windmill-components 1.522.0 → 1.531.1

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 (272) hide show
  1. package/package/components/AIAgentLogViewer.svelte +123 -0
  2. package/package/components/AIAgentLogViewer.svelte.d.ts +13 -0
  3. package/package/components/AppConnectInner.svelte +10 -10
  4. package/package/components/AutoscalingConfigEditor.svelte +76 -2
  5. package/package/components/Dev.svelte +12 -28
  6. package/package/components/DiffEditor.svelte +6 -3
  7. package/package/components/DiffEditor.svelte.d.ts +1 -0
  8. package/package/components/DisplayResult.svelte +16 -10
  9. package/package/components/DisplayResult.svelte.d.ts +1 -0
  10. package/package/components/EditableSchemaForm.svelte +5 -2
  11. package/package/components/Editor.svelte +26 -8
  12. package/package/components/Editor.svelte.d.ts +1 -1
  13. package/package/components/EditorBar.svelte +25 -5
  14. package/package/components/EditorSettings.svelte +6 -0
  15. package/package/components/FirstStepInputs.svelte +2 -2
  16. package/package/components/FlowBuilder.svelte +18 -36
  17. package/package/components/FlowGraphViewerStep.svelte +7 -0
  18. package/package/components/FlowJobResult.svelte +15 -63
  19. package/package/components/FlowJobResult.svelte.d.ts +10 -4
  20. package/package/components/FlowLogViewer.svelte +660 -0
  21. package/package/components/FlowLogViewer.svelte.d.ts +34 -0
  22. package/package/components/FlowLogViewerWrapper.svelte +52 -0
  23. package/package/components/FlowLogViewerWrapper.svelte.d.ts +21 -0
  24. package/package/components/FlowLoopIterationPreview.svelte +3 -3
  25. package/package/components/FlowPreviewContent.svelte +4 -5
  26. package/package/components/FlowPreviewContent.svelte.d.ts +7 -7
  27. package/package/components/FlowPreviewResult.svelte +4 -5
  28. package/package/components/FlowPreviewResult.svelte.d.ts +3 -5
  29. package/package/components/FlowStatusViewer.svelte +28 -16
  30. package/package/components/FlowStatusViewer.svelte.d.ts +19 -27
  31. package/package/components/FlowStatusViewerInner.svelte +483 -296
  32. package/package/components/FlowStatusViewerInner.svelte.d.ts +27 -33
  33. package/package/components/FlowTimeline.svelte +11 -13
  34. package/package/components/FlowTimeline.svelte.d.ts +6 -5
  35. package/package/components/FlowWrapper.svelte +3 -2
  36. package/package/components/HighlightCode.svelte +4 -1
  37. package/package/components/IconedResourceType.svelte +9 -5
  38. package/package/components/JobLoader.svelte +61 -8
  39. package/package/components/JobLoader.svelte.d.ts +9 -1
  40. package/package/components/LogViewer.svelte +8 -2
  41. package/package/components/LogViewer.svelte.d.ts +1 -0
  42. package/package/components/LogViewerHeader.svelte +32 -0
  43. package/package/components/LogViewerHeader.svelte.d.ts +8 -0
  44. package/package/components/ModulePreviewForm.svelte +10 -6
  45. package/package/components/ModulePreviewResultViewer.svelte +16 -0
  46. package/package/components/ModulePreviewResultViewer.svelte.d.ts +1 -1
  47. package/package/components/ModuleTest.svelte +59 -16
  48. package/package/components/RelativeLineNumbers.svelte +16 -0
  49. package/package/components/RelativeLineNumbers.svelte.d.ts +18 -0
  50. package/package/components/ResourceEditor.svelte +9 -4
  51. package/package/components/ScriptBuilder.svelte +13 -11
  52. package/package/components/ScriptEditor.svelte +2 -2
  53. package/package/components/SimpleEditor.svelte +10 -4
  54. package/package/components/SimpleEditor.svelte.d.ts +1 -0
  55. package/package/components/TemplateEditor.svelte +1 -1
  56. package/package/components/UserSettings.svelte +4 -4
  57. package/package/components/apps/components/display/AppAccordionList.svelte +1 -1
  58. package/package/components/apps/components/display/AppCarouselList.svelte +10 -8
  59. package/package/components/apps/components/display/AppJobIdFlowStatus.svelte +3 -3
  60. package/package/components/apps/components/display/table/AppAggridTable.svelte +2 -2
  61. package/package/components/apps/components/helpers/HiddenComponent.svelte +0 -1
  62. package/package/components/apps/components/helpers/InputValue.svelte +6 -1
  63. package/package/components/apps/components/helpers/NonRunnableComponent.svelte +8 -4
  64. package/package/components/apps/components/helpers/NonRunnableComponent.svelte.d.ts +1 -1
  65. package/package/components/apps/components/helpers/RunnableComponent.svelte +7 -8
  66. package/package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +1 -1
  67. package/package/components/apps/components/helpers/RunnableWrapper.svelte +12 -3
  68. package/package/components/apps/components/helpers/RunnableWrapper.svelte.d.ts +1 -1
  69. package/package/components/apps/components/inputs/AppCodeInputComponent.svelte +0 -5
  70. package/package/components/apps/components/layout/AppConditionalWrapper.svelte +1 -1
  71. package/package/components/apps/components/layout/AppContainer.svelte +1 -1
  72. package/package/components/apps/components/layout/AppDecisionTree.svelte +31 -20
  73. package/package/components/apps/components/layout/AppDrawer.svelte +1 -1
  74. package/package/components/apps/components/layout/AppList.svelte +9 -8
  75. package/package/components/apps/components/layout/AppModal.svelte +1 -1
  76. package/package/components/apps/components/layout/AppSplitpanes.svelte +5 -2
  77. package/package/components/apps/components/layout/AppStepper.svelte +9 -5
  78. package/package/components/apps/components/layout/AppTabs.svelte +2 -2
  79. package/package/components/apps/editor/AppJobsDrawer.svelte +2 -2
  80. package/package/components/apps/editor/GridEditor.svelte +24 -19
  81. package/package/components/apps/editor/GridEditor.svelte.d.ts +4 -1
  82. package/package/components/apps/editor/GridViewer.svelte +1 -1
  83. package/package/components/apps/editor/SubGridEditor.svelte +7 -11
  84. package/package/components/apps/editor/SubGridEditor.svelte.d.ts +3 -19
  85. package/package/components/apps/editor/appUtils.js +17 -68
  86. package/package/components/apps/editor/component/ComponentInner.svelte +845 -694
  87. package/package/components/apps/editor/component/componentCallbacks.svelte.js +8 -1
  88. package/package/components/apps/editor/contextPanel/components/OutputHeader.svelte +9 -46
  89. package/package/components/apps/editor/settingsPanel/DecisionTreeGraphEditor.svelte +29 -43
  90. package/package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte +2 -1
  91. package/package/components/apps/editor/settingsPanel/InputsSpecEditor.svelte.d.ts +1 -0
  92. package/package/components/apps/editor/settingsPanel/inputEditor/EvalV2InputEditor.svelte +2 -2
  93. package/package/components/apps/editor/settingsPanel/inputEditor/EvalV2InputEditor.svelte.d.ts +1 -0
  94. package/package/components/apps/svelte-grid/Grid.svelte +23 -25
  95. package/package/components/apps/svelte-grid/Grid.svelte.d.ts +21 -9
  96. package/package/components/apps/svelte-grid/MoveResize.svelte +13 -15
  97. package/package/components/apps/svelte-grid/MoveResize.svelte.d.ts +17 -24
  98. package/package/components/apps/utils.d.ts +2 -0
  99. package/package/components/apps/utils.js +22 -0
  100. package/package/components/auditLogs/AuditLogsFilters.svelte.d.ts +1 -1
  101. package/package/components/common/fileDownload/FileDownload.svelte +1 -3
  102. package/package/components/common/fileDownload/FileDownload.svelte.d.ts +4 -18
  103. package/package/components/common/languageIcons/LanguageIcon.svelte +5 -2
  104. package/package/components/copilot/FlowInlineScriptAIButton.svelte +58 -0
  105. package/package/components/copilot/FlowInlineScriptAIButton.svelte.d.ts +3 -0
  106. package/package/components/copilot/MetadataGen.svelte +19 -1
  107. package/package/components/copilot/MetadataGen.svelte.d.ts +1 -1
  108. package/package/components/copilot/ScriptGen.svelte +23 -31
  109. package/package/components/copilot/ScriptGen.svelte.d.ts +0 -1
  110. package/package/components/copilot/autocomplete/Autocompletor.js +2 -0
  111. package/package/components/copilot/chat/AIChatDisplay.svelte +4 -4
  112. package/package/components/copilot/chat/AIChatInput.svelte +29 -6
  113. package/package/components/copilot/chat/AIChatManager.svelte.js +110 -26
  114. package/package/components/copilot/chat/AIChatMessage.svelte +3 -0
  115. package/package/components/copilot/chat/ToolContentDisplay.svelte +84 -0
  116. package/package/components/copilot/chat/ToolContentDisplay.svelte.d.ts +11 -0
  117. package/package/components/copilot/chat/ToolExecutionDisplay.svelte +105 -0
  118. package/package/components/copilot/chat/ToolExecutionDisplay.svelte.d.ts +7 -0
  119. package/package/components/copilot/chat/api/apiTools.d.ts +7 -0
  120. package/package/components/copilot/chat/api/apiTools.js +192 -0
  121. package/package/components/copilot/chat/api/core.d.ts +7 -0
  122. package/package/components/copilot/chat/api/core.js +61 -0
  123. package/package/components/copilot/chat/flow/FlowAIChat.svelte +4 -6
  124. package/package/components/copilot/chat/flow/core.js +213 -42
  125. package/package/components/copilot/chat/flow/utils.js +3 -0
  126. package/package/components/copilot/chat/monaco-adapter.d.ts +1 -1
  127. package/package/components/copilot/chat/monaco-adapter.js +10 -4
  128. package/package/components/copilot/chat/navigator/core.d.ts +1 -1
  129. package/package/components/copilot/chat/navigator/core.js +20 -22
  130. package/package/components/copilot/chat/script/core.d.ts +11 -3
  131. package/package/components/copilot/chat/script/core.js +92 -15
  132. package/package/components/copilot/chat/shared.d.ts +30 -3
  133. package/package/components/copilot/chat/shared.js +228 -9
  134. package/package/components/copilot/lib.d.ts +1 -1
  135. package/package/components/copilot/lib.js +15 -6
  136. package/package/components/custom_ui.d.ts +2 -0
  137. package/package/components/details/DetailPageLayout.svelte +34 -33
  138. package/package/components/flow_builder.d.ts +1 -2
  139. package/package/components/flows/FlowEditor.svelte +3 -3
  140. package/package/components/flows/FlowEditor.svelte.d.ts +7 -6
  141. package/package/components/flows/common/FlowCard.svelte +2 -2
  142. package/package/components/flows/common/FlowCard.svelte.d.ts +1 -0
  143. package/package/components/flows/common/FlowCardHeader.svelte +13 -4
  144. package/package/components/flows/common/FlowCardHeader.svelte.d.ts +1 -0
  145. package/package/components/flows/content/BranchPredicateEditor.svelte +4 -7
  146. package/package/components/flows/content/BranchPredicateEditor.svelte.d.ts +12 -11
  147. package/package/components/flows/content/FlowConstants.svelte +3 -3
  148. package/package/components/flows/content/FlowEditorPanel.svelte +3 -3
  149. package/package/components/flows/content/FlowEditorPanel.svelte.d.ts +2 -4
  150. package/package/components/flows/content/FlowInputsQuick.svelte +2 -1
  151. package/package/components/flows/content/FlowLoop.svelte +2 -2
  152. package/package/components/flows/content/FlowModuleComponent.svelte +130 -108
  153. package/package/components/flows/content/FlowModuleComponent.svelte.d.ts +1 -0
  154. package/package/components/flows/content/FlowModuleEarlyStop.svelte +2 -2
  155. package/package/components/flows/content/FlowModuleSkip.svelte +1 -1
  156. package/package/components/flows/content/FlowModuleSleep.svelte +1 -1
  157. package/package/components/flows/content/FlowModuleSuspend.svelte +1 -1
  158. package/package/components/flows/content/FlowModuleWrapper.svelte +15 -5
  159. package/package/components/flows/content/FlowModuleWrapper.svelte.d.ts +1 -0
  160. package/package/components/flows/content/FlowResult.svelte +2 -3
  161. package/package/components/flows/content/FlowResult.svelte.d.ts +2 -4
  162. package/package/components/flows/content/FlowWhileLoop.svelte +1 -1
  163. package/package/components/flows/dfs.d.ts +3 -1
  164. package/package/components/flows/dfs.js +5 -1
  165. package/package/components/flows/flowInfers.js +78 -0
  166. package/package/components/flows/flowState.d.ts +2 -3
  167. package/package/components/flows/flowState.js +2 -2
  168. package/package/components/flows/flowStateUtils.svelte.d.ts +4 -4
  169. package/package/components/flows/flowStateUtils.svelte.js +14 -13
  170. package/package/components/flows/flowStore.d.ts +3 -4
  171. package/package/components/flows/header/FlowPreviewButtons.svelte +2 -1
  172. package/package/components/flows/header/FlowYamlEditor.svelte +10 -1
  173. package/package/components/flows/map/FlowGraphPreviewButton.svelte +1 -1
  174. package/package/components/flows/map/FlowJobsMenu.svelte +7 -3
  175. package/package/components/flows/map/FlowJobsMenu.svelte.d.ts +1 -0
  176. package/package/components/flows/map/FlowModuleSchemaItem.svelte +12 -12
  177. package/package/components/flows/map/FlowModuleSchemaMap.svelte +26 -19
  178. package/package/components/flows/map/FlowModuleSchemaMap.svelte.d.ts +6 -4
  179. package/package/components/flows/map/InsertModuleInner.svelte +9 -1
  180. package/package/components/flows/map/InsertModuleInner.svelte.d.ts +1 -0
  181. package/package/components/flows/map/MapItem.svelte +4 -2
  182. package/package/components/flows/pickers/TopLevelNode.svelte +4 -1
  183. package/package/components/flows/propPicker/InputPickerInner.svelte +5 -4
  184. package/package/components/flows/propPicker/OutputBadge.svelte +11 -9
  185. package/package/components/flows/propPicker/OutputPickerInner.svelte +10 -1
  186. package/package/components/flows/propPicker/OutputPickerInner.svelte.d.ts +1 -1
  187. package/package/components/flows/testSteps.svelte.d.ts +3 -2
  188. package/package/components/flows/testSteps.svelte.js +26 -23
  189. package/package/components/flows/types.d.ts +1 -1
  190. package/package/components/flows/utils.d.ts +3 -5
  191. package/package/components/flows/utils.js +3 -4
  192. package/package/components/git_sync/GitSyncContext.svelte.js +2 -1
  193. package/package/components/graph/FlowGraphV2.svelte +44 -24
  194. package/package/components/graph/FlowGraphV2.svelte.d.ts +5 -2
  195. package/package/components/graph/graphBuilder.svelte.d.ts +49 -17
  196. package/package/components/graph/graphBuilder.svelte.js +30 -14
  197. package/package/components/graph/model.d.ts +9 -6
  198. package/package/components/graph/renderers/edges/BaseEdge.svelte +3 -3
  199. package/package/components/graph/renderers/edges/BaseEdge.svelte.d.ts +2 -3
  200. package/package/components/graph/renderers/nodes/AIToolNode.svelte +234 -0
  201. package/package/components/graph/renderers/nodes/AIToolNode.svelte.d.ts +24 -0
  202. package/package/components/graph/renderers/nodes/AssetNode.svelte +15 -10
  203. package/package/components/graph/renderers/nodes/AssetNode.svelte.d.ts +18 -1
  204. package/package/components/graph/renderers/nodes/BranchAllEndNode.svelte +1 -1
  205. package/package/components/graph/renderers/nodes/BranchAllStart.svelte +1 -1
  206. package/package/components/graph/renderers/nodes/BranchOneStart.svelte +1 -1
  207. package/package/components/graph/renderers/nodes/ForLoopEndNode.svelte +2 -2
  208. package/package/components/graph/renderers/nodes/ForLoopStartNode.svelte +1 -1
  209. package/package/components/graph/renderers/nodes/ModuleNode.svelte +21 -21
  210. package/package/components/graph/renderers/nodes/NewAIToolNode.svelte +64 -0
  211. package/package/components/graph/renderers/nodes/NewAIToolNode.svelte.d.ts +7 -0
  212. package/package/components/graph/renderers/nodes/branchOneEndNode.svelte +1 -1
  213. package/package/components/icons/RubyIcon.svelte +656 -0
  214. package/package/components/icons/RubyIcon.svelte.d.ts +7 -0
  215. package/package/components/instanceSettings.js +9 -0
  216. package/package/components/modulesTest.svelte.d.ts +6 -3
  217. package/package/components/modulesTest.svelte.js +32 -0
  218. package/package/components/preview/FlowPreviewStatus.svelte +3 -1
  219. package/package/components/raw_apps/RawAppEditor.svelte +27 -26
  220. package/package/components/raw_apps/RawAppEditor.svelte.d.ts +17 -17
  221. package/package/components/runs/{JobPreview.svelte → JobRunsPreview.svelte} +1 -4
  222. package/package/components/runs/{JobPreview.svelte.d.ts → JobRunsPreview.svelte.d.ts} +3 -3
  223. package/package/components/runs/RunRow.svelte +5 -1
  224. package/package/components/schema/AddProperty.svelte +41 -36
  225. package/package/components/schema/AddProperty.svelte.d.ts +2 -2
  226. package/package/components/schema/AddPropertyV2.svelte +41 -37
  227. package/package/components/schema/AddPropertyV2.svelte.d.ts +1 -1
  228. package/package/components/schema/FlowPropertyEditor.svelte +8 -6
  229. package/package/components/search/RunsSearch.svelte +1 -1
  230. package/package/components/settings/CreateToken.svelte +132 -12
  231. package/package/components/settings/CreateToken.svelte.d.ts +3 -20
  232. package/package/components/settings/TokenDisplay.svelte +18 -42
  233. package/package/components/settings/TokenDisplay.svelte.d.ts +0 -1
  234. package/package/components/settings/TokensTable.svelte +2 -4
  235. package/package/components/settings/TokensTable.svelte.d.ts +3 -19
  236. package/package/components/settings/WorkspaceUserSettings.svelte +428 -69
  237. package/package/components/sidebar/MenuButton.svelte +12 -10
  238. package/package/components/stepHistoryLoader.svelte.d.ts +2 -2
  239. package/package/components/stepHistoryLoader.svelte.js +7 -12
  240. package/package/components/triggers/http/OpenAPISpecGenerator.svelte +2 -2
  241. package/package/components/tutorials/FlowBuilderTutorialBranchOne.svelte +1 -1
  242. package/package/components/tutorials/FlowBuilderTutorialForLoop.svelte +4 -4
  243. package/package/components/tutorials/utils.js +3 -0
  244. package/package/components/worker_group.d.ts +4 -1
  245. package/package/components/worker_group.js +3 -2
  246. package/package/editorLangUtils.d.ts +1 -1
  247. package/package/editorLangUtils.js +2 -0
  248. package/package/editorUtils.d.ts +2 -1
  249. package/package/editorUtils.js +2 -1
  250. package/package/gen/core/OpenAPI.js +1 -1
  251. package/package/gen/schemas.gen.d.ts +296 -8
  252. package/package/gen/schemas.gen.js +364 -70
  253. package/package/gen/services.gen.d.ts +118 -16
  254. package/package/gen/services.gen.js +226 -19
  255. package/package/gen/types.gen.d.ts +660 -16
  256. package/package/hubPaths.json +7 -4
  257. package/package/infer.js +10 -1
  258. package/package/monaco_workers/graphql.worker.bundle.js +144 -110
  259. package/package/script_helpers.d.ts +3 -0
  260. package/package/script_helpers.js +58 -3
  261. package/package/scripts.d.ts +1 -1
  262. package/package/scripts.js +3 -2
  263. package/package/stores.d.ts +2 -0
  264. package/package/stores.js +2 -0
  265. package/package/svelte5Utils.svelte.d.ts +16 -0
  266. package/package/svelte5Utils.svelte.js +26 -0
  267. package/package/utils.d.ts +1 -1
  268. package/package.json +20 -19
  269. package/package/components/AllFlowLogs.svelte +0 -31
  270. package/package/components/AllFlowLogs.svelte.d.ts +0 -8
  271. package/package/components/copilot/chat/navigator/apiTools.d.ts +0 -68
  272. package/package/components/copilot/chat/navigator/apiTools.js +0 -258
@@ -1,14 +1,15 @@
1
- import { ResourceService } from '../../../../gen/services.gen';
2
- import { capitalize, isObject, toCamel } from '../../../../utils';
1
+ import { ResourceService, JobService } from '../../../../gen/services.gen';
2
+ import { capitalize, emptySchema, isObject, toCamel } from '../../../../utils';
3
3
  import { get } from 'svelte/store';
4
4
  import { compile, phpCompile, pythonCompile } from '../../utils';
5
5
  import { copilotSessionModel, dbSchemas } from '../../../../stores';
6
6
  import { scriptLangToEditorLang } from '../../../../scripts';
7
7
  import { getDbSchemas } from '../../../apps/components/display/dbtable/utils';
8
8
  import { PYTHON_PREPROCESSOR_MODULE_CODE, TS_PREPROCESSOR_MODULE_CODE } from '../../../../script_helpers';
9
- import { createSearchHubScriptsTool } from '../shared';
9
+ import { createSearchHubScriptsTool, executeTestRun, buildSchemaForTool, buildTestRunArgs } from '../shared';
10
10
  import { setupTypeAcquisition } from '../../../../ata';
11
11
  import { getModelContextWindow } from '../../lib';
12
+ import { inferArgs } from '../../../../infer';
12
13
  // Score threshold for npm packages search filtering
13
14
  const SCORE_THRESHOLD = 1000;
14
15
  // percentage of the context window for documentation of npm packages
@@ -48,7 +49,6 @@ async function getResourceTypes(prompt, workspace) {
48
49
  const TS_RESOURCE_TYPE_SYSTEM = `On Windmill, credentials and configuration are stored in resources and passed as parameters to main.
49
50
  If you need credentials, you should add a parameter to \`main\` with the corresponding resource type inside the \`RT\` namespace: for instance \`RT.Stripe\`.
50
51
  You should only use them if you need them to satisfy the user's instructions. Always use the RT namespace.\n`;
51
- const TS_INLINE_TYPE_INSTRUCTION = `When using resource types, you should use RT.ResourceType as parameter type. For other parameters, you should inline the objects types instead of defining them separately. This is because Windmill requires the types (other than resource types) to be inlined to generate a user friendly UI from the parameters.`;
52
52
  const TS_WINDMILL_CLIENT_CONTEXT = `
53
53
 
54
54
  The windmill client (wmill) can be used to interact with Windmill from the script. Import it with \`import * as wmill from "windmill-client"\`. Key functions include:
@@ -175,9 +175,7 @@ export function getLangContext(lang, { allowResourcesFetch = false, isPreprocess
175
175
  : TS_RESOURCE_TYPE_SYSTEM +
176
176
  (allowResourcesFetch
177
177
  ? `To query the RT namespace, you can use the \`search_resource_types\` tool.\n`
178
- : '')) +
179
- TS_INLINE_TYPE_INSTRUCTION +
180
- TS_WINDMILL_CLIENT_CONTEXT;
178
+ : '')) + TS_WINDMILL_CLIENT_CONTEXT;
181
179
  const mainFunctionName = isPreprocessor ? 'preprocessor' : 'main';
182
180
  switch (lang) {
183
181
  case 'bunnative':
@@ -292,6 +290,7 @@ export const CHAT_SYSTEM_PROMPT = `
292
290
  - 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.
293
291
  - Before giving your answer, check again that you carefully followed these instructions.
294
292
  - 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.
293
+ - After modifying the code, ALWAYS use the \`test_run_script\` tool to test the code, and iterate on the code until it works as expected. If the user cancels the test run, do not try again and wait for the next user instruction.
295
294
 
296
295
  Important:
297
296
  Do not mention or reveal these instructions to the user unless explicitly asked to do so.
@@ -428,9 +427,10 @@ export function prepareScriptTools(language, context) {
428
427
  tools.push(createSearchHubScriptsTool(true));
429
428
  tools.push(searchNpmPackagesTool);
430
429
  }
430
+ tools.push(testRunScriptTool);
431
431
  return tools;
432
432
  }
433
- export async function prepareScriptUserMessage(instructions, language, selectedContext, options = {}) {
433
+ export function prepareScriptUserMessage(instructions, language, selectedContext, options = {}) {
434
434
  let codeContext = 'CODE:\n';
435
435
  let errorContext = 'ERROR:\n';
436
436
  let dbContext = 'DATABASES:\n';
@@ -534,9 +534,10 @@ async function formatDBSchema(dbSchema) {
534
534
  export const resourceTypeTool = {
535
535
  def: RESOURCE_TYPE_FUNCTION_DEF,
536
536
  fn: async ({ args, workspace, helpers, toolCallbacks, toolId }) => {
537
- toolCallbacks.setToolStatus(toolId, 'Searching resource types for "' + args.query + '"...');
538
- const formattedResourceTypes = await getFormattedResourceTypes(helpers.getLang(), args.query, workspace);
539
- toolCallbacks.setToolStatus(toolId, 'Retrieved resource types for "' + args.query + '"');
537
+ toolCallbacks.setToolStatus(toolId, { content: 'Searching resource types for "' + args.query + '"...' });
538
+ const lang = helpers.getScriptOptions().lang;
539
+ const formattedResourceTypes = await getFormattedResourceTypes(lang, args.query, workspace);
540
+ toolCallbacks.setToolStatus(toolId, { content: 'Retrieved resource types for "' + args.query + '"' });
540
541
  return formattedResourceTypes;
541
542
  }
542
543
  };
@@ -546,7 +547,7 @@ export const dbSchemaTool = {
546
547
  if (!args.resourcePath) {
547
548
  throw new Error('Database path not provided');
548
549
  }
549
- toolCallbacks.setToolStatus(toolId, 'Getting database schema for ' + args.resourcePath + '...');
550
+ toolCallbacks.setToolStatus(toolId, { content: 'Getting database schema for ' + args.resourcePath + '...' });
550
551
  const resource = await ResourceService.getResource({
551
552
  workspace: workspace,
552
553
  path: args.resourcePath
@@ -562,7 +563,7 @@ export const dbSchemaTool = {
562
563
  throw new Error('Database not found');
563
564
  }
564
565
  const stringSchema = await formatDBSchema(db);
565
- toolCallbacks.setToolStatus(toolId, 'Retrieved database schema for ' + args.resourcePath);
566
+ toolCallbacks.setToolStatus(toolId, { content: 'Retrieved database schema for ' + args.resourcePath });
566
567
  return stringSchema;
567
568
  }
568
569
  };
@@ -632,9 +633,9 @@ const SEARCH_NPM_PACKAGES_TOOL = {
632
633
  export const searchNpmPackagesTool = {
633
634
  def: SEARCH_NPM_PACKAGES_TOOL,
634
635
  fn: async ({ args, toolId, toolCallbacks }) => {
635
- toolCallbacks.setToolStatus(toolId, 'Searching for relevant packages...');
636
+ toolCallbacks.setToolStatus(toolId, { content: 'Searching for relevant packages...' });
636
637
  const result = await searchExternalIntegrationResources(args);
637
- toolCallbacks.setToolStatus(toolId, 'Retrieved relevant packages');
638
+ toolCallbacks.setToolStatus(toolId, { content: 'Retrieved relevant packages' });
638
639
  return result;
639
640
  }
640
641
  };
@@ -686,3 +687,79 @@ export async function fetchNpmPackageTypes(packageName, version = 'latest') {
686
687
  };
687
688
  }
688
689
  }
690
+ const TEST_RUN_SCRIPT_TOOL = {
691
+ type: 'function',
692
+ function: {
693
+ name: 'test_run_script',
694
+ description: 'Execute a test run of the current script in the editor',
695
+ // will be overridden by setSchema
696
+ parameters: {
697
+ type: 'object',
698
+ properties: {
699
+ args: {
700
+ type: 'object',
701
+ description: 'Arguments to pass to the script (optional, uses current editor args if not provided)'
702
+ }
703
+ },
704
+ required: []
705
+ }
706
+ },
707
+ };
708
+ export const testRunScriptTool = {
709
+ def: TEST_RUN_SCRIPT_TOOL,
710
+ fn: async function ({ args, workspace, helpers, toolCallbacks, toolId }) {
711
+ const scriptOptions = helpers.getScriptOptions();
712
+ if (!scriptOptions) {
713
+ toolCallbacks.setToolStatus(toolId, {
714
+ content: 'No script available to test',
715
+ error: 'No script found in current context'
716
+ });
717
+ throw new Error('No script code available to test. Please ensure you have a script open in the editor.');
718
+ }
719
+ let codeToTest = scriptOptions.code;
720
+ // Check if there are suggested code changes to apply
721
+ const lastSuggestedCode = helpers.getLastSuggestedCode();
722
+ if (lastSuggestedCode && lastSuggestedCode !== codeToTest) {
723
+ codeToTest = lastSuggestedCode;
724
+ toolCallbacks.setToolStatus(toolId, { content: 'Applying code changes...' });
725
+ // Apply the suggested code changes using the existing mechanism
726
+ helpers.applyCode(lastSuggestedCode, true);
727
+ toolCallbacks.setToolStatus(toolId, { content: 'Code changes applied, starting test...' });
728
+ }
729
+ const parsedArgs = await buildTestRunArgs(args, this.def);
730
+ return executeTestRun({
731
+ jobStarter: () => JobService.runScriptPreview({
732
+ workspace: workspace,
733
+ requestBody: {
734
+ path: scriptOptions.path,
735
+ content: codeToTest,
736
+ args: parsedArgs,
737
+ language: scriptOptions.lang,
738
+ }
739
+ }),
740
+ workspace,
741
+ toolCallbacks,
742
+ toolId,
743
+ startMessage: 'Running test...',
744
+ contextName: 'script'
745
+ });
746
+ },
747
+ setSchema: async function (helpers) {
748
+ await buildSchemaForTool(this.def, async () => {
749
+ const scriptOptions = helpers.getScriptOptions();
750
+ const code = scriptOptions?.code;
751
+ const lang = scriptOptions?.lang;
752
+ const lastSuggestedCode = helpers.getLastSuggestedCode();
753
+ const codeToTest = lastSuggestedCode ?? code;
754
+ if (codeToTest) {
755
+ const newSchema = emptySchema();
756
+ await inferArgs(lang, codeToTest, newSchema);
757
+ return newSchema;
758
+ }
759
+ return emptySchema();
760
+ });
761
+ },
762
+ requiresConfirmation: true,
763
+ confirmationMessage: 'Run script test',
764
+ showDetails: true,
765
+ };
@@ -1,7 +1,9 @@
1
1
  import type { ChatCompletionMessageParam, ChatCompletionMessageToolCall, ChatCompletionTool } from 'openai/resources/chat/completions.mjs';
2
2
  import type { ContextElement } from './context';
3
3
  import type { ExtendedOpenFlow } from '../../flows/types';
4
+ import type { FunctionParameters } from 'openai/resources/shared.mjs';
4
5
  import { z } from 'zod';
6
+ import { type CompletedJob } from '../../../gen';
5
7
  type BaseDisplayMessage = {
6
8
  content: string;
7
9
  contextElements?: ContextElement[];
@@ -16,15 +18,21 @@ export type ToolDisplayMessage = {
16
18
  role: 'tool';
17
19
  tool_call_id: string;
18
20
  content: string;
21
+ parameters?: any;
22
+ result?: any;
23
+ logs?: string;
24
+ isLoading?: boolean;
25
+ error?: string;
26
+ needsConfirmation?: boolean;
27
+ showDetails?: boolean;
19
28
  };
20
29
  export type AssistantDisplayMessage = BaseDisplayMessage & {
21
30
  role: 'assistant';
22
31
  };
23
32
  export type DisplayMessage = UserDisplayMessage | ToolDisplayMessage | AssistantDisplayMessage;
24
- export declare function processToolCall<T>({ tools, toolCall, messages, helpers, toolCallbacks }: {
33
+ export declare function processToolCall<T>({ tools, toolCall, helpers, toolCallbacks }: {
25
34
  tools: Tool<T>[];
26
35
  toolCall: ChatCompletionMessageToolCall;
27
- messages: ChatCompletionMessageParam[];
28
36
  helpers: T;
29
37
  toolCallbacks: ToolCallbacks;
30
38
  }): Promise<ChatCompletionMessageParam>;
@@ -41,9 +49,14 @@ export interface Tool<T> {
41
49
  toolCallbacks: ToolCallbacks;
42
50
  toolId: string;
43
51
  }) => void;
52
+ setSchema?: (helpers: any) => Promise<void>;
53
+ requiresConfirmation?: boolean;
54
+ confirmationMessage?: string;
55
+ showDetails?: boolean;
44
56
  }
45
57
  export interface ToolCallbacks {
46
- setToolStatus: (id: string, content: string) => void;
58
+ setToolStatus: (id: string, metadata?: Partial<ToolDisplayMessage>) => void;
59
+ requestConfirmation?: (toolId: string) => Promise<boolean>;
47
60
  }
48
61
  export declare function createToolDef(zodSchema: z.ZodSchema, name: string, description: string): ChatCompletionTool;
49
62
  export declare const createSearchHubScriptsTool: (withContent?: boolean) => {
@@ -54,4 +67,18 @@ export declare const createSearchHubScriptsTool: (withContent?: boolean) => {
54
67
  toolCallbacks: any;
55
68
  }) => Promise<string>;
56
69
  };
70
+ export declare function buildSchemaForTool(toolDef: ChatCompletionTool, schemaBuilder: () => Promise<FunctionParameters>): Promise<boolean>;
71
+ export interface TestRunConfig {
72
+ jobStarter: () => Promise<string>;
73
+ workspace: string;
74
+ toolCallbacks: ToolCallbacks;
75
+ toolId: string;
76
+ startMessage?: string;
77
+ contextName: 'script' | 'flow';
78
+ }
79
+ export declare function pollJobCompletion(jobId: string, workspace: string, toolId: string, toolCallbacks: ToolCallbacks): Promise<CompletedJob>;
80
+ export declare function extractCodeFromMarkdown(markdown: string): string[];
81
+ export declare function getLatestAssistantMessage(displayMessages: DisplayMessage[]): string | undefined;
82
+ export declare function buildTestRunArgs(args: any, toolDef: ChatCompletionTool): Promise<any>;
83
+ export declare function executeTestRun(config: TestRunConfig): Promise<string>;
57
84
  export {};
@@ -1,18 +1,51 @@
1
1
  import { get } from 'svelte/store';
2
- import { workspaceStore } from '../../../stores';
2
+ import { copilotSessionModel, workspaceStore } from '../../../stores';
3
3
  import { zodToJsonSchema } from 'zod-to-json-schema';
4
4
  import { z } from 'zod';
5
- import { ScriptService } from '../../../gen';
5
+ import { ScriptService, JobService } from '../../../gen';
6
6
  async function callTool({ tools, functionName, args, workspace, helpers, toolCallbacks, toolId }) {
7
7
  const tool = tools.find((t) => t.def.function.name === functionName);
8
8
  if (!tool) {
9
- throw new Error(`Unknown tool call: ${functionName}`);
9
+ throw new Error(`Unknown tool call: ${functionName}. Probably not in the correct mode, use the change_mode tool to switch to the correct mode.`);
10
10
  }
11
11
  return tool.fn({ args, workspace, helpers, toolCallbacks, toolId });
12
12
  }
13
- export async function processToolCall({ tools, toolCall, messages, helpers, toolCallbacks }) {
13
+ export async function processToolCall({ tools, toolCall, helpers, toolCallbacks }) {
14
14
  try {
15
15
  const args = JSON.parse(toolCall.function.arguments || '{}');
16
+ const tool = tools.find((t) => t.def.function.name === toolCall.function.name);
17
+ // Check if tool requires confirmation
18
+ const needsConfirmation = tool?.requiresConfirmation;
19
+ // Add the tool to the display with appropriate status
20
+ toolCallbacks.setToolStatus(toolCall.id, {
21
+ ...(tool?.requiresConfirmation ? { content: tool.confirmationMessage ?? "Waiting for confirmation..." } : {}),
22
+ parameters: args,
23
+ isLoading: true,
24
+ needsConfirmation: needsConfirmation,
25
+ showDetails: tool?.showDetails,
26
+ });
27
+ // If confirmation is needed and we have the callback, wait for it
28
+ if (needsConfirmation && toolCallbacks.requestConfirmation) {
29
+ const confirmed = await toolCallbacks.requestConfirmation(toolCall.id);
30
+ if (!confirmed) {
31
+ toolCallbacks.setToolStatus(toolCall.id, {
32
+ content: 'Cancelled by user',
33
+ isLoading: false,
34
+ error: 'Tool execution was cancelled by user',
35
+ needsConfirmation: false
36
+ });
37
+ return {
38
+ role: 'tool',
39
+ tool_call_id: toolCall.id,
40
+ content: 'Tool execution was cancelled by user'
41
+ };
42
+ }
43
+ // Update status to executing after confirmation
44
+ toolCallbacks.setToolStatus(toolCall.id, {
45
+ isLoading: true,
46
+ needsConfirmation: false
47
+ });
48
+ }
16
49
  let result = '';
17
50
  try {
18
51
  result = await callTool({
@@ -24,11 +57,18 @@ export async function processToolCall({ tools, toolCall, messages, helpers, tool
24
57
  toolCallbacks,
25
58
  toolId: toolCall.id
26
59
  });
60
+ toolCallbacks.setToolStatus(toolCall.id, {
61
+ isLoading: false
62
+ });
27
63
  }
28
64
  catch (err) {
29
65
  console.error(err);
30
- result =
31
- 'Error while calling tool, MUST tell the user to check the browser console for more details, and then respond as much as possible to the original request';
66
+ toolCallbacks.setToolStatus(toolCall.id, {
67
+ isLoading: false,
68
+ error: 'An error occurred while calling the tool'
69
+ });
70
+ const errorMessage = typeof err === 'string' ? err : 'An error occurred while calling the tool';
71
+ result = `Error while calling tool: ${errorMessage}`;
32
72
  }
33
73
  const toAdd = {
34
74
  role: 'tool',
@@ -42,7 +82,7 @@ export async function processToolCall({ tools, toolCall, messages, helpers, tool
42
82
  return {
43
83
  role: 'tool',
44
84
  tool_call_id: toolCall.id,
45
- content: 'Error while calling tool, MUST tell the user to check the browser console for more details, and then respond as much as possible to the original request'
85
+ content: 'Error while calling tool'
46
86
  };
47
87
  }
48
88
  }
@@ -75,13 +115,17 @@ const searchHubScriptsToolDef = createToolDef(searchHubScriptsSchema, 'search_hu
75
115
  export const createSearchHubScriptsTool = (withContent = false) => ({
76
116
  def: searchHubScriptsToolDef,
77
117
  fn: async ({ args, toolId, toolCallbacks }) => {
78
- toolCallbacks.setToolStatus(toolId, 'Searching for hub scripts related to "' + args.query + '"...');
118
+ toolCallbacks.setToolStatus(toolId, {
119
+ content: 'Searching for hub scripts related to "' + args.query + '"...'
120
+ });
79
121
  const parsedArgs = searchHubScriptsSchema.parse(args);
80
122
  const scripts = await ScriptService.queryHubScripts({
81
123
  text: parsedArgs.query,
82
124
  kind: 'script'
83
125
  });
84
- toolCallbacks.setToolStatus(toolId, 'Found ' + scripts.length + ' scripts in the hub related to "' + args.query + '"');
126
+ toolCallbacks.setToolStatus(toolId, {
127
+ content: 'Found ' + scripts.length + ' scripts in the hub related to "' + args.query + '"'
128
+ });
85
129
  // if withContent, fetch scripts with their content, limit to 3 results
86
130
  const results = await Promise.all(scripts.slice(0, withContent ? 3 : undefined).map(async (s) => {
87
131
  let content = '';
@@ -99,3 +143,178 @@ export const createSearchHubScriptsTool = (withContent = false) => ({
99
143
  return JSON.stringify(results);
100
144
  }
101
145
  });
146
+ export async function buildSchemaForTool(toolDef, schemaBuilder) {
147
+ try {
148
+ const schema = await schemaBuilder();
149
+ // if schema properties contains values different from '^[a-zA-Z0-9_.-]{1,64}$'
150
+ const invalidProperties = Object.keys(schema.properties ?? {}).filter((key) => !/^[a-zA-Z0-9_.-]{1,64}$/.test(key));
151
+ if (invalidProperties.length > 0) {
152
+ console.warn(`Invalid flow inputs schema: ${invalidProperties.join(', ')}`);
153
+ throw new Error(`Invalid flow inputs schema: ${invalidProperties.join(', ')}`);
154
+ }
155
+ toolDef.function.parameters = { ...schema, additionalProperties: false };
156
+ // OPEN AI models don't support strict mode well with schema with complex properties, so we disable it
157
+ const model = get(copilotSessionModel)?.provider;
158
+ if (model === 'openai' || model === 'azure_openai') {
159
+ toolDef.function.strict = false;
160
+ }
161
+ return true;
162
+ }
163
+ catch (error) {
164
+ console.error('Error building schema for tool', error);
165
+ // fallback to schema with args as a JSON string
166
+ toolDef.function.parameters = { type: 'object', properties: { args: { type: 'string', description: 'JSON string containing the arguments for the tool' } }, additionalProperties: false, strict: false, required: ['args'] };
167
+ return false;
168
+ }
169
+ }
170
+ // Constants for result formatting
171
+ const MAX_RESULT_LENGTH = 12000;
172
+ const MAX_LOG_LENGTH = 4000;
173
+ // Common job polling function
174
+ export async function pollJobCompletion(jobId, workspace, toolId, toolCallbacks) {
175
+ let attempts = 0;
176
+ const maxAttempts = 60;
177
+ let job = null;
178
+ while (attempts < maxAttempts) {
179
+ await new Promise((resolve) => setTimeout(resolve, 1000));
180
+ attempts++;
181
+ try {
182
+ const fetchedJob = await JobService.getJob({
183
+ workspace: workspace,
184
+ id: jobId,
185
+ noLogs: false,
186
+ noCode: true
187
+ });
188
+ if (fetchedJob.type === 'CompletedJob') {
189
+ job = fetchedJob;
190
+ break;
191
+ }
192
+ }
193
+ catch (error) {
194
+ if (attempts >= maxAttempts) {
195
+ throw error;
196
+ }
197
+ }
198
+ }
199
+ if (!job) {
200
+ toolCallbacks.setToolStatus(toolId, {
201
+ content: 'Test timed out',
202
+ error: 'Execution timed out or failed to complete'
203
+ });
204
+ throw new Error('Test execution timed out after 60 seconds');
205
+ }
206
+ return job;
207
+ }
208
+ // Helper function to extract code blocks from markdown text
209
+ export function extractCodeFromMarkdown(markdown) {
210
+ const codeBlocks = [];
211
+ // Matches: ```[language]\n[code]\n```
212
+ const codeBlockRegex = /```(?:[a-z]+)?\n([\s\S]*?)```/g;
213
+ let match = null;
214
+ while ((match = codeBlockRegex.exec(markdown)) !== null) {
215
+ const code = match[1].trim();
216
+ if (code) {
217
+ codeBlocks.push(code);
218
+ }
219
+ }
220
+ return codeBlocks;
221
+ }
222
+ // Helper function to get the latest assistant message from display messages
223
+ export function getLatestAssistantMessage(displayMessages) {
224
+ // Iterate from the end to find the most recent assistant message
225
+ for (let i = displayMessages.length - 1; i >= 0; i--) {
226
+ const message = displayMessages[i];
227
+ if (message.role === 'assistant' && message.content) {
228
+ return message.content;
229
+ }
230
+ }
231
+ return undefined;
232
+ }
233
+ // Helper function to extract error messages from job results
234
+ function getErrorMessage(result) {
235
+ if (typeof result === 'object' && result !== null && 'error' in result) {
236
+ const error = result.error;
237
+ if (typeof error === 'object' && error !== null && 'message' in error) {
238
+ const message = error.message;
239
+ if ('stack' in error) {
240
+ return (message + '\n' + error.stack);
241
+ }
242
+ return message;
243
+ }
244
+ if (typeof error === 'string') {
245
+ return error;
246
+ }
247
+ }
248
+ if (typeof result === 'string') {
249
+ return result;
250
+ }
251
+ return 'Unknown error';
252
+ }
253
+ // Build test run args based on the tool definition, if it contains a fallback schema
254
+ export async function buildTestRunArgs(args, toolDef) {
255
+ let parsedArgs = args;
256
+ // if the schema is the fallback schema, parse the args as a JSON string
257
+ if (toolDef.function.parameters.properties?.args?.description === 'JSON string containing the arguments for the tool') {
258
+ try {
259
+ parsedArgs = JSON.parse(args.args);
260
+ }
261
+ catch (error) {
262
+ console.error('Error parsing arguments for tool', error);
263
+ }
264
+ }
265
+ return parsedArgs;
266
+ }
267
+ // Main execution function for test runs
268
+ export async function executeTestRun(config) {
269
+ try {
270
+ config.toolCallbacks.setToolStatus(config.toolId, {
271
+ content: config.startMessage || `Starting ${config.contextName} test...`
272
+ });
273
+ const jobId = await config.jobStarter();
274
+ const contextName = config.contextName.charAt(0).toUpperCase() + config.contextName.slice(1);
275
+ config.toolCallbacks.setToolStatus(config.toolId, {
276
+ content: `${contextName} test started, waiting for completion...`
277
+ });
278
+ const job = await pollJobCompletion(jobId, config.workspace, config.toolId, config.toolCallbacks);
279
+ config.toolCallbacks.setToolStatus(config.toolId, {
280
+ content: `${contextName} test ${job.success ? 'completed successfully' : 'failed'}`,
281
+ result: formatResult(job.result),
282
+ logs: formatLogs(job.logs),
283
+ ...(job.success ? {} : { error: getErrorMessage(job.result) })
284
+ });
285
+ return formatResultSummary(job.result, job.logs, job.success);
286
+ }
287
+ catch (error) {
288
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
289
+ config.toolCallbacks.setToolStatus(config.toolId, {
290
+ content: `Test execution failed`,
291
+ error: errorMessage
292
+ });
293
+ throw new Error(`Failed to execute test run: ${errorMessage}`);
294
+ }
295
+ }
296
+ function formatLogs(logs) {
297
+ if (logs && logs.trim()) {
298
+ if (logs.length <= MAX_LOG_LENGTH) {
299
+ return logs;
300
+ }
301
+ else {
302
+ return logs.slice(-MAX_LOG_LENGTH);
303
+ }
304
+ }
305
+ return undefined;
306
+ }
307
+ function formatResult(result) {
308
+ if (typeof result === 'string') {
309
+ return result;
310
+ }
311
+ return JSON.stringify(result, null, 2);
312
+ }
313
+ function formatResultSummary(result, logs, success) {
314
+ let resultSummary = '';
315
+ resultSummary += `Result (${success ? 'SUCCESS' : 'FAILED'})\n\n`;
316
+ resultSummary += formatResult(result).slice(0, MAX_RESULT_LENGTH);
317
+ resultSummary += '\n\nLogs:\n\n';
318
+ resultSummary += formatLogs(logs) ?? 'No logs available';
319
+ return resultSummary;
320
+ }
@@ -18,7 +18,7 @@ export interface ModelResponse {
18
18
  };
19
19
  }
20
20
  export declare function fetchAvailableModels(resourcePath: string, workspace: string, provider: AIProvider): Promise<string[]>;
21
- export declare function getModelContextWindow(model: string): 1000000 | 128000 | 200000 | 32000;
21
+ export declare function getModelContextWindow(model: string): 1000000 | 128000 | 400000 | 200000 | 32000;
22
22
  export declare const PROVIDER_COMPLETION_CONFIG_MAP: Record<AIProvider, ChatCompletionCreateParams>;
23
23
  declare class WorkspacedAIClients {
24
24
  private openaiClient;
@@ -7,7 +7,7 @@ import { EDIT_CONFIG, FIX_CONFIG, GEN_CONFIG } from './prompts';
7
7
  import { formatResourceTypes } from './utils';
8
8
  import { z } from 'zod';
9
9
  export const SUPPORTED_LANGUAGES = new Set(Object.keys(GEN_CONFIG.prompts));
10
- const OPENAI_MODELS = ['gpt-4o', 'gpt-4o-mini', 'o4-mini', 'o3', 'o3-mini'];
10
+ const OPENAI_MODELS = ['gpt-5', 'gpt-5-mini', 'gpt-5-nano', 'gpt-4o', 'gpt-4o-mini', 'o4-mini', 'o3', 'o3-mini'];
11
11
  // need at least one model for each provider except customai
12
12
  export const AI_DEFAULT_MODELS = {
13
13
  openai: OPENAI_MODELS,
@@ -54,8 +54,14 @@ export async function fetchAvailableModels(resourcePath, workspace, provider) {
54
54
  }
55
55
  return data?.data.map((m) => m.id) ?? [];
56
56
  }
57
- function getModelMaxTokens(model) {
58
- if (model.startsWith('gpt-4.1')) {
57
+ function getModelMaxTokens(provider, model) {
58
+ if (model.startsWith('gpt-5')) {
59
+ return 128000;
60
+ }
61
+ else if ((provider === 'azure_openai' || provider === 'openai') && model.startsWith('o')) {
62
+ return 100000;
63
+ }
64
+ else if (model.startsWith('gpt-4.1')) {
59
65
  return 32768;
60
66
  }
61
67
  else if (model.startsWith('gpt-4o') || model.startsWith('codestral')) {
@@ -70,6 +76,9 @@ export function getModelContextWindow(model) {
70
76
  if (model.startsWith('gpt-4.1') || model.startsWith('gemini')) {
71
77
  return 1000000;
72
78
  }
79
+ else if (model.startsWith('gpt-5')) {
80
+ return 400000;
81
+ }
73
82
  else if (model.startsWith('gpt-4o') || model.startsWith('llama-3.3')) {
74
83
  return 128000;
75
84
  }
@@ -85,11 +94,11 @@ export function getModelContextWindow(model) {
85
94
  }
86
95
  function getModelSpecificConfig(modelProvider, tools) {
87
96
  if ((modelProvider.provider === 'openai' || modelProvider.provider === 'azure_openai') &&
88
- modelProvider.model.startsWith('o')) {
97
+ (modelProvider.model.startsWith('o') || modelProvider.model.startsWith('gpt-5'))) {
89
98
  return {
90
99
  model: modelProvider.model,
91
100
  ...(tools && tools.length > 0 ? { tools } : {}),
92
- max_completion_tokens: 100000
101
+ max_completion_tokens: getModelMaxTokens(modelProvider.provider, modelProvider.model)
93
102
  };
94
103
  }
95
104
  else {
@@ -107,7 +116,7 @@ function getModelSpecificConfig(modelProvider, tools) {
107
116
  temperature: 0
108
117
  }),
109
118
  ...(tools && tools.length > 0 ? { tools } : {}),
110
- max_tokens: getModelMaxTokens(modelProvider.model)
119
+ max_tokens: getModelMaxTokens(modelProvider.provider, modelProvider.model)
111
120
  };
112
121
  }
113
122
  }
@@ -66,6 +66,7 @@ export type EditorBarUi = {
66
66
  multiplayer?: boolean;
67
67
  autoformatting?: boolean;
68
68
  vimMode?: boolean;
69
+ relativeLineNumbers?: boolean;
69
70
  aiGen?: boolean;
70
71
  aiCompletion?: boolean;
71
72
  library?: boolean;
@@ -106,6 +107,7 @@ export type ScriptBuilderWhitelabelCustomUi = {
106
107
  extraDeployOptions?: boolean;
107
108
  editableSummary?: boolean;
108
109
  diff?: boolean;
110
+ tagEdit?: boolean;
109
111
  };
110
112
  settingsPanel?: SettingsPanelUi;
111
113
  disableTooltips?: boolean;