@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,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FlowViewer — Stripped-down, read-only React Flow canvas for embedding in docs.
|
|
3
|
+
*
|
|
4
|
+
* Renders a flow from static data with:
|
|
5
|
+
* - Nodes and edges on a React Flow canvas
|
|
6
|
+
* - Double-click a node to open its config panel (read-only)
|
|
7
|
+
* - Agent node tool display
|
|
8
|
+
* - No sidebar, toolbar, run controls, chat, or mutations
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { FlowViewer } from '@invect/ui/demo';
|
|
13
|
+
* import '@invect/ui/styles';
|
|
14
|
+
*
|
|
15
|
+
* <FlowViewer
|
|
16
|
+
* nodes={[
|
|
17
|
+
* { id: '1', type: 'core.input', position: { x: 0, y: 0 },
|
|
18
|
+
* data: { id: '1', type: 'core.input', display_name: 'Input', reference_id: 'input', status: 'default', params: {} } },
|
|
19
|
+
* { id: '2', type: 'core.model', position: { x: 300, y: 0 },
|
|
20
|
+
* data: { id: '2', type: 'core.model', display_name: 'GPT-4', reference_id: 'gpt4', status: 'default', params: {} } },
|
|
21
|
+
* ]}
|
|
22
|
+
* edges={[{ id: 'e1-2', source: '1', target: '2' }]}
|
|
23
|
+
* nodeDefinitions={[...]}
|
|
24
|
+
* theme="dark"
|
|
25
|
+
* style={{ height: 500 }}
|
|
26
|
+
* />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import React, { useMemo, useCallback, useRef, useState, useEffect } from 'react';
|
|
31
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
32
|
+
import {
|
|
33
|
+
ReactFlow,
|
|
34
|
+
ReactFlowProvider,
|
|
35
|
+
Controls,
|
|
36
|
+
Background,
|
|
37
|
+
BackgroundVariant,
|
|
38
|
+
type Node,
|
|
39
|
+
type Edge,
|
|
40
|
+
type NodeTypes,
|
|
41
|
+
type EdgeTypes,
|
|
42
|
+
} from '@xyflow/react';
|
|
43
|
+
import { GraphNodeType } from '@invect/core/types';
|
|
44
|
+
import { ThemeProvider, useTheme } from '../contexts/ThemeProvider';
|
|
45
|
+
import { ApiProvider } from '../contexts/ApiContext';
|
|
46
|
+
import { NodeRegistryProvider } from '../contexts/NodeRegistryContext';
|
|
47
|
+
import { PluginRegistryProvider } from '../contexts/PluginRegistryContext';
|
|
48
|
+
import { ValidationProvider } from '../contexts/ValidationContext';
|
|
49
|
+
import { UniversalNode, AgentNode, type ToolDefinition } from '../components/nodes';
|
|
50
|
+
import { BatchFlowEdge, defaultEdgeOptions } from '../components/graph';
|
|
51
|
+
import {
|
|
52
|
+
AgentToolCallbacksProvider,
|
|
53
|
+
type AgentToolCallbacks,
|
|
54
|
+
} from '../contexts/AgentToolCallbacksContext';
|
|
55
|
+
import { NodeConfigPanel } from '../components/flow-editor/node-config-panel/NodeConfigPanel';
|
|
56
|
+
import { useFlowEditorStore } from '../components/flow-editor/flow-editor.store';
|
|
57
|
+
import type { NodeDefinition } from '../types/node-definition.types';
|
|
58
|
+
import type { ReactFlowNodeData, AgentToolDefinition } from '@invect/core/types';
|
|
59
|
+
import { createDemoApiClient } from './demo-api-client';
|
|
60
|
+
import type { ApiClient } from '../api/client';
|
|
61
|
+
import '../app.css';
|
|
62
|
+
|
|
63
|
+
const EDGE_TYPES: EdgeTypes = {
|
|
64
|
+
default: BatchFlowEdge,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const FIT_VIEW_OPTIONS = {
|
|
68
|
+
duration: 0,
|
|
69
|
+
padding: 0.2,
|
|
70
|
+
} as const;
|
|
71
|
+
|
|
72
|
+
export interface FlowViewerProps {
|
|
73
|
+
/** React Flow nodes to render */
|
|
74
|
+
nodes: Node<ReactFlowNodeData>[];
|
|
75
|
+
/** React Flow edges to render */
|
|
76
|
+
edges: Edge[];
|
|
77
|
+
/** Node definitions for rendering and config panel */
|
|
78
|
+
nodeDefinitions?: NodeDefinition[];
|
|
79
|
+
/** Agent tool definitions (shown on agent nodes) */
|
|
80
|
+
agentTools?: AgentToolDefinition[];
|
|
81
|
+
/** Theme mode */
|
|
82
|
+
theme?: 'light' | 'dark' | 'system';
|
|
83
|
+
/** Allow double-click to open the node config panel */
|
|
84
|
+
interactive?: boolean;
|
|
85
|
+
/** Show React Flow controls (zoom, fit) */
|
|
86
|
+
showControls?: boolean;
|
|
87
|
+
/** CSS class name for the outer container */
|
|
88
|
+
className?: string;
|
|
89
|
+
/** Inline styles for the outer container */
|
|
90
|
+
style?: React.CSSProperties;
|
|
91
|
+
/** Additional class for the outer container */
|
|
92
|
+
containerClassName?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// No-op for read-only tool callbacks
|
|
96
|
+
const toolNoop = () => {
|
|
97
|
+
// intentionally empty — viewer is read-only
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/** Internal canvas component — must be inside ReactFlowProvider */
|
|
101
|
+
function FlowViewerCanvas({
|
|
102
|
+
nodes,
|
|
103
|
+
edges,
|
|
104
|
+
nodeDefinitions = [],
|
|
105
|
+
agentTools = [],
|
|
106
|
+
interactive = true,
|
|
107
|
+
showControls = true,
|
|
108
|
+
}: Omit<FlowViewerProps, 'theme' | 'className' | 'style' | 'containerClassName'>) {
|
|
109
|
+
const { resolvedTheme } = useTheme();
|
|
110
|
+
const dialogContainerRef = useRef<HTMLDivElement | null>(null);
|
|
111
|
+
|
|
112
|
+
// Config panel state
|
|
113
|
+
const [configPanelOpen, setConfigPanelOpen] = useState(false);
|
|
114
|
+
const [selectedNodeId, setSelectedNodeId] = useState<string | null>(null);
|
|
115
|
+
|
|
116
|
+
// Sync nodes into Zustand store so NodeConfigPanel can read them
|
|
117
|
+
const syncFromServer = useFlowEditorStore((s) => s.syncFromServer);
|
|
118
|
+
const setFlowId = useFlowEditorStore((s) => s.setFlowId);
|
|
119
|
+
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
setFlowId('demo-flow', undefined);
|
|
122
|
+
syncFromServer(nodes, edges, 'demo-flow:1', 'Demo Flow');
|
|
123
|
+
}, [nodes, edges, syncFromServer, setFlowId]);
|
|
124
|
+
|
|
125
|
+
// Build nodeTypes mapping from definitions
|
|
126
|
+
const nodeTypes: NodeTypes = useMemo(() => {
|
|
127
|
+
// eslint-disable-next-line typescript/no-explicit-any
|
|
128
|
+
const mapping: Record<string, React.ComponentType<any>> = {
|
|
129
|
+
[GraphNodeType.AGENT]: AgentNode,
|
|
130
|
+
default: UniversalNode,
|
|
131
|
+
};
|
|
132
|
+
for (const def of nodeDefinitions) {
|
|
133
|
+
if (!(def.type in mapping)) {
|
|
134
|
+
mapping[def.type] = UniversalNode;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return mapping;
|
|
138
|
+
}, [nodeDefinitions]);
|
|
139
|
+
|
|
140
|
+
// Transform agent tools for context
|
|
141
|
+
const availableTools: ToolDefinition[] = useMemo(
|
|
142
|
+
() =>
|
|
143
|
+
agentTools
|
|
144
|
+
.filter((tool) => tool.provider?.id !== 'triggers' && !tool.id.startsWith('trigger.'))
|
|
145
|
+
.map((tool) => ({
|
|
146
|
+
id: tool.id,
|
|
147
|
+
name: tool.name,
|
|
148
|
+
description: tool.description,
|
|
149
|
+
category: tool.category as ToolDefinition['category'],
|
|
150
|
+
tags: tool.tags,
|
|
151
|
+
inputSchema: tool.inputSchema,
|
|
152
|
+
nodeType: tool.nodeType,
|
|
153
|
+
provider: tool.provider,
|
|
154
|
+
})),
|
|
155
|
+
[agentTools],
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// Agent tool callbacks (read-only — no mutations in viewer mode)
|
|
159
|
+
const agentToolCallbacks = useMemo<AgentToolCallbacks>(
|
|
160
|
+
() => ({
|
|
161
|
+
onOpenToolSelector: toolNoop,
|
|
162
|
+
onShowMoreTools: toolNoop,
|
|
163
|
+
onRemoveTool: toolNoop,
|
|
164
|
+
onToolClick: toolNoop,
|
|
165
|
+
availableTools,
|
|
166
|
+
selectedToolNodeId: null,
|
|
167
|
+
selectedToolInstanceId: null,
|
|
168
|
+
}),
|
|
169
|
+
[availableTools],
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
const handleNodeDoubleClick = useCallback(
|
|
173
|
+
(_event: React.MouseEvent, clickedNode: Node) => {
|
|
174
|
+
if (!interactive) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
setSelectedNodeId(clickedNode.id);
|
|
178
|
+
setConfigPanelOpen(true);
|
|
179
|
+
},
|
|
180
|
+
[interactive],
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
const handlePanelOpenChange = useCallback((open: boolean) => {
|
|
184
|
+
if (!open) {
|
|
185
|
+
setConfigPanelOpen(false);
|
|
186
|
+
setSelectedNodeId(null);
|
|
187
|
+
}
|
|
188
|
+
}, []);
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<div
|
|
192
|
+
ref={dialogContainerRef}
|
|
193
|
+
style={{ width: '100%', height: '100%', background: 'var(--canvas-background)' }}
|
|
194
|
+
>
|
|
195
|
+
<AgentToolCallbacksProvider value={agentToolCallbacks}>
|
|
196
|
+
<ReactFlow
|
|
197
|
+
nodes={nodes}
|
|
198
|
+
edges={edges}
|
|
199
|
+
nodeTypes={nodeTypes}
|
|
200
|
+
edgeTypes={EDGE_TYPES}
|
|
201
|
+
defaultEdgeOptions={defaultEdgeOptions}
|
|
202
|
+
colorMode={resolvedTheme}
|
|
203
|
+
fitView
|
|
204
|
+
fitViewOptions={FIT_VIEW_OPTIONS}
|
|
205
|
+
onNodeDoubleClick={interactive ? handleNodeDoubleClick : undefined}
|
|
206
|
+
nodesDraggable={false}
|
|
207
|
+
nodesConnectable={false}
|
|
208
|
+
elementsSelectable={interactive}
|
|
209
|
+
panOnScroll
|
|
210
|
+
panOnDrag
|
|
211
|
+
zoomOnScroll
|
|
212
|
+
zoomOnPinch
|
|
213
|
+
zoomOnDoubleClick={false}
|
|
214
|
+
>
|
|
215
|
+
{showControls && <Controls />}
|
|
216
|
+
<Background variant={BackgroundVariant.Dots} gap={20} size={1.2} />
|
|
217
|
+
</ReactFlow>
|
|
218
|
+
</AgentToolCallbacksProvider>
|
|
219
|
+
|
|
220
|
+
{interactive && (
|
|
221
|
+
<NodeConfigPanel
|
|
222
|
+
open={configPanelOpen}
|
|
223
|
+
nodeId={selectedNodeId}
|
|
224
|
+
flowId="demo-flow"
|
|
225
|
+
onOpenChange={handlePanelOpenChange}
|
|
226
|
+
portalContainer={dialogContainerRef.current}
|
|
227
|
+
availableTools={availableTools}
|
|
228
|
+
/>
|
|
229
|
+
)}
|
|
230
|
+
</div>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Self-contained flow viewer with all necessary providers.
|
|
236
|
+
* Renders React Flow canvas with Invect node styling.
|
|
237
|
+
*/
|
|
238
|
+
export function FlowViewer({
|
|
239
|
+
theme = 'dark',
|
|
240
|
+
className,
|
|
241
|
+
style,
|
|
242
|
+
containerClassName,
|
|
243
|
+
nodeDefinitions = [],
|
|
244
|
+
agentTools = [],
|
|
245
|
+
...canvasProps
|
|
246
|
+
}: FlowViewerProps) {
|
|
247
|
+
// Create a stable QueryClient for the viewer
|
|
248
|
+
const queryClient = useMemo(
|
|
249
|
+
() =>
|
|
250
|
+
new QueryClient({
|
|
251
|
+
defaultOptions: {
|
|
252
|
+
queries: { staleTime: Infinity, retry: false },
|
|
253
|
+
},
|
|
254
|
+
}),
|
|
255
|
+
[],
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
// Create mock API client with the node definitions and agent tools
|
|
259
|
+
const mockClient = useMemo(
|
|
260
|
+
() =>
|
|
261
|
+
createDemoApiClient({
|
|
262
|
+
nodeDefinitions,
|
|
263
|
+
agentTools,
|
|
264
|
+
}) as unknown as ApiClient,
|
|
265
|
+
[nodeDefinitions, agentTools],
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
return (
|
|
269
|
+
<div
|
|
270
|
+
className={containerClassName}
|
|
271
|
+
style={{ position: 'relative', overflow: 'hidden', ...style }}
|
|
272
|
+
>
|
|
273
|
+
<ThemeProvider defaultTheme={theme} storageKey="invect-viewer-theme" className={className}>
|
|
274
|
+
<QueryClientProvider client={queryClient}>
|
|
275
|
+
<ApiProvider apiClient={mockClient}>
|
|
276
|
+
<PluginRegistryProvider plugins={[]}>
|
|
277
|
+
<ValidationProvider>
|
|
278
|
+
<NodeRegistryProvider>
|
|
279
|
+
<ReactFlowProvider>
|
|
280
|
+
<FlowViewerCanvas
|
|
281
|
+
nodeDefinitions={nodeDefinitions}
|
|
282
|
+
agentTools={agentTools}
|
|
283
|
+
{...canvasProps}
|
|
284
|
+
/>
|
|
285
|
+
</ReactFlowProvider>
|
|
286
|
+
</NodeRegistryProvider>
|
|
287
|
+
</ValidationProvider>
|
|
288
|
+
</PluginRegistryProvider>
|
|
289
|
+
</ApiProvider>
|
|
290
|
+
</QueryClientProvider>
|
|
291
|
+
</ThemeProvider>
|
|
292
|
+
</div>
|
|
293
|
+
);
|
|
294
|
+
}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DemoApiClient — A mock ApiClient that returns static data for frontend-only demos.
|
|
3
|
+
*
|
|
4
|
+
* Uses a Proxy to intercept all method calls. Methods that have registered mock
|
|
5
|
+
* data return it; all others return safe empty defaults (empty arrays, empty objects).
|
|
6
|
+
* Write operations (create, update, delete, execute) are silently no-ops.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
Flow,
|
|
11
|
+
FlowRun,
|
|
12
|
+
NodeExecution,
|
|
13
|
+
Credential,
|
|
14
|
+
ReactFlowData,
|
|
15
|
+
PaginatedResponse,
|
|
16
|
+
DashboardStats,
|
|
17
|
+
AgentToolDefinition,
|
|
18
|
+
NodeDefinition,
|
|
19
|
+
} from '../api/types';
|
|
20
|
+
|
|
21
|
+
export interface DemoData {
|
|
22
|
+
/** Flows to show on the dashboard */
|
|
23
|
+
flows?: Flow[];
|
|
24
|
+
/** Map of flowId → ReactFlowData for the flow editor canvas */
|
|
25
|
+
flowReactFlowData?: Record<string, ReactFlowData>;
|
|
26
|
+
/** Node definitions for the palette and registry */
|
|
27
|
+
nodeDefinitions?: NodeDefinition[];
|
|
28
|
+
/** Agent tool definitions */
|
|
29
|
+
agentTools?: AgentToolDefinition[];
|
|
30
|
+
/** Dashboard stats override */
|
|
31
|
+
dashboardStats?: Partial<DashboardStats>;
|
|
32
|
+
/** Flow runs (execution history) */
|
|
33
|
+
flowRuns?: FlowRun[];
|
|
34
|
+
/** Node executions keyed by flowRunId */
|
|
35
|
+
nodeExecutions?: Record<string, NodeExecution[]>;
|
|
36
|
+
/** Credentials */
|
|
37
|
+
credentials?: Credential[];
|
|
38
|
+
/** Chat messages keyed by flowId */
|
|
39
|
+
chatMessages?: Record<
|
|
40
|
+
string,
|
|
41
|
+
Array<{
|
|
42
|
+
id: string;
|
|
43
|
+
flowId: string;
|
|
44
|
+
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
45
|
+
content: string;
|
|
46
|
+
toolMeta?: Record<string, unknown> | null;
|
|
47
|
+
createdAt: string;
|
|
48
|
+
}>
|
|
49
|
+
>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const EMPTY_PAGINATED = <T>(items: T[] = []): PaginatedResponse<T> => ({
|
|
53
|
+
data: items,
|
|
54
|
+
pagination: {
|
|
55
|
+
page: 1,
|
|
56
|
+
limit: items.length || 20,
|
|
57
|
+
totalPages: 1,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const DEFAULT_STATS: DashboardStats = {
|
|
62
|
+
totalFlows: 0,
|
|
63
|
+
totalRuns: 0,
|
|
64
|
+
runsLast24h: 0,
|
|
65
|
+
activeRuns: 0,
|
|
66
|
+
successRate: 100,
|
|
67
|
+
failedRunsLast24h: 0,
|
|
68
|
+
runsByStatus: {},
|
|
69
|
+
recentRuns: [],
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// No-op function to satisfy lint rules about empty functions
|
|
73
|
+
const noop = () => {
|
|
74
|
+
// intentionally empty — demo mock
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Creates a mock API client backed entirely by static data.
|
|
79
|
+
* No HTTP requests are ever made.
|
|
80
|
+
*/
|
|
81
|
+
export function createDemoApiClient(data: DemoData = {}): Record<string, unknown> {
|
|
82
|
+
const {
|
|
83
|
+
flows = [],
|
|
84
|
+
flowReactFlowData = {},
|
|
85
|
+
nodeDefinitions = [],
|
|
86
|
+
agentTools = [],
|
|
87
|
+
dashboardStats = {},
|
|
88
|
+
flowRuns = [],
|
|
89
|
+
nodeExecutions = {},
|
|
90
|
+
credentials = [],
|
|
91
|
+
chatMessages = {},
|
|
92
|
+
} = data;
|
|
93
|
+
|
|
94
|
+
const stats: DashboardStats = {
|
|
95
|
+
...DEFAULT_STATS,
|
|
96
|
+
totalFlows: flows.length,
|
|
97
|
+
totalRuns: flowRuns.length,
|
|
98
|
+
runsLast24h: flowRuns.length,
|
|
99
|
+
successRate:
|
|
100
|
+
flowRuns.length > 0
|
|
101
|
+
? Math.round(
|
|
102
|
+
(flowRuns.filter((r) => r.status === 'SUCCESS').length / flowRuns.length) * 100,
|
|
103
|
+
)
|
|
104
|
+
: 100,
|
|
105
|
+
runsByStatus: flowRuns.reduce(
|
|
106
|
+
(acc, r) => {
|
|
107
|
+
acc[r.status] = (acc[r.status] || 0) + 1;
|
|
108
|
+
return acc;
|
|
109
|
+
},
|
|
110
|
+
{} as Record<string, number>,
|
|
111
|
+
),
|
|
112
|
+
recentRuns: flowRuns.slice(0, 10),
|
|
113
|
+
...dashboardStats,
|
|
114
|
+
} as DashboardStats;
|
|
115
|
+
|
|
116
|
+
// Method implementations for read operations
|
|
117
|
+
const methods: Record<string, (...args: unknown[]) => unknown> = {
|
|
118
|
+
// Identity
|
|
119
|
+
getBaseURL: () => 'demo://mock',
|
|
120
|
+
setBaseURL: noop,
|
|
121
|
+
setUserId: noop,
|
|
122
|
+
|
|
123
|
+
// Dashboard
|
|
124
|
+
getDashboardStats: async () => stats,
|
|
125
|
+
|
|
126
|
+
// Flows
|
|
127
|
+
getFlows: async () => EMPTY_PAGINATED(flows),
|
|
128
|
+
getFlow: async (...args: unknown[]) => {
|
|
129
|
+
const id = args[0] as string;
|
|
130
|
+
return flows.find((f) => f.id === id) ?? flows[0] ?? null;
|
|
131
|
+
},
|
|
132
|
+
getFlowReactFlowData: async (...args: unknown[]) => {
|
|
133
|
+
const flowId = args[0] as string;
|
|
134
|
+
return flowReactFlowData[flowId] ?? null;
|
|
135
|
+
},
|
|
136
|
+
getFlowVersions: async () => EMPTY_PAGINATED([]),
|
|
137
|
+
|
|
138
|
+
// Nodes
|
|
139
|
+
getAvailableNodes: async () => nodeDefinitions,
|
|
140
|
+
resolveNodeDefinition: async () => null,
|
|
141
|
+
loadFieldOptions: async () => [],
|
|
142
|
+
|
|
143
|
+
// Agent tools
|
|
144
|
+
getAgentTools: async () => agentTools,
|
|
145
|
+
|
|
146
|
+
// Credentials
|
|
147
|
+
listCredentials: async () => credentials,
|
|
148
|
+
getCredential: async (...args: unknown[]) => {
|
|
149
|
+
const id = args[0] as string;
|
|
150
|
+
return credentials.find((c) => c.id === id) ?? null;
|
|
151
|
+
},
|
|
152
|
+
getCredentialUsage: async () => ({ flowsCount: 0, nodesCount: 0, lastUsedAt: null }),
|
|
153
|
+
|
|
154
|
+
// OAuth2 (empty)
|
|
155
|
+
getOAuth2Providers: async () => [],
|
|
156
|
+
getOAuth2Provider: async () => null,
|
|
157
|
+
|
|
158
|
+
// Flow runs
|
|
159
|
+
getFlowRun: async (...args: unknown[]) => {
|
|
160
|
+
const id = args[0] as string;
|
|
161
|
+
return flowRuns.find((r) => r.id === id) ?? null;
|
|
162
|
+
},
|
|
163
|
+
getFlowRunsByFlowId: async (...args: unknown[]) => {
|
|
164
|
+
const flowId = args[0] as string;
|
|
165
|
+
const matching = flowRuns.filter((r) => r.flowId === flowId);
|
|
166
|
+
return EMPTY_PAGINATED(matching);
|
|
167
|
+
},
|
|
168
|
+
getAllFlowRuns: async () => EMPTY_PAGINATED(flowRuns),
|
|
169
|
+
|
|
170
|
+
// Node executions
|
|
171
|
+
getNodeExecutionsByFlowRun: async (...args: unknown[]) => {
|
|
172
|
+
const flowRunId = args[0] as string;
|
|
173
|
+
return nodeExecutions[flowRunId] ?? [];
|
|
174
|
+
},
|
|
175
|
+
getAllNodeExecutions: async () => {
|
|
176
|
+
const all = Object.values(nodeExecutions).flat();
|
|
177
|
+
return EMPTY_PAGINATED(all);
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
// Models (empty)
|
|
181
|
+
getModels: async () => [],
|
|
182
|
+
getModelsForCredential: async () => [],
|
|
183
|
+
|
|
184
|
+
// Databases
|
|
185
|
+
getAvailableDatabases: async () => [],
|
|
186
|
+
|
|
187
|
+
// Triggers (empty)
|
|
188
|
+
listTriggersForFlow: async () => [],
|
|
189
|
+
getTrigger: async () => null,
|
|
190
|
+
|
|
191
|
+
// Chat
|
|
192
|
+
getChatStatus: async () => ({ enabled: true }),
|
|
193
|
+
getChatModels: async () => [
|
|
194
|
+
{ id: 'claude-sonnet-4-20250514', name: 'Claude Sonnet 4', provider: 'anthropic' },
|
|
195
|
+
{ id: 'gpt-4o', name: 'GPT-4o', provider: 'openai' },
|
|
196
|
+
],
|
|
197
|
+
getChatMessages: async (...args: unknown[]) => {
|
|
198
|
+
const flowId = args[0] as string;
|
|
199
|
+
return chatMessages[flowId] ?? [];
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
// === Write operations (all no-ops for demo) ===
|
|
203
|
+
createFlow: async () => flows[0] ?? {},
|
|
204
|
+
createFlowWithVersion: async () => flows[0] ?? {},
|
|
205
|
+
updateFlow: async () => flows[0] ?? {},
|
|
206
|
+
deleteFlow: async () => undefined,
|
|
207
|
+
createFlowVersion: async () => ({}),
|
|
208
|
+
validateFlow: async () => ({ isValid: true, errors: [], warnings: [] }),
|
|
209
|
+
executeFlow: async () => ({}),
|
|
210
|
+
executeFlowToNode: async () => ({}),
|
|
211
|
+
testNode: async () => ({}),
|
|
212
|
+
testModelPrompt: async () => ({}),
|
|
213
|
+
testJsExpression: async () => ({}),
|
|
214
|
+
testMapper: async () => ({}),
|
|
215
|
+
executeSqlQuery: async () => ({}),
|
|
216
|
+
createCredential: async () => ({}),
|
|
217
|
+
updateCredential: async () => ({}),
|
|
218
|
+
deleteCredential: async () => undefined,
|
|
219
|
+
testCredential: async () => ({ success: true }),
|
|
220
|
+
testCredentialRequest: async () => ({}),
|
|
221
|
+
startOAuth2Flow: async () => ({}),
|
|
222
|
+
handleOAuth2Callback: async () => ({}),
|
|
223
|
+
refreshOAuth2Credential: async () => ({}),
|
|
224
|
+
pauseFlowRun: async () => ({}),
|
|
225
|
+
resumeFlowRun: async () => ({}),
|
|
226
|
+
cancelFlowRun: async () => ({}),
|
|
227
|
+
createTrigger: async () => ({}),
|
|
228
|
+
updateTrigger: async () => ({}),
|
|
229
|
+
deleteTrigger: async () => undefined,
|
|
230
|
+
syncTriggersForFlow: async () => ({}),
|
|
231
|
+
sendChatMessage: async () => ({}),
|
|
232
|
+
saveChatMessages: async () => ({}),
|
|
233
|
+
deleteChatMessages: async () => ({}),
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// Proxy catches any method not explicitly listed above and returns a safe fallback
|
|
237
|
+
return new Proxy(methods, {
|
|
238
|
+
get(target, prop: string) {
|
|
239
|
+
if (prop in target) {
|
|
240
|
+
return target[prop];
|
|
241
|
+
}
|
|
242
|
+
// Unknown method — return async no-op
|
|
243
|
+
return async () => null;
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Demo / preview components for embedding Invect UI without a backend.
|
|
2
|
+
//
|
|
3
|
+
// These components are designed for documentation, marketing pages,
|
|
4
|
+
// and interactive previews where no Invect server is available.
|
|
5
|
+
|
|
6
|
+
export { DemoInvect, type DemoInvectProps } from './DemoInvect';
|
|
7
|
+
export { FlowViewer, type FlowViewerProps } from './FlowViewer';
|
|
8
|
+
export { createDemoApiClient, type DemoData } from './demo-api-client';
|
|
9
|
+
export {
|
|
10
|
+
sampleNodeDefinitions,
|
|
11
|
+
simpleFlowNodes,
|
|
12
|
+
simpleFlowEdges,
|
|
13
|
+
branchingFlowNodes,
|
|
14
|
+
branchingFlowEdges,
|
|
15
|
+
showcaseFlowNodes,
|
|
16
|
+
showcaseFlowEdges,
|
|
17
|
+
showcaseAgentTools,
|
|
18
|
+
sampleDemoData,
|
|
19
|
+
} from './sample-data';
|
|
20
|
+
|
|
21
|
+
// Re-export types commonly needed when constructing demo data
|
|
22
|
+
export type { NodeDefinition } from '../types/node-definition.types';
|
|
23
|
+
export type {
|
|
24
|
+
ReactFlowNodeData,
|
|
25
|
+
ReactFlowNode,
|
|
26
|
+
ReactFlowEdge,
|
|
27
|
+
AgentToolDefinition,
|
|
28
|
+
} from '@invect/core/types';
|