windmill-components 1.700.1 → 1.700.3

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 (77) hide show
  1. package/dist/appPolicy/myFunction.es.js +1337 -0
  2. package/dist/sharedUtils/common.d.ts +2 -5
  3. package/dist/sharedUtils/components/apps/components/display/dbtable/queries/select.d.ts +0 -2
  4. package/dist/sharedUtils/components/apps/components/display/dbtable/utils.d.ts +3 -14
  5. package/dist/sharedUtils/components/apps/editor/appPolicy.d.ts +1 -1
  6. package/dist/sharedUtils/components/apps/editor/appUtilsS3.d.ts +1 -12
  7. package/dist/sharedUtils/components/apps/editor/component/components.d.ts +2 -68
  8. package/dist/sharedUtils/components/apps/inputType.d.ts +2 -4
  9. package/dist/sharedUtils/components/apps/sharedTypes.d.ts +0 -2
  10. package/dist/sharedUtils/components/dbTypes.d.ts +0 -3
  11. package/dist/sharedUtils/components/raw_apps/rawAppPolicy.d.ts +1 -1
  12. package/dist/sharedUtils/components/raw_apps/utils.d.ts +1 -1
  13. package/dist/sharedUtils/components/triggers/utils.d.ts +3 -2
  14. package/dist/sharedUtils/gen/schemas.gen.d.ts +71 -915
  15. package/dist/sharedUtils/gen/services.gen.d.ts +23 -329
  16. package/dist/sharedUtils/gen/types.gen.d.ts +141 -1870
  17. package/dist/sharedUtils/hub.d.ts +0 -1
  18. package/dist/sharedUtils/jsr.json +5 -5
  19. package/dist/sharedUtils/lib.d.ts +1 -1
  20. package/dist/sharedUtils/lib.es.js +79 -241
  21. package/dist/sharedUtils/package.json +11 -11
  22. package/dist/sharedUtils/stores.d.ts +0 -1
  23. package/dist/sharedUtils/svelte5Utils.svelte.d.ts +1 -32
  24. package/dist/sharedUtils/utils.d.ts +4 -19
  25. package/package/components/DisplayResultControlBar.svelte +26 -11
  26. package/package/components/JobArgs.svelte +43 -24
  27. package/package/components/ShareModal.svelte.d.ts +1 -1
  28. package/package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +0 -3
  29. package/package/components/copilot/CustomAIPrompts.svelte +3 -2
  30. package/package/components/copilot/chat/AIChatInput.svelte +2 -0
  31. package/package/components/copilot/chat/AIChatManager.svelte.js +52 -14
  32. package/package/components/copilot/chat/CreatedResourceActionDrawers.svelte +15 -0
  33. package/package/components/copilot/chat/ToolMessageActions.svelte +4 -2
  34. package/package/components/copilot/chat/app/core.js +2 -30
  35. package/package/components/copilot/chat/flow/core.js +13 -351
  36. package/package/components/copilot/chat/flow/editableFlowJson.d.ts +52 -0
  37. package/package/components/copilot/chat/flow/editableFlowJson.js +328 -0
  38. package/package/components/copilot/chat/flow/inlineScriptsUtils.js +2 -2
  39. package/package/components/copilot/chat/global/core.d.ts +5 -0
  40. package/package/components/copilot/chat/global/core.js +1739 -0
  41. package/package/components/copilot/chat/global/core.test.d.ts +1 -0
  42. package/package/components/copilot/chat/global/core.test.js +123 -0
  43. package/package/components/copilot/chat/global/deployRequests.d.ts +7 -0
  44. package/package/components/copilot/chat/global/deployRequests.js +76 -0
  45. package/package/components/copilot/chat/global/deployRequests.test.d.ts +1 -0
  46. package/package/components/copilot/chat/global/deployRequests.test.js +142 -0
  47. package/package/components/copilot/chat/global/draftStore.svelte.d.ts +55 -0
  48. package/package/components/copilot/chat/global/draftStore.svelte.js +78 -0
  49. package/package/components/copilot/chat/global/draftStore.test.d.ts +1 -0
  50. package/package/components/copilot/chat/global/draftStore.test.js +44 -0
  51. package/package/components/copilot/chat/global/gate.d.ts +1 -0
  52. package/package/components/copilot/chat/global/gate.js +27 -0
  53. package/package/components/copilot/chat/shared.d.ts +16 -2
  54. package/package/components/copilot/chat/shared.js +40 -0
  55. package/package/components/copilot/chat/workspaceToolsZod.gen.d.ts +28 -9
  56. package/package/components/copilot/chat/workspaceToolsZod.gen.js +19 -0
  57. package/package/components/raw_apps/templates.d.ts +77 -0
  58. package/package/components/raw_apps/templates.js +618 -0
  59. package/package/components/runs/runsFilter.d.ts +1 -1
  60. package/package/components/settings/AIPromptsModal.svelte +5 -2
  61. package/package/components/triggers/azure/AzureTriggerEditorConfigSection.svelte.d.ts +1 -1
  62. package/package/gen/core/OpenAPI.js +1 -1
  63. package/package/gen/schemas.gen.d.ts +37 -355
  64. package/package/gen/schemas.gen.js +39 -359
  65. package/package/gen/services.gen.d.ts +4 -280
  66. package/package/gen/services.gen.js +7 -565
  67. package/package/gen/types.gen.d.ts +77 -1135
  68. package/package/system_prompts/index.d.ts +2 -0
  69. package/package/system_prompts/index.js +8 -0
  70. package/package/system_prompts/prompts.d.ts +2 -0
  71. package/package/system_prompts/prompts.js +381 -0
  72. package/package/utils/downloadFile.d.ts +6 -4
  73. package/package/utils/downloadFile.js +9 -15
  74. package/package/utils_deployable.d.ts +5 -318
  75. package/package.json +1 -1
  76. package/dist/sharedUtils/components/assets/lib.d.ts +0 -25
  77. package/dist/sharedUtils/components/icons/index.d.ts +0 -101
@@ -1,208 +1,15 @@
1
1
  import { ScriptService, JobService } from '../../../../gen';
2
2
  import { z } from 'zod';
3
3
  import { createDbSchemaTool, getFormattedResourceTypes, getLangContext, SUPPORTED_CHAT_SCRIPT_LANGUAGES } from '../script/core';
4
- import { createSearchHubScriptsTool, createToolDef, executeTestRun, buildSchemaForTool, buildTestRunArgs, buildContextString, applyCodePiecesToFlowModules, SPECIAL_MODULE_IDS, formatScriptLintResult, createSearchWorkspaceTool, createGetRunnableDetailsTool } from '../shared';
4
+ import { createSearchHubScriptsTool, createToolDef, findAndReplace, executeTestRun, buildSchemaForTool, buildTestRunArgs, buildContextString, applyCodePiecesToFlowModules, SPECIAL_MODULE_IDS, formatScriptLintResult, createSearchWorkspaceTool, createGetRunnableDetailsTool } from '../shared';
5
5
  import { createWorkspaceMutationTools } from '../workspaceTools';
6
6
  import { findModuleInFlow, findModuleInModules } from '../../../flows/flowTree';
7
7
  import { createInlineScriptSession } from './inlineScriptsUtils';
8
8
  import { validateFlowGroups } from './helperUtils';
9
- import { flowModuleSchema, flowModulesSchema } from './openFlowZod.gen';
9
+ import { flowModuleSchema } from './openFlowZod.gen';
10
10
  import { collectAllFlowModuleIdsFromModules } from '../../../flows/flowTree';
11
+ import { buildEditableFlowJson as buildEditableFlowJsonBase, validateEditableFlowJson, validateFlowModules, validateFlowSchema } from './editableFlowJson';
11
12
  import { FLOW_CHAT_SPECIAL_MODULES, getFlowPrompt } from '../../../../system_prompts';
12
- /**
13
- * Navigate to a schema at a given path, handling arrays, objects, unions, and wrappers.
14
- * Uses Zod 4 internal structure.
15
- * @param schema The Zod schema to navigate
16
- * @param path The path to navigate
17
- * @param data Optional actual data to help resolve discriminated unions
18
- */
19
- function getSchemaAtPath(schema, path, data) {
20
- let current = schema;
21
- let currentData = data;
22
- for (let i = 0; i < path.length; i++) {
23
- const segment = path[i];
24
- if (!current || !current._def)
25
- return null;
26
- let type = current._def.type;
27
- // Unwrap optional/nullable/default/catch
28
- while (['optional', 'nullable', 'default', 'catch'].includes(type)) {
29
- current = current._def.innerType;
30
- if (!current || !current._def)
31
- return null;
32
- type = current._def.type;
33
- }
34
- // Handle arrays
35
- if (type === 'array') {
36
- if (typeof segment === 'number') {
37
- current = current._def.element;
38
- if (currentData && Array.isArray(currentData)) {
39
- currentData = currentData[segment];
40
- }
41
- continue;
42
- }
43
- // If segment is not a number, continue into element type
44
- current = current._def.element;
45
- i--;
46
- continue;
47
- }
48
- // Handle objects
49
- if (type === 'object') {
50
- const shape = current._def.shape;
51
- const key = String(segment);
52
- if (shape && key in shape) {
53
- current = shape[key];
54
- if (currentData && typeof currentData === 'object') {
55
- currentData = currentData[key];
56
- }
57
- continue;
58
- }
59
- return null;
60
- }
61
- // Handle discriminated unions (shows as 'union' in Zod 4)
62
- if (type === 'union') {
63
- const options = current._def.options;
64
- if (options) {
65
- // If we have data, try to find the correct union option based on discriminator
66
- if (currentData && typeof currentData === 'object') {
67
- // Check for common discriminator fields
68
- const typeValue = currentData.type;
69
- if (typeValue) {
70
- // Find option that matches this type
71
- for (const option of options) {
72
- const optionShape = option._def?.shape;
73
- const optionType = optionShape?.type?._def?.values?.[0];
74
- if (optionType === typeValue) {
75
- const remainingPath = path.slice(i);
76
- const result = getSchemaAtPath(option, remainingPath, currentData);
77
- if (result)
78
- return result;
79
- }
80
- }
81
- }
82
- }
83
- // Fallback: try to find a matching schema in any of the options
84
- for (const option of options) {
85
- const remainingPath = path.slice(i);
86
- const result = getSchemaAtPath(option, remainingPath, currentData);
87
- if (result)
88
- return result;
89
- }
90
- }
91
- return null;
92
- }
93
- // Handle record - any string key accesses the value type
94
- if (type === 'record') {
95
- current = current._def.valueType;
96
- if (!current)
97
- return null;
98
- if (currentData && typeof currentData === 'object') {
99
- currentData = currentData[segment];
100
- }
101
- continue;
102
- }
103
- return null;
104
- }
105
- return current;
106
- }
107
- /**
108
- * Format a JSON Schema object into a concise human-readable string for error messages.
109
- * Prioritizes structural information (object shapes, enums) over descriptions.
110
- */
111
- function formatJsonSchemaForError(jsonSchema) {
112
- // For objects, show structure (more actionable than description)
113
- if (jsonSchema.type === 'object' && jsonSchema.properties) {
114
- const props = Object.entries(jsonSchema.properties)
115
- .slice(0, 5) // Limit to 5 properties
116
- .map(([k, v]) => {
117
- // Include enum values for string properties if available
118
- if (v.enum) {
119
- return `${k}: ${v.enum.map((e) => JSON.stringify(e)).join('|')}`;
120
- }
121
- return `${k}: ${v.type || 'any'}`;
122
- })
123
- .join(', ');
124
- const moreProps = Object.keys(jsonSchema.properties).length > 5
125
- ? `, ... (${Object.keys(jsonSchema.properties).length - 5} more)`
126
- : '';
127
- const required = jsonSchema.required?.length
128
- ? ` (required: ${jsonSchema.required.join(', ')})`
129
- : '';
130
- return `{ ${props}${moreProps} }${required}`;
131
- }
132
- if (jsonSchema.const !== undefined) {
133
- return JSON.stringify(jsonSchema.const);
134
- }
135
- if (jsonSchema.enum) {
136
- return `one of: ${jsonSchema.enum.map((v) => JSON.stringify(v)).join(', ')}`;
137
- }
138
- if (jsonSchema.oneOf) {
139
- return jsonSchema.oneOf.map((s) => formatJsonSchemaForError(s)).join(' | ');
140
- }
141
- if (jsonSchema.anyOf) {
142
- return jsonSchema.anyOf.map((s) => formatJsonSchemaForError(s)).join(' | ');
143
- }
144
- // Fall back to description for non-structural types
145
- if (jsonSchema.description) {
146
- return jsonSchema.description;
147
- }
148
- return jsonSchema.type || JSON.stringify(jsonSchema);
149
- }
150
- /**
151
- * Extract a human-readable description of what a schema expects.
152
- * For objects, prefers showing the actual structure over descriptions.
153
- * For simpler types, uses description if available.
154
- */
155
- function getExpectedFormat(schema) {
156
- if (!schema || !schema._def)
157
- return null;
158
- let current = schema;
159
- // Unwrap optional/nullable to get inner type
160
- while (current._def.type === 'optional' || current._def.type === 'nullable') {
161
- current = current._def.innerType;
162
- if (!current || !current._def)
163
- break;
164
- }
165
- // Try JSON Schema representation first for objects (more actionable than descriptions)
166
- try {
167
- const jsonSchema = z.toJSONSchema(schema);
168
- // Skip if it's just a schema with no useful info
169
- if (Object.keys(jsonSchema).length <= 1 ||
170
- (Object.keys(jsonSchema).length === 1 && jsonSchema.$schema)) {
171
- return null;
172
- }
173
- const formatted = formatJsonSchemaForError(jsonSchema);
174
- if (formatted && formatted !== 'unknown' && !formatted.startsWith('{')) {
175
- return formatted;
176
- }
177
- // For objects, only return if it has meaningful properties
178
- if (formatted && formatted.startsWith('{') && formatted !== '{ }') {
179
- return formatted;
180
- }
181
- }
182
- catch {
183
- // Ignore errors from toJSONSchema
184
- }
185
- return null;
186
- }
187
- function countExactMatches(content, search) {
188
- if (search.length === 0) {
189
- return 0;
190
- }
191
- let count = 0;
192
- let index = 0;
193
- while ((index = content.indexOf(search, index)) !== -1) {
194
- count++;
195
- index += search.length;
196
- }
197
- return count;
198
- }
199
- function replaceFirstExactMatch(content, search, replace) {
200
- const index = content.indexOf(search);
201
- if (index === -1) {
202
- return content;
203
- }
204
- return content.slice(0, index) + replace + content.slice(index + search.length);
205
- }
206
13
  function formatEmptyInlineScriptWarning({ emptyInlineScriptModuleIds }) {
207
14
  if (emptyInlineScriptModuleIds.length === 0) {
208
15
  return '';
@@ -210,154 +17,18 @@ function formatEmptyInlineScriptWarning({ emptyInlineScriptModuleIds }) {
210
17
  const moduleList = emptyInlineScriptModuleIds.map((id) => `'${id}'`).join(', ');
211
18
  return ` Warning: inline scripts ${moduleList} are empty for now. Use set_module_code to fill them in.`;
212
19
  }
213
- function validateFlowModules(rawModules) {
214
- if (!Array.isArray(rawModules)) {
215
- throw new Error('Flow modules must be an array');
216
- }
217
- const parsedModules = rawModules;
218
- const result = flowModulesSchema.safeParse(parsedModules);
219
- if (!result.success) {
220
- const errors = result.error.issues.slice(0, 5).map((e) => {
221
- const path = e.path;
222
- // Try to find module id for better context
223
- const moduleIndex = typeof path[0] === 'number' ? path[0] : undefined;
224
- const moduleId = moduleIndex !== undefined ? parsedModules[moduleIndex]?.id : undefined;
225
- const fieldPath = path.slice(1).join('.');
226
- let message = e.message;
227
- if (e.code === 'invalid_type') {
228
- // Zod 4 message already contains "expected X, received Y"
229
- // Try to extract expected format from schema, passing actual data
230
- // to help resolve discriminated unions correctly
231
- const targetSchema = getSchemaAtPath(flowModulesSchema, path, parsedModules);
232
- if (targetSchema) {
233
- const expectedFormat = getExpectedFormat(targetSchema);
234
- if (expectedFormat) {
235
- message += `\n Expected format: ${expectedFormat}`;
236
- }
237
- }
238
- }
239
- if (moduleId) {
240
- return `Module "${moduleId}" -> ${fieldPath}: ${message}`;
241
- }
242
- return `${path.join('.')}: ${message}`;
243
- });
244
- throw new Error(`Invalid flow modules:\n${errors.join('\n')}`);
245
- }
246
- const ids = collectAllFlowModuleIdsFromModules(parsedModules);
247
- if (ids.length !== new Set(ids).size) {
248
- throw new Error('Duplicate module IDs found in flow');
249
- }
250
- const reservedIds = ids.filter((id) => id === SPECIAL_MODULE_IDS.PREPROCESSOR || id === SPECIAL_MODULE_IDS.FAILURE);
251
- if (reservedIds.length > 0) {
252
- throw new Error('Special modules must be provided via preprocessor_module and failure_module, not inside modules');
253
- }
254
- return parsedModules;
255
- }
256
- function validateFlowSchema(rawSchema) {
257
- if (rawSchema == null) {
258
- return null;
259
- }
260
- if (typeof rawSchema !== 'object' || Array.isArray(rawSchema)) {
261
- throw new Error('Flow schema must be an object or null');
262
- }
263
- return rawSchema;
264
- }
265
- function validateOptionalFlowModule(rawModule, fieldName) {
266
- if (rawModule == null) {
267
- return null;
268
- }
269
- const result = flowModuleSchema.safeParse(rawModule);
270
- if (!result.success) {
271
- const error = result.error.issues[0];
272
- throw new Error(`Invalid ${fieldName}: ${error?.message ?? 'unknown error'}`);
273
- }
274
- return result.data;
275
- }
276
- function validateEditableFlowJson(rawFlow) {
277
- if (!rawFlow || typeof rawFlow !== 'object' || Array.isArray(rawFlow)) {
278
- throw new Error('Flow JSON must be an object');
279
- }
280
- const flow = rawFlow;
281
- const modules = validateFlowModules(flow.modules);
282
- const schema = validateFlowSchema(flow.schema);
283
- const preprocessorModule = validateOptionalFlowModule(flow.preprocessor_module, 'preprocessor_module');
284
- const failureModule = validateOptionalFlowModule(flow.failure_module, 'failure_module');
285
- const groupModuleIds = new Set(collectAllFlowModuleIdsFromModules(modules));
286
- const groups = validateFlowGroups(flow.groups, groupModuleIds);
287
- if (preprocessorModule) {
288
- if (preprocessorModule.id !== SPECIAL_MODULE_IDS.PREPROCESSOR) {
289
- throw new Error(`Invalid preprocessor_module: id must be "${SPECIAL_MODULE_IDS.PREPROCESSOR}"`);
290
- }
291
- if (preprocessorModule.value.type !== 'rawscript' &&
292
- preprocessorModule.value.type !== 'script') {
293
- throw new Error('Invalid preprocessor_module: only "rawscript" and "script" modules are supported');
294
- }
295
- }
296
- if (failureModule) {
297
- if (failureModule.id !== SPECIAL_MODULE_IDS.FAILURE) {
298
- throw new Error(`Invalid failure_module: id must be "${SPECIAL_MODULE_IDS.FAILURE}"`);
299
- }
300
- if (failureModule.value.type !== 'rawscript' && failureModule.value.type !== 'script') {
301
- throw new Error('Invalid failure_module: only "rawscript" and "script" modules are supported');
302
- }
303
- }
304
- const ids = new Set(collectAllFlowModuleIdsFromModules(modules));
305
- if (preprocessorModule) {
306
- if (ids.has(preprocessorModule.id)) {
307
- throw new Error(`Duplicate module ID found in preprocessor_module: ${preprocessorModule.id}`);
308
- }
309
- ids.add(preprocessorModule.id);
310
- }
311
- if (failureModule && ids.has(failureModule.id)) {
312
- throw new Error(`Duplicate module ID found in failure_module: ${failureModule.id}`);
313
- }
314
- return {
315
- modules,
316
- schema,
317
- preprocessor_module: preprocessorModule,
318
- failure_module: failureModule,
319
- groups
320
- };
321
- }
20
+ /**
21
+ * Build the agent-facing compact view of a flow, with editor-only post-processing
22
+ * (insert `[#START]` / `[#END]` markers around code pieces selected as context).
23
+ * Delegates to the shared `buildEditableFlowJson` for the rest.
24
+ */
322
25
  function buildEditableFlowJson(flow, inlineScriptSession, selectedContext = []) {
26
+ const json = buildEditableFlowJsonBase({ value: flow.value, schema: flow.schema }, inlineScriptSession);
323
27
  const codePieces = selectedContext.filter((c) => c.type === 'flow_module_code_piece');
324
- const optimizedModules = inlineScriptSession
325
- ? inlineScriptSession.extractAndReplaceInlineScripts(flow.value.modules)
326
- : flow.value.modules;
327
- const modules = applyCodePiecesToFlowModules(codePieces, optimizedModules);
328
- let preprocessorModule = flow.value.preprocessor_module;
329
- if (preprocessorModule?.value?.type === 'rawscript' &&
330
- preprocessorModule.value.content &&
331
- inlineScriptSession) {
332
- inlineScriptSession.set(preprocessorModule.id, preprocessorModule.value.content);
333
- preprocessorModule = {
334
- ...preprocessorModule,
335
- value: {
336
- ...preprocessorModule.value,
337
- content: `inline_script.${preprocessorModule.id}`
338
- }
339
- };
28
+ if (codePieces.length === 0) {
29
+ return json;
340
30
  }
341
- let failureModule = flow.value.failure_module;
342
- if (failureModule?.value?.type === 'rawscript' &&
343
- failureModule.value.content &&
344
- inlineScriptSession) {
345
- inlineScriptSession.set(failureModule.id, failureModule.value.content);
346
- failureModule = {
347
- ...failureModule,
348
- value: {
349
- ...failureModule.value,
350
- content: `inline_script.${failureModule.id}`
351
- }
352
- };
353
- }
354
- return {
355
- modules,
356
- schema: flow.schema ?? null,
357
- preprocessor_module: preprocessorModule ?? null,
358
- failure_module: failureModule ?? null,
359
- groups: flow.value.groups ?? null
360
- };
31
+ return { ...json, modules: applyCodePiecesToFlowModules(codePieces, json.modules) };
361
32
  }
362
33
  const langSchema = z.enum(SUPPORTED_CHAT_SCRIPT_LANGUAGES);
363
34
  const resourceTypeToolSchema = z.object({
@@ -710,19 +381,10 @@ export const flowTools = [
710
381
  // then copy extracted inline scripts back into the helper session before applying the patch.
711
382
  const inlineScriptSession = createInlineScriptSession();
712
383
  const currentFlowJson = JSON.stringify(buildEditableFlowJson(flow, inlineScriptSession));
713
- const matchCount = countExactMatches(currentFlowJson, oldString);
714
- if (matchCount === 0) {
715
- throw new Error('old_string was not found in the current flow JSON.');
716
- }
717
- if (!replaceAll && matchCount !== 1) {
718
- throw new Error(`old_string matched ${matchCount} locations. Make it more specific or set replace_all to true.`);
719
- }
720
384
  toolCallbacks.setToolStatus(toolId, {
721
385
  content: 'Applying JSON patch...'
722
386
  });
723
- const updatedFlowJson = replaceAll
724
- ? currentFlowJson.split(oldString).join(newString)
725
- : replaceFirstExactMatch(currentFlowJson, oldString, newString);
387
+ const updatedFlowJson = findAndReplace(currentFlowJson, oldString, newString, replaceAll, 'current flow JSON');
726
388
  let parsedFlow;
727
389
  try {
728
390
  parsedFlow = validateEditableFlowJson(JSON.parse(updatedFlowJson));
@@ -0,0 +1,52 @@
1
+ import { z } from 'zod';
2
+ import type { FlowModule, FlowValue } from '../../../../gen';
3
+ import type { InlineScriptSession } from './inlineScriptsUtils';
4
+ import { type FlowGroup } from './helperUtils';
5
+ /**
6
+ * Compact, agent-friendly representation of a flow.
7
+ *
8
+ * Inline rawscript content is replaced with `inline_script.<moduleId>` placeholders
9
+ * by `buildEditableFlowJson` so flows stay short in tool I/O. Use the matching
10
+ * InlineScriptSession to recover the actual content.
11
+ */
12
+ export type EditableFlowJson = {
13
+ modules: FlowModule[];
14
+ schema: Record<string, any> | null;
15
+ preprocessor_module: FlowModule | null;
16
+ failure_module: FlowModule | null;
17
+ groups: FlowGroup[] | null;
18
+ };
19
+ /** Optional input to the rich-error path of `validateEditableFlowJson`. */
20
+ type SchemaErrorContext = {
21
+ /** Custom modules schema to validate against (defaults to flowModulesSchema). */
22
+ modulesSchema?: z.ZodTypeAny;
23
+ };
24
+ export declare function validateFlowModules(rawModules: unknown, ctx?: SchemaErrorContext): FlowModule[];
25
+ export declare function validateFlowSchema(rawSchema: unknown): Record<string, any> | null;
26
+ /**
27
+ * Parse and validate a raw object as an `EditableFlowJson`. Validates module
28
+ * shape, schema shape, optional special modules (with their reserved ids),
29
+ * groups, and that no module ids collide.
30
+ */
31
+ export declare function validateEditableFlowJson(rawFlow: unknown, ctx?: SchemaErrorContext): EditableFlowJson;
32
+ /**
33
+ * Build the agent-facing compact view of a flow. When an `InlineScriptSession`
34
+ * is provided, every rawscript module's `content` is moved into the session
35
+ * and replaced with the placeholder `inline_script.<moduleId>` (preprocessor
36
+ * and failure modules included).
37
+ */
38
+ export declare function buildEditableFlowJson(flow: {
39
+ value: FlowValue;
40
+ schema?: Record<string, any> | null | undefined;
41
+ }, inlineScriptSession?: InlineScriptSession): EditableFlowJson;
42
+ /**
43
+ * Inverse of `buildEditableFlowJson`. Replaces `inline_script.<moduleId>`
44
+ * placeholders in `editable.modules` and the special modules with the content
45
+ * stored in `session`. Other fields on the original FlowValue (`same_worker`,
46
+ * `concurrent_limit`, etc.) are preserved.
47
+ *
48
+ * Pair with `buildEditableFlowJson` for round-trip patches: extract → patch
49
+ * the compact view → restore.
50
+ */
51
+ export declare function applyEditableFlowJsonToFlow(originalValue: FlowValue, editable: EditableFlowJson, session: InlineScriptSession): FlowValue;
52
+ export {};