windmill-components 1.677.0 → 1.687.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/CiTestResults.svelte +64 -0
- package/package/components/CiTestResults.svelte.d.ts +7 -0
- package/package/components/CompareWorkspaces.svelte +626 -418
- 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 +20 -3
- 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/FlowStatusViewerInner.svelte +269 -220
- package/package/components/FlowTimeline.svelte +1 -1
- package/package/components/FolderEditor.svelte +189 -4
- package/package/components/ForkWorkspaceBanner.svelte +82 -11
- package/package/components/GlobalUserOffboardingModal.svelte +293 -0
- package/package/components/GlobalUserOffboardingModal.svelte.d.ts +10 -0
- package/package/components/InstanceSettings.svelte +22 -3
- package/package/components/Login.svelte +22 -10
- 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/QueueAlerts.svelte +10 -10
- package/package/components/ResourcePicker.svelte +2 -2
- package/package/components/ScriptBuilder.svelte +52 -11
- package/package/components/ScriptEditor.svelte +1 -3
- package/package/components/ScriptEditor.svelte.d.ts +1 -1
- package/package/components/ShareModal.svelte +236 -98
- 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/editor/inlineScriptsPanel/InlineScriptRunnableByPath.svelte +4 -2
- package/package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +12 -0
- package/package/components/assets/AssetsDropdownButton.svelte +1 -1
- package/package/components/common/confirmationModal/ConfirmationModal.svelte +1 -1
- 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/AIChatManager.svelte.js +2 -2
- 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.js +129 -1
- package/package/components/copilot/chat/app/core.test.js +192 -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/flow/FlowAIChat.svelte +55 -76
- package/package/components/copilot/chat/flow/core.d.ts +13 -3
- package/package/components/copilot/chat/flow/core.js +467 -116
- package/package/components/copilot/chat/flow/helperUtils.d.ts +19 -0
- package/package/components/copilot/chat/flow/helperUtils.js +68 -0
- package/package/components/copilot/chat/flow/helperUtils.test.js +116 -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/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/shared.d.ts +1 -2
- package/package/components/copilot/chat/shared.js +94 -52
- package/package/components/copilot/chat/tokenUsage.d.ts +23 -0
- package/package/components/copilot/chat/tokenUsage.js +42 -0
- package/package/components/copilot/lib.d.ts +5 -1
- package/package/components/copilot/lib.js +21 -5
- 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/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/FlowModuleDeleteAfterUse.svelte +15 -7
- package/package/components/flows/content/FlowSettings.svelte +29 -0
- 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 +6 -1
- package/package/components/flows/flowStore.svelte.d.ts +1 -1
- 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 +70 -227
- package/package/components/flows/map/FlowModuleSchemaMap.svelte.d.ts +0 -2
- package/package/components/flows/pickers/PickHubScriptQuick.svelte +2 -2
- package/package/components/flows/pickers/PickHubScriptQuick.svelte.d.ts +1 -1
- 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 -5
- package/package/components/git_sync/GitSyncRepositoryCard.svelte +2 -29
- package/package/components/git_sync/PullWorkspaceModal.svelte +6 -7
- package/package/components/graph/FlowGraphV2.svelte +2 -2
- package/package/components/graph/FlowGraphV2.svelte.d.ts +1 -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 +5 -2
- package/package/components/home/HomeConnectDrawer.svelte +125 -0
- package/package/components/home/HomeConnectDrawer.svelte.d.ts +5 -0
- 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 +42 -8
- package/package/components/offboarding-utils.d.ts +11 -0
- package/package/components/offboarding-utils.js +100 -0
- package/package/components/raw_apps/RawAppDataTableDrawer.svelte +1 -1
- package/package/components/raw_apps/RawAppEditor.svelte +27 -0
- 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/RawAppYamlEditor.svelte +81 -0
- package/package/components/raw_apps/RawAppYamlEditor.svelte.d.ts +20 -0
- package/package/components/raw_apps/datatableUtils.svelte.js +1 -1
- package/package/components/runs/runsFilter.d.ts +1 -1
- package/package/components/script_builder.d.ts +1 -1
- package/package/components/select/Select.svelte +2 -1
- package/package/components/select/Select.svelte.d.ts +1 -0
- package/package/components/settings/CreateToken.svelte +113 -64
- package/package/components/settings/CreateToken.svelte.d.ts +3 -0
- package/package/components/settings/WorkspaceUserSettings.svelte +34 -28
- package/package/components/sidebar/SidebarContent.svelte +58 -2
- package/package/components/sidebar/WorkspaceMenu.svelte +8 -4
- package/package/components/triggers/AddTriggersButton.svelte +11 -0
- package/package/components/triggers/PermissionedAsLine.svelte +37 -3
- package/package/components/triggers/PermissionedAsLine.svelte.d.ts +6 -0
- package/package/components/triggers/TriggersEditor.svelte +5 -1
- package/package/components/triggers/TriggersWrapper.svelte +10 -0
- package/package/components/triggers/email/EmailTriggerEditorInner.svelte +13 -11
- package/package/components/triggers/gcp/GcpTriggerEditorInner.svelte +13 -11
- package/package/components/triggers/http/RouteEditorConfigSection.svelte +15 -7
- package/package/components/triggers/http/RouteEditorInner.svelte +14 -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 +13 -11
- package/package/components/triggers/mqtt/MqttEditorConfigSection.svelte.d.ts +1 -1
- package/package/components/triggers/mqtt/MqttTriggerEditorInner.svelte +13 -11
- 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 +13 -11
- package/package/components/triggers/postgres/PostgresTriggerEditor.svelte.d.ts +4 -3
- package/package/components/triggers/postgres/PostgresTriggerEditorInner.svelte +13 -11
- package/package/components/triggers/schedules/ScheduleEditorInner.svelte +13 -11
- package/package/components/triggers/sqs/SqsTriggerEditor.svelte.d.ts +4 -3
- package/package/components/triggers/sqs/SqsTriggerEditorInner.svelte +13 -11
- package/package/components/triggers/triggers.svelte.js +1 -0
- package/package/components/triggers/utils.js +27 -6
- package/package/components/triggers/websocket/WebsocketTriggerEditorInner.svelte +13 -11
- 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/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/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 +1172 -164
- package/package/gen/schemas.gen.js +1168 -157
- package/package/gen/services.gen.d.ts +511 -6
- package/package/gen/services.gen.js +1023 -23
- package/package/gen/types.gen.d.ts +2278 -151
- package/package/githubApp.js +5 -1
- package/package/hubPaths.json +1 -4
- package/package/infer.js +13 -1
- package/package/infer.svelte.js +10 -1
- 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 +14 -0
- package/package/stores.d.ts +4 -0
- package/package/stores.js +1 -0
- package/package/system_prompts/prompts.d.ts +4 -3
- package/package/system_prompts/prompts.js +270 -20
- package/package/templates/ci_test_bun.ts.template +19 -0
- package/package/templates/ci_test_python.py.template +18 -0
- package/package/utils_deployable.d.ts +11 -7
- package/package/utils_workspace_deploy.d.ts +8 -8
- package/package/utils_workspace_deploy.js +86 -420
- package/package.json +4 -4
- 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/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/{flows/agentToolUtils.test.d.ts → copilot/chat/flow/utils.test.d.ts} +0 -0
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
2
|
import { flushSync } from 'svelte';
|
|
3
3
|
import { createFlowDiffManager } from './flowDiffManager.svelte';
|
|
4
4
|
import { DUPLICATE_MODULE_PREFIX, NEW_MODULE_PREFIX } from './flowDiff';
|
|
5
5
|
import { SPECIAL_MODULE_IDS } from '../copilot/chat/shared';
|
|
6
|
-
import { createRawScriptModule, createForloopModule, createBranchOneModule, createBranchAllModule, createExtendedOpenFlow, createFlowStore, deepClone, expectModuleOrder, createIdentityModule } from './flowDiff.testUtils';
|
|
6
|
+
import { createRawScriptModule, createForloopModule, createBranchOneModule, createBranchAllModule, createExtendedOpenFlow, createFlowStore, createFlowWithSpecialModules, deepClone, expectModuleOrder, createIdentityModule, createAiAgentModule, createFlowModuleTool } from './flowDiff.testUtils';
|
|
7
|
+
vi.mock('../copilot/chat/shared', () => ({
|
|
8
|
+
SPECIAL_MODULE_IDS: {
|
|
9
|
+
INPUT: 'Input',
|
|
10
|
+
PREPROCESSOR: 'preprocessor',
|
|
11
|
+
FAILURE: 'failure'
|
|
12
|
+
}
|
|
13
|
+
}));
|
|
7
14
|
describe('FlowDiffManager', () => {
|
|
8
15
|
describe('effect auto-computation', () => {
|
|
9
16
|
it('auto-computes moduleActions when flows differ', () => {
|
|
@@ -153,6 +160,30 @@ describe('FlowDiffManager', () => {
|
|
|
153
160
|
});
|
|
154
161
|
cleanup();
|
|
155
162
|
});
|
|
163
|
+
it('accepts added preprocessor module - stores it on beforeFlow', () => {
|
|
164
|
+
const cleanup = $effect.root(() => {
|
|
165
|
+
const manager = createFlowDiffManager({ testMode: true });
|
|
166
|
+
const preprocessor = createRawScriptModule(SPECIAL_MODULE_IDS.PREPROCESSOR, 'prep');
|
|
167
|
+
const beforeFlow = createExtendedOpenFlow({ modules: [] });
|
|
168
|
+
const afterFlow = createFlowWithSpecialModules({
|
|
169
|
+
preprocessor_module: deepClone(preprocessor)
|
|
170
|
+
});
|
|
171
|
+
manager.setEditMode(true);
|
|
172
|
+
manager.setBeforeFlow(beforeFlow);
|
|
173
|
+
manager.setCurrentFlow(afterFlow);
|
|
174
|
+
flushSync();
|
|
175
|
+
expect(manager.moduleActions[SPECIAL_MODULE_IDS.PREPROCESSOR]).toEqual({
|
|
176
|
+
action: 'added',
|
|
177
|
+
pending: true
|
|
178
|
+
});
|
|
179
|
+
manager.acceptModule(SPECIAL_MODULE_IDS.PREPROCESSOR);
|
|
180
|
+
flushSync();
|
|
181
|
+
expect(manager.beforeFlow?.value.preprocessor_module?.id).toBe(SPECIAL_MODULE_IDS.PREPROCESSOR);
|
|
182
|
+
expect(manager.beforeFlow?.value.preprocessor_module?.value
|
|
183
|
+
?.content).toBe('prep');
|
|
184
|
+
});
|
|
185
|
+
cleanup();
|
|
186
|
+
});
|
|
156
187
|
it('handles duplicate ID prefix (old__) for type changes', () => {
|
|
157
188
|
const cleanup = $effect.root(() => {
|
|
158
189
|
const manager = createFlowDiffManager({ testMode: true });
|
|
@@ -274,6 +305,29 @@ describe('FlowDiffManager', () => {
|
|
|
274
305
|
});
|
|
275
306
|
cleanup();
|
|
276
307
|
});
|
|
308
|
+
it('rejects removed failure module - restores it on flowStore', () => {
|
|
309
|
+
const cleanup = $effect.root(() => {
|
|
310
|
+
const manager = createFlowDiffManager({ testMode: true });
|
|
311
|
+
const failure = createRawScriptModule(SPECIAL_MODULE_IDS.FAILURE, 'fail');
|
|
312
|
+
const beforeFlow = createExtendedOpenFlow(createFlowWithSpecialModules({
|
|
313
|
+
failure_module: deepClone(failure)
|
|
314
|
+
}));
|
|
315
|
+
const flowStore = createFlowStore(createExtendedOpenFlow({ modules: [] }));
|
|
316
|
+
manager.setEditMode(true);
|
|
317
|
+
manager.setBeforeFlow(beforeFlow);
|
|
318
|
+
manager.setCurrentFlow(flowStore.val.value);
|
|
319
|
+
flushSync();
|
|
320
|
+
expect(manager.moduleActions[SPECIAL_MODULE_IDS.FAILURE]).toEqual({
|
|
321
|
+
action: 'removed',
|
|
322
|
+
pending: true
|
|
323
|
+
});
|
|
324
|
+
manager.rejectModule(SPECIAL_MODULE_IDS.FAILURE, flowStore);
|
|
325
|
+
flushSync();
|
|
326
|
+
expect(flowStore.val.value.failure_module?.id).toBe(SPECIAL_MODULE_IDS.FAILURE);
|
|
327
|
+
expect(flowStore.val.value.failure_module?.value?.content).toBe('fail');
|
|
328
|
+
});
|
|
329
|
+
cleanup();
|
|
330
|
+
});
|
|
277
331
|
it('does not crash without flowStore', () => {
|
|
278
332
|
const cleanup = $effect.root(() => {
|
|
279
333
|
const manager = createFlowDiffManager({ testMode: true });
|
|
@@ -1251,5 +1305,52 @@ describe('FlowDiffManager', () => {
|
|
|
1251
1305
|
});
|
|
1252
1306
|
cleanup();
|
|
1253
1307
|
});
|
|
1308
|
+
it('accepts an added ai agent tool into beforeFlow', () => {
|
|
1309
|
+
const cleanup = $effect.root(() => {
|
|
1310
|
+
const manager = createFlowDiffManager({ testMode: true });
|
|
1311
|
+
const lookupTool = createFlowModuleTool(createRawScriptModule('lookup_user', 'lookup'));
|
|
1312
|
+
const sumTool = createFlowModuleTool(createRawScriptModule('sum', 'sum'));
|
|
1313
|
+
const beforeFlow = createExtendedOpenFlow({
|
|
1314
|
+
modules: [createAiAgentModule('agent', [deepClone(lookupTool)])]
|
|
1315
|
+
});
|
|
1316
|
+
const currentFlowValue = {
|
|
1317
|
+
modules: [createAiAgentModule('agent', [deepClone(lookupTool), deepClone(sumTool)])]
|
|
1318
|
+
};
|
|
1319
|
+
manager.setEditMode(true);
|
|
1320
|
+
manager.setBeforeFlow(beforeFlow);
|
|
1321
|
+
manager.setCurrentFlow(currentFlowValue);
|
|
1322
|
+
flushSync();
|
|
1323
|
+
expect(manager.moduleActions['sum']).toEqual({ action: 'added', pending: true });
|
|
1324
|
+
manager.acceptModule('sum');
|
|
1325
|
+
flushSync();
|
|
1326
|
+
const tools = (((manager.beforeFlow?.value.modules ?? [])[0]?.value).tools ?? []);
|
|
1327
|
+
expect(tools.map((tool) => tool.id)).toEqual(['lookup_user', 'sum']);
|
|
1328
|
+
});
|
|
1329
|
+
cleanup();
|
|
1330
|
+
});
|
|
1331
|
+
it('rejects a removed ai agent tool back into the live flow', () => {
|
|
1332
|
+
const cleanup = $effect.root(() => {
|
|
1333
|
+
const manager = createFlowDiffManager({ testMode: true });
|
|
1334
|
+
const lookupTool = createFlowModuleTool(createRawScriptModule('lookup_user', 'lookup'));
|
|
1335
|
+
const sumTool = createFlowModuleTool(createRawScriptModule('sum', 'sum'));
|
|
1336
|
+
const beforeFlow = createExtendedOpenFlow({
|
|
1337
|
+
modules: [createAiAgentModule('agent', [deepClone(lookupTool), deepClone(sumTool)])]
|
|
1338
|
+
});
|
|
1339
|
+
const currentFlowValue = {
|
|
1340
|
+
modules: [createAiAgentModule('agent', [deepClone(lookupTool)])]
|
|
1341
|
+
};
|
|
1342
|
+
const flowStore = createFlowStore(createExtendedOpenFlow(currentFlowValue));
|
|
1343
|
+
manager.setEditMode(true);
|
|
1344
|
+
manager.setBeforeFlow(beforeFlow);
|
|
1345
|
+
manager.setCurrentFlow(flowStore.val.value);
|
|
1346
|
+
flushSync();
|
|
1347
|
+
expect(manager.moduleActions['sum']).toEqual({ action: 'removed', pending: true });
|
|
1348
|
+
manager.rejectModule('sum', flowStore);
|
|
1349
|
+
flushSync();
|
|
1350
|
+
const tools = (((flowStore.val.value.modules ?? [])[0]?.value).tools ?? []);
|
|
1351
|
+
expect(tools.map((tool) => tool.id)).toEqual(['lookup_user', 'sum']);
|
|
1352
|
+
});
|
|
1353
|
+
cleanup();
|
|
1354
|
+
});
|
|
1254
1355
|
});
|
|
1255
1356
|
});
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { FlowModule, OpenFlow } from '../../gen';
|
|
2
2
|
type ModuleBranches = FlowModule[][];
|
|
3
|
+
/**
|
|
4
|
+
* Returns read-only child-module branches for explorer/search-style consumers.
|
|
5
|
+
* Structural knowledge lives in `flowTree.ts`; this file is a thin read-only adapter.
|
|
6
|
+
*/
|
|
3
7
|
export declare function getSubModules(flowModule: FlowModule): ModuleBranches;
|
|
4
8
|
export declare function getAllSubmodules(flowModule: FlowModule): ModuleBranches;
|
|
5
9
|
export declare function getAllModules(flow_modules: FlowModule[], failure_module?: FlowModule): FlowModule[];
|
|
@@ -1,37 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { collectDescendantFlowModules, getChildModuleBranches } from './flowTree';
|
|
2
|
+
/**
|
|
3
|
+
* Returns read-only child-module branches for explorer/search-style consumers.
|
|
4
|
+
* Structural knowledge lives in `flowTree.ts`; this file is a thin read-only adapter.
|
|
5
|
+
*/
|
|
2
6
|
export function getSubModules(flowModule) {
|
|
3
|
-
|
|
4
|
-
return [flowModule.value.modules];
|
|
5
|
-
}
|
|
6
|
-
else if (flowModule.value.type === 'branchall') {
|
|
7
|
-
return flowModule.value.branches.map((branch) => branch.modules);
|
|
8
|
-
}
|
|
9
|
-
else if (flowModule.value.type == 'branchone') {
|
|
10
|
-
return [...flowModule.value.branches.map((branch) => branch.modules), flowModule.value.default];
|
|
11
|
-
}
|
|
12
|
-
else if (flowModule.value.type === 'aiagent') {
|
|
13
|
-
// Return AI agent tools as pseudo-FlowModules for searching
|
|
14
|
-
if (flowModule.value.tools) {
|
|
15
|
-
return [
|
|
16
|
-
flowModule.value.tools
|
|
17
|
-
.filter(isFlowModuleTool)
|
|
18
|
-
.map((tool) => ({
|
|
19
|
-
id: tool.id,
|
|
20
|
-
value: tool.value,
|
|
21
|
-
summary: tool.summary
|
|
22
|
-
}))
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return [];
|
|
7
|
+
return getChildModuleBranches(flowModule);
|
|
27
8
|
}
|
|
28
9
|
export function getAllSubmodules(flowModule) {
|
|
29
10
|
return getSubModules(flowModule).map((modules) => {
|
|
30
|
-
return modules
|
|
31
|
-
.map((module) => {
|
|
32
|
-
return [module, ...getAllSubmodules(module).flat()];
|
|
33
|
-
})
|
|
34
|
-
.flat();
|
|
11
|
+
return modules.flatMap((module) => [module, ...collectDescendantFlowModules(module)]);
|
|
35
12
|
});
|
|
36
13
|
}
|
|
37
14
|
export function getAllModules(flow_modules, failure_module) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ScriptService } from '../../gen';
|
|
2
2
|
import { initialCode } from '../../script_helpers';
|
|
3
|
+
import { inferAssets } from '../../infer';
|
|
3
4
|
import { userStore, workspaceStore } from '../../stores';
|
|
4
5
|
import { getScriptByPath } from '../../scripts';
|
|
5
6
|
import { get } from 'svelte/store';
|
|
@@ -47,6 +48,9 @@ export async function pickFlow(path, summary, id) {
|
|
|
47
48
|
}
|
|
48
49
|
export async function createInlineScriptModule(language, kind, subkind, id, summary) {
|
|
49
50
|
const code = initialCode(language, kind, subkind);
|
|
51
|
+
// Needed when the predefined code has assets in it
|
|
52
|
+
const inferResult = await inferAssets(language, code);
|
|
53
|
+
const assets = inferResult.status === 'ok' && inferResult.assets.length > 0 ? inferResult.assets : undefined;
|
|
50
54
|
const flowModule = {
|
|
51
55
|
id,
|
|
52
56
|
summary,
|
|
@@ -55,7 +59,8 @@ export async function createInlineScriptModule(language, kind, subkind, id, summ
|
|
|
55
59
|
content: code,
|
|
56
60
|
language,
|
|
57
61
|
input_transforms: {},
|
|
58
|
-
...(kind === 'trigger' ? { is_trigger: true } : {})
|
|
62
|
+
...(kind === 'trigger' ? { is_trigger: true } : {}),
|
|
63
|
+
...(assets ? { assets } : {})
|
|
59
64
|
}
|
|
60
65
|
};
|
|
61
66
|
return [flowModule, await loadFlowModuleState(flowModule)];
|
|
@@ -65,7 +65,7 @@ export declare function getFirstStepSchema(flowState: FlowState, flow: OpenFlow)
|
|
|
65
65
|
id: string;
|
|
66
66
|
summary: string | undefined;
|
|
67
67
|
value: {
|
|
68
|
-
language?: "deno" | "bun" | "python3" | "go" | "bash" | "powershell" | "postgresql" | "mysql" | "bigquery" | "snowflake" | "mssql" | "oracledb" | "graphql" | "nativets" | "php" | "rust" | "ansible" | "csharp" | "nu" | "java" | "ruby" | "duckdb" | undefined;
|
|
68
|
+
language?: "deno" | "bun" | "python3" | "go" | "bash" | "powershell" | "postgresql" | "mysql" | "bigquery" | "snowflake" | "mssql" | "oracledb" | "graphql" | "nativets" | "php" | "rust" | "ansible" | "csharp" | "nu" | "java" | "ruby" | "rlang" | "duckdb" | undefined;
|
|
69
69
|
path?: string | undefined;
|
|
70
70
|
type: "rawscript" | "script" | "flow" | "forloopflow" | "whileloopflow" | "branchone" | "branchall" | "aiagent" | "identity";
|
|
71
71
|
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { FlowModule } from '../../gen';
|
|
2
|
+
export type FlowModuleTree = {
|
|
3
|
+
modules?: FlowModule[] | null;
|
|
4
|
+
failure_module?: FlowModule | null;
|
|
5
|
+
preprocessor_module?: FlowModule | null;
|
|
6
|
+
};
|
|
7
|
+
export type ModuleParentLocation = {
|
|
8
|
+
type: 'root';
|
|
9
|
+
index: number;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'forloop' | 'whileloop';
|
|
12
|
+
parentId: string;
|
|
13
|
+
index: number;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'branchone-default';
|
|
16
|
+
parentId: string;
|
|
17
|
+
index: number;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'branchone-branch';
|
|
20
|
+
parentId: string;
|
|
21
|
+
branchIndex: number;
|
|
22
|
+
index: number;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'branchall-branch';
|
|
25
|
+
parentId: string;
|
|
26
|
+
branchIndex: number;
|
|
27
|
+
index: number;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'aiagent';
|
|
30
|
+
parentId: string;
|
|
31
|
+
index: number;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'failure';
|
|
34
|
+
index: -1;
|
|
35
|
+
} | {
|
|
36
|
+
type: 'preprocessor';
|
|
37
|
+
index: -1;
|
|
38
|
+
};
|
|
39
|
+
export type ArrayBackedModuleParentLocation = Exclude<ModuleParentLocation, {
|
|
40
|
+
type: 'failure';
|
|
41
|
+
index: -1;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'preprocessor';
|
|
44
|
+
index: -1;
|
|
45
|
+
}>;
|
|
46
|
+
type ArrayBackedFlowNodeMatch = {
|
|
47
|
+
module: FlowModule;
|
|
48
|
+
location: ArrayBackedModuleParentLocation;
|
|
49
|
+
container: FlowModule[];
|
|
50
|
+
};
|
|
51
|
+
export type FlowNodeMatch = ArrayBackedFlowNodeMatch | {
|
|
52
|
+
module: FlowModule;
|
|
53
|
+
location: Extract<ModuleParentLocation, {
|
|
54
|
+
type: 'failure' | 'preprocessor';
|
|
55
|
+
}>;
|
|
56
|
+
};
|
|
57
|
+
export type FlowNodeLocation = {
|
|
58
|
+
module: FlowModule;
|
|
59
|
+
location: ModuleParentLocation;
|
|
60
|
+
};
|
|
61
|
+
export declare function getChildModuleBranches(module: FlowModule): FlowModule[][];
|
|
62
|
+
export declare function collectDescendantFlowModules(module: FlowModule): FlowModule[];
|
|
63
|
+
/**
|
|
64
|
+
* Collect every module ID in a flow tree, including ALL aiagent tool IDs
|
|
65
|
+
* (both flowmodule and non-flowmodule like MCP). Used for ID uniqueness
|
|
66
|
+
* validation where every tool's ID must be reserved regardless of type.
|
|
67
|
+
*/
|
|
68
|
+
export declare function collectAllFlowModuleIds(flow: FlowModuleTree): string[];
|
|
69
|
+
/**
|
|
70
|
+
* Like collectAllFlowModuleIds but operates on a modules array directly
|
|
71
|
+
* (without failure_module/preprocessor_module).
|
|
72
|
+
*/
|
|
73
|
+
export declare function collectAllFlowModuleIdsFromModules(modules: FlowModule[]): string[];
|
|
74
|
+
export declare function collectFlowNodes(flow: FlowModuleTree): FlowNodeLocation[];
|
|
75
|
+
export declare function findModuleInModules(modules: FlowModule[], moduleId: string): FlowModule | undefined;
|
|
76
|
+
export declare function findFlowNode(flow: FlowModuleTree, moduleId: string): FlowNodeMatch | null;
|
|
77
|
+
/**
|
|
78
|
+
* Returns the live stored module for any module id in the flow tree.
|
|
79
|
+
* This includes nested modules, AI-agent flowmodule tools, and special modules.
|
|
80
|
+
*/
|
|
81
|
+
export declare function findModuleInFlow(flow: FlowModuleTree, moduleId: string): FlowModule | null;
|
|
82
|
+
export declare function findModuleParent(flow: FlowModuleTree, moduleId: string): ModuleParentLocation | null;
|
|
83
|
+
export declare function getModuleArrayByLocation(flow: FlowModuleTree, location: ArrayBackedModuleParentLocation): FlowModule[] | null;
|
|
84
|
+
export declare function ensureModuleArrayByLocation(flow: FlowModuleTree, location: ArrayBackedModuleParentLocation, templateFlow?: FlowModuleTree): FlowModule[] | null;
|
|
85
|
+
export declare function getModuleArrayContainer(flow: FlowModuleTree, moduleId: string): {
|
|
86
|
+
index: number;
|
|
87
|
+
modules: FlowModule[];
|
|
88
|
+
} | null;
|
|
89
|
+
export declare function removeFlowModule(flow: FlowModuleTree, moduleId: string): FlowModule | null;
|
|
90
|
+
export declare function replaceFlowModule(target: FlowModule, next: FlowModule): FlowModule;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
function isFlowModuleToolCandidate(tool) {
|
|
2
|
+
const toolValue = tool.value;
|
|
3
|
+
return toolValue.tool_type === undefined || toolValue.tool_type === 'flowmodule';
|
|
4
|
+
}
|
|
5
|
+
export function getChildModuleBranches(module) {
|
|
6
|
+
if (module.value.type === 'forloopflow' || module.value.type === 'whileloopflow') {
|
|
7
|
+
return [module.value.modules];
|
|
8
|
+
}
|
|
9
|
+
if (module.value.type === 'branchone') {
|
|
10
|
+
return [module.value.default, ...module.value.branches.map((branch) => branch.modules)];
|
|
11
|
+
}
|
|
12
|
+
if (module.value.type === 'branchall') {
|
|
13
|
+
return module.value.branches.map((branch) => branch.modules);
|
|
14
|
+
}
|
|
15
|
+
if (module.value.type === 'aiagent' && module.value.tools) {
|
|
16
|
+
return [
|
|
17
|
+
module.value.tools.filter((tool) => isFlowModuleToolCandidate(tool))
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
export function collectDescendantFlowModules(module) {
|
|
23
|
+
return getChildModuleBranches(module).flatMap((branch) => branch.flatMap((childModule) => [childModule, ...collectDescendantFlowModules(childModule)]));
|
|
24
|
+
}
|
|
25
|
+
function visitNestedFlowNodesOfModule(module, visit) {
|
|
26
|
+
if (module.value.type === 'aiagent' && module.value.tools) {
|
|
27
|
+
const tools = module.value.tools;
|
|
28
|
+
for (let toolIndex = 0; toolIndex < tools.length; toolIndex++) {
|
|
29
|
+
const tool = tools[toolIndex];
|
|
30
|
+
if (!isFlowModuleToolCandidate(tool)) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const toolMatch = {
|
|
34
|
+
module: tool,
|
|
35
|
+
location: {
|
|
36
|
+
type: 'aiagent',
|
|
37
|
+
parentId: module.id,
|
|
38
|
+
index: toolIndex
|
|
39
|
+
},
|
|
40
|
+
container: tools
|
|
41
|
+
};
|
|
42
|
+
if (visit(toolMatch) || visitNestedFlowNodesOfModule(tool, visit)) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
const childBranches = getChildModuleBranches(module);
|
|
49
|
+
for (let branchIndex = 0; branchIndex < childBranches.length; branchIndex++) {
|
|
50
|
+
const branch = childBranches[branchIndex];
|
|
51
|
+
const locationBuilder = module.value.type === 'forloopflow'
|
|
52
|
+
? (childIndex) => ({
|
|
53
|
+
type: 'forloop',
|
|
54
|
+
parentId: module.id,
|
|
55
|
+
index: childIndex
|
|
56
|
+
})
|
|
57
|
+
: module.value.type === 'whileloopflow'
|
|
58
|
+
? (childIndex) => ({
|
|
59
|
+
type: 'whileloop',
|
|
60
|
+
parentId: module.id,
|
|
61
|
+
index: childIndex
|
|
62
|
+
})
|
|
63
|
+
: module.value.type === 'branchone'
|
|
64
|
+
? branchIndex === 0
|
|
65
|
+
? (childIndex) => ({
|
|
66
|
+
type: 'branchone-default',
|
|
67
|
+
parentId: module.id,
|
|
68
|
+
index: childIndex
|
|
69
|
+
})
|
|
70
|
+
: (childIndex) => ({
|
|
71
|
+
type: 'branchone-branch',
|
|
72
|
+
parentId: module.id,
|
|
73
|
+
branchIndex: branchIndex - 1,
|
|
74
|
+
index: childIndex
|
|
75
|
+
})
|
|
76
|
+
: (childIndex) => ({
|
|
77
|
+
type: 'branchall-branch',
|
|
78
|
+
parentId: module.id,
|
|
79
|
+
branchIndex,
|
|
80
|
+
index: childIndex
|
|
81
|
+
});
|
|
82
|
+
if (visitFlowNodesInModules(branch, locationBuilder, visit)) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
function visitFlowNodesInModules(modules, locationBuilder, visit) {
|
|
89
|
+
for (let index = 0; index < modules.length; index++) {
|
|
90
|
+
const module = modules[index];
|
|
91
|
+
if (visit({
|
|
92
|
+
module,
|
|
93
|
+
location: locationBuilder(index),
|
|
94
|
+
container: modules
|
|
95
|
+
})) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
if (visitNestedFlowNodesOfModule(module, visit)) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
function findFlowNodeInModules(modules, moduleId, locationBuilder) {
|
|
105
|
+
let match = null;
|
|
106
|
+
visitFlowNodesInModules(modules, locationBuilder, (nodeMatch) => {
|
|
107
|
+
if (nodeMatch.module.id !== moduleId) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
match = nodeMatch;
|
|
111
|
+
return true;
|
|
112
|
+
});
|
|
113
|
+
return match;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Collect every module ID in a flow tree, including ALL aiagent tool IDs
|
|
117
|
+
* (both flowmodule and non-flowmodule like MCP). Used for ID uniqueness
|
|
118
|
+
* validation where every tool's ID must be reserved regardless of type.
|
|
119
|
+
*/
|
|
120
|
+
export function collectAllFlowModuleIds(flow) {
|
|
121
|
+
const ids = [];
|
|
122
|
+
function walkModules(modules) {
|
|
123
|
+
for (const module of modules) {
|
|
124
|
+
if (module.id) {
|
|
125
|
+
ids.push(module.id);
|
|
126
|
+
}
|
|
127
|
+
if (module.value.type === 'forloopflow' || module.value.type === 'whileloopflow') {
|
|
128
|
+
walkModules(module.value.modules);
|
|
129
|
+
}
|
|
130
|
+
else if (module.value.type === 'branchone') {
|
|
131
|
+
for (const branch of module.value.branches) {
|
|
132
|
+
walkModules(branch.modules);
|
|
133
|
+
}
|
|
134
|
+
walkModules(module.value.default);
|
|
135
|
+
}
|
|
136
|
+
else if (module.value.type === 'branchall') {
|
|
137
|
+
for (const branch of module.value.branches) {
|
|
138
|
+
walkModules(branch.modules);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else if (module.value.type === 'aiagent' && module.value.tools) {
|
|
142
|
+
walkModules(module.value.tools);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (flow.modules) {
|
|
147
|
+
walkModules(flow.modules);
|
|
148
|
+
}
|
|
149
|
+
if (flow.failure_module?.id) {
|
|
150
|
+
ids.push(flow.failure_module.id);
|
|
151
|
+
}
|
|
152
|
+
if (flow.preprocessor_module?.id) {
|
|
153
|
+
ids.push(flow.preprocessor_module.id);
|
|
154
|
+
}
|
|
155
|
+
return ids;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Like collectAllFlowModuleIds but operates on a modules array directly
|
|
159
|
+
* (without failure_module/preprocessor_module).
|
|
160
|
+
*/
|
|
161
|
+
export function collectAllFlowModuleIdsFromModules(modules) {
|
|
162
|
+
return collectAllFlowModuleIds({ modules });
|
|
163
|
+
}
|
|
164
|
+
export function collectFlowNodes(flow) {
|
|
165
|
+
const matches = [];
|
|
166
|
+
if (flow.failure_module) {
|
|
167
|
+
matches.push({
|
|
168
|
+
module: flow.failure_module,
|
|
169
|
+
location: { type: 'failure', index: -1 }
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
if (flow.preprocessor_module) {
|
|
173
|
+
matches.push({
|
|
174
|
+
module: flow.preprocessor_module,
|
|
175
|
+
location: { type: 'preprocessor', index: -1 }
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
visitFlowNodesInModules(flow.modules ?? [], (index) => ({ type: 'root', index }), (match) => {
|
|
179
|
+
matches.push({
|
|
180
|
+
module: match.module,
|
|
181
|
+
location: match.location
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
return matches;
|
|
185
|
+
}
|
|
186
|
+
export function findModuleInModules(modules, moduleId) {
|
|
187
|
+
return (findFlowNodeInModules(modules, moduleId, (index) => ({ type: 'root', index }))?.module ??
|
|
188
|
+
undefined);
|
|
189
|
+
}
|
|
190
|
+
export function findFlowNode(flow, moduleId) {
|
|
191
|
+
if (flow.failure_module?.id === moduleId) {
|
|
192
|
+
return {
|
|
193
|
+
module: flow.failure_module,
|
|
194
|
+
location: { type: 'failure', index: -1 }
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
if (flow.preprocessor_module?.id === moduleId) {
|
|
198
|
+
return {
|
|
199
|
+
module: flow.preprocessor_module,
|
|
200
|
+
location: { type: 'preprocessor', index: -1 }
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
return findFlowNodeInModules(flow.modules ?? [], moduleId, (index) => ({ type: 'root', index }));
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Returns the live stored module for any module id in the flow tree.
|
|
207
|
+
* This includes nested modules, AI-agent flowmodule tools, and special modules.
|
|
208
|
+
*/
|
|
209
|
+
export function findModuleInFlow(flow, moduleId) {
|
|
210
|
+
return findFlowNode(flow, moduleId)?.module ?? null;
|
|
211
|
+
}
|
|
212
|
+
export function findModuleParent(flow, moduleId) {
|
|
213
|
+
return findFlowNode(flow, moduleId)?.location ?? null;
|
|
214
|
+
}
|
|
215
|
+
function resolveModuleArrayByLocation(flow, location, options = {}) {
|
|
216
|
+
if (location.type === 'root') {
|
|
217
|
+
if (!flow.modules && options.createIfMissing) {
|
|
218
|
+
flow.modules = [];
|
|
219
|
+
}
|
|
220
|
+
return flow.modules ?? null;
|
|
221
|
+
}
|
|
222
|
+
const parentModule = findModuleInFlow(flow, location.parentId);
|
|
223
|
+
if (!parentModule) {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
if (location.type === 'forloop' && parentModule.value.type === 'forloopflow') {
|
|
227
|
+
return parentModule.value.modules ?? null;
|
|
228
|
+
}
|
|
229
|
+
if (location.type === 'whileloop' && parentModule.value.type === 'whileloopflow') {
|
|
230
|
+
return parentModule.value.modules ?? null;
|
|
231
|
+
}
|
|
232
|
+
if (location.type === 'branchone-default' && parentModule.value.type === 'branchone') {
|
|
233
|
+
return parentModule.value.default ?? null;
|
|
234
|
+
}
|
|
235
|
+
if (location.type === 'branchone-branch' && parentModule.value.type === 'branchone') {
|
|
236
|
+
let branch = parentModule.value.branches[location.branchIndex];
|
|
237
|
+
if (!branch && options.templateFlow) {
|
|
238
|
+
const templateParent = findModuleInFlow(options.templateFlow, location.parentId);
|
|
239
|
+
const templateBranch = templateParent?.value.type === 'branchone'
|
|
240
|
+
? templateParent.value.branches[location.branchIndex]
|
|
241
|
+
: undefined;
|
|
242
|
+
if (templateBranch) {
|
|
243
|
+
while (parentModule.value.branches.length <= location.branchIndex) {
|
|
244
|
+
parentModule.value.branches.push({ expr: '', modules: [] });
|
|
245
|
+
}
|
|
246
|
+
parentModule.value.branches[location.branchIndex] = {
|
|
247
|
+
...templateBranch,
|
|
248
|
+
modules: []
|
|
249
|
+
};
|
|
250
|
+
branch = parentModule.value.branches[location.branchIndex];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return branch?.modules ?? null;
|
|
254
|
+
}
|
|
255
|
+
if (location.type === 'branchall-branch' && parentModule.value.type === 'branchall') {
|
|
256
|
+
let branch = parentModule.value.branches[location.branchIndex];
|
|
257
|
+
if (!branch && options.templateFlow) {
|
|
258
|
+
const templateParent = findModuleInFlow(options.templateFlow, location.parentId);
|
|
259
|
+
const templateBranch = templateParent?.value.type === 'branchall'
|
|
260
|
+
? templateParent.value.branches[location.branchIndex]
|
|
261
|
+
: undefined;
|
|
262
|
+
if (templateBranch) {
|
|
263
|
+
while (parentModule.value.branches.length <= location.branchIndex) {
|
|
264
|
+
parentModule.value.branches.push({ modules: [] });
|
|
265
|
+
}
|
|
266
|
+
parentModule.value.branches[location.branchIndex] = {
|
|
267
|
+
...templateBranch,
|
|
268
|
+
modules: []
|
|
269
|
+
};
|
|
270
|
+
branch = parentModule.value.branches[location.branchIndex];
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return branch?.modules ?? null;
|
|
274
|
+
}
|
|
275
|
+
if (location.type === 'aiagent' && parentModule.value.type === 'aiagent') {
|
|
276
|
+
if (!parentModule.value.tools && options.createIfMissing) {
|
|
277
|
+
parentModule.value.tools = [];
|
|
278
|
+
}
|
|
279
|
+
return parentModule.value.tools ?? null;
|
|
280
|
+
}
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
export function getModuleArrayByLocation(flow, location) {
|
|
284
|
+
return resolveModuleArrayByLocation(flow, location);
|
|
285
|
+
}
|
|
286
|
+
export function ensureModuleArrayByLocation(flow, location, templateFlow) {
|
|
287
|
+
return resolveModuleArrayByLocation(flow, location, {
|
|
288
|
+
createIfMissing: true,
|
|
289
|
+
templateFlow
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
export function getModuleArrayContainer(flow, moduleId) {
|
|
293
|
+
const match = findFlowNode(flow, moduleId);
|
|
294
|
+
if (!match || !('container' in match)) {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
index: match.location.index,
|
|
299
|
+
modules: match.container
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
export function removeFlowModule(flow, moduleId) {
|
|
303
|
+
if (flow.preprocessor_module?.id === moduleId) {
|
|
304
|
+
const removed = flow.preprocessor_module;
|
|
305
|
+
flow.preprocessor_module = undefined;
|
|
306
|
+
return removed;
|
|
307
|
+
}
|
|
308
|
+
if (flow.failure_module?.id === moduleId) {
|
|
309
|
+
const removed = flow.failure_module;
|
|
310
|
+
flow.failure_module = undefined;
|
|
311
|
+
return removed;
|
|
312
|
+
}
|
|
313
|
+
const match = findFlowNode(flow, moduleId);
|
|
314
|
+
if (!match || !('container' in match)) {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
const [removed] = match.container.splice(match.location.index, 1);
|
|
318
|
+
return removed ?? null;
|
|
319
|
+
}
|
|
320
|
+
export function replaceFlowModule(target, next) {
|
|
321
|
+
for (const key of Object.keys(target)) {
|
|
322
|
+
delete target[key];
|
|
323
|
+
}
|
|
324
|
+
Object.assign(target, next);
|
|
325
|
+
return target;
|
|
326
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|