@synergenius/flow-weaver 0.23.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.1";
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
  });
@@ -39216,13 +39216,13 @@ Add '@param ${fromPort}' to the workflow JSDoc and include it in the params obje
39216
39216
  connections.filter((c) => c.from.node === c.to.node).map((c) => c.from.node)
39217
39217
  );
39218
39218
  const nonSelfLoopConnections = connections.filter((c) => c.from.node !== c.to.node);
39219
- const dfs = (nodeName, path52) => {
39219
+ const dfs = (nodeName, path54) => {
39220
39220
  if (recursionStack.has(nodeName)) {
39221
39221
  if (selfLoopNodes.has(nodeName)) {
39222
39222
  return false;
39223
39223
  }
39224
- const cycleStart = path52.indexOf(nodeName);
39225
- const cyclePath = [...path52.slice(cycleStart), nodeName];
39224
+ const cycleStart = path54.indexOf(nodeName);
39225
+ const cyclePath = [...path54.slice(cycleStart), nodeName];
39226
39226
  const cycleNodes = cyclePath.slice(0, -1);
39227
39227
  const sortedCycle = [...cycleNodes].sort();
39228
39228
  const cycleKey = sortedCycle.join(",");
@@ -39244,7 +39244,7 @@ Add '@param ${fromPort}' to the workflow JSDoc and include it in the params obje
39244
39244
  return false;
39245
39245
  }
39246
39246
  recursionStack.add(nodeName);
39247
- const newPath = [...path52, nodeName];
39247
+ const newPath = [...path54, nodeName];
39248
39248
  const instance = instances.find((n) => n.id === nodeName);
39249
39249
  if (!instance) {
39250
39250
  recursionStack.delete(nodeName);
@@ -40493,15 +40493,15 @@ async function loadAST(filePath) {
40493
40493
  async function saveASTAlongside(ast) {
40494
40494
  const sourceFile = ast.sourceFile;
40495
40495
  const dir = path7.dirname(sourceFile);
40496
- const basename20 = path7.basename(sourceFile, path7.extname(sourceFile));
40497
- const astFile = path7.join(dir, `${basename20}.ast.json`);
40496
+ const basename21 = path7.basename(sourceFile, path7.extname(sourceFile));
40497
+ const astFile = path7.join(dir, `${basename21}.ast.json`);
40498
40498
  await saveAST(ast, astFile);
40499
40499
  return astFile;
40500
40500
  }
40501
40501
  async function loadASTAlongside(sourceFile) {
40502
40502
  const dir = path7.dirname(sourceFile);
40503
- const basename20 = path7.basename(sourceFile, path7.extname(sourceFile));
40504
- const astFile = path7.join(dir, `${basename20}.ast.json`);
40503
+ const basename21 = path7.basename(sourceFile, path7.extname(sourceFile));
40504
+ const astFile = path7.join(dir, `${basename21}.ast.json`);
40505
40505
  return loadAST(astFile);
40506
40506
  }
40507
40507
  var init_serialization_node = __esm({
@@ -40582,8 +40582,8 @@ ${errorMessages.join("\n")}`);
40582
40582
  }
40583
40583
  function getDefaultOutputFile(sourceFile) {
40584
40584
  const dir = path8.dirname(sourceFile);
40585
- const basename20 = path8.basename(sourceFile, ".ts");
40586
- return path8.join(dir, `${basename20}.generated.ts`);
40585
+ const basename21 = path8.basename(sourceFile, ".ts");
40586
+ return path8.join(dir, `${basename21}.generated.ts`);
40587
40587
  }
40588
40588
  var init_compile = __esm({
40589
40589
  "src/api/compile.ts"() {
@@ -40829,7 +40829,7 @@ function processResult(result, scope) {
40829
40829
  }
40830
40830
  return result !== NOTHING ? result : void 0;
40831
40831
  }
40832
- function finalize(rootScope, value, path52) {
40832
+ function finalize(rootScope, value, path54) {
40833
40833
  if (isFrozen(value))
40834
40834
  return value;
40835
40835
  const useStrictIteration = rootScope.immer_.shouldUseStrictIteration();
@@ -40837,7 +40837,7 @@ function finalize(rootScope, value, path52) {
40837
40837
  if (!state) {
40838
40838
  each(
40839
40839
  value,
40840
- (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path52),
40840
+ (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path54),
40841
40841
  useStrictIteration
40842
40842
  );
40843
40843
  return value;
@@ -40867,16 +40867,16 @@ function finalize(rootScope, value, path52) {
40867
40867
  result,
40868
40868
  key,
40869
40869
  childValue,
40870
- path52,
40870
+ path54,
40871
40871
  isSet22
40872
40872
  ),
40873
40873
  useStrictIteration
40874
40874
  );
40875
40875
  maybeFreeze(rootScope, result, false);
40876
- if (path52 && rootScope.patches_) {
40876
+ if (path54 && rootScope.patches_) {
40877
40877
  getPlugin("Patches").generatePatches_(
40878
40878
  state,
40879
- path52,
40879
+ path54,
40880
40880
  rootScope.patches_,
40881
40881
  rootScope.inversePatches_
40882
40882
  );
@@ -40898,9 +40898,9 @@ function finalizeProperty(rootScope, parentState, targetObject, prop, childValue
40898
40898
  if (process.env.NODE_ENV !== "production" && childValue === targetObject)
40899
40899
  die(5);
40900
40900
  if (isDraft(childValue)) {
40901
- const path52 = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
40901
+ const path54 = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
40902
40902
  !has2(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;
40903
- const res = finalize(rootScope, childValue, path52);
40903
+ const res = finalize(rootScope, childValue, path54);
40904
40904
  set(targetObject, prop, res);
40905
40905
  if (isDraft(res)) {
40906
40906
  rootScope.canAutoFreeze_ = false;
@@ -42290,8 +42290,8 @@ var init_parseUtil = __esm({
42290
42290
  init_errors();
42291
42291
  init_en();
42292
42292
  makeIssue = (params) => {
42293
- const { data, path: path52, errorMaps, issueData } = params;
42294
- const fullPath = [...path52, ...issueData.path || []];
42293
+ const { data, path: path54, errorMaps, issueData } = params;
42294
+ const fullPath = [...path54, ...issueData.path || []];
42295
42295
  const fullIssue = {
42296
42296
  ...issueData,
42297
42297
  path: fullPath
@@ -42599,11 +42599,11 @@ var init_types = __esm({
42599
42599
  init_parseUtil();
42600
42600
  init_util();
42601
42601
  ParseInputLazyPath = class {
42602
- constructor(parent, value, path52, key) {
42602
+ constructor(parent, value, path54, key) {
42603
42603
  this._cachedPath = [];
42604
42604
  this.parent = parent;
42605
42605
  this.data = value;
42606
- this._path = path52;
42606
+ this._path = path54;
42607
42607
  this._key = key;
42608
42608
  }
42609
42609
  get path() {
@@ -55816,14 +55816,14 @@ function waypointsToSvgPath(waypoints, cornerRadius) {
55816
55816
  radii[i + 1] *= scale;
55817
55817
  }
55818
55818
  }
55819
- let path52 = `M ${waypoints[0][0]},${waypoints[0][1]}`;
55819
+ let path54 = `M ${waypoints[0][0]},${waypoints[0][1]}`;
55820
55820
  for (let i = 1; i < waypoints.length - 1; i++) {
55821
55821
  const prev = waypoints[i - 1];
55822
55822
  const curr = waypoints[i];
55823
55823
  const next = waypoints[i + 1];
55824
55824
  const r = radii[i];
55825
55825
  if (r < 2) {
55826
- path52 += ` L ${curr[0]},${curr[1]}`;
55826
+ path54 += ` L ${curr[0]},${curr[1]}`;
55827
55827
  continue;
55828
55828
  }
55829
55829
  const dPrev = [prev[0] - curr[0], prev[1] - curr[1]];
@@ -55836,12 +55836,12 @@ function waypointsToSvgPath(waypoints, cornerRadius) {
55836
55836
  const arcEnd = [curr[0] + uNext[0] * r, curr[1] + uNext[1] * r];
55837
55837
  const cross = dPrev[0] * dNext[1] - dPrev[1] * dNext[0];
55838
55838
  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]}`;
55839
+ path54 += ` L ${arcStart[0]},${arcStart[1]}`;
55840
+ path54 += ` A ${r} ${r} 0 0 ${sweep} ${arcEnd[0]},${arcEnd[1]}`;
55841
55841
  }
55842
55842
  const last2 = waypoints[waypoints.length - 1];
55843
- path52 += ` L ${last2[0]},${last2[1]}`;
55844
- return path52;
55843
+ path54 += ` L ${last2[0]},${last2[1]}`;
55844
+ return path54;
55845
55845
  }
55846
55846
  function computeWaypoints(from, to, nodeBoxes, sourceNodeId, targetNodeId, padding, exitStub, entryStub, allocator) {
55847
55847
  const isSelfConnection = sourceNodeId === targetNodeId;
@@ -55988,7 +55988,7 @@ function calculateOrthogonalPath(from, to, nodeBoxes, sourceNodeId, targetNodeId
55988
55988
  }
55989
55989
  function calculateOrthogonalPathSafe(from, to, nodeBoxes, sourceNodeId, targetNodeId, options, allocator) {
55990
55990
  try {
55991
- const path52 = calculateOrthogonalPath(
55991
+ const path54 = calculateOrthogonalPath(
55992
55992
  from,
55993
55993
  to,
55994
55994
  nodeBoxes,
@@ -55997,8 +55997,8 @@ function calculateOrthogonalPathSafe(from, to, nodeBoxes, sourceNodeId, targetNo
55997
55997
  options,
55998
55998
  allocator
55999
55999
  );
56000
- if (!path52 || path52.length < 5) return null;
56001
- return path52;
56000
+ if (!path54 || path54.length < 5) return null;
56001
+ return path54;
56002
56002
  } catch {
56003
56003
  return null;
56004
56004
  }
@@ -56222,13 +56222,13 @@ function computeConnectionPath(sx, sy, tx, ty) {
56222
56222
  const deUy = deY / deLen;
56223
56223
  const [cx, cy] = quadCurveControl(bx, by, dx, dy, -deUx, -deUy);
56224
56224
  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;
56225
+ let path54 = `M ${cx},${cy} M ${ax},${ay}`;
56226
+ path54 += ` L ${bx},${by}`;
56227
+ path54 += ` Q ${cx},${cy} ${dx},${dy}`;
56228
+ path54 += ` L ${ex},${ey}`;
56229
+ path54 += ` Q ${fx},${fy} ${gx},${gy}`;
56230
+ path54 += ` L ${hx},${hy}`;
56231
+ return path54;
56232
56232
  }
56233
56233
  function orderedPorts(ports, direction) {
56234
56234
  const cloned = {};
@@ -56518,7 +56518,7 @@ function finalizeScopePositions(parentNode, ast, theme = "dark") {
56518
56518
  function buildConnection(fromNode, fromPort, toNode, toPort, sourcePort, targetPort, theme = "dark") {
56519
56519
  const sourceColor = getPortColor(sourcePort.dataType, sourcePort.isFailure, theme);
56520
56520
  const targetColor = getPortColor(targetPort.dataType, targetPort.isFailure, theme);
56521
- const path52 = computeConnectionPath(sourcePort.cx, sourcePort.cy, targetPort.cx, targetPort.cy);
56521
+ const path54 = computeConnectionPath(sourcePort.cx, sourcePort.cy, targetPort.cx, targetPort.cy);
56522
56522
  return {
56523
56523
  fromNode,
56524
56524
  fromPort,
@@ -56527,7 +56527,7 @@ function buildConnection(fromNode, fromPort, toNode, toPort, sourcePort, targetP
56527
56527
  sourceColor,
56528
56528
  targetColor,
56529
56529
  isStepConnection: sourcePort.dataType === "STEP",
56530
- path: path52
56530
+ path: path54
56531
56531
  };
56532
56532
  }
56533
56533
  function portsColumnHeight(count) {
@@ -56988,9 +56988,9 @@ function buildDiagramGraph(ast, options = {}) {
56988
56988
  color: targetColor,
56989
56989
  dashed
56990
56990
  };
56991
- let path52;
56991
+ let path54;
56992
56992
  if (xDistance > STUB_DISTANCE_THRESHOLD) {
56993
- path52 = "";
56993
+ path54 = "";
56994
56994
  } else if (!useCurve && distance > ORTHOGONAL_DISTANCE_THRESHOLD) {
56995
56995
  const orthoPath = calculateOrthogonalPathSafe(
56996
56996
  [sx, sy],
@@ -57001,9 +57001,9 @@ function buildDiagramGraph(ast, options = {}) {
57001
57001
  { fromPortIndex: pc3.fromPortIndex, toPortIndex: pc3.toPortIndex },
57002
57002
  allocator
57003
57003
  );
57004
- path52 = orthoPath ?? computeConnectionPath(sx, sy, tx, ty);
57004
+ path54 = orthoPath ?? computeConnectionPath(sx, sy, tx, ty);
57005
57005
  } else {
57006
- path52 = computeConnectionPath(sx, sy, tx, ty);
57006
+ path54 = computeConnectionPath(sx, sy, tx, ty);
57007
57007
  }
57008
57008
  connections.push({
57009
57009
  fromNode: pc3.fromNodeId,
@@ -57013,7 +57013,7 @@ function buildDiagramGraph(ast, options = {}) {
57013
57013
  sourceColor,
57014
57014
  targetColor,
57015
57015
  isStepConnection: pc3.sourcePort.dataType === "STEP",
57016
- path: path52,
57016
+ path: path54,
57017
57017
  sourceStub,
57018
57018
  targetStub
57019
57019
  });
@@ -57173,12 +57173,12 @@ function resolveDefaultIcon(nt) {
57173
57173
  if (nt.variant === "WORKFLOW" || nt.variant === "IMPORTED_WORKFLOW") return "flow";
57174
57174
  return "code";
57175
57175
  }
57176
- function pathExtent(path52) {
57176
+ function pathExtent(path54) {
57177
57177
  let minX = Infinity, minY = Infinity;
57178
57178
  let maxX = -Infinity, maxY = -Infinity;
57179
57179
  const pattern = /(-?[\d.]+),(-?[\d.]+)/g;
57180
57180
  let m;
57181
- while ((m = pattern.exec(path52)) !== null) {
57181
+ while ((m = pattern.exec(path54)) !== null) {
57182
57182
  const x = parseFloat(m[1]);
57183
57183
  const y = parseFloat(m[2]);
57184
57184
  minX = Math.min(minX, x);
@@ -57817,17 +57817,17 @@ function buildAdjacency(ast) {
57817
57817
  function enumeratePaths(ast) {
57818
57818
  const { fromStart, toExit, edges } = buildAdjacency(ast);
57819
57819
  const paths = [];
57820
- function dfs(current2, path52, visited) {
57820
+ function dfs(current2, path54, visited) {
57821
57821
  if (toExit.has(current2)) {
57822
- paths.push([...path52, "Exit"]);
57822
+ paths.push([...path54, "Exit"]);
57823
57823
  }
57824
57824
  const targets = edges.get(current2) || [];
57825
57825
  for (const next of targets) {
57826
57826
  if (!visited.has(next)) {
57827
57827
  visited.add(next);
57828
- path52.push(next);
57829
- dfs(next, path52, visited);
57830
- path52.pop();
57828
+ path54.push(next);
57829
+ dfs(next, path54, visited);
57830
+ path54.pop();
57831
57831
  visited.delete(next);
57832
57832
  }
57833
57833
  }
@@ -57841,22 +57841,22 @@ function enumeratePaths(ast) {
57841
57841
  function buildGraph(ast) {
57842
57842
  const { fromStart, toExit, edges } = buildAdjacency(ast);
57843
57843
  const lines = [];
57844
- function dfs(current2, path52, visited) {
57844
+ function dfs(current2, path54, visited) {
57845
57845
  if (toExit.has(current2)) {
57846
- lines.push([...path52, "Exit"].join(" -> "));
57846
+ lines.push([...path54, "Exit"].join(" -> "));
57847
57847
  }
57848
57848
  const targets = edges.get(current2) || [];
57849
57849
  for (const next of targets) {
57850
57850
  if (!visited.has(next)) {
57851
57851
  visited.add(next);
57852
- path52.push(next);
57853
- dfs(next, path52, visited);
57854
- path52.pop();
57852
+ path54.push(next);
57853
+ dfs(next, path54, visited);
57854
+ path54.pop();
57855
57855
  visited.delete(next);
57856
57856
  }
57857
57857
  }
57858
57858
  if (targets.length === 0 && !toExit.has(current2)) {
57859
- lines.push(path52.join(" -> "));
57859
+ lines.push(path54.join(" -> "));
57860
57860
  }
57861
57861
  }
57862
57862
  fromStart.forEach((startNode) => {
@@ -62070,13 +62070,13 @@ var init_promise_polyfill = __esm({
62070
62070
  // Available starting from Node 22
62071
62071
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
62072
62072
  static withResolver() {
62073
- let resolve36;
62073
+ let resolve38;
62074
62074
  let reject2;
62075
62075
  const promise = new Promise((res, rej) => {
62076
- resolve36 = res;
62076
+ resolve38 = res;
62077
62077
  reject2 = rej;
62078
62078
  });
62079
- return { promise, resolve: resolve36, reject: reject2 };
62079
+ return { promise, resolve: resolve38, reject: reject2 };
62080
62080
  }
62081
62081
  };
62082
62082
  }
@@ -62114,7 +62114,7 @@ function createPrompt(view) {
62114
62114
  output
62115
62115
  });
62116
62116
  const screen = new ScreenManager(rl);
62117
- const { promise, resolve: resolve36, reject: reject2 } = PromisePolyfill.withResolver();
62117
+ const { promise, resolve: resolve38, reject: reject2 } = PromisePolyfill.withResolver();
62118
62118
  const cancel = () => reject2(new CancelPromptError());
62119
62119
  if (signal) {
62120
62120
  const abort = () => reject2(new AbortPromptError({ cause: signal.reason }));
@@ -62141,7 +62141,7 @@ function createPrompt(view) {
62141
62141
  cycle(() => {
62142
62142
  try {
62143
62143
  const nextView = view(config2, (value) => {
62144
- setImmediate(() => resolve36(value));
62144
+ setImmediate(() => resolve38(value));
62145
62145
  });
62146
62146
  if (nextView === void 0) {
62147
62147
  const callerFilename = callSites[1]?.getFileName();
@@ -62952,13 +62952,13 @@ var init_promise_polyfill2 = __esm({
62952
62952
  // Available starting from Node 22
62953
62953
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
62954
62954
  static withResolver() {
62955
- let resolve36;
62955
+ let resolve38;
62956
62956
  let reject2;
62957
62957
  const promise = new Promise((res, rej) => {
62958
- resolve36 = res;
62958
+ resolve38 = res;
62959
62959
  reject2 = rej;
62960
62960
  });
62961
- return { promise, resolve: resolve36, reject: reject2 };
62961
+ return { promise, resolve: resolve38, reject: reject2 };
62962
62962
  }
62963
62963
  };
62964
62964
  }
@@ -62996,7 +62996,7 @@ function createPrompt2(view) {
62996
62996
  output
62997
62997
  });
62998
62998
  const screen = new ScreenManager2(rl);
62999
- const { promise, resolve: resolve36, reject: reject2 } = PromisePolyfill2.withResolver();
62999
+ const { promise, resolve: resolve38, reject: reject2 } = PromisePolyfill2.withResolver();
63000
63000
  const cancel = () => reject2(new CancelPromptError2());
63001
63001
  if (signal) {
63002
63002
  const abort = () => reject2(new AbortPromptError2({ cause: signal.reason }));
@@ -63023,7 +63023,7 @@ function createPrompt2(view) {
63023
63023
  cycle(() => {
63024
63024
  try {
63025
63025
  const nextView = view(config2, (value) => {
63026
- setImmediate(() => resolve36(value));
63026
+ setImmediate(() => resolve38(value));
63027
63027
  });
63028
63028
  if (nextView === void 0) {
63029
63029
  const callerFilename = callSites[1]?.getFileName();
@@ -63807,13 +63807,13 @@ var init_promise_polyfill3 = __esm({
63807
63807
  // Available starting from Node 22
63808
63808
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
63809
63809
  static withResolver() {
63810
- let resolve36;
63810
+ let resolve38;
63811
63811
  let reject2;
63812
63812
  const promise = new Promise((res, rej) => {
63813
- resolve36 = res;
63813
+ resolve38 = res;
63814
63814
  reject2 = rej;
63815
63815
  });
63816
- return { promise, resolve: resolve36, reject: reject2 };
63816
+ return { promise, resolve: resolve38, reject: reject2 };
63817
63817
  }
63818
63818
  };
63819
63819
  }
@@ -63851,7 +63851,7 @@ function createPrompt3(view) {
63851
63851
  output
63852
63852
  });
63853
63853
  const screen = new ScreenManager3(rl);
63854
- const { promise, resolve: resolve36, reject: reject2 } = PromisePolyfill3.withResolver();
63854
+ const { promise, resolve: resolve38, reject: reject2 } = PromisePolyfill3.withResolver();
63855
63855
  const cancel = () => reject2(new CancelPromptError3());
63856
63856
  if (signal) {
63857
63857
  const abort = () => reject2(new AbortPromptError3({ cause: signal.reason }));
@@ -63878,7 +63878,7 @@ function createPrompt3(view) {
63878
63878
  cycle(() => {
63879
63879
  try {
63880
63880
  const nextView = view(config2, (value) => {
63881
- setImmediate(() => resolve36(value));
63881
+ setImmediate(() => resolve38(value));
63882
63882
  });
63883
63883
  if (nextView === void 0) {
63884
63884
  const callerFilename = callSites[1]?.getFileName();
@@ -65437,15 +65437,15 @@ var require_route = __commonJS({
65437
65437
  };
65438
65438
  }
65439
65439
  function wrapConversion(toModel, graph) {
65440
- const path52 = [graph[toModel].parent, toModel];
65440
+ const path54 = [graph[toModel].parent, toModel];
65441
65441
  let fn = conversions[graph[toModel].parent][toModel];
65442
65442
  let cur = graph[toModel].parent;
65443
65443
  while (graph[cur].parent) {
65444
- path52.unshift(graph[cur].parent);
65444
+ path54.unshift(graph[cur].parent);
65445
65445
  fn = link(conversions[graph[cur].parent][cur], fn);
65446
65446
  cur = graph[cur].parent;
65447
65447
  }
65448
- fn.conversion = path52;
65448
+ fn.conversion = path54;
65449
65449
  return fn;
65450
65450
  }
65451
65451
  module2.exports = function(fromModel) {
@@ -67000,8 +67000,8 @@ async function loadPackTemplates(projectDir) {
67000
67000
  const templatesPath = await import("path").then(
67001
67001
  (p) => p.join(pkg.path, "templates.js")
67002
67002
  );
67003
- const { existsSync: existsSync36 } = await import("fs");
67004
- if (!existsSync36(templatesPath)) continue;
67003
+ const { existsSync: existsSync37 } = await import("fs");
67004
+ if (!existsSync37(templatesPath)) continue;
67005
67005
  const mod = await import(templatesPath);
67006
67006
  if (mod.workflowTemplates && Array.isArray(mod.workflowTemplates)) {
67007
67007
  for (const tmpl of mod.workflowTemplates) {
@@ -68249,8 +68249,8 @@ async function executeWorkflowFromFile(filePath, params, options) {
68249
68249
  `${path20.sep}dist${path20.sep}`
68250
68250
  );
68251
68251
  if (fs19.existsSync(distEquivalent)) {
68252
- const relative9 = path20.relative(srcDir, distEquivalent);
68253
- const posixRelative = relative9.replace(/\\/g, "/");
68252
+ const relative10 = path20.relative(srcDir, distEquivalent);
68253
+ const posixRelative = relative10.replace(/\\/g, "/");
68254
68254
  const normalized = posixRelative.startsWith(".") ? posixRelative : `./${posixRelative}`;
68255
68255
  return `from '${normalized}'`;
68256
68256
  }
@@ -68773,10 +68773,10 @@ function assignProp(target, prop, value) {
68773
68773
  configurable: true
68774
68774
  });
68775
68775
  }
68776
- function getElementAtPath(obj, path52) {
68777
- if (!path52)
68776
+ function getElementAtPath(obj, path54) {
68777
+ if (!path54)
68778
68778
  return obj;
68779
- return path52.reduce((acc, key) => acc?.[key], obj);
68779
+ return path54.reduce((acc, key) => acc?.[key], obj);
68780
68780
  }
68781
68781
  function promiseAllObject(promisesObj) {
68782
68782
  const keys2 = Object.keys(promisesObj);
@@ -69025,11 +69025,11 @@ function aborted(x, startIndex = 0) {
69025
69025
  }
69026
69026
  return false;
69027
69027
  }
69028
- function prefixIssues(path52, issues) {
69028
+ function prefixIssues(path54, issues) {
69029
69029
  return issues.map((iss) => {
69030
69030
  var _a2;
69031
69031
  (_a2 = iss).path ?? (_a2.path = []);
69032
- iss.path.unshift(path52);
69032
+ iss.path.unshift(path54);
69033
69033
  return iss;
69034
69034
  });
69035
69035
  }
@@ -77205,7 +77205,7 @@ var init_protocol = __esm({
77205
77205
  return;
77206
77206
  }
77207
77207
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
77208
- await new Promise((resolve36) => setTimeout(resolve36, pollInterval));
77208
+ await new Promise((resolve38) => setTimeout(resolve38, pollInterval));
77209
77209
  options?.signal?.throwIfAborted();
77210
77210
  }
77211
77211
  } catch (error2) {
@@ -77222,7 +77222,7 @@ var init_protocol = __esm({
77222
77222
  */
77223
77223
  request(request, resultSchema, options) {
77224
77224
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
77225
- return new Promise((resolve36, reject2) => {
77225
+ return new Promise((resolve38, reject2) => {
77226
77226
  const earlyReject = (error2) => {
77227
77227
  reject2(error2);
77228
77228
  };
@@ -77300,7 +77300,7 @@ var init_protocol = __esm({
77300
77300
  if (!parseResult.success) {
77301
77301
  reject2(parseResult.error);
77302
77302
  } else {
77303
- resolve36(parseResult.data);
77303
+ resolve38(parseResult.data);
77304
77304
  }
77305
77305
  } catch (error2) {
77306
77306
  reject2(error2);
@@ -77561,12 +77561,12 @@ var init_protocol = __esm({
77561
77561
  }
77562
77562
  } catch {
77563
77563
  }
77564
- return new Promise((resolve36, reject2) => {
77564
+ return new Promise((resolve38, reject2) => {
77565
77565
  if (signal.aborted) {
77566
77566
  reject2(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
77567
77567
  return;
77568
77568
  }
77569
- const timeoutId = setTimeout(resolve36, interval);
77569
+ const timeoutId = setTimeout(resolve38, interval);
77570
77570
  signal.addEventListener("abort", () => {
77571
77571
  clearTimeout(timeoutId);
77572
77572
  reject2(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -80593,7 +80593,7 @@ var require_compile = __commonJS({
80593
80593
  const schOrFunc = root2.refs[ref];
80594
80594
  if (schOrFunc)
80595
80595
  return schOrFunc;
80596
- let _sch = resolve36.call(this, root2, ref);
80596
+ let _sch = resolve38.call(this, root2, ref);
80597
80597
  if (_sch === void 0) {
80598
80598
  const schema2 = (_a2 = root2.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref];
80599
80599
  const { schemaId } = this.opts;
@@ -80620,7 +80620,7 @@ var require_compile = __commonJS({
80620
80620
  function sameSchemaEnv(s1, s2) {
80621
80621
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
80622
80622
  }
80623
- function resolve36(root2, ref) {
80623
+ function resolve38(root2, ref) {
80624
80624
  let sch;
80625
80625
  while (typeof (sch = this.refs[ref]) == "string")
80626
80626
  ref = sch;
@@ -80835,8 +80835,8 @@ var require_utils = __commonJS({
80835
80835
  }
80836
80836
  return ind;
80837
80837
  }
80838
- function removeDotSegments(path52) {
80839
- let input = path52;
80838
+ function removeDotSegments(path54) {
80839
+ let input = path54;
80840
80840
  const output = [];
80841
80841
  let nextSlash = -1;
80842
80842
  let len = 0;
@@ -81035,8 +81035,8 @@ var require_schemes = __commonJS({
81035
81035
  wsComponent.secure = void 0;
81036
81036
  }
81037
81037
  if (wsComponent.resourceName) {
81038
- const [path52, query] = wsComponent.resourceName.split("?");
81039
- wsComponent.path = path52 && path52 !== "/" ? path52 : void 0;
81038
+ const [path54, query] = wsComponent.resourceName.split("?");
81039
+ wsComponent.path = path54 && path54 !== "/" ? path54 : void 0;
81040
81040
  wsComponent.query = query;
81041
81041
  wsComponent.resourceName = void 0;
81042
81042
  }
@@ -81195,55 +81195,55 @@ var require_fast_uri = __commonJS({
81195
81195
  }
81196
81196
  return uri;
81197
81197
  }
81198
- function resolve36(baseURI, relativeURI, options) {
81198
+ function resolve38(baseURI, relativeURI, options) {
81199
81199
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
81200
81200
  const resolved = resolveComponent(parse5(baseURI, schemelessOptions), parse5(relativeURI, schemelessOptions), schemelessOptions, true);
81201
81201
  schemelessOptions.skipEscape = true;
81202
81202
  return serialize(resolved, schemelessOptions);
81203
81203
  }
81204
- function resolveComponent(base, relative9, options, skipNormalization) {
81204
+ function resolveComponent(base, relative10, options, skipNormalization) {
81205
81205
  const target = {};
81206
81206
  if (!skipNormalization) {
81207
81207
  base = parse5(serialize(base, options), options);
81208
- relative9 = parse5(serialize(relative9, options), options);
81208
+ relative10 = parse5(serialize(relative10, options), options);
81209
81209
  }
81210
81210
  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;
81211
+ if (!options.tolerant && relative10.scheme) {
81212
+ target.scheme = relative10.scheme;
81213
+ target.userinfo = relative10.userinfo;
81214
+ target.host = relative10.host;
81215
+ target.port = relative10.port;
81216
+ target.path = removeDotSegments(relative10.path || "");
81217
+ target.query = relative10.query;
81218
81218
  } 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;
81219
+ if (relative10.userinfo !== void 0 || relative10.host !== void 0 || relative10.port !== void 0) {
81220
+ target.userinfo = relative10.userinfo;
81221
+ target.host = relative10.host;
81222
+ target.port = relative10.port;
81223
+ target.path = removeDotSegments(relative10.path || "");
81224
+ target.query = relative10.query;
81225
81225
  } else {
81226
- if (!relative9.path) {
81226
+ if (!relative10.path) {
81227
81227
  target.path = base.path;
81228
- if (relative9.query !== void 0) {
81229
- target.query = relative9.query;
81228
+ if (relative10.query !== void 0) {
81229
+ target.query = relative10.query;
81230
81230
  } else {
81231
81231
  target.query = base.query;
81232
81232
  }
81233
81233
  } else {
81234
- if (relative9.path[0] === "/") {
81235
- target.path = removeDotSegments(relative9.path);
81234
+ if (relative10.path[0] === "/") {
81235
+ target.path = removeDotSegments(relative10.path);
81236
81236
  } else {
81237
81237
  if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
81238
- target.path = "/" + relative9.path;
81238
+ target.path = "/" + relative10.path;
81239
81239
  } else if (!base.path) {
81240
- target.path = relative9.path;
81240
+ target.path = relative10.path;
81241
81241
  } else {
81242
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative9.path;
81242
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative10.path;
81243
81243
  }
81244
81244
  target.path = removeDotSegments(target.path);
81245
81245
  }
81246
- target.query = relative9.query;
81246
+ target.query = relative10.query;
81247
81247
  }
81248
81248
  target.userinfo = base.userinfo;
81249
81249
  target.host = base.host;
@@ -81251,7 +81251,7 @@ var require_fast_uri = __commonJS({
81251
81251
  }
81252
81252
  target.scheme = base.scheme;
81253
81253
  }
81254
- target.fragment = relative9.fragment;
81254
+ target.fragment = relative10.fragment;
81255
81255
  return target;
81256
81256
  }
81257
81257
  function equal(uriA, uriB, options) {
@@ -81422,7 +81422,7 @@ var require_fast_uri = __commonJS({
81422
81422
  var fastUri = {
81423
81423
  SCHEMES,
81424
81424
  normalize: normalize2,
81425
- resolve: resolve36,
81425
+ resolve: resolve38,
81426
81426
  resolveComponent,
81427
81427
  equal,
81428
81428
  serialize,
@@ -84398,12 +84398,12 @@ var require_dist = __commonJS({
84398
84398
  throw new Error(`Unknown format "${name}"`);
84399
84399
  return f;
84400
84400
  };
84401
- function addFormats(ajv, list, fs49, exportName) {
84401
+ function addFormats(ajv, list, fs50, exportName) {
84402
84402
  var _a2;
84403
84403
  var _b;
84404
84404
  (_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
84405
84405
  for (const f of list)
84406
- ajv.addFormat(f, fs49[f]);
84406
+ ajv.addFormat(f, fs50[f]);
84407
84407
  }
84408
84408
  module2.exports = exports2 = formatsPlugin;
84409
84409
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -85396,7 +85396,7 @@ var init_mcp = __esm({
85396
85396
  let task = createTaskResult.task;
85397
85397
  const pollInterval = task.pollInterval ?? 5e3;
85398
85398
  while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
85399
- await new Promise((resolve36) => setTimeout(resolve36, pollInterval));
85399
+ await new Promise((resolve38) => setTimeout(resolve38, pollInterval));
85400
85400
  const updatedTask = await extra.taskStore.getTask(taskId);
85401
85401
  if (!updatedTask) {
85402
85402
  throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
@@ -85987,12 +85987,12 @@ var init_stdio2 = __esm({
85987
85987
  this.onclose?.();
85988
85988
  }
85989
85989
  send(message) {
85990
- return new Promise((resolve36) => {
85990
+ return new Promise((resolve38) => {
85991
85991
  const json2 = serializeMessage(message);
85992
85992
  if (this._stdout.write(json2)) {
85993
- resolve36();
85993
+ resolve38();
85994
85994
  } else {
85995
- this._stdout.once("drain", resolve36);
85995
+ this._stdout.once("drain", resolve38);
85996
85996
  }
85997
85997
  });
85998
85998
  }
@@ -86270,8 +86270,8 @@ ${parseResult.errors.join("\n")}`);
86270
86270
  });
86271
86271
  const outputFile = filePath.replace(/\.ts$/, `.${args.target}.ts`);
86272
86272
  if (args.write !== false) {
86273
- const fs49 = await import("fs");
86274
- fs49.writeFileSync(outputFile, code, "utf8");
86273
+ const fs50 = await import("fs");
86274
+ fs50.writeFileSync(outputFile, code, "utf8");
86275
86275
  }
86276
86276
  return makeToolResult({
86277
86277
  target: args.target,
@@ -87652,8 +87652,8 @@ var init_adapters = __esm({
87652
87652
  * Extract workflow ID from file path (uses filename without extension)
87653
87653
  */
87654
87654
  extractWorkflowId(filePath) {
87655
- const basename20 = path25.basename(filePath, path25.extname(filePath));
87656
- return basename20;
87655
+ const basename21 = path25.basename(filePath, path25.extname(filePath));
87656
+ return basename21;
87657
87657
  }
87658
87658
  };
87659
87659
  HttpRequestAdapter = class extends BaseRequestAdapter {
@@ -88324,8 +88324,8 @@ var init_generator = __esm({
88324
88324
  doc.paths["/health"] = this.generateHealthEndpoint();
88325
88325
  doc.paths["/workflows"] = this.generateListEndpoint();
88326
88326
  for (const endpoint of endpoints) {
88327
- const path52 = options.basePath ? `${options.basePath}${endpoint.path}` : endpoint.path;
88328
- doc.paths[path52] = this.generateWorkflowEndpoint(endpoint);
88327
+ const path54 = options.basePath ? `${options.basePath}${endpoint.path}` : endpoint.path;
88328
+ doc.paths[path54] = this.generateWorkflowEndpoint(endpoint);
88329
88329
  }
88330
88330
  return doc;
88331
88331
  }
@@ -88663,8 +88663,8 @@ var init_base = __esm({
88663
88663
  * Get relative import path for the workflow
88664
88664
  */
88665
88665
  getWorkflowImport(workflowFile) {
88666
- const basename20 = path27.basename(workflowFile, path27.extname(workflowFile));
88667
- return `./${basename20}.js`;
88666
+ const basename21 = path27.basename(workflowFile, path27.extname(workflowFile));
88667
+ return `./${basename21}.js`;
88668
88668
  }
88669
88669
  /**
88670
88670
  * Generate OpenAPI spec for node types as HTTP endpoints
@@ -90723,8 +90723,8 @@ var init_debug_controller = __esm({
90723
90723
  async pause(nodeId, phase, ctx) {
90724
90724
  const state = this.buildState(nodeId, phase, ctx);
90725
90725
  this._pauseResolve?.(state);
90726
- return new Promise((resolve36) => {
90727
- this._gateResolve = (action) => resolve36(action);
90726
+ return new Promise((resolve38) => {
90727
+ this._gateResolve = (action) => resolve38(action);
90728
90728
  });
90729
90729
  }
90730
90730
  applyAction(action) {
@@ -90785,8 +90785,8 @@ var init_debug_controller = __esm({
90785
90785
  return outputs;
90786
90786
  }
90787
90787
  _createPausePromise() {
90788
- return new Promise((resolve36) => {
90789
- this._pauseResolve = resolve36;
90788
+ return new Promise((resolve38) => {
90789
+ this._pauseResolve = resolve38;
90790
90790
  });
90791
90791
  }
90792
90792
  };
@@ -90985,8 +90985,8 @@ var init_agent_channel = __esm({
90985
90985
  */
90986
90986
  async request(agentRequest) {
90987
90987
  this._pauseResolve?.(agentRequest);
90988
- return new Promise((resolve36, reject2) => {
90989
- this._resolve = resolve36;
90988
+ return new Promise((resolve38, reject2) => {
90989
+ this._resolve = resolve38;
90990
90990
  this._reject = reject2;
90991
90991
  });
90992
90992
  }
@@ -91016,8 +91016,8 @@ var init_agent_channel = __esm({
91016
91016
  this._pausePromise = this._createPausePromise();
91017
91017
  }
91018
91018
  _createPausePromise() {
91019
- return new Promise((resolve36) => {
91020
- this._pauseResolve = resolve36;
91019
+ return new Promise((resolve38) => {
91020
+ this._pauseResolve = resolve38;
91021
91021
  });
91022
91022
  }
91023
91023
  };
@@ -92649,13 +92649,13 @@ async function runDebugRepl(controller, execPromise, agentChannel, options) {
92649
92649
  output: process.stderr,
92650
92650
  prompt: "> "
92651
92651
  });
92652
- return new Promise((resolve36, reject2) => {
92652
+ return new Promise((resolve38, reject2) => {
92653
92653
  let resolved = false;
92654
92654
  function finish(value) {
92655
92655
  if (resolved) return;
92656
92656
  resolved = true;
92657
92657
  rl.close();
92658
- resolve36(value);
92658
+ resolve38(value);
92659
92659
  }
92660
92660
  function fail(err) {
92661
92661
  if (resolved) return;
@@ -92867,7 +92867,7 @@ Workflow completed in ${execResult.executionTime}ms`);
92867
92867
  });
92868
92868
  }
92869
92869
  function promptForInput(question) {
92870
- return new Promise((resolve36) => {
92870
+ return new Promise((resolve38) => {
92871
92871
  const rl = readline8.createInterface({
92872
92872
  input: process.stdin,
92873
92873
  output: process.stderr
@@ -92875,7 +92875,7 @@ function promptForInput(question) {
92875
92875
  });
92876
92876
  rl.question(question, (answer) => {
92877
92877
  rl.close();
92878
- resolve36(answer.trim());
92878
+ resolve38(answer.trim());
92879
92879
  });
92880
92880
  });
92881
92881
  }
@@ -95088,14 +95088,14 @@ var init_platform_client = __esm({
95088
95088
  this.baseUrl = creds.platformUrl.replace(/\/+$/, "");
95089
95089
  this.token = creds.token;
95090
95090
  }
95091
- async fetch(path52, opts = {}) {
95091
+ async fetch(path54, opts = {}) {
95092
95092
  const isApiKey = this.token.startsWith("fw_");
95093
95093
  const headers = {
95094
95094
  "Content-Type": "application/json",
95095
95095
  ...isApiKey ? { "X-API-Key": this.token } : { Authorization: `Bearer ${this.token}` },
95096
95096
  ...opts.headers ?? {}
95097
95097
  };
95098
- return fetch(`${this.baseUrl}${path52}`, { ...opts, headers });
95098
+ return fetch(`${this.baseUrl}${path54}`, { ...opts, headers });
95099
95099
  }
95100
95100
  // Auth
95101
95101
  async getUser() {
@@ -95392,7 +95392,7 @@ async function authStatusCommand() {
95392
95392
  console.log("");
95393
95393
  }
95394
95394
  function prompt(message, hidden = false) {
95395
- return new Promise((resolve36) => {
95395
+ return new Promise((resolve38) => {
95396
95396
  const rl = readline9.createInterface({ input: process.stdin, output: process.stderr });
95397
95397
  if (hidden && process.stdin.isTTY) {
95398
95398
  process.stderr.write(message);
@@ -95405,7 +95405,7 @@ function prompt(message, hidden = false) {
95405
95405
  process.stdin.removeListener("data", handler);
95406
95406
  process.stderr.write("\n");
95407
95407
  rl.close();
95408
- resolve36(input);
95408
+ resolve38(input);
95409
95409
  } else if (ch === "") {
95410
95410
  process.exit(1);
95411
95411
  } else if (ch === "\x7F") {
@@ -95418,7 +95418,7 @@ function prompt(message, hidden = false) {
95418
95418
  } else {
95419
95419
  rl.question(message, (answer) => {
95420
95420
  rl.close();
95421
- resolve36(answer);
95421
+ resolve38(answer);
95422
95422
  });
95423
95423
  }
95424
95424
  });
@@ -95536,12 +95536,252 @@ var init_deploy = __esm({
95536
95536
  }
95537
95537
  });
95538
95538
 
95539
+ // src/agent/device-connection.ts
95540
+ var DeviceConnection;
95541
+ var init_device_connection = __esm({
95542
+ "src/agent/device-connection.ts"() {
95543
+ "use strict";
95544
+ DeviceConnection = class {
95545
+ ws = null;
95546
+ heartbeatInterval = null;
95547
+ reconnectTimeout = null;
95548
+ requestHandlers = /* @__PURE__ */ new Map();
95549
+ connected = false;
95550
+ shouldReconnect = true;
95551
+ options;
95552
+ deviceInfo;
95553
+ log;
95554
+ constructor(options) {
95555
+ this.options = options;
95556
+ this.log = options.logger ?? (() => {
95557
+ });
95558
+ const os5 = __require("node:os");
95559
+ this.deviceInfo = {
95560
+ name: options.deviceName ?? os5.hostname(),
95561
+ hostname: os5.hostname(),
95562
+ projectDir: options.projectDir,
95563
+ platform: process.platform,
95564
+ capabilities: []
95565
+ };
95566
+ }
95567
+ /**
95568
+ * Add a capability to advertise to the platform.
95569
+ */
95570
+ addCapability(capability) {
95571
+ if (!this.deviceInfo.capabilities.includes(capability)) {
95572
+ this.deviceInfo.capabilities.push(capability);
95573
+ }
95574
+ }
95575
+ /**
95576
+ * Register a handler for incoming requests from the platform.
95577
+ */
95578
+ onRequest(method, handler) {
95579
+ this.requestHandlers.set(method, handler);
95580
+ }
95581
+ /**
95582
+ * Connect to the platform. Reconnects automatically on disconnect.
95583
+ */
95584
+ async connect() {
95585
+ const wsUrl = this.options.platformUrl.replace(/^http/, "ws").replace(/\/$/, "") + "/ws/device";
95586
+ this.log(`Connecting to ${wsUrl}...`);
95587
+ this.shouldReconnect = true;
95588
+ return new Promise((resolve38, reject2) => {
95589
+ try {
95590
+ this.ws = new WebSocket(`${wsUrl}?token=${encodeURIComponent(this.options.token)}`);
95591
+ } catch (err) {
95592
+ reject2(err);
95593
+ return;
95594
+ }
95595
+ this.ws.addEventListener("open", () => {
95596
+ this.connected = true;
95597
+ this.log(`Connected as "${this.deviceInfo.name}"`);
95598
+ this.send({ type: "device:register", device: this.deviceInfo });
95599
+ this.heartbeatInterval = setInterval(() => {
95600
+ if (this.ws?.readyState === WebSocket.OPEN) {
95601
+ this.send({ type: "heartbeat", timestamp: Date.now() });
95602
+ }
95603
+ }, 3e4);
95604
+ this.options.onConnect?.();
95605
+ resolve38();
95606
+ });
95607
+ this.ws.addEventListener("message", async (event) => {
95608
+ try {
95609
+ const msg = JSON.parse(typeof event.data === "string" ? event.data : String(event.data));
95610
+ await this.handleMessage(msg);
95611
+ } catch (err) {
95612
+ this.log(`Parse error: ${err instanceof Error ? err.message : err}`);
95613
+ }
95614
+ });
95615
+ this.ws.addEventListener("close", (event) => {
95616
+ this.connected = false;
95617
+ if (this.heartbeatInterval) clearInterval(this.heartbeatInterval);
95618
+ this.options.onDisconnect?.(event.code);
95619
+ if (this.shouldReconnect) {
95620
+ this.log(`Disconnected (${event.code}). Reconnecting in 5s...`);
95621
+ this.scheduleReconnect();
95622
+ }
95623
+ });
95624
+ this.ws.addEventListener("error", () => {
95625
+ if (!this.connected) {
95626
+ reject2(new Error("WebSocket connection failed"));
95627
+ } else {
95628
+ this.log("Connection error");
95629
+ }
95630
+ });
95631
+ });
95632
+ }
95633
+ /**
95634
+ * Emit an event to the platform.
95635
+ */
95636
+ emit(event) {
95637
+ if (!this.connected) return;
95638
+ this.send({ type: "device:event", event });
95639
+ this.options.onEvent?.(event);
95640
+ }
95641
+ /**
95642
+ * Disconnect from the platform. No auto-reconnect.
95643
+ */
95644
+ disconnect() {
95645
+ this.shouldReconnect = false;
95646
+ if (this.heartbeatInterval) clearInterval(this.heartbeatInterval);
95647
+ if (this.reconnectTimeout) clearTimeout(this.reconnectTimeout);
95648
+ if (this.ws) {
95649
+ this.ws.close(1e3, "Device disconnecting");
95650
+ this.ws = null;
95651
+ }
95652
+ this.connected = false;
95653
+ }
95654
+ isConnected() {
95655
+ return this.connected;
95656
+ }
95657
+ getDeviceInfo() {
95658
+ return this.deviceInfo;
95659
+ }
95660
+ // --- Private ---
95661
+ send(msg) {
95662
+ if (this.ws?.readyState === WebSocket.OPEN) {
95663
+ this.ws.send(JSON.stringify(msg));
95664
+ }
95665
+ }
95666
+ async handleMessage(msg) {
95667
+ const type2 = String(msg.type ?? "");
95668
+ const requestId = String(msg.requestId ?? "");
95669
+ if (type2 === "request") {
95670
+ const method = String(msg.method ?? "");
95671
+ const params = msg.params ?? {};
95672
+ const handler = this.requestHandlers.get(method);
95673
+ if (!handler) {
95674
+ this.send({ type: "response", requestId, success: false, error: `Unknown method: ${method}` });
95675
+ return;
95676
+ }
95677
+ try {
95678
+ const result = await handler(method, params);
95679
+ this.send({ type: "response", requestId, success: true, result });
95680
+ } catch (err) {
95681
+ this.send({ type: "response", requestId, success: false, error: err instanceof Error ? err.message : String(err) });
95682
+ }
95683
+ }
95684
+ }
95685
+ scheduleReconnect() {
95686
+ if (this.reconnectTimeout) clearTimeout(this.reconnectTimeout);
95687
+ this.reconnectTimeout = setTimeout(async () => {
95688
+ try {
95689
+ await this.connect();
95690
+ } catch {
95691
+ this.log("Reconnect failed. Retrying in 10s...");
95692
+ this.reconnectTimeout = setTimeout(() => this.scheduleReconnect(), 1e4);
95693
+ }
95694
+ }, 5e3);
95695
+ }
95696
+ };
95697
+ }
95698
+ });
95699
+
95700
+ // src/cli/commands/connect.ts
95701
+ var connect_exports = {};
95702
+ __export(connect_exports, {
95703
+ handleConnect: () => handleConnect
95704
+ });
95705
+ import * as fs49 from "node:fs";
95706
+ import * as path52 from "node:path";
95707
+ import * as os4 from "node:os";
95708
+ async function handleConnect(projectDir) {
95709
+ const credPath = path52.join(os4.homedir(), ".fw", "credentials.json");
95710
+ if (!fs49.existsSync(credPath)) {
95711
+ console.error("\n Not logged in. Run: fw login\n");
95712
+ process.exit(1);
95713
+ }
95714
+ const creds = JSON.parse(fs49.readFileSync(credPath, "utf-8"));
95715
+ if (!creds.token || !creds.platformUrl || creds.expiresAt < Date.now()) {
95716
+ console.error("\n Credentials expired. Run: fw login\n");
95717
+ process.exit(1);
95718
+ }
95719
+ const conn = new DeviceConnection({
95720
+ platformUrl: creds.platformUrl,
95721
+ token: creds.token,
95722
+ projectDir,
95723
+ deviceName: path52.basename(projectDir),
95724
+ logger: (msg) => process.stderr.write(` \x1B[2m${msg}\x1B[0m
95725
+ `)
95726
+ });
95727
+ conn.addCapability("file_read");
95728
+ conn.addCapability("file_list");
95729
+ conn.onRequest("file:read", async (_method, params) => {
95730
+ const filePath = path52.resolve(projectDir, String(params.path ?? ""));
95731
+ if (!filePath.startsWith(projectDir)) throw new Error("Path outside project directory");
95732
+ if (!fs49.existsSync(filePath)) throw new Error("File not found");
95733
+ const stat = fs49.statSync(filePath);
95734
+ if (stat.isDirectory()) return { type: "directory", entries: fs49.readdirSync(filePath) };
95735
+ if (stat.size > 1048576) throw new Error("File too large (>1MB)");
95736
+ return { type: "file", content: fs49.readFileSync(filePath, "utf-8") };
95737
+ });
95738
+ conn.onRequest("file:list", async (_method, params) => {
95739
+ const dirPath = path52.resolve(projectDir, String(params.path ?? "."));
95740
+ if (!dirPath.startsWith(projectDir)) throw new Error("Path outside project directory");
95741
+ if (!fs49.existsSync(dirPath)) throw new Error("Directory not found");
95742
+ const entries = fs49.readdirSync(dirPath, { withFileTypes: true });
95743
+ 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)) }));
95744
+ });
95745
+ console.log("");
95746
+ console.log(" \x1B[1mflow-weaver connect\x1B[0m");
95747
+ console.log(` \x1B[2mProject: ${path52.basename(projectDir)}\x1B[0m`);
95748
+ console.log(` \x1B[2mPlatform: ${creds.platformUrl}\x1B[0m`);
95749
+ console.log("");
95750
+ try {
95751
+ await conn.connect();
95752
+ console.log(" \x1B[2mPress Ctrl+C to disconnect.\x1B[0m\n");
95753
+ await new Promise((resolve38) => {
95754
+ process.on("SIGINT", () => {
95755
+ console.log("\n \x1B[2mDisconnecting...\x1B[0m");
95756
+ conn.disconnect();
95757
+ resolve38();
95758
+ });
95759
+ process.on("SIGTERM", () => {
95760
+ conn.disconnect();
95761
+ resolve38();
95762
+ });
95763
+ });
95764
+ } catch (err) {
95765
+ console.error(` \x1B[31m\u2717\x1B[0m Connection failed: ${err instanceof Error ? err.message : err}`);
95766
+ process.exit(1);
95767
+ }
95768
+ }
95769
+ var init_connect = __esm({
95770
+ "src/cli/commands/connect.ts"() {
95771
+ "use strict";
95772
+ init_device_connection();
95773
+ }
95774
+ });
95775
+
95539
95776
  // src/cli/env-setup.ts
95540
95777
  if (process.env.FORCE_COLOR === "0") {
95541
95778
  process.env.NO_COLOR = "1";
95542
95779
  delete process.env.FORCE_COLOR;
95543
95780
  }
95544
95781
 
95782
+ // src/cli/index.ts
95783
+ import * as path53 from "node:path";
95784
+
95545
95785
  // node_modules/commander/esm.mjs
95546
95786
  var import_index = __toESM(require_commander(), 1);
95547
95787
  var {
@@ -95562,7 +95802,7 @@ var {
95562
95802
  // src/cli/index.ts
95563
95803
  init_logger();
95564
95804
  init_error_utils();
95565
- var version2 = true ? "0.23.0" : "0.0.0-dev";
95805
+ var version2 = true ? "0.23.1" : "0.0.0-dev";
95566
95806
  var program2 = new Command();
95567
95807
  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
95808
  logger.banner(version2);
@@ -95861,6 +96101,10 @@ if (!process.env["VITEST"]) {
95861
96101
  const { cloudStatusCommand: cloudStatusCommand2 } = await Promise.resolve().then(() => (init_deploy(), deploy_exports));
95862
96102
  await cloudStatusCommand2();
95863
96103
  });
96104
+ program2.command("connect [dir]").description("Connect this device to the Flow Weaver platform").action(async (dir) => {
96105
+ const { handleConnect: handleConnect2 } = await Promise.resolve().then(() => (init_connect(), connect_exports));
96106
+ await handleConnect2(path53.resolve(dir ?? "."));
96107
+ });
95864
96108
  if (!program2.commands.some((c) => c.name() === "weaver")) {
95865
96109
  program2.command("weaver").description("AI assistant for Flow Weaver workflows").allowUnknownOption(true).action(async () => {
95866
96110
  console.log("");