windmill-cli 1.813.0 → 1.815.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/esm/main.js +1154 -506
  2. package/package.json +2 -2
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.813.0",
16769
+ VERSION: "1.815.0",
16770
16770
  WITH_CREDENTIALS: true,
16771
16771
  interceptors: {
16772
16772
  request: new Interceptors,
@@ -17387,6 +17387,16 @@ var getAuditLog = (data) => {
17387
17387
  body: data.requestBody,
17388
17388
  mediaType: "application/json"
17389
17389
  });
17390
+ }, editInstanceGroups = (data) => {
17391
+ return request(OpenAPI, {
17392
+ method: "POST",
17393
+ url: "/w/{workspace}/workspaces/edit_instance_groups",
17394
+ path: {
17395
+ workspace: data.workspace
17396
+ },
17397
+ body: data.requestBody,
17398
+ mediaType: "application/json"
17399
+ });
17390
17400
  }, editWebhook = (data) => {
17391
17401
  return request(OpenAPI, {
17392
17402
  method: "POST",
@@ -20002,7 +20012,7 @@ var init_auth = __esm(async () => {
20002
20012
  });
20003
20013
 
20004
20014
  // src/core/constants.ts
20005
- var WM_FORK_PREFIX = "wm-fork", VERSION = "1.813.0";
20015
+ var WM_FORK_PREFIX = "wm-fork", VERSION = "1.815.0";
20006
20016
 
20007
20017
  // src/utils/resource_folders.ts
20008
20018
  import { existsSync } from "node:fs";
@@ -28632,108 +28642,6 @@ async function resolveBindPort(requested, flagLabel, log) {
28632
28642
  var BIND_HOST = "0.0.0.0";
28633
28643
  var init_port_probe = () => {};
28634
28644
 
28635
- // node_modules/ws/lib/stream.js
28636
- var require_stream = __commonJS(function(exports, module) {
28637
- var { Duplex } = __require("stream");
28638
- function emitClose(stream) {
28639
- stream.emit("close");
28640
- }
28641
- function duplexOnEnd() {
28642
- if (!this.destroyed && this._writableState.finished) {
28643
- this.destroy();
28644
- }
28645
- }
28646
- function duplexOnError(err) {
28647
- this.removeListener("error", duplexOnError);
28648
- this.destroy();
28649
- if (this.listenerCount("error") === 0) {
28650
- this.emit("error", err);
28651
- }
28652
- }
28653
- function createWebSocketStream(ws, options) {
28654
- let terminateOnDestroy = true;
28655
- const duplex = new Duplex({
28656
- ...options,
28657
- autoDestroy: false,
28658
- emitClose: false,
28659
- objectMode: false,
28660
- writableObjectMode: false
28661
- });
28662
- ws.on("message", function message(msg, isBinary) {
28663
- const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
28664
- if (!duplex.push(data))
28665
- ws.pause();
28666
- });
28667
- ws.once("error", function error(err) {
28668
- if (duplex.destroyed)
28669
- return;
28670
- terminateOnDestroy = false;
28671
- duplex.destroy(err);
28672
- });
28673
- ws.once("close", function close() {
28674
- if (duplex.destroyed)
28675
- return;
28676
- duplex.push(null);
28677
- });
28678
- duplex._destroy = function(err, callback) {
28679
- if (ws.readyState === ws.CLOSED) {
28680
- callback(err);
28681
- process.nextTick(emitClose, duplex);
28682
- return;
28683
- }
28684
- let called = false;
28685
- ws.once("error", function error(err) {
28686
- called = true;
28687
- callback(err);
28688
- });
28689
- ws.once("close", function close() {
28690
- if (!called)
28691
- callback(err);
28692
- process.nextTick(emitClose, duplex);
28693
- });
28694
- if (terminateOnDestroy)
28695
- ws.terminate();
28696
- };
28697
- duplex._final = function(callback) {
28698
- if (ws.readyState === ws.CONNECTING) {
28699
- ws.once("open", function open() {
28700
- duplex._final(callback);
28701
- });
28702
- return;
28703
- }
28704
- if (ws._socket === null)
28705
- return;
28706
- if (ws._socket._writableState.finished) {
28707
- callback();
28708
- if (duplex._readableState.endEmitted)
28709
- duplex.destroy();
28710
- } else {
28711
- ws._socket.once("finish", function finish() {
28712
- callback();
28713
- });
28714
- ws.close();
28715
- }
28716
- };
28717
- duplex._read = function() {
28718
- if (ws.isPaused)
28719
- ws.resume();
28720
- };
28721
- duplex._write = function(chunk, encoding, callback) {
28722
- if (ws.readyState === ws.CONNECTING) {
28723
- ws.once("open", function open() {
28724
- duplex._write(chunk, encoding, callback);
28725
- });
28726
- return;
28727
- }
28728
- ws.send(chunk, callback);
28729
- };
28730
- duplex.on("end", duplexOnEnd);
28731
- duplex.on("error", duplexOnError);
28732
- return duplex;
28733
- }
28734
- module.exports = createWebSocketStream;
28735
- });
28736
-
28737
28645
  // node_modules/ws/lib/constants.js
28738
28646
  var require_constants = __commonJS(function(exports, module) {
28739
28647
  var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
@@ -28742,6 +28650,7 @@ var require_constants = __commonJS(function(exports, module) {
28742
28650
  BINARY_TYPES.push("blob");
28743
28651
  module.exports = {
28744
28652
  BINARY_TYPES,
28653
+ CLOSE_TIMEOUT: 30000,
28745
28654
  EMPTY_BUFFER: Buffer.alloc(0),
28746
28655
  GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
28747
28656
  hasBlob,
@@ -28879,11 +28788,11 @@ var require_permessage_deflate = __commonJS(function(exports, module) {
28879
28788
  var zlibLimiter;
28880
28789
 
28881
28790
  class PerMessageDeflate {
28882
- constructor(options, isServer, maxPayload) {
28883
- this._maxPayload = maxPayload | 0;
28791
+ constructor(options) {
28884
28792
  this._options = options || {};
28885
28793
  this._threshold = this._options.threshold !== undefined ? this._options.threshold : 1024;
28886
- this._isServer = !!isServer;
28794
+ this._maxPayload = this._options.maxPayload | 0;
28795
+ this._isServer = !!this._options.isServer;
28887
28796
  this._deflate = null;
28888
28797
  this._inflate = null;
28889
28798
  this.params = null;
@@ -28935,7 +28844,7 @@ var require_permessage_deflate = __commonJS(function(exports, module) {
28935
28844
  acceptAsServer(offers) {
28936
28845
  const opts = this._options;
28937
28846
  const accepted = offers.find((params) => {
28938
- if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params.client_max_window_bits) {
28847
+ if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && (typeof params.client_max_window_bits === "number" ? opts.clientMaxWindowBits > params.client_max_window_bits : !params.client_max_window_bits)) {
28939
28848
  return false;
28940
28849
  }
28941
28850
  return true;
@@ -29118,6 +29027,10 @@ var require_permessage_deflate = __commonJS(function(exports, module) {
29118
29027
  }
29119
29028
  function inflateOnError(err) {
29120
29029
  this[kPerMessageDeflate]._inflate = null;
29030
+ if (this[kError]) {
29031
+ this[kCallback](this[kError]);
29032
+ return;
29033
+ }
29121
29034
  err[kStatusCode] = 1007;
29122
29035
  this[kCallback](err);
29123
29036
  }
@@ -29338,6 +29251,8 @@ var require_receiver = __commonJS(function(exports, module) {
29338
29251
  this._binaryType = options.binaryType || BINARY_TYPES[0];
29339
29252
  this._extensions = options.extensions || {};
29340
29253
  this._isServer = !!options.isServer;
29254
+ this._maxBufferedChunks = options.maxBufferedChunks | 0;
29255
+ this._maxFragments = options.maxFragments | 0;
29341
29256
  this._maxPayload = options.maxPayload | 0;
29342
29257
  this._skipUTF8Validation = !!options.skipUTF8Validation;
29343
29258
  this[kWebSocket] = undefined;
@@ -29352,6 +29267,7 @@ var require_receiver = __commonJS(function(exports, module) {
29352
29267
  this._opcode = 0;
29353
29268
  this._totalPayloadLength = 0;
29354
29269
  this._messageLength = 0;
29270
+ this._numFragments = 0;
29355
29271
  this._fragments = [];
29356
29272
  this._errored = false;
29357
29273
  this._loop = false;
@@ -29360,6 +29276,10 @@ var require_receiver = __commonJS(function(exports, module) {
29360
29276
  _write(chunk, encoding, cb) {
29361
29277
  if (this._opcode === 8 && this._state == GET_INFO)
29362
29278
  return cb();
29279
+ if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
29280
+ cb(this.createError(RangeError, "Too many buffered chunks", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS"));
29281
+ return;
29282
+ }
29363
29283
  this._bufferedBytes += chunk.length;
29364
29284
  this._buffers.push(chunk);
29365
29285
  this.startLoop(cb);
@@ -29557,6 +29477,11 @@ var require_receiver = __commonJS(function(exports, module) {
29557
29477
  this.controlMessage(data, cb);
29558
29478
  return;
29559
29479
  }
29480
+ if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) {
29481
+ const error = this.createError(RangeError, "Too many message fragments", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS");
29482
+ cb(error);
29483
+ return;
29484
+ }
29560
29485
  if (this._compressed) {
29561
29486
  this._state = INFLATING;
29562
29487
  this.decompress(data, cb);
@@ -29597,6 +29522,7 @@ var require_receiver = __commonJS(function(exports, module) {
29597
29522
  this._totalPayloadLength = 0;
29598
29523
  this._messageLength = 0;
29599
29524
  this._fragmented = 0;
29525
+ this._numFragments = 0;
29600
29526
  this._fragments = [];
29601
29527
  if (this._opcode === 2) {
29602
29528
  let data;
@@ -29695,6 +29621,9 @@ var require_receiver = __commonJS(function(exports, module) {
29695
29621
  var require_sender = __commonJS(function(exports, module) {
29696
29622
  var { Duplex } = __require("stream");
29697
29623
  var { randomFillSync } = __require("crypto");
29624
+ var {
29625
+ types: { isUint8Array }
29626
+ } = __require("util");
29698
29627
  var PerMessageDeflate = require_permessage_deflate();
29699
29628
  var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
29700
29629
  var { isBlob, isValidStatusCode } = require_validation();
@@ -29814,8 +29743,10 @@ var require_sender = __commonJS(function(exports, module) {
29814
29743
  buf.writeUInt16BE(code, 0);
29815
29744
  if (typeof data === "string") {
29816
29745
  buf.write(data, 2);
29817
- } else {
29746
+ } else if (isUint8Array(data)) {
29818
29747
  buf.set(data, 2);
29748
+ } else {
29749
+ throw new TypeError("Second argument must be a string or a Uint8Array");
29819
29750
  }
29820
29751
  }
29821
29752
  const options = {
@@ -30377,6 +30308,7 @@ var require_websocket = __commonJS(function(exports, module) {
30377
30308
  var { isBlob } = require_validation();
30378
30309
  var {
30379
30310
  BINARY_TYPES,
30311
+ CLOSE_TIMEOUT,
30380
30312
  EMPTY_BUFFER,
30381
30313
  GUID,
30382
30314
  kForOnEventAttribute,
@@ -30390,7 +30322,6 @@ var require_websocket = __commonJS(function(exports, module) {
30390
30322
  } = require_event_target();
30391
30323
  var { format, parse } = require_extension();
30392
30324
  var { toBuffer } = require_buffer_util();
30393
- var closeTimeout = 30 * 1000;
30394
30325
  var kAborted = Symbol("kAborted");
30395
30326
  var protocolVersions = [8, 13];
30396
30327
  var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
@@ -30430,6 +30361,7 @@ var require_websocket = __commonJS(function(exports, module) {
30430
30361
  initAsClient(this, address, protocols, options);
30431
30362
  } else {
30432
30363
  this._autoPong = options.autoPong;
30364
+ this._closeTimeout = options.closeTimeout;
30433
30365
  this._isServer = true;
30434
30366
  }
30435
30367
  }
@@ -30481,6 +30413,8 @@ var require_websocket = __commonJS(function(exports, module) {
30481
30413
  binaryType: this.binaryType,
30482
30414
  extensions: this._extensions,
30483
30415
  isServer: this._isServer,
30416
+ maxBufferedChunks: options.maxBufferedChunks,
30417
+ maxFragments: options.maxFragments,
30484
30418
  maxPayload: options.maxPayload,
30485
30419
  skipUTF8Validation: options.skipUTF8Validation
30486
30420
  });
@@ -30721,7 +30655,10 @@ var require_websocket = __commonJS(function(exports, module) {
30721
30655
  const opts = {
30722
30656
  allowSynchronousEvents: true,
30723
30657
  autoPong: true,
30658
+ closeTimeout: CLOSE_TIMEOUT,
30724
30659
  protocolVersion: protocolVersions[1],
30660
+ maxBufferedChunks: 256 * 1024,
30661
+ maxFragments: 16 * 1024,
30725
30662
  maxPayload: 100 * 1024 * 1024,
30726
30663
  skipUTF8Validation: false,
30727
30664
  perMessageDeflate: true,
@@ -30738,6 +30675,7 @@ var require_websocket = __commonJS(function(exports, module) {
30738
30675
  port: undefined
30739
30676
  };
30740
30677
  websocket._autoPong = opts.autoPong;
30678
+ websocket._closeTimeout = opts.closeTimeout;
30741
30679
  if (!protocolVersions.includes(opts.protocolVersion)) {
30742
30680
  throw new RangeError(`Unsupported protocol version: ${opts.protocolVersion} ` + `(supported versions: ${protocolVersions.join(", ")})`);
30743
30681
  }
@@ -30747,7 +30685,7 @@ var require_websocket = __commonJS(function(exports, module) {
30747
30685
  } else {
30748
30686
  try {
30749
30687
  parsedUrl = new URL2(address);
30750
- } catch (e) {
30688
+ } catch {
30751
30689
  throw new SyntaxError(`Invalid URL: ${address}`);
30752
30690
  }
30753
30691
  }
@@ -30761,7 +30699,7 @@ var require_websocket = __commonJS(function(exports, module) {
30761
30699
  const isIpcUrl = parsedUrl.protocol === "ws+unix:";
30762
30700
  let invalidUrlMessage;
30763
30701
  if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) {
30764
- invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", ` + '"http:", "https", or "ws+unix:"';
30702
+ invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", ` + '"http:", "https:", or "ws+unix:"';
30765
30703
  } else if (isIpcUrl && !parsedUrl.pathname) {
30766
30704
  invalidUrlMessage = "The URL's pathname is empty";
30767
30705
  } else if (parsedUrl.hash) {
@@ -30795,7 +30733,11 @@ var require_websocket = __commonJS(function(exports, module) {
30795
30733
  opts.path = parsedUrl.pathname + parsedUrl.search;
30796
30734
  opts.timeout = opts.handshakeTimeout;
30797
30735
  if (opts.perMessageDeflate) {
30798
- perMessageDeflate = new PerMessageDeflate(opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, false, opts.maxPayload);
30736
+ perMessageDeflate = new PerMessageDeflate({
30737
+ ...opts.perMessageDeflate,
30738
+ isServer: false,
30739
+ maxPayload: opts.maxPayload
30740
+ });
30799
30741
  opts.headers["Sec-WebSocket-Extensions"] = format({
30800
30742
  [PerMessageDeflate.extensionName]: perMessageDeflate.offer()
30801
30743
  });
@@ -30955,6 +30897,8 @@ var require_websocket = __commonJS(function(exports, module) {
30955
30897
  websocket.setSocket(socket, head, {
30956
30898
  allowSynchronousEvents: opts.allowSynchronousEvents,
30957
30899
  generateMask: opts.generateMask,
30900
+ maxBufferedChunks: opts.maxBufferedChunks,
30901
+ maxFragments: opts.maxFragments,
30958
30902
  maxPayload: opts.maxPayload,
30959
30903
  skipUTF8Validation: opts.skipUTF8Validation
30960
30904
  });
@@ -31076,7 +31020,7 @@ var require_websocket = __commonJS(function(exports, module) {
31076
31020
  }
31077
31021
  }
31078
31022
  function setCloseTimer(websocket) {
31079
- websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket), closeTimeout);
31023
+ websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket), websocket._closeTimeout);
31080
31024
  }
31081
31025
  function socketOnClose() {
31082
31026
  const websocket = this[kWebSocket];
@@ -31084,8 +31028,8 @@ var require_websocket = __commonJS(function(exports, module) {
31084
31028
  this.removeListener("data", socketOnData);
31085
31029
  this.removeListener("end", socketOnEnd);
31086
31030
  websocket._readyState = WebSocket.CLOSING;
31087
- let chunk;
31088
- if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && (chunk = websocket._socket.read()) !== null) {
31031
+ if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
31032
+ const chunk = this.read(this._readableState.length);
31089
31033
  websocket._receiver.write(chunk);
31090
31034
  }
31091
31035
  websocket._receiver.end();
@@ -31120,6 +31064,109 @@ var require_websocket = __commonJS(function(exports, module) {
31120
31064
  }
31121
31065
  });
31122
31066
 
31067
+ // node_modules/ws/lib/stream.js
31068
+ var require_stream = __commonJS(function(exports, module) {
31069
+ var WebSocket = require_websocket();
31070
+ var { Duplex } = __require("stream");
31071
+ function emitClose(stream) {
31072
+ stream.emit("close");
31073
+ }
31074
+ function duplexOnEnd() {
31075
+ if (!this.destroyed && this._writableState.finished) {
31076
+ this.destroy();
31077
+ }
31078
+ }
31079
+ function duplexOnError(err) {
31080
+ this.removeListener("error", duplexOnError);
31081
+ this.destroy();
31082
+ if (this.listenerCount("error") === 0) {
31083
+ this.emit("error", err);
31084
+ }
31085
+ }
31086
+ function createWebSocketStream(ws, options) {
31087
+ let terminateOnDestroy = true;
31088
+ const duplex = new Duplex({
31089
+ ...options,
31090
+ autoDestroy: false,
31091
+ emitClose: false,
31092
+ objectMode: false,
31093
+ writableObjectMode: false
31094
+ });
31095
+ ws.on("message", function message(msg, isBinary) {
31096
+ const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
31097
+ if (!duplex.push(data))
31098
+ ws.pause();
31099
+ });
31100
+ ws.once("error", function error(err) {
31101
+ if (duplex.destroyed)
31102
+ return;
31103
+ terminateOnDestroy = false;
31104
+ duplex.destroy(err);
31105
+ });
31106
+ ws.once("close", function close() {
31107
+ if (duplex.destroyed)
31108
+ return;
31109
+ duplex.push(null);
31110
+ });
31111
+ duplex._destroy = function(err, callback) {
31112
+ if (ws.readyState === ws.CLOSED) {
31113
+ callback(err);
31114
+ process.nextTick(emitClose, duplex);
31115
+ return;
31116
+ }
31117
+ let called = false;
31118
+ ws.once("error", function error(err) {
31119
+ called = true;
31120
+ callback(err);
31121
+ });
31122
+ ws.once("close", function close() {
31123
+ if (!called)
31124
+ callback(err);
31125
+ process.nextTick(emitClose, duplex);
31126
+ });
31127
+ if (terminateOnDestroy)
31128
+ ws.terminate();
31129
+ };
31130
+ duplex._final = function(callback) {
31131
+ if (ws.readyState === ws.CONNECTING) {
31132
+ ws.once("open", function open() {
31133
+ duplex._final(callback);
31134
+ });
31135
+ return;
31136
+ }
31137
+ if (ws._socket === null)
31138
+ return;
31139
+ if (ws._socket._writableState.finished) {
31140
+ callback();
31141
+ if (duplex._readableState.endEmitted)
31142
+ duplex.destroy();
31143
+ } else {
31144
+ ws._socket.once("finish", function finish() {
31145
+ callback();
31146
+ });
31147
+ ws.close();
31148
+ }
31149
+ };
31150
+ duplex._read = function() {
31151
+ if (ws.isPaused)
31152
+ ws.resume();
31153
+ };
31154
+ duplex._write = function(chunk, encoding, callback) {
31155
+ if (ws.readyState === ws.CONNECTING) {
31156
+ ws.once("open", function open() {
31157
+ duplex._write(chunk, encoding, callback);
31158
+ });
31159
+ return;
31160
+ }
31161
+ ws.send(chunk, callback);
31162
+ };
31163
+ duplex.on("end", duplexOnEnd);
31164
+ duplex.on("error", duplexOnError);
31165
+ return duplex;
31166
+ }
31167
+ module.exports = createWebSocketStream;
31168
+ });
31169
+
31123
31170
  // node_modules/ws/lib/subprotocol.js
31124
31171
  var require_subprotocol = __commonJS(function(exports, module) {
31125
31172
  var { tokenChars } = require_validation();
@@ -31175,7 +31222,7 @@ var require_websocket_server = __commonJS(function(exports, module) {
31175
31222
  var PerMessageDeflate = require_permessage_deflate();
31176
31223
  var subprotocol = require_subprotocol();
31177
31224
  var WebSocket = require_websocket();
31178
- var { GUID, kWebSocket } = require_constants();
31225
+ var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants();
31179
31226
  var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
31180
31227
  var RUNNING = 0;
31181
31228
  var CLOSING = 1;
@@ -31187,11 +31234,14 @@ var require_websocket_server = __commonJS(function(exports, module) {
31187
31234
  options = {
31188
31235
  allowSynchronousEvents: true,
31189
31236
  autoPong: true,
31237
+ maxBufferedChunks: 256 * 1024,
31238
+ maxFragments: 16 * 1024,
31190
31239
  maxPayload: 100 * 1024 * 1024,
31191
31240
  skipUTF8Validation: false,
31192
31241
  perMessageDeflate: false,
31193
31242
  handleProtocols: null,
31194
31243
  clientTracking: true,
31244
+ closeTimeout: CLOSE_TIMEOUT,
31195
31245
  verifyClient: null,
31196
31246
  noServer: false,
31197
31247
  backlog: null,
@@ -31312,9 +31362,11 @@ var require_websocket_server = __commonJS(function(exports, module) {
31312
31362
  abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
31313
31363
  return;
31314
31364
  }
31315
- if (version !== 8 && version !== 13) {
31365
+ if (version !== 13 && version !== 8) {
31316
31366
  const message = "Missing or invalid Sec-WebSocket-Version header";
31317
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
31367
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
31368
+ "Sec-WebSocket-Version": "13, 8"
31369
+ });
31318
31370
  return;
31319
31371
  }
31320
31372
  if (!this.shouldHandle(req)) {
@@ -31335,7 +31387,11 @@ var require_websocket_server = __commonJS(function(exports, module) {
31335
31387
  const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
31336
31388
  const extensions = {};
31337
31389
  if (this.options.perMessageDeflate && secWebSocketExtensions !== undefined) {
31338
- const perMessageDeflate = new PerMessageDeflate(this.options.perMessageDeflate, true, this.options.maxPayload);
31390
+ const perMessageDeflate = new PerMessageDeflate({
31391
+ ...this.options.perMessageDeflate,
31392
+ isServer: true,
31393
+ maxPayload: this.options.maxPayload
31394
+ });
31339
31395
  try {
31340
31396
  const offers = extension.parse(secWebSocketExtensions);
31341
31397
  if (offers[PerMessageDeflate.extensionName]) {
@@ -31406,6 +31462,8 @@ var require_websocket_server = __commonJS(function(exports, module) {
31406
31462
  socket.removeListener("error", socketOnError);
31407
31463
  ws.setSocket(socket, head, {
31408
31464
  allowSynchronousEvents: this.options.allowSynchronousEvents,
31465
+ maxBufferedChunks: this.options.maxBufferedChunks,
31466
+ maxFragments: this.options.maxFragments,
31409
31467
  maxPayload: this.options.maxPayload,
31410
31468
  skipUTF8Validation: this.options.skipUTF8Validation
31411
31469
  });
@@ -31453,23 +31511,26 @@ var require_websocket_server = __commonJS(function(exports, module) {
31453
31511
  \r
31454
31512
  ` + message);
31455
31513
  }
31456
- function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
31514
+ function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
31457
31515
  if (server.listenerCount("wsClientError")) {
31458
31516
  const err = new Error(message);
31459
31517
  Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
31460
31518
  server.emit("wsClientError", err, socket, req);
31461
31519
  } else {
31462
- abortHandshake(socket, code, message);
31520
+ abortHandshake(socket, code, message, headers);
31463
31521
  }
31464
31522
  }
31465
31523
  });
31466
31524
 
31467
31525
  // node_modules/ws/wrapper.mjs
31468
- var import_stream, import_receiver, import_sender, import_websocket, import_websocket_server;
31526
+ var import_stream, import_extension, import_permessage_deflate, import_receiver, import_sender, import_subprotocol, import_websocket, import_websocket_server;
31469
31527
  var init_wrapper = __esm(() => {
31470
31528
  import_stream = __toESM(require_stream(), 1);
31529
+ import_extension = __toESM(require_extension(), 1);
31530
+ import_permessage_deflate = __toESM(require_permessage_deflate(), 1);
31471
31531
  import_receiver = __toESM(require_receiver(), 1);
31472
31532
  import_sender = __toESM(require_sender(), 1);
31533
+ import_subprotocol = __toESM(require_subprotocol(), 1);
31473
31534
  import_websocket = __toESM(require_websocket(), 1);
31474
31535
  import_websocket_server = __toESM(require_websocket_server(), 1);
31475
31536
  });
@@ -34108,7 +34169,7 @@ function cacheDir() {
34108
34169
  return path5.join(os3.tmpdir(), "windmill");
34109
34170
  }
34110
34171
  }
34111
- var FALLBACK_VERSION = "0.28.0", cached, inFlight, extractCounter = 0;
34172
+ var FALLBACK_VERSION = "0.28.2", cached, inFlight, extractCounter = 0;
34112
34173
  var init_esbuild_loader = __esm(() => {
34113
34174
  init_tar_stream();
34114
34175
  init_log();
@@ -48317,265 +48378,518 @@ var require_data = __commonJS(function(exports, module) {
48317
48378
  };
48318
48379
  });
48319
48380
 
48320
- // ../windmill-yaml-validator/node_modules/fast-uri/lib/scopedChars.js
48321
- var require_scopedChars = __commonJS(function(exports, module) {
48322
- var HEX = {
48323
- 0: 0,
48324
- 1: 1,
48325
- 2: 2,
48326
- 3: 3,
48327
- 4: 4,
48328
- 5: 5,
48329
- 6: 6,
48330
- 7: 7,
48331
- 8: 8,
48332
- 9: 9,
48333
- a: 10,
48334
- A: 10,
48335
- b: 11,
48336
- B: 11,
48337
- c: 12,
48338
- C: 12,
48339
- d: 13,
48340
- D: 13,
48341
- e: 14,
48342
- E: 14,
48343
- f: 15,
48344
- F: 15
48345
- };
48346
- module.exports = {
48347
- HEX
48348
- };
48349
- });
48350
-
48351
48381
  // ../windmill-yaml-validator/node_modules/fast-uri/lib/utils.js
48352
48382
  var require_utils2 = __commonJS(function(exports, module) {
48353
- var { HEX } = require_scopedChars();
48354
- var IPV4_REG = /^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;
48355
- function normalizeIPv4(host) {
48356
- if (findToken(host, ".") < 3) {
48357
- return { host, isIPV4: false };
48358
- }
48359
- const matches = host.match(IPV4_REG) || [];
48360
- const [address] = matches;
48361
- if (address) {
48362
- return { host: stripLeadingZeros(address, "."), isIPV4: true };
48363
- } else {
48364
- return { host, isIPV4: false };
48383
+ var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
48384
+ var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
48385
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
48386
+ var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
48387
+ var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
48388
+ var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
48389
+ var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
48390
+ var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
48391
+ var BYTE_HEX = new Array(256);
48392
+ {
48393
+ const HEX_DIGITS = "0123456789ABCDEF";
48394
+ for (let i = 0;i < 256; i++) {
48395
+ BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
48365
48396
  }
48366
48397
  }
48367
- function stringArrayToHexStripped(input, keepZero = false) {
48398
+ function percentEncodeNonAscii(cp) {
48399
+ if (cp < 2048) {
48400
+ return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
48401
+ }
48402
+ if (cp < 65536) {
48403
+ return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
48404
+ }
48405
+ return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
48406
+ }
48407
+ function stringArrayToHexStripped(input) {
48368
48408
  let acc = "";
48369
- let strip = true;
48370
- for (const c of input) {
48371
- if (HEX[c] === undefined)
48372
- return;
48373
- if (c !== "0" && strip === true)
48374
- strip = false;
48375
- if (!strip)
48376
- acc += c;
48409
+ let code = 0;
48410
+ let i = 0;
48411
+ for (i = 0;i < input.length; i++) {
48412
+ code = input[i].charCodeAt(0);
48413
+ if (code === 48) {
48414
+ continue;
48415
+ }
48416
+ if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {
48417
+ return "";
48418
+ }
48419
+ acc += input[i];
48420
+ break;
48421
+ }
48422
+ for (i += 1;i < input.length; i++) {
48423
+ code = input[i].charCodeAt(0);
48424
+ if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {
48425
+ return "";
48426
+ }
48427
+ acc += input[i];
48377
48428
  }
48378
- if (keepZero && acc.length === 0)
48379
- acc = "0";
48380
48429
  return acc;
48381
48430
  }
48382
- function getIPV6(input) {
48383
- let tokenCount = 0;
48384
- const output = { error: false, address: "", zone: "" };
48385
- const address = [];
48386
- const buffer = [];
48387
- let isZone = false;
48388
- let endipv6Encountered = false;
48389
- let endIpv6 = false;
48390
- function consume() {
48391
- if (buffer.length) {
48392
- if (isZone === false) {
48393
- const hex = stringArrayToHexStripped(buffer);
48394
- if (hex !== undefined) {
48395
- address.push(hex);
48396
- } else {
48397
- output.error = true;
48398
- return false;
48399
- }
48431
+ var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
48432
+ var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
48433
+ var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
48434
+ var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
48435
+ function isZoneIdentifier(zone) {
48436
+ if (zone.length === 0)
48437
+ return false;
48438
+ for (let i = 0;i < zone.length; i++) {
48439
+ if (isZoneCharacter(zone[i]))
48440
+ continue;
48441
+ if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
48442
+ i += 2;
48443
+ continue;
48444
+ }
48445
+ return false;
48446
+ }
48447
+ return true;
48448
+ }
48449
+ function compressIPv6ZeroRun(hextets) {
48450
+ let bestStart = -1;
48451
+ let bestLength = 0;
48452
+ let runStart = -1;
48453
+ let runLength = 0;
48454
+ for (let i = 0;i < hextets.length; i++) {
48455
+ if (hextets[i] === "0") {
48456
+ if (runStart === -1)
48457
+ runStart = i;
48458
+ runLength++;
48459
+ if (runLength > bestLength) {
48460
+ bestLength = runLength;
48461
+ bestStart = runStart;
48400
48462
  }
48401
- buffer.length = 0;
48463
+ } else {
48464
+ runStart = -1;
48465
+ runLength = 0;
48402
48466
  }
48403
- return true;
48404
48467
  }
48405
- for (let i = 0;i < input.length; i++) {
48406
- const cursor = input[i];
48407
- if (cursor === "[" || cursor === "]") {
48468
+ if (bestLength < 2)
48469
+ return hextets.join(":");
48470
+ const head = hextets.slice(0, bestStart).join(":");
48471
+ const tail = hextets.slice(bestStart + bestLength).join(":");
48472
+ return head + "::" + tail;
48473
+ }
48474
+ function normalizeIPv6Address(input) {
48475
+ const compression = input.indexOf("::");
48476
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1)
48477
+ return;
48478
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
48479
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
48480
+ if (compression !== -1) {
48481
+ if (left.length === 1 && left[0] === "")
48482
+ left.length = 0;
48483
+ if (right.length === 1 && right[0] === "")
48484
+ right.length = 0;
48485
+ }
48486
+ const parts = left.concat(right);
48487
+ let hextetCount = 0;
48488
+ for (let i = 0;i < parts.length; i++) {
48489
+ const part = parts[i];
48490
+ if (part === "")
48491
+ return;
48492
+ if (part.indexOf(".") !== -1) {
48493
+ if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part))
48494
+ return;
48495
+ hextetCount += 2;
48408
48496
  continue;
48409
48497
  }
48410
- if (cursor === ":") {
48411
- if (endipv6Encountered === true) {
48412
- endIpv6 = true;
48413
- }
48414
- if (!consume()) {
48498
+ if (!isHextet(part))
48499
+ return;
48500
+ parts[i] = parseInt(part, 16).toString(16);
48501
+ hextetCount++;
48502
+ }
48503
+ if (compression === -1) {
48504
+ if (hextetCount !== 8)
48505
+ return;
48506
+ return compressIPv6ZeroRun(parts);
48507
+ }
48508
+ if (hextetCount >= 8)
48509
+ return;
48510
+ const expanded = parts.slice(0, left.length);
48511
+ for (let i = hextetCount;i < 8; i++)
48512
+ expanded.push("0");
48513
+ for (let i = left.length;i < parts.length; i++)
48514
+ expanded.push(parts[i]);
48515
+ return compressIPv6ZeroRun(expanded);
48516
+ }
48517
+ function normalizeIPv6(host) {
48518
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
48519
+ const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
48520
+ if (hasBracket && !bracketed)
48521
+ return { host, isIPV6: false, error: true };
48522
+ let input = bracketed ? host.slice(1, -1) : host;
48523
+ if (bracketed && isIPvFuture(input)) {
48524
+ input = input.toLowerCase();
48525
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
48526
+ }
48527
+ if (findToken(input, ":") < 2) {
48528
+ return { host, isIPV6: false, error: bracketed };
48529
+ }
48530
+ let zoneIdentifier = "";
48531
+ const zoneSeparator = input.indexOf("%");
48532
+ if (zoneSeparator !== -1) {
48533
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
48534
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
48535
+ if (!isZoneIdentifier(zoneIdentifier))
48536
+ return { host, isIPV6: false, error: true };
48537
+ input = input.slice(0, zoneSeparator);
48538
+ }
48539
+ const address = normalizeIPv6Address(input);
48540
+ if (address === undefined)
48541
+ return { host, isIPV6: false, error: true };
48542
+ return {
48543
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
48544
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
48545
+ isIPV6: true
48546
+ };
48547
+ }
48548
+ function findToken(str, token) {
48549
+ let ind = 0;
48550
+ for (let i = 0;i < str.length; i++) {
48551
+ if (str[i] === token)
48552
+ ind++;
48553
+ }
48554
+ return ind;
48555
+ }
48556
+ function removeDotSegments(path) {
48557
+ let input = path;
48558
+ const output = [];
48559
+ let nextSlash = -1;
48560
+ let len = 0;
48561
+ while (len = input.length) {
48562
+ if (len === 1) {
48563
+ if (input === ".") {
48415
48564
  break;
48416
- }
48417
- tokenCount++;
48418
- address.push(":");
48419
- if (tokenCount > 7) {
48420
- output.error = true;
48565
+ } else if (input === "/") {
48566
+ output.push("/");
48567
+ break;
48568
+ } else {
48569
+ output.push(input);
48421
48570
  break;
48422
48571
  }
48423
- if (i - 1 >= 0 && input[i - 1] === ":") {
48424
- endipv6Encountered = true;
48572
+ } else if (len === 2) {
48573
+ if (input[0] === ".") {
48574
+ if (input[1] === ".") {
48575
+ break;
48576
+ } else if (input[1] === "/") {
48577
+ input = input.slice(2);
48578
+ continue;
48579
+ }
48580
+ } else if (input[0] === "/") {
48581
+ if (input[1] === "." || input[1] === "/") {
48582
+ output.push("/");
48583
+ break;
48584
+ }
48425
48585
  }
48426
- continue;
48427
- } else if (cursor === "%") {
48428
- if (!consume()) {
48586
+ } else if (len === 3) {
48587
+ if (input === "/..") {
48588
+ if (output.length !== 0) {
48589
+ output.pop();
48590
+ }
48591
+ output.push("/");
48429
48592
  break;
48430
48593
  }
48431
- isZone = true;
48594
+ }
48595
+ if (input[0] === ".") {
48596
+ if (input[1] === ".") {
48597
+ if (input[2] === "/") {
48598
+ input = input.slice(3);
48599
+ continue;
48600
+ }
48601
+ } else if (input[1] === "/") {
48602
+ input = input.slice(2);
48603
+ continue;
48604
+ }
48605
+ } else if (input[0] === "/") {
48606
+ if (input[1] === ".") {
48607
+ if (input[2] === "/") {
48608
+ input = input.slice(2);
48609
+ continue;
48610
+ } else if (input[2] === ".") {
48611
+ if (input[3] === "/") {
48612
+ input = input.slice(3);
48613
+ if (output.length !== 0) {
48614
+ output.pop();
48615
+ }
48616
+ continue;
48617
+ }
48618
+ }
48619
+ }
48620
+ }
48621
+ if ((nextSlash = input.indexOf("/", 1)) === -1) {
48622
+ output.push(input);
48623
+ break;
48432
48624
  } else {
48433
- buffer.push(cursor);
48434
- continue;
48625
+ output.push(input.slice(0, nextSlash));
48626
+ input = input.slice(nextSlash);
48435
48627
  }
48436
48628
  }
48437
- if (buffer.length) {
48438
- if (isZone) {
48439
- output.zone = buffer.join("");
48440
- } else if (endIpv6) {
48441
- address.push(buffer.join(""));
48442
- } else {
48443
- address.push(stringArrayToHexStripped(buffer));
48629
+ return output.join("");
48630
+ }
48631
+ var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
48632
+ var HOST_DELIM_RE = /[@/?#:]/g;
48633
+ var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
48634
+ function reescapeHostDelimiters(host, isIP) {
48635
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
48636
+ re.lastIndex = 0;
48637
+ return host.replace(re, (ch) => HOST_DELIMS[ch]);
48638
+ }
48639
+ function normalizePercentEncoding(input, decodeUnreserved = false) {
48640
+ if (input.indexOf("%") === -1) {
48641
+ return input;
48642
+ }
48643
+ let output = "";
48644
+ for (let i = 0;i < input.length; i++) {
48645
+ if (input[i] === "%" && i + 2 < input.length) {
48646
+ const hex = input.slice(i + 1, i + 3);
48647
+ if (isHexPair(hex)) {
48648
+ const normalizedHex = hex.toUpperCase();
48649
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
48650
+ if (decodeUnreserved && isUnreserved(decoded)) {
48651
+ output += decoded;
48652
+ } else {
48653
+ output += "%" + normalizedHex;
48654
+ }
48655
+ i += 2;
48656
+ continue;
48657
+ }
48444
48658
  }
48659
+ output += input[i];
48445
48660
  }
48446
- output.address = address.join("");
48447
48661
  return output;
48448
48662
  }
48449
- function normalizeIPv6(host) {
48450
- if (findToken(host, ":") < 2) {
48451
- return { host, isIPV6: false };
48452
- }
48453
- const ipv6 = getIPV6(host);
48454
- if (!ipv6.error) {
48455
- let newHost = ipv6.address;
48456
- let escapedHost = ipv6.address;
48457
- if (ipv6.zone) {
48458
- newHost += "%" + ipv6.zone;
48459
- escapedHost += "%25" + ipv6.zone;
48460
- }
48461
- return { host: newHost, escapedHost, isIPV6: true };
48462
- } else {
48463
- return { host, isIPV6: false };
48663
+ function normalizePathEncoding(input) {
48664
+ let output = "";
48665
+ for (let i = 0;i < input.length; i++) {
48666
+ const ch = input[i];
48667
+ if (ch === "%" && i + 2 < input.length) {
48668
+ const hex = input.slice(i + 1, i + 3);
48669
+ if (isHexPair(hex)) {
48670
+ const normalizedHex = hex.toUpperCase();
48671
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
48672
+ if (decoded !== "." && isUnreserved(decoded)) {
48673
+ output += decoded;
48674
+ } else {
48675
+ output += "%" + normalizedHex;
48676
+ }
48677
+ i += 2;
48678
+ continue;
48679
+ }
48680
+ }
48681
+ if (isPathCharacter(ch)) {
48682
+ output += ch;
48683
+ } else {
48684
+ const code = input.charCodeAt(i);
48685
+ if (code < 128) {
48686
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
48687
+ } else if (code < 55296 || code > 57343) {
48688
+ output += percentEncodeNonAscii(code);
48689
+ } else if (code <= 56319 && i + 1 < input.length) {
48690
+ const low = input.charCodeAt(i + 1);
48691
+ if (low >= 56320 && low <= 57343) {
48692
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
48693
+ i++;
48694
+ } else {
48695
+ output += percentEncodeNonAscii(65533);
48696
+ }
48697
+ } else {
48698
+ output += percentEncodeNonAscii(65533);
48699
+ }
48700
+ }
48464
48701
  }
48702
+ return output;
48465
48703
  }
48466
- function stripLeadingZeros(str, token) {
48467
- let out = "";
48468
- let skip = true;
48469
- const l = str.length;
48470
- for (let i = 0;i < l; i++) {
48471
- const c = str[i];
48472
- if (c === "0" && skip) {
48473
- if (i + 1 <= l && str[i + 1] === token || i + 1 === l) {
48474
- out += c;
48475
- skip = false;
48704
+ function serializePathEncoding(input, pathNoScheme = false) {
48705
+ let output = "";
48706
+ let firstSegment = pathNoScheme && input[0] !== "/";
48707
+ for (let i = 0;i < input.length; i++) {
48708
+ const ch = input[i];
48709
+ if (ch === "%" && i + 2 < input.length) {
48710
+ const hex = input.slice(i + 1, i + 3);
48711
+ if (isHexPair(hex)) {
48712
+ output += "%" + hex.toUpperCase();
48713
+ i += 2;
48714
+ continue;
48476
48715
  }
48716
+ }
48717
+ if (ch === "/") {
48718
+ firstSegment = false;
48719
+ }
48720
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
48721
+ output += ch;
48477
48722
  } else {
48478
- if (c === token) {
48479
- skip = true;
48723
+ const code = input.charCodeAt(i);
48724
+ if (code < 128) {
48725
+ output += BYTE_HEX[code];
48726
+ } else if (code < 55296 || code > 57343) {
48727
+ output += percentEncodeNonAscii(code);
48728
+ } else if (code <= 56319 && i + 1 < input.length) {
48729
+ const low = input.charCodeAt(i + 1);
48730
+ if (low >= 56320 && low <= 57343) {
48731
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
48732
+ i++;
48733
+ } else {
48734
+ output += percentEncodeNonAscii(65533);
48735
+ }
48480
48736
  } else {
48481
- skip = false;
48737
+ output += percentEncodeNonAscii(65533);
48482
48738
  }
48483
- out += c;
48484
48739
  }
48485
48740
  }
48486
- return out;
48741
+ return output;
48487
48742
  }
48488
- function findToken(str, token) {
48489
- let ind = 0;
48490
- for (let i = 0;i < str.length; i++) {
48491
- if (str[i] === token)
48492
- ind++;
48743
+ function encodeComponent(input, isAllowed) {
48744
+ let output = "";
48745
+ for (let i = 0;i < input.length; i++) {
48746
+ const ch = input[i];
48747
+ if (ch === "%" && i + 2 < input.length) {
48748
+ const hex = input.slice(i + 1, i + 3);
48749
+ if (isHexPair(hex)) {
48750
+ output += "%" + hex.toUpperCase();
48751
+ i += 2;
48752
+ continue;
48753
+ }
48754
+ }
48755
+ if (isAllowed(ch)) {
48756
+ output += ch;
48757
+ } else {
48758
+ const code = input.charCodeAt(i);
48759
+ if (code < 128) {
48760
+ output += BYTE_HEX[code];
48761
+ } else if (code < 55296 || code > 57343) {
48762
+ output += percentEncodeNonAscii(code);
48763
+ } else if (code <= 56319 && i + 1 < input.length) {
48764
+ const low = input.charCodeAt(i + 1);
48765
+ if (low >= 56320 && low <= 57343) {
48766
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
48767
+ i++;
48768
+ } else {
48769
+ output += percentEncodeNonAscii(65533);
48770
+ }
48771
+ } else {
48772
+ output += percentEncodeNonAscii(65533);
48773
+ }
48774
+ }
48493
48775
  }
48494
- return ind;
48776
+ return output;
48495
48777
  }
48496
- var RDS1 = /^\.\.?\//u;
48497
- var RDS2 = /^\/\.(?:\/|$)/u;
48498
- var RDS3 = /^\/\.\.(?:\/|$)/u;
48499
- var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u;
48500
- function removeDotSegments(input) {
48501
- const output = [];
48502
- while (input.length) {
48503
- if (input.match(RDS1)) {
48504
- input = input.replace(RDS1, "");
48505
- } else if (input.match(RDS2)) {
48506
- input = input.replace(RDS2, "/");
48507
- } else if (input.match(RDS3)) {
48508
- input = input.replace(RDS3, "/");
48509
- output.pop();
48510
- } else if (input === "." || input === "..") {
48511
- input = "";
48778
+ function encodeUserinfo(input) {
48779
+ return encodeComponent(input, isUserinfoCharacter);
48780
+ }
48781
+ function encodeQuery(input) {
48782
+ return encodeComponent(input, isQueryFragmentCharacter);
48783
+ }
48784
+ function encodeFragment(input) {
48785
+ return encodeComponent(input, isQueryFragmentCharacter);
48786
+ }
48787
+ function isEscapeSafe(cp) {
48788
+ return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95;
48789
+ }
48790
+ function normalizeQueryFragmentEncoding(input) {
48791
+ let output = "";
48792
+ for (let i = 0;i < input.length; i++) {
48793
+ const ch = input[i];
48794
+ if (ch === "%" && i + 2 < input.length) {
48795
+ const hex = input.slice(i + 1, i + 3);
48796
+ if (isHexPair(hex)) {
48797
+ const normalizedHex = hex.toUpperCase();
48798
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
48799
+ if (isUnreserved(decoded)) {
48800
+ output += decoded;
48801
+ } else {
48802
+ output += "%" + normalizedHex;
48803
+ }
48804
+ i += 2;
48805
+ continue;
48806
+ }
48807
+ }
48808
+ if (isQueryFragmentCharacter(ch)) {
48809
+ output += ch;
48512
48810
  } else {
48513
- const im = input.match(RDS5);
48514
- if (im) {
48515
- const s = im[0];
48516
- input = input.slice(s.length);
48517
- output.push(s);
48811
+ const code = input.charCodeAt(i);
48812
+ if (code < 128) {
48813
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
48814
+ } else if (code < 55296 || code > 57343) {
48815
+ output += percentEncodeNonAscii(code);
48816
+ } else if (code <= 56319 && i + 1 < input.length) {
48817
+ const low = input.charCodeAt(i + 1);
48818
+ if (low >= 56320 && low <= 57343) {
48819
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
48820
+ i++;
48821
+ } else {
48822
+ output += percentEncodeNonAscii(65533);
48823
+ }
48518
48824
  } else {
48519
- throw new Error("Unexpected dot segment condition");
48825
+ output += percentEncodeNonAscii(65533);
48520
48826
  }
48521
48827
  }
48522
48828
  }
48523
- return output.join("");
48829
+ return output;
48524
48830
  }
48525
- function normalizeComponentEncoding(components, esc) {
48526
- const func = esc !== true ? escape : unescape;
48527
- if (components.scheme !== undefined) {
48528
- components.scheme = func(components.scheme);
48529
- }
48530
- if (components.userinfo !== undefined) {
48531
- components.userinfo = func(components.userinfo);
48532
- }
48533
- if (components.host !== undefined) {
48534
- components.host = func(components.host);
48535
- }
48536
- if (components.path !== undefined) {
48537
- components.path = func(components.path);
48538
- }
48539
- if (components.query !== undefined) {
48540
- components.query = func(components.query);
48541
- }
48542
- if (components.fragment !== undefined) {
48543
- components.fragment = func(components.fragment);
48831
+ function escapePreservingEscapes(input) {
48832
+ let output = "";
48833
+ for (let i = 0;i < input.length; i++) {
48834
+ if (input[i] === "%" && i + 2 < input.length) {
48835
+ const hex = input.slice(i + 1, i + 3);
48836
+ if (isHexPair(hex)) {
48837
+ output += "%" + hex.toUpperCase();
48838
+ i += 2;
48839
+ continue;
48840
+ }
48841
+ }
48842
+ output += escape(input[i]);
48544
48843
  }
48545
- return components;
48844
+ return output;
48546
48845
  }
48547
- function recomposeAuthority(components) {
48846
+ function recomposeAuthority(component) {
48548
48847
  const uriTokens = [];
48549
- if (components.userinfo !== undefined) {
48550
- uriTokens.push(components.userinfo);
48848
+ if (component.userinfo !== undefined) {
48849
+ uriTokens.push(encodeUserinfo(component.userinfo));
48551
48850
  uriTokens.push("@");
48552
48851
  }
48553
- if (components.host !== undefined) {
48554
- let host = unescape(components.host);
48555
- const ipV4res = normalizeIPv4(host);
48556
- if (ipV4res.isIPV4) {
48557
- host = ipV4res.host;
48558
- } else {
48559
- const ipV6res = normalizeIPv6(ipV4res.host);
48560
- if (ipV6res.isIPV6 === true) {
48852
+ if (component.host !== undefined) {
48853
+ let host = component.host;
48854
+ if (!isIPv4(host)) {
48855
+ let ipV6res = normalizeIPv6(host);
48856
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
48857
+ host = normalizePercentEncoding(host, true);
48858
+ ipV6res = normalizeIPv6(host);
48859
+ }
48860
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
48561
48861
  host = `[${ipV6res.escapedHost}]`;
48562
48862
  } else {
48563
- host = components.host;
48863
+ host = reescapeHostDelimiters(host, false);
48564
48864
  }
48565
48865
  }
48566
48866
  uriTokens.push(host);
48567
48867
  }
48568
- if (typeof components.port === "number" || typeof components.port === "string") {
48868
+ if (typeof component.port === "number" || typeof component.port === "string") {
48869
+ const port = String(component.port);
48870
+ if (!isPort(port)) {
48871
+ throw new TypeError("URI port is malformed.");
48872
+ }
48569
48873
  uriTokens.push(":");
48570
- uriTokens.push(String(components.port));
48874
+ uriTokens.push(port);
48571
48875
  }
48572
48876
  return uriTokens.length ? uriTokens.join("") : undefined;
48573
48877
  }
48574
48878
  module.exports = {
48879
+ nonSimpleDomain,
48575
48880
  recomposeAuthority,
48576
- normalizeComponentEncoding,
48881
+ reescapeHostDelimiters,
48882
+ normalizePercentEncoding,
48883
+ normalizePathEncoding,
48884
+ serializePathEncoding,
48885
+ normalizeQueryFragmentEncoding,
48886
+ encodeUserinfo,
48887
+ encodeQuery,
48888
+ encodeFragment,
48889
+ escapePreservingEscapes,
48577
48890
  removeDotSegments,
48578
- normalizeIPv4,
48891
+ isIPv4,
48892
+ isUUID,
48579
48893
  normalizeIPv6,
48580
48894
  stringArrayToHexStripped
48581
48895
  };
@@ -48583,99 +48897,122 @@ var require_utils2 = __commonJS(function(exports, module) {
48583
48897
 
48584
48898
  // ../windmill-yaml-validator/node_modules/fast-uri/lib/schemes.js
48585
48899
  var require_schemes = __commonJS(function(exports, module) {
48586
- var UUID_REG = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;
48587
- var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
48588
- function isSecure(wsComponents) {
48589
- return typeof wsComponents.secure === "boolean" ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
48590
- }
48591
- function httpParse(components) {
48592
- if (!components.host) {
48593
- components.error = components.error || "HTTP URIs must have a host.";
48594
- }
48595
- return components;
48596
- }
48597
- function httpSerialize(components) {
48598
- const secure = String(components.scheme).toLowerCase() === "https";
48599
- if (components.port === (secure ? 443 : 80) || components.port === "") {
48600
- components.port = undefined;
48601
- }
48602
- if (!components.path) {
48603
- components.path = "/";
48604
- }
48605
- return components;
48606
- }
48607
- function wsParse(wsComponents) {
48608
- wsComponents.secure = isSecure(wsComponents);
48609
- wsComponents.resourceName = (wsComponents.path || "/") + (wsComponents.query ? "?" + wsComponents.query : "");
48610
- wsComponents.path = undefined;
48611
- wsComponents.query = undefined;
48612
- return wsComponents;
48900
+ var { isUUID } = require_utils2();
48901
+ var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
48902
+ var supportedSchemeNames = [
48903
+ "http",
48904
+ "https",
48905
+ "ws",
48906
+ "wss",
48907
+ "urn",
48908
+ "urn:uuid"
48909
+ ];
48910
+ function isValidSchemeName(name) {
48911
+ return supportedSchemeNames.indexOf(name) !== -1;
48613
48912
  }
48614
- function wsSerialize(wsComponents) {
48615
- if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
48616
- wsComponents.port = undefined;
48617
- }
48618
- if (typeof wsComponents.secure === "boolean") {
48619
- wsComponents.scheme = wsComponents.secure ? "wss" : "ws";
48620
- wsComponents.secure = undefined;
48621
- }
48622
- if (wsComponents.resourceName) {
48623
- const [path, query] = wsComponents.resourceName.split("?");
48624
- wsComponents.path = path && path !== "/" ? path : undefined;
48625
- wsComponents.query = query;
48626
- wsComponents.resourceName = undefined;
48913
+ function wsIsSecure(wsComponent) {
48914
+ if (wsComponent.secure === true) {
48915
+ return true;
48916
+ } else if (wsComponent.secure === false) {
48917
+ return false;
48918
+ } else if (wsComponent.scheme) {
48919
+ return wsComponent.scheme.length === 3 && (wsComponent.scheme[0] === "w" || wsComponent.scheme[0] === "W") && (wsComponent.scheme[1] === "s" || wsComponent.scheme[1] === "S") && (wsComponent.scheme[2] === "s" || wsComponent.scheme[2] === "S");
48920
+ } else {
48921
+ return false;
48627
48922
  }
48628
- wsComponents.fragment = undefined;
48629
- return wsComponents;
48630
48923
  }
48631
- function urnParse(urnComponents, options) {
48632
- if (!urnComponents.path) {
48633
- urnComponents.error = "URN can not be parsed";
48634
- return urnComponents;
48635
- }
48636
- const matches = urnComponents.path.match(URN_REG);
48637
- if (matches) {
48638
- const scheme = options.scheme || urnComponents.scheme || "urn";
48639
- urnComponents.nid = matches[1].toLowerCase();
48640
- urnComponents.nss = matches[2];
48641
- const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`;
48642
- const schemeHandler = SCHEMES[urnScheme];
48643
- urnComponents.path = undefined;
48924
+ function httpParse(component) {
48925
+ if (!component.host) {
48926
+ component.error = component.error || "HTTP URIs must have a host.";
48927
+ }
48928
+ return component;
48929
+ }
48930
+ function httpSerialize(component) {
48931
+ const secure = String(component.scheme).toLowerCase() === "https";
48932
+ if (component.port === (secure ? 443 : 80) || component.port === "") {
48933
+ component.port = undefined;
48934
+ }
48935
+ if (!component.path) {
48936
+ component.path = "/";
48937
+ }
48938
+ return component;
48939
+ }
48940
+ function wsParse(wsComponent) {
48941
+ wsComponent.secure = wsIsSecure(wsComponent);
48942
+ wsComponent.resourceName = (wsComponent.path || "/") + (wsComponent.query ? "?" + wsComponent.query : "");
48943
+ wsComponent.path = undefined;
48944
+ wsComponent.query = undefined;
48945
+ return wsComponent;
48946
+ }
48947
+ function wsSerialize(wsComponent) {
48948
+ if (wsComponent.port === (wsIsSecure(wsComponent) ? 443 : 80) || wsComponent.port === "") {
48949
+ wsComponent.port = undefined;
48950
+ }
48951
+ if (typeof wsComponent.secure === "boolean") {
48952
+ wsComponent.scheme = wsComponent.secure ? "wss" : "ws";
48953
+ wsComponent.secure = undefined;
48954
+ }
48955
+ if (wsComponent.resourceName) {
48956
+ const queryIndex = wsComponent.resourceName.indexOf("?");
48957
+ const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
48958
+ wsComponent.path = path && path !== "/" ? path : undefined;
48959
+ wsComponent.query = queryIndex === -1 ? undefined : wsComponent.resourceName.slice(queryIndex + 1);
48960
+ wsComponent.resourceName = undefined;
48961
+ }
48962
+ wsComponent.fragment = undefined;
48963
+ return wsComponent;
48964
+ }
48965
+ function urnParse(urnComponent, options) {
48966
+ if (!urnComponent.path) {
48967
+ urnComponent.error = "URN can not be parsed";
48968
+ return urnComponent;
48969
+ }
48970
+ const matches = urnComponent.path.match(URN_REG);
48971
+ if (matches && matches[0] === urnComponent.path) {
48972
+ const scheme = options.scheme || urnComponent.scheme || "urn";
48973
+ urnComponent.nid = matches[1].toLowerCase();
48974
+ urnComponent.nss = matches[2];
48975
+ const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`;
48976
+ const schemeHandler = getSchemeHandler(urnScheme);
48977
+ urnComponent.path = undefined;
48644
48978
  if (schemeHandler) {
48645
- urnComponents = schemeHandler.parse(urnComponents, options);
48979
+ urnComponent = schemeHandler.parse(urnComponent, options);
48646
48980
  }
48647
48981
  } else {
48648
- urnComponents.error = urnComponents.error || "URN can not be parsed.";
48982
+ urnComponent.error = urnComponent.error || "URN can not be parsed.";
48649
48983
  }
48650
- return urnComponents;
48984
+ return urnComponent;
48651
48985
  }
48652
- function urnSerialize(urnComponents, options) {
48653
- const scheme = options.scheme || urnComponents.scheme || "urn";
48654
- const nid = urnComponents.nid.toLowerCase();
48986
+ function urnSerialize(urnComponent, options) {
48987
+ if (urnComponent.nid === undefined) {
48988
+ throw new Error("URN without nid cannot be serialized");
48989
+ }
48990
+ const scheme = options.scheme || urnComponent.scheme || "urn";
48991
+ const nid = urnComponent.nid.toLowerCase();
48655
48992
  const urnScheme = `${scheme}:${options.nid || nid}`;
48656
- const schemeHandler = SCHEMES[urnScheme];
48993
+ const schemeHandler = getSchemeHandler(urnScheme);
48657
48994
  if (schemeHandler) {
48658
- urnComponents = schemeHandler.serialize(urnComponents, options);
48995
+ urnComponent = schemeHandler.serialize(urnComponent, options);
48659
48996
  }
48660
- const uriComponents = urnComponents;
48661
- const nss = urnComponents.nss;
48662
- uriComponents.path = `${nid || options.nid}:${nss}`;
48997
+ const uriComponent = urnComponent;
48998
+ const nss = urnComponent.nss;
48999
+ uriComponent.path = `${nid || options.nid}:${nss}`;
48663
49000
  options.skipEscape = true;
48664
- return uriComponents;
49001
+ return uriComponent;
48665
49002
  }
48666
- function urnuuidParse(urnComponents, options) {
48667
- const uuidComponents = urnComponents;
48668
- uuidComponents.uuid = uuidComponents.nss;
48669
- uuidComponents.nss = undefined;
48670
- if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
48671
- uuidComponents.error = uuidComponents.error || "UUID is not valid.";
49003
+ function urnuuidParse(urnComponent, options) {
49004
+ const uuidComponent = urnComponent;
49005
+ uuidComponent.uuid = uuidComponent.nss;
49006
+ uuidComponent.nss = undefined;
49007
+ if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) {
49008
+ uuidComponent.error = uuidComponent.error || "UUID is not valid.";
48672
49009
  }
48673
- return uuidComponents;
49010
+ return uuidComponent;
48674
49011
  }
48675
- function urnuuidSerialize(uuidComponents) {
48676
- const urnComponents = uuidComponents;
48677
- urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
48678
- return urnComponents;
49012
+ function urnuuidSerialize(uuidComponent) {
49013
+ const urnComponent = uuidComponent;
49014
+ urnComponent.nss = (uuidComponent.uuid || "").toLowerCase();
49015
+ return urnComponent;
48679
49016
  }
48680
49017
  var http = {
48681
49018
  scheme: "http",
@@ -48721,27 +49058,73 @@ var require_schemes = __commonJS(function(exports, module) {
48721
49058
  urn,
48722
49059
  "urn:uuid": urnuuid
48723
49060
  };
48724
- module.exports = SCHEMES;
49061
+ Object.setPrototypeOf(SCHEMES, null);
49062
+ function getSchemeHandler(scheme) {
49063
+ return scheme && (SCHEMES[scheme] || SCHEMES[scheme.toLowerCase()]) || undefined;
49064
+ }
49065
+ module.exports = {
49066
+ wsIsSecure,
49067
+ SCHEMES,
49068
+ isValidSchemeName,
49069
+ getSchemeHandler
49070
+ };
48725
49071
  });
48726
49072
 
48727
49073
  // ../windmill-yaml-validator/node_modules/fast-uri/index.js
48728
49074
  var require_fast_uri = __commonJS(function(exports, module) {
48729
- var { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = require_utils2();
48730
- var SCHEMES = require_schemes();
49075
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils2();
49076
+ var { SCHEMES, getSchemeHandler } = require_schemes();
49077
+ var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
49078
+ var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
49079
+ function decodeValidScheme(scheme) {
49080
+ const decodedScheme = unescape(String(scheme));
49081
+ if (!VALID_SCHEME.test(decodedScheme)) {
49082
+ throw new TypeError(MALFORMED_SCHEME_ERROR);
49083
+ }
49084
+ return decodedScheme;
49085
+ }
48731
49086
  function normalize(uri, options) {
48732
49087
  if (typeof uri === "string") {
48733
- uri = serialize(parse(uri, options), options);
49088
+ uri = normalizeString(uri, options);
48734
49089
  } else if (typeof uri === "object") {
48735
49090
  uri = parse(serialize(uri, options), options);
48736
49091
  }
48737
49092
  return uri;
48738
49093
  }
48739
49094
  function resolve(baseURI, relativeURI, options) {
48740
- const schemelessOptions = Object.assign({ scheme: "null" }, options);
48741
- const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
48742
- return serialize(resolved, { ...schemelessOptions, skipEscape: true });
48743
- }
48744
- function resolveComponents(base, relative, options, skipNormalization) {
49095
+ const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
49096
+ const {
49097
+ parsed: baseParsed,
49098
+ malformedAuthorityOrPort: baseMalformed,
49099
+ malformedPercentEncoding: baseMalformedPercentEncoding,
49100
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
49101
+ malformedHost: baseMalformedHost,
49102
+ malformedScheme: baseMalformedScheme
49103
+ } = parseWithStatus(baseURI, schemelessOptions);
49104
+ const {
49105
+ parsed: relativeParsed,
49106
+ malformedAuthorityOrPort: relativeMalformed,
49107
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
49108
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
49109
+ malformedHost: relativeMalformedHost,
49110
+ malformedScheme: relativeMalformedScheme
49111
+ } = parseWithStatus(relativeURI, schemelessOptions);
49112
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
49113
+ throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
49114
+ }
49115
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
49116
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
49117
+ const resolvedHost = resolved.host;
49118
+ const resolvedHostIsIP = resolvedHost !== undefined && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
49119
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
49120
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
49121
+ if (resolved.error && !encodedASCIIHost) {
49122
+ throw new Error(resolved.error);
49123
+ }
49124
+ schemelessOptions.skipEscape = true;
49125
+ return serialize(resolved, schemelessOptions);
49126
+ }
49127
+ function resolveComponent(base, relative, options, skipNormalization) {
48745
49128
  const target = {};
48746
49129
  if (!skipNormalization) {
48747
49130
  base = parse(serialize(base, options), options);
@@ -48771,7 +49154,7 @@ var require_fast_uri = __commonJS(function(exports, module) {
48771
49154
  target.query = base.query;
48772
49155
  }
48773
49156
  } else {
48774
- if (relative.path.charAt(0) === "/") {
49157
+ if (relative.path[0] === "/") {
48775
49158
  target.path = removeDotSegments(relative.path);
48776
49159
  } else {
48777
49160
  if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
@@ -48795,22 +49178,12 @@ var require_fast_uri = __commonJS(function(exports, module) {
48795
49178
  return target;
48796
49179
  }
48797
49180
  function equal(uriA, uriB, options) {
48798
- if (typeof uriA === "string") {
48799
- uriA = unescape(uriA);
48800
- uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
48801
- } else if (typeof uriA === "object") {
48802
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
48803
- }
48804
- if (typeof uriB === "string") {
48805
- uriB = unescape(uriB);
48806
- uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
48807
- } else if (typeof uriB === "object") {
48808
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
48809
- }
48810
- return uriA.toLowerCase() === uriB.toLowerCase();
49181
+ const normalizedA = normalizeComparableURI(uriA, options);
49182
+ const normalizedB = normalizeComparableURI(uriB, options);
49183
+ return normalizedA !== undefined && normalizedB !== undefined && normalizedA === normalizedB;
48811
49184
  }
48812
49185
  function serialize(cmpts, opts) {
48813
- const components = {
49186
+ const component = {
48814
49187
  host: cmpts.host,
48815
49188
  scheme: cmpts.scheme,
48816
49189
  userinfo: cmpts.userinfo,
@@ -48828,63 +49201,99 @@ var require_fast_uri = __commonJS(function(exports, module) {
48828
49201
  };
48829
49202
  const options = Object.assign({}, opts);
48830
49203
  const uriTokens = [];
48831
- const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
49204
+ if (component.scheme) {
49205
+ component.scheme = decodeValidScheme(component.scheme);
49206
+ }
49207
+ const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
48832
49208
  if (schemeHandler && schemeHandler.serialize)
48833
- schemeHandler.serialize(components, options);
48834
- if (components.path !== undefined) {
49209
+ schemeHandler.serialize(component, options);
49210
+ const hasAuthority = component.userinfo !== undefined || component.host !== undefined || component.port !== undefined;
49211
+ const pathNoScheme = !options.skipEscape && component.scheme === undefined && !hasAuthority;
49212
+ if (component.path !== undefined) {
48835
49213
  if (!options.skipEscape) {
48836
- components.path = escape(components.path);
48837
- if (components.scheme !== undefined) {
48838
- components.path = components.path.split("%3A").join(":");
48839
- }
49214
+ component.path = serializePathEncoding(component.path, pathNoScheme);
48840
49215
  } else {
48841
- components.path = unescape(components.path);
49216
+ component.path = normalizePercentEncoding(component.path);
48842
49217
  }
48843
49218
  }
48844
- if (options.reference !== "suffix" && components.scheme) {
48845
- uriTokens.push(components.scheme, ":");
49219
+ if (options.reference !== "suffix" && component.scheme) {
49220
+ component.scheme = decodeValidScheme(component.scheme);
49221
+ uriTokens.push(component.scheme, ":");
48846
49222
  }
48847
- const authority = recomposeAuthority(components);
49223
+ const authority = recomposeAuthority(component);
48848
49224
  if (authority !== undefined) {
48849
49225
  if (options.reference !== "suffix") {
48850
49226
  uriTokens.push("//");
48851
49227
  }
48852
49228
  uriTokens.push(authority);
48853
- if (components.path && components.path.charAt(0) !== "/") {
49229
+ if (component.path && component.path[0] !== "/") {
48854
49230
  uriTokens.push("/");
48855
49231
  }
48856
49232
  }
48857
- if (components.path !== undefined) {
48858
- let s = components.path;
49233
+ if (component.path !== undefined) {
49234
+ let s = component.path;
48859
49235
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
48860
49236
  s = removeDotSegments(s);
48861
49237
  }
48862
- if (authority === undefined) {
48863
- s = s.replace(/^\/\//u, "/%2F");
49238
+ if (pathNoScheme) {
49239
+ s = serializePathEncoding(s, true);
49240
+ }
49241
+ if (authority === undefined && s[0] === "/" && s[1] === "/") {
49242
+ s = "/%2F" + s.slice(2);
48864
49243
  }
48865
49244
  uriTokens.push(s);
48866
49245
  }
48867
- if (components.query !== undefined) {
48868
- uriTokens.push("?", components.query);
49246
+ if (component.query !== undefined) {
49247
+ uriTokens.push("?", encodeQuery(component.query));
48869
49248
  }
48870
- if (components.fragment !== undefined) {
48871
- uriTokens.push("#", components.fragment);
49249
+ if (component.fragment !== undefined) {
49250
+ uriTokens.push("#", encodeFragment(component.fragment));
48872
49251
  }
48873
49252
  return uriTokens.join("");
48874
49253
  }
48875
- var hexLookUp = Array.from({ length: 127 }, (_v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)));
48876
- function nonSimpleDomain(value) {
48877
- let code = 0;
48878
- for (let i = 0, len = value.length;i < len; ++i) {
48879
- code = value.charCodeAt(i);
48880
- if (code > 126 || hexLookUp[code]) {
49254
+ var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
49255
+ var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
49256
+ var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
49257
+ function getParseError(parsed, matches) {
49258
+ if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
49259
+ return 'URI path must start with "/" when authority is present.';
49260
+ }
49261
+ if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
49262
+ return "URI port is malformed.";
49263
+ }
49264
+ return;
49265
+ }
49266
+ function hasMalformedPercentEncoding(component) {
49267
+ if (component === undefined)
49268
+ return false;
49269
+ let percent = component.indexOf("%");
49270
+ while (percent !== -1) {
49271
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
48881
49272
  return true;
48882
49273
  }
49274
+ percent = component.indexOf("%", percent + 3);
48883
49275
  }
48884
49276
  return false;
48885
49277
  }
48886
- var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
48887
- function parse(uri, opts) {
49278
+ function isIPLiteral(host) {
49279
+ return host[0] === "[" && host[host.length - 1] === "]";
49280
+ }
49281
+ function hasMalformedComponentPercentEncoding(matches) {
49282
+ const host = matches[4];
49283
+ return hasMalformedPercentEncoding(matches[3]) || host !== undefined && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
49284
+ }
49285
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
49286
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
49287
+ try {
49288
+ parsed.host = new URL("http://" + parsed.host).hostname;
49289
+ } catch (e) {
49290
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
49291
+ return true;
49292
+ }
49293
+ }
49294
+ return false;
49295
+ }
49296
+ function parseWithStatus(uri, opts) {
48888
49297
  const options = Object.assign({}, opts);
48889
49298
  const parsed = {
48890
49299
  scheme: undefined,
@@ -48895,10 +49304,39 @@ var require_fast_uri = __commonJS(function(exports, module) {
48895
49304
  query: undefined,
48896
49305
  fragment: undefined
48897
49306
  };
48898
- const gotEncoding = uri.indexOf("%") !== -1;
49307
+ let malformedAuthorityOrPort = false;
49308
+ let malformedPercentEncoding = false;
49309
+ let malformedSchemeSpecific = false;
49310
+ let malformedHost = false;
49311
+ let malformedIPLiteral = false;
49312
+ let malformedScheme = false;
48899
49313
  let isIP = false;
48900
- if (options.reference === "suffix")
48901
- uri = (options.scheme ? options.scheme + ":" : "") + "//" + uri;
49314
+ if (options.reference === "suffix") {
49315
+ if (options.scheme) {
49316
+ uri = options.scheme + ":" + uri;
49317
+ } else {
49318
+ uri = "//" + uri;
49319
+ }
49320
+ }
49321
+ const authorityMatch = uri.match(AUTHORITY_PREFIX);
49322
+ if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
49323
+ parsed.error = "URI authority must not contain a literal backslash.";
49324
+ malformedAuthorityOrPort = true;
49325
+ }
49326
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
49327
+ if (introducerMatch !== null) {
49328
+ const region = introducerMatch[1];
49329
+ const normalizedRegion = region.replace(/[\t\n\r]/g, "");
49330
+ if (normalizedRegion.length >= 2) {
49331
+ if (normalizedRegion.slice(0, 2) !== "//") {
49332
+ parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
49333
+ malformedAuthorityOrPort = true;
49334
+ } else if (region.length !== normalizedRegion.length) {
49335
+ parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
49336
+ malformedAuthorityOrPort = true;
49337
+ }
49338
+ }
49339
+ }
48902
49340
  const matches = uri.match(URI_PARSE);
48903
49341
  if (matches) {
48904
49342
  parsed.scheme = matches[1];
@@ -48908,17 +49346,41 @@ var require_fast_uri = __commonJS(function(exports, module) {
48908
49346
  parsed.path = matches[6] || "";
48909
49347
  parsed.query = matches[7];
48910
49348
  parsed.fragment = matches[8];
49349
+ if (parsed.scheme !== undefined) {
49350
+ const decodedScheme = unescape(parsed.scheme);
49351
+ if (VALID_SCHEME.test(decodedScheme)) {
49352
+ parsed.scheme = decodedScheme.toLowerCase();
49353
+ } else {
49354
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
49355
+ malformedScheme = true;
49356
+ }
49357
+ }
49358
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
49359
+ if (malformedPercentEncoding) {
49360
+ parsed.error = parsed.error || "URI contains malformed percent-encoding.";
49361
+ }
48911
49362
  if (isNaN(parsed.port)) {
48912
49363
  parsed.port = matches[5];
48913
49364
  }
49365
+ const parseError = getParseError(parsed, matches);
49366
+ if (parseError !== undefined) {
49367
+ parsed.error = parsed.error || parseError;
49368
+ malformedAuthorityOrPort = true;
49369
+ }
48914
49370
  if (parsed.host) {
48915
- const ipv4result = normalizeIPv4(parsed.host);
48916
- if (ipv4result.isIPV4 === false) {
48917
- const ipv6result = normalizeIPv6(ipv4result.host);
48918
- parsed.host = ipv6result.host.toLowerCase();
48919
- isIP = ipv6result.isIPV6;
49371
+ const ipv4result = isIPv4(parsed.host);
49372
+ if (ipv4result === false) {
49373
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
49374
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
49375
+ const ipv6result = normalizeIPv6(parsed.host);
49376
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
49377
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
49378
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
49379
+ if (malformedIPLiteral) {
49380
+ parsed.error = parsed.error || "URI host is malformed.";
49381
+ malformedAuthorityOrPort = true;
49382
+ }
48920
49383
  } else {
48921
- parsed.host = ipv4result.host;
48922
49384
  isIP = true;
48923
49385
  }
48924
49386
  }
@@ -48934,43 +49396,74 @@ var require_fast_uri = __commonJS(function(exports, module) {
48934
49396
  if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) {
48935
49397
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
48936
49398
  }
48937
- const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || "").toLowerCase()];
48938
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
48939
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
48940
- try {
48941
- parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
48942
- } catch (e) {
48943
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
48944
- }
49399
+ const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
49400
+ if (!malformedIPLiteral) {
49401
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
49402
+ }
49403
+ if (uri.indexOf("%") !== -1 && parsed.host !== undefined && !malformedIPLiteral) {
49404
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
49405
+ if (!isIP) {
49406
+ host = normalizePercentEncoding(host.toLowerCase());
48945
49407
  }
49408
+ parsed.host = reescapeHostDelimiters(host, isIP);
48946
49409
  }
48947
49410
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
48948
- if (gotEncoding && parsed.scheme !== undefined) {
48949
- parsed.scheme = unescape(parsed.scheme);
48950
- }
48951
- if (gotEncoding && parsed.host !== undefined) {
48952
- parsed.host = unescape(parsed.host);
48953
- }
48954
49411
  if (parsed.path) {
48955
- parsed.path = escape(unescape(parsed.path));
49412
+ parsed.path = normalizePathEncoding(parsed.path);
49413
+ }
49414
+ if (parsed.query) {
49415
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query);
48956
49416
  }
48957
49417
  if (parsed.fragment) {
48958
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
49418
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
48959
49419
  }
48960
49420
  }
48961
49421
  if (schemeHandler && schemeHandler.parse) {
48962
49422
  schemeHandler.parse(parsed, options);
49423
+ if (schemeHandler === SCHEMES.urn && parsed.nid === undefined) {
49424
+ malformedSchemeSpecific = true;
49425
+ }
48963
49426
  }
48964
49427
  } else {
48965
49428
  parsed.error = parsed.error || "URI can not be parsed.";
48966
49429
  }
48967
- return parsed;
49430
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
49431
+ }
49432
+ function parse(uri, opts) {
49433
+ return parseWithStatus(uri, opts).parsed;
49434
+ }
49435
+ function normalizeString(uri, opts) {
49436
+ return normalizeStringWithStatus(uri, opts).normalized;
49437
+ }
49438
+ function normalizeStringWithStatus(uri, opts) {
49439
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
49440
+ return {
49441
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
49442
+ malformedAuthorityOrPort,
49443
+ malformedPercentEncoding,
49444
+ malformedSchemeSpecific,
49445
+ malformedHost,
49446
+ malformedScheme
49447
+ };
49448
+ }
49449
+ function normalizeComparableURI(uri, opts) {
49450
+ if (typeof uri !== "string" && typeof uri !== "object") {
49451
+ return;
49452
+ }
49453
+ let value;
49454
+ try {
49455
+ value = typeof uri === "string" ? uri : serialize(uri, opts);
49456
+ } catch {
49457
+ return;
49458
+ }
49459
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
49460
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? undefined : normalized;
48968
49461
  }
48969
49462
  var fastUri = {
48970
49463
  SCHEMES,
48971
49464
  normalize,
48972
49465
  resolve,
48973
- resolveComponents,
49466
+ resolveComponent,
48974
49467
  equal,
48975
49468
  serialize,
48976
49469
  parse
@@ -49099,7 +49592,7 @@ var require_core = __commonJS(function(exports) {
49099
49592
  constructor(opts = {}) {
49100
49593
  this.schemas = {};
49101
49594
  this.refs = {};
49102
- this.formats = {};
49595
+ this.formats = Object.create(null);
49103
49596
  this._compilations = new Set;
49104
49597
  this._loading = {};
49105
49598
  this._cache = new Map;
@@ -49840,6 +50333,7 @@ var require_limitLength = __commonJS(function(exports) {
49840
50333
  var require_pattern = __commonJS(function(exports) {
49841
50334
  Object.defineProperty(exports, "__esModule", { value: true });
49842
50335
  var code_1 = require_code2();
50336
+ var util_1 = require_util2();
49843
50337
  var codegen_1 = require_codegen();
49844
50338
  var error = {
49845
50339
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
@@ -49852,10 +50346,18 @@ var require_pattern = __commonJS(function(exports) {
49852
50346
  $data: true,
49853
50347
  error,
49854
50348
  code(cxt) {
49855
- const { data, $data, schema, schemaCode, it } = cxt;
50349
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
49856
50350
  const u = it.opts.unicodeRegExp ? "u" : "";
49857
- const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema);
49858
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
50351
+ if ($data) {
50352
+ const { regExp } = it.opts.code;
50353
+ const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
50354
+ const valid = gen.let("valid");
50355
+ gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
50356
+ cxt.fail$data((0, codegen_1._)`!${valid}`);
50357
+ } else {
50358
+ const regExp = (0, code_1.usePattern)(cxt, schema);
50359
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
50360
+ }
49859
50361
  }
49860
50362
  };
49861
50363
  exports.default = def;
@@ -56422,7 +56924,7 @@ var init_openflow = __esm(() => {
56422
56924
  openflow_default = {
56423
56925
  openapi: "3.0.3",
56424
56926
  info: {
56425
- version: "1.813.0",
56927
+ version: "1.815.0",
56426
56928
  title: "OpenFlow Spec",
56427
56929
  contact: {
56428
56930
  name: "Ruben Fiszel",
@@ -57121,9 +57623,30 @@ var init_openflow = __esm(() => {
57121
57623
  "kind"
57122
57624
  ]
57123
57625
  },
57626
+ MemoryWindow: {
57627
+ type: "object",
57628
+ 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",
57629
+ properties: {
57630
+ kind: {
57631
+ type: "string",
57632
+ enum: [
57633
+ "window"
57634
+ ]
57635
+ },
57636
+ context_length: {
57637
+ type: "integer",
57638
+ description: "Number of most recent messages to load and store. 0 turns memory off."
57639
+ }
57640
+ },
57641
+ required: [
57642
+ "kind",
57643
+ "context_length"
57644
+ ]
57645
+ },
57124
57646
  MemoryAuto: {
57125
57647
  type: "object",
57126
- description: "Automatic context management",
57648
+ deprecated: true,
57649
+ 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",
57127
57650
  properties: {
57128
57651
  kind: {
57129
57652
  type: "string",
@@ -57167,7 +57690,8 @@ var init_openflow = __esm(() => {
57167
57690
  },
57168
57691
  MemoryManual: {
57169
57692
  type: "object",
57170
- description: "Explicit message history",
57693
+ deprecated: true,
57694
+ description: "Deprecated, still read as it was written. Move the step to `off` with `previous_messages` instead.",
57171
57695
  properties: {
57172
57696
  kind: {
57173
57697
  type: "string",
@@ -57188,11 +57712,14 @@ var init_openflow = __esm(() => {
57188
57712
  ]
57189
57713
  },
57190
57714
  MemoryConfig: {
57191
- description: "Conversation memory configuration",
57715
+ 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`.",
57192
57716
  oneOf: [
57193
57717
  {
57194
57718
  $ref: "#/components/schemas/MemoryOff"
57195
57719
  },
57720
+ {
57721
+ $ref: "#/components/schemas/MemoryWindow"
57722
+ },
57196
57723
  {
57197
57724
  $ref: "#/components/schemas/MemoryAuto"
57198
57725
  },
@@ -57800,7 +58327,10 @@ Valid values: 'text' (default) - plain text response, 'image' - image generation
57800
58327
  $ref: "#/components/schemas/InputTransform"
57801
58328
  }
57802
58329
  ],
57803
- description: "The user's prompt/message to the AI agent. Supports variable interpolation with flow.input syntax."
58330
+ description: `The user's prompt/message to the AI agent. Supports variable interpolation with
58331
+ flow.input syntax. Required unless memory is off and \`previous_messages\` supplies
58332
+ the prompt; image output always needs it.
58333
+ `
57804
58334
  },
57805
58335
  system_prompt: {
57806
58336
  allOf: [
@@ -57823,6 +58353,22 @@ Streaming events include: token_delta, reasoning_token_delta, tool_call, tool_ca
57823
58353
  memory: {
57824
58354
  $ref: "#/components/schemas/MemoryTransform"
57825
58355
  },
58356
+ memory_id: {
58357
+ allOf: [
58358
+ {
58359
+ $ref: "#/components/schemas/InputTransform"
58360
+ }
58361
+ ],
58362
+ 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`: it is ignored when memory is off, and an older `auto` or\n`manual` memory reads neither history input.\n"
58363
+ },
58364
+ previous_messages: {
58365
+ allOf: [
58366
+ {
58367
+ $ref: "#/components/schemas/InputTransform"
58368
+ }
58369
+ ],
58370
+ 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"
58371
+ },
57826
58372
  output_schema: {
57827
58373
  allOf: [
57828
58374
  {
@@ -57894,10 +58440,7 @@ Range: 0.0 to 2.0 (provider-dependent)
57894
58440
  Range: 1-1000.
57895
58441
  `
57896
58442
  }
57897
- },
57898
- required: [
57899
- "user_message"
57900
- ]
58443
+ }
57901
58444
  },
57902
58445
  tools: {
57903
58446
  type: "array",
@@ -57926,7 +58469,7 @@ Range: 1-1000.
57926
58469
  description: `Path of a reusable \`ai_agent\` resource (hybrid linking). When set, the agent brain
57927
58470
  config (provider/model/system prompt/etc.) and tool set are resolved at runtime from
57928
58471
  that resource; the module's input_transforms then only carry the flow-local inputs
57929
- (user_message/user_attachments/enabled_tools).
58472
+ (user_message, user_attachments, enabled_tools and the history inputs memory_id and previous_messages).
57930
58473
  `
57931
58474
  },
57932
58475
  tool_inputs: {
@@ -66307,6 +66850,22 @@ function stripUnappliedSettingsFields(local, remote) {
66307
66850
  delete local?.color;
66308
66851
  delete remote?.color;
66309
66852
  }
66853
+ if (local)
66854
+ local.auto_invite ??= {};
66855
+ if (remote)
66856
+ remote.auto_invite ??= {};
66857
+ const localInvite = local?.auto_invite;
66858
+ const remoteInvite = remote?.auto_invite;
66859
+ if (localInvite?.instance_groups == null) {
66860
+ for (const invite of [localInvite, remoteInvite]) {
66861
+ delete invite?.instance_groups;
66862
+ delete invite?.instance_groups_roles;
66863
+ }
66864
+ } else {
66865
+ localInvite.instance_groups_roles ??= {};
66866
+ if (remoteInvite)
66867
+ remoteInvite.instance_groups_roles ??= {};
66868
+ }
66310
66869
  }
66311
66870
  async function compareDynFSElement(els1, els2, ignore, json, skips, ignoreMetadataDeletion, codebases, ignoreCodebaseChanges, specificItems, branchOverride, isEls1Remote, caseInsensitiveFs, parentOwnsScheduleEnabled) {
66312
66871
  let [m1, m2] = els2 ? await Promise.all([
@@ -74341,7 +74900,17 @@ async function pushWorkspaceSettings(workspace, _path, settings, localSettings)
74341
74900
  }
74342
74901
  });
74343
74902
  }
74344
- if (!deepEqual(localSettings.auto_invite, settings.auto_invite)) {
74903
+ const {
74904
+ instance_groups: localGroups,
74905
+ instance_groups_roles: localGroupRoles,
74906
+ ...localDomainInvite
74907
+ } = localSettings.auto_invite ?? {};
74908
+ const {
74909
+ instance_groups: remoteGroups,
74910
+ instance_groups_roles: remoteGroupRoles,
74911
+ ...remoteDomainInvite
74912
+ } = settings.auto_invite ?? {};
74913
+ if (!deepEqual(localDomainInvite, remoteDomainInvite)) {
74345
74914
  debug(`Updating auto invite...`);
74346
74915
  const localAutoInvite = localSettings.auto_invite;
74347
74916
  if (localAutoInvite?.mode && !["add", "invite"].includes(localAutoInvite.mode)) {
@@ -74368,6 +74937,13 @@ async function pushWorkspaceSettings(workspace, _path, settings, localSettings)
74368
74937
  });
74369
74938
  }
74370
74939
  }
74940
+ if (localGroups != null && (!deepEqual(localGroups, remoteGroups) || !deepEqual(localGroupRoles ?? {}, remoteGroupRoles ?? {}))) {
74941
+ debug(`Updating instance groups...`);
74942
+ await editInstanceGroups({
74943
+ workspace,
74944
+ requestBody: { groups: localGroups, roles: localGroupRoles ?? {} }
74945
+ });
74946
+ }
74371
74947
  if (!deepEqual(localSettings.ai_config, settings.ai_config)) {
74372
74948
  debug(`Updating copilot settings...`);
74373
74949
  await editCopilotConfig({
@@ -74460,10 +75036,13 @@ async function pushWorkspaceSettings(workspace, _path, settings, localSettings)
74460
75036
  }
74461
75037
  if (!deepEqual(localSettings.datatable, settings.datatable)) {
74462
75038
  debug(`Updating datatable config...`);
74463
- await editDataTableConfig({
75039
+ const { stranded_references } = await editDataTableConfig({
74464
75040
  workspace,
74465
75041
  requestBody: { settings: localSettings.datatable ?? { datatables: {} } }
74466
75042
  });
75043
+ if (stranded_references?.length) {
75044
+ warn(`Removed data tables governed data tables in other workspaces, which no longer resolve: ${stranded_references.map((r) => `${r.workspace_id}/${r.datatable}`).join(", ")}. A superadmin can point them somewhere else.`);
75045
+ }
74467
75046
  }
74468
75047
  if (localSettings.slack_command_script != settings.slack_command_script) {
74469
75048
  debug(`Updating slack command script...`);
@@ -79716,6 +80295,8 @@ parseS3Object(s3Object: S3Object): S3ObjectRecord
79716
80295
  /**
79717
80296
  * Create a SQL template function for PostgreSQL/datatable queries
79718
80297
  * @param name - Database/datatable name (default: "main")
80298
+ * @param opts.role - Connect as this data table role instead of the data table's default one.
80299
+ * Only meaningful on a data table under roles, and only for a role you are a tenant of.
79719
80300
  * @returns SQL template function for building parameterized queries
79720
80301
  * @example
79721
80302
  * let sql = wmill.datatable()
@@ -79725,8 +80306,11 @@ parseS3Object(s3Object: S3Object): S3ObjectRecord
79725
80306
  * SELECT * FROM friends
79726
80307
  * WHERE name = \${name} AND age = \${age}::int
79727
80308
  * \`.fetch()
80309
+ * @example
80310
+ * // Read through a restricted role
80311
+ * let sql = wmill.datatable("main", { role: "analytics" })
79728
80312
  */
79729
- datatable(name: string = "main"): DatatableSqlTemplateFunction
80313
+ datatable(name: string = "main", opts?: DatatableOptions): DatatableSqlTemplateFunction
79730
80314
 
79731
80315
  /**
79732
80316
  * Create a SQL template function for DuckDB/ducklake queries
@@ -80507,6 +81091,8 @@ parseS3Object(s3Object: S3Object): S3ObjectRecord
80507
81091
  /**
80508
81092
  * Create a SQL template function for PostgreSQL/datatable queries
80509
81093
  * @param name - Database/datatable name (default: "main")
81094
+ * @param opts.role - Connect as this data table role instead of the data table's default one.
81095
+ * Only meaningful on a data table under roles, and only for a role you are a tenant of.
80510
81096
  * @returns SQL template function for building parameterized queries
80511
81097
  * @example
80512
81098
  * let sql = wmill.datatable()
@@ -80516,8 +81102,11 @@ parseS3Object(s3Object: S3Object): S3ObjectRecord
80516
81102
  * SELECT * FROM friends
80517
81103
  * WHERE name = \${name} AND age = \${age}::int
80518
81104
  * \`.fetch()
81105
+ * @example
81106
+ * // Read through a restricted role
81107
+ * let sql = wmill.datatable("main", { role: "analytics" })
80519
81108
  */
80520
- datatable(name: string = "main"): DatatableSqlTemplateFunction
81109
+ datatable(name: string = "main", opts?: DatatableOptions): DatatableSqlTemplateFunction
80521
81110
 
80522
81111
  /**
80523
81112
  * Create a SQL template function for DuckDB/ducklake queries
@@ -81392,6 +81981,8 @@ parseS3Object(s3Object: S3Object): S3ObjectRecord
81392
81981
  /**
81393
81982
  * Create a SQL template function for PostgreSQL/datatable queries
81394
81983
  * @param name - Database/datatable name (default: "main")
81984
+ * @param opts.role - Connect as this data table role instead of the data table's default one.
81985
+ * Only meaningful on a data table under roles, and only for a role you are a tenant of.
81395
81986
  * @returns SQL template function for building parameterized queries
81396
81987
  * @example
81397
81988
  * let sql = wmill.datatable()
@@ -81401,8 +81992,11 @@ parseS3Object(s3Object: S3Object): S3ObjectRecord
81401
81992
  * SELECT * FROM friends
81402
81993
  * WHERE name = \${name} AND age = \${age}::int
81403
81994
  * \`.fetch()
81995
+ * @example
81996
+ * // Read through a restricted role
81997
+ * let sql = wmill.datatable("main", { role: "analytics" })
81404
81998
  */
81405
- datatable(name: string = "main"): DatatableSqlTemplateFunction
81999
+ datatable(name: string = "main", opts?: DatatableOptions): DatatableSqlTemplateFunction
81406
82000
 
81407
82001
  /**
81408
82002
  * Create a SQL template function for DuckDB/ducklake queries
@@ -83011,10 +83605,13 @@ def send_teams_message(conversation_id: str, text: str, success: bool = True, ca
83011
83605
  #
83012
83606
  # Args:
83013
83607
  # name: Database name (default: "main")
83608
+ # role: Connect as this data table role instead of the data table's default one.
83609
+ # Only meaningful on a data table under roles, and only for a role you are a
83610
+ # tenant of.
83014
83611
  #
83015
83612
  # Returns:
83016
83613
  # DataTableClient instance
83017
- def datatable(name: str = 'main')
83614
+ def datatable(name: str = 'main', *, role: Optional[str] = None)
83018
83615
 
83019
83616
  # Get a DuckLake client for DuckDB queries.
83020
83617
  #
@@ -83232,7 +83829,7 @@ def parse_sql_client_name(name: str) -> tuple[str, Optional[str]]
83232
83829
  #
83233
83830
  # @task(retry={"attempts": 3, "delay": 30, "multiplier": 2})
83234
83831
  # async def call_api(payload: dict): ...
83235
- def task(_func = None, path: Optional[str] = None, tag: Optional[str] = None, timeout: Optional[int] = None, cache_ttl: Optional[int] = None, priority: Optional[int] = None, concurrency_limit: Optional[int] = None, concurrency_key: Optional[str] = None, concurrency_time_window_s: Optional[int] = None, retry: Optional[dict] = None)
83832
+ def task(_func = None, *, path: Optional[str] = None, tag: Optional[str] = None, timeout: Optional[int] = None, cache_ttl: Optional[int] = None, priority: Optional[int] = None, concurrency_limit: Optional[int] = None, concurrency_key: Optional[str] = None, concurrency_time_window_s: Optional[int] = None, retry: Optional[dict] = None)
83236
83833
 
83237
83834
  # Create a task that dispatches to a separate Windmill script.
83238
83835
  #
@@ -83245,7 +83842,7 @@ def task(_func = None, path: Optional[str] = None, tag: Optional[str] = None, ti
83245
83842
  # @workflow
83246
83843
  # async def main():
83247
83844
  # data = await extract(url="https://...")
83248
- def task_script(path: str, timeout: Optional[int] = None, tag: Optional[str] = None, cache_ttl: Optional[int] = None, priority: Optional[int] = None, concurrency_limit: Optional[int] = None, concurrency_key: Optional[str] = None, concurrency_time_window_s: Optional[int] = None, retry: Optional[dict] = None)
83845
+ def task_script(path: str, *, timeout: Optional[int] = None, tag: Optional[str] = None, cache_ttl: Optional[int] = None, priority: Optional[int] = None, concurrency_limit: Optional[int] = None, concurrency_key: Optional[str] = None, concurrency_time_window_s: Optional[int] = None, retry: Optional[dict] = None)
83249
83846
 
83250
83847
  # Create a task that dispatches to a separate Windmill flow.
83251
83848
  #
@@ -83258,7 +83855,7 @@ def task_script(path: str, timeout: Optional[int] = None, tag: Optional[str] = N
83258
83855
  # @workflow
83259
83856
  # async def main():
83260
83857
  # result = await pipeline(input=data)
83261
- def task_flow(path: str, timeout: Optional[int] = None, tag: Optional[str] = None, cache_ttl: Optional[int] = None, priority: Optional[int] = None, concurrency_limit: Optional[int] = None, concurrency_key: Optional[str] = None, concurrency_time_window_s: Optional[int] = None, retry: Optional[dict] = None)
83858
+ def task_flow(path: str, *, timeout: Optional[int] = None, tag: Optional[str] = None, cache_ttl: Optional[int] = None, priority: Optional[int] = None, concurrency_limit: Optional[int] = None, concurrency_key: Optional[str] = None, concurrency_time_window_s: Optional[int] = None, retry: Optional[dict] = None)
83262
83859
 
83263
83860
  # Decorator marking an async function as a workflow-as-code entry point.
83264
83861
  #
@@ -83323,7 +83920,7 @@ async def wait_for_approval(timeout: int = 1800, form: dict | None = None, self_
83323
83920
  # ...
83324
83921
  #
83325
83922
  # results = await parallel(items, process, concurrency=5)
83326
- async def parallel(items, fn, concurrency: Optional[int] = None)
83923
+ async def parallel(items, fn, *, concurrency: Optional[int] = None)
83327
83924
 
83328
83925
  # Commit Kafka offsets for a trigger with auto_commit disabled.
83329
83926
  #
@@ -83882,9 +84479,60 @@ tool, \`websearch\` for web search.
83882
84479
  }
83883
84480
  \`\`\`
83884
84481
 
83885
- - \`provider\` is a static object, not a bare resource string: \`{ "kind": <provider kind>,
84482
+ - \`provider\` is an object, not a bare resource string: \`{ "kind": <provider kind>,
83886
84483
  "resource": "$res:<path>", "model": <model id> }\`. Required unless the module links to a saved
83887
- agent through \`value.agent\`
84484
+ agent through \`value.agent\`. Static is right for a flow run from a form; a chat flow wires its
84485
+ fields to flow inputs instead — see below
84486
+
84487
+ ### Chat-Mode Flows
84488
+
84489
+ A flow with \`value.chat_input_enabled: true\` is run from a chat instead of a form: the composer
84490
+ sends one message per turn and renders the conversation. It needs a required \`user_message\` string
84491
+ input, read by the agent. Any other flow input the composer does not edit itself is asked for
84492
+ under Configure inputs.
84493
+
84494
+ **A static \`provider\` gives a chat that cannot change its model.** Feed it from flow inputs
84495
+ instead, either way round: one input carrying the whole object (\`"expr": "flow_input.model_config"\`)
84496
+ makes every field editable, or wire it field by field to fix some and expose others. A field the
84497
+ chat can write becomes a control in the composer — a provider picker, a model list, a thinking
84498
+ control — and a field left static is fixed, with no control drawn for it. \`kind\` is the one
84499
+ exception: the composer writes it only together with \`resource\`, since a provider is picked as a
84500
+ pair, so a \`kind\` input wired on its own stays askable under Configure inputs and nothing the run
84501
+ needs becomes unreachable.
84502
+
84503
+ \`\`\`json
84504
+ {
84505
+ "id": "chat_agent",
84506
+ "value": {
84507
+ "type": "aiagent",
84508
+ "input_transforms": {
84509
+ "provider": {
84510
+ "type": "javascript",
84511
+ "expr": "({ kind: 'anthropic', resource: '$res:f/ai/claude', model: flow_input.model, reasoning_effort: flow_input.thinking })"
84512
+ },
84513
+ "user_message": { "type": "javascript", "expr": "flow_input.user_message" },
84514
+ "user_attachments": { "type": "javascript", "expr": "flow_input.files" },
84515
+ "memory": { "type": "static", "value": { "kind": "window", "context_length": 10 } },
84516
+ "streaming": { "type": "static", "value": true },
84517
+ "output_type": { "type": "static", "value": "text" }
84518
+ },
84519
+ "tools": []
84520
+ }
84521
+ }
84522
+ \`\`\`
84523
+
84524
+ - Wiring field by field means one object literal whose values are literals or bare \`flow_input.x\`
84525
+ references. A spread, a call or a computed key leaves the composer unable to tell which input
84526
+ feeds which field, so it offers no control at all — a bare \`flow_input.x\` for the whole object
84527
+ is read instead as that one input carrying every field
84528
+ - \`memory\` is what lets the agent see earlier turns; without it every message starts from nothing
84529
+ - \`streaming\` on makes the answer and its thinking appear token by token instead of all at once
84530
+ - \`user_attachments\` points at a flow input typed as an array of s3 objects
84531
+ (\`{ "type": "array", "items": { "type": "object", "resourceType": "s3object" } }\`), so files
84532
+ sent with a message reach the agent
84533
+ - Running one needs a \`memory_id\` **query parameter** — not a flow argument — naming the
84534
+ conversation the turn belongs to: a fresh UUID starts one, reusing a UUID continues it. The chat
84535
+ supplies it itself; a run driven any other way has to pass it or the server refuses the job
83888
84536
 
83889
84537
  ### Tool Naming Rules
83890
84538
 
@@ -84188,7 +84836,7 @@ Reference a specific resource using \`$res:\` prefix:
84188
84836
 
84189
84837
  ## OpenFlow Schema
84190
84838
 
84191
- {"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":"JavaScript expression to return early from the flow"},"chat_input_enabled":{"type":"boolean","description":"Whether this flow accepts chat-style input"},"notes":{"type":"array","description":"Sticky notes attached to the flow","items":{"$ref":"#/components/schemas/FlowNote"}},"groups":{"type":"array","description":"Semantic groups of modules for organizational purposes","items":{"$ref":"#/components/schemas/FlowGroup"}}},"required":["modules"]},"Retry":{"type":"object","description":"Retry configuration for failed module executions","properties":{"constant":{"type":"object","description":"Retry with constant delay between attempts","properties":{"attempts":{"type":"integer","description":"Number of retry attempts"},"seconds":{"type":"integer","description":"Seconds to wait between retries"}}},"exponential":{"type":"object","description":"Retry with exponential backoff (delay doubles each time)","properties":{"attempts":{"type":"integer","description":"Number of retry attempts"},"multiplier":{"type":"integer","description":"Multiplier for exponential backoff"},"seconds":{"type":"integer","minimum":1,"description":"Initial delay in seconds"},"random_factor":{"type":"integer","minimum":0,"maximum":100,"description":"Random jitter percentage (0-100) to avoid thundering herd"}}},"retry_if":{"$ref":"#/components/schemas/RetryIf"}}},"FlowNote":{"type":"object","description":"A sticky note attached to a flow for documentation and annotation","properties":{"id":{"type":"string","description":"Unique identifier for the note"},"text":{"type":"string","description":"Content of the note"},"position":{"type":"object","description":"Position of the note in the flow editor","properties":{"x":{"type":"number","description":"X coordinate"},"y":{"type":"number","description":"Y coordinate"}},"required":["x","y"]},"size":{"type":"object","description":"Size of the note in the flow editor","properties":{"width":{"type":"number","description":"Width in pixels"},"height":{"type":"number","description":"Height in pixels"}},"required":["width","height"]},"color":{"type":"string","description":"Color of the note (e.g., \\"yellow\\", \\"#ffff00\\")"},"type":{"type":"string","enum":["free","group"],"description":"Type of note - 'free' for standalone notes, 'group' for notes that group other nodes"},"locked":{"type":"boolean","default":false,"description":"Whether the note is locked and cannot be edited or moved"},"contained_node_ids":{"type":"array","items":{"type":"string"},"description":"For group notes, the IDs of nodes contained within this group"}},"required":["id","text","color","type"]},"FlowGroup":{"type":"object","description":"A semantic group of flow modules for organizational purposes. Does not affect execution \\u2014 modules remain in their original position in the flow. Groups provide naming and collapsibility in the editor. Members are computed dynamically from all nodes on paths between start_id and end_id.","properties":{"summary":{"type":"string","description":"Display name for this group"},"note":{"type":"string","description":"Markdown note shown below the group header"},"autocollapse":{"type":"boolean","default":false,"description":"If true, this group is collapsed by default in the flow editor. UI hint only."},"start_id":{"type":"string","description":"ID of the first flow module in this group (topological entry point)"},"end_id":{"type":"string","description":"ID of the last flow module in this group (topological exit point)"},"color":{"type":"string","description":"Color for the group in the flow editor"}},"required":["start_id","end_id"]},"RetryIf":{"type":"object","description":"Conditional retry based on error or result","properties":{"expr":{"type":"string","description":"JavaScript expression that returns true to retry. Has access to 'result' and 'error' variables"}},"required":["expr"]},"StopAfterIf":{"type":"object","description":"Early termination condition for a module","properties":{"skip_if_stopped":{"type":"boolean","description":"If true, following steps are skipped when this condition triggers"},"expr":{"type":"string","description":"JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"},"error_message":{"type":"string","nullable":true,"description":"Custom error message when stopping with an error. Mutually exclusive with skip_if_stopped. If set to a non-empty string, the flow stops with this error. If empty string, a default error message is used. If null or omitted, no error is raised."},"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"},"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"]},"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"]},"MemoryAuto":{"type":"object","description":"Automatic context management","properties":{"kind":{"type":"string","enum":["auto"]},"context_length":{"type":"integer","description":"Maximum number of messages to retain in context"},"memory_id":{"type":"string","description":"Identifier for persistent memory across agent invocations"}},"required":["kind"]},"MemoryMessage":{"type":"object","description":"A single message in conversation history","properties":{"role":{"type":"string","enum":["user","assistant","system"]},"content":{"type":"string"}},"required":["role","content"]},"MemoryManual":{"type":"object","description":"Explicit message history","properties":{"kind":{"type":"string","enum":["manual"]},"messages":{"type":"array","items":{"$ref":"#/components/schemas/MemoryMessage"}}},"required":["kind","messages"]},"MemoryConfig":{"description":"Conversation memory configuration","oneOf":[{"$ref":"#/components/schemas/MemoryOff"},{"$ref":"#/components/schemas/MemoryAuto"},{"$ref":"#/components/schemas/MemoryManual"}],"discriminator":{"propertyName":"kind","mapping":{"off":"#/components/schemas/MemoryOff","auto":"#/components/schemas/MemoryAuto","manual":"#/components/schemas/MemoryManual"}}},"StaticMemoryTransform":{"type":"object","description":"Static memory configuration passed directly to the AI agent","properties":{"value":{"$ref":"#/components/schemas/MemoryConfig"},"type":{"type":"string","enum":["static"]}},"required":["type","value"]},"MemoryTransform":{"description":"Memory configuration - can be static (MemoryConfig), JavaScript expression, or AI-determined","oneOf":[{"$ref":"#/components/schemas/StaticMemoryTransform"},{"$ref":"#/components/schemas/JavascriptTransform"},{"$ref":"#/components/schemas/AiTransform"}],"discriminator":{"propertyName":"type","mapping":{"static":"#/components/schemas/StaticMemoryTransform","javascript":"#/components/schemas/JavascriptTransform","ai":"#/components/schemas/AiTransform"}}},"FlowModuleValue":{"description":"The actual implementation of a flow step. Can be a script (inline or referenced), subflow, loop, branch, or special module type","oneOf":[{"$ref":"#/components/schemas/RawScript"},{"$ref":"#/components/schemas/PathScript"},{"$ref":"#/components/schemas/PathFlow"},{"$ref":"#/components/schemas/ForloopFlow"},{"$ref":"#/components/schemas/WhileloopFlow"},{"$ref":"#/components/schemas/BranchOne"},{"$ref":"#/components/schemas/BranchAll"},{"$ref":"#/components/schemas/Identity"},{"$ref":"#/components/schemas/AiAgent"}],"discriminator":{"propertyName":"type","mapping":{"rawscript":"#/components/schemas/RawScript","script":"#/components/schemas/PathScript","flow":"#/components/schemas/PathFlow","forloopflow":"#/components/schemas/ForloopFlow","whileloopflow":"#/components/schemas/WhileloopFlow","branchone":"#/components/schemas/BranchOne","branchall":"#/components/schemas/BranchAll","identity":"#/components/schemas/Identity","aiagent":"#/components/schemas/AiAgent"}}},"RawScript":{"type":"object","description":"Inline script with code defined directly in the flow. Use 'bun' as default language if unspecified. The script receives arguments from input_transforms","properties":{"input_transforms":{"type":"object","description":"Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments","additionalProperties":{"$ref":"#/components/schemas/InputTransform"}},"content":{"type":"string","description":"The script source code. Should export a 'main' function"},"language":{"type":"string","description":"Programming language for this script","enum":["deno","bun","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."},"value":{"$ref":"#/components/schemas/ToolValue"}},"required":["id","value"]},"ToolValue":{"description":"The implementation of a tool. Can be a flow module (script/flow) or an MCP tool reference","oneOf":[{"$ref":"#/components/schemas/FlowModuleTool"},{"$ref":"#/components/schemas/McpToolValue"},{"$ref":"#/components/schemas/WebsearchToolValue"}],"discriminator":{"propertyName":"tool_type","mapping":{"flowmodule":"#/components/schemas/FlowModuleTool","mcp":"#/components/schemas/McpToolValue","websearch":"#/components/schemas/WebsearchToolValue"}}},"FlowModuleTool":{"description":"A tool implemented as a flow module (script, flow, etc.). The AI can call this like any other flow module","allOf":[{"type":"object","properties":{"tool_type":{"type":"string","enum":["flowmodule"]}},"required":["tool_type"]},{"$ref":"#/components/schemas/FlowModuleValue"}]},"WebsearchToolValue":{"type":"object","description":"A tool implemented as a websearch tool. The AI can call this like any other websearch tool","properties":{"tool_type":{"type":"string","enum":["websearch"]}},"required":["tool_type"]},"McpToolValue":{"type":"object","description":"Reference to an external MCP (Model Context Protocol) tool. The AI can call tools from MCP servers","properties":{"tool_type":{"type":"string","enum":["mcp"]},"resource_path":{"type":"string","description":"Path to the MCP resource/server configuration"},"include_tools":{"type":"array","description":"Whitelist of specific tools to include from this MCP server","items":{"type":"string"}},"exclude_tools":{"type":"array","description":"Blacklist of tools to exclude from this MCP server","items":{"type":"string"}}},"required":["tool_type","resource_path"]},"AiAgent":{"type":"object","description":"AI agent step that can use tools to accomplish tasks. The agent receives inputs and can call any of its configured tools to complete the task","properties":{"input_transforms":{"type":"object","description":"Input parameters for the AI agent mapped to their values","properties":{"provider":{"$ref":"#/components/schemas/ProviderTransform"},"output_type":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Output format type.\\nValid values: 'text' (default) - plain text response, 'image' - image generation\\n"},"user_message":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"The user's prompt/message to the AI agent. Supports variable interpolation with flow.input syntax."},"system_prompt":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"System instructions that guide the AI's behavior, persona, and response style. Optional."},"streaming":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Boolean. If true, stream the AI response incrementally.\\nStreaming events include: token_delta, reasoning_token_delta, tool_call, tool_call_arguments, tool_execution, tool_result\\n"},"memory":{"$ref":"#/components/schemas/MemoryTransform"},"output_schema":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"JSON Schema object defining structured output format. Used when you need the AI to return data in a specific shape.\\nSupports standard JSON Schema properties: type, properties, required, items, enum, pattern, minLength, maxLength, minimum, maximum, etc.\\nExample: { type: 'object', properties: { name: { type: 'string' }, age: { type: 'integer' } }, required: ['name'] }\\n"},"user_attachments":{"allOf":[{"$ref":"#/components/schemas/InputTransform"}],"description":"Array of file references (images or PDFs) for the AI agent.\\nFormat: Array<{ bucket: string, key: string }> - S3 object references\\nExample: [{ bucket: 'my-bucket', key: 'documents/report.pdf' }]\\n"},"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"}},"required":["user_message"]},"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).\\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"]},"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"]}}`,
84839
+ {"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":"JavaScript expression to return early from the flow"},"chat_input_enabled":{"type":"boolean","description":"Whether this flow accepts chat-style input"},"notes":{"type":"array","description":"Sticky notes attached to the flow","items":{"$ref":"#/components/schemas/FlowNote"}},"groups":{"type":"array","description":"Semantic groups of modules for organizational purposes","items":{"$ref":"#/components/schemas/FlowGroup"}}},"required":["modules"]},"Retry":{"type":"object","description":"Retry configuration for failed module executions","properties":{"constant":{"type":"object","description":"Retry with constant delay between attempts","properties":{"attempts":{"type":"integer","description":"Number of retry attempts"},"seconds":{"type":"integer","description":"Seconds to wait between retries"}}},"exponential":{"type":"object","description":"Retry with exponential backoff (delay doubles each time)","properties":{"attempts":{"type":"integer","description":"Number of retry attempts"},"multiplier":{"type":"integer","description":"Multiplier for exponential backoff"},"seconds":{"type":"integer","minimum":1,"description":"Initial delay in seconds"},"random_factor":{"type":"integer","minimum":0,"maximum":100,"description":"Random jitter percentage (0-100) to avoid thundering herd"}}},"retry_if":{"$ref":"#/components/schemas/RetryIf"}}},"FlowNote":{"type":"object","description":"A sticky note attached to a flow for documentation and annotation","properties":{"id":{"type":"string","description":"Unique identifier for the note"},"text":{"type":"string","description":"Content of the note"},"position":{"type":"object","description":"Position of the note in the flow editor","properties":{"x":{"type":"number","description":"X coordinate"},"y":{"type":"number","description":"Y coordinate"}},"required":["x","y"]},"size":{"type":"object","description":"Size of the note in the flow editor","properties":{"width":{"type":"number","description":"Width in pixels"},"height":{"type":"number","description":"Height in pixels"}},"required":["width","height"]},"color":{"type":"string","description":"Color of the note (e.g., \\"yellow\\", \\"#ffff00\\")"},"type":{"type":"string","enum":["free","group"],"description":"Type of note - 'free' for standalone notes, 'group' for notes that group other nodes"},"locked":{"type":"boolean","default":false,"description":"Whether the note is locked and cannot be edited or moved"},"contained_node_ids":{"type":"array","items":{"type":"string"},"description":"For group notes, the IDs of nodes contained within this group"}},"required":["id","text","color","type"]},"FlowGroup":{"type":"object","description":"A semantic group of flow modules for organizational purposes. Does not affect execution \\u2014 modules remain in their original position in the flow. Groups provide naming and collapsibility in the editor. Members are computed dynamically from all nodes on paths between start_id and end_id.","properties":{"summary":{"type":"string","description":"Display name for this group"},"note":{"type":"string","description":"Markdown note shown below the group header"},"autocollapse":{"type":"boolean","default":false,"description":"If true, this group is collapsed by default in the flow editor. UI hint only."},"start_id":{"type":"string","description":"ID of the first flow module in this group (topological entry point)"},"end_id":{"type":"string","description":"ID of the last flow module in this group (topological exit point)"},"color":{"type":"string","description":"Color for the group in the flow editor"}},"required":["start_id","end_id"]},"RetryIf":{"type":"object","description":"Conditional retry based on error or result","properties":{"expr":{"type":"string","description":"JavaScript expression that returns true to retry. Has access to 'result' and 'error' variables"}},"required":["expr"]},"StopAfterIf":{"type":"object","description":"Early termination condition for a module","properties":{"skip_if_stopped":{"type":"boolean","description":"If true, following steps are skipped when this condition triggers"},"expr":{"type":"string","description":"JavaScript expression evaluated after the module runs. Can use 'result' (step's result) or 'flow_input'. Return true to stop"},"error_message":{"type":"string","nullable":true,"description":"Custom error message when stopping with an error. Mutually exclusive with skip_if_stopped. If set to a non-empty string, the flow stops with this error. If empty string, a default error message is used. If null or omitted, no error is raised."},"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"},"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"]},"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"]},"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/MemoryAuto"},{"$ref":"#/components/schemas/MemoryManual"}],"discriminator":{"propertyName":"kind","mapping":{"off":"#/components/schemas/MemoryOff","window":"#/components/schemas/MemoryWindow","auto":"#/components/schemas/MemoryAuto","manual":"#/components/schemas/MemoryManual"}}},"StaticMemoryTransform":{"type":"object","description":"Static memory configuration passed directly to the AI agent","properties":{"value":{"$ref":"#/components/schemas/MemoryConfig"},"type":{"type":"string","enum":["static"]}},"required":["type","value"]},"MemoryTransform":{"description":"Memory configuration - can be static (MemoryConfig), JavaScript expression, or AI-determined","oneOf":[{"$ref":"#/components/schemas/StaticMemoryTransform"},{"$ref":"#/components/schemas/JavascriptTransform"},{"$ref":"#/components/schemas/AiTransform"}],"discriminator":{"propertyName":"type","mapping":{"static":"#/components/schemas/StaticMemoryTransform","javascript":"#/components/schemas/JavascriptTransform","ai":"#/components/schemas/AiTransform"}}},"FlowModuleValue":{"description":"The actual implementation of a flow step. Can be a script (inline or referenced), subflow, loop, branch, or special module type","oneOf":[{"$ref":"#/components/schemas/RawScript"},{"$ref":"#/components/schemas/PathScript"},{"$ref":"#/components/schemas/PathFlow"},{"$ref":"#/components/schemas/ForloopFlow"},{"$ref":"#/components/schemas/WhileloopFlow"},{"$ref":"#/components/schemas/BranchOne"},{"$ref":"#/components/schemas/BranchAll"},{"$ref":"#/components/schemas/Identity"},{"$ref":"#/components/schemas/AiAgent"}],"discriminator":{"propertyName":"type","mapping":{"rawscript":"#/components/schemas/RawScript","script":"#/components/schemas/PathScript","flow":"#/components/schemas/PathFlow","forloopflow":"#/components/schemas/ForloopFlow","whileloopflow":"#/components/schemas/WhileloopFlow","branchone":"#/components/schemas/BranchOne","branchall":"#/components/schemas/BranchAll","identity":"#/components/schemas/Identity","aiagent":"#/components/schemas/AiAgent"}}},"RawScript":{"type":"object","description":"Inline script with code defined directly in the flow. Use 'bun' as default language if unspecified. The script receives arguments from input_transforms","properties":{"input_transforms":{"type":"object","description":"Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments","additionalProperties":{"$ref":"#/components/schemas/InputTransform"}},"content":{"type":"string","description":"The script source code. Should export a 'main' function"},"language":{"type":"string","description":"Programming language for this script","enum":["deno","bun","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."},"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\`: it is ignored when memory is off, and an older \`auto\` or\\n\`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"}}},"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).\\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"]},"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"]}}`,
84192
84840
  "raw-app": `---
84193
84841
  name: raw-app
84194
84842
  description: MUST use when creating raw apps.