meshy-node 0.3.7 → 0.3.8

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.
package/main.cjs CHANGED
@@ -4646,8 +4646,8 @@ var require_helpers = __commonJS({
4646
4646
  function req(url, opts = {}) {
4647
4647
  const href = typeof url === "string" ? url : url.href;
4648
4648
  const req2 = (href.startsWith("https:") ? https2 : http3).request(url, opts);
4649
- const promise = new Promise((resolve14, reject) => {
4650
- req2.once("response", resolve14).once("error", reject).end();
4649
+ const promise = new Promise((resolve15, reject) => {
4650
+ req2.once("response", resolve15).once("error", reject).end();
4651
4651
  });
4652
4652
  req2.then = promise.then.bind(promise);
4653
4653
  return req2;
@@ -4824,7 +4824,7 @@ var require_parse_proxy_response = __commonJS({
4824
4824
  var debug_1 = __importDefault(require_src());
4825
4825
  var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
4826
4826
  function parseProxyResponse(socket) {
4827
- return new Promise((resolve14, reject) => {
4827
+ return new Promise((resolve15, reject) => {
4828
4828
  let buffersLength = 0;
4829
4829
  const buffers = [];
4830
4830
  function read() {
@@ -4890,7 +4890,7 @@ var require_parse_proxy_response = __commonJS({
4890
4890
  }
4891
4891
  debug("got proxy server response: %o %o", firstLine, headers);
4892
4892
  cleanup();
4893
- resolve14({
4893
+ resolve15({
4894
4894
  connect: {
4895
4895
  statusCode,
4896
4896
  statusText,
@@ -6629,8 +6629,8 @@ var require_node2 = __commonJS({
6629
6629
  }
6630
6630
  break;
6631
6631
  case "FILE":
6632
- var fs22 = require("fs");
6633
- stream2 = new fs22.SyncWriteStream(fd2, { autoClose: false });
6632
+ var fs23 = require("fs");
6633
+ stream2 = new fs23.SyncWriteStream(fd2, { autoClose: false });
6634
6634
  stream2._type = "fs";
6635
6635
  break;
6636
6636
  case "PIPE":
@@ -10283,10 +10283,10 @@ var require_raw_body = __commonJS({
10283
10283
  if (done) {
10284
10284
  return readStream(stream, encoding, length, limit, wrap(done));
10285
10285
  }
10286
- return new Promise(function executor(resolve14, reject) {
10286
+ return new Promise(function executor(resolve15, reject) {
10287
10287
  readStream(stream, encoding, length, limit, function onRead(err, buf) {
10288
10288
  if (err) return reject(err);
10289
- resolve14(buf);
10289
+ resolve15(buf);
10290
10290
  });
10291
10291
  });
10292
10292
  }
@@ -19420,11 +19420,11 @@ var require_mime_types = __commonJS({
19420
19420
  }
19421
19421
  return exts[0];
19422
19422
  }
19423
- function lookup(path23) {
19424
- if (!path23 || typeof path23 !== "string") {
19423
+ function lookup(path24) {
19424
+ if (!path24 || typeof path24 !== "string") {
19425
19425
  return false;
19426
19426
  }
19427
- var extension2 = extname3("x." + path23).toLowerCase().substr(1);
19427
+ var extension2 = extname3("x." + path24).toLowerCase().substr(1);
19428
19428
  if (!extension2) {
19429
19429
  return false;
19430
19430
  }
@@ -22942,7 +22942,7 @@ var require_path_to_regexp = __commonJS({
22942
22942
  "use strict";
22943
22943
  module2.exports = pathToRegexp;
22944
22944
  var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
22945
- function pathToRegexp(path23, keys, options) {
22945
+ function pathToRegexp(path24, keys, options) {
22946
22946
  options = options || {};
22947
22947
  keys = keys || [];
22948
22948
  var strict = options.strict;
@@ -22956,8 +22956,8 @@ var require_path_to_regexp = __commonJS({
22956
22956
  var pos = 0;
22957
22957
  var backtrack = "";
22958
22958
  var m;
22959
- if (path23 instanceof RegExp) {
22960
- while (m = MATCHING_GROUP_REGEXP.exec(path23.source)) {
22959
+ if (path24 instanceof RegExp) {
22960
+ while (m = MATCHING_GROUP_REGEXP.exec(path24.source)) {
22961
22961
  if (m[0][0] === "\\") continue;
22962
22962
  keys.push({
22963
22963
  name: m[1] || name2++,
@@ -22965,18 +22965,18 @@ var require_path_to_regexp = __commonJS({
22965
22965
  offset: m.index
22966
22966
  });
22967
22967
  }
22968
- return path23;
22968
+ return path24;
22969
22969
  }
22970
- if (Array.isArray(path23)) {
22971
- path23 = path23.map(function(value) {
22970
+ if (Array.isArray(path24)) {
22971
+ path24 = path24.map(function(value) {
22972
22972
  return pathToRegexp(value, keys, options).source;
22973
22973
  });
22974
- return new RegExp(path23.join("|"), flags);
22974
+ return new RegExp(path24.join("|"), flags);
22975
22975
  }
22976
- if (typeof path23 !== "string") {
22976
+ if (typeof path24 !== "string") {
22977
22977
  throw new TypeError("path must be a string, array of strings, or regular expression");
22978
22978
  }
22979
- path23 = path23.replace(
22979
+ path24 = path24.replace(
22980
22980
  /\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
22981
22981
  function(match, slash, format, key, capture, star, optional, offset) {
22982
22982
  if (match[0] === "\\") {
@@ -22993,7 +22993,7 @@ var require_path_to_regexp = __commonJS({
22993
22993
  if (slash || format) {
22994
22994
  backtrack = "";
22995
22995
  } else {
22996
- backtrack += path23.slice(pos, offset);
22996
+ backtrack += path24.slice(pos, offset);
22997
22997
  }
22998
22998
  pos = offset + match.length;
22999
22999
  if (match === "*") {
@@ -23023,7 +23023,7 @@ var require_path_to_regexp = __commonJS({
23023
23023
  return result;
23024
23024
  }
23025
23025
  );
23026
- while (m = MATCHING_GROUP_REGEXP.exec(path23)) {
23026
+ while (m = MATCHING_GROUP_REGEXP.exec(path24)) {
23027
23027
  if (m[0][0] === "\\") continue;
23028
23028
  if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
23029
23029
  keys.splice(keysOffset + i, 0, {
@@ -23035,13 +23035,13 @@ var require_path_to_regexp = __commonJS({
23035
23035
  }
23036
23036
  i++;
23037
23037
  }
23038
- path23 += strict ? "" : path23[path23.length - 1] === "/" ? "?" : "/?";
23038
+ path24 += strict ? "" : path24[path24.length - 1] === "/" ? "?" : "/?";
23039
23039
  if (end) {
23040
- path23 += "$";
23041
- } else if (path23[path23.length - 1] !== "/") {
23042
- path23 += lookahead ? "(?=/|$)" : "(?:/|$)";
23040
+ path24 += "$";
23041
+ } else if (path24[path24.length - 1] !== "/") {
23042
+ path24 += lookahead ? "(?=/|$)" : "(?:/|$)";
23043
23043
  }
23044
- return new RegExp("^" + path23, flags);
23044
+ return new RegExp("^" + path24, flags);
23045
23045
  }
23046
23046
  }
23047
23047
  });
@@ -23054,19 +23054,19 @@ var require_layer = __commonJS({
23054
23054
  var debug = require_src2()("express:router:layer");
23055
23055
  var hasOwnProperty = Object.prototype.hasOwnProperty;
23056
23056
  module2.exports = Layer;
23057
- function Layer(path23, options, fn) {
23057
+ function Layer(path24, options, fn) {
23058
23058
  if (!(this instanceof Layer)) {
23059
- return new Layer(path23, options, fn);
23059
+ return new Layer(path24, options, fn);
23060
23060
  }
23061
- debug("new %o", path23);
23061
+ debug("new %o", path24);
23062
23062
  var opts = options || {};
23063
23063
  this.handle = fn;
23064
23064
  this.name = fn.name || "<anonymous>";
23065
23065
  this.params = void 0;
23066
23066
  this.path = void 0;
23067
- this.regexp = pathRegexp(path23, this.keys = [], opts);
23068
- this.regexp.fast_star = path23 === "*";
23069
- this.regexp.fast_slash = path23 === "/" && opts.end === false;
23067
+ this.regexp = pathRegexp(path24, this.keys = [], opts);
23068
+ this.regexp.fast_star = path24 === "*";
23069
+ this.regexp.fast_slash = path24 === "/" && opts.end === false;
23070
23070
  }
23071
23071
  Layer.prototype.handle_error = function handle_error(error, req, res, next) {
23072
23072
  var fn = this.handle;
@@ -23090,20 +23090,20 @@ var require_layer = __commonJS({
23090
23090
  next(err);
23091
23091
  }
23092
23092
  };
23093
- Layer.prototype.match = function match(path23) {
23093
+ Layer.prototype.match = function match(path24) {
23094
23094
  var match2;
23095
- if (path23 != null) {
23095
+ if (path24 != null) {
23096
23096
  if (this.regexp.fast_slash) {
23097
23097
  this.params = {};
23098
23098
  this.path = "";
23099
23099
  return true;
23100
23100
  }
23101
23101
  if (this.regexp.fast_star) {
23102
- this.params = { "0": decode_param(path23) };
23103
- this.path = path23;
23102
+ this.params = { "0": decode_param(path24) };
23103
+ this.path = path24;
23104
23104
  return true;
23105
23105
  }
23106
- match2 = this.regexp.exec(path23);
23106
+ match2 = this.regexp.exec(path24);
23107
23107
  }
23108
23108
  if (!match2) {
23109
23109
  this.params = void 0;
@@ -23196,10 +23196,10 @@ var require_route = __commonJS({
23196
23196
  var slice = Array.prototype.slice;
23197
23197
  var toString = Object.prototype.toString;
23198
23198
  module2.exports = Route;
23199
- function Route(path23) {
23200
- this.path = path23;
23199
+ function Route(path24) {
23200
+ this.path = path24;
23201
23201
  this.stack = [];
23202
- debug("new %o", path23);
23202
+ debug("new %o", path24);
23203
23203
  this.methods = {};
23204
23204
  }
23205
23205
  Route.prototype._handles_method = function _handles_method(method) {
@@ -23412,8 +23412,8 @@ var require_router = __commonJS({
23412
23412
  if (++sync > 100) {
23413
23413
  return setImmediate(next, err);
23414
23414
  }
23415
- var path23 = getPathname(req);
23416
- if (path23 == null) {
23415
+ var path24 = getPathname(req);
23416
+ if (path24 == null) {
23417
23417
  return done(layerError);
23418
23418
  }
23419
23419
  var layer;
@@ -23421,7 +23421,7 @@ var require_router = __commonJS({
23421
23421
  var route;
23422
23422
  while (match !== true && idx < stack.length) {
23423
23423
  layer = stack[idx++];
23424
- match = matchLayer(layer, path23);
23424
+ match = matchLayer(layer, path24);
23425
23425
  route = layer.route;
23426
23426
  if (typeof match !== "boolean") {
23427
23427
  layerError = layerError || match;
@@ -23459,18 +23459,18 @@ var require_router = __commonJS({
23459
23459
  } else if (route) {
23460
23460
  layer.handle_request(req, res, next);
23461
23461
  } else {
23462
- trim_prefix(layer, layerError, layerPath, path23);
23462
+ trim_prefix(layer, layerError, layerPath, path24);
23463
23463
  }
23464
23464
  sync = 0;
23465
23465
  });
23466
23466
  }
23467
- function trim_prefix(layer, layerError, layerPath, path23) {
23467
+ function trim_prefix(layer, layerError, layerPath, path24) {
23468
23468
  if (layerPath.length !== 0) {
23469
- if (layerPath !== path23.slice(0, layerPath.length)) {
23469
+ if (layerPath !== path24.slice(0, layerPath.length)) {
23470
23470
  next(layerError);
23471
23471
  return;
23472
23472
  }
23473
- var c = path23[layerPath.length];
23473
+ var c = path24[layerPath.length];
23474
23474
  if (c && c !== "/" && c !== ".") return next(layerError);
23475
23475
  debug("trim prefix (%s) from url %s", layerPath, req.url);
23476
23476
  removed = layerPath;
@@ -23548,7 +23548,7 @@ var require_router = __commonJS({
23548
23548
  };
23549
23549
  proto.use = function use(fn) {
23550
23550
  var offset = 0;
23551
- var path23 = "/";
23551
+ var path24 = "/";
23552
23552
  if (typeof fn !== "function") {
23553
23553
  var arg = fn;
23554
23554
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -23556,7 +23556,7 @@ var require_router = __commonJS({
23556
23556
  }
23557
23557
  if (typeof arg !== "function") {
23558
23558
  offset = 1;
23559
- path23 = fn;
23559
+ path24 = fn;
23560
23560
  }
23561
23561
  }
23562
23562
  var callbacks = flatten(slice.call(arguments, offset));
@@ -23568,8 +23568,8 @@ var require_router = __commonJS({
23568
23568
  if (typeof fn !== "function") {
23569
23569
  throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
23570
23570
  }
23571
- debug("use %o %s", path23, fn.name || "<anonymous>");
23572
- var layer = new Layer(path23, {
23571
+ debug("use %o %s", path24, fn.name || "<anonymous>");
23572
+ var layer = new Layer(path24, {
23573
23573
  sensitive: this.caseSensitive,
23574
23574
  strict: false,
23575
23575
  end: false
@@ -23579,9 +23579,9 @@ var require_router = __commonJS({
23579
23579
  }
23580
23580
  return this;
23581
23581
  };
23582
- proto.route = function route(path23) {
23583
- var route2 = new Route(path23);
23584
- var layer = new Layer(path23, {
23582
+ proto.route = function route(path24) {
23583
+ var route2 = new Route(path24);
23584
+ var layer = new Layer(path24, {
23585
23585
  sensitive: this.caseSensitive,
23586
23586
  strict: this.strict,
23587
23587
  end: true
@@ -23591,8 +23591,8 @@ var require_router = __commonJS({
23591
23591
  return route2;
23592
23592
  };
23593
23593
  methods.concat("all").forEach(function(method) {
23594
- proto[method] = function(path23) {
23595
- var route = this.route(path23);
23594
+ proto[method] = function(path24) {
23595
+ var route = this.route(path24);
23596
23596
  route[method].apply(route, slice.call(arguments, 1));
23597
23597
  return this;
23598
23598
  };
@@ -23628,9 +23628,9 @@ var require_router = __commonJS({
23628
23628
  }
23629
23629
  return toString.call(obj).replace(objectRegExp, "$1");
23630
23630
  }
23631
- function matchLayer(layer, path23) {
23631
+ function matchLayer(layer, path24) {
23632
23632
  try {
23633
- return layer.match(path23);
23633
+ return layer.match(path24);
23634
23634
  } catch (err) {
23635
23635
  return err;
23636
23636
  }
@@ -23748,13 +23748,13 @@ var require_view = __commonJS({
23748
23748
  "../../node_modules/.pnpm/express@4.22.1/node_modules/express/lib/view.js"(exports2, module2) {
23749
23749
  "use strict";
23750
23750
  var debug = require_src2()("express:view");
23751
- var path23 = require("path");
23752
- var fs22 = require("fs");
23753
- var dirname7 = path23.dirname;
23754
- var basename5 = path23.basename;
23755
- var extname3 = path23.extname;
23756
- var join18 = path23.join;
23757
- var resolve14 = path23.resolve;
23751
+ var path24 = require("path");
23752
+ var fs23 = require("fs");
23753
+ var dirname7 = path24.dirname;
23754
+ var basename5 = path24.basename;
23755
+ var extname3 = path24.extname;
23756
+ var join18 = path24.join;
23757
+ var resolve15 = path24.resolve;
23758
23758
  module2.exports = View;
23759
23759
  function View(name2, options) {
23760
23760
  var opts = options || {};
@@ -23783,39 +23783,39 @@ var require_view = __commonJS({
23783
23783
  this.path = this.lookup(fileName);
23784
23784
  }
23785
23785
  View.prototype.lookup = function lookup(name2) {
23786
- var path24;
23786
+ var path25;
23787
23787
  var roots = [].concat(this.root);
23788
23788
  debug('lookup "%s"', name2);
23789
- for (var i = 0; i < roots.length && !path24; i++) {
23789
+ for (var i = 0; i < roots.length && !path25; i++) {
23790
23790
  var root = roots[i];
23791
- var loc = resolve14(root, name2);
23791
+ var loc = resolve15(root, name2);
23792
23792
  var dir = dirname7(loc);
23793
23793
  var file = basename5(loc);
23794
- path24 = this.resolve(dir, file);
23794
+ path25 = this.resolve(dir, file);
23795
23795
  }
23796
- return path24;
23796
+ return path25;
23797
23797
  };
23798
23798
  View.prototype.render = function render(options, callback) {
23799
23799
  debug('render "%s"', this.path);
23800
23800
  this.engine(this.path, options, callback);
23801
23801
  };
23802
- View.prototype.resolve = function resolve15(dir, file) {
23802
+ View.prototype.resolve = function resolve16(dir, file) {
23803
23803
  var ext = this.ext;
23804
- var path24 = join18(dir, file);
23805
- var stat = tryStat(path24);
23804
+ var path25 = join18(dir, file);
23805
+ var stat = tryStat(path25);
23806
23806
  if (stat && stat.isFile()) {
23807
- return path24;
23807
+ return path25;
23808
23808
  }
23809
- path24 = join18(dir, basename5(file, ext), "index" + ext);
23810
- stat = tryStat(path24);
23809
+ path25 = join18(dir, basename5(file, ext), "index" + ext);
23810
+ stat = tryStat(path25);
23811
23811
  if (stat && stat.isFile()) {
23812
- return path24;
23812
+ return path25;
23813
23813
  }
23814
23814
  };
23815
- function tryStat(path24) {
23816
- debug('stat "%s"', path24);
23815
+ function tryStat(path25) {
23816
+ debug('stat "%s"', path25);
23817
23817
  try {
23818
- return fs22.statSync(path24);
23818
+ return fs23.statSync(path25);
23819
23819
  } catch (e) {
23820
23820
  return void 0;
23821
23821
  }
@@ -24112,8 +24112,8 @@ var require_types = __commonJS({
24112
24112
  var require_mime = __commonJS({
24113
24113
  "../../node_modules/.pnpm/mime@1.6.0/node_modules/mime/mime.js"(exports2, module2) {
24114
24114
  "use strict";
24115
- var path23 = require("path");
24116
- var fs22 = require("fs");
24115
+ var path24 = require("path");
24116
+ var fs23 = require("fs");
24117
24117
  function Mime() {
24118
24118
  this.types = /* @__PURE__ */ Object.create(null);
24119
24119
  this.extensions = /* @__PURE__ */ Object.create(null);
@@ -24134,7 +24134,7 @@ var require_mime = __commonJS({
24134
24134
  };
24135
24135
  Mime.prototype.load = function(file) {
24136
24136
  this._loading = file;
24137
- var map = {}, content = fs22.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
24137
+ var map = {}, content = fs23.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
24138
24138
  lines.forEach(function(line) {
24139
24139
  var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
24140
24140
  map[fields.shift()] = fields;
@@ -24142,8 +24142,8 @@ var require_mime = __commonJS({
24142
24142
  this.define(map);
24143
24143
  this._loading = null;
24144
24144
  };
24145
- Mime.prototype.lookup = function(path24, fallback) {
24146
- var ext = path24.replace(/^.*[\.\/\\]/, "").toLowerCase();
24145
+ Mime.prototype.lookup = function(path25, fallback) {
24146
+ var ext = path25.replace(/^.*[\.\/\\]/, "").toLowerCase();
24147
24147
  return this.types[ext] || fallback || this.default_type;
24148
24148
  };
24149
24149
  Mime.prototype.extension = function(mimeType) {
@@ -24256,33 +24256,33 @@ var require_send = __commonJS({
24256
24256
  var escapeHtml2 = require_escape_html();
24257
24257
  var etag = require_etag();
24258
24258
  var fresh = require_fresh();
24259
- var fs22 = require("fs");
24259
+ var fs23 = require("fs");
24260
24260
  var mime = require_mime();
24261
24261
  var ms = require_ms();
24262
24262
  var onFinished = require_on_finished();
24263
24263
  var parseRange = require_range_parser();
24264
- var path23 = require("path");
24264
+ var path24 = require("path");
24265
24265
  var statuses = require_statuses();
24266
24266
  var Stream = require("stream");
24267
24267
  var util3 = require("util");
24268
- var extname3 = path23.extname;
24269
- var join18 = path23.join;
24270
- var normalize = path23.normalize;
24271
- var resolve14 = path23.resolve;
24272
- var sep4 = path23.sep;
24268
+ var extname3 = path24.extname;
24269
+ var join18 = path24.join;
24270
+ var normalize = path24.normalize;
24271
+ var resolve15 = path24.resolve;
24272
+ var sep4 = path24.sep;
24273
24273
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
24274
24274
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
24275
24275
  var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
24276
24276
  module2.exports = send;
24277
24277
  module2.exports.mime = mime;
24278
- function send(req, path24, options) {
24279
- return new SendStream(req, path24, options);
24278
+ function send(req, path25, options) {
24279
+ return new SendStream(req, path25, options);
24280
24280
  }
24281
- function SendStream(req, path24, options) {
24281
+ function SendStream(req, path25, options) {
24282
24282
  Stream.call(this);
24283
24283
  var opts = options || {};
24284
24284
  this.options = opts;
24285
- this.path = path24;
24285
+ this.path = path25;
24286
24286
  this.req = req;
24287
24287
  this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
24288
24288
  this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
@@ -24305,7 +24305,7 @@ var require_send = __commonJS({
24305
24305
  this._maxage = opts.maxAge || opts.maxage;
24306
24306
  this._maxage = typeof this._maxage === "string" ? ms(this._maxage) : Number(this._maxage);
24307
24307
  this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
24308
- this._root = opts.root ? resolve14(opts.root) : null;
24308
+ this._root = opts.root ? resolve15(opts.root) : null;
24309
24309
  if (!this._root && opts.from) {
24310
24310
  this.from(opts.from);
24311
24311
  }
@@ -24328,8 +24328,8 @@ var require_send = __commonJS({
24328
24328
  this._index = index2;
24329
24329
  return this;
24330
24330
  }, "send.index: pass index as option");
24331
- SendStream.prototype.root = function root(path24) {
24332
- this._root = resolve14(String(path24));
24331
+ SendStream.prototype.root = function root(path25) {
24332
+ this._root = resolve15(String(path25));
24333
24333
  debug("root %s", this._root);
24334
24334
  return this;
24335
24335
  };
@@ -24442,10 +24442,10 @@ var require_send = __commonJS({
24442
24442
  var lastModified = this.res.getHeader("Last-Modified");
24443
24443
  return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
24444
24444
  };
24445
- SendStream.prototype.redirect = function redirect(path24) {
24445
+ SendStream.prototype.redirect = function redirect(path25) {
24446
24446
  var res = this.res;
24447
24447
  if (hasListeners(this, "directory")) {
24448
- this.emit("directory", res, path24);
24448
+ this.emit("directory", res, path25);
24449
24449
  return;
24450
24450
  }
24451
24451
  if (this.hasTrailingSlash()) {
@@ -24465,42 +24465,42 @@ var require_send = __commonJS({
24465
24465
  SendStream.prototype.pipe = function pipe(res) {
24466
24466
  var root = this._root;
24467
24467
  this.res = res;
24468
- var path24 = decode(this.path);
24469
- if (path24 === -1) {
24468
+ var path25 = decode(this.path);
24469
+ if (path25 === -1) {
24470
24470
  this.error(400);
24471
24471
  return res;
24472
24472
  }
24473
- if (~path24.indexOf("\0")) {
24473
+ if (~path25.indexOf("\0")) {
24474
24474
  this.error(400);
24475
24475
  return res;
24476
24476
  }
24477
24477
  var parts;
24478
24478
  if (root !== null) {
24479
- if (path24) {
24480
- path24 = normalize("." + sep4 + path24);
24479
+ if (path25) {
24480
+ path25 = normalize("." + sep4 + path25);
24481
24481
  }
24482
- if (UP_PATH_REGEXP.test(path24)) {
24483
- debug('malicious path "%s"', path24);
24482
+ if (UP_PATH_REGEXP.test(path25)) {
24483
+ debug('malicious path "%s"', path25);
24484
24484
  this.error(403);
24485
24485
  return res;
24486
24486
  }
24487
- parts = path24.split(sep4);
24488
- path24 = normalize(join18(root, path24));
24487
+ parts = path25.split(sep4);
24488
+ path25 = normalize(join18(root, path25));
24489
24489
  } else {
24490
- if (UP_PATH_REGEXP.test(path24)) {
24491
- debug('malicious path "%s"', path24);
24490
+ if (UP_PATH_REGEXP.test(path25)) {
24491
+ debug('malicious path "%s"', path25);
24492
24492
  this.error(403);
24493
24493
  return res;
24494
24494
  }
24495
- parts = normalize(path24).split(sep4);
24496
- path24 = resolve14(path24);
24495
+ parts = normalize(path25).split(sep4);
24496
+ path25 = resolve15(path25);
24497
24497
  }
24498
24498
  if (containsDotFile(parts)) {
24499
24499
  var access = this._dotfiles;
24500
24500
  if (access === void 0) {
24501
24501
  access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
24502
24502
  }
24503
- debug('%s dotfile "%s"', access, path24);
24503
+ debug('%s dotfile "%s"', access, path25);
24504
24504
  switch (access) {
24505
24505
  case "allow":
24506
24506
  break;
@@ -24514,13 +24514,13 @@ var require_send = __commonJS({
24514
24514
  }
24515
24515
  }
24516
24516
  if (this._index.length && this.hasTrailingSlash()) {
24517
- this.sendIndex(path24);
24517
+ this.sendIndex(path25);
24518
24518
  return res;
24519
24519
  }
24520
- this.sendFile(path24);
24520
+ this.sendFile(path25);
24521
24521
  return res;
24522
24522
  };
24523
- SendStream.prototype.send = function send2(path24, stat) {
24523
+ SendStream.prototype.send = function send2(path25, stat) {
24524
24524
  var len = stat.size;
24525
24525
  var options = this.options;
24526
24526
  var opts = {};
@@ -24532,9 +24532,9 @@ var require_send = __commonJS({
24532
24532
  this.headersAlreadySent();
24533
24533
  return;
24534
24534
  }
24535
- debug('pipe "%s"', path24);
24536
- this.setHeader(path24, stat);
24537
- this.type(path24);
24535
+ debug('pipe "%s"', path25);
24536
+ this.setHeader(path25, stat);
24537
+ this.type(path25);
24538
24538
  if (this.isConditionalGET()) {
24539
24539
  if (this.isPreconditionFailure()) {
24540
24540
  this.error(412);
@@ -24583,28 +24583,28 @@ var require_send = __commonJS({
24583
24583
  res.end();
24584
24584
  return;
24585
24585
  }
24586
- this.stream(path24, opts);
24586
+ this.stream(path25, opts);
24587
24587
  };
24588
- SendStream.prototype.sendFile = function sendFile(path24) {
24588
+ SendStream.prototype.sendFile = function sendFile(path25) {
24589
24589
  var i = 0;
24590
24590
  var self2 = this;
24591
- debug('stat "%s"', path24);
24592
- fs22.stat(path24, function onstat(err, stat) {
24593
- if (err && err.code === "ENOENT" && !extname3(path24) && path24[path24.length - 1] !== sep4) {
24591
+ debug('stat "%s"', path25);
24592
+ fs23.stat(path25, function onstat(err, stat) {
24593
+ if (err && err.code === "ENOENT" && !extname3(path25) && path25[path25.length - 1] !== sep4) {
24594
24594
  return next(err);
24595
24595
  }
24596
24596
  if (err) return self2.onStatError(err);
24597
- if (stat.isDirectory()) return self2.redirect(path24);
24598
- self2.emit("file", path24, stat);
24599
- self2.send(path24, stat);
24597
+ if (stat.isDirectory()) return self2.redirect(path25);
24598
+ self2.emit("file", path25, stat);
24599
+ self2.send(path25, stat);
24600
24600
  });
24601
24601
  function next(err) {
24602
24602
  if (self2._extensions.length <= i) {
24603
24603
  return err ? self2.onStatError(err) : self2.error(404);
24604
24604
  }
24605
- var p = path24 + "." + self2._extensions[i++];
24605
+ var p = path25 + "." + self2._extensions[i++];
24606
24606
  debug('stat "%s"', p);
24607
- fs22.stat(p, function(err2, stat) {
24607
+ fs23.stat(p, function(err2, stat) {
24608
24608
  if (err2) return next(err2);
24609
24609
  if (stat.isDirectory()) return next();
24610
24610
  self2.emit("file", p, stat);
@@ -24612,7 +24612,7 @@ var require_send = __commonJS({
24612
24612
  });
24613
24613
  }
24614
24614
  };
24615
- SendStream.prototype.sendIndex = function sendIndex(path24) {
24615
+ SendStream.prototype.sendIndex = function sendIndex(path25) {
24616
24616
  var i = -1;
24617
24617
  var self2 = this;
24618
24618
  function next(err) {
@@ -24620,9 +24620,9 @@ var require_send = __commonJS({
24620
24620
  if (err) return self2.onStatError(err);
24621
24621
  return self2.error(404);
24622
24622
  }
24623
- var p = join18(path24, self2._index[i]);
24623
+ var p = join18(path25, self2._index[i]);
24624
24624
  debug('stat "%s"', p);
24625
- fs22.stat(p, function(err2, stat) {
24625
+ fs23.stat(p, function(err2, stat) {
24626
24626
  if (err2) return next(err2);
24627
24627
  if (stat.isDirectory()) return next();
24628
24628
  self2.emit("file", p, stat);
@@ -24631,10 +24631,10 @@ var require_send = __commonJS({
24631
24631
  }
24632
24632
  next();
24633
24633
  };
24634
- SendStream.prototype.stream = function stream(path24, options) {
24634
+ SendStream.prototype.stream = function stream(path25, options) {
24635
24635
  var self2 = this;
24636
24636
  var res = this.res;
24637
- var stream2 = fs22.createReadStream(path24, options);
24637
+ var stream2 = fs23.createReadStream(path25, options);
24638
24638
  this.emit("stream", stream2);
24639
24639
  stream2.pipe(res);
24640
24640
  function cleanup() {
@@ -24649,10 +24649,10 @@ var require_send = __commonJS({
24649
24649
  self2.emit("end");
24650
24650
  });
24651
24651
  };
24652
- SendStream.prototype.type = function type(path24) {
24652
+ SendStream.prototype.type = function type(path25) {
24653
24653
  var res = this.res;
24654
24654
  if (res.getHeader("Content-Type")) return;
24655
- var type2 = mime.lookup(path24);
24655
+ var type2 = mime.lookup(path25);
24656
24656
  if (!type2) {
24657
24657
  debug("no content-type");
24658
24658
  return;
@@ -24661,9 +24661,9 @@ var require_send = __commonJS({
24661
24661
  debug("content-type %s", type2);
24662
24662
  res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
24663
24663
  };
24664
- SendStream.prototype.setHeader = function setHeader(path24, stat) {
24664
+ SendStream.prototype.setHeader = function setHeader(path25, stat) {
24665
24665
  var res = this.res;
24666
- this.emit("headers", res, path24, stat);
24666
+ this.emit("headers", res, path25, stat);
24667
24667
  if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
24668
24668
  debug("accept ranges");
24669
24669
  res.setHeader("Accept-Ranges", "bytes");
@@ -24722,9 +24722,9 @@ var require_send = __commonJS({
24722
24722
  }
24723
24723
  return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
24724
24724
  }
24725
- function decode(path24) {
24725
+ function decode(path25) {
24726
24726
  try {
24727
- return decodeURIComponent(path24);
24727
+ return decodeURIComponent(path25);
24728
24728
  } catch (err) {
24729
24729
  return -1;
24730
24730
  }
@@ -25634,10 +25634,10 @@ var require_utils2 = __commonJS({
25634
25634
  var querystring = require("querystring");
25635
25635
  exports2.etag = createETagGenerator({ weak: false });
25636
25636
  exports2.wetag = createETagGenerator({ weak: true });
25637
- exports2.isAbsolute = function(path23) {
25638
- if ("/" === path23[0]) return true;
25639
- if (":" === path23[1] && ("\\" === path23[2] || "/" === path23[2])) return true;
25640
- if ("\\\\" === path23.substring(0, 2)) return true;
25637
+ exports2.isAbsolute = function(path24) {
25638
+ if ("/" === path24[0]) return true;
25639
+ if (":" === path24[1] && ("\\" === path24[2] || "/" === path24[2])) return true;
25640
+ if ("\\\\" === path24.substring(0, 2)) return true;
25641
25641
  };
25642
25642
  exports2.flatten = deprecate.function(
25643
25643
  flatten,
@@ -25773,7 +25773,7 @@ var require_application = __commonJS({
25773
25773
  var deprecate = require_depd()("express");
25774
25774
  var flatten = require_array_flatten();
25775
25775
  var merge = require_utils_merge();
25776
- var resolve14 = require("path").resolve;
25776
+ var resolve15 = require("path").resolve;
25777
25777
  var setPrototypeOf = require_setprototypeof();
25778
25778
  var hasOwnProperty = Object.prototype.hasOwnProperty;
25779
25779
  var slice = Array.prototype.slice;
@@ -25812,7 +25812,7 @@ var require_application = __commonJS({
25812
25812
  this.mountpath = "/";
25813
25813
  this.locals.settings = this.settings;
25814
25814
  this.set("view", View);
25815
- this.set("views", resolve14("views"));
25815
+ this.set("views", resolve15("views"));
25816
25816
  this.set("jsonp callback name", "callback");
25817
25817
  if (env === "production") {
25818
25818
  this.enable("view cache");
@@ -25848,7 +25848,7 @@ var require_application = __commonJS({
25848
25848
  };
25849
25849
  app.use = function use(fn) {
25850
25850
  var offset = 0;
25851
- var path23 = "/";
25851
+ var path24 = "/";
25852
25852
  if (typeof fn !== "function") {
25853
25853
  var arg = fn;
25854
25854
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -25856,7 +25856,7 @@ var require_application = __commonJS({
25856
25856
  }
25857
25857
  if (typeof arg !== "function") {
25858
25858
  offset = 1;
25859
- path23 = fn;
25859
+ path24 = fn;
25860
25860
  }
25861
25861
  }
25862
25862
  var fns = flatten(slice.call(arguments, offset));
@@ -25867,12 +25867,12 @@ var require_application = __commonJS({
25867
25867
  var router = this._router;
25868
25868
  fns.forEach(function(fn2) {
25869
25869
  if (!fn2 || !fn2.handle || !fn2.set) {
25870
- return router.use(path23, fn2);
25870
+ return router.use(path24, fn2);
25871
25871
  }
25872
- debug(".use app under %s", path23);
25873
- fn2.mountpath = path23;
25872
+ debug(".use app under %s", path24);
25873
+ fn2.mountpath = path24;
25874
25874
  fn2.parent = this;
25875
- router.use(path23, function mounted_app(req, res, next) {
25875
+ router.use(path24, function mounted_app(req, res, next) {
25876
25876
  var orig = req.app;
25877
25877
  fn2.handle(req, res, function(err) {
25878
25878
  setPrototypeOf(req, orig.request);
@@ -25884,9 +25884,9 @@ var require_application = __commonJS({
25884
25884
  }, this);
25885
25885
  return this;
25886
25886
  };
25887
- app.route = function route(path23) {
25887
+ app.route = function route(path24) {
25888
25888
  this.lazyrouter();
25889
- return this._router.route(path23);
25889
+ return this._router.route(path24);
25890
25890
  };
25891
25891
  app.engine = function engine(ext, fn) {
25892
25892
  if (typeof fn !== "function") {
@@ -25937,7 +25937,7 @@ var require_application = __commonJS({
25937
25937
  }
25938
25938
  return this;
25939
25939
  };
25940
- app.path = function path23() {
25940
+ app.path = function path24() {
25941
25941
  return this.parent ? this.parent.path() + this.mountpath : "";
25942
25942
  };
25943
25943
  app.enabled = function enabled2(setting) {
@@ -25953,19 +25953,19 @@ var require_application = __commonJS({
25953
25953
  return this.set(setting, false);
25954
25954
  };
25955
25955
  methods.forEach(function(method) {
25956
- app[method] = function(path23) {
25956
+ app[method] = function(path24) {
25957
25957
  if (method === "get" && arguments.length === 1) {
25958
- return this.set(path23);
25958
+ return this.set(path24);
25959
25959
  }
25960
25960
  this.lazyrouter();
25961
- var route = this._router.route(path23);
25961
+ var route = this._router.route(path24);
25962
25962
  route[method].apply(route, slice.call(arguments, 1));
25963
25963
  return this;
25964
25964
  };
25965
25965
  });
25966
- app.all = function all(path23) {
25966
+ app.all = function all(path24) {
25967
25967
  this.lazyrouter();
25968
- var route = this._router.route(path23);
25968
+ var route = this._router.route(path24);
25969
25969
  var args = slice.call(arguments, 1);
25970
25970
  for (var i = 0; i < methods.length; i++) {
25971
25971
  route[methods[i]].apply(route, args);
@@ -26724,7 +26724,7 @@ var require_request = __commonJS({
26724
26724
  var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
26725
26725
  return subdomains2.slice(offset);
26726
26726
  });
26727
- defineGetter(req, "path", function path23() {
26727
+ defineGetter(req, "path", function path24() {
26728
26728
  return parse(this).pathname;
26729
26729
  });
26730
26730
  defineGetter(req, "hostname", function hostname3() {
@@ -27045,9 +27045,9 @@ var require_response = __commonJS({
27045
27045
  var encodeUrl = require_encodeurl();
27046
27046
  var escapeHtml2 = require_escape_html();
27047
27047
  var http3 = require("http");
27048
- var isAbsolute4 = require_utils2().isAbsolute;
27048
+ var isAbsolute5 = require_utils2().isAbsolute;
27049
27049
  var onFinished = require_on_finished();
27050
- var path23 = require("path");
27050
+ var path24 = require("path");
27051
27051
  var statuses = require_statuses();
27052
27052
  var merge = require_utils_merge();
27053
27053
  var sign = require_cookie_signature().sign;
@@ -27056,9 +27056,9 @@ var require_response = __commonJS({
27056
27056
  var setCharset = require_utils2().setCharset;
27057
27057
  var cookie = require_cookie();
27058
27058
  var send = require_send();
27059
- var extname3 = path23.extname;
27059
+ var extname3 = path24.extname;
27060
27060
  var mime = send.mime;
27061
- var resolve14 = path23.resolve;
27061
+ var resolve15 = path24.resolve;
27062
27062
  var vary = require_vary();
27063
27063
  var res = Object.create(http3.ServerResponse.prototype);
27064
27064
  module2.exports = res;
@@ -27235,26 +27235,26 @@ var require_response = __commonJS({
27235
27235
  this.type("txt");
27236
27236
  return this.send(body);
27237
27237
  };
27238
- res.sendFile = function sendFile(path24, options, callback) {
27238
+ res.sendFile = function sendFile(path25, options, callback) {
27239
27239
  var done = callback;
27240
27240
  var req = this.req;
27241
27241
  var res2 = this;
27242
27242
  var next = req.next;
27243
27243
  var opts = options || {};
27244
- if (!path24) {
27244
+ if (!path25) {
27245
27245
  throw new TypeError("path argument is required to res.sendFile");
27246
27246
  }
27247
- if (typeof path24 !== "string") {
27247
+ if (typeof path25 !== "string") {
27248
27248
  throw new TypeError("path must be a string to res.sendFile");
27249
27249
  }
27250
27250
  if (typeof options === "function") {
27251
27251
  done = options;
27252
27252
  opts = {};
27253
27253
  }
27254
- if (!opts.root && !isAbsolute4(path24)) {
27254
+ if (!opts.root && !isAbsolute5(path25)) {
27255
27255
  throw new TypeError("path must be absolute or specify root to res.sendFile");
27256
27256
  }
27257
- var pathname = encodeURI(path24);
27257
+ var pathname = encodeURI(path25);
27258
27258
  var file = send(req, pathname, opts);
27259
27259
  sendfile(res2, file, opts, function(err) {
27260
27260
  if (done) return done(err);
@@ -27264,7 +27264,7 @@ var require_response = __commonJS({
27264
27264
  }
27265
27265
  });
27266
27266
  };
27267
- res.sendfile = function(path24, options, callback) {
27267
+ res.sendfile = function(path25, options, callback) {
27268
27268
  var done = callback;
27269
27269
  var req = this.req;
27270
27270
  var res2 = this;
@@ -27274,7 +27274,7 @@ var require_response = __commonJS({
27274
27274
  done = options;
27275
27275
  opts = {};
27276
27276
  }
27277
- var file = send(req, path24, opts);
27277
+ var file = send(req, path25, opts);
27278
27278
  sendfile(res2, file, opts, function(err) {
27279
27279
  if (done) return done(err);
27280
27280
  if (err && err.code === "EISDIR") return next();
@@ -27287,7 +27287,7 @@ var require_response = __commonJS({
27287
27287
  res.sendfile,
27288
27288
  "res.sendfile: Use res.sendFile instead"
27289
27289
  );
27290
- res.download = function download(path24, filename, options, callback) {
27290
+ res.download = function download(path25, filename, options, callback) {
27291
27291
  var done = callback;
27292
27292
  var name2 = filename;
27293
27293
  var opts = options || null;
@@ -27304,7 +27304,7 @@ var require_response = __commonJS({
27304
27304
  opts = filename;
27305
27305
  }
27306
27306
  var headers = {
27307
- "Content-Disposition": contentDisposition(name2 || path24)
27307
+ "Content-Disposition": contentDisposition(name2 || path25)
27308
27308
  };
27309
27309
  if (opts && opts.headers) {
27310
27310
  var keys = Object.keys(opts.headers);
@@ -27317,7 +27317,7 @@ var require_response = __commonJS({
27317
27317
  }
27318
27318
  opts = Object.create(opts);
27319
27319
  opts.headers = headers;
27320
- var fullPath = !opts.root ? resolve14(path24) : path24;
27320
+ var fullPath = !opts.root ? resolve15(path25) : path25;
27321
27321
  return this.sendFile(fullPath, opts, done);
27322
27322
  };
27323
27323
  res.contentType = res.type = function contentType(type) {
@@ -27583,7 +27583,7 @@ var require_serve_static = __commonJS({
27583
27583
  var encodeUrl = require_encodeurl();
27584
27584
  var escapeHtml2 = require_escape_html();
27585
27585
  var parseUrl = require_parseurl();
27586
- var resolve14 = require("path").resolve;
27586
+ var resolve15 = require("path").resolve;
27587
27587
  var send = require_send();
27588
27588
  var url = require("url");
27589
27589
  module2.exports = serveStatic;
@@ -27603,7 +27603,7 @@ var require_serve_static = __commonJS({
27603
27603
  throw new TypeError("option setHeaders must be function");
27604
27604
  }
27605
27605
  opts.maxage = opts.maxage || opts.maxAge || 0;
27606
- opts.root = resolve14(root);
27606
+ opts.root = resolve15(root);
27607
27607
  var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
27608
27608
  return function serveStatic2(req, res, next) {
27609
27609
  if (req.method !== "GET" && req.method !== "HEAD") {
@@ -27618,11 +27618,11 @@ var require_serve_static = __commonJS({
27618
27618
  }
27619
27619
  var forwardError = !fallthrough;
27620
27620
  var originalUrl = parseUrl.original(req);
27621
- var path23 = parseUrl(req).pathname;
27622
- if (path23 === "/" && originalUrl.pathname.substr(-1) !== "/") {
27623
- path23 = "";
27621
+ var path24 = parseUrl(req).pathname;
27622
+ if (path24 === "/" && originalUrl.pathname.substr(-1) !== "/") {
27623
+ path24 = "";
27624
27624
  }
27625
- var stream = send(req, path23, opts);
27625
+ var stream = send(req, path24, opts);
27626
27626
  stream.on("directory", onDirectory);
27627
27627
  if (setHeaders) {
27628
27628
  stream.on("headers", setHeaders);
@@ -30059,7 +30059,7 @@ function wasClockTurnedBack(cachedAt) {
30059
30059
  return cachedAtSec > nowSeconds();
30060
30060
  }
30061
30061
  function delay(t, value) {
30062
- return new Promise((resolve14) => setTimeout(() => resolve14(value), t));
30062
+ return new Promise((resolve15) => setTimeout(() => resolve15(value), t));
30063
30063
  }
30064
30064
 
30065
30065
  // ../../node_modules/.pnpm/@azure+msal-common@16.5.0/node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.mjs
@@ -31553,7 +31553,7 @@ var developerCliCredentialInternals = {
31553
31553
  const encodedClaims = btoa(claims);
31554
31554
  claimsSections = ["--claims", encodedClaims];
31555
31555
  }
31556
- return new Promise((resolve14, reject) => {
31556
+ return new Promise((resolve15, reject) => {
31557
31557
  try {
31558
31558
  const args = [
31559
31559
  "auth",
@@ -31570,7 +31570,7 @@ var developerCliCredentialInternals = {
31570
31570
  cwd: developerCliCredentialInternals.getSafeWorkingDir(),
31571
31571
  timeout
31572
31572
  }, (error, stdout, stderr) => {
31573
- resolve14({ stdout, stderr, error });
31573
+ resolve15({ stdout, stderr, error });
31574
31574
  });
31575
31575
  } catch (err) {
31576
31576
  reject(err);
@@ -31718,7 +31718,7 @@ var cliCredentialInternals = {
31718
31718
  if (subscription) {
31719
31719
  subscriptionSection = ["--subscription", `"${subscription}"`];
31720
31720
  }
31721
- return new Promise((resolve14, reject) => {
31721
+ return new Promise((resolve15, reject) => {
31722
31722
  try {
31723
31723
  const args = [
31724
31724
  "account",
@@ -31732,7 +31732,7 @@ var cliCredentialInternals = {
31732
31732
  ];
31733
31733
  const command = ["az", ...args].join(" ");
31734
31734
  import_child_process2.default.exec(command, { cwd: cliCredentialInternals.getSafeWorkingDir(), timeout }, (error, stdout, stderr) => {
31735
- resolve14({ stdout, stderr, error });
31735
+ resolve15({ stdout, stderr, error });
31736
31736
  });
31737
31737
  } catch (err) {
31738
31738
  reject(err);
@@ -31873,7 +31873,7 @@ var processUtils = {
31873
31873
  * @internal
31874
31874
  */
31875
31875
  execFile(file, params, options) {
31876
- return new Promise((resolve14, reject) => {
31876
+ return new Promise((resolve15, reject) => {
31877
31877
  import_node_child_process.default.execFile(file, params, options, (error, stdout, stderr) => {
31878
31878
  if (Buffer.isBuffer(stdout)) {
31879
31879
  stdout = stdout.toString("utf8");
@@ -31884,7 +31884,7 @@ var processUtils = {
31884
31884
  if (stderr || error) {
31885
31885
  reject(stderr ? new Error(stderr) : error);
31886
31886
  } else {
31887
- resolve14(stdout);
31887
+ resolve15(stdout);
31888
31888
  }
31889
31889
  });
31890
31890
  });
@@ -33266,19 +33266,19 @@ async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_NODE_REQUEST_TIME
33266
33266
  cleanup();
33267
33267
  }
33268
33268
  }
33269
- async function fetchNodeWithFallback(node, path23, init, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS, trace, options) {
33269
+ async function fetchNodeWithFallback(node, path24, init, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS, trace, options) {
33270
33270
  let lastError;
33271
33271
  const endpoints = getNodeRequestEndpoints(node, options);
33272
33272
  for (const [index, endpoint] of endpoints.entries()) {
33273
33273
  const attempt = index + 1;
33274
- trace?.onAttempt?.({ attempt, endpoint, path: path23, timeoutMs, totalEndpoints: endpoints.length });
33274
+ trace?.onAttempt?.({ attempt, endpoint, path: path24, timeoutMs, totalEndpoints: endpoints.length });
33275
33275
  try {
33276
- const response = await fetchWithTimeout(`${endpoint}${path23}`, init, timeoutMs);
33277
- trace?.onResponse?.({ attempt, endpoint, path: path23, response, timeoutMs, totalEndpoints: endpoints.length });
33276
+ const response = await fetchWithTimeout(`${endpoint}${path24}`, init, timeoutMs);
33277
+ trace?.onResponse?.({ attempt, endpoint, path: path24, response, timeoutMs, totalEndpoints: endpoints.length });
33278
33278
  return { endpoint, response };
33279
33279
  } catch (error) {
33280
33280
  lastError = error;
33281
- trace?.onError?.({ attempt, endpoint, error, path: path23, timeoutMs, totalEndpoints: endpoints.length });
33281
+ trace?.onError?.({ attempt, endpoint, error, path: path24, timeoutMs, totalEndpoints: endpoints.length });
33282
33282
  }
33283
33283
  }
33284
33284
  throw lastError instanceof Error ? lastError : new Error("No reachable node endpoint");
@@ -34431,7 +34431,7 @@ var KeepaliveNodeMessageQueue = class {
34431
34431
  queued.push(requestMessage);
34432
34432
  this.queuedMessages.set(nodeId, queued);
34433
34433
  this.log.info("queued keepalive node message request", { nodeId, ...describeNodeMessage(requestMessage) });
34434
- return new Promise((resolve14, reject) => {
34434
+ return new Promise((resolve15, reject) => {
34435
34435
  const timeoutId = setTimeout(() => {
34436
34436
  this.pendingResponses.delete(requestMessage.id);
34437
34437
  reject(new Error(`Timed out waiting for ${requestMessage.kind} response from ${nodeId}`));
@@ -34439,7 +34439,7 @@ var KeepaliveNodeMessageQueue = class {
34439
34439
  this.pendingResponses.set(requestMessage.id, {
34440
34440
  nodeId,
34441
34441
  kind: requestMessage.kind,
34442
- resolve: resolve14,
34442
+ resolve: resolve15,
34443
34443
  reject,
34444
34444
  timeoutId
34445
34445
  });
@@ -35326,9 +35326,9 @@ var DataRouter = class {
35326
35326
  /**
35327
35327
  * Returns true if the request should be proxied to the leader.
35328
35328
  */
35329
- shouldProxy(method, path23) {
35329
+ shouldProxy(method, path24) {
35330
35330
  if (this.election.isLeader()) return false;
35331
- if (this.isExcludedPath(path23)) return false;
35331
+ if (this.isExcludedPath(path24)) return false;
35332
35332
  if (method.toUpperCase() === "GET") return false;
35333
35333
  return WRITE_METHODS.has(method.toUpperCase());
35334
35334
  }
@@ -35432,8 +35432,8 @@ var DataRouter = class {
35432
35432
  };
35433
35433
  }
35434
35434
  // ── Helpers ───────────────────────────────────────────────────────────
35435
- isExcludedPath(path23) {
35436
- return EXCLUDED_PATH_PREFIXES.some((prefix) => path23.startsWith(prefix)) || EXCLUDED_PATH_SUFFIXES.some((suffix) => path23.endsWith(suffix));
35435
+ isExcludedPath(path24) {
35436
+ return EXCLUDED_PATH_PREFIXES.some((prefix) => path24.startsWith(prefix)) || EXCLUDED_PATH_SUFFIXES.some((suffix) => path24.endsWith(suffix));
35437
35437
  }
35438
35438
  };
35439
35439
 
@@ -36341,7 +36341,7 @@ var LiteAgentRunner = class {
36341
36341
  }
36342
36342
  };
36343
36343
  function runProcessForOutput(command, args, prompt, cwd, extractOutput) {
36344
- return new Promise((resolve14, reject) => {
36344
+ return new Promise((resolve15, reject) => {
36345
36345
  const proc = (0, import_node_child_process3.spawn)(command, args, {
36346
36346
  cwd: cwd ?? process.cwd(),
36347
36347
  stdio: ["pipe", "pipe", "pipe"]
@@ -36361,7 +36361,7 @@ function runProcessForOutput(command, args, prompt, cwd, extractOutput) {
36361
36361
  return;
36362
36362
  }
36363
36363
  try {
36364
- resolve14(extractOutput ? extractOutput(stdout) : stdout.trim());
36364
+ resolve15(extractOutput ? extractOutput(stdout) : stdout.trim());
36365
36365
  } catch (error) {
36366
36366
  reject(error);
36367
36367
  }
@@ -38752,7 +38752,7 @@ async function closeHttpServer(server, options = {}) {
38752
38752
  return;
38753
38753
  }
38754
38754
  const forceAfterMs = options.forceAfterMs ?? 1e3;
38755
- await new Promise((resolve14, reject) => {
38755
+ await new Promise((resolve15, reject) => {
38756
38756
  const forceTimer = setTimeout(() => {
38757
38757
  server.closeAllConnections?.();
38758
38758
  server.closeIdleConnections?.();
@@ -38764,7 +38764,7 @@ async function closeHttpServer(server, options = {}) {
38764
38764
  reject(err);
38765
38765
  return;
38766
38766
  }
38767
- resolve14();
38767
+ resolve15();
38768
38768
  });
38769
38769
  server.closeIdleConnections?.();
38770
38770
  });
@@ -39261,8 +39261,8 @@ function getErrorMap() {
39261
39261
 
39262
39262
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
39263
39263
  var makeIssue = (params) => {
39264
- const { data, path: path23, errorMaps, issueData } = params;
39265
- const fullPath = [...path23, ...issueData.path || []];
39264
+ const { data, path: path24, errorMaps, issueData } = params;
39265
+ const fullPath = [...path24, ...issueData.path || []];
39266
39266
  const fullIssue = {
39267
39267
  ...issueData,
39268
39268
  path: fullPath
@@ -39378,11 +39378,11 @@ var errorUtil;
39378
39378
 
39379
39379
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
39380
39380
  var ParseInputLazyPath = class {
39381
- constructor(parent, value, path23, key) {
39381
+ constructor(parent, value, path24, key) {
39382
39382
  this._cachedPath = [];
39383
39383
  this.parent = parent;
39384
39384
  this.data = value;
39385
- this._path = path23;
39385
+ this._path = path24;
39386
39386
  this._key = key;
39387
39387
  }
39388
39388
  get path() {
@@ -43096,6 +43096,10 @@ var NodeNativeSessionsQuery = external_exports.object({
43096
43096
  agent: external_exports.enum(["codex", "claudecode"]),
43097
43097
  limit: external_exports.coerce.number().int().min(1).max(100).default(50)
43098
43098
  });
43099
+ var NodeTerminalExecuteBody = external_exports.object({
43100
+ command: external_exports.string().trim().min(1),
43101
+ cwd: external_exports.string().trim().min(1).optional()
43102
+ });
43099
43103
  var NodeWorkDirTreeResponse = external_exports.object({
43100
43104
  nodeId: external_exports.string(),
43101
43105
  rootPath: external_exports.string(),
@@ -43137,6 +43141,18 @@ var NodeNativeSessionsResponse = external_exports.object({
43137
43141
  agent: external_exports.enum(["codex", "claudecode"]),
43138
43142
  sessions: external_exports.array(NativeSessionSummarySchema)
43139
43143
  });
43144
+ var NodeTerminalExecuteResponse = external_exports.object({
43145
+ nodeId: external_exports.string(),
43146
+ cwd: external_exports.string(),
43147
+ command: external_exports.string(),
43148
+ exitCode: external_exports.number().int().nullable(),
43149
+ stdout: external_exports.string(),
43150
+ stderr: external_exports.string(),
43151
+ durationMs: external_exports.number().int().min(0),
43152
+ timedOut: external_exports.boolean(),
43153
+ stdoutTruncated: external_exports.boolean(),
43154
+ stderrTruncated: external_exports.boolean()
43155
+ });
43140
43156
  var UpdateNodeBody = external_exports.object({
43141
43157
  name: external_exports.string().min(1).optional(),
43142
43158
  capabilities: external_exports.array(external_exports.string()).optional()
@@ -43283,8 +43299,8 @@ var BatchTaskIdsBody = external_exports.object({
43283
43299
  });
43284
43300
 
43285
43301
  // ../../packages/api/src/app/server.ts
43286
- var path20 = __toESM(require("path"), 1);
43287
- var fs19 = __toESM(require("fs"), 1);
43302
+ var path21 = __toESM(require("path"), 1);
43303
+ var fs20 = __toESM(require("fs"), 1);
43288
43304
  var import_express14 = __toESM(require_express2(), 1);
43289
43305
 
43290
43306
  // ../../packages/api/src/middleware/auth.ts
@@ -43421,8 +43437,8 @@ function decodePathSegment(value) {
43421
43437
  return value;
43422
43438
  }
43423
43439
  }
43424
- function getSingleTaskDeleteId(path23) {
43425
- const match = /^\/api\/tasks\/([^/]+)$/.exec(path23);
43440
+ function getSingleTaskDeleteId(path24) {
43441
+ const match = /^\/api\/tasks\/([^/]+)$/.exec(path24);
43426
43442
  return match ? decodePathSegment(match[1]) : null;
43427
43443
  }
43428
43444
  function getSuccessfulBatchDeleteIds(body) {
@@ -45147,6 +45163,7 @@ var LEGACY_KIND_BY_NODE_MESSAGE = {
45147
45163
  "node.workdir.tree": "node-workdir-tree",
45148
45164
  "node.workdir.branch-info": "node-workdir-branch-info",
45149
45165
  "node.workdir.branch-create": "node-workdir-branch-create",
45166
+ "node.terminal.execute": "node-terminal-execute",
45150
45167
  "node.sessions.list": "node-sessions-list",
45151
45168
  "node.transport.set": "devtunnel",
45152
45169
  "node.agent.upgrade": "node-agent-upgrade",
@@ -45425,6 +45442,95 @@ async function maybeProxyReadToLeader(req, res, options = {}) {
45425
45442
  }
45426
45443
  }
45427
45444
 
45445
+ // ../../packages/api/src/node/node-terminal-service.ts
45446
+ var import_node_child_process10 = require("child_process");
45447
+ var fs17 = __toESM(require("fs"), 1);
45448
+ var path18 = __toESM(require("path"), 1);
45449
+ var DEFAULT_TIMEOUT_MS = 3e4;
45450
+ var DEFAULT_OUTPUT_LIMIT_BYTES = 64 * 1024;
45451
+ function isAbsolutePath2(value) {
45452
+ return path18.isAbsolute(value) || /^[A-Za-z]:[\/]/.test(value);
45453
+ }
45454
+ function resolveCommandCwd(nodeId, rootPath, cwd) {
45455
+ if (!rootPath) {
45456
+ throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
45457
+ }
45458
+ const requestedCwd = cwd?.trim() || ".";
45459
+ const resolved = isAbsolutePath2(requestedCwd) ? path18.resolve(requestedCwd) : path18.resolve(rootPath, requestedCwd);
45460
+ if (!fs17.existsSync(resolved) || !fs17.statSync(resolved).isDirectory()) {
45461
+ throw new MeshyError("VALIDATION_ERROR", `Working directory does not exist: ${resolved}`, 400);
45462
+ }
45463
+ return resolved;
45464
+ }
45465
+ function captureLimited(chunks, chunk, currentBytes, limitBytes) {
45466
+ if (currentBytes >= limitBytes) {
45467
+ return currentBytes + chunk.length;
45468
+ }
45469
+ const remaining = limitBytes - currentBytes;
45470
+ chunks.push(chunk.length <= remaining ? chunk : chunk.subarray(0, remaining));
45471
+ return currentBytes + chunk.length;
45472
+ }
45473
+ function toCapturedOutput(chunks, observedBytes, limitBytes) {
45474
+ return {
45475
+ text: Buffer.concat(chunks).toString("utf8"),
45476
+ truncated: observedBytes > limitBytes
45477
+ };
45478
+ }
45479
+ function executeLocalNodeTerminalCommand(nodeId, rootPath, command, options = {}) {
45480
+ const normalizedCommand = command.trim();
45481
+ if (!normalizedCommand) {
45482
+ throw new MeshyError("VALIDATION_ERROR", "Command must not be empty", 400);
45483
+ }
45484
+ const cwd = resolveCommandCwd(nodeId, rootPath, options.cwd);
45485
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
45486
+ const outputLimitBytes = options.outputLimitBytes ?? DEFAULT_OUTPUT_LIMIT_BYTES;
45487
+ const startedAt = Date.now();
45488
+ const stdoutChunks = [];
45489
+ const stderrChunks = [];
45490
+ let stdoutBytes = 0;
45491
+ let stderrBytes = 0;
45492
+ let timedOut = false;
45493
+ return new Promise((resolve15, reject) => {
45494
+ const child = (0, import_node_child_process10.spawn)(normalizedCommand, {
45495
+ cwd,
45496
+ shell: true,
45497
+ windowsHide: true,
45498
+ stdio: ["ignore", "pipe", "pipe"]
45499
+ });
45500
+ const timeout = setTimeout(() => {
45501
+ timedOut = true;
45502
+ child.kill("SIGTERM");
45503
+ }, timeoutMs);
45504
+ child.stdout?.on("data", (chunk) => {
45505
+ stdoutBytes = captureLimited(stdoutChunks, chunk, stdoutBytes, outputLimitBytes);
45506
+ });
45507
+ child.stderr?.on("data", (chunk) => {
45508
+ stderrBytes = captureLimited(stderrChunks, chunk, stderrBytes, outputLimitBytes);
45509
+ });
45510
+ child.on("error", (err) => {
45511
+ clearTimeout(timeout);
45512
+ reject(new MeshyError("VALIDATION_ERROR", err.message, 400));
45513
+ });
45514
+ child.on("close", (code) => {
45515
+ clearTimeout(timeout);
45516
+ const stdout = toCapturedOutput(stdoutChunks, stdoutBytes, outputLimitBytes);
45517
+ const stderr = toCapturedOutput(stderrChunks, stderrBytes, outputLimitBytes);
45518
+ resolve15({
45519
+ nodeId,
45520
+ cwd,
45521
+ command: normalizedCommand,
45522
+ exitCode: code,
45523
+ stdout: stdout.text,
45524
+ stderr: stderr.text,
45525
+ durationMs: Date.now() - startedAt,
45526
+ timedOut,
45527
+ stdoutTruncated: stdout.truncated,
45528
+ stderrTruncated: stderr.truncated
45529
+ });
45530
+ });
45531
+ });
45532
+ }
45533
+
45428
45534
  // ../../packages/api/src/node/node-native-session-service.ts
45429
45535
  function getLocalNodeNativeSessions(nodeId, agent, limit) {
45430
45536
  return {
@@ -45494,13 +45600,13 @@ function cancelTaskOnCurrentNode(deps, taskId, options = {}) {
45494
45600
  }
45495
45601
 
45496
45602
  // ../../packages/api/src/tasks/task-output-service.ts
45497
- var fs18 = __toESM(require("fs"), 1);
45498
- var path19 = __toESM(require("path"), 1);
45603
+ var fs19 = __toESM(require("fs"), 1);
45604
+ var path20 = __toESM(require("path"), 1);
45499
45605
 
45500
45606
  // ../../packages/api/src/preview/preview-server.ts
45501
45607
  var crypto3 = __toESM(require("crypto"), 1);
45502
- var fs17 = __toESM(require("fs"), 1);
45503
- var path18 = __toESM(require("path"), 1);
45608
+ var fs18 = __toESM(require("fs"), 1);
45609
+ var path19 = __toESM(require("path"), 1);
45504
45610
  var http2 = __toESM(require("http"), 1);
45505
45611
  var import_node_stream3 = require("stream");
45506
45612
  var import_promises6 = require("stream/promises");
@@ -45612,19 +45718,19 @@ function buildPreviewWorkerProxyHeaders(req) {
45612
45718
  // ../../packages/api/src/preview/preview-server.ts
45613
45719
  function resolvePreviewPath(rootPath, relativePath) {
45614
45720
  const sanitizedPath = relativePath.replace(/\\/g, "/");
45615
- const resolvedPath = path18.resolve(rootPath, sanitizedPath);
45616
- const normalizedRoot = path18.resolve(rootPath);
45617
- if (!resolvedPath.startsWith(normalizedRoot + path18.sep) && resolvedPath !== normalizedRoot) {
45721
+ const resolvedPath = path19.resolve(rootPath, sanitizedPath);
45722
+ const normalizedRoot = path19.resolve(rootPath);
45723
+ if (!resolvedPath.startsWith(normalizedRoot + path19.sep) && resolvedPath !== normalizedRoot) {
45618
45724
  throw new Error("Invalid preview path");
45619
45725
  }
45620
45726
  return {
45621
45727
  absolutePath: resolvedPath,
45622
- normalizedPath: path18.relative(normalizedRoot, resolvedPath).split(path18.sep).join("/")
45728
+ normalizedPath: path19.relative(normalizedRoot, resolvedPath).split(path19.sep).join("/")
45623
45729
  };
45624
45730
  }
45625
45731
  function resolvePreviewEntryPath(rootPath, entryPath) {
45626
45732
  const { absolutePath, normalizedPath } = resolvePreviewPath(rootPath, entryPath ?? "index.html");
45627
- if (!fs17.existsSync(absolutePath) || !fs17.statSync(absolutePath).isFile()) {
45733
+ if (!fs18.existsSync(absolutePath) || !fs18.statSync(absolutePath).isFile()) {
45628
45734
  throw new Error("Preview entry not found");
45629
45735
  }
45630
45736
  return normalizedPath;
@@ -45726,7 +45832,7 @@ var MIME_MAP2 = {
45726
45832
  ".mdx": "text/markdown"
45727
45833
  };
45728
45834
  function getMime(filePath) {
45729
- return MIME_MAP2[path18.extname(filePath).toLowerCase()] ?? "application/octet-stream";
45835
+ return MIME_MAP2[path19.extname(filePath).toLowerCase()] ?? "application/octet-stream";
45730
45836
  }
45731
45837
  function escapeHtml(value) {
45732
45838
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
@@ -46080,14 +46186,14 @@ async function sendPreviewAssetResponse(sessionManager, token, requestedPath, re
46080
46186
  res.end("Invalid path");
46081
46187
  return;
46082
46188
  }
46083
- if (!fs17.existsSync(resolved) || !fs17.statSync(resolved).isFile()) {
46189
+ if (!fs18.existsSync(resolved) || !fs18.statSync(resolved).isFile()) {
46084
46190
  res.writeHead(404, { "Content-Type": "text/plain" });
46085
46191
  res.end("File not found");
46086
46192
  return;
46087
46193
  }
46088
- const ext = path18.extname(resolved).toLowerCase();
46194
+ const ext = path19.extname(resolved).toLowerCase();
46089
46195
  const mime = ext === ".md" || ext === ".mdx" ? "text/html" : getMime(resolved);
46090
- const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(fs17.readFileSync(resolved, "utf8"), path18.basename(resolved)) : fs17.readFileSync(resolved);
46196
+ const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(fs18.readFileSync(resolved, "utf8"), path19.basename(resolved)) : fs18.readFileSync(resolved);
46091
46197
  res.writeHead(200, {
46092
46198
  "Content-Type": mime,
46093
46199
  "Content-Length": content.length,
@@ -46409,13 +46515,13 @@ function getLocalTaskOutputDownload(taskEngine, taskId, filePath) {
46409
46515
  const rootPath = getTaskOutputRoot(taskEngine, taskId);
46410
46516
  try {
46411
46517
  const absolutePath = resolveOutputPath(rootPath, filePath);
46412
- if (!fs18.existsSync(absolutePath) || !fs18.statSync(absolutePath).isFile()) {
46518
+ if (!fs19.existsSync(absolutePath) || !fs19.statSync(absolutePath).isFile()) {
46413
46519
  throw new MeshyError("TASK_NOT_FOUND", `File not found: ${filePath}`, 404);
46414
46520
  }
46415
46521
  const { mimeType } = classifyFile(absolutePath);
46416
- const fileName = path19.basename(absolutePath).replace(/"/g, "");
46522
+ const fileName = path20.basename(absolutePath).replace(/"/g, "");
46417
46523
  return {
46418
- content: fs18.readFileSync(absolutePath),
46524
+ content: fs19.readFileSync(absolutePath),
46419
46525
  headers: {
46420
46526
  "Content-Type": mimeType,
46421
46527
  "Content-Disposition": `inline; filename="${fileName}"`,
@@ -46586,6 +46692,20 @@ async function executeWorkerControlRequest(deps, request) {
46586
46692
  );
46587
46693
  break;
46588
46694
  }
46695
+ case "node.terminal.execute": {
46696
+ const self2 = deps.nodeRegistry.getSelf();
46697
+ response = jsonResponse(
46698
+ request.id,
46699
+ 200,
46700
+ await executeLocalNodeTerminalCommand(
46701
+ self2.id,
46702
+ self2.workDir ?? deps.workDir,
46703
+ payloadValue(request, "command", ""),
46704
+ { cwd: payloadValue(request, "cwd", void 0) }
46705
+ )
46706
+ );
46707
+ break;
46708
+ }
46589
46709
  case "node.sessions.list": {
46590
46710
  const self2 = deps.nodeRegistry.getSelf();
46591
46711
  response = jsonResponse(
@@ -46833,11 +46953,143 @@ async function sendNodeAgentUpgrade(req, res, nodeId, agentParam) {
46833
46953
  res.status(202).json(operation);
46834
46954
  }
46835
46955
 
46956
+ // ../../packages/api/src/routes/node-terminal.ts
46957
+ var NODE_TERMINAL_PROXY_TIMEOUT_MS = 35e3;
46958
+ function describeProxyError2(error) {
46959
+ if (error instanceof Error) {
46960
+ const errorCategory = error.name === "AbortError" || /aborted/i.test(error.message) ? "abort" : /timeout/i.test(error.message) ? "timeout" : "network";
46961
+ return {
46962
+ errorName: error.name,
46963
+ errorMessage: error.message,
46964
+ errorCategory
46965
+ };
46966
+ }
46967
+ return {
46968
+ errorName: "UnknownError",
46969
+ errorMessage: String(error),
46970
+ errorCategory: "unknown"
46971
+ };
46972
+ }
46973
+ function createNodeTerminalProxyTrace(log2, nodeId, proxyPath) {
46974
+ return {
46975
+ onAttempt: ({ attempt, endpoint, timeoutMs, totalEndpoints }) => {
46976
+ log2.debug("node terminal proxy attempt", {
46977
+ nodeId,
46978
+ proxyPath,
46979
+ endpoint,
46980
+ attempt,
46981
+ totalEndpoints,
46982
+ timeoutMs
46983
+ });
46984
+ },
46985
+ onResponse: ({ attempt, endpoint, response, timeoutMs, totalEndpoints }) => {
46986
+ log2.info("node terminal proxy response", {
46987
+ nodeId,
46988
+ proxyPath,
46989
+ endpoint,
46990
+ attempt,
46991
+ totalEndpoints,
46992
+ timeoutMs,
46993
+ ok: response.ok,
46994
+ statusCode: response.status
46995
+ });
46996
+ },
46997
+ onError: ({ attempt, endpoint, error, timeoutMs, totalEndpoints }) => {
46998
+ log2.warn("node terminal proxy attempt failed", {
46999
+ nodeId,
47000
+ proxyPath,
47001
+ endpoint,
47002
+ attempt,
47003
+ totalEndpoints,
47004
+ timeoutMs,
47005
+ ...describeProxyError2(error)
47006
+ });
47007
+ }
47008
+ };
47009
+ }
47010
+ async function maybeHandleRemoteNodeTerminalExecuteRequest(req, res, nodeId) {
47011
+ const body = NodeTerminalExecuteBody.parse(req.body);
47012
+ const { nodeRegistry, heartbeat, logger: rootLogger } = req.app.locals.deps;
47013
+ const selfId = nodeRegistry.getSelf().id;
47014
+ if (nodeId === selfId) {
47015
+ return false;
47016
+ }
47017
+ const node = nodeRegistry.getNode(nodeId);
47018
+ if (!node) {
47019
+ throw new MeshyError("NODE_NOT_FOUND", `Node ${nodeId} not found`, 404);
47020
+ }
47021
+ const log2 = rootLogger.child("nodes/terminal");
47022
+ const proxyPath = req.originalUrl ?? `/api/nodes/${nodeId}/terminal/execute`;
47023
+ const fallbackRequest = createNodeMessage("node.terminal.execute", {
47024
+ command: body.command,
47025
+ cwd: body.cwd
47026
+ }, { expectsResponse: true });
47027
+ const canPushToNode = heartbeat?.canPushToNode?.(nodeId) ?? true;
47028
+ if (!canPushToNode && canRequestNodeMessage(heartbeat)) {
47029
+ log2.warn("node terminal request falling back to keepalive control", { nodeId, proxyPath });
47030
+ const controlResponse = await requestFallbackNodeMessage(heartbeat, nodeId, fallbackRequest);
47031
+ sendWorkerControlResponse(res, controlResponse);
47032
+ return true;
47033
+ }
47034
+ try {
47035
+ const { endpoint, response } = await fetchNodeWithFallback(
47036
+ node,
47037
+ proxyPath,
47038
+ {
47039
+ method: "POST",
47040
+ headers: { "Content-Type": "application/json" },
47041
+ body: JSON.stringify(body)
47042
+ },
47043
+ NODE_TERMINAL_PROXY_TIMEOUT_MS,
47044
+ createNodeTerminalProxyTrace(log2, nodeId, proxyPath),
47045
+ { preferPublicEndpoint: true }
47046
+ );
47047
+ log2.debug("proxying node terminal request", { nodeId, endpoint, proxyPath });
47048
+ await sendProxyResponse(res, response);
47049
+ return true;
47050
+ } catch (err) {
47051
+ const errorDetails = describeProxyError2(err);
47052
+ log2.warn("node terminal proxy error", {
47053
+ nodeId,
47054
+ proxyPath,
47055
+ timeoutMs: NODE_TERMINAL_PROXY_TIMEOUT_MS,
47056
+ ...errorDetails
47057
+ });
47058
+ if (canRequestNodeMessage(heartbeat)) {
47059
+ log2.warn("node terminal proxy failed, falling back to keepalive control", {
47060
+ nodeId,
47061
+ proxyPath,
47062
+ timeoutMs: NODE_TERMINAL_PROXY_TIMEOUT_MS,
47063
+ ...errorDetails
47064
+ });
47065
+ const controlResponse = await requestFallbackNodeMessage(heartbeat, nodeId, fallbackRequest);
47066
+ sendWorkerControlResponse(res, controlResponse);
47067
+ return true;
47068
+ }
47069
+ throw new MeshyError("NODE_OFFLINE", `Cannot reach node ${nodeId} to execute a terminal command`, 502);
47070
+ }
47071
+ }
47072
+ async function sendLocalNodeTerminalExecute(req, res, nodeId) {
47073
+ const body = NodeTerminalExecuteBody.parse(req.body);
47074
+ const { nodeRegistry, workDir } = req.app.locals.deps;
47075
+ const self2 = nodeRegistry.getSelf();
47076
+ if (nodeId !== self2.id) {
47077
+ throw new MeshyError("NODE_NOT_FOUND", `Node ${nodeId} not found`, 404);
47078
+ }
47079
+ const result = await executeLocalNodeTerminalCommand(
47080
+ self2.id,
47081
+ self2.workDir ?? workDir,
47082
+ body.command,
47083
+ { cwd: body.cwd }
47084
+ );
47085
+ res.json(result);
47086
+ }
47087
+
46836
47088
  // ../../packages/api/src/routes/nodes.ts
46837
47089
  var NODE_WORKDIR_PROXY_TIMEOUT_MS = 1e4;
46838
47090
  var NODE_WORKDIR_BRANCH_PROXY_TIMEOUT_MS = 25e3;
46839
47091
  var NODE_NATIVE_SESSIONS_PROXY_TIMEOUT_MS = 1e4;
46840
- function describeProxyError2(error) {
47092
+ function describeProxyError3(error) {
46841
47093
  if (error instanceof Error) {
46842
47094
  const errorCategory = error.name === "AbortError" || /aborted/i.test(error.message) ? "abort" : /timeout/i.test(error.message) ? "timeout" : "network";
46843
47095
  return {
@@ -46884,7 +47136,7 @@ function createNodeWorkdirProxyTrace(log2, nodeId, proxyPath) {
46884
47136
  attempt,
46885
47137
  totalEndpoints,
46886
47138
  timeoutMs,
46887
- ...describeProxyError2(error)
47139
+ ...describeProxyError3(error)
46888
47140
  });
46889
47141
  }
46890
47142
  };
@@ -46939,7 +47191,7 @@ async function maybeHandleRemoteNodeWorkDirRequest(req, res, nodeId) {
46939
47191
  await sendProxyResponse(res, response);
46940
47192
  return true;
46941
47193
  } catch (err) {
46942
- const errorDetails = describeProxyError2(err);
47194
+ const errorDetails = describeProxyError3(err);
46943
47195
  log2.warn("node workdir proxy error", {
46944
47196
  nodeId,
46945
47197
  proxyPath,
@@ -47006,7 +47258,7 @@ async function maybeHandleRemoteNodeWorkDirBranchInfoRequest(req, res, nodeId) {
47006
47258
  await sendProxyResponse(res, response);
47007
47259
  return true;
47008
47260
  } catch (err) {
47009
- const errorDetails = describeProxyError2(err);
47261
+ const errorDetails = describeProxyError3(err);
47010
47262
  log2.warn("node workdir branch proxy error", {
47011
47263
  nodeId,
47012
47264
  proxyPath,
@@ -47071,7 +47323,7 @@ async function maybeHandleRemoteNodeNativeSessionsRequest(req, res, nodeId) {
47071
47323
  await sendProxyResponse(res, response);
47072
47324
  return true;
47073
47325
  } catch (err) {
47074
- const errorDetails = describeProxyError2(err);
47326
+ const errorDetails = describeProxyError3(err);
47075
47327
  log2.warn("node native sessions proxy error", {
47076
47328
  nodeId,
47077
47329
  proxyPath,
@@ -47158,6 +47410,14 @@ function createNodeRoutes() {
47158
47410
  }
47159
47411
  sendLocalNodeWorkDirBranchInfo(req, res, nodeId);
47160
47412
  }));
47413
+ router.post("/:id/terminal/execute", asyncHandler3(async (req, res) => {
47414
+ const nodeId = req.params.id;
47415
+ const handled = await maybeHandleRemoteNodeTerminalExecuteRequest(req, res, nodeId);
47416
+ if (handled) {
47417
+ return;
47418
+ }
47419
+ await sendLocalNodeTerminalExecute(req, res, nodeId);
47420
+ }));
47161
47421
  router.post("/:id/workdir/branch", asyncHandler3(async (req, res) => {
47162
47422
  const nodeId = req.params.id;
47163
47423
  await sendNodeWorkDirBranchCreateOperation(req, res, nodeId);
@@ -47577,7 +47837,7 @@ function getTaskLogsProxyRequestMetadata(req) {
47577
47837
  const sourceNodeId = req.get(TASK_LOG_PROXY_SOURCE_HEADER) ?? void 0;
47578
47838
  return { isProxy: purpose === TASK_LOG_PROXY_PURPOSE, sourceNodeId, task: decodeTaskSnapshot(req.get(TASK_LOG_PROXY_TASK_HEADER)) };
47579
47839
  }
47580
- function describeProxyError3(error) {
47840
+ function describeProxyError4(error) {
47581
47841
  if (error instanceof Error) {
47582
47842
  const errorCategory = error.name === "AbortError" || /aborted/i.test(error.message) ? "abort" : /timeout/i.test(error.message) ? "timeout" : "network";
47583
47843
  return {
@@ -47619,7 +47879,7 @@ function createTaskLogsProxyTrace(log2, taskId, nodeId, proxyPath) {
47619
47879
  attempt,
47620
47880
  totalEndpoints,
47621
47881
  timeoutMs,
47622
- ...describeProxyError3(error)
47882
+ ...describeProxyError4(error)
47623
47883
  });
47624
47884
  }
47625
47885
  };
@@ -47697,7 +47957,7 @@ async function sendTaskLogsResponse(req, res, taskId) {
47697
47957
  log2.warn("failed to seed task snapshot before task logs proxy", {
47698
47958
  taskId,
47699
47959
  assignedTo,
47700
- ...describeProxyError3(err)
47960
+ ...describeProxyError4(err)
47701
47961
  });
47702
47962
  return [];
47703
47963
  });
@@ -47730,7 +47990,7 @@ async function sendTaskLogsResponse(req, res, taskId) {
47730
47990
  taskId,
47731
47991
  assignedTo,
47732
47992
  timeoutMs: TASK_LOG_PROXY_TIMEOUT_MS,
47733
- ...describeProxyError3(err)
47993
+ ...describeProxyError4(err)
47734
47994
  });
47735
47995
  const fallback = await requestTaskLogsOverKeepalive(heartbeat, assignedTo, task, after);
47736
47996
  if (fallback) {
@@ -47807,7 +48067,7 @@ function resolveRequestOrigin(req) {
47807
48067
 
47808
48068
  // ../../packages/api/src/routes/task-output.ts
47809
48069
  var TASK_OUTPUT_PROXY_TIMEOUT_MS = 1e4;
47810
- function describeProxyError4(error) {
48070
+ function describeProxyError5(error) {
47811
48071
  if (error instanceof Error) {
47812
48072
  const errorCategory = error.name === "AbortError" || /aborted/i.test(error.message) ? "abort" : /timeout/i.test(error.message) ? "timeout" : "network";
47813
48073
  return {
@@ -47860,7 +48120,7 @@ function createTaskOutputProxyTrace(log2, taskId, assignedTo, kind, proxyPath) {
47860
48120
  attempt,
47861
48121
  totalEndpoints,
47862
48122
  timeoutMs,
47863
- ...describeProxyError4(error)
48123
+ ...describeProxyError5(error)
47864
48124
  });
47865
48125
  }
47866
48126
  };
@@ -47978,7 +48238,7 @@ async function maybeHandleRemoteTaskOutputRequest(req, res, taskId, subPath, ini
47978
48238
  assignedTo: assignedNodeId,
47979
48239
  kind: hydratedFallbackRequest.kind,
47980
48240
  timeoutMs: TASK_OUTPUT_PROXY_TIMEOUT_MS,
47981
- ...describeProxyError4(err)
48241
+ ...describeProxyError5(err)
47982
48242
  });
47983
48243
  const controlResponse = await requestFallbackNodeMessage(heartbeat, assignedNodeId, hydratedFallbackRequest);
47984
48244
  if (hydratedFallbackRequest.kind === "task.preview.create" && controlResponse.bodyEncoding === "json" && isPreviewSessionPayload(controlResponse.body)) {
@@ -47995,7 +48255,7 @@ async function maybeHandleRemoteTaskOutputRequest(req, res, taskId, subPath, ini
47995
48255
  assignedTo: assignedNodeId,
47996
48256
  kind: messageKind,
47997
48257
  timeoutMs: TASK_OUTPUT_PROXY_TIMEOUT_MS,
47998
- ...describeProxyError4(err)
48258
+ ...describeProxyError5(err)
47999
48259
  });
48000
48260
  throw new MeshyError("NODE_OFFLINE", "Cannot reach worker for task output", 502);
48001
48261
  }
@@ -49241,8 +49501,8 @@ function hasAuthorizationHeader(req) {
49241
49501
  function resolveRuntimeBaseDir() {
49242
49502
  const entryPath = process.argv[1];
49243
49503
  if (typeof entryPath === "string" && entryPath.length > 0) {
49244
- const resolved = fs19.realpathSync(path20.resolve(entryPath));
49245
- return path20.dirname(resolved);
49504
+ const resolved = fs20.realpathSync(path21.resolve(entryPath));
49505
+ return path21.dirname(resolved);
49246
49506
  }
49247
49507
  return process.cwd();
49248
49508
  }
@@ -49250,18 +49510,18 @@ function resolveStaticDir(baseDir) {
49250
49510
  const envStaticDir = process.env.MESHY_STATIC_DIR;
49251
49511
  const candidateDirs = [
49252
49512
  envStaticDir,
49253
- path20.resolve(baseDir, "dashboard"),
49254
- path20.resolve(baseDir, "../dashboard"),
49255
- path20.resolve(baseDir, "../../dashboard/dist"),
49256
- path20.resolve(baseDir, "../../../packages/dashboard/dist"),
49257
- path20.resolve(baseDir, "../public"),
49258
- path20.resolve(baseDir, "../../packages/api/public"),
49259
- path20.resolve(baseDir, "../../../packages/api/public"),
49260
- path20.resolve(process.cwd(), "packages/dashboard/dist"),
49261
- path20.resolve(process.cwd(), "packages/api/public")
49513
+ path21.resolve(baseDir, "dashboard"),
49514
+ path21.resolve(baseDir, "../dashboard"),
49515
+ path21.resolve(baseDir, "../../dashboard/dist"),
49516
+ path21.resolve(baseDir, "../../../packages/dashboard/dist"),
49517
+ path21.resolve(baseDir, "../public"),
49518
+ path21.resolve(baseDir, "../../packages/api/public"),
49519
+ path21.resolve(baseDir, "../../../packages/api/public"),
49520
+ path21.resolve(process.cwd(), "packages/dashboard/dist"),
49521
+ path21.resolve(process.cwd(), "packages/api/public")
49262
49522
  ].filter((value) => typeof value === "string" && value.length > 0);
49263
49523
  for (const candidate of candidateDirs) {
49264
- if (fs19.existsSync(candidate)) {
49524
+ if (fs20.existsSync(candidate)) {
49265
49525
  return candidate;
49266
49526
  }
49267
49527
  }
@@ -49362,8 +49622,8 @@ function createServer2(deps) {
49362
49622
  app.use("/api/node-operations", createNodeOperationRoutes());
49363
49623
  app.use("/api/events", createEventRoutes());
49364
49624
  if (staticDir) {
49365
- const indexPath = path20.join(staticDir, "index.html");
49366
- if (fs19.existsSync(indexPath)) {
49625
+ const indexPath = path21.join(staticDir, "index.html");
49626
+ if (fs20.existsSync(indexPath)) {
49367
49627
  app.get("*", (req, res, next) => {
49368
49628
  if (isApiRequest(req)) {
49369
49629
  next();
@@ -49397,12 +49657,12 @@ function detectLocalIp() {
49397
49657
  return "127.0.0.1";
49398
49658
  }
49399
49659
  function detectAvailablePort() {
49400
- return new Promise((resolve14, reject) => {
49660
+ return new Promise((resolve15, reject) => {
49401
49661
  const srv = (0, import_node_http2.createServer)();
49402
49662
  srv.listen(0, () => {
49403
49663
  const addr = srv.address();
49404
49664
  const port = addr && typeof addr !== "string" ? addr.port : 0;
49405
- srv.close((err) => err ? reject(err) : resolve14(port));
49665
+ srv.close((err) => err ? reject(err) : resolve15(port));
49406
49666
  });
49407
49667
  srv.on("error", reject);
49408
49668
  });
@@ -49447,10 +49707,10 @@ var DirectTransport = class {
49447
49707
  };
49448
49708
 
49449
49709
  // ../../packages/transport/src/devtunnel.ts
49450
- var import_node_child_process10 = require("child_process");
49710
+ var import_node_child_process11 = require("child_process");
49451
49711
  function isInstalled(cmd) {
49452
49712
  try {
49453
- (0, import_node_child_process10.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
49713
+ (0, import_node_child_process11.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
49454
49714
  return true;
49455
49715
  } catch {
49456
49716
  return false;
@@ -49473,18 +49733,18 @@ var DevTunnelTransport = class {
49473
49733
  );
49474
49734
  }
49475
49735
  try {
49476
- (0, import_node_child_process10.execSync)("devtunnel user show", { stdio: "pipe" });
49736
+ (0, import_node_child_process11.execSync)("devtunnel user show", { stdio: "pipe" });
49477
49737
  } catch {
49478
49738
  throw new Error(
49479
49739
  "Not logged in to devtunnel. Run: devtunnel user login"
49480
49740
  );
49481
49741
  }
49482
49742
  const hostArgs = this.buildHostArgs(localPort);
49483
- const child = (0, import_node_child_process10.spawn)("devtunnel", hostArgs, {
49743
+ const child = (0, import_node_child_process11.spawn)("devtunnel", hostArgs, {
49484
49744
  stdio: ["pipe", "pipe", "pipe"]
49485
49745
  });
49486
49746
  this.process = child;
49487
- this.publicUrl = await new Promise((resolve14, reject) => {
49747
+ this.publicUrl = await new Promise((resolve15, reject) => {
49488
49748
  const timeout = setTimeout(() => {
49489
49749
  child.kill();
49490
49750
  this.process = null;
@@ -49507,7 +49767,7 @@ var DevTunnelTransport = class {
49507
49767
  clearTimeout(timeout);
49508
49768
  child.stdout?.removeListener("data", onData);
49509
49769
  child.stderr?.removeListener("data", onErrData);
49510
- resolve14(url.replace(/\/+$/, ""));
49770
+ resolve15(url.replace(/\/+$/, ""));
49511
49771
  };
49512
49772
  child.stdout?.on("data", onData);
49513
49773
  child.stderr?.on("data", onErrData);
@@ -49539,14 +49799,14 @@ ${lines.join("")}`
49539
49799
  this.publicUrl = null;
49540
49800
  if (child.exitCode === null) {
49541
49801
  child.kill("SIGTERM");
49542
- await new Promise((resolve14) => {
49802
+ await new Promise((resolve15) => {
49543
49803
  const killTimer = setTimeout(() => {
49544
49804
  child.kill("SIGKILL");
49545
- resolve14();
49805
+ resolve15();
49546
49806
  }, 5e3);
49547
49807
  child.on("close", () => {
49548
49808
  clearTimeout(killTimer);
49549
- resolve14();
49809
+ resolve15();
49550
49810
  });
49551
49811
  });
49552
49812
  }
@@ -49585,7 +49845,7 @@ ${lines.join("")}`
49585
49845
  return;
49586
49846
  }
49587
49847
  try {
49588
- (0, import_node_child_process10.execFileSync)("devtunnel", ["access", "create", tunnelId, "--tenant"], { stdio: "pipe" });
49848
+ (0, import_node_child_process11.execFileSync)("devtunnel", ["access", "create", tunnelId, "--tenant"], { stdio: "pipe" });
49589
49849
  } catch (err) {
49590
49850
  if (isExistingTenantAccessError(err)) {
49591
49851
  return;
@@ -49601,7 +49861,7 @@ ${lines.join("")}`
49601
49861
  return void 0;
49602
49862
  }
49603
49863
  try {
49604
- (0, import_node_child_process10.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
49864
+ (0, import_node_child_process11.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
49605
49865
  return tunnelId;
49606
49866
  } catch {
49607
49867
  const createArgs = ["create", tunnelId];
@@ -49609,7 +49869,7 @@ ${lines.join("")}`
49609
49869
  createArgs.push("-a");
49610
49870
  }
49611
49871
  try {
49612
- (0, import_node_child_process10.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
49872
+ (0, import_node_child_process11.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
49613
49873
  return tunnelId;
49614
49874
  } catch (err) {
49615
49875
  throw new Error(
@@ -49621,13 +49881,13 @@ ${lines.join("")}`
49621
49881
  ensureTunnelPort(tunnelId, localPort) {
49622
49882
  const ports = this.listTunnelPorts(tunnelId);
49623
49883
  for (const stalePort of ports.filter((p) => p !== localPort)) {
49624
- (0, import_node_child_process10.execFileSync)("devtunnel", ["port", "delete", tunnelId, "-p", String(stalePort)], { stdio: "pipe" });
49884
+ (0, import_node_child_process11.execFileSync)("devtunnel", ["port", "delete", tunnelId, "-p", String(stalePort)], { stdio: "pipe" });
49625
49885
  }
49626
49886
  if (ports.includes(localPort)) {
49627
49887
  return;
49628
49888
  }
49629
49889
  try {
49630
- (0, import_node_child_process10.execFileSync)(
49890
+ (0, import_node_child_process11.execFileSync)(
49631
49891
  "devtunnel",
49632
49892
  ["port", "create", tunnelId, "-p", String(localPort), "--protocol", "http"],
49633
49893
  { stdio: "pipe" }
@@ -49643,7 +49903,7 @@ ${lines.join("")}`
49643
49903
  }
49644
49904
  listTunnelPorts(tunnelId) {
49645
49905
  try {
49646
- const output = (0, import_node_child_process10.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
49906
+ const output = (0, import_node_child_process11.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
49647
49907
  const parsed = JSON.parse(output.toString());
49648
49908
  const items = Array.isArray(parsed) ? parsed : parsed && typeof parsed === "object" && Array.isArray(parsed.ports) ? parsed.ports : parsed && typeof parsed === "object" && Array.isArray(parsed.value) ? parsed.value : [];
49649
49909
  return items.map((item) => getPortNumber(item)).filter((value) => value !== void 0);
@@ -49655,7 +49915,7 @@ ${lines.join("")}`
49655
49915
  }
49656
49916
  hasTunnelPort(tunnelId, localPort) {
49657
49917
  try {
49658
- (0, import_node_child_process10.execFileSync)(
49918
+ (0, import_node_child_process11.execFileSync)(
49659
49919
  "devtunnel",
49660
49920
  ["port", "show", tunnelId, "-p", String(localPort), "-j"],
49661
49921
  { stdio: "pipe" }
@@ -49759,10 +50019,10 @@ var terminalWriter = {
49759
50019
  };
49760
50020
 
49761
50021
  // src/startup.ts
49762
- var fs20 = __toESM(require("fs"), 1);
49763
- var path21 = __toESM(require("path"), 1);
50022
+ var fs21 = __toESM(require("fs"), 1);
50023
+ var path22 = __toESM(require("path"), 1);
49764
50024
  var readline = __toESM(require("readline/promises"), 1);
49765
- var import_node_child_process11 = require("child_process");
50025
+ var import_node_child_process12 = require("child_process");
49766
50026
  function getDefaultNodeName() {
49767
50027
  return getDeviceNodeName();
49768
50028
  }
@@ -49808,7 +50068,7 @@ function createPromptSession(prompt) {
49808
50068
  }
49809
50069
  function createDefaultCommandRunner(platform2) {
49810
50070
  return (command, args, interactive = false) => {
49811
- const result = (0, import_node_child_process11.spawnSync)(command, args, {
50071
+ const result = (0, import_node_child_process12.spawnSync)(command, args, {
49812
50072
  encoding: "utf-8",
49813
50073
  shell: platform2 === "win32",
49814
50074
  stdio: interactive ? "inherit" : "pipe"
@@ -49823,19 +50083,19 @@ function createDefaultCommandRunner(platform2) {
49823
50083
  };
49824
50084
  }
49825
50085
  function getNodeMetadataPath2(storagePath) {
49826
- return path21.join(storagePath, "metadata.json");
50086
+ return path22.join(storagePath, "metadata.json");
49827
50087
  }
49828
50088
  function readStartupMetadataFile(storagePath) {
49829
50089
  try {
49830
- const raw = JSON.parse(fs20.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
50090
+ const raw = JSON.parse(fs21.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
49831
50091
  return typeof raw === "object" && raw !== null ? raw : {};
49832
50092
  } catch {
49833
50093
  return {};
49834
50094
  }
49835
50095
  }
49836
50096
  function writeStartupMetadataFile(storagePath, metadata) {
49837
- fs20.mkdirSync(storagePath, { recursive: true });
49838
- fs20.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
50097
+ fs21.mkdirSync(storagePath, { recursive: true });
50098
+ fs21.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
49839
50099
  }
49840
50100
  function formatLocalDate2(now) {
49841
50101
  const year = now.getFullYear();
@@ -49917,7 +50177,7 @@ function isRequirementSatisfied(requirement, status) {
49917
50177
  return true;
49918
50178
  }
49919
50179
  function sleep(ms) {
49920
- return new Promise((resolve14) => setTimeout(resolve14, ms));
50180
+ return new Promise((resolve15) => setTimeout(resolve15, ms));
49921
50181
  }
49922
50182
  function areCachedAuthRequirementsCurrent(commandRunner) {
49923
50183
  return isAuthenticated("az", commandRunner) && isAuthenticated("devtunnel", commandRunner);
@@ -50074,9 +50334,9 @@ async function ensureStartupRequirements(storagePath, options = {}) {
50074
50334
  metadata
50075
50335
  };
50076
50336
  }
50077
- function loadConfigFile(path23) {
50337
+ function loadConfigFile(path24) {
50078
50338
  try {
50079
- const raw = fs20.readFileSync(path23, "utf-8");
50339
+ const raw = fs21.readFileSync(path24, "utf-8");
50080
50340
  return JSON.parse(raw);
50081
50341
  } catch {
50082
50342
  return {};
@@ -50254,26 +50514,26 @@ function formatLoadedStartMetadata(info, authEnabled) {
50254
50514
  }
50255
50515
 
50256
50516
  // src/runtime-metadata.ts
50257
- var fs21 = __toESM(require("fs"), 1);
50258
- var path22 = __toESM(require("path"), 1);
50259
- var import_node_child_process12 = require("child_process");
50517
+ var fs22 = __toESM(require("fs"), 1);
50518
+ var path23 = __toESM(require("path"), 1);
50519
+ var import_node_child_process13 = require("child_process");
50260
50520
  var runtimeDir = resolveRuntimeDir();
50261
50521
  var appRoot = resolveAppRoot(runtimeDir);
50262
- var repoRoot = path22.resolve(appRoot, "../..");
50522
+ var repoRoot = path23.resolve(appRoot, "../..");
50263
50523
  function resolveRuntimeDir() {
50264
50524
  const entryPath = process.argv[1];
50265
50525
  if (typeof entryPath === "string" && entryPath.length > 0) {
50266
50526
  try {
50267
- return path22.dirname(fs21.realpathSync(path22.resolve(entryPath)));
50527
+ return path23.dirname(fs22.realpathSync(path23.resolve(entryPath)));
50268
50528
  } catch {
50269
- return path22.dirname(path22.resolve(entryPath));
50529
+ return path23.dirname(path23.resolve(entryPath));
50270
50530
  }
50271
50531
  }
50272
50532
  return process.cwd();
50273
50533
  }
50274
50534
  function readJsonFile(filePath) {
50275
50535
  try {
50276
- return JSON.parse(fs21.readFileSync(filePath, "utf-8"));
50536
+ return JSON.parse(fs22.readFileSync(filePath, "utf-8"));
50277
50537
  } catch {
50278
50538
  return null;
50279
50539
  }
@@ -50283,9 +50543,9 @@ function readPackageManifest(filePath) {
50283
50543
  }
50284
50544
  function readEmbeddedRuntimeMetadata() {
50285
50545
  const candidates = [
50286
- path22.join(appRoot, "runtime-metadata.json"),
50287
- path22.join(runtimeDir, "runtime-metadata.json"),
50288
- path22.resolve(process.cwd(), "apps/node/dist/runtime-metadata.json")
50546
+ path23.join(appRoot, "runtime-metadata.json"),
50547
+ path23.join(runtimeDir, "runtime-metadata.json"),
50548
+ path23.resolve(process.cwd(), "apps/node/dist/runtime-metadata.json")
50289
50549
  ];
50290
50550
  for (const candidate of candidates) {
50291
50551
  const metadata = readJsonFile(candidate);
@@ -50298,23 +50558,23 @@ function readEmbeddedRuntimeMetadata() {
50298
50558
  function resolveAppRoot(baseDir) {
50299
50559
  const candidates = [
50300
50560
  baseDir,
50301
- path22.resolve(baseDir, ".."),
50302
- path22.resolve(process.cwd(), "apps/node/dist"),
50303
- path22.resolve(process.cwd(), "apps/node"),
50561
+ path23.resolve(baseDir, ".."),
50562
+ path23.resolve(process.cwd(), "apps/node/dist"),
50563
+ path23.resolve(process.cwd(), "apps/node"),
50304
50564
  process.cwd()
50305
50565
  ];
50306
50566
  for (const candidate of candidates) {
50307
- const manifest = readPackageManifest(path22.join(candidate, "package.json"));
50567
+ const manifest = readPackageManifest(path23.join(candidate, "package.json"));
50308
50568
  if (manifest?.name === "@meshy/node" || manifest?.name === "meshy-node") {
50309
50569
  return candidate;
50310
50570
  }
50311
50571
  }
50312
50572
  for (const candidate of candidates) {
50313
- if (fs21.existsSync(path22.join(candidate, "package.json"))) {
50573
+ if (fs22.existsSync(path23.join(candidate, "package.json"))) {
50314
50574
  return candidate;
50315
50575
  }
50316
50576
  }
50317
- return path22.resolve(baseDir, "..");
50577
+ return path23.resolve(baseDir, "..");
50318
50578
  }
50319
50579
  function toPackageInfo(filePath) {
50320
50580
  const manifest = readPackageManifest(filePath);
@@ -50352,7 +50612,7 @@ function readRepositoryUrlFromManifest(manifest) {
50352
50612
  }
50353
50613
  function readGitValue(args) {
50354
50614
  try {
50355
- const output = (0, import_node_child_process12.execFileSync)("git", args, {
50615
+ const output = (0, import_node_child_process13.execFileSync)("git", args, {
50356
50616
  cwd: repoRoot,
50357
50617
  encoding: "utf-8",
50358
50618
  stdio: ["ignore", "pipe", "ignore"],
@@ -50374,8 +50634,8 @@ function buildRuntimeMetadata(storagePath) {
50374
50634
  components: startupRequirements.components
50375
50635
  };
50376
50636
  }
50377
- const appPackage = toPackageInfo(path22.join(appRoot, "package.json"));
50378
- const workspaceManifest = readPackageManifest(path22.join(repoRoot, "package.json"));
50637
+ const appPackage = toPackageInfo(path23.join(appRoot, "package.json"));
50638
+ const workspaceManifest = readPackageManifest(path23.join(repoRoot, "package.json"));
50379
50639
  return {
50380
50640
  packageName: appPackage?.name ?? "meshy",
50381
50641
  packageVersion: appPackage?.version ?? "0.1.0",
@@ -50383,11 +50643,11 @@ function buildRuntimeMetadata(storagePath) {
50383
50643
  startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
50384
50644
  components: startupRequirements.components,
50385
50645
  packages: {
50386
- workspace: toPackageInfo(path22.join(repoRoot, "package.json")),
50646
+ workspace: toPackageInfo(path23.join(repoRoot, "package.json")),
50387
50647
  node: appPackage,
50388
- core: toPackageInfo(path22.join(repoRoot, "packages/core/package.json")),
50389
- dashboard: toPackageInfo(path22.join(repoRoot, "packages/dashboard/package.json")),
50390
- api: toPackageInfo(path22.join(repoRoot, "packages/api/package.json"))
50648
+ core: toPackageInfo(path23.join(repoRoot, "packages/core/package.json")),
50649
+ dashboard: toPackageInfo(path23.join(repoRoot, "packages/dashboard/package.json")),
50650
+ api: toPackageInfo(path23.join(repoRoot, "packages/api/package.json"))
50391
50651
  },
50392
50652
  repository: {
50393
50653
  url: normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.upstream.url"])) ?? normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.origin.url"])) ?? readRepositoryUrlFromManifest(workspaceManifest),