@synergenius/flow-weaver 0.23.0 → 0.23.3

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.
@@ -935,8 +935,8 @@ var require_command = __commonJS({
935
935
  "node_modules/commander/lib/command.js"(exports2) {
936
936
  var EventEmitter2 = __require("events").EventEmitter;
937
937
  var childProcess = __require("child_process");
938
- var path52 = __require("path");
939
- var fs49 = __require("fs");
938
+ var path54 = __require("path");
939
+ var fs50 = __require("fs");
940
940
  var process6 = __require("process");
941
941
  var { Argument: Argument2, humanReadableArgName } = require_argument();
942
942
  var { CommanderError: CommanderError2 } = require_error();
@@ -1759,10 +1759,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1759
1759
  let launchWithNode = false;
1760
1760
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1761
1761
  function findFile(baseDir, baseName) {
1762
- const localBin = path52.resolve(baseDir, baseName);
1763
- if (fs49.existsSync(localBin)) return localBin;
1764
- if (sourceExt.includes(path52.extname(baseName))) return void 0;
1765
- const foundExt = sourceExt.find((ext2) => fs49.existsSync(`${localBin}${ext2}`));
1762
+ const localBin = path54.resolve(baseDir, baseName);
1763
+ if (fs50.existsSync(localBin)) return localBin;
1764
+ if (sourceExt.includes(path54.extname(baseName))) return void 0;
1765
+ const foundExt = sourceExt.find((ext2) => fs50.existsSync(`${localBin}${ext2}`));
1766
1766
  if (foundExt) return `${localBin}${foundExt}`;
1767
1767
  return void 0;
1768
1768
  }
@@ -1773,23 +1773,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
1773
1773
  if (this._scriptPath) {
1774
1774
  let resolvedScriptPath;
1775
1775
  try {
1776
- resolvedScriptPath = fs49.realpathSync(this._scriptPath);
1776
+ resolvedScriptPath = fs50.realpathSync(this._scriptPath);
1777
1777
  } catch (err) {
1778
1778
  resolvedScriptPath = this._scriptPath;
1779
1779
  }
1780
- executableDir = path52.resolve(path52.dirname(resolvedScriptPath), executableDir);
1780
+ executableDir = path54.resolve(path54.dirname(resolvedScriptPath), executableDir);
1781
1781
  }
1782
1782
  if (executableDir) {
1783
1783
  let localFile = findFile(executableDir, executableFile);
1784
1784
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1785
- const legacyName = path52.basename(this._scriptPath, path52.extname(this._scriptPath));
1785
+ const legacyName = path54.basename(this._scriptPath, path54.extname(this._scriptPath));
1786
1786
  if (legacyName !== this._name) {
1787
1787
  localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
1788
1788
  }
1789
1789
  }
1790
1790
  executableFile = localFile || executableFile;
1791
1791
  }
1792
- launchWithNode = sourceExt.includes(path52.extname(executableFile));
1792
+ launchWithNode = sourceExt.includes(path54.extname(executableFile));
1793
1793
  let proc2;
1794
1794
  if (process6.platform !== "win32") {
1795
1795
  if (launchWithNode) {
@@ -2572,7 +2572,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2572
2572
  * @return {Command}
2573
2573
  */
2574
2574
  nameFromFilename(filename) {
2575
- this._name = path52.basename(filename, path52.extname(filename));
2575
+ this._name = path54.basename(filename, path54.extname(filename));
2576
2576
  return this;
2577
2577
  }
2578
2578
  /**
@@ -2586,9 +2586,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2586
2586
  * @param {string} [path]
2587
2587
  * @return {string|null|Command}
2588
2588
  */
2589
- executableDir(path53) {
2590
- if (path53 === void 0) return this._executableDir;
2591
- this._executableDir = path53;
2589
+ executableDir(path55) {
2590
+ if (path55 === void 0) return this._executableDir;
2591
+ this._executableDir = path55;
2592
2592
  return this;
2593
2593
  }
2594
2594
  /**
@@ -6875,10 +6875,10 @@ var init_esm3 = __esm({
6875
6875
  * Return a void Promise that resolves once the stream ends.
6876
6876
  */
6877
6877
  async promise() {
6878
- return new Promise((resolve36, reject2) => {
6878
+ return new Promise((resolve38, reject2) => {
6879
6879
  this.on(DESTROYED, () => reject2(new Error("stream destroyed")));
6880
6880
  this.on("error", (er) => reject2(er));
6881
- this.on("end", () => resolve36());
6881
+ this.on("end", () => resolve38());
6882
6882
  });
6883
6883
  }
6884
6884
  /**
@@ -6902,7 +6902,7 @@ var init_esm3 = __esm({
6902
6902
  return Promise.resolve({ done: false, value: res });
6903
6903
  if (this[EOF])
6904
6904
  return stop();
6905
- let resolve36;
6905
+ let resolve38;
6906
6906
  let reject2;
6907
6907
  const onerr = (er) => {
6908
6908
  this.off("data", ondata);
@@ -6916,19 +6916,19 @@ var init_esm3 = __esm({
6916
6916
  this.off("end", onend);
6917
6917
  this.off(DESTROYED, ondestroy);
6918
6918
  this.pause();
6919
- resolve36({ value, done: !!this[EOF] });
6919
+ resolve38({ value, done: !!this[EOF] });
6920
6920
  };
6921
6921
  const onend = () => {
6922
6922
  this.off("error", onerr);
6923
6923
  this.off("data", ondata);
6924
6924
  this.off(DESTROYED, ondestroy);
6925
6925
  stop();
6926
- resolve36({ done: true, value: void 0 });
6926
+ resolve38({ done: true, value: void 0 });
6927
6927
  };
6928
6928
  const ondestroy = () => onerr(new Error("stream destroyed"));
6929
6929
  return new Promise((res2, rej) => {
6930
6930
  reject2 = rej;
6931
- resolve36 = res2;
6931
+ resolve38 = res2;
6932
6932
  this.once(DESTROYED, ondestroy);
6933
6933
  this.once("error", onerr);
6934
6934
  this.once("end", onend);
@@ -7303,12 +7303,12 @@ var init_esm4 = __esm({
7303
7303
  /**
7304
7304
  * Get the Path object referenced by the string path, resolved from this Path
7305
7305
  */
7306
- resolve(path52) {
7307
- if (!path52) {
7306
+ resolve(path54) {
7307
+ if (!path54) {
7308
7308
  return this;
7309
7309
  }
7310
- const rootPath = this.getRootString(path52);
7311
- const dir = path52.substring(rootPath.length);
7310
+ const rootPath = this.getRootString(path54);
7311
+ const dir = path54.substring(rootPath.length);
7312
7312
  const dirParts = dir.split(this.splitSep);
7313
7313
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
7314
7314
  return result;
@@ -7912,9 +7912,9 @@ var init_esm4 = __esm({
7912
7912
  if (this.#asyncReaddirInFlight) {
7913
7913
  await this.#asyncReaddirInFlight;
7914
7914
  } else {
7915
- let resolve36 = () => {
7915
+ let resolve38 = () => {
7916
7916
  };
7917
- this.#asyncReaddirInFlight = new Promise((res) => resolve36 = res);
7917
+ this.#asyncReaddirInFlight = new Promise((res) => resolve38 = res);
7918
7918
  try {
7919
7919
  for (const e of await this.#fs.promises.readdir(fullpath, {
7920
7920
  withFileTypes: true
@@ -7927,7 +7927,7 @@ var init_esm4 = __esm({
7927
7927
  children.provisional = 0;
7928
7928
  }
7929
7929
  this.#asyncReaddirInFlight = void 0;
7930
- resolve36();
7930
+ resolve38();
7931
7931
  }
7932
7932
  return children.slice(0, children.provisional);
7933
7933
  }
@@ -8060,8 +8060,8 @@ var init_esm4 = __esm({
8060
8060
  /**
8061
8061
  * @internal
8062
8062
  */
8063
- getRootString(path52) {
8064
- return win32.parse(path52).root;
8063
+ getRootString(path54) {
8064
+ return win32.parse(path54).root;
8065
8065
  }
8066
8066
  /**
8067
8067
  * @internal
@@ -8107,8 +8107,8 @@ var init_esm4 = __esm({
8107
8107
  /**
8108
8108
  * @internal
8109
8109
  */
8110
- getRootString(path52) {
8111
- return path52.startsWith("/") ? "/" : "";
8110
+ getRootString(path54) {
8111
+ return path54.startsWith("/") ? "/" : "";
8112
8112
  }
8113
8113
  /**
8114
8114
  * @internal
@@ -8157,8 +8157,8 @@ var init_esm4 = __esm({
8157
8157
  *
8158
8158
  * @internal
8159
8159
  */
8160
- constructor(cwd = process.cwd(), pathImpl, sep3, { nocase, childrenCacheSize = 16 * 1024, fs: fs49 = defaultFS } = {}) {
8161
- this.#fs = fsFromOption(fs49);
8160
+ constructor(cwd = process.cwd(), pathImpl, sep3, { nocase, childrenCacheSize = 16 * 1024, fs: fs50 = defaultFS } = {}) {
8161
+ this.#fs = fsFromOption(fs50);
8162
8162
  if (cwd instanceof URL || cwd.startsWith("file://")) {
8163
8163
  cwd = fileURLToPath(cwd);
8164
8164
  }
@@ -8197,11 +8197,11 @@ var init_esm4 = __esm({
8197
8197
  /**
8198
8198
  * Get the depth of a provided path, string, or the cwd
8199
8199
  */
8200
- depth(path52 = this.cwd) {
8201
- if (typeof path52 === "string") {
8202
- path52 = this.cwd.resolve(path52);
8200
+ depth(path54 = this.cwd) {
8201
+ if (typeof path54 === "string") {
8202
+ path54 = this.cwd.resolve(path54);
8203
8203
  }
8204
- return path52.depth();
8204
+ return path54.depth();
8205
8205
  }
8206
8206
  /**
8207
8207
  * Return the cache of child entries. Exposed so subclasses can create
@@ -8688,9 +8688,9 @@ var init_esm4 = __esm({
8688
8688
  process6();
8689
8689
  return results;
8690
8690
  }
8691
- chdir(path52 = this.cwd) {
8691
+ chdir(path54 = this.cwd) {
8692
8692
  const oldCwd = this.cwd;
8693
- this.cwd = typeof path52 === "string" ? this.cwd.resolve(path52) : path52;
8693
+ this.cwd = typeof path54 === "string" ? this.cwd.resolve(path54) : path54;
8694
8694
  this.cwd[setAsCwd](oldCwd);
8695
8695
  }
8696
8696
  };
@@ -8716,8 +8716,8 @@ var init_esm4 = __esm({
8716
8716
  /**
8717
8717
  * @internal
8718
8718
  */
8719
- newRoot(fs49) {
8720
- return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs49 });
8719
+ newRoot(fs50) {
8720
+ return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs50 });
8721
8721
  }
8722
8722
  /**
8723
8723
  * Return true if the provided path string is an absolute path
@@ -8745,8 +8745,8 @@ var init_esm4 = __esm({
8745
8745
  /**
8746
8746
  * @internal
8747
8747
  */
8748
- newRoot(fs49) {
8749
- return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs49 });
8748
+ newRoot(fs50) {
8749
+ return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs50 });
8750
8750
  }
8751
8751
  /**
8752
8752
  * Return true if the provided path string is an absolute path
@@ -9002,10 +9002,10 @@ var init_ignore = __esm({
9002
9002
  ignored(p) {
9003
9003
  const fullpath = p.fullpath();
9004
9004
  const fullpaths = `${fullpath}/`;
9005
- const relative9 = p.relative() || ".";
9006
- const relatives = `${relative9}/`;
9005
+ const relative10 = p.relative() || ".";
9006
+ const relatives = `${relative10}/`;
9007
9007
  for (const m of this.relative) {
9008
- if (m.match(relative9) || m.match(relatives))
9008
+ if (m.match(relative10) || m.match(relatives))
9009
9009
  return true;
9010
9010
  }
9011
9011
  for (const m of this.absolute) {
@@ -9016,9 +9016,9 @@ var init_ignore = __esm({
9016
9016
  }
9017
9017
  childrenIgnored(p) {
9018
9018
  const fullpath = p.fullpath() + "/";
9019
- const relative9 = (p.relative() || ".") + "/";
9019
+ const relative10 = (p.relative() || ".") + "/";
9020
9020
  for (const m of this.relativeChildren) {
9021
- if (m.match(relative9))
9021
+ if (m.match(relative10))
9022
9022
  return true;
9023
9023
  }
9024
9024
  for (const m of this.absoluteChildren) {
@@ -9065,8 +9065,8 @@ var init_processor = __esm({
9065
9065
  }
9066
9066
  // match, absolute, ifdir
9067
9067
  entries() {
9068
- return [...this.store.entries()].map(([path52, n]) => [
9069
- path52,
9068
+ return [...this.store.entries()].map(([path54, n]) => [
9069
+ path54,
9070
9070
  !!(n & 2),
9071
9071
  !!(n & 1)
9072
9072
  ]);
@@ -9279,9 +9279,9 @@ var init_walker = __esm({
9279
9279
  signal;
9280
9280
  maxDepth;
9281
9281
  includeChildMatches;
9282
- constructor(patterns, path52, opts) {
9282
+ constructor(patterns, path54, opts) {
9283
9283
  this.patterns = patterns;
9284
- this.path = path52;
9284
+ this.path = path54;
9285
9285
  this.opts = opts;
9286
9286
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
9287
9287
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -9300,11 +9300,11 @@ var init_walker = __esm({
9300
9300
  });
9301
9301
  }
9302
9302
  }
9303
- #ignored(path52) {
9304
- return this.seen.has(path52) || !!this.#ignore?.ignored?.(path52);
9303
+ #ignored(path54) {
9304
+ return this.seen.has(path54) || !!this.#ignore?.ignored?.(path54);
9305
9305
  }
9306
- #childrenIgnored(path52) {
9307
- return !!this.#ignore?.childrenIgnored?.(path52);
9306
+ #childrenIgnored(path54) {
9307
+ return !!this.#ignore?.childrenIgnored?.(path54);
9308
9308
  }
9309
9309
  // backpressure mechanism
9310
9310
  pause() {
@@ -9519,8 +9519,8 @@ var init_walker = __esm({
9519
9519
  };
9520
9520
  GlobWalker = class extends GlobUtil {
9521
9521
  matches = /* @__PURE__ */ new Set();
9522
- constructor(patterns, path52, opts) {
9523
- super(patterns, path52, opts);
9522
+ constructor(patterns, path54, opts) {
9523
+ super(patterns, path54, opts);
9524
9524
  }
9525
9525
  matchEmit(e) {
9526
9526
  this.matches.add(e);
@@ -9557,8 +9557,8 @@ var init_walker = __esm({
9557
9557
  };
9558
9558
  GlobStream = class extends GlobUtil {
9559
9559
  results;
9560
- constructor(patterns, path52, opts) {
9561
- super(patterns, path52, opts);
9560
+ constructor(patterns, path54, opts) {
9561
+ super(patterns, path54, opts);
9562
9562
  this.results = new Minipass({
9563
9563
  signal: this.signal,
9564
9564
  objectMode: true
@@ -9886,7 +9886,7 @@ var VERSION;
9886
9886
  var init_generated_version = __esm({
9887
9887
  "src/generated-version.ts"() {
9888
9888
  "use strict";
9889
- VERSION = "0.23.0";
9889
+ VERSION = "0.23.3";
9890
9890
  }
9891
9891
  });
9892
9892
 
@@ -13082,7 +13082,7 @@ var require_util = __commonJS({
13082
13082
  var normalize2 = createSafeHandler((url) => {
13083
13083
  });
13084
13084
  exports2.normalize = normalize2;
13085
- function join28(aRoot, aPath) {
13085
+ function join29(aRoot, aPath) {
13086
13086
  const pathType = getURLType(aPath);
13087
13087
  const rootType = getURLType(aRoot);
13088
13088
  aRoot = ensureDirectory(aRoot);
@@ -13112,12 +13112,12 @@ var require_util = __commonJS({
13112
13112
  const newPath = withBase(aPath, withBase(aRoot, base));
13113
13113
  return computeRelativeURL(base, newPath);
13114
13114
  }
13115
- exports2.join = join28;
13116
- function relative9(rootURL, targetURL) {
13115
+ exports2.join = join29;
13116
+ function relative10(rootURL, targetURL) {
13117
13117
  const result = relativeIfPossible(rootURL, targetURL);
13118
13118
  return typeof result === "string" ? result : normalize2(targetURL);
13119
13119
  }
13120
- exports2.relative = relative9;
13120
+ exports2.relative = relative10;
13121
13121
  function relativeIfPossible(rootURL, targetURL) {
13122
13122
  const urlType = getURLType(rootURL);
13123
13123
  if (urlType !== getURLType(targetURL)) {
@@ -13141,8 +13141,8 @@ var require_util = __commonJS({
13141
13141
  sourceURL = sourceURL.replace(/^\//, "");
13142
13142
  }
13143
13143
  let url = normalize2(sourceURL || "");
13144
- if (sourceRoot) url = join28(sourceRoot, url);
13145
- if (sourceMapURL) url = join28(trimFilename(sourceMapURL), url);
13144
+ if (sourceRoot) url = join29(sourceRoot, url);
13145
+ if (sourceMapURL) url = join29(trimFilename(sourceMapURL), url);
13146
13146
  return url;
13147
13147
  }
13148
13148
  exports2.computeSourceURL = computeSourceURL;
@@ -13693,17 +13693,17 @@ var require_binary_search = __commonJS({
13693
13693
  var require_read_wasm = __commonJS({
13694
13694
  "node_modules/source-map/lib/read-wasm.js"(exports2, module2) {
13695
13695
  "use strict";
13696
- var fs49 = __require("fs");
13697
- var path52 = __require("path");
13696
+ var fs50 = __require("fs");
13697
+ var path54 = __require("path");
13698
13698
  module2.exports = function readWasm() {
13699
- return new Promise((resolve36, reject2) => {
13700
- const wasmPath = path52.join(__dirname, "mappings.wasm");
13701
- fs49.readFile(wasmPath, null, (error2, data) => {
13699
+ return new Promise((resolve38, reject2) => {
13700
+ const wasmPath = path54.join(__dirname, "mappings.wasm");
13701
+ fs50.readFile(wasmPath, null, (error2, data) => {
13702
13702
  if (error2) {
13703
13703
  reject2(error2);
13704
13704
  return;
13705
13705
  }
13706
- resolve36(data.buffer);
13706
+ resolve38(data.buffer);
13707
13707
  });
13708
13708
  });
13709
13709
  };
@@ -15911,7 +15911,7 @@ is not a problem with esbuild. You need to fix your environment instead.
15911
15911
  let latestResultPromise;
15912
15912
  let provideLatestResult;
15913
15913
  if (isContext)
15914
- requestCallbacks["on-end"] = (id, request2) => new Promise((resolve36) => {
15914
+ requestCallbacks["on-end"] = (id, request2) => new Promise((resolve38) => {
15915
15915
  buildResponseToResult(request2, (err, result, onEndErrors, onEndWarnings) => {
15916
15916
  const response = {
15917
15917
  errors: onEndErrors,
@@ -15921,7 +15921,7 @@ is not a problem with esbuild. You need to fix your environment instead.
15921
15921
  latestResultPromise = void 0;
15922
15922
  provideLatestResult = void 0;
15923
15923
  sendResponse(id, response);
15924
- resolve36();
15924
+ resolve38();
15925
15925
  });
15926
15926
  });
15927
15927
  sendRequest(refs, request, (error2, response) => {
@@ -15938,10 +15938,10 @@ is not a problem with esbuild. You need to fix your environment instead.
15938
15938
  let didDispose = false;
15939
15939
  const result = {
15940
15940
  rebuild: () => {
15941
- if (!latestResultPromise) latestResultPromise = new Promise((resolve36, reject2) => {
15941
+ if (!latestResultPromise) latestResultPromise = new Promise((resolve38, reject2) => {
15942
15942
  let settlePromise;
15943
15943
  provideLatestResult = (err, result2) => {
15944
- if (!settlePromise) settlePromise = () => err ? reject2(err) : resolve36(result2);
15944
+ if (!settlePromise) settlePromise = () => err ? reject2(err) : resolve38(result2);
15945
15945
  };
15946
15946
  const triggerAnotherBuild = () => {
15947
15947
  const request2 = {
@@ -15962,7 +15962,7 @@ is not a problem with esbuild. You need to fix your environment instead.
15962
15962
  });
15963
15963
  return latestResultPromise;
15964
15964
  },
15965
- watch: (options2 = {}) => new Promise((resolve36, reject2) => {
15965
+ watch: (options2 = {}) => new Promise((resolve38, reject2) => {
15966
15966
  if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`);
15967
15967
  const keys2 = {};
15968
15968
  const delay = getFlag(options2, keys2, "delay", mustBeInteger);
@@ -15974,10 +15974,10 @@ is not a problem with esbuild. You need to fix your environment instead.
15974
15974
  if (delay) request2.delay = delay;
15975
15975
  sendRequest(refs, request2, (error22) => {
15976
15976
  if (error22) reject2(new Error(error22));
15977
- else resolve36(void 0);
15977
+ else resolve38(void 0);
15978
15978
  });
15979
15979
  }),
15980
- serve: (options2 = {}) => new Promise((resolve36, reject2) => {
15980
+ serve: (options2 = {}) => new Promise((resolve38, reject2) => {
15981
15981
  if (!streamIn.hasFS) throw new Error(`Cannot use the "serve" API in this environment`);
15982
15982
  const keys2 = {};
15983
15983
  const port = getFlag(options2, keys2, "port", mustBeValidPortNumber);
@@ -16015,28 +16015,28 @@ is not a problem with esbuild. You need to fix your environment instead.
16015
16015
  sendResponse(id, {});
16016
16016
  };
16017
16017
  }
16018
- resolve36(response2);
16018
+ resolve38(response2);
16019
16019
  });
16020
16020
  }),
16021
- cancel: () => new Promise((resolve36) => {
16022
- if (didDispose) return resolve36();
16021
+ cancel: () => new Promise((resolve38) => {
16022
+ if (didDispose) return resolve38();
16023
16023
  const request2 = {
16024
16024
  command: "cancel",
16025
16025
  key: buildKey
16026
16026
  };
16027
16027
  sendRequest(refs, request2, () => {
16028
- resolve36();
16028
+ resolve38();
16029
16029
  });
16030
16030
  }),
16031
- dispose: () => new Promise((resolve36) => {
16032
- if (didDispose) return resolve36();
16031
+ dispose: () => new Promise((resolve38) => {
16032
+ if (didDispose) return resolve38();
16033
16033
  didDispose = true;
16034
16034
  const request2 = {
16035
16035
  command: "dispose",
16036
16036
  key: buildKey
16037
16037
  };
16038
16038
  sendRequest(refs, request2, () => {
16039
- resolve36();
16039
+ resolve38();
16040
16040
  scheduleOnDisposeCallbacks();
16041
16041
  refs.unref();
16042
16042
  });
@@ -16075,7 +16075,7 @@ is not a problem with esbuild. You need to fix your environment instead.
16075
16075
  onLoad: []
16076
16076
  };
16077
16077
  i++;
16078
- let resolve36 = (path310, options = {}) => {
16078
+ let resolve38 = (path310, options = {}) => {
16079
16079
  if (!isSetupDone) throw new Error('Cannot call "resolve" before plugin setup has completed');
16080
16080
  if (typeof path310 !== "string") throw new Error(`The path to resolve must be a string`);
16081
16081
  let keys22 = /* @__PURE__ */ Object.create(null);
@@ -16119,7 +16119,7 @@ is not a problem with esbuild. You need to fix your environment instead.
16119
16119
  };
16120
16120
  let promise = setup({
16121
16121
  initialOptions,
16122
- resolve: resolve36,
16122
+ resolve: resolve38,
16123
16123
  onStart(callback) {
16124
16124
  let registeredText = `This error came from the "onStart" callback registered here:`;
16125
16125
  let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart");
@@ -16570,9 +16570,9 @@ ${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
16570
16570
  if (regexp.flags) result = `(?${regexp.flags})${result}`;
16571
16571
  return result;
16572
16572
  }
16573
- var fs49 = __require("fs");
16574
- var os4 = __require("os");
16575
- var path52 = __require("path");
16573
+ var fs50 = __require("fs");
16574
+ var os5 = __require("os");
16575
+ var path54 = __require("path");
16576
16576
  var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
16577
16577
  var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
16578
16578
  var packageDarwin_arm64 = "@esbuild/darwin-arm64";
@@ -16613,7 +16613,7 @@ ${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
16613
16613
  let pkg;
16614
16614
  let subpath;
16615
16615
  let isWASM = false;
16616
- let platformKey = `${process.platform} ${os4.arch()} ${os4.endianness()}`;
16616
+ let platformKey = `${process.platform} ${os5.arch()} ${os5.endianness()}`;
16617
16617
  if (platformKey in knownWindowsPackages) {
16618
16618
  pkg = knownWindowsPackages[platformKey];
16619
16619
  subpath = "esbuild.exe";
@@ -16631,19 +16631,19 @@ ${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
16631
16631
  }
16632
16632
  function pkgForSomeOtherPlatform() {
16633
16633
  const libMainJS = __require.resolve("esbuild");
16634
- const nodeModulesDirectory = path52.dirname(path52.dirname(path52.dirname(libMainJS)));
16635
- if (path52.basename(nodeModulesDirectory) === "node_modules") {
16634
+ const nodeModulesDirectory = path54.dirname(path54.dirname(path54.dirname(libMainJS)));
16635
+ if (path54.basename(nodeModulesDirectory) === "node_modules") {
16636
16636
  for (const unixKey in knownUnixlikePackages) {
16637
16637
  try {
16638
16638
  const pkg = knownUnixlikePackages[unixKey];
16639
- if (fs49.existsSync(path52.join(nodeModulesDirectory, pkg))) return pkg;
16639
+ if (fs50.existsSync(path54.join(nodeModulesDirectory, pkg))) return pkg;
16640
16640
  } catch {
16641
16641
  }
16642
16642
  }
16643
16643
  for (const windowsKey in knownWindowsPackages) {
16644
16644
  try {
16645
16645
  const pkg = knownWindowsPackages[windowsKey];
16646
- if (fs49.existsSync(path52.join(nodeModulesDirectory, pkg))) return pkg;
16646
+ if (fs50.existsSync(path54.join(nodeModulesDirectory, pkg))) return pkg;
16647
16647
  } catch {
16648
16648
  }
16649
16649
  }
@@ -16651,12 +16651,12 @@ ${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
16651
16651
  return null;
16652
16652
  }
16653
16653
  function downloadedBinPath(pkg, subpath) {
16654
- const esbuildLibDir = path52.dirname(__require.resolve("esbuild"));
16655
- return path52.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path52.basename(subpath)}`);
16654
+ const esbuildLibDir = path54.dirname(__require.resolve("esbuild"));
16655
+ return path54.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path54.basename(subpath)}`);
16656
16656
  }
16657
16657
  function generateBinPath() {
16658
16658
  if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
16659
- if (!fs49.existsSync(ESBUILD_BINARY_PATH)) {
16659
+ if (!fs50.existsSync(ESBUILD_BINARY_PATH)) {
16660
16660
  console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
16661
16661
  } else {
16662
16662
  return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
@@ -16668,7 +16668,7 @@ ${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
16668
16668
  binPath = __require.resolve(`${pkg}/${subpath}`);
16669
16669
  } catch (e) {
16670
16670
  binPath = downloadedBinPath(pkg, subpath);
16671
- if (!fs49.existsSync(binPath)) {
16671
+ if (!fs50.existsSync(binPath)) {
16672
16672
  try {
16673
16673
  __require.resolve(pkg);
16674
16674
  } catch {
@@ -16742,17 +16742,17 @@ for your current platform.`);
16742
16742
  }
16743
16743
  if (pnpapi) {
16744
16744
  const root2 = pnpapi.getPackageInformation(pnpapi.topLevel).packageLocation;
16745
- const binTargetPath = path52.join(
16745
+ const binTargetPath = path54.join(
16746
16746
  root2,
16747
16747
  "node_modules",
16748
16748
  ".cache",
16749
16749
  "esbuild",
16750
- `pnpapi-${pkg.replace("/", "-")}-${"0.27.3"}-${path52.basename(subpath)}`
16750
+ `pnpapi-${pkg.replace("/", "-")}-${"0.27.3"}-${path54.basename(subpath)}`
16751
16751
  );
16752
- if (!fs49.existsSync(binTargetPath)) {
16753
- fs49.mkdirSync(path52.dirname(binTargetPath), { recursive: true });
16754
- fs49.copyFileSync(binPath, binTargetPath);
16755
- fs49.chmodSync(binTargetPath, 493);
16752
+ if (!fs50.existsSync(binTargetPath)) {
16753
+ fs50.mkdirSync(path54.dirname(binTargetPath), { recursive: true });
16754
+ fs50.copyFileSync(binPath, binTargetPath);
16755
+ fs50.chmodSync(binTargetPath, 493);
16756
16756
  }
16757
16757
  return { binPath: binTargetPath, isWASM };
16758
16758
  }
@@ -16997,46 +16997,46 @@ More information: The file containing the code for esbuild's JavaScript API (${_
16997
16997
  }
16998
16998
  };
16999
16999
  longLivedService = {
17000
- build: (options) => new Promise((resolve36, reject2) => {
17000
+ build: (options) => new Promise((resolve38, reject2) => {
17001
17001
  service.buildOrContext({
17002
17002
  callName: "build",
17003
17003
  refs,
17004
17004
  options,
17005
17005
  isTTY: isTTY2(),
17006
17006
  defaultWD,
17007
- callback: (err, res) => err ? reject2(err) : resolve36(res)
17007
+ callback: (err, res) => err ? reject2(err) : resolve38(res)
17008
17008
  });
17009
17009
  }),
17010
- context: (options) => new Promise((resolve36, reject2) => service.buildOrContext({
17010
+ context: (options) => new Promise((resolve38, reject2) => service.buildOrContext({
17011
17011
  callName: "context",
17012
17012
  refs,
17013
17013
  options,
17014
17014
  isTTY: isTTY2(),
17015
17015
  defaultWD,
17016
- callback: (err, res) => err ? reject2(err) : resolve36(res)
17016
+ callback: (err, res) => err ? reject2(err) : resolve38(res)
17017
17017
  })),
17018
- transform: (input, options) => new Promise((resolve36, reject2) => service.transform({
17018
+ transform: (input, options) => new Promise((resolve38, reject2) => service.transform({
17019
17019
  callName: "transform",
17020
17020
  refs,
17021
17021
  input,
17022
17022
  options: options || {},
17023
17023
  isTTY: isTTY2(),
17024
17024
  fs: fsAsync,
17025
- callback: (err, res) => err ? reject2(err) : resolve36(res)
17025
+ callback: (err, res) => err ? reject2(err) : resolve38(res)
17026
17026
  })),
17027
- formatMessages: (messages, options) => new Promise((resolve36, reject2) => service.formatMessages({
17027
+ formatMessages: (messages, options) => new Promise((resolve38, reject2) => service.formatMessages({
17028
17028
  callName: "formatMessages",
17029
17029
  refs,
17030
17030
  messages,
17031
17031
  options,
17032
- callback: (err, res) => err ? reject2(err) : resolve36(res)
17032
+ callback: (err, res) => err ? reject2(err) : resolve38(res)
17033
17033
  })),
17034
- analyzeMetafile: (metafile, options) => new Promise((resolve36, reject2) => service.analyzeMetafile({
17034
+ analyzeMetafile: (metafile, options) => new Promise((resolve38, reject2) => service.analyzeMetafile({
17035
17035
  callName: "analyzeMetafile",
17036
17036
  refs,
17037
17037
  metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile),
17038
17038
  options,
17039
- callback: (err, res) => err ? reject2(err) : resolve36(res)
17039
+ callback: (err, res) => err ? reject2(err) : resolve38(res)
17040
17040
  }))
17041
17041
  };
17042
17042
  return longLivedService;
@@ -17114,13 +17114,13 @@ error: ${text}`);
17114
17114
  worker.postMessage(msg);
17115
17115
  let status = Atomics.wait(sharedBufferView, 0, 0);
17116
17116
  if (status !== "ok" && status !== "not-equal") throw new Error("Internal error: Atomics.wait() failed: " + status);
17117
- let { message: { id: id2, resolve: resolve36, reject: reject2, properties } } = worker_threads2.receiveMessageOnPort(mainPort);
17117
+ let { message: { id: id2, resolve: resolve38, reject: reject2, properties } } = worker_threads2.receiveMessageOnPort(mainPort);
17118
17118
  if (id !== id2) throw new Error(`Internal error: Expected id ${id} but got id ${id2}`);
17119
17119
  if (reject2) {
17120
17120
  applyProperties(reject2, properties);
17121
17121
  throw reject2;
17122
17122
  }
17123
- return resolve36;
17123
+ return resolve38;
17124
17124
  };
17125
17125
  worker.unref();
17126
17126
  return {
@@ -18252,9 +18252,9 @@ var init_port_tag_utils = __esm({
18252
18252
  });
18253
18253
 
18254
18254
  // src/sugar-optimizer.ts
18255
- function validatePathMacro(path52, connections, instances, nodeTypes, startPorts, exitPorts) {
18255
+ function validatePathMacro(path54, connections, instances, nodeTypes, startPorts, exitPorts) {
18256
18256
  const instanceIds = new Set(instances.map((inst) => inst.id));
18257
- for (const step of path52.steps) {
18257
+ for (const step of path54.steps) {
18258
18258
  if (step.node === "Start" || step.node === "Exit") continue;
18259
18259
  if (!instanceIds.has(step.node)) return false;
18260
18260
  }
@@ -18264,9 +18264,9 @@ function validatePathMacro(path52, connections, instances, nodeTypes, startPorts
18264
18264
  connKeys.add(`${conn.from.node}.${conn.from.port}->${conn.to.node}.${conn.to.port}`);
18265
18265
  }
18266
18266
  }
18267
- for (let i = 0; i < path52.steps.length - 1; i++) {
18268
- const current2 = path52.steps[i];
18269
- const next = path52.steps[i + 1];
18267
+ for (let i = 0; i < path54.steps.length - 1; i++) {
18268
+ const current2 = path54.steps[i];
18269
+ const next = path54.steps[i + 1];
18270
18270
  const route = current2.route || "ok";
18271
18271
  let expectedKey;
18272
18272
  if (current2.node === "Start") {
@@ -18312,7 +18312,7 @@ function validatePathMacro(path52, connections, instances, nodeTypes, startPorts
18312
18312
  const nt = getNodeType2(nodeId);
18313
18313
  return nt?.inputs || {};
18314
18314
  };
18315
- const { steps } = path52;
18315
+ const { steps } = path54;
18316
18316
  for (let i = 0; i < steps.length - 1; i++) {
18317
18317
  const nextId = steps[i + 1].node;
18318
18318
  if (nextId === "Exit") continue;
@@ -18434,12 +18434,12 @@ function detectSugarPatterns(connections, instances, existingMacros, nodeTypes,
18434
18434
  }
18435
18435
  const candidateRoutes = [];
18436
18436
  const MAX_ROUTES = 20;
18437
- function dfs(node, path52, visited) {
18437
+ function dfs(node, path54, visited) {
18438
18438
  if (candidateRoutes.length >= MAX_ROUTES) return;
18439
18439
  if (node === "Exit") {
18440
- path52.push({ node: "Exit" });
18441
- candidateRoutes.push([...path52]);
18442
- path52.pop();
18440
+ path54.push({ node: "Exit" });
18441
+ candidateRoutes.push([...path54]);
18442
+ path54.pop();
18443
18443
  return;
18444
18444
  }
18445
18445
  if (visited.has(node)) return;
@@ -18451,15 +18451,15 @@ function detectSugarPatterns(connections, instances, existingMacros, nodeTypes,
18451
18451
  }
18452
18452
  if (edges.ok && !coveredByExistingMacro.has(edges.ok === "Exit" ? "" : edges.ok)) {
18453
18453
  const step = node === "Start" ? { node: "Start" } : { node };
18454
- path52.push(step);
18455
- dfs(edges.ok, path52, visited);
18456
- path52.pop();
18454
+ path54.push(step);
18455
+ dfs(edges.ok, path54, visited);
18456
+ path54.pop();
18457
18457
  }
18458
18458
  if (edges.fail && !coveredByExistingMacro.has(edges.fail === "Exit" ? "" : edges.fail)) {
18459
18459
  const step = { node, route: "fail" };
18460
- path52.push(step);
18461
- dfs(edges.fail, path52, visited);
18462
- path52.pop();
18460
+ path54.push(step);
18461
+ dfs(edges.fail, path54, visited);
18462
+ path54.pop();
18463
18463
  }
18464
18464
  visited.delete(node);
18465
18465
  }
@@ -22078,11 +22078,11 @@ var init_toKey = __esm({
22078
22078
  });
22079
22079
 
22080
22080
  // node_modules/lodash-es/_baseGet.js
22081
- function baseGet(object3, path52) {
22082
- path52 = castPath_default(path52, object3);
22083
- var index = 0, length = path52.length;
22081
+ function baseGet(object3, path54) {
22082
+ path54 = castPath_default(path54, object3);
22083
+ var index = 0, length = path54.length;
22084
22084
  while (object3 != null && index < length) {
22085
- object3 = object3[toKey_default(path52[index++])];
22085
+ object3 = object3[toKey_default(path54[index++])];
22086
22086
  }
22087
22087
  return index && index == length ? object3 : void 0;
22088
22088
  }
@@ -22096,8 +22096,8 @@ var init_baseGet = __esm({
22096
22096
  });
22097
22097
 
22098
22098
  // node_modules/lodash-es/get.js
22099
- function get(object3, path52, defaultValue) {
22100
- var result = object3 == null ? void 0 : baseGet_default(object3, path52);
22099
+ function get(object3, path54, defaultValue) {
22100
+ var result = object3 == null ? void 0 : baseGet_default(object3, path54);
22101
22101
  return result === void 0 ? defaultValue : result;
22102
22102
  }
22103
22103
  var get_default;
@@ -23460,11 +23460,11 @@ var init_baseHasIn = __esm({
23460
23460
  });
23461
23461
 
23462
23462
  // node_modules/lodash-es/_hasPath.js
23463
- function hasPath(object3, path52, hasFunc) {
23464
- path52 = castPath_default(path52, object3);
23465
- var index = -1, length = path52.length, result = false;
23463
+ function hasPath(object3, path54, hasFunc) {
23464
+ path54 = castPath_default(path54, object3);
23465
+ var index = -1, length = path54.length, result = false;
23466
23466
  while (++index < length) {
23467
- var key = toKey_default(path52[index]);
23467
+ var key = toKey_default(path54[index]);
23468
23468
  if (!(result = object3 != null && hasFunc(object3, key))) {
23469
23469
  break;
23470
23470
  }
@@ -23490,8 +23490,8 @@ var init_hasPath = __esm({
23490
23490
  });
23491
23491
 
23492
23492
  // node_modules/lodash-es/hasIn.js
23493
- function hasIn(object3, path52) {
23494
- return object3 != null && hasPath_default(object3, path52, baseHasIn_default);
23493
+ function hasIn(object3, path54) {
23494
+ return object3 != null && hasPath_default(object3, path54, baseHasIn_default);
23495
23495
  }
23496
23496
  var hasIn_default;
23497
23497
  var init_hasIn = __esm({
@@ -23503,13 +23503,13 @@ var init_hasIn = __esm({
23503
23503
  });
23504
23504
 
23505
23505
  // node_modules/lodash-es/_baseMatchesProperty.js
23506
- function baseMatchesProperty(path52, srcValue) {
23507
- if (isKey_default(path52) && isStrictComparable_default(srcValue)) {
23508
- return matchesStrictComparable_default(toKey_default(path52), srcValue);
23506
+ function baseMatchesProperty(path54, srcValue) {
23507
+ if (isKey_default(path54) && isStrictComparable_default(srcValue)) {
23508
+ return matchesStrictComparable_default(toKey_default(path54), srcValue);
23509
23509
  }
23510
23510
  return function(object3) {
23511
- var objValue = get_default(object3, path52);
23512
- return objValue === void 0 && objValue === srcValue ? hasIn_default(object3, path52) : baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG6 | COMPARE_UNORDERED_FLAG4);
23511
+ var objValue = get_default(object3, path54);
23512
+ return objValue === void 0 && objValue === srcValue ? hasIn_default(object3, path54) : baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG6 | COMPARE_UNORDERED_FLAG4);
23513
23513
  };
23514
23514
  }
23515
23515
  var COMPARE_PARTIAL_FLAG6, COMPARE_UNORDERED_FLAG4, baseMatchesProperty_default;
@@ -23542,9 +23542,9 @@ var init_baseProperty = __esm({
23542
23542
  });
23543
23543
 
23544
23544
  // node_modules/lodash-es/_basePropertyDeep.js
23545
- function basePropertyDeep(path52) {
23545
+ function basePropertyDeep(path54) {
23546
23546
  return function(object3) {
23547
- return baseGet_default(object3, path52);
23547
+ return baseGet_default(object3, path54);
23548
23548
  };
23549
23549
  }
23550
23550
  var basePropertyDeep_default;
@@ -23556,8 +23556,8 @@ var init_basePropertyDeep = __esm({
23556
23556
  });
23557
23557
 
23558
23558
  // node_modules/lodash-es/property.js
23559
- function property(path52) {
23560
- return isKey_default(path52) ? baseProperty_default(toKey_default(path52)) : basePropertyDeep_default(path52);
23559
+ function property(path54) {
23560
+ return isKey_default(path54) ? baseProperty_default(toKey_default(path54)) : basePropertyDeep_default(path54);
23561
23561
  }
23562
23562
  var property_default;
23563
23563
  var init_property = __esm({
@@ -24176,8 +24176,8 @@ var init_baseHas = __esm({
24176
24176
  });
24177
24177
 
24178
24178
  // node_modules/lodash-es/has.js
24179
- function has(object3, path52) {
24180
- return object3 != null && hasPath_default(object3, path52, baseHas_default);
24179
+ function has(object3, path54) {
24180
+ return object3 != null && hasPath_default(object3, path54, baseHas_default);
24181
24181
  }
24182
24182
  var has_default;
24183
24183
  var init_has = __esm({
@@ -24383,14 +24383,14 @@ var init_negate = __esm({
24383
24383
  });
24384
24384
 
24385
24385
  // node_modules/lodash-es/_baseSet.js
24386
- function baseSet(object3, path52, value, customizer) {
24386
+ function baseSet(object3, path54, value, customizer) {
24387
24387
  if (!isObject_default(object3)) {
24388
24388
  return object3;
24389
24389
  }
24390
- path52 = castPath_default(path52, object3);
24391
- var index = -1, length = path52.length, lastIndex = length - 1, nested = object3;
24390
+ path54 = castPath_default(path54, object3);
24391
+ var index = -1, length = path54.length, lastIndex = length - 1, nested = object3;
24392
24392
  while (nested != null && ++index < length) {
24393
- var key = toKey_default(path52[index]), newValue = value;
24393
+ var key = toKey_default(path54[index]), newValue = value;
24394
24394
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
24395
24395
  return object3;
24396
24396
  }
@@ -24398,7 +24398,7 @@ function baseSet(object3, path52, value, customizer) {
24398
24398
  var objValue = nested[key];
24399
24399
  newValue = customizer ? customizer(objValue, key, nested) : void 0;
24400
24400
  if (newValue === void 0) {
24401
- newValue = isObject_default(objValue) ? objValue : isIndex_default(path52[index + 1]) ? [] : {};
24401
+ newValue = isObject_default(objValue) ? objValue : isIndex_default(path54[index + 1]) ? [] : {};
24402
24402
  }
24403
24403
  }
24404
24404
  assignValue_default(nested, key, newValue);
@@ -24422,9 +24422,9 @@ var init_baseSet = __esm({
24422
24422
  function basePickBy(object3, paths, predicate) {
24423
24423
  var index = -1, length = paths.length, result = {};
24424
24424
  while (++index < length) {
24425
- var path52 = paths[index], value = baseGet_default(object3, path52);
24426
- if (predicate(value, path52)) {
24427
- baseSet_default(result, castPath_default(path52, object3), value);
24425
+ var path54 = paths[index], value = baseGet_default(object3, path54);
24426
+ if (predicate(value, path54)) {
24427
+ baseSet_default(result, castPath_default(path54, object3), value);
24428
24428
  }
24429
24429
  }
24430
24430
  return result;
@@ -24448,8 +24448,8 @@ function pickBy(object3, predicate) {
24448
24448
  return [prop];
24449
24449
  });
24450
24450
  predicate = baseIteratee_default(predicate);
24451
- return basePickBy_default(object3, props, function(value, path52) {
24452
- return predicate(value, path52[0]);
24451
+ return basePickBy_default(object3, props, function(value, path54) {
24452
+ return predicate(value, path54[0]);
24453
24453
  });
24454
24454
  }
24455
24455
  var pickBy_default;
@@ -27196,12 +27196,12 @@ function assignCategoriesMapProp(tokenTypes) {
27196
27196
  singleAssignCategoriesToksMap([], currTokType);
27197
27197
  });
27198
27198
  }
27199
- function singleAssignCategoriesToksMap(path52, nextNode) {
27200
- forEach_default(path52, (pathNode) => {
27199
+ function singleAssignCategoriesToksMap(path54, nextNode) {
27200
+ forEach_default(path54, (pathNode) => {
27201
27201
  nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true;
27202
27202
  });
27203
27203
  forEach_default(nextNode.CATEGORIES, (nextCategory) => {
27204
- const newPath = path52.concat(nextNode);
27204
+ const newPath = path54.concat(nextNode);
27205
27205
  if (!includes_default(newPath, nextCategory)) {
27206
27206
  singleAssignCategoriesToksMap(newPath, nextCategory);
27207
27207
  }
@@ -28371,10 +28371,10 @@ var init_interpreter = __esm({
28371
28371
  init_rest();
28372
28372
  init_api2();
28373
28373
  AbstractNextPossibleTokensWalker = class extends RestWalker {
28374
- constructor(topProd, path52) {
28374
+ constructor(topProd, path54) {
28375
28375
  super();
28376
28376
  this.topProd = topProd;
28377
- this.path = path52;
28377
+ this.path = path54;
28378
28378
  this.possibleTokTypes = [];
28379
28379
  this.nextProductionName = "";
28380
28380
  this.nextProductionOccurrence = 0;
@@ -28418,9 +28418,9 @@ var init_interpreter = __esm({
28418
28418
  }
28419
28419
  };
28420
28420
  NextAfterTokenWalker = class extends AbstractNextPossibleTokensWalker {
28421
- constructor(topProd, path52) {
28422
- super(topProd, path52);
28423
- this.path = path52;
28421
+ constructor(topProd, path54) {
28422
+ super(topProd, path54);
28423
+ this.path = path54;
28424
28424
  this.nextTerminalName = "";
28425
28425
  this.nextTerminalOccurrence = 0;
28426
28426
  this.nextTerminalName = this.path.lastTok.name;
@@ -28661,10 +28661,10 @@ function initializeArrayOfArrays(size) {
28661
28661
  }
28662
28662
  return result;
28663
28663
  }
28664
- function pathToHashKeys(path52) {
28664
+ function pathToHashKeys(path54) {
28665
28665
  let keys2 = [""];
28666
- for (let i = 0; i < path52.length; i++) {
28667
- const tokType = path52[i];
28666
+ for (let i = 0; i < path54.length; i++) {
28667
+ const tokType = path54[i];
28668
28668
  const longerKeys = [];
28669
28669
  for (let j = 0; j < keys2.length; j++) {
28670
28670
  const currShorterKey = keys2[j];
@@ -28967,7 +28967,7 @@ function validateRuleIsOverridden(ruleName, definedRulesNames, className) {
28967
28967
  }
28968
28968
  return errors2;
28969
28969
  }
28970
- function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path52 = []) {
28970
+ function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path54 = []) {
28971
28971
  const errors2 = [];
28972
28972
  const nextNonTerminals = getFirstNoneTerminal(currRule.definition);
28973
28973
  if (isEmpty_default(nextNonTerminals)) {
@@ -28979,15 +28979,15 @@ function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path52 = [])
28979
28979
  errors2.push({
28980
28980
  message: errMsgProvider.buildLeftRecursionError({
28981
28981
  topLevelRule: topRule,
28982
- leftRecursionPath: path52
28982
+ leftRecursionPath: path54
28983
28983
  }),
28984
28984
  type: ParserDefinitionErrorType.LEFT_RECURSION,
28985
28985
  ruleName
28986
28986
  });
28987
28987
  }
28988
- const validNextSteps = difference_default(nextNonTerminals, path52.concat([topRule]));
28988
+ const validNextSteps = difference_default(nextNonTerminals, path54.concat([topRule]));
28989
28989
  const errorsFromNextSteps = flatMap_default(validNextSteps, (currRefRule) => {
28990
- const newPath = clone_default(path52);
28990
+ const newPath = clone_default(path54);
28991
28991
  newPath.push(currRefRule);
28992
28992
  return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath);
28993
28993
  });
@@ -35517,6 +35517,7 @@ var init_tag_registry = __esm({
35517
35517
  // src/marketplace/registry.ts
35518
35518
  var registry_exports = {};
35519
35519
  __export(registry_exports, {
35520
+ discoverDeviceHandlers: () => discoverDeviceHandlers,
35520
35521
  discoverDocTopics: () => discoverDocTopics,
35521
35522
  discoverInitContributions: () => discoverInitContributions,
35522
35523
  discoverTagHandlers: () => discoverTagHandlers,
@@ -35655,6 +35656,20 @@ async function discoverInitContributions(projectDir) {
35655
35656
  }
35656
35657
  return contributions;
35657
35658
  }
35659
+ async function discoverDeviceHandlers(projectDir) {
35660
+ const packages = await listInstalledPackages(projectDir);
35661
+ const handlers = [];
35662
+ for (const pkg of packages) {
35663
+ const manifest = pkg.manifest;
35664
+ if (!manifest.deviceHandlers) continue;
35665
+ handlers.push({
35666
+ packageName: pkg.name,
35667
+ packagePath: pkg.path,
35668
+ entrypoint: path5.join(pkg.path, manifest.deviceHandlers)
35669
+ });
35670
+ }
35671
+ return handlers;
35672
+ }
35658
35673
  var MARKETPLACE_KEYWORD, NPM_SEARCH_URL, PACK_NAME_RE;
35659
35674
  var init_registry = __esm({
35660
35675
  "src/marketplace/registry.ts"() {
@@ -39216,13 +39231,13 @@ Add '@param ${fromPort}' to the workflow JSDoc and include it in the params obje
39216
39231
  connections.filter((c) => c.from.node === c.to.node).map((c) => c.from.node)
39217
39232
  );
39218
39233
  const nonSelfLoopConnections = connections.filter((c) => c.from.node !== c.to.node);
39219
- const dfs = (nodeName, path52) => {
39234
+ const dfs = (nodeName, path54) => {
39220
39235
  if (recursionStack.has(nodeName)) {
39221
39236
  if (selfLoopNodes.has(nodeName)) {
39222
39237
  return false;
39223
39238
  }
39224
- const cycleStart = path52.indexOf(nodeName);
39225
- const cyclePath = [...path52.slice(cycleStart), nodeName];
39239
+ const cycleStart = path54.indexOf(nodeName);
39240
+ const cyclePath = [...path54.slice(cycleStart), nodeName];
39226
39241
  const cycleNodes = cyclePath.slice(0, -1);
39227
39242
  const sortedCycle = [...cycleNodes].sort();
39228
39243
  const cycleKey = sortedCycle.join(",");
@@ -39244,7 +39259,7 @@ Add '@param ${fromPort}' to the workflow JSDoc and include it in the params obje
39244
39259
  return false;
39245
39260
  }
39246
39261
  recursionStack.add(nodeName);
39247
- const newPath = [...path52, nodeName];
39262
+ const newPath = [...path54, nodeName];
39248
39263
  const instance = instances.find((n) => n.id === nodeName);
39249
39264
  if (!instance) {
39250
39265
  recursionStack.delete(nodeName);
@@ -40493,15 +40508,15 @@ async function loadAST(filePath) {
40493
40508
  async function saveASTAlongside(ast) {
40494
40509
  const sourceFile = ast.sourceFile;
40495
40510
  const dir = path7.dirname(sourceFile);
40496
- const basename20 = path7.basename(sourceFile, path7.extname(sourceFile));
40497
- const astFile = path7.join(dir, `${basename20}.ast.json`);
40511
+ const basename21 = path7.basename(sourceFile, path7.extname(sourceFile));
40512
+ const astFile = path7.join(dir, `${basename21}.ast.json`);
40498
40513
  await saveAST(ast, astFile);
40499
40514
  return astFile;
40500
40515
  }
40501
40516
  async function loadASTAlongside(sourceFile) {
40502
40517
  const dir = path7.dirname(sourceFile);
40503
- const basename20 = path7.basename(sourceFile, path7.extname(sourceFile));
40504
- const astFile = path7.join(dir, `${basename20}.ast.json`);
40518
+ const basename21 = path7.basename(sourceFile, path7.extname(sourceFile));
40519
+ const astFile = path7.join(dir, `${basename21}.ast.json`);
40505
40520
  return loadAST(astFile);
40506
40521
  }
40507
40522
  var init_serialization_node = __esm({
@@ -40582,8 +40597,8 @@ ${errorMessages.join("\n")}`);
40582
40597
  }
40583
40598
  function getDefaultOutputFile(sourceFile) {
40584
40599
  const dir = path8.dirname(sourceFile);
40585
- const basename20 = path8.basename(sourceFile, ".ts");
40586
- return path8.join(dir, `${basename20}.generated.ts`);
40600
+ const basename21 = path8.basename(sourceFile, ".ts");
40601
+ return path8.join(dir, `${basename21}.generated.ts`);
40587
40602
  }
40588
40603
  var init_compile = __esm({
40589
40604
  "src/api/compile.ts"() {
@@ -40829,7 +40844,7 @@ function processResult(result, scope) {
40829
40844
  }
40830
40845
  return result !== NOTHING ? result : void 0;
40831
40846
  }
40832
- function finalize(rootScope, value, path52) {
40847
+ function finalize(rootScope, value, path54) {
40833
40848
  if (isFrozen(value))
40834
40849
  return value;
40835
40850
  const useStrictIteration = rootScope.immer_.shouldUseStrictIteration();
@@ -40837,7 +40852,7 @@ function finalize(rootScope, value, path52) {
40837
40852
  if (!state) {
40838
40853
  each(
40839
40854
  value,
40840
- (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path52),
40855
+ (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path54),
40841
40856
  useStrictIteration
40842
40857
  );
40843
40858
  return value;
@@ -40867,16 +40882,16 @@ function finalize(rootScope, value, path52) {
40867
40882
  result,
40868
40883
  key,
40869
40884
  childValue,
40870
- path52,
40885
+ path54,
40871
40886
  isSet22
40872
40887
  ),
40873
40888
  useStrictIteration
40874
40889
  );
40875
40890
  maybeFreeze(rootScope, result, false);
40876
- if (path52 && rootScope.patches_) {
40891
+ if (path54 && rootScope.patches_) {
40877
40892
  getPlugin("Patches").generatePatches_(
40878
40893
  state,
40879
- path52,
40894
+ path54,
40880
40895
  rootScope.patches_,
40881
40896
  rootScope.inversePatches_
40882
40897
  );
@@ -40898,9 +40913,9 @@ function finalizeProperty(rootScope, parentState, targetObject, prop, childValue
40898
40913
  if (process.env.NODE_ENV !== "production" && childValue === targetObject)
40899
40914
  die(5);
40900
40915
  if (isDraft(childValue)) {
40901
- const path52 = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
40916
+ const path54 = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
40902
40917
  !has2(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;
40903
- const res = finalize(rootScope, childValue, path52);
40918
+ const res = finalize(rootScope, childValue, path54);
40904
40919
  set(targetObject, prop, res);
40905
40920
  if (isDraft(res)) {
40906
40921
  rootScope.canAutoFreeze_ = false;
@@ -42290,8 +42305,8 @@ var init_parseUtil = __esm({
42290
42305
  init_errors();
42291
42306
  init_en();
42292
42307
  makeIssue = (params) => {
42293
- const { data, path: path52, errorMaps, issueData } = params;
42294
- const fullPath = [...path52, ...issueData.path || []];
42308
+ const { data, path: path54, errorMaps, issueData } = params;
42309
+ const fullPath = [...path54, ...issueData.path || []];
42295
42310
  const fullIssue = {
42296
42311
  ...issueData,
42297
42312
  path: fullPath
@@ -42599,11 +42614,11 @@ var init_types = __esm({
42599
42614
  init_parseUtil();
42600
42615
  init_util();
42601
42616
  ParseInputLazyPath = class {
42602
- constructor(parent, value, path52, key) {
42617
+ constructor(parent, value, path54, key) {
42603
42618
  this._cachedPath = [];
42604
42619
  this.parent = parent;
42605
42620
  this.data = value;
42606
- this._path = path52;
42621
+ this._path = path54;
42607
42622
  this._key = key;
42608
42623
  }
42609
42624
  get path() {
@@ -55816,14 +55831,14 @@ function waypointsToSvgPath(waypoints, cornerRadius) {
55816
55831
  radii[i + 1] *= scale;
55817
55832
  }
55818
55833
  }
55819
- let path52 = `M ${waypoints[0][0]},${waypoints[0][1]}`;
55834
+ let path54 = `M ${waypoints[0][0]},${waypoints[0][1]}`;
55820
55835
  for (let i = 1; i < waypoints.length - 1; i++) {
55821
55836
  const prev = waypoints[i - 1];
55822
55837
  const curr = waypoints[i];
55823
55838
  const next = waypoints[i + 1];
55824
55839
  const r = radii[i];
55825
55840
  if (r < 2) {
55826
- path52 += ` L ${curr[0]},${curr[1]}`;
55841
+ path54 += ` L ${curr[0]},${curr[1]}`;
55827
55842
  continue;
55828
55843
  }
55829
55844
  const dPrev = [prev[0] - curr[0], prev[1] - curr[1]];
@@ -55836,12 +55851,12 @@ function waypointsToSvgPath(waypoints, cornerRadius) {
55836
55851
  const arcEnd = [curr[0] + uNext[0] * r, curr[1] + uNext[1] * r];
55837
55852
  const cross = dPrev[0] * dNext[1] - dPrev[1] * dNext[0];
55838
55853
  const sweep = cross > 0 ? 0 : 1;
55839
- path52 += ` L ${arcStart[0]},${arcStart[1]}`;
55840
- path52 += ` A ${r} ${r} 0 0 ${sweep} ${arcEnd[0]},${arcEnd[1]}`;
55854
+ path54 += ` L ${arcStart[0]},${arcStart[1]}`;
55855
+ path54 += ` A ${r} ${r} 0 0 ${sweep} ${arcEnd[0]},${arcEnd[1]}`;
55841
55856
  }
55842
55857
  const last2 = waypoints[waypoints.length - 1];
55843
- path52 += ` L ${last2[0]},${last2[1]}`;
55844
- return path52;
55858
+ path54 += ` L ${last2[0]},${last2[1]}`;
55859
+ return path54;
55845
55860
  }
55846
55861
  function computeWaypoints(from, to, nodeBoxes, sourceNodeId, targetNodeId, padding, exitStub, entryStub, allocator) {
55847
55862
  const isSelfConnection = sourceNodeId === targetNodeId;
@@ -55988,7 +56003,7 @@ function calculateOrthogonalPath(from, to, nodeBoxes, sourceNodeId, targetNodeId
55988
56003
  }
55989
56004
  function calculateOrthogonalPathSafe(from, to, nodeBoxes, sourceNodeId, targetNodeId, options, allocator) {
55990
56005
  try {
55991
- const path52 = calculateOrthogonalPath(
56006
+ const path54 = calculateOrthogonalPath(
55992
56007
  from,
55993
56008
  to,
55994
56009
  nodeBoxes,
@@ -55997,8 +56012,8 @@ function calculateOrthogonalPathSafe(from, to, nodeBoxes, sourceNodeId, targetNo
55997
56012
  options,
55998
56013
  allocator
55999
56014
  );
56000
- if (!path52 || path52.length < 5) return null;
56001
- return path52;
56015
+ if (!path54 || path54.length < 5) return null;
56016
+ return path54;
56002
56017
  } catch {
56003
56018
  return null;
56004
56019
  }
@@ -56222,13 +56237,13 @@ function computeConnectionPath(sx, sy, tx, ty) {
56222
56237
  const deUy = deY / deLen;
56223
56238
  const [cx, cy] = quadCurveControl(bx, by, dx, dy, -deUx, -deUy);
56224
56239
  const [fx, fy] = quadCurveControl(gx, gy, ex, ey, deUx, deUy);
56225
- let path52 = `M ${cx},${cy} M ${ax},${ay}`;
56226
- path52 += ` L ${bx},${by}`;
56227
- path52 += ` Q ${cx},${cy} ${dx},${dy}`;
56228
- path52 += ` L ${ex},${ey}`;
56229
- path52 += ` Q ${fx},${fy} ${gx},${gy}`;
56230
- path52 += ` L ${hx},${hy}`;
56231
- return path52;
56240
+ let path54 = `M ${cx},${cy} M ${ax},${ay}`;
56241
+ path54 += ` L ${bx},${by}`;
56242
+ path54 += ` Q ${cx},${cy} ${dx},${dy}`;
56243
+ path54 += ` L ${ex},${ey}`;
56244
+ path54 += ` Q ${fx},${fy} ${gx},${gy}`;
56245
+ path54 += ` L ${hx},${hy}`;
56246
+ return path54;
56232
56247
  }
56233
56248
  function orderedPorts(ports, direction) {
56234
56249
  const cloned = {};
@@ -56518,7 +56533,7 @@ function finalizeScopePositions(parentNode, ast, theme = "dark") {
56518
56533
  function buildConnection(fromNode, fromPort, toNode, toPort, sourcePort, targetPort, theme = "dark") {
56519
56534
  const sourceColor = getPortColor(sourcePort.dataType, sourcePort.isFailure, theme);
56520
56535
  const targetColor = getPortColor(targetPort.dataType, targetPort.isFailure, theme);
56521
- const path52 = computeConnectionPath(sourcePort.cx, sourcePort.cy, targetPort.cx, targetPort.cy);
56536
+ const path54 = computeConnectionPath(sourcePort.cx, sourcePort.cy, targetPort.cx, targetPort.cy);
56522
56537
  return {
56523
56538
  fromNode,
56524
56539
  fromPort,
@@ -56527,7 +56542,7 @@ function buildConnection(fromNode, fromPort, toNode, toPort, sourcePort, targetP
56527
56542
  sourceColor,
56528
56543
  targetColor,
56529
56544
  isStepConnection: sourcePort.dataType === "STEP",
56530
- path: path52
56545
+ path: path54
56531
56546
  };
56532
56547
  }
56533
56548
  function portsColumnHeight(count) {
@@ -56988,9 +57003,9 @@ function buildDiagramGraph(ast, options = {}) {
56988
57003
  color: targetColor,
56989
57004
  dashed
56990
57005
  };
56991
- let path52;
57006
+ let path54;
56992
57007
  if (xDistance > STUB_DISTANCE_THRESHOLD) {
56993
- path52 = "";
57008
+ path54 = "";
56994
57009
  } else if (!useCurve && distance > ORTHOGONAL_DISTANCE_THRESHOLD) {
56995
57010
  const orthoPath = calculateOrthogonalPathSafe(
56996
57011
  [sx, sy],
@@ -57001,9 +57016,9 @@ function buildDiagramGraph(ast, options = {}) {
57001
57016
  { fromPortIndex: pc3.fromPortIndex, toPortIndex: pc3.toPortIndex },
57002
57017
  allocator
57003
57018
  );
57004
- path52 = orthoPath ?? computeConnectionPath(sx, sy, tx, ty);
57019
+ path54 = orthoPath ?? computeConnectionPath(sx, sy, tx, ty);
57005
57020
  } else {
57006
- path52 = computeConnectionPath(sx, sy, tx, ty);
57021
+ path54 = computeConnectionPath(sx, sy, tx, ty);
57007
57022
  }
57008
57023
  connections.push({
57009
57024
  fromNode: pc3.fromNodeId,
@@ -57013,7 +57028,7 @@ function buildDiagramGraph(ast, options = {}) {
57013
57028
  sourceColor,
57014
57029
  targetColor,
57015
57030
  isStepConnection: pc3.sourcePort.dataType === "STEP",
57016
- path: path52,
57031
+ path: path54,
57017
57032
  sourceStub,
57018
57033
  targetStub
57019
57034
  });
@@ -57173,12 +57188,12 @@ function resolveDefaultIcon(nt) {
57173
57188
  if (nt.variant === "WORKFLOW" || nt.variant === "IMPORTED_WORKFLOW") return "flow";
57174
57189
  return "code";
57175
57190
  }
57176
- function pathExtent(path52) {
57191
+ function pathExtent(path54) {
57177
57192
  let minX = Infinity, minY = Infinity;
57178
57193
  let maxX = -Infinity, maxY = -Infinity;
57179
57194
  const pattern = /(-?[\d.]+),(-?[\d.]+)/g;
57180
57195
  let m;
57181
- while ((m = pattern.exec(path52)) !== null) {
57196
+ while ((m = pattern.exec(path54)) !== null) {
57182
57197
  const x = parseFloat(m[1]);
57183
57198
  const y = parseFloat(m[2]);
57184
57199
  minX = Math.min(minX, x);
@@ -57817,17 +57832,17 @@ function buildAdjacency(ast) {
57817
57832
  function enumeratePaths(ast) {
57818
57833
  const { fromStart, toExit, edges } = buildAdjacency(ast);
57819
57834
  const paths = [];
57820
- function dfs(current2, path52, visited) {
57835
+ function dfs(current2, path54, visited) {
57821
57836
  if (toExit.has(current2)) {
57822
- paths.push([...path52, "Exit"]);
57837
+ paths.push([...path54, "Exit"]);
57823
57838
  }
57824
57839
  const targets = edges.get(current2) || [];
57825
57840
  for (const next of targets) {
57826
57841
  if (!visited.has(next)) {
57827
57842
  visited.add(next);
57828
- path52.push(next);
57829
- dfs(next, path52, visited);
57830
- path52.pop();
57843
+ path54.push(next);
57844
+ dfs(next, path54, visited);
57845
+ path54.pop();
57831
57846
  visited.delete(next);
57832
57847
  }
57833
57848
  }
@@ -57841,22 +57856,22 @@ function enumeratePaths(ast) {
57841
57856
  function buildGraph(ast) {
57842
57857
  const { fromStart, toExit, edges } = buildAdjacency(ast);
57843
57858
  const lines = [];
57844
- function dfs(current2, path52, visited) {
57859
+ function dfs(current2, path54, visited) {
57845
57860
  if (toExit.has(current2)) {
57846
- lines.push([...path52, "Exit"].join(" -> "));
57861
+ lines.push([...path54, "Exit"].join(" -> "));
57847
57862
  }
57848
57863
  const targets = edges.get(current2) || [];
57849
57864
  for (const next of targets) {
57850
57865
  if (!visited.has(next)) {
57851
57866
  visited.add(next);
57852
- path52.push(next);
57853
- dfs(next, path52, visited);
57854
- path52.pop();
57867
+ path54.push(next);
57868
+ dfs(next, path54, visited);
57869
+ path54.pop();
57855
57870
  visited.delete(next);
57856
57871
  }
57857
57872
  }
57858
57873
  if (targets.length === 0 && !toExit.has(current2)) {
57859
- lines.push(path52.join(" -> "));
57874
+ lines.push(path54.join(" -> "));
57860
57875
  }
57861
57876
  }
57862
57877
  fromStart.forEach((startNode) => {
@@ -62070,13 +62085,13 @@ var init_promise_polyfill = __esm({
62070
62085
  // Available starting from Node 22
62071
62086
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
62072
62087
  static withResolver() {
62073
- let resolve36;
62088
+ let resolve38;
62074
62089
  let reject2;
62075
62090
  const promise = new Promise((res, rej) => {
62076
- resolve36 = res;
62091
+ resolve38 = res;
62077
62092
  reject2 = rej;
62078
62093
  });
62079
- return { promise, resolve: resolve36, reject: reject2 };
62094
+ return { promise, resolve: resolve38, reject: reject2 };
62080
62095
  }
62081
62096
  };
62082
62097
  }
@@ -62114,7 +62129,7 @@ function createPrompt(view) {
62114
62129
  output
62115
62130
  });
62116
62131
  const screen = new ScreenManager(rl);
62117
- const { promise, resolve: resolve36, reject: reject2 } = PromisePolyfill.withResolver();
62132
+ const { promise, resolve: resolve38, reject: reject2 } = PromisePolyfill.withResolver();
62118
62133
  const cancel = () => reject2(new CancelPromptError());
62119
62134
  if (signal) {
62120
62135
  const abort = () => reject2(new AbortPromptError({ cause: signal.reason }));
@@ -62141,7 +62156,7 @@ function createPrompt(view) {
62141
62156
  cycle(() => {
62142
62157
  try {
62143
62158
  const nextView = view(config2, (value) => {
62144
- setImmediate(() => resolve36(value));
62159
+ setImmediate(() => resolve38(value));
62145
62160
  });
62146
62161
  if (nextView === void 0) {
62147
62162
  const callerFilename = callSites[1]?.getFileName();
@@ -62952,13 +62967,13 @@ var init_promise_polyfill2 = __esm({
62952
62967
  // Available starting from Node 22
62953
62968
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
62954
62969
  static withResolver() {
62955
- let resolve36;
62970
+ let resolve38;
62956
62971
  let reject2;
62957
62972
  const promise = new Promise((res, rej) => {
62958
- resolve36 = res;
62973
+ resolve38 = res;
62959
62974
  reject2 = rej;
62960
62975
  });
62961
- return { promise, resolve: resolve36, reject: reject2 };
62976
+ return { promise, resolve: resolve38, reject: reject2 };
62962
62977
  }
62963
62978
  };
62964
62979
  }
@@ -62996,7 +63011,7 @@ function createPrompt2(view) {
62996
63011
  output
62997
63012
  });
62998
63013
  const screen = new ScreenManager2(rl);
62999
- const { promise, resolve: resolve36, reject: reject2 } = PromisePolyfill2.withResolver();
63014
+ const { promise, resolve: resolve38, reject: reject2 } = PromisePolyfill2.withResolver();
63000
63015
  const cancel = () => reject2(new CancelPromptError2());
63001
63016
  if (signal) {
63002
63017
  const abort = () => reject2(new AbortPromptError2({ cause: signal.reason }));
@@ -63023,7 +63038,7 @@ function createPrompt2(view) {
63023
63038
  cycle(() => {
63024
63039
  try {
63025
63040
  const nextView = view(config2, (value) => {
63026
- setImmediate(() => resolve36(value));
63041
+ setImmediate(() => resolve38(value));
63027
63042
  });
63028
63043
  if (nextView === void 0) {
63029
63044
  const callerFilename = callSites[1]?.getFileName();
@@ -63807,13 +63822,13 @@ var init_promise_polyfill3 = __esm({
63807
63822
  // Available starting from Node 22
63808
63823
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
63809
63824
  static withResolver() {
63810
- let resolve36;
63825
+ let resolve38;
63811
63826
  let reject2;
63812
63827
  const promise = new Promise((res, rej) => {
63813
- resolve36 = res;
63828
+ resolve38 = res;
63814
63829
  reject2 = rej;
63815
63830
  });
63816
- return { promise, resolve: resolve36, reject: reject2 };
63831
+ return { promise, resolve: resolve38, reject: reject2 };
63817
63832
  }
63818
63833
  };
63819
63834
  }
@@ -63851,7 +63866,7 @@ function createPrompt3(view) {
63851
63866
  output
63852
63867
  });
63853
63868
  const screen = new ScreenManager3(rl);
63854
- const { promise, resolve: resolve36, reject: reject2 } = PromisePolyfill3.withResolver();
63869
+ const { promise, resolve: resolve38, reject: reject2 } = PromisePolyfill3.withResolver();
63855
63870
  const cancel = () => reject2(new CancelPromptError3());
63856
63871
  if (signal) {
63857
63872
  const abort = () => reject2(new AbortPromptError3({ cause: signal.reason }));
@@ -63878,7 +63893,7 @@ function createPrompt3(view) {
63878
63893
  cycle(() => {
63879
63894
  try {
63880
63895
  const nextView = view(config2, (value) => {
63881
- setImmediate(() => resolve36(value));
63896
+ setImmediate(() => resolve38(value));
63882
63897
  });
63883
63898
  if (nextView === void 0) {
63884
63899
  const callerFilename = callSites[1]?.getFileName();
@@ -65437,15 +65452,15 @@ var require_route = __commonJS({
65437
65452
  };
65438
65453
  }
65439
65454
  function wrapConversion(toModel, graph) {
65440
- const path52 = [graph[toModel].parent, toModel];
65455
+ const path54 = [graph[toModel].parent, toModel];
65441
65456
  let fn = conversions[graph[toModel].parent][toModel];
65442
65457
  let cur = graph[toModel].parent;
65443
65458
  while (graph[cur].parent) {
65444
- path52.unshift(graph[cur].parent);
65459
+ path54.unshift(graph[cur].parent);
65445
65460
  fn = link(conversions[graph[cur].parent][cur], fn);
65446
65461
  cur = graph[cur].parent;
65447
65462
  }
65448
- fn.conversion = path52;
65463
+ fn.conversion = path54;
65449
65464
  return fn;
65450
65465
  }
65451
65466
  module2.exports = function(fromModel) {
@@ -67000,8 +67015,8 @@ async function loadPackTemplates(projectDir) {
67000
67015
  const templatesPath = await import("path").then(
67001
67016
  (p) => p.join(pkg.path, "templates.js")
67002
67017
  );
67003
- const { existsSync: existsSync36 } = await import("fs");
67004
- if (!existsSync36(templatesPath)) continue;
67018
+ const { existsSync: existsSync37 } = await import("fs");
67019
+ if (!existsSync37(templatesPath)) continue;
67005
67020
  const mod = await import(templatesPath);
67006
67021
  if (mod.workflowTemplates && Array.isArray(mod.workflowTemplates)) {
67007
67022
  for (const tmpl of mod.workflowTemplates) {
@@ -68249,8 +68264,8 @@ async function executeWorkflowFromFile(filePath, params, options) {
68249
68264
  `${path20.sep}dist${path20.sep}`
68250
68265
  );
68251
68266
  if (fs19.existsSync(distEquivalent)) {
68252
- const relative9 = path20.relative(srcDir, distEquivalent);
68253
- const posixRelative = relative9.replace(/\\/g, "/");
68267
+ const relative10 = path20.relative(srcDir, distEquivalent);
68268
+ const posixRelative = relative10.replace(/\\/g, "/");
68254
68269
  const normalized = posixRelative.startsWith(".") ? posixRelative : `./${posixRelative}`;
68255
68270
  return `from '${normalized}'`;
68256
68271
  }
@@ -68773,10 +68788,10 @@ function assignProp(target, prop, value) {
68773
68788
  configurable: true
68774
68789
  });
68775
68790
  }
68776
- function getElementAtPath(obj, path52) {
68777
- if (!path52)
68791
+ function getElementAtPath(obj, path54) {
68792
+ if (!path54)
68778
68793
  return obj;
68779
- return path52.reduce((acc, key) => acc?.[key], obj);
68794
+ return path54.reduce((acc, key) => acc?.[key], obj);
68780
68795
  }
68781
68796
  function promiseAllObject(promisesObj) {
68782
68797
  const keys2 = Object.keys(promisesObj);
@@ -69025,11 +69040,11 @@ function aborted(x, startIndex = 0) {
69025
69040
  }
69026
69041
  return false;
69027
69042
  }
69028
- function prefixIssues(path52, issues) {
69043
+ function prefixIssues(path54, issues) {
69029
69044
  return issues.map((iss) => {
69030
69045
  var _a2;
69031
69046
  (_a2 = iss).path ?? (_a2.path = []);
69032
- iss.path.unshift(path52);
69047
+ iss.path.unshift(path54);
69033
69048
  return iss;
69034
69049
  });
69035
69050
  }
@@ -77205,7 +77220,7 @@ var init_protocol = __esm({
77205
77220
  return;
77206
77221
  }
77207
77222
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
77208
- await new Promise((resolve36) => setTimeout(resolve36, pollInterval));
77223
+ await new Promise((resolve38) => setTimeout(resolve38, pollInterval));
77209
77224
  options?.signal?.throwIfAborted();
77210
77225
  }
77211
77226
  } catch (error2) {
@@ -77222,7 +77237,7 @@ var init_protocol = __esm({
77222
77237
  */
77223
77238
  request(request, resultSchema, options) {
77224
77239
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
77225
- return new Promise((resolve36, reject2) => {
77240
+ return new Promise((resolve38, reject2) => {
77226
77241
  const earlyReject = (error2) => {
77227
77242
  reject2(error2);
77228
77243
  };
@@ -77300,7 +77315,7 @@ var init_protocol = __esm({
77300
77315
  if (!parseResult.success) {
77301
77316
  reject2(parseResult.error);
77302
77317
  } else {
77303
- resolve36(parseResult.data);
77318
+ resolve38(parseResult.data);
77304
77319
  }
77305
77320
  } catch (error2) {
77306
77321
  reject2(error2);
@@ -77561,12 +77576,12 @@ var init_protocol = __esm({
77561
77576
  }
77562
77577
  } catch {
77563
77578
  }
77564
- return new Promise((resolve36, reject2) => {
77579
+ return new Promise((resolve38, reject2) => {
77565
77580
  if (signal.aborted) {
77566
77581
  reject2(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
77567
77582
  return;
77568
77583
  }
77569
- const timeoutId = setTimeout(resolve36, interval);
77584
+ const timeoutId = setTimeout(resolve38, interval);
77570
77585
  signal.addEventListener("abort", () => {
77571
77586
  clearTimeout(timeoutId);
77572
77587
  reject2(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -80593,7 +80608,7 @@ var require_compile = __commonJS({
80593
80608
  const schOrFunc = root2.refs[ref];
80594
80609
  if (schOrFunc)
80595
80610
  return schOrFunc;
80596
- let _sch = resolve36.call(this, root2, ref);
80611
+ let _sch = resolve38.call(this, root2, ref);
80597
80612
  if (_sch === void 0) {
80598
80613
  const schema2 = (_a2 = root2.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref];
80599
80614
  const { schemaId } = this.opts;
@@ -80620,7 +80635,7 @@ var require_compile = __commonJS({
80620
80635
  function sameSchemaEnv(s1, s2) {
80621
80636
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
80622
80637
  }
80623
- function resolve36(root2, ref) {
80638
+ function resolve38(root2, ref) {
80624
80639
  let sch;
80625
80640
  while (typeof (sch = this.refs[ref]) == "string")
80626
80641
  ref = sch;
@@ -80835,8 +80850,8 @@ var require_utils = __commonJS({
80835
80850
  }
80836
80851
  return ind;
80837
80852
  }
80838
- function removeDotSegments(path52) {
80839
- let input = path52;
80853
+ function removeDotSegments(path54) {
80854
+ let input = path54;
80840
80855
  const output = [];
80841
80856
  let nextSlash = -1;
80842
80857
  let len = 0;
@@ -81035,8 +81050,8 @@ var require_schemes = __commonJS({
81035
81050
  wsComponent.secure = void 0;
81036
81051
  }
81037
81052
  if (wsComponent.resourceName) {
81038
- const [path52, query] = wsComponent.resourceName.split("?");
81039
- wsComponent.path = path52 && path52 !== "/" ? path52 : void 0;
81053
+ const [path54, query] = wsComponent.resourceName.split("?");
81054
+ wsComponent.path = path54 && path54 !== "/" ? path54 : void 0;
81040
81055
  wsComponent.query = query;
81041
81056
  wsComponent.resourceName = void 0;
81042
81057
  }
@@ -81195,55 +81210,55 @@ var require_fast_uri = __commonJS({
81195
81210
  }
81196
81211
  return uri;
81197
81212
  }
81198
- function resolve36(baseURI, relativeURI, options) {
81213
+ function resolve38(baseURI, relativeURI, options) {
81199
81214
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
81200
81215
  const resolved = resolveComponent(parse5(baseURI, schemelessOptions), parse5(relativeURI, schemelessOptions), schemelessOptions, true);
81201
81216
  schemelessOptions.skipEscape = true;
81202
81217
  return serialize(resolved, schemelessOptions);
81203
81218
  }
81204
- function resolveComponent(base, relative9, options, skipNormalization) {
81219
+ function resolveComponent(base, relative10, options, skipNormalization) {
81205
81220
  const target = {};
81206
81221
  if (!skipNormalization) {
81207
81222
  base = parse5(serialize(base, options), options);
81208
- relative9 = parse5(serialize(relative9, options), options);
81223
+ relative10 = parse5(serialize(relative10, options), options);
81209
81224
  }
81210
81225
  options = options || {};
81211
- if (!options.tolerant && relative9.scheme) {
81212
- target.scheme = relative9.scheme;
81213
- target.userinfo = relative9.userinfo;
81214
- target.host = relative9.host;
81215
- target.port = relative9.port;
81216
- target.path = removeDotSegments(relative9.path || "");
81217
- target.query = relative9.query;
81226
+ if (!options.tolerant && relative10.scheme) {
81227
+ target.scheme = relative10.scheme;
81228
+ target.userinfo = relative10.userinfo;
81229
+ target.host = relative10.host;
81230
+ target.port = relative10.port;
81231
+ target.path = removeDotSegments(relative10.path || "");
81232
+ target.query = relative10.query;
81218
81233
  } else {
81219
- if (relative9.userinfo !== void 0 || relative9.host !== void 0 || relative9.port !== void 0) {
81220
- target.userinfo = relative9.userinfo;
81221
- target.host = relative9.host;
81222
- target.port = relative9.port;
81223
- target.path = removeDotSegments(relative9.path || "");
81224
- target.query = relative9.query;
81234
+ if (relative10.userinfo !== void 0 || relative10.host !== void 0 || relative10.port !== void 0) {
81235
+ target.userinfo = relative10.userinfo;
81236
+ target.host = relative10.host;
81237
+ target.port = relative10.port;
81238
+ target.path = removeDotSegments(relative10.path || "");
81239
+ target.query = relative10.query;
81225
81240
  } else {
81226
- if (!relative9.path) {
81241
+ if (!relative10.path) {
81227
81242
  target.path = base.path;
81228
- if (relative9.query !== void 0) {
81229
- target.query = relative9.query;
81243
+ if (relative10.query !== void 0) {
81244
+ target.query = relative10.query;
81230
81245
  } else {
81231
81246
  target.query = base.query;
81232
81247
  }
81233
81248
  } else {
81234
- if (relative9.path[0] === "/") {
81235
- target.path = removeDotSegments(relative9.path);
81249
+ if (relative10.path[0] === "/") {
81250
+ target.path = removeDotSegments(relative10.path);
81236
81251
  } else {
81237
81252
  if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
81238
- target.path = "/" + relative9.path;
81253
+ target.path = "/" + relative10.path;
81239
81254
  } else if (!base.path) {
81240
- target.path = relative9.path;
81255
+ target.path = relative10.path;
81241
81256
  } else {
81242
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative9.path;
81257
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative10.path;
81243
81258
  }
81244
81259
  target.path = removeDotSegments(target.path);
81245
81260
  }
81246
- target.query = relative9.query;
81261
+ target.query = relative10.query;
81247
81262
  }
81248
81263
  target.userinfo = base.userinfo;
81249
81264
  target.host = base.host;
@@ -81251,7 +81266,7 @@ var require_fast_uri = __commonJS({
81251
81266
  }
81252
81267
  target.scheme = base.scheme;
81253
81268
  }
81254
- target.fragment = relative9.fragment;
81269
+ target.fragment = relative10.fragment;
81255
81270
  return target;
81256
81271
  }
81257
81272
  function equal(uriA, uriB, options) {
@@ -81422,7 +81437,7 @@ var require_fast_uri = __commonJS({
81422
81437
  var fastUri = {
81423
81438
  SCHEMES,
81424
81439
  normalize: normalize2,
81425
- resolve: resolve36,
81440
+ resolve: resolve38,
81426
81441
  resolveComponent,
81427
81442
  equal,
81428
81443
  serialize,
@@ -84398,12 +84413,12 @@ var require_dist = __commonJS({
84398
84413
  throw new Error(`Unknown format "${name}"`);
84399
84414
  return f;
84400
84415
  };
84401
- function addFormats(ajv, list, fs49, exportName) {
84416
+ function addFormats(ajv, list, fs50, exportName) {
84402
84417
  var _a2;
84403
84418
  var _b;
84404
84419
  (_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
84405
84420
  for (const f of list)
84406
- ajv.addFormat(f, fs49[f]);
84421
+ ajv.addFormat(f, fs50[f]);
84407
84422
  }
84408
84423
  module2.exports = exports2 = formatsPlugin;
84409
84424
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -85396,7 +85411,7 @@ var init_mcp = __esm({
85396
85411
  let task = createTaskResult.task;
85397
85412
  const pollInterval = task.pollInterval ?? 5e3;
85398
85413
  while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
85399
- await new Promise((resolve36) => setTimeout(resolve36, pollInterval));
85414
+ await new Promise((resolve38) => setTimeout(resolve38, pollInterval));
85400
85415
  const updatedTask = await extra.taskStore.getTask(taskId);
85401
85416
  if (!updatedTask) {
85402
85417
  throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
@@ -85987,12 +86002,12 @@ var init_stdio2 = __esm({
85987
86002
  this.onclose?.();
85988
86003
  }
85989
86004
  send(message) {
85990
- return new Promise((resolve36) => {
86005
+ return new Promise((resolve38) => {
85991
86006
  const json2 = serializeMessage(message);
85992
86007
  if (this._stdout.write(json2)) {
85993
- resolve36();
86008
+ resolve38();
85994
86009
  } else {
85995
- this._stdout.once("drain", resolve36);
86010
+ this._stdout.once("drain", resolve38);
85996
86011
  }
85997
86012
  });
85998
86013
  }
@@ -86270,8 +86285,8 @@ ${parseResult.errors.join("\n")}`);
86270
86285
  });
86271
86286
  const outputFile = filePath.replace(/\.ts$/, `.${args.target}.ts`);
86272
86287
  if (args.write !== false) {
86273
- const fs49 = await import("fs");
86274
- fs49.writeFileSync(outputFile, code, "utf8");
86288
+ const fs50 = await import("fs");
86289
+ fs50.writeFileSync(outputFile, code, "utf8");
86275
86290
  }
86276
86291
  return makeToolResult({
86277
86292
  target: args.target,
@@ -87652,8 +87667,8 @@ var init_adapters = __esm({
87652
87667
  * Extract workflow ID from file path (uses filename without extension)
87653
87668
  */
87654
87669
  extractWorkflowId(filePath) {
87655
- const basename20 = path25.basename(filePath, path25.extname(filePath));
87656
- return basename20;
87670
+ const basename21 = path25.basename(filePath, path25.extname(filePath));
87671
+ return basename21;
87657
87672
  }
87658
87673
  };
87659
87674
  HttpRequestAdapter = class extends BaseRequestAdapter {
@@ -88324,8 +88339,8 @@ var init_generator = __esm({
88324
88339
  doc.paths["/health"] = this.generateHealthEndpoint();
88325
88340
  doc.paths["/workflows"] = this.generateListEndpoint();
88326
88341
  for (const endpoint of endpoints) {
88327
- const path52 = options.basePath ? `${options.basePath}${endpoint.path}` : endpoint.path;
88328
- doc.paths[path52] = this.generateWorkflowEndpoint(endpoint);
88342
+ const path54 = options.basePath ? `${options.basePath}${endpoint.path}` : endpoint.path;
88343
+ doc.paths[path54] = this.generateWorkflowEndpoint(endpoint);
88329
88344
  }
88330
88345
  return doc;
88331
88346
  }
@@ -88663,8 +88678,8 @@ var init_base = __esm({
88663
88678
  * Get relative import path for the workflow
88664
88679
  */
88665
88680
  getWorkflowImport(workflowFile) {
88666
- const basename20 = path27.basename(workflowFile, path27.extname(workflowFile));
88667
- return `./${basename20}.js`;
88681
+ const basename21 = path27.basename(workflowFile, path27.extname(workflowFile));
88682
+ return `./${basename21}.js`;
88668
88683
  }
88669
88684
  /**
88670
88685
  * Generate OpenAPI spec for node types as HTTP endpoints
@@ -90723,8 +90738,8 @@ var init_debug_controller = __esm({
90723
90738
  async pause(nodeId, phase, ctx) {
90724
90739
  const state = this.buildState(nodeId, phase, ctx);
90725
90740
  this._pauseResolve?.(state);
90726
- return new Promise((resolve36) => {
90727
- this._gateResolve = (action) => resolve36(action);
90741
+ return new Promise((resolve38) => {
90742
+ this._gateResolve = (action) => resolve38(action);
90728
90743
  });
90729
90744
  }
90730
90745
  applyAction(action) {
@@ -90785,8 +90800,8 @@ var init_debug_controller = __esm({
90785
90800
  return outputs;
90786
90801
  }
90787
90802
  _createPausePromise() {
90788
- return new Promise((resolve36) => {
90789
- this._pauseResolve = resolve36;
90803
+ return new Promise((resolve38) => {
90804
+ this._pauseResolve = resolve38;
90790
90805
  });
90791
90806
  }
90792
90807
  };
@@ -90985,8 +91000,8 @@ var init_agent_channel = __esm({
90985
91000
  */
90986
91001
  async request(agentRequest) {
90987
91002
  this._pauseResolve?.(agentRequest);
90988
- return new Promise((resolve36, reject2) => {
90989
- this._resolve = resolve36;
91003
+ return new Promise((resolve38, reject2) => {
91004
+ this._resolve = resolve38;
90990
91005
  this._reject = reject2;
90991
91006
  });
90992
91007
  }
@@ -91016,8 +91031,8 @@ var init_agent_channel = __esm({
91016
91031
  this._pausePromise = this._createPausePromise();
91017
91032
  }
91018
91033
  _createPausePromise() {
91019
- return new Promise((resolve36) => {
91020
- this._pauseResolve = resolve36;
91034
+ return new Promise((resolve38) => {
91035
+ this._pauseResolve = resolve38;
91021
91036
  });
91022
91037
  }
91023
91038
  };
@@ -92649,13 +92664,13 @@ async function runDebugRepl(controller, execPromise, agentChannel, options) {
92649
92664
  output: process.stderr,
92650
92665
  prompt: "> "
92651
92666
  });
92652
- return new Promise((resolve36, reject2) => {
92667
+ return new Promise((resolve38, reject2) => {
92653
92668
  let resolved = false;
92654
92669
  function finish(value) {
92655
92670
  if (resolved) return;
92656
92671
  resolved = true;
92657
92672
  rl.close();
92658
- resolve36(value);
92673
+ resolve38(value);
92659
92674
  }
92660
92675
  function fail(err) {
92661
92676
  if (resolved) return;
@@ -92867,7 +92882,7 @@ Workflow completed in ${execResult.executionTime}ms`);
92867
92882
  });
92868
92883
  }
92869
92884
  function promptForInput(question) {
92870
- return new Promise((resolve36) => {
92885
+ return new Promise((resolve38) => {
92871
92886
  const rl = readline8.createInterface({
92872
92887
  input: process.stdin,
92873
92888
  output: process.stderr
@@ -92875,7 +92890,7 @@ function promptForInput(question) {
92875
92890
  });
92876
92891
  rl.question(question, (answer) => {
92877
92892
  rl.close();
92878
- resolve36(answer.trim());
92893
+ resolve38(answer.trim());
92879
92894
  });
92880
92895
  });
92881
92896
  }
@@ -95088,14 +95103,14 @@ var init_platform_client = __esm({
95088
95103
  this.baseUrl = creds.platformUrl.replace(/\/+$/, "");
95089
95104
  this.token = creds.token;
95090
95105
  }
95091
- async fetch(path52, opts = {}) {
95106
+ async fetch(path54, opts = {}) {
95092
95107
  const isApiKey = this.token.startsWith("fw_");
95093
95108
  const headers = {
95094
95109
  "Content-Type": "application/json",
95095
95110
  ...isApiKey ? { "X-API-Key": this.token } : { Authorization: `Bearer ${this.token}` },
95096
95111
  ...opts.headers ?? {}
95097
95112
  };
95098
- return fetch(`${this.baseUrl}${path52}`, { ...opts, headers });
95113
+ return fetch(`${this.baseUrl}${path54}`, { ...opts, headers });
95099
95114
  }
95100
95115
  // Auth
95101
95116
  async getUser() {
@@ -95201,8 +95216,9 @@ __export(auth_exports, {
95201
95216
  import * as readline9 from "node:readline";
95202
95217
  async function loginCommand(options) {
95203
95218
  const platformUrl = options.platformUrl ?? getPlatformUrl();
95219
+ const displayUrl = platformUrl.replace(/^https?:\/\//, "");
95204
95220
  console.log("");
95205
- console.log(" \x1B[1mFlow Weaver Cloud\x1B[0m \x1B[2m(flowweaver.ai)\x1B[0m");
95221
+ console.log(` \x1B[1mFlow Weaver\x1B[0m \x1B[2m(${displayUrl})\x1B[0m`);
95206
95222
  console.log("");
95207
95223
  if (options.apiKey) {
95208
95224
  await loginWithApiKey(options.apiKey, platformUrl);
@@ -95234,8 +95250,8 @@ async function loginWithBrowser(platformUrl) {
95234
95250
  verificationUrl = data.verificationUrl;
95235
95251
  interval = data.interval ?? 5;
95236
95252
  } catch {
95237
- console.error(" \x1B[31m\u2717\x1B[0m Cannot connect to flowweaver.ai");
95238
- console.error(" Check your internet connection or set FW_PLATFORM_URL");
95253
+ console.error(` \x1B[31m\u2717\x1B[0m Cannot connect to ${platformUrl}`);
95254
+ console.error(" Check the URL or set FW_PLATFORM_URL");
95239
95255
  process.exit(1);
95240
95256
  return;
95241
95257
  }
@@ -95252,21 +95268,26 @@ async function loginWithBrowser(platformUrl) {
95252
95268
  console.log(` \x1B[36m${authUrl}\x1B[0m`);
95253
95269
  }
95254
95270
  console.log("");
95255
- process.stdout.write(" Waiting for authentication...");
95271
+ process.stderr.write(" Waiting for approval");
95256
95272
  let cancelled = false;
95257
95273
  const sigHandler = () => {
95258
95274
  cancelled = true;
95259
95275
  };
95260
95276
  process.on("SIGINT", sigHandler);
95261
95277
  const maxAttempts = 120;
95278
+ let networkErrors = 0;
95262
95279
  for (let i = 0; i < maxAttempts && !cancelled; i++) {
95263
95280
  await new Promise((r) => setTimeout(r, interval * 1e3));
95264
95281
  try {
95265
95282
  const resp = await fetch(`${platformUrl}/auth/device/poll?deviceCode=${deviceCode}`);
95266
- if (!resp.ok) continue;
95283
+ networkErrors = 0;
95284
+ if (!resp.ok) {
95285
+ process.stderr.write(".");
95286
+ continue;
95287
+ }
95267
95288
  const data = await resp.json();
95268
95289
  if (data.status === "approved" && data.token && data.user) {
95269
- process.stdout.write(" \x1B[32m\u2713\x1B[0m\n\n");
95290
+ process.stderr.write(" \x1B[32m\u2713\x1B[0m\n\n");
95270
95291
  saveCredentials({
95271
95292
  token: data.token,
95272
95293
  email: data.user.email,
@@ -95283,7 +95304,7 @@ async function loginWithBrowser(platformUrl) {
95283
95304
  return;
95284
95305
  }
95285
95306
  if (data.status === "expired") {
95286
- process.stdout.write(" \x1B[31mtimed out\x1B[0m\n\n");
95307
+ process.stderr.write(" \x1B[31mtimed out\x1B[0m\n\n");
95287
95308
  console.log(" Code expired. Run \x1B[36mfw login\x1B[0m again.");
95288
95309
  console.log("");
95289
95310
  process.removeListener("SIGINT", sigHandler);
@@ -95291,22 +95312,27 @@ async function loginWithBrowser(platformUrl) {
95291
95312
  return;
95292
95313
  }
95293
95314
  if (data.status === "denied") {
95294
- process.stdout.write(" \x1B[31mdenied\x1B[0m\n\n");
95315
+ process.stderr.write(" \x1B[31mdenied\x1B[0m\n\n");
95295
95316
  console.log(" Access denied.");
95296
95317
  console.log("");
95297
95318
  process.removeListener("SIGINT", sigHandler);
95298
95319
  process.exit(1);
95299
95320
  return;
95300
95321
  }
95301
- if (i % 4 === 3) process.stdout.write(".");
95322
+ process.stderr.write(".");
95302
95323
  } catch {
95324
+ networkErrors++;
95325
+ if (networkErrors >= 3) {
95326
+ process.stderr.write(" \x1B[33m!\x1B[0m");
95327
+ networkErrors = 0;
95328
+ }
95303
95329
  }
95304
95330
  }
95305
95331
  process.removeListener("SIGINT", sigHandler);
95306
95332
  if (cancelled) {
95307
- process.stdout.write(" \x1B[33mcancelled\x1B[0m\n\n");
95333
+ process.stderr.write(" \x1B[33mcancelled\x1B[0m\n\n");
95308
95334
  } else {
95309
- process.stdout.write(" \x1B[31mtimed out\x1B[0m\n\n");
95335
+ process.stderr.write(" \x1B[31mtimed out\x1B[0m\n\n");
95310
95336
  console.log(" Authentication timed out. Run \x1B[36mfw login\x1B[0m again.");
95311
95337
  console.log("");
95312
95338
  }
@@ -95392,21 +95418,22 @@ async function authStatusCommand() {
95392
95418
  console.log("");
95393
95419
  }
95394
95420
  function prompt(message, hidden = false) {
95395
- return new Promise((resolve36) => {
95396
- const rl = readline9.createInterface({ input: process.stdin, output: process.stderr });
95397
- if (hidden && process.stdin.isTTY) {
95421
+ if (hidden && process.stdin.isTTY) {
95422
+ return new Promise((resolve38) => {
95398
95423
  process.stderr.write(message);
95399
95424
  process.stdin.setRawMode(true);
95425
+ process.stdin.resume();
95400
95426
  let input = "";
95401
95427
  const handler = (key) => {
95402
95428
  const ch = key.toString();
95403
95429
  if (ch === "\r" || ch === "\n") {
95404
95430
  process.stdin.setRawMode(false);
95431
+ process.stdin.pause();
95405
95432
  process.stdin.removeListener("data", handler);
95406
95433
  process.stderr.write("\n");
95407
- rl.close();
95408
- resolve36(input);
95434
+ resolve38(input);
95409
95435
  } else if (ch === "") {
95436
+ process.stdin.setRawMode(false);
95410
95437
  process.exit(1);
95411
95438
  } else if (ch === "\x7F") {
95412
95439
  input = input.slice(0, -1);
@@ -95415,12 +95442,14 @@ function prompt(message, hidden = false) {
95415
95442
  }
95416
95443
  };
95417
95444
  process.stdin.on("data", handler);
95418
- } else {
95419
- rl.question(message, (answer) => {
95420
- rl.close();
95421
- resolve36(answer);
95422
- });
95423
- }
95445
+ });
95446
+ }
95447
+ return new Promise((resolve38) => {
95448
+ const rl = readline9.createInterface({ input: process.stdin, output: process.stderr });
95449
+ rl.question(message, (answer) => {
95450
+ rl.close();
95451
+ resolve38(answer);
95452
+ });
95424
95453
  });
95425
95454
  }
95426
95455
  var init_auth = __esm({
@@ -95536,12 +95565,344 @@ var init_deploy = __esm({
95536
95565
  }
95537
95566
  });
95538
95567
 
95568
+ // src/agent/device-connection.ts
95569
+ var DeviceConnection;
95570
+ var init_device_connection = __esm({
95571
+ "src/agent/device-connection.ts"() {
95572
+ "use strict";
95573
+ DeviceConnection = class {
95574
+ ws = null;
95575
+ heartbeatInterval = null;
95576
+ reconnectTimeout = null;
95577
+ requestHandlers = /* @__PURE__ */ new Map();
95578
+ connected = false;
95579
+ shouldReconnect = true;
95580
+ options;
95581
+ deviceInfo;
95582
+ log;
95583
+ constructor(options) {
95584
+ this.options = options;
95585
+ this.log = options.logger ?? (() => {
95586
+ });
95587
+ const os5 = __require("node:os");
95588
+ this.deviceInfo = {
95589
+ name: options.deviceName ?? os5.hostname(),
95590
+ hostname: os5.hostname(),
95591
+ projectDir: options.projectDir,
95592
+ platform: process.platform,
95593
+ capabilities: []
95594
+ };
95595
+ }
95596
+ /**
95597
+ * Add a capability to advertise to the platform.
95598
+ */
95599
+ addCapability(capability) {
95600
+ if (!this.deviceInfo.capabilities.includes(capability)) {
95601
+ this.deviceInfo.capabilities.push(capability);
95602
+ }
95603
+ }
95604
+ /**
95605
+ * Set the list of packs that contributed device handlers.
95606
+ * The platform uses this to auto-install packs in the user's workspace.
95607
+ */
95608
+ setPacks(packs) {
95609
+ this.deviceInfo.packs = packs;
95610
+ }
95611
+ /**
95612
+ * Register a handler for incoming requests from the platform.
95613
+ */
95614
+ onRequest(method, handler) {
95615
+ this.requestHandlers.set(method, handler);
95616
+ }
95617
+ /**
95618
+ * Connect to the platform. Reconnects automatically on disconnect.
95619
+ */
95620
+ async connect() {
95621
+ const wsUrl = this.options.platformUrl.replace(/^http/, "ws").replace(/\/$/, "") + "/ws/device";
95622
+ this.log(`Connecting to ${wsUrl}...`);
95623
+ this.shouldReconnect = true;
95624
+ return new Promise((resolve38, reject2) => {
95625
+ try {
95626
+ this.ws = new WebSocket(`${wsUrl}?token=${encodeURIComponent(this.options.token)}`);
95627
+ } catch (err) {
95628
+ reject2(err);
95629
+ return;
95630
+ }
95631
+ this.ws.addEventListener("open", () => {
95632
+ this.connected = true;
95633
+ this.log(`Connected as "${this.deviceInfo.name}"`);
95634
+ this.send({ type: "device:register", device: this.deviceInfo });
95635
+ this.heartbeatInterval = setInterval(() => {
95636
+ if (this.ws?.readyState === WebSocket.OPEN) {
95637
+ this.send({ type: "heartbeat", timestamp: Date.now() });
95638
+ }
95639
+ }, 3e4);
95640
+ this.options.onConnect?.();
95641
+ resolve38();
95642
+ });
95643
+ this.ws.addEventListener("message", async (event) => {
95644
+ try {
95645
+ const msg = JSON.parse(typeof event.data === "string" ? event.data : String(event.data));
95646
+ await this.handleMessage(msg);
95647
+ } catch (err) {
95648
+ this.log(`Parse error: ${err instanceof Error ? err.message : err}`);
95649
+ }
95650
+ });
95651
+ this.ws.addEventListener("close", (event) => {
95652
+ this.connected = false;
95653
+ if (this.heartbeatInterval) clearInterval(this.heartbeatInterval);
95654
+ this.options.onDisconnect?.(event.code);
95655
+ if (this.shouldReconnect) {
95656
+ this.log(`Disconnected (${event.code}). Reconnecting in 5s...`);
95657
+ this.scheduleReconnect();
95658
+ }
95659
+ });
95660
+ this.ws.addEventListener("error", () => {
95661
+ if (!this.connected) {
95662
+ reject2(new Error("WebSocket connection failed"));
95663
+ } else {
95664
+ this.log("Connection error");
95665
+ }
95666
+ });
95667
+ });
95668
+ }
95669
+ /**
95670
+ * Emit an event to the platform.
95671
+ */
95672
+ emit(event) {
95673
+ if (!this.connected) return;
95674
+ this.send({ type: "device:event", event });
95675
+ this.options.onEvent?.(event);
95676
+ }
95677
+ /**
95678
+ * Disconnect from the platform. No auto-reconnect.
95679
+ */
95680
+ disconnect() {
95681
+ this.shouldReconnect = false;
95682
+ if (this.heartbeatInterval) clearInterval(this.heartbeatInterval);
95683
+ if (this.reconnectTimeout) clearTimeout(this.reconnectTimeout);
95684
+ if (this.ws) {
95685
+ this.ws.close(1e3, "Device disconnecting");
95686
+ this.ws = null;
95687
+ }
95688
+ this.connected = false;
95689
+ }
95690
+ isConnected() {
95691
+ return this.connected;
95692
+ }
95693
+ getDeviceInfo() {
95694
+ return this.deviceInfo;
95695
+ }
95696
+ // --- Private ---
95697
+ send(msg) {
95698
+ if (this.ws?.readyState === WebSocket.OPEN) {
95699
+ this.ws.send(JSON.stringify(msg));
95700
+ }
95701
+ }
95702
+ async handleMessage(msg) {
95703
+ const type2 = String(msg.type ?? "");
95704
+ const requestId = String(msg.requestId ?? "");
95705
+ if (type2 === "request") {
95706
+ const method = String(msg.method ?? "");
95707
+ const params = msg.params ?? {};
95708
+ const handler = this.requestHandlers.get(method);
95709
+ if (!handler) {
95710
+ this.send({ type: "response", requestId, success: false, error: `Unknown method: ${method}` });
95711
+ return;
95712
+ }
95713
+ try {
95714
+ const result = await handler(method, params);
95715
+ this.send({ type: "response", requestId, success: true, result });
95716
+ } catch (err) {
95717
+ this.send({ type: "response", requestId, success: false, error: err instanceof Error ? err.message : String(err) });
95718
+ }
95719
+ }
95720
+ }
95721
+ scheduleReconnect() {
95722
+ if (this.reconnectTimeout) clearTimeout(this.reconnectTimeout);
95723
+ this.reconnectTimeout = setTimeout(async () => {
95724
+ try {
95725
+ await this.connect();
95726
+ } catch {
95727
+ this.log("Reconnect failed. Retrying in 10s...");
95728
+ this.reconnectTimeout = setTimeout(() => this.scheduleReconnect(), 1e4);
95729
+ }
95730
+ }, 5e3);
95731
+ }
95732
+ };
95733
+ }
95734
+ });
95735
+
95736
+ // src/cli/commands/connect.ts
95737
+ var connect_exports = {};
95738
+ __export(connect_exports, {
95739
+ handleConnect: () => handleConnect,
95740
+ loadPackDeviceHandlers: () => loadPackDeviceHandlers
95741
+ });
95742
+ import * as fs49 from "node:fs";
95743
+ import * as path52 from "node:path";
95744
+ import * as os4 from "node:os";
95745
+ import * as readline10 from "node:readline";
95746
+ function promptYesNo(message) {
95747
+ return new Promise((resolve38) => {
95748
+ const rl = readline10.createInterface({ input: process.stdin, output: process.stderr });
95749
+ rl.question(message, (answer) => {
95750
+ rl.close();
95751
+ const normalized = answer.trim().toLowerCase();
95752
+ resolve38(normalized === "" || normalized === "y" || normalized === "yes");
95753
+ });
95754
+ });
95755
+ }
95756
+ async function loadPackDeviceHandlers(conn, projectDir) {
95757
+ const loadedPacks = [];
95758
+ try {
95759
+ const handlers = await discoverDeviceHandlers(projectDir);
95760
+ for (const handler of handlers) {
95761
+ try {
95762
+ const mod = await import(handler.entrypoint);
95763
+ if (typeof mod.register === "function") {
95764
+ await mod.register(conn, { projectDir });
95765
+ loadedPacks.push(handler.packageName);
95766
+ process.stderr.write(` \x1B[2m+ ${handler.packageName} handlers\x1B[0m
95767
+ `);
95768
+ }
95769
+ } catch (err) {
95770
+ process.stderr.write(` \x1B[33m\u26A0\x1B[0m Failed to load handlers from ${handler.packageName}: ${err instanceof Error ? err.message : err}
95771
+ `);
95772
+ }
95773
+ }
95774
+ } catch {
95775
+ }
95776
+ return loadedPacks;
95777
+ }
95778
+ async function handleConnect(projectDir) {
95779
+ const credPath = path52.join(os4.homedir(), ".fw", "credentials.json");
95780
+ if (!fs49.existsSync(credPath)) {
95781
+ console.error("\n Not logged in. Run: fw login\n");
95782
+ process.exit(1);
95783
+ }
95784
+ const creds = JSON.parse(fs49.readFileSync(credPath, "utf-8"));
95785
+ if (!creds.token || !creds.platformUrl || creds.expiresAt < Date.now()) {
95786
+ console.error("\n Credentials expired. Run: fw login\n");
95787
+ process.exit(1);
95788
+ }
95789
+ const conn = new DeviceConnection({
95790
+ platformUrl: creds.platformUrl,
95791
+ token: creds.token,
95792
+ projectDir,
95793
+ deviceName: path52.basename(projectDir),
95794
+ logger: (msg) => process.stderr.write(` \x1B[2m${msg}\x1B[0m
95795
+ `)
95796
+ });
95797
+ conn.addCapability("file_read");
95798
+ conn.addCapability("file_list");
95799
+ conn.onRequest("file:read", async (_method, params) => {
95800
+ const filePath = path52.resolve(projectDir, String(params.path ?? ""));
95801
+ if (!filePath.startsWith(projectDir)) throw new Error("Path outside project directory");
95802
+ if (!fs49.existsSync(filePath)) throw new Error("File not found");
95803
+ const stat = fs49.statSync(filePath);
95804
+ if (stat.isDirectory()) return { type: "directory", entries: fs49.readdirSync(filePath) };
95805
+ if (stat.size > 1048576) throw new Error("File too large (>1MB)");
95806
+ return { type: "file", content: fs49.readFileSync(filePath, "utf-8") };
95807
+ });
95808
+ conn.onRequest("file:list", async (_method, params) => {
95809
+ const dirPath = path52.resolve(projectDir, String(params.path ?? "."));
95810
+ if (!dirPath.startsWith(projectDir)) throw new Error("Path outside project directory");
95811
+ if (!fs49.existsSync(dirPath)) throw new Error("Directory not found");
95812
+ const entries = fs49.readdirSync(dirPath, { withFileTypes: true });
95813
+ return entries.filter((e) => !e.name.startsWith(".") && e.name !== "node_modules" && e.name !== "dist").map((e) => ({ name: e.name, type: e.isDirectory() ? "directory" : "file", path: path52.relative(projectDir, path52.join(dirPath, e.name)), hasUnfetchedChildren: e.isDirectory() }));
95814
+ });
95815
+ const loadedPacks = await loadPackDeviceHandlers(conn, projectDir);
95816
+ if (loadedPacks.length > 0) {
95817
+ conn.setPacks(loadedPacks);
95818
+ }
95819
+ console.log("");
95820
+ console.log(" \x1B[1mflow-weaver connect\x1B[0m");
95821
+ console.log(` \x1B[2mProject: ${path52.basename(projectDir)}\x1B[0m`);
95822
+ console.log(` \x1B[2mPlatform: ${creds.platformUrl}\x1B[0m`);
95823
+ console.log("");
95824
+ if (loadedPacks.length > 0) {
95825
+ try {
95826
+ const checkRes = await fetch(`${creds.platformUrl}/devices/check-packs`, {
95827
+ method: "POST",
95828
+ headers: { "Content-Type": "application/json", "Authorization": `Bearer ${creds.token}` },
95829
+ body: JSON.stringify({ packs: loadedPacks })
95830
+ });
95831
+ if (checkRes.ok) {
95832
+ const { missing } = await checkRes.json();
95833
+ if (missing.length > 0) {
95834
+ console.log(" The following packs need to be installed in Studio:");
95835
+ for (const p of missing) {
95836
+ console.log(` \x1B[36m${p}\x1B[0m`);
95837
+ }
95838
+ console.log("");
95839
+ const answer = await promptYesNo(" Install now? (Y/n) ");
95840
+ if (answer) {
95841
+ process.stderr.write(" Installing...");
95842
+ const installRes = await fetch(`${creds.platformUrl}/devices/install-packs`, {
95843
+ method: "POST",
95844
+ headers: { "Content-Type": "application/json", "Authorization": `Bearer ${creds.token}` },
95845
+ body: JSON.stringify({ packs: missing })
95846
+ });
95847
+ if (installRes.ok) {
95848
+ const { results } = await installRes.json();
95849
+ const allOk = results.every((r) => r.ok);
95850
+ if (allOk) {
95851
+ process.stderr.write(" \x1B[32m\u2713\x1B[0m\n\n");
95852
+ } else {
95853
+ process.stderr.write(" \x1B[33mpartial\x1B[0m\n");
95854
+ for (const r of results) {
95855
+ if (!r.ok) console.log(` \x1B[31m\u2717\x1B[0m ${r.pack}: ${r.error}`);
95856
+ }
95857
+ console.log("");
95858
+ }
95859
+ } else {
95860
+ process.stderr.write(" \x1B[31mfailed\x1B[0m\n\n");
95861
+ }
95862
+ } else {
95863
+ console.log(" \x1B[2mSkipped. Install manually via Studio marketplace.\x1B[0m\n");
95864
+ }
95865
+ }
95866
+ }
95867
+ } catch {
95868
+ }
95869
+ }
95870
+ try {
95871
+ await conn.connect();
95872
+ console.log(" \x1B[2mPress Ctrl+C to disconnect.\x1B[0m\n");
95873
+ await new Promise((resolve38) => {
95874
+ process.on("SIGINT", () => {
95875
+ console.log("\n \x1B[2mDisconnecting...\x1B[0m");
95876
+ conn.disconnect();
95877
+ resolve38();
95878
+ });
95879
+ process.on("SIGTERM", () => {
95880
+ conn.disconnect();
95881
+ resolve38();
95882
+ });
95883
+ });
95884
+ } catch (err) {
95885
+ console.error(` \x1B[31m\u2717\x1B[0m Connection failed: ${err instanceof Error ? err.message : err}`);
95886
+ process.exit(1);
95887
+ }
95888
+ }
95889
+ var init_connect = __esm({
95890
+ "src/cli/commands/connect.ts"() {
95891
+ "use strict";
95892
+ init_device_connection();
95893
+ init_registry();
95894
+ }
95895
+ });
95896
+
95539
95897
  // src/cli/env-setup.ts
95540
95898
  if (process.env.FORCE_COLOR === "0") {
95541
95899
  process.env.NO_COLOR = "1";
95542
95900
  delete process.env.FORCE_COLOR;
95543
95901
  }
95544
95902
 
95903
+ // src/cli/index.ts
95904
+ import * as path53 from "node:path";
95905
+
95545
95906
  // node_modules/commander/esm.mjs
95546
95907
  var import_index = __toESM(require_commander(), 1);
95547
95908
  var {
@@ -95562,7 +95923,7 @@ var {
95562
95923
  // src/cli/index.ts
95563
95924
  init_logger();
95564
95925
  init_error_utils();
95565
- var version2 = true ? "0.23.0" : "0.0.0-dev";
95926
+ var version2 = true ? "0.23.3" : "0.0.0-dev";
95566
95927
  var program2 = new Command();
95567
95928
  program2.name("fw").description("Flow Weaver Annotations - Compile and validate workflow files").option("-v, --version", "Output the current version").option("--no-color", "Disable colors").option("--color", "Force colors").on("option:version", () => {
95568
95929
  logger.banner(version2);
@@ -95861,6 +96222,10 @@ if (!process.env["VITEST"]) {
95861
96222
  const { cloudStatusCommand: cloudStatusCommand2 } = await Promise.resolve().then(() => (init_deploy(), deploy_exports));
95862
96223
  await cloudStatusCommand2();
95863
96224
  });
96225
+ program2.command("connect [dir]").description("Connect this device to the Flow Weaver platform").action(async (dir) => {
96226
+ const { handleConnect: handleConnect2 } = await Promise.resolve().then(() => (init_connect(), connect_exports));
96227
+ await handleConnect2(path53.resolve(dir ?? "."));
96228
+ });
95864
96229
  if (!program2.commands.some((c) => c.name() === "weaver")) {
95865
96230
  program2.command("weaver").description("AI assistant for Flow Weaver workflows").allowUnknownOption(true).action(async () => {
95866
96231
  console.log("");