windmill-cli 1.712.0 → 1.713.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/main.js +31 -692
- 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.
|
|
16775
|
+
VERSION: "1.713.1",
|
|
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}`));
|
|
@@ -69962,6 +69964,7 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
|
|
|
69962
69964
|
summary: localApp.summary,
|
|
69963
69965
|
policy: appForPolicy.policy,
|
|
69964
69966
|
deployment_message: message,
|
|
69967
|
+
skip_draft_deletion: true,
|
|
69965
69968
|
...localApp.custom_path ? { custom_path: localApp.custom_path } : {}
|
|
69966
69969
|
},
|
|
69967
69970
|
js,
|
|
@@ -69980,6 +69983,7 @@ async function pushRawApp(workspace, remotePath, localPath, message) {
|
|
|
69980
69983
|
summary: localApp.summary,
|
|
69981
69984
|
policy: appForPolicy.policy,
|
|
69982
69985
|
deployment_message: message,
|
|
69986
|
+
skip_draft_deletion: true,
|
|
69983
69987
|
...localApp.custom_path ? { custom_path: localApp.custom_path } : {}
|
|
69984
69988
|
},
|
|
69985
69989
|
js,
|
|
@@ -72879,7 +72883,8 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
72879
72883
|
requestBody: {
|
|
72880
72884
|
deployment_message: message,
|
|
72881
72885
|
...localAppBody,
|
|
72882
|
-
...preserveFields
|
|
72886
|
+
...preserveFields,
|
|
72887
|
+
skip_draft_deletion: true
|
|
72883
72888
|
}
|
|
72884
72889
|
});
|
|
72885
72890
|
}
|
|
@@ -72891,7 +72896,8 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
72891
72896
|
path: remotePath,
|
|
72892
72897
|
deployment_message: message,
|
|
72893
72898
|
...localAppBody,
|
|
72894
|
-
...preserveFields
|
|
72899
|
+
...preserveFields,
|
|
72900
|
+
skip_draft_deletion: true
|
|
72895
72901
|
}
|
|
72896
72902
|
});
|
|
72897
72903
|
}
|
|
@@ -73065,7 +73071,8 @@ var init_app = __esm(async () => {
|
|
|
73065
73071
|
on_behalf_of: `u/${username}`,
|
|
73066
73072
|
on_behalf_of_email: email
|
|
73067
73073
|
},
|
|
73068
|
-
preserve_on_behalf_of: true
|
|
73074
|
+
preserve_on_behalf_of: true,
|
|
73075
|
+
skip_draft_deletion: true
|
|
73069
73076
|
}
|
|
73070
73077
|
});
|
|
73071
73078
|
info(colors.green(`Updated permissioned_as for app ${appPath} to ${email}`));
|
|
@@ -76273,7 +76280,8 @@ async function pushFlow(workspace, remotePath, localPath, message, permissionedA
|
|
|
76273
76280
|
path: remotePath.replaceAll(SEP20, "/"),
|
|
76274
76281
|
deployment_message: message,
|
|
76275
76282
|
...localFlowBody,
|
|
76276
|
-
...preserveFields
|
|
76283
|
+
...preserveFields,
|
|
76284
|
+
skip_draft_deletion: true
|
|
76277
76285
|
}
|
|
76278
76286
|
});
|
|
76279
76287
|
}
|
|
@@ -76286,7 +76294,8 @@ async function pushFlow(workspace, remotePath, localPath, message, permissionedA
|
|
|
76286
76294
|
path: remotePath.replaceAll(SEP20, "/"),
|
|
76287
76295
|
deployment_message: message,
|
|
76288
76296
|
...localFlowBody,
|
|
76289
|
-
...preserveFields
|
|
76297
|
+
...preserveFields,
|
|
76298
|
+
skip_draft_deletion: true
|
|
76290
76299
|
}
|
|
76291
76300
|
});
|
|
76292
76301
|
} catch (e) {
|
|
@@ -76912,7 +76921,8 @@ var init_flow = __esm(async () => {
|
|
|
76912
76921
|
...remote,
|
|
76913
76922
|
path: flowPath,
|
|
76914
76923
|
on_behalf_of_email: email,
|
|
76915
|
-
preserve_on_behalf_of: true
|
|
76924
|
+
preserve_on_behalf_of: true,
|
|
76925
|
+
skip_draft_deletion: true
|
|
76916
76926
|
}
|
|
76917
76927
|
});
|
|
76918
76928
|
info(colors.green(`Updated permissioned_as for flow ${flowPath} to ${email}`));
|
|
@@ -78014,7 +78024,7 @@ var init_skills_gen = __esm(() => {
|
|
|
78014
78024
|
{ name: "write-script-bash", description: "MUST use when writing Bash scripts.", languageKey: "bash" },
|
|
78015
78025
|
{ name: "write-script-bigquery", description: "MUST use when writing BigQuery queries.", languageKey: "bigquery" },
|
|
78016
78026
|
{ name: "write-script-bun", description: "MUST use when writing Bun/TypeScript scripts.", languageKey: "bun" },
|
|
78017
|
-
{ 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" },
|
|
78018
78028
|
{ name: "write-script-csharp", description: "MUST use when writing C# scripts.", languageKey: "csharp" },
|
|
78019
78029
|
{ name: "write-script-deno", description: "MUST use when writing Deno/TypeScript scripts.", languageKey: "deno" },
|
|
78020
78030
|
{ name: "write-script-duckdb", description: "MUST use when writing DuckDB queries.", languageKey: "duckdb" },
|
|
@@ -78023,7 +78033,6 @@ var init_skills_gen = __esm(() => {
|
|
|
78023
78033
|
{ name: "write-script-java", description: "MUST use when writing Java scripts.", languageKey: "java" },
|
|
78024
78034
|
{ name: "write-script-mssql", description: "MUST use when writing MS SQL Server queries.", languageKey: "mssql" },
|
|
78025
78035
|
{ name: "write-script-mysql", description: "MUST use when writing MySQL queries.", languageKey: "mysql" },
|
|
78026
|
-
{ name: "write-script-nativets", description: "MUST use when writing Native TypeScript scripts.", languageKey: "nativets" },
|
|
78027
78036
|
{ name: "write-script-php", description: "MUST use when writing PHP scripts.", languageKey: "php" },
|
|
78028
78037
|
{ name: "write-script-postgresql", description: "MUST use when writing PostgreSQL queries.", languageKey: "postgresql" },
|
|
78029
78038
|
{ name: "write-script-powershell", description: "MUST use when writing PowerShell scripts.", languageKey: "powershell" },
|
|
@@ -78928,7 +78937,7 @@ ducklake(name: string = "main"): SqlTemplateFunction
|
|
|
78928
78937
|
`,
|
|
78929
78938
|
"write-script-bunnative": `---
|
|
78930
78939
|
name: write-script-bunnative
|
|
78931
|
-
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.
|
|
78932
78941
|
---
|
|
78933
78942
|
|
|
78934
78943
|
## CLI Commands
|
|
@@ -78968,13 +78977,14 @@ Use \`wmill resource-type list --schema\` to discover available resource types.
|
|
|
78968
78977
|
|
|
78969
78978
|
# TypeScript (Bun Native)
|
|
78970
78979
|
|
|
78971
|
-
Native TypeScript execution
|
|
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.
|
|
78972
78981
|
|
|
78973
78982
|
## Structure
|
|
78974
78983
|
|
|
78975
78984
|
Export a single **async** function called \`main\`:
|
|
78976
78985
|
|
|
78977
78986
|
\`\`\`typescript
|
|
78987
|
+
//native
|
|
78978
78988
|
export async function main(param1: string, param2: number) {
|
|
78979
78989
|
// Your code here
|
|
78980
78990
|
return { result: param1, count: param2 };
|
|
@@ -78990,6 +79000,7 @@ On Windmill, credentials and configuration are stored in resources and passed as
|
|
|
78990
79000
|
Use the \`RT\` namespace for resource types:
|
|
78991
79001
|
|
|
78992
79002
|
\`\`\`typescript
|
|
79003
|
+
//native
|
|
78993
79004
|
export async function main(stripe: RT.Stripe) {
|
|
78994
79005
|
// stripe contains API key and config from the resource
|
|
78995
79006
|
}
|
|
@@ -79001,9 +79012,10 @@ Before using a resource type, check the \`rt.d.ts\` file in the project root to
|
|
|
79001
79012
|
|
|
79002
79013
|
## Imports
|
|
79003
79014
|
|
|
79004
|
-
**
|
|
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:
|
|
79005
79016
|
|
|
79006
79017
|
\`\`\`typescript
|
|
79018
|
+
//native
|
|
79007
79019
|
export async function main(url: string) {
|
|
79008
79020
|
const response = await fetch(url);
|
|
79009
79021
|
return await response.json();
|
|
@@ -79012,13 +79024,14 @@ export async function main(url: string) {
|
|
|
79012
79024
|
|
|
79013
79025
|
## Windmill Client
|
|
79014
79026
|
|
|
79015
|
-
|
|
79027
|
+
\`windmill-client\` is available for Windmill-specific primitives such as the S3 helpers below (\`loadS3File\`, \`loadS3FileStream\`, \`writeS3File\`, \`S3Object\`). Use \`fetch\` for plain HTTP.
|
|
79016
79028
|
|
|
79017
79029
|
## Preprocessor Scripts
|
|
79018
79030
|
|
|
79019
79031
|
For preprocessor scripts, the function should be named \`preprocessor\` and receives an \`event\` parameter:
|
|
79020
79032
|
|
|
79021
79033
|
\`\`\`typescript
|
|
79034
|
+
//native
|
|
79022
79035
|
type Event = {
|
|
79023
79036
|
kind:
|
|
79024
79037
|
| "webhook"
|
|
@@ -79051,6 +79064,7 @@ Windmill provides built-in support for S3-compatible storage operations. The \`w
|
|
|
79051
79064
|
### Receiving an S3Object as a script parameter
|
|
79052
79065
|
|
|
79053
79066
|
\`\`\`typescript
|
|
79067
|
+
//native
|
|
79054
79068
|
import * as wmill from "windmill-client";
|
|
79055
79069
|
|
|
79056
79070
|
export async function main(file: wmill.S3Object) {
|
|
@@ -79062,6 +79076,7 @@ export async function main(file: wmill.S3Object) {
|
|
|
79062
79076
|
### S3 operations
|
|
79063
79077
|
|
|
79064
79078
|
\`\`\`typescript
|
|
79079
|
+
//native
|
|
79065
79080
|
import * as wmill from "windmill-client";
|
|
79066
79081
|
|
|
79067
79082
|
// Load file content from S3
|
|
@@ -80978,682 +80993,6 @@ All keys are optional: \`prefix\` (object key prefix), \`storage\` (named storag
|
|
|
80978
80993
|
omit to use the workspace default), \`format\` (\`json\` (default), \`parquet\`, or
|
|
80979
80994
|
\`csv\`). Use this for large result sets — rows stream directly to S3 instead of
|
|
80980
80995
|
being buffered as the script return value.
|
|
80981
|
-
`,
|
|
80982
|
-
"write-script-nativets": `---
|
|
80983
|
-
name: write-script-nativets
|
|
80984
|
-
description: MUST use when writing Native TypeScript scripts.
|
|
80985
|
-
---
|
|
80986
|
-
|
|
80987
|
-
## CLI Commands
|
|
80988
|
-
|
|
80989
|
-
Place scripts in a folder.
|
|
80990
|
-
|
|
80991
|
-
After writing, tell the user which command fits what they want to do:
|
|
80992
|
-
|
|
80993
|
-
- \`wmill script preview <script_path>\` — **default when iterating on a local script.** Runs the local file without deploying.
|
|
80994
|
-
- \`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.
|
|
80995
|
-
- \`wmill generate-metadata\` — generate \`.script.yaml\` and \`.lock\` files for the script you modified.
|
|
80996
|
-
- \`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".
|
|
80997
|
-
|
|
80998
|
-
### Preview vs run — choose by intent, not habit
|
|
80999
|
-
|
|
81000
|
-
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.
|
|
81001
|
-
|
|
81002
|
-
Only use \`script run\` when:
|
|
81003
|
-
- The user explicitly says "run the deployed version" / "run what's on the server".
|
|
81004
|
-
- There is no local script being edited (you're just invoking an existing script).
|
|
81005
|
-
|
|
81006
|
-
Only use \`sync push\` when:
|
|
81007
|
-
- The user explicitly asks to deploy, publish, push, or ship.
|
|
81008
|
-
- The preview has already validated the change and the user wants it in the workspace.
|
|
81009
|
-
|
|
81010
|
-
### After writing — offer to test, don't wait passively
|
|
81011
|
-
|
|
81012
|
-
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.
|
|
81013
|
-
|
|
81014
|
-
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.
|
|
81015
|
-
|
|
81016
|
-
\`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.
|
|
81017
|
-
|
|
81018
|
-
For a **visual** open-the-script-in-the-dev-page preview (rather than \`script preview\`'s run-and-print-result), use the \`preview\` skill.
|
|
81019
|
-
|
|
81020
|
-
Use \`wmill resource-type list --schema\` to discover available resource types.
|
|
81021
|
-
|
|
81022
|
-
# TypeScript (Native)
|
|
81023
|
-
|
|
81024
|
-
Native TypeScript execution with fetch only - no external imports allowed.
|
|
81025
|
-
|
|
81026
|
-
## Structure
|
|
81027
|
-
|
|
81028
|
-
Export a single **async** function called \`main\`:
|
|
81029
|
-
|
|
81030
|
-
\`\`\`typescript
|
|
81031
|
-
export async function main(param1: string, param2: number) {
|
|
81032
|
-
// Your code here
|
|
81033
|
-
return { result: param1, count: param2 };
|
|
81034
|
-
}
|
|
81035
|
-
\`\`\`
|
|
81036
|
-
|
|
81037
|
-
Do not call the main function.
|
|
81038
|
-
|
|
81039
|
-
## Resource Types
|
|
81040
|
-
|
|
81041
|
-
On Windmill, credentials and configuration are stored in resources and passed as parameters to main.
|
|
81042
|
-
|
|
81043
|
-
Use the \`RT\` namespace for resource types:
|
|
81044
|
-
|
|
81045
|
-
\`\`\`typescript
|
|
81046
|
-
export async function main(stripe: RT.Stripe) {
|
|
81047
|
-
// stripe contains API key and config from the resource
|
|
81048
|
-
}
|
|
81049
|
-
\`\`\`
|
|
81050
|
-
|
|
81051
|
-
Only use resource types if you need them to satisfy the instructions. Always use the RT namespace.
|
|
81052
|
-
|
|
81053
|
-
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\`.
|
|
81054
|
-
|
|
81055
|
-
## Imports
|
|
81056
|
-
|
|
81057
|
-
**No imports allowed.** Use the globally available \`fetch\` function:
|
|
81058
|
-
|
|
81059
|
-
\`\`\`typescript
|
|
81060
|
-
export async function main(url: string) {
|
|
81061
|
-
const response = await fetch(url);
|
|
81062
|
-
return await response.json();
|
|
81063
|
-
}
|
|
81064
|
-
\`\`\`
|
|
81065
|
-
|
|
81066
|
-
## Windmill Client
|
|
81067
|
-
|
|
81068
|
-
The windmill client is not available in native TypeScript mode. Use fetch to call APIs directly.
|
|
81069
|
-
|
|
81070
|
-
## Preprocessor Scripts
|
|
81071
|
-
|
|
81072
|
-
For preprocessor scripts, the function should be named \`preprocessor\` and receives an \`event\` parameter:
|
|
81073
|
-
|
|
81074
|
-
\`\`\`typescript
|
|
81075
|
-
type Event = {
|
|
81076
|
-
kind:
|
|
81077
|
-
| "webhook"
|
|
81078
|
-
| "http"
|
|
81079
|
-
| "websocket"
|
|
81080
|
-
| "kafka"
|
|
81081
|
-
| "email"
|
|
81082
|
-
| "nats"
|
|
81083
|
-
| "postgres"
|
|
81084
|
-
| "sqs"
|
|
81085
|
-
| "mqtt"
|
|
81086
|
-
| "gcp";
|
|
81087
|
-
body: any;
|
|
81088
|
-
headers: Record<string, string>;
|
|
81089
|
-
query: Record<string, string>;
|
|
81090
|
-
};
|
|
81091
|
-
|
|
81092
|
-
export async function preprocessor(event: Event) {
|
|
81093
|
-
return {
|
|
81094
|
-
param1: event.body.field1,
|
|
81095
|
-
param2: event.query.id
|
|
81096
|
-
};
|
|
81097
|
-
}
|
|
81098
|
-
\`\`\`
|
|
81099
|
-
|
|
81100
|
-
|
|
81101
|
-
# TypeScript SDK (windmill-client)
|
|
81102
|
-
|
|
81103
|
-
Import: import * as wmill from 'windmill-client'
|
|
81104
|
-
|
|
81105
|
-
workerHasInternalServer(): boolean
|
|
81106
|
-
|
|
81107
|
-
/**
|
|
81108
|
-
* Initialize the Windmill client with authentication token and base URL
|
|
81109
|
-
* @param token - Authentication token (defaults to WM_TOKEN env variable)
|
|
81110
|
-
* @param baseUrl - API base URL (defaults to BASE_INTERNAL_URL or BASE_URL env variable)
|
|
81111
|
-
*/
|
|
81112
|
-
setClient(token?: string, baseUrl?: string): void
|
|
81113
|
-
|
|
81114
|
-
/**
|
|
81115
|
-
* Create a client configuration from env variables
|
|
81116
|
-
* @returns client configuration
|
|
81117
|
-
*/
|
|
81118
|
-
getWorkspace(): string
|
|
81119
|
-
|
|
81120
|
-
/**
|
|
81121
|
-
* Get a resource value by path
|
|
81122
|
-
* @param path path of the resource, default to internal state path
|
|
81123
|
-
* @param undefinedIfEmpty if the resource does not exist, return undefined instead of throwing an error
|
|
81124
|
-
* @returns resource value
|
|
81125
|
-
*/
|
|
81126
|
-
async getResource(path?: string, undefinedIfEmpty?: boolean): Promise<any>
|
|
81127
|
-
|
|
81128
|
-
/**
|
|
81129
|
-
* Get the true root job id
|
|
81130
|
-
* @param jobId job id to get the root job id from (default to current job)
|
|
81131
|
-
* @returns root job id
|
|
81132
|
-
*/
|
|
81133
|
-
async getRootJobId(jobId?: string): Promise<string>
|
|
81134
|
-
|
|
81135
|
-
/**
|
|
81136
|
-
* @deprecated Use runScriptByPath or runScriptByHash instead
|
|
81137
|
-
*/
|
|
81138
|
-
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
|
81139
|
-
|
|
81140
|
-
/**
|
|
81141
|
-
* Run a script synchronously by its path and wait for the result
|
|
81142
|
-
* @param path - Script path in Windmill
|
|
81143
|
-
* @param args - Arguments to pass to the script
|
|
81144
|
-
* @param verbose - Enable verbose logging
|
|
81145
|
-
* @returns Script execution result
|
|
81146
|
-
*/
|
|
81147
|
-
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
|
81148
|
-
|
|
81149
|
-
/**
|
|
81150
|
-
* Run a script synchronously by its hash and wait for the result
|
|
81151
|
-
* @param hash_ - Script hash in Windmill
|
|
81152
|
-
* @param args - Arguments to pass to the script
|
|
81153
|
-
* @param verbose - Enable verbose logging
|
|
81154
|
-
* @returns Script execution result
|
|
81155
|
-
*/
|
|
81156
|
-
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
|
81157
|
-
|
|
81158
|
-
/**
|
|
81159
|
-
* Append a text to the result stream
|
|
81160
|
-
* @param text text to append to the result stream
|
|
81161
|
-
*/
|
|
81162
|
-
appendToResultStream(text: string): void
|
|
81163
|
-
|
|
81164
|
-
/**
|
|
81165
|
-
* Stream to the result stream
|
|
81166
|
-
* @param stream stream to stream to the result stream
|
|
81167
|
-
*/
|
|
81168
|
-
async streamResult(stream: AsyncIterable<string>): Promise<void>
|
|
81169
|
-
|
|
81170
|
-
/**
|
|
81171
|
-
* Run a flow synchronously by its path and wait for the result
|
|
81172
|
-
* @param path - Flow path in Windmill
|
|
81173
|
-
* @param args - Arguments to pass to the flow
|
|
81174
|
-
* @param verbose - Enable verbose logging
|
|
81175
|
-
* @returns Flow execution result
|
|
81176
|
-
*/
|
|
81177
|
-
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
|
81178
|
-
|
|
81179
|
-
/**
|
|
81180
|
-
* Wait for a job to complete and return its result
|
|
81181
|
-
* @param jobId - ID of the job to wait for
|
|
81182
|
-
* @param verbose - Enable verbose logging
|
|
81183
|
-
* @returns Job result when completed
|
|
81184
|
-
*/
|
|
81185
|
-
async waitJob(jobId: string, verbose: boolean = false): Promise<any>
|
|
81186
|
-
|
|
81187
|
-
/**
|
|
81188
|
-
* Get the result of a completed job
|
|
81189
|
-
* @param jobId - ID of the completed job
|
|
81190
|
-
* @returns Job result
|
|
81191
|
-
*/
|
|
81192
|
-
async getResult(jobId: string): Promise<any>
|
|
81193
|
-
|
|
81194
|
-
/**
|
|
81195
|
-
* Get the result of a job if completed, or its current status
|
|
81196
|
-
* @param jobId - ID of the job
|
|
81197
|
-
* @returns Object with started, completed, success, and result properties
|
|
81198
|
-
*/
|
|
81199
|
-
async getResultMaybe(jobId: string): Promise<any>
|
|
81200
|
-
|
|
81201
|
-
/**
|
|
81202
|
-
* @deprecated Use runScriptByPathAsync or runScriptByHashAsync instead
|
|
81203
|
-
*/
|
|
81204
|
-
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null): Promise<string>
|
|
81205
|
-
|
|
81206
|
-
/**
|
|
81207
|
-
* Run a script asynchronously by its path
|
|
81208
|
-
* @param path - Script path in Windmill
|
|
81209
|
-
* @param args - Arguments to pass to the script
|
|
81210
|
-
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
|
81211
|
-
* @returns Job ID of the created job
|
|
81212
|
-
*/
|
|
81213
|
-
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
|
81214
|
-
|
|
81215
|
-
/**
|
|
81216
|
-
* Run a script asynchronously by its hash
|
|
81217
|
-
* @param hash_ - Script hash in Windmill
|
|
81218
|
-
* @param args - Arguments to pass to the script
|
|
81219
|
-
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
|
81220
|
-
* @returns Job ID of the created job
|
|
81221
|
-
*/
|
|
81222
|
-
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
|
81223
|
-
|
|
81224
|
-
/**
|
|
81225
|
-
* Run a flow asynchronously by its path
|
|
81226
|
-
* @param path - Flow path in Windmill
|
|
81227
|
-
* @param args - Arguments to pass to the flow
|
|
81228
|
-
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
|
81229
|
-
* @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
|
|
81230
|
-
* @returns Job ID of the created job
|
|
81231
|
-
*/
|
|
81232
|
-
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>
|
|
81233
|
-
|
|
81234
|
-
/**
|
|
81235
|
-
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
|
81236
|
-
* @param obj resource value or path of the resource under the format \`$res:path\`
|
|
81237
|
-
* @returns resource value
|
|
81238
|
-
*/
|
|
81239
|
-
async resolveDefaultResource(obj: any): Promise<any>
|
|
81240
|
-
|
|
81241
|
-
/**
|
|
81242
|
-
* Get the state file path from environment variables
|
|
81243
|
-
* @returns State path string
|
|
81244
|
-
*/
|
|
81245
|
-
getStatePath(): string
|
|
81246
|
-
|
|
81247
|
-
/**
|
|
81248
|
-
* Set a resource value by path
|
|
81249
|
-
* @param path path of the resource to set, default to state path
|
|
81250
|
-
* @param value new value of the resource to set
|
|
81251
|
-
* @param initializeToTypeIfNotExist if the resource does not exist, initialize it with this type
|
|
81252
|
-
*/
|
|
81253
|
-
async setResource(value: any, path?: string, initializeToTypeIfNotExist?: string): Promise<void>
|
|
81254
|
-
|
|
81255
|
-
/**
|
|
81256
|
-
* Set the state
|
|
81257
|
-
* @param state state to set
|
|
81258
|
-
* @deprecated use setState instead
|
|
81259
|
-
*/
|
|
81260
|
-
async setInternalState(state: any): Promise<void>
|
|
81261
|
-
|
|
81262
|
-
/**
|
|
81263
|
-
* Set the state
|
|
81264
|
-
* @param state state to set
|
|
81265
|
-
* @param path Optional state resource path override. Defaults to \`getStatePath()\`.
|
|
81266
|
-
*/
|
|
81267
|
-
async setState(state: any, path?: string): Promise<void>
|
|
81268
|
-
|
|
81269
|
-
/**
|
|
81270
|
-
* Set the progress
|
|
81271
|
-
* Progress cannot go back and limited to 0% to 99% range
|
|
81272
|
-
* @param percent Progress to set in %
|
|
81273
|
-
* @param jobId? Job to set progress for
|
|
81274
|
-
*/
|
|
81275
|
-
async setProgress(percent: number, jobId?: any): Promise<void>
|
|
81276
|
-
|
|
81277
|
-
/**
|
|
81278
|
-
* Get the progress
|
|
81279
|
-
* @param jobId? Job to get progress from
|
|
81280
|
-
* @returns Optional clamped between 0 and 100 progress value
|
|
81281
|
-
*/
|
|
81282
|
-
async getProgress(jobId?: any): Promise<number | null>
|
|
81283
|
-
|
|
81284
|
-
/**
|
|
81285
|
-
* Set a flow user state
|
|
81286
|
-
* @param key key of the state
|
|
81287
|
-
* @param value value of the state
|
|
81288
|
-
*/
|
|
81289
|
-
async setFlowUserState(key: string, value: any, errorIfNotPossible?: boolean): Promise<void>
|
|
81290
|
-
|
|
81291
|
-
/**
|
|
81292
|
-
* Get a flow user state
|
|
81293
|
-
* @param path path of the variable
|
|
81294
|
-
*/
|
|
81295
|
-
async getFlowUserState(key: string, errorIfNotPossible?: boolean): Promise<any>
|
|
81296
|
-
|
|
81297
|
-
/**
|
|
81298
|
-
* Get the internal state
|
|
81299
|
-
* @deprecated use getState instead
|
|
81300
|
-
*/
|
|
81301
|
-
async getInternalState(): Promise<any>
|
|
81302
|
-
|
|
81303
|
-
/**
|
|
81304
|
-
* Get the state shared across executions
|
|
81305
|
-
* @param path Optional state resource path override. Defaults to \`getStatePath()\`.
|
|
81306
|
-
*/
|
|
81307
|
-
async getState(path?: string): Promise<any>
|
|
81308
|
-
|
|
81309
|
-
/**
|
|
81310
|
-
* Get a variable by path
|
|
81311
|
-
* @param path path of the variable
|
|
81312
|
-
* @returns variable value
|
|
81313
|
-
*/
|
|
81314
|
-
async getVariable(path: string): Promise<string>
|
|
81315
|
-
|
|
81316
|
-
/**
|
|
81317
|
-
* Set a variable by path, create if not exist
|
|
81318
|
-
* @param path path of the variable
|
|
81319
|
-
* @param value value of the variable
|
|
81320
|
-
* @param isSecretIfNotExist if the variable does not exist, create it as secret or not (default: false)
|
|
81321
|
-
* @param descriptionIfNotExist if the variable does not exist, create it with this description (default: "")
|
|
81322
|
-
*/
|
|
81323
|
-
async setVariable(path: string, value: string, isSecretIfNotExist?: boolean, descriptionIfNotExist?: string): Promise<void>
|
|
81324
|
-
|
|
81325
|
-
/**
|
|
81326
|
-
* Build a PostgreSQL connection URL from a database resource
|
|
81327
|
-
* @param path - Path to the database resource
|
|
81328
|
-
* @returns PostgreSQL connection URL string
|
|
81329
|
-
*/
|
|
81330
|
-
async databaseUrlFromResource(path: string): Promise<string>
|
|
81331
|
-
|
|
81332
|
-
async polarsConnectionSettings(s3_resource_path: string | undefined): Promise<any>
|
|
81333
|
-
|
|
81334
|
-
async duckdbConnectionSettings(s3_resource_path: string | undefined): Promise<any>
|
|
81335
|
-
|
|
81336
|
-
/**
|
|
81337
|
-
* Get S3 client settings from a resource or workspace default
|
|
81338
|
-
* @param s3_resource_path - Path to S3 resource (uses workspace default if undefined)
|
|
81339
|
-
* @param workspace - Workspace to read from (defaults to the \`WM_WORKSPACE\` env var)
|
|
81340
|
-
* @returns S3 client configuration settings
|
|
81341
|
-
*/
|
|
81342
|
-
async denoS3LightClientSettings(s3_resource_path: string | undefined, workspace: string | undefined = undefined): Promise<DenoS3LightClientSettings>
|
|
81343
|
-
|
|
81344
|
-
/**
|
|
81345
|
-
* Load the content of a file stored in S3. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
|
|
81346
|
-
*
|
|
81347
|
-
* \`\`\`typescript
|
|
81348
|
-
* let fileContent = await wmill.loadS3FileContent(inputFile)
|
|
81349
|
-
* // if the file is a raw text file, it can be decoded and printed directly:
|
|
81350
|
-
* const text = new TextDecoder().decode(fileContentStream)
|
|
81351
|
-
* console.log(text);
|
|
81352
|
-
* \`\`\`
|
|
81353
|
-
*
|
|
81354
|
-
* @param workspace - Workspace to read from (defaults to the \`WM_WORKSPACE\` env var)
|
|
81355
|
-
*/
|
|
81356
|
-
async loadS3File(s3object: S3Object, s3ResourcePath: string | undefined = undefined, workspace: string | undefined = undefined): Promise<Uint8Array | undefined>
|
|
81357
|
-
|
|
81358
|
-
/**
|
|
81359
|
-
* 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.
|
|
81360
|
-
*
|
|
81361
|
-
* \`\`\`typescript
|
|
81362
|
-
* let fileContentBlob = await wmill.loadS3FileStream(inputFile)
|
|
81363
|
-
* // if the content is plain text, the blob can be read directly:
|
|
81364
|
-
* console.log(await fileContentBlob.text());
|
|
81365
|
-
* \`\`\`
|
|
81366
|
-
*
|
|
81367
|
-
* @param workspace - Workspace to read from (defaults to the \`WM_WORKSPACE\` env var)
|
|
81368
|
-
*/
|
|
81369
|
-
async loadS3FileStream(s3object: S3Object, s3ResourcePath: string | undefined = undefined, workspace: string | undefined = undefined): Promise<Blob | undefined>
|
|
81370
|
-
|
|
81371
|
-
/**
|
|
81372
|
-
* Persist a file to the S3 bucket. If the s3ResourcePath is undefined, it will default to the workspace S3 resource.
|
|
81373
|
-
*
|
|
81374
|
-
* \`\`\`typescript
|
|
81375
|
-
* const s3object = await writeS3File(s3Object, "Hello Windmill!")
|
|
81376
|
-
* const fileContentAsUtf8Str = (await s3object.toArray()).toString('utf-8')
|
|
81377
|
-
* console.log(fileContentAsUtf8Str)
|
|
81378
|
-
* \`\`\`
|
|
81379
|
-
*
|
|
81380
|
-
* @param workspace - Workspace to write to (defaults to the \`WM_WORKSPACE\` env var)
|
|
81381
|
-
*/
|
|
81382
|
-
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>
|
|
81383
|
-
|
|
81384
|
-
/**
|
|
81385
|
-
* Permanently delete a file from S3 by key.
|
|
81386
|
-
*
|
|
81387
|
-
* \`\`\`typescript
|
|
81388
|
-
* await wmill.deleteS3File({ s3: "path/to/file.txt" })
|
|
81389
|
-
* \`\`\`
|
|
81390
|
-
*
|
|
81391
|
-
* @param s3object - S3 object identifying the file to delete (must have \`s3\` set)
|
|
81392
|
-
* @param workspace - Workspace to delete from (defaults to the \`WM_WORKSPACE\` env var)
|
|
81393
|
-
*/
|
|
81394
|
-
async deleteS3File(s3object: S3Object, workspace: string | undefined = undefined): Promise<void>
|
|
81395
|
-
|
|
81396
|
-
/**
|
|
81397
|
-
* Sign S3 objects to be used by anonymous users in public apps
|
|
81398
|
-
* @param s3objects s3 objects to sign
|
|
81399
|
-
* @returns signed s3 objects
|
|
81400
|
-
*/
|
|
81401
|
-
async signS3Objects(s3objects: S3Object[]): Promise<S3Object[]>
|
|
81402
|
-
|
|
81403
|
-
/**
|
|
81404
|
-
* Sign S3 object to be used by anonymous users in public apps
|
|
81405
|
-
* @param s3object s3 object to sign
|
|
81406
|
-
* @returns signed s3 object
|
|
81407
|
-
*/
|
|
81408
|
-
async signS3Object(s3object: S3Object): Promise<S3Object>
|
|
81409
|
-
|
|
81410
|
-
/**
|
|
81411
|
-
* Generate a presigned public URL for an array of S3 objects.
|
|
81412
|
-
* If an S3 object is not signed yet, it will be signed first.
|
|
81413
|
-
* @param s3Objects s3 objects to sign
|
|
81414
|
-
* @returns list of signed public URLs
|
|
81415
|
-
*/
|
|
81416
|
-
async getPresignedS3PublicUrls(s3Objects: S3Object[], { baseUrl }: { baseUrl?: string } = {}): Promise<string[]>
|
|
81417
|
-
|
|
81418
|
-
/**
|
|
81419
|
-
* Generate a presigned public URL for an S3 object. If the S3 object is not signed yet, it will be signed first.
|
|
81420
|
-
* @param s3Object s3 object to sign
|
|
81421
|
-
* @returns signed public URL
|
|
81422
|
-
*/
|
|
81423
|
-
async getPresignedS3PublicUrl(s3Objects: S3Object, { baseUrl }: { baseUrl?: string } = {}): Promise<string>
|
|
81424
|
-
|
|
81425
|
-
/**
|
|
81426
|
-
* Get URLs needed for resuming a flow after this step
|
|
81427
|
-
* @param approver approver name
|
|
81428
|
-
* @param flowLevel if true, generate resume URLs for the parent flow instead of the specific step.
|
|
81429
|
-
* This allows pre-approvals that can be consumed by any later suspend step in the same flow.
|
|
81430
|
-
* @returns approval page UI URL, resume and cancel API URLs for resuming the flow
|
|
81431
|
-
*/
|
|
81432
|
-
async getResumeUrls(approver?: string, flowLevel?: boolean): Promise<{
|
|
81433
|
-
approvalPage: string;
|
|
81434
|
-
resume: string;
|
|
81435
|
-
cancel: string;
|
|
81436
|
-
}>
|
|
81437
|
-
|
|
81438
|
-
/**
|
|
81439
|
-
* @deprecated use getResumeUrls instead
|
|
81440
|
-
*/
|
|
81441
|
-
getResumeEndpoints(approver?: string): Promise<{
|
|
81442
|
-
approvalPage: string;
|
|
81443
|
-
resume: string;
|
|
81444
|
-
cancel: string;
|
|
81445
|
-
}>
|
|
81446
|
-
|
|
81447
|
-
/**
|
|
81448
|
-
* Get an OIDC jwt token for auth to external services (e.g: Vault, AWS) (ee only)
|
|
81449
|
-
* @param audience audience of the token
|
|
81450
|
-
* @param expiresIn Optional number of seconds until the token expires
|
|
81451
|
-
* @returns jwt token
|
|
81452
|
-
*/
|
|
81453
|
-
async getIdToken(audience: string, expiresIn?: number): Promise<string>
|
|
81454
|
-
|
|
81455
|
-
/**
|
|
81456
|
-
* Convert a base64-encoded string to Uint8Array
|
|
81457
|
-
* @param data - Base64-encoded string
|
|
81458
|
-
* @returns Decoded Uint8Array
|
|
81459
|
-
*/
|
|
81460
|
-
base64ToUint8Array(data: string): Uint8Array
|
|
81461
|
-
|
|
81462
|
-
/**
|
|
81463
|
-
* Convert a Uint8Array to base64-encoded string
|
|
81464
|
-
* @param arrayBuffer - Uint8Array to encode
|
|
81465
|
-
* @returns Base64-encoded string
|
|
81466
|
-
*/
|
|
81467
|
-
uint8ArrayToBase64(arrayBuffer: Uint8Array): string
|
|
81468
|
-
|
|
81469
|
-
/**
|
|
81470
|
-
* Get email from workspace username
|
|
81471
|
-
* This method is particularly useful for apps that require the email address of the viewer.
|
|
81472
|
-
* 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.
|
|
81473
|
-
* @param username
|
|
81474
|
-
* @returns email address
|
|
81475
|
-
*/
|
|
81476
|
-
async usernameToEmail(username: string): Promise<string>
|
|
81477
|
-
|
|
81478
|
-
/**
|
|
81479
|
-
* Sends an interactive approval request via Slack, allowing optional customization of the message, approver, and form fields.
|
|
81480
|
-
*
|
|
81481
|
-
* **[Enterprise Edition Only]** To include form fields in the Slack approval request, go to **Advanced -> Suspend -> Form**
|
|
81482
|
-
* and define a form. Learn more at [Windmill Documentation](https://www.windmill.dev/docs/flows/flow_approval#form).
|
|
81483
|
-
*
|
|
81484
|
-
* @param {Object} options - The configuration options for the Slack approval request.
|
|
81485
|
-
* @param {string} options.slackResourcePath - The path to the Slack resource in Windmill.
|
|
81486
|
-
* @param {string} options.channelId - The Slack channel ID where the approval request will be sent.
|
|
81487
|
-
* @param {string} [options.message] - Optional custom message to include in the Slack approval request.
|
|
81488
|
-
* @param {string} [options.approver] - Optional user ID or name of the approver for the request.
|
|
81489
|
-
* @param {DefaultArgs} [options.defaultArgsJson] - Optional object defining or overriding the default arguments to a form field.
|
|
81490
|
-
* @param {Enums} [options.dynamicEnumsJson] - Optional object overriding the enum default values of an enum form field.
|
|
81491
|
-
* @param {string} [options.resumeButtonText] - Optional text for the resume button.
|
|
81492
|
-
* @param {string} [options.cancelButtonText] - Optional text for the cancel button.
|
|
81493
|
-
*
|
|
81494
|
-
* @returns {Promise<void>} Resolves when the Slack approval request is successfully sent.
|
|
81495
|
-
*
|
|
81496
|
-
* @throws {Error} If the function is not called within a flow or flow preview.
|
|
81497
|
-
* @throws {Error} If the \`JobService.getSlackApprovalPayload\` call fails.
|
|
81498
|
-
*
|
|
81499
|
-
* **Usage Example:**
|
|
81500
|
-
* \`\`\`typescript
|
|
81501
|
-
* await requestInteractiveSlackApproval({
|
|
81502
|
-
* slackResourcePath: "/u/alex/my_slack_resource",
|
|
81503
|
-
* channelId: "admins-slack-channel",
|
|
81504
|
-
* message: "Please approve this request",
|
|
81505
|
-
* approver: "approver123",
|
|
81506
|
-
* defaultArgsJson: { key1: "value1", key2: 42 },
|
|
81507
|
-
* dynamicEnumsJson: { foo: ["choice1", "choice2"], bar: ["optionA", "optionB"] },
|
|
81508
|
-
* resumeButtonText: "Resume",
|
|
81509
|
-
* cancelButtonText: "Cancel",
|
|
81510
|
-
* });
|
|
81511
|
-
* \`\`\`
|
|
81512
|
-
*
|
|
81513
|
-
* **Note:** This function requires execution within a Windmill flow or flow preview.
|
|
81514
|
-
*/
|
|
81515
|
-
async requestInteractiveSlackApproval({ slackResourcePath, channelId, message, approver, defaultArgsJson, dynamicEnumsJson, resumeButtonText, cancelButtonText, }: SlackApprovalOptions): Promise<void>
|
|
81516
|
-
|
|
81517
|
-
/**
|
|
81518
|
-
* Sends an interactive approval request via Teams, allowing optional customization of the message, approver, and form fields.
|
|
81519
|
-
*
|
|
81520
|
-
* **[Enterprise Edition Only]** To include form fields in the Teams approval request, go to **Advanced -> Suspend -> Form**
|
|
81521
|
-
* and define a form. Learn more at [Windmill Documentation](https://www.windmill.dev/docs/flows/flow_approval#form).
|
|
81522
|
-
*
|
|
81523
|
-
* @param {Object} options - The configuration options for the Teams approval request.
|
|
81524
|
-
* @param {string} options.teamName - The Teams team name where the approval request will be sent.
|
|
81525
|
-
* @param {string} options.channelName - The Teams channel name where the approval request will be sent.
|
|
81526
|
-
* @param {string} [options.message] - Optional custom message to include in the Teams approval request.
|
|
81527
|
-
* @param {string} [options.approver] - Optional user ID or name of the approver for the request.
|
|
81528
|
-
* @param {DefaultArgs} [options.defaultArgsJson] - Optional object defining or overriding the default arguments to a form field.
|
|
81529
|
-
* @param {Enums} [options.dynamicEnumsJson] - Optional object overriding the enum default values of an enum form field.
|
|
81530
|
-
*
|
|
81531
|
-
* @returns {Promise<void>} Resolves when the Teams approval request is successfully sent.
|
|
81532
|
-
*
|
|
81533
|
-
* @throws {Error} If the function is not called within a flow or flow preview.
|
|
81534
|
-
* @throws {Error} If the \`JobService.getTeamsApprovalPayload\` call fails.
|
|
81535
|
-
*
|
|
81536
|
-
* **Usage Example:**
|
|
81537
|
-
* \`\`\`typescript
|
|
81538
|
-
* await requestInteractiveTeamsApproval({
|
|
81539
|
-
* teamName: "admins-teams",
|
|
81540
|
-
* channelName: "admins-teams-channel",
|
|
81541
|
-
* message: "Please approve this request",
|
|
81542
|
-
* approver: "approver123",
|
|
81543
|
-
* defaultArgsJson: { key1: "value1", key2: 42 },
|
|
81544
|
-
* dynamicEnumsJson: { foo: ["choice1", "choice2"], bar: ["optionA", "optionB"] },
|
|
81545
|
-
* });
|
|
81546
|
-
* \`\`\`
|
|
81547
|
-
*
|
|
81548
|
-
* **Note:** This function requires execution within a Windmill flow or flow preview.
|
|
81549
|
-
*/
|
|
81550
|
-
async requestInteractiveTeamsApproval({ teamName, channelName, message, approver, defaultArgsJson, dynamicEnumsJson, }: TeamsApprovalOptions): Promise<void>
|
|
81551
|
-
|
|
81552
|
-
/**
|
|
81553
|
-
* Parse an S3 object from URI string or record format
|
|
81554
|
-
* @param s3Object - S3 object as URI string (s3://storage/key) or record
|
|
81555
|
-
* @returns S3 object record with storage and s3 key
|
|
81556
|
-
*/
|
|
81557
|
-
parseS3Object(s3Object: S3Object): S3ObjectRecord
|
|
81558
|
-
|
|
81559
|
-
setWorkflowCtx(ctx: WorkflowCtx | null): void
|
|
81560
|
-
|
|
81561
|
-
async sleep(seconds: number): Promise<void>
|
|
81562
|
-
|
|
81563
|
-
async step<T>(name: string, fn: () => T | Promise<T>): Promise<T>
|
|
81564
|
-
|
|
81565
|
-
/**
|
|
81566
|
-
* Create a task that dispatches to a separate Windmill script.
|
|
81567
|
-
*
|
|
81568
|
-
* @example
|
|
81569
|
-
* const extract = taskScript("f/data/extract");
|
|
81570
|
-
* // inside workflow: await extract({ url: "https://..." })
|
|
81571
|
-
*/
|
|
81572
|
-
taskScript(path: string, options?: TaskOptions): (...args: any[]) => PromiseLike<any>
|
|
81573
|
-
|
|
81574
|
-
/**
|
|
81575
|
-
* Create a task that dispatches to a separate Windmill flow.
|
|
81576
|
-
*
|
|
81577
|
-
* @example
|
|
81578
|
-
* const pipeline = taskFlow("f/etl/pipeline");
|
|
81579
|
-
* // inside workflow: await pipeline({ input: data })
|
|
81580
|
-
*/
|
|
81581
|
-
taskFlow(path: string, options?: TaskOptions): (...args: any[]) => PromiseLike<any>
|
|
81582
|
-
|
|
81583
|
-
/**
|
|
81584
|
-
* Mark an async function as a workflow-as-code entry point.
|
|
81585
|
-
*
|
|
81586
|
-
* The function must be **deterministic**: given the same inputs it must call
|
|
81587
|
-
* tasks in the same order on every replay. Branching on task results is fine
|
|
81588
|
-
* (results are replayed from checkpoint), but branching on external state
|
|
81589
|
-
* (current time, random values, external API calls) must use \`step()\` to
|
|
81590
|
-
* checkpoint the value so replays see the same result.
|
|
81591
|
-
*/
|
|
81592
|
-
workflow<T>(fn: (...args: any[]) => Promise<T>): void
|
|
81593
|
-
|
|
81594
|
-
/**
|
|
81595
|
-
* Suspend the workflow and wait for an external approval.
|
|
81596
|
-
*
|
|
81597
|
-
* Use \`getResumeUrls()\` (wrapped in \`step()\`) to obtain resume/cancel/approvalPage
|
|
81598
|
-
* URLs before calling this function.
|
|
81599
|
-
*
|
|
81600
|
-
* @example
|
|
81601
|
-
* const urls = await step("urls", () => getResumeUrls());
|
|
81602
|
-
* await step("notify", () => sendEmail(urls.approvalPage));
|
|
81603
|
-
* const { value, approver } = await waitForApproval({ timeout: 3600 });
|
|
81604
|
-
*/
|
|
81605
|
-
waitForApproval(options?: { timeout?: number; form?: object; selfApproval?: boolean; }): PromiseLike<{ value: any; approver: string; approved: boolean }>
|
|
81606
|
-
|
|
81607
|
-
/**
|
|
81608
|
-
* Process items in parallel with optional concurrency control.
|
|
81609
|
-
*
|
|
81610
|
-
* Each item is processed by calling \`fn(item)\`, which should be a task().
|
|
81611
|
-
* Items are dispatched in batches of \`concurrency\` (default: all at once).
|
|
81612
|
-
*
|
|
81613
|
-
* @example
|
|
81614
|
-
* const process = task(async (item: string) => { ... });
|
|
81615
|
-
* const results = await parallel(items, process, { concurrency: 5 });
|
|
81616
|
-
*/
|
|
81617
|
-
async parallel<T, R>(items: T[], fn: (item: T) => PromiseLike<R> | R, options?: { concurrency?: number },): Promise<R[]>
|
|
81618
|
-
|
|
81619
|
-
/**
|
|
81620
|
-
* Commit Kafka offsets for a trigger with auto_commit disabled.
|
|
81621
|
-
* @param triggerPath - Path to the Kafka trigger (from event.wm_trigger.trigger_path)
|
|
81622
|
-
* @param topic - Kafka topic name (from event.topic)
|
|
81623
|
-
* @param partition - Partition number (from event.partition)
|
|
81624
|
-
* @param offset - Message offset to commit (from event.offset)
|
|
81625
|
-
*/
|
|
81626
|
-
async commitKafkaOffsets(triggerPath: string, topic: string, partition: number, offset: number,): Promise<void>
|
|
81627
|
-
|
|
81628
|
-
/**
|
|
81629
|
-
* Create a SQL template function for PostgreSQL/datatable queries
|
|
81630
|
-
* @param name - Database/datatable name (default: "main")
|
|
81631
|
-
* @returns SQL template function for building parameterized queries
|
|
81632
|
-
* @example
|
|
81633
|
-
* let sql = wmill.datatable()
|
|
81634
|
-
* let name = 'Robin'
|
|
81635
|
-
* let age = 21
|
|
81636
|
-
* await sql\`
|
|
81637
|
-
* SELECT * FROM friends
|
|
81638
|
-
* WHERE name = \${name} AND age = \${age}::int
|
|
81639
|
-
* \`.fetch()
|
|
81640
|
-
*/
|
|
81641
|
-
datatable(name: string = "main"): DatatableSqlTemplateFunction
|
|
81642
|
-
|
|
81643
|
-
/**
|
|
81644
|
-
* Create a SQL template function for DuckDB/ducklake queries
|
|
81645
|
-
* @param name - DuckDB database name (default: "main")
|
|
81646
|
-
* @returns SQL template function for building parameterized queries
|
|
81647
|
-
* @example
|
|
81648
|
-
* let sql = wmill.ducklake()
|
|
81649
|
-
* let name = 'Robin'
|
|
81650
|
-
* let age = 21
|
|
81651
|
-
* await sql\`
|
|
81652
|
-
* SELECT * FROM friends
|
|
81653
|
-
* WHERE name = \${name} AND age = \${age}
|
|
81654
|
-
* \`.fetch()
|
|
81655
|
-
*/
|
|
81656
|
-
ducklake(name: string = "main"): SqlTemplateFunction
|
|
81657
80996
|
`,
|
|
81658
80997
|
"write-script-php": `---
|
|
81659
80998
|
name: write-script-php
|
|
@@ -83504,7 +82843,7 @@ Reference a specific resource using \`$res:\` prefix:
|
|
|
83504
82843
|
|
|
83505
82844
|
## OpenFlow Schema
|
|
83506
82845
|
|
|
83507
|
-
{"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"]}}`,
|
|
83508
82847
|
"raw-app": `---
|
|
83509
82848
|
name: raw-app
|
|
83510
82849
|
description: MUST use when creating raw apps.
|
|
@@ -93659,7 +92998,7 @@ var object_storage_default = command41;
|
|
|
93659
92998
|
|
|
93660
92999
|
// src/main.ts
|
|
93661
93000
|
await init_context();
|
|
93662
|
-
var VERSION = "1.
|
|
93001
|
+
var VERSION = "1.713.1";
|
|
93663
93002
|
async function checkVersionSafe(cmd) {
|
|
93664
93003
|
const mainCommand = cmd.getMainCommand();
|
|
93665
93004
|
const upgradeCommand = mainCommand.getCommand("upgrade");
|