windmill-components 1.596.1 → 1.613.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.
Files changed (416) hide show
  1. package/dist/sharedUtils/assets/tokens/colorTokensConfig.d.ts +2 -0
  2. package/dist/sharedUtils/base.d.ts +1 -0
  3. package/dist/sharedUtils/cloud.d.ts +1 -0
  4. package/dist/sharedUtils/common.d.ts +111 -0
  5. package/dist/sharedUtils/components/apps/components/display/dbtable/queries/count.d.ts +5 -0
  6. package/dist/sharedUtils/components/apps/components/display/dbtable/queries/delete.d.ts +5 -0
  7. package/dist/sharedUtils/components/apps/components/display/dbtable/queries/insert.d.ts +5 -0
  8. package/dist/sharedUtils/components/apps/components/display/dbtable/queries/select.d.ts +13 -0
  9. package/dist/sharedUtils/components/apps/components/display/dbtable/queries/update.d.ts +11 -0
  10. package/dist/sharedUtils/components/apps/components/display/dbtable/utils.d.ts +95 -0
  11. package/dist/sharedUtils/components/apps/editor/appPolicy.d.ts +6 -0
  12. package/dist/sharedUtils/components/apps/editor/appUtilsCore.d.ts +7 -0
  13. package/dist/sharedUtils/components/apps/editor/appUtilsS3.d.ts +33 -0
  14. package/dist/sharedUtils/components/apps/editor/commonAppUtils.d.ts +10 -0
  15. package/dist/sharedUtils/components/apps/editor/component/components.d.ts +5371 -0
  16. package/dist/sharedUtils/components/apps/editor/component/default-codes.d.ts +3 -0
  17. package/dist/sharedUtils/components/apps/editor/component/index.d.ts +3 -0
  18. package/dist/sharedUtils/components/apps/editor/component/sets.d.ts +7 -0
  19. package/dist/sharedUtils/components/apps/editor/componentsPanel/componentDefaultProps.d.ts +3 -0
  20. package/dist/sharedUtils/components/apps/gridUtils.d.ts +14 -0
  21. package/dist/sharedUtils/components/apps/inputType.d.ts +178 -0
  22. package/dist/sharedUtils/components/apps/rx.d.ts +29 -0
  23. package/dist/sharedUtils/components/apps/sharedTypes.d.ts +21 -0
  24. package/dist/sharedUtils/components/apps/types.d.ts +274 -0
  25. package/dist/sharedUtils/components/assets/lib.d.ts +25 -0
  26. package/dist/sharedUtils/components/common/alert/model.d.ts +2 -0
  27. package/dist/sharedUtils/components/common/badge/model.d.ts +8 -0
  28. package/dist/sharedUtils/components/common/button/model.d.ts +45 -0
  29. package/dist/sharedUtils/components/common/fileInput/model.d.ts +1 -0
  30. package/dist/sharedUtils/components/common/index.d.ts +24 -0
  31. package/dist/sharedUtils/components/common/skeleton/model.d.ts +21 -0
  32. package/dist/sharedUtils/components/dbTypes.d.ts +14 -0
  33. package/dist/sharedUtils/components/diff_drawer.d.ts +26 -0
  34. package/dist/sharedUtils/components/ducklake.d.ts +1 -0
  35. package/dist/sharedUtils/components/flows/scheduleUtils.d.ts +7 -0
  36. package/dist/sharedUtils/components/icons/index.d.ts +101 -0
  37. package/dist/sharedUtils/components/random_positive_adjetive.d.ts +1 -0
  38. package/dist/sharedUtils/components/raw_apps/rawAppPolicy.d.ts +10 -0
  39. package/dist/sharedUtils/components/raw_apps/utils.d.ts +15 -0
  40. package/dist/sharedUtils/components/triggers/email/utils.d.ts +4 -0
  41. package/dist/sharedUtils/components/triggers/gcp/utils.d.ts +2 -0
  42. package/dist/sharedUtils/components/triggers/http/utils.d.ts +11 -0
  43. package/dist/sharedUtils/components/triggers/kafka/utils.d.ts +2 -0
  44. package/dist/sharedUtils/components/triggers/mqtt/utils.d.ts +2 -0
  45. package/dist/sharedUtils/components/triggers/nats/utils.d.ts +2 -0
  46. package/dist/sharedUtils/components/triggers/postgres/utils.d.ts +8 -0
  47. package/dist/sharedUtils/components/triggers/sqs/utils.d.ts +2 -0
  48. package/dist/sharedUtils/components/triggers/triggers.svelte.d.ts +32 -0
  49. package/dist/sharedUtils/components/triggers/utils.d.ts +80 -0
  50. package/dist/sharedUtils/components/triggers/websocket/utils.d.ts +2 -0
  51. package/dist/sharedUtils/components/triggers.d.ts +20 -0
  52. package/dist/sharedUtils/gen/core/ApiError.d.ts +10 -0
  53. package/dist/sharedUtils/gen/core/ApiRequestOptions.d.ts +13 -0
  54. package/dist/sharedUtils/gen/core/ApiResult.d.ts +7 -0
  55. package/dist/sharedUtils/gen/core/CancelablePromise.d.ts +26 -0
  56. package/dist/sharedUtils/gen/core/OpenAPI.d.ts +27 -0
  57. package/dist/sharedUtils/gen/core/request.d.ts +29 -0
  58. package/dist/sharedUtils/gen/index.d.ts +6 -0
  59. package/dist/sharedUtils/gen/schemas.gen.d.ts +7036 -0
  60. package/dist/sharedUtils/gen/services.gen.d.ts +6047 -0
  61. package/dist/sharedUtils/gen/types.gen.d.ts +21881 -0
  62. package/dist/sharedUtils/history.svelte.d.ts +9 -0
  63. package/dist/sharedUtils/hub.d.ts +49 -0
  64. package/dist/sharedUtils/jsr.json +6 -0
  65. package/dist/sharedUtils/lib.d.ts +5 -0
  66. package/dist/sharedUtils/lib.es.js +1588 -0
  67. package/dist/sharedUtils/package.json +12 -0
  68. package/dist/sharedUtils/schema.d.ts +3 -0
  69. package/dist/sharedUtils/stores.d.ts +97 -0
  70. package/dist/sharedUtils/svelte5Utils.svelte.d.ts +80 -0
  71. package/dist/sharedUtils/toast.d.ts +8 -0
  72. package/dist/sharedUtils/utils.d.ts +265 -0
  73. package/package/assets/tokens/tokens.json +11 -1
  74. package/package/ata/apis.js +78 -5
  75. package/package/components/AddUser.svelte +1 -1
  76. package/package/components/CenteredModal.svelte +32 -24
  77. package/package/components/CenteredModal.svelte.d.ts +7 -27
  78. package/package/components/CenteredPage.svelte +5 -2
  79. package/package/components/CenteredPage.svelte.d.ts +2 -0
  80. package/package/components/ConcurrentJobsChart.svelte +3 -2
  81. package/package/components/ConcurrentJobsChart.svelte.d.ts +2 -2
  82. package/package/components/CustomPopover.svelte +20 -23
  83. package/package/components/CustomPopover.svelte.d.ts +14 -39
  84. package/package/components/DBManager.svelte +105 -17
  85. package/package/components/DBManager.svelte.d.ts +2 -1
  86. package/package/components/DBManagerContent.svelte +4 -3
  87. package/package/components/DBManagerContent.svelte.d.ts +1 -1
  88. package/package/components/DBTableEditor.svelte +210 -171
  89. package/package/components/DBTableEditor.svelte.d.ts +22 -3
  90. package/package/components/Description.svelte +3 -2
  91. package/package/components/Dev.svelte +36 -2
  92. package/package/components/DiffDrawer.svelte +8 -29
  93. package/package/components/DiffEditor.svelte +32 -2
  94. package/package/components/DisplayResult.svelte +32 -24
  95. package/package/components/Editor.svelte +70 -16
  96. package/package/components/Editor.svelte.d.ts +3 -0
  97. package/package/components/EditorBar.svelte +1 -1
  98. package/package/components/FakeMonacoPlaceHolder.svelte +1 -1
  99. package/package/components/FlowBuilder.svelte +17 -11
  100. package/package/components/FlowDiffViewer.svelte +37 -0
  101. package/package/components/FlowDiffViewer.svelte.d.ts +7 -0
  102. package/package/components/FlowPreviewContent.svelte +3 -2
  103. package/package/components/FlowPreviewResult.svelte +0 -4
  104. package/package/components/FlowStatusViewerInner.svelte +50 -33
  105. package/package/components/FlowStatusViewerInner.svelte.d.ts +1 -1
  106. package/package/components/FlowStatusWaitingForEvents.svelte +27 -23
  107. package/package/components/FlowStatusWaitingForEvents.svelte.d.ts +4 -18
  108. package/package/components/FlowViewer.svelte +103 -2
  109. package/package/components/FlowViewer.svelte.d.ts +9 -3
  110. package/package/components/ForkWorkspaceBanner.svelte +16 -13
  111. package/package/components/GraphqlSchemaViewer.svelte +8 -1
  112. package/package/components/HistoricInputs.svelte +25 -27
  113. package/package/components/HistoricInputs.svelte.d.ts +2 -2
  114. package/package/components/InstanceSetting.svelte +38 -0
  115. package/package/components/InviteUser.svelte +16 -42
  116. package/package/components/InviteUser.svelte.d.ts +4 -18
  117. package/package/components/JobOtelTraces.svelte +287 -0
  118. package/package/components/JobOtelTraces.svelte.d.ts +6 -0
  119. package/package/components/JsonInputs.svelte +6 -8
  120. package/package/components/JsonInputs.svelte.d.ts +7 -8
  121. package/package/components/LogViewer.svelte +91 -33
  122. package/package/components/Login.svelte +21 -0
  123. package/package/components/ManualPopover.svelte +5 -6
  124. package/package/components/ManualPopover.svelte.d.ts +9 -35
  125. package/package/components/MemoryFootprintViewer.svelte +2 -6
  126. package/package/components/ModulePreview.svelte +23 -21
  127. package/package/components/ModulePreview.svelte.d.ts +1 -0
  128. package/package/components/Path.svelte +2 -2
  129. package/package/components/Path.svelte.d.ts +1 -1
  130. package/package/components/ResourcePicker.svelte +3 -0
  131. package/package/components/ResourcePicker.svelte.d.ts +1 -0
  132. package/package/components/RunButton.svelte +5 -15
  133. package/package/components/RunButton.svelte.d.ts +7 -19
  134. package/package/components/RunChart.svelte +8 -4
  135. package/package/components/RunChart.svelte.d.ts +2 -2
  136. package/package/components/RunFormAdvancedPopup.svelte +1 -1
  137. package/package/components/RunsPage.svelte +169 -539
  138. package/package/components/RunsPage.svelte.d.ts +5 -5
  139. package/package/components/S3FilePicker.svelte +7 -11
  140. package/package/components/S3FilePickerInner.svelte +2 -3
  141. package/package/components/S3FilePickerInner.svelte.d.ts +2 -2
  142. package/package/components/SchemaForm.svelte +26 -19
  143. package/package/components/SchemaFormWithArgPicker.svelte +4 -3
  144. package/package/components/ScriptBuilder.svelte +1 -1
  145. package/package/components/ScriptEditor.svelte +575 -101
  146. package/package/components/Section.svelte +3 -1
  147. package/package/components/ServiceLogsInner.svelte +4 -4
  148. package/package/components/SimpleEditor.svelte +46 -2
  149. package/package/components/SuperadminSettingsInner.svelte +1 -1
  150. package/package/components/TemplateEditor.svelte +54 -29
  151. package/package/components/TemplateEditor.svelte.d.ts +13 -102
  152. package/package/components/UserSettings.svelte +1 -1
  153. package/package/components/WorkerTagPicker.svelte +1 -1
  154. package/package/components/WorkerTagSelect.svelte +5 -2
  155. package/package/components/WorkspaceTutorials.svelte +5 -0
  156. package/package/components/apps/components/buttons/AppButton.svelte +21 -6
  157. package/package/components/apps/components/buttons/AppForm.svelte +2 -1
  158. package/package/components/apps/components/buttons/AppFormButton.svelte +2 -1
  159. package/package/components/apps/components/display/dbtable/AppDbExplorer.svelte +0 -4
  160. package/package/components/apps/components/display/dbtable/metadata.js +69 -30
  161. package/package/components/apps/components/display/dbtable/queries/alterTable.d.ts +46 -0
  162. package/package/components/apps/components/display/dbtable/queries/alterTable.js +314 -0
  163. package/package/components/apps/components/display/dbtable/queries/alterTable.test.d.ts +1 -0
  164. package/package/components/apps/components/display/dbtable/queries/alterTable.test.js +867 -0
  165. package/package/components/apps/components/display/dbtable/queries/createTable.d.ts +2 -24
  166. package/package/components/apps/components/display/dbtable/queries/createTable.js +11 -25
  167. package/package/components/apps/components/display/dbtable/queries/dbQueriesUtils.d.ts +9 -0
  168. package/package/components/apps/components/display/dbtable/queries/dbQueriesUtils.js +45 -0
  169. package/package/components/apps/components/display/dbtable/queries/relationalKeys.d.ts +47 -0
  170. package/package/components/apps/components/display/dbtable/queries/relationalKeys.js +402 -0
  171. package/package/components/apps/components/display/dbtable/queries/select.d.ts +2 -0
  172. package/package/components/apps/components/display/dbtable/queries/select.js +37 -6
  173. package/package/components/apps/components/display/dbtable/tableEditor.d.ts +35 -0
  174. package/package/components/apps/components/display/dbtable/tableEditor.js +49 -0
  175. package/package/components/apps/components/display/dbtable/utils.d.ts +10 -1
  176. package/package/components/apps/components/display/dbtable/utils.js +52 -20
  177. package/package/components/apps/components/helpers/HiddenComponent.svelte +1 -1
  178. package/package/components/apps/components/helpers/InputValue.svelte +1 -1
  179. package/package/components/apps/components/helpers/ResolveConfig.svelte +1 -1
  180. package/package/components/apps/components/helpers/RunnableComponent.svelte +3 -2
  181. package/package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +1 -1
  182. package/package/components/apps/components/helpers/RunnableWrapper.svelte +2 -2
  183. package/package/components/apps/editor/AppEditorHeader.svelte +8 -1
  184. package/package/components/apps/editor/AppEditorHeaderDeploy.svelte +32 -29
  185. package/package/components/apps/editor/AppEditorHeaderDeploy.svelte.d.ts +2 -2
  186. package/package/components/apps/editor/AppEditorHeaderDeployInitialDraft.svelte +4 -4
  187. package/package/components/apps/editor/AppEditorHeaderDeployInitialDraft.svelte.d.ts +3 -3
  188. package/package/components/apps/editor/PublicApp.svelte +49 -30
  189. package/package/components/apps/editor/PublicApp.svelte.d.ts +1 -0
  190. package/package/components/apps/editor/inlineScriptsPanel/InlineScriptRunnableByPath.svelte +77 -7
  191. package/package/components/apps/editor/inlineScriptsPanel/InlineScriptRunnableByPath.svelte.d.ts +2 -2
  192. package/package/components/apps/editor/inlineScriptsPanel/utils.d.ts +2 -2
  193. package/package/components/apps/editor/inlineScriptsPanel/utils.js +10 -1
  194. package/package/components/apps/inputType.d.ts +6 -1
  195. package/package/components/auditLogs/AuditLogsFilters.svelte +9 -17
  196. package/package/components/auditLogs/AuditLogsFilters.svelte.d.ts +1 -1
  197. package/package/components/common/button/model.js +1 -1
  198. package/package/components/common/calendarPicker/CalendarPicker.svelte.d.ts +1 -1
  199. package/package/components/common/languageIcons/TypeScript.svelte +5 -3
  200. package/package/components/common/languageIcons/TypeScript.svelte.d.ts +1 -0
  201. package/package/components/common/modal/Modal.svelte +3 -3
  202. package/package/components/copilot/autocomplete/Autocompletor.js +3 -2
  203. package/package/components/copilot/chat/AIButtonStyle.d.ts +1 -1
  204. package/package/components/copilot/chat/AIButtonStyle.js +2 -1
  205. package/package/components/copilot/chat/AIChat.svelte +3 -1
  206. package/package/components/copilot/chat/AIChatDisplay.svelte +89 -4
  207. package/package/components/copilot/chat/AIChatInput.svelte +275 -0
  208. package/package/components/copilot/chat/AIChatManager.svelte.js +107 -1
  209. package/package/components/copilot/chat/AiChatLayout.svelte +15 -30
  210. package/package/components/copilot/chat/AppAvailableContextList.svelte +263 -0
  211. package/package/components/copilot/chat/AppAvailableContextList.svelte.d.ts +13 -0
  212. package/package/components/copilot/chat/ContextElementBadge.svelte +44 -0
  213. package/package/components/copilot/chat/DatatableCreationPolicy.svelte +32 -33
  214. package/package/components/copilot/chat/ProviderModelSelector.svelte +1 -1
  215. package/package/components/copilot/chat/__tests__/app/appEvalHelpers.js +3 -0
  216. package/package/components/copilot/chat/__tests__/flow/flowEvalHelpers.js +4 -0
  217. package/package/components/copilot/chat/app/core.d.ts +56 -15
  218. package/package/components/copilot/chat/app/core.js +141 -22
  219. package/package/components/copilot/chat/context.d.ts +59 -2
  220. package/package/components/copilot/chat/context.js +6 -2
  221. package/package/components/copilot/chat/flow/FlowAIChat.svelte +22 -0
  222. package/package/components/copilot/chat/flow/core.d.ts +3 -1
  223. package/package/components/copilot/chat/flow/core.js +29 -2
  224. package/package/components/copilot/chat/flow/openFlow.json +1 -1
  225. package/package/components/copilot/chat/flow/openFlowZod.d.ts +1 -0
  226. package/package/components/copilot/chat/flow/openFlowZod.js +14 -2
  227. package/package/components/copilot/chat/script/core.d.ts +4 -1
  228. package/package/components/copilot/chat/script/core.js +38 -2
  229. package/package/components/copilot/chat/shared.d.ts +10 -0
  230. package/package/components/copilot/chat/shared.js +24 -0
  231. package/package/components/copilot/lib.d.ts +1 -1
  232. package/package/components/custom_ui.d.ts +2 -0
  233. package/package/components/dbOps.d.ts +18 -4
  234. package/package/components/dbOps.js +25 -3
  235. package/package/components/debug/DebugConsole.svelte +277 -0
  236. package/package/components/debug/DebugConsole.svelte.d.ts +13 -0
  237. package/package/components/debug/DebugPanel.svelte +97 -0
  238. package/package/components/debug/DebugPanel.svelte.d.ts +11 -0
  239. package/package/components/debug/DebugToolbar.svelte +148 -0
  240. package/package/components/debug/DebugToolbar.svelte.d.ts +17 -0
  241. package/package/components/debug/DebugVariableViewer.svelte +115 -0
  242. package/package/components/debug/DebugVariableViewer.svelte.d.ts +11 -0
  243. package/package/components/debug/MonacoDebugger.svelte +384 -0
  244. package/package/components/debug/MonacoDebugger.svelte.d.ts +15 -0
  245. package/package/components/debug/dapClient.d.ts +192 -0
  246. package/package/components/debug/dapClient.js +426 -0
  247. package/package/components/debug/debugUtils.d.ts +30 -0
  248. package/package/components/debug/debugUtils.js +131 -0
  249. package/package/components/debug/index.d.ts +75 -0
  250. package/package/components/debug/index.js +82 -0
  251. package/package/components/flows/CreateActionsApp.svelte +6 -4
  252. package/package/components/flows/DebounceLimit.svelte.d.ts +1 -1
  253. package/package/components/flows/FlowHistoryInner.svelte +15 -4
  254. package/package/components/flows/content/AgentToolWrapper.svelte +1 -1
  255. package/package/components/flows/content/FlowEditorDrawer.svelte +124 -0
  256. package/package/components/flows/content/FlowEditorDrawer.svelte.d.ts +22 -0
  257. package/package/components/flows/content/FlowInput.svelte +211 -37
  258. package/package/components/flows/content/FlowModuleComponent.svelte +553 -67
  259. package/package/components/flows/content/FlowModuleEarlyStop.svelte +8 -10
  260. package/package/components/flows/content/FlowModuleHeader.svelte +7 -4
  261. package/package/components/flows/content/FlowModuleWorkerTagSelect.svelte +1 -1
  262. package/package/components/flows/content/McpOAuthConnect.svelte +217 -0
  263. package/package/components/flows/content/McpOAuthConnect.svelte.d.ts +7 -0
  264. package/package/components/flows/content/McpToolEditor.svelte +50 -37
  265. package/package/components/flows/content/McpToolEditor.svelte.d.ts +0 -1
  266. package/package/components/flows/conversations/FlowChat.svelte +16 -2
  267. package/package/components/flows/conversations/FlowChat.svelte.d.ts +2 -1
  268. package/package/components/flows/conversations/FlowChatInterface.svelte +103 -6
  269. package/package/components/flows/conversations/FlowChatInterface.svelte.d.ts +2 -0
  270. package/package/components/flows/conversations/FlowChatManager.svelte.js +53 -21
  271. package/package/components/flows/header/FlowImportExportMenu.svelte +1 -1
  272. package/package/components/flows/propPicker/PropPickerWrapper.svelte +3 -1
  273. package/package/components/flows/types.d.ts +2 -0
  274. package/package/components/git_sync/GitSyncRepositoryCard.svelte +16 -8
  275. package/package/components/home/ItemsList.svelte +5 -5
  276. package/package/components/home/TutorialBanner.svelte +34 -18
  277. package/package/components/icons/CssIcon.svelte +20 -0
  278. package/package/components/icons/CssIcon.svelte.d.ts +7 -25
  279. package/package/components/icons/HtmlIcon.svelte +20 -0
  280. package/package/components/icons/HtmlIcon.svelte.d.ts +8 -0
  281. package/package/components/icons/JavaScriptIcon.svelte +10 -2
  282. package/package/components/icons/JavaScriptIcon.svelte.d.ts +1 -0
  283. package/package/components/icons/JsonIcon.svelte +8 -2
  284. package/package/components/icons/JsonIcon.svelte.d.ts +1 -0
  285. package/package/components/icons/LessIcon.svelte +16 -0
  286. package/package/components/icons/LessIcon.svelte.d.ts +8 -0
  287. package/package/components/icons/MarkdownIcon.svelte +20 -0
  288. package/package/components/icons/MarkdownIcon.svelte.d.ts +8 -0
  289. package/package/components/icons/ReactIcon.svelte +10 -2
  290. package/package/components/icons/ReactIcon.svelte.d.ts +1 -0
  291. package/package/components/icons/SassIcon.svelte +28 -0
  292. package/package/components/icons/SassIcon.svelte.d.ts +8 -0
  293. package/package/components/icons/SvelteIcon.svelte +10 -2
  294. package/package/components/icons/SvelteIcon.svelte.d.ts +1 -0
  295. package/package/components/icons/VueIcon.svelte +10 -2
  296. package/package/components/icons/VueIcon.svelte.d.ts +1 -0
  297. package/package/components/icons/YamlIcon.svelte +20 -0
  298. package/package/components/icons/YamlIcon.svelte.d.ts +8 -0
  299. package/package/components/instanceSettings/SecretBackendConfig.svelte +514 -0
  300. package/package/components/instanceSettings/SecretBackendConfig.svelte.d.ts +8 -0
  301. package/package/components/instanceSettings.d.ts +2 -1
  302. package/package/components/instanceSettings.js +32 -1
  303. package/package/components/jobs/JobPreview.svelte +46 -39
  304. package/package/components/jobs/JobPreview.svelte.d.ts +1 -0
  305. package/package/components/monacoLanguagesOptions.js +16 -15
  306. package/package/components/propertyPicker/PropPicker.svelte +16 -2
  307. package/package/components/propertyPicker/PropPicker.svelte.d.ts +2 -0
  308. package/package/components/raw_apps/DefaultDatabaseSelector.svelte +9 -5
  309. package/package/components/raw_apps/FileEditorIcon.svelte +12 -7
  310. package/package/components/raw_apps/FileEditorIcon.svelte.d.ts +2 -0
  311. package/package/components/raw_apps/FileTreeNode.svelte +119 -83
  312. package/package/components/raw_apps/RawAppBackgroundRunner.svelte +88 -8
  313. package/package/components/raw_apps/RawAppDataTableList.svelte +12 -9
  314. package/package/components/raw_apps/RawAppEditor.svelte +218 -68
  315. package/package/components/raw_apps/RawAppEditorHeader.svelte +33 -16
  316. package/package/components/raw_apps/RawAppHistoryList.svelte +264 -80
  317. package/package/components/raw_apps/RawAppHistoryList.svelte.d.ts +1 -0
  318. package/package/components/raw_apps/RawAppHistoryManager.svelte.d.ts +15 -1
  319. package/package/components/raw_apps/RawAppHistoryManager.svelte.js +46 -12
  320. package/package/components/raw_apps/RawAppInlineScriptEditor.svelte +549 -47
  321. package/package/components/raw_apps/RawAppInlineScriptEditor.svelte.d.ts +31 -5
  322. package/package/components/raw_apps/RawAppInlineScriptPanelList.svelte +25 -18
  323. package/package/components/raw_apps/RawAppInlineScriptPanelList.svelte.d.ts +1 -0
  324. package/package/components/raw_apps/RawAppInlineScriptRunnable.svelte +141 -10
  325. package/package/components/raw_apps/RawAppInlineScriptRunnable.svelte.d.ts +8 -0
  326. package/package/components/raw_apps/RawAppInlineScriptsPanel.svelte +2 -1
  327. package/package/components/raw_apps/RawAppInlineScriptsPanel.svelte.d.ts +9 -1
  328. package/package/components/raw_apps/RawAppInputsSpecEditor.svelte +47 -3
  329. package/package/components/raw_apps/RawAppInputsSpecEditor.svelte.d.ts +2 -2
  330. package/package/components/raw_apps/RawAppModules.svelte +13 -7
  331. package/package/components/raw_apps/RawAppPreview.svelte +48 -6
  332. package/package/components/raw_apps/RawAppSidebar.svelte +194 -125
  333. package/package/components/raw_apps/RawAppSidebar.svelte.d.ts +1 -0
  334. package/package/components/raw_apps/RunnableRow.svelte +41 -0
  335. package/package/components/raw_apps/RunnableRow.svelte.d.ts +11 -0
  336. package/package/components/raw_apps/utils.d.ts +1 -1
  337. package/package/components/raw_apps/utils.js +76 -18
  338. package/package/components/runs/ManuelDatePicker.svelte +3 -3
  339. package/package/components/runs/ManuelDatePicker.svelte.d.ts +3 -3
  340. package/package/components/runs/NoWorkerWithTagWarning.svelte +5 -1
  341. package/package/components/runs/RunsFilter.svelte +75 -63
  342. package/package/components/runs/RunsFilter.svelte.d.ts +35 -4
  343. package/package/components/runs/RunsQueue.svelte.d.ts +1 -1
  344. package/package/components/runs/RunsTable.svelte +1 -1
  345. package/package/components/runs/RunsTable.svelte.d.ts +1 -1
  346. package/package/components/runs/useJobsLoader.svelte.d.ts +34 -0
  347. package/package/components/runs/useJobsLoader.svelte.js +507 -0
  348. package/package/components/scriptEditor/LogPanel.svelte +17 -2
  349. package/package/components/scriptEditor/LogPanel.svelte.d.ts +2 -0
  350. package/package/components/select/SelectDropdown.svelte +2 -2
  351. package/package/components/settings/AIPromptsModal.svelte +88 -0
  352. package/package/components/settings/AIPromptsModal.svelte.d.ts +11 -0
  353. package/package/components/settings/ChangeWorkspaceColor.svelte +4 -3
  354. package/package/components/settings/ChangeWorkspaceId.svelte +14 -10
  355. package/package/components/settings/ChangeWorkspaceName.svelte +7 -6
  356. package/package/components/settings/CreateToken.svelte +1 -1
  357. package/package/components/settings/UserAIPromptsSettings.svelte +56 -15
  358. package/package/components/settings/WorkspaceOperatorSettings.svelte +68 -85
  359. package/package/components/settings/WorkspaceUserSettings.svelte +531 -406
  360. package/package/components/sidebar/MenuButton.svelte +46 -24
  361. package/package/components/sidebar/MenuButton.svelte.d.ts +2 -0
  362. package/package/components/sidebar/MultiplayerMenu.svelte +3 -3
  363. package/package/components/sidebar/OperatorMenu.svelte +62 -87
  364. package/package/components/sidebar/SidebarContent.svelte +7 -2
  365. package/package/components/sidebar/WorkspaceMenu.svelte +35 -85
  366. package/package/components/sqlTypeService.js +4 -3
  367. package/package/components/table/DataTable.svelte +3 -2
  368. package/package/components/table/DataTable.svelte.d.ts +1 -0
  369. package/package/components/text_input/TextInput.svelte +3 -0
  370. package/package/components/text_input/TextInput.svelte.d.ts +2 -0
  371. package/package/components/tutorials/FlowBuilderLiveTutorial.svelte +6 -35
  372. package/package/components/tutorials/RunsTutorial.svelte +399 -0
  373. package/package/components/{schema/SchemaPicker.svelte.d.ts → tutorials/RunsTutorial.svelte.d.ts} +11 -12
  374. package/package/components/tutorials/TroubleshootFlowTutorial.svelte +5 -20
  375. package/package/components/tutorials/utils.d.ts +16 -0
  376. package/package/components/tutorials/utils.js +96 -0
  377. package/package/components/tutorials/workspace/WorkspaceOnboardingOperatorTutorial.svelte +133 -0
  378. package/package/components/{SavedInputs.svelte.d.ts → tutorials/workspace/WorkspaceOnboardingOperatorTutorial.svelte.d.ts} +8 -11
  379. package/package/components/vscode.js +6 -6
  380. package/package/components/workspace/WorkspaceCard.svelte +184 -0
  381. package/package/components/workspace/WorkspaceCard.svelte.d.ts +24 -0
  382. package/package/components/workspace/WorkspaceIcon.svelte +21 -0
  383. package/package/components/workspace/WorkspaceIcon.svelte.d.ts +9 -0
  384. package/package/components/workspace/WorkspaceTreeView.svelte +331 -0
  385. package/package/components/workspace/WorkspaceTreeView.svelte.d.ts +15 -0
  386. package/package/components/workspaceSettings/AISettings.svelte +146 -108
  387. package/package/components/workspaceSettings/CreateWorkspace.svelte +25 -11
  388. package/package/components/workspaceSettings/DucklakeSettings.svelte +46 -23
  389. package/package/components/workspaceSettings/DucklakeSettings.svelte.d.ts +2 -1
  390. package/package/components/workspaceSettings/ModelTokenLimits.svelte +14 -18
  391. package/package/components/workspaceSettings/StorageSettings.svelte +280 -241
  392. package/package/components/workspaceSettings/StorageSettings.svelte.d.ts +1 -0
  393. package/package/consts.js +4 -1
  394. package/package/gen/core/OpenAPI.js +1 -1
  395. package/package/gen/schemas.gen.d.ts +126 -0
  396. package/package/gen/schemas.gen.js +126 -0
  397. package/package/gen/services.gen.d.ts +151 -2
  398. package/package/gen/services.gen.js +301 -4
  399. package/package/gen/types.gen.d.ts +584 -2
  400. package/package/hubPaths.json +3 -2
  401. package/package/infer.js +2 -0
  402. package/package/monaco_workers/graphql.worker.bundle.js +121 -121
  403. package/package/rawAppWmillTs.d.ts +11 -0
  404. package/package/rawAppWmillTs.js +38 -1
  405. package/package/svelte5Utils.svelte.d.ts +9 -0
  406. package/package/svelte5Utils.svelte.js +51 -1
  407. package/package/tutorialUtils.js +0 -4
  408. package/package/tutorials/config.js +31 -3
  409. package/package/tutorials/roleUtils.d.ts +1 -1
  410. package/package/tutorials/roleUtils.js +6 -2
  411. package/package/utils.js +159 -1
  412. package/package.json +16 -17
  413. package/package/components/SavedInputs.svelte +0 -416
  414. package/package/components/runs/JobsLoader.svelte +0 -468
  415. package/package/components/runs/JobsLoader.svelte.d.ts +0 -49
  416. package/package/components/schema/SchemaPicker.svelte +0 -92
@@ -1,6 +1,18 @@
1
1
  import { z } from "zod/v3";
2
- export const flowModuleSchema = z.object({ "id": z.string().describe("Unique identifier for this step. Used to reference results via 'results.step_id'. Must be a valid identifier (alphanumeric, underscore, hyphen)"), "value": z.discriminatedUnion("type", [z.object({ "input_transforms": z.record(z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs")).describe("Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments"), "content": z.string().describe("The script source code. Should export a 'main' function"), "language": z.enum(["deno", "bun", "python3", "go", "bash", "powershell", "postgresql", "mysql", "bigquery", "snowflake", "mssql", "oracledb", "graphql", "nativets", "php"]).describe("Programming language for this script"), "path": z.string().describe("Optional path for saving this script").optional(), "lock": z.string().describe("Lock file content for dependencies").optional(), "type": z.literal("rawscript"), "tag": z.string().describe("Worker group tag for execution routing").optional(), "concurrent_limit": z.number().describe("Maximum concurrent executions of this script").optional(), "concurrency_time_window_s": z.number().describe("Time window for concurrent_limit").optional(), "custom_concurrency_key": z.string().describe("Custom key for grouping concurrent executions").optional(), "is_trigger": z.boolean().describe("If true, this script is a trigger that can start the flow").optional(), "assets": z.array(z.object({ "path": z.string().describe("Path to the asset"), "kind": z.enum(["s3object", "resource", "ducklake", "datatable"]).describe("Type of asset"), "access_type": z.enum(["r", "w", "rw"]).describe("Access level for this asset").optional(), "alt_access_type": z.enum(["r", "w", "rw"]).describe("Alternative access level").optional() })).describe("External resources this script accesses (S3 objects, resources, etc.)").optional() }).describe("Inline script with code defined directly in the flow. Use 'bun' as default language if unspecified. The script receives arguments from input_transforms"), z.object({ "input_transforms": z.record(z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs")).describe("Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments"), "path": z.string().describe("Path to the script in the workspace (e.g., 'f/scripts/send_email')"), "hash": z.string().describe("Optional specific version hash of the script to use").optional(), "type": z.literal("script"), "tag_override": z.string().describe("Override the script's default worker group tag").optional(), "is_trigger": z.boolean().describe("If true, this script is a trigger that can start the flow").optional() }).describe("Reference to an existing script by path. Use this when calling a previously saved script instead of writing inline code"), z.object({ "input_transforms": z.record(z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs")).describe("Map of parameter names to their values (static or JavaScript expressions). These become the subflow's input arguments"), "path": z.string().describe("Path to the flow in the workspace (e.g., 'f/flows/process_user')"), "type": z.literal("flow") }).describe("Reference to an existing flow by path. Use this to call another flow as a subflow"), z.object({ "modules": z.array(z.lazy(() => flowModuleSchema)).describe("Steps to execute for each iteration. These can reference the iteration value via 'flow_input.iter.value'"), "iterator": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs"), "skip_failures": z.boolean().describe("If true, iteration failures don't stop the loop. Failed iterations return null"), "type": z.literal("forloopflow"), "parallel": z.boolean().describe("If true, iterations run concurrently (faster for I/O-bound operations). Use with parallelism to control concurrency").optional(), "parallelism": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "squash": z.boolean().optional() }).describe("Executes nested modules in a loop over an iterator. Inside the loop, use 'flow_input.iter.value' to access the current iteration value, and 'flow_input.iter.index' for the index. Supports parallel execution for better performance on I/O-bound operations"), z.object({ "modules": z.array(z.lazy(() => flowModuleSchema)).describe("Steps to execute in each iteration. Use stop_after_if to control when the loop ends"), "skip_failures": z.boolean().describe("If true, iteration failures don't stop the loop. Failed iterations return null"), "type": z.literal("whileloopflow"), "parallel": z.boolean().describe("If true, iterations run concurrently (use with caution in while loops)").optional(), "parallelism": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "squash": z.boolean().optional() }).describe("Executes nested modules repeatedly while a condition is true. The loop checks the condition after each iteration. Use stop_after_if on modules to control loop termination"), z.object({ "branches": z.array(z.object({ "summary": z.string().describe("Short description of this branch condition").optional(), "expr": z.string().describe("JavaScript expression that returns boolean. Can use 'results.step_id' or 'flow_input'. First true expr wins"), "modules": z.array(z.lazy(() => flowModuleSchema)).describe("Steps to execute if this branch's expr is true") })).describe("Array of branches to evaluate in order. The first branch with expr evaluating to true executes"), "default": z.array(z.lazy(() => flowModuleSchema)).describe("Steps to execute if no branch expressions match"), "type": z.literal("branchone") }).describe("Conditional branching where only the first matching branch executes. Branches are evaluated in order, and the first one with a true expression runs. If no branches match, the default branch executes"), z.object({ "branches": z.array(z.object({ "summary": z.string().describe("Short description of this branch's purpose").optional(), "skip_failure": z.boolean().describe("If true, failure in this branch doesn't fail the entire flow").optional(), "modules": z.array(z.lazy(() => flowModuleSchema)).describe("Steps to execute in this branch") })).describe("Array of branches that all execute (either in parallel or sequentially)"), "type": z.literal("branchall"), "parallel": z.boolean().describe("If true, all branches execute concurrently. If false, they execute sequentially").optional() }).describe("Parallel branching where all branches execute simultaneously. Unlike BranchOne, all branches run regardless of conditions. Useful for executing independent tasks concurrently"), z.object({ "type": z.literal("identity"), "flow": z.boolean().describe("If true, marks this as a flow identity (special handling)").optional() }).describe("Pass-through module that returns its input unchanged. Useful for flow structure or as a placeholder"), z.object({ "input_transforms": z.object({ "provider": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs"), "output_type": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs"), "user_message": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs"), "system_prompt": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "streaming": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "messages_context_length": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "output_schema": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "user_images": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "max_completion_tokens": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "temperature": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional() }).describe("Input parameters for the AI agent mapped to their values"), "tools": z.array(z.object({ "id": z.string().describe("Unique identifier for this tool. Cannot contain spaces - use underscores instead (e.g., 'get_user_data' not 'get user data')"), "summary": z.string().describe("Short description of what this tool does (shown to the AI)").optional(), "value": z.any().superRefine((x, ctx) => {
3
- const schemas = [z.intersection(z.object({ "tool_type": z.literal("flowmodule") }), z.lazy(() => flowModuleSchema)).describe("A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module"), z.object({ "tool_type": z.literal("mcp"), "resource_path": z.string().describe("Path to the MCP resource/server configuration"), "include_tools": z.array(z.string()).describe("Whitelist of specific tools to include from this MCP server").optional(), "exclude_tools": z.array(z.string()).describe("Blacklist of tools to exclude from this MCP server").optional() }).describe("Reference to an external MCP (Model Context Protocol) tool. The AI can call tools from MCP servers")];
2
+ export const flowModuleValueSchema = z.discriminatedUnion("type", [z.object({ "input_transforms": z.record(z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs")).describe("Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments"), "content": z.string().describe("The script source code. Should export a 'main' function"), "language": z.enum(["deno", "bun", "python3", "go", "bash", "powershell", "postgresql", "mysql", "bigquery", "snowflake", "mssql", "oracledb", "graphql", "nativets", "php"]).describe("Programming language for this script"), "path": z.string().describe("Optional path for saving this script").optional(), "lock": z.string().describe("Lock file content for dependencies").optional(), "type": z.literal("rawscript"), "tag": z.string().describe("Worker group tag for execution routing").optional(), "concurrent_limit": z.number().describe("Maximum concurrent executions of this script").optional(), "concurrency_time_window_s": z.number().describe("Time window for concurrent_limit").optional(), "custom_concurrency_key": z.string().describe("Custom key for grouping concurrent executions").optional(), "is_trigger": z.boolean().describe("If true, this script is a trigger that can start the flow").optional(), "assets": z.array(z.object({ "path": z.string().describe("Path to the asset"), "kind": z.enum(["s3object", "resource", "ducklake", "datatable"]).describe("Type of asset"), "access_type": z.enum(["r", "w", "rw"]).describe("Access level for this asset").optional(), "alt_access_type": z.enum(["r", "w", "rw"]).describe("Alternative access level").optional() })).describe("External resources this script accesses (S3 objects, resources, etc.)").optional() }).describe("Inline script with code defined directly in the flow. Use 'bun' as default language if unspecified. The script receives arguments from input_transforms"), z.object({ "input_transforms": z.record(z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs")).describe("Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments"), "path": z.string().describe("Path to the script in the workspace (e.g., 'f/scripts/send_email')"), "hash": z.string().describe("Optional specific version hash of the script to use").optional(), "type": z.literal("script"), "tag_override": z.string().describe("Override the script's default worker group tag").optional(), "is_trigger": z.boolean().describe("If true, this script is a trigger that can start the flow").optional() }).describe("Reference to an existing script by path. Use this when calling a previously saved script instead of writing inline code"), z.object({ "input_transforms": z.record(z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs")).describe("Map of parameter names to their values (static or JavaScript expressions). These become the subflow's input arguments"), "path": z.string().describe("Path to the flow in the workspace (e.g., 'f/flows/process_user')"), "type": z.literal("flow") }).describe("Reference to an existing flow by path. Use this to call another flow as a subflow"), z.object({ "modules": z.array(z.object({ "id": z.string().describe("Unique identifier for this step. Used to reference results via 'results.step_id'. Must be a valid identifier (alphanumeric, underscore, hyphen)"), "value": z.lazy(() => flowModuleValueSchema), "stop_after_if": z.object({ "skip_if_stopped": z.boolean().describe("If true, following steps are skipped when this condition triggers").optional(), "expr": z.string().describe("JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"), "error_message": z.string().describe("Custom error message shown when stopping").optional() }).describe("Early termination condition for a module").optional(), "stop_after_all_iters_if": z.object({ "skip_if_stopped": z.boolean().describe("If true, following steps are skipped when this condition triggers").optional(), "expr": z.string().describe("JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"), "error_message": z.string().describe("Custom error message shown when stopping").optional() }).describe("Early termination condition for a module").optional(), "skip_if": z.object({ "expr": z.string().describe("JavaScript expression that returns true to skip. Can use 'flow_input' or 'results.<step_id>'") }).describe("Conditionally skip this step based on previous results or flow inputs").optional(), "sleep": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "cache_ttl": z.number().describe("Cache duration in seconds for this step's results").optional(), "cache_ignore_s3_path": z.boolean().optional(), "timeout": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "delete_after_use": z.boolean().describe("If true, this step's result is deleted after use to save memory").optional(), "summary": z.string().describe("Short description of what this step does").optional(), "mock": z.object({ "enabled": z.boolean().describe("If true, return mock value instead of executing").optional(), "return_value": z.any().describe("Value to return when mocked").optional() }).describe("Mock configuration for testing without executing the actual step").optional(), "suspend": z.object({ "required_events": z.number().int().describe("Number of approvals required before continuing").optional(), "timeout": z.number().int().describe("Timeout in seconds before auto-continuing or canceling").optional(), "resume_form": z.object({ "schema": z.record(z.any()).describe("JSON Schema for the resume form").optional() }).describe("Form schema for collecting input when resuming").optional(), "user_auth_required": z.boolean().describe("If true, only authenticated users can approve").optional(), "user_groups_required": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "self_approval_disabled": z.boolean().describe("If true, the user who started the flow cannot approve").optional(), "hide_cancel": z.boolean().describe("If true, hide the cancel button on the approval form").optional(), "continue_on_disapprove_timeout": z.boolean().describe("If true, continue flow on timeout instead of canceling").optional() }).describe("Configuration for approval/resume steps that wait for user input").optional(), "priority": z.number().describe("Execution priority for this step (higher numbers run first)").optional(), "continue_on_error": z.boolean().describe("If true, flow continues even if this step fails").optional(), "retry": z.object({ "constant": z.object({ "attempts": z.number().int().describe("Number of retry attempts").optional(), "seconds": z.number().int().describe("Seconds to wait between retries").optional() }).describe("Retry with constant delay between attempts").optional(), "exponential": z.object({ "attempts": z.number().int().describe("Number of retry attempts").optional(), "multiplier": z.number().int().describe("Multiplier for exponential backoff").optional(), "seconds": z.number().int().gte(1).describe("Initial delay in seconds").optional(), "random_factor": z.number().int().gte(0).lte(100).describe("Random jitter percentage (0-100) to avoid thundering herd").optional() }).describe("Retry with exponential backoff (delay doubles each time)").optional(), "retry_if": z.object({ "expr": z.string().describe("JavaScript expression that returns true to retry. Has access to 'result' and 'error' variables") }).describe("Conditional retry based on error or result").optional() }).describe("Retry configuration for failed module executions").optional() }).describe("A single step in a flow. Can be a script, subflow, loop, or branch")).describe("Steps to execute for each iteration. These can reference the iteration value via 'flow_input.iter.value'"), "iterator": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs"), "skip_failures": z.boolean().describe("If true, iteration failures don't stop the loop. Failed iterations return null"), "type": z.literal("forloopflow"), "parallel": z.boolean().describe("If true, iterations run concurrently (faster for I/O-bound operations). Use with parallelism to control concurrency").optional(), "parallelism": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "squash": z.boolean().optional() }).describe("Executes nested modules in a loop over an iterator. Inside the loop, use 'flow_input.iter.value' to access the current iteration value, and 'flow_input.iter.index' for the index. Supports parallel execution for better performance on I/O-bound operations"), z.object({ "modules": z.array(z.object({ "id": z.string().describe("Unique identifier for this step. Used to reference results via 'results.step_id'. Must be a valid identifier (alphanumeric, underscore, hyphen)"), "value": z.lazy(() => flowModuleValueSchema), "stop_after_if": z.object({ "skip_if_stopped": z.boolean().describe("If true, following steps are skipped when this condition triggers").optional(), "expr": z.string().describe("JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"), "error_message": z.string().describe("Custom error message shown when stopping").optional() }).describe("Early termination condition for a module").optional(), "stop_after_all_iters_if": z.object({ "skip_if_stopped": z.boolean().describe("If true, following steps are skipped when this condition triggers").optional(), "expr": z.string().describe("JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"), "error_message": z.string().describe("Custom error message shown when stopping").optional() }).describe("Early termination condition for a module").optional(), "skip_if": z.object({ "expr": z.string().describe("JavaScript expression that returns true to skip. Can use 'flow_input' or 'results.<step_id>'") }).describe("Conditionally skip this step based on previous results or flow inputs").optional(), "sleep": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "cache_ttl": z.number().describe("Cache duration in seconds for this step's results").optional(), "cache_ignore_s3_path": z.boolean().optional(), "timeout": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "delete_after_use": z.boolean().describe("If true, this step's result is deleted after use to save memory").optional(), "summary": z.string().describe("Short description of what this step does").optional(), "mock": z.object({ "enabled": z.boolean().describe("If true, return mock value instead of executing").optional(), "return_value": z.any().describe("Value to return when mocked").optional() }).describe("Mock configuration for testing without executing the actual step").optional(), "suspend": z.object({ "required_events": z.number().int().describe("Number of approvals required before continuing").optional(), "timeout": z.number().int().describe("Timeout in seconds before auto-continuing or canceling").optional(), "resume_form": z.object({ "schema": z.record(z.any()).describe("JSON Schema for the resume form").optional() }).describe("Form schema for collecting input when resuming").optional(), "user_auth_required": z.boolean().describe("If true, only authenticated users can approve").optional(), "user_groups_required": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "self_approval_disabled": z.boolean().describe("If true, the user who started the flow cannot approve").optional(), "hide_cancel": z.boolean().describe("If true, hide the cancel button on the approval form").optional(), "continue_on_disapprove_timeout": z.boolean().describe("If true, continue flow on timeout instead of canceling").optional() }).describe("Configuration for approval/resume steps that wait for user input").optional(), "priority": z.number().describe("Execution priority for this step (higher numbers run first)").optional(), "continue_on_error": z.boolean().describe("If true, flow continues even if this step fails").optional(), "retry": z.object({ "constant": z.object({ "attempts": z.number().int().describe("Number of retry attempts").optional(), "seconds": z.number().int().describe("Seconds to wait between retries").optional() }).describe("Retry with constant delay between attempts").optional(), "exponential": z.object({ "attempts": z.number().int().describe("Number of retry attempts").optional(), "multiplier": z.number().int().describe("Multiplier for exponential backoff").optional(), "seconds": z.number().int().gte(1).describe("Initial delay in seconds").optional(), "random_factor": z.number().int().gte(0).lte(100).describe("Random jitter percentage (0-100) to avoid thundering herd").optional() }).describe("Retry with exponential backoff (delay doubles each time)").optional(), "retry_if": z.object({ "expr": z.string().describe("JavaScript expression that returns true to retry. Has access to 'result' and 'error' variables") }).describe("Conditional retry based on error or result").optional() }).describe("Retry configuration for failed module executions").optional() }).describe("A single step in a flow. Can be a script, subflow, loop, or branch")).describe("Steps to execute in each iteration. Use stop_after_if to control when the loop ends"), "skip_failures": z.boolean().describe("If true, iteration failures don't stop the loop. Failed iterations return null"), "type": z.literal("whileloopflow"), "parallel": z.boolean().describe("If true, iterations run concurrently (use with caution in while loops)").optional(), "parallelism": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "squash": z.boolean().optional() }).describe("Executes nested modules repeatedly while a condition is true. The loop checks the condition after each iteration. Use stop_after_if on modules to control loop termination"), z.object({ "branches": z.array(z.object({ "summary": z.string().describe("Short description of this branch condition").optional(), "expr": z.string().describe("JavaScript expression that returns boolean. Can use 'results.step_id' or 'flow_input'. First true expr wins"), "modules": z.array(z.object({ "id": z.string().describe("Unique identifier for this step. Used to reference results via 'results.step_id'. Must be a valid identifier (alphanumeric, underscore, hyphen)"), "value": z.lazy(() => flowModuleValueSchema), "stop_after_if": z.object({ "skip_if_stopped": z.boolean().describe("If true, following steps are skipped when this condition triggers").optional(), "expr": z.string().describe("JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"), "error_message": z.string().describe("Custom error message shown when stopping").optional() }).describe("Early termination condition for a module").optional(), "stop_after_all_iters_if": z.object({ "skip_if_stopped": z.boolean().describe("If true, following steps are skipped when this condition triggers").optional(), "expr": z.string().describe("JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"), "error_message": z.string().describe("Custom error message shown when stopping").optional() }).describe("Early termination condition for a module").optional(), "skip_if": z.object({ "expr": z.string().describe("JavaScript expression that returns true to skip. Can use 'flow_input' or 'results.<step_id>'") }).describe("Conditionally skip this step based on previous results or flow inputs").optional(), "sleep": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "cache_ttl": z.number().describe("Cache duration in seconds for this step's results").optional(), "cache_ignore_s3_path": z.boolean().optional(), "timeout": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "delete_after_use": z.boolean().describe("If true, this step's result is deleted after use to save memory").optional(), "summary": z.string().describe("Short description of what this step does").optional(), "mock": z.object({ "enabled": z.boolean().describe("If true, return mock value instead of executing").optional(), "return_value": z.any().describe("Value to return when mocked").optional() }).describe("Mock configuration for testing without executing the actual step").optional(), "suspend": z.object({ "required_events": z.number().int().describe("Number of approvals required before continuing").optional(), "timeout": z.number().int().describe("Timeout in seconds before auto-continuing or canceling").optional(), "resume_form": z.object({ "schema": z.record(z.any()).describe("JSON Schema for the resume form").optional() }).describe("Form schema for collecting input when resuming").optional(), "user_auth_required": z.boolean().describe("If true, only authenticated users can approve").optional(), "user_groups_required": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "self_approval_disabled": z.boolean().describe("If true, the user who started the flow cannot approve").optional(), "hide_cancel": z.boolean().describe("If true, hide the cancel button on the approval form").optional(), "continue_on_disapprove_timeout": z.boolean().describe("If true, continue flow on timeout instead of canceling").optional() }).describe("Configuration for approval/resume steps that wait for user input").optional(), "priority": z.number().describe("Execution priority for this step (higher numbers run first)").optional(), "continue_on_error": z.boolean().describe("If true, flow continues even if this step fails").optional(), "retry": z.object({ "constant": z.object({ "attempts": z.number().int().describe("Number of retry attempts").optional(), "seconds": z.number().int().describe("Seconds to wait between retries").optional() }).describe("Retry with constant delay between attempts").optional(), "exponential": z.object({ "attempts": z.number().int().describe("Number of retry attempts").optional(), "multiplier": z.number().int().describe("Multiplier for exponential backoff").optional(), "seconds": z.number().int().gte(1).describe("Initial delay in seconds").optional(), "random_factor": z.number().int().gte(0).lte(100).describe("Random jitter percentage (0-100) to avoid thundering herd").optional() }).describe("Retry with exponential backoff (delay doubles each time)").optional(), "retry_if": z.object({ "expr": z.string().describe("JavaScript expression that returns true to retry. Has access to 'result' and 'error' variables") }).describe("Conditional retry based on error or result").optional() }).describe("Retry configuration for failed module executions").optional() }).describe("A single step in a flow. Can be a script, subflow, loop, or branch")).describe("Steps to execute if this branch's expr is true") })).describe("Array of branches to evaluate in order. The first branch with expr evaluating to true executes"), "default": z.array(z.object({ "id": z.string().describe("Unique identifier for this step. Used to reference results via 'results.step_id'. Must be a valid identifier (alphanumeric, underscore, hyphen)"), "value": z.lazy(() => flowModuleValueSchema), "stop_after_if": z.object({ "skip_if_stopped": z.boolean().describe("If true, following steps are skipped when this condition triggers").optional(), "expr": z.string().describe("JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"), "error_message": z.string().describe("Custom error message shown when stopping").optional() }).describe("Early termination condition for a module").optional(), "stop_after_all_iters_if": z.object({ "skip_if_stopped": z.boolean().describe("If true, following steps are skipped when this condition triggers").optional(), "expr": z.string().describe("JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"), "error_message": z.string().describe("Custom error message shown when stopping").optional() }).describe("Early termination condition for a module").optional(), "skip_if": z.object({ "expr": z.string().describe("JavaScript expression that returns true to skip. Can use 'flow_input' or 'results.<step_id>'") }).describe("Conditionally skip this step based on previous results or flow inputs").optional(), "sleep": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "cache_ttl": z.number().describe("Cache duration in seconds for this step's results").optional(), "cache_ignore_s3_path": z.boolean().optional(), "timeout": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "delete_after_use": z.boolean().describe("If true, this step's result is deleted after use to save memory").optional(), "summary": z.string().describe("Short description of what this step does").optional(), "mock": z.object({ "enabled": z.boolean().describe("If true, return mock value instead of executing").optional(), "return_value": z.any().describe("Value to return when mocked").optional() }).describe("Mock configuration for testing without executing the actual step").optional(), "suspend": z.object({ "required_events": z.number().int().describe("Number of approvals required before continuing").optional(), "timeout": z.number().int().describe("Timeout in seconds before auto-continuing or canceling").optional(), "resume_form": z.object({ "schema": z.record(z.any()).describe("JSON Schema for the resume form").optional() }).describe("Form schema for collecting input when resuming").optional(), "user_auth_required": z.boolean().describe("If true, only authenticated users can approve").optional(), "user_groups_required": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "self_approval_disabled": z.boolean().describe("If true, the user who started the flow cannot approve").optional(), "hide_cancel": z.boolean().describe("If true, hide the cancel button on the approval form").optional(), "continue_on_disapprove_timeout": z.boolean().describe("If true, continue flow on timeout instead of canceling").optional() }).describe("Configuration for approval/resume steps that wait for user input").optional(), "priority": z.number().describe("Execution priority for this step (higher numbers run first)").optional(), "continue_on_error": z.boolean().describe("If true, flow continues even if this step fails").optional(), "retry": z.object({ "constant": z.object({ "attempts": z.number().int().describe("Number of retry attempts").optional(), "seconds": z.number().int().describe("Seconds to wait between retries").optional() }).describe("Retry with constant delay between attempts").optional(), "exponential": z.object({ "attempts": z.number().int().describe("Number of retry attempts").optional(), "multiplier": z.number().int().describe("Multiplier for exponential backoff").optional(), "seconds": z.number().int().gte(1).describe("Initial delay in seconds").optional(), "random_factor": z.number().int().gte(0).lte(100).describe("Random jitter percentage (0-100) to avoid thundering herd").optional() }).describe("Retry with exponential backoff (delay doubles each time)").optional(), "retry_if": z.object({ "expr": z.string().describe("JavaScript expression that returns true to retry. Has access to 'result' and 'error' variables") }).describe("Conditional retry based on error or result").optional() }).describe("Retry configuration for failed module executions").optional() }).describe("A single step in a flow. Can be a script, subflow, loop, or branch")).describe("Steps to execute if no branch expressions match"), "type": z.literal("branchone") }).describe("Conditional branching where only the first matching branch executes. Branches are evaluated in order, and the first one with a true expression runs. If no branches match, the default branch executes"), z.object({ "branches": z.array(z.object({ "summary": z.string().describe("Short description of this branch's purpose").optional(), "skip_failure": z.boolean().describe("If true, failure in this branch doesn't fail the entire flow").optional(), "modules": z.array(z.object({ "id": z.string().describe("Unique identifier for this step. Used to reference results via 'results.step_id'. Must be a valid identifier (alphanumeric, underscore, hyphen)"), "value": z.lazy(() => flowModuleValueSchema), "stop_after_if": z.object({ "skip_if_stopped": z.boolean().describe("If true, following steps are skipped when this condition triggers").optional(), "expr": z.string().describe("JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"), "error_message": z.string().describe("Custom error message shown when stopping").optional() }).describe("Early termination condition for a module").optional(), "stop_after_all_iters_if": z.object({ "skip_if_stopped": z.boolean().describe("If true, following steps are skipped when this condition triggers").optional(), "expr": z.string().describe("JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"), "error_message": z.string().describe("Custom error message shown when stopping").optional() }).describe("Early termination condition for a module").optional(), "skip_if": z.object({ "expr": z.string().describe("JavaScript expression that returns true to skip. Can use 'flow_input' or 'results.<step_id>'") }).describe("Conditionally skip this step based on previous results or flow inputs").optional(), "sleep": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "cache_ttl": z.number().describe("Cache duration in seconds for this step's results").optional(), "cache_ignore_s3_path": z.boolean().optional(), "timeout": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "delete_after_use": z.boolean().describe("If true, this step's result is deleted after use to save memory").optional(), "summary": z.string().describe("Short description of what this step does").optional(), "mock": z.object({ "enabled": z.boolean().describe("If true, return mock value instead of executing").optional(), "return_value": z.any().describe("Value to return when mocked").optional() }).describe("Mock configuration for testing without executing the actual step").optional(), "suspend": z.object({ "required_events": z.number().int().describe("Number of approvals required before continuing").optional(), "timeout": z.number().int().describe("Timeout in seconds before auto-continuing or canceling").optional(), "resume_form": z.object({ "schema": z.record(z.any()).describe("JSON Schema for the resume form").optional() }).describe("Form schema for collecting input when resuming").optional(), "user_auth_required": z.boolean().describe("If true, only authenticated users can approve").optional(), "user_groups_required": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "self_approval_disabled": z.boolean().describe("If true, the user who started the flow cannot approve").optional(), "hide_cancel": z.boolean().describe("If true, hide the cancel button on the approval form").optional(), "continue_on_disapprove_timeout": z.boolean().describe("If true, continue flow on timeout instead of canceling").optional() }).describe("Configuration for approval/resume steps that wait for user input").optional(), "priority": z.number().describe("Execution priority for this step (higher numbers run first)").optional(), "continue_on_error": z.boolean().describe("If true, flow continues even if this step fails").optional(), "retry": z.object({ "constant": z.object({ "attempts": z.number().int().describe("Number of retry attempts").optional(), "seconds": z.number().int().describe("Seconds to wait between retries").optional() }).describe("Retry with constant delay between attempts").optional(), "exponential": z.object({ "attempts": z.number().int().describe("Number of retry attempts").optional(), "multiplier": z.number().int().describe("Multiplier for exponential backoff").optional(), "seconds": z.number().int().gte(1).describe("Initial delay in seconds").optional(), "random_factor": z.number().int().gte(0).lte(100).describe("Random jitter percentage (0-100) to avoid thundering herd").optional() }).describe("Retry with exponential backoff (delay doubles each time)").optional(), "retry_if": z.object({ "expr": z.string().describe("JavaScript expression that returns true to retry. Has access to 'result' and 'error' variables") }).describe("Conditional retry based on error or result").optional() }).describe("Retry configuration for failed module executions").optional() }).describe("A single step in a flow. Can be a script, subflow, loop, or branch")).describe("Steps to execute in this branch") })).describe("Array of branches that all execute (either in parallel or sequentially)"), "type": z.literal("branchall"), "parallel": z.boolean().describe("If true, all branches execute concurrently. If false, they execute sequentially").optional() }).describe("Parallel branching where all branches execute simultaneously. Unlike BranchOne, all branches run regardless of conditions. Useful for executing independent tasks concurrently"), z.object({ "type": z.literal("identity"), "flow": z.boolean().describe("If true, marks this as a flow identity (special handling)").optional() }).describe("Pass-through module that returns its input unchanged. Useful for flow structure or as a placeholder"), z.object({ "input_transforms": z.object({ "provider": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs"), "output_type": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs"), "user_message": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs"), "system_prompt": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "streaming": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "memory": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "output_schema": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "user_images": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "max_completion_tokens": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "temperature": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional() }).describe("Input parameters for the AI agent mapped to their values"), "tools": z.array(z.object({ "id": z.string().describe("Unique identifier for this tool. Cannot contain spaces - use underscores instead (e.g., 'get_user_data' not 'get user data')"), "summary": z.string().describe("Short description of what this tool does (shown to the AI)").optional(), "value": z.any().superRefine((x, ctx) => {
3
+ const schemas = [z.intersection(z.object({ "tool_type": z.literal("flowmodule") }), z.lazy(() => flowModuleValueSchema)).describe("A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module"), z.object({ "tool_type": z.literal("mcp"), "resource_path": z.string().describe("Path to the MCP resource/server configuration"), "include_tools": z.array(z.string()).describe("Whitelist of specific tools to include from this MCP server").optional(), "exclude_tools": z.array(z.string()).describe("Blacklist of tools to exclude from this MCP server").optional() }).describe("Reference to an external MCP (Model Context Protocol) tool. The AI can call tools from MCP servers"), z.object({ "tool_type": z.literal("websearch") }).describe("A tool implemented as a websearch tool. The AI can call this like any other websearch tool")];
4
+ const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
5
+ if (schemas.length - errors.length !== 1) {
6
+ ctx.addIssue({
7
+ path: ctx.path,
8
+ code: "invalid_union",
9
+ unionErrors: errors,
10
+ message: "Invalid input: Should pass single schema",
11
+ });
12
+ }
13
+ }).describe("The implementation of a tool. Can be a flow module (script/flow) or an MCP tool reference") }).describe("A tool available to an AI agent. Can be a flow module or an external MCP (Model Context Protocol) tool")).describe("Array of tools the agent can use. The agent decides which tools to call based on the task"), "type": z.literal("aiagent"), "parallel": z.boolean().describe("If true, the agent can execute multiple tool calls in parallel").optional() }).describe("AI agent step that can use tools to accomplish tasks. The agent receives inputs and can call any of its configured tools to complete the task")]).describe("The actual implementation of a flow step. Can be a script (inline or referenced), subflow, loop, branch, or special module type");
14
+ export const flowModuleSchema = z.object({ "id": z.string().describe("Unique identifier for this step. Used to reference results via 'results.step_id'. Must be a valid identifier (alphanumeric, underscore, hyphen)"), "value": z.discriminatedUnion("type", [z.object({ "input_transforms": z.record(z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs")).describe("Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments"), "content": z.string().describe("The script source code. Should export a 'main' function"), "language": z.enum(["deno", "bun", "python3", "go", "bash", "powershell", "postgresql", "mysql", "bigquery", "snowflake", "mssql", "oracledb", "graphql", "nativets", "php"]).describe("Programming language for this script"), "path": z.string().describe("Optional path for saving this script").optional(), "lock": z.string().describe("Lock file content for dependencies").optional(), "type": z.literal("rawscript"), "tag": z.string().describe("Worker group tag for execution routing").optional(), "concurrent_limit": z.number().describe("Maximum concurrent executions of this script").optional(), "concurrency_time_window_s": z.number().describe("Time window for concurrent_limit").optional(), "custom_concurrency_key": z.string().describe("Custom key for grouping concurrent executions").optional(), "is_trigger": z.boolean().describe("If true, this script is a trigger that can start the flow").optional(), "assets": z.array(z.object({ "path": z.string().describe("Path to the asset"), "kind": z.enum(["s3object", "resource", "ducklake", "datatable"]).describe("Type of asset"), "access_type": z.enum(["r", "w", "rw"]).describe("Access level for this asset").optional(), "alt_access_type": z.enum(["r", "w", "rw"]).describe("Alternative access level").optional() })).describe("External resources this script accesses (S3 objects, resources, etc.)").optional() }).describe("Inline script with code defined directly in the flow. Use 'bun' as default language if unspecified. The script receives arguments from input_transforms"), z.object({ "input_transforms": z.record(z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs")).describe("Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments"), "path": z.string().describe("Path to the script in the workspace (e.g., 'f/scripts/send_email')"), "hash": z.string().describe("Optional specific version hash of the script to use").optional(), "type": z.literal("script"), "tag_override": z.string().describe("Override the script's default worker group tag").optional(), "is_trigger": z.boolean().describe("If true, this script is a trigger that can start the flow").optional() }).describe("Reference to an existing script by path. Use this when calling a previously saved script instead of writing inline code"), z.object({ "input_transforms": z.record(z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs")).describe("Map of parameter names to their values (static or JavaScript expressions). These become the subflow's input arguments"), "path": z.string().describe("Path to the flow in the workspace (e.g., 'f/flows/process_user')"), "type": z.literal("flow") }).describe("Reference to an existing flow by path. Use this to call another flow as a subflow"), z.object({ "modules": z.array(z.lazy(() => flowModuleSchema)).describe("Steps to execute for each iteration. These can reference the iteration value via 'flow_input.iter.value'"), "iterator": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs"), "skip_failures": z.boolean().describe("If true, iteration failures don't stop the loop. Failed iterations return null"), "type": z.literal("forloopflow"), "parallel": z.boolean().describe("If true, iterations run concurrently (faster for I/O-bound operations). Use with parallelism to control concurrency").optional(), "parallelism": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "squash": z.boolean().optional() }).describe("Executes nested modules in a loop over an iterator. Inside the loop, use 'flow_input.iter.value' to access the current iteration value, and 'flow_input.iter.index' for the index. Supports parallel execution for better performance on I/O-bound operations"), z.object({ "modules": z.array(z.lazy(() => flowModuleSchema)).describe("Steps to execute in each iteration. Use stop_after_if to control when the loop ends"), "skip_failures": z.boolean().describe("If true, iteration failures don't stop the loop. Failed iterations return null"), "type": z.literal("whileloopflow"), "parallel": z.boolean().describe("If true, iterations run concurrently (use with caution in while loops)").optional(), "parallelism": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "squash": z.boolean().optional() }).describe("Executes nested modules repeatedly while a condition is true. The loop checks the condition after each iteration. Use stop_after_if on modules to control loop termination"), z.object({ "branches": z.array(z.object({ "summary": z.string().describe("Short description of this branch condition").optional(), "expr": z.string().describe("JavaScript expression that returns boolean. Can use 'results.step_id' or 'flow_input'. First true expr wins"), "modules": z.array(z.lazy(() => flowModuleSchema)).describe("Steps to execute if this branch's expr is true") })).describe("Array of branches to evaluate in order. The first branch with expr evaluating to true executes"), "default": z.array(z.lazy(() => flowModuleSchema)).describe("Steps to execute if no branch expressions match"), "type": z.literal("branchone") }).describe("Conditional branching where only the first matching branch executes. Branches are evaluated in order, and the first one with a true expression runs. If no branches match, the default branch executes"), z.object({ "branches": z.array(z.object({ "summary": z.string().describe("Short description of this branch's purpose").optional(), "skip_failure": z.boolean().describe("If true, failure in this branch doesn't fail the entire flow").optional(), "modules": z.array(z.lazy(() => flowModuleSchema)).describe("Steps to execute in this branch") })).describe("Array of branches that all execute (either in parallel or sequentially)"), "type": z.literal("branchall"), "parallel": z.boolean().describe("If true, all branches execute concurrently. If false, they execute sequentially").optional() }).describe("Parallel branching where all branches execute simultaneously. Unlike BranchOne, all branches run regardless of conditions. Useful for executing independent tasks concurrently"), z.object({ "type": z.literal("identity"), "flow": z.boolean().describe("If true, marks this as a flow identity (special handling)").optional() }).describe("Pass-through module that returns its input unchanged. Useful for flow structure or as a placeholder"), z.object({ "input_transforms": z.object({ "provider": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs"), "output_type": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs"), "user_message": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs"), "system_prompt": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "streaming": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "memory": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "output_schema": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "user_images": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "max_completion_tokens": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional(), "temperature": z.discriminatedUnion("type", [z.object({ "value": z.any().describe("The static value. For resources, use format '$res:path/to/resource'").optional(), "type": z.literal("static") }).describe("Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'"), z.object({ "expr": z.string().describe("JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"), "type": z.literal("javascript") }).describe("JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value")]).describe("Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs").optional() }).describe("Input parameters for the AI agent mapped to their values"), "tools": z.array(z.object({ "id": z.string().describe("Unique identifier for this tool. Cannot contain spaces - use underscores instead (e.g., 'get_user_data' not 'get user data')"), "summary": z.string().describe("Short description of what this tool does (shown to the AI)").optional(), "value": z.any().superRefine((x, ctx) => {
15
+ const schemas = [z.intersection(z.object({ "tool_type": z.literal("flowmodule") }), z.lazy(() => flowModuleValueSchema)).describe("A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module"), z.object({ "tool_type": z.literal("mcp"), "resource_path": z.string().describe("Path to the MCP resource/server configuration"), "include_tools": z.array(z.string()).describe("Whitelist of specific tools to include from this MCP server").optional(), "exclude_tools": z.array(z.string()).describe("Blacklist of tools to exclude from this MCP server").optional() }).describe("Reference to an external MCP (Model Context Protocol) tool. The AI can call tools from MCP servers"), z.object({ "tool_type": z.literal("websearch") }).describe("A tool implemented as a websearch tool. The AI can call this like any other websearch tool")];
4
16
  const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
5
17
  if (schemas.length - errors.length !== 1) {
6
18
  ctx.addIssue({
@@ -1,7 +1,7 @@
1
1
  import type { AIProvider, AIProviderModel, ResourceType, ScriptLang } from '../../../../gen/types.gen';
2
2
  import type { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam } from 'openai/resources/index.mjs';
3
3
  import type { ContextElement } from '../context';
4
- import { type Tool } from '../shared';
4
+ import { type Tool, type ScriptLintResult } from '../shared';
5
5
  import type { ReviewChangesOpts } from '../monaco-adapter';
6
6
  export declare const DIFF_BASED_EDIT_PROVIDERS: AIProvider[];
7
7
  export declare function formatResourceTypes(allResourceTypes: ResourceType[], lang: 'python3' | 'php' | 'bun' | 'deno' | 'nativets' | 'bunnative'): string;
@@ -30,6 +30,8 @@ export interface ScriptChatHelpers {
30
30
  args: Record<string, any>;
31
31
  };
32
32
  applyCode: (code: string, opts?: ReviewChangesOpts) => Promise<void>;
33
+ /** Get lint errors from the Monaco editor */
34
+ getLintErrors?: () => ScriptLintResult;
33
35
  }
34
36
  export declare const resourceTypeTool: Tool<ScriptChatHelpers>;
35
37
  export declare function createDbSchemaTool<T>(): Tool<T>;
@@ -46,3 +48,4 @@ export declare function fetchNpmPackageTypes(packageName: string, version?: stri
46
48
  export declare const editCodeToolWithDiff: Tool<ScriptChatHelpers>;
47
49
  export declare const editCodeTool: Tool<ScriptChatHelpers>;
48
50
  export declare const testRunScriptTool: Tool<ScriptChatHelpers>;
51
+ export declare const getLintErrorsTool: Tool<ScriptChatHelpers>;
@@ -3,7 +3,7 @@ import { capitalize, isObject, toCamel } from '../../../../utils';
3
3
  import { get } from 'svelte/store';
4
4
  import { compile, phpCompile, pythonCompile } from '../../utils';
5
5
  import { dbSchemas } from '../../../../stores';
6
- import { createSearchHubScriptsTool, executeTestRun, buildTestRunArgs, buildContextString } from '../shared';
6
+ import { createSearchHubScriptsTool, executeTestRun, buildTestRunArgs, buildContextString, formatScriptLintResult } from '../shared';
7
7
  import { setupTypeAcquisition } from '../../../../ata';
8
8
  import { getModelContextWindow } from '../../lib';
9
9
  import { getCurrentModel } from '../../../../aiStore';
@@ -130,7 +130,7 @@ function buildChatSystemPrompt(currentModel) {
130
130
  - You can also receive a \`DIFF\` of the changes that have been made to the code. You should use this diff to give better answers.
131
131
  - Before giving your answer, check again that you carefully followed these instructions.
132
132
  - When asked to create a script that communicates with an external service, you can use the \`search_hub_scripts\` tool to search for relevant scripts in the hub. Make sure the language is the same as what the user is coding in. If you do not find any relevant scripts, you can use the \`search_npm_packages\` tool to search for relevant packages and their documentation. Always give a link to the documentation in your answer if possible.
133
- - After applying code changes with the \`${editToolName}\` tool, ALWAYS use the \`test_run_script\` tool to test the code, and iterate on the code until it works as expected (MAX 3 times). If the user cancels the test run, do not try again and wait for the next user instruction.
133
+ - After applying code changes with the \`${editToolName}\` tool, ALWAYS use the \`get_lint_errors\` tool to check for lint errors. If there are errors, fix them before proceeding. Then use the \`test_run_script\` tool to test the code, and iterate on the code until it works as expected (MAX 3 times). If the user cancels the test run, do not try again and wait for the next user instruction.
134
134
 
135
135
  Important:
136
136
  ${useDiffBasedEdit ? '- Each old_string must match the exact text in the current code, including whitespace and indentation.' : ''}
@@ -264,6 +264,7 @@ export function prepareScriptTools(currentModel, language, context) {
264
264
  tools.push(editCodeTool);
265
265
  }
266
266
  tools.push(testRunScriptTool);
267
+ tools.push(getLintErrorsTool);
267
268
  return tools;
268
269
  }
269
270
  export function prepareScriptUserMessage(instructions, selectedContext) {
@@ -567,6 +568,20 @@ const TEST_RUN_SCRIPT_TOOL = {
567
568
  }
568
569
  }
569
570
  };
571
+ const GET_LINT_ERRORS_TOOL = {
572
+ type: 'function',
573
+ function: {
574
+ name: 'get_lint_errors',
575
+ description: 'Get lint errors and warnings from the current script in the editor. Use this after making code changes to check for issues.',
576
+ parameters: {
577
+ type: 'object',
578
+ properties: {},
579
+ additionalProperties: false,
580
+ strict: true,
581
+ required: []
582
+ }
583
+ }
584
+ };
570
585
  export const editCodeToolWithDiff = {
571
586
  def: EDIT_CODE_TOOL_WITH_DIFF,
572
587
  streamArguments: true,
@@ -703,3 +718,24 @@ export const testRunScriptTool = {
703
718
  confirmationMessage: 'Run script test',
704
719
  showDetails: true
705
720
  };
721
+ export const getLintErrorsTool = {
722
+ def: GET_LINT_ERRORS_TOOL,
723
+ fn: async function ({ helpers, toolCallbacks, toolId }) {
724
+ toolCallbacks.setToolStatus(toolId, { content: 'Getting lint errors...' });
725
+ if (!helpers.getLintErrors) {
726
+ toolCallbacks.setToolStatus(toolId, {
727
+ content: 'Lint errors not available',
728
+ error: 'getLintErrors helper is not available in this context'
729
+ });
730
+ return 'Lint errors are not available in this context. The editor may not support lint error reporting.';
731
+ }
732
+ const lintResult = helpers.getLintErrors();
733
+ const status = lintResult.errorCount > 0
734
+ ? `Found ${lintResult.errorCount} error(s)`
735
+ : lintResult.warningCount > 0
736
+ ? `Found ${lintResult.warningCount} warning(s)`
737
+ : 'No issues found';
738
+ toolCallbacks.setToolStatus(toolId, { content: status });
739
+ return formatScriptLintResult(lintResult);
740
+ }
741
+ };
@@ -15,6 +15,7 @@ import type { ExtendedOpenFlow } from '../../flows/types';
15
15
  import type { FunctionParameters } from 'openai/resources/shared.mjs';
16
16
  import { z } from 'zod';
17
17
  import { type CompletedJob, type FlowModule } from '../../../gen';
18
+ import { type editor as meditor } from 'monaco-editor';
18
19
  export declare const TOOL_PRETTIFY_MAP: Record<string, (content: string) => string>;
19
20
  export interface ContextStringResult {
20
21
  dbContext: string;
@@ -119,4 +120,13 @@ export declare function extractCodeFromMarkdown(markdown: string): string[];
119
120
  export declare function getLatestAssistantMessage(displayMessages: DisplayMessage[]): string | undefined;
120
121
  export declare function buildTestRunArgs(args: any, toolDef: ChatCompletionFunctionTool): Promise<any>;
121
122
  export declare function executeTestRun(config: TestRunConfig): Promise<string>;
123
+ /** Result of linting a script */
124
+ export interface ScriptLintResult {
125
+ errorCount: number;
126
+ warningCount: number;
127
+ errors: meditor.IMarker[];
128
+ warnings: meditor.IMarker[];
129
+ }
130
+ /** Format script lint result for display */
131
+ export declare function formatScriptLintResult(lintResult: ScriptLintResult): string;
122
132
  export {};
@@ -15,6 +15,7 @@ import { z } from 'zod';
15
15
  import { ScriptService, JobService } from '../../../gen';
16
16
  import { scriptLangToEditorLang } from '../../../scripts';
17
17
  import { getCurrentModel } from '../../../aiStore';
18
+ import {} from 'monaco-editor';
18
19
  // Prettify function for code arguments - extracts and formats code from JSON
19
20
  function prettifyCodeArguments(content) {
20
21
  let codeContent = content;
@@ -640,3 +641,26 @@ function formatResultSummary(result, logs, success) {
640
641
  resultSummary += formatLogs(logs) ?? 'No logs available';
641
642
  return resultSummary;
642
643
  }
644
+ /** Format script lint result for display */
645
+ export function formatScriptLintResult(lintResult) {
646
+ let response = '';
647
+ const hasIssues = lintResult.errorCount > 0 || lintResult.warningCount > 0;
648
+ if (hasIssues) {
649
+ if (lintResult.errorCount > 0) {
650
+ response += `❌ **${lintResult.errorCount} error(s)** found that must be fixed:\n`;
651
+ for (const error of lintResult.errors) {
652
+ response += `- Line ${error.startLineNumber}: ${error.message}\n`;
653
+ }
654
+ }
655
+ if (lintResult.warningCount > 0) {
656
+ response += `\n⚠️ **${lintResult.warningCount} warning(s)** found:\n`;
657
+ for (const warning of lintResult.warnings) {
658
+ response += `- Line ${warning.startLineNumber}: ${warning.message}\n`;
659
+ }
660
+ }
661
+ }
662
+ else {
663
+ response = '✅ No lint issues found.';
664
+ }
665
+ return response;
666
+ }
@@ -25,7 +25,7 @@ export interface ModelResponse {
25
25
  };
26
26
  }
27
27
  export declare function fetchAvailableModels(resourcePath: string, workspace: string, provider: AIProvider, signal?: AbortSignal): Promise<string[]>;
28
- export declare function getModelMaxTokens(provider: AIProvider, model: string): 128000 | 32000 | 100000 | 64000 | 32768 | 16384 | 4096 | 8192;
28
+ export declare function getModelMaxTokens(provider: AIProvider, model: string): 100000 | 128000 | 32000 | 64000 | 32768 | 16384 | 4096 | 8192;
29
29
  export declare function getModelContextWindow(model: string): 1000000 | 400000 | 128000 | 200000 | 32000;
30
30
  export declare const PROVIDER_COMPLETION_CONFIG_MAP: Record<AIProvider, ChatCompletionCreateParams>;
31
31
  declare class WorkspacedAIClients {
@@ -10,6 +10,7 @@ export type FlowBuilderWhitelabelCustomUi = {
10
10
  extraDeployOptions?: boolean;
11
11
  editableSummary?: boolean;
12
12
  settings?: boolean;
13
+ draft?: boolean;
13
14
  };
14
15
  settingsPanel?: boolean;
15
16
  settingsTabs?: {
@@ -79,6 +80,7 @@ export type EditorBarUi = {
79
80
  database?: boolean;
80
81
  ducklake?: boolean;
81
82
  dataTable?: boolean;
83
+ debug?: boolean;
82
84
  };
83
85
  export type EditableSchemaFormUi = {
84
86
  jsonOnly?: boolean;
@@ -1,7 +1,8 @@
1
- import { type ColumnDef } from './apps/components/display/dbtable/utils';
1
+ import { type ColumnDef, type TableMetadata } from './apps/components/display/dbtable/utils';
2
2
  import type { DBSchema } from '../stores';
3
3
  import type { DbInput, DbType } from './dbTypes';
4
- import { type CreateTableValues } from './apps/components/display/dbtable/queries/createTable';
4
+ import { type TableEditorValues } from './apps/components/display/dbtable/tableEditor';
5
+ import { type AlterTableValues } from './apps/components/display/dbtable/queries/alterTable';
5
6
  export type IDbTableOps = {
6
7
  dbType: DbType;
7
8
  tableKey: string;
@@ -41,19 +42,32 @@ export type IDbSchemaOps = {
41
42
  schema?: string;
42
43
  }) => Promise<void>;
43
44
  onCreate: (params: {
44
- values: CreateTableValues;
45
+ values: TableEditorValues;
45
46
  schema?: string;
46
47
  }) => Promise<void>;
47
48
  previewCreateSql: (params: {
48
- values: CreateTableValues;
49
+ values: TableEditorValues;
49
50
  schema?: string;
50
51
  }) => string;
52
+ onAlter: (params: {
53
+ values: AlterTableValues;
54
+ schema?: string;
55
+ }) => Promise<void>;
56
+ previewAlterSql: (params: {
57
+ values: AlterTableValues;
58
+ schema?: string;
59
+ }) => string[];
51
60
  onCreateSchema: (params: {
52
61
  schema: string;
53
62
  }) => Promise<void>;
54
63
  onDeleteSchema: (params: {
55
64
  schema: string;
56
65
  }) => Promise<void>;
66
+ onFetchTableEditorDefinition: (params: {
67
+ table: string;
68
+ schema?: string;
69
+ getColDefs: () => Promise<TableMetadata>;
70
+ }) => Promise<TableEditorValues>;
57
71
  };
58
72
  export declare function dbSchemaOpsWithPreviewScripts({ workspace, input }: {
59
73
  workspace: string;
@@ -9,7 +9,10 @@ import { makeDeleteTableQuery } from './apps/components/display/dbtable/queries/
9
9
  import { stringifySchema } from './copilot/lib';
10
10
  import { wrapDucklakeQuery } from './ducklake';
11
11
  import { assert } from '../utils';
12
+ import { buildTableEditorValues } from './apps/components/display/dbtable/tableEditor';
13
+ import { makeAlterTableQueries, makeAlterTableQuery } from './apps/components/display/dbtable/queries/alterTable';
12
14
  import { makeCreateTableQuery } from './apps/components/display/dbtable/queries/createTable';
15
+ import { fetchTableRelationalKeys } from './apps/components/display/dbtable/queries/relationalKeys';
13
16
  export function dbTableOpsWithPreviewScripts({ input, tableKey, colDefs, workspace }) {
14
17
  const dbType = getDbType(input);
15
18
  const language = getLanguageByResourceType(dbType);
@@ -30,15 +33,15 @@ export function dbTableOpsWithPreviewScripts({ input, tableKey, colDefs, workspa
30
33
  return count;
31
34
  },
32
35
  getRows: async (params) => {
33
- let query = makeSelectQuery(tableKey, colDefs, undefined, dbType);
36
+ let query = makeSelectQuery(tableKey, colDefs, undefined, dbType, undefined, {
37
+ fixPgIntTypes: true
38
+ });
34
39
  if (input.type === 'ducklake')
35
40
  query = wrapDucklakeQuery(query, input.ducklake);
36
41
  let items = (await runScriptAndPollResult({
37
42
  workspace,
38
43
  requestBody: { args: { ...dbArg, ...params }, language, content: query }
39
44
  }));
40
- if (input.type === 'database' && input.resourceType === 'ms_sql_server')
41
- items = items?.[0];
42
45
  if (!items || !Array.isArray(items)) {
43
46
  throw 'items is not an array';
44
47
  }
@@ -101,6 +104,16 @@ export function dbSchemaOpsWithPreviewScripts({ workspace, input }) {
101
104
  });
102
105
  },
103
106
  previewCreateSql: ({ values, schema }) => makeCreateTableQuery(values, dbType, schema),
107
+ onAlter: async ({ values, schema }) => {
108
+ let query = makeAlterTableQuery(values, dbType, schema);
109
+ if (input.type === 'ducklake')
110
+ query = wrapDucklakeQuery(query, input.ducklake);
111
+ await runScriptAndPollResult({
112
+ workspace,
113
+ requestBody: { args: dbArg, content: query, language }
114
+ });
115
+ },
116
+ previewAlterSql: ({ values, schema }) => makeAlterTableQueries(values, dbType, schema),
104
117
  onCreateSchema: async ({ schema }) => {
105
118
  let createSchemaQuery = `CREATE SCHEMA ${schema};`;
106
119
  if (input.type === 'ducklake')
@@ -118,6 +131,15 @@ export function dbSchemaOpsWithPreviewScripts({ workspace, input }) {
118
131
  workspace,
119
132
  requestBody: { args: { ...dbArg }, language, content: dropSchemaQuery }
120
133
  });
134
+ },
135
+ onFetchTableEditorDefinition: async ({ table, schema, getColDefs }) => {
136
+ let { foreignKeys, pk_constraint_name, colDefs } = await fetchTableRelationalKeys(input, dbType, table, schema, workspace, dbArg, language, getColDefs);
137
+ return buildTableEditorValues({
138
+ tableName: table,
139
+ metadata: colDefs,
140
+ foreignKeys,
141
+ pk_constraint_name
142
+ });
121
143
  }
122
144
  };
123
145
  }