@flowdrop/flowdrop 1.0.0
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 +252 -0
- package/dist/adapters/WorkflowAdapter.d.ts +167 -0
- package/dist/adapters/WorkflowAdapter.js +368 -0
- package/dist/adapters/agentspec/AgentSpecAdapter.d.ts +96 -0
- package/dist/adapters/agentspec/AgentSpecAdapter.js +626 -0
- package/dist/adapters/agentspec/agentAdapter.d.ts +59 -0
- package/dist/adapters/agentspec/agentAdapter.js +91 -0
- package/dist/adapters/agentspec/autoLayout.d.ts +34 -0
- package/dist/adapters/agentspec/autoLayout.js +127 -0
- package/dist/adapters/agentspec/componentTypeDefaults.d.ts +73 -0
- package/dist/adapters/agentspec/componentTypeDefaults.js +238 -0
- package/dist/adapters/agentspec/defaultNodeTypes.d.ts +53 -0
- package/dist/adapters/agentspec/defaultNodeTypes.js +561 -0
- package/dist/adapters/agentspec/index.d.ts +37 -0
- package/dist/adapters/agentspec/index.js +39 -0
- package/dist/adapters/agentspec/validator.d.ts +34 -0
- package/dist/adapters/agentspec/validator.js +169 -0
- package/dist/api/enhanced-client.d.ts +183 -0
- package/dist/api/enhanced-client.js +430 -0
- package/dist/components/App.svelte +981 -0
- package/dist/components/App.svelte.d.ts +54 -0
- package/dist/components/CanvasBanner.stories.svelte +29 -0
- package/dist/components/CanvasBanner.stories.svelte.d.ts +27 -0
- package/dist/components/CanvasBanner.svelte +57 -0
- package/dist/components/CanvasBanner.svelte.d.ts +8 -0
- package/dist/components/ConfigForm.svelte +1138 -0
- package/dist/components/ConfigForm.svelte.d.ts +44 -0
- package/dist/components/ConfigModal.svelte +188 -0
- package/dist/components/ConfigModal.svelte.d.ts +13 -0
- package/dist/components/ConfigPanel.stories.svelte +47 -0
- package/dist/components/ConfigPanel.stories.svelte.d.ts +27 -0
- package/dist/components/ConfigPanel.svelte +182 -0
- package/dist/components/ConfigPanel.svelte.d.ts +32 -0
- package/dist/components/ConnectionLine.svelte +32 -0
- package/dist/components/ConnectionLine.svelte.d.ts +3 -0
- package/dist/components/EdgeRefresher.svelte +41 -0
- package/dist/components/EdgeRefresher.svelte.d.ts +9 -0
- package/dist/components/FlowDropZone.svelte +83 -0
- package/dist/components/FlowDropZone.svelte.d.ts +13 -0
- package/dist/components/LoadingSpinner.stories.svelte +30 -0
- package/dist/components/LoadingSpinner.stories.svelte.d.ts +27 -0
- package/dist/components/LoadingSpinner.svelte +36 -0
- package/dist/components/LoadingSpinner.svelte.d.ts +8 -0
- package/dist/components/Logo.stories.svelte +22 -0
- package/dist/components/Logo.stories.svelte.d.ts +27 -0
- package/dist/components/Logo.svelte +102 -0
- package/dist/components/Logo.svelte.d.ts +26 -0
- package/dist/components/LogsSidebar.svelte +563 -0
- package/dist/components/LogsSidebar.svelte.d.ts +17 -0
- package/dist/components/MarkdownDisplay.stories.svelte +36 -0
- package/dist/components/MarkdownDisplay.stories.svelte.d.ts +27 -0
- package/dist/components/MarkdownDisplay.svelte +29 -0
- package/dist/components/MarkdownDisplay.svelte.d.ts +7 -0
- package/dist/components/Navbar.stories.svelte +53 -0
- package/dist/components/Navbar.stories.svelte.d.ts +27 -0
- package/dist/components/Navbar.svelte +726 -0
- package/dist/components/Navbar.svelte.d.ts +29 -0
- package/dist/components/NodeSidebar.svelte +762 -0
- package/dist/components/NodeSidebar.svelte.d.ts +9 -0
- package/dist/components/NodeStatusOverlay.stories.svelte +85 -0
- package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +27 -0
- package/dist/components/NodeStatusOverlay.svelte +327 -0
- package/dist/components/NodeStatusOverlay.svelte.d.ts +11 -0
- package/dist/components/PipelineStatus.svelte +314 -0
- package/dist/components/PipelineStatus.svelte.d.ts +20 -0
- package/dist/components/PortCoordinateTracker.svelte +58 -0
- package/dist/components/PortCoordinateTracker.svelte.d.ts +12 -0
- package/dist/components/ReadOnlyDetails.svelte +170 -0
- package/dist/components/ReadOnlyDetails.svelte.d.ts +25 -0
- package/dist/components/SchemaForm.stories.svelte +116 -0
- package/dist/components/SchemaForm.stories.svelte.d.ts +27 -0
- package/dist/components/SchemaForm.svelte +536 -0
- package/dist/components/SchemaForm.svelte.d.ts +83 -0
- package/dist/components/SettingsModal.svelte +279 -0
- package/dist/components/SettingsModal.svelte.d.ts +23 -0
- package/dist/components/SettingsPanel.svelte +638 -0
- package/dist/components/SettingsPanel.svelte.d.ts +21 -0
- package/dist/components/StatusIcon.stories.svelte +60 -0
- package/dist/components/StatusIcon.stories.svelte.d.ts +27 -0
- package/dist/components/StatusIcon.svelte +119 -0
- package/dist/components/StatusIcon.svelte.d.ts +10 -0
- package/dist/components/StatusLabel.stories.svelte +17 -0
- package/dist/components/StatusLabel.stories.svelte.d.ts +27 -0
- package/dist/components/StatusLabel.svelte +33 -0
- package/dist/components/StatusLabel.svelte.d.ts +7 -0
- package/dist/components/ThemeToggle.stories.svelte +25 -0
- package/dist/components/ThemeToggle.stories.svelte.d.ts +27 -0
- package/dist/components/ThemeToggle.svelte +185 -0
- package/dist/components/ThemeToggle.svelte.d.ts +14 -0
- package/dist/components/UniversalNode.svelte +155 -0
- package/dist/components/UniversalNode.svelte.d.ts +15 -0
- package/dist/components/WorkflowEditor.svelte +1035 -0
- package/dist/components/WorkflowEditor.svelte.d.ts +23 -0
- package/dist/components/form/FormArray.svelte +1049 -0
- package/dist/components/form/FormArray.svelte.d.ts +22 -0
- package/dist/components/form/FormAutocomplete.svelte +1009 -0
- package/dist/components/form/FormAutocomplete.svelte.d.ts +25 -0
- package/dist/components/form/FormCheckboxGroup.stories.svelte +28 -0
- package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormCheckboxGroup.svelte +155 -0
- package/dist/components/form/FormCheckboxGroup.svelte.d.ts +17 -0
- package/dist/components/form/FormCodeEditor.svelte +458 -0
- package/dist/components/form/FormCodeEditor.svelte.d.ts +25 -0
- package/dist/components/form/FormField.svelte +417 -0
- package/dist/components/form/FormField.svelte.d.ts +29 -0
- package/dist/components/form/FormFieldLight.svelte +425 -0
- package/dist/components/form/FormFieldLight.svelte.d.ts +18 -0
- package/dist/components/form/FormFieldWrapper.stories.svelte +53 -0
- package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormFieldWrapper.svelte +125 -0
- package/dist/components/form/FormFieldWrapper.svelte.d.ts +18 -0
- package/dist/components/form/FormFieldset.svelte +142 -0
- package/dist/components/form/FormFieldset.svelte.d.ts +11 -0
- package/dist/components/form/FormMarkdownEditor.svelte +752 -0
- package/dist/components/form/FormMarkdownEditor.svelte.d.ts +33 -0
- package/dist/components/form/FormNumberField.stories.svelte +36 -0
- package/dist/components/form/FormNumberField.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormNumberField.svelte +112 -0
- package/dist/components/form/FormNumberField.svelte.d.ts +25 -0
- package/dist/components/form/FormRangeField.stories.svelte +31 -0
- package/dist/components/form/FormRangeField.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormRangeField.svelte +246 -0
- package/dist/components/form/FormRangeField.svelte.d.ts +23 -0
- package/dist/components/form/FormSelect.stories.svelte +50 -0
- package/dist/components/form/FormSelect.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormSelect.svelte +129 -0
- package/dist/components/form/FormSelect.svelte.d.ts +20 -0
- package/dist/components/form/FormTemplateEditor.svelte +825 -0
- package/dist/components/form/FormTemplateEditor.svelte.d.ts +41 -0
- package/dist/components/form/FormTextField.stories.svelte +30 -0
- package/dist/components/form/FormTextField.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormTextField.svelte +91 -0
- package/dist/components/form/FormTextField.svelte.d.ts +19 -0
- package/dist/components/form/FormTextarea.stories.svelte +34 -0
- package/dist/components/form/FormTextarea.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormTextarea.svelte +97 -0
- package/dist/components/form/FormTextarea.svelte.d.ts +21 -0
- package/dist/components/form/FormToggle.stories.svelte +30 -0
- package/dist/components/form/FormToggle.stories.svelte.d.ts +27 -0
- package/dist/components/form/FormToggle.svelte +126 -0
- package/dist/components/form/FormToggle.svelte.d.ts +19 -0
- package/dist/components/form/FormUISchemaRenderer.svelte +136 -0
- package/dist/components/form/FormUISchemaRenderer.svelte.d.ts +32 -0
- package/dist/components/form/index.d.ts +50 -0
- package/dist/components/form/index.js +54 -0
- package/dist/components/form/templateAutocomplete.d.ts +29 -0
- package/dist/components/form/templateAutocomplete.js +254 -0
- package/dist/components/form/types.d.ts +485 -0
- package/dist/components/form/types.js +73 -0
- package/dist/components/interrupt/ChoicePrompt.stories.svelte +52 -0
- package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/ChoicePrompt.svelte +401 -0
- package/dist/components/interrupt/ChoicePrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +71 -0
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/ConfirmationPrompt.svelte +292 -0
- package/dist/components/interrupt/ConfirmationPrompt.svelte.d.ts +25 -0
- package/dist/components/interrupt/FormPrompt.svelte +236 -0
- package/dist/components/interrupt/FormPrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/InterruptBubble.svelte +601 -0
- package/dist/components/interrupt/InterruptBubble.svelte.d.ts +16 -0
- package/dist/components/interrupt/ReviewPrompt.stories.svelte +67 -0
- package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/ReviewPrompt.svelte +861 -0
- package/dist/components/interrupt/ReviewPrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/TextInputPrompt.stories.svelte +47 -0
- package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +27 -0
- package/dist/components/interrupt/TextInputPrompt.svelte +346 -0
- package/dist/components/interrupt/TextInputPrompt.svelte.d.ts +23 -0
- package/dist/components/interrupt/index.d.ts +13 -0
- package/dist/components/interrupt/index.js +15 -0
- package/dist/components/layouts/MainLayout.svelte +718 -0
- package/dist/components/layouts/MainLayout.svelte.d.ts +62 -0
- package/dist/components/nodes/GatewayNode.stories.svelte +108 -0
- package/dist/components/nodes/GatewayNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/GatewayNode.svelte +591 -0
- package/dist/components/nodes/GatewayNode.svelte.d.ts +15 -0
- package/dist/components/nodes/IdeaNode.stories.svelte +52 -0
- package/dist/components/nodes/IdeaNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/IdeaNode.svelte +455 -0
- package/dist/components/nodes/IdeaNode.svelte.d.ts +24 -0
- package/dist/components/nodes/NotesNode.stories.svelte +76 -0
- package/dist/components/nodes/NotesNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/NotesNode.svelte +378 -0
- package/dist/components/nodes/NotesNode.svelte.d.ts +24 -0
- package/dist/components/nodes/SimpleNode.stories.svelte +159 -0
- package/dist/components/nodes/SimpleNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/SimpleNode.svelte +451 -0
- package/dist/components/nodes/SimpleNode.svelte.d.ts +25 -0
- package/dist/components/nodes/SquareNode.stories.svelte +82 -0
- package/dist/components/nodes/SquareNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/SquareNode.svelte +407 -0
- package/dist/components/nodes/SquareNode.svelte.d.ts +25 -0
- package/dist/components/nodes/TerminalNode.stories.svelte +25 -0
- package/dist/components/nodes/TerminalNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/TerminalNode.svelte +690 -0
- package/dist/components/nodes/TerminalNode.svelte.d.ts +25 -0
- package/dist/components/nodes/ToolNode.stories.svelte +189 -0
- package/dist/components/nodes/ToolNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/ToolNode.svelte +471 -0
- package/dist/components/nodes/ToolNode.svelte.d.ts +36 -0
- package/dist/components/nodes/WorkflowNode.stories.svelte +55 -0
- package/dist/components/nodes/WorkflowNode.stories.svelte.d.ts +26 -0
- package/dist/components/nodes/WorkflowNode.svelte +571 -0
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +15 -0
- package/dist/components/playground/ChatPanel.svelte +905 -0
- package/dist/components/playground/ChatPanel.svelte.d.ts +46 -0
- package/dist/components/playground/ExecutionLogs.svelte +488 -0
- package/dist/components/playground/ExecutionLogs.svelte.d.ts +14 -0
- package/dist/components/playground/InputCollector.svelte +444 -0
- package/dist/components/playground/InputCollector.svelte.d.ts +16 -0
- package/dist/components/playground/MessageBubble.stories.svelte +62 -0
- package/dist/components/playground/MessageBubble.stories.svelte.d.ts +27 -0
- package/dist/components/playground/MessageBubble.svelte +633 -0
- package/dist/components/playground/MessageBubble.svelte.d.ts +24 -0
- package/dist/components/playground/Playground.svelte +1075 -0
- package/dist/components/playground/Playground.svelte.d.ts +25 -0
- package/dist/components/playground/PlaygroundModal.svelte +220 -0
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +25 -0
- package/dist/components/playground/SessionManager.svelte +538 -0
- package/dist/components/playground/SessionManager.svelte.d.ts +20 -0
- package/dist/config/agentSpecEndpoints.d.ts +70 -0
- package/dist/config/agentSpecEndpoints.js +65 -0
- package/dist/config/constants.d.ts +43 -0
- package/dist/config/constants.js +31 -0
- package/dist/config/defaultCategories.d.ts +7 -0
- package/dist/config/defaultCategories.js +126 -0
- package/dist/config/defaultPortConfig.d.ts +6 -0
- package/dist/config/defaultPortConfig.js +201 -0
- package/dist/config/endpoints.d.ts +160 -0
- package/dist/config/endpoints.js +146 -0
- package/dist/config/runtimeConfig.d.ts +47 -0
- package/dist/config/runtimeConfig.js +80 -0
- package/dist/core/index.d.ts +75 -0
- package/dist/core/index.js +92 -0
- package/dist/display/index.d.ts +29 -0
- package/dist/display/index.js +36 -0
- package/dist/editor/index.d.ts +95 -0
- package/dist/editor/index.js +138 -0
- package/dist/form/code.d.ts +101 -0
- package/dist/form/code.js +168 -0
- package/dist/form/fieldRegistry.d.ts +169 -0
- package/dist/form/fieldRegistry.js +152 -0
- package/dist/form/full.d.ts +56 -0
- package/dist/form/full.js +80 -0
- package/dist/form/index.d.ts +77 -0
- package/dist/form/index.js +91 -0
- package/dist/form/markdown.d.ts +69 -0
- package/dist/form/markdown.js +103 -0
- package/dist/helpers/nodeLayoutHelper.d.ts +14 -0
- package/dist/helpers/nodeLayoutHelper.js +19 -0
- package/dist/helpers/proximityConnect.d.ts +94 -0
- package/dist/helpers/proximityConnect.js +314 -0
- package/dist/helpers/workflowEditorHelper.d.ts +183 -0
- package/dist/helpers/workflowEditorHelper.js +595 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +64 -0
- package/dist/mocks/app-environment.d.ts +8 -0
- package/dist/mocks/app-environment.js +16 -0
- package/dist/mocks/app-forms.d.ts +2 -0
- package/dist/mocks/app-forms.js +22 -0
- package/dist/mocks/app-navigation.d.ts +5 -0
- package/dist/mocks/app-navigation.js +36 -0
- package/dist/mocks/app-stores.d.ts +14 -0
- package/dist/mocks/app-stores.js +26 -0
- package/dist/playground/index.d.ts +131 -0
- package/dist/playground/index.js +172 -0
- package/dist/playground/mount.d.ts +203 -0
- package/dist/playground/mount.js +235 -0
- package/dist/registry/BaseRegistry.d.ts +92 -0
- package/dist/registry/BaseRegistry.js +124 -0
- package/dist/registry/builtinFormats.d.ts +23 -0
- package/dist/registry/builtinFormats.js +70 -0
- package/dist/registry/builtinNodes.d.ts +77 -0
- package/dist/registry/builtinNodes.js +211 -0
- package/dist/registry/index.d.ts +8 -0
- package/dist/registry/index.js +12 -0
- package/dist/registry/nodeComponentRegistry.d.ts +276 -0
- package/dist/registry/nodeComponentRegistry.js +262 -0
- package/dist/registry/plugin.d.ts +215 -0
- package/dist/registry/plugin.js +249 -0
- package/dist/registry/workflowFormatRegistry.d.ts +122 -0
- package/dist/registry/workflowFormatRegistry.js +96 -0
- package/dist/schema/index.d.ts +23 -0
- package/dist/schema/index.js +23 -0
- package/dist/schemas/v1/workflow.schema.json +1078 -0
- package/dist/services/agentSpecExecutionService.d.ts +106 -0
- package/dist/services/agentSpecExecutionService.js +334 -0
- package/dist/services/api.d.ts +115 -0
- package/dist/services/api.js +214 -0
- package/dist/services/apiVariableService.d.ts +114 -0
- package/dist/services/apiVariableService.js +338 -0
- package/dist/services/autoSaveService.d.ts +112 -0
- package/dist/services/autoSaveService.js +227 -0
- package/dist/services/categoriesApi.d.ts +14 -0
- package/dist/services/categoriesApi.js +49 -0
- package/dist/services/draftStorage.d.ts +171 -0
- package/dist/services/draftStorage.js +299 -0
- package/dist/services/dynamicSchemaService.d.ts +108 -0
- package/dist/services/dynamicSchemaService.js +444 -0
- package/dist/services/globalSave.d.ts +69 -0
- package/dist/services/globalSave.js +248 -0
- package/dist/services/historyService.d.ts +208 -0
- package/dist/services/historyService.js +321 -0
- package/dist/services/interruptService.d.ts +133 -0
- package/dist/services/interruptService.js +280 -0
- package/dist/services/nodeExecutionService.d.ts +63 -0
- package/dist/services/nodeExecutionService.js +266 -0
- package/dist/services/playgroundService.d.ts +130 -0
- package/dist/services/playgroundService.js +321 -0
- package/dist/services/portConfigApi.d.ts +14 -0
- package/dist/services/portConfigApi.js +54 -0
- package/dist/services/settingsService.d.ts +92 -0
- package/dist/services/settingsService.js +196 -0
- package/dist/services/toastService.d.ts +156 -0
- package/dist/services/toastService.js +265 -0
- package/dist/services/variableService.d.ts +141 -0
- package/dist/services/variableService.js +463 -0
- package/dist/services/workflowStorage.d.ts +37 -0
- package/dist/services/workflowStorage.js +116 -0
- package/dist/settings/index.d.ts +25 -0
- package/dist/settings/index.js +33 -0
- package/dist/stores/categoriesStore.svelte.d.ts +32 -0
- package/dist/stores/categoriesStore.svelte.js +77 -0
- package/dist/stores/editorStateMachine.svelte.d.ts +42 -0
- package/dist/stores/editorStateMachine.svelte.js +132 -0
- package/dist/stores/historyStore.svelte.d.ts +136 -0
- package/dist/stores/historyStore.svelte.js +207 -0
- package/dist/stores/interruptStore.svelte.d.ts +179 -0
- package/dist/stores/interruptStore.svelte.js +346 -0
- package/dist/stores/playgroundStore.svelte.d.ts +230 -0
- package/dist/stores/playgroundStore.svelte.js +515 -0
- package/dist/stores/portCoordinateStore.svelte.d.ts +66 -0
- package/dist/stores/portCoordinateStore.svelte.js +186 -0
- package/dist/stores/settingsStore.svelte.d.ts +158 -0
- package/dist/stores/settingsStore.svelte.js +544 -0
- package/dist/stores/workflowStore.svelte.d.ts +260 -0
- package/dist/stores/workflowStore.svelte.js +649 -0
- package/dist/stories/CanvasDecorator.svelte +49 -0
- package/dist/stories/CanvasDecorator.svelte.d.ts +8 -0
- package/dist/stories/NodeDecorator.svelte +73 -0
- package/dist/stories/NodeDecorator.svelte.d.ts +8 -0
- package/dist/stories/utils.d.ts +93 -0
- package/dist/stories/utils.js +122 -0
- package/dist/styles/base.css +1300 -0
- package/dist/styles/toast.css +35 -0
- package/dist/styles/tokens.css +475 -0
- package/dist/svelte-app.d.ts +150 -0
- package/dist/svelte-app.js +295 -0
- package/dist/types/agentspec.d.ts +318 -0
- package/dist/types/agentspec.js +48 -0
- package/dist/types/auth.d.ts +263 -0
- package/dist/types/auth.js +229 -0
- package/dist/types/config.d.ts +151 -0
- package/dist/types/config.js +7 -0
- package/dist/types/events.d.ts +190 -0
- package/dist/types/events.js +30 -0
- package/dist/types/index.d.ts +1234 -0
- package/dist/types/index.js +27 -0
- package/dist/types/interrupt.d.ts +390 -0
- package/dist/types/interrupt.js +145 -0
- package/dist/types/interruptState.d.ts +211 -0
- package/dist/types/interruptState.js +308 -0
- package/dist/types/playground.d.ts +351 -0
- package/dist/types/playground.js +95 -0
- package/dist/types/settings.d.ts +189 -0
- package/dist/types/settings.js +97 -0
- package/dist/types/uischema.d.ts +144 -0
- package/dist/types/uischema.js +51 -0
- package/dist/utils/colors.d.ts +288 -0
- package/dist/utils/colors.js +548 -0
- package/dist/utils/config.d.ts +37 -0
- package/dist/utils/config.js +226 -0
- package/dist/utils/connections.d.ts +125 -0
- package/dist/utils/connections.js +414 -0
- package/dist/utils/errors.d.ts +28 -0
- package/dist/utils/errors.js +44 -0
- package/dist/utils/fetchWithAuth.d.ts +25 -0
- package/dist/utils/fetchWithAuth.js +34 -0
- package/dist/utils/handleIds.d.ts +35 -0
- package/dist/utils/handleIds.js +58 -0
- package/dist/utils/handlePositioning.d.ts +31 -0
- package/dist/utils/handlePositioning.js +35 -0
- package/dist/utils/icons.d.ts +106 -0
- package/dist/utils/icons.js +157 -0
- package/dist/utils/logger.d.ts +47 -0
- package/dist/utils/logger.js +72 -0
- package/dist/utils/nodeStatus.d.ts +53 -0
- package/dist/utils/nodeStatus.js +183 -0
- package/dist/utils/nodeTypes.d.ts +117 -0
- package/dist/utils/nodeTypes.js +244 -0
- package/dist/utils/nodeWrapper.d.ts +39 -0
- package/dist/utils/nodeWrapper.js +62 -0
- package/dist/utils/performanceUtils.d.ts +30 -0
- package/dist/utils/performanceUtils.js +108 -0
- package/dist/utils/sanitize.d.ts +19 -0
- package/dist/utils/sanitize.js +31 -0
- package/dist/utils/uischema.d.ts +52 -0
- package/dist/utils/uischema.js +88 -0
- package/dist/utils/validation.d.ts +29 -0
- package/dist/utils/validation.js +39 -0
- package/package.json +292 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playground Mount Functions
|
|
3
|
+
*
|
|
4
|
+
* Provides mount/unmount functions for integrating the Playground component
|
|
5
|
+
* into any web application. Particularly useful for integration with
|
|
6
|
+
* vanilla JS, Drupal, WordPress, or other frameworks.
|
|
7
|
+
*
|
|
8
|
+
* @module playground/mount
|
|
9
|
+
*
|
|
10
|
+
* @example Basic usage in vanilla JavaScript:
|
|
11
|
+
* ```javascript
|
|
12
|
+
* const app = await FlowDrop.mountPlayground(
|
|
13
|
+
* document.getElementById("playground-container"),
|
|
14
|
+
* {
|
|
15
|
+
* workflowId: "wf-123",
|
|
16
|
+
* endpointConfig: FlowDrop.createEndpointConfig("/api/flowdrop"),
|
|
17
|
+
* mode: "standalone"
|
|
18
|
+
* }
|
|
19
|
+
* );
|
|
20
|
+
*
|
|
21
|
+
* // Later, to cleanup:
|
|
22
|
+
* app.destroy();
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example Drupal integration:
|
|
26
|
+
* ```javascript
|
|
27
|
+
* (function (Drupal, FlowDrop) {
|
|
28
|
+
* Drupal.behaviors.flowdropPlayground = {
|
|
29
|
+
* attach: function (context, settings) {
|
|
30
|
+
* const container = document.getElementById("playground-container");
|
|
31
|
+
* if (!container || container.dataset.initialized) return;
|
|
32
|
+
* container.dataset.initialized = "true";
|
|
33
|
+
*
|
|
34
|
+
* FlowDrop.mountPlayground(container, {
|
|
35
|
+
* workflowId: settings.flowdrop.workflowId,
|
|
36
|
+
* endpointConfig: FlowDrop.createEndpointConfig(settings.flowdrop.apiBaseUrl),
|
|
37
|
+
* mode: "standalone"
|
|
38
|
+
* }).then(function (app) {
|
|
39
|
+
* container._flowdropApp = app;
|
|
40
|
+
* });
|
|
41
|
+
* }
|
|
42
|
+
* };
|
|
43
|
+
* })(Drupal, window.FlowDrop);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
import { mount, unmount } from 'svelte';
|
|
47
|
+
import Playground from '../components/playground/Playground.svelte';
|
|
48
|
+
import PlaygroundModal from '../components/playground/PlaygroundModal.svelte';
|
|
49
|
+
import { setEndpointConfig } from '../services/api.js';
|
|
50
|
+
import { playgroundService } from '../services/playgroundService.js';
|
|
51
|
+
import { getCurrentSession, getSessions, getMessages, playgroundActions, createPollingCallback, subscribeToSessionStatus } from '../stores/playgroundStore.svelte.js';
|
|
52
|
+
/**
|
|
53
|
+
* Mount the Playground component in a container
|
|
54
|
+
*
|
|
55
|
+
* This function mounts the Playground Svelte component into a DOM container,
|
|
56
|
+
* enabling interactive workflow testing with a chat interface.
|
|
57
|
+
*
|
|
58
|
+
* @param container - DOM element to mount the playground into
|
|
59
|
+
* @param options - Configuration options for the playground
|
|
60
|
+
* @returns Promise resolving to a MountedPlayground instance
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* import { mountPlayground, createEndpointConfig } from "@flowdrop/flowdrop/playground";
|
|
65
|
+
*
|
|
66
|
+
* const app = await mountPlayground(
|
|
67
|
+
* document.getElementById("playground"),
|
|
68
|
+
* {
|
|
69
|
+
* workflowId: "wf-123",
|
|
70
|
+
* endpointConfig: createEndpointConfig("/api/flowdrop"),
|
|
71
|
+
* mode: "standalone",
|
|
72
|
+
* config: {
|
|
73
|
+
* showTimestamps: true,
|
|
74
|
+
* autoScroll: true,
|
|
75
|
+
* pollingInterval: 1500
|
|
76
|
+
* }
|
|
77
|
+
* }
|
|
78
|
+
* );
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export async function mountPlayground(container, options) {
|
|
82
|
+
const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, config = {}, height = '100%', width = '100%', onClose, onSessionStatusChange } = options;
|
|
83
|
+
// Validate required parameters
|
|
84
|
+
if (!workflowId) {
|
|
85
|
+
throw new Error('workflowId is required for mountPlayground()');
|
|
86
|
+
}
|
|
87
|
+
if (!container) {
|
|
88
|
+
throw new Error('container element is required for mountPlayground()');
|
|
89
|
+
}
|
|
90
|
+
// Validate onClose for modal mode
|
|
91
|
+
if (mode === 'modal' && !onClose) {
|
|
92
|
+
throw new Error('onClose callback is required for modal mode');
|
|
93
|
+
}
|
|
94
|
+
// Set endpoint configuration if provided
|
|
95
|
+
let finalEndpointConfig;
|
|
96
|
+
if (endpointConfig) {
|
|
97
|
+
// Merge with default configuration to ensure all required endpoints are present
|
|
98
|
+
const { defaultEndpointConfig } = await import('../config/endpoints.js');
|
|
99
|
+
finalEndpointConfig = {
|
|
100
|
+
...defaultEndpointConfig,
|
|
101
|
+
...endpointConfig,
|
|
102
|
+
endpoints: {
|
|
103
|
+
...defaultEndpointConfig.endpoints,
|
|
104
|
+
...endpointConfig.endpoints
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
setEndpointConfig(finalEndpointConfig);
|
|
108
|
+
}
|
|
109
|
+
// Handle modal mode differently
|
|
110
|
+
// For modal mode, PlaygroundModal creates its own backdrop, so we mount directly to body
|
|
111
|
+
// For other modes, use the provided container
|
|
112
|
+
let targetContainer = container;
|
|
113
|
+
if (mode === 'modal') {
|
|
114
|
+
// For modal mode, create a container in the body
|
|
115
|
+
// PlaygroundModal will handle the backdrop itself
|
|
116
|
+
targetContainer = document.body;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// Apply container styling for non-modal modes
|
|
120
|
+
container.style.height = height;
|
|
121
|
+
container.style.width = width;
|
|
122
|
+
}
|
|
123
|
+
// Mount the appropriate component
|
|
124
|
+
// Separate the mount calls to avoid TypeScript inference issues with different props types
|
|
125
|
+
let svelteApp;
|
|
126
|
+
if (mode === 'modal') {
|
|
127
|
+
svelteApp = mount(PlaygroundModal, {
|
|
128
|
+
target: targetContainer,
|
|
129
|
+
props: {
|
|
130
|
+
isOpen: true,
|
|
131
|
+
workflowId,
|
|
132
|
+
workflow,
|
|
133
|
+
initialSessionId,
|
|
134
|
+
endpointConfig: finalEndpointConfig,
|
|
135
|
+
config,
|
|
136
|
+
onClose: () => {
|
|
137
|
+
if (onClose) {
|
|
138
|
+
onClose();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
svelteApp = mount(Playground, {
|
|
146
|
+
target: targetContainer,
|
|
147
|
+
props: {
|
|
148
|
+
workflowId,
|
|
149
|
+
workflow,
|
|
150
|
+
mode,
|
|
151
|
+
initialSessionId,
|
|
152
|
+
endpointConfig: finalEndpointConfig,
|
|
153
|
+
config,
|
|
154
|
+
onClose
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
// Store state for cleanup
|
|
159
|
+
const state = {
|
|
160
|
+
svelteApp,
|
|
161
|
+
container: targetContainer,
|
|
162
|
+
originalContainer: mode === 'modal' ? container : undefined,
|
|
163
|
+
workflowId
|
|
164
|
+
};
|
|
165
|
+
// Create shared polling callback using lifecycle hooks from config
|
|
166
|
+
const pollingCallback = createPollingCallback(config.isTerminalStatus);
|
|
167
|
+
const pollingInterval = config.pollingInterval ?? 1500;
|
|
168
|
+
// Subscribe to session status changes if callback provided
|
|
169
|
+
let unsubscribeStatus;
|
|
170
|
+
if (onSessionStatusChange) {
|
|
171
|
+
unsubscribeStatus = subscribeToSessionStatus(onSessionStatusChange);
|
|
172
|
+
}
|
|
173
|
+
// Create the mounted playground interface
|
|
174
|
+
const mountedPlayground = {
|
|
175
|
+
destroy: () => {
|
|
176
|
+
// Unsubscribe from status changes
|
|
177
|
+
unsubscribeStatus?.();
|
|
178
|
+
// Stop any active polling
|
|
179
|
+
playgroundService.stopPolling();
|
|
180
|
+
// Reset playground state
|
|
181
|
+
playgroundActions.reset();
|
|
182
|
+
// Unmount Svelte component
|
|
183
|
+
unmount(state.svelteApp);
|
|
184
|
+
},
|
|
185
|
+
getCurrentSession: () => {
|
|
186
|
+
return getCurrentSession();
|
|
187
|
+
},
|
|
188
|
+
getSessions: () => {
|
|
189
|
+
return getSessions();
|
|
190
|
+
},
|
|
191
|
+
getMessageCount: () => {
|
|
192
|
+
return getMessages().length;
|
|
193
|
+
},
|
|
194
|
+
isExecuting: () => {
|
|
195
|
+
return playgroundService.isPolling();
|
|
196
|
+
},
|
|
197
|
+
stopPolling: () => {
|
|
198
|
+
playgroundService.stopPolling();
|
|
199
|
+
},
|
|
200
|
+
startPolling: () => {
|
|
201
|
+
const session = getCurrentSession();
|
|
202
|
+
if (session) {
|
|
203
|
+
playgroundService.startPolling(session.id, pollingCallback, pollingInterval, config.shouldStopPolling);
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
pushMessages: (response) => {
|
|
207
|
+
pollingCallback(response);
|
|
208
|
+
},
|
|
209
|
+
reset: () => {
|
|
210
|
+
playgroundService.stopPolling();
|
|
211
|
+
playgroundActions.reset();
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
return mountedPlayground;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Unmount a Playground instance
|
|
218
|
+
*
|
|
219
|
+
* Convenience function for destroying a mounted playground.
|
|
220
|
+
* Equivalent to calling `app.destroy()`.
|
|
221
|
+
*
|
|
222
|
+
* @param app - The mounted playground to unmount
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* const app = await mountPlayground(container, options);
|
|
227
|
+
* // ... later
|
|
228
|
+
* unmountPlayground(app);
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
export function unmountPlayground(app) {
|
|
232
|
+
if (app && typeof app.destroy === 'function') {
|
|
233
|
+
app.destroy();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Registry
|
|
3
|
+
*
|
|
4
|
+
* Generic base class for all FlowDrop registries. Provides the shared
|
|
5
|
+
* mechanics: Map storage, subscribe/notify, onClear callbacks, and size tracking.
|
|
6
|
+
*
|
|
7
|
+
* Subclasses define their own `register()` method with domain-appropriate
|
|
8
|
+
* signatures, using `this.items` and `this.notifyListeners()` directly.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* class MyRegistry extends BaseRegistry<string, MyItem> {
|
|
13
|
+
* register(item: MyItem, overwrite = false): void {
|
|
14
|
+
* if (this.items.has(item.id) && !overwrite) {
|
|
15
|
+
* throw new Error(`Already registered: ${item.id}`);
|
|
16
|
+
* }
|
|
17
|
+
* this.items.set(item.id, item);
|
|
18
|
+
* this.notifyListeners();
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class BaseRegistry<K, V> {
|
|
24
|
+
/** Internal storage map */
|
|
25
|
+
protected items: Map<K, V>;
|
|
26
|
+
/** Change listeners */
|
|
27
|
+
private listeners;
|
|
28
|
+
/** Callbacks invoked when the registry is cleared (for resetting flags) */
|
|
29
|
+
private clearCallbacks;
|
|
30
|
+
/**
|
|
31
|
+
* Unregister an item by key.
|
|
32
|
+
*
|
|
33
|
+
* @param key - The key to remove
|
|
34
|
+
* @returns true if the key was found and removed, false otherwise
|
|
35
|
+
*/
|
|
36
|
+
unregister(key: K): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Get an item by key.
|
|
39
|
+
*
|
|
40
|
+
* @param key - The key to look up
|
|
41
|
+
* @returns The item if found, undefined otherwise
|
|
42
|
+
*/
|
|
43
|
+
get(key: K): V | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Check if a key is registered.
|
|
46
|
+
*
|
|
47
|
+
* @param key - The key to check
|
|
48
|
+
* @returns true if the key is registered
|
|
49
|
+
*/
|
|
50
|
+
has(key: K): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Get all registered keys.
|
|
53
|
+
*
|
|
54
|
+
* @returns Array of registered keys
|
|
55
|
+
*/
|
|
56
|
+
getKeys(): K[];
|
|
57
|
+
/**
|
|
58
|
+
* Get all registered values.
|
|
59
|
+
*
|
|
60
|
+
* @returns Array of all registered items
|
|
61
|
+
*/
|
|
62
|
+
getAll(): V[];
|
|
63
|
+
/**
|
|
64
|
+
* Subscribe to registry changes.
|
|
65
|
+
* Called whenever items are registered, unregistered, or cleared.
|
|
66
|
+
*
|
|
67
|
+
* @param listener - Callback to invoke on changes
|
|
68
|
+
* @returns Unsubscribe function
|
|
69
|
+
*/
|
|
70
|
+
subscribe(listener: () => void): () => void;
|
|
71
|
+
/**
|
|
72
|
+
* Register a callback invoked when the registry is cleared.
|
|
73
|
+
* Useful for resetting module-level registration flags in tests.
|
|
74
|
+
*
|
|
75
|
+
* @param callback - Function to call on clear
|
|
76
|
+
* @returns Unsubscribe function
|
|
77
|
+
*/
|
|
78
|
+
onClear(callback: () => void): () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Clear all registrations.
|
|
81
|
+
* Invokes onClear callbacks first, then notifies listeners.
|
|
82
|
+
*/
|
|
83
|
+
clear(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Get the count of registered items.
|
|
86
|
+
*/
|
|
87
|
+
get size(): number;
|
|
88
|
+
/**
|
|
89
|
+
* Notify all change listeners.
|
|
90
|
+
*/
|
|
91
|
+
protected notifyListeners(): void;
|
|
92
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Registry
|
|
3
|
+
*
|
|
4
|
+
* Generic base class for all FlowDrop registries. Provides the shared
|
|
5
|
+
* mechanics: Map storage, subscribe/notify, onClear callbacks, and size tracking.
|
|
6
|
+
*
|
|
7
|
+
* Subclasses define their own `register()` method with domain-appropriate
|
|
8
|
+
* signatures, using `this.items` and `this.notifyListeners()` directly.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* class MyRegistry extends BaseRegistry<string, MyItem> {
|
|
13
|
+
* register(item: MyItem, overwrite = false): void {
|
|
14
|
+
* if (this.items.has(item.id) && !overwrite) {
|
|
15
|
+
* throw new Error(`Already registered: ${item.id}`);
|
|
16
|
+
* }
|
|
17
|
+
* this.items.set(item.id, item);
|
|
18
|
+
* this.notifyListeners();
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export class BaseRegistry {
|
|
24
|
+
/** Internal storage map */
|
|
25
|
+
items = new Map();
|
|
26
|
+
/** Change listeners */
|
|
27
|
+
listeners = new Set();
|
|
28
|
+
/** Callbacks invoked when the registry is cleared (for resetting flags) */
|
|
29
|
+
clearCallbacks = new Set();
|
|
30
|
+
/**
|
|
31
|
+
* Unregister an item by key.
|
|
32
|
+
*
|
|
33
|
+
* @param key - The key to remove
|
|
34
|
+
* @returns true if the key was found and removed, false otherwise
|
|
35
|
+
*/
|
|
36
|
+
unregister(key) {
|
|
37
|
+
const result = this.items.delete(key);
|
|
38
|
+
if (result) {
|
|
39
|
+
this.notifyListeners();
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get an item by key.
|
|
45
|
+
*
|
|
46
|
+
* @param key - The key to look up
|
|
47
|
+
* @returns The item if found, undefined otherwise
|
|
48
|
+
*/
|
|
49
|
+
get(key) {
|
|
50
|
+
return this.items.get(key);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check if a key is registered.
|
|
54
|
+
*
|
|
55
|
+
* @param key - The key to check
|
|
56
|
+
* @returns true if the key is registered
|
|
57
|
+
*/
|
|
58
|
+
has(key) {
|
|
59
|
+
return this.items.has(key);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get all registered keys.
|
|
63
|
+
*
|
|
64
|
+
* @returns Array of registered keys
|
|
65
|
+
*/
|
|
66
|
+
getKeys() {
|
|
67
|
+
return Array.from(this.items.keys());
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get all registered values.
|
|
71
|
+
*
|
|
72
|
+
* @returns Array of all registered items
|
|
73
|
+
*/
|
|
74
|
+
getAll() {
|
|
75
|
+
return Array.from(this.items.values());
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Subscribe to registry changes.
|
|
79
|
+
* Called whenever items are registered, unregistered, or cleared.
|
|
80
|
+
*
|
|
81
|
+
* @param listener - Callback to invoke on changes
|
|
82
|
+
* @returns Unsubscribe function
|
|
83
|
+
*/
|
|
84
|
+
subscribe(listener) {
|
|
85
|
+
this.listeners.add(listener);
|
|
86
|
+
return () => this.listeners.delete(listener);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Register a callback invoked when the registry is cleared.
|
|
90
|
+
* Useful for resetting module-level registration flags in tests.
|
|
91
|
+
*
|
|
92
|
+
* @param callback - Function to call on clear
|
|
93
|
+
* @returns Unsubscribe function
|
|
94
|
+
*/
|
|
95
|
+
onClear(callback) {
|
|
96
|
+
this.clearCallbacks.add(callback);
|
|
97
|
+
return () => this.clearCallbacks.delete(callback);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Clear all registrations.
|
|
101
|
+
* Invokes onClear callbacks first, then notifies listeners.
|
|
102
|
+
*/
|
|
103
|
+
clear() {
|
|
104
|
+
this.items.clear();
|
|
105
|
+
for (const cb of this.clearCallbacks) {
|
|
106
|
+
cb();
|
|
107
|
+
}
|
|
108
|
+
this.notifyListeners();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get the count of registered items.
|
|
112
|
+
*/
|
|
113
|
+
get size() {
|
|
114
|
+
return this.items.size;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Notify all change listeners.
|
|
118
|
+
*/
|
|
119
|
+
notifyListeners() {
|
|
120
|
+
for (const listener of this.listeners) {
|
|
121
|
+
listener();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Workflow Format Registration
|
|
3
|
+
*
|
|
4
|
+
* Registers the default FlowDrop and Agent Spec format adapters
|
|
5
|
+
* with the workflow format registry.
|
|
6
|
+
*
|
|
7
|
+
* This module is automatically loaded when imported,
|
|
8
|
+
* ensuring built-in formats are available without user action.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Register all built-in workflow format adapters.
|
|
12
|
+
* Safe to call multiple times — will only register once.
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerBuiltinFormats(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Check if built-in formats have been registered.
|
|
17
|
+
*/
|
|
18
|
+
export declare function areBuiltinFormatsRegistered(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Reset the registration state.
|
|
21
|
+
* Primarily useful for testing.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resetBuiltinFormatRegistration(): void;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Workflow Format Registration
|
|
3
|
+
*
|
|
4
|
+
* Registers the default FlowDrop and Agent Spec format adapters
|
|
5
|
+
* with the workflow format registry.
|
|
6
|
+
*
|
|
7
|
+
* This module is automatically loaded when imported,
|
|
8
|
+
* ensuring built-in formats are available without user action.
|
|
9
|
+
*/
|
|
10
|
+
import { workflowFormatRegistry } from './workflowFormatRegistry.js';
|
|
11
|
+
import { AgentSpecAdapter } from '../adapters/agentspec/AgentSpecAdapter.js';
|
|
12
|
+
import { validateForAgentSpecExport } from '../adapters/agentspec/validator.js';
|
|
13
|
+
/**
|
|
14
|
+
* Track whether built-in formats have been registered.
|
|
15
|
+
* Prevents duplicate registration on hot reload.
|
|
16
|
+
*/
|
|
17
|
+
let registered = false;
|
|
18
|
+
/**
|
|
19
|
+
* Register all built-in workflow format adapters.
|
|
20
|
+
* Safe to call multiple times — will only register once.
|
|
21
|
+
*/
|
|
22
|
+
export function registerBuiltinFormats() {
|
|
23
|
+
if (registered)
|
|
24
|
+
return;
|
|
25
|
+
// FlowDrop native — passthrough (StandardWorkflow ↔ JSON)
|
|
26
|
+
const flowdropAdapter = {
|
|
27
|
+
id: 'flowdrop',
|
|
28
|
+
name: 'FlowDrop',
|
|
29
|
+
description: 'FlowDrop native workflow format',
|
|
30
|
+
version: '1.0.0',
|
|
31
|
+
// No nodes — FlowDrop nodes are universal (no formats restriction)
|
|
32
|
+
export: (workflow) => JSON.stringify(workflow, null, 2),
|
|
33
|
+
import: (data) => JSON.parse(data)
|
|
34
|
+
};
|
|
35
|
+
workflowFormatRegistry.register(flowdropAdapter);
|
|
36
|
+
// Agent Spec — wraps existing AgentSpecAdapter
|
|
37
|
+
// No bundled nodes — Agent Spec node types are user-provided via
|
|
38
|
+
// getDefaultAgentSpecNodeTypes() or custom definitions passed to mountFlowDropApp()
|
|
39
|
+
const agentSpecAdapter = new AgentSpecAdapter();
|
|
40
|
+
const agentSpecFormatAdapter = {
|
|
41
|
+
id: 'agentspec',
|
|
42
|
+
name: 'Agent Spec (Oracle)',
|
|
43
|
+
description: 'Oracle Open Agent Spec format',
|
|
44
|
+
version: '1.0.0',
|
|
45
|
+
export: (workflow) => agentSpecAdapter.exportJSON(workflow),
|
|
46
|
+
import: (data) => agentSpecAdapter.importJSON(data),
|
|
47
|
+
validate: (workflow) => validateForAgentSpecExport(workflow)
|
|
48
|
+
};
|
|
49
|
+
workflowFormatRegistry.register(agentSpecFormatAdapter);
|
|
50
|
+
registered = true;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check if built-in formats have been registered.
|
|
54
|
+
*/
|
|
55
|
+
export function areBuiltinFormatsRegistered() {
|
|
56
|
+
return registered;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Reset the registration state.
|
|
60
|
+
* Primarily useful for testing.
|
|
61
|
+
*/
|
|
62
|
+
export function resetBuiltinFormatRegistration() {
|
|
63
|
+
registered = false;
|
|
64
|
+
}
|
|
65
|
+
// Sync registration flag with registry.clear() for test isolation
|
|
66
|
+
workflowFormatRegistry.onClear(() => {
|
|
67
|
+
registered = false;
|
|
68
|
+
});
|
|
69
|
+
// Auto-register built-in formats when this module is imported
|
|
70
|
+
registerBuiltinFormats();
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Node Components Registration
|
|
3
|
+
* Registers all default FlowDrop node components with the registry.
|
|
4
|
+
*
|
|
5
|
+
* This module is automatically loaded when the library initializes,
|
|
6
|
+
* ensuring all built-in node types are available without user action.
|
|
7
|
+
*/
|
|
8
|
+
import { type NodeComponentRegistration } from './nodeComponentRegistry.js';
|
|
9
|
+
/**
|
|
10
|
+
* Source identifier for built-in FlowDrop components
|
|
11
|
+
*/
|
|
12
|
+
export declare const FLOWDROP_SOURCE = "flowdrop";
|
|
13
|
+
/**
|
|
14
|
+
* Built-in FlowDrop node component registrations.
|
|
15
|
+
* These are the default node types that ship with FlowDrop.
|
|
16
|
+
*/
|
|
17
|
+
export declare const BUILTIN_NODE_COMPONENTS: NodeComponentRegistration[];
|
|
18
|
+
/**
|
|
19
|
+
* Alias mapping for type resolution.
|
|
20
|
+
* Maps alternative type names to their canonical registration.
|
|
21
|
+
*/
|
|
22
|
+
export declare const BUILTIN_TYPE_ALIASES: Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Initialize the registry with built-in components.
|
|
25
|
+
* This is called automatically when the library loads.
|
|
26
|
+
*
|
|
27
|
+
* Safe to call multiple times - will only register once.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* // Usually not needed - called automatically
|
|
32
|
+
* // But can be called manually if needed
|
|
33
|
+
* registerBuiltinNodes();
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function registerBuiltinNodes(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Check if built-in nodes have been registered.
|
|
39
|
+
*
|
|
40
|
+
* @returns true if registerBuiltinNodes() has been called
|
|
41
|
+
*/
|
|
42
|
+
export declare function areBuiltinsRegistered(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Reset the registration state.
|
|
45
|
+
* Primarily useful for testing.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resetBuiltinRegistration(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Get the canonical type for a given type string.
|
|
50
|
+
* Handles aliases like "default" -> "workflowNode".
|
|
51
|
+
*
|
|
52
|
+
* @param type - The type string to resolve
|
|
53
|
+
* @returns The canonical type string
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveBuiltinAlias(type: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Check if a type is a built-in FlowDrop type.
|
|
58
|
+
*
|
|
59
|
+
* @param type - The type to check
|
|
60
|
+
* @returns true if this is a built-in type
|
|
61
|
+
*/
|
|
62
|
+
export declare function isBuiltinType(type: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Get all built-in type identifiers.
|
|
65
|
+
*
|
|
66
|
+
* @returns Array of built-in type strings
|
|
67
|
+
*/
|
|
68
|
+
export declare function getBuiltinTypes(): string[];
|
|
69
|
+
/**
|
|
70
|
+
* Type for built-in node types.
|
|
71
|
+
* Use this when you specifically need a built-in type.
|
|
72
|
+
*/
|
|
73
|
+
export type BuiltinNodeType = 'workflowNode' | 'simple' | 'square' | 'tool' | 'gateway' | 'note' | 'terminal' | 'idea';
|
|
74
|
+
/**
|
|
75
|
+
* Array of built-in type strings for runtime validation.
|
|
76
|
+
*/
|
|
77
|
+
export declare const BUILTIN_NODE_TYPES: BuiltinNodeType[];
|