windmill-cli 1.862.0 → 1.863.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/esm/main.js +571 -94
  2. package/package.json +1 -1
package/esm/main.js CHANGED
@@ -16766,7 +16766,7 @@ var init_OpenAPI = __esm(() => {
16766
16766
  PASSWORD: undefined,
16767
16767
  TOKEN: getEnv3("WM_TOKEN"),
16768
16768
  USERNAME: undefined,
16769
- VERSION: "1.862.0",
16769
+ VERSION: "1.863.0",
16770
16770
  WITH_CREDENTIALS: true,
16771
16771
  interceptors: {
16772
16772
  request: new Interceptors,
@@ -20093,7 +20093,7 @@ var init_auth = __esm(async () => {
20093
20093
  });
20094
20094
 
20095
20095
  // src/core/constants.ts
20096
- var WM_FORK_PREFIX = "wm-fork", VERSION = "1.862.0";
20096
+ var WM_FORK_PREFIX = "wm-fork", VERSION = "1.863.0";
20097
20097
 
20098
20098
  // src/utils/resource_folders.ts
20099
20099
  import { existsSync } from "node:fs";
@@ -23655,6 +23655,29 @@ async function setActiveWorkspace(workspaceName, configDirOverride) {
23655
23655
  const file = await getActiveWorkspaceConfigFilePath(configDirOverride);
23656
23656
  await writeFile3(file, workspaceName, "utf-8");
23657
23657
  }
23658
+ async function knownRemotes(opts) {
23659
+ const remotes = [];
23660
+ for (const w of await allWorkspaces(opts.configDir)) {
23661
+ try {
23662
+ const remote = new URL(w.remote).toString();
23663
+ if (!remotes.includes(remote))
23664
+ remotes.push(remote);
23665
+ } catch {}
23666
+ }
23667
+ const active = await getActiveWorkspace(opts);
23668
+ let defaultRemote = CLOUD_REMOTE;
23669
+ try {
23670
+ if (active)
23671
+ defaultRemote = new URL(active.remote).toString();
23672
+ } catch {}
23673
+ const suggestions = [
23674
+ defaultRemote,
23675
+ ...remotes.filter((r) => r !== defaultRemote)
23676
+ ];
23677
+ if (!suggestions.includes(CLOUD_REMOTE))
23678
+ suggestions.push(CLOUD_REMOTE);
23679
+ return { suggestions, defaultRemote };
23680
+ }
23658
23681
  async function add(opts, workspaceName, workspaceId, remote) {
23659
23682
  if (opts.workspace) {
23660
23683
  info(colors.red.bold("! Workspace needs to be specified as positional argument, not as option."));
@@ -23678,10 +23701,13 @@ async function add(opts, workspaceName, workspaceId, remote) {
23678
23701
  workspaceId = workspaceName;
23679
23702
  remote = url.toString();
23680
23703
  } catch {
23681
- remote = new URL(await Input.prompt({
23704
+ const { suggestions, defaultRemote } = await knownRemotes(opts);
23705
+ remote = new URL(await PickableInput.prompt({
23682
23706
  message: "Enter the Remote URL",
23683
- suggestions: ["https://app.windmill.dev/"],
23684
- default: "https://app.windmill.dev/"
23707
+ suggestions,
23708
+ list: suggestions.length > 1,
23709
+ info: suggestions.length > 1,
23710
+ default: defaultRemote
23685
23711
  })).toString();
23686
23712
  }
23687
23713
  }
@@ -24062,7 +24088,7 @@ async function bind(opts, doBind) {
24062
24088
  }
24063
24089
  }
24064
24090
  }
24065
- var command2, workspace_default;
24091
+ var CLOUD_REMOTE = "https://app.windmill.dev/", PickableInput, command2, workspace_default;
24066
24092
  var init_workspace = __esm(async () => {
24067
24093
  init_config();
24068
24094
  init_colors2();
@@ -24082,6 +24108,15 @@ var init_workspace = __esm(async () => {
24082
24108
  init_slack(),
24083
24109
  init_settings()
24084
24110
  ]);
24111
+ PickableInput = class PickableInput extends Input {
24112
+ getValue() {
24113
+ const highlighted = this.suggestions[this.suggestionsIndex];
24114
+ if (!this.inputValue && highlighted !== undefined) {
24115
+ return highlighted.toString();
24116
+ }
24117
+ return super.getValue();
24118
+ }
24119
+ };
24085
24120
  command2 = new Command().alias("profile").description("workspace related commands").action(list3).command("switch").complete("workspace", async () => (await allWorkspaces()).map((x) => x.name)).description("Switch to another workspace").arguments("<workspace_name:string:workspace>").action(switchC).command("add").description("Add a workspace").arguments("[workspace_name:string] [workspace_id:string] [remote:string]").option("-c --create", "Create the workspace if it does not exist").option("--create-workspace-name <workspace_name:string>", "Specify the workspace name. Ignored if --create is not specified or the workspace already exists. Will default to the workspace id.").option("--create-username <username:string>", "Specify your own username in the newly created workspace. Ignored if --create is not specified, the workspace already exists or automatic username creation is enabled on the instance.", {
24086
24121
  default: "admin"
24087
24122
  }).action(add).command("remove").description("Remove a workspace").arguments("<workspace_name:string>").action(remove).command("whoami").description("Show the currently active user").action(whoami2).command("list").description("List local workspace profiles").action(list3).command("list-remote").description("List workspaces on the remote server that you have access to").option("--as-superadmin", "List ALL workspaces on the instance (requires the token to belong to a superadmin/devops user)").action(listRemote).command("list-forks").description("List forked workspaces on the remote server").action(listForks).command("bind").description("Create or update a workspace entry in wmill.yaml from the active profile").option("--workspace <name:string>", "Workspace name (default: current branch or workspaceId)").option("--branch <branch:string>", "Git branch to associate (default: workspace name)").action((opts) => bind(opts, true)).command("unbind").description("Remove baseUrl and workspaceId from a workspace entry").option("--workspace <name:string>", "Workspace to unbind").action((opts) => bind(opts, false)).command("fork").description(`Create a forked workspace from its parent workspace.
@@ -35010,7 +35045,7 @@ var init_job_polling = __esm(() => {
35010
35045
  });
35011
35046
 
35012
35047
  // src/utils/codebase.ts
35013
- import { readFile as readFile2, stat as stat4 } from "node:fs/promises";
35048
+ import { readdir as readdir2, readFile as readFile2, realpath, stat as stat4 } from "node:fs/promises";
35014
35049
  import path7 from "node:path";
35015
35050
  function extraDigestPaths(codebase) {
35016
35051
  return [].concat(codebase.extra_digest_paths ?? []);
@@ -35034,47 +35069,370 @@ function uncoveredBundleInputs(codebase, entry, inputs) {
35034
35069
  return abs != entryAbs && !roots.some((r) => abs == r || abs.startsWith(r + path7.sep));
35035
35070
  });
35036
35071
  }
35072
+ function isPerScriptDigest(codebase) {
35073
+ return codebase.per_script_digest === true && !codebase.customBundler;
35074
+ }
35075
+ function sameCodebaseDigest(a, b) {
35076
+ const base = (d) => d ? d.endsWith(".tar") ? d.slice(0, -4) : d : undefined;
35077
+ return base(a) === base(b);
35078
+ }
35037
35079
  function listSyncCodebases(options) {
35038
35080
  const res = [];
35039
35081
  const nb_codebase = options?.codebases?.length ?? 0;
35040
35082
  if (nb_codebase > 0) {
35041
35083
  info(`Found ${nb_codebase} codebases: ${options?.codebases?.map((c) => c.relative_path).join(", ")}`);
35042
35084
  }
35085
+ const hasher = new FileHasher;
35043
35086
  for (const codebase of options?.codebases ?? []) {
35044
- let _digest = undefined;
35045
- let alreadyPrinted = false;
35046
- let hasAssets = false;
35047
- const getDigest = async (forceTar) => {
35048
- if (_digest == undefined) {
35049
- let digest = await digestDir(codebase.relative_path, JSON.stringify(codebase));
35050
- const extra = extraDigestPaths(codebase);
35051
- if (extra.length > 0) {
35052
- const hashes = await Promise.all(extra.map(digestPath));
35053
- digest = await generateHash(digest + hashes.join(""));
35054
- }
35055
- if (codebase.format == "esm") {
35056
- digest += ".esm";
35057
- }
35058
- _digest = digest;
35059
- if (!alreadyPrinted) {
35060
- alreadyPrinted = true;
35061
- info(`Codebase ${codebase.relative_path}, digest: ${_digest}`);
35062
- }
35063
- hasAssets = Array.isArray(codebase.assets) && codebase.assets.length > 0;
35064
- }
35065
- if (forceTar || hasAssets) {
35066
- return _digest + ".tar";
35067
- } else {
35068
- return _digest;
35087
+ const hasAssets = Array.isArray(codebase.assets) && codebase.assets.length > 0;
35088
+ const withSuffixes = (digest, forceTar) => {
35089
+ if (codebase.format == "esm")
35090
+ digest += ".esm";
35091
+ return forceTar || hasAssets ? digest + ".tar" : digest;
35092
+ };
35093
+ if (!isPerScriptDigest(codebase)) {
35094
+ let dirDigest;
35095
+ const getDigest = async (_scriptPath, forceTar) => {
35096
+ if (!dirDigest) {
35097
+ dirDigest = (async () => {
35098
+ let digest = await digestDir(codebase.relative_path, JSON.stringify(codebase));
35099
+ const extra = extraDigestPaths(codebase);
35100
+ if (extra.length > 0) {
35101
+ const hashes = await Promise.all(extra.map(digestPath));
35102
+ digest = await generateHash(digest + hashes.join(""));
35103
+ }
35104
+ info(`Codebase ${codebase.relative_path}, digest: ${withSuffixes(digest)}`);
35105
+ return digest;
35106
+ })();
35107
+ }
35108
+ return withSuffixes(await dirDigest, forceTar);
35109
+ };
35110
+ res.push({ ...codebase, getDigest, primeDigests: async () => {} });
35111
+ continue;
35112
+ }
35113
+ const digests = new Map;
35114
+ const primeDigests = async (scriptPaths) => {
35115
+ const missing = [
35116
+ ...new Set(scriptPaths.map((p) => path7.resolve(p)))
35117
+ ].filter((p) => !digests.has(p));
35118
+ if (missing.length == 0)
35119
+ return;
35120
+ const computed = scriptDigests(codebase, missing, hasher);
35121
+ for (const p of missing) {
35122
+ const d = computed.then((m) => {
35123
+ const v = m.get(p);
35124
+ if (v instanceof Error)
35125
+ throw v;
35126
+ return v;
35127
+ });
35128
+ d.catch(() => {});
35129
+ digests.set(p, d);
35069
35130
  }
35131
+ await Promise.allSettled(missing.map((p) => digests.get(p)));
35132
+ };
35133
+ const getDigest = async (scriptPath, forceTar) => {
35134
+ const abs = path7.resolve(scriptPath);
35135
+ if (!digests.has(abs))
35136
+ await primeDigests([abs]);
35137
+ return withSuffixes(await digests.get(abs), forceTar);
35070
35138
  };
35071
- res.push({ ...codebase, getDigest });
35139
+ res.push({ ...codebase, getDigest, primeDigests });
35072
35140
  }
35073
35141
  return res;
35074
35142
  }
35143
+
35144
+ class FileHasher {
35145
+ hashes = new Map;
35146
+ configs = new Map;
35147
+ packages = new Map;
35148
+ packageFields = new Map;
35149
+ packageFor(dir) {
35150
+ let p = this.packages.get(dir);
35151
+ if (!p) {
35152
+ p = (async () => {
35153
+ const here = path7.join(dir, "package.json");
35154
+ if (await isFile(here))
35155
+ return here;
35156
+ const parent = path7.dirname(dir);
35157
+ return parent == dir ? undefined : await this.packageFor(parent);
35158
+ })();
35159
+ this.packages.set(dir, p);
35160
+ }
35161
+ return p;
35162
+ }
35163
+ hashPackageFields(pkgPath) {
35164
+ let h = this.packageFields.get(pkgPath);
35165
+ if (!h) {
35166
+ h = (async () => {
35167
+ const pkg = await readJson(pkgPath);
35168
+ if (!pkg || typeof pkg != "object")
35169
+ return await this.hash(pkgPath);
35170
+ const fields = BUILD_PACKAGE_FIELDS.map((f) => [f, pkg[f]]);
35171
+ return await generateHash(JSON.stringify(fields));
35172
+ })();
35173
+ this.packageFields.set(pkgPath, h);
35174
+ }
35175
+ return h;
35176
+ }
35177
+ hash(absPath) {
35178
+ let h = this.hashes.get(absPath);
35179
+ if (!h) {
35180
+ h = readFile2(absPath).then(generateHashFromBuffer);
35181
+ this.hashes.set(absPath, h);
35182
+ }
35183
+ return h;
35184
+ }
35185
+ configsFor(dir) {
35186
+ let c = this.configs.get(dir);
35187
+ if (!c) {
35188
+ c = (async () => {
35189
+ for (const name of ["tsconfig.json", "jsconfig.json"]) {
35190
+ const p = path7.join(dir, name);
35191
+ if (await isFile(p))
35192
+ return await this.extendsChain(p, new Set);
35193
+ }
35194
+ const parent = path7.dirname(dir);
35195
+ return parent == dir ? [] : await this.configsFor(parent);
35196
+ })();
35197
+ this.configs.set(dir, c);
35198
+ }
35199
+ return c;
35200
+ }
35201
+ async extendsChain(config, seen) {
35202
+ if (seen.has(config))
35203
+ return [];
35204
+ seen.add(config);
35205
+ const res = [config];
35206
+ for (const spec of tsconfigExtends(await readFile2(config, "utf8"))) {
35207
+ const dir = path7.dirname(config);
35208
+ const bases = isPackageSpec(spec) ? await packageConfigFiles(spec, dir) : [await resolveRelativeExtends(spec, dir)].filter((b) => b != null);
35209
+ for (const base of bases)
35210
+ res.push(...await this.extendsChain(base, seen));
35211
+ }
35212
+ return res;
35213
+ }
35214
+ }
35215
+ async function resolveRelativeExtends(spec, dir) {
35216
+ const p = path7.resolve(dir, spec == "." || spec == ".." ? spec + "/tsconfig.json" : spec);
35217
+ if (await isFile(p))
35218
+ return p;
35219
+ return !p.endsWith(".json") && await isFile(p + ".json") ? p + ".json" : undefined;
35220
+ }
35221
+ async function packageConfigFiles(spec, dir) {
35222
+ const name = spec.split("/").slice(0, spec.startsWith("@") ? 2 : 1).join("/");
35223
+ const res = [];
35224
+ for (let d = dir;; d = path7.dirname(d)) {
35225
+ const pkgDir = path7.join(d, "node_modules", name);
35226
+ if (await stat4(pkgDir).then((s) => s.isDirectory(), () => false)) {
35227
+ res.push(...await filesUnder(pkgDir, new Set));
35228
+ const field = (await readJson(path7.join(pkgDir, "package.json")))?.tsconfig;
35229
+ if (typeof field == "string" && field != "") {
35230
+ const p = path7.resolve(pkgDir, field);
35231
+ if (await isFile(p))
35232
+ res.push(p);
35233
+ }
35234
+ }
35235
+ if (path7.dirname(d) == d)
35236
+ return [...new Set(res)].sort();
35237
+ }
35238
+ }
35239
+ async function filesUnder(dir, seenDirs) {
35240
+ const real = await realpath(dir);
35241
+ if (seenDirs.has(real))
35242
+ return [];
35243
+ seenDirs.add(real);
35244
+ const res = [];
35245
+ for (const e of (await readdir2(dir)).sort()) {
35246
+ const p = path7.join(dir, e);
35247
+ const s = await stat4(p).catch(() => {
35248
+ return;
35249
+ });
35250
+ if (s?.isDirectory() && e != "node_modules")
35251
+ res.push(...await filesUnder(p, seenDirs));
35252
+ else if (s?.isFile())
35253
+ res.push(p);
35254
+ }
35255
+ return res;
35256
+ }
35257
+ function tsconfigExtends(text) {
35258
+ text = text.replace(/^\uFEFF/, "");
35259
+ let json = "";
35260
+ for (let i = 0;i < text.length; i++) {
35261
+ const ch = text[i];
35262
+ if (ch == '"') {
35263
+ const start = i;
35264
+ for (i++;i < text.length && text[i] != '"'; i++)
35265
+ if (text[i] == "\\")
35266
+ i++;
35267
+ json += text.slice(start, i + 1);
35268
+ } else if (ch == "/" && text[i + 1] == "/") {
35269
+ while (i < text.length && text[i] != `
35270
+ `)
35271
+ i++;
35272
+ json += `
35273
+ `;
35274
+ } else if (ch == "/" && text[i + 1] == "*") {
35275
+ i = text.indexOf("*/", i + 2);
35276
+ if (i < 0)
35277
+ break;
35278
+ i++;
35279
+ } else {
35280
+ json += ch;
35281
+ }
35282
+ }
35283
+ try {
35284
+ const ext = JSON.parse(json.replace(/,(\s*[}\]])/g, "$1"))?.extends;
35285
+ return [].concat(ext ?? []).filter((e) => typeof e == "string");
35286
+ } catch {
35287
+ return [];
35288
+ }
35289
+ }
35290
+ async function readJson(p) {
35291
+ try {
35292
+ return JSON.parse((await readFile2(p, "utf8")).replace(/^\uFEFF/, ""));
35293
+ } catch {
35294
+ return;
35295
+ }
35296
+ }
35297
+ function isFileInput(key) {
35298
+ return !/^[<(]|^[a-z-]{2,}:/i.test(key);
35299
+ }
35300
+ async function scriptDigests(codebase, scriptPaths, hasher) {
35301
+ const cwd = await realpath(process.cwd());
35302
+ const parts = [JSON.stringify(codebase)];
35303
+ for (const p of extraDigestPaths(codebase))
35304
+ parts.push(await digestPath(p));
35305
+ for (const a of codebase.assets ?? []) {
35306
+ parts.push(`${a.to}\x00${await hasher.hash(path7.resolve(a.from))}`);
35307
+ }
35308
+ const shared = parts.join(`
35309
+ `);
35310
+ const closures = await importClosures(codebase, scriptPaths, cwd);
35311
+ const res = new Map;
35312
+ await Promise.all(scriptPaths.map(async (script) => {
35313
+ const files = closures.get(script);
35314
+ if (files instanceof Error) {
35315
+ res.set(script, files);
35316
+ return;
35317
+ }
35318
+ const configs = new Set;
35319
+ const packages = new Set;
35320
+ for (const f of files) {
35321
+ const pkg = await hasher.packageFor(path7.dirname(f));
35322
+ if (pkg)
35323
+ packages.add(pkg);
35324
+ if (f.split(path7.sep).includes("node_modules"))
35325
+ continue;
35326
+ for (const c of await hasher.configsFor(path7.dirname(f))) {
35327
+ configs.add(c);
35328
+ }
35329
+ }
35330
+ const rel = (f) => toPosix(path7.relative(cwd, f));
35331
+ const entries = await Promise.all([
35332
+ ...[...files, ...configs].map(async (f) => `${rel(f)}\x00${await hasher.hash(f)}`),
35333
+ ...[...packages].map(async (p) => `${rel(p)}\x00fields\x00${await hasher.hashPackageFields(p)}`)
35334
+ ]);
35335
+ entries.sort();
35336
+ res.set(script, await generateHash(shared + `
35337
+ ` + entries.join(`
35338
+ `)));
35339
+ }));
35340
+ return res;
35341
+ }
35342
+ async function importClosures(codebase, scriptPaths, cwd) {
35343
+ const res = new Map;
35344
+ const entries = new Map;
35345
+ for (const s of scriptPaths) {
35346
+ try {
35347
+ entries.set(s, await realpath(s));
35348
+ } catch (e) {
35349
+ res.set(s, bundleError(s, e));
35350
+ }
35351
+ }
35352
+ const inject = await Promise.all((codebase.inject ?? []).map((p) => realpath(path7.resolve(p))));
35353
+ const graph = async (entries, batched) => {
35354
+ const out = await withEsbuild((esbuild) => esbuild.build({
35355
+ ...graphBuildOptions(codebase, batched),
35356
+ entryPoints: entries,
35357
+ absWorkingDir: cwd
35358
+ }));
35359
+ const imports = new Map;
35360
+ for (const [key, input] of Object.entries(out.metafile?.inputs ?? {})) {
35361
+ if (!isFileInput(key))
35362
+ continue;
35363
+ imports.set(path7.resolve(cwd, key), input.imports.filter((i) => !i.external && isFileInput(i.path)).map((i) => path7.resolve(cwd, i.path)));
35364
+ }
35365
+ return imports;
35366
+ };
35367
+ const closure = (imports, script) => {
35368
+ if (!imports.has(script)) {
35369
+ throw new Error(`esbuild reported no inputs for ${script}`);
35370
+ }
35371
+ const seen = new Set;
35372
+ const todo = [script, ...inject];
35373
+ while (todo.length > 0) {
35374
+ const f = todo.pop();
35375
+ if (seen.has(f))
35376
+ continue;
35377
+ seen.add(f);
35378
+ todo.push(...imports.get(f) ?? []);
35379
+ }
35380
+ return seen;
35381
+ };
35382
+ if (entries.size > 1) {
35383
+ try {
35384
+ const imports = await graph([...entries.values()], true);
35385
+ for (const [s, real] of entries)
35386
+ res.set(s, closure(imports, real));
35387
+ return res;
35388
+ } catch (e) {
35389
+ const first = e?.errors?.[0];
35390
+ const reason = first ? `${first.location?.file ? first.location.file + ": " : ""}${first.text}` : String(e).split(`
35391
+ `)[0];
35392
+ info(`Codebase digest: the batched build failed (${reason}), digesting ${entries.size} scripts one by one`);
35393
+ }
35394
+ }
35395
+ const queue = [...entries];
35396
+ await Promise.all(Array.from({ length: Math.min(8, queue.length) }, async () => {
35397
+ for (let q = queue.shift();q != null; q = queue.shift()) {
35398
+ const [s, real] = q;
35399
+ try {
35400
+ res.set(s, closure(await graph([real], false), real));
35401
+ } catch (e) {
35402
+ res.set(s, bundleError(s, e));
35403
+ }
35404
+ }
35405
+ }));
35406
+ return res;
35407
+ }
35408
+ function bundleError(script, e) {
35409
+ const msg = e instanceof Error ? e.message : String(e);
35410
+ return new Error(`Cannot compute the codebase digest of ${toPosix(path7.relative(process.cwd(), script))}: bundling it failed. ` + `With per_script_digest every codebase script must bundle for a push to compare it; fix the script or exclude it from the codebase.
35411
+ ${msg}`);
35412
+ }
35413
+ function graphBuildOptions(codebase, batched) {
35414
+ return {
35415
+ bundle: true,
35416
+ write: false,
35417
+ metafile: true,
35418
+ logLevel: "silent",
35419
+ outdir: "/",
35420
+ platform: "node",
35421
+ packages: "bundle",
35422
+ external: codebase.external,
35423
+ inject: codebase.inject,
35424
+ define: codebase.define,
35425
+ loader: codebase.loader ?? { ".node": "file" },
35426
+ target: "esnext",
35427
+ ...batched ? { format: "esm", splitting: true } : { format: codebase.format ?? "cjs" }
35428
+ };
35429
+ }
35430
+ var isPackageSpec = (spec) => !/^\.{1,2}(\/|\\|$)/.test(spec) && !path7.isAbsolute(spec), isFile = (p) => stat4(p).then((s) => s.isFile(), () => false), BUILD_PACKAGE_FIELDS, toPosix = (p) => p.split(path7.sep).join("/");
35075
35431
  var init_codebase = __esm(async () => {
35076
35432
  init_log();
35433
+ init_esbuild_loader();
35077
35434
  await init_utils();
35435
+ BUILD_PACKAGE_FIELDS = ["sideEffects", "type", "main", "module", "browser", "exports", "imports"];
35078
35436
  });
35079
35437
 
35080
35438
  // bootstrap/script_bootstrap.ts
@@ -35629,7 +35987,7 @@ var init_slack2 = __esm(async () => {
35629
35987
  });
35630
35988
 
35631
35989
  // src/commands/instance/instance.ts
35632
- import { writeFile as writeFile6, readdir as readdir2, mkdir as mkdir3, rm, stat as stat5 } from "node:fs/promises";
35990
+ import { writeFile as writeFile6, readdir as readdir3, mkdir as mkdir3, rm, stat as stat5 } from "node:fs/promises";
35633
35991
  import { appendFile } from "node:fs/promises";
35634
35992
  import * as path8 from "node:path";
35635
35993
  async function allInstances() {
@@ -36044,7 +36402,7 @@ async function getLocalWorkspaces(rootDir, localPrefix, folderPerInstance) {
36044
36402
  await mkdir3(localPrefix);
36045
36403
  }
36046
36404
  if (folderPerInstance) {
36047
- const prefixEntries = await readdir2(rootDir + "/" + localPrefix, { withFileTypes: true });
36405
+ const prefixEntries = await readdir3(rootDir + "/" + localPrefix, { withFileTypes: true });
36048
36406
  for (const dir of prefixEntries) {
36049
36407
  if (dir.isDirectory()) {
36050
36408
  const dirName = dir.name;
@@ -36055,7 +36413,7 @@ async function getLocalWorkspaces(rootDir, localPrefix, folderPerInstance) {
36055
36413
  }
36056
36414
  }
36057
36415
  } else {
36058
- const rootEntries = await readdir2(rootDir, { withFileTypes: true });
36416
+ const rootEntries = await readdir3(rootDir, { withFileTypes: true });
36059
36417
  for (const dir of rootEntries) {
36060
36418
  const dirName = dir.name;
36061
36419
  if (dirName.startsWith(localPrefix + "_")) {
@@ -36811,7 +37169,8 @@ var init_settings2 = __esm(async () => {
36811
37169
  "error_handler_fallback_to_instance_alerts",
36812
37170
  "add_admins_and_developers_to_forks",
36813
37171
  "variable_expiration_handler",
36814
- "role_overrides"
37172
+ "role_overrides",
37173
+ "webhook_events"
36815
37174
  ];
36816
37175
  RETIRED_SETTINGS = ["guest_access_enabled"];
36817
37176
  instanceSettingsPath = INSTANCE_SETTINGS_PATH;
@@ -58857,7 +59216,7 @@ var init_openflow = __esm(() => {
58857
59216
  openflow_default = {
58858
59217
  openapi: "3.0.3",
58859
59218
  info: {
58860
- version: "1.862.0",
59219
+ version: "1.863.0",
58861
59220
  title: "OpenFlow Spec",
58862
59221
  contact: {
58863
59222
  name: "Ruben Fiszel",
@@ -58948,6 +59307,14 @@ var init_openflow = __esm(() => {
58948
59307
  type: "number",
58949
59308
  description: "Time window in seconds for concurrent_limit"
58950
59309
  },
59310
+ on_concurrency_limit: {
59311
+ type: "string",
59312
+ enum: [
59313
+ "queue",
59314
+ "fail"
59315
+ ],
59316
+ description: "What a run of this flow does when its concurrency limit is reached. `queue` (default) re-queues it to a later slot, `fail` ends it immediately as failed, like any failed step."
59317
+ },
58951
59318
  debounce_delay_s: {
58952
59319
  type: "integer",
58953
59320
  description: "Delay in seconds to debounce flow executions"
@@ -59293,6 +59660,10 @@ var init_openflow = __esm(() => {
59293
59660
  },
59294
59661
  return_value: {
59295
59662
  description: "Value to return when mocked"
59663
+ },
59664
+ preview_only: {
59665
+ type: "boolean",
59666
+ description: "If true, the mock applies only to runs started as a flow preview (from the editor, and every job under it, subflows included). Absent or false, it applies to every run."
59296
59667
  }
59297
59668
  }
59298
59669
  },
@@ -59850,6 +60221,14 @@ Windmill does not know needs one; those fall back to 128000.
59850
60221
  type: "number",
59851
60222
  description: "Time window for concurrent_limit"
59852
60223
  },
60224
+ on_concurrency_limit: {
60225
+ type: "string",
60226
+ enum: [
60227
+ "queue",
60228
+ "fail"
60229
+ ],
60230
+ description: "What a run of this step does when its concurrency limit is reached. `queue` (default) re-queues it to a later slot, `fail` ends it immediately as failed."
60231
+ },
59853
60232
  custom_concurrency_key: {
59854
60233
  type: "string",
59855
60234
  description: "Custom key for grouping concurrent executions"
@@ -60060,6 +60439,16 @@ Windmill does not know needs one; those fall back to 128000.
60060
60439
  },
60061
60440
  squash: {
60062
60441
  type: "boolean"
60442
+ },
60443
+ max_iterations: {
60444
+ type: "integer",
60445
+ minimum: 1,
60446
+ description: "Maximum number of iterations. Checked after each iteration; when reached and stop_after_if did not stop the loop, the loop fails with an error named 'LoopExhausted'"
60447
+ },
60448
+ max_duration_secs: {
60449
+ type: "integer",
60450
+ minimum: 1,
60451
+ description: "Maximum wall-clock seconds since the first iteration started, checked after each iteration. A running iteration is not interrupted, so the loop can exceed the limit by up to one iteration; the timeout of the body's steps caps an iteration. When reached and stop_after_if did not stop the loop, the loop fails with an error named 'LoopExhausted'"
60063
60452
  }
60064
60453
  },
60065
60454
  required: [
@@ -60160,6 +60549,10 @@ Windmill does not know needs one; those fall back to 128000.
60160
60549
  parallel: {
60161
60550
  type: "boolean",
60162
60551
  description: "If true, all branches execute concurrently. If false, they execute sequentially"
60552
+ },
60553
+ parallelism: {
60554
+ description: "Maximum number of branches running at once when parallel=true. Can be static number or expression",
60555
+ $ref: "#/components/schemas/InputTransform"
60163
60556
  }
60164
60557
  },
60165
60558
  required: [
@@ -61728,6 +62121,11 @@ Frontend appends a \`*\` to the displayed name.
61728
62121
  default: "and",
61729
62122
  description: "Logic to apply when evaluating the top-level filters. 'and' requires all of them to match, 'or' requires any of them to match. Nested `any_of`/`all_of`/`none_of` groups carry their own logic."
61730
62123
  },
62124
+ run_on_filter_error: {
62125
+ type: "boolean",
62126
+ default: false,
62127
+ description: "Whether a message the filters cannot read (not UTF-8, or not JSON) still runs the target, as if the trigger had no filters. A preprocessor then finds the reason in `event.filter_error`. When false, such a message is skipped."
62128
+ },
61731
62129
  auto_offset_reset: {
61732
62130
  type: "string",
61733
62131
  enum: [
@@ -62527,6 +62925,11 @@ Frontend appends a \`*\` to the displayed name.
62527
62925
  default: "and",
62528
62926
  description: "Logic to apply when evaluating the top-level filters. 'and' requires all of them to match, 'or' requires any of them to match. Nested `any_of`/`all_of`/`none_of` groups carry their own logic."
62529
62927
  },
62928
+ run_on_filter_error: {
62929
+ type: "boolean",
62930
+ default: false,
62931
+ description: "Whether a message the filters cannot read (not UTF-8, or not JSON) still runs the target, as if the trigger had no filters. A preprocessor then finds the reason in `event.filter_error`. When false, such a message is skipped."
62932
+ },
62530
62933
  initial_messages: {
62531
62934
  type: "array",
62532
62935
  nullable: true,
@@ -63220,7 +63623,7 @@ function isAppTypeStr(typeStr) {
63220
63623
  function appFolderOf(path, typeStr) {
63221
63624
  return extractFolderPath(path, typeStr) ?? path;
63222
63625
  }
63223
- function toPosix(path) {
63626
+ function toPosix2(path) {
63224
63627
  return path.replaceAll("\\", "/");
63225
63628
  }
63226
63629
  function appsArrivingOrLeaving(changes) {
@@ -63228,7 +63631,7 @@ function appsArrivingOrLeaving(changes) {
63228
63631
  for (const change of changes) {
63229
63632
  if (change.name === "edited")
63230
63633
  continue;
63231
- const path = toPosix(change.path);
63634
+ const path = toPosix2(change.path);
63232
63635
  if (!isAppFolderMetadataFile(path) && !isRawAppFolderMetadataFile(path)) {
63233
63636
  continue;
63234
63637
  }
@@ -63261,7 +63664,7 @@ async function preCheckPermissionedAs(changes, userEmail, userIsAdminOrDeployer,
63261
63664
  continue;
63262
63665
  }
63263
63666
  if (isAppTypeStr(typeStr)) {
63264
- const path = toPosix(change.path);
63667
+ const path = toPosix2(change.path);
63265
63668
  const folder = appFolderOf(path, typeStr);
63266
63669
  if (!arrivingOrLeaving.has(folder) && (typeStr === "app" || deploysWithRawApp(path.slice(folder.length)))) {
63267
63670
  addItem({ path: folder, currentOwner: "(app policy owner)" });
@@ -65492,7 +65895,7 @@ async function handleFile(path, workspace, alreadySynced, message, opts, rawWork
65492
65895
  metafile: true
65493
65896
  }));
65494
65897
  const endTime = performance.now();
65495
- const uncovered = uncoveredBundleInputs(codebase, path, Object.keys(out.metafile?.inputs ?? {}));
65898
+ const uncovered = isPerScriptDigest(codebase) ? [] : uncoveredBundleInputs(codebase, path, Object.keys(out.metafile?.inputs ?? {}));
65496
65899
  if (uncovered.length > 0) {
65497
65900
  warnAlways(`${path} bundles files outside codebase ${codebase.relative_path}; edits to them won't be detected as changes unless listed in extra_digest_paths: ${uncovered.join(", ")}`);
65498
65901
  }
@@ -65564,7 +65967,7 @@ async function handleFile(path, workspace, alreadySynced, message, opts, rawWork
65564
65967
  typed = structuredClone(remote);
65565
65968
  }
65566
65969
  if (typed && codebase) {
65567
- typed.codebase = await codebase.getDigest(forceTar);
65970
+ typed.codebase = await codebase.getDigest(path, forceTar);
65568
65971
  }
65569
65972
  const scriptBasePath = moduleEntryPoint ? getScriptBasePathFromModulePath(path) : path.substring(0, path.indexOf("."));
65570
65973
  const isDbt = language === "dbt";
@@ -65593,12 +65996,13 @@ async function handleFile(path, workspace, alreadySynced, message, opts, rawWork
65593
65996
  has_preprocessor: typed?.has_preprocessor,
65594
65997
  priority: typed?.priority,
65595
65998
  concurrency_key: typed?.concurrency_key,
65999
+ on_concurrency_limit: typed?.on_concurrency_limit,
65596
66000
  debounce_key: typed?.debounce_key,
65597
66001
  debounce_delay_s: typed?.debounce_delay_s,
65598
66002
  debounce_args_to_accumulate: typed?.debounce_args_to_accumulate,
65599
66003
  max_total_debouncing_time: typed?.max_total_debouncing_time,
65600
66004
  max_total_debounces_amount: typed?.max_total_debounces_amount,
65601
- codebase: await codebase?.getDigest(forceTar),
66005
+ codebase: await codebase?.getDigest(path, forceTar),
65602
66006
  timeout: nonePositiveInt(typed?.timeout),
65603
66007
  delete_after_secs: typed?.delete_after_secs,
65604
66008
  on_behalf_of_email: typed?.on_behalf_of_email,
@@ -65621,7 +66025,7 @@ async function handleFile(path, workspace, alreadySynced, message, opts, rawWork
65621
66025
  if (remote) {
65622
66026
  if (content === remote.content) {
65623
66027
  if (typed == undefined || typed.description === remote.description && typed.summary === remote.summary && typed.kind == remote.kind && language == (remote.language === "bunnative" ? "bun" : remote.language) && !remote.archived && (Array.isArray(remote?.lock) ? remote?.lock?.join(`
65624
- `) : remote?.lock ?? "").trim() == (typed?.lock ?? "").trim() && deepEqual(typed.schema, remote.schema) && typed.tag == remote.tag && (typed.ws_error_handler_muted ?? false) == remote.ws_error_handler_muted && typed.dedicated_worker == remote.dedicated_worker && typed.cache_ttl == remote.cache_ttl && Boolean(typed.cache_ignore_s3_path) == Boolean(remote.cache_ignore_s3_path) && normConcurrencyTimeWindowS == normalizeConcurrency(remote.concurrent_limit, remote.concurrency_time_window_s)[1] && normConcurrentLimit == normalizeConcurrency(remote.concurrent_limit)[0] && Boolean(typed.restart_unless_cancelled) == Boolean(remote.restart_unless_cancelled) && Boolean(typed.visible_to_runner_only) == Boolean(remote.visible_to_runner_only) && Boolean(typed.has_preprocessor) == Boolean(remote.has_preprocessor) && typed.priority == remote.priority && nonePositiveInt(typed.timeout) == nonePositiveInt(remote.timeout) && typed.delete_after_secs == remote.delete_after_secs && typed.concurrency_key == remote["concurrency_key"] && typed.debounce_key == remote["debounce_key"] && typed.debounce_delay_s == remote["debounce_delay_s"] && deepEqual(typed.debounce_args_to_accumulate ?? null, remote.debounce_args_to_accumulate ?? null) && typed.max_total_debouncing_time == remote.max_total_debouncing_time && typed.max_total_debounces_amount == remote.max_total_debounces_amount && typed.codebase == remote.codebase && (hasOnBehalfOf ? true : typed.on_behalf_of_email == remote.on_behalf_of_email) && deepEqual(typed.envs, remote.envs) && deepEqual(typed.labels ?? null, remote.labels ?? null) && deepEqual(typed.job_token_scopes ?? null, remote.job_token_scopes ?? null) && deepEqual(modules ?? null, remote.modules ?? null)) {
66028
+ `) : remote?.lock ?? "").trim() == (typed?.lock ?? "").trim() && deepEqual(typed.schema, remote.schema) && typed.tag == remote.tag && (typed.ws_error_handler_muted ?? false) == remote.ws_error_handler_muted && typed.dedicated_worker == remote.dedicated_worker && typed.cache_ttl == remote.cache_ttl && Boolean(typed.cache_ignore_s3_path) == Boolean(remote.cache_ignore_s3_path) && normConcurrencyTimeWindowS == normalizeConcurrency(remote.concurrent_limit, remote.concurrency_time_window_s)[1] && normConcurrentLimit == normalizeConcurrency(remote.concurrent_limit)[0] && Boolean(typed.restart_unless_cancelled) == Boolean(remote.restart_unless_cancelled) && Boolean(typed.visible_to_runner_only) == Boolean(remote.visible_to_runner_only) && Boolean(typed.has_preprocessor) == Boolean(remote.has_preprocessor) && typed.priority == remote.priority && nonePositiveInt(typed.timeout) == nonePositiveInt(remote.timeout) && typed.delete_after_secs == remote.delete_after_secs && typed.concurrency_key == remote["concurrency_key"] && (typed.on_concurrency_limit ?? "queue") == (remote.on_concurrency_limit ?? "queue") && typed.debounce_key == remote["debounce_key"] && typed.debounce_delay_s == remote["debounce_delay_s"] && deepEqual(typed.debounce_args_to_accumulate ?? null, remote.debounce_args_to_accumulate ?? null) && typed.max_total_debouncing_time == remote.max_total_debouncing_time && typed.max_total_debounces_amount == remote.max_total_debounces_amount && typed.codebase == remote.codebase && (hasOnBehalfOf ? true : typed.on_behalf_of_email == remote.on_behalf_of_email) && deepEqual(typed.envs, remote.envs) && deepEqual(typed.labels ?? null, remote.labels ?? null) && deepEqual(typed.job_token_scopes ?? null, remote.job_token_scopes ?? null) && deepEqual(modules ?? null, remote.modules ?? null)) {
65625
66029
  info(colors.green(`Script ${remotePath} is up to date`));
65626
66030
  await applyExtraPermsDiff(workspaceId, "script", remotePath.replaceAll(SEP6, "/"), typed?.extra_perms, remote?.extra_perms);
65627
66031
  return true;
@@ -66562,7 +66966,7 @@ var init_script = __esm(async () => {
66562
66966
  });
66563
66967
 
66564
66968
  // src/commands/lint/lint.ts
66565
- import { stat as stat7, readdir as readdir3 } from "node:fs/promises";
66969
+ import { stat as stat7, readdir as readdir4 } from "node:fs/promises";
66566
66970
  import process16 from "node:process";
66567
66971
  import * as path12 from "node:path";
66568
66972
  import { sep as SEP7 } from "node:path";
@@ -66714,7 +67118,7 @@ function findInlineScriptsInApp(obj, currentPath = []) {
66714
67118
  async function checkRawAppRunnables(backendDir, rawAppYamlPath, defaultTs) {
66715
67119
  const issues = [];
66716
67120
  const allFiles = [];
66717
- const entries = await readdir3(backendDir, { withFileTypes: true });
67121
+ const entries = await readdir4(backendDir, { withFileTypes: true });
66718
67122
  for (const entry of entries) {
66719
67123
  if (entry.isFile()) {
66720
67124
  allFiles.push(entry.name);
@@ -67381,13 +67785,13 @@ var init_shared_ui = __esm(async () => {
67381
67785
  });
67382
67786
 
67383
67787
  // src/commands/resource/resource.ts
67384
- import { mkdir as mkdir5, stat as stat8, writeFile as writeFile9, readdir as readdir4 } from "node:fs/promises";
67788
+ import { mkdir as mkdir5, stat as stat8, writeFile as writeFile9, readdir as readdir5 } from "node:fs/promises";
67385
67789
  import nodePath from "node:path";
67386
67790
  import { sep as SEP8 } from "node:path";
67387
67791
  async function readFilesetDirectory(dirPath) {
67388
67792
  const result = {};
67389
67793
  async function walk(currentPath, prefix) {
67390
- const entries = await readdir4(currentPath, { withFileTypes: true });
67794
+ const entries = await readdir5(currentPath, { withFileTypes: true });
67391
67795
  for (const entry of entries) {
67392
67796
  const entryPath = nodePath.join(currentPath, entry.name);
67393
67797
  const relPath = prefix ? prefix + "/" + entry.name : entry.name;
@@ -67913,7 +68317,7 @@ var init_lock_dedup = __esm(async () => {
67913
68317
  // src/commands/sync/sync.ts
67914
68318
  import {
67915
68319
  writeFile as writeFile11,
67916
- readdir as readdir5,
68320
+ readdir as readdir6,
67917
68321
  stat as stat9,
67918
68322
  rm as rm4,
67919
68323
  copyFile,
@@ -67933,7 +68337,7 @@ async function collectSharedLockReaders(json) {
67933
68337
  const walk = async (dir) => {
67934
68338
  let entries;
67935
68339
  try {
67936
- entries = await readdir5(dir, { withFileTypes: true });
68340
+ entries = await readdir6(dir, { withFileTypes: true });
67937
68341
  } catch (e) {
67938
68342
  if (e?.code === "ENOENT")
67939
68343
  return;
@@ -68121,6 +68525,44 @@ function findCodebase(path, codebases) {
68121
68525
  }
68122
68526
  }
68123
68527
  }
68528
+ async function primeCodebaseDigests(codebases, ignore) {
68529
+ if (!codebases.some(isPerScriptDigest))
68530
+ return;
68531
+ const scripts = new Map;
68532
+ const walk = async (dir) => {
68533
+ for (const e of await readdir6(dir || ".", { withFileTypes: true })) {
68534
+ const p = dir ? path15.join(dir, e.name) : e.name;
68535
+ if (e.isDirectory()) {
68536
+ if (e.name != "node_modules" && !e.name.startsWith("."))
68537
+ await walk(p);
68538
+ continue;
68539
+ }
68540
+ if (!e.name.endsWith(".script.yaml") || ignore(p, false))
68541
+ continue;
68542
+ const ts = p.replace(/\.script\.yaml$/, ".ts");
68543
+ const c = findCodebase(ts, codebases);
68544
+ if (!c || !isPerScriptDigest(c))
68545
+ continue;
68546
+ if (!await stat9(ts).then((s) => s.isFile(), () => false))
68547
+ continue;
68548
+ scripts.set(c, [...scripts.get(c) ?? [], ts]);
68549
+ }
68550
+ };
68551
+ await walk("");
68552
+ for (const [c, paths] of scripts) {
68553
+ const start = performance.now();
68554
+ await c.primeDigests(paths);
68555
+ info(`Codebase ${c.relative_path}: digested ${paths.length} scripts in ${((performance.now() - start) / 1000).toFixed(1)}s`);
68556
+ }
68557
+ }
68558
+ function sameScriptMetadataModuloTar(a, b) {
68559
+ if (!a || !b || typeof a != "object" || typeof b != "object") {
68560
+ return false;
68561
+ }
68562
+ const { codebase: c1, ...rest1 } = a;
68563
+ const { codebase: c2, ...rest2 } = b;
68564
+ return sameCodebaseDigest(c1, c2) && deepEqual(rest1, rest2);
68565
+ }
68124
68566
  async function addCodebaseDigestIfRelevant(path, content, codebases, ignoreCodebaseChanges) {
68125
68567
  const isScript = path.endsWith(".script.yaml");
68126
68568
  if (!isScript) {
@@ -68150,7 +68592,7 @@ async function addCodebaseDigestIfRelevant(path, content, codebases, ignoreCodeb
68150
68592
  if (ignoreCodebaseChanges) {
68151
68593
  parsed["codebase"] = undefined;
68152
68594
  } else {
68153
- parsed["codebase"] = await c.getDigest();
68595
+ parsed["codebase"] = await c.getDigest(replacedPath);
68154
68596
  }
68155
68597
  parsed["lock"] = "";
68156
68598
  return import_yaml22.stringify(parsed, yamlOptions);
@@ -68176,7 +68618,7 @@ async function FSFSElement(p, codebases, ignoreCodebaseChanges) {
68176
68618
  if (!isDir)
68177
68619
  return [];
68178
68620
  try {
68179
- const entries = await readdir5(localP, { withFileTypes: true });
68621
+ const entries = await readdir6(localP, { withFileTypes: true });
68180
68622
  for (const e of entries) {
68181
68623
  yield _internal_element(path15.join(localP, e.name), e.isDirectory(), codebases);
68182
68624
  }
@@ -69601,7 +70043,7 @@ async function compareDynFSElement(els1, els2, ignore, json, skips, ignoreMetada
69601
70043
  if (isEls1Remote === false && isWorkspaceSettingsFile(k)) {
69602
70044
  stripUnappliedSettingsFields(after, before);
69603
70045
  }
69604
- if (deepEqual(before, after)) {
70046
+ if (deepEqual(before, after) || isScriptMetadata && sameScriptMetadataModuloTar(before, after)) {
69605
70047
  continue;
69606
70048
  }
69607
70049
  if (!ignoreCodebaseChanges) {
@@ -69615,7 +70057,7 @@ async function compareDynFSElement(els1, els2, ignore, json, skips, ignoreMetada
69615
70057
  delete after.codebase;
69616
70058
  v = import_yaml22.stringify(after, yamlOptions);
69617
70059
  }
69618
- if (beforeCodebase != afterCodebase) {
70060
+ if (!sameCodebaseDigest(beforeCodebase, afterCodebase)) {
69619
70061
  codebaseChanges[k] = afterCodebase ?? beforeCodebase ?? "";
69620
70062
  }
69621
70063
  }
@@ -69655,7 +70097,7 @@ async function compareDynFSElement(els1, els2, ignore, json, skips, ignoreMetada
69655
70097
  continue;
69656
70098
  }
69657
70099
  const c = findCodebase(tsFile, codebases);
69658
- if (await c?.getDigest() != v) {
70100
+ if (!sameCodebaseDigest(await c?.getDigest(tsFile), v)) {
69659
70101
  changes.push({
69660
70102
  name: "edited",
69661
70103
  path: tsFile,
@@ -70351,7 +70793,7 @@ async function dedupeLockfilesOnDisk(args) {
70351
70793
  failed = [],
70352
70794
  dryRun
70353
70795
  } = args;
70354
- const map = await elementsToMap(await FSFSElement(process.cwd(), codebases, false), ignore, opts.json ?? false, opts);
70796
+ const map = await elementsToMap(await FSFSElement(process.cwd(), codebases, true), ignore, opts.json ?? false, opts);
70355
70797
  const plan = computeSharedLockPlan(map, {
70356
70798
  defaultTs: opts.defaultTs,
70357
70799
  depFiles: opts.skipWorkspaceDependencies ? Object.keys(await getRawWorkspaceDependencies(false)) : undefined
@@ -70622,6 +71064,9 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
70622
71064
  } catch {}
70623
71065
  const localFlowInlineMapping = (flowDir) => checkoutInlineNames(path15.join(process.cwd(), flowDir, "flow.yaml"));
70624
71066
  const remote = ZipFSElement(await downloadZip(workspace, opts.plainSecrets, opts.skipVariables, opts.skipResources, opts.skipResourceTypes, opts.skipSecrets, opts.includeSchedules, opts.includeTriggers, opts.includeUsers, opts.includeGroups, opts.includeSettings, opts.includeKey, opts.skipWorkspaceDependencies, opts.skipDatatableMigrations, opts.defaultTs, opts.syncBehavior, opts.includeDatatablePermissions), !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, resourceTypeToIsFileset, false, parseSyncBehavior(opts.syncBehavior) >= 1, localFlowInlineMapping);
71067
+ if (!opts.skipScripts) {
71068
+ await primeCodebaseDigests(codebases, await ignoreF(opts));
71069
+ }
70625
71070
  const local = await FSFSElement(path15.join(process.cwd(), ""), codebases, false);
70626
71071
  const { changes, localMap } = await compareDynFSElement(local, remote, await ignoreF(opts), opts.json ?? false, opts, true, codebases, false, specificItems, wsNameForFiles, false, await isCaseInsensitiveFilesystem(process.cwd()), parentOwnsScheduleEnabled);
70627
71072
  const wsSpecificFlagOnly = computeWsSpecificFlagOnlyPushes(localMap, localSpecificItems, serverWsSpecificItems);
@@ -71983,7 +72428,7 @@ var init_parse_schema = __esm(() => {
71983
72428
 
71984
72429
  // src/utils/metadata.ts
71985
72430
  import { sep as SEP10 } from "node:path";
71986
- import { writeFile as writeFile12, stat as stat10, rm as rm5, readdir as readdir6 } from "node:fs/promises";
72431
+ import { writeFile as writeFile12, stat as stat10, rm as rm5, readdir as readdir7 } from "node:fs/promises";
71987
72432
  import { readFileSync as readFileSync3, existsSync as existsSync12, readdirSync as readdirSync2, statSync as statSync3, writeFileSync as writeFileSync5 } from "node:fs";
71988
72433
  import * as path16 from "node:path";
71989
72434
  import { createRequire as createRequire3 } from "node:module";
@@ -72003,7 +72448,7 @@ function loadParser(pkgName) {
72003
72448
  async function getRawWorkspaceDependencies(legacyBehaviour) {
72004
72449
  const rawWorkspaceDeps = {};
72005
72450
  try {
72006
- const entries = await readdir6("dependencies", { withFileTypes: true });
72451
+ const entries = await readdir7("dependencies", { withFileTypes: true });
72007
72452
  for (const entry of entries) {
72008
72453
  if (entry.isDirectory())
72009
72454
  continue;
@@ -72854,7 +73299,7 @@ var init_metadata = __esm(async () => {
72854
73299
  // src/commands/app/raw_apps.ts
72855
73300
  import { sep as SEP11 } from "node:path";
72856
73301
  import path17 from "node:path";
72857
- import { readdir as readdir7 } from "node:fs/promises";
73302
+ import { readdir as readdir8 } from "node:fs/promises";
72858
73303
  async function readSiblingLock(backendPath, runnableId, allFiles) {
72859
73304
  const target = `${runnableId.toLowerCase()}.lock`;
72860
73305
  const lockFile = allFiles.find((f) => f.toLowerCase() === target);
@@ -72902,7 +73347,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
72902
73347
  const runnables = {};
72903
73348
  try {
72904
73349
  const allFiles = [];
72905
- const _entries = await readdir7(backendPath, { withFileTypes: true });
73350
+ const _entries = await readdir8(backendPath, { withFileTypes: true });
72906
73351
  for (const entry of _entries) {
72907
73352
  if (entry.isFile()) {
72908
73353
  allFiles.push(entry.name);
@@ -72982,7 +73427,7 @@ function writeRunnableToBackend(backendPath, runnableId, runnable) {
72982
73427
  async function collectAppFiles(localPath) {
72983
73428
  const files = {};
72984
73429
  async function readDirRecursive(dir, basePath = "/") {
72985
- const dirEntries = await readdir7(dir, { withFileTypes: true });
73430
+ const dirEntries = await readdir8(dir, { withFileTypes: true });
72986
73431
  for (const entry of dirEntries) {
72987
73432
  const fullPath = dir + entry.name;
72988
73433
  const relativePath = basePath + entry.name;
@@ -73181,7 +73626,7 @@ var init_raw_apps = __esm(async () => {
73181
73626
 
73182
73627
  // src/commands/app/app_metadata.ts
73183
73628
  import path18 from "node:path";
73184
- import { mkdir as mkdir9, readdir as readdir8 } from "node:fs/promises";
73629
+ import { mkdir as mkdir9, readdir as readdir9 } from "node:fs/promises";
73185
73630
  import { sep as SEP12 } from "node:path";
73186
73631
  async function isAppDirectlyStale(appFolder, hashes, conf) {
73187
73632
  if (await checkifMetadataUptodate(appFolder, hashes[TOP_HASH2], conf, TOP_HASH2)) {
@@ -73625,7 +74070,7 @@ async function inferAllInlineSchemas(appFolder, defaultTs = "bun") {
73625
74070
  const backendPath = path18.join(appFolder, APP_BACKEND_FOLDER);
73626
74071
  let entries;
73627
74072
  try {
73628
- entries = await readdir8(backendPath, { withFileTypes: true });
74073
+ entries = await readdir9(backendPath, { withFileTypes: true });
73629
74074
  } catch {
73630
74075
  return schemas;
73631
74076
  }
@@ -76855,7 +77300,7 @@ var init_app = __esm(async () => {
76855
77300
  });
76856
77301
 
76857
77302
  // src/commands/folder/folder.ts
76858
- import { stat as stat13, readdir as readdir9, writeFile as writeFile15, mkdir as mkdir11 } from "node:fs/promises";
77303
+ import { stat as stat13, readdir as readdir10, writeFile as writeFile15, mkdir as mkdir11 } from "node:fs/promises";
76859
77304
  import { sep as SEP15 } from "node:path";
76860
77305
  async function list8(opts) {
76861
77306
  if (opts.json)
@@ -76983,7 +77428,7 @@ async function addMissing(opts) {
76983
77428
  info("No 'f/' directory found. Nothing to do.");
76984
77429
  return;
76985
77430
  }
76986
- const entries = await readdir9(fDir, { withFileTypes: true });
77431
+ const entries = await readdir10(fDir, { withFileTypes: true });
76987
77432
  const missing = [];
76988
77433
  for (const entry of entries) {
76989
77434
  if (!entry.isDirectory())
@@ -78551,7 +78996,7 @@ async function resolvePreviewLocalScriptState(scriptPath, opts) {
78551
78996
  lock: normalizeOptionalLock(rawLock),
78552
78997
  tag: metadata?.payload?.tag,
78553
78998
  codebase,
78554
- codebaseDigest: codebase ? await codebase.getDigest(Array.isArray(codebase.assets) && codebase.assets.length > 0) : undefined
78999
+ codebaseDigest: codebase ? await codebase.getDigest(filePath, Array.isArray(codebase.assets) && codebase.assets.length > 0) : undefined
78555
79000
  };
78556
79001
  }
78557
79002
  return;
@@ -78603,7 +79048,7 @@ async function findDivergedLocalPathScripts(workspaceId, scriptPaths, opts) {
78603
79048
  continue;
78604
79049
  }
78605
79050
  const remoteLock = normalizeOptionalString(remoteScript.lock);
78606
- const diverged = normalizeComparableContent(localScript.content) !== normalizeComparableContent(remoteScript.content) || localScript.language !== remoteScript.language || localScript.lock !== undefined && normalizeComparableContent(localScript.lock) !== normalizeComparableContent(remoteLock) || localScript.tag !== normalizeOptionalString(remoteScript.tag) || localScript.codebaseDigest !== normalizeOptionalString(remoteScript.codebase);
79051
+ const diverged = normalizeComparableContent(localScript.content) !== normalizeComparableContent(remoteScript.content) || localScript.language !== remoteScript.language || localScript.lock !== undefined && normalizeComparableContent(localScript.lock) !== normalizeComparableContent(remoteLock) || localScript.tag !== normalizeOptionalString(remoteScript.tag) || !sameCodebaseDigest(localScript.codebaseDigest, remoteScript.codebase);
78607
79052
  if (diverged) {
78608
79053
  changed.push(scriptPath);
78609
79054
  }
@@ -79706,6 +80151,24 @@ function outputResult(opts, result) {
79706
80151
  error(colors.red(result.error));
79707
80152
  }
79708
80153
  }
80154
+ function resolveGitSyncWsName(config, opts, workspace) {
80155
+ return resolveWsNameForConfigFromFlags({ workspaces: config.workspaces, workspace: opts.workspace }) ?? inferWsNameFromProfile(config, workspace) ?? inferWsNameFromForkBranch(config, workspace.workspaceId);
80156
+ }
80157
+ function resolveOverrideTarget(config, opts, workspace, currentBranch) {
80158
+ const resolved = resolveGitSyncWsName(config, opts, workspace);
80159
+ if (resolved || !currentBranch)
80160
+ return resolved;
80161
+ const entries = config.workspaces ?? {};
80162
+ const taken = getWorkspaceNames(config.workspaces).filter((name) => name === currentBranch || getEffectiveGitBranch(name, entries[name]) === currentBranch);
80163
+ if (taken.length > 0) {
80164
+ throw new Error(`No workspace entry in wmill.yaml matches workspace '${workspace.workspaceId}', and git branch '${currentBranch}' is already used by ${taken.join(", ")}. ` + `Name the entry for this workspace '${workspace.workspaceId}' and keep 'gitBranch: ${currentBranch}' on it so it can be resolved.`);
80165
+ }
80166
+ return currentBranch;
80167
+ }
80168
+ async function getEffectiveSettingsForWorkspace(config, opts, workspace) {
80169
+ const wsName = resolveGitSyncWsName(config, opts, workspace);
80170
+ return await getEffectiveSettings(config, opts.promotion, true, opts.jsonOutput, wsName);
80171
+ }
79709
80172
  function normalizeRepoPath(path) {
79710
80173
  return path.replace(/^\$res:/, "");
79711
80174
  }
@@ -79910,7 +80373,7 @@ async function pullGitSyncSettings(opts) {
79910
80373
  }
79911
80374
  return;
79912
80375
  }
79913
- const currentSettings = await getEffectiveSettings(localConfig, opts.promotion, true, opts.jsonOutput);
80376
+ const currentSettings = await getEffectiveSettingsForWorkspace(localConfig, opts, workspace);
79914
80377
  let writeMode = "replace";
79915
80378
  if (opts.default || opts.replace) {
79916
80379
  writeMode = "replace";
@@ -79959,7 +80422,7 @@ async function pullGitSyncSettings(opts) {
79959
80422
  return;
79960
80423
  }
79961
80424
  if (!opts.diff && !opts.default && !opts.replace && !opts.override) {
79962
- const effectiveCurrentSettings = await getEffectiveSettings(localConfig, opts.promotion, true, opts.jsonOutput);
80425
+ const effectiveCurrentSettings = await getEffectiveSettingsForWorkspace(localConfig, opts, workspace);
79963
80426
  const gitSyncBackend = GitSyncSettingsConverter.extractGitSyncFields(GitSyncSettingsConverter.normalize(backendSyncOptions));
79964
80427
  const gitSyncCurrent = GitSyncSettingsConverter.extractGitSyncFields(GitSyncSettingsConverter.normalize(effectiveCurrentSettings));
79965
80428
  const hasConflict = !deepEqual(gitSyncBackend, gitSyncCurrent);
@@ -80065,11 +80528,12 @@ async function pullGitSyncSettings(opts) {
80065
80528
  }
80066
80529
  }
80067
80530
  }
80068
- if (writeMode === "override" && isGitRepository()) {
80069
- const currentBranch = getCurrentGitBranch();
80070
- if (currentBranch) {
80071
- info(`Detected Git repository, writing settings to branch: ${currentBranch}`);
80072
- updatedConfig = applyBackendSettingsToBranch(localConfig, currentBranch, backendSyncOptions);
80531
+ let overrideTarget;
80532
+ if (writeMode === "override") {
80533
+ overrideTarget = resolveOverrideTarget(localConfig, opts, workspace, isGitRepository() ? getCurrentGitBranch() : undefined);
80534
+ if (overrideTarget) {
80535
+ info(`Writing settings to workspace entry: ${overrideTarget}`);
80536
+ updatedConfig = applyBackendSettingsToBranch(localConfig, overrideTarget, backendSyncOptions);
80073
80537
  }
80074
80538
  }
80075
80539
  await writeFile19("wmill.yaml", import_yaml43.stringify(updatedConfig, yamlOptions), "utf-8");
@@ -80082,9 +80546,8 @@ async function pullGitSyncSettings(opts) {
80082
80546
  } else {
80083
80547
  info(colors.green(`Git-sync settings pulled successfully from ${selectedRepo.git_repo_resource_path}`));
80084
80548
  if (writeMode === "override") {
80085
- const currentBranch = getCurrentGitBranch();
80086
- if (currentBranch) {
80087
- info(colors.gray(`Settings written to branch '${currentBranch}' overrides`));
80549
+ if (overrideTarget) {
80550
+ info(colors.gray(`Settings written to workspace '${overrideTarget}' overrides`));
80088
80551
  }
80089
80552
  } else if (writeMode === "replace") {
80090
80553
  info(colors.gray(`Settings written to top-level configuration`));
@@ -80205,7 +80668,7 @@ async function pushGitSyncSettings(opts) {
80205
80668
  return;
80206
80669
  }
80207
80670
  const repoPath = normalizeRepoPath(selectedRepo.git_repo_resource_path);
80208
- const effectiveSettings = await getEffectiveSettings(localConfig, opts.promotion, true, opts.jsonOutput);
80671
+ const effectiveSettings = await getEffectiveSettingsForWorkspace(localConfig, opts, workspace);
80209
80672
  const backendFormat = GitSyncSettingsConverter.toBackendFormat(effectiveSettings);
80210
80673
  const currentBackend = selectedRepo.settings;
80211
80674
  const currentSyncOptions = GitSyncSettingsConverter.fromBackendFormat(currentBackend);
@@ -86712,7 +87175,7 @@ can call one, not an agent used as a tool.
86712
87175
  - \`flow_input.iter.value\` - Current iteration value inside a \`forloopflow\`; in a \`whileloopflow\` it is just the iteration index (a plain number, same as \`flow_input.iter.index\`)
86713
87176
  - \`flow_input.iter.index\` - Current loop index when inside a loop (\`forloopflow\` or \`whileloopflow\`)
86714
87177
  - After a suspend step (approval), the next step's javascript expressions also get:
86715
- - \`resume\` - the last resume payload (the resume form values); with \`continue_on_disapprove_timeout\`, a disapproval or timeout yields \`{ error: { name: "SuspendedDisapproved" | "SuspendedTimedOut", message } }\` instead
87178
+ - \`resume\` - the last resume payload (the resume form values); with \`continue_on_disapprove_timeout\`, a disapproval or timeout yields \`{ error: { name: "SuspendedDisapproved" | "SuspendedTimedOut", message } }\` instead, plus \`reason\` on a disapproval whose approver gave one
86716
87179
  - \`resumes\` - every resume payload, in arrival order
86717
87180
  - \`approvers\` - a plain array of strings, one per resume: for a resume through the \`resume\`/\`cancel\` URL from \`getResumeUrls(approver)\`, the \`approver\` passed there if any; otherwise (including the \`approvalPage\` link) the resuming user's username, else \`"anonymous"\`, e.g. \`approvers[0]\`. It is NOT the \`{ resume_id, approver }\` objects stored in the flow status, so \`approvers[0].approver\` is always undefined
86718
87181
 
@@ -86725,6 +87188,7 @@ can call one, not an agent used as a tool.
86725
87188
  - \`stop_after_if\` is evaluated after each iteration: on the loop module, \`result\` is that iteration's result (what its last step returned); on an inner step, it is that step's result
86726
87189
  - \`flow_input.iter.value\` in a \`whileloopflow\` is just the iteration index (same number as \`flow_input.iter.index\`) — it never carries state, so \`flow_input.iter.value.<field>\` is always undefined and a loop whose stop condition depends on it never terminates
86727
87190
  - To carry state across iterations, a step reads its own previous-iteration result via \`results.<its_own_id>\` with a first-iteration fallback (e.g. \`results.b ?? flow_input.start\`) — but then the loop's \`stop_after_if\` MUST sit on that inner step, not on the loop module: a body that is exactly one plain step with the stop condition on the loop module runs on a fast path where \`results.<step_id>\` is null on every iteration and the loop never terminates (bodies with 2+ steps, or whose single step has its own \`stop_after_if\`, retry or similar, resolve \`results\` across iterations regardless of stop placement)
87191
+ - To cap a \`whileloopflow\`, set \`max_iterations\` and/or \`max_duration_secs\` (seconds since the first iteration started) on the loop's \`value\`, rather than encoding the bound into \`stop_after_if\`. Both are checked after each iteration, so a running iteration is never interrupted and the loop can exceed \`max_duration_secs\` by at most one iteration (bound an iteration with its steps' \`timeout\`); whichever is reached first, unless \`stop_after_if\` stopped the loop at that iteration, fails the loop with \`{ error: { name: "LoopExhausted", message } }\`. To handle it, set \`continue_on_error: true\` on the loop and branch in the next step on \`results.<loop_id>.error?.name === "LoopExhausted"\` (only the step right after the loop sees the error there; later steps see the iterations' results); retries and the failure module apply as for any step failure. For a pause between iterations, set \`sleep\` on the body's step
86728
87192
  - For state that is just a counter, derive it from the index instead (e.g. \`flow_input.iter.index + 1\`) — that works in every configuration, including with \`stop_after_if\` on the loop module
86729
87193
  - If the user asks for a final scalar/object after a loop, add a normal step after the loop that extracts the final value from the loop result instead of returning the whole loop result array
86730
87194
 
@@ -87034,7 +87498,7 @@ Reference a specific resource using \`$res:\` prefix:
87034
87498
 
87035
87499
  ## OpenFlow Schema
87036
87500
 
87037
- {"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":"Address of the account the flow runs on behalf of. Derived from on_behalf_of on read; accepted on write, where it is resolved to the account it names."},"on_behalf_of":{"type":"string","description":"The flow runs with the permissions of this identity: u/{username}, g/{group}, or a bare email when the username is itself email-shaped. The only stored half of the identity; on_behalf_of_email is derived from it. Omit it when writing and it is resolved from that address instead."}},"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"},"timeout":{"type":"integer","description":"Wall-clock limit in seconds for the whole flow run, counted from its start and including time spent sleeping or suspended at an approval. It also applies when the flow is called as a subflow step, unless that step sets its own timeout, which replaces it. It is checked periodically, so a run can go a few seconds past it. When it expires, the running steps are cancelled, the failure module runs if there is one, and the flow ends cancelled with a timeout error. A calling flow sees the subflow step fail with that error."},"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":"Id of the step whose result a sync webhook returns as soon as that step completes, while the rest of the flow keeps running. When the step does not run, or fails while the flow has a failure module, the flow's final result is returned instead."},"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: the n-th retry waits multiplier \\u00d7 seconds^n","properties":{"attempts":{"type":"integer","description":"Number of retry attempts"},"multiplier":{"type":"integer","description":"Multiplier for exponential backoff"},"seconds":{"type":"integer","minimum":1,"description":"Base of the exponential (seconds); the n-th retry waits multiplier \\u00d7 seconds^n, where n counts constant retries too"},"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, one of: yellow, blue, green, purple, pink, orange, red, cyan, lime, gray. Any other value renders unstyled."},"type":{"type":"string","enum":["free","group"],"description":"Type of note - 'free' for standalone notes. 'group' notes are deprecated; segment a flow with FlowValue.groups instead."},"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, one of: yellow, blue, green, purple, pink, orange, red, cyan, lime, gray. Omit it to let the editor pick one."}},"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."},"error_include_result":{"type":"boolean","description":"When stopping with an error (error_message set), embed the stopping step's own result inside the raised error object (as error.result) instead of discarding it. The top-level result stays { error }. Defaults to false."}},"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 after this step completes, before the next step starts (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"},"skin":{"type":"string","enum":["detailed","minimal"],"description":"How the approval request is presented, on the approval page and in Slack/Teams approval messages. 'detailed' (used when unset) shows the flow details (arguments, graph, approvers); 'minimal' shows only the request: the step description, form and approve/reject actions"}}},"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"},"job_token_scopes":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Scopes the token of this step's jobs is restricted to (domain:action[:resource], e.g. oidc:write), on top of the flow's own restriction: a step can only narrow it. Applies to everything the step runs (loop and branch bodies, AI agent tools)."},"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 for loops, use 'flow_input.iter.value' for the current iteration value (in while loops it equals 'flow_input.iter.index')","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","azure_foundry","anthropic","mistral","deepseek","googleai","groq","openrouter","togetherai","customai","aws_bedrock","typesafe","cloudflare"]},"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')"},"reasoning_effort":{"type":"string","description":"Provider-native reasoning effort token (e.g. 'low', 'high', 'none') for models that support extended thinking. Optional; unset leaves the provider default."}},"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"]},"MemoryWindow":{"type":"object","description":"Keeps the most recent messages of the memory named by the run's memory id (or the step's\\n\`memory_id\`). Without a memory id the agent runs without memory.\\n","properties":{"kind":{"type":"string","enum":["window"]},"context_length":{"type":"integer","description":"Number of most recent messages to load and store. 0 turns memory off."}},"required":["kind","context_length"]},"MemoryAuto":{"type":"object","deprecated":true,"description":"Deprecated, still read as it was written: the run's memory id, else the \`memory_id\` here.\\nThe step's own \`memory_id\` is not read while this kind is set; switch the kind to \`window\`\\nto use it. Without a \`context_length\`, or with 0, it is \`off\` and reads \`previous_messages\`.\\n","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"]},"MemoryCompaction":{"type":"object","description":"Keeps the whole memory named by the run's memory id (or the step's \`memory_id\`), replacing\\nits older part with a summary as the conversation approaches the model's context window.\\nWithout a memory id the agent runs without memory, and compaction bounds the run's own loop.\\n","properties":{"kind":{"type":"string","enum":["compaction"]},"context_window":{"type":"integer","description":"Overrides the context window looked up from the model, in tokens. Only a model\\nWindmill does not know needs one; those fall back to 128000.\\n"}},"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","deprecated":true,"description":"Deprecated, still read as it was written. Move the step to \`off\` with \`previous_messages\` instead.","properties":{"kind":{"type":"string","enum":["manual"]},"messages":{"type":"array","items":{"$ref":"#/components/schemas/MemoryMessage"}}},"required":["kind","messages"]},"MemoryConfig":{"description":"Managed memory, stored by Windmill and replayed with each request. The memory is named by a memory id, see \`memory_id\`. While it is off, a step can supply its history in \`previous_messages\`.","oneOf":[{"$ref":"#/components/schemas/MemoryOff"},{"$ref":"#/components/schemas/MemoryWindow"},{"$ref":"#/components/schemas/MemoryCompaction"},{"$ref":"#/components/schemas/MemoryAuto"},{"$ref":"#/components/schemas/MemoryManual"}],"discriminator":{"propertyName":"kind","mapping":{"off":"#/components/schemas/MemoryOff","window":"#/components/schemas/MemoryWindow","compaction":"#/components/schemas/MemoryCompaction","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"},{"$ref":"#/components/schemas/AiDecision"}],"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","aidecision":"#/components/schemas/AiDecision"}}},"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","bunnative","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","dbt"]},"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 until stopped. The implicit iterator is the iteration counter, so 'flow_input.iter.value' equals 'flow_input.iter.index' (0, 1, 2, ...) and never carries state. To carry state across iterations, a step reads its own previous-iteration result via 'results.<its_own_id>' with a first-iteration fallback - the loop's stop_after_if must then be on that inner step (a plain single-step body with stop_after_if on the loop module does not resolve 'results' across iterations and never terminates); plain counters can instead be derived from 'flow_input.iter.index', which works in every configuration. stop_after_if is evaluated after each iteration - on the loop module 'result' is the last iteration's result","properties":{"modules":{"type":"array","description":"Steps to execute in each iteration","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":"The name the AI agent calls this tool by, not a human label. On a flowmodule tool it must match ^[a-zA-Z0-9_]+$ - letters, numbers and underscores only (e.g. 'search_documentation', not 'Search documentation') - and always be set; on an mcp, websearch or question tool it is a plain label. Put the human-readable explanation in 'description'."},"description":{"type":"string","description":"Free-text description of the tool given to the AI to decide when and how to call it. Overrides the description auto-derived from the underlying script."},"job_token_scopes":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Scopes the token of this tool's jobs is restricted to, on top of the agent step's own restriction: a tool can only narrow it."},"requires_approval":{"type":"boolean","description":"Flowmodule and mcp tools only. Each call waits for a person to approve or reject it from the flow's run page or chat, without the agent holding a worker. Calls in the same turn that do not require approval run right away. A rejected call, or one nobody answers within 30 minutes, is reported to the AI as not run."},"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"},{"$ref":"#/components/schemas/QuestionToolValue"}],"discriminator":{"propertyName":"tool_type","mapping":{"flowmodule":"#/components/schemas/FlowModuleTool","mcp":"#/components/schemas/McpToolValue","websearch":"#/components/schemas/WebsearchToolValue","question":"#/components/schemas/QuestionToolValue"}}},"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"]},"QuestionToolValue":{"type":"object","description":"Built-in tool the AI calls as ask_question: the agent stops, releasing its worker, until someone answers from the flow's run page or chat or the question times out, then resumes with the answer as the tool result.","properties":{"tool_type":{"type":"string","enum":["question"]},"timeout":{"type":"integer","description":"Seconds to wait for an answer before the question is reported to the AI as timed out. Defaults to 1800."}},"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\\nflow.input syntax. Required unless memory is off and \`previous_messages\` supplies\\nthe prompt; image output always needs it.\\n"},"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, reasoning_token_delta, tool_call, tool_call_arguments, tool_execution, tool_result\\n"},"memory":{"$ref":"#/components/schemas/MemoryTransform"},"memory_id":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"String. Names the memory this step reads and writes, overriding the memory id the run\\nwas started with (the chat conversation, an app chat session or the \`memory_id\` run\\nparameter). Leave unset to use the run's memory id. A fixed value shares one memory\\nacross every run; an expression such as \`flow_input.customer_id\` keeps one memory per\\nkey. When it evaluates to an empty value the agent runs without memory. Read only\\nwhile \`memory\` is \`window\` or \`compaction\`: it is ignored when memory is off, and an\\nolder \`auto\` or \`manual\` memory reads neither history input.\\n"},"previous_messages":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Array of MemoryMessage. History supplied by the flow, sent between the system prompt\\nand the user message. Read only while \`memory\` is off or absent: managed memory\\nignores it, and an older \`auto\` or \`manual\` memory reads neither history input.\\n"},"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"},"enabled_tools":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Array of strings naming which of the tools configured in \`tools\` the agent may call\\nthis run. Leaving it unset carries every one of them; an empty array carries none.\\nA tool is named as the model is shown it. An entry the model is shown nothing of is\\nnamed by what identifies it instead: an MCP server by its resource path, carrying\\nevery tool it exposes (which of them stays that entry's include_tools/exclude_tools),\\nand a websearch entry by the reserved name '__wm_web_search', whatever summary it carries\\n(no tool may take that name).\\nExample: ['get_user', 'u/admin/github_mcp', '__wm_web_search']\\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"},"model":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"String. Only on a step linked to a saved agent (see \`agent\`): replaces the model\\nsaved on the agent for this step's runs, on the agent's own provider resource. An\\nempty value keeps the saved model. Set it to an expression such as\\n\`flow_input.model\` to choose the model per run.\\n"},"reasoning_effort":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"String. Only on a step linked to a saved agent (see \`agent\`): replaces the reasoning\\neffort saved on the agent for this step's runs, as a provider-native token (e.g.\\n'low', 'high', 'none'). An empty value sends no effort, so the model runs at its\\ndefault. Leave the input out to keep the saved effort, which holds only while the\\nstep runs the saved model. A step that is not linked sets both inside \`provider\`.\\n"}}},"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"]},"tag":{"type":"string","description":"Worker group tag for execution routing. If not set, the AI agent step runs on the flow's tag (default \`flow\`)"},"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."},"agent":{"type":"string","description":"Path of a reusable \`ai_agent\` resource (hybrid linking). When set, the agent brain\\nconfig (provider/model/system prompt/etc.) and tool set are resolved at runtime from\\nthat resource; the module's input_transforms then only carry the flow-local inputs\\n(user_message, user_attachments, enabled_tools and the history inputs memory_id and previous_messages)\\nand, optionally, the \`model\` and \`reasoning_effort\` overrides of what the agent saved.\\n"},"tool_inputs":{"type":"object","description":"Host-local wiring for an agent's tool inputs, keyed by tool id then input key. Binds the\\nreferenced agent's tools to this flow's context (flow_input/results) without mutating the\\nshared resource; overlaid onto the tools' input_transforms at runtime \\u2014 including when\\n\`agent\` is unset, since a step forked for editing keeps these overrides until it is saved\\nback or unlinked.\\n","additionalProperties":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/InputTransform"}}},"parallel":{"type":"boolean","description":"If true, the agent can execute multiple tool calls in parallel"}},"required":["type","input_transforms"]},"AiDecision":{"type":"object","description":"AI decision step: one call to a decision model (TypeSafe's Jev, Cloudflare's\\nJev-compatible Clef, or OpenAI's Decisions API) that answers typed questions about a\\nstate with calibrated probabilities, instead of generating text.\\nPrefer it over an AI agent to classify, route, score or check something: it is fast,\\ncheap and its answers are structured. Its result is { output: { <question name>: answer },\\nmodel, usage }, so a later step reads e.g. results.<id>.output.intent.choice. To route on\\nthe answers, follow it with a branchone whose branch exprs read\\nresults.<id>.output.<question>.choice. Usable as an AI agent tool, where the calling agent\\nsupplies the state.\\n","properties":{"input_transforms":{"type":"object","description":"Input parameters for the decision mapped to their values","properties":{"provider":{"$ref":"#/components/schemas/ProviderTransform"},"state":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"What the questions are asked about: a string, an object or an array of strings.\\nAn object with descriptive keys holding only what the questions need works best.\\nExample: { message: flow_input.message, plan: results.a.plan }\\n"},"questions":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Object mapping each question name to { type, instructions, criteria }, where type is:\\n- 'choice': criteria maps each option to its description (up to 255); the answer\\n has choice, probabilities and confidence\\n- 'score': criteria is an ordered array of 2 to 10 level descriptions; the answer\\n has score, legend, probabilities and confidence\\n- 'noul': yes/no, criteria optionally { true, false } descriptions; the answer has\\n noul, the probability of yes (0 to 1)\\nExample: { intent: { type: 'choice', instructions: 'What does the customer want?',\\ncriteria: { refund: 'Money back', bug: 'Something is broken' } } }\\n"}},"required":["provider","state","questions"]},"type":{"type":"string","enum":["aidecision"]},"tag":{"type":"string","description":"Worker group tag for execution routing. If not set, the step runs on the flow's tag (default \`flow\`)"}},"required":["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":["approval"]},"call_id":{"type":"string"},"calls":{"type":"array","items":{"type":"object","properties":{"function_name":{"type":"string"},"arguments":{}},"required":["function_name","arguments"]}},"expires_at":{"type":"string","format":"date-time"}},"required":["type","call_id","calls","expires_at"]},{"type":"object","properties":{"type":{"type":"string","enum":["question"]},"call_id":{"type":"string"},"question":{"type":"string"},"choices":{"type":"array","items":{"type":"string"},"description":"answers the model proposes; a free-text answer is always possible"},"multi_select":{"type":"boolean","description":"whether several choices can be picked together"},"expires_at":{"type":"string","format":"date-time"}},"required":["type","call_id","question","expires_at"]},{"type":"object","properties":{"type":{"type":"string","enum":["message"]}},"required":["content","type"]}]}},"agent_actions_success":{"type":"array","items":{"type":"boolean"}}},"required":["type"]}}
87501
+ {"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":"Address of the account the flow runs on behalf of. Derived from on_behalf_of on read; accepted on write, where it is resolved to the account it names."},"on_behalf_of":{"type":"string","description":"The flow runs with the permissions of this identity: u/{username}, g/{group}, or a bare email when the username is itself email-shaped. The only stored half of the identity; on_behalf_of_email is derived from it. Omit it when writing and it is resolved from that address instead."}},"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"},"on_concurrency_limit":{"type":"string","enum":["queue","fail"],"description":"What a run of this flow does when its concurrency limit is reached. \`queue\` (default) re-queues it to a later slot, \`fail\` ends it immediately as failed, like any failed step."},"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"},"timeout":{"type":"integer","description":"Wall-clock limit in seconds for the whole flow run, counted from its start and including time spent sleeping or suspended at an approval. It also applies when the flow is called as a subflow step, unless that step sets its own timeout, which replaces it. It is checked periodically, so a run can go a few seconds past it. When it expires, the running steps are cancelled, the failure module runs if there is one, and the flow ends cancelled with a timeout error. A calling flow sees the subflow step fail with that error."},"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":"Id of the step whose result a sync webhook returns as soon as that step completes, while the rest of the flow keeps running. When the step does not run, or fails while the flow has a failure module, the flow's final result is returned instead."},"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: the n-th retry waits multiplier \\u00d7 seconds^n","properties":{"attempts":{"type":"integer","description":"Number of retry attempts"},"multiplier":{"type":"integer","description":"Multiplier for exponential backoff"},"seconds":{"type":"integer","minimum":1,"description":"Base of the exponential (seconds); the n-th retry waits multiplier \\u00d7 seconds^n, where n counts constant retries too"},"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, one of: yellow, blue, green, purple, pink, orange, red, cyan, lime, gray. Any other value renders unstyled."},"type":{"type":"string","enum":["free","group"],"description":"Type of note - 'free' for standalone notes. 'group' notes are deprecated; segment a flow with FlowValue.groups instead."},"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, one of: yellow, blue, green, purple, pink, orange, red, cyan, lime, gray. Omit it to let the editor pick one."}},"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."},"error_include_result":{"type":"boolean","description":"When stopping with an error (error_message set), embed the stopping step's own result inside the raised error object (as error.result) instead of discarding it. The top-level result stays { error }. Defaults to false."}},"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 after this step completes, before the next step starts (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"},"preview_only":{"type":"boolean","description":"If true, the mock applies only to runs started as a flow preview (from the editor, and every job under it, subflows included). Absent or false, it applies to every run."}}},"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"},"skin":{"type":"string","enum":["detailed","minimal"],"description":"How the approval request is presented, on the approval page and in Slack/Teams approval messages. 'detailed' (used when unset) shows the flow details (arguments, graph, approvers); 'minimal' shows only the request: the step description, form and approve/reject actions"}}},"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"},"job_token_scopes":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Scopes the token of this step's jobs is restricted to (domain:action[:resource], e.g. oidc:write), on top of the flow's own restriction: a step can only narrow it. Applies to everything the step runs (loop and branch bodies, AI agent tools)."},"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 for loops, use 'flow_input.iter.value' for the current iteration value (in while loops it equals 'flow_input.iter.index')","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","azure_foundry","anthropic","mistral","deepseek","googleai","groq","openrouter","togetherai","customai","aws_bedrock","typesafe","cloudflare"]},"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')"},"reasoning_effort":{"type":"string","description":"Provider-native reasoning effort token (e.g. 'low', 'high', 'none') for models that support extended thinking. Optional; unset leaves the provider default."}},"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"]},"MemoryWindow":{"type":"object","description":"Keeps the most recent messages of the memory named by the run's memory id (or the step's\\n\`memory_id\`). Without a memory id the agent runs without memory.\\n","properties":{"kind":{"type":"string","enum":["window"]},"context_length":{"type":"integer","description":"Number of most recent messages to load and store. 0 turns memory off."}},"required":["kind","context_length"]},"MemoryAuto":{"type":"object","deprecated":true,"description":"Deprecated, still read as it was written: the run's memory id, else the \`memory_id\` here.\\nThe step's own \`memory_id\` is not read while this kind is set; switch the kind to \`window\`\\nto use it. Without a \`context_length\`, or with 0, it is \`off\` and reads \`previous_messages\`.\\n","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"]},"MemoryCompaction":{"type":"object","description":"Keeps the whole memory named by the run's memory id (or the step's \`memory_id\`), replacing\\nits older part with a summary as the conversation approaches the model's context window.\\nWithout a memory id the agent runs without memory, and compaction bounds the run's own loop.\\n","properties":{"kind":{"type":"string","enum":["compaction"]},"context_window":{"type":"integer","description":"Overrides the context window looked up from the model, in tokens. Only a model\\nWindmill does not know needs one; those fall back to 128000.\\n"}},"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","deprecated":true,"description":"Deprecated, still read as it was written. Move the step to \`off\` with \`previous_messages\` instead.","properties":{"kind":{"type":"string","enum":["manual"]},"messages":{"type":"array","items":{"$ref":"#/components/schemas/MemoryMessage"}}},"required":["kind","messages"]},"MemoryConfig":{"description":"Managed memory, stored by Windmill and replayed with each request. The memory is named by a memory id, see \`memory_id\`. While it is off, a step can supply its history in \`previous_messages\`.","oneOf":[{"$ref":"#/components/schemas/MemoryOff"},{"$ref":"#/components/schemas/MemoryWindow"},{"$ref":"#/components/schemas/MemoryCompaction"},{"$ref":"#/components/schemas/MemoryAuto"},{"$ref":"#/components/schemas/MemoryManual"}],"discriminator":{"propertyName":"kind","mapping":{"off":"#/components/schemas/MemoryOff","window":"#/components/schemas/MemoryWindow","compaction":"#/components/schemas/MemoryCompaction","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"},{"$ref":"#/components/schemas/AiDecision"}],"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","aidecision":"#/components/schemas/AiDecision"}}},"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","bunnative","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"},"on_concurrency_limit":{"type":"string","enum":["queue","fail"],"description":"What a run of this step does when its concurrency limit is reached. \`queue\` (default) re-queues it to a later slot, \`fail\` ends it immediately as failed."},"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","dbt"]},"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 until stopped. The implicit iterator is the iteration counter, so 'flow_input.iter.value' equals 'flow_input.iter.index' (0, 1, 2, ...) and never carries state. To carry state across iterations, a step reads its own previous-iteration result via 'results.<its_own_id>' with a first-iteration fallback - the loop's stop_after_if must then be on that inner step (a plain single-step body with stop_after_if on the loop module does not resolve 'results' across iterations and never terminates); plain counters can instead be derived from 'flow_input.iter.index', which works in every configuration. stop_after_if is evaluated after each iteration - on the loop module 'result' is the last iteration's result","properties":{"modules":{"type":"array","description":"Steps to execute in each iteration","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"},"max_iterations":{"type":"integer","minimum":1,"description":"Maximum number of iterations. Checked after each iteration; when reached and stop_after_if did not stop the loop, the loop fails with an error named 'LoopExhausted'"},"max_duration_secs":{"type":"integer","minimum":1,"description":"Maximum wall-clock seconds since the first iteration started, checked after each iteration. A running iteration is not interrupted, so the loop can exceed the limit by up to one iteration; the timeout of the body's steps caps an iteration. When reached and stop_after_if did not stop the loop, the loop fails with an error named 'LoopExhausted'"}},"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"},"parallelism":{"description":"Maximum number of branches running at once when parallel=true. Can be static number or expression","$ref":"#/components/schemas/InputTransform"}},"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":"The name the AI agent calls this tool by, not a human label. On a flowmodule tool it must match ^[a-zA-Z0-9_]+$ - letters, numbers and underscores only (e.g. 'search_documentation', not 'Search documentation') - and always be set; on an mcp, websearch or question tool it is a plain label. Put the human-readable explanation in 'description'."},"description":{"type":"string","description":"Free-text description of the tool given to the AI to decide when and how to call it. Overrides the description auto-derived from the underlying script."},"job_token_scopes":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Scopes the token of this tool's jobs is restricted to, on top of the agent step's own restriction: a tool can only narrow it."},"requires_approval":{"type":"boolean","description":"Flowmodule and mcp tools only. Each call waits for a person to approve or reject it from the flow's run page or chat, without the agent holding a worker. Calls in the same turn that do not require approval run right away. A rejected call, or one nobody answers within 30 minutes, is reported to the AI as not run."},"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"},{"$ref":"#/components/schemas/QuestionToolValue"}],"discriminator":{"propertyName":"tool_type","mapping":{"flowmodule":"#/components/schemas/FlowModuleTool","mcp":"#/components/schemas/McpToolValue","websearch":"#/components/schemas/WebsearchToolValue","question":"#/components/schemas/QuestionToolValue"}}},"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"]},"QuestionToolValue":{"type":"object","description":"Built-in tool the AI calls as ask_question: the agent stops, releasing its worker, until someone answers from the flow's run page or chat or the question times out, then resumes with the answer as the tool result.","properties":{"tool_type":{"type":"string","enum":["question"]},"timeout":{"type":"integer","description":"Seconds to wait for an answer before the question is reported to the AI as timed out. Defaults to 1800."}},"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\\nflow.input syntax. Required unless memory is off and \`previous_messages\` supplies\\nthe prompt; image output always needs it.\\n"},"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, reasoning_token_delta, tool_call, tool_call_arguments, tool_execution, tool_result\\n"},"memory":{"$ref":"#/components/schemas/MemoryTransform"},"memory_id":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"String. Names the memory this step reads and writes, overriding the memory id the run\\nwas started with (the chat conversation, an app chat session or the \`memory_id\` run\\nparameter). Leave unset to use the run's memory id. A fixed value shares one memory\\nacross every run; an expression such as \`flow_input.customer_id\` keeps one memory per\\nkey. When it evaluates to an empty value the agent runs without memory. Read only\\nwhile \`memory\` is \`window\` or \`compaction\`: it is ignored when memory is off, and an\\nolder \`auto\` or \`manual\` memory reads neither history input.\\n"},"previous_messages":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Array of MemoryMessage. History supplied by the flow, sent between the system prompt\\nand the user message. Read only while \`memory\` is off or absent: managed memory\\nignores it, and an older \`auto\` or \`manual\` memory reads neither history input.\\n"},"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"},"enabled_tools":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Array of strings naming which of the tools configured in \`tools\` the agent may call\\nthis run. Leaving it unset carries every one of them; an empty array carries none.\\nA tool is named as the model is shown it. An entry the model is shown nothing of is\\nnamed by what identifies it instead: an MCP server by its resource path, carrying\\nevery tool it exposes (which of them stays that entry's include_tools/exclude_tools),\\nand a websearch entry by the reserved name '__wm_web_search', whatever summary it carries\\n(no tool may take that name).\\nExample: ['get_user', 'u/admin/github_mcp', '__wm_web_search']\\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"},"model":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"String. Only on a step linked to a saved agent (see \`agent\`): replaces the model\\nsaved on the agent for this step's runs, on the agent's own provider resource. An\\nempty value keeps the saved model. Set it to an expression such as\\n\`flow_input.model\` to choose the model per run.\\n"},"reasoning_effort":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"String. Only on a step linked to a saved agent (see \`agent\`): replaces the reasoning\\neffort saved on the agent for this step's runs, as a provider-native token (e.g.\\n'low', 'high', 'none'). An empty value sends no effort, so the model runs at its\\ndefault. Leave the input out to keep the saved effort, which holds only while the\\nstep runs the saved model. A step that is not linked sets both inside \`provider\`.\\n"}}},"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"]},"tag":{"type":"string","description":"Worker group tag for execution routing. If not set, the AI agent step runs on the flow's tag (default \`flow\`)"},"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."},"agent":{"type":"string","description":"Path of a reusable \`ai_agent\` resource (hybrid linking). When set, the agent brain\\nconfig (provider/model/system prompt/etc.) and tool set are resolved at runtime from\\nthat resource; the module's input_transforms then only carry the flow-local inputs\\n(user_message, user_attachments, enabled_tools and the history inputs memory_id and previous_messages)\\nand, optionally, the \`model\` and \`reasoning_effort\` overrides of what the agent saved.\\n"},"tool_inputs":{"type":"object","description":"Host-local wiring for an agent's tool inputs, keyed by tool id then input key. Binds the\\nreferenced agent's tools to this flow's context (flow_input/results) without mutating the\\nshared resource; overlaid onto the tools' input_transforms at runtime \\u2014 including when\\n\`agent\` is unset, since a step forked for editing keeps these overrides until it is saved\\nback or unlinked.\\n","additionalProperties":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/InputTransform"}}},"parallel":{"type":"boolean","description":"If true, the agent can execute multiple tool calls in parallel"}},"required":["type","input_transforms"]},"AiDecision":{"type":"object","description":"AI decision step: one call to a decision model (TypeSafe's Jev, Cloudflare's\\nJev-compatible Clef, or OpenAI's Decisions API) that answers typed questions about a\\nstate with calibrated probabilities, instead of generating text.\\nPrefer it over an AI agent to classify, route, score or check something: it is fast,\\ncheap and its answers are structured. Its result is { output: { <question name>: answer },\\nmodel, usage }, so a later step reads e.g. results.<id>.output.intent.choice. To route on\\nthe answers, follow it with a branchone whose branch exprs read\\nresults.<id>.output.<question>.choice. Usable as an AI agent tool, where the calling agent\\nsupplies the state.\\n","properties":{"input_transforms":{"type":"object","description":"Input parameters for the decision mapped to their values","properties":{"provider":{"$ref":"#/components/schemas/ProviderTransform"},"state":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"What the questions are asked about: a string, an object or an array of strings.\\nAn object with descriptive keys holding only what the questions need works best.\\nExample: { message: flow_input.message, plan: results.a.plan }\\n"},"questions":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Object mapping each question name to { type, instructions, criteria }, where type is:\\n- 'choice': criteria maps each option to its description (up to 255); the answer\\n has choice, probabilities and confidence\\n- 'score': criteria is an ordered array of 2 to 10 level descriptions; the answer\\n has score, legend, probabilities and confidence\\n- 'noul': yes/no, criteria optionally { true, false } descriptions; the answer has\\n noul, the probability of yes (0 to 1)\\nExample: { intent: { type: 'choice', instructions: 'What does the customer want?',\\ncriteria: { refund: 'Money back', bug: 'Something is broken' } } }\\n"}},"required":["provider","state","questions"]},"type":{"type":"string","enum":["aidecision"]},"tag":{"type":"string","description":"Worker group tag for execution routing. If not set, the step runs on the flow's tag (default \`flow\`)"}},"required":["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":["approval"]},"call_id":{"type":"string"},"calls":{"type":"array","items":{"type":"object","properties":{"function_name":{"type":"string"},"arguments":{}},"required":["function_name","arguments"]}},"expires_at":{"type":"string","format":"date-time"}},"required":["type","call_id","calls","expires_at"]},{"type":"object","properties":{"type":{"type":"string","enum":["question"]},"call_id":{"type":"string"},"question":{"type":"string"},"choices":{"type":"array","items":{"type":"string"},"description":"answers the model proposes; a free-text answer is always possible"},"multi_select":{"type":"boolean","description":"whether several choices can be picked together"},"expires_at":{"type":"string","format":"date-time"}},"required":["type","call_id","question","expires_at"]},{"type":"object","properties":{"type":{"type":"string","enum":["message"]}},"required":["content","type"]}]}},"agent_actions_success":{"type":"array","items":{"type":"boolean"}}},"required":["type"]}}
87038
87502
  `,
87039
87503
  "raw-app": `---
87040
87504
  name: raw-app
@@ -89082,7 +89546,8 @@ write a secret you were not given: keep the placeholder.
89082
89546
  | \`default_app\` | Path of the app shown as the workspace home. |
89083
89547
  | \`default_scripts\` | \`{ order?, hidden?, default_script_content? }\` for the script language picker. |
89084
89548
  | \`deploy_ui\` | \`{ include_path?, include_type? }\`: what the deploy-to-workspace UI offers. |
89085
- | \`operator_settings\` | What operators see and do: page visibility flags (\`runs\`, \`schedules\`, \`resources\`, \`variables\`, \`assets\`, \`audit_logs\`, \`groups\`, \`folders\`, \`workers\`, \`triggers\`) and write rights (\`manage_schedules\`, \`manage_triggers\`, \`builder_flows\`, \`builder_apps\`). A write right the value omits keeps its stored value. |
89549
+ | \`role_overrides\` | \`{ <role>: { label?, capabilities, workspace_only? } }\`: the workspace's overrides of the instance's roles, and with \`workspace_only: true\` a role of this workspace only (Enterprise). A role the value omits loses its override. Overriding a role the instance does not define is refused. Edit operator rights in \`role_overrides.operator\`. |
89550
+ | \`operator_settings\` | Legacy view of the \`operator\` role, kept for older servers: page visibility flags (\`runs\`, \`schedules\`, \`resources\`, \`variables\`, \`assets\`, \`audit_logs\`, \`groups\`, \`folders\`, \`workers\`, \`triggers\`) and write rights (\`manage_schedules\`, \`manage_triggers\`, \`builder_flows\`, \`builder_apps\`). Not applied when the document also states \`role_overrides\`. |
89086
89551
  | \`mute_critical_alerts\` | Mute the workspace's critical alerts. |
89087
89552
  | \`slack_team_id\`, \`slack_name\` | Read only: set by connecting Slack on the settings page. |
89088
89553
  | \`slack_command_script\` / \`teams_command_script\` | Script or flow handling the Slack / Teams command. |
@@ -89104,7 +89569,7 @@ only show them, \`-y\` to skip the question, \`--replace\` to clear what the fil
89104
89569
  With \`includeSettings: true\` in \`wmill.yaml\`, \`wmill sync pull\` writes the document to
89105
89570
  \`settings.yaml\`, secrets encrypted with the workspace key (plaintext only with \`plainSecrets\`), and
89106
89571
  \`wmill sync push\` applies it. Unlike a partial apply, a push treats the file as the whole
89107
- document: a setting the file omits is cleared, except \`operator_settings\`, \`color\`, the auto-invite
89572
+ document: a setting the file omits is cleared, except \`operator_settings\`, \`role_overrides\`, \`color\`, the auto-invite
89108
89573
  instance groups, and the keys \`ducklake\`, \`dbt_warehouses\`, \`deploy_ui\`, \`teams_command_script\`,
89109
89574
  \`public_app_execution_limit_per_minute\`, \`guest_jwt_public_key\`, \`guest_jwt_jwks_url\`,
89110
89575
  \`error_handler_fallback_to_instance_alerts\` and
@@ -90835,6 +91300,11 @@ properties:
90835
91300
  description: Logic to apply when evaluating the top-level filters. 'and' requires
90836
91301
  all of them to match, 'or' requires any of them to match. Nested \`any_of\`/\`all_of\`/\`none_of\`
90837
91302
  groups carry their own logic.
91303
+ run_on_filter_error:
91304
+ type: boolean
91305
+ description: Whether a message the filters cannot read (not UTF-8, or not JSON)
91306
+ still runs the target, as if the trigger had no filters. A preprocessor then
91307
+ finds the reason in \`event.filter_error\`. When false, such a message is skipped.
90838
91308
  auto_offset_reset:
90839
91309
  type: string
90840
91310
  enum:
@@ -91569,6 +92039,11 @@ properties:
91569
92039
  description: Logic to apply when evaluating the top-level filters. 'and' requires
91570
92040
  all of them to match, 'or' requires any of them to match. Nested \`any_of\`/\`all_of\`/\`none_of\`
91571
92041
  groups carry their own logic.
92042
+ run_on_filter_error:
92043
+ type: boolean
92044
+ description: Whether a message the filters cannot read (not UTF-8, or not JSON)
92045
+ still runs the target, as if the trigger had no filters. A preprocessor then
92046
+ finds the reason in \`event.filter_error\`. When false, such a message is skipped.
91572
92047
  initial_messages:
91573
92048
  type: array
91574
92049
  items:
@@ -93990,7 +94465,7 @@ async function scriptDigest(contentFile, defaultTs, codebases = []) {
93990
94465
  throw e;
93991
94466
  }
93992
94467
  const codebase = language == "bun" ? findCodebase(contentFile, codebases) : undefined;
93993
- let codebaseDigest = codebase ? await codebase.getDigest() : undefined;
94468
+ let codebaseDigest = codebase ? await codebase.getDigest(contentFile) : undefined;
93994
94469
  if (codebaseDigest && meta?.codebase === codebaseDigest + ".tar") {
93995
94470
  codebaseDigest = meta.codebase;
93996
94471
  }
@@ -94694,7 +95169,7 @@ var import_yaml49 = __toESM(require_dist(), 1);
94694
95169
  import { sep as SEP22 } from "node:path";
94695
95170
  import * as http3 from "node:http";
94696
95171
  import * as https from "node:https";
94697
- import { access, readdir as readdir10, realpath, stat as stat19, unlink, writeFile as writeFile21 } from "node:fs/promises";
95172
+ import { access, readdir as readdir11, realpath as realpath2, stat as stat19, unlink, writeFile as writeFile21 } from "node:fs/promises";
94698
95173
  import { watch as watch2 } from "node:fs";
94699
95174
  import * as path25 from "node:path";
94700
95175
  import * as fs17 from "node:fs";
@@ -94825,7 +95300,7 @@ async function listWorkspacePaths() {
94825
95300
  async function walk(dir, rel) {
94826
95301
  let entries;
94827
95302
  try {
94828
- entries = await readdir10(dir, { withFileTypes: true });
95303
+ entries = await readdir11(dir, { withFileTypes: true });
94829
95304
  } catch {
94830
95305
  return;
94831
95306
  }
@@ -94848,7 +95323,7 @@ async function listWorkspacePaths() {
94848
95323
  continue;
94849
95324
  }
94850
95325
  if (entry.name.endsWith(getModuleFolderSuffix())) {
94851
- const files = await readdir10(childAbs).catch(() => []);
95326
+ const files = await readdir11(childAbs).catch(() => []);
94852
95327
  if (files.some((f) => f.startsWith("script.") && hasScriptExt(f))) {
94853
95328
  items.push({
94854
95329
  path: childRel.slice(0, -getModuleFolderSuffix().length),
@@ -94932,7 +95407,7 @@ async function dev2(opts) {
94932
95407
  info("Started dev mode");
94933
95408
  let currentLastEdit = undefined;
94934
95409
  const fsWatcher = watch2(".", { recursive: true });
94935
- const base = await realpath(".");
95410
+ const base = await realpath2(".");
94936
95411
  const ignore = await ignoreF(opts);
94937
95412
  const codebases = await listSyncCodebases(opts);
94938
95413
  let tempScriptRefs = undefined;
@@ -94971,7 +95446,7 @@ async function dev2(opts) {
94971
95446
  const rest = [];
94972
95447
  const scriptsWithModules = new Set;
94973
95448
  for (const raw of pathsToLoad) {
94974
- const rel = (await realpath(raw).catch(() => raw)).replace(base + SEP22, "").replaceAll("\\", "/");
95449
+ const rel = (await realpath2(raw).catch(() => raw)).replace(base + SEP22, "").replaceAll("\\", "/");
94975
95450
  const wmPath = getScriptBasePathFromModulePath(rel);
94976
95451
  if (wmPath)
94977
95452
  scriptsWithModules.add(wmPath);
@@ -94992,7 +95467,7 @@ async function dev2(opts) {
94992
95467
  if (paths.length == 0) {
94993
95468
  return;
94994
95469
  }
94995
- const nativePath = (await realpath(paths[0])).replace(base + SEP22, "");
95470
+ const nativePath = (await realpath2(paths[0])).replace(base + SEP22, "");
94996
95471
  const cpath = nativePath.replaceAll("\\", "/");
94997
95472
  const insideFlow = isInsideFlowFolder(cpath);
94998
95473
  if (insideFlow || !ignore(nativePath, false)) {
@@ -95178,7 +95653,7 @@ async function dev2(opts) {
95178
95653
  }
95179
95654
  const extractedPaths = new Set(allExtracted.map((s) => s.path));
95180
95655
  try {
95181
- const dirFiles = await readdir10(flowDir);
95656
+ const dirFiles = await readdir11(flowDir);
95182
95657
  for (const file of dirFiles) {
95183
95658
  if (file === "flow.yaml" || file === "flow.json" || file.startsWith("."))
95184
95659
  continue;
@@ -95940,6 +96415,7 @@ var CONFIG_REFERENCE = [
95940
96415
  properties: {
95941
96416
  relative_path: { type: "string", description: "Path to the codebase directory" },
95942
96417
  extra_digest_paths: { type: "array", items: { type: "string" }, description: "Paths outside relative_path that scripts import, relative to wmill.yaml; hashed recursively" },
96418
+ per_script_digest: { type: "boolean", description: "Redeploy a script only when a file it bundles changes, instead of on any change under relative_path. Each push bundles every script of the codebase once to find its inputs, so every one of them must bundle. Files a script reads at runtime rather than imports are not covered: list them in extra_digest_paths" },
95943
96419
  includes: { type: "array", items: { type: "string" }, description: "Glob patterns for files to include in bundle" },
95944
96420
  excludes: { type: "array", items: { type: "string" }, description: "Glob patterns for files to exclude from bundle" },
95945
96421
  format: { type: "string", enum: ["cjs", "esm"], description: "Bundle output format" },
@@ -95961,6 +96437,7 @@ Each entry is bundled and uploaded so scripts can import shared code.`,
95961
96437
  "# codebases:",
95962
96438
  "# - relative_path: ./shared # path to the codebase",
95963
96439
  '# # extra_digest_paths: ["../packages/utils/src"] # imported paths outside relative_path, hashed recursively (skip node_modules/dist)',
96440
+ "# # per_script_digest: true # redeploy a script only when a file it bundles changes",
95964
96441
  '# includes: ["**/*.ts"] # files to include in bundle',
95965
96442
  '# excludes: ["node_modules/**"] # files to exclude',
95966
96443
  '# format: esm # bundle format: "cjs" or "esm"',
@@ -96206,7 +96683,7 @@ await __promiseAll([
96206
96683
  init_utils(),
96207
96684
  init_freshness()
96208
96685
  ]);
96209
- import { cp, mkdir as mkdir15, readdir as readdir11, rm as rm7, stat as stat21, writeFile as writeFile22 } from "node:fs/promises";
96686
+ import { cp, mkdir as mkdir15, readdir as readdir12, rm as rm7, stat as stat21, writeFile as writeFile22 } from "node:fs/promises";
96210
96687
  import { join as join23 } from "node:path";
96211
96688
  var WMILL_INIT_AI_SKILLS_SOURCE_ENV = "WMILL_INIT_AI_SKILLS_SOURCE";
96212
96689
  var WMILL_INIT_AI_AGENTS_SOURCE_ENV = "WMILL_INIT_AI_AGENTS_SOURCE";
@@ -96362,7 +96839,7 @@ async function ensureSkillsDirectories(targetDir) {
96362
96839
  return skillsDirs;
96363
96840
  }
96364
96841
  async function copyDirectoryContents(sourceDir, targetDir) {
96365
- const entries = await readdir11(sourceDir, { withFileTypes: true });
96842
+ const entries = await readdir12(sourceDir, { withFileTypes: true });
96366
96843
  await Promise.all(entries.map(async (entry) => {
96367
96844
  await cp(join23(sourceDir, entry.name), join23(targetDir, entry.name), {
96368
96845
  recursive: true,
@@ -96401,7 +96878,7 @@ ${schemaDocs.join(`
96401
96878
  `)}`;
96402
96879
  }
96403
96880
  async function readSkillMetadataFromDirectory(skillsDir) {
96404
- const entries = await readdir11(skillsDir, { withFileTypes: true });
96881
+ const entries = await readdir12(skillsDir, { withFileTypes: true });
96405
96882
  const skills = [];
96406
96883
  for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
96407
96884
  if (!entry.isDirectory()) {