windmill-cli 1.849.0 → 1.850.1-aireview.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 (3) hide show
  1. package/LICENSE +13 -0
  2. package/esm/main.js +1011 -115
  3. 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.849.0",
16769
+ VERSION: "1.850.0",
16770
16770
  WITH_CREDENTIALS: true,
16771
16771
  interceptors: {
16772
16772
  request: new Interceptors,
@@ -18286,6 +18286,16 @@ var getAuditLog = (data) => {
18286
18286
  keep_captures: data.keepCaptures
18287
18287
  }
18288
18288
  });
18289
+ }, completeAi = (data) => {
18290
+ return request(OpenAPI, {
18291
+ method: "POST",
18292
+ url: "/w/{workspace}/ai/complete",
18293
+ path: {
18294
+ workspace: data.workspace
18295
+ },
18296
+ body: data.requestBody,
18297
+ mediaType: "application/json"
18298
+ });
18289
18299
  }, getSharedUi = (data) => {
18290
18300
  return request(OpenAPI, {
18291
18301
  method: "GET",
@@ -20074,7 +20084,7 @@ var init_auth = __esm(async () => {
20074
20084
  });
20075
20085
 
20076
20086
  // src/core/constants.ts
20077
- var WM_FORK_PREFIX = "wm-fork", VERSION = "1.849.0";
20087
+ var WM_FORK_PREFIX = "wm-fork", VERSION = "1.850.1-aireview.0";
20078
20088
 
20079
20089
  // src/utils/resource_folders.ts
20080
20090
  import { existsSync } from "node:fs";
@@ -27668,17 +27678,14 @@ function s4(e) {
27668
27678
  function c4(e, t) {
27669
27679
  switch (t) {
27670
27680
  case "postgresql":
27671
- return `"${e}"`;
27681
+ case "snowflake":
27682
+ case "duckdb":
27683
+ return `"${e.replace(/"/g, '""')}"`;
27672
27684
  case "ms_sql_server":
27673
- return `[${e}]`;
27685
+ return `[${e.replace(/]/g, "]]")}]`;
27674
27686
  case "mysql":
27675
- return `\`${e}\``;
27676
- case "snowflake":
27677
- return `"${e}"`;
27678
27687
  case "bigquery":
27679
- return `\`${e}\``;
27680
- case "duckdb":
27681
- return `"${e}"`;
27688
+ return `\`${e.replace(/`/g, "``")}\``;
27682
27689
  default:
27683
27690
  throw Error("Unsupported database type: " + t);
27684
27691
  }
@@ -28455,7 +28462,7 @@ function J3(e) {
28455
28462
  }).join("; ")} }`;
28456
28463
  }
28457
28464
  function Y2(e, t) {
28458
- let n = Object.keys(t).filter((e) => t[e].type == "static");
28465
+ let n = Object.keys(t).filter((e) => t[e].type == "static" || t[e].type == "ctx");
28459
28466
  return {
28460
28467
  ...e,
28461
28468
  properties: { ...Object.fromEntries(Object.entries(e.properties ?? {}).filter(([e]) => !n.includes(e))) }
@@ -28468,13 +28475,20 @@ function Z(e) {
28468
28475
  return `// THIS FILE IS READ-ONLY
28469
28476
  // AND GENERATED AUTOMATICALLY FROM YOUR RUNNABLES
28470
28477
 
28478
+ /**
28479
+ * \`memoryId\` names the conversation a turn of an agent or a chat-mode flow belongs to: a
28480
+ * signed-in viewer's conversations are theirs alone.
28481
+ */
28471
28482
  export declare const backend: {
28472
- ${Object.entries(e).map(([e, t]) => ` ${e}: (args: ${X2(t)}) => Promise<any>;`).join(`
28483
+ ${Object.entries(e).map(([e, t]) => ` ${e}: (args: ${X2(t)}, opts?: { memoryId?: string }) => Promise<any>;`).join(`
28473
28484
  `)}
28474
28485
  };
28475
28486
 
28487
+ /**
28488
+ * Start a runnable and resolve its job id. \`memoryId\` is as for \`backend\`.
28489
+ */
28476
28490
  export declare const backendAsync: {
28477
- ${Object.entries(e).map(([e, t]) => ` ${e}: (args: ${X2(t)}) => Promise<string>;`).join(`
28491
+ ${Object.entries(e).map(([e, t]) => ` ${e}: (args: ${X2(t)}, opts?: { memoryId?: string }) => Promise<string>;`).join(`
28478
28492
  `)}
28479
28493
  };
28480
28494
 
@@ -28490,10 +28504,10 @@ export type Job = {
28490
28504
  };
28491
28505
 
28492
28506
  /**
28493
- * Execute a job and wait for it to complete and return the completed job
28507
+ * Wait for a job to complete and return its result. Rejects if the job failed.
28494
28508
  * @param id
28495
28509
  */
28496
- export declare function waitJob(id: string): Promise<Job>;
28510
+ export declare function waitJob(id: string): Promise<any>;
28497
28511
 
28498
28512
  /**
28499
28513
  * Get a job by id and return immediately with the current state of the job
@@ -28527,7 +28541,7 @@ function $(e, t) {
28527
28541
  let n = {};
28528
28542
  typeof e.delete_after_secs == "number" && e.delete_after_secs >= 0 && (n.delete_after_secs = e.delete_after_secs);
28529
28543
  let r = Object.entries(t).map(([e, t]) => t.sensitive ? e : undefined).filter(Boolean);
28530
- return r.length > 0 && (n.sensitive_inputs = r), e.inlineScript?.tag && (n.tag = e.inlineScript.tag), n;
28544
+ return r.length > 0 && (n.sensitive_inputs = r), e.inlineScript?.tag && (n.tag = e.inlineScript.tag), e.viewer_data_access === true && k3(e) && (n.viewer_data_access = true), n;
28531
28545
  }
28532
28546
  async function te2(e, t, n) {
28533
28547
  let r = U3(n), i = Object.entries(n).map(([e, t]) => t.allowUserResources ? e : undefined).filter(Boolean);
@@ -28561,8 +28575,8 @@ export const backend = new Proxy(
28561
28575
  {},
28562
28576
  {
28563
28577
  get(_, runnable_id: string) {
28564
- return (v: any) => {
28565
- return doRequest('backend', { runnable_id, v })
28578
+ return (v: any, opts?: { memoryId?: string }) => {
28579
+ return doRequest('backend', { runnable_id, v, memoryId: opts?.memoryId })
28566
28580
  }
28567
28581
  }
28568
28582
  }
@@ -28572,8 +28586,8 @@ export const backendAsync = new Proxy(
28572
28586
  {},
28573
28587
  {
28574
28588
  get(_, runnable_id: string) {
28575
- return (v: any) => {
28576
- return doRequest('backendAsync', { runnable_id, v })
28589
+ return (v: any, opts?: { memoryId?: string }) => {
28590
+ return doRequest('backendAsync', { runnable_id, v, memoryId: opts?.memoryId })
28577
28591
  }
28578
28592
  }
28579
28593
  }
@@ -34815,8 +34829,8 @@ export const backend = new Proxy(
34815
34829
  {},
34816
34830
  {
34817
34831
  get(_, runnable_id: string) {
34818
- return (v: any) => {
34819
- return doRequest('backend', { runnable_id, v })
34832
+ return (v: any, opts?: { memoryId?: string }) => {
34833
+ return doRequest('backend', { runnable_id, v, memoryId: opts?.memoryId })
34820
34834
  }
34821
34835
  }
34822
34836
  })
@@ -34825,8 +34839,8 @@ export const backendAsync = new Proxy(
34825
34839
  {},
34826
34840
  {
34827
34841
  get(_, runnable_id: string) {
34828
- return (v: any) => {
34829
- return doRequest('backendAsync', { runnable_id, v })
34842
+ return (v: any, opts?: { memoryId?: string }) => {
34843
+ return doRequest('backendAsync', { runnable_id, v, memoryId: opts?.memoryId })
34830
34844
  }
34831
34845
  }
34832
34846
  })
@@ -58797,7 +58811,7 @@ var init_openflow = __esm(() => {
58797
58811
  openflow_default = {
58798
58812
  openapi: "3.0.3",
58799
58813
  info: {
58800
- version: "1.849.0",
58814
+ version: "1.850.0",
58801
58815
  title: "OpenFlow Spec",
58802
58816
  contact: {
58803
58817
  name: "Ruben Fiszel",
@@ -60113,7 +60127,7 @@ Windmill does not know needs one; those fall back to 128000.
60113
60127
  },
60114
60128
  summary: {
60115
60129
  type: "string",
60116
- 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 or websearch tool it is a plain label. Put the human-readable explanation in 'description'."
60130
+ 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'."
60117
60131
  },
60118
60132
  description: {
60119
60133
  type: "string",
@@ -60127,6 +60141,10 @@ Windmill does not know needs one; those fall back to 128000.
60127
60141
  },
60128
60142
  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."
60129
60143
  },
60144
+ requires_approval: {
60145
+ type: "boolean",
60146
+ 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."
60147
+ },
60130
60148
  value: {
60131
60149
  $ref: "#/components/schemas/ToolValue"
60132
60150
  }
@@ -60147,6 +60165,9 @@ Windmill does not know needs one; those fall back to 128000.
60147
60165
  },
60148
60166
  {
60149
60167
  $ref: "#/components/schemas/WebsearchToolValue"
60168
+ },
60169
+ {
60170
+ $ref: "#/components/schemas/QuestionToolValue"
60150
60171
  }
60151
60172
  ]
60152
60173
  },
@@ -60187,6 +60208,25 @@ Windmill does not know needs one; those fall back to 128000.
60187
60208
  "tool_type"
60188
60209
  ]
60189
60210
  },
60211
+ QuestionToolValue: {
60212
+ type: "object",
60213
+ 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.",
60214
+ properties: {
60215
+ tool_type: {
60216
+ type: "string",
60217
+ enum: [
60218
+ "question"
60219
+ ]
60220
+ },
60221
+ timeout: {
60222
+ type: "integer",
60223
+ description: "Seconds to wait for an answer before the question is reported to the AI as timed out. Defaults to 1800."
60224
+ }
60225
+ },
60226
+ required: [
60227
+ "tool_type"
60228
+ ]
60229
+ },
60190
60230
  McpToolValue: {
60191
60231
  type: "object",
60192
60232
  description: "Reference to an external MCP (Model Context Protocol) tool. The AI can call tools from MCP servers",
@@ -60793,6 +60833,84 @@ criteria: { refund: 'Money back', bug: 'Something is broken' } } }
60793
60833
  "type"
60794
60834
  ]
60795
60835
  },
60836
+ {
60837
+ type: "object",
60838
+ properties: {
60839
+ type: {
60840
+ type: "string",
60841
+ enum: [
60842
+ "approval"
60843
+ ]
60844
+ },
60845
+ call_id: {
60846
+ type: "string"
60847
+ },
60848
+ calls: {
60849
+ type: "array",
60850
+ items: {
60851
+ type: "object",
60852
+ properties: {
60853
+ function_name: {
60854
+ type: "string"
60855
+ },
60856
+ arguments: {}
60857
+ },
60858
+ required: [
60859
+ "function_name",
60860
+ "arguments"
60861
+ ]
60862
+ }
60863
+ },
60864
+ expires_at: {
60865
+ type: "string",
60866
+ format: "date-time"
60867
+ }
60868
+ },
60869
+ required: [
60870
+ "type",
60871
+ "call_id",
60872
+ "calls",
60873
+ "expires_at"
60874
+ ]
60875
+ },
60876
+ {
60877
+ type: "object",
60878
+ properties: {
60879
+ type: {
60880
+ type: "string",
60881
+ enum: [
60882
+ "question"
60883
+ ]
60884
+ },
60885
+ call_id: {
60886
+ type: "string"
60887
+ },
60888
+ question: {
60889
+ type: "string"
60890
+ },
60891
+ choices: {
60892
+ type: "array",
60893
+ items: {
60894
+ type: "string"
60895
+ },
60896
+ description: "answers the model proposes; a free-text answer is always possible"
60897
+ },
60898
+ multi_select: {
60899
+ type: "boolean",
60900
+ description: "whether several choices can be picked together"
60901
+ },
60902
+ expires_at: {
60903
+ type: "string",
60904
+ format: "date-time"
60905
+ }
60906
+ },
60907
+ required: [
60908
+ "type",
60909
+ "call_id",
60910
+ "question",
60911
+ "expires_at"
60912
+ ]
60913
+ },
60796
60914
  {
60797
60915
  type: "object",
60798
60916
  properties: {
@@ -62802,7 +62920,7 @@ function checkAgentTools(agent, report) {
62802
62920
  const seen = new Map;
62803
62921
  tools.forEach((tool, i) => {
62804
62922
  const kind = tool?.value?.tool_type;
62805
- if (kind === "mcp" || kind === "websearch")
62923
+ if (kind === "mcp" || BUILTIN_TOOL_TYPES.has(kind))
62806
62924
  return;
62807
62925
  const at = `${agent.pointer}/value/tools/${i}`;
62808
62926
  const name = tool?.summary;
@@ -62814,8 +62932,8 @@ function checkAgentTools(agent, report) {
62814
62932
  report.errors.push(`${at} tool name '${name}' may only contain letters, numbers and underscores (a run that offers this tool fails with 'Invalid tool name')`);
62815
62933
  return;
62816
62934
  }
62817
- if (name === WEBSEARCH_ENABLED_NAME) {
62818
- report.errors.push(`${at} tool name '${name}' is reserved for enabling web search`);
62935
+ if (BUILTIN_ENABLED_NAMES.has(name)) {
62936
+ report.errors.push(`${at} tool name '${name}' is reserved for a built-in tool`);
62819
62937
  return;
62820
62938
  }
62821
62939
  if (seen.has(name)) {
@@ -62929,9 +63047,14 @@ function checkFlowSemantics(flow) {
62929
63047
  checkNotes(value.notes, report);
62930
63048
  return report;
62931
63049
  }
62932
- var TOOL_NAME_REGEX, WEBSEARCH_ENABLED_NAME = "__wm_web_search", RESERVED_IDS, PALETTE, VIRTUAL_NODE_IDS;
63050
+ var TOOL_NAME_REGEX, WEBSEARCH_ENABLED_NAME = "__wm_web_search", BUILTIN_ENABLED_NAMES, BUILTIN_TOOL_TYPES, RESERVED_IDS, PALETTE, VIRTUAL_NODE_IDS;
62933
63051
  var init_flow_semantics = __esm(() => {
62934
63052
  TOOL_NAME_REGEX = /^[a-zA-Z0-9_]+$/;
63053
+ BUILTIN_ENABLED_NAMES = new Set([
63054
+ WEBSEARCH_ENABLED_NAME,
63055
+ "__wm_question"
63056
+ ]);
63057
+ BUILTIN_TOOL_TYPES = new Set(["websearch", "question"]);
62935
63058
  RESERVED_IDS = new Set([
62936
63059
  "do",
62937
63060
  "bg",
@@ -74413,17 +74536,17 @@ data: reload
74413
74536
  try {
74414
74537
  const message = JSON.parse(data.toString());
74415
74538
  info(colors.cyan(`[WebSocket] Received: ${JSON.stringify(message)}`));
74416
- const { type, reqId, runnable_id, v, jobId } = message;
74539
+ const { type, reqId, runnable_id, v, jobId, memoryId } = message;
74417
74540
  const respond = (responseType, result, error) => {
74418
74541
  ws.send(JSON.stringify({ type: responseType, reqId, result, error }));
74419
74542
  };
74420
- const runAndWaitForResult = async (runnableId, args) => {
74543
+ const runAndWaitForResult = async (runnableId, args, memoryId) => {
74421
74544
  const runnables = await loadRunnables();
74422
74545
  const runnable = runnables[runnableId];
74423
74546
  if (!runnable) {
74424
74547
  throw new Error(`Runnable not found: ${runnableId}`);
74425
74548
  }
74426
- const uuid = await executeRunnable(runnable, workspaceId, appPath, runnableId, args, appTempRefs, previewModules(runnables, runnableId));
74549
+ const uuid = await executeRunnable(runnable, workspaceId, appPath, runnableId, args, appTempRefs, previewModules(runnables, runnableId), memoryId);
74427
74550
  info(colors.gray(`[backend] Job started: ${uuid}`));
74428
74551
  const result = await waitForJob(workspaceId, uuid);
74429
74552
  return { uuid, result };
@@ -74432,7 +74555,7 @@ data: reload
74432
74555
  case "backend": {
74433
74556
  info(colors.blue(`[backend] Running runnable: ${runnable_id}`));
74434
74557
  try {
74435
- const { result } = await runAndWaitForResult(runnable_id, v);
74558
+ const { result } = await runAndWaitForResult(runnable_id, v, memoryId);
74436
74559
  respond("backendRes", result, false);
74437
74560
  } catch (error2) {
74438
74561
  error(colors.red(`[backend] Error: ${error2.message}`));
@@ -74448,7 +74571,7 @@ data: reload
74448
74571
  if (!runnable) {
74449
74572
  throw new Error(`Runnable not found: ${runnable_id}`);
74450
74573
  }
74451
- const uuid = await executeRunnable(runnable, workspaceId, appPath, runnable_id, v, appTempRefs, previewModules(runnables, runnable_id));
74574
+ const uuid = await executeRunnable(runnable, workspaceId, appPath, runnable_id, v, appTempRefs, previewModules(runnables, runnable_id), memoryId);
74452
74575
  info(colors.gray(`[backendAsync] Job started: ${uuid}`));
74453
74576
  respond("backendAsyncRes", uuid, false);
74454
74577
  waitForJob(workspaceId, uuid).then((result) => {
@@ -74708,12 +74831,7 @@ function agentRunnableSchema(memory) {
74708
74831
  const managed = memory?.kind === "compaction" || (memory?.kind === "window" || memory?.kind === "auto") && Boolean(memory.context_length);
74709
74832
  const legacy = memory?.kind === "manual";
74710
74833
  const history = {};
74711
- if (managed) {
74712
- history.memory_id = {
74713
- type: "string",
74714
- description: "The conversation the message belongs to: reuse it to continue one, or omit it for a single run"
74715
- };
74716
- } else if (!legacy) {
74834
+ if (!managed && !legacy) {
74717
74835
  history.previous_messages = {
74718
74836
  type: "array",
74719
74837
  description: "The history to answer from, as chat messages: this agent keeps no memory",
@@ -74838,10 +74956,11 @@ function previewModules(runnables, runnableId) {
74838
74956
  }
74839
74957
  return Object.keys(modules).length > 0 ? modules : undefined;
74840
74958
  }
74841
- async function executeRunnable(runnable, workspace, appPath, runnableId, args, tempScriptRefs, modules) {
74959
+ async function executeRunnable(runnable, workspace, appPath, runnableId, args, tempScriptRefs, modules, memoryId) {
74842
74960
  const requestBody = {
74843
74961
  component: runnableId,
74844
74962
  args: args ?? {},
74963
+ ...memoryId ? { run_query_params: { memory_id: memoryId } } : {},
74845
74964
  force_viewer_static_fields: {},
74846
74965
  force_viewer_one_of_fields: {},
74847
74966
  force_viewer_allow_user_resources: []
@@ -80338,6 +80457,7 @@ var init_skills_gen = __esm(() => {
80338
80457
  { name: "triggers", description: "MUST use when configuring triggers." },
80339
80458
  { name: "schedules", description: "MUST use when configuring schedules." },
80340
80459
  { name: "resources", description: "MUST use when managing resources." },
80460
+ { name: "agents", description: "MUST use when creating or changing an AI agent, the reusable `ai_agent` resource the Agents page lists." },
80341
80461
  { name: "write-workflow-as-code", description: "MUST use when writing or modifying Windmill Workflow-as-Code scripts using workflow, task, step, sleep, approvals, taskScript, taskFlow, task_script, or task_flow." },
80342
80462
  { name: "write-pipeline", description: "MUST use when creating or modifying a data pipeline, a set of scripts marked `pipeline` and wired together by `on` / `materialize` annotations." },
80343
80463
  { name: "datatables", description: "MUST use when changing a data table's schema, writing or running its migrations, or working with its roles and permissions." },
@@ -86215,8 +86335,12 @@ value:
86215
86335
  ## AI Agent Modules
86216
86336
 
86217
86337
  An \`aiagent\` module runs an LLM that can call tools. Each entry of \`value.tools\` is a module-shaped
86218
- object with an extra \`value.tool_type\`: \`flowmodule\` for a script/flow tool, \`mcp\` for an MCP server
86219
- tool, \`websearch\` for web search.
86338
+ object with an extra \`value.tool_type\`: \`flowmodule\` for a script or inline script tool (or a nested
86339
+ agent or AI decision), \`mcp\` for an MCP server tool, \`websearch\` for web search, \`question\` for a
86340
+ built-in \`ask_question\` tool (the agent stops, without holding a worker, until someone answers from
86341
+ the run page or the chat; optional \`value.timeout\` in seconds, default 1800). Set
86342
+ \`requires_approval: true\` on a \`flowmodule\` or \`mcp\` tool to have a person approve or reject each of
86343
+ its calls before it runs.
86220
86344
 
86221
86345
  \`\`\`json
86222
86346
  {
@@ -86243,7 +86367,7 @@ tool, \`websearch\` for web search.
86243
86367
  "type": "rawscript",
86244
86368
  "language": "bun",
86245
86369
  "content": "export async function main(query: string) { return ['doc1', 'doc2']; }",
86246
- "input_transforms": { "query": { "type": "static", "value": "" } }
86370
+ "input_transforms": { "query": { "type": "ai" } }
86247
86371
  }
86248
86372
  }
86249
86373
  ]
@@ -86251,6 +86375,11 @@ tool, \`websearch\` for web search.
86251
86375
  }
86252
86376
  \`\`\`
86253
86377
 
86378
+ - A flow cannot be a tool: a run offered one fails with \`Unsupported tool\`. Wrap it in a script
86379
+ that runs the flow
86380
+ - Each argument of a tool is either the model's or fixed. \`{ "type": "ai" }\` (or no value) lets the
86381
+ model fill it; a static value, an empty string included, fixes it and hides it from the model. Fix
86382
+ what the model must not choose, such as a resource, a table name or a limit
86254
86383
  - \`provider\` is an object, not a bare resource string: \`{ "kind": <provider kind>,
86255
86384
  "resource": "$res:<path>", "model": <model id> }\`. Required unless the module links to a saved
86256
86385
  agent through \`value.agent\`. Static is right for a flow run from a form; a chat flow wires its
@@ -86312,9 +86441,9 @@ needs becomes unreachable.
86312
86441
 
86313
86442
  ### Tool Naming Rules
86314
86443
 
86315
- These rules cover \`flowmodule\` tools, the ones the agent calls by name. A \`websearch\` tool's
86316
- \`summary\` is a plain label (\`Web Search\`), and an \`mcp\` tool exposes the MCP server's own tool
86317
- names, so neither is name-checked at all — leave those summaries as they are.
86444
+ These rules cover \`flowmodule\` tools, the ones the agent calls by name. A \`websearch\` or \`question\`
86445
+ tool's \`summary\` is a plain label (\`Web Search\`), and an \`mcp\` tool exposes the MCP
86446
+ server's own tool names, so none is name-checked at all — leave those summaries as they are.
86318
86447
 
86319
86448
  - A flowmodule tool's \`summary\` is the **name the agent calls it by**, not a human label. Put the
86320
86449
  human-readable explanation in \`description\`
@@ -86759,7 +86888,7 @@ Reference a specific resource using \`$res:\` prefix:
86759
86888
 
86760
86889
  ## OpenFlow Schema
86761
86890
 
86762
- {"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"},"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 before executing this step (in seconds or as expression)","$ref":"#/components/schemas/InputTransform"},"cache_ttl":{"type":"number","description":"Cache duration in seconds for this step's results"},"cache_ignore_s3_path":{"type":"boolean"},"timeout":{"description":"Maximum execution time in seconds (static value or expression)","$ref":"#/components/schemas/InputTransform"},"delete_after_secs":{"type":"integer","description":"If set, delete the step's args, result and logs after this many seconds following job completion"},"summary":{"type":"string","description":"Short description of what this step does"},"mock":{"type":"object","description":"Mock configuration for testing without executing the actual step","properties":{"enabled":{"type":"boolean","description":"If true, return mock value instead of executing"},"return_value":{"description":"Value to return when mocked"}}},"suspend":{"type":"object","description":"Configuration for approval/resume steps that wait for user input","properties":{"required_events":{"type":"integer","description":"Number of approvals required before continuing"},"timeout":{"type":"integer","description":"Timeout in seconds before auto-continuing or canceling"},"resume_form":{"type":"object","description":"Form schema for collecting input when resuming","properties":{"schema":{"type":"object","description":"JSON Schema for the resume form"}}},"user_auth_required":{"type":"boolean","description":"If true, only authenticated users can approve"},"user_groups_required":{"description":"Expression or list of groups that can approve","$ref":"#/components/schemas/InputTransform"},"self_approval_disabled":{"type":"boolean","description":"If true, the user who started the flow cannot approve"},"hide_cancel":{"type":"boolean","description":"If true, hide the cancel button on the approval form"},"continue_on_disapprove_timeout":{"type":"boolean","description":"If true, continue flow on timeout instead of canceling"},"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 or websearch 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."},"value":{"$ref":"#/components/schemas/ToolValue"}},"required":["id","value"]},"ToolValue":{"description":"The implementation of a tool. Can be a flow module (script/flow) or an MCP tool reference","oneOf":[{"$ref":"#/components/schemas/FlowModuleTool"},{"$ref":"#/components/schemas/McpToolValue"},{"$ref":"#/components/schemas/WebsearchToolValue"}],"discriminator":{"propertyName":"tool_type","mapping":{"flowmodule":"#/components/schemas/FlowModuleTool","mcp":"#/components/schemas/McpToolValue","websearch":"#/components/schemas/WebsearchToolValue"}}},"FlowModuleTool":{"description":"A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module","allOf":[{"type":"object","properties":{"tool_type":{"type":"string","enum":["flowmodule"]}},"required":["tool_type"]},{"$ref":"#/components/schemas/FlowModuleValue"}]},"WebsearchToolValue":{"type":"object","description":"A tool implemented as a websearch tool. The AI can call this like any other websearch tool","properties":{"tool_type":{"type":"string","enum":["websearch"]}},"required":["tool_type"]},"McpToolValue":{"type":"object","description":"Reference to an external MCP (Model Context Protocol) tool. The AI can call tools from MCP servers","properties":{"tool_type":{"type":"string","enum":["mcp"]},"resource_path":{"type":"string","description":"Path to the MCP resource/server configuration"},"include_tools":{"type":"array","description":"Whitelist of specific tools to include from this MCP server","items":{"type":"string"}},"exclude_tools":{"type":"array","description":"Blacklist of tools to exclude from this MCP server","items":{"type":"string"}}},"required":["tool_type","resource_path"]},"AiAgent":{"type":"object","description":"AI agent step that can use tools to accomplish tasks. The agent receives inputs and can call any of its configured tools to complete the task","properties":{"input_transforms":{"type":"object","description":"Input parameters for the AI agent mapped to their values","properties":{"provider":{"$ref":"#/components/schemas/ProviderTransform"},"output_type":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Output format type.\\nValid values: 'text' (default) - plain text response, 'image' - image generation\\n"},"user_message":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"The user's prompt/message to the AI agent. Supports variable interpolation with\\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":["message"]}},"required":["content","type"]}]}},"agent_actions_success":{"type":"array","items":{"type":"boolean"}}},"required":["type"]}}
86891
+ {"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"},"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 before executing this step (in seconds or as expression)","$ref":"#/components/schemas/InputTransform"},"cache_ttl":{"type":"number","description":"Cache duration in seconds for this step's results"},"cache_ignore_s3_path":{"type":"boolean"},"timeout":{"description":"Maximum execution time in seconds (static value or expression)","$ref":"#/components/schemas/InputTransform"},"delete_after_secs":{"type":"integer","description":"If set, delete the step's args, result and logs after this many seconds following job completion"},"summary":{"type":"string","description":"Short description of what this step does"},"mock":{"type":"object","description":"Mock configuration for testing without executing the actual step","properties":{"enabled":{"type":"boolean","description":"If true, return mock value instead of executing"},"return_value":{"description":"Value to return when mocked"}}},"suspend":{"type":"object","description":"Configuration for approval/resume steps that wait for user input","properties":{"required_events":{"type":"integer","description":"Number of approvals required before continuing"},"timeout":{"type":"integer","description":"Timeout in seconds before auto-continuing or canceling"},"resume_form":{"type":"object","description":"Form schema for collecting input when resuming","properties":{"schema":{"type":"object","description":"JSON Schema for the resume form"}}},"user_auth_required":{"type":"boolean","description":"If true, only authenticated users can approve"},"user_groups_required":{"description":"Expression or list of groups that can approve","$ref":"#/components/schemas/InputTransform"},"self_approval_disabled":{"type":"boolean","description":"If true, the user who started the flow cannot approve"},"hide_cancel":{"type":"boolean","description":"If true, hide the cancel button on the approval form"},"continue_on_disapprove_timeout":{"type":"boolean","description":"If true, continue flow on timeout instead of canceling"},"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"]}}
86763
86892
  `,
86764
86893
  "raw-app": `---
86765
86894
  name: raw-app
@@ -87176,7 +87305,7 @@ import * as wmill from './wmill'
87176
87305
  const chat = useWindmillChat({ wmill, runnable: 'chat' })
87177
87306
  \`\`\`
87178
87307
 
87179
- \`runnable\` is the runnable's key; each runnable keeps its own conversations. The runnable takes \`user_message\` and \`memory_id\`, the conversation id, which the chat fills in: the agent remembers earlier turns of a conversation, and a signed-in viewer's conversations are theirs alone. Called directly as \`backend.<key>({ user_message })\` without \`memory_id\`, it is a single run with no conversation, for a one-off question. The chat needs an agent with managed memory. An agent whose memory is off keeps none: its runnable takes \`previous_messages\` (chat messages) instead of \`memory_id\`, and the app keeps the history itself. The chat keeps its transcript in the app's own storage. \`chat.stop()\` stops following without cancelling the turn, and a message sent while it still runs is refused with \`TurnRunningError\`. Attachments are not supported this way.
87308
+ \`runnable\` is the runnable's key; each runnable keeps its own conversations. The runnable takes \`user_message\`; the chat passes the conversation id as \`backendAsync.<key>(args, { memoryId })\`: the agent remembers earlier turns of a conversation, and a signed-in viewer's conversations are theirs alone. Called directly as \`backend.<key>({ user_message })\`, it is a single run with no conversation, for a one-off question; \`backend.<key>(args, { memoryId })\` waits for the reply of a conversation turn. The chat needs an agent with managed memory. An agent whose memory is off keeps none: its runnable takes \`previous_messages\` (chat messages) instead, and the app keeps the history itself. The chat keeps its transcript in the app's own storage. \`chat.stop()\` stops following without cancelling the turn, and a message sent while it still runs is refused with \`TurnRunningError\`. Attachments are not supported this way.
87180
87309
 
87181
87310
  ## Backend runnables
87182
87311
 
@@ -87232,7 +87361,7 @@ Use only \`wmill\` functions the SDK actually exports; for an endpoint none of t
87232
87361
 
87233
87362
  ### Path runnables (script / flow / hubscript / agent)
87234
87363
 
87235
- When \`type\` is \`script\`, \`flow\`, \`hubscript\` or \`agent\`, the runnable just stores a \`path\` to an existing workspace or hub item — no inline code. The referenced item's input/output schema becomes the runnable's surface; an agent's is \`user_message\` and \`user_attachments\`, plus \`memory_id\` when the agent keeps managed memory or \`previous_messages\` when its memory is off.
87364
+ When \`type\` is \`script\`, \`flow\`, \`hubscript\` or \`agent\`, the runnable just stores a \`path\` to an existing workspace or hub item — no inline code. The referenced item's input/output schema becomes the runnable's surface; an agent's is \`user_message\` and \`user_attachments\`, plus \`previous_messages\` when its memory is off.
87236
87365
 
87237
87366
  Before writing an inline runnable, look for a workspace script or flow that already does the job, or a Hub script (a prebuilt integration at \`hub/<version>/<app>/<name>\`) for a third-party service, and reference it instead of copying its logic.
87238
87367
 
@@ -87521,6 +87650,7 @@ Example: \`f/databases/postgres_prod.resource.json\`
87521
87650
  An agent, as the Agents page lists it, is a resource of type \`ai_agent\`. Its value holds the
87522
87651
  agent's provider, system prompt, tools and memory settings, and a flow step uses a saved agent by
87523
87652
  linking its path.
87653
+ Before writing one, use the \`agents\` skill.
87524
87654
 
87525
87655
  ## Variable References
87526
87656
 
@@ -87788,6 +87918,126 @@ wmill resource-type get postgresql
87788
87918
  # deploy via \`git push\` or \`wmill sync push\` (see the Deploying section in AGENTS.wmill.md).
87789
87919
  wmill sync push
87790
87920
  \`\`\`
87921
+ `,
87922
+ agents: `---
87923
+ name: agents
87924
+ description: MUST use when creating or changing an AI agent, the reusable \`ai_agent\` resource the Agents page lists.
87925
+ ---
87926
+
87927
+ # Windmill AI Agents
87928
+
87929
+ An agent, as the Agents page lists it, is a saved LLM with its own system prompt, tools and
87930
+ memory, stored as a resource of type \`ai_agent\`. It is built once and used in several places: it is
87931
+ run from its own page (a chat, or a run form), a flow's AI agent step links to it by path, and it
87932
+ can be shared in Slack channels from its page. Build a standalone agent when the user wants an
87933
+ assistant they talk to or reuse. Build a flow when the agent is one step of a larger process.
87934
+
87935
+ ## File Format
87936
+
87937
+ An agent is a resource file like any other, \`{path}.resource.yaml\` (or \`.resource.json\`), with
87938
+ \`resource_type: ai_agent\`.
87939
+
87940
+ ## Structure
87941
+
87942
+ \`\`\`json
87943
+ {
87944
+ "resource_type": "ai_agent",
87945
+ "description": "Answers support questions from the product docs",
87946
+ "value": {
87947
+ "provider": { "kind": "openai", "resource": "$res:f/ai_providers/openai", "model": "gpt-4o" },
87948
+ "system_prompt": "You are the support assistant for Acme. Answer from the docs; say so when they don't cover a question.",
87949
+ "memory": { "kind": "compaction" },
87950
+ "output_type": "text",
87951
+ "tools": [
87952
+ {
87953
+ "id": "search_docs",
87954
+ "summary": "search_documentation",
87955
+ "description": "Search the product documentation. Use it whenever the user asks how a feature works.",
87956
+ "value": {
87957
+ "tool_type": "flowmodule",
87958
+ "type": "script",
87959
+ "path": "f/support/search_docs",
87960
+ "input_transforms": {
87961
+ "query": { "type": "ai" },
87962
+ "index": { "type": "static", "value": "product_docs" }
87963
+ }
87964
+ }
87965
+ }
87966
+ ]
87967
+ }
87968
+ }
87969
+ \`\`\`
87970
+
87971
+ The agent's own settings are plain values, not the \`input_transforms\` an agent step in a flow uses:
87972
+ each is fixed when the agent is saved. Only a tool's arguments keep \`input_transforms\` (see Tools). \`$res:\` and \`$var:\` references inside it are resolved at run time.
87973
+
87974
+ - \`provider\` (required): \`{ "kind", "resource": "$res:<path>", "model" }\`, plus an optional
87975
+ \`reasoning_effort\`. \`resource\` names the workspace's AI provider resource of that kind
87976
+ - \`system_prompt\`: how the agent behaves. Write it for the agent's job: who it serves, what it may
87977
+ do with its tools, and what it should refuse or hand back
87978
+ - \`memory\`: what lets the agent see earlier turns. \`{ "kind": "compaction" }\` keeps the whole
87979
+ conversation, summarizing its older part as it nears the model's context window; it is what a new
87980
+ agent starts with on its page. \`{ "kind": "off" }\` makes every run start from nothing, right for an
87981
+ agent that handles one request per run
87982
+ - \`output_type\`: \`text\` (default) or \`image\`. Image output ignores tools and needs S3 storage on the
87983
+ workspace
87984
+ - \`output_schema\`: a JSON schema the answer must follow, for an agent whose output a program reads
87985
+ - \`max_iterations\`: how many model and tool rounds a run may take, 1 to 1000 (default 10)
87986
+ - \`streaming\` (default on), \`temperature\`, \`max_completion_tokens\`: as their names say
87987
+ - \`run_on_behalf_of\`: runs from the agent's page take the identity the agent was deployed with
87988
+ rather than the caller's, so people can use it without access to what its tools touch.
87989
+ \`slack_anyone\` lets anyone in the Slack channels it is shared in ask it, and is kept only with
87990
+ \`run_on_behalf_of\`. Set either only when the user asks: both widen who acts with the deployer's
87991
+ rights
87992
+ - \`on_behalf_of\` is the identity itself. Deploying sets it, so never write it
87993
+
87994
+ ## Tools
87995
+
87996
+ \`tools\` takes the same entries as a flow's AI agent step. \`value.tool_type\` is \`flowmodule\` for a
87997
+ script or inline script the agent calls (or a nested agent or AI decision), \`mcp\` for an MCP server
87998
+ (\`{ "tool_type": "mcp", "resource_path": "$res:<path>", "include_tools": [], "exclude_tools": [] }\`),
87999
+ or \`websearch\` for web search (\`{ "tool_type": "websearch" }\`, summary \`Web Search\`).
88000
+
88001
+ - Write logic made for this agent as an inline \`rawscript\` tool, as a flow writes its steps. Point a
88002
+ \`script\` tool at a deployed script (\`path\`) only when one already does the job: a run calls the
88003
+ deployed version, so a script that exists only as a draft fails the run. An inline tool's
88004
+ \`value\` is a flow's rawscript step:
88005
+ \`{ "tool_type": "flowmodule", "type": "rawscript", "language": "bun", "content": "export async function main(query: string) { ... }", "input_transforms": { "query": { "type": "ai" } } }\`
88006
+ - A flow cannot be a tool: a run offered one fails with \`Unsupported tool\`. Wrap it in a script
88007
+ that runs the flow
88008
+ - A flowmodule tool's \`summary\` is the name the agent calls it by: letters, numbers and underscores
88009
+ only, unique among the agent's tools, and neither a reserved step id (a JavaScript keyword, \`ctx\`,
88010
+ \`state\`, \`bg\`) nor \`__wm_web_search\`. Put the explanation in \`description\`, which tells the agent
88011
+ when to call it
88012
+ - Each argument of a tool is either the model's or fixed. \`{ "type": "ai" }\` (or no value) lets the
88013
+ model fill it; a static value fixes it and hides it from the model. Fix what the model must not
88014
+ choose, such as a resource, a table name or a limit
88015
+
88016
+ ## Using It From a Flow
88017
+
88018
+ An AI agent step links to a saved agent with \`value.agent\` instead of carrying its own \`provider\`,
88019
+ system prompt and tools:
88020
+
88021
+ \`\`\`json
88022
+ {
88023
+ "id": "support",
88024
+ "value": {
88025
+ "type": "aiagent",
88026
+ "agent": "f/support/support_agent",
88027
+ "input_transforms": {
88028
+ "user_message": { "type": "javascript", "expr": "flow_input.question" }
88029
+ },
88030
+ "tools": []
88031
+ }
88032
+ }
88033
+ \`\`\`
88034
+
88035
+ The step holds only what belongs to one use of the agent: \`user_message\`, \`user_attachments\`,
88036
+ \`enabled_tools\`, \`memory_id\`, \`previous_messages\`, and the \`model\` and \`reasoning_effort\` overrides.
88037
+ Its \`value.tool_inputs\` (\`{ "<tool id>": { "<argument>": <input transform> } }\`) wires a saved
88038
+ tool's arguments to this flow, e.g. \`flow_input.customer_id\`, over the transforms the agent saved,
88039
+ without changing the agent. Everything else comes from the agent, so a change to the agent reaches
88040
+ every flow linking it.
87791
88041
  `,
87792
88042
  "write-workflow-as-code": `---
87793
88043
  name: write-workflow-as-code
@@ -88670,7 +88920,7 @@ write a secret you were not given: keep the placeholder.
88670
88920
  | \`git_sync\` | \`{ repositories: [...] }\`, each with \`git_repo_resource_path\`, \`script_path\` and \`settings\` (include/exclude paths and types). Server-owned fields (webhook secrets, sync state, credentials) are never read nor written. |
88671
88921
  | \`datatable\` | \`{ datatables: { <name>: { database: { resource_type, resource_path } } } }\`, both required: \`resource_type: postgresql\` with \`resource_path\` a Postgres resource's path, or \`instance\`, or \`external_instance\` (Enterprise only), with \`resource_path\` the name of a database a superadmin set up. A fork's entry can instead be \`{ reference: { workspace_id, datatable } }\`, pointing at its parent's data table; keep it as is. \`main\` is the one scripts use by default. Role permissions are \`datatable_permissions\`. |
88672
88922
  | \`datatable_permissions\` | \`{ <data table>: { default_role, roles: { <role>: [tenants] } } }\`: who may connect to each data table as which role. Tenants are \`u/<user>\`, \`g/<group>\`, \`f/<folder>\` or \`*\`; \`admin\` is always a role, and \`default_role: null\` means no default. A data table the value omits is no longer under roles. Only a data table on a cluster Windmill manages can be. |
88673
- | \`protection_rules\` | \`{ <rule name>: { rules: [...], bypass_groups: [...], bypass_users: [...] } }\`, rules among \`DisableDirectDeployment\`, \`DisableWorkspaceForking\`, \`RestrictDeployToDeployers\`, \`RestrictAnonymousAppDeployment\`, \`RestrictPublicRunSharing\`, \`RestrictGuestAppDeployment\`, \`RequireIsolatedForks\`. A rule the value omits is deleted. The dev workspace lock is not listed and cannot be set here. |
88923
+ | \`protection_rules\` | \`{ <rule name>: { rules: [...], bypass_groups: [...], bypass_users: [...], fork_role_mapping?: { <role here>: <role in its forks> } } }\`, rules among \`DisableDirectDeployment\`, \`DisableWorkspaceForking\`, \`RestrictDeployToDeployers\`, \`RestrictAnonymousAppDeployment\`, \`RestrictPublicRunSharing\`, \`RestrictGuestAppDeployment\`, \`RequireIsolatedForks\`. A rule the value omits is deleted. The dev workspace lock is not listed and cannot be set here. |
88674
88924
  | \`ducklake\` | \`{ ducklakes: { <name>: { catalog, storage, ... } } }\`. |
88675
88925
  | \`dbt_warehouses\` | dbt warehouse connections. |
88676
88926
  | \`default_app\` | Path of the app shown as the workspace home. |
@@ -89250,6 +89500,20 @@ resource type related commands
89250
89500
  - \`resource-type push <file_path:string> <name:string>\` - push a local resource spec. This overrides any remote versions.
89251
89501
  - \`resource-type generate-namespace\` - Create a TypeScript definition file with the RT namespace generated from the resource types
89252
89502
 
89503
+ ### review
89504
+
89505
+ Review a pull request on a git sync repository with the workspace's AI, the way deployment requests are reviewed. Reads the changes and the base branch's review instructions from git; the instance, workspace and token come from the flags, never from the checkout's wmill.yaml.
89506
+
89507
+ **Options:**
89508
+ - \`--base <ref:string>\` - The base branch commit. Defaults to the pull_request event's base.
89509
+ - \`--head <ref:string>\` - The pull request's commit. Defaults to the event's head, else HEAD.
89510
+ - \`--model <model:string>\` - provider:model to review with. Defaults to the workspace's default model.
89511
+ - \`--folder <dir:string>\` - The repository directory the workspace is synced into, when it is not the root.
89512
+ - \`--json\` - Print the review as JSON
89513
+ - \`--post <target:string>\` - Post the review on the pull request. Only \`github\` is supported.
89514
+ - \`--pr <number:number>\` - The pull request number. Defaults to the pull_request event's.
89515
+ - \`--fail-on <severity:string>\` - Exit with 1 when a finding is at least this severe: high, medium or low.
89516
+
89253
89517
  ### schedule
89254
89518
 
89255
89519
  schedule related commands
@@ -91421,7 +91685,7 @@ var init_freshness = __esm(async () => {
91421
91685
  // src/commands/refresh/tsconfig.ts
91422
91686
  import { execSync as execSync6 } from "node:child_process";
91423
91687
  import { createHash as createHash3 } from "node:crypto";
91424
- import { existsSync as existsSync20, readFileSync as readFileSync5, writeFileSync as writeFileSync9 } from "node:fs";
91688
+ import { existsSync as existsSync20, readFileSync as readFileSync6, writeFileSync as writeFileSync9 } from "node:fs";
91425
91689
  import path26 from "node:path";
91426
91690
  import process25 from "node:process";
91427
91691
  function buildManagedTsconfig() {
@@ -91559,7 +91823,7 @@ async function ensureUserReferencesManaged(opts) {
91559
91823
  const existingName = path26.basename(existing);
91560
91824
  let text = "";
91561
91825
  try {
91562
- text = readFileSync5(existing, "utf-8");
91826
+ text = readFileSync6(existing, "utf-8");
91563
91827
  } catch {
91564
91828
  return;
91565
91829
  }
@@ -91627,7 +91891,7 @@ async function warnIfTsconfigStale(opts) {
91627
91891
  return;
91628
91892
  let managedText;
91629
91893
  try {
91630
- managedText = readFileSync5(managedPath, "utf-8");
91894
+ managedText = readFileSync6(managedPath, "utf-8");
91631
91895
  } catch {
91632
91896
  return;
91633
91897
  }
@@ -91644,7 +91908,7 @@ function emitTsconfigWarning(message) {
91644
91908
  process25.stderr.write(`${colors.yellow(message)}
91645
91909
  `);
91646
91910
  }
91647
- var WORKSPACE_IMPORT_DIRS, MANAGED_TSCONFIG = "tsconfig.wmill.json", MANAGED_IMPORT_MAP = "import_map.wmill.json", MANAGED_NOTICE, TSCONFIG_HASH_PREFIX = "// wmill-tsconfig-hash: ", TSCONFIG_HASH_REGEX, LEGACY_GENERATED_TSCONFIGS, command32, tsconfig_default;
91911
+ var WORKSPACE_IMPORT_DIRS, MANAGED_TSCONFIG = "tsconfig.wmill.json", MANAGED_IMPORT_MAP = "import_map.wmill.json", MANAGED_NOTICE, TSCONFIG_HASH_PREFIX = "// wmill-tsconfig-hash: ", TSCONFIG_HASH_REGEX, LEGACY_GENERATED_TSCONFIGS, command33, tsconfig_default;
91648
91912
  var init_tsconfig = __esm(async () => {
91649
91913
  init_colors2();
91650
91914
  init_mod3();
@@ -91680,10 +91944,10 @@ var init_tsconfig = __esm(async () => {
91680
91944
  include: ["**/*.ts", "rt.d.ts"]
91681
91945
  }
91682
91946
  ];
91683
- command32 = new Command().description("Refresh the wmill-managed tsconfig.wmill.json (and Deno import map for Deno projects)").option("--yes", "Non-interactive: wire an existing custom tsconfig.json/deno.json to the managed file without prompting (a previously-generated config is always migrated automatically).").action(async (opts) => {
91947
+ command33 = new Command().description("Refresh the wmill-managed tsconfig.wmill.json (and Deno import map for Deno projects)").option("--yes", "Non-interactive: wire an existing custom tsconfig.json/deno.json to the managed file without prompting (a previously-generated config is always migrated automatically).").action(async (opts) => {
91684
91948
  await refreshTsconfig({ yes: opts.yes === true });
91685
91949
  });
91686
- tsconfig_default = command32;
91950
+ tsconfig_default = command33;
91687
91951
  });
91688
91952
 
91689
91953
  // src/main.ts
@@ -92880,6 +93144,10 @@ await init_conf();
92880
93144
  function sortedUnique(arr) {
92881
93145
  return [...new Set(arr)].sort();
92882
93146
  }
93147
+ function sortedMapping(m) {
93148
+ const keys = Object.keys(m ?? {}).sort();
93149
+ return keys.length > 0 ? Object.fromEntries(keys.map((k) => [k, m[k]])) : undefined;
93150
+ }
92883
93151
 
92884
93152
  class ProtectionRulesConverter {
92885
93153
  static normalizeEntry(entry) {
@@ -92887,7 +93155,8 @@ class ProtectionRulesConverter {
92887
93155
  name: entry.name,
92888
93156
  rules: sortedUnique(entry.rules ?? []),
92889
93157
  bypass_groups: sortedUnique(entry.bypass_groups ?? []),
92890
- bypass_users: sortedUnique(entry.bypass_users ?? [])
93158
+ bypass_users: sortedUnique(entry.bypass_users ?? []),
93159
+ ...sortedMapping(entry.fork_role_mapping) ? { fork_role_mapping: sortedMapping(entry.fork_role_mapping) } : {}
92891
93160
  };
92892
93161
  }
92893
93162
  static normalizeList(entries) {
@@ -92898,13 +93167,14 @@ class ProtectionRulesConverter {
92898
93167
  name: r.name,
92899
93168
  rules: [...r.rules ?? []],
92900
93169
  bypass_groups: [...r.bypass_groups ?? []],
92901
- bypass_users: [...r.bypass_users ?? []]
93170
+ bypass_users: [...r.bypass_users ?? []],
93171
+ fork_role_mapping: { ...r.fork_role_mapping ?? {} }
92902
93172
  })));
92903
93173
  }
92904
93174
  static entriesEqual(a, b) {
92905
93175
  const na = ProtectionRulesConverter.normalizeEntry(a);
92906
93176
  const nb = ProtectionRulesConverter.normalizeEntry(b);
92907
- return na.name === nb.name && na.rules.length === nb.rules.length && na.rules.every((v, i) => v === nb.rules[i]) && na.bypass_groups.length === nb.bypass_groups.length && na.bypass_groups.every((v, i) => v === nb.bypass_groups[i]) && na.bypass_users.length === nb.bypass_users.length && na.bypass_users.every((v, i) => v === nb.bypass_users[i]);
93177
+ return na.name === nb.name && na.rules.length === nb.rules.length && na.rules.every((v, i) => v === nb.rules[i]) && na.bypass_groups.length === nb.bypass_groups.length && na.bypass_groups.every((v, i) => v === nb.bypass_groups[i]) && na.bypass_users.length === nb.bypass_users.length && na.bypass_users.every((v, i) => v === nb.bypass_users[i]) && JSON.stringify(na.fork_role_mapping ?? {}) === JSON.stringify(nb.fork_role_mapping ?? {});
92908
93178
  }
92909
93179
  static listsEqual(a, b) {
92910
93180
  const na = ProtectionRulesConverter.normalizeList(a);
@@ -93045,6 +93315,10 @@ function describeEntry(entry) {
93045
93315
  if (n.bypass_users.length > 0) {
93046
93316
  parts.push(`bypass_users=[${n.bypass_users.join(", ")}]`);
93047
93317
  }
93318
+ if (n.fork_role_mapping) {
93319
+ const pairs = Object.entries(n.fork_role_mapping).map(([f, t]) => `${f}->${t}`);
93320
+ parts.push(`fork_role_mapping=[${pairs.join(", ")}]`);
93321
+ }
93048
93322
  return parts.join(" ");
93049
93323
  }
93050
93324
  function displayPlan(ws, plan) {
@@ -93316,7 +93590,8 @@ async function pushProtectionRules(opts, workspaceArg) {
93316
93590
  name: n.name,
93317
93591
  rules: n.rules,
93318
93592
  bypass_groups: n.bypass_groups,
93319
- bypass_users: n.bypass_users
93593
+ bypass_users: n.bypass_users,
93594
+ fork_role_mapping: n.fork_role_mapping ?? {}
93320
93595
  }
93321
93596
  });
93322
93597
  applied.created++;
@@ -93329,7 +93604,8 @@ async function pushProtectionRules(opts, workspaceArg) {
93329
93604
  requestBody: {
93330
93605
  rules: n.rules,
93331
93606
  bypass_groups: n.bypass_groups,
93332
- bypass_users: n.bypass_users
93607
+ bypass_users: n.bypass_users,
93608
+ fork_role_mapping: n.fork_role_mapping ?? {}
93333
93609
  }
93334
93610
  });
93335
93611
  applied.updated++;
@@ -93605,6 +93881,626 @@ async function digest(opts, ...paths) {
93605
93881
  var command27 = new Command().description("Compute the content digest of local scripts and flows, as the `digest` and `root_digest` claims of job OIDC tokens carry it. Run from the root of a sync checkout, pulled after the deployment's dependency jobs completed: they write the lockfiles the digest covers. A flow also lists the digest of each inline step, as `<flow path>/<step id>`.").arguments("<paths...:string>").option("--json", "Output the digests as JSON").action(digest);
93606
93882
  var digest_default = command27;
93607
93883
 
93884
+ // src/commands/review/review.ts
93885
+ init_mod3();
93886
+ init_colors2();
93887
+ init_log();
93888
+ init_services_gen();
93889
+ await __promiseAll([
93890
+ init_auth(),
93891
+ init_context(),
93892
+ init_types(),
93893
+ init_resource_folders(),
93894
+ init_utils(),
93895
+ init_yaml()
93896
+ ]);
93897
+ import { execFileSync as execFileSync3 } from "node:child_process";
93898
+ import { readFileSync as readFileSync5 } from "node:fs";
93899
+ import { posix } from "node:path";
93900
+
93901
+ // src/commands/review/aiReviewCore.gen.ts
93902
+ var MAX_FOLDER_INSTRUCTIONS_LENGTH = 32 * 1024;
93903
+ var MAX_FOLDER_INSTRUCTIONS_TOTAL = 48 * 1024;
93904
+ function folderInstructionScope(path) {
93905
+ return path.slice(0, path.lastIndexOf("/") + 1);
93906
+ }
93907
+ function instructionsCovering(instructions, paths) {
93908
+ return instructions.filter((i) => paths.some((p) => `${p}/`.startsWith(i.scope))).sort((a, b) => a.scope.length - b.scope.length || a.path.localeCompare(b.path));
93909
+ }
93910
+ function truncateForPrompt(text, maxBytes) {
93911
+ const encoded = new TextEncoder().encode(text);
93912
+ if (encoded.byteLength <= maxBytes)
93913
+ return text;
93914
+ const cut = new TextDecoder("utf-8").decode(encoded.slice(0, maxBytes)).replace(/�$/, "");
93915
+ return `${cut}… [truncated]`;
93916
+ }
93917
+ function folderInstructionsOpeningTag(path) {
93918
+ return `<folder_instructions path="${path}"`;
93919
+ }
93920
+ function formatFolderInstructions(blocks) {
93921
+ let remaining = MAX_FOLDER_INSTRUCTIONS_TOTAL;
93922
+ const bodies = [...blocks].reverse().map(({ body }) => {
93923
+ const cut = truncateForPrompt(body, Math.min(MAX_FOLDER_INSTRUCTIONS_LENGTH, remaining));
93924
+ remaining = Math.max(0, remaining - new TextEncoder().encode(cut).byteLength);
93925
+ return cut;
93926
+ });
93927
+ bodies.reverse();
93928
+ return blocks.map(({ instruction }, i) => `${folderInstructionsOpeningTag(instruction.path)} scope="${instruction.scope}">
93929
+ ${bodies[i]}
93930
+ </folder_instructions>`).join(`
93931
+
93932
+ `);
93933
+ }
93934
+ var REVIEW_INSTRUCTIONS_RESOURCE_TYPE = "ai_review_instruction";
93935
+ var VALUE_WITHHELD_KINDS = new Set(["variable", "resource"]);
93936
+ var PER_SIDE_CHAR_CAP = 20000;
93937
+ var TOTAL_CHAR_BUDGET = 160000;
93938
+ var MAX_OUTPUT_TOKENS = 8000;
93939
+ var INTRO = {
93940
+ deployment_request: "You review a Windmill deployment request: a set of changes made in a fork workspace that will be merged into its parent workspace. Each changed item is given with its parent version (what is deployed now) and its fork version (what will be deployed).",
93941
+ pull_request: "You review a pull request on a git repository that Windmill's git sync keeps in step with a workspace: merging it deploys its changes. Each changed item is given with the files that make it up in the repository, each as a unified diff of the base branch (what is deployed now) against the pull request (what will be deployed). Every diff line starts with its line number: R<n> for line n of the pull request's version of the file, L<n> for line n of the base version, then + for an added line, - for a removed one and a space for unchanged context."
93942
+ };
93943
+ var ANSWER_SHAPE = {
93944
+ deployment_request: '{"summary": "<one or two sentences on what the change does and its overall risk>", "findings": [{"kind": "<item kind as given>", "path": "<item path as given>", "severity": "high" | "medium" | "low", "comment": "<the issue and what to do about it, under 80 words>"}]}',
93945
+ pull_request: '{"summary": "<one or two sentences on what the change does and its overall risk>", "findings": [{"kind": "<item kind as given>", "path": "<item path as given>", "file": "<the file the issue is in, as given>", "line": "<the R or L line number the issue is on, as given, such as R12, or null for the file as a whole>", "severity": "high" | "medium" | "low", "comment": "<the issue and what to do about it, under 80 words>"}]}'
93946
+ };
93947
+ var SOURCE = {
93948
+ deployment_request: "The parent workspace",
93949
+ pull_request: "The repository's base branch"
93950
+ };
93951
+ function reviewSystemPrompt(subject) {
93952
+ return `${INTRO[subject]} An item can be a script, flow, app, schedule, trigger, folder, resource type, datatable migration, variable or resource.
93953
+
93954
+ Report only issues a reviewer should act on before approving the merge:
93955
+ - bugs and logic errors introduced by the change
93956
+ - breaking changes: removed or renamed inputs, changed input types, changed outputs that callers may rely on
93957
+ - risky operational changes: schedules retimed, triggers pointed at a different script or flow, folder owners or permissions, app policies, destructive migrations
93958
+ - hardcoded secrets or credentials
93959
+ - deletions that look unintended
93960
+
93961
+ Do not comment on style, naming, formatting or lockfiles, and do not praise. Do not repeat a finding for every item it touches. An item with no issue gets no finding.
93962
+
93963
+ Answer with JSON only, no prose around it, in this shape:
93964
+ ${ANSWER_SHAPE[subject]}`;
93965
+ }
93966
+ function reviewInstructionsSection(subject, blocks) {
93967
+ if (blocks.length === 0)
93968
+ return "";
93969
+ return `
93970
+
93971
+ ${SOURCE[subject]} gives the review instructions below, each for the changed items under the folder in its scope. For those items they take precedence over the instructions above, and a nested folder's over its parent folder's. They may ask you to check more, check less or weigh severity differently, except that hardcoded secrets or credentials and deletions that look unintended are always reported. The answer is still the JSON above.
93972
+
93973
+ ${formatFolderInstructions(blocks)}`;
93974
+ }
93975
+ function capText(text, cap) {
93976
+ return text.length > cap ? `${text.slice(0, cap)}
93977
+ … (truncated, ${text.length - cap} more characters)` : text;
93978
+ }
93979
+
93980
+ class ReviewBudget {
93981
+ included = [];
93982
+ omitted = [];
93983
+ spent = false;
93984
+ used = 0;
93985
+ add(key, section) {
93986
+ if (!this.spent && this.used + section.length <= TOTAL_CHAR_BUDGET) {
93987
+ this.included.push(section);
93988
+ this.used += section.length;
93989
+ } else {
93990
+ this.spent = true;
93991
+ this.omitted.push(key);
93992
+ }
93993
+ }
93994
+ userPrompt(header) {
93995
+ let user = `${header}
93996
+
93997
+ ${this.included.join(`
93998
+
93999
+ `)}`;
94000
+ if (this.omitted.length > 0) {
94001
+ user += `
94002
+
94003
+ Also changed, contents not shown for size:
94004
+ ${this.omitted.map((o) => `- ${o}`).join(`
94005
+ `)}`;
94006
+ }
94007
+ return user;
94008
+ }
94009
+ }
94010
+ function parseReviewAnswer(text, anchors) {
94011
+ const start = text.indexOf("{");
94012
+ const end = text.lastIndexOf("}");
94013
+ if (start === -1 || end <= start) {
94014
+ throw new Error("The AI answer was not in the expected format");
94015
+ }
94016
+ const parsed = JSON.parse(text.slice(start, end + 1));
94017
+ const findings = [];
94018
+ for (const [i, raw] of (Array.isArray(parsed.findings) ? parsed.findings : []).entries()) {
94019
+ if (!raw || typeof raw.comment !== "string" || !raw.comment.trim())
94020
+ continue;
94021
+ const anchored = anchors.items.has(`${raw.kind}:${raw.path}`);
94022
+ const finding = {
94023
+ id: String(i),
94024
+ kind: anchored ? raw.kind : "",
94025
+ path: anchored ? raw.path : "",
94026
+ severity: ["high", "medium", "low"].includes(raw.severity) ? raw.severity : "medium",
94027
+ comment: raw.comment.trim()
94028
+ };
94029
+ const fileLines = typeof raw.file === "string" ? anchors.lines?.get(raw.file) : undefined;
94030
+ if (fileLines) {
94031
+ finding.file = raw.file;
94032
+ const line = /^([LR])(\d+)$/.exec(String(raw.line ?? "").trim());
94033
+ const side = line?.[1] === "L" ? "LEFT" : "RIGHT";
94034
+ if (line && fileLines[side].has(Number(line[2]))) {
94035
+ finding.side = side;
94036
+ finding.line = Number(line[2]);
94037
+ }
94038
+ }
94039
+ findings.push(finding);
94040
+ }
94041
+ const rank = { high: 0, medium: 1, low: 2 };
94042
+ findings.sort((a, b) => rank[a.severity] - rank[b.severity]);
94043
+ return { summary: typeof parsed.summary === "string" ? parsed.summary : "", findings };
94044
+ }
94045
+
94046
+ // src/commands/review/review.ts
94047
+ var GITHUB_DIFF_CONTEXT = 3;
94048
+ var MODEL_DIFF_CONTEXT = 20;
94049
+ function git2(args) {
94050
+ return execFileSync3("git", ["-c", "core.quotePath=false", ...args], {
94051
+ encoding: "utf-8",
94052
+ maxBuffer: 512 * 1024 * 1024,
94053
+ stdio: ["ignore", "pipe", "pipe"]
94054
+ });
94055
+ }
94056
+ function itemOf(file) {
94057
+ const containers = [
94058
+ [".fileset/", "resource"],
94059
+ ["__mod/", "script"],
94060
+ [`${DBT_MODULE_SUFFIX}/`, "script"],
94061
+ ...[DOTTED_SUFFIXES, NON_DOTTED_SUFFIXES].flatMap((suffixes) => Object.entries(suffixes).map(([kind, suffix]) => [`${suffix}/`, kind]))
94062
+ ];
94063
+ let outermost;
94064
+ for (const [marker, kind] of containers) {
94065
+ const i = file.indexOf(marker);
94066
+ if (i > 0 && (!outermost || i < outermost.path.length)) {
94067
+ outermost = { kind, path: file.slice(0, i) };
94068
+ }
94069
+ }
94070
+ if (outermost)
94071
+ return outermost;
94072
+ if (parseDatatableMigrationPath(file))
94073
+ return { kind: "datatable_migration", path: file };
94074
+ const sidecar = file.indexOf(".resource.file.");
94075
+ if (sidecar > 0)
94076
+ return { kind: "resource", path: file.slice(0, sidecar) };
94077
+ let kind;
94078
+ try {
94079
+ kind = getTypeStrFromPath(file);
94080
+ } catch {
94081
+ return { kind: "file", path: file };
94082
+ }
94083
+ if (kind === "folder")
94084
+ return { kind, path: posix.dirname(file) };
94085
+ const dir = posix.dirname(file);
94086
+ const name = posix.basename(file).split(".")[0];
94087
+ if (!/^[ufg]\//.test(file) || !name)
94088
+ return { kind, path: file };
94089
+ return { kind, path: dir === "." ? name : `${dir}/${name}` };
94090
+ }
94091
+ function isLockfile(file) {
94092
+ return posix.basename(file) === "wmill-lock.yaml" || file.endsWith(".lock");
94093
+ }
94094
+ function numberDiff(diff) {
94095
+ if (/^Binary files .* differ$/m.test(diff))
94096
+ return;
94097
+ const out = [];
94098
+ const left = new Set;
94099
+ const right = new Set;
94100
+ let l = 0;
94101
+ let r = 0;
94102
+ let inHunk = false;
94103
+ for (const line of diff.split(`
94104
+ `)) {
94105
+ const hunk = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(line);
94106
+ if (hunk) {
94107
+ l = Number(hunk[1]);
94108
+ r = Number(hunk[2]);
94109
+ inHunk = true;
94110
+ out.push(line);
94111
+ continue;
94112
+ }
94113
+ if (!inHunk || line.startsWith("\\"))
94114
+ continue;
94115
+ const mark = line[0];
94116
+ const content = line.slice(1);
94117
+ if (mark === "+") {
94118
+ right.add(r);
94119
+ out.push(`R${r++} +${content}`);
94120
+ } else if (mark === "-") {
94121
+ left.add(l);
94122
+ out.push(`L${l++} -${content}`);
94123
+ } else if (mark === " ") {
94124
+ right.add(r);
94125
+ out.push(`R${r++} ${content}`);
94126
+ l++;
94127
+ }
94128
+ }
94129
+ return { text: out.join(`
94130
+ `), left, right };
94131
+ }
94132
+ function changedItems(mergeBase, head, root) {
94133
+ const out = git2(["diff", "--name-status", "--no-renames", "-z", mergeBase, head]);
94134
+ const fields = out.split("\x00").filter((f) => f !== "");
94135
+ const items = new Map;
94136
+ for (let i = 0;i + 1 < fields.length; i += 2) {
94137
+ const [code, file] = [fields[i], fields[i + 1]];
94138
+ if (isLockfile(file) || !file.startsWith(root))
94139
+ continue;
94140
+ const { kind, path } = itemOf(file.slice(root.length));
94141
+ const key = `${kind}:${path}`;
94142
+ const item = items.get(key) ?? { kind, path, files: [] };
94143
+ item.files.push({
94144
+ file,
94145
+ status: code === "A" ? "added" : code === "D" ? "deleted" : "modified"
94146
+ });
94147
+ items.set(key, item);
94148
+ }
94149
+ return [...items.values()];
94150
+ }
94151
+ function changeOf(item) {
94152
+ if (item.files.every((f) => f.status === "added"))
94153
+ return "added";
94154
+ if (item.files.every((f) => f.status === "deleted"))
94155
+ return "deleted";
94156
+ return "modified";
94157
+ }
94158
+ function baseInstructions(baseSha, itemPaths, root) {
94159
+ let listing = "";
94160
+ try {
94161
+ listing = git2([
94162
+ "grep",
94163
+ "-l",
94164
+ "-E",
94165
+ `resource_type['"]?:[[:space:]]*['"]?${REVIEW_INSTRUCTIONS_RESOURCE_TYPE}`,
94166
+ baseSha,
94167
+ "--",
94168
+ `${root}*.resource.yaml`,
94169
+ `${root}*.resource.json`
94170
+ ]);
94171
+ } catch (e) {
94172
+ if (e.status !== 1)
94173
+ throw e;
94174
+ }
94175
+ const listed = listing.split(`
94176
+ `).filter(Boolean).map((line) => line.slice(baseSha.length + 1)).map((file) => {
94177
+ const path = file.slice(root.length).replace(/\.resource\.(yaml|json)$/, "");
94178
+ return { file, instruction: { path, scope: folderInstructionScope(path) } };
94179
+ });
94180
+ const fileOf = new Map(listed.map((l) => [l.instruction.path, l.file]));
94181
+ const blocks = [];
94182
+ const skipped = [];
94183
+ for (const instruction of instructionsCovering(listed.map((l) => l.instruction), itemPaths)) {
94184
+ const file = fileOf.get(instruction.path);
94185
+ try {
94186
+ const raw = git2(["show", `${baseSha}:${file}`]);
94187
+ const parsed = file.endsWith(".json") ? JSON.parse(raw) : yamlParseContent(file, raw);
94188
+ const content = parsed.value?.content;
94189
+ if (parsed.resource_type !== REVIEW_INSTRUCTIONS_RESOURCE_TYPE)
94190
+ continue;
94191
+ if (typeof content !== "string")
94192
+ throw new Error("no string content");
94193
+ const inline = /^!inline (.+)$/.exec(content);
94194
+ blocks.push({
94195
+ instruction,
94196
+ body: inline ? git2(["show", `${baseSha}:${root}${inline[1].trim()}`]) : content
94197
+ });
94198
+ } catch (e) {
94199
+ warn(`Could not read review instructions ${instruction.path}: ${e}`);
94200
+ skipped.push(instruction.path);
94201
+ }
94202
+ }
94203
+ return { blocks, skipped };
94204
+ }
94205
+ var WITHHELD_KINDS = new Set([...VALUE_WITHHELD_KINDS, "encryption_key"]);
94206
+ var INSTRUCTION_RESOURCE_TYPES = new Set([REVIEW_INSTRUCTIONS_RESOURCE_TYPE, "ai_instruction"]);
94207
+ function isInstructionResource(item, revs, root) {
94208
+ if (item.kind !== "resource")
94209
+ return false;
94210
+ const definition = `${root}${item.path}.resource.`;
94211
+ const ownFile = (file) => {
94212
+ if (!file.startsWith(definition))
94213
+ return false;
94214
+ const rest = file.slice(definition.length);
94215
+ return rest === "yaml" || rest === "json" || /^file\.[^./]+$/.test(rest);
94216
+ };
94217
+ if (!item.files.every((f) => ownFile(f.file)))
94218
+ return false;
94219
+ let defined = false;
94220
+ for (const rev of revs) {
94221
+ for (const file of [`${definition}yaml`, `${definition}json`]) {
94222
+ let raw;
94223
+ try {
94224
+ raw = git2(["show", `${rev}:${file}`]);
94225
+ } catch {
94226
+ continue;
94227
+ }
94228
+ try {
94229
+ const parsed = file.endsWith(".json") ? JSON.parse(raw) : yamlParseContent(file, raw);
94230
+ if (!INSTRUCTION_RESOURCE_TYPES.has(parsed.resource_type))
94231
+ return false;
94232
+ } catch {
94233
+ return false;
94234
+ }
94235
+ defined = true;
94236
+ }
94237
+ }
94238
+ return defined;
94239
+ }
94240
+ function parseModel(model) {
94241
+ if (!model)
94242
+ return;
94243
+ const i = model.indexOf(":");
94244
+ if (i <= 0)
94245
+ throw new Error(`--model takes provider:model, got ${model}`);
94246
+ return { provider: model.slice(0, i), model: model.slice(i + 1) };
94247
+ }
94248
+ function buildReviewPrompt(baseSha, headSha, folder = "") {
94249
+ const trimmed = folder.replace(/^\/+|\/+$/g, "");
94250
+ const root = trimmed ? `${trimmed}/` : "";
94251
+ let mergeBase;
94252
+ try {
94253
+ mergeBase = git2(["merge-base", baseSha, headSha]).trim();
94254
+ } catch {
94255
+ throw new Error(`No common ancestor between ${baseSha} and ${headSha}. Fetch the full history (actions/checkout with fetch-depth: 0).`);
94256
+ }
94257
+ const items = changedItems(mergeBase, headSha, root);
94258
+ const { blocks, skipped } = baseInstructions(baseSha, items.map((i) => i.path), root);
94259
+ const budget = new ReviewBudget;
94260
+ const unreadable = [];
94261
+ const lines = new Map;
94262
+ for (const item of items) {
94263
+ const key = `${item.kind}:${item.path}`;
94264
+ if (budget.spent) {
94265
+ budget.omitted.push(key);
94266
+ continue;
94267
+ }
94268
+ const header = `### ${item.kind} ${item.path} (${changeOf(item)})`;
94269
+ if (WITHHELD_KINDS.has(item.kind) && !isInstructionResource(item, [mergeBase, headSha], root)) {
94270
+ budget.add(key, `${header}
94271
+ Value withheld from review.`);
94272
+ continue;
94273
+ }
94274
+ const files = [];
94275
+ let failed = false;
94276
+ for (const { file, status } of item.files) {
94277
+ const shown = numberDiff(git2(["diff", "--no-color", "--no-ext-diff", `-U${MODEL_DIFF_CONTEXT}`, mergeBase, headSha, "--", `:(literal)${file}`]));
94278
+ const commentable = numberDiff(git2(["diff", "--no-color", "--no-ext-diff", `-U${GITHUB_DIFF_CONTEXT}`, mergeBase, headSha, "--", `:(literal)${file}`]));
94279
+ if (!shown || !commentable) {
94280
+ failed = true;
94281
+ files.push(`#### ${file} (${status})
94282
+ Contents could not be read.`);
94283
+ continue;
94284
+ }
94285
+ lines.set(file, { LEFT: commentable.left, RIGHT: commentable.right });
94286
+ files.push(`#### ${file} (${status})
94287
+ ${capText(shown.text, 2 * PER_SIDE_CHAR_CAP)}`);
94288
+ }
94289
+ if (failed)
94290
+ unreadable.push(key);
94291
+ budget.add(key, `${header}
94292
+ ${files.join(`
94293
+ `)}`);
94294
+ }
94295
+ return {
94296
+ system: reviewSystemPrompt("pull_request") + reviewInstructionsSection("pull_request", blocks),
94297
+ user: budget.userPrompt(`Base: ${baseSha}
94298
+ Pull request head: ${headSha}`),
94299
+ anchors: { items: new Set(items.map((i) => `${i.kind}:${i.path}`)), lines },
94300
+ omitted: budget.omitted,
94301
+ unreadable,
94302
+ instructions: blocks.map((b) => b.instruction.path),
94303
+ skippedInstructions: skipped
94304
+ };
94305
+ }
94306
+ async function reviewChanges(workspaceId, model, baseSha, headSha, folder) {
94307
+ const { system, user, anchors, ...reported } = buildReviewPrompt(baseSha, headSha, folder);
94308
+ const response = await completeAi({
94309
+ workspace: workspaceId,
94310
+ requestBody: { system, user, model: parseModel(model), max_tokens: MAX_OUTPUT_TOKENS }
94311
+ });
94312
+ return {
94313
+ ...parseReviewAnswer(response.text, anchors),
94314
+ ...reported,
94315
+ model: `${response.model.provider}:${response.model.model}`
94316
+ };
94317
+ }
94318
+ var SEVERITY_RANK = { high: 0, medium: 1, low: 2 };
94319
+ function findingLine(f) {
94320
+ const where = [f.path && `\`${f.path}\``, f.file && f.file !== f.path && `\`${f.file}\``].filter(Boolean).join(" ");
94321
+ return `- **${f.severity}**${where ? ` ${where}` : ""}: ${f.comment}`;
94322
+ }
94323
+ function reviewBody(result, marker, inBody) {
94324
+ const sections = [marker, "### Windmill AI review", result.summary || "No summary."];
94325
+ if (result.findings.length === 0)
94326
+ sections.push("No issues found.");
94327
+ if (inBody.length > 0)
94328
+ sections.push(inBody.map(findingLine).join(`
94329
+ `));
94330
+ const list = (title, entries) => entries.length > 0 && sections.push(`${title}
94331
+ ${entries.map((e) => `- \`${e}\``).join(`
94332
+ `)}`);
94333
+ list("**Not reviewed**, the files could not be read as text:", result.unreadable);
94334
+ list("**Reviewed by name only**, over the size budget:", result.omitted);
94335
+ list("Review instructions applied, from the base branch:", result.instructions);
94336
+ list("**Review instructions skipped**, their body could not be read:", result.skippedInstructions);
94337
+ sections.push(`<sub>${result.model}</sub>`);
94338
+ return sections.join(`
94339
+
94340
+ `);
94341
+ }
94342
+ async function github(ctx, method, path, body) {
94343
+ const res = await fetch(`${ctx.api}/repos/${ctx.repo}${path}`, {
94344
+ method,
94345
+ headers: {
94346
+ Authorization: `Bearer ${ctx.token}`,
94347
+ Accept: "application/vnd.github+json",
94348
+ "X-GitHub-Api-Version": "2022-11-28",
94349
+ ...body ? { "Content-Type": "application/json" } : {}
94350
+ },
94351
+ body: body ? JSON.stringify(body) : undefined
94352
+ });
94353
+ if (!res.ok) {
94354
+ const err = new Error(`GitHub ${method} ${path}: ${res.status} ${await res.text()}`);
94355
+ err.status = res.status;
94356
+ throw err;
94357
+ }
94358
+ return res.json();
94359
+ }
94360
+ async function alreadyReviewed(ctx, marker) {
94361
+ for (let page = 1;page <= 20; page++) {
94362
+ const reviews = await github(ctx, "GET", `/pulls/${ctx.pr}/reviews?per_page=100&page=${page}`);
94363
+ if (reviews.some((r) => r.body?.includes(marker)))
94364
+ return true;
94365
+ if (reviews.length < 100)
94366
+ return false;
94367
+ }
94368
+ return false;
94369
+ }
94370
+ function reviewPayload(result, headSha) {
94371
+ const marker = `<!-- windmill-ai-review:${headSha} -->`;
94372
+ const anchored = result.findings.filter((f) => f.file && f.line);
94373
+ return {
94374
+ marker,
94375
+ body: reviewBody(result, marker, result.findings.filter((f) => !(f.file && f.line))),
94376
+ comments: anchored.map((f) => ({
94377
+ path: f.file,
94378
+ line: f.line,
94379
+ side: f.side,
94380
+ body: `**${f.severity}**: ${f.comment}`
94381
+ })),
94382
+ fallback_body: reviewBody(result, marker, result.findings)
94383
+ };
94384
+ }
94385
+ async function postReview(ctx, headSha, result) {
94386
+ const { marker, body, comments, fallback_body } = reviewPayload(result, headSha);
94387
+ if (await alreadyReviewed(ctx, marker)) {
94388
+ info(`This commit already has a Windmill AI review, not posting another.`);
94389
+ return;
94390
+ }
94391
+ try {
94392
+ await github(ctx, "POST", `/pulls/${ctx.pr}/reviews`, {
94393
+ commit_id: headSha,
94394
+ event: "COMMENT",
94395
+ body,
94396
+ comments
94397
+ });
94398
+ } catch (e) {
94399
+ if (e.status !== 422 || comments.length === 0)
94400
+ throw e;
94401
+ warn(`GitHub refused the line comments, posting them in the review body: ${e}`);
94402
+ await github(ctx, "POST", `/pulls/${ctx.pr}/reviews`, {
94403
+ commit_id: headSha,
94404
+ event: "COMMENT",
94405
+ body: fallback_body
94406
+ });
94407
+ }
94408
+ info(colors.green(`Posted the review on pull request #${ctx.pr}.`));
94409
+ }
94410
+ function githubEvent() {
94411
+ const path = process.env.GITHUB_EVENT_PATH;
94412
+ if (!path)
94413
+ return;
94414
+ try {
94415
+ return JSON.parse(readFileSync5(path, "utf-8"));
94416
+ } catch {
94417
+ return;
94418
+ }
94419
+ }
94420
+ function githubContext(opts, event) {
94421
+ const token = process.env.GITHUB_TOKEN;
94422
+ const repo = process.env.GITHUB_REPOSITORY;
94423
+ const pr = opts.pr ?? event?.pull_request?.number;
94424
+ if (!token || !repo || !pr) {
94425
+ throw new Error("--post github needs GITHUB_TOKEN and GITHUB_REPOSITORY in the environment, and the pull request number (--pr, or a pull_request event)");
94426
+ }
94427
+ return { api: process.env.GITHUB_API_URL ?? "https://api.github.com", repo, token, pr };
94428
+ }
94429
+ function printResult(result) {
94430
+ info(colors.bold(result.summary || "No summary."));
94431
+ for (const f of result.findings) {
94432
+ const where = [f.path, f.file && f.line ? `${f.file}:${f.side === "LEFT" ? "L" : "R"}${f.line}` : f.file].filter(Boolean).join(" ");
94433
+ console.log(`${f.severity.toUpperCase()} ${where}
94434
+ ${f.comment}`);
94435
+ }
94436
+ if (result.findings.length === 0)
94437
+ info("No issues found.");
94438
+ if (result.unreadable.length)
94439
+ warn(`Not reviewed, unreadable: ${result.unreadable.join(", ")}`);
94440
+ if (result.omitted.length)
94441
+ warn(`Reviewed by name only, over budget: ${result.omitted.join(", ")}`);
94442
+ if (result.instructions.length)
94443
+ info(`Review instructions applied: ${result.instructions.join(", ")}`);
94444
+ if (result.skippedInstructions.length) {
94445
+ warn(`Review instructions skipped: ${result.skippedInstructions.join(", ")}`);
94446
+ }
94447
+ }
94448
+ async function review(opts) {
94449
+ if (opts.json)
94450
+ setSilent(true);
94451
+ if (!opts.baseUrl || !opts.workspace || !opts.token) {
94452
+ throw new Error("wmill review needs --base-url, --workspace and --token");
94453
+ }
94454
+ const event = githubEvent();
94455
+ const base = opts.base ?? event?.pull_request?.base?.sha;
94456
+ const head = opts.head ?? event?.pull_request?.head?.sha ?? "HEAD";
94457
+ if (!base)
94458
+ throw new Error("--base is required outside a GitHub pull_request event");
94459
+ const baseSha = git2(["rev-parse", "--verify", `${base}^{commit}`]).trim();
94460
+ const headSha = git2(["rev-parse", "--verify", `${head}^{commit}`]).trim();
94461
+ const ctx = opts.post === "github" ? githubContext(opts, event) : undefined;
94462
+ await requireLogin(opts);
94463
+ const { workspaceId } = await resolveWorkspace(opts);
94464
+ let result;
94465
+ try {
94466
+ result = await reviewChanges(workspaceId, opts.model, baseSha, headSha, opts.folder);
94467
+ } catch (e) {
94468
+ if (ctx) {
94469
+ await github(ctx, "POST", `/pulls/${ctx.pr}/reviews`, {
94470
+ commit_id: headSha,
94471
+ event: "COMMENT",
94472
+ body: `### Windmill AI review
94473
+
94474
+ The review could not be completed: ${apiErrorMessage(e) ?? (e instanceof Error ? e.message : e)}`
94475
+ }).catch((postError) => error(`Could not report the failure on the pull request: ${postError}`));
94476
+ }
94477
+ throw e;
94478
+ }
94479
+ if (opts.json)
94480
+ console.log(JSON.stringify({ ...result, post: reviewPayload(result, headSha) }));
94481
+ else
94482
+ printResult(result);
94483
+ if (ctx)
94484
+ await postReview(ctx, headSha, result);
94485
+ if (opts.failOn && result.findings.some((f) => SEVERITY_RANK[f.severity] <= SEVERITY_RANK[opts.failOn])) {
94486
+ process.exitCode = 1;
94487
+ }
94488
+ }
94489
+ var command28 = new Command().description("Review a pull request on a git sync repository with the workspace's AI, the way deployment requests are reviewed. Reads the changes and the base branch's review instructions from git; the instance, workspace and token come from the flags, never from the checkout's wmill.yaml.").option("--base <ref:string>", "The base branch commit. Defaults to the pull_request event's base.").option("--head <ref:string>", "The pull request's commit. Defaults to the event's head, else HEAD.").option("--model <model:string>", "provider:model to review with. Defaults to the workspace's default model.").option("--folder <dir:string>", "The repository directory the workspace is synced into, when it is not the root.").option("--json", "Print the review as JSON").option("--post <target:string>", "Post the review on the pull request. Only `github` is supported.", {
94490
+ value: (v) => {
94491
+ if (v !== "github")
94492
+ throw new Error(`--post supports github only, got ${v}`);
94493
+ return v;
94494
+ }
94495
+ }).option("--pr <number:number>", "The pull request number. Defaults to the pull_request event's.").option("--fail-on <severity:string>", "Exit with 1 when a finding is at least this severe: high, medium or low.", {
94496
+ value: (v) => {
94497
+ if (!["high", "medium", "low"].includes(v))
94498
+ throw new Error(`--fail-on takes high, medium or low, got ${v}`);
94499
+ return v;
94500
+ }
94501
+ }).action(review);
94502
+ var review_default = command28;
94503
+
93608
94504
  // src/commands/dev/dev.ts
93609
94505
  init_mod3();
93610
94506
  init_log();
@@ -93629,7 +94525,7 @@ await __promiseAll([
93629
94525
  init_codebase(),
93630
94526
  init_local_path_scripts()
93631
94527
  ]);
93632
- var import_yaml48 = __toESM(require_dist(), 1);
94528
+ var import_yaml49 = __toESM(require_dist(), 1);
93633
94529
  import { sep as SEP22 } from "node:path";
93634
94530
  import * as http3 from "node:http";
93635
94531
  import * as https from "node:https";
@@ -94106,7 +95002,7 @@ async function dev2(opts) {
94106
95002
  info(`Wrote inline script: ${filePath}`);
94107
95003
  }
94108
95004
  }
94109
- const flowYaml = import_yaml48.stringify(data.flow);
95005
+ const flowYaml = import_yaml49.stringify(data.flow);
94110
95006
  let currentYaml;
94111
95007
  try {
94112
95008
  currentYaml = await readTextFile(flowYamlPath);
@@ -94359,8 +95255,8 @@ async function dev2(opts) {
94359
95255
  await Promise.all([startServer(), watchChanges()]);
94360
95256
  console.log("Stopped dev mode");
94361
95257
  }
94362
- var command28 = new Command().description("Watch local file changes and live-reload the dev page for preview. Does NOT deploy to the remote workspace — use wmill sync push for that.").option("--includes <pattern...:string>", "Filter paths given a glob pattern or path").option("--proxy-port <port:number>", "Port for a localhost reverse proxy to the remote Windmill server").option("--path <path:string>", "Watch a specific windmill path (e.g., u/admin/my_script or f/my_flow)").option("--no-open", "Do not open the browser automatically").action(dev2);
94363
- var dev_default2 = command28;
95258
+ var command29 = new Command().description("Watch local file changes and live-reload the dev page for preview. Does NOT deploy to the remote workspace — use wmill sync push for that.").option("--includes <pattern...:string>", "Filter paths given a glob pattern or path").option("--proxy-port <port:number>", "Port for a localhost reverse proxy to the remote Windmill server").option("--path <path:string>", "Watch a specific windmill path (e.g., u/admin/my_script or f/my_flow)").option("--no-open", "Do not open the browser automatically").action(dev2);
95259
+ var dev_default2 = command29;
94364
95260
 
94365
95261
  // src/main.ts
94366
95262
  init_gen();
@@ -94518,8 +95414,8 @@ Worker Group: ${group.groupName} (${group.workers.length} workers)`);
94518
95414
  info("Use 'wmill instance add' to add a new instance");
94519
95415
  }
94520
95416
  }
94521
- var command29 = new Command().description("List all workers grouped by worker groups").option("--instance [instance]", "Name of the instance to push to, override the active instance").option("--base-url [baseUrl]", "If used with --token, will be used as the base url for the instance").action(displayWorkers);
94522
- var workers_default = command29;
95417
+ var command30 = new Command().description("List all workers grouped by worker groups").option("--instance [instance]", "Name of the instance to push to, override the active instance").option("--base-url [baseUrl]", "If used with --token, will be used as the base url for the instance").action(displayWorkers);
95418
+ var workers_default = command30;
94523
95419
 
94524
95420
  // src/commands/queues/queues.ts
94525
95421
  init_mod3();
@@ -94627,8 +95523,8 @@ async function displayQueues(opts, workspace) {
94627
95523
  info("Use 'wmill instance add' to add a new instance");
94628
95524
  }
94629
95525
  }
94630
- var command30 = new Command().description("List all queues with their metrics").arguments("[workspace:string] the optional workspace to filter by (default to all workspaces)").option("--instance [instance]", "Name of the instance to push to, override the active instance").option("--base-url [baseUrl]", "If used with --token, will be used as the base url for the instance").action(displayQueues);
94631
- var queues_default = command30;
95526
+ var command31 = new Command().description("List all queues with their metrics").arguments("[workspace:string] the optional workspace to filter by (default to all workspaces)").option("--instance [instance]", "Name of the instance to push to, override the active instance").option("--base-url [baseUrl]", "If used with --token, will be used as the base url for the instance").action(displayQueues);
95527
+ var queues_default = command31;
94632
95528
 
94633
95529
  // src/main.ts
94634
95530
  await init_dependencies();
@@ -95492,8 +96388,8 @@ async function promptMigration() {
95492
96388
  async function promptsAction(opts) {
95493
96389
  await refreshPrompts({ yes: opts.yes === true });
95494
96390
  }
95495
- var command31 = new Command().description("Refresh AGENTS.wmill.md and managed skills. User-owned AGENTS.md and CLAUDE.md are never overwritten unless you opt in.").option("--yes", "Non-interactive: append the @AGENTS.wmill.md include to an existing AGENTS.md / CLAUDE.md without prompting. Without it, a non-interactive run leaves an unlinked file untouched.").action(promptsAction);
95496
- var prompts_default = command31;
96391
+ var command32 = new Command().description("Refresh AGENTS.wmill.md and managed skills. User-owned AGENTS.md and CLAUDE.md are never overwritten unless you opt in.").option("--yes", "Non-interactive: append the @AGENTS.wmill.md include to an existing AGENTS.md / CLAUDE.md without prompting. Without it, a non-interactive run leaves an unlinked file untouched.").action(promptsAction);
96392
+ var prompts_default = command32;
95497
96393
 
95498
96394
  // src/commands/init/init.ts
95499
96395
  await init_tsconfig();
@@ -95687,14 +96583,14 @@ async function initAction(opts) {
95687
96583
  }
95688
96584
  }
95689
96585
  }
95690
- var command33 = new Command().description("Bootstrap a windmill project with a wmill.yaml file").option("--use-default", "Use default settings without checking backend").option("--use-backend", "Use backend git-sync settings if available").option("--repository <repo:string>", "Specify repository path (e.g., u/user/repo) when using backend settings").option("--bind-profile", "Automatically bind active workspace profile to current Git branch").option("--no-bind-profile", "Skip workspace profile binding prompt").action(initAction);
95691
- var init_default = command33;
96586
+ var command34 = new Command().description("Bootstrap a windmill project with a wmill.yaml file").option("--use-default", "Use default settings without checking backend").option("--use-backend", "Use backend git-sync settings if available").option("--repository <repo:string>", "Specify repository path (e.g., u/user/repo) when using backend settings").option("--bind-profile", "Automatically bind active workspace profile to current Git branch").option("--no-bind-profile", "Skip workspace profile binding prompt").action(initAction);
96587
+ var init_default = command34;
95692
96588
 
95693
96589
  // src/commands/refresh/refresh.ts
95694
96590
  init_mod3();
95695
96591
  await init_tsconfig();
95696
- var command34 = new Command().description("Refresh wmill-managed project files (AGENTS.wmill.md, skills, tsconfig.wmill.json)").command("prompts", prompts_default).command("tsconfig", tsconfig_default);
95697
- var refresh_default = command34;
96592
+ var command35 = new Command().description("Refresh wmill-managed project files (AGENTS.wmill.md, skills, tsconfig.wmill.json)").command("prompts", prompts_default).command("tsconfig", tsconfig_default);
96593
+ var refresh_default = command35;
95698
96594
 
95699
96595
  // src/main.ts
95700
96596
  init_freshness_gate();
@@ -95863,8 +96759,8 @@ Warning: Found ${workers.length} active worker(s) on the instance.`));
95863
96759
  }
95864
96760
  var pull3 = new Command().description("Pull completed and queued jobs from workspace").option("-c, --completed-output <file:string>", "Completed jobs output file (default: completed_jobs.json)").option("-q, --queued-output <file:string>", "Queued jobs output file (default: queued_jobs.json)").option("--skip-worker-check", "Skip checking for active workers before export").arguments("[workspace:string]").action(pullJobs);
95865
96761
  var push12 = new Command().description("Push completed and queued jobs to workspace").option("-c, --completed-file <file:string>", "Completed jobs input file (default: completed_jobs.json)").option("-q, --queued-file <file:string>", "Queued jobs input file (default: queued_jobs.json)").option("--skip-worker-check", "Skip checking for active workers before import").arguments("[workspace:string]").action(pushJobs);
95866
- var command35 = new Command().description("Manage jobs (import/export)").command("pull", pull3).command("push", push12);
95867
- var jobs_default = command35;
96762
+ var command36 = new Command().description("Manage jobs (import/export)").command("pull", pull3).command("push", push12);
96763
+ var jobs_default = command36;
95868
96764
 
95869
96765
  // src/commands/job/job.ts
95870
96766
  init_mod3();
@@ -96225,8 +97121,8 @@ async function restart(opts, id) {
96225
97121
  console.log(newId);
96226
97122
  }
96227
97123
  var listOptions = (cmd) => cmd.option("--json", "Output as JSON (for piping to jq)").option("--script-path <scriptPath:string>", "Filter by exact script/flow path").option("--created-by <createdBy:string>", "Filter by creator username").option("--running", "Show only running jobs").option("--failed", "Show only failed jobs").option("--success <success:boolean>", "Filter by success status (true/false)").option("--limit <limit:number>", "Number of jobs to return (default 30, max 100)").option("--job-kinds <jobKinds:string>", "Filter by job kinds (default: script,flow,singlestepflow)").option("--label <label:string>", "Filter by job label").option("--all", "Include sub-jobs (flow steps). By default only top-level jobs are shown").option("--parent <parent:string>", "Filter by parent job ID (show sub-jobs of a specific flow)").option("--is-flow-step", "Show only flow step jobs");
96228
- var command36 = listOptions(new Command().description("Manage jobs (list, inspect, cancel)")).action(list13).command("list", listOptions(new Command().description("List recent jobs"))).action(list13).command("get", "Get job details. For flows: shows step tree with sub-job IDs").arguments("<id:string>").option("--json", "Output as JSON (for piping to jq)").action(get10).command("result", "Get the result of a completed job (machine-friendly)").arguments("<id:string>").action(result).command("logs", "Get job logs. For flows: aggregates all step logs").arguments("<id:string>").action(logs).command("cancel", "Cancel a running or queued job").arguments("<id:string>").option("--reason <reason:string>", "Reason for cancellation").action(cancel).command("rerun", "Re-run a completed job with the same args. Prints the new job UUID on stdout.").arguments("<id:string>").action(rerun).command("restart", "Restart a completed flow at a given top-level step. Prints the new flow job UUID on stdout.").arguments("<id:string>").option("--step <stepId:string>", "Top-level step id to restart the flow from", { required: true }).option("--iteration <n:number>", "For a top-level branchall or for-loop step, the iteration to restart at").action(restart);
96229
- var job_default = command36;
97124
+ var command37 = listOptions(new Command().description("Manage jobs (list, inspect, cancel)")).action(list13).command("list", listOptions(new Command().description("List recent jobs"))).action(list13).command("get", "Get job details. For flows: shows step tree with sub-job IDs").arguments("<id:string>").option("--json", "Output as JSON (for piping to jq)").action(get10).command("result", "Get the result of a completed job (machine-friendly)").arguments("<id:string>").action(result).command("logs", "Get job logs. For flows: aggregates all step logs").arguments("<id:string>").action(logs).command("cancel", "Cancel a running or queued job").arguments("<id:string>").option("--reason <reason:string>", "Reason for cancellation").action(cancel).command("rerun", "Re-run a completed job with the same args. Prints the new job UUID on stdout.").arguments("<id:string>").action(rerun).command("restart", "Restart a completed flow at a given top-level step. Prints the new flow job UUID on stdout.").arguments("<id:string>").option("--step <stepId:string>", "Top-level step id to restart the flow from", { required: true }).option("--iteration <n:number>", "For a top-level branchall or for-loop step, the iteration to restart at").action(restart);
97125
+ var job_default = command37;
96230
97126
 
96231
97127
  // src/commands/group/group.ts
96232
97128
  init_mod3();
@@ -96325,8 +97221,8 @@ async function removeUser(opts, name, username) {
96325
97221
  });
96326
97222
  info(colors.green(`User '${username}' removed from group '${name}'.`));
96327
97223
  }
96328
- var command37 = new Command().description("Manage workspace groups").option("--json", "Output as JSON (for piping to jq)").action(list14).command("list", "List all groups in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list14).command("get", "Get group details and members").arguments("<name:string>").option("--json", "Output as JSON (for piping to jq)").action(get11).command("create", "Create a new group").arguments("<name:string>").option("--summary <summary:string>", "Group summary/description").action(create).command("delete", "Delete a group").arguments("<name:string>").action(deleteGroup2).command("add-user", "Add a user to a group").arguments("<name:string> <username:string>").action(addUser2).command("remove-user", "Remove a user from a group").arguments("<name:string> <username:string>").action(removeUser);
96329
- var group_default = command37;
97224
+ var command38 = new Command().description("Manage workspace groups").option("--json", "Output as JSON (for piping to jq)").action(list14).command("list", "List all groups in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list14).command("get", "Get group details and members").arguments("<name:string>").option("--json", "Output as JSON (for piping to jq)").action(get11).command("create", "Create a new group").arguments("<name:string>").option("--summary <summary:string>", "Group summary/description").action(create).command("delete", "Delete a group").arguments("<name:string>").action(deleteGroup2).command("add-user", "Add a user to a group").arguments("<name:string> <username:string>").action(addUser2).command("remove-user", "Remove a user from a group").arguments("<name:string> <username:string>").action(removeUser);
97225
+ var group_default = command38;
96330
97226
 
96331
97227
  // src/commands/audit/audit.ts
96332
97228
  init_mod3();
@@ -96403,8 +97299,8 @@ async function get12(opts, id) {
96403
97299
  }
96404
97300
  }
96405
97301
  var auditListOptions = (cmd) => cmd.option("--json", "Output as JSON (for piping to jq)").option("--username <username:string>", "Filter by username").option("--operation <operation:string>", "Filter by operation (exact or prefix)").option("--action-kind <actionKind:string>", "Filter by action kind (Create, Update, Delete, Execute)").option("--before <before:string>", "Filter events before this timestamp").option("--after <after:string>", "Filter events after this timestamp").option("--limit <limit:number>", "Number of entries to return (default 30, max 100)");
96406
- var command38 = auditListOptions(new Command().description("View audit logs (requires admin)")).action(list15).command("list", auditListOptions(new Command().description("List audit log entries"))).action(list15).command("get", "Get a specific audit log entry").arguments("<id:string>").option("--json", "Output as JSON (for piping to jq)").action(get12);
96407
- var audit_default = command38;
97302
+ var command39 = auditListOptions(new Command().description("View audit logs (requires admin)")).action(list15).command("list", auditListOptions(new Command().description("List audit log entries"))).action(list15).command("get", "Get a specific audit log entry").arguments("<id:string>").option("--json", "Output as JSON (for piping to jq)").action(get12);
97303
+ var audit_default = command39;
96408
97304
 
96409
97305
  // src/commands/token/token.ts
96410
97306
  init_mod3();
@@ -96458,8 +97354,8 @@ async function deleteToken2(opts, tokenPrefix) {
96458
97354
  await deleteToken({ tokenPrefix });
96459
97355
  info(colors.green(`Token with prefix '${tokenPrefix}' deleted.`));
96460
97356
  }
96461
- var command39 = new Command().description("Manage API tokens").option("--json", "Output as JSON (for piping to jq)").action(list16).command("list", "List API tokens").option("--json", "Output as JSON (for piping to jq)").action(list16).command("create", "Create a new API token").option("--label <label:string>", "Token label").option("--expiration <expiration:string>", "Token expiration (ISO 8601 timestamp)").action(create2).command("delete", "Delete a token by its prefix").arguments("<token_prefix:string>").action(deleteToken2);
96462
- var token_default = command39;
97357
+ var command40 = new Command().description("Manage API tokens").option("--json", "Output as JSON (for piping to jq)").action(list16).command("list", "List API tokens").option("--json", "Output as JSON (for piping to jq)").action(list16).command("create", "Create a new API token").option("--label <label:string>", "Token label").option("--expiration <expiration:string>", "Token expiration (ISO 8601 timestamp)").action(create2).command("delete", "Delete a token by its prefix").arguments("<token_prefix:string>").action(deleteToken2);
97358
+ var token_default = command40;
96463
97359
 
96464
97360
  // src/commands/trash/trash.ts
96465
97361
  init_mod3();
@@ -96550,8 +97446,8 @@ async function restore(opts, ...ids) {
96550
97446
  process.exitCode = 1;
96551
97447
  }
96552
97448
  }
96553
- var command40 = new Command().description("List, inspect and restore items deleted in the last three days (requires admin)").option("--json", "Output as JSON (for piping to jq)").option("--kind <kind:string>", "Only items of this kind: script, flow, app, schedule, variable, resource or a trigger kind such as http_trigger").option("--limit <limit:integer>", "Number of items to return (default 100, max 1000)").option("--page <page:integer>", "Page to return, starting at 1").action(list17).command("list", "List trashed items, most recently deleted first").option("--json", "Output as JSON (for piping to jq)").option("--kind <kind:string>", "Only items of this kind: script, flow, app, schedule, variable, resource or a trigger kind such as http_trigger").option("--limit <limit:integer>", "Number of items to return (default 100, max 1000)").option("--page <page:integer>", "Page to return, starting at 1").action(list17).command("get", "Show a trashed item and the data it was deleted with").arguments("<id:integer>").option("--json", "Output as JSON (for piping to jq)").action(get13).command("restore", "Put trashed items back at their paths").arguments("<ids...:integer>").action(restore);
96554
- var trash_default = command40;
97449
+ var command41 = new Command().description("List, inspect and restore items deleted in the last three days (requires admin)").option("--json", "Output as JSON (for piping to jq)").option("--kind <kind:string>", "Only items of this kind: script, flow, app, schedule, variable, resource or a trigger kind such as http_trigger").option("--limit <limit:integer>", "Number of items to return (default 100, max 1000)").option("--page <page:integer>", "Page to return, starting at 1").action(list17).command("list", "List trashed items, most recently deleted first").option("--json", "Output as JSON (for piping to jq)").option("--kind <kind:string>", "Only items of this kind: script, flow, app, schedule, variable, resource or a trigger kind such as http_trigger").option("--limit <limit:integer>", "Number of items to return (default 100, max 1000)").option("--page <page:integer>", "Page to return, starting at 1").action(list17).command("get", "Show a trashed item and the data it was deleted with").arguments("<id:integer>").option("--json", "Output as JSON (for piping to jq)").action(get13).command("restore", "Put trashed items back at their paths").arguments("<ids...:integer>").action(restore);
97450
+ var trash_default = command41;
96555
97451
 
96556
97452
  // src/main.ts
96557
97453
  await init_generate_metadata();
@@ -96612,14 +97508,14 @@ ${await res.text()}`);
96612
97508
  console.log();
96613
97509
  }
96614
97510
  }
96615
- var command41 = new Command().name("docs").description("Search Windmill documentation.").arguments("<query:string>").option("--json", "Output results as JSON.").action(docs);
96616
- var docs_default = command41;
97511
+ var command42 = new Command().name("docs").description("Search Windmill documentation.").arguments("<query:string>").option("--json", "Output results as JSON.").action(docs);
97512
+ var docs_default = command42;
96617
97513
 
96618
97514
  // src/commands/config/config.ts
96619
97515
  init_mod3();
96620
97516
  init_log();
96621
97517
  init_colors2();
96622
- var import_yaml49 = __toESM(require_dist(), 1);
97518
+ var import_yaml50 = __toESM(require_dist(), 1);
96623
97519
  import { writeFile as writeFile25 } from "node:fs/promises";
96624
97520
  await __promiseAll([
96625
97521
  init_conf(),
@@ -96674,7 +97570,7 @@ async function migrateAction() {
96674
97570
  } else {
96675
97571
  newConf.workspaces = workspaces;
96676
97572
  }
96677
- await writeFile25(wmillYamlPath, import_yaml49.stringify(newConf), "utf-8");
97573
+ await writeFile25(wmillYamlPath, import_yaml50.stringify(newConf), "utf-8");
96678
97574
  info(colors.green(`✅ Migrated '${legacyKey}' to 'workspaces' in ${wmillYamlPath}`));
96679
97575
  if (wsNames.length > 0) {
96680
97576
  info(` Workspace entries: ${wsNames.join(", ")}`);
@@ -96683,8 +97579,8 @@ async function migrateAction() {
96683
97579
  info(` Also removed additional legacy keys: ${legacyKeys.slice(1).join(", ")}`);
96684
97580
  }
96685
97581
  }
96686
- var command42 = new Command().name("config").description("Show all available wmill.yaml configuration options").option("--json", "Output as JSON for programmatic consumption").action(configAction).command("migrate").description("Migrate wmill.yaml from gitBranches/environments to workspaces format").action(migrateAction);
96687
- var config_default = command42;
97582
+ var command43 = new Command().name("config").description("Show all available wmill.yaml configuration options").option("--json", "Output as JSON for programmatic consumption").action(configAction).command("migrate").description("Migrate wmill.yaml from gitBranches/environments to workspaces format").action(migrateAction);
97583
+ var config_default = command43;
96688
97584
 
96689
97585
  // src/commands/datatable/datatable.ts
96690
97586
  init_mod3();
@@ -98694,8 +99590,8 @@ async function serve2(opts) {
98694
99590
  async function psql2(opts) {
98695
99591
  await psql(opts);
98696
99592
  }
98697
- var command43 = new Command().description("datatable related commands").command("list", "list all datatables in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list18).command("run", "run a SQL query on a datatable").arguments("<sql:string>").option("-n --name <name:string>", "Datatable name (default: main)").option("-s --silent", "Output only the final result as JSON. Useful for scripting.").action(run4).command("migrate", migrateCommand).command("create", "register a datatable database in the workspace (default: instance-backed 'main') so scripts can use datatable://<name>").arguments("[name:string]").option("--resource <resource:string>", "Back the datatable with an existing postgresql resource path instead of the instance database").option("--force", "Allow adding to a workspace that already has datatables (fork metadata on existing ones is not preserved)").action(create3).command("serve", "Serve all datatables as a Postgres-wire endpoint (psql, DBeaver, pgAdmin); the client picks the datatable via the database name in its connection string").option("--port <port:number>", "Port to listen on (default: first free port in 5433-5500)").option("--host <host:string>", "Bind address (default: 127.0.0.1)").option("--password <password:string>", "Password for Postgres clients (default: generate a random password at startup)").action(serve2).command("psql", "Start a serve listener and launch psql connected to it").option("-n --name <name:string>", "Datatable to connect psql to (default: main)").option("--port <port:number>", "Port the proxy listens on (default: first free port in 5433-5500)").option("--host <host:string>", "Bind address for the proxy (default: 127.0.0.1)").option("--password <password:string>", "Password for the temporary Postgres proxy (default: generate a random password at startup)").action(psql2);
98698
- var datatable_default = command43;
99593
+ var command44 = new Command().description("datatable related commands").command("list", "list all datatables in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list18).command("run", "run a SQL query on a datatable").arguments("<sql:string>").option("-n --name <name:string>", "Datatable name (default: main)").option("-s --silent", "Output only the final result as JSON. Useful for scripting.").action(run4).command("migrate", migrateCommand).command("create", "register a datatable database in the workspace (default: instance-backed 'main') so scripts can use datatable://<name>").arguments("[name:string]").option("--resource <resource:string>", "Back the datatable with an existing postgresql resource path instead of the instance database").option("--force", "Allow adding to a workspace that already has datatables (fork metadata on existing ones is not preserved)").action(create3).command("serve", "Serve all datatables as a Postgres-wire endpoint (psql, DBeaver, pgAdmin); the client picks the datatable via the database name in its connection string").option("--port <port:number>", "Port to listen on (default: first free port in 5433-5500)").option("--host <host:string>", "Bind address (default: 127.0.0.1)").option("--password <password:string>", "Password for Postgres clients (default: generate a random password at startup)").action(serve2).command("psql", "Start a serve listener and launch psql connected to it").option("-n --name <name:string>", "Datatable to connect psql to (default: main)").option("--port <port:number>", "Port the proxy listens on (default: first free port in 5433-5500)").option("--host <host:string>", "Bind address for the proxy (default: 127.0.0.1)").option("--password <password:string>", "Password for the temporary Postgres proxy (default: generate a random password at startup)").action(psql2);
99594
+ var datatable_default = command44;
98699
99595
 
98700
99596
  // src/commands/pipeline/pipeline.ts
98701
99597
  init_mod3();
@@ -99985,8 +100881,8 @@ async function dev3(opts, folderArg) {
99985
100881
  process27.exit(0);
99986
100882
  });
99987
100883
  }
99988
- var command44 = new Command().description("Live-preview a data pipeline from local files: watch an `f/<folder>` of `// pipeline` scripts, push the working-tree graph to the dev page, and run the cascade via preview (no deploy).").arguments("[folder:string]").option("--port <port:number>", "Port for the dev WebSocket server.").option("--no-open", "Do not open the browser automatically.").option("--frontend <origin:string>", "Origin serving the /pipeline_dev page (e.g. http://localhost:3000 for a locally-run frontend). Defaults to the workspace remote; use it when the remote's deployed frontend predates the dev page.").action(dev3);
99989
- var dev_default3 = command44;
100884
+ var command45 = new Command().description("Live-preview a data pipeline from local files: watch an `f/<folder>` of `// pipeline` scripts, push the working-tree graph to the dev page, and run the cascade via preview (no deploy).").arguments("[folder:string]").option("--port <port:number>", "Port for the dev WebSocket server.").option("--no-open", "Do not open the browser automatically.").option("--frontend <origin:string>", "Origin serving the /pipeline_dev page (e.g. http://localhost:3000 for a locally-run frontend). Defaults to the workspace remote; use it when the remote's deployed frontend predates the dev page.").action(dev3);
100885
+ var dev_default3 = command45;
99990
100886
 
99991
100887
  // src/commands/pipeline/docs.ts
99992
100888
  init_gen();
@@ -99999,7 +100895,7 @@ await __promiseAll([
99999
100895
  init_conf()
100000
100896
  ]);
100001
100897
  import { writeFile as writeFile26 } from "node:fs/promises";
100002
- import { existsSync as existsSync22, readFileSync as readFileSync8 } from "node:fs";
100898
+ import { existsSync as existsSync22, readFileSync as readFileSync9 } from "node:fs";
100003
100899
  import * as path29 from "node:path";
100004
100900
  var ASSET_KINDS = "s3object,ducklake,datatable,volume,dbt";
100005
100901
  function assetUri(kind, p) {
@@ -100222,7 +101118,7 @@ async function generatePipelineDocs(opts, folder) {
100222
101118
  if (existsSync22(p)) {
100223
101119
  let existing;
100224
101120
  try {
100225
- existing = readFileSync8(p, "utf-8");
101121
+ existing = readFileSync9(p, "utf-8");
100226
101122
  } catch {
100227
101123
  continue;
100228
101124
  }
@@ -100877,8 +101773,8 @@ Full logs: ${runUrl}`);
100877
101773
  info(colors.green.bold(`Bounded run complete — ${order.length} script(s) succeeded.`));
100878
101774
  }
100879
101775
  }
100880
- var command45 = new Command().description("inspect asset-driven pipelines (scripts marked `// pipeline`, wired by `// on <spec>` annotations)").command("list", "list pipeline folders in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list19).command("show", "render a pipeline folder's DAG (sources, lineage, subscriptions) in the terminal").arguments("<folder:string>").option("--json", "Output the raw asset graph as JSON").option("--local", "Build the graph from local working-tree files (// pipeline scripts) instead of the deployed workspace — no deploy needed.").action(show2).command("run", "run a cascade: from --from (a root OR any mid-DAG model), fan downstream up to the --to end node(s)").arguments("<folder:string>").option("--from <script:string>", "Start script (short name or path). May be any node, including a mid-DAG model — that node plus its transitive downstream runs, upstream is NOT re-run (dbt `--select model+`). Defaults to the folder's sole schedule/manual root.").option("--to <node:string>", "End node(s) to stop at — script names/paths or asset URIs (e.g. datatable://main/staged). Repeatable or comma-separated. Omit to run the full downstream.", { collect: true }).option("--dry-run", "Print the topological run plan without executing.").option("--json", "Output the plan as JSON (for piping to jq).").option("--local", "Run the local working-tree scripts via preview (no deploy) instead of the deployed versions; the graph is built from local files.").option("--upload <binding:string>", "Bind an object to a data_upload/webhook entry point so it runs in the cascade, as SCRIPT[:PARAM]=SOURCE (SOURCE is a local file or an s3://key). Local files are uploaded to the workspace store; the S3Object param is inferred when the script has exactly one. Repeatable.", { collect: true }).option("--arg <binding:string>", "Pass a plain run arg to a script in the cascade, as SCRIPT:PARAM=VALUE (VALUE is parsed as JSON when possible, else taken as a string — e.g. daily_report:partition=2026-07-02). Repeatable.", { collect: true }).option("--partition <value:string>", "Partition value for `// partitioned` scripts in the run (e.g. 2026-06-30) — use it to backfill a past slice. With --local, time kinds (daily/hourly/weekly/monthly) default to the current UTC period when omitted; `dynamic` always needs it. Deployed runs without it defer to backend run-start resolution.").action(run5).command("docs", "generate PIPELINE.md (+ AGENTS.md pointer) describing a folder's pipeline graph and datatable schemas, for an editor / agentic loop").arguments("<folder:string>").option("--local", "Build the graph from local working-tree files instead of the deployed workspace.").action(generatePipelineDocs).command("dev", dev_default3);
100881
- var pipeline_default = command45;
101776
+ var command46 = new Command().description("inspect asset-driven pipelines (scripts marked `// pipeline`, wired by `// on <spec>` annotations)").command("list", "list pipeline folders in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list19).command("show", "render a pipeline folder's DAG (sources, lineage, subscriptions) in the terminal").arguments("<folder:string>").option("--json", "Output the raw asset graph as JSON").option("--local", "Build the graph from local working-tree files (// pipeline scripts) instead of the deployed workspace — no deploy needed.").action(show2).command("run", "run a cascade: from --from (a root OR any mid-DAG model), fan downstream up to the --to end node(s)").arguments("<folder:string>").option("--from <script:string>", "Start script (short name or path). May be any node, including a mid-DAG model — that node plus its transitive downstream runs, upstream is NOT re-run (dbt `--select model+`). Defaults to the folder's sole schedule/manual root.").option("--to <node:string>", "End node(s) to stop at — script names/paths or asset URIs (e.g. datatable://main/staged). Repeatable or comma-separated. Omit to run the full downstream.", { collect: true }).option("--dry-run", "Print the topological run plan without executing.").option("--json", "Output the plan as JSON (for piping to jq).").option("--local", "Run the local working-tree scripts via preview (no deploy) instead of the deployed versions; the graph is built from local files.").option("--upload <binding:string>", "Bind an object to a data_upload/webhook entry point so it runs in the cascade, as SCRIPT[:PARAM]=SOURCE (SOURCE is a local file or an s3://key). Local files are uploaded to the workspace store; the S3Object param is inferred when the script has exactly one. Repeatable.", { collect: true }).option("--arg <binding:string>", "Pass a plain run arg to a script in the cascade, as SCRIPT:PARAM=VALUE (VALUE is parsed as JSON when possible, else taken as a string — e.g. daily_report:partition=2026-07-02). Repeatable.", { collect: true }).option("--partition <value:string>", "Partition value for `// partitioned` scripts in the run (e.g. 2026-06-30) — use it to backfill a past slice. With --local, time kinds (daily/hourly/weekly/monthly) default to the current UTC period when omitted; `dynamic` always needs it. Deployed runs without it defer to backend run-start resolution.").action(run5).command("docs", "generate PIPELINE.md (+ AGENTS.md pointer) describing a folder's pipeline graph and datatable schemas, for an editor / agentic loop").arguments("<folder:string>").option("--local", "Build the graph from local working-tree files instead of the deployed workspace.").action(generatePipelineDocs).command("dev", dev_default3);
101777
+ var pipeline_default = command46;
100882
101778
 
100883
101779
  // src/commands/ducklake/ducklake.ts
100884
101780
  init_mod3();
@@ -100908,8 +101804,8 @@ async function run6(opts, sql) {
100908
101804
  const name = opts.name ?? DEFAULT_DUCKLAKE_NAME;
100909
101805
  await runCatalogQuery(opts, "ducklake", name, sql);
100910
101806
  }
100911
- var command46 = new Command().description("ducklake related commands").command("list", "list all ducklakes in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list20).command("run", "run a SQL query on a ducklake").arguments("<sql:string>").option("-n --name <name:string>", "Ducklake name (default: main)").option("-s --silent", "Output only the final result as JSON. Useful for scripting.").action(run6);
100912
- var ducklake_default = command46;
101807
+ var command47 = new Command().description("ducklake related commands").command("list", "list all ducklakes in the workspace").option("--json", "Output as JSON (for piping to jq)").action(list20).command("run", "run a SQL query on a ducklake").arguments("<sql:string>").option("-n --name <name:string>", "Ducklake name (default: main)").option("-s --silent", "Output only the final result as JSON. Useful for scripting.").action(run6);
101808
+ var ducklake_default = command47;
100913
101809
 
100914
101810
  // src/commands/object-storage/object-storage.ts
100915
101811
  init_mod3();
@@ -101110,8 +102006,8 @@ async function preview3(opts, fileKey) {
101110
102006
  `);
101111
102007
  }
101112
102008
  }
101113
- var command47 = new Command().alias("s3").description("Object storage (S3) related commands. Operates on the workspace's default object storage; use --storage to target a configured secondary storage.").action(listStorages).command("list", "List configured object storages for the workspace (default + secondary).").option("--json", "Output as JSON (for piping to jq)").action(listStorages).command("files", "List files in an object storage. Optionally filter by prefix.").alias("ls").arguments("[prefix:string]").option("--json", "Output as JSON (for piping to jq)").option("--max-keys <maxKeys:number>", "Page size (default 100)").option("--marker <marker:string>", "Pagination marker from a previous response").option("--storage <storage:string>", "Secondary storage name (omit for the workspace default)").action(listFiles).command("upload", "Upload a local file to object storage at the given file key.").arguments("<local_path:string> <file_key:string>").option("--storage <storage:string>", "Secondary storage name").option("--content-type <contentType:string>", "Content-Type header to set on the object").option("--content-disposition <contentDisposition:string>", "Content-Disposition header to set on the object").action(upload).command("download", "Download an object to a local file (or stdout). Default output path is the basename of the file key in the current directory.").arguments("<file_key:string> [output_path:string]").option("--storage <storage:string>", "Secondary storage name").option("--stdout", "Write file contents to stdout instead of a file").action(download).command("delete", "Delete an object from object storage. Prompts for confirmation unless --yes is set.").arguments("<file_key:string>").option("--storage <storage:string>", "Secondary storage name").option("--yes", "Skip the confirmation prompt").action(del).command("move", "Move an object within the same storage (rename or relocate by key).").arguments("<src_file_key:string> <dest_file_key:string>").option("--storage <storage:string>", "Secondary storage name").action(move).command("info", "Show metadata (size, mime, last-modified) for an object.").arguments("<file_key:string>").option("--json", "Output as JSON (for piping to jq)").option("--storage <storage:string>", "Secondary storage name").action(info2).command("preview", "Preview the contents of an object (text/CSV). Use --bytes-from / --bytes-length to peek at a slice of binary files.").arguments("<file_key:string>").option("--storage <storage:string>", "Secondary storage name").option("--mime <mime:string>", "Override the detected mime type (e.g. text/csv)").option("--bytes-from <bytesFrom:number>", "Start offset in bytes").option("--bytes-length <bytesLength:number>", "Number of bytes to read").option("--csv-separator <csvSeparator:string>", "CSV column separator (default ,)").option("--csv-header", "Treat the first CSV row as a header").action(preview3);
101114
- var object_storage_default = command47;
102009
+ var command48 = new Command().alias("s3").description("Object storage (S3) related commands. Operates on the workspace's default object storage; use --storage to target a configured secondary storage.").action(listStorages).command("list", "List configured object storages for the workspace (default + secondary).").option("--json", "Output as JSON (for piping to jq)").action(listStorages).command("files", "List files in an object storage. Optionally filter by prefix.").alias("ls").arguments("[prefix:string]").option("--json", "Output as JSON (for piping to jq)").option("--max-keys <maxKeys:number>", "Page size (default 100)").option("--marker <marker:string>", "Pagination marker from a previous response").option("--storage <storage:string>", "Secondary storage name (omit for the workspace default)").action(listFiles).command("upload", "Upload a local file to object storage at the given file key.").arguments("<local_path:string> <file_key:string>").option("--storage <storage:string>", "Secondary storage name").option("--content-type <contentType:string>", "Content-Type header to set on the object").option("--content-disposition <contentDisposition:string>", "Content-Disposition header to set on the object").action(upload).command("download", "Download an object to a local file (or stdout). Default output path is the basename of the file key in the current directory.").arguments("<file_key:string> [output_path:string]").option("--storage <storage:string>", "Secondary storage name").option("--stdout", "Write file contents to stdout instead of a file").action(download).command("delete", "Delete an object from object storage. Prompts for confirmation unless --yes is set.").arguments("<file_key:string>").option("--storage <storage:string>", "Secondary storage name").option("--yes", "Skip the confirmation prompt").action(del).command("move", "Move an object within the same storage (rename or relocate by key).").arguments("<src_file_key:string> <dest_file_key:string>").option("--storage <storage:string>", "Secondary storage name").action(move).command("info", "Show metadata (size, mime, last-modified) for an object.").arguments("<file_key:string>").option("--json", "Output as JSON (for piping to jq)").option("--storage <storage:string>", "Secondary storage name").action(info2).command("preview", "Preview the contents of an object (text/CSV). Use --bytes-from / --bytes-length to peek at a slice of binary files.").arguments("<file_key:string>").option("--storage <storage:string>", "Secondary storage name").option("--mime <mime:string>", "Override the detected mime type (e.g. text/csv)").option("--bytes-from <bytesFrom:number>", "Start offset in bytes").option("--bytes-length <bytesLength:number>", "Number of bytes to read").option("--csv-separator <csvSeparator:string>", "CSV column separator (default ,)").option("--csv-header", "Treat the first CSV row as a header").action(preview3);
102010
+ var object_storage_default = command48;
101115
102011
 
101116
102012
  // src/main.ts
101117
102013
  await init_context();
@@ -101131,7 +102027,7 @@ async function checkVersionSafe(cmd) {
101131
102027
  }
101132
102028
  mainCommand.version(`${currentVersion} (New version available: ${latestVersion}. Run '${mainCommand.getName()} upgrade' to upgrade to the latest version!)`);
101133
102029
  }
101134
- var command48 = new Command().name("wmill").action(() => info(`Welcome to Windmill CLI ${VERSION}. Use -h for help.`)).description("Windmill CLI").globalOption("--workspace <workspace:string>", "Specify the target workspace. This overrides the default workspace.").globalOption("--debug --verbose", "Show debug/verbose logs").globalOption("--show-diffs", "Show diff informations when syncing (may show sensitive informations)").globalOption("--token <token:string>", "Specify an API token. This will override any stored token.").globalOption("--base-url <baseUrl:string>", "Specify the base URL of the API. If used, --token and --workspace are required and no local remote/workspace already set will be used.").globalOption("--config-dir <configDir:string>", "Specify a custom config directory. Overrides WMILL_CONFIG_DIR environment variable and default ~/.config location.").env("HEADERS <headers:string>", `Specify headers to use for all requests. e.g: "HEADERS='h1: v1, h2: v2'"`).version(VERSION).versionOption(false).helpOption("-h, --help", "Show this help.", {
102030
+ var command49 = new Command().name("wmill").action(() => info(`Welcome to Windmill CLI ${VERSION}. Use -h for help.`)).description("Windmill CLI").globalOption("--workspace <workspace:string>", "Specify the target workspace. This overrides the default workspace.").globalOption("--debug --verbose", "Show debug/verbose logs").globalOption("--show-diffs", "Show diff informations when syncing (may show sensitive informations)").globalOption("--token <token:string>", "Specify an API token. This will override any stored token.").globalOption("--base-url <baseUrl:string>", "Specify the base URL of the API. If used, --token and --workspace are required and no local remote/workspace already set will be used.").globalOption("--config-dir <configDir:string>", "Specify a custom config directory. Overrides WMILL_CONFIG_DIR environment variable and default ~/.config location.").env("HEADERS <headers:string>", `Specify headers to use for all requests. e.g: "HEADERS='h1: v1, h2: v2'"`).version(VERSION).versionOption(false).helpOption("-h, --help", "Show this help.", {
101135
102031
  action: async function() {
101136
102032
  const self2 = this;
101137
102033
  const long = self2.getRawArgs().includes(`--${self2.getHelpOption()?.name}`);
@@ -101143,7 +102039,7 @@ var command48 = new Command().name("wmill").action(() => info(`Welcome to Windmi
101143
102039
  self2.showHelp({ long });
101144
102040
  self2.exit();
101145
102041
  }
101146
- }).command("init", init_default).command("refresh", refresh_default).command("app", app_default).command("flow", flow_default).command("script", script_default).command("workspace", workspace_default).command("resource", resource_default).command("resource-type", resource_type_default).command("user", user_default).command("variable", variable_default).command("hub", hub_default).command("folder", folder_default).command("schedule", schedule_default2).command("trigger", trigger_default).command("dev", dev_default2).command("sync", sync_default).command("lint", lint_default).command("digest", digest_default).command("gitsync-settings", gitsync_settings_default).command("protection-rules", protection_rules_default).command("instance", instance_default).command("worker-groups", worker_groups_default).command("workers", workers_default).command("queues", queues_default).command("dependencies", dependencies_default).command("jobs", jobs_default).command("job", job_default).command("group", group_default).command("audit", audit_default).command("token", token_default).command("trash", trash_default).command("generate-metadata", generate_metadata_default).command("docs", docs_default).command("config", config_default).command("datatable", datatable_default).command("pipeline", pipeline_default).command("ducklake", ducklake_default).command("object-storage", object_storage_default).command("version --version", "Show version information").action(async (opts) => {
102042
+ }).command("init", init_default).command("refresh", refresh_default).command("app", app_default).command("flow", flow_default).command("script", script_default).command("workspace", workspace_default).command("resource", resource_default).command("resource-type", resource_type_default).command("user", user_default).command("variable", variable_default).command("hub", hub_default).command("folder", folder_default).command("schedule", schedule_default2).command("trigger", trigger_default).command("dev", dev_default2).command("sync", sync_default).command("lint", lint_default).command("digest", digest_default).command("review", review_default).command("gitsync-settings", gitsync_settings_default).command("protection-rules", protection_rules_default).command("instance", instance_default).command("worker-groups", worker_groups_default).command("workers", workers_default).command("queues", queues_default).command("dependencies", dependencies_default).command("jobs", jobs_default).command("job", job_default).command("group", group_default).command("audit", audit_default).command("token", token_default).command("trash", trash_default).command("generate-metadata", generate_metadata_default).command("docs", docs_default).command("config", config_default).command("datatable", datatable_default).command("pipeline", pipeline_default).command("ducklake", ducklake_default).command("object-storage", object_storage_default).command("version --version", "Show version information").action(async (opts) => {
101147
102043
  console.log("CLI version: " + VERSION);
101148
102044
  try {
101149
102045
  const provider = new NpmProvider({ package: "windmill-cli" });
@@ -101173,20 +102069,20 @@ var command48 = new Command().name("wmill").action(() => info(`Welcome to Windmi
101173
102069
  error(e);
101174
102070
  info("Try running with sudo and otherwise check the result of the command: npm uninstall windmill-cli && npm install -g windmill-cli");
101175
102071
  })).command("completions", new Command().description("Generate shell completions.").command("bash", new Command().description("Generate bash completions.").action(() => {
101176
- process.stdout.write(generateShellCompletions(command48, "bash") + `
102072
+ process.stdout.write(generateShellCompletions(command49, "bash") + `
101177
102073
  `);
101178
102074
  })).command("zsh", new Command().description("Generate zsh completions.").action(() => {
101179
- process.stdout.write(generateShellCompletions(command48, "zsh") + `
102075
+ process.stdout.write(generateShellCompletions(command49, "zsh") + `
101180
102076
  `);
101181
102077
  })).command("fish", new Command().description("Generate fish completions.").action(() => {
101182
- process.stdout.write(generateShellCompletions(command48, "fish") + `
102078
+ process.stdout.write(generateShellCompletions(command49, "fish") + `
101183
102079
  `);
101184
102080
  })));
101185
102081
  async function main2() {
101186
102082
  try {
101187
102083
  const args = process.argv.slice(2);
101188
102084
  if (args.length === 0) {
101189
- command48.showHelp();
102085
+ command49.showHelp();
101190
102086
  }
101191
102087
  const LOG_LEVEL = args.includes("--verbose") || args.includes("--debug") ? "DEBUG" : "INFO";
101192
102088
  setShowDiffs(args.includes("--show-diffs"));
@@ -101207,7 +102103,7 @@ async function main2() {
101207
102103
  await init_tsconfig();
101208
102104
  await warnIfTsconfigStale().catch(() => {});
101209
102105
  }
101210
- await command48.parse(args);
102106
+ await command49.parse(args);
101211
102107
  } catch (e) {
101212
102108
  const apiError = apiErrorMessage(e);
101213
102109
  if (apiError !== undefined) {
@@ -101241,7 +102137,7 @@ if (isMain()) {
101241
102137
  process.stdin.destroy();
101242
102138
  });
101243
102139
  }
101244
- var main_default = command48;
102140
+ var main_default = command49;
101245
102141
  export {
101246
102142
  VERSION,
101247
102143
  WM_FORK_PREFIX,