windmill-cli 1.711.0 → 1.713.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 (2) hide show
  1. package/esm/main.js +74 -696
  2. package/package.json +1 -1
package/esm/main.js CHANGED
@@ -16772,7 +16772,7 @@ var init_OpenAPI = __esm(() => {
16772
16772
  PASSWORD: undefined,
16773
16773
  TOKEN: getEnv3("WM_TOKEN"),
16774
16774
  USERNAME: undefined,
16775
- VERSION: "1.711.0",
16775
+ VERSION: "1.713.0",
16776
16776
  WITH_CREDENTIALS: true,
16777
16777
  interceptors: {
16778
16778
  request: new Interceptors,
@@ -64056,6 +64056,7 @@ async function readModulesFromDisk(moduleFolderPath, defaultTs, folderLayout = f
64056
64056
  }
64057
64057
  async function createScript2(bundleContent, workspaceId, body, workspace) {
64058
64058
  const start = performance.now();
64059
+ body = { ...body, skip_draft_deletion: true };
64059
64060
  const skipIfNoop = "skip_if_noop=true";
64060
64061
  const extraHeaders = getHeaders2();
64061
64062
  if (!bundleContent) {
@@ -64750,7 +64751,8 @@ async function setPermissionedAs(opts, scriptPath, email) {
64750
64751
  `) : remote.lock ?? undefined,
64751
64752
  parent_hash: remote.hash,
64752
64753
  on_behalf_of_email: email,
64753
- preserve_on_behalf_of: true
64754
+ preserve_on_behalf_of: true,
64755
+ skip_draft_deletion: true
64754
64756
  }
64755
64757
  });
64756
64758
  info(colors.green(`Updated permissioned_as for script ${scriptPath} to ${email}`));
@@ -67379,6 +67381,14 @@ async function pull(opts) {
67379
67381
  checkoutGitSyncDeployBranch(deployBranch);
67380
67382
  }
67381
67383
  if (opts.onlyCreateBranch) {
67384
+ gitSyncDeployPush({
67385
+ items: deployItems,
67386
+ authorName: process.env["WM_USERNAME"] || "windmill",
67387
+ authorEmail: process.env["WM_EMAIL"] || "windmill@windmill.dev",
67388
+ committerName: opts.gitCommitterName,
67389
+ committerEmail: opts.gitCommitterEmail,
67390
+ onlyCreateBranch: true
67391
+ });
67382
67392
  return;
67383
67393
  }
67384
67394
  }
@@ -67662,9 +67672,12 @@ function prettyChanges(changes, specificItems, branchOverride, folderDefaultAnno
67662
67672
  } else if (change.name === "deleted") {
67663
67673
  info(colors.red(`- ${getTypeStrFromPath(change.path)} ` + displayPath + colors.gray(wsNote)));
67664
67674
  } else if (change.name === "edited") {
67665
- info(colors.yellow(`~ ${getTypeStrFromPath(change.path)} ` + displayPath + colors.gray(wsNote) + (change.codebase ? ` (codebase changed)` : "")));
67675
+ const changeType = getTypeStrFromPath(change.path);
67676
+ info(colors.yellow(`~ ${changeType} ` + displayPath + colors.gray(wsNote) + (change.codebase ? ` (codebase changed)` : "")));
67666
67677
  if (change.before != change.after) {
67667
- if (change.path.endsWith(".yaml")) {
67678
+ if (changeType === "encryption_key") {
67679
+ showDiff(redactEncryptionKey(change.before), redactEncryptionKey(change.after));
67680
+ } else if (change.path.endsWith(".yaml")) {
67668
67681
  try {
67669
67682
  showDiff(import_yaml11.stringify(yamlParseContent(change.path, change.before), yamlOptions), import_yaml11.stringify(yamlParseContent(change.path, change.after), yamlOptions));
67670
67683
  } catch {
@@ -69951,6 +69964,7 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
69951
69964
  summary: localApp.summary,
69952
69965
  policy: appForPolicy.policy,
69953
69966
  deployment_message: message,
69967
+ skip_draft_deletion: true,
69954
69968
  ...localApp.custom_path ? { custom_path: localApp.custom_path } : {}
69955
69969
  },
69956
69970
  js,
@@ -69969,6 +69983,7 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
69969
69983
  summary: localApp.summary,
69970
69984
  policy: appForPolicy.policy,
69971
69985
  deployment_message: message,
69986
+ skip_draft_deletion: true,
69972
69987
  ...localApp.custom_path ? { custom_path: localApp.custom_path } : {}
69973
69988
  },
69974
69989
  js,
@@ -72868,7 +72883,8 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
72868
72883
  requestBody: {
72869
72884
  deployment_message: message,
72870
72885
  ...localAppBody,
72871
- ...preserveFields
72886
+ ...preserveFields,
72887
+ skip_draft_deletion: true
72872
72888
  }
72873
72889
  });
72874
72890
  }
@@ -72880,7 +72896,8 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
72880
72896
  path: remotePath,
72881
72897
  deployment_message: message,
72882
72898
  ...localAppBody,
72883
- ...preserveFields
72899
+ ...preserveFields,
72900
+ skip_draft_deletion: true
72884
72901
  }
72885
72902
  });
72886
72903
  }
@@ -73054,7 +73071,8 @@ var init_app = __esm(async () => {
73054
73071
  on_behalf_of: `u/${username}`,
73055
73072
  on_behalf_of_email: email
73056
73073
  },
73057
- preserve_on_behalf_of: true
73074
+ preserve_on_behalf_of: true,
73075
+ skip_draft_deletion: true
73058
73076
  }
73059
73077
  });
73060
73078
  info(colors.green(`Updated permissioned_as for app ${appPath} to ${email}`));
@@ -75804,11 +75822,35 @@ function showDiff(local, remote) {
75804
75822
  }
75805
75823
  function showConflict(path21, local, remote) {
75806
75824
  info(colors.yellow(`- ${path21}`));
75807
- showDiff(local, remote);
75825
+ let isEncryptionKey = false;
75826
+ try {
75827
+ isEncryptionKey = getTypeStrFromPath(path21) === "encryption_key";
75828
+ } catch {}
75829
+ if (isEncryptionKey) {
75830
+ showDiff(redactEncryptionKey(local), redactEncryptionKey(remote));
75831
+ } else {
75832
+ showDiff(local, remote);
75833
+ }
75808
75834
  info("\x1B[31mlocal\x1B[31m - \x1B[32mremote\x1B[32m");
75809
75835
  info(`
75810
75836
  `);
75811
75837
  }
75838
+ function redactEncryptionKey(content) {
75839
+ if (!content)
75840
+ return content;
75841
+ try {
75842
+ const parsed = JSON.parse(content);
75843
+ if (typeof parsed === "string") {
75844
+ return JSON.stringify(redactString(parsed));
75845
+ }
75846
+ } catch {}
75847
+ return redactString(content);
75848
+ }
75849
+ function redactString(s) {
75850
+ if (s.length <= 5)
75851
+ return s;
75852
+ return s.slice(0, 5) + "*".repeat(s.length - 5);
75853
+ }
75812
75854
  async function pushObj(workspace, p, befObj, newObj, plainSecrets, alreadySynced3, message, originalLocalPath, permissionedAsContext, wsSpecific) {
75813
75855
  const typeEnding = getTypeStrFromPath(p);
75814
75856
  if (typeEnding === "app") {
@@ -76238,7 +76280,8 @@ async function pushFlow(workspace, remotePath, localPath, message, permissionedA
76238
76280
  path: remotePath.replaceAll(SEP20, "/"),
76239
76281
  deployment_message: message,
76240
76282
  ...localFlowBody,
76241
- ...preserveFields
76283
+ ...preserveFields,
76284
+ skip_draft_deletion: true
76242
76285
  }
76243
76286
  });
76244
76287
  }
@@ -76251,7 +76294,8 @@ async function pushFlow(workspace, remotePath, localPath, message, permissionedA
76251
76294
  path: remotePath.replaceAll(SEP20, "/"),
76252
76295
  deployment_message: message,
76253
76296
  ...localFlowBody,
76254
- ...preserveFields
76297
+ ...preserveFields,
76298
+ skip_draft_deletion: true
76255
76299
  }
76256
76300
  });
76257
76301
  } catch (e) {
@@ -76877,7 +76921,8 @@ var init_flow = __esm(async () => {
76877
76921
  ...remote,
76878
76922
  path: flowPath,
76879
76923
  on_behalf_of_email: email,
76880
- preserve_on_behalf_of: true
76924
+ preserve_on_behalf_of: true,
76925
+ skip_draft_deletion: true
76881
76926
  }
76882
76927
  });
76883
76928
  info(colors.green(`Updated permissioned_as for flow ${flowPath} to ${email}`));
@@ -77979,7 +78024,7 @@ var init_skills_gen = __esm(() => {
77979
78024
  { name: "write-script-bash", description: "MUST use when writing Bash scripts.", languageKey: "bash" },
77980
78025
  { name: "write-script-bigquery", description: "MUST use when writing BigQuery queries.", languageKey: "bigquery" },
77981
78026
  { name: "write-script-bun", description: "MUST use when writing Bun/TypeScript scripts.", languageKey: "bun" },
77982
- { name: "write-script-bunnative", description: "MUST use when writing Bun Native scripts.", languageKey: "bunnative" },
78027
+ { name: "write-script-bunnative", description: "MUST use when writing Bun Native scripts. The script must start with //native to run on the native worker.", languageKey: "bunnative" },
77983
78028
  { name: "write-script-csharp", description: "MUST use when writing C# scripts.", languageKey: "csharp" },
77984
78029
  { name: "write-script-deno", description: "MUST use when writing Deno/TypeScript scripts.", languageKey: "deno" },
77985
78030
  { name: "write-script-duckdb", description: "MUST use when writing DuckDB queries.", languageKey: "duckdb" },
@@ -77988,7 +78033,6 @@ var init_skills_gen = __esm(() => {
77988
78033
  { name: "write-script-java", description: "MUST use when writing Java scripts.", languageKey: "java" },
77989
78034
  { name: "write-script-mssql", description: "MUST use when writing MS SQL Server queries.", languageKey: "mssql" },
77990
78035
  { name: "write-script-mysql", description: "MUST use when writing MySQL queries.", languageKey: "mysql" },
77991
- { name: "write-script-nativets", description: "MUST use when writing Native TypeScript scripts.", languageKey: "nativets" },
77992
78036
  { name: "write-script-php", description: "MUST use when writing PHP scripts.", languageKey: "php" },
77993
78037
  { name: "write-script-postgresql", description: "MUST use when writing PostgreSQL queries.", languageKey: "postgresql" },
77994
78038
  { name: "write-script-powershell", description: "MUST use when writing PowerShell scripts.", languageKey: "powershell" },
@@ -78893,7 +78937,7 @@ ducklake(name: string = "main"): SqlTemplateFunction
78893
78937
  `,
78894
78938
  "write-script-bunnative": `---
78895
78939
  name: write-script-bunnative
78896
- description: MUST use when writing Bun Native scripts.
78940
+ description: MUST use when writing Bun Native scripts. The script must start with //native to run on the native worker.
78897
78941
  ---
78898
78942
 
78899
78943
  ## CLI Commands
@@ -78933,13 +78977,14 @@ Use \`wmill resource-type list --schema\` to discover available resource types.
78933
78977
 
78934
78978
  # TypeScript (Bun Native)
78935
78979
 
78936
- Native TypeScript execution with fetch only - no external imports allowed.
78980
+ Native TypeScript execution. Native scripts are Bun scripts that run on the native worker — a lightweight V8 isolate that exposes \`fetch\` and the JavaScript standard library — and can be heavily parallelized. Every script MUST start with \`//native\` on its first line so Windmill routes it to the native worker; without it the exact same script runs on the regular Bun worker. You may import npm packages and other Windmill scripts (e.g. \`./helper.ts\`) — imports are resolved and bundled just like a regular Bun script — as long as everything (your code and its dependencies) relies only on \`fetch\` and the standard library. Libraries that need Node/Bun runtime APIs (filesystem, \`node:*\` modules, child processes, native addons) will not work on the native worker; use the regular \`bun\` language for those.
78937
78981
 
78938
78982
  ## Structure
78939
78983
 
78940
78984
  Export a single **async** function called \`main\`:
78941
78985
 
78942
78986
  \`\`\`typescript
78987
+ //native
78943
78988
  export async function main(param1: string, param2: number) {
78944
78989
  // Your code here
78945
78990
  return { result: param1, count: param2 };
@@ -78955,6 +79000,7 @@ On Windmill, credentials and configuration are stored in resources and passed as
78955
79000
  Use the \`RT\` namespace for resource types:
78956
79001
 
78957
79002
  \`\`\`typescript
79003
+ //native
78958
79004
  export async function main(stripe: RT.Stripe) {
78959
79005
  // stripe contains API key and config from the resource
78960
79006
  }
@@ -78966,9 +79012,10 @@ Before using a resource type, check the \`rt.d.ts\` file in the project root to
78966
79012
 
78967
79013
  ## Imports
78968
79014
 
78969
- **No imports allowed.** Use the globally available \`fetch\` function:
79015
+ **The constraint is the runtime, not the import list.** You may import npm packages and relative Windmill scripts; they are resolved and bundled exactly like a regular Bun script. But the native worker only provides \`fetch\` and the JavaScript standard library, so any imported code must work using only those. Anything requiring Node/Bun built-ins (\`node:fs\`, \`child_process\`, the \`Bun\` API, native modules) belongs in a regular \`bun\` script instead. Use the globally available \`fetch\` for HTTP:
78970
79016
 
78971
79017
  \`\`\`typescript
79018
+ //native
78972
79019
  export async function main(url: string) {
78973
79020
  const response = await fetch(url);
78974
79021
  return await response.json();
@@ -78977,13 +79024,14 @@ export async function main(url: string) {
78977
79024
 
78978
79025
  ## Windmill Client
78979
79026
 
78980
- The windmill client is not available in native TypeScript mode. Use fetch to call APIs directly.
79027
+ \`windmill-client\` is available for Windmill-specific primitives such as the S3 helpers below (\`loadS3File\`, \`loadS3FileStream\`, \`writeS3File\`, \`S3Object\`). Use \`fetch\` for plain HTTP.
78981
79028
 
78982
79029
  ## Preprocessor Scripts
78983
79030
 
78984
79031
  For preprocessor scripts, the function should be named \`preprocessor\` and receives an \`event\` parameter:
78985
79032
 
78986
79033
  \`\`\`typescript
79034
+ //native
78987
79035
  type Event = {
78988
79036
  kind:
78989
79037
  | "webhook"
@@ -79016,6 +79064,7 @@ Windmill provides built-in support for S3-compatible storage operations. The \`w
79016
79064
  ### Receiving an S3Object as a script parameter
79017
79065
 
79018
79066
  \`\`\`typescript
79067
+ //native
79019
79068
  import * as wmill from "windmill-client";
79020
79069
 
79021
79070
  export async function main(file: wmill.S3Object) {
@@ -79027,6 +79076,7 @@ export async function main(file: wmill.S3Object) {
79027
79076
  ### S3 operations
79028
79077
 
79029
79078
  \`\`\`typescript
79079
+ //native
79030
79080
  import * as wmill from "windmill-client";
79031
79081
 
79032
79082
  // Load file content from S3
@@ -80943,682 +80993,6 @@ All keys are optional: \`prefix\` (object key prefix), \`storage\` (named storag
80943
80993
  omit to use the workspace default), \`format\` (\`json\` (default), \`parquet\`, or
80944
80994
  \`csv\`). Use this for large result sets — rows stream directly to S3 instead of
80945
80995
  being buffered as the script return value.
80946
- `,
80947
- "write-script-nativets": `---
80948
- name: write-script-nativets
80949
- description: MUST use when writing Native TypeScript scripts.
80950
- ---
80951
-
80952
- ## CLI Commands
80953
-
80954
- Place scripts in a folder.
80955
-
80956
- After writing, tell the user which command fits what they want to do:
80957
-
80958
- - \`wmill script preview <script_path>\` — **default when iterating on a local script.** Runs the local file without deploying.
80959
- - \`wmill script run <path>\` — runs the script **already deployed** in the workspace. Use only when the user explicitly wants to test the deployed version, not local edits.
80960
- - \`wmill generate-metadata\` — generate \`.script.yaml\` and \`.lock\` files for the script you modified.
80961
- - \`wmill sync push\` — deploy local changes to the workspace. Only suggest/run this when the user explicitly asks to deploy/publish/push — not when they say "run", "try", or "test".
80962
-
80963
- ### Preview vs run — choose by intent, not habit
80964
-
80965
- If the user says "run the script", "try it", "test it", "does it work" while there are **local edits to the script file**, use \`script preview\`. Do NOT push the script to then \`script run\` it — pushing is a deploy, and deploying just to test overwrites the workspace version with untested changes.
80966
-
80967
- Only use \`script run\` when:
80968
- - The user explicitly says "run the deployed version" / "run what's on the server".
80969
- - There is no local script being edited (you're just invoking an existing script).
80970
-
80971
- Only use \`sync push\` when:
80972
- - The user explicitly asks to deploy, publish, push, or ship.
80973
- - The preview has already validated the change and the user wants it in the workspace.
80974
-
80975
- ### After writing — offer to test, don't wait passively
80976
-
80977
- If the user hasn't already told you to run/test/preview the script, offer it as a one-sentence next step (e.g. "Want me to run \`wmill script preview\` with sample args?"). Do not present a multi-option menu.
80978
-
80979
- If the user already asked to test/run/try the script in their original request, skip the offer and just execute \`wmill script preview <path> -d '<args>'\` directly — pick plausible args from the script's declared parameters. The shape varies by language: \`main(...)\` for code languages, the SQL dialect's own placeholder syntax (\`$1\` for PostgreSQL, \`?\` for MySQL/Snowflake, \`@P1\` for MSSQL, \`@name\` for BigQuery, etc.), positional \`$1\`, \`$2\`, … for Bash, \`param(...)\` for PowerShell.
80980
-
80981
- \`wmill script preview\` does not deploy, but it still executes script code and may cause side effects; run it yourself when the user asked to test/preview (or after confirming that execution is intended). \`wmill sync push\` and \`wmill generate-metadata\` modify workspace state or local files — only run these when the user explicitly asks; otherwise tell them which to run.
80982
-
80983
- For a **visual** open-the-script-in-the-dev-page preview (rather than \`script preview\`'s run-and-print-result), use the \`preview\` skill.
80984
-
80985
- Use \`wmill resource-type list --schema\` to discover available resource types.
80986
-
80987
- # TypeScript (Native)
80988
-
80989
- Native TypeScript execution with fetch only - no external imports allowed.
80990
-
80991
- ## Structure
80992
-
80993
- Export a single **async** function called \`main\`:
80994
-
80995
- \`\`\`typescript
80996
- export async function main(param1: string, param2: number) {
80997
- // Your code here
80998
- return { result: param1, count: param2 };
80999
- }
81000
- \`\`\`
81001
-
81002
- Do not call the main function.
81003
-
81004
- ## Resource Types
81005
-
81006
- On Windmill, credentials and configuration are stored in resources and passed as parameters to main.
81007
-
81008
- Use the \`RT\` namespace for resource types:
81009
-
81010
- \`\`\`typescript
81011
- export async function main(stripe: RT.Stripe) {
81012
- // stripe contains API key and config from the resource
81013
- }
81014
- \`\`\`
81015
-
81016
- Only use resource types if you need them to satisfy the instructions. Always use the RT namespace.
81017
-
81018
- Before using a resource type, check the \`rt.d.ts\` file in the project root to see all available resource types and their fields. This file is generated by \`wmill resource-type generate-namespace\`.
81019
-
81020
- ## Imports
81021
-
81022
- **No imports allowed.** Use the globally available \`fetch\` function:
81023
-
81024
- \`\`\`typescript
81025
- export async function main(url: string) {
81026
- const response = await fetch(url);
81027
- return await response.json();
81028
- }
81029
- \`\`\`
81030
-
81031
- ## Windmill Client
81032
-
81033
- The windmill client is not available in native TypeScript mode. Use fetch to call APIs directly.
81034
-
81035
- ## Preprocessor Scripts
81036
-
81037
- For preprocessor scripts, the function should be named \`preprocessor\` and receives an \`event\` parameter:
81038
-
81039
- \`\`\`typescript
81040
- type Event = {
81041
- kind:
81042
- | "webhook"
81043
- | "http"
81044
- | "websocket"
81045
- | "kafka"
81046
- | "email"
81047
- | "nats"
81048
- | "postgres"
81049
- | "sqs"
81050
- | "mqtt"
81051
- | "gcp";
81052
- body: any;
81053
- headers: Record<string, string>;
81054
- query: Record<string, string>;
81055
- };
81056
-
81057
- export async function preprocessor(event: Event) {
81058
- return {
81059
- param1: event.body.field1,
81060
- param2: event.query.id
81061
- };
81062
- }
81063
- \`\`\`
81064
-
81065
-
81066
- # TypeScript SDK (windmill-client)
81067
-
81068
- Import: import * as wmill from 'windmill-client'
81069
-
81070
- workerHasInternalServer(): boolean
81071
-
81072
- /**
81073
- * Initialize the Windmill client with authentication token and base URL
81074
- * @param token - Authentication token (defaults to WM_TOKEN env variable)
81075
- * @param baseUrl - API base URL (defaults to BASE_INTERNAL_URL or BASE_URL env variable)
81076
- */
81077
- setClient(token?: string, baseUrl?: string): void
81078
-
81079
- /**
81080
- * Create a client configuration from env variables
81081
- * @returns client configuration
81082
- */
81083
- getWorkspace(): string
81084
-
81085
- /**
81086
- * Get a resource value by path
81087
- * @param path path of the resource, default to internal state path
81088
- * @param undefinedIfEmpty if the resource does not exist, return undefined instead of throwing an error
81089
- * @returns resource value
81090
- */
81091
- async getResource(path?: string, undefinedIfEmpty?: boolean): Promise<any>
81092
-
81093
- /**
81094
- * Get the true root job id
81095
- * @param jobId job id to get the root job id from (default to current job)
81096
- * @returns root job id
81097
- */
81098
- async getRootJobId(jobId?: string): Promise<string>
81099
-
81100
- /**
81101
- * @deprecated Use runScriptByPath or runScriptByHash instead
81102
- */
81103
- async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
81104
-
81105
- /**
81106
- * Run a script synchronously by its path and wait for the result
81107
- * @param path - Script path in Windmill
81108
- * @param args - Arguments to pass to the script
81109
- * @param verbose - Enable verbose logging
81110
- * @returns Script execution result
81111
- */
81112
- async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
81113
-
81114
- /**
81115
- * Run a script synchronously by its hash and wait for the result
81116
- * @param hash_ - Script hash in Windmill
81117
- * @param args - Arguments to pass to the script
81118
- * @param verbose - Enable verbose logging
81119
- * @returns Script execution result
81120
- */
81121
- async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
81122
-
81123
- /**
81124
- * Append a text to the result stream
81125
- * @param text text to append to the result stream
81126
- */
81127
- appendToResultStream(text: string): void
81128
-
81129
- /**
81130
- * Stream to the result stream
81131
- * @param stream stream to stream to the result stream
81132
- */
81133
- async streamResult(stream: AsyncIterable<string>): Promise<void>
81134
-
81135
- /**
81136
- * Run a flow synchronously by its path and wait for the result
81137
- * @param path - Flow path in Windmill
81138
- * @param args - Arguments to pass to the flow
81139
- * @param verbose - Enable verbose logging
81140
- * @returns Flow execution result
81141
- */
81142
- async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
81143
-
81144
- /**
81145
- * Wait for a job to complete and return its result
81146
- * @param jobId - ID of the job to wait for
81147
- * @param verbose - Enable verbose logging
81148
- * @returns Job result when completed
81149
- */
81150
- async waitJob(jobId: string, verbose: boolean = false): Promise<any>
81151
-
81152
- /**
81153
- * Get the result of a completed job
81154
- * @param jobId - ID of the completed job
81155
- * @returns Job result
81156
- */
81157
- async getResult(jobId: string): Promise<any>
81158
-
81159
- /**
81160
- * Get the result of a job if completed, or its current status
81161
- * @param jobId - ID of the job
81162
- * @returns Object with started, completed, success, and result properties
81163
- */
81164
- async getResultMaybe(jobId: string): Promise<any>
81165
-
81166
- /**
81167
- * @deprecated Use runScriptByPathAsync or runScriptByHashAsync instead
81168
- */
81169
- async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null): Promise<string>
81170
-
81171
- /**
81172
- * Run a script asynchronously by its path
81173
- * @param path - Script path in Windmill
81174
- * @param args - Arguments to pass to the script
81175
- * @param scheduledInSeconds - Schedule execution for a future time (in seconds)
81176
- * @returns Job ID of the created job
81177
- */
81178
- async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
81179
-
81180
- /**
81181
- * Run a script asynchronously by its hash
81182
- * @param hash_ - Script hash in Windmill
81183
- * @param args - Arguments to pass to the script
81184
- * @param scheduledInSeconds - Schedule execution for a future time (in seconds)
81185
- * @returns Job ID of the created job
81186
- */
81187
- async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
81188
-
81189
- /**
81190
- * Run a flow asynchronously by its path
81191
- * @param path - Flow path in Windmill
81192
- * @param args - Arguments to pass to the flow
81193
- * @param scheduledInSeconds - Schedule execution for a future time (in seconds)
81194
- * @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
81195
- * @returns Job ID of the created job
81196
- */
81197
- async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true): Promise<string>
81198
-
81199
- /**
81200
- * Resolve a resource value in case the default value was picked because the input payload was undefined
81201
- * @param obj resource value or path of the resource under the format \`$res:path\`
81202
- * @returns resource value
81203
- */
81204
- async resolveDefaultResource(obj: any): Promise<any>
81205
-
81206
- /**
81207
- * Get the state file path from environment variables
81208
- * @returns State path string
81209
- */
81210
- getStatePath(): string
81211
-
81212
- /**
81213
- * Set a resource value by path
81214
- * @param path path of the resource to set, default to state path
81215
- * @param value new value of the resource to set
81216
- * @param initializeToTypeIfNotExist if the resource does not exist, initialize it with this type
81217
- */
81218
- async setResource(value: any, path?: string, initializeToTypeIfNotExist?: string): Promise<void>
81219
-
81220
- /**
81221
- * Set the state
81222
- * @param state state to set
81223
- * @deprecated use setState instead
81224
- */
81225
- async setInternalState(state: any): Promise<void>
81226
-
81227
- /**
81228
- * Set the state
81229
- * @param state state to set
81230
- * @param path Optional state resource path override. Defaults to \`getStatePath()\`.
81231
- */
81232
- async setState(state: any, path?: string): Promise<void>
81233
-
81234
- /**
81235
- * Set the progress
81236
- * Progress cannot go back and limited to 0% to 99% range
81237
- * @param percent Progress to set in %
81238
- * @param jobId? Job to set progress for
81239
- */
81240
- async setProgress(percent: number, jobId?: any): Promise<void>
81241
-
81242
- /**
81243
- * Get the progress
81244
- * @param jobId? Job to get progress from
81245
- * @returns Optional clamped between 0 and 100 progress value
81246
- */
81247
- async getProgress(jobId?: any): Promise<number | null>
81248
-
81249
- /**
81250
- * Set a flow user state
81251
- * @param key key of the state
81252
- * @param value value of the state
81253
- */
81254
- async setFlowUserState(key: string, value: any, errorIfNotPossible?: boolean): Promise<void>
81255
-
81256
- /**
81257
- * Get a flow user state
81258
- * @param path path of the variable
81259
- */
81260
- async getFlowUserState(key: string, errorIfNotPossible?: boolean): Promise<any>
81261
-
81262
- /**
81263
- * Get the internal state
81264
- * @deprecated use getState instead
81265
- */
81266
- async getInternalState(): Promise<any>
81267
-
81268
- /**
81269
- * Get the state shared across executions
81270
- * @param path Optional state resource path override. Defaults to \`getStatePath()\`.
81271
- */
81272
- async getState(path?: string): Promise<any>
81273
-
81274
- /**
81275
- * Get a variable by path
81276
- * @param path path of the variable
81277
- * @returns variable value
81278
- */
81279
- async getVariable(path: string): Promise<string>
81280
-
81281
- /**
81282
- * Set a variable by path, create if not exist
81283
- * @param path path of the variable
81284
- * @param value value of the variable
81285
- * @param isSecretIfNotExist if the variable does not exist, create it as secret or not (default: false)
81286
- * @param descriptionIfNotExist if the variable does not exist, create it with this description (default: "")
81287
- */
81288
- async setVariable(path: string, value: string, isSecretIfNotExist?: boolean, descriptionIfNotExist?: string): Promise<void>
81289
-
81290
- /**
81291
- * Build a PostgreSQL connection URL from a database resource
81292
- * @param path - Path to the database resource
81293
- * @returns PostgreSQL connection URL string
81294
- */
81295
- async databaseUrlFromResource(path: string): Promise<string>
81296
-
81297
- async polarsConnectionSettings(s3_resource_path: string | undefined): Promise<any>
81298
-
81299
- async duckdbConnectionSettings(s3_resource_path: string | undefined): Promise<any>
81300
-
81301
- /**
81302
- * Get S3 client settings from a resource or workspace default
81303
- * @param s3_resource_path - Path to S3 resource (uses workspace default if undefined)
81304
- * @param workspace - Workspace to read from (defaults to the \`WM_WORKSPACE\` env var)
81305
- * @returns S3 client configuration settings
81306
- */
81307
- async denoS3LightClientSettings(s3_resource_path: string | undefined, workspace: string | undefined = undefined): Promise<DenoS3LightClientSettings>
81308
-
81309
- /**
81310
- * Load the content of a file stored in S3. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
81311
- *
81312
- * \`\`\`typescript
81313
- * let fileContent = await wmill.loadS3FileContent(inputFile)
81314
- * // if the file is a raw text file, it can be decoded and printed directly:
81315
- * const text = new TextDecoder().decode(fileContentStream)
81316
- * console.log(text);
81317
- * \`\`\`
81318
- *
81319
- * @param workspace - Workspace to read from (defaults to the \`WM_WORKSPACE\` env var)
81320
- */
81321
- async loadS3File(s3object: S3Object, s3ResourcePath: string | undefined = undefined, workspace: string | undefined = undefined): Promise<Uint8Array | undefined>
81322
-
81323
- /**
81324
- * Load the content of a file stored in S3 as a stream. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
81325
- *
81326
- * \`\`\`typescript
81327
- * let fileContentBlob = await wmill.loadS3FileStream(inputFile)
81328
- * // if the content is plain text, the blob can be read directly:
81329
- * console.log(await fileContentBlob.text());
81330
- * \`\`\`
81331
- *
81332
- * @param workspace - Workspace to read from (defaults to the \`WM_WORKSPACE\` env var)
81333
- */
81334
- async loadS3FileStream(s3object: S3Object, s3ResourcePath: string | undefined = undefined, workspace: string | undefined = undefined): Promise<Blob | undefined>
81335
-
81336
- /**
81337
- * Persist a file to the S3 bucket. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
81338
- *
81339
- * \`\`\`typescript
81340
- * const s3object = await writeS3File(s3Object, "Hello Windmill!")
81341
- * const fileContentAsUtf8Str = (await s3object.toArray()).toString('utf-8')
81342
- * console.log(fileContentAsUtf8Str)
81343
- * \`\`\`
81344
- *
81345
- * @param workspace - Workspace to write to (defaults to the \`WM_WORKSPACE\` env var)
81346
- */
81347
- async writeS3File(s3object: S3Object | undefined, fileContent: string | Blob, s3ResourcePath: string | undefined = undefined, contentType: string | undefined = undefined, contentDisposition: string | undefined = undefined, workspace: string | undefined = undefined): Promise<S3Object>
81348
-
81349
- /**
81350
- * Permanently delete a file from S3 by key.
81351
- *
81352
- * \`\`\`typescript
81353
- * await wmill.deleteS3File({ s3: "path/to/file.txt" })
81354
- * \`\`\`
81355
- *
81356
- * @param s3object - S3 object identifying the file to delete (must have \`s3\` set)
81357
- * @param workspace - Workspace to delete from (defaults to the \`WM_WORKSPACE\` env var)
81358
- */
81359
- async deleteS3File(s3object: S3Object, workspace: string | undefined = undefined): Promise<void>
81360
-
81361
- /**
81362
- * Sign S3 objects to be used by anonymous users in public apps
81363
- * @param s3objects s3 objects to sign
81364
- * @returns signed s3 objects
81365
- */
81366
- async signS3Objects(s3objects: S3Object[]): Promise<S3Object[]>
81367
-
81368
- /**
81369
- * Sign S3 object to be used by anonymous users in public apps
81370
- * @param s3object s3 object to sign
81371
- * @returns signed s3 object
81372
- */
81373
- async signS3Object(s3object: S3Object): Promise<S3Object>
81374
-
81375
- /**
81376
- * Generate a presigned public URL for an array of S3 objects.
81377
- * If an S3 object is not signed yet, it will be signed first.
81378
- * @param s3Objects s3 objects to sign
81379
- * @returns list of signed public URLs
81380
- */
81381
- async getPresignedS3PublicUrls(s3Objects: S3Object[], { baseUrl }: { baseUrl?: string } = {}): Promise<string[]>
81382
-
81383
- /**
81384
- * Generate a presigned public URL for an S3 object. If the S3 object is not signed yet, it will be signed first.
81385
- * @param s3Object s3 object to sign
81386
- * @returns signed public URL
81387
- */
81388
- async getPresignedS3PublicUrl(s3Objects: S3Object, { baseUrl }: { baseUrl?: string } = {}): Promise<string>
81389
-
81390
- /**
81391
- * Get URLs needed for resuming a flow after this step
81392
- * @param approver approver name
81393
- * @param flowLevel if true, generate resume URLs for the parent flow instead of the specific step.
81394
- * This allows pre-approvals that can be consumed by any later suspend step in the same flow.
81395
- * @returns approval page UI URL, resume and cancel API URLs for resuming the flow
81396
- */
81397
- async getResumeUrls(approver?: string, flowLevel?: boolean): Promise<{
81398
- approvalPage: string;
81399
- resume: string;
81400
- cancel: string;
81401
- }>
81402
-
81403
- /**
81404
- * @deprecated use getResumeUrls instead
81405
- */
81406
- getResumeEndpoints(approver?: string): Promise<{
81407
- approvalPage: string;
81408
- resume: string;
81409
- cancel: string;
81410
- }>
81411
-
81412
- /**
81413
- * Get an OIDC jwt token for auth to external services (e.g: Vault, AWS) (ee only)
81414
- * @param audience audience of the token
81415
- * @param expiresIn Optional number of seconds until the token expires
81416
- * @returns jwt token
81417
- */
81418
- async getIdToken(audience: string, expiresIn?: number): Promise<string>
81419
-
81420
- /**
81421
- * Convert a base64-encoded string to Uint8Array
81422
- * @param data - Base64-encoded string
81423
- * @returns Decoded Uint8Array
81424
- */
81425
- base64ToUint8Array(data: string): Uint8Array
81426
-
81427
- /**
81428
- * Convert a Uint8Array to base64-encoded string
81429
- * @param arrayBuffer - Uint8Array to encode
81430
- * @returns Base64-encoded string
81431
- */
81432
- uint8ArrayToBase64(arrayBuffer: Uint8Array): string
81433
-
81434
- /**
81435
- * Get email from workspace username
81436
- * This method is particularly useful for apps that require the email address of the viewer.
81437
- * Indeed, in the viewer context, WM_USERNAME is set to the username of the viewer but WM_EMAIL is set to the email of the creator of the app.
81438
- * @param username
81439
- * @returns email address
81440
- */
81441
- async usernameToEmail(username: string): Promise<string>
81442
-
81443
- /**
81444
- * Sends an interactive approval request via Slack, allowing optional customization of the message, approver, and form fields.
81445
- *
81446
- * **[Enterprise Edition Only]** To include form fields in the Slack approval request, go to **Advanced -> Suspend -> Form**
81447
- * and define a form. Learn more at [Windmill Documentation](https://www.windmill.dev/docs/flows/flow_approval#form).
81448
- *
81449
- * @param {Object} options - The configuration options for the Slack approval request.
81450
- * @param {string} options.slackResourcePath - The path to the Slack resource in Windmill.
81451
- * @param {string} options.channelId - The Slack channel ID where the approval request will be sent.
81452
- * @param {string} [options.message] - Optional custom message to include in the Slack approval request.
81453
- * @param {string} [options.approver] - Optional user ID or name of the approver for the request.
81454
- * @param {DefaultArgs} [options.defaultArgsJson] - Optional object defining or overriding the default arguments to a form field.
81455
- * @param {Enums} [options.dynamicEnumsJson] - Optional object overriding the enum default values of an enum form field.
81456
- * @param {string} [options.resumeButtonText] - Optional text for the resume button.
81457
- * @param {string} [options.cancelButtonText] - Optional text for the cancel button.
81458
- *
81459
- * @returns {Promise<void>} Resolves when the Slack approval request is successfully sent.
81460
- *
81461
- * @throws {Error} If the function is not called within a flow or flow preview.
81462
- * @throws {Error} If the \`JobService.getSlackApprovalPayload\` call fails.
81463
- *
81464
- * **Usage Example:**
81465
- * \`\`\`typescript
81466
- * await requestInteractiveSlackApproval({
81467
- * slackResourcePath: "/u/alex/my_slack_resource",
81468
- * channelId: "admins-slack-channel",
81469
- * message: "Please approve this request",
81470
- * approver: "approver123",
81471
- * defaultArgsJson: { key1: "value1", key2: 42 },
81472
- * dynamicEnumsJson: { foo: ["choice1", "choice2"], bar: ["optionA", "optionB"] },
81473
- * resumeButtonText: "Resume",
81474
- * cancelButtonText: "Cancel",
81475
- * });
81476
- * \`\`\`
81477
- *
81478
- * **Note:** This function requires execution within a Windmill flow or flow preview.
81479
- */
81480
- async requestInteractiveSlackApproval({ slackResourcePath, channelId, message, approver, defaultArgsJson, dynamicEnumsJson, resumeButtonText, cancelButtonText, }: SlackApprovalOptions): Promise<void>
81481
-
81482
- /**
81483
- * Sends an interactive approval request via Teams, allowing optional customization of the message, approver, and form fields.
81484
- *
81485
- * **[Enterprise Edition Only]** To include form fields in the Teams approval request, go to **Advanced -> Suspend -> Form**
81486
- * and define a form. Learn more at [Windmill Documentation](https://www.windmill.dev/docs/flows/flow_approval#form).
81487
- *
81488
- * @param {Object} options - The configuration options for the Teams approval request.
81489
- * @param {string} options.teamName - The Teams team name where the approval request will be sent.
81490
- * @param {string} options.channelName - The Teams channel name where the approval request will be sent.
81491
- * @param {string} [options.message] - Optional custom message to include in the Teams approval request.
81492
- * @param {string} [options.approver] - Optional user ID or name of the approver for the request.
81493
- * @param {DefaultArgs} [options.defaultArgsJson] - Optional object defining or overriding the default arguments to a form field.
81494
- * @param {Enums} [options.dynamicEnumsJson] - Optional object overriding the enum default values of an enum form field.
81495
- *
81496
- * @returns {Promise<void>} Resolves when the Teams approval request is successfully sent.
81497
- *
81498
- * @throws {Error} If the function is not called within a flow or flow preview.
81499
- * @throws {Error} If the \`JobService.getTeamsApprovalPayload\` call fails.
81500
- *
81501
- * **Usage Example:**
81502
- * \`\`\`typescript
81503
- * await requestInteractiveTeamsApproval({
81504
- * teamName: "admins-teams",
81505
- * channelName: "admins-teams-channel",
81506
- * message: "Please approve this request",
81507
- * approver: "approver123",
81508
- * defaultArgsJson: { key1: "value1", key2: 42 },
81509
- * dynamicEnumsJson: { foo: ["choice1", "choice2"], bar: ["optionA", "optionB"] },
81510
- * });
81511
- * \`\`\`
81512
- *
81513
- * **Note:** This function requires execution within a Windmill flow or flow preview.
81514
- */
81515
- async requestInteractiveTeamsApproval({ teamName, channelName, message, approver, defaultArgsJson, dynamicEnumsJson, }: TeamsApprovalOptions): Promise<void>
81516
-
81517
- /**
81518
- * Parse an S3 object from URI string or record format
81519
- * @param s3Object - S3 object as URI string (s3://storage/key) or record
81520
- * @returns S3 object record with storage and s3 key
81521
- */
81522
- parseS3Object(s3Object: S3Object): S3ObjectRecord
81523
-
81524
- setWorkflowCtx(ctx: WorkflowCtx | null): void
81525
-
81526
- async sleep(seconds: number): Promise<void>
81527
-
81528
- async step<T>(name: string, fn: () => T | Promise<T>): Promise<T>
81529
-
81530
- /**
81531
- * Create a task that dispatches to a separate Windmill script.
81532
- *
81533
- * @example
81534
- * const extract = taskScript("f/data/extract");
81535
- * // inside workflow: await extract({ url: "https://..." })
81536
- */
81537
- taskScript(path: string, options?: TaskOptions): (...args: any[]) => PromiseLike<any>
81538
-
81539
- /**
81540
- * Create a task that dispatches to a separate Windmill flow.
81541
- *
81542
- * @example
81543
- * const pipeline = taskFlow("f/etl/pipeline");
81544
- * // inside workflow: await pipeline({ input: data })
81545
- */
81546
- taskFlow(path: string, options?: TaskOptions): (...args: any[]) => PromiseLike<any>
81547
-
81548
- /**
81549
- * Mark an async function as a workflow-as-code entry point.
81550
- *
81551
- * The function must be **deterministic**: given the same inputs it must call
81552
- * tasks in the same order on every replay. Branching on task results is fine
81553
- * (results are replayed from checkpoint), but branching on external state
81554
- * (current time, random values, external API calls) must use \`step()\` to
81555
- * checkpoint the value so replays see the same result.
81556
- */
81557
- workflow<T>(fn: (...args: any[]) => Promise<T>): void
81558
-
81559
- /**
81560
- * Suspend the workflow and wait for an external approval.
81561
- *
81562
- * Use \`getResumeUrls()\` (wrapped in \`step()\`) to obtain resume/cancel/approvalPage
81563
- * URLs before calling this function.
81564
- *
81565
- * @example
81566
- * const urls = await step("urls", () => getResumeUrls());
81567
- * await step("notify", () => sendEmail(urls.approvalPage));
81568
- * const { value, approver } = await waitForApproval({ timeout: 3600 });
81569
- */
81570
- waitForApproval(options?: { timeout?: number; form?: object; selfApproval?: boolean; }): PromiseLike<{ value: any; approver: string; approved: boolean }>
81571
-
81572
- /**
81573
- * Process items in parallel with optional concurrency control.
81574
- *
81575
- * Each item is processed by calling \`fn(item)\`, which should be a task().
81576
- * Items are dispatched in batches of \`concurrency\` (default: all at once).
81577
- *
81578
- * @example
81579
- * const process = task(async (item: string) => { ... });
81580
- * const results = await parallel(items, process, { concurrency: 5 });
81581
- */
81582
- async parallel<T, R>(items: T[], fn: (item: T) => PromiseLike<R> | R, options?: { concurrency?: number },): Promise<R[]>
81583
-
81584
- /**
81585
- * Commit Kafka offsets for a trigger with auto_commit disabled.
81586
- * @param triggerPath - Path to the Kafka trigger (from event.wm_trigger.trigger_path)
81587
- * @param topic - Kafka topic name (from event.topic)
81588
- * @param partition - Partition number (from event.partition)
81589
- * @param offset - Message offset to commit (from event.offset)
81590
- */
81591
- async commitKafkaOffsets(triggerPath: string, topic: string, partition: number, offset: number,): Promise<void>
81592
-
81593
- /**
81594
- * Create a SQL template function for PostgreSQL/datatable queries
81595
- * @param name - Database/datatable name (default: "main")
81596
- * @returns SQL template function for building parameterized queries
81597
- * @example
81598
- * let sql = wmill.datatable()
81599
- * let name = 'Robin'
81600
- * let age = 21
81601
- * await sql\`
81602
- * SELECT * FROM friends
81603
- * WHERE name = \${name} AND age = \${age}::int
81604
- * \`.fetch()
81605
- */
81606
- datatable(name: string = "main"): DatatableSqlTemplateFunction
81607
-
81608
- /**
81609
- * Create a SQL template function for DuckDB/ducklake queries
81610
- * @param name - DuckDB database name (default: "main")
81611
- * @returns SQL template function for building parameterized queries
81612
- * @example
81613
- * let sql = wmill.ducklake()
81614
- * let name = 'Robin'
81615
- * let age = 21
81616
- * await sql\`
81617
- * SELECT * FROM friends
81618
- * WHERE name = \${name} AND age = \${age}
81619
- * \`.fetch()
81620
- */
81621
- ducklake(name: string = "main"): SqlTemplateFunction
81622
80996
  `,
81623
80997
  "write-script-php": `---
81624
80998
  name: write-script-php
@@ -83469,7 +82843,7 @@ Reference a specific resource using \`$res:\` prefix:
83469
82843
 
83470
82844
  ## OpenFlow Schema
83471
82845
 
83472
- {"OpenFlow":{"type":"object","description":"Top-level flow definition containing metadata, configuration, and the flow structure","properties":{"summary":{"type":"string","description":"Short description of what this flow does"},"description":{"type":"string","description":"Detailed documentation for this flow"},"value":{"$ref":"#/components/schemas/FlowValue"},"schema":{"type":"object","description":"JSON Schema for flow inputs. Use this to define input parameters, their types, defaults, and validation. For resource inputs, set type to 'object' and format to 'resource-<type>' (e.g., 'resource-stripe')"},"on_behalf_of_email":{"type":"string","description":"The flow will be run with the permissions of the user with this email."}},"required":["summary","value"]},"FlowValue":{"type":"object","description":"The flow structure containing modules and optional preprocessor/failure handlers","properties":{"modules":{"type":"array","description":"Array of steps that execute in sequence. Each step can be a script, subflow, loop, or branch","items":{"$ref":"#/components/schemas/FlowModule"}},"failure_module":{"description":"Special module that executes when the flow fails. Receives error object with message, name, stack, and step_id. Must have id 'failure'. Only supports script/rawscript types","$ref":"#/components/schemas/FlowModule"},"preprocessor_module":{"description":"Special module that runs before the first step on external triggers. Must have id 'preprocessor'. Only supports script/rawscript types. Cannot reference other step results","$ref":"#/components/schemas/FlowModule"},"same_worker":{"type":"boolean","description":"If true, all steps run on the same worker for better performance"},"concurrent_limit":{"type":"number","description":"Maximum number of concurrent executions of this flow"},"concurrency_key":{"type":"string","description":"Expression to group concurrent executions (e.g., by user ID)"},"concurrency_time_window_s":{"type":"number","description":"Time window in seconds for concurrent_limit"},"debounce_delay_s":{"type":"integer","description":"Delay in seconds to debounce flow executions"},"debounce_key":{"type":"string","description":"Expression to group debounced executions"},"debounce_args_to_accumulate":{"type":"array","description":"Arguments to accumulate across debounced executions","items":{"type":"string"}},"max_total_debouncing_time":{"type":"integer","description":"Maximum total time in seconds that a job can be debounced"},"max_total_debounces_amount":{"type":"integer","description":"Maximum number of times a job can be debounced"},"skip_expr":{"type":"string","description":"JavaScript expression to conditionally skip the entire flow"},"cache_ttl":{"type":"number","description":"Cache duration in seconds for flow results"},"cache_ignore_s3_path":{"type":"boolean"},"delete_after_secs":{"type":"integer","description":"If set, delete the flow job's args, result and logs after this many seconds following job completion"},"flow_env":{"type":"object","description":"Environment variables available to all steps. Values can be strings, JSON values, or special references: '$var:path' (workspace variable) or '$res:path' (resource).","additionalProperties":{}},"priority":{"type":"number","description":"Execution priority (higher numbers run first)"},"early_return":{"type":"string","description":"JavaScript expression to return early from the flow"},"chat_input_enabled":{"type":"boolean","description":"Whether this flow accepts chat-style input"},"notes":{"type":"array","description":"Sticky notes attached to the flow","items":{"$ref":"#/components/schemas/FlowNote"}},"groups":{"type":"array","description":"Semantic groups of modules for organizational purposes","items":{"$ref":"#/components/schemas/FlowGroup"}}},"required":["modules"]},"Retry":{"type":"object","description":"Retry configuration for failed module executions","properties":{"constant":{"type":"object","description":"Retry with constant delay between attempts","properties":{"attempts":{"type":"integer","description":"Number of retry attempts"},"seconds":{"type":"integer","description":"Seconds to wait between retries"}}},"exponential":{"type":"object","description":"Retry with exponential backoff (delay doubles each time)","properties":{"attempts":{"type":"integer","description":"Number of retry attempts"},"multiplier":{"type":"integer","description":"Multiplier for exponential backoff"},"seconds":{"type":"integer","minimum":1,"description":"Initial delay in seconds"},"random_factor":{"type":"integer","minimum":0,"maximum":100,"description":"Random jitter percentage (0-100) to avoid thundering herd"}}},"retry_if":{"$ref":"#/components/schemas/RetryIf"}}},"FlowNote":{"type":"object","description":"A sticky note attached to a flow for documentation and annotation","properties":{"id":{"type":"string","description":"Unique identifier for the note"},"text":{"type":"string","description":"Content of the note"},"position":{"type":"object","description":"Position of the note in the flow editor","properties":{"x":{"type":"number","description":"X coordinate"},"y":{"type":"number","description":"Y coordinate"}},"required":["x","y"]},"size":{"type":"object","description":"Size of the note in the flow editor","properties":{"width":{"type":"number","description":"Width in pixels"},"height":{"type":"number","description":"Height in pixels"}},"required":["width","height"]},"color":{"type":"string","description":"Color of the note (e.g., \\"yellow\\", \\"#ffff00\\")"},"type":{"type":"string","enum":["free","group"],"description":"Type of note - 'free' for standalone notes, 'group' for notes that group other nodes"},"locked":{"type":"boolean","default":false,"description":"Whether the note is locked and cannot be edited or moved"},"contained_node_ids":{"type":"array","items":{"type":"string"},"description":"For group notes, the IDs of nodes contained within this group"}},"required":["id","text","color","type"]},"FlowGroup":{"type":"object","description":"A semantic group of flow modules for organizational purposes. Does not affect execution \\u2014 modules remain in their original position in the flow. Groups provide naming and collapsibility in the editor. Members are computed dynamically from all nodes on paths between start_id and end_id.","properties":{"summary":{"type":"string","description":"Display name for this group"},"note":{"type":"string","description":"Markdown note shown below the group header"},"autocollapse":{"type":"boolean","default":false,"description":"If true, this group is collapsed by default in the flow editor. UI hint only."},"start_id":{"type":"string","description":"ID of the first flow module in this group (topological entry point)"},"end_id":{"type":"string","description":"ID of the last flow module in this group (topological exit point)"},"color":{"type":"string","description":"Color for the group in the flow editor"}},"required":["start_id","end_id"]},"RetryIf":{"type":"object","description":"Conditional retry based on error or result","properties":{"expr":{"type":"string","description":"JavaScript expression that returns true to retry. Has access to 'result' and 'error' variables"}},"required":["expr"]},"StopAfterIf":{"type":"object","description":"Early termination condition for a module","properties":{"skip_if_stopped":{"type":"boolean","description":"If true, following steps are skipped when this condition triggers"},"expr":{"type":"string","description":"JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"},"error_message":{"type":"string","nullable":true,"description":"Custom error message when stopping with an error. Mutually exclusive with skip_if_stopped. If set to a non-empty string, the flow stops with this error. If empty string, a default error message is used. If null or omitted, no error is raised."}},"required":["expr"]},"FlowModule":{"type":"object","description":"A single step in a flow. Can be a script, subflow, loop, or branch","properties":{"id":{"type":"string","description":"Unique identifier for this step. Used to reference results via 'results.step_id'. Must be a valid identifier (alphanumeric, underscore, hyphen)"},"value":{"$ref":"#/components/schemas/FlowModuleValue"},"stop_after_if":{"description":"Early termination condition evaluated after this step completes","$ref":"#/components/schemas/StopAfterIf"},"stop_after_all_iters_if":{"description":"For loops only - early termination condition evaluated after all iterations complete","$ref":"#/components/schemas/StopAfterIf"},"skip_if":{"type":"object","description":"Conditionally skip this step based on previous results or flow inputs","properties":{"expr":{"type":"string","description":"JavaScript expression that returns true to skip. Can use 'flow_input' or 'results.<step_id>'"}},"required":["expr"]},"sleep":{"description":"Delay before executing this step (in seconds or as expression)","$ref":"#/components/schemas/InputTransform"},"cache_ttl":{"type":"number","description":"Cache duration in seconds for this step's results"},"cache_ignore_s3_path":{"type":"boolean"},"timeout":{"description":"Maximum execution time in seconds (static value or expression)","$ref":"#/components/schemas/InputTransform"},"delete_after_secs":{"type":"integer","description":"If set, delete the step's args, result and logs after this many seconds following job completion"},"summary":{"type":"string","description":"Short description of what this step does"},"mock":{"type":"object","description":"Mock configuration for testing without executing the actual step","properties":{"enabled":{"type":"boolean","description":"If true, return mock value instead of executing"},"return_value":{"description":"Value to return when mocked"}}},"suspend":{"type":"object","description":"Configuration for approval/resume steps that wait for user input","properties":{"required_events":{"type":"integer","description":"Number of approvals required before continuing"},"timeout":{"type":"integer","description":"Timeout in seconds before auto-continuing or canceling"},"resume_form":{"type":"object","description":"Form schema for collecting input when resuming","properties":{"schema":{"type":"object","description":"JSON Schema for the resume form"}}},"user_auth_required":{"type":"boolean","description":"If true, only authenticated users can approve"},"user_groups_required":{"description":"Expression or list of groups that can approve","$ref":"#/components/schemas/InputTransform"},"self_approval_disabled":{"type":"boolean","description":"If true, the user who started the flow cannot approve"},"hide_cancel":{"type":"boolean","description":"If true, hide the cancel button on the approval form"},"continue_on_disapprove_timeout":{"type":"boolean","description":"If true, continue flow on timeout instead of canceling"}}},"priority":{"type":"number","description":"Execution priority for this step (higher numbers run first)"},"continue_on_error":{"type":"boolean","description":"If true, flow continues even if this step fails"},"retry":{"description":"Retry configuration if this step fails","$ref":"#/components/schemas/Retry"},"debouncing":{"description":"Debounce configuration for this step (EE only)","type":"object","properties":{"debounce_delay_s":{"type":"integer","description":"Delay in seconds to debounce this step's executions across flow runs"},"debounce_key":{"type":"string","description":"Expression to group debounced executions. Supports $workspace and $args[name]. Default: $workspace/flow/<flow_path>-<step_id>"},"debounce_args_to_accumulate":{"type":"array","description":"Array-type arguments to accumulate across debounced executions","items":{"type":"string"}},"max_total_debouncing_time":{"type":"integer","description":"Maximum total time in seconds before forced execution"},"max_total_debounces_amount":{"type":"integer","description":"Maximum number of debounces before forced execution"}}}},"required":["value","id"]},"InputTransform":{"description":"Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs","oneOf":[{"$ref":"#/components/schemas/StaticTransform"},{"$ref":"#/components/schemas/JavascriptTransform"},{"$ref":"#/components/schemas/AiTransform"}],"discriminator":{"propertyName":"type","mapping":{"static":"#/components/schemas/StaticTransform","javascript":"#/components/schemas/JavascriptTransform","ai":"#/components/schemas/AiTransform"}}},"StaticTransform":{"type":"object","description":"Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'","properties":{"value":{"description":"The static value. For resources, use format '$res:path/to/resource'"},"type":{"type":"string","enum":["static"]}},"required":["type"]},"JavascriptTransform":{"type":"object","description":"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","properties":{"expr":{"type":"string","description":"JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"},"type":{"type":"string","enum":["javascript"]}},"required":["expr","type"]},"AiTransform":{"type":"object","description":"Value resolved by the AI runtime for this input. The AI engine decides how to satisfy the parameter.","properties":{"type":{"type":"string","enum":["ai"]}},"required":["type"]},"AIProviderKind":{"type":"string","description":"Supported AI provider types","enum":["openai","azure_openai","anthropic","mistral","deepseek","googleai","groq","openrouter","togetherai","customai","aws_bedrock"]},"ProviderConfig":{"type":"object","description":"Complete AI provider configuration with resource reference and model selection","properties":{"kind":{"$ref":"#/components/schemas/AIProviderKind"},"resource":{"type":"string","description":"Resource reference in format '$res:{resource_path}' pointing to provider credentials"},"model":{"type":"string","description":"Model identifier (e.g., 'gpt-4', 'claude-3-opus-20240229', 'gemini-pro')"}},"required":["kind","resource","model"]},"StaticProviderTransform":{"type":"object","description":"Static provider configuration passed directly to the AI agent","properties":{"value":{"$ref":"#/components/schemas/ProviderConfig"},"type":{"type":"string","enum":["static"]}},"required":["type","value"]},"ProviderTransform":{"description":"Provider configuration - can be static (ProviderConfig), JavaScript expression, or AI-determined","oneOf":[{"$ref":"#/components/schemas/StaticProviderTransform"},{"$ref":"#/components/schemas/JavascriptTransform"},{"$ref":"#/components/schemas/AiTransform"}],"discriminator":{"propertyName":"type","mapping":{"static":"#/components/schemas/StaticProviderTransform","javascript":"#/components/schemas/JavascriptTransform","ai":"#/components/schemas/AiTransform"}}},"MemoryOff":{"type":"object","description":"No conversation memory/context","properties":{"kind":{"type":"string","enum":["off"]}},"required":["kind"]},"MemoryAuto":{"type":"object","description":"Automatic context management","properties":{"kind":{"type":"string","enum":["auto"]},"context_length":{"type":"integer","description":"Maximum number of messages to retain in context"},"memory_id":{"type":"string","description":"Identifier for persistent memory across agent invocations"}},"required":["kind"]},"MemoryMessage":{"type":"object","description":"A single message in conversation history","properties":{"role":{"type":"string","enum":["user","assistant","system"]},"content":{"type":"string"}},"required":["role","content"]},"MemoryManual":{"type":"object","description":"Explicit message history","properties":{"kind":{"type":"string","enum":["manual"]},"messages":{"type":"array","items":{"$ref":"#/components/schemas/MemoryMessage"}}},"required":["kind","messages"]},"MemoryConfig":{"description":"Conversation memory configuration","oneOf":[{"$ref":"#/components/schemas/MemoryOff"},{"$ref":"#/components/schemas/MemoryAuto"},{"$ref":"#/components/schemas/MemoryManual"}],"discriminator":{"propertyName":"kind","mapping":{"off":"#/components/schemas/MemoryOff","auto":"#/components/schemas/MemoryAuto","manual":"#/components/schemas/MemoryManual"}}},"StaticMemoryTransform":{"type":"object","description":"Static memory configuration passed directly to the AI agent","properties":{"value":{"$ref":"#/components/schemas/MemoryConfig"},"type":{"type":"string","enum":["static"]}},"required":["type","value"]},"MemoryTransform":{"description":"Memory configuration - can be static (MemoryConfig), JavaScript expression, or AI-determined","oneOf":[{"$ref":"#/components/schemas/StaticMemoryTransform"},{"$ref":"#/components/schemas/JavascriptTransform"},{"$ref":"#/components/schemas/AiTransform"}],"discriminator":{"propertyName":"type","mapping":{"static":"#/components/schemas/StaticMemoryTransform","javascript":"#/components/schemas/JavascriptTransform","ai":"#/components/schemas/AiTransform"}}},"FlowModuleValue":{"description":"The actual implementation of a flow step. Can be a script (inline or referenced), subflow, loop, branch, or special module type","oneOf":[{"$ref":"#/components/schemas/RawScript"},{"$ref":"#/components/schemas/PathScript"},{"$ref":"#/components/schemas/PathFlow"},{"$ref":"#/components/schemas/ForloopFlow"},{"$ref":"#/components/schemas/WhileloopFlow"},{"$ref":"#/components/schemas/BranchOne"},{"$ref":"#/components/schemas/BranchAll"},{"$ref":"#/components/schemas/Identity"},{"$ref":"#/components/schemas/AiAgent"}],"discriminator":{"propertyName":"type","mapping":{"rawscript":"#/components/schemas/RawScript","script":"#/components/schemas/PathScript","flow":"#/components/schemas/PathFlow","forloopflow":"#/components/schemas/ForloopFlow","whileloopflow":"#/components/schemas/WhileloopFlow","branchone":"#/components/schemas/BranchOne","branchall":"#/components/schemas/BranchAll","identity":"#/components/schemas/Identity","aiagent":"#/components/schemas/AiAgent"}}},"RawScript":{"type":"object","description":"Inline script with code defined directly in the flow. Use 'bun' as default language if unspecified. The script receives arguments from input_transforms","properties":{"input_transforms":{"type":"object","description":"Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments","additionalProperties":{"$ref":"#/components/schemas/InputTransform"}},"content":{"type":"string","description":"The script source code. Should export a 'main' function"},"language":{"type":"string","description":"Programming language for this script","enum":["deno","bun","python3","go","bash","powershell","postgresql","mysql","bigquery","snowflake","mssql","oracledb","graphql","nativets","php","rust","ansible","csharp","nu","java","ruby","rlang","duckdb"]},"path":{"type":"string","description":"Optional path for saving this script"},"lock":{"type":"string","description":"Lock file content for dependencies"},"type":{"type":"string","enum":["rawscript"]},"tag":{"type":"string","description":"Worker group tag for execution routing"},"concurrent_limit":{"type":"number","description":"Maximum concurrent executions of this script"},"concurrency_time_window_s":{"type":"number","description":"Time window for concurrent_limit"},"custom_concurrency_key":{"type":"string","description":"Custom key for grouping concurrent executions"},"is_trigger":{"type":"boolean","description":"If true, this script is a trigger that can start the flow"},"assets":{"type":"array","description":"External resources this script accesses (S3 objects, resources, etc.)","items":{"type":"object","required":["path","kind"],"properties":{"path":{"type":"string","description":"Path to the asset"},"kind":{"type":"string","description":"Type of asset","enum":["s3object","resource","ducklake","datatable","volume"]},"access_type":{"type":"string","nullable":true,"description":"Access level for this asset","enum":["r","w","rw"]},"alt_access_type":{"type":"string","nullable":true,"description":"Alternative access level","enum":["r","w","rw"]}}}}},"required":["type","content","language","input_transforms"]},"PathScript":{"type":"object","description":"Reference to an existing script by path. Use this when calling a previously saved script instead of writing inline code","properties":{"input_transforms":{"type":"object","description":"Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments","additionalProperties":{"$ref":"#/components/schemas/InputTransform"}},"path":{"type":"string","description":"Path to the script in the workspace (e.g., 'f/scripts/send_email')"},"hash":{"type":"string","description":"Optional specific version hash of the script to use"},"type":{"type":"string","enum":["script"]},"tag_override":{"type":"string","description":"Override the script's default worker group tag"},"is_trigger":{"type":"boolean","description":"If true, this script is a trigger that can start the flow"}},"required":["type","path","input_transforms"]},"PathFlow":{"type":"object","description":"Reference to an existing flow by path. Use this to call another flow as a subflow","properties":{"input_transforms":{"type":"object","description":"Map of parameter names to their values (static or JavaScript expressions). These become the subflow's input arguments","additionalProperties":{"$ref":"#/components/schemas/InputTransform"}},"path":{"type":"string","description":"Path to the flow in the workspace (e.g., 'f/flows/process_user')"},"type":{"type":"string","enum":["flow"]}},"required":["type","path","input_transforms"]},"ForloopFlow":{"type":"object","description":"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","properties":{"modules":{"type":"array","description":"Steps to execute for each iteration. These can reference the iteration value via 'flow_input.iter.value'","items":{"$ref":"#/components/schemas/FlowModule"}},"iterator":{"description":"JavaScript expression that returns an array to iterate over. Can reference 'results.step_id' or 'flow_input'","$ref":"#/components/schemas/InputTransform"},"skip_failures":{"type":"boolean","description":"If true, iteration failures don't stop the loop. Failed iterations return null"},"type":{"type":"string","enum":["forloopflow"]},"parallel":{"type":"boolean","description":"If true, iterations run concurrently (faster for I/O-bound operations). Use with parallelism to control concurrency"},"parallelism":{"description":"Maximum number of concurrent iterations when parallel=true. Limits resource usage. Can be static number or expression","$ref":"#/components/schemas/InputTransform"},"squash":{"type":"boolean"}},"required":["modules","iterator","skip_failures","type"]},"WhileloopFlow":{"type":"object","description":"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","properties":{"modules":{"type":"array","description":"Steps to execute in each iteration. Use stop_after_if to control when the loop ends","items":{"$ref":"#/components/schemas/FlowModule"}},"skip_failures":{"type":"boolean","description":"If true, iteration failures don't stop the loop. Failed iterations return null"},"type":{"type":"string","enum":["whileloopflow"]},"parallel":{"type":"boolean","description":"If true, iterations run concurrently (use with caution in while loops)"},"parallelism":{"description":"Maximum number of concurrent iterations when parallel=true","$ref":"#/components/schemas/InputTransform"},"squash":{"type":"boolean"}},"required":["modules","skip_failures","type"]},"BranchOne":{"type":"object","description":"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","properties":{"branches":{"type":"array","description":"Array of branches to evaluate in order. The first branch with expr evaluating to true executes","items":{"type":"object","properties":{"summary":{"type":"string","description":"Short description of this branch condition"},"expr":{"type":"string","description":"JavaScript expression that returns boolean. Can use 'results.step_id' or 'flow_input'. First true expr wins"},"modules":{"type":"array","description":"Steps to execute if this branch's expr is true","items":{"$ref":"#/components/schemas/FlowModule"}}},"required":["modules","expr"]}},"default":{"type":"array","description":"Steps to execute if no branch expressions match","items":{"$ref":"#/components/schemas/FlowModule"}},"type":{"type":"string","enum":["branchone"]}},"required":["branches","default","type"]},"BranchAll":{"type":"object","description":"Parallel branching where all branches execute simultaneously. Unlike BranchOne, all branches run regardless of conditions. Useful for executing independent tasks concurrently","properties":{"branches":{"type":"array","description":"Array of branches that all execute (either in parallel or sequentially)","items":{"type":"object","properties":{"summary":{"type":"string","description":"Short description of this branch's purpose"},"skip_failure":{"type":"boolean","description":"If true, failure in this branch doesn't fail the entire flow"},"modules":{"type":"array","description":"Steps to execute in this branch","items":{"$ref":"#/components/schemas/FlowModule"}}},"required":["modules"]}},"type":{"type":"string","enum":["branchall"]},"parallel":{"type":"boolean","description":"If true, all branches execute concurrently. If false, they execute sequentially"}},"required":["branches","type"]},"AgentTool":{"type":"object","description":"A tool available to an AI agent. Can be a flow module or an external MCP (Model Context Protocol) tool","properties":{"id":{"type":"string","description":"Unique identifier for this tool. Cannot contain spaces - use underscores instead (e.g., 'get_user_data' not 'get user data')"},"summary":{"type":"string","description":"Short description of what this tool does (shown to the AI)"},"value":{"$ref":"#/components/schemas/ToolValue"}},"required":["id","value"]},"ToolValue":{"description":"The implementation of a tool. Can be a flow module (script/flow) or an MCP tool reference","oneOf":[{"$ref":"#/components/schemas/FlowModuleTool"},{"$ref":"#/components/schemas/McpToolValue"},{"$ref":"#/components/schemas/WebsearchToolValue"}],"discriminator":{"propertyName":"tool_type","mapping":{"flowmodule":"#/components/schemas/FlowModuleTool","mcp":"#/components/schemas/McpToolValue","websearch":"#/components/schemas/WebsearchToolValue"}}},"FlowModuleTool":{"description":"A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module","allOf":[{"type":"object","properties":{"tool_type":{"type":"string","enum":["flowmodule"]}},"required":["tool_type"]},{"$ref":"#/components/schemas/FlowModuleValue"}]},"WebsearchToolValue":{"type":"object","description":"A tool implemented as a websearch tool. The AI can call this like any other websearch tool","properties":{"tool_type":{"type":"string","enum":["websearch"]}},"required":["tool_type"]},"McpToolValue":{"type":"object","description":"Reference to an external MCP (Model Context Protocol) tool. The AI can call tools from MCP servers","properties":{"tool_type":{"type":"string","enum":["mcp"]},"resource_path":{"type":"string","description":"Path to the MCP resource/server configuration"},"include_tools":{"type":"array","description":"Whitelist of specific tools to include from this MCP server","items":{"type":"string"}},"exclude_tools":{"type":"array","description":"Blacklist of tools to exclude from this MCP server","items":{"type":"string"}}},"required":["tool_type","resource_path"]},"AiAgent":{"type":"object","description":"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","properties":{"input_transforms":{"type":"object","description":"Input parameters for the AI agent mapped to their values","properties":{"provider":{"$ref":"#/components/schemas/ProviderTransform"},"output_type":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Output format type.\\nValid values: 'text' (default) - plain text response, 'image' - image generation\\n"},"user_message":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"The user's prompt/message to the AI agent. Supports variable interpolation with flow.input syntax."},"system_prompt":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"System instructions that guide the AI's behavior, persona, and response style. Optional."},"streaming":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Boolean. If true, stream the AI response incrementally.\\nStreaming events include: token_delta, tool_call, tool_call_arguments, tool_execution, tool_result\\n"},"memory":{"$ref":"#/components/schemas/MemoryTransform"},"output_schema":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"JSON Schema object defining structured output format. Used when you need the AI to return data in a specific shape.\\nSupports standard JSON Schema properties: type, properties, required, items, enum, pattern, minLength, maxLength, minimum, maximum, etc.\\nExample: { type: 'object', properties: { name: { type: 'string' }, age: { type: 'integer' } }, required: ['name'] }\\n"},"user_attachments":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Array of file references (images or PDFs) for the AI agent.\\nFormat: Array<{ bucket: string, key: string }> - S3 object references\\nExample: [{ bucket: 'my-bucket', key: 'documents/report.pdf' }]\\n"},"max_completion_tokens":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Integer. Maximum number of tokens the AI will generate in its response.\\nRange: 1 to 4,294,967,295. Typical values: 256-4096 for most use cases.\\n"},"temperature":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Float. Controls randomness/creativity of responses.\\nRange: 0.0 to 2.0 (provider-dependent)\\n- 0.0 = deterministic, focused responses\\n- 0.7 = balanced (common default)\\n- 1.0+ = more creative/random\\n"},"max_iterations":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Number. Limits how many times the agent can loop through reasoning and tool use.\\nRange: 1-1000.\\n"}},"required":["provider","user_message","output_type"]},"tools":{"type":"array","description":"Array of tools the agent can use. The agent decides which tools to call based on the task","items":{"$ref":"#/components/schemas/AgentTool"}},"type":{"type":"string","enum":["aiagent"]},"omit_output_from_conversation":{"type":"boolean","default":false,"description":"If true, this AI agent step does not persist its assistant or tool messages to the flow conversation when chat mode is enabled."},"parallel":{"type":"boolean","description":"If true, the agent can execute multiple tool calls in parallel"}},"required":["tools","type","input_transforms"]},"Identity":{"type":"object","description":"Pass-through module that returns its input unchanged. Useful for flow structure or as a placeholder","properties":{"type":{"type":"string","enum":["identity"]},"flow":{"type":"boolean","description":"If true, marks this as a flow identity (special handling)"}},"required":["type"]},"FlowStatus":{"type":"object","properties":{"step":{"type":"integer"},"modules":{"type":"array","items":{"$ref":"#/components/schemas/FlowStatusModule"}},"user_states":{"additionalProperties":true},"preprocessor_module":{"allOf":[{"$ref":"#/components/schemas/FlowStatusModule"}]},"failure_module":{"allOf":[{"$ref":"#/components/schemas/FlowStatusModule"},{"type":"object","properties":{"parent_module":{"type":"string"}}}]},"retry":{"type":"object","properties":{"fail_count":{"type":"integer"},"failed_jobs":{"type":"array","items":{"type":"string","format":"uuid"}}}}},"required":["step","modules","failure_module"]},"FlowStatusModule":{"type":"object","properties":{"type":{"type":"string","enum":["WaitingForPriorSteps","WaitingForEvents","WaitingForExecutor","InProgress","Success","Failure"]},"id":{"type":"string"},"job":{"type":"string","format":"uuid"},"count":{"type":"integer"},"progress":{"type":"integer"},"iterator":{"type":"object","properties":{"index":{"type":"integer"},"itered":{"type":"array","items":{}},"itered_len":{"type":"integer"},"args":{}}},"flow_jobs":{"type":"array","items":{"type":"string"}},"flow_jobs_success":{"type":"array","items":{"type":"boolean"}},"flow_jobs_duration":{"type":"object","properties":{"started_at":{"type":"array","items":{"type":"string"}},"duration_ms":{"type":"array","items":{"type":"integer"}}}},"branch_chosen":{"type":"object","properties":{"type":{"type":"string","enum":["branch","default"]},"branch":{"type":"integer"}},"required":["type"]},"branchall":{"type":"object","properties":{"branch":{"type":"integer"},"len":{"type":"integer"}},"required":["branch","len"]},"approvers":{"type":"array","items":{"type":"object","properties":{"resume_id":{"type":"integer"},"approver":{"type":"string"}},"required":["resume_id","approver"]}},"failed_retries":{"type":"array","items":{"type":"string","format":"uuid"}},"skipped":{"type":"boolean"},"agent_actions":{"type":"array","items":{"type":"object","oneOf":[{"type":"object","properties":{"job_id":{"type":"string","format":"uuid"},"function_name":{"type":"string"},"type":{"type":"string","enum":["tool_call"]},"module_id":{"type":"string"}},"required":["job_id","function_name","type","module_id"]},{"type":"object","properties":{"call_id":{"type":"string","format":"uuid"},"function_name":{"type":"string"},"resource_path":{"type":"string"},"type":{"type":"string","enum":["mcp_tool_call"]},"arguments":{"type":"object"}},"required":["call_id","function_name","resource_path","type"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_search"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["message"]}},"required":["content","type"]}]}},"agent_actions_success":{"type":"array","items":{"type":"boolean"}}},"required":["type"]}}`,
82846
+ {"OpenFlow":{"type":"object","description":"Top-level flow definition containing metadata, configuration, and the flow structure","properties":{"summary":{"type":"string","description":"Short description of what this flow does"},"description":{"type":"string","description":"Detailed documentation for this flow"},"value":{"$ref":"#/components/schemas/FlowValue"},"schema":{"type":"object","description":"JSON Schema for flow inputs. Use this to define input parameters, their types, defaults, and validation. For resource inputs, set type to 'object' and format to 'resource-<type>' (e.g., 'resource-stripe')"},"on_behalf_of_email":{"type":"string","description":"The flow will be run with the permissions of the user with this email."}},"required":["summary","value"]},"FlowValue":{"type":"object","description":"The flow structure containing modules and optional preprocessor/failure handlers","properties":{"modules":{"type":"array","description":"Array of steps that execute in sequence. Each step can be a script, subflow, loop, or branch","items":{"$ref":"#/components/schemas/FlowModule"}},"failure_module":{"description":"Special module that executes when the flow fails. Receives error object with message, name, stack, and step_id. Must have id 'failure'. Only supports script/rawscript types","$ref":"#/components/schemas/FlowModule"},"preprocessor_module":{"description":"Special module that runs before the first step on external triggers. Must have id 'preprocessor'. Only supports script/rawscript types. Cannot reference other step results","$ref":"#/components/schemas/FlowModule"},"same_worker":{"type":"boolean","description":"If true, all steps run on the same worker for better performance"},"preserve_step_tags":{"type":"boolean","description":"If true and the flow runs on a custom worker tag, steps that declare their own non-empty tag run on it instead of inheriting the flow tag. Steps without their own tag still inherit the flow tag."},"concurrent_limit":{"type":"number","description":"Maximum number of concurrent executions of this flow"},"concurrency_key":{"type":"string","description":"Expression to group concurrent executions (e.g., by user ID)"},"concurrency_time_window_s":{"type":"number","description":"Time window in seconds for concurrent_limit"},"debounce_delay_s":{"type":"integer","description":"Delay in seconds to debounce flow executions"},"debounce_key":{"type":"string","description":"Expression to group debounced executions"},"debounce_args_to_accumulate":{"type":"array","description":"Arguments to accumulate across debounced executions","items":{"type":"string"}},"max_total_debouncing_time":{"type":"integer","description":"Maximum total time in seconds that a job can be debounced"},"max_total_debounces_amount":{"type":"integer","description":"Maximum number of times a job can be debounced"},"skip_expr":{"type":"string","description":"JavaScript expression to conditionally skip the entire flow"},"cache_ttl":{"type":"number","description":"Cache duration in seconds for flow results"},"cache_ignore_s3_path":{"type":"boolean"},"delete_after_secs":{"type":"integer","description":"If set, delete the flow job's args, result and logs after this many seconds following job completion"},"flow_env":{"type":"object","description":"Environment variables available to all steps. Values can be strings, JSON values, or special references: '$var:path' (workspace variable) or '$res:path' (resource).","additionalProperties":{}},"priority":{"type":"number","description":"Execution priority (higher numbers run first)"},"early_return":{"type":"string","description":"JavaScript expression to return early from the flow"},"chat_input_enabled":{"type":"boolean","description":"Whether this flow accepts chat-style input"},"notes":{"type":"array","description":"Sticky notes attached to the flow","items":{"$ref":"#/components/schemas/FlowNote"}},"groups":{"type":"array","description":"Semantic groups of modules for organizational purposes","items":{"$ref":"#/components/schemas/FlowGroup"}}},"required":["modules"]},"Retry":{"type":"object","description":"Retry configuration for failed module executions","properties":{"constant":{"type":"object","description":"Retry with constant delay between attempts","properties":{"attempts":{"type":"integer","description":"Number of retry attempts"},"seconds":{"type":"integer","description":"Seconds to wait between retries"}}},"exponential":{"type":"object","description":"Retry with exponential backoff (delay doubles each time)","properties":{"attempts":{"type":"integer","description":"Number of retry attempts"},"multiplier":{"type":"integer","description":"Multiplier for exponential backoff"},"seconds":{"type":"integer","minimum":1,"description":"Initial delay in seconds"},"random_factor":{"type":"integer","minimum":0,"maximum":100,"description":"Random jitter percentage (0-100) to avoid thundering herd"}}},"retry_if":{"$ref":"#/components/schemas/RetryIf"}}},"FlowNote":{"type":"object","description":"A sticky note attached to a flow for documentation and annotation","properties":{"id":{"type":"string","description":"Unique identifier for the note"},"text":{"type":"string","description":"Content of the note"},"position":{"type":"object","description":"Position of the note in the flow editor","properties":{"x":{"type":"number","description":"X coordinate"},"y":{"type":"number","description":"Y coordinate"}},"required":["x","y"]},"size":{"type":"object","description":"Size of the note in the flow editor","properties":{"width":{"type":"number","description":"Width in pixels"},"height":{"type":"number","description":"Height in pixels"}},"required":["width","height"]},"color":{"type":"string","description":"Color of the note (e.g., \\"yellow\\", \\"#ffff00\\")"},"type":{"type":"string","enum":["free","group"],"description":"Type of note - 'free' for standalone notes, 'group' for notes that group other nodes"},"locked":{"type":"boolean","default":false,"description":"Whether the note is locked and cannot be edited or moved"},"contained_node_ids":{"type":"array","items":{"type":"string"},"description":"For group notes, the IDs of nodes contained within this group"}},"required":["id","text","color","type"]},"FlowGroup":{"type":"object","description":"A semantic group of flow modules for organizational purposes. Does not affect execution \\u2014 modules remain in their original position in the flow. Groups provide naming and collapsibility in the editor. Members are computed dynamically from all nodes on paths between start_id and end_id.","properties":{"summary":{"type":"string","description":"Display name for this group"},"note":{"type":"string","description":"Markdown note shown below the group header"},"autocollapse":{"type":"boolean","default":false,"description":"If true, this group is collapsed by default in the flow editor. UI hint only."},"start_id":{"type":"string","description":"ID of the first flow module in this group (topological entry point)"},"end_id":{"type":"string","description":"ID of the last flow module in this group (topological exit point)"},"color":{"type":"string","description":"Color for the group in the flow editor"}},"required":["start_id","end_id"]},"RetryIf":{"type":"object","description":"Conditional retry based on error or result","properties":{"expr":{"type":"string","description":"JavaScript expression that returns true to retry. Has access to 'result' and 'error' variables"}},"required":["expr"]},"StopAfterIf":{"type":"object","description":"Early termination condition for a module","properties":{"skip_if_stopped":{"type":"boolean","description":"If true, following steps are skipped when this condition triggers"},"expr":{"type":"string","description":"JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"},"error_message":{"type":"string","nullable":true,"description":"Custom error message when stopping with an error. Mutually exclusive with skip_if_stopped. If set to a non-empty string, the flow stops with this error. If empty string, a default error message is used. If null or omitted, no error is raised."}},"required":["expr"]},"FlowModule":{"type":"object","description":"A single step in a flow. Can be a script, subflow, loop, or branch","properties":{"id":{"type":"string","description":"Unique identifier for this step. Used to reference results via 'results.step_id'. Must be a valid identifier (alphanumeric, underscore, hyphen)"},"value":{"$ref":"#/components/schemas/FlowModuleValue"},"stop_after_if":{"description":"Early termination condition evaluated after this step completes","$ref":"#/components/schemas/StopAfterIf"},"stop_after_all_iters_if":{"description":"For loops only - early termination condition evaluated after all iterations complete","$ref":"#/components/schemas/StopAfterIf"},"skip_if":{"type":"object","description":"Conditionally skip this step based on previous results or flow inputs","properties":{"expr":{"type":"string","description":"JavaScript expression that returns true to skip. Can use 'flow_input' or 'results.<step_id>'"}},"required":["expr"]},"sleep":{"description":"Delay before executing this step (in seconds or as expression)","$ref":"#/components/schemas/InputTransform"},"cache_ttl":{"type":"number","description":"Cache duration in seconds for this step's results"},"cache_ignore_s3_path":{"type":"boolean"},"timeout":{"description":"Maximum execution time in seconds (static value or expression)","$ref":"#/components/schemas/InputTransform"},"delete_after_secs":{"type":"integer","description":"If set, delete the step's args, result and logs after this many seconds following job completion"},"summary":{"type":"string","description":"Short description of what this step does"},"mock":{"type":"object","description":"Mock configuration for testing without executing the actual step","properties":{"enabled":{"type":"boolean","description":"If true, return mock value instead of executing"},"return_value":{"description":"Value to return when mocked"}}},"suspend":{"type":"object","description":"Configuration for approval/resume steps that wait for user input","properties":{"required_events":{"type":"integer","description":"Number of approvals required before continuing"},"timeout":{"type":"integer","description":"Timeout in seconds before auto-continuing or canceling"},"resume_form":{"type":"object","description":"Form schema for collecting input when resuming","properties":{"schema":{"type":"object","description":"JSON Schema for the resume form"}}},"user_auth_required":{"type":"boolean","description":"If true, only authenticated users can approve"},"user_groups_required":{"description":"Expression or list of groups that can approve","$ref":"#/components/schemas/InputTransform"},"self_approval_disabled":{"type":"boolean","description":"If true, the user who started the flow cannot approve"},"hide_cancel":{"type":"boolean","description":"If true, hide the cancel button on the approval form"},"continue_on_disapprove_timeout":{"type":"boolean","description":"If true, continue flow on timeout instead of canceling"}}},"priority":{"type":"number","description":"Execution priority for this step (higher numbers run first)"},"continue_on_error":{"type":"boolean","description":"If true, flow continues even if this step fails"},"retry":{"description":"Retry configuration if this step fails","$ref":"#/components/schemas/Retry"},"debouncing":{"description":"Debounce configuration for this step (EE only)","type":"object","properties":{"debounce_delay_s":{"type":"integer","description":"Delay in seconds to debounce this step's executions across flow runs"},"debounce_key":{"type":"string","description":"Expression to group debounced executions. Supports $workspace and $args[name]. Default: $workspace/flow/<flow_path>-<step_id>"},"debounce_args_to_accumulate":{"type":"array","description":"Array-type arguments to accumulate across debounced executions","items":{"type":"string"}},"max_total_debouncing_time":{"type":"integer","description":"Maximum total time in seconds before forced execution"},"max_total_debounces_amount":{"type":"integer","description":"Maximum number of debounces before forced execution"}}}},"required":["value","id"]},"InputTransform":{"description":"Maps input parameters for a step. Can be a static value or a JavaScript expression that references previous results or flow inputs","oneOf":[{"$ref":"#/components/schemas/StaticTransform"},{"$ref":"#/components/schemas/JavascriptTransform"},{"$ref":"#/components/schemas/AiTransform"}],"discriminator":{"propertyName":"type","mapping":{"static":"#/components/schemas/StaticTransform","javascript":"#/components/schemas/JavascriptTransform","ai":"#/components/schemas/AiTransform"}}},"StaticTransform":{"type":"object","description":"Static value passed directly to the step. Use for hardcoded values or resource references like '$res:path/to/resource'","properties":{"value":{"description":"The static value. For resources, use format '$res:path/to/resource'"},"type":{"type":"string","enum":["static"]}},"required":["type"]},"JavascriptTransform":{"type":"object","description":"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","properties":{"expr":{"type":"string","description":"JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)"},"type":{"type":"string","enum":["javascript"]}},"required":["expr","type"]},"AiTransform":{"type":"object","description":"Value resolved by the AI runtime for this input. The AI engine decides how to satisfy the parameter.","properties":{"type":{"type":"string","enum":["ai"]}},"required":["type"]},"AIProviderKind":{"type":"string","description":"Supported AI provider types","enum":["openai","azure_openai","anthropic","mistral","deepseek","googleai","groq","openrouter","togetherai","customai","aws_bedrock"]},"ProviderConfig":{"type":"object","description":"Complete AI provider configuration with resource reference and model selection","properties":{"kind":{"$ref":"#/components/schemas/AIProviderKind"},"resource":{"type":"string","description":"Resource reference in format '$res:{resource_path}' pointing to provider credentials"},"model":{"type":"string","description":"Model identifier (e.g., 'gpt-4', 'claude-3-opus-20240229', 'gemini-pro')"}},"required":["kind","resource","model"]},"StaticProviderTransform":{"type":"object","description":"Static provider configuration passed directly to the AI agent","properties":{"value":{"$ref":"#/components/schemas/ProviderConfig"},"type":{"type":"string","enum":["static"]}},"required":["type","value"]},"ProviderTransform":{"description":"Provider configuration - can be static (ProviderConfig), JavaScript expression, or AI-determined","oneOf":[{"$ref":"#/components/schemas/StaticProviderTransform"},{"$ref":"#/components/schemas/JavascriptTransform"},{"$ref":"#/components/schemas/AiTransform"}],"discriminator":{"propertyName":"type","mapping":{"static":"#/components/schemas/StaticProviderTransform","javascript":"#/components/schemas/JavascriptTransform","ai":"#/components/schemas/AiTransform"}}},"MemoryOff":{"type":"object","description":"No conversation memory/context","properties":{"kind":{"type":"string","enum":["off"]}},"required":["kind"]},"MemoryAuto":{"type":"object","description":"Automatic context management","properties":{"kind":{"type":"string","enum":["auto"]},"context_length":{"type":"integer","description":"Maximum number of messages to retain in context"},"memory_id":{"type":"string","description":"Identifier for persistent memory across agent invocations"}},"required":["kind"]},"MemoryMessage":{"type":"object","description":"A single message in conversation history","properties":{"role":{"type":"string","enum":["user","assistant","system"]},"content":{"type":"string"}},"required":["role","content"]},"MemoryManual":{"type":"object","description":"Explicit message history","properties":{"kind":{"type":"string","enum":["manual"]},"messages":{"type":"array","items":{"$ref":"#/components/schemas/MemoryMessage"}}},"required":["kind","messages"]},"MemoryConfig":{"description":"Conversation memory configuration","oneOf":[{"$ref":"#/components/schemas/MemoryOff"},{"$ref":"#/components/schemas/MemoryAuto"},{"$ref":"#/components/schemas/MemoryManual"}],"discriminator":{"propertyName":"kind","mapping":{"off":"#/components/schemas/MemoryOff","auto":"#/components/schemas/MemoryAuto","manual":"#/components/schemas/MemoryManual"}}},"StaticMemoryTransform":{"type":"object","description":"Static memory configuration passed directly to the AI agent","properties":{"value":{"$ref":"#/components/schemas/MemoryConfig"},"type":{"type":"string","enum":["static"]}},"required":["type","value"]},"MemoryTransform":{"description":"Memory configuration - can be static (MemoryConfig), JavaScript expression, or AI-determined","oneOf":[{"$ref":"#/components/schemas/StaticMemoryTransform"},{"$ref":"#/components/schemas/JavascriptTransform"},{"$ref":"#/components/schemas/AiTransform"}],"discriminator":{"propertyName":"type","mapping":{"static":"#/components/schemas/StaticMemoryTransform","javascript":"#/components/schemas/JavascriptTransform","ai":"#/components/schemas/AiTransform"}}},"FlowModuleValue":{"description":"The actual implementation of a flow step. Can be a script (inline or referenced), subflow, loop, branch, or special module type","oneOf":[{"$ref":"#/components/schemas/RawScript"},{"$ref":"#/components/schemas/PathScript"},{"$ref":"#/components/schemas/PathFlow"},{"$ref":"#/components/schemas/ForloopFlow"},{"$ref":"#/components/schemas/WhileloopFlow"},{"$ref":"#/components/schemas/BranchOne"},{"$ref":"#/components/schemas/BranchAll"},{"$ref":"#/components/schemas/Identity"},{"$ref":"#/components/schemas/AiAgent"}],"discriminator":{"propertyName":"type","mapping":{"rawscript":"#/components/schemas/RawScript","script":"#/components/schemas/PathScript","flow":"#/components/schemas/PathFlow","forloopflow":"#/components/schemas/ForloopFlow","whileloopflow":"#/components/schemas/WhileloopFlow","branchone":"#/components/schemas/BranchOne","branchall":"#/components/schemas/BranchAll","identity":"#/components/schemas/Identity","aiagent":"#/components/schemas/AiAgent"}}},"RawScript":{"type":"object","description":"Inline script with code defined directly in the flow. Use 'bun' as default language if unspecified. The script receives arguments from input_transforms","properties":{"input_transforms":{"type":"object","description":"Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments","additionalProperties":{"$ref":"#/components/schemas/InputTransform"}},"content":{"type":"string","description":"The script source code. Should export a 'main' function"},"language":{"type":"string","description":"Programming language for this script","enum":["deno","bun","python3","go","bash","powershell","postgresql","mysql","bigquery","snowflake","mssql","oracledb","graphql","nativets","php","rust","ansible","csharp","nu","java","ruby","rlang","duckdb"]},"path":{"type":"string","description":"Optional path for saving this script"},"lock":{"type":"string","description":"Lock file content for dependencies"},"type":{"type":"string","enum":["rawscript"]},"tag":{"type":"string","description":"Worker group tag for execution routing"},"concurrent_limit":{"type":"number","description":"Maximum concurrent executions of this script"},"concurrency_time_window_s":{"type":"number","description":"Time window for concurrent_limit"},"custom_concurrency_key":{"type":"string","description":"Custom key for grouping concurrent executions"},"is_trigger":{"type":"boolean","description":"If true, this script is a trigger that can start the flow"},"assets":{"type":"array","description":"External resources this script accesses (S3 objects, resources, etc.)","items":{"type":"object","required":["path","kind"],"properties":{"path":{"type":"string","description":"Path to the asset"},"kind":{"type":"string","description":"Type of asset","enum":["s3object","resource","ducklake","datatable","volume"]},"access_type":{"type":"string","nullable":true,"description":"Access level for this asset","enum":["r","w","rw"]},"alt_access_type":{"type":"string","nullable":true,"description":"Alternative access level","enum":["r","w","rw"]}}}}},"required":["type","content","language","input_transforms"]},"PathScript":{"type":"object","description":"Reference to an existing script by path. Use this when calling a previously saved script instead of writing inline code","properties":{"input_transforms":{"type":"object","description":"Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments","additionalProperties":{"$ref":"#/components/schemas/InputTransform"}},"path":{"type":"string","description":"Path to the script in the workspace (e.g., 'f/scripts/send_email')"},"hash":{"type":"string","description":"Optional specific version hash of the script to use"},"type":{"type":"string","enum":["script"]},"tag_override":{"type":"string","description":"Override the script's default worker group tag"},"is_trigger":{"type":"boolean","description":"If true, this script is a trigger that can start the flow"}},"required":["type","path","input_transforms"]},"PathFlow":{"type":"object","description":"Reference to an existing flow by path. Use this to call another flow as a subflow","properties":{"input_transforms":{"type":"object","description":"Map of parameter names to their values (static or JavaScript expressions). These become the subflow's input arguments","additionalProperties":{"$ref":"#/components/schemas/InputTransform"}},"path":{"type":"string","description":"Path to the flow in the workspace (e.g., 'f/flows/process_user')"},"type":{"type":"string","enum":["flow"]}},"required":["type","path","input_transforms"]},"ForloopFlow":{"type":"object","description":"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","properties":{"modules":{"type":"array","description":"Steps to execute for each iteration. These can reference the iteration value via 'flow_input.iter.value'","items":{"$ref":"#/components/schemas/FlowModule"}},"iterator":{"description":"JavaScript expression that returns an array to iterate over. Can reference 'results.step_id' or 'flow_input'","$ref":"#/components/schemas/InputTransform"},"skip_failures":{"type":"boolean","description":"If true, iteration failures don't stop the loop. Failed iterations return null"},"type":{"type":"string","enum":["forloopflow"]},"parallel":{"type":"boolean","description":"If true, iterations run concurrently (faster for I/O-bound operations). Use with parallelism to control concurrency"},"parallelism":{"description":"Maximum number of concurrent iterations when parallel=true. Limits resource usage. Can be static number or expression","$ref":"#/components/schemas/InputTransform"},"squash":{"type":"boolean"}},"required":["modules","iterator","skip_failures","type"]},"WhileloopFlow":{"type":"object","description":"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","properties":{"modules":{"type":"array","description":"Steps to execute in each iteration. Use stop_after_if to control when the loop ends","items":{"$ref":"#/components/schemas/FlowModule"}},"skip_failures":{"type":"boolean","description":"If true, iteration failures don't stop the loop. Failed iterations return null"},"type":{"type":"string","enum":["whileloopflow"]},"parallel":{"type":"boolean","description":"If true, iterations run concurrently (use with caution in while loops)"},"parallelism":{"description":"Maximum number of concurrent iterations when parallel=true","$ref":"#/components/schemas/InputTransform"},"squash":{"type":"boolean"}},"required":["modules","skip_failures","type"]},"BranchOne":{"type":"object","description":"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","properties":{"branches":{"type":"array","description":"Array of branches to evaluate in order. The first branch with expr evaluating to true executes","items":{"type":"object","properties":{"summary":{"type":"string","description":"Short description of this branch condition"},"expr":{"type":"string","description":"JavaScript expression that returns boolean. Can use 'results.step_id' or 'flow_input'. First true expr wins"},"modules":{"type":"array","description":"Steps to execute if this branch's expr is true","items":{"$ref":"#/components/schemas/FlowModule"}}},"required":["modules","expr"]}},"default":{"type":"array","description":"Steps to execute if no branch expressions match","items":{"$ref":"#/components/schemas/FlowModule"}},"type":{"type":"string","enum":["branchone"]}},"required":["branches","default","type"]},"BranchAll":{"type":"object","description":"Parallel branching where all branches execute simultaneously. Unlike BranchOne, all branches run regardless of conditions. Useful for executing independent tasks concurrently","properties":{"branches":{"type":"array","description":"Array of branches that all execute (either in parallel or sequentially)","items":{"type":"object","properties":{"summary":{"type":"string","description":"Short description of this branch's purpose"},"skip_failure":{"type":"boolean","description":"If true, failure in this branch doesn't fail the entire flow"},"modules":{"type":"array","description":"Steps to execute in this branch","items":{"$ref":"#/components/schemas/FlowModule"}}},"required":["modules"]}},"type":{"type":"string","enum":["branchall"]},"parallel":{"type":"boolean","description":"If true, all branches execute concurrently. If false, they execute sequentially"}},"required":["branches","type"]},"AgentTool":{"type":"object","description":"A tool available to an AI agent. Can be a flow module or an external MCP (Model Context Protocol) tool","properties":{"id":{"type":"string","description":"Unique identifier for this tool. Cannot contain spaces - use underscores instead (e.g., 'get_user_data' not 'get user data')"},"summary":{"type":"string","description":"Short description of what this tool does (shown to the AI)"},"value":{"$ref":"#/components/schemas/ToolValue"}},"required":["id","value"]},"ToolValue":{"description":"The implementation of a tool. Can be a flow module (script/flow) or an MCP tool reference","oneOf":[{"$ref":"#/components/schemas/FlowModuleTool"},{"$ref":"#/components/schemas/McpToolValue"},{"$ref":"#/components/schemas/WebsearchToolValue"}],"discriminator":{"propertyName":"tool_type","mapping":{"flowmodule":"#/components/schemas/FlowModuleTool","mcp":"#/components/schemas/McpToolValue","websearch":"#/components/schemas/WebsearchToolValue"}}},"FlowModuleTool":{"description":"A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module","allOf":[{"type":"object","properties":{"tool_type":{"type":"string","enum":["flowmodule"]}},"required":["tool_type"]},{"$ref":"#/components/schemas/FlowModuleValue"}]},"WebsearchToolValue":{"type":"object","description":"A tool implemented as a websearch tool. The AI can call this like any other websearch tool","properties":{"tool_type":{"type":"string","enum":["websearch"]}},"required":["tool_type"]},"McpToolValue":{"type":"object","description":"Reference to an external MCP (Model Context Protocol) tool. The AI can call tools from MCP servers","properties":{"tool_type":{"type":"string","enum":["mcp"]},"resource_path":{"type":"string","description":"Path to the MCP resource/server configuration"},"include_tools":{"type":"array","description":"Whitelist of specific tools to include from this MCP server","items":{"type":"string"}},"exclude_tools":{"type":"array","description":"Blacklist of tools to exclude from this MCP server","items":{"type":"string"}}},"required":["tool_type","resource_path"]},"AiAgent":{"type":"object","description":"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","properties":{"input_transforms":{"type":"object","description":"Input parameters for the AI agent mapped to their values","properties":{"provider":{"$ref":"#/components/schemas/ProviderTransform"},"output_type":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Output format type.\\nValid values: 'text' (default) - plain text response, 'image' - image generation\\n"},"user_message":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"The user's prompt/message to the AI agent. Supports variable interpolation with flow.input syntax."},"system_prompt":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"System instructions that guide the AI's behavior, persona, and response style. Optional."},"streaming":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Boolean. If true, stream the AI response incrementally.\\nStreaming events include: token_delta, tool_call, tool_call_arguments, tool_execution, tool_result\\n"},"memory":{"$ref":"#/components/schemas/MemoryTransform"},"output_schema":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"JSON Schema object defining structured output format. Used when you need the AI to return data in a specific shape.\\nSupports standard JSON Schema properties: type, properties, required, items, enum, pattern, minLength, maxLength, minimum, maximum, etc.\\nExample: { type: 'object', properties: { name: { type: 'string' }, age: { type: 'integer' } }, required: ['name'] }\\n"},"user_attachments":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Array of file references (images or PDFs) for the AI agent.\\nFormat: Array<{ bucket: string, key: string }> - S3 object references\\nExample: [{ bucket: 'my-bucket', key: 'documents/report.pdf' }]\\n"},"max_completion_tokens":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Integer. Maximum number of tokens the AI will generate in its response.\\nRange: 1 to 4,294,967,295. Typical values: 256-4096 for most use cases.\\n"},"temperature":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Float. Controls randomness/creativity of responses.\\nRange: 0.0 to 2.0 (provider-dependent)\\n- 0.0 = deterministic, focused responses\\n- 0.7 = balanced (common default)\\n- 1.0+ = more creative/random\\n"},"max_iterations":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Number. Limits how many times the agent can loop through reasoning and tool use.\\nRange: 1-1000.\\n"}},"required":["provider","user_message","output_type"]},"tools":{"type":"array","description":"Array of tools the agent can use. The agent decides which tools to call based on the task","items":{"$ref":"#/components/schemas/AgentTool"}},"type":{"type":"string","enum":["aiagent"]},"omit_output_from_conversation":{"type":"boolean","default":false,"description":"If true, this AI agent step does not persist its assistant or tool messages to the flow conversation when chat mode is enabled."},"parallel":{"type":"boolean","description":"If true, the agent can execute multiple tool calls in parallel"}},"required":["tools","type","input_transforms"]},"Identity":{"type":"object","description":"Pass-through module that returns its input unchanged. Useful for flow structure or as a placeholder","properties":{"type":{"type":"string","enum":["identity"]},"flow":{"type":"boolean","description":"If true, marks this as a flow identity (special handling)"}},"required":["type"]},"FlowStatus":{"type":"object","properties":{"step":{"type":"integer"},"modules":{"type":"array","items":{"$ref":"#/components/schemas/FlowStatusModule"}},"user_states":{"additionalProperties":true},"preprocessor_module":{"allOf":[{"$ref":"#/components/schemas/FlowStatusModule"}]},"failure_module":{"allOf":[{"$ref":"#/components/schemas/FlowStatusModule"},{"type":"object","properties":{"parent_module":{"type":"string"}}}]},"retry":{"type":"object","properties":{"fail_count":{"type":"integer"},"failed_jobs":{"type":"array","items":{"type":"string","format":"uuid"}}}}},"required":["step","modules","failure_module"]},"FlowStatusModule":{"type":"object","properties":{"type":{"type":"string","enum":["WaitingForPriorSteps","WaitingForEvents","WaitingForExecutor","InProgress","Success","Failure"]},"id":{"type":"string"},"job":{"type":"string","format":"uuid"},"count":{"type":"integer"},"progress":{"type":"integer"},"iterator":{"type":"object","properties":{"index":{"type":"integer"},"itered":{"type":"array","items":{}},"itered_len":{"type":"integer"},"args":{}}},"flow_jobs":{"type":"array","items":{"type":"string"}},"flow_jobs_success":{"type":"array","items":{"type":"boolean"}},"flow_jobs_duration":{"type":"object","properties":{"started_at":{"type":"array","items":{"type":"string"}},"duration_ms":{"type":"array","items":{"type":"integer"}}}},"branch_chosen":{"type":"object","properties":{"type":{"type":"string","enum":["branch","default"]},"branch":{"type":"integer"}},"required":["type"]},"branchall":{"type":"object","properties":{"branch":{"type":"integer"},"len":{"type":"integer"}},"required":["branch","len"]},"approvers":{"type":"array","items":{"type":"object","properties":{"resume_id":{"type":"integer"},"approver":{"type":"string"}},"required":["resume_id","approver"]}},"failed_retries":{"type":"array","items":{"type":"string","format":"uuid"}},"skipped":{"type":"boolean"},"agent_actions":{"type":"array","items":{"type":"object","oneOf":[{"type":"object","properties":{"job_id":{"type":"string","format":"uuid"},"function_name":{"type":"string"},"type":{"type":"string","enum":["tool_call"]},"module_id":{"type":"string"}},"required":["job_id","function_name","type","module_id"]},{"type":"object","properties":{"call_id":{"type":"string","format":"uuid"},"function_name":{"type":"string"},"resource_path":{"type":"string"},"type":{"type":"string","enum":["mcp_tool_call"]},"arguments":{"type":"object"}},"required":["call_id","function_name","resource_path","type"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_search"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["message"]}},"required":["content","type"]}]}},"agent_actions_success":{"type":"array","items":{"type":"boolean"}}},"required":["type"]}}`,
83473
82847
  "raw-app": `---
83474
82848
  name: raw-app
83475
82849
  description: MUST use when creating raw apps.
@@ -90161,7 +89535,11 @@ ${options.includeLine}
90161
89535
  }
90162
89536
  function referencesIncludeLine(content, includeLine) {
90163
89537
  for (const line of content.split(/\r?\n/)) {
90164
- if (line.trim() === includeLine) {
89538
+ const trimmed = line.trim();
89539
+ if (trimmed.startsWith("<!--") || trimmed.endsWith("-->")) {
89540
+ continue;
89541
+ }
89542
+ if (trimmed.split(/\s+/).includes(includeLine)) {
90165
89543
  return true;
90166
89544
  }
90167
89545
  }
@@ -93620,7 +92998,7 @@ var object_storage_default = command41;
93620
92998
 
93621
92999
  // src/main.ts
93622
93000
  await init_context();
93623
- var VERSION = "1.711.0";
93001
+ var VERSION = "1.713.0";
93624
93002
  async function checkVersionSafe(cmd) {
93625
93003
  const mainCommand = cmd.getMainCommand();
93626
93004
  const upgradeCommand = mainCommand.getCommand("upgrade");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.711.0",
3
+ "version": "1.713.0",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",