windmill-components 1.677.1 → 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/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/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/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 +485 -19
- package/package/gen/schemas.gen.js +489 -20
- package/package/gen/services.gen.d.ts +229 -2
- package/package/gen/services.gen.js +463 -1
- package/package/gen/types.gen.d.ts +866 -29
- 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_workspace_deploy.d.ts +8 -8
- package/package/utils_workspace_deploy.js +86 -420
- package/package.json +3 -3
- 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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FlowModule, OpenFlow, RawScript } from '../../../../gen';
|
|
2
|
+
import type { InlineScriptSession } from './inlineScriptsUtils';
|
|
3
|
+
type FlowLike = Pick<OpenFlow, 'value'> & {
|
|
4
|
+
schema?: Record<string, any>;
|
|
5
|
+
};
|
|
6
|
+
export interface FlowJsonUpdate {
|
|
7
|
+
modules?: FlowModule[];
|
|
8
|
+
schema?: Record<string, any> | null;
|
|
9
|
+
preprocessorModule?: FlowModule | null;
|
|
10
|
+
failureModule?: FlowModule | null;
|
|
11
|
+
}
|
|
12
|
+
export interface FlowJsonUpdateResult {
|
|
13
|
+
emptyInlineScriptModuleIds: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare function updateRawScriptModuleContent(flow: FlowLike, id: string, code: string): (FlowModule & {
|
|
16
|
+
value: RawScript;
|
|
17
|
+
}) | undefined;
|
|
18
|
+
export declare function applyFlowJsonUpdate(flow: FlowLike, inlineScriptSession: InlineScriptSession, { modules, schema, preprocessorModule, failureModule }: FlowJsonUpdate): FlowJsonUpdateResult;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { forEachFlowModule } from '../../../flows/dfs';
|
|
2
|
+
import { findModuleInFlow } from '../../../flows/flowTree';
|
|
3
|
+
export function updateRawScriptModuleContent(flow, id, code) {
|
|
4
|
+
const module = findModuleInFlow(flow.value, id);
|
|
5
|
+
if (!module || module.value.type !== 'rawscript') {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
const rawScriptModule = module;
|
|
9
|
+
rawScriptModule.value.content = code;
|
|
10
|
+
return rawScriptModule;
|
|
11
|
+
}
|
|
12
|
+
export function applyFlowJsonUpdate(flow, inlineScriptSession, { modules, schema, preprocessorModule, failureModule }) {
|
|
13
|
+
const emptyInlineScriptModuleIds = new Set();
|
|
14
|
+
if (modules !== undefined) {
|
|
15
|
+
flow.value.modules = restoreFlowModules(modules, inlineScriptSession, emptyInlineScriptModuleIds);
|
|
16
|
+
}
|
|
17
|
+
if (schema !== undefined) {
|
|
18
|
+
flow.schema = schema ?? undefined;
|
|
19
|
+
}
|
|
20
|
+
if (preprocessorModule !== undefined) {
|
|
21
|
+
flow.value.preprocessor_module =
|
|
22
|
+
preprocessorModule === null
|
|
23
|
+
? undefined
|
|
24
|
+
: restoreFlowModule(preprocessorModule, inlineScriptSession, emptyInlineScriptModuleIds);
|
|
25
|
+
}
|
|
26
|
+
if (failureModule !== undefined) {
|
|
27
|
+
flow.value.failure_module =
|
|
28
|
+
failureModule === null
|
|
29
|
+
? undefined
|
|
30
|
+
: restoreFlowModule(failureModule, inlineScriptSession, emptyInlineScriptModuleIds);
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
emptyInlineScriptModuleIds: Array.from(emptyInlineScriptModuleIds)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function restoreFlowModules(modules, inlineScriptSession, emptyInlineScriptModuleIds) {
|
|
37
|
+
const restoredModules = inlineScriptSession.restoreInlineScriptReferences(modules);
|
|
38
|
+
replaceNewInlineScriptRefsWithEmptyCode(restoredModules, emptyInlineScriptModuleIds);
|
|
39
|
+
assertResolvedInlineScripts(restoredModules, inlineScriptSession);
|
|
40
|
+
return restoredModules;
|
|
41
|
+
}
|
|
42
|
+
function restoreFlowModule(module, inlineScriptSession, emptyInlineScriptModuleIds) {
|
|
43
|
+
const [restoredModule] = inlineScriptSession.restoreInlineScriptReferences([module]);
|
|
44
|
+
replaceNewInlineScriptRefsWithEmptyCode([restoredModule], emptyInlineScriptModuleIds);
|
|
45
|
+
assertResolvedInlineScripts([restoredModule], inlineScriptSession);
|
|
46
|
+
return restoredModule;
|
|
47
|
+
}
|
|
48
|
+
function assertResolvedInlineScripts(modules, inlineScriptSession) {
|
|
49
|
+
const unresolvedRefs = inlineScriptSession.findUnresolvedInlineScriptRefs(modules);
|
|
50
|
+
if (unresolvedRefs.length > 0) {
|
|
51
|
+
throw new Error(`Unresolved inline script references: ${unresolvedRefs.join(', ')}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function replaceNewInlineScriptRefsWithEmptyCode(modules, emptyInlineScriptModuleIds) {
|
|
55
|
+
function replaceInlineScriptRefWithEmptyCode(ownerId, content) {
|
|
56
|
+
const match = content.match(/^inline_script\.(.+)$/);
|
|
57
|
+
if (!match || match[1] !== ownerId) {
|
|
58
|
+
return content;
|
|
59
|
+
}
|
|
60
|
+
emptyInlineScriptModuleIds.add(ownerId);
|
|
61
|
+
return '';
|
|
62
|
+
}
|
|
63
|
+
forEachFlowModule(modules, (module) => {
|
|
64
|
+
if (module.value.type === 'rawscript' && module.value.content) {
|
|
65
|
+
module.value.content = replaceInlineScriptRefWithEmptyCode(module.id, module.value.content);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { applyFlowJsonUpdate, updateRawScriptModuleContent } from './helperUtils';
|
|
3
|
+
import { createInlineScriptSession } from './inlineScriptsUtils';
|
|
4
|
+
vi.mock('../shared', () => ({
|
|
5
|
+
SPECIAL_MODULE_IDS: {
|
|
6
|
+
PREPROCESSOR: 'preprocessor',
|
|
7
|
+
FAILURE: 'failure'
|
|
8
|
+
}
|
|
9
|
+
}));
|
|
10
|
+
function makeRawScriptModule(id, content) {
|
|
11
|
+
return {
|
|
12
|
+
id,
|
|
13
|
+
summary: id,
|
|
14
|
+
value: {
|
|
15
|
+
type: 'rawscript',
|
|
16
|
+
language: 'bun',
|
|
17
|
+
content,
|
|
18
|
+
input_transforms: {}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function makeAiAgentWithTool(agentId, toolId, toolContent) {
|
|
23
|
+
return {
|
|
24
|
+
id: agentId,
|
|
25
|
+
summary: agentId,
|
|
26
|
+
value: {
|
|
27
|
+
type: 'aiagent',
|
|
28
|
+
tools: [
|
|
29
|
+
{
|
|
30
|
+
id: toolId,
|
|
31
|
+
summary: toolId,
|
|
32
|
+
value: {
|
|
33
|
+
tool_type: 'flowmodule',
|
|
34
|
+
type: 'rawscript',
|
|
35
|
+
language: 'bun',
|
|
36
|
+
content: toolContent,
|
|
37
|
+
input_transforms: {}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
input_transforms: {}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
describe('applyFlowJsonUpdate', () => {
|
|
46
|
+
it('accepts new self-referenced inline scripts and initializes them as empty', () => {
|
|
47
|
+
const flow = {
|
|
48
|
+
value: {
|
|
49
|
+
modules: [makeRawScriptModule('process_data', 'existing code')]
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const inlineScriptSession = createInlineScriptSession();
|
|
53
|
+
inlineScriptSession.set('process_data', 'existing code');
|
|
54
|
+
const result = applyFlowJsonUpdate(flow, inlineScriptSession, {
|
|
55
|
+
modules: [
|
|
56
|
+
makeRawScriptModule('process_data', 'inline_script.process_data'),
|
|
57
|
+
makeRawScriptModule('validate_data', 'inline_script.validate_data')
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
const [processDataModule, validateDataModule] = flow.value.modules;
|
|
61
|
+
expect(result.emptyInlineScriptModuleIds).toEqual(['validate_data']);
|
|
62
|
+
expect(inlineScriptSession.has('validate_data')).toBe(false);
|
|
63
|
+
expect(processDataModule?.value.type).toBe('rawscript');
|
|
64
|
+
expect(processDataModule?.value.content).toBe('existing code');
|
|
65
|
+
expect(validateDataModule?.value.type).toBe('rawscript');
|
|
66
|
+
expect(validateDataModule?.value.content).toBe('');
|
|
67
|
+
});
|
|
68
|
+
it('still rejects unresolved inline script references that do not match the module id', () => {
|
|
69
|
+
const flow = {
|
|
70
|
+
value: {
|
|
71
|
+
modules: []
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const inlineScriptSession = createInlineScriptSession();
|
|
75
|
+
expect(() => applyFlowJsonUpdate(flow, inlineScriptSession, {
|
|
76
|
+
modules: [makeRawScriptModule('validate_data', 'inline_script.other_module')]
|
|
77
|
+
})).toThrow('Unresolved inline script references: other_module');
|
|
78
|
+
});
|
|
79
|
+
it('keeps the inline script session unchanged after a failed update so retries still warn', () => {
|
|
80
|
+
const flow = {
|
|
81
|
+
value: {
|
|
82
|
+
modules: [makeRawScriptModule('process_data', 'existing code')]
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const inlineScriptSession = createInlineScriptSession();
|
|
86
|
+
inlineScriptSession.set('process_data', 'existing code');
|
|
87
|
+
expect(() => applyFlowJsonUpdate(flow, inlineScriptSession, {
|
|
88
|
+
modules: [
|
|
89
|
+
makeRawScriptModule('validate_data', 'inline_script.validate_data'),
|
|
90
|
+
makeRawScriptModule('save_results', 'inline_script.other_module')
|
|
91
|
+
]
|
|
92
|
+
})).toThrow('Unresolved inline script references: other_module');
|
|
93
|
+
expect(inlineScriptSession.getAll()).toEqual({
|
|
94
|
+
process_data: 'existing code'
|
|
95
|
+
});
|
|
96
|
+
expect(flow.value.modules[0]?.value.content).toBe('existing code');
|
|
97
|
+
const result = applyFlowJsonUpdate(flow, inlineScriptSession, {
|
|
98
|
+
modules: [
|
|
99
|
+
makeRawScriptModule('process_data', 'inline_script.process_data'),
|
|
100
|
+
makeRawScriptModule('validate_data', 'inline_script.validate_data')
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
expect(result.emptyInlineScriptModuleIds).toEqual(['validate_data']);
|
|
104
|
+
expect(inlineScriptSession.has('validate_data')).toBe(false);
|
|
105
|
+
});
|
|
106
|
+
it('updates ai agent rawscript tools in place when changing module code', () => {
|
|
107
|
+
const flow = {
|
|
108
|
+
value: {
|
|
109
|
+
modules: [makeAiAgentWithTool('agent', 'sum', '')]
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const updatedModule = updateRawScriptModuleContent(flow, 'sum', 'export async function main(numbers: number[]) { return 0 }');
|
|
113
|
+
expect(updatedModule?.value.content).toBe('export async function main(numbers: number[]) { return 0 }');
|
|
114
|
+
expect(flow.value.modules[0].value.tools[0].value.content).toBe('export async function main(numbers: number[]) { return 0 }');
|
|
115
|
+
});
|
|
116
|
+
});
|
|
@@ -1,31 +1,12 @@
|
|
|
1
1
|
import type { FlowModule } from '../../../../gen';
|
|
2
|
-
|
|
3
|
-
* Storage for inline scripts extracted from flow modules.
|
|
4
|
-
* Maps module IDs to their rawscript content for token-efficient transmission to AI.
|
|
5
|
-
*/
|
|
6
|
-
declare class InlineScriptStore {
|
|
7
|
-
private scripts;
|
|
2
|
+
export interface InlineScriptSession {
|
|
8
3
|
clear(): void;
|
|
9
4
|
set(moduleId: string, content: string): void;
|
|
10
5
|
get(moduleId: string): string | undefined;
|
|
11
6
|
has(moduleId: string): boolean;
|
|
12
7
|
getAll(): Record<string, string>;
|
|
8
|
+
extractAndReplaceInlineScripts(modules: FlowModule[]): FlowModule[];
|
|
9
|
+
restoreInlineScriptReferences(modules: FlowModule[]): FlowModule[];
|
|
10
|
+
findUnresolvedInlineScriptRefs(modules: FlowModule[]): string[];
|
|
13
11
|
}
|
|
14
|
-
export declare
|
|
15
|
-
/**
|
|
16
|
-
* Recursively extracts all rawscript content from flow modules and stores them.
|
|
17
|
-
* Replaces the content with references like "inline_script.{module_id}".
|
|
18
|
-
*/
|
|
19
|
-
export declare function extractAndReplaceInlineScripts(modules: FlowModule[]): FlowModule[];
|
|
20
|
-
/**
|
|
21
|
-
* Recursively restores inline script references back to their full content.
|
|
22
|
-
* If content matches pattern "inline_script.{id}", looks up and restores the original.
|
|
23
|
-
* If content doesn't match (new/modified script), keeps it as-is.
|
|
24
|
-
*/
|
|
25
|
-
export declare function restoreInlineScriptReferences(modules: FlowModule[]): FlowModule[];
|
|
26
|
-
/**
|
|
27
|
-
* Recursively finds any unresolved inline script references in flow modules.
|
|
28
|
-
* Returns array of module IDs that still have `inline_script.{id}` patterns.
|
|
29
|
-
*/
|
|
30
|
-
export declare function findUnresolvedInlineScriptRefs(modules: FlowModule[]): string[];
|
|
31
|
-
export {};
|
|
12
|
+
export declare function createInlineScriptSession(): InlineScriptSession;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Storage for inline scripts extracted from flow modules.
|
|
3
|
-
* Maps module IDs to their rawscript content for token-efficient transmission to AI.
|
|
4
|
-
*/
|
|
5
|
-
class InlineScriptStore {
|
|
1
|
+
class DefaultInlineScriptSession {
|
|
6
2
|
scripts = new Map();
|
|
7
3
|
clear() {
|
|
8
4
|
this.scripts.clear();
|
|
@@ -19,68 +15,69 @@ class InlineScriptStore {
|
|
|
19
15
|
getAll() {
|
|
20
16
|
return Object.fromEntries(this.scripts.entries());
|
|
21
17
|
}
|
|
18
|
+
extractAndReplaceInlineScripts(modules) {
|
|
19
|
+
return extractAndReplaceInlineScripts(modules, this);
|
|
20
|
+
}
|
|
21
|
+
restoreInlineScriptReferences(modules) {
|
|
22
|
+
return restoreInlineScriptReferences(modules, this);
|
|
23
|
+
}
|
|
24
|
+
findUnresolvedInlineScriptRefs(modules) {
|
|
25
|
+
return findUnresolvedInlineScriptRefs(modules);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function createInlineScriptSession() {
|
|
29
|
+
return new DefaultInlineScriptSession();
|
|
22
30
|
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Recursively extracts all rawscript content from flow modules and stores them.
|
|
26
|
-
* Replaces the content with references like "inline_script.{module_id}".
|
|
27
|
-
*/
|
|
28
|
-
export function extractAndReplaceInlineScripts(modules) {
|
|
31
|
+
function extractAndReplaceInlineScripts(modules, session) {
|
|
29
32
|
if (!modules || !Array.isArray(modules)) {
|
|
30
33
|
return [];
|
|
31
34
|
}
|
|
32
35
|
return modules.map((module) => {
|
|
33
36
|
const newModule = { ...module };
|
|
34
37
|
if (newModule.value.type === 'rawscript' && newModule.value.content) {
|
|
35
|
-
|
|
36
|
-
inlineScriptStore.set(module.id, newModule.value.content);
|
|
37
|
-
// Replace with reference
|
|
38
|
+
session.set(module.id, newModule.value.content);
|
|
38
39
|
newModule.value = {
|
|
39
40
|
...newModule.value,
|
|
40
41
|
content: `inline_script.${module.id}`
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
else if (newModule.value.type === 'forloopflow' || newModule.value.type === 'whileloopflow') {
|
|
44
|
-
// Recursively process nested modules in loops
|
|
45
45
|
if (newModule.value.modules) {
|
|
46
46
|
newModule.value = {
|
|
47
47
|
...newModule.value,
|
|
48
|
-
modules: extractAndReplaceInlineScripts(newModule.value.modules)
|
|
48
|
+
modules: extractAndReplaceInlineScripts(newModule.value.modules, session)
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
else if (newModule.value.type === 'branchone') {
|
|
53
|
-
// Process branches and default modules
|
|
54
53
|
if (newModule.value.branches) {
|
|
55
54
|
newModule.value = {
|
|
56
55
|
...newModule.value,
|
|
57
56
|
branches: newModule.value.branches.map((branch) => ({
|
|
58
57
|
...branch,
|
|
59
|
-
modules: branch.modules ? extractAndReplaceInlineScripts(branch.modules) : []
|
|
58
|
+
modules: branch.modules ? extractAndReplaceInlineScripts(branch.modules, session) : []
|
|
60
59
|
}))
|
|
61
60
|
};
|
|
62
61
|
}
|
|
63
62
|
if (newModule.value.default) {
|
|
64
63
|
newModule.value = {
|
|
65
64
|
...newModule.value,
|
|
66
|
-
default: extractAndReplaceInlineScripts(newModule.value.default)
|
|
65
|
+
default: extractAndReplaceInlineScripts(newModule.value.default, session)
|
|
67
66
|
};
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
else if (newModule.value.type === 'branchall') {
|
|
71
|
-
// Process all branches
|
|
72
70
|
if (newModule.value.branches) {
|
|
73
71
|
newModule.value = {
|
|
74
72
|
...newModule.value,
|
|
75
73
|
branches: newModule.value.branches.map((branch) => ({
|
|
76
74
|
...branch,
|
|
77
|
-
modules: branch.modules ? extractAndReplaceInlineScripts(branch.modules) : []
|
|
75
|
+
modules: branch.modules ? extractAndReplaceInlineScripts(branch.modules, session) : []
|
|
78
76
|
}))
|
|
79
77
|
};
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
80
|
else if (newModule.value.type === 'aiagent') {
|
|
83
|
-
// Process AI agent tools
|
|
84
81
|
if (newModule.value.tools) {
|
|
85
82
|
newModule.value = {
|
|
86
83
|
...newModule.value,
|
|
@@ -92,7 +89,7 @@ export function extractAndReplaceInlineScripts(modules) {
|
|
|
92
89
|
tool.value.type === 'rawscript' &&
|
|
93
90
|
'content' in tool.value &&
|
|
94
91
|
tool.value.content) {
|
|
95
|
-
|
|
92
|
+
session.set(tool.id, tool.value.content);
|
|
96
93
|
return {
|
|
97
94
|
...tool,
|
|
98
95
|
value: {
|
|
@@ -109,73 +106,58 @@ export function extractAndReplaceInlineScripts(modules) {
|
|
|
109
106
|
return newModule;
|
|
110
107
|
});
|
|
111
108
|
}
|
|
112
|
-
|
|
113
|
-
* Recursively restores inline script references back to their full content.
|
|
114
|
-
* If content matches pattern "inline_script.{id}", looks up and restores the original.
|
|
115
|
-
* If content doesn't match (new/modified script), keeps it as-is.
|
|
116
|
-
*/
|
|
117
|
-
export function restoreInlineScriptReferences(modules) {
|
|
109
|
+
function restoreInlineScriptReferences(modules, session) {
|
|
118
110
|
return modules.map((module) => {
|
|
119
111
|
const newModule = { ...module };
|
|
120
112
|
if (newModule.value.type === 'rawscript' && newModule.value.content) {
|
|
121
|
-
const
|
|
122
|
-
// Check if it's a reference
|
|
123
|
-
const match = content.match(/^inline_script\.(.+)$/);
|
|
113
|
+
const match = newModule.value.content.match(/^inline_script\.(.+)$/);
|
|
124
114
|
if (match) {
|
|
125
|
-
const
|
|
126
|
-
const storedContent = inlineScriptStore.get(moduleId);
|
|
115
|
+
const storedContent = session.get(match[1]);
|
|
127
116
|
if (storedContent !== undefined) {
|
|
128
|
-
// Restore original content
|
|
129
117
|
newModule.value = {
|
|
130
118
|
...newModule.value,
|
|
131
119
|
content: storedContent
|
|
132
120
|
};
|
|
133
121
|
}
|
|
134
|
-
// If not found in store, keep the reference as-is (shouldn't happen normally)
|
|
135
122
|
}
|
|
136
|
-
// If not a reference, it's new/modified content - keep as-is
|
|
137
123
|
}
|
|
138
124
|
else if (newModule.value.type === 'forloopflow' || newModule.value.type === 'whileloopflow') {
|
|
139
|
-
// Recursively process nested modules in loops
|
|
140
125
|
if (newModule.value.modules) {
|
|
141
126
|
newModule.value = {
|
|
142
127
|
...newModule.value,
|
|
143
|
-
modules: restoreInlineScriptReferences(newModule.value.modules)
|
|
128
|
+
modules: restoreInlineScriptReferences(newModule.value.modules, session)
|
|
144
129
|
};
|
|
145
130
|
}
|
|
146
131
|
}
|
|
147
132
|
else if (newModule.value.type === 'branchone') {
|
|
148
|
-
// Process branches and default modules
|
|
149
133
|
if (newModule.value.branches) {
|
|
150
134
|
newModule.value = {
|
|
151
135
|
...newModule.value,
|
|
152
136
|
branches: newModule.value.branches.map((branch) => ({
|
|
153
137
|
...branch,
|
|
154
|
-
modules: branch.modules ? restoreInlineScriptReferences(branch.modules) : []
|
|
138
|
+
modules: branch.modules ? restoreInlineScriptReferences(branch.modules, session) : []
|
|
155
139
|
}))
|
|
156
140
|
};
|
|
157
141
|
}
|
|
158
142
|
if (newModule.value.default) {
|
|
159
143
|
newModule.value = {
|
|
160
144
|
...newModule.value,
|
|
161
|
-
default: restoreInlineScriptReferences(newModule.value.default)
|
|
145
|
+
default: restoreInlineScriptReferences(newModule.value.default, session)
|
|
162
146
|
};
|
|
163
147
|
}
|
|
164
148
|
}
|
|
165
149
|
else if (newModule.value.type === 'branchall') {
|
|
166
|
-
// Process all branches
|
|
167
150
|
if (newModule.value.branches) {
|
|
168
151
|
newModule.value = {
|
|
169
152
|
...newModule.value,
|
|
170
153
|
branches: newModule.value.branches.map((branch) => ({
|
|
171
154
|
...branch,
|
|
172
|
-
modules: branch.modules ? restoreInlineScriptReferences(branch.modules) : []
|
|
155
|
+
modules: branch.modules ? restoreInlineScriptReferences(branch.modules, session) : []
|
|
173
156
|
}))
|
|
174
157
|
};
|
|
175
158
|
}
|
|
176
159
|
}
|
|
177
160
|
else if (newModule.value.type === 'aiagent') {
|
|
178
|
-
// Process AI agent tools
|
|
179
161
|
if (newModule.value.tools) {
|
|
180
162
|
newModule.value = {
|
|
181
163
|
...newModule.value,
|
|
@@ -187,11 +169,9 @@ export function restoreInlineScriptReferences(modules) {
|
|
|
187
169
|
tool.value.type === 'rawscript' &&
|
|
188
170
|
'content' in tool.value &&
|
|
189
171
|
tool.value.content) {
|
|
190
|
-
const
|
|
191
|
-
const match = content.match(/^inline_script\.(.+)$/);
|
|
172
|
+
const match = tool.value.content.match(/^inline_script\.(.+)$/);
|
|
192
173
|
if (match) {
|
|
193
|
-
const
|
|
194
|
-
const storedContent = inlineScriptStore.get(toolId);
|
|
174
|
+
const storedContent = session.get(match[1]);
|
|
195
175
|
if (storedContent !== undefined) {
|
|
196
176
|
return {
|
|
197
177
|
...tool,
|
|
@@ -211,11 +191,7 @@ export function restoreInlineScriptReferences(modules) {
|
|
|
211
191
|
return newModule;
|
|
212
192
|
});
|
|
213
193
|
}
|
|
214
|
-
|
|
215
|
-
* Recursively finds any unresolved inline script references in flow modules.
|
|
216
|
-
* Returns array of module IDs that still have `inline_script.{id}` patterns.
|
|
217
|
-
*/
|
|
218
|
-
export function findUnresolvedInlineScriptRefs(modules) {
|
|
194
|
+
function findUnresolvedInlineScriptRefs(modules) {
|
|
219
195
|
const unresolvedRefs = [];
|
|
220
196
|
function checkModule(module) {
|
|
221
197
|
if (module.value.type === 'rawscript' && module.value.content) {
|
|
@@ -247,7 +223,6 @@ export function findUnresolvedInlineScriptRefs(modules) {
|
|
|
247
223
|
}
|
|
248
224
|
}
|
|
249
225
|
else if (module.value.type === 'aiagent') {
|
|
250
|
-
// Check AI agent tools
|
|
251
226
|
if (module.value.tools) {
|
|
252
227
|
for (const tool of module.value.tools) {
|
|
253
228
|
if (tool.value &&
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { collectAllFlowModuleIdsFromModules } from '../../../../components/flows/flowTree';
|
|
3
|
+
function createAiAgentTool(id, content) {
|
|
4
|
+
return {
|
|
5
|
+
id,
|
|
6
|
+
summary: id,
|
|
7
|
+
value: {
|
|
8
|
+
tool_type: 'flowmodule',
|
|
9
|
+
type: 'rawscript',
|
|
10
|
+
content,
|
|
11
|
+
language: 'bun',
|
|
12
|
+
input_transforms: {}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function createAiAgentModule(id, tools) {
|
|
17
|
+
return {
|
|
18
|
+
id,
|
|
19
|
+
value: {
|
|
20
|
+
type: 'aiagent',
|
|
21
|
+
tools,
|
|
22
|
+
input_transforms: {}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
describe('chat flow utils', () => {
|
|
27
|
+
it('collects nested module ids and all ai agent tool ids for flow-json validation', () => {
|
|
28
|
+
const modules = [
|
|
29
|
+
{
|
|
30
|
+
id: 'router',
|
|
31
|
+
value: {
|
|
32
|
+
type: 'branchone',
|
|
33
|
+
default: [{ id: 'default_step', value: { type: 'identity' } }],
|
|
34
|
+
branches: [{ expr: 'true', modules: [{ id: 'branch_step', value: { type: 'identity' } }] }],
|
|
35
|
+
input_transforms: {}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
createAiAgentModule('agent', [
|
|
39
|
+
createAiAgentTool('lookup', 'lookup-tool'),
|
|
40
|
+
{
|
|
41
|
+
id: 'search_docs',
|
|
42
|
+
summary: 'search_docs',
|
|
43
|
+
value: {
|
|
44
|
+
tool_type: 'mcp',
|
|
45
|
+
resource_path: ''
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
])
|
|
49
|
+
];
|
|
50
|
+
expect(collectAllFlowModuleIdsFromModules(modules)).toEqual([
|
|
51
|
+
'router',
|
|
52
|
+
'branch_step',
|
|
53
|
+
'default_step',
|
|
54
|
+
'agent',
|
|
55
|
+
'lookup',
|
|
56
|
+
'search_docs'
|
|
57
|
+
]);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -3,6 +3,11 @@ import type { ChatCompletionMessageParam } from 'openai/resources/index.mjs';
|
|
|
3
3
|
import { type Tool, type ToolCallbacks } from './shared';
|
|
4
4
|
import type { ResponseStream } from 'openai/lib/responses/ResponseStream.mjs';
|
|
5
5
|
import type { AIProviderModel } from '../../../gen';
|
|
6
|
+
import { type ChatTokenUsage } from './tokenUsage';
|
|
7
|
+
interface ParsedCompletionResult {
|
|
8
|
+
shouldContinue: boolean;
|
|
9
|
+
tokenUsage: ChatTokenUsage;
|
|
10
|
+
}
|
|
6
11
|
export declare function getOpenAIResponsesCompletion(messages: ChatCompletionMessageParam[], abortController: AbortController, tools?: OpenAI.Chat.Completions.ChatCompletionTool[], options?: {
|
|
7
12
|
forceModelProvider?: AIProviderModel;
|
|
8
13
|
openaiClient?: OpenAI;
|
|
@@ -13,10 +18,11 @@ export declare function parseOpenAIResponsesCompletion(runner: ResponseStream, c
|
|
|
13
18
|
onMessageEnd: () => void;
|
|
14
19
|
}, messages: ChatCompletionMessageParam[], addedMessages: ChatCompletionMessageParam[], tools: Tool<any>[], helpers: any, options?: {
|
|
15
20
|
workspace?: string;
|
|
16
|
-
}): Promise<
|
|
21
|
+
}): Promise<ParsedCompletionResult>;
|
|
17
22
|
export declare function getNonStreamingOpenAIResponsesCompletion(messages: ChatCompletionMessageParam[], abortController: AbortController, testOptions?: {
|
|
18
23
|
apiKey?: string;
|
|
19
24
|
workspace?: string;
|
|
20
25
|
resourcePath?: string;
|
|
21
26
|
forceModelProvider: AIProviderModel;
|
|
22
27
|
}): Promise<string>;
|
|
28
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import OpenAI, { OpenAIError } from 'openai';
|
|
2
2
|
import { createOpenAIProxyClient, getAiProxyBaseURL, getProviderAndCompletionConfig, workspaceAIClients } from '../lib';
|
|
3
3
|
import { processToolCall } from './shared';
|
|
4
|
+
import { openAIResponsesUsageToChatTokenUsage } from './tokenUsage';
|
|
4
5
|
// Conversion utilities for Responses API
|
|
5
6
|
function convertMessagesToResponsesInput(messages) {
|
|
6
7
|
const systemMessage = messages.find((m) => m.role === 'system');
|
|
@@ -254,6 +255,8 @@ export async function parseOpenAIResponsesCompletion(runner, callbacks, messages
|
|
|
254
255
|
if (error) {
|
|
255
256
|
throw error;
|
|
256
257
|
}
|
|
258
|
+
const finalResponse = await runner.finalResponse();
|
|
259
|
+
const tokenUsage = openAIResponsesUsageToChatTokenUsage(finalResponse.usage);
|
|
257
260
|
// Process tool calls if any
|
|
258
261
|
if (toolCallsToProcess.length > 0) {
|
|
259
262
|
const assistantWithTools = {
|
|
@@ -274,9 +277,9 @@ export async function parseOpenAIResponsesCompletion(runner, callbacks, messages
|
|
|
274
277
|
messages.push(messageToAdd);
|
|
275
278
|
addedMessages.push(messageToAdd);
|
|
276
279
|
}
|
|
277
|
-
return
|
|
280
|
+
return { shouldContinue: true, tokenUsage };
|
|
278
281
|
}
|
|
279
|
-
return
|
|
282
|
+
return { shouldContinue: false, tokenUsage };
|
|
280
283
|
}
|
|
281
284
|
export async function getNonStreamingOpenAIResponsesCompletion(messages, abortController, testOptions) {
|
|
282
285
|
const { provider, config } = getProviderAndCompletionConfig({
|
|
@@ -26,8 +26,7 @@ export interface ContextStringResult {
|
|
|
26
26
|
hasFlowModule: boolean;
|
|
27
27
|
}
|
|
28
28
|
export declare const extractAllModules: (modules: FlowModule[]) => FlowModule[];
|
|
29
|
-
export declare
|
|
30
|
-
export declare function applyCodePiecesToFlowModules(codePieces: FlowModuleCodePieceElement[], flowModules: FlowModule[]): string;
|
|
29
|
+
export declare function applyCodePiecesToFlowModules(codePieces: FlowModuleCodePieceElement[], flowModules: FlowModule[]): FlowModule[];
|
|
31
30
|
export declare function buildContextString(selectedContext: ContextElement[]): string;
|
|
32
31
|
type BaseDisplayMessage = {
|
|
33
32
|
content: string;
|