windmill-components 1.677.1 → 1.695.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/package/components/AppConnectInner.svelte +6 -0
- package/package/components/ArgInput.svelte +2 -0
- package/package/components/AutoscalingConfigEditor.svelte +18 -4
- package/package/components/CiTestResults.svelte +64 -0
- package/package/components/CiTestResults.svelte.d.ts +7 -0
- package/package/components/CompareWorkspaces.svelte +741 -484
- package/package/components/DBManager.svelte +35 -4
- package/package/components/DBManager.svelte.d.ts +2 -0
- package/package/components/DBManagerContent.svelte +3 -1
- package/package/components/DBManagerContent.svelte.d.ts +3 -0
- package/package/components/DBManagerDrawer.svelte +145 -3
- package/package/components/DBTableEditor.svelte +14 -4
- package/package/components/DatatablePicker.svelte +2 -5
- package/package/components/DatatableSchemaDiff.svelte +531 -0
- package/package/components/DatatableSchemaDiff.svelte.d.ts +29 -0
- package/package/components/DedicatedWorkersSelector.svelte +4 -2
- package/package/components/DefaultTagsInner.svelte +42 -2
- package/package/components/DeployWorkspaceDrawer.svelte +1 -1
- package/package/components/Dev.svelte +407 -74
- package/package/components/EditableSchemaForm.svelte +4 -0
- package/package/components/Editor.svelte +1 -1
- package/package/components/EditorBar.svelte +1 -1
- package/package/components/EditorBar.svelte.d.ts +1 -1
- package/package/components/ErrorOrRecoveryHandler.svelte +2 -2
- package/package/components/FlowPreviewContent.svelte +32 -30
- package/package/components/FlowRestartButton.svelte +143 -61
- package/package/components/FlowRestartButton.svelte.d.ts +37 -0
- package/package/components/FlowStatusViewer.svelte +15 -1
- package/package/components/FlowStatusViewer.svelte.d.ts +10 -2
- package/package/components/FlowStatusViewerInner.svelte +270 -222
- package/package/components/FlowStatusViewerInner.svelte.d.ts +6 -2
- package/package/components/FlowTimeline.svelte +1 -1
- package/package/components/FolderEditor.svelte +189 -4
- package/package/components/ForkConflictModal.svelte +57 -0
- package/package/components/ForkConflictModal.svelte.d.ts +3 -0
- package/package/components/ForkWorkspaceBanner.svelte +82 -11
- package/package/components/GitRepoViewer.svelte +251 -97
- package/package/components/GlobalUserOffboardingModal.svelte +293 -0
- package/package/components/GlobalUserOffboardingModal.svelte.d.ts +10 -0
- package/package/components/InputTransformSchemaForm.svelte +1 -1
- package/package/components/InstanceSettings.svelte +58 -19
- package/package/components/Login.svelte +133 -36
- package/package/components/Login.svelte.d.ts +1 -0
- package/package/components/ModuleTest.svelte +2 -1
- package/package/components/NoMainFuncBadge.svelte +1 -1
- package/package/components/OffboardItemsBox.svelte +56 -0
- package/package/components/OffboardItemsBox.svelte.d.ts +12 -0
- package/package/components/OffboardReassignControls.svelte +47 -0
- package/package/components/OffboardReassignControls.svelte.d.ts +20 -0
- package/package/components/OffboardWorkspaceSection.svelte +110 -0
- package/package/components/OffboardWorkspaceSection.svelte.d.ts +24 -0
- package/package/components/OnBehalfOfSelector.svelte +21 -3
- package/package/components/OnBehalfOfSelector.svelte.d.ts +7 -0
- package/package/components/Path.svelte +7 -1
- package/package/components/Path.svelte.d.ts +1 -1
- package/package/components/QueueAlerts.svelte +10 -10
- package/package/components/ResourcePicker.svelte +2 -2
- package/package/components/RunsPage.svelte +2 -1
- package/package/components/S3FilePickerInner.svelte +89 -89
- package/package/components/ScriptBuilder.svelte +52 -11
- package/package/components/ScriptEditor.svelte +19 -8
- package/package/components/ScriptEditor.svelte.d.ts +1 -1
- package/package/components/ShareModal.svelte +236 -98
- package/package/components/ShareModal.svelte.d.ts +1 -1
- package/package/components/SuperadminSettingsInner.svelte +362 -315
- package/package/components/UserOffboardingModal.svelte +238 -0
- package/package/components/UserOffboardingModal.svelte.d.ts +10 -0
- package/package/components/WorkspaceDeployLayout.svelte +3 -3
- package/package/components/WorkspaceDeployLayout.svelte.d.ts +1 -0
- package/package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +3 -0
- package/package/components/apps/components/helpers/executeRunnable.js +2 -1
- package/package/components/apps/editor/AppReportsDrawerInner.svelte +1 -1
- package/package/components/apps/editor/appPolicy.js +2 -1
- package/package/components/apps/editor/commonAppUtils.d.ts +3 -0
- package/package/components/apps/editor/inlineScriptsPanel/CacheTtlPopup.svelte +1 -1
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +7 -0
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptRunnableByPath.svelte +4 -2
- package/package/components/apps/editor/inlineScriptsPanel/TagPopup.svelte +49 -0
- package/package/components/apps/editor/inlineScriptsPanel/TagPopup.svelte.d.ts +9 -0
- package/package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +12 -0
- package/package/components/apps/inputType.d.ts +1 -0
- package/package/components/apps/sharedTypes.d.ts +1 -0
- package/package/components/assets/AssetsDropdownButton.svelte +1 -1
- package/package/components/auditLogs/AuditLogsFilters.svelte +8 -3
- package/package/components/common/confirmationModal/ConfirmationModal.svelte +1 -1
- package/package/components/common/fileUpload/S3ArgInput.svelte +12 -10
- package/package/components/common/fileUpload/S3ArgInput.svelte.d.ts +2 -0
- package/package/components/common/table/AppRow.svelte +3 -3
- package/package/components/common/table/FlowRow.svelte +3 -3
- package/package/components/common/table/RawAppRow.svelte +4 -4
- package/package/components/common/table/Row.svelte +6 -2
- package/package/components/common/table/ScriptRow.svelte +11 -3
- package/package/components/copilot/chat/AIChatDisplay.svelte +5 -36
- package/package/components/copilot/chat/AIChatInput.svelte +56 -47
- package/package/components/copilot/chat/AIChatManager.svelte.js +50 -48
- package/package/components/copilot/chat/ContextElementBadge.svelte +6 -4
- package/package/components/copilot/chat/anthropic.d.ts +7 -1
- package/package/components/copilot/chat/anthropic.js +5 -2
- package/package/components/copilot/chat/app/core.d.ts +12 -20
- package/package/components/copilot/chat/app/core.js +230 -159
- package/package/components/copilot/chat/app/core.test.js +417 -0
- package/package/components/copilot/chat/chatLoop.d.ts +3 -0
- package/package/components/copilot/chat/chatLoop.js +13 -5
- package/package/components/copilot/chat/context.js +44 -0
- package/package/components/copilot/chat/flow/FlowAIChat.svelte +57 -76
- package/package/components/copilot/chat/flow/core.d.ts +14 -3
- package/package/components/copilot/chat/flow/core.js +494 -116
- package/package/components/copilot/chat/flow/helperUtils.d.ts +22 -0
- package/package/components/copilot/chat/flow/helperUtils.js +100 -0
- package/package/components/copilot/chat/flow/helperUtils.test.js +231 -0
- package/package/components/copilot/chat/flow/inlineScriptsUtils.d.ts +5 -24
- package/package/components/copilot/chat/flow/inlineScriptsUtils.js +30 -55
- package/package/components/copilot/chat/flow/openFlow.json +1 -1
- package/package/components/copilot/chat/flow/openFlowZod.gen.js +24 -0
- package/package/components/copilot/chat/flow/utils.test.js +59 -0
- package/package/components/copilot/chat/openai-responses.d.ts +7 -1
- package/package/components/copilot/chat/openai-responses.js +5 -2
- package/package/components/copilot/chat/script/core.js +3 -0
- package/package/components/copilot/chat/shared.d.ts +7 -2
- package/package/components/copilot/chat/shared.js +116 -53
- package/package/components/copilot/chat/shared.test.d.ts +1 -0
- package/package/components/copilot/chat/shared.test.js +412 -0
- package/package/components/copilot/chat/tokenUsage.d.ts +23 -0
- package/package/components/copilot/chat/tokenUsage.js +42 -0
- package/package/components/copilot/chat/workspaceTools.d.ts +7 -0
- package/package/components/copilot/chat/workspaceTools.js +239 -0
- package/package/components/copilot/chat/workspaceToolsZod.gen.d.ts +1295 -0
- package/package/components/copilot/chat/workspaceToolsZod.gen.js +424 -0
- package/package/components/copilot/lib.d.ts +5 -1
- package/package/components/copilot/lib.js +24 -6
- package/package/components/copilot/lib.test.d.ts +1 -0
- package/package/components/copilot/lib.test.js +19 -0
- package/package/components/copilot/modelConfig.d.ts +3 -0
- package/package/components/copilot/modelConfig.js +10 -0
- package/package/components/deploymentRequest/DeploymentRequestPanel.svelte +337 -0
- package/package/components/deploymentRequest/DeploymentRequestPanel.svelte.d.ts +15 -0
- package/package/components/details/CopyableCodeBlock.svelte +18 -8
- package/package/components/details/CopyableCodeBlock.svelte.d.ts +1 -0
- package/package/components/flows/FlowAssetsHandler.svelte +19 -21
- package/package/components/flows/FlowProgressBar.svelte +5 -2
- package/package/components/flows/agentToolTree.d.ts +17 -0
- package/package/components/flows/agentToolTree.js +114 -0
- package/package/components/flows/agentToolTree.test.d.ts +1 -0
- package/package/components/flows/agentToolTree.test.js +86 -0
- package/package/components/flows/agentToolUtils.d.ts +0 -5
- package/package/components/flows/agentToolUtils.js +0 -49
- package/package/components/flows/content/FlowLoop.svelte +7 -4
- package/package/components/flows/content/FlowModuleComponent.svelte +636 -599
- package/package/components/flows/content/FlowModuleDeleteAfterUse.svelte +15 -7
- package/package/components/flows/content/FlowSettings.svelte +29 -0
- package/package/components/flows/conversations/FlowChatManager.svelte.js +21 -10
- package/package/components/flows/dfs.d.ts +6 -2
- package/package/components/flows/dfs.js +19 -11
- package/package/components/flows/flowDeleteController.d.ts +32 -0
- package/package/components/flows/flowDeleteController.js +54 -0
- package/package/components/flows/flowDeleteController.test.d.ts +1 -0
- package/package/components/flows/flowDeleteController.test.js +121 -0
- package/package/components/flows/flowDeleteUtils.d.ts +48 -0
- package/package/components/flows/flowDeleteUtils.js +150 -0
- package/package/components/flows/flowDeleteUtils.test.d.ts +1 -0
- package/package/components/flows/flowDeleteUtils.test.js +131 -0
- package/package/components/flows/flowDiff.d.ts +2 -47
- package/package/components/flows/flowDiff.js +16 -293
- package/package/components/flows/flowDiff.testUtils.d.ts +8 -0
- package/package/components/flows/flowDiff.testUtils.js +26 -0
- package/package/components/flows/flowDiffManager.svelte.js +20 -75
- package/package/components/flows/flowDiffManager.svelte.test.js +103 -2
- package/package/components/flows/flowExplorer.d.ts +4 -0
- package/package/components/flows/flowExplorer.js +7 -30
- package/package/components/flows/flowState.d.ts +1 -0
- package/package/components/flows/flowStateUtils.svelte.js +11 -2
- package/package/components/flows/flowTree.d.ts +91 -0
- package/package/components/flows/flowTree.js +326 -0
- package/package/components/flows/flowTree.test.d.ts +1 -0
- package/package/components/flows/flowTree.test.js +236 -0
- package/package/components/flows/map/FlowJobsMenu.svelte +36 -30
- package/package/components/flows/map/FlowModuleSchemaItem.svelte +1 -1
- package/package/components/flows/map/FlowModuleSchemaMap.svelte +73 -229
- package/package/components/flows/map/FlowModuleSchemaMap.svelte.d.ts +1 -2
- package/package/components/flows/pickers/PickHubScriptQuick.svelte +2 -2
- package/package/components/flows/previousResults.js +13 -41
- package/package/components/flows/previousResults.test.d.ts +1 -0
- package/package/components/flows/previousResults.test.js +65 -0
- package/package/components/flows/propPicker/OutputPicker.svelte +2 -1
- package/package/components/flows/propPicker/OutputPickerInner.svelte +41 -4
- package/package/components/flows/propPicker/StepHistory.svelte +9 -1
- package/package/components/git_sync/GitSyncContext.svelte.js +11 -7
- package/package/components/git_sync/GitSyncRepositoryCard.svelte +2 -29
- package/package/components/git_sync/PullWorkspaceModal.svelte +6 -7
- package/package/components/graph/FlowGraphV2.svelte +8 -4
- package/package/components/graph/FlowGraphV2.svelte.d.ts +2 -0
- package/package/components/graph/groupedModulesProxy.svelte.d.ts +10 -0
- package/package/components/graph/groupedModulesProxy.svelte.js +17 -1
- package/package/components/graph/renderers/triggers/TriggersBadge.svelte +8 -2
- package/package/components/home/HomeConnectDrawer.svelte +125 -0
- package/package/components/home/HomeConnectDrawer.svelte.d.ts +5 -0
- package/package/components/home/deploy_ui.js +1 -1
- package/package/components/icons/AzureIcon.svelte +12 -25
- package/package/components/icons/AzureIcon.svelte.d.ts +3 -2
- package/package/components/icons/GithubIcon.svelte +4 -4
- package/package/components/icons/GithubIcon.svelte.d.ts +5 -2
- package/package/components/instanceSettings/ExternalJwtTokens.svelte +85 -0
- package/package/components/instanceSettings/ExternalJwtTokens.svelte.d.ts +12 -0
- package/package/components/instanceSettings/GhesAppSettings.svelte +17 -0
- package/package/components/instanceSettings/IndexerMemorySettings.svelte +56 -29
- package/package/components/instanceSettings/SecretBackendConfig.svelte +9 -2
- package/package/components/instanceSettings.d.ts +1 -0
- package/package/components/instanceSettings.js +66 -8
- package/package/components/mcp/McpScopeSelector.svelte +119 -9
- package/package/components/mcp/McpScopeSelector.svelte.d.ts +1 -0
- package/package/components/offboarding-utils.d.ts +11 -0
- package/package/components/offboarding-utils.js +102 -0
- package/package/components/progressBar/ProgressBar.svelte +9 -5
- package/package/components/progressBar/ProgressBar.svelte.d.ts +1 -0
- package/package/components/raw_apps/DeleteAfterUsePopup.svelte +52 -0
- package/package/components/raw_apps/DeleteAfterUsePopup.svelte.d.ts +9 -0
- package/package/components/raw_apps/RawAppBackgroundRunner.svelte +5 -1
- package/package/components/raw_apps/RawAppDataTableDrawer.svelte +1 -1
- package/package/components/raw_apps/RawAppEditor.svelte +186 -102
- package/package/components/raw_apps/RawAppEditorHeader.svelte +6 -1
- package/package/components/raw_apps/RawAppEditorHeader.svelte.d.ts +1 -0
- package/package/components/raw_apps/RawAppInlineScriptEditor.svelte +9 -3
- package/package/components/raw_apps/RawAppInlineScriptEditor.svelte.d.ts +2 -1
- package/package/components/raw_apps/RawAppInlineScriptRunnable.svelte +1 -0
- package/package/components/raw_apps/RawAppInlineScriptRunnable.svelte.d.ts +1 -0
- package/package/components/raw_apps/RawAppInputsSpecEditor.svelte +48 -5
- package/package/components/raw_apps/RawAppSharedUiDrawer.svelte +129 -0
- package/package/components/raw_apps/RawAppSharedUiDrawer.svelte.d.ts +5 -0
- package/package/components/raw_apps/RawAppSidebar.svelte +12 -0
- package/package/components/raw_apps/RawAppYamlEditor.svelte +81 -0
- package/package/components/raw_apps/RawAppYamlEditor.svelte.d.ts +20 -0
- package/package/components/raw_apps/dataTableRefUtils.d.ts +7 -0
- package/package/components/raw_apps/dataTableRefUtils.js +34 -0
- package/package/components/raw_apps/dataTableRefUtils.test.d.ts +1 -0
- package/package/components/raw_apps/dataTableRefUtils.test.js +29 -0
- package/package/components/raw_apps/datatableUtils.svelte.js +1 -1
- package/package/components/raw_apps/rawAppPolicy.d.ts +1 -0
- package/package/components/raw_apps/rawAppPolicy.js +17 -2
- package/package/components/resources/resourceTypesFilter.d.ts +19 -0
- package/package/components/resources/resourceTypesFilter.js +21 -0
- package/package/components/restartFromStepPath.d.ts +39 -0
- package/package/components/restartFromStepPath.js +89 -0
- package/package/components/runs/JobDetailFieldConfig.d.ts +1 -0
- package/package/components/runs/JobDetailFieldConfig.js +57 -10
- package/package/components/runs/JobDetailHeader.svelte +24 -3
- package/package/components/runs/runsFilter.d.ts +1 -1
- package/package/components/schema/FlowPropertyEditor.svelte +30 -1
- package/package/components/schema/FlowPropertyEditor.svelte.d.ts +5 -2
- package/package/components/script_builder.d.ts +1 -1
- package/package/components/search/GlobalSearchModal.svelte +8 -1
- package/package/components/select/Select.svelte +3 -2
- package/package/components/select/Select.svelte.d.ts +1 -0
- package/package/components/settings/CreateToken.svelte +91 -71
- package/package/components/settings/CreateToken.svelte.d.ts +3 -0
- package/package/components/settings/EditTokenScopesModal.svelte +57 -0
- package/package/components/settings/EditTokenScopesModal.svelte.d.ts +10 -0
- package/package/components/settings/ScopesPicker.svelte +43 -0
- package/package/components/settings/ScopesPicker.svelte.d.ts +11 -0
- package/package/components/settings/TokensTable.svelte +51 -15
- package/package/components/settings/WorkspaceUserSettings.svelte +34 -28
- package/package/components/sidebar/OperatorMenu.svelte +6 -0
- package/package/components/sidebar/SidebarContent.svelte +68 -2
- package/package/components/sidebar/WorkspaceMenu.svelte +8 -4
- package/package/components/triggers/AddTriggersButton.svelte +17 -0
- package/package/components/triggers/CaptureWrapper.svelte +19 -1
- package/package/components/triggers/PermissionedAsLine.svelte +37 -3
- package/package/components/triggers/PermissionedAsLine.svelte.d.ts +6 -0
- package/package/components/triggers/TriggerEditorToolbar.svelte.d.ts +1 -1
- package/package/components/triggers/TriggerModeToggle.svelte +36 -7
- package/package/components/triggers/TriggerModeToggle.svelte.d.ts +1 -1
- package/package/components/triggers/TriggerSuspendedJobsModal.svelte.d.ts +1 -1
- package/package/components/triggers/TriggersEditor.svelte +10 -2
- package/package/components/triggers/TriggersWrapper.svelte +20 -0
- package/package/components/triggers/azure/AzureCapture.svelte +41 -0
- package/package/components/triggers/azure/AzureCapture.svelte.d.ts +44 -0
- package/package/components/triggers/azure/AzureTriggerEditor.svelte +20 -0
- package/package/components/triggers/azure/AzureTriggerEditor.svelte.d.ts +9 -0
- package/package/components/triggers/azure/AzureTriggerEditorConfigSection.svelte +301 -0
- package/package/components/triggers/azure/AzureTriggerEditorConfigSection.svelte.d.ts +16 -0
- package/package/components/triggers/azure/AzureTriggerEditorInner.svelte +422 -0
- package/package/components/triggers/azure/AzureTriggerEditorInner.svelte.d.ts +25 -0
- package/package/components/triggers/azure/AzureTriggerPanel.svelte +55 -0
- package/package/components/triggers/azure/AzureTriggerPanel.svelte.d.ts +10 -0
- package/{dist/sharedUtils/components/triggers/kafka → package/components/triggers/azure}/utils.d.ts +1 -1
- package/package/components/triggers/azure/utils.js +56 -0
- package/package/components/triggers/email/EmailTriggerEditorInner.svelte +15 -11
- package/package/components/triggers/gcp/GcpTriggerEditorInner.svelte +22 -14
- package/package/components/triggers/http/RouteEditorConfigSection.svelte +15 -7
- package/package/components/triggers/http/RouteEditorInner.svelte +16 -14
- package/package/components/triggers/http/RoutesGenerator.svelte +6 -1
- package/package/components/triggers/http/RoutesPanel.svelte +1 -1
- package/package/components/triggers/http/utils.d.ts +1 -1
- package/package/components/triggers/http/utils.js +2 -2
- package/package/components/triggers/kafka/KafkaTriggerEditorInner.svelte +22 -14
- package/package/components/triggers/mqtt/MqttTriggerEditorInner.svelte +22 -14
- package/package/components/triggers/native/NativeTriggerEditor.svelte +3 -0
- package/package/components/triggers/native/services/github/GitHubTriggerForm.svelte +118 -0
- package/package/components/triggers/native/services/github/GitHubTriggerForm.svelte.d.ts +17 -0
- package/package/components/triggers/native/utils.js +14 -0
- package/package/components/triggers/nats/NatsTriggerEditor.svelte.d.ts +4 -3
- package/package/components/triggers/nats/NatsTriggerEditorInner.svelte +22 -14
- package/package/components/triggers/postgres/PostgresTriggerEditor.svelte.d.ts +4 -3
- package/package/components/triggers/postgres/PostgresTriggerEditorInner.svelte +22 -14
- package/package/components/triggers/schedules/ScheduleEditorInner.svelte +22 -14
- package/package/components/triggers/sqs/SqsTriggerEditor.svelte.d.ts +4 -3
- package/package/components/triggers/sqs/SqsTriggerEditorInner.svelte +22 -14
- package/package/components/triggers/triggers.svelte.d.ts +1 -0
- package/package/components/triggers/triggers.svelte.js +24 -1
- package/package/components/triggers/utils.js +47 -6
- package/package/components/triggers/websocket/WebsocketTriggerEditorInner.svelte +22 -14
- package/package/components/triggers.d.ts +1 -1
- package/package/components/useFolderDefaultPermissionedAs.svelte.d.ts +13 -0
- package/package/components/useFolderDefaultPermissionedAs.svelte.js +63 -0
- package/package/components/useNestedRestartState.svelte.d.ts +56 -0
- package/package/components/useNestedRestartState.svelte.js +320 -0
- package/package/components/workspaceSettings/CreateWorkspace.svelte +16 -677
- package/package/components/workspaceSettings/CreateWorkspaceInner.svelte +604 -0
- package/package/components/workspaceSettings/CreateWorkspaceInner.svelte.d.ts +7 -0
- package/package/components/workspaceSettings/CustomInstanceDbSelect.svelte +27 -25
- package/package/components/workspaceSettings/CustomInstanceDbWizardModal.svelte +46 -8
- package/package/components/workspaceSettings/DataTableSettings.svelte +27 -22
- package/package/components/workspaceSettings/DucklakeSettings.svelte +1 -1
- package/package/components/workspaceSettings/ForkDatatableSection.svelte +228 -0
- package/package/components/workspaceSettings/ForkDatatableSection.svelte.d.ts +28 -0
- package/package/components/workspaceSettings/GitSyncFilterSettings.svelte +8 -2
- package/package/components/workspaceSettings/RulesetEditor.svelte +27 -2
- package/package/components/workspaceSettings/SharedUiSettings.svelte +175 -0
- package/package/components/workspaceSettings/SharedUiSettings.svelte.d.ts +3 -0
- package/package/components/workspaceSettings/VolumeStorageSettings.svelte +1 -1
- package/package/components/workspaceSettings/WorkspaceIntegrations.svelte +17 -1
- package/package/consts.d.ts +3 -0
- package/package/consts.js +10 -0
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/schemas.gen.d.ts +795 -59
- package/package/gen/schemas.gen.js +801 -60
- package/package/gen/services.gen.d.ts +475 -5
- package/package/gen/services.gen.js +976 -23
- package/package/gen/types.gen.d.ts +1865 -75
- package/package/githubApp.js +5 -1
- package/package/hubPaths.json +2 -8
- package/package/infer.d.ts +1 -1
- package/package/infer.js +50 -52
- package/package/infer.svelte.js +10 -1
- package/package/mcpEndpointTools.js +60 -4
- package/package/monaco_workers/sqlTypePlugin.worker.d.ts +10 -0
- package/package/monaco_workers/sqlTypePlugin.worker.js +39 -0
- package/package/script_helpers.d.ts +8 -2
- package/package/script_helpers.js +31 -0
- package/package/stores.d.ts +11 -0
- package/package/stores.js +6 -0
- package/package/system_prompts/index.d.ts +1 -0
- package/package/system_prompts/index.js +8 -0
- package/package/system_prompts/prompts.d.ts +17 -13
- package/package/system_prompts/prompts.js +921 -61
- package/package/templates/ci_test_bun.ts.template +27 -0
- package/package/templates/ci_test_python.py.template +26 -0
- package/package/utils/forkConflict.d.ts +26 -0
- package/package/utils/forkConflict.js +56 -0
- package/package/utils_deployable.d.ts +164 -121
- package/package/utils_deployable.js +61 -11
- package/package/utils_workspace_deploy.d.ts +8 -8
- package/package/utils_workspace_deploy.js +89 -421
- package/package.json +30 -6
- package/dist/sharedUtils/assets/tokens/colorTokensConfig.d.ts +0 -2
- package/dist/sharedUtils/base.d.ts +0 -1
- package/dist/sharedUtils/cloud.d.ts +0 -1
- package/dist/sharedUtils/common.d.ts +0 -111
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/count.d.ts +0 -5
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/delete.d.ts +0 -5
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/insert.d.ts +0 -5
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/select.d.ts +0 -13
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/update.d.ts +0 -11
- package/dist/sharedUtils/components/apps/components/display/dbtable/utils.d.ts +0 -95
- package/dist/sharedUtils/components/apps/editor/appPolicy.d.ts +0 -6
- package/dist/sharedUtils/components/apps/editor/appUtilsCore.d.ts +0 -7
- package/dist/sharedUtils/components/apps/editor/appUtilsS3.d.ts +0 -33
- package/dist/sharedUtils/components/apps/editor/commonAppUtils.d.ts +0 -10
- package/dist/sharedUtils/components/apps/editor/component/components.d.ts +0 -5371
- package/dist/sharedUtils/components/apps/editor/component/default-codes.d.ts +0 -3
- package/dist/sharedUtils/components/apps/editor/component/index.d.ts +0 -3
- package/dist/sharedUtils/components/apps/editor/component/sets.d.ts +0 -7
- package/dist/sharedUtils/components/apps/editor/componentsPanel/componentDefaultProps.d.ts +0 -3
- package/dist/sharedUtils/components/apps/gridUtils.d.ts +0 -14
- package/dist/sharedUtils/components/apps/inputType.d.ts +0 -178
- package/dist/sharedUtils/components/apps/rx.d.ts +0 -29
- package/dist/sharedUtils/components/apps/sharedTypes.d.ts +0 -21
- package/dist/sharedUtils/components/apps/types.d.ts +0 -274
- package/dist/sharedUtils/components/assets/lib.d.ts +0 -25
- package/dist/sharedUtils/components/common/alert/model.d.ts +0 -2
- package/dist/sharedUtils/components/common/badge/model.d.ts +0 -8
- package/dist/sharedUtils/components/common/button/model.d.ts +0 -45
- package/dist/sharedUtils/components/common/fileInput/model.d.ts +0 -1
- package/dist/sharedUtils/components/common/index.d.ts +0 -24
- package/dist/sharedUtils/components/common/skeleton/model.d.ts +0 -21
- package/dist/sharedUtils/components/dbTypes.d.ts +0 -14
- package/dist/sharedUtils/components/diff_drawer.d.ts +0 -26
- package/dist/sharedUtils/components/ducklake.d.ts +0 -1
- package/dist/sharedUtils/components/flows/scheduleUtils.d.ts +0 -7
- package/dist/sharedUtils/components/icons/index.d.ts +0 -101
- package/dist/sharedUtils/components/random_positive_adjetive.d.ts +0 -1
- package/dist/sharedUtils/components/raw_apps/rawAppPolicy.d.ts +0 -10
- package/dist/sharedUtils/components/raw_apps/utils.d.ts +0 -15
- package/dist/sharedUtils/components/triggers/email/utils.d.ts +0 -4
- package/dist/sharedUtils/components/triggers/gcp/utils.d.ts +0 -2
- package/dist/sharedUtils/components/triggers/http/utils.d.ts +0 -11
- package/dist/sharedUtils/components/triggers/mqtt/utils.d.ts +0 -2
- package/dist/sharedUtils/components/triggers/nats/utils.d.ts +0 -2
- package/dist/sharedUtils/components/triggers/postgres/utils.d.ts +0 -8
- package/dist/sharedUtils/components/triggers/sqs/utils.d.ts +0 -2
- package/dist/sharedUtils/components/triggers/triggers.svelte.d.ts +0 -32
- package/dist/sharedUtils/components/triggers/utils.d.ts +0 -80
- package/dist/sharedUtils/components/triggers/websocket/utils.d.ts +0 -2
- package/dist/sharedUtils/components/triggers.d.ts +0 -20
- package/dist/sharedUtils/gen/core/ApiError.d.ts +0 -10
- package/dist/sharedUtils/gen/core/ApiRequestOptions.d.ts +0 -13
- package/dist/sharedUtils/gen/core/ApiResult.d.ts +0 -7
- package/dist/sharedUtils/gen/core/CancelablePromise.d.ts +0 -26
- package/dist/sharedUtils/gen/core/OpenAPI.d.ts +0 -27
- package/dist/sharedUtils/gen/core/request.d.ts +0 -29
- package/dist/sharedUtils/gen/index.d.ts +0 -6
- package/dist/sharedUtils/gen/schemas.gen.d.ts +0 -7036
- package/dist/sharedUtils/gen/services.gen.d.ts +0 -6047
- package/dist/sharedUtils/gen/types.gen.d.ts +0 -21881
- package/dist/sharedUtils/history.svelte.d.ts +0 -9
- package/dist/sharedUtils/hub.d.ts +0 -49
- package/dist/sharedUtils/jsr.json +0 -6
- package/dist/sharedUtils/lib.d.ts +0 -5
- package/dist/sharedUtils/lib.es.js +0 -1588
- package/dist/sharedUtils/package.json +0 -12
- package/dist/sharedUtils/schema.d.ts +0 -3
- package/dist/sharedUtils/stores.d.ts +0 -97
- package/dist/sharedUtils/svelte5Utils.svelte.d.ts +0 -80
- package/dist/sharedUtils/toast.d.ts +0 -8
- package/dist/sharedUtils/utils.d.ts +0 -265
- package/package/components/copilot/chat/__tests__/app/appChat.eval.test.js +0 -153
- package/package/components/copilot/chat/__tests__/app/appEvalComparison.d.ts +0 -21
- package/package/components/copilot/chat/__tests__/app/appEvalComparison.js +0 -136
- package/package/components/copilot/chat/__tests__/app/appEvalHelpers.d.ts +0 -15
- package/package/components/copilot/chat/__tests__/app/appEvalHelpers.js +0 -107
- package/package/components/copilot/chat/__tests__/app/appEvalRunner.d.ts +0 -50
- package/package/components/copilot/chat/__tests__/app/appEvalRunner.js +0 -93
- package/package/components/copilot/chat/__tests__/app/appFixtureLoader.d.ts +0 -29
- package/package/components/copilot/chat/__tests__/app/appFixtureLoader.js +0 -134
- package/package/components/copilot/chat/__tests__/app/appResultsWriter.d.ts +0 -30
- package/package/components/copilot/chat/__tests__/app/appResultsWriter.js +0 -197
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/createFolder/main.d.ts +0 -10
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/createFolder/main.js +0 -9
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/createFolder/meta.json +0 -4
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/deleteItem/main.d.ts +0 -6
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/deleteItem/main.js +0 -5
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/deleteItem/meta.json +0 -4
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/listFiles/main.d.ts +0 -12
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/listFiles/main.js +0 -14
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/listFiles/meta.json +0 -4
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/listFolders/main.d.ts +0 -8
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/listFolders/main.js +0 -25
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/listFolders/meta.json +0 -4
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/moveItem/main.d.ts +0 -7
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/moveItem/main.js +0 -5
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/moveItem/meta.json +0 -4
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/renameItem/main.d.ts +0 -8
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/renameItem/main.js +0 -5
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/backend/renameItem/meta.json +0 -4
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/frontend/components/Breadcrumb.d.ts +0 -10
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/frontend/components/Breadcrumb.tsx +0 -26
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/frontend/components/FileItem.d.ts +0 -10
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/frontend/components/FileItem.tsx +0 -79
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/frontend/components/FileList.d.ts +0 -10
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/frontend/components/FileList.tsx +0 -46
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/frontend/components/FolderTree.d.ts +0 -10
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/frontend/components/FolderTree.tsx +0 -56
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/frontend/components/Toolbar.d.ts +0 -6
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/frontend/components/Toolbar.tsx +0 -59
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/frontend/index.d.ts +0 -16
- package/package/components/copilot/chat/__tests__/app/initial/file_manager/frontend/index.tsx +0 -119
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/backend/addToCart/main.d.ts +0 -15
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/backend/addToCart/main.js +0 -14
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/backend/addToCart/meta.json +0 -4
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/backend/calculateTotal/main.d.ts +0 -14
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/backend/calculateTotal/main.js +0 -5
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/backend/calculateTotal/meta.json +0 -4
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/backend/getProducts/main.d.ts +0 -6
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/backend/getProducts/main.js +0 -41
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/backend/getProducts/meta.json +0 -4
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/backend/removeFromCart/main.d.ts +0 -15
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/backend/removeFromCart/main.js +0 -3
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/backend/removeFromCart/meta.json +0 -4
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/frontend/components/Cart.d.ts +0 -9
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/frontend/components/Cart.tsx +0 -51
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/frontend/components/ProductCard.d.ts +0 -8
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/frontend/components/ProductCard.tsx +0 -27
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/frontend/components/ProductList.d.ts +0 -8
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/frontend/components/ProductList.tsx +0 -18
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/frontend/index.d.ts +0 -12
- package/package/components/copilot/chat/__tests__/app/initial/shopping_cart/frontend/index.tsx +0 -81
- package/package/components/copilot/chat/__tests__/app/initial/test1_counter_app/backend/decrementCounter/main.d.ts +0 -3
- package/package/components/copilot/chat/__tests__/app/initial/test1_counter_app/backend/decrementCounter/main.js +0 -3
- package/package/components/copilot/chat/__tests__/app/initial/test1_counter_app/backend/decrementCounter/meta.json +0 -4
- package/package/components/copilot/chat/__tests__/app/initial/test1_counter_app/backend/incrementCounter/main.d.ts +0 -3
- package/package/components/copilot/chat/__tests__/app/initial/test1_counter_app/backend/incrementCounter/main.js +0 -3
- package/package/components/copilot/chat/__tests__/app/initial/test1_counter_app/backend/incrementCounter/meta.json +0 -4
- package/package/components/copilot/chat/__tests__/app/initial/test1_counter_app/frontend/index.d.ts +0 -2
- package/package/components/copilot/chat/__tests__/app/initial/test1_counter_app/frontend/index.tsx +0 -38
- package/package/components/copilot/chat/__tests__/app/variants/baseline.d.ts +0 -6
- package/package/components/copilot/chat/__tests__/app/variants/baseline.js +0 -10
- package/package/components/copilot/chat/__tests__/app/variants/index.d.ts +0 -3
- package/package/components/copilot/chat/__tests__/app/variants/index.js +0 -3
- package/package/components/copilot/chat/__tests__/app/variants/streamlined.d.ts +0 -6
- package/package/components/copilot/chat/__tests__/app/variants/streamlined.js +0 -137
- package/package/components/copilot/chat/__tests__/flow/expected/test1.json +0 -134
- package/package/components/copilot/chat/__tests__/flow/expected/test2.json +0 -183
- package/package/components/copilot/chat/__tests__/flow/expected/test3.json +0 -204
- package/package/components/copilot/chat/__tests__/flow/expected/test4.json +0 -175
- package/package/components/copilot/chat/__tests__/flow/expected/test5_modify_simple.json +0 -68
- package/package/components/copilot/chat/__tests__/flow/expected/test6_modify_medium.json +0 -142
- package/package/components/copilot/chat/__tests__/flow/expected/test7_modify_complex.json +0 -136
- package/package/components/copilot/chat/__tests__/flow/flowChat.eval.test.js +0 -294
- package/package/components/copilot/chat/__tests__/flow/flowEvalComparison.d.ts +0 -17
- package/package/components/copilot/chat/__tests__/flow/flowEvalComparison.js +0 -49
- package/package/components/copilot/chat/__tests__/flow/flowEvalHelpers.d.ts +0 -12
- package/package/components/copilot/chat/__tests__/flow/flowEvalHelpers.js +0 -79
- package/package/components/copilot/chat/__tests__/flow/flowEvalRunner.d.ts +0 -50
- package/package/components/copilot/chat/__tests__/flow/flowEvalRunner.js +0 -102
- package/package/components/copilot/chat/__tests__/flow/initial/test5_initial.json +0 -53
- package/package/components/copilot/chat/__tests__/flow/initial/test6_initial.json +0 -68
- package/package/components/copilot/chat/__tests__/flow/initial/test7_initial.json +0 -120
- package/package/components/copilot/chat/__tests__/flow/variants/baseline.d.ts +0 -6
- package/package/components/copilot/chat/__tests__/flow/variants/baseline.js +0 -10
- package/package/components/copilot/chat/__tests__/flow/variants/index.d.ts +0 -3
- package/package/components/copilot/chat/__tests__/flow/variants/index.js +0 -3
- package/package/components/copilot/chat/__tests__/flow/variants/minimal-single-tool.d.ts +0 -15
- package/package/components/copilot/chat/__tests__/flow/variants/minimal-single-tool.js +0 -388
- package/package/components/copilot/chat/__tests__/shared/baseEvalRunner.d.ts +0 -45
- package/package/components/copilot/chat/__tests__/shared/baseEvalRunner.js +0 -121
- package/package/components/copilot/chat/__tests__/shared/baseLLMEvaluator.d.ts +0 -28
- package/package/components/copilot/chat/__tests__/shared/baseLLMEvaluator.js +0 -96
- package/package/components/copilot/chat/__tests__/shared/baseResultsWriter.d.ts +0 -32
- package/package/components/copilot/chat/__tests__/shared/baseResultsWriter.js +0 -130
- package/package/components/copilot/chat/__tests__/shared/baseVariants.d.ts +0 -45
- package/package/components/copilot/chat/__tests__/shared/baseVariants.js +0 -57
- package/package/components/copilot/chat/__tests__/shared/index.d.ts +0 -10
- package/package/components/copilot/chat/__tests__/shared/index.js +0 -5
- package/package/components/copilot/chat/__tests__/shared/types.d.ts +0 -105
- package/package/components/copilot/chat/__tests__/shared/types.js +0 -9
- package/package/components/copilot/chat/flow/openFlowZod.js +0 -24
- package/package/components/copilot/chat/flow/utils.d.ts +0 -14
- package/package/components/copilot/chat/flow/utils.js +0 -108
- package/package/components/flows/agentToolUtils.test.js +0 -55
- /package/package/components/copilot/chat/{__tests__/app/appChat.eval.test.d.ts → app/core.test.d.ts} +0 -0
- /package/package/components/copilot/chat/{__tests__/flow/flowChat.eval.test.d.ts → flow/helperUtils.test.d.ts} +0 -0
- /package/package/components/copilot/chat/flow/{openFlowZod.d.ts → openFlowZod.gen.d.ts} +0 -0
- /package/package/components/{flows/agentToolUtils.test.d.ts → copilot/chat/flow/utils.test.d.ts} +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
vi.mock('../aiProviderStorage', () => ({
|
|
3
|
+
loadStoredConfig: () => undefined
|
|
4
|
+
}));
|
|
5
|
+
vi.mock('./flowInfers', () => ({
|
|
6
|
+
AI_AGENT_SCHEMA: { properties: {} }
|
|
7
|
+
}));
|
|
8
|
+
import { GroupDisplayState } from '../graph/groupEditor.svelte';
|
|
9
|
+
import { createDeletePlan, removeDeletePlanTools, resolveDeleteTargets } from './flowDeleteUtils';
|
|
10
|
+
function makeRawModule(id, expr) {
|
|
11
|
+
return {
|
|
12
|
+
id,
|
|
13
|
+
summary: id,
|
|
14
|
+
value: {
|
|
15
|
+
type: 'rawscript',
|
|
16
|
+
content: '',
|
|
17
|
+
language: 'python3',
|
|
18
|
+
input_transforms: expr
|
|
19
|
+
? {
|
|
20
|
+
user_input: {
|
|
21
|
+
type: 'javascript',
|
|
22
|
+
expr
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
: {}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function makeAiAgent(id, tools) {
|
|
30
|
+
return {
|
|
31
|
+
id,
|
|
32
|
+
summary: id,
|
|
33
|
+
value: {
|
|
34
|
+
type: 'aiagent',
|
|
35
|
+
tools,
|
|
36
|
+
input_transforms: {}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function makeFlowModuleTool(module) {
|
|
41
|
+
return {
|
|
42
|
+
id: module.id,
|
|
43
|
+
summary: module.summary,
|
|
44
|
+
value: {
|
|
45
|
+
tool_type: 'flowmodule',
|
|
46
|
+
...module.value
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
describe('resolveDeleteTargets', () => {
|
|
51
|
+
it('resolves structure nodes, preprocessor, and ai tools while pruning nested descendants', () => {
|
|
52
|
+
const rootAgent = makeAiAgent('root_agent', [
|
|
53
|
+
makeFlowModuleTool(makeRawModule('lookup_user')),
|
|
54
|
+
makeFlowModuleTool(makeAiAgent('support_agent', [makeFlowModuleTool(makeRawModule('create_ticket'))]))
|
|
55
|
+
]);
|
|
56
|
+
const tree = [{ id: 'root_agent', kind: 'leaf', branches: [] }];
|
|
57
|
+
const { targets, missingIds } = resolveDeleteTargets(tree, [rootAgent], ['preprocessor', 'root_agent', 'create_ticket', 'missing_tool'], true);
|
|
58
|
+
expect(targets.map((target) => target.kind)).toEqual(['preprocessor', 'structure_node']);
|
|
59
|
+
expect(targets[1].stateIds).toEqual([
|
|
60
|
+
'root_agent',
|
|
61
|
+
'lookup_user',
|
|
62
|
+
'support_agent',
|
|
63
|
+
'create_ticket'
|
|
64
|
+
]);
|
|
65
|
+
expect(missingIds).toEqual(['missing_tool']);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
describe('createDeletePlan', () => {
|
|
69
|
+
it('collects subtree dependents and routes structure deletes through the proxy helper', () => {
|
|
70
|
+
const agent = makeAiAgent('agent_step', [makeFlowModuleTool(makeRawModule('lookup_user'))]);
|
|
71
|
+
const dependent = makeRawModule('dependent_step', 'results.lookup_user?.value');
|
|
72
|
+
const flow = {
|
|
73
|
+
summary: 'Flow',
|
|
74
|
+
value: {
|
|
75
|
+
modules: [agent, dependent]
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const tree = [
|
|
79
|
+
{ id: 'agent_step', kind: 'leaf', branches: [] },
|
|
80
|
+
{ id: 'dependent_step', kind: 'leaf', branches: [] }
|
|
81
|
+
];
|
|
82
|
+
const commit = vi.fn();
|
|
83
|
+
const prepareDelete = vi.fn(() => ({
|
|
84
|
+
affectedGroups: [],
|
|
85
|
+
duplicateGroups: [],
|
|
86
|
+
commit
|
|
87
|
+
}));
|
|
88
|
+
const proxy = {
|
|
89
|
+
prepareDelete
|
|
90
|
+
};
|
|
91
|
+
const plan = createDeletePlan({
|
|
92
|
+
ids: ['agent_step'],
|
|
93
|
+
flow,
|
|
94
|
+
tree,
|
|
95
|
+
proxy,
|
|
96
|
+
displayState: new GroupDisplayState(() => [])
|
|
97
|
+
});
|
|
98
|
+
expect(prepareDelete).toHaveBeenCalledWith(['agent_step'], expect.any(Object));
|
|
99
|
+
expect(plan?.plannedStateIds).toEqual(['agent_step', 'lookup_user']);
|
|
100
|
+
expect(plan?.structureDelete?.affectedGroups).toEqual([]);
|
|
101
|
+
expect(plan?.dependents).toEqual({
|
|
102
|
+
dependent_step: ['results.lookup_user?.value']
|
|
103
|
+
});
|
|
104
|
+
expect(plan?.selection).toEqual({ kind: 'select', id: 'dependent_step' });
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
describe('removeDeletePlanTools', () => {
|
|
108
|
+
it('removes nested tools before their parents and returns every removed id', () => {
|
|
109
|
+
const rootAgent = makeAiAgent('root_agent', [
|
|
110
|
+
makeFlowModuleTool(makeAiAgent('support_agent', [makeFlowModuleTool(makeRawModule('create_ticket'))]))
|
|
111
|
+
]);
|
|
112
|
+
const tree = [];
|
|
113
|
+
const { targets } = resolveDeleteTargets(tree, [rootAgent], ['support_agent', 'create_ticket'], false);
|
|
114
|
+
expect(removeDeletePlanTools(targets, [rootAgent])).toEqual(['support_agent', 'create_ticket']);
|
|
115
|
+
expect(rootAgent.value.tools).toEqual([]);
|
|
116
|
+
});
|
|
117
|
+
it('re-resolves live owners before removing planned tool targets', () => {
|
|
118
|
+
const rootAgent = makeAiAgent('root_agent', [
|
|
119
|
+
makeFlowModuleTool(makeRawModule('lookup_user')),
|
|
120
|
+
makeFlowModuleTool(makeAiAgent('support_agent', [makeFlowModuleTool(makeRawModule('create_ticket'))]))
|
|
121
|
+
]);
|
|
122
|
+
const tree = [];
|
|
123
|
+
const { targets } = resolveDeleteTargets(tree, [rootAgent], ['support_agent'], false);
|
|
124
|
+
rootAgent.value.tools.unshift(makeFlowModuleTool(makeRawModule('new_lookup')));
|
|
125
|
+
expect(removeDeletePlanTools(targets, [rootAgent])).toEqual(['support_agent', 'create_ticket']);
|
|
126
|
+
expect(rootAgent.value.tools.map((tool) => tool.id)).toEqual([
|
|
127
|
+
'new_lookup',
|
|
128
|
+
'lookup_user'
|
|
129
|
+
]);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { FlowModule, FlowValue } from '../../gen';
|
|
2
|
+
import { type ModuleParentLocation } from './flowTree';
|
|
3
|
+
export { findModuleInFlow, findModuleParent, type ModuleParentLocation } from './flowTree';
|
|
2
4
|
/** Prefix added to module IDs when the original module coexists with a replacement */
|
|
3
5
|
export declare const DUPLICATE_MODULE_PREFIX = "old__";
|
|
4
6
|
/** Prefix added to new module IDs when restoring original during type change rejection */
|
|
@@ -52,45 +54,6 @@ export declare function computeFlowModuleDiff(beforeFlow: FlowValue, afterFlow:
|
|
|
52
54
|
* Index within the container is not considered (modules can be reordered).
|
|
53
55
|
*/
|
|
54
56
|
export declare function locationsEqual(a: ModuleParentLocation | null, b: ModuleParentLocation | null): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Represents the parent location of a module
|
|
57
|
-
*/
|
|
58
|
-
export type ModuleParentLocation = {
|
|
59
|
-
type: 'root';
|
|
60
|
-
index: number;
|
|
61
|
-
} | {
|
|
62
|
-
type: 'forloop' | 'whileloop';
|
|
63
|
-
parentId: string;
|
|
64
|
-
index: number;
|
|
65
|
-
} | {
|
|
66
|
-
type: 'branchone-default';
|
|
67
|
-
parentId: string;
|
|
68
|
-
index: number;
|
|
69
|
-
} | {
|
|
70
|
-
type: 'branchone-branch';
|
|
71
|
-
parentId: string;
|
|
72
|
-
branchIndex: number;
|
|
73
|
-
index: number;
|
|
74
|
-
} | {
|
|
75
|
-
type: 'branchall-branch';
|
|
76
|
-
parentId: string;
|
|
77
|
-
branchIndex: number;
|
|
78
|
-
index: number;
|
|
79
|
-
} | {
|
|
80
|
-
type: 'aiagent';
|
|
81
|
-
parentId: string;
|
|
82
|
-
index: number;
|
|
83
|
-
} | {
|
|
84
|
-
type: 'failure';
|
|
85
|
-
index: -1;
|
|
86
|
-
} | {
|
|
87
|
-
type: 'preprocessor';
|
|
88
|
-
index: -1;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Finds the parent location of a module in a flow
|
|
92
|
-
*/
|
|
93
|
-
export declare function findModuleParent(flow: FlowValue, moduleId: string): ModuleParentLocation | null;
|
|
94
57
|
/**
|
|
95
58
|
* Builds the complete flow diff result with action maps and merged flow.
|
|
96
59
|
* The merged flow contains all modules from afterFlow plus removed modules from
|
|
@@ -115,14 +78,6 @@ export declare function buildFlowTimeline(beforeFlow: FlowValue, afterFlow: Flow
|
|
|
115
78
|
* @param moduleId - The ID of the module being inserted
|
|
116
79
|
*/
|
|
117
80
|
export declare function insertModuleIntoFlow(targetFlow: FlowValue, moduleToInsert: FlowModule, sourceFlow: FlowValue, moduleId: string): void;
|
|
118
|
-
/**
|
|
119
|
-
* Finds a module by ID anywhere in a flow (including nested modules, failure, and preprocessor)
|
|
120
|
-
*
|
|
121
|
-
* @param flow - The flow to search in
|
|
122
|
-
* @param moduleId - The ID of the module to find
|
|
123
|
-
* @returns The module if found, null otherwise
|
|
124
|
-
*/
|
|
125
|
-
export declare function findModuleInFlow(flow: FlowValue, moduleId: string): FlowModule | null;
|
|
126
81
|
/**
|
|
127
82
|
* Checks if the input schema has changed between two flow versions.
|
|
128
83
|
* The input schema always exists (even if empty), so we only check for modifications.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { dfs } from './dfs';
|
|
2
1
|
import { deepEqual } from 'fast-equals';
|
|
2
|
+
import { collectAllFlowModuleIds, collectFlowNodes, ensureModuleArrayByLocation, findModuleParent, getModuleArrayByLocation } from './flowTree';
|
|
3
|
+
export { findModuleInFlow, findModuleParent } from './flowTree';
|
|
3
4
|
/** Prefix added to module IDs when the original module coexists with a replacement */
|
|
4
5
|
export const DUPLICATE_MODULE_PREFIX = 'old__';
|
|
5
6
|
/** Prefix added to new module IDs when restoring original during type change rejection */
|
|
@@ -103,21 +104,11 @@ export function computeFlowModuleDiff(beforeFlow, afterFlow, options = { markAsP
|
|
|
103
104
|
*/
|
|
104
105
|
function getAllModulesMap(flow) {
|
|
105
106
|
const moduleMap = new Map();
|
|
106
|
-
|
|
107
|
-
const allModules = dfs(flow.modules ?? [], (m) => m);
|
|
108
|
-
for (const module of allModules) {
|
|
107
|
+
for (const { module } of collectFlowNodes(flow)) {
|
|
109
108
|
if (module?.id) {
|
|
110
109
|
moduleMap.set(module.id, module);
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
|
-
// Add failure module if it exists
|
|
114
|
-
if (flow.failure_module?.id) {
|
|
115
|
-
moduleMap.set(flow.failure_module.id, flow.failure_module);
|
|
116
|
-
}
|
|
117
|
-
// Add preprocessor module if it exists
|
|
118
|
-
if (flow.preprocessor_module?.id) {
|
|
119
|
-
moduleMap.set(flow.preprocessor_module.id, flow.preprocessor_module);
|
|
120
|
-
}
|
|
121
112
|
return moduleMap;
|
|
122
113
|
}
|
|
123
114
|
/**
|
|
@@ -125,28 +116,14 @@ function getAllModulesMap(flow) {
|
|
|
125
116
|
*/
|
|
126
117
|
function getAllModulesWithLocation(flow) {
|
|
127
118
|
const result = new Map();
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
119
|
+
for (const entry of collectFlowNodes(flow)) {
|
|
120
|
+
if (entry.module?.id) {
|
|
121
|
+
result.set(entry.module.id, {
|
|
122
|
+
module: entry.module,
|
|
123
|
+
location: entry.location
|
|
124
|
+
});
|
|
135
125
|
}
|
|
136
126
|
}
|
|
137
|
-
// Add special modules
|
|
138
|
-
if (flow.failure_module?.id) {
|
|
139
|
-
result.set(flow.failure_module.id, {
|
|
140
|
-
module: flow.failure_module,
|
|
141
|
-
location: { type: 'failure', index: -1 }
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
if (flow.preprocessor_module?.id) {
|
|
145
|
-
result.set(flow.preprocessor_module.id, {
|
|
146
|
-
module: flow.preprocessor_module,
|
|
147
|
-
location: { type: 'preprocessor', index: -1 }
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
127
|
return result;
|
|
151
128
|
}
|
|
152
129
|
/**
|
|
@@ -177,95 +154,6 @@ export function locationsEqual(a, b) {
|
|
|
177
154
|
return false;
|
|
178
155
|
}
|
|
179
156
|
}
|
|
180
|
-
/**
|
|
181
|
-
* Finds the parent location of a module in a flow
|
|
182
|
-
*/
|
|
183
|
-
export function findModuleParent(flow, moduleId) {
|
|
184
|
-
// Check special modules
|
|
185
|
-
if (flow.failure_module?.id === moduleId) {
|
|
186
|
-
return { type: 'failure', index: -1 };
|
|
187
|
-
}
|
|
188
|
-
if (flow.preprocessor_module?.id === moduleId) {
|
|
189
|
-
return { type: 'preprocessor', index: -1 };
|
|
190
|
-
}
|
|
191
|
-
// Check root level
|
|
192
|
-
const rootIndex = flow.modules?.findIndex((m) => m.id === moduleId);
|
|
193
|
-
if (rootIndex !== undefined && rootIndex >= 0) {
|
|
194
|
-
return { type: 'root', index: rootIndex };
|
|
195
|
-
}
|
|
196
|
-
// Recursively search nested modules
|
|
197
|
-
function searchInModules(modules) {
|
|
198
|
-
for (const module of modules) {
|
|
199
|
-
// Check forloopflow
|
|
200
|
-
if (module.value.type === 'forloopflow') {
|
|
201
|
-
const index = module.value.modules.findIndex((m) => m.id === moduleId);
|
|
202
|
-
if (index >= 0) {
|
|
203
|
-
return { type: 'forloop', parentId: module.id, index };
|
|
204
|
-
}
|
|
205
|
-
const nested = searchInModules(module.value.modules);
|
|
206
|
-
if (nested)
|
|
207
|
-
return nested;
|
|
208
|
-
}
|
|
209
|
-
// Check whileloopflow
|
|
210
|
-
if (module.value.type === 'whileloopflow') {
|
|
211
|
-
const index = module.value.modules.findIndex((m) => m.id === moduleId);
|
|
212
|
-
if (index >= 0) {
|
|
213
|
-
return { type: 'whileloop', parentId: module.id, index };
|
|
214
|
-
}
|
|
215
|
-
const nested = searchInModules(module.value.modules);
|
|
216
|
-
if (nested)
|
|
217
|
-
return nested;
|
|
218
|
-
}
|
|
219
|
-
// Check branchone
|
|
220
|
-
if (module.value.type === 'branchone') {
|
|
221
|
-
// Check default branch
|
|
222
|
-
const defaultIndex = module.value.default.findIndex((m) => m.id === moduleId);
|
|
223
|
-
if (defaultIndex >= 0) {
|
|
224
|
-
return { type: 'branchone-default', parentId: module.id, index: defaultIndex };
|
|
225
|
-
}
|
|
226
|
-
const nestedDefault = searchInModules(module.value.default);
|
|
227
|
-
if (nestedDefault)
|
|
228
|
-
return nestedDefault;
|
|
229
|
-
// Check other branches
|
|
230
|
-
for (let branchIndex = 0; branchIndex < module.value.branches.length; branchIndex++) {
|
|
231
|
-
const branch = module.value.branches[branchIndex];
|
|
232
|
-
const index = branch.modules.findIndex((m) => m.id === moduleId);
|
|
233
|
-
if (index >= 0) {
|
|
234
|
-
return { type: 'branchone-branch', parentId: module.id, branchIndex, index };
|
|
235
|
-
}
|
|
236
|
-
const nested = searchInModules(branch.modules);
|
|
237
|
-
if (nested)
|
|
238
|
-
return nested;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
// Check branchall
|
|
242
|
-
if (module.value.type === 'branchall') {
|
|
243
|
-
for (let branchIndex = 0; branchIndex < module.value.branches.length; branchIndex++) {
|
|
244
|
-
const branch = module.value.branches[branchIndex];
|
|
245
|
-
const index = branch.modules.findIndex((m) => m.id === moduleId);
|
|
246
|
-
if (index >= 0) {
|
|
247
|
-
return { type: 'branchall-branch', parentId: module.id, branchIndex, index };
|
|
248
|
-
}
|
|
249
|
-
const nested = searchInModules(branch.modules);
|
|
250
|
-
if (nested)
|
|
251
|
-
return nested;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
// Check aiagent
|
|
255
|
-
if (module.value.type === 'aiagent' && module.value.tools) {
|
|
256
|
-
const index = module.value.tools.findIndex((m) => m.id === moduleId);
|
|
257
|
-
if (index >= 0) {
|
|
258
|
-
return { type: 'aiagent', parentId: module.id, index };
|
|
259
|
-
}
|
|
260
|
-
const nested = searchInModules(module.value.tools);
|
|
261
|
-
if (nested)
|
|
262
|
-
return nested;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
return null;
|
|
266
|
-
}
|
|
267
|
-
return searchInModules(flow.modules ?? []);
|
|
268
|
-
}
|
|
269
157
|
/**
|
|
270
158
|
* Deep clones a module to avoid mutation
|
|
271
159
|
*/
|
|
@@ -333,48 +221,8 @@ function prependModuleId(module, prefix) {
|
|
|
333
221
|
}
|
|
334
222
|
return newModule;
|
|
335
223
|
}
|
|
336
|
-
/**
|
|
337
|
-
* Collects all module IDs from a flow structure recursively
|
|
338
|
-
*/
|
|
339
224
|
function getAllModuleIds(flow) {
|
|
340
|
-
|
|
341
|
-
function collectFromModules(modules) {
|
|
342
|
-
for (const module of modules) {
|
|
343
|
-
if (module.id) {
|
|
344
|
-
ids.add(module.id);
|
|
345
|
-
}
|
|
346
|
-
// Recursively collect from nested modules
|
|
347
|
-
if (module.value.type === 'forloopflow' || module.value.type === 'whileloopflow') {
|
|
348
|
-
collectFromModules(module.value.modules);
|
|
349
|
-
}
|
|
350
|
-
else if (module.value.type === 'branchone') {
|
|
351
|
-
collectFromModules(module.value.default);
|
|
352
|
-
for (const branch of module.value.branches) {
|
|
353
|
-
collectFromModules(branch.modules);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
else if (module.value.type === 'branchall') {
|
|
357
|
-
for (const branch of module.value.branches) {
|
|
358
|
-
collectFromModules(branch.modules);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
else if (module.value.type === 'aiagent' && module.value.tools) {
|
|
362
|
-
collectFromModules(module.value.tools);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
// Collect from root modules
|
|
367
|
-
if (flow.modules) {
|
|
368
|
-
collectFromModules(flow.modules);
|
|
369
|
-
}
|
|
370
|
-
// Collect from special modules
|
|
371
|
-
if (flow.failure_module?.id) {
|
|
372
|
-
ids.add(flow.failure_module.id);
|
|
373
|
-
}
|
|
374
|
-
if (flow.preprocessor_module?.id) {
|
|
375
|
-
ids.add(flow.preprocessor_module.id);
|
|
376
|
-
}
|
|
377
|
-
return ids;
|
|
225
|
+
return new Set(collectAllFlowModuleIds(flow));
|
|
378
226
|
}
|
|
379
227
|
/**
|
|
380
228
|
* Scans the merged flow for duplicate IDs and prefixes duplicates with 'old__'.
|
|
@@ -503,24 +351,7 @@ function reconstructMergedFlow(afterFlow, beforeFlow, beforeActions) {
|
|
|
503
351
|
}
|
|
504
352
|
// Track the newly added module ID
|
|
505
353
|
mergedIds.add(clonedModule.id);
|
|
506
|
-
|
|
507
|
-
if (parentLocation.type === 'failure') {
|
|
508
|
-
merged.failure_module = clonedModule;
|
|
509
|
-
}
|
|
510
|
-
else if (parentLocation.type === 'preprocessor') {
|
|
511
|
-
merged.preprocessor_module = clonedModule;
|
|
512
|
-
}
|
|
513
|
-
else if (parentLocation.type === 'root') {
|
|
514
|
-
// Find the best position to insert in root modules
|
|
515
|
-
const insertIndex = findBestInsertPosition(merged.modules ?? [], beforeFlow.modules ?? [], parentLocation.index, removedId);
|
|
516
|
-
if (!merged.modules)
|
|
517
|
-
merged.modules = [];
|
|
518
|
-
merged.modules.splice(insertIndex, 0, clonedModule);
|
|
519
|
-
}
|
|
520
|
-
else {
|
|
521
|
-
// Find the parent module in merged flow and insert into it
|
|
522
|
-
insertIntoNestedParent(merged, parentLocation, clonedModule, beforeFlow);
|
|
523
|
-
}
|
|
354
|
+
insertModuleIntoFlow(merged, clonedModule, beforeFlow, removedId);
|
|
524
355
|
}
|
|
525
356
|
// Post-process: fix any duplicate IDs that may have been created
|
|
526
357
|
// This handles the case where a module moved from one location to another
|
|
@@ -554,101 +385,6 @@ function findBestInsertPosition(targetModules, beforeModules, originalIndex, rem
|
|
|
554
385
|
/**
|
|
555
386
|
* Inserts a removed module into its nested parent in the merged flow
|
|
556
387
|
*/
|
|
557
|
-
function insertIntoNestedParent(merged, parentLocation, moduleToInsert, beforeFlow) {
|
|
558
|
-
if (parentLocation.type === 'root' ||
|
|
559
|
-
parentLocation.type === 'failure' ||
|
|
560
|
-
parentLocation.type === 'preprocessor') {
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
// Find the parent module in merged flow
|
|
564
|
-
const parentModule = findModuleById(merged, parentLocation.parentId);
|
|
565
|
-
if (!parentModule) {
|
|
566
|
-
console.warn('Parent module not found', parentLocation);
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
// Get the before parent to know original ordering
|
|
570
|
-
const beforeParent = findModuleById(beforeFlow, parentLocation.parentId);
|
|
571
|
-
if (!beforeParent) {
|
|
572
|
-
console.warn('Before parent module not found', parentLocation);
|
|
573
|
-
return;
|
|
574
|
-
}
|
|
575
|
-
// Insert based on type
|
|
576
|
-
if (parentLocation.type === 'forloop' && parentModule.value.type === 'forloopflow') {
|
|
577
|
-
const beforeModules = beforeParent.value.modules ?? [];
|
|
578
|
-
const insertIndex = findBestInsertPosition(parentModule.value.modules, beforeModules, parentLocation.index, moduleToInsert.id);
|
|
579
|
-
parentModule.value.modules.splice(insertIndex, 0, moduleToInsert);
|
|
580
|
-
}
|
|
581
|
-
else if (parentLocation.type === 'whileloop' && parentModule.value.type === 'whileloopflow') {
|
|
582
|
-
const beforeModules = beforeParent.value.modules ?? [];
|
|
583
|
-
const insertIndex = findBestInsertPosition(parentModule.value.modules, beforeModules, parentLocation.index, moduleToInsert.id);
|
|
584
|
-
parentModule.value.modules.splice(insertIndex, 0, moduleToInsert);
|
|
585
|
-
}
|
|
586
|
-
else if (parentLocation.type === 'branchone-default' &&
|
|
587
|
-
parentModule.value.type === 'branchone') {
|
|
588
|
-
const beforeModules = beforeParent.value.default ?? [];
|
|
589
|
-
const insertIndex = findBestInsertPosition(parentModule.value.default, beforeModules, parentLocation.index, moduleToInsert.id);
|
|
590
|
-
parentModule.value.default.splice(insertIndex, 0, moduleToInsert);
|
|
591
|
-
}
|
|
592
|
-
else if (parentLocation.type === 'branchone-branch' &&
|
|
593
|
-
parentModule.value.type === 'branchone') {
|
|
594
|
-
let branch = parentModule.value.branches[parentLocation.branchIndex];
|
|
595
|
-
const beforeBranch = beforeParent.value.branches?.[parentLocation.branchIndex];
|
|
596
|
-
// If the branch doesn't exist (entire branch was removed), recreate it from beforeFlow
|
|
597
|
-
if (!branch && beforeBranch) {
|
|
598
|
-
// Ensure we have enough branch slots
|
|
599
|
-
while (parentModule.value.branches.length <= parentLocation.branchIndex) {
|
|
600
|
-
parentModule.value.branches.push({ expr: '', modules: [] });
|
|
601
|
-
}
|
|
602
|
-
// Restore the branch with its original expr but empty modules (we'll add them)
|
|
603
|
-
parentModule.value.branches[parentLocation.branchIndex] = {
|
|
604
|
-
...beforeBranch,
|
|
605
|
-
modules: []
|
|
606
|
-
};
|
|
607
|
-
branch = parentModule.value.branches[parentLocation.branchIndex];
|
|
608
|
-
}
|
|
609
|
-
if (branch) {
|
|
610
|
-
const beforeModules = beforeBranch?.modules ?? [];
|
|
611
|
-
const insertIndex = findBestInsertPosition(branch.modules, beforeModules, parentLocation.index, moduleToInsert.id);
|
|
612
|
-
branch.modules.splice(insertIndex, 0, moduleToInsert);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
else if (parentLocation.type === 'branchall-branch' &&
|
|
616
|
-
parentModule.value.type === 'branchall') {
|
|
617
|
-
let branch = parentModule.value.branches[parentLocation.branchIndex];
|
|
618
|
-
const beforeBranch = beforeParent.value.branches?.[parentLocation.branchIndex];
|
|
619
|
-
// If the branch doesn't exist (entire branch was removed), recreate it from beforeFlow
|
|
620
|
-
if (!branch && beforeBranch) {
|
|
621
|
-
// Ensure we have enough branch slots
|
|
622
|
-
while (parentModule.value.branches.length <= parentLocation.branchIndex) {
|
|
623
|
-
parentModule.value.branches.push({ modules: [] });
|
|
624
|
-
}
|
|
625
|
-
// Restore the branch with empty modules (we'll add them)
|
|
626
|
-
parentModule.value.branches[parentLocation.branchIndex] = {
|
|
627
|
-
...beforeBranch,
|
|
628
|
-
modules: []
|
|
629
|
-
};
|
|
630
|
-
branch = parentModule.value.branches[parentLocation.branchIndex];
|
|
631
|
-
}
|
|
632
|
-
if (branch) {
|
|
633
|
-
const beforeModules = beforeBranch?.modules ?? [];
|
|
634
|
-
const insertIndex = findBestInsertPosition(branch.modules, beforeModules, parentLocation.index, moduleToInsert.id);
|
|
635
|
-
branch.modules.splice(insertIndex, 0, moduleToInsert);
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
else if (parentLocation.type === 'aiagent' && parentModule.value.type === 'aiagent') {
|
|
639
|
-
const tools = parentModule.value.tools ?? [];
|
|
640
|
-
const beforeTools = beforeParent.value.tools ?? [];
|
|
641
|
-
const insertIndex = findBestInsertPosition(tools, beforeTools, parentLocation.index, moduleToInsert.id);
|
|
642
|
-
tools.splice(insertIndex, 0, moduleToInsert);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* Finds a module by ID anywhere in the flow
|
|
647
|
-
*/
|
|
648
|
-
function findModuleById(flow, moduleId) {
|
|
649
|
-
const moduleMap = getAllModulesMap(flow);
|
|
650
|
-
return moduleMap.get(moduleId) ?? null;
|
|
651
|
-
}
|
|
652
388
|
/**
|
|
653
389
|
* Adjusts the after actions based on display mode and adds entries for prefixed IDs
|
|
654
390
|
*/
|
|
@@ -732,26 +468,13 @@ export function insertModuleIntoFlow(targetFlow, moduleToInsert, sourceFlow, mod
|
|
|
732
468
|
targetFlow.preprocessor_module = moduleToInsert;
|
|
733
469
|
return;
|
|
734
470
|
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
if (!targetFlow.modules)
|
|
739
|
-
targetFlow.modules = [];
|
|
740
|
-
targetFlow.modules.splice(insertIndex, 0, moduleToInsert);
|
|
471
|
+
const targetModules = ensureModuleArrayByLocation(targetFlow, parentLocation, sourceFlow);
|
|
472
|
+
const sourceModules = getModuleArrayByLocation(sourceFlow, parentLocation);
|
|
473
|
+
if (!targetModules || !sourceModules) {
|
|
741
474
|
return;
|
|
742
475
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
}
|
|
746
|
-
/**
|
|
747
|
-
* Finds a module by ID anywhere in a flow (including nested modules, failure, and preprocessor)
|
|
748
|
-
*
|
|
749
|
-
* @param flow - The flow to search in
|
|
750
|
-
* @param moduleId - The ID of the module to find
|
|
751
|
-
* @returns The module if found, null otherwise
|
|
752
|
-
*/
|
|
753
|
-
export function findModuleInFlow(flow, moduleId) {
|
|
754
|
-
return findModuleById(flow, moduleId);
|
|
476
|
+
const insertIndex = findBestInsertPosition(targetModules, sourceModules, parentLocation.index, moduleId);
|
|
477
|
+
targetModules.splice(insertIndex, 0, moduleToInsert);
|
|
755
478
|
}
|
|
756
479
|
/**
|
|
757
480
|
* Checks if the input schema has changed between two flow versions.
|
|
@@ -30,6 +30,14 @@ export declare function createBranchOneModule(id: string, defaultModules: FlowMo
|
|
|
30
30
|
export declare function createBranchAllModule(id: string, branches: {
|
|
31
31
|
modules: FlowModule[];
|
|
32
32
|
}[]): FlowModule;
|
|
33
|
+
/**
|
|
34
|
+
* Wraps a FlowModule as an AI agent flowmodule tool.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createFlowModuleTool(module: FlowModule): FlowModule;
|
|
37
|
+
/**
|
|
38
|
+
* Creates an AI agent module with the provided tools.
|
|
39
|
+
*/
|
|
40
|
+
export declare function createAiAgentModule(id: string, tools: FlowModule[]): FlowModule;
|
|
33
41
|
/**
|
|
34
42
|
* Creates a FlowValue with the given modules
|
|
35
43
|
*/
|
|
@@ -79,6 +79,32 @@ export function createBranchAllModule(id, branches) {
|
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Wraps a FlowModule as an AI agent flowmodule tool.
|
|
84
|
+
*/
|
|
85
|
+
export function createFlowModuleTool(module) {
|
|
86
|
+
return {
|
|
87
|
+
id: module.id,
|
|
88
|
+
summary: module.summary,
|
|
89
|
+
value: {
|
|
90
|
+
tool_type: 'flowmodule',
|
|
91
|
+
...module.value
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Creates an AI agent module with the provided tools.
|
|
97
|
+
*/
|
|
98
|
+
export function createAiAgentModule(id, tools) {
|
|
99
|
+
return {
|
|
100
|
+
id,
|
|
101
|
+
value: {
|
|
102
|
+
type: 'aiagent',
|
|
103
|
+
tools,
|
|
104
|
+
input_transforms: {}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
82
108
|
// ============================================================================
|
|
83
109
|
// Flow Creation Helpers
|
|
84
110
|
// ============================================================================
|