meshy-node 0.5.7 → 0.5.9

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
@@ -4649,8 +4649,8 @@ var require_helpers = __commonJS({
4649
4649
  function req(url, opts = {}) {
4650
4650
  const href = typeof url === "string" ? url : url.href;
4651
4651
  const req2 = (href.startsWith("https:") ? https2 : http3).request(url, opts);
4652
- const promise = new Promise((resolve14, reject) => {
4653
- req2.once("response", resolve14).once("error", reject).end();
4652
+ const promise = new Promise((resolve15, reject) => {
4653
+ req2.once("response", resolve15).once("error", reject).end();
4654
4654
  });
4655
4655
  req2.then = promise.then.bind(promise);
4656
4656
  return req2;
@@ -4827,7 +4827,7 @@ var require_parse_proxy_response = __commonJS({
4827
4827
  var debug_1 = __importDefault(require_src());
4828
4828
  var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
4829
4829
  function parseProxyResponse(socket) {
4830
- return new Promise((resolve14, reject) => {
4830
+ return new Promise((resolve15, reject) => {
4831
4831
  let buffersLength = 0;
4832
4832
  const buffers = [];
4833
4833
  function read() {
@@ -4893,7 +4893,7 @@ var require_parse_proxy_response = __commonJS({
4893
4893
  }
4894
4894
  debug("got proxy server response: %o %o", firstLine, headers);
4895
4895
  cleanup();
4896
- resolve14({
4896
+ resolve15({
4897
4897
  connect: {
4898
4898
  statusCode,
4899
4899
  statusText,
@@ -5782,8 +5782,8 @@ var init_parseUtil = __esm({
5782
5782
  init_errors();
5783
5783
  init_en();
5784
5784
  makeIssue = (params) => {
5785
- const { data, path: path22, errorMaps, issueData } = params;
5786
- const fullPath = [...path22, ...issueData.path || []];
5785
+ const { data, path: path23, errorMaps, issueData } = params;
5786
+ const fullPath = [...path23, ...issueData.path || []];
5787
5787
  const fullIssue = {
5788
5788
  ...issueData,
5789
5789
  path: fullPath
@@ -6094,11 +6094,11 @@ var init_types = __esm({
6094
6094
  init_parseUtil();
6095
6095
  init_util();
6096
6096
  ParseInputLazyPath = class {
6097
- constructor(parent, value, path22, key) {
6097
+ constructor(parent, value, path23, key) {
6098
6098
  this._cachedPath = [];
6099
6099
  this.parent = parent;
6100
6100
  this.data = value;
6101
- this._path = path22;
6101
+ this._path = path23;
6102
6102
  this._key = key;
6103
6103
  }
6104
6104
  get path() {
@@ -10739,8 +10739,8 @@ var require_node2 = __commonJS({
10739
10739
  }
10740
10740
  break;
10741
10741
  case "FILE":
10742
- var fs23 = require("fs");
10743
- stream2 = new fs23.SyncWriteStream(fd2, { autoClose: false });
10742
+ var fs24 = require("fs");
10743
+ stream2 = new fs24.SyncWriteStream(fd2, { autoClose: false });
10744
10744
  stream2._type = "fs";
10745
10745
  break;
10746
10746
  case "PIPE":
@@ -14393,10 +14393,10 @@ var require_raw_body = __commonJS({
14393
14393
  if (done) {
14394
14394
  return readStream(stream, encoding, length, limit, wrap(done));
14395
14395
  }
14396
- return new Promise(function executor(resolve14, reject) {
14396
+ return new Promise(function executor(resolve15, reject) {
14397
14397
  readStream(stream, encoding, length, limit, function onRead(err, buf) {
14398
14398
  if (err) return reject(err);
14399
- resolve14(buf);
14399
+ resolve15(buf);
14400
14400
  });
14401
14401
  });
14402
14402
  }
@@ -23480,7 +23480,7 @@ var require_mime_types = __commonJS({
23480
23480
  "../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js"(exports2) {
23481
23481
  "use strict";
23482
23482
  var db = require_mime_db();
23483
- var extname3 = require("path").extname;
23483
+ var extname4 = require("path").extname;
23484
23484
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
23485
23485
  var TEXT_TYPE_REGEXP = /^text\//i;
23486
23486
  exports2.charset = charset;
@@ -23530,11 +23530,11 @@ var require_mime_types = __commonJS({
23530
23530
  }
23531
23531
  return exts[0];
23532
23532
  }
23533
- function lookup(path22) {
23534
- if (!path22 || typeof path22 !== "string") {
23533
+ function lookup(path23) {
23534
+ if (!path23 || typeof path23 !== "string") {
23535
23535
  return false;
23536
23536
  }
23537
- var extension2 = extname3("x." + path22).toLowerCase().substr(1);
23537
+ var extension2 = extname4("x." + path23).toLowerCase().substr(1);
23538
23538
  if (!extension2) {
23539
23539
  return false;
23540
23540
  }
@@ -27052,7 +27052,7 @@ var require_path_to_regexp = __commonJS({
27052
27052
  "use strict";
27053
27053
  module2.exports = pathToRegexp;
27054
27054
  var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
27055
- function pathToRegexp(path22, keys, options) {
27055
+ function pathToRegexp(path23, keys, options) {
27056
27056
  options = options || {};
27057
27057
  keys = keys || [];
27058
27058
  var strict = options.strict;
@@ -27066,8 +27066,8 @@ var require_path_to_regexp = __commonJS({
27066
27066
  var pos = 0;
27067
27067
  var backtrack = "";
27068
27068
  var m;
27069
- if (path22 instanceof RegExp) {
27070
- while (m = MATCHING_GROUP_REGEXP.exec(path22.source)) {
27069
+ if (path23 instanceof RegExp) {
27070
+ while (m = MATCHING_GROUP_REGEXP.exec(path23.source)) {
27071
27071
  if (m[0][0] === "\\") continue;
27072
27072
  keys.push({
27073
27073
  name: m[1] || name2++,
@@ -27075,18 +27075,18 @@ var require_path_to_regexp = __commonJS({
27075
27075
  offset: m.index
27076
27076
  });
27077
27077
  }
27078
- return path22;
27078
+ return path23;
27079
27079
  }
27080
- if (Array.isArray(path22)) {
27081
- path22 = path22.map(function(value) {
27080
+ if (Array.isArray(path23)) {
27081
+ path23 = path23.map(function(value) {
27082
27082
  return pathToRegexp(value, keys, options).source;
27083
27083
  });
27084
- return new RegExp(path22.join("|"), flags);
27084
+ return new RegExp(path23.join("|"), flags);
27085
27085
  }
27086
- if (typeof path22 !== "string") {
27086
+ if (typeof path23 !== "string") {
27087
27087
  throw new TypeError("path must be a string, array of strings, or regular expression");
27088
27088
  }
27089
- path22 = path22.replace(
27089
+ path23 = path23.replace(
27090
27090
  /\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
27091
27091
  function(match, slash, format, key, capture, star, optional2, offset) {
27092
27092
  if (match[0] === "\\") {
@@ -27103,7 +27103,7 @@ var require_path_to_regexp = __commonJS({
27103
27103
  if (slash || format) {
27104
27104
  backtrack = "";
27105
27105
  } else {
27106
- backtrack += path22.slice(pos, offset);
27106
+ backtrack += path23.slice(pos, offset);
27107
27107
  }
27108
27108
  pos = offset + match.length;
27109
27109
  if (match === "*") {
@@ -27133,7 +27133,7 @@ var require_path_to_regexp = __commonJS({
27133
27133
  return result;
27134
27134
  }
27135
27135
  );
27136
- while (m = MATCHING_GROUP_REGEXP.exec(path22)) {
27136
+ while (m = MATCHING_GROUP_REGEXP.exec(path23)) {
27137
27137
  if (m[0][0] === "\\") continue;
27138
27138
  if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
27139
27139
  keys.splice(keysOffset + i, 0, {
@@ -27145,13 +27145,13 @@ var require_path_to_regexp = __commonJS({
27145
27145
  }
27146
27146
  i++;
27147
27147
  }
27148
- path22 += strict ? "" : path22[path22.length - 1] === "/" ? "?" : "/?";
27148
+ path23 += strict ? "" : path23[path23.length - 1] === "/" ? "?" : "/?";
27149
27149
  if (end) {
27150
- path22 += "$";
27151
- } else if (path22[path22.length - 1] !== "/") {
27152
- path22 += lookahead ? "(?=/|$)" : "(?:/|$)";
27150
+ path23 += "$";
27151
+ } else if (path23[path23.length - 1] !== "/") {
27152
+ path23 += lookahead ? "(?=/|$)" : "(?:/|$)";
27153
27153
  }
27154
- return new RegExp("^" + path22, flags);
27154
+ return new RegExp("^" + path23, flags);
27155
27155
  }
27156
27156
  }
27157
27157
  });
@@ -27164,19 +27164,19 @@ var require_layer = __commonJS({
27164
27164
  var debug = require_src2()("express:router:layer");
27165
27165
  var hasOwnProperty = Object.prototype.hasOwnProperty;
27166
27166
  module2.exports = Layer;
27167
- function Layer(path22, options, fn) {
27167
+ function Layer(path23, options, fn) {
27168
27168
  if (!(this instanceof Layer)) {
27169
- return new Layer(path22, options, fn);
27169
+ return new Layer(path23, options, fn);
27170
27170
  }
27171
- debug("new %o", path22);
27171
+ debug("new %o", path23);
27172
27172
  var opts = options || {};
27173
27173
  this.handle = fn;
27174
27174
  this.name = fn.name || "<anonymous>";
27175
27175
  this.params = void 0;
27176
27176
  this.path = void 0;
27177
- this.regexp = pathRegexp(path22, this.keys = [], opts);
27178
- this.regexp.fast_star = path22 === "*";
27179
- this.regexp.fast_slash = path22 === "/" && opts.end === false;
27177
+ this.regexp = pathRegexp(path23, this.keys = [], opts);
27178
+ this.regexp.fast_star = path23 === "*";
27179
+ this.regexp.fast_slash = path23 === "/" && opts.end === false;
27180
27180
  }
27181
27181
  Layer.prototype.handle_error = function handle_error(error2, req, res, next) {
27182
27182
  var fn = this.handle;
@@ -27200,20 +27200,20 @@ var require_layer = __commonJS({
27200
27200
  next(err);
27201
27201
  }
27202
27202
  };
27203
- Layer.prototype.match = function match(path22) {
27203
+ Layer.prototype.match = function match(path23) {
27204
27204
  var match2;
27205
- if (path22 != null) {
27205
+ if (path23 != null) {
27206
27206
  if (this.regexp.fast_slash) {
27207
27207
  this.params = {};
27208
27208
  this.path = "";
27209
27209
  return true;
27210
27210
  }
27211
27211
  if (this.regexp.fast_star) {
27212
- this.params = { "0": decode_param(path22) };
27213
- this.path = path22;
27212
+ this.params = { "0": decode_param(path23) };
27213
+ this.path = path23;
27214
27214
  return true;
27215
27215
  }
27216
- match2 = this.regexp.exec(path22);
27216
+ match2 = this.regexp.exec(path23);
27217
27217
  }
27218
27218
  if (!match2) {
27219
27219
  this.params = void 0;
@@ -27306,10 +27306,10 @@ var require_route = __commonJS({
27306
27306
  var slice = Array.prototype.slice;
27307
27307
  var toString = Object.prototype.toString;
27308
27308
  module2.exports = Route;
27309
- function Route(path22) {
27310
- this.path = path22;
27309
+ function Route(path23) {
27310
+ this.path = path23;
27311
27311
  this.stack = [];
27312
- debug("new %o", path22);
27312
+ debug("new %o", path23);
27313
27313
  this.methods = {};
27314
27314
  }
27315
27315
  Route.prototype._handles_method = function _handles_method(method) {
@@ -27522,8 +27522,8 @@ var require_router = __commonJS({
27522
27522
  if (++sync > 100) {
27523
27523
  return setImmediate(next, err);
27524
27524
  }
27525
- var path22 = getPathname(req);
27526
- if (path22 == null) {
27525
+ var path23 = getPathname(req);
27526
+ if (path23 == null) {
27527
27527
  return done(layerError);
27528
27528
  }
27529
27529
  var layer;
@@ -27531,7 +27531,7 @@ var require_router = __commonJS({
27531
27531
  var route;
27532
27532
  while (match !== true && idx < stack.length) {
27533
27533
  layer = stack[idx++];
27534
- match = matchLayer(layer, path22);
27534
+ match = matchLayer(layer, path23);
27535
27535
  route = layer.route;
27536
27536
  if (typeof match !== "boolean") {
27537
27537
  layerError = layerError || match;
@@ -27569,18 +27569,18 @@ var require_router = __commonJS({
27569
27569
  } else if (route) {
27570
27570
  layer.handle_request(req, res, next);
27571
27571
  } else {
27572
- trim_prefix(layer, layerError, layerPath, path22);
27572
+ trim_prefix(layer, layerError, layerPath, path23);
27573
27573
  }
27574
27574
  sync = 0;
27575
27575
  });
27576
27576
  }
27577
- function trim_prefix(layer, layerError, layerPath, path22) {
27577
+ function trim_prefix(layer, layerError, layerPath, path23) {
27578
27578
  if (layerPath.length !== 0) {
27579
- if (layerPath !== path22.slice(0, layerPath.length)) {
27579
+ if (layerPath !== path23.slice(0, layerPath.length)) {
27580
27580
  next(layerError);
27581
27581
  return;
27582
27582
  }
27583
- var c = path22[layerPath.length];
27583
+ var c = path23[layerPath.length];
27584
27584
  if (c && c !== "/" && c !== ".") return next(layerError);
27585
27585
  debug("trim prefix (%s) from url %s", layerPath, req.url);
27586
27586
  removed = layerPath;
@@ -27658,7 +27658,7 @@ var require_router = __commonJS({
27658
27658
  };
27659
27659
  proto.use = function use(fn) {
27660
27660
  var offset = 0;
27661
- var path22 = "/";
27661
+ var path23 = "/";
27662
27662
  if (typeof fn !== "function") {
27663
27663
  var arg = fn;
27664
27664
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -27666,7 +27666,7 @@ var require_router = __commonJS({
27666
27666
  }
27667
27667
  if (typeof arg !== "function") {
27668
27668
  offset = 1;
27669
- path22 = fn;
27669
+ path23 = fn;
27670
27670
  }
27671
27671
  }
27672
27672
  var callbacks = flatten(slice.call(arguments, offset));
@@ -27678,8 +27678,8 @@ var require_router = __commonJS({
27678
27678
  if (typeof fn !== "function") {
27679
27679
  throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
27680
27680
  }
27681
- debug("use %o %s", path22, fn.name || "<anonymous>");
27682
- var layer = new Layer(path22, {
27681
+ debug("use %o %s", path23, fn.name || "<anonymous>");
27682
+ var layer = new Layer(path23, {
27683
27683
  sensitive: this.caseSensitive,
27684
27684
  strict: false,
27685
27685
  end: false
@@ -27689,9 +27689,9 @@ var require_router = __commonJS({
27689
27689
  }
27690
27690
  return this;
27691
27691
  };
27692
- proto.route = function route(path22) {
27693
- var route2 = new Route(path22);
27694
- var layer = new Layer(path22, {
27692
+ proto.route = function route(path23) {
27693
+ var route2 = new Route(path23);
27694
+ var layer = new Layer(path23, {
27695
27695
  sensitive: this.caseSensitive,
27696
27696
  strict: this.strict,
27697
27697
  end: true
@@ -27701,8 +27701,8 @@ var require_router = __commonJS({
27701
27701
  return route2;
27702
27702
  };
27703
27703
  methods.concat("all").forEach(function(method) {
27704
- proto[method] = function(path22) {
27705
- var route = this.route(path22);
27704
+ proto[method] = function(path23) {
27705
+ var route = this.route(path23);
27706
27706
  route[method].apply(route, slice.call(arguments, 1));
27707
27707
  return this;
27708
27708
  };
@@ -27738,9 +27738,9 @@ var require_router = __commonJS({
27738
27738
  }
27739
27739
  return toString.call(obj).replace(objectRegExp, "$1");
27740
27740
  }
27741
- function matchLayer(layer, path22) {
27741
+ function matchLayer(layer, path23) {
27742
27742
  try {
27743
- return layer.match(path22);
27743
+ return layer.match(path23);
27744
27744
  } catch (err) {
27745
27745
  return err;
27746
27746
  }
@@ -27858,18 +27858,18 @@ var require_view = __commonJS({
27858
27858
  "../../node_modules/.pnpm/express@4.22.1/node_modules/express/lib/view.js"(exports2, module2) {
27859
27859
  "use strict";
27860
27860
  var debug = require_src2()("express:view");
27861
- var path22 = require("path");
27862
- var fs23 = require("fs");
27863
- var dirname7 = path22.dirname;
27864
- var basename5 = path22.basename;
27865
- var extname3 = path22.extname;
27866
- var join16 = path22.join;
27867
- var resolve14 = path22.resolve;
27861
+ var path23 = require("path");
27862
+ var fs24 = require("fs");
27863
+ var dirname7 = path23.dirname;
27864
+ var basename5 = path23.basename;
27865
+ var extname4 = path23.extname;
27866
+ var join17 = path23.join;
27867
+ var resolve15 = path23.resolve;
27868
27868
  module2.exports = View;
27869
27869
  function View(name2, options) {
27870
27870
  var opts = options || {};
27871
27871
  this.defaultEngine = opts.defaultEngine;
27872
- this.ext = extname3(name2);
27872
+ this.ext = extname4(name2);
27873
27873
  this.name = name2;
27874
27874
  this.root = opts.root;
27875
27875
  if (!this.ext && !this.defaultEngine) {
@@ -27893,39 +27893,39 @@ var require_view = __commonJS({
27893
27893
  this.path = this.lookup(fileName);
27894
27894
  }
27895
27895
  View.prototype.lookup = function lookup(name2) {
27896
- var path23;
27896
+ var path24;
27897
27897
  var roots = [].concat(this.root);
27898
27898
  debug('lookup "%s"', name2);
27899
- for (var i = 0; i < roots.length && !path23; i++) {
27899
+ for (var i = 0; i < roots.length && !path24; i++) {
27900
27900
  var root = roots[i];
27901
- var loc = resolve14(root, name2);
27901
+ var loc = resolve15(root, name2);
27902
27902
  var dir = dirname7(loc);
27903
27903
  var file = basename5(loc);
27904
- path23 = this.resolve(dir, file);
27904
+ path24 = this.resolve(dir, file);
27905
27905
  }
27906
- return path23;
27906
+ return path24;
27907
27907
  };
27908
27908
  View.prototype.render = function render(options, callback) {
27909
27909
  debug('render "%s"', this.path);
27910
27910
  this.engine(this.path, options, callback);
27911
27911
  };
27912
- View.prototype.resolve = function resolve15(dir, file) {
27912
+ View.prototype.resolve = function resolve16(dir, file) {
27913
27913
  var ext = this.ext;
27914
- var path23 = join16(dir, file);
27915
- var stat = tryStat(path23);
27914
+ var path24 = join17(dir, file);
27915
+ var stat = tryStat(path24);
27916
27916
  if (stat && stat.isFile()) {
27917
- return path23;
27917
+ return path24;
27918
27918
  }
27919
- path23 = join16(dir, basename5(file, ext), "index" + ext);
27920
- stat = tryStat(path23);
27919
+ path24 = join17(dir, basename5(file, ext), "index" + ext);
27920
+ stat = tryStat(path24);
27921
27921
  if (stat && stat.isFile()) {
27922
- return path23;
27922
+ return path24;
27923
27923
  }
27924
27924
  };
27925
- function tryStat(path23) {
27926
- debug('stat "%s"', path23);
27925
+ function tryStat(path24) {
27926
+ debug('stat "%s"', path24);
27927
27927
  try {
27928
- return fs23.statSync(path23);
27928
+ return fs24.statSync(path24);
27929
27929
  } catch (e) {
27930
27930
  return void 0;
27931
27931
  }
@@ -28222,8 +28222,8 @@ var require_types = __commonJS({
28222
28222
  var require_mime = __commonJS({
28223
28223
  "../../node_modules/.pnpm/mime@1.6.0/node_modules/mime/mime.js"(exports2, module2) {
28224
28224
  "use strict";
28225
- var path22 = require("path");
28226
- var fs23 = require("fs");
28225
+ var path23 = require("path");
28226
+ var fs24 = require("fs");
28227
28227
  function Mime() {
28228
28228
  this.types = /* @__PURE__ */ Object.create(null);
28229
28229
  this.extensions = /* @__PURE__ */ Object.create(null);
@@ -28244,7 +28244,7 @@ var require_mime = __commonJS({
28244
28244
  };
28245
28245
  Mime.prototype.load = function(file) {
28246
28246
  this._loading = file;
28247
- var map = {}, content = fs23.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
28247
+ var map = {}, content = fs24.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
28248
28248
  lines.forEach(function(line) {
28249
28249
  var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
28250
28250
  map[fields.shift()] = fields;
@@ -28252,8 +28252,8 @@ var require_mime = __commonJS({
28252
28252
  this.define(map);
28253
28253
  this._loading = null;
28254
28254
  };
28255
- Mime.prototype.lookup = function(path23, fallback) {
28256
- var ext = path23.replace(/^.*[\.\/\\]/, "").toLowerCase();
28255
+ Mime.prototype.lookup = function(path24, fallback) {
28256
+ var ext = path24.replace(/^.*[\.\/\\]/, "").toLowerCase();
28257
28257
  return this.types[ext] || fallback || this.default_type;
28258
28258
  };
28259
28259
  Mime.prototype.extension = function(mimeType) {
@@ -28366,33 +28366,33 @@ var require_send = __commonJS({
28366
28366
  var escapeHtml2 = require_escape_html();
28367
28367
  var etag = require_etag();
28368
28368
  var fresh = require_fresh();
28369
- var fs23 = require("fs");
28369
+ var fs24 = require("fs");
28370
28370
  var mime = require_mime();
28371
28371
  var ms = require_ms();
28372
28372
  var onFinished = require_on_finished();
28373
28373
  var parseRange = require_range_parser();
28374
- var path22 = require("path");
28374
+ var path23 = require("path");
28375
28375
  var statuses = require_statuses();
28376
28376
  var Stream = require("stream");
28377
28377
  var util3 = require("util");
28378
- var extname3 = path22.extname;
28379
- var join16 = path22.join;
28380
- var normalize = path22.normalize;
28381
- var resolve14 = path22.resolve;
28382
- var sep5 = path22.sep;
28378
+ var extname4 = path23.extname;
28379
+ var join17 = path23.join;
28380
+ var normalize = path23.normalize;
28381
+ var resolve15 = path23.resolve;
28382
+ var sep5 = path23.sep;
28383
28383
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
28384
28384
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
28385
28385
  var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
28386
28386
  module2.exports = send;
28387
28387
  module2.exports.mime = mime;
28388
- function send(req, path23, options) {
28389
- return new SendStream(req, path23, options);
28388
+ function send(req, path24, options) {
28389
+ return new SendStream(req, path24, options);
28390
28390
  }
28391
- function SendStream(req, path23, options) {
28391
+ function SendStream(req, path24, options) {
28392
28392
  Stream.call(this);
28393
28393
  var opts = options || {};
28394
28394
  this.options = opts;
28395
- this.path = path23;
28395
+ this.path = path24;
28396
28396
  this.req = req;
28397
28397
  this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
28398
28398
  this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
@@ -28415,7 +28415,7 @@ var require_send = __commonJS({
28415
28415
  this._maxage = opts.maxAge || opts.maxage;
28416
28416
  this._maxage = typeof this._maxage === "string" ? ms(this._maxage) : Number(this._maxage);
28417
28417
  this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
28418
- this._root = opts.root ? resolve14(opts.root) : null;
28418
+ this._root = opts.root ? resolve15(opts.root) : null;
28419
28419
  if (!this._root && opts.from) {
28420
28420
  this.from(opts.from);
28421
28421
  }
@@ -28438,8 +28438,8 @@ var require_send = __commonJS({
28438
28438
  this._index = index2;
28439
28439
  return this;
28440
28440
  }, "send.index: pass index as option");
28441
- SendStream.prototype.root = function root(path23) {
28442
- this._root = resolve14(String(path23));
28441
+ SendStream.prototype.root = function root(path24) {
28442
+ this._root = resolve15(String(path24));
28443
28443
  debug("root %s", this._root);
28444
28444
  return this;
28445
28445
  };
@@ -28552,10 +28552,10 @@ var require_send = __commonJS({
28552
28552
  var lastModified = this.res.getHeader("Last-Modified");
28553
28553
  return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
28554
28554
  };
28555
- SendStream.prototype.redirect = function redirect(path23) {
28555
+ SendStream.prototype.redirect = function redirect(path24) {
28556
28556
  var res = this.res;
28557
28557
  if (hasListeners(this, "directory")) {
28558
- this.emit("directory", res, path23);
28558
+ this.emit("directory", res, path24);
28559
28559
  return;
28560
28560
  }
28561
28561
  if (this.hasTrailingSlash()) {
@@ -28575,42 +28575,42 @@ var require_send = __commonJS({
28575
28575
  SendStream.prototype.pipe = function pipe2(res) {
28576
28576
  var root = this._root;
28577
28577
  this.res = res;
28578
- var path23 = decode(this.path);
28579
- if (path23 === -1) {
28578
+ var path24 = decode(this.path);
28579
+ if (path24 === -1) {
28580
28580
  this.error(400);
28581
28581
  return res;
28582
28582
  }
28583
- if (~path23.indexOf("\0")) {
28583
+ if (~path24.indexOf("\0")) {
28584
28584
  this.error(400);
28585
28585
  return res;
28586
28586
  }
28587
28587
  var parts;
28588
28588
  if (root !== null) {
28589
- if (path23) {
28590
- path23 = normalize("." + sep5 + path23);
28589
+ if (path24) {
28590
+ path24 = normalize("." + sep5 + path24);
28591
28591
  }
28592
- if (UP_PATH_REGEXP.test(path23)) {
28593
- debug('malicious path "%s"', path23);
28592
+ if (UP_PATH_REGEXP.test(path24)) {
28593
+ debug('malicious path "%s"', path24);
28594
28594
  this.error(403);
28595
28595
  return res;
28596
28596
  }
28597
- parts = path23.split(sep5);
28598
- path23 = normalize(join16(root, path23));
28597
+ parts = path24.split(sep5);
28598
+ path24 = normalize(join17(root, path24));
28599
28599
  } else {
28600
- if (UP_PATH_REGEXP.test(path23)) {
28601
- debug('malicious path "%s"', path23);
28600
+ if (UP_PATH_REGEXP.test(path24)) {
28601
+ debug('malicious path "%s"', path24);
28602
28602
  this.error(403);
28603
28603
  return res;
28604
28604
  }
28605
- parts = normalize(path23).split(sep5);
28606
- path23 = resolve14(path23);
28605
+ parts = normalize(path24).split(sep5);
28606
+ path24 = resolve15(path24);
28607
28607
  }
28608
28608
  if (containsDotFile(parts)) {
28609
28609
  var access = this._dotfiles;
28610
28610
  if (access === void 0) {
28611
28611
  access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
28612
28612
  }
28613
- debug('%s dotfile "%s"', access, path23);
28613
+ debug('%s dotfile "%s"', access, path24);
28614
28614
  switch (access) {
28615
28615
  case "allow":
28616
28616
  break;
@@ -28624,13 +28624,13 @@ var require_send = __commonJS({
28624
28624
  }
28625
28625
  }
28626
28626
  if (this._index.length && this.hasTrailingSlash()) {
28627
- this.sendIndex(path23);
28627
+ this.sendIndex(path24);
28628
28628
  return res;
28629
28629
  }
28630
- this.sendFile(path23);
28630
+ this.sendFile(path24);
28631
28631
  return res;
28632
28632
  };
28633
- SendStream.prototype.send = function send2(path23, stat) {
28633
+ SendStream.prototype.send = function send2(path24, stat) {
28634
28634
  var len = stat.size;
28635
28635
  var options = this.options;
28636
28636
  var opts = {};
@@ -28642,9 +28642,9 @@ var require_send = __commonJS({
28642
28642
  this.headersAlreadySent();
28643
28643
  return;
28644
28644
  }
28645
- debug('pipe "%s"', path23);
28646
- this.setHeader(path23, stat);
28647
- this.type(path23);
28645
+ debug('pipe "%s"', path24);
28646
+ this.setHeader(path24, stat);
28647
+ this.type(path24);
28648
28648
  if (this.isConditionalGET()) {
28649
28649
  if (this.isPreconditionFailure()) {
28650
28650
  this.error(412);
@@ -28693,28 +28693,28 @@ var require_send = __commonJS({
28693
28693
  res.end();
28694
28694
  return;
28695
28695
  }
28696
- this.stream(path23, opts);
28696
+ this.stream(path24, opts);
28697
28697
  };
28698
- SendStream.prototype.sendFile = function sendFile(path23) {
28698
+ SendStream.prototype.sendFile = function sendFile(path24) {
28699
28699
  var i = 0;
28700
28700
  var self2 = this;
28701
- debug('stat "%s"', path23);
28702
- fs23.stat(path23, function onstat(err, stat) {
28703
- if (err && err.code === "ENOENT" && !extname3(path23) && path23[path23.length - 1] !== sep5) {
28701
+ debug('stat "%s"', path24);
28702
+ fs24.stat(path24, function onstat(err, stat) {
28703
+ if (err && err.code === "ENOENT" && !extname4(path24) && path24[path24.length - 1] !== sep5) {
28704
28704
  return next(err);
28705
28705
  }
28706
28706
  if (err) return self2.onStatError(err);
28707
- if (stat.isDirectory()) return self2.redirect(path23);
28708
- self2.emit("file", path23, stat);
28709
- self2.send(path23, stat);
28707
+ if (stat.isDirectory()) return self2.redirect(path24);
28708
+ self2.emit("file", path24, stat);
28709
+ self2.send(path24, stat);
28710
28710
  });
28711
28711
  function next(err) {
28712
28712
  if (self2._extensions.length <= i) {
28713
28713
  return err ? self2.onStatError(err) : self2.error(404);
28714
28714
  }
28715
- var p = path23 + "." + self2._extensions[i++];
28715
+ var p = path24 + "." + self2._extensions[i++];
28716
28716
  debug('stat "%s"', p);
28717
- fs23.stat(p, function(err2, stat) {
28717
+ fs24.stat(p, function(err2, stat) {
28718
28718
  if (err2) return next(err2);
28719
28719
  if (stat.isDirectory()) return next();
28720
28720
  self2.emit("file", p, stat);
@@ -28722,7 +28722,7 @@ var require_send = __commonJS({
28722
28722
  });
28723
28723
  }
28724
28724
  };
28725
- SendStream.prototype.sendIndex = function sendIndex(path23) {
28725
+ SendStream.prototype.sendIndex = function sendIndex(path24) {
28726
28726
  var i = -1;
28727
28727
  var self2 = this;
28728
28728
  function next(err) {
@@ -28730,9 +28730,9 @@ var require_send = __commonJS({
28730
28730
  if (err) return self2.onStatError(err);
28731
28731
  return self2.error(404);
28732
28732
  }
28733
- var p = join16(path23, self2._index[i]);
28733
+ var p = join17(path24, self2._index[i]);
28734
28734
  debug('stat "%s"', p);
28735
- fs23.stat(p, function(err2, stat) {
28735
+ fs24.stat(p, function(err2, stat) {
28736
28736
  if (err2) return next(err2);
28737
28737
  if (stat.isDirectory()) return next();
28738
28738
  self2.emit("file", p, stat);
@@ -28741,10 +28741,10 @@ var require_send = __commonJS({
28741
28741
  }
28742
28742
  next();
28743
28743
  };
28744
- SendStream.prototype.stream = function stream(path23, options) {
28744
+ SendStream.prototype.stream = function stream(path24, options) {
28745
28745
  var self2 = this;
28746
28746
  var res = this.res;
28747
- var stream2 = fs23.createReadStream(path23, options);
28747
+ var stream2 = fs24.createReadStream(path24, options);
28748
28748
  this.emit("stream", stream2);
28749
28749
  stream2.pipe(res);
28750
28750
  function cleanup() {
@@ -28759,10 +28759,10 @@ var require_send = __commonJS({
28759
28759
  self2.emit("end");
28760
28760
  });
28761
28761
  };
28762
- SendStream.prototype.type = function type(path23) {
28762
+ SendStream.prototype.type = function type(path24) {
28763
28763
  var res = this.res;
28764
28764
  if (res.getHeader("Content-Type")) return;
28765
- var type2 = mime.lookup(path23);
28765
+ var type2 = mime.lookup(path24);
28766
28766
  if (!type2) {
28767
28767
  debug("no content-type");
28768
28768
  return;
@@ -28771,9 +28771,9 @@ var require_send = __commonJS({
28771
28771
  debug("content-type %s", type2);
28772
28772
  res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
28773
28773
  };
28774
- SendStream.prototype.setHeader = function setHeader(path23, stat) {
28774
+ SendStream.prototype.setHeader = function setHeader(path24, stat) {
28775
28775
  var res = this.res;
28776
- this.emit("headers", res, path23, stat);
28776
+ this.emit("headers", res, path24, stat);
28777
28777
  if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
28778
28778
  debug("accept ranges");
28779
28779
  res.setHeader("Accept-Ranges", "bytes");
@@ -28832,9 +28832,9 @@ var require_send = __commonJS({
28832
28832
  }
28833
28833
  return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
28834
28834
  }
28835
- function decode(path23) {
28835
+ function decode(path24) {
28836
28836
  try {
28837
- return decodeURIComponent(path23);
28837
+ return decodeURIComponent(path24);
28838
28838
  } catch (err) {
28839
28839
  return -1;
28840
28840
  }
@@ -29744,10 +29744,10 @@ var require_utils2 = __commonJS({
29744
29744
  var querystring = require("querystring");
29745
29745
  exports2.etag = createETagGenerator({ weak: false });
29746
29746
  exports2.wetag = createETagGenerator({ weak: true });
29747
- exports2.isAbsolute = function(path22) {
29748
- if ("/" === path22[0]) return true;
29749
- if (":" === path22[1] && ("\\" === path22[2] || "/" === path22[2])) return true;
29750
- if ("\\\\" === path22.substring(0, 2)) return true;
29747
+ exports2.isAbsolute = function(path23) {
29748
+ if ("/" === path23[0]) return true;
29749
+ if (":" === path23[1] && ("\\" === path23[2] || "/" === path23[2])) return true;
29750
+ if ("\\\\" === path23.substring(0, 2)) return true;
29751
29751
  };
29752
29752
  exports2.flatten = deprecate.function(
29753
29753
  flatten,
@@ -29883,7 +29883,7 @@ var require_application = __commonJS({
29883
29883
  var deprecate = require_depd()("express");
29884
29884
  var flatten = require_array_flatten();
29885
29885
  var merge2 = require_utils_merge();
29886
- var resolve14 = require("path").resolve;
29886
+ var resolve15 = require("path").resolve;
29887
29887
  var setPrototypeOf = require_setprototypeof();
29888
29888
  var hasOwnProperty = Object.prototype.hasOwnProperty;
29889
29889
  var slice = Array.prototype.slice;
@@ -29922,7 +29922,7 @@ var require_application = __commonJS({
29922
29922
  this.mountpath = "/";
29923
29923
  this.locals.settings = this.settings;
29924
29924
  this.set("view", View);
29925
- this.set("views", resolve14("views"));
29925
+ this.set("views", resolve15("views"));
29926
29926
  this.set("jsonp callback name", "callback");
29927
29927
  if (env === "production") {
29928
29928
  this.enable("view cache");
@@ -29958,7 +29958,7 @@ var require_application = __commonJS({
29958
29958
  };
29959
29959
  app.use = function use(fn) {
29960
29960
  var offset = 0;
29961
- var path22 = "/";
29961
+ var path23 = "/";
29962
29962
  if (typeof fn !== "function") {
29963
29963
  var arg = fn;
29964
29964
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -29966,7 +29966,7 @@ var require_application = __commonJS({
29966
29966
  }
29967
29967
  if (typeof arg !== "function") {
29968
29968
  offset = 1;
29969
- path22 = fn;
29969
+ path23 = fn;
29970
29970
  }
29971
29971
  }
29972
29972
  var fns = flatten(slice.call(arguments, offset));
@@ -29977,12 +29977,12 @@ var require_application = __commonJS({
29977
29977
  var router = this._router;
29978
29978
  fns.forEach(function(fn2) {
29979
29979
  if (!fn2 || !fn2.handle || !fn2.set) {
29980
- return router.use(path22, fn2);
29980
+ return router.use(path23, fn2);
29981
29981
  }
29982
- debug(".use app under %s", path22);
29983
- fn2.mountpath = path22;
29982
+ debug(".use app under %s", path23);
29983
+ fn2.mountpath = path23;
29984
29984
  fn2.parent = this;
29985
- router.use(path22, function mounted_app(req, res, next) {
29985
+ router.use(path23, function mounted_app(req, res, next) {
29986
29986
  var orig = req.app;
29987
29987
  fn2.handle(req, res, function(err) {
29988
29988
  setPrototypeOf(req, orig.request);
@@ -29994,9 +29994,9 @@ var require_application = __commonJS({
29994
29994
  }, this);
29995
29995
  return this;
29996
29996
  };
29997
- app.route = function route(path22) {
29997
+ app.route = function route(path23) {
29998
29998
  this.lazyrouter();
29999
- return this._router.route(path22);
29999
+ return this._router.route(path23);
30000
30000
  };
30001
30001
  app.engine = function engine(ext, fn) {
30002
30002
  if (typeof fn !== "function") {
@@ -30047,7 +30047,7 @@ var require_application = __commonJS({
30047
30047
  }
30048
30048
  return this;
30049
30049
  };
30050
- app.path = function path22() {
30050
+ app.path = function path23() {
30051
30051
  return this.parent ? this.parent.path() + this.mountpath : "";
30052
30052
  };
30053
30053
  app.enabled = function enabled2(setting) {
@@ -30063,19 +30063,19 @@ var require_application = __commonJS({
30063
30063
  return this.set(setting, false);
30064
30064
  };
30065
30065
  methods.forEach(function(method) {
30066
- app[method] = function(path22) {
30066
+ app[method] = function(path23) {
30067
30067
  if (method === "get" && arguments.length === 1) {
30068
- return this.set(path22);
30068
+ return this.set(path23);
30069
30069
  }
30070
30070
  this.lazyrouter();
30071
- var route = this._router.route(path22);
30071
+ var route = this._router.route(path23);
30072
30072
  route[method].apply(route, slice.call(arguments, 1));
30073
30073
  return this;
30074
30074
  };
30075
30075
  });
30076
- app.all = function all(path22) {
30076
+ app.all = function all(path23) {
30077
30077
  this.lazyrouter();
30078
- var route = this._router.route(path22);
30078
+ var route = this._router.route(path23);
30079
30079
  var args = slice.call(arguments, 1);
30080
30080
  for (var i = 0; i < methods.length; i++) {
30081
30081
  route[methods[i]].apply(route, args);
@@ -30834,7 +30834,7 @@ var require_request = __commonJS({
30834
30834
  var subdomains2 = !isIP(hostname4) ? hostname4.split(".").reverse() : [hostname4];
30835
30835
  return subdomains2.slice(offset);
30836
30836
  });
30837
- defineGetter(req, "path", function path22() {
30837
+ defineGetter(req, "path", function path23() {
30838
30838
  return parse3(this).pathname;
30839
30839
  });
30840
30840
  defineGetter(req, "hostname", function hostname4() {
@@ -31157,7 +31157,7 @@ var require_response = __commonJS({
31157
31157
  var http3 = require("http");
31158
31158
  var isAbsolute5 = require_utils2().isAbsolute;
31159
31159
  var onFinished = require_on_finished();
31160
- var path22 = require("path");
31160
+ var path23 = require("path");
31161
31161
  var statuses = require_statuses();
31162
31162
  var merge2 = require_utils_merge();
31163
31163
  var sign = require_cookie_signature().sign;
@@ -31166,9 +31166,9 @@ var require_response = __commonJS({
31166
31166
  var setCharset = require_utils2().setCharset;
31167
31167
  var cookie = require_cookie();
31168
31168
  var send = require_send();
31169
- var extname3 = path22.extname;
31169
+ var extname4 = path23.extname;
31170
31170
  var mime = send.mime;
31171
- var resolve14 = path22.resolve;
31171
+ var resolve15 = path23.resolve;
31172
31172
  var vary = require_vary();
31173
31173
  var res = Object.create(http3.ServerResponse.prototype);
31174
31174
  module2.exports = res;
@@ -31345,26 +31345,26 @@ var require_response = __commonJS({
31345
31345
  this.type("txt");
31346
31346
  return this.send(body);
31347
31347
  };
31348
- res.sendFile = function sendFile(path23, options, callback) {
31348
+ res.sendFile = function sendFile(path24, options, callback) {
31349
31349
  var done = callback;
31350
31350
  var req = this.req;
31351
31351
  var res2 = this;
31352
31352
  var next = req.next;
31353
31353
  var opts = options || {};
31354
- if (!path23) {
31354
+ if (!path24) {
31355
31355
  throw new TypeError("path argument is required to res.sendFile");
31356
31356
  }
31357
- if (typeof path23 !== "string") {
31357
+ if (typeof path24 !== "string") {
31358
31358
  throw new TypeError("path must be a string to res.sendFile");
31359
31359
  }
31360
31360
  if (typeof options === "function") {
31361
31361
  done = options;
31362
31362
  opts = {};
31363
31363
  }
31364
- if (!opts.root && !isAbsolute5(path23)) {
31364
+ if (!opts.root && !isAbsolute5(path24)) {
31365
31365
  throw new TypeError("path must be absolute or specify root to res.sendFile");
31366
31366
  }
31367
- var pathname = encodeURI(path23);
31367
+ var pathname = encodeURI(path24);
31368
31368
  var file = send(req, pathname, opts);
31369
31369
  sendfile(res2, file, opts, function(err) {
31370
31370
  if (done) return done(err);
@@ -31374,7 +31374,7 @@ var require_response = __commonJS({
31374
31374
  }
31375
31375
  });
31376
31376
  };
31377
- res.sendfile = function(path23, options, callback) {
31377
+ res.sendfile = function(path24, options, callback) {
31378
31378
  var done = callback;
31379
31379
  var req = this.req;
31380
31380
  var res2 = this;
@@ -31384,7 +31384,7 @@ var require_response = __commonJS({
31384
31384
  done = options;
31385
31385
  opts = {};
31386
31386
  }
31387
- var file = send(req, path23, opts);
31387
+ var file = send(req, path24, opts);
31388
31388
  sendfile(res2, file, opts, function(err) {
31389
31389
  if (done) return done(err);
31390
31390
  if (err && err.code === "EISDIR") return next();
@@ -31397,7 +31397,7 @@ var require_response = __commonJS({
31397
31397
  res.sendfile,
31398
31398
  "res.sendfile: Use res.sendFile instead"
31399
31399
  );
31400
- res.download = function download(path23, filename, options, callback) {
31400
+ res.download = function download(path24, filename, options, callback) {
31401
31401
  var done = callback;
31402
31402
  var name2 = filename;
31403
31403
  var opts = options || null;
@@ -31414,7 +31414,7 @@ var require_response = __commonJS({
31414
31414
  opts = filename;
31415
31415
  }
31416
31416
  var headers = {
31417
- "Content-Disposition": contentDisposition(name2 || path23)
31417
+ "Content-Disposition": contentDisposition(name2 || path24)
31418
31418
  };
31419
31419
  if (opts && opts.headers) {
31420
31420
  var keys = Object.keys(opts.headers);
@@ -31427,7 +31427,7 @@ var require_response = __commonJS({
31427
31427
  }
31428
31428
  opts = Object.create(opts);
31429
31429
  opts.headers = headers;
31430
- var fullPath = !opts.root ? resolve14(path23) : path23;
31430
+ var fullPath = !opts.root ? resolve15(path24) : path24;
31431
31431
  return this.sendFile(fullPath, opts, done);
31432
31432
  };
31433
31433
  res.contentType = res.type = function contentType(type) {
@@ -31458,7 +31458,7 @@ var require_response = __commonJS({
31458
31458
  };
31459
31459
  res.attachment = function attachment(filename) {
31460
31460
  if (filename) {
31461
- this.type(extname3(filename));
31461
+ this.type(extname4(filename));
31462
31462
  }
31463
31463
  this.set("Content-Disposition", contentDisposition(filename));
31464
31464
  return this;
@@ -31693,7 +31693,7 @@ var require_serve_static = __commonJS({
31693
31693
  var encodeUrl = require_encodeurl();
31694
31694
  var escapeHtml2 = require_escape_html();
31695
31695
  var parseUrl = require_parseurl();
31696
- var resolve14 = require("path").resolve;
31696
+ var resolve15 = require("path").resolve;
31697
31697
  var send = require_send();
31698
31698
  var url = require("url");
31699
31699
  module2.exports = serveStatic;
@@ -31713,7 +31713,7 @@ var require_serve_static = __commonJS({
31713
31713
  throw new TypeError("option setHeaders must be function");
31714
31714
  }
31715
31715
  opts.maxage = opts.maxage || opts.maxAge || 0;
31716
- opts.root = resolve14(root);
31716
+ opts.root = resolve15(root);
31717
31717
  var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
31718
31718
  return function serveStatic2(req, res, next) {
31719
31719
  if (req.method !== "GET" && req.method !== "HEAD") {
@@ -31728,11 +31728,11 @@ var require_serve_static = __commonJS({
31728
31728
  }
31729
31729
  var forwardError = !fallthrough;
31730
31730
  var originalUrl = parseUrl.original(req);
31731
- var path22 = parseUrl(req).pathname;
31732
- if (path22 === "/" && originalUrl.pathname.substr(-1) !== "/") {
31733
- path22 = "";
31731
+ var path23 = parseUrl(req).pathname;
31732
+ if (path23 === "/" && originalUrl.pathname.substr(-1) !== "/") {
31733
+ path23 = "";
31734
31734
  }
31735
- var stream = send(req, path22, opts);
31735
+ var stream = send(req, path23, opts);
31736
31736
  stream.on("directory", onDirectory);
31737
31737
  if (setHeaders) {
31738
31738
  stream.on("headers", setHeaders);
@@ -32069,10 +32069,10 @@ function assignProp(target, prop, value) {
32069
32069
  configurable: true
32070
32070
  });
32071
32071
  }
32072
- function getElementAtPath(obj, path22) {
32073
- if (!path22)
32072
+ function getElementAtPath(obj, path23) {
32073
+ if (!path23)
32074
32074
  return obj;
32075
- return path22.reduce((acc, key) => acc?.[key], obj);
32075
+ return path23.reduce((acc, key) => acc?.[key], obj);
32076
32076
  }
32077
32077
  function promiseAllObject(promisesObj) {
32078
32078
  const keys = Object.keys(promisesObj);
@@ -32321,11 +32321,11 @@ function aborted(x, startIndex = 0) {
32321
32321
  }
32322
32322
  return false;
32323
32323
  }
32324
- function prefixIssues(path22, issues) {
32324
+ function prefixIssues(path23, issues) {
32325
32325
  return issues.map((iss) => {
32326
32326
  var _a;
32327
32327
  (_a = iss).path ?? (_a.path = []);
32328
- iss.path.unshift(path22);
32328
+ iss.path.unshift(path23);
32329
32329
  return iss;
32330
32330
  });
32331
32331
  }
@@ -38438,7 +38438,7 @@ var init_protocol = __esm({
38438
38438
  return;
38439
38439
  }
38440
38440
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
38441
- await new Promise((resolve14) => setTimeout(resolve14, pollInterval));
38441
+ await new Promise((resolve15) => setTimeout(resolve15, pollInterval));
38442
38442
  options?.signal?.throwIfAborted();
38443
38443
  }
38444
38444
  } catch (error2) {
@@ -38455,7 +38455,7 @@ var init_protocol = __esm({
38455
38455
  */
38456
38456
  request(request, resultSchema, options) {
38457
38457
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
38458
- return new Promise((resolve14, reject) => {
38458
+ return new Promise((resolve15, reject) => {
38459
38459
  const earlyReject = (error2) => {
38460
38460
  reject(error2);
38461
38461
  };
@@ -38533,7 +38533,7 @@ var init_protocol = __esm({
38533
38533
  if (!parseResult.success) {
38534
38534
  reject(parseResult.error);
38535
38535
  } else {
38536
- resolve14(parseResult.data);
38536
+ resolve15(parseResult.data);
38537
38537
  }
38538
38538
  } catch (error2) {
38539
38539
  reject(error2);
@@ -38794,12 +38794,12 @@ var init_protocol = __esm({
38794
38794
  }
38795
38795
  } catch {
38796
38796
  }
38797
- return new Promise((resolve14, reject) => {
38797
+ return new Promise((resolve15, reject) => {
38798
38798
  if (signal.aborted) {
38799
38799
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
38800
38800
  return;
38801
38801
  }
38802
- const timeoutId = setTimeout(resolve14, interval);
38802
+ const timeoutId = setTimeout(resolve15, interval);
38803
38803
  signal.addEventListener("abort", () => {
38804
38804
  clearTimeout(timeoutId);
38805
38805
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -41826,7 +41826,7 @@ var require_compile = __commonJS({
41826
41826
  const schOrFunc = root.refs[ref];
41827
41827
  if (schOrFunc)
41828
41828
  return schOrFunc;
41829
- let _sch = resolve14.call(this, root, ref);
41829
+ let _sch = resolve15.call(this, root, ref);
41830
41830
  if (_sch === void 0) {
41831
41831
  const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
41832
41832
  const { schemaId } = this.opts;
@@ -41853,7 +41853,7 @@ var require_compile = __commonJS({
41853
41853
  function sameSchemaEnv(s1, s2) {
41854
41854
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
41855
41855
  }
41856
- function resolve14(root, ref) {
41856
+ function resolve15(root, ref) {
41857
41857
  let sch;
41858
41858
  while (typeof (sch = this.refs[ref]) == "string")
41859
41859
  ref = sch;
@@ -42071,8 +42071,8 @@ var require_utils3 = __commonJS({
42071
42071
  }
42072
42072
  return ind;
42073
42073
  }
42074
- function removeDotSegments(path22) {
42075
- let input = path22;
42074
+ function removeDotSegments(path23) {
42075
+ let input = path23;
42076
42076
  const output = [];
42077
42077
  let nextSlash = -1;
42078
42078
  let len = 0;
@@ -42324,8 +42324,8 @@ var require_schemes = __commonJS({
42324
42324
  wsComponent.secure = void 0;
42325
42325
  }
42326
42326
  if (wsComponent.resourceName) {
42327
- const [path22, query] = wsComponent.resourceName.split("?");
42328
- wsComponent.path = path22 && path22 !== "/" ? path22 : void 0;
42327
+ const [path23, query] = wsComponent.resourceName.split("?");
42328
+ wsComponent.path = path23 && path23 !== "/" ? path23 : void 0;
42329
42329
  wsComponent.query = query;
42330
42330
  wsComponent.resourceName = void 0;
42331
42331
  }
@@ -42484,7 +42484,7 @@ var require_fast_uri = __commonJS({
42484
42484
  }
42485
42485
  return uri;
42486
42486
  }
42487
- function resolve14(baseURI, relativeURI, options) {
42487
+ function resolve15(baseURI, relativeURI, options) {
42488
42488
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
42489
42489
  const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
42490
42490
  schemelessOptions.skipEscape = true;
@@ -42742,7 +42742,7 @@ var require_fast_uri = __commonJS({
42742
42742
  var fastUri = {
42743
42743
  SCHEMES,
42744
42744
  normalize,
42745
- resolve: resolve14,
42745
+ resolve: resolve15,
42746
42746
  resolveComponent,
42747
42747
  equal,
42748
42748
  serialize,
@@ -45718,12 +45718,12 @@ var require_dist4 = __commonJS({
45718
45718
  throw new Error(`Unknown format "${name2}"`);
45719
45719
  return f;
45720
45720
  };
45721
- function addFormats(ajv, list, fs23, exportName) {
45721
+ function addFormats(ajv, list, fs24, exportName) {
45722
45722
  var _a;
45723
45723
  var _b;
45724
45724
  (_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
45725
45725
  for (const f of list)
45726
- ajv.addFormat(f, fs23[f]);
45726
+ ajv.addFormat(f, fs24[f]);
45727
45727
  }
45728
45728
  module2.exports = exports2 = formatsPlugin;
45729
45729
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -46549,8 +46549,8 @@ var require_windows = __commonJS({
46549
46549
  "use strict";
46550
46550
  module2.exports = isexe;
46551
46551
  isexe.sync = sync;
46552
- var fs23 = require("fs");
46553
- function checkPathExt(path22, options) {
46552
+ var fs24 = require("fs");
46553
+ function checkPathExt(path23, options) {
46554
46554
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
46555
46555
  if (!pathext) {
46556
46556
  return true;
@@ -46561,25 +46561,25 @@ var require_windows = __commonJS({
46561
46561
  }
46562
46562
  for (var i = 0; i < pathext.length; i++) {
46563
46563
  var p = pathext[i].toLowerCase();
46564
- if (p && path22.substr(-p.length).toLowerCase() === p) {
46564
+ if (p && path23.substr(-p.length).toLowerCase() === p) {
46565
46565
  return true;
46566
46566
  }
46567
46567
  }
46568
46568
  return false;
46569
46569
  }
46570
- function checkStat(stat, path22, options) {
46570
+ function checkStat(stat, path23, options) {
46571
46571
  if (!stat.isSymbolicLink() && !stat.isFile()) {
46572
46572
  return false;
46573
46573
  }
46574
- return checkPathExt(path22, options);
46574
+ return checkPathExt(path23, options);
46575
46575
  }
46576
- function isexe(path22, options, cb) {
46577
- fs23.stat(path22, function(er, stat) {
46578
- cb(er, er ? false : checkStat(stat, path22, options));
46576
+ function isexe(path23, options, cb) {
46577
+ fs24.stat(path23, function(er, stat) {
46578
+ cb(er, er ? false : checkStat(stat, path23, options));
46579
46579
  });
46580
46580
  }
46581
- function sync(path22, options) {
46582
- return checkStat(fs23.statSync(path22), path22, options);
46581
+ function sync(path23, options) {
46582
+ return checkStat(fs24.statSync(path23), path23, options);
46583
46583
  }
46584
46584
  }
46585
46585
  });
@@ -46590,14 +46590,14 @@ var require_mode = __commonJS({
46590
46590
  "use strict";
46591
46591
  module2.exports = isexe;
46592
46592
  isexe.sync = sync;
46593
- var fs23 = require("fs");
46594
- function isexe(path22, options, cb) {
46595
- fs23.stat(path22, function(er, stat) {
46593
+ var fs24 = require("fs");
46594
+ function isexe(path23, options, cb) {
46595
+ fs24.stat(path23, function(er, stat) {
46596
46596
  cb(er, er ? false : checkStat(stat, options));
46597
46597
  });
46598
46598
  }
46599
- function sync(path22, options) {
46600
- return checkStat(fs23.statSync(path22), options);
46599
+ function sync(path23, options) {
46600
+ return checkStat(fs24.statSync(path23), options);
46601
46601
  }
46602
46602
  function checkStat(stat, options) {
46603
46603
  return stat.isFile() && checkMode(stat, options);
@@ -46622,7 +46622,7 @@ var require_mode = __commonJS({
46622
46622
  var require_isexe = __commonJS({
46623
46623
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports2, module2) {
46624
46624
  "use strict";
46625
- var fs23 = require("fs");
46625
+ var fs24 = require("fs");
46626
46626
  var core;
46627
46627
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
46628
46628
  core = require_windows();
@@ -46631,7 +46631,7 @@ var require_isexe = __commonJS({
46631
46631
  }
46632
46632
  module2.exports = isexe;
46633
46633
  isexe.sync = sync;
46634
- function isexe(path22, options, cb) {
46634
+ function isexe(path23, options, cb) {
46635
46635
  if (typeof options === "function") {
46636
46636
  cb = options;
46637
46637
  options = {};
@@ -46640,17 +46640,17 @@ var require_isexe = __commonJS({
46640
46640
  if (typeof Promise !== "function") {
46641
46641
  throw new TypeError("callback not provided");
46642
46642
  }
46643
- return new Promise(function(resolve14, reject) {
46644
- isexe(path22, options || {}, function(er, is) {
46643
+ return new Promise(function(resolve15, reject) {
46644
+ isexe(path23, options || {}, function(er, is) {
46645
46645
  if (er) {
46646
46646
  reject(er);
46647
46647
  } else {
46648
- resolve14(is);
46648
+ resolve15(is);
46649
46649
  }
46650
46650
  });
46651
46651
  });
46652
46652
  }
46653
- core(path22, options || {}, function(er, is) {
46653
+ core(path23, options || {}, function(er, is) {
46654
46654
  if (er) {
46655
46655
  if (er.code === "EACCES" || options && options.ignoreErrors) {
46656
46656
  er = null;
@@ -46660,9 +46660,9 @@ var require_isexe = __commonJS({
46660
46660
  cb(er, is);
46661
46661
  });
46662
46662
  }
46663
- function sync(path22, options) {
46663
+ function sync(path23, options) {
46664
46664
  try {
46665
- return core.sync(path22, options || {});
46665
+ return core.sync(path23, options || {});
46666
46666
  } catch (er) {
46667
46667
  if (options && options.ignoreErrors || er.code === "EACCES") {
46668
46668
  return false;
@@ -46679,7 +46679,7 @@ var require_which = __commonJS({
46679
46679
  "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports2, module2) {
46680
46680
  "use strict";
46681
46681
  var isWindows2 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
46682
- var path22 = require("path");
46682
+ var path23 = require("path");
46683
46683
  var COLON = isWindows2 ? ";" : ":";
46684
46684
  var isexe = require_isexe();
46685
46685
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -46712,27 +46712,27 @@ var require_which = __commonJS({
46712
46712
  opt = {};
46713
46713
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
46714
46714
  const found = [];
46715
- const step = (i) => new Promise((resolve14, reject) => {
46715
+ const step = (i) => new Promise((resolve15, reject) => {
46716
46716
  if (i === pathEnv.length)
46717
- return opt.all && found.length ? resolve14(found) : reject(getNotFoundError(cmd));
46717
+ return opt.all && found.length ? resolve15(found) : reject(getNotFoundError(cmd));
46718
46718
  const ppRaw = pathEnv[i];
46719
46719
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
46720
- const pCmd = path22.join(pathPart, cmd);
46720
+ const pCmd = path23.join(pathPart, cmd);
46721
46721
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
46722
- resolve14(subStep(p, i, 0));
46722
+ resolve15(subStep(p, i, 0));
46723
46723
  });
46724
- const subStep = (p, i, ii) => new Promise((resolve14, reject) => {
46724
+ const subStep = (p, i, ii) => new Promise((resolve15, reject) => {
46725
46725
  if (ii === pathExt.length)
46726
- return resolve14(step(i + 1));
46726
+ return resolve15(step(i + 1));
46727
46727
  const ext = pathExt[ii];
46728
46728
  isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
46729
46729
  if (!er && is) {
46730
46730
  if (opt.all)
46731
46731
  found.push(p + ext);
46732
46732
  else
46733
- return resolve14(p + ext);
46733
+ return resolve15(p + ext);
46734
46734
  }
46735
- return resolve14(subStep(p, i, ii + 1));
46735
+ return resolve15(subStep(p, i, ii + 1));
46736
46736
  });
46737
46737
  });
46738
46738
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -46744,7 +46744,7 @@ var require_which = __commonJS({
46744
46744
  for (let i = 0; i < pathEnv.length; i++) {
46745
46745
  const ppRaw = pathEnv[i];
46746
46746
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
46747
- const pCmd = path22.join(pathPart, cmd);
46747
+ const pCmd = path23.join(pathPart, cmd);
46748
46748
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
46749
46749
  for (let j = 0; j < pathExt.length; j++) {
46750
46750
  const cur = p + pathExt[j];
@@ -46792,7 +46792,7 @@ var require_path_key = __commonJS({
46792
46792
  var require_resolveCommand = __commonJS({
46793
46793
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
46794
46794
  "use strict";
46795
- var path22 = require("path");
46795
+ var path23 = require("path");
46796
46796
  var which = require_which();
46797
46797
  var getPathKey = require_path_key();
46798
46798
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -46810,7 +46810,7 @@ var require_resolveCommand = __commonJS({
46810
46810
  try {
46811
46811
  resolved = which.sync(parsed.command, {
46812
46812
  path: env[getPathKey({ env })],
46813
- pathExt: withoutPathExt ? path22.delimiter : void 0
46813
+ pathExt: withoutPathExt ? path23.delimiter : void 0
46814
46814
  });
46815
46815
  } catch (e) {
46816
46816
  } finally {
@@ -46819,7 +46819,7 @@ var require_resolveCommand = __commonJS({
46819
46819
  }
46820
46820
  }
46821
46821
  if (resolved) {
46822
- resolved = path22.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
46822
+ resolved = path23.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
46823
46823
  }
46824
46824
  return resolved;
46825
46825
  }
@@ -46873,8 +46873,8 @@ var require_shebang_command = __commonJS({
46873
46873
  if (!match) {
46874
46874
  return null;
46875
46875
  }
46876
- const [path22, argument] = match[0].replace(/#! ?/, "").split(" ");
46877
- const binary = path22.split("/").pop();
46876
+ const [path23, argument] = match[0].replace(/#! ?/, "").split(" ");
46877
+ const binary = path23.split("/").pop();
46878
46878
  if (binary === "env") {
46879
46879
  return argument;
46880
46880
  }
@@ -46887,16 +46887,16 @@ var require_shebang_command = __commonJS({
46887
46887
  var require_readShebang = __commonJS({
46888
46888
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
46889
46889
  "use strict";
46890
- var fs23 = require("fs");
46890
+ var fs24 = require("fs");
46891
46891
  var shebangCommand = require_shebang_command();
46892
46892
  function readShebang(command) {
46893
46893
  const size = 150;
46894
46894
  const buffer = Buffer.alloc(size);
46895
46895
  let fd;
46896
46896
  try {
46897
- fd = fs23.openSync(command, "r");
46898
- fs23.readSync(fd, buffer, 0, size, 0);
46899
- fs23.closeSync(fd);
46897
+ fd = fs24.openSync(command, "r");
46898
+ fs24.readSync(fd, buffer, 0, size, 0);
46899
+ fs24.closeSync(fd);
46900
46900
  } catch (e) {
46901
46901
  }
46902
46902
  return shebangCommand(buffer.toString());
@@ -46909,7 +46909,7 @@ var require_readShebang = __commonJS({
46909
46909
  var require_parse3 = __commonJS({
46910
46910
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
46911
46911
  "use strict";
46912
- var path22 = require("path");
46912
+ var path23 = require("path");
46913
46913
  var resolveCommand = require_resolveCommand();
46914
46914
  var escape2 = require_escape();
46915
46915
  var readShebang = require_readShebang();
@@ -46934,7 +46934,7 @@ var require_parse3 = __commonJS({
46934
46934
  const needsShell = !isExecutableRegExp.test(commandFile);
46935
46935
  if (parsed.options.forceShell || needsShell) {
46936
46936
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
46937
- parsed.command = path22.normalize(parsed.command);
46937
+ parsed.command = path23.normalize(parsed.command);
46938
46938
  parsed.command = escape2.command(parsed.command);
46939
46939
  parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
46940
46940
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -47024,7 +47024,7 @@ var require_cross_spawn = __commonJS({
47024
47024
  var cp = require("child_process");
47025
47025
  var parse3 = require_parse3();
47026
47026
  var enoent = require_enoent();
47027
- function spawn8(command, args, options) {
47027
+ function spawn9(command, args, options) {
47028
47028
  const parsed = parse3(command, args, options);
47029
47029
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
47030
47030
  enoent.hookChildProcess(spawned, parsed);
@@ -47036,8 +47036,8 @@ var require_cross_spawn = __commonJS({
47036
47036
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
47037
47037
  return result;
47038
47038
  }
47039
- module2.exports = spawn8;
47040
- module2.exports.spawn = spawn8;
47039
+ module2.exports = spawn9;
47040
+ module2.exports.spawn = spawn9;
47041
47041
  module2.exports.sync = spawnSync5;
47042
47042
  module2.exports._parse = parse3;
47043
47043
  module2.exports._enoent = enoent;
@@ -47141,7 +47141,7 @@ var init_stdio2 = __esm({
47141
47141
  if (this._process) {
47142
47142
  throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");
47143
47143
  }
47144
- return new Promise((resolve14, reject) => {
47144
+ return new Promise((resolve15, reject) => {
47145
47145
  this._process = (0, import_cross_spawn.default)(this._serverParams.command, this._serverParams.args ?? [], {
47146
47146
  // merge default env with server env because mcp server needs some env vars
47147
47147
  env: {
@@ -47158,7 +47158,7 @@ var init_stdio2 = __esm({
47158
47158
  this.onerror?.(error2);
47159
47159
  });
47160
47160
  this._process.on("spawn", () => {
47161
- resolve14();
47161
+ resolve15();
47162
47162
  });
47163
47163
  this._process.on("close", (_code) => {
47164
47164
  this._process = void 0;
@@ -47217,22 +47217,22 @@ var init_stdio2 = __esm({
47217
47217
  if (this._process) {
47218
47218
  const processToClose = this._process;
47219
47219
  this._process = void 0;
47220
- const closePromise = new Promise((resolve14) => {
47220
+ const closePromise = new Promise((resolve15) => {
47221
47221
  processToClose.once("close", () => {
47222
- resolve14();
47222
+ resolve15();
47223
47223
  });
47224
47224
  });
47225
47225
  try {
47226
47226
  processToClose.stdin?.end();
47227
47227
  } catch {
47228
47228
  }
47229
- await Promise.race([closePromise, new Promise((resolve14) => setTimeout(resolve14, 2e3).unref())]);
47229
+ await Promise.race([closePromise, new Promise((resolve15) => setTimeout(resolve15, 2e3).unref())]);
47230
47230
  if (processToClose.exitCode === null) {
47231
47231
  try {
47232
47232
  processToClose.kill("SIGTERM");
47233
47233
  } catch {
47234
47234
  }
47235
- await Promise.race([closePromise, new Promise((resolve14) => setTimeout(resolve14, 2e3).unref())]);
47235
+ await Promise.race([closePromise, new Promise((resolve15) => setTimeout(resolve15, 2e3).unref())]);
47236
47236
  }
47237
47237
  if (processToClose.exitCode === null) {
47238
47238
  try {
@@ -47244,15 +47244,15 @@ var init_stdio2 = __esm({
47244
47244
  this._readBuffer.clear();
47245
47245
  }
47246
47246
  send(message) {
47247
- return new Promise((resolve14) => {
47247
+ return new Promise((resolve15) => {
47248
47248
  if (!this._process?.stdin) {
47249
47249
  throw new Error("Not connected");
47250
47250
  }
47251
47251
  const json = serializeMessage(message);
47252
47252
  if (this._process.stdin.write(json)) {
47253
- resolve14();
47253
+ resolve15();
47254
47254
  } else {
47255
- this._process.stdin.once("drain", resolve14);
47255
+ this._process.stdin.once("drain", resolve15);
47256
47256
  }
47257
47257
  });
47258
47258
  }
@@ -48064,7 +48064,7 @@ async function closeHttpServer(server, options = {}) {
48064
48064
  return;
48065
48065
  }
48066
48066
  const forceAfterMs = options.forceAfterMs ?? 1e3;
48067
- await new Promise((resolve14, reject) => {
48067
+ await new Promise((resolve15, reject) => {
48068
48068
  const forceTimer = setTimeout(() => {
48069
48069
  server.closeAllConnections?.();
48070
48070
  server.closeIdleConnections?.();
@@ -48076,7 +48076,7 @@ async function closeHttpServer(server, options = {}) {
48076
48076
  reject(err);
48077
48077
  return;
48078
48078
  }
48079
- resolve14();
48079
+ resolve15();
48080
48080
  });
48081
48081
  server.closeIdleConnections?.();
48082
48082
  });
@@ -50117,7 +50117,7 @@ function wasClockTurnedBack(cachedAt) {
50117
50117
  return cachedAtSec > nowSeconds();
50118
50118
  }
50119
50119
  function delay(t, value) {
50120
- return new Promise((resolve14) => setTimeout(() => resolve14(value), t));
50120
+ return new Promise((resolve15) => setTimeout(() => resolve15(value), t));
50121
50121
  }
50122
50122
 
50123
50123
  // ../../node_modules/.pnpm/@azure+msal-common@16.5.0/node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.mjs
@@ -51611,7 +51611,7 @@ var developerCliCredentialInternals = {
51611
51611
  const encodedClaims = btoa(claims);
51612
51612
  claimsSections = ["--claims", encodedClaims];
51613
51613
  }
51614
- return new Promise((resolve14, reject) => {
51614
+ return new Promise((resolve15, reject) => {
51615
51615
  try {
51616
51616
  const args = [
51617
51617
  "auth",
@@ -51628,7 +51628,7 @@ var developerCliCredentialInternals = {
51628
51628
  cwd: developerCliCredentialInternals.getSafeWorkingDir(),
51629
51629
  timeout
51630
51630
  }, (error2, stdout, stderr) => {
51631
- resolve14({ stdout, stderr, error: error2 });
51631
+ resolve15({ stdout, stderr, error: error2 });
51632
51632
  });
51633
51633
  } catch (err) {
51634
51634
  reject(err);
@@ -51776,7 +51776,7 @@ var cliCredentialInternals = {
51776
51776
  if (subscription) {
51777
51777
  subscriptionSection = ["--subscription", `"${subscription}"`];
51778
51778
  }
51779
- return new Promise((resolve14, reject) => {
51779
+ return new Promise((resolve15, reject) => {
51780
51780
  try {
51781
51781
  const args = [
51782
51782
  "account",
@@ -51790,7 +51790,7 @@ var cliCredentialInternals = {
51790
51790
  ];
51791
51791
  const command = ["az", ...args].join(" ");
51792
51792
  import_child_process2.default.exec(command, { cwd: cliCredentialInternals.getSafeWorkingDir(), timeout }, (error2, stdout, stderr) => {
51793
- resolve14({ stdout, stderr, error: error2 });
51793
+ resolve15({ stdout, stderr, error: error2 });
51794
51794
  });
51795
51795
  } catch (err) {
51796
51796
  reject(err);
@@ -51931,7 +51931,7 @@ var processUtils = {
51931
51931
  * @internal
51932
51932
  */
51933
51933
  execFile(file, params, options) {
51934
- return new Promise((resolve14, reject) => {
51934
+ return new Promise((resolve15, reject) => {
51935
51935
  import_node_child_process.default.execFile(file, params, options, (error2, stdout, stderr) => {
51936
51936
  if (Buffer.isBuffer(stdout)) {
51937
51937
  stdout = stdout.toString("utf8");
@@ -51942,7 +51942,7 @@ var processUtils = {
51942
51942
  if (stderr || error2) {
51943
51943
  reject(stderr ? new Error(stderr) : error2);
51944
51944
  } else {
51945
- resolve14(stdout);
51945
+ resolve15(stdout);
51946
51946
  }
51947
51947
  });
51948
51948
  });
@@ -52367,11 +52367,11 @@ function persistNodeStartupTransport(storagePath, transport) {
52367
52367
  transport
52368
52368
  });
52369
52369
  }
52370
- function persistNodeStartupJoin(storagePath, join16) {
52370
+ function persistNodeStartupJoin(storagePath, join17) {
52371
52371
  const startup = resolveNodeStartupMetadata(storagePath);
52372
52372
  persistNodeStartupMetadata(storagePath, {
52373
52373
  ...startup,
52374
- join: join16
52374
+ join: join17
52375
52375
  });
52376
52376
  }
52377
52377
  function resolvePersistedDevTunnelId(storagePath, kind) {
@@ -53388,19 +53388,19 @@ async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_NODE_REQUEST_TIME
53388
53388
  cleanup();
53389
53389
  }
53390
53390
  }
53391
- async function fetchNodeWithFallback(node, path22, init, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS, trace, options) {
53391
+ async function fetchNodeWithFallback(node, path23, init, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS, trace, options) {
53392
53392
  let lastError;
53393
53393
  const endpoints = getNodeRequestEndpoints(node, options);
53394
53394
  for (const [index, endpoint] of endpoints.entries()) {
53395
53395
  const attempt = index + 1;
53396
- trace?.onAttempt?.({ attempt, endpoint, path: path22, timeoutMs, totalEndpoints: endpoints.length });
53396
+ trace?.onAttempt?.({ attempt, endpoint, path: path23, timeoutMs, totalEndpoints: endpoints.length });
53397
53397
  try {
53398
- const response = await fetchWithTimeout(`${endpoint}${path22}`, init, timeoutMs);
53399
- trace?.onResponse?.({ attempt, endpoint, path: path22, response, timeoutMs, totalEndpoints: endpoints.length });
53398
+ const response = await fetchWithTimeout(`${endpoint}${path23}`, init, timeoutMs);
53399
+ trace?.onResponse?.({ attempt, endpoint, path: path23, response, timeoutMs, totalEndpoints: endpoints.length });
53400
53400
  return { endpoint, response };
53401
53401
  } catch (error2) {
53402
53402
  lastError = error2;
53403
- trace?.onError?.({ attempt, endpoint, error: error2, path: path22, timeoutMs, totalEndpoints: endpoints.length });
53403
+ trace?.onError?.({ attempt, endpoint, error: error2, path: path23, timeoutMs, totalEndpoints: endpoints.length });
53404
53404
  }
53405
53405
  }
53406
53406
  throw lastError instanceof Error ? lastError : new Error("No reachable node endpoint");
@@ -54718,7 +54718,7 @@ var KeepaliveNodeMessageQueue = class {
54718
54718
  queued.push(requestMessage);
54719
54719
  this.queuedMessages.set(nodeId, queued);
54720
54720
  this.log.info("queued keepalive node message request", { nodeId, ...describeNodeMessage(requestMessage) });
54721
- return new Promise((resolve14, reject) => {
54721
+ return new Promise((resolve15, reject) => {
54722
54722
  const timeoutId = setTimeout(() => {
54723
54723
  this.pendingResponses.delete(requestMessage.id);
54724
54724
  reject(new Error(`Timed out waiting for ${requestMessage.kind} response from ${nodeId}`));
@@ -54726,7 +54726,7 @@ var KeepaliveNodeMessageQueue = class {
54726
54726
  this.pendingResponses.set(requestMessage.id, {
54727
54727
  nodeId,
54728
54728
  kind: requestMessage.kind,
54729
- resolve: resolve14,
54729
+ resolve: resolve15,
54730
54730
  reject,
54731
54731
  timeoutId
54732
54732
  });
@@ -55624,9 +55624,9 @@ var DataRouter = class {
55624
55624
  /**
55625
55625
  * Returns true if the request should be proxied to the leader.
55626
55626
  */
55627
- shouldProxy(method, path22) {
55627
+ shouldProxy(method, path23) {
55628
55628
  if (this.election.isLeader()) return false;
55629
- if (this.isExcludedPath(path22)) return false;
55629
+ if (this.isExcludedPath(path23)) return false;
55630
55630
  if (method.toUpperCase() === "GET") return false;
55631
55631
  return WRITE_METHODS.has(method.toUpperCase());
55632
55632
  }
@@ -55730,8 +55730,8 @@ var DataRouter = class {
55730
55730
  };
55731
55731
  }
55732
55732
  // ── Helpers ───────────────────────────────────────────────────────────
55733
- isExcludedPath(path22) {
55734
- return EXCLUDED_PATH_PREFIXES.some((prefix) => path22.startsWith(prefix)) || EXCLUDED_PATH_SUFFIXES.some((suffix) => path22.endsWith(suffix));
55733
+ isExcludedPath(path23) {
55734
+ return EXCLUDED_PATH_PREFIXES.some((prefix) => path23.startsWith(prefix)) || EXCLUDED_PATH_SUFFIXES.some((suffix) => path23.endsWith(suffix));
55735
55735
  }
55736
55736
  };
55737
55737
 
@@ -55837,7 +55837,7 @@ var ExecutionEngine = class {
55837
55837
  };
55838
55838
 
55839
55839
  // ../../packages/core/src/agents/engine-capabilities.ts
55840
- var FOLLOW_UP_AGENTS = ["claudecode", "codex"];
55840
+ var FOLLOW_UP_AGENTS = ["claudecode", "codex", "copilot"];
55841
55841
  function supportsFollowUpAgent(agent) {
55842
55842
  return FOLLOW_UP_AGENTS.includes(agent);
55843
55843
  }
@@ -55873,9 +55873,122 @@ var EngineRegistry = class {
55873
55873
  var fs8 = __toESM(require("fs"), 1);
55874
55874
  var os4 = __toESM(require("os"), 1);
55875
55875
  var path7 = __toESM(require("path"), 1);
55876
+
55877
+ // ../../packages/core/src/agents/copilot-transcript-events.ts
55876
55878
  function isRecord2(value) {
55877
55879
  return typeof value === "object" && value !== null;
55878
55880
  }
55881
+ function extractStringContent(value) {
55882
+ if (typeof value === "string") return value.trim();
55883
+ if (!Array.isArray(value)) return "";
55884
+ return value.map((part) => {
55885
+ if (typeof part === "string") return part.trim();
55886
+ if (isRecord2(part)) {
55887
+ if (typeof part.text === "string") return part.text.trim();
55888
+ if (typeof part.content === "string") return part.content.trim();
55889
+ }
55890
+ return "";
55891
+ }).filter(Boolean).join("\n\n");
55892
+ }
55893
+ function buildAssistantContentEvent(content, timestamp) {
55894
+ return {
55895
+ type: "assistant",
55896
+ message: {
55897
+ role: "assistant",
55898
+ content
55899
+ },
55900
+ ...timestamp ? { timestamp } : {}
55901
+ };
55902
+ }
55903
+ function extractCopilotEventText(event) {
55904
+ const data = isRecord2(event.data) ? event.data : void 0;
55905
+ const message = isRecord2(event.message) ? event.message : void 0;
55906
+ const dataMessage = isRecord2(data?.message) ? data.message : void 0;
55907
+ return extractStringContent(data?.content) || extractStringContent(data?.text) || extractStringContent(dataMessage?.content) || extractStringContent(dataMessage?.text) || extractStringContent(event.content) || extractStringContent(event.text) || extractStringContent(message?.content) || extractStringContent(message?.text);
55908
+ }
55909
+ function getStringField(record2, field) {
55910
+ const value = record2?.[field];
55911
+ return typeof value === "string" ? value.trim() : "";
55912
+ }
55913
+ function normalizeCopilotToolInput(value) {
55914
+ if (isRecord2(value)) return value;
55915
+ if (typeof value === "string" && value.trim()) {
55916
+ return { arguments: value.trim() };
55917
+ }
55918
+ return {};
55919
+ }
55920
+ function extractCopilotAssistantContent(event) {
55921
+ const data = isRecord2(event.data) ? event.data : void 0;
55922
+ const content = [];
55923
+ const reasoning = extractStringContent(data?.reasoningText) || extractStringContent(data?.reasoning);
55924
+ const text = extractCopilotEventText(event);
55925
+ if (reasoning) {
55926
+ content.push({ type: "thinking", thinking: reasoning });
55927
+ }
55928
+ if (text) {
55929
+ content.push({ type: "text", text });
55930
+ }
55931
+ if (Array.isArray(data?.toolRequests)) {
55932
+ for (const request of data.toolRequests) {
55933
+ if (!isRecord2(request)) continue;
55934
+ const id = getStringField(request, "toolCallId") || getStringField(request, "id") || getStringField(request, "callId");
55935
+ const name2 = getStringField(request, "name") || getStringField(request, "toolName");
55936
+ if (!id || !name2) continue;
55937
+ content.push({
55938
+ type: "tool_use",
55939
+ id,
55940
+ name: name2,
55941
+ input: normalizeCopilotToolInput(request.arguments ?? request.input)
55942
+ });
55943
+ }
55944
+ }
55945
+ return content;
55946
+ }
55947
+ function extractCopilotToolResult(event) {
55948
+ const data = isRecord2(event.data) ? event.data : void 0;
55949
+ const result = isRecord2(data?.result) ? data.result : void 0;
55950
+ const toolUseId = getStringField(data, "toolCallId") || getStringField(data, "toolUseId") || getStringField(data, "id");
55951
+ const content = extractStringContent(result?.content) || extractStringContent(result?.detailedContent) || extractStringContent(data?.result) || extractStringContent(data?.content) || extractStringContent(data?.output);
55952
+ if (!toolUseId || !content) {
55953
+ return null;
55954
+ }
55955
+ return {
55956
+ toolUseId,
55957
+ content,
55958
+ ...data?.success === false ? { isError: true } : {}
55959
+ };
55960
+ }
55961
+ function convertCopilotTranscriptEvent(event, opts = {}) {
55962
+ const type = typeof event.type === "string" ? event.type.toLowerCase() : "";
55963
+ const timestamp = typeof event.timestamp === "string" ? event.timestamp : void 0;
55964
+ if (opts.includeUserMessages === true && (type === "user.message" || type === "user_message")) {
55965
+ const text = extractCopilotEventText(event);
55966
+ if (!text) {
55967
+ return [];
55968
+ }
55969
+ return [buildTaskUserLogEvent([{ type: "text", text }], timestamp)];
55970
+ }
55971
+ if (type === "assistant.message" || type === "assistant_message" || type === "assistant" || type === "message") {
55972
+ const content = extractCopilotAssistantContent(event);
55973
+ if (content.length === 0) {
55974
+ return [];
55975
+ }
55976
+ return [buildAssistantContentEvent(content, timestamp)];
55977
+ }
55978
+ if (type === "tool.execution_complete" || type === "tool_execution_complete") {
55979
+ const result = extractCopilotToolResult(event);
55980
+ if (!result) {
55981
+ return [];
55982
+ }
55983
+ return [buildTaskUserLogEvent([{ type: "tool_result", ...result }], timestamp)];
55984
+ }
55985
+ return [];
55986
+ }
55987
+
55988
+ // ../../packages/core/src/agents/native-session-history.ts
55989
+ function isRecord3(value) {
55990
+ return typeof value === "object" && value !== null;
55991
+ }
55879
55992
  function readJsonLines(filePath) {
55880
55993
  if (!fs8.existsSync(filePath)) {
55881
55994
  return [];
@@ -55887,7 +56000,7 @@ function readJsonLines(filePath) {
55887
56000
  return content.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).flatMap((line) => {
55888
56001
  try {
55889
56002
  const parsed = JSON.parse(line);
55890
- return isRecord2(parsed) ? [parsed] : [];
56003
+ return isRecord3(parsed) ? [parsed] : [];
55891
56004
  } catch {
55892
56005
  return [];
55893
56006
  }
@@ -55987,7 +56100,7 @@ function extractCodexReasoningText(item) {
55987
56100
  if (Array.isArray(item.summary)) {
55988
56101
  return item.summary.map((entry) => {
55989
56102
  if (typeof entry === "string") return entry.trim();
55990
- if (isRecord2(entry) && typeof entry.text === "string") {
56103
+ if (isRecord3(entry) && typeof entry.text === "string") {
55991
56104
  return entry.text.trim();
55992
56105
  }
55993
56106
  return "";
@@ -56013,7 +56126,7 @@ function extractTextFromClaudeMessageContent(content) {
56013
56126
  return "";
56014
56127
  }
56015
56128
  for (const part of content) {
56016
- if (!isRecord2(part)) continue;
56129
+ if (!isRecord3(part)) continue;
56017
56130
  if (typeof part.text === "string" && part.text.trim()) {
56018
56131
  return truncateSummary(part.text);
56019
56132
  }
@@ -56023,6 +56136,27 @@ function extractTextFromClaudeMessageContent(content) {
56023
56136
  }
56024
56137
  return "";
56025
56138
  }
56139
+ function readSimpleYaml(filePath) {
56140
+ if (!fs8.existsSync(filePath)) {
56141
+ return {};
56142
+ }
56143
+ const metadata = {};
56144
+ for (const rawLine of fs8.readFileSync(filePath, "utf8").split(/\r?\n/)) {
56145
+ const line = rawLine.trim();
56146
+ if (!line || line.startsWith("#")) continue;
56147
+ const separatorIndex = line.indexOf(":");
56148
+ if (separatorIndex <= 0) continue;
56149
+ const key = line.slice(0, separatorIndex).trim();
56150
+ let value = line.slice(separatorIndex + 1).trim();
56151
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
56152
+ value = value.slice(1, -1);
56153
+ }
56154
+ if (key && value) {
56155
+ metadata[key] = value;
56156
+ }
56157
+ }
56158
+ return metadata;
56159
+ }
56026
56160
  function findClaudeSessionSummary(entries, sessionId) {
56027
56161
  let cwd = "";
56028
56162
  let summary = "";
@@ -56034,7 +56168,7 @@ function findClaudeSessionSummary(entries, sessionId) {
56034
56168
  if (!cwd && typeof entry.cwd === "string" && entry.cwd.trim()) {
56035
56169
  cwd = entry.cwd.trim();
56036
56170
  }
56037
- if (summary || entry.type !== "user" || !isRecord2(entry.message)) {
56171
+ if (summary || entry.type !== "user" || !isRecord3(entry.message)) {
56038
56172
  continue;
56039
56173
  }
56040
56174
  const candidate = extractTextFromClaudeMessageContent(entry.message.content);
@@ -56076,7 +56210,7 @@ function findCodexSessionSummary(entries, filePath, sessionIndex) {
56076
56210
  if (typeof entry.timestamp === "string") {
56077
56211
  updatedAt = entry.timestamp;
56078
56212
  }
56079
- if (entry.type === "session_meta" && isRecord2(entry.payload)) {
56213
+ if (entry.type === "session_meta" && isRecord3(entry.payload)) {
56080
56214
  if (typeof entry.payload.id === "string" && entry.payload.id.trim()) {
56081
56215
  sessionId = entry.payload.id.trim();
56082
56216
  }
@@ -56085,7 +56219,7 @@ function findCodexSessionSummary(entries, filePath, sessionIndex) {
56085
56219
  }
56086
56220
  continue;
56087
56221
  }
56088
- if (!summary && entry.type === "event_msg" && isRecord2(entry.payload) && entry.payload.type === "user_message") {
56222
+ if (!summary && entry.type === "event_msg" && isRecord3(entry.payload) && entry.payload.type === "user_message") {
56089
56223
  if (typeof entry.payload.message === "string" && entry.payload.message.trim()) {
56090
56224
  summary = truncateSummary(entry.payload.message);
56091
56225
  }
@@ -56118,7 +56252,7 @@ function loadClaudeSessionHistory(sessionId) {
56118
56252
  if (entry.type !== "user" && entry.type !== "assistant" || entry.isMeta === true || entry.isSidechain === true) {
56119
56253
  return false;
56120
56254
  }
56121
- return isRecord2(entry.message);
56255
+ return isRecord3(entry.message);
56122
56256
  });
56123
56257
  return { logs, sourcePath: sessionFile };
56124
56258
  }
@@ -56129,7 +56263,7 @@ function loadCodexSessionHistory(sessionId) {
56129
56263
  return { logs: [], sourcePath: null };
56130
56264
  }
56131
56265
  const logs = readJsonLines(sessionFile).flatMap((entry) => {
56132
- if (entry.type !== "event_msg" || !isRecord2(entry.payload)) {
56266
+ if (entry.type !== "event_msg" || !isRecord3(entry.payload)) {
56133
56267
  return [];
56134
56268
  }
56135
56269
  const timestamp = typeof entry.timestamp === "string" ? entry.timestamp : void 0;
@@ -56150,10 +56284,64 @@ function loadCodexSessionHistory(sessionId) {
56150
56284
  });
56151
56285
  return { logs, sourcePath: sessionFile };
56152
56286
  }
56287
+ function findCopilotSessionDir(sessionId) {
56288
+ const sessionsDir = path7.join(getNativeHomeDir(), ".copilot", "session-state");
56289
+ if (!fs8.existsSync(sessionsDir)) {
56290
+ return null;
56291
+ }
56292
+ const normalized = sessionId.toLowerCase();
56293
+ const entries = fs8.readdirSync(sessionsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort((left, right) => left.localeCompare(right));
56294
+ const match = entries.find((name2) => name2.toLowerCase() === normalized) ?? entries.find((name2) => name2.toLowerCase().startsWith(normalized));
56295
+ return match ? path7.join(sessionsDir, match) : null;
56296
+ }
56297
+ function loadCopilotSessionHistory(sessionId) {
56298
+ const sessionDir = findCopilotSessionDir(sessionId);
56299
+ if (!sessionDir) {
56300
+ return { logs: [], sourcePath: null };
56301
+ }
56302
+ const sessionFile = path7.join(sessionDir, "events.jsonl");
56303
+ if (!fs8.existsSync(sessionFile)) {
56304
+ return { logs: [], sourcePath: null };
56305
+ }
56306
+ const logs = readJsonLines(sessionFile).flatMap((entry) => convertCopilotTranscriptEvent(entry, { includeUserMessages: true }));
56307
+ return { logs, sourcePath: sessionFile };
56308
+ }
56309
+ function findFirstCopilotUserMessage(sessionDir) {
56310
+ const sessionFile = path7.join(sessionDir, "events.jsonl");
56311
+ for (const entry of readJsonLines(sessionFile)) {
56312
+ const type = typeof entry.type === "string" ? entry.type.toLowerCase() : "";
56313
+ if (type !== "user.message" && type !== "user_message") continue;
56314
+ const text = extractCopilotEventText(entry);
56315
+ if (text) {
56316
+ return truncateSummary(text);
56317
+ }
56318
+ }
56319
+ return "";
56320
+ }
56321
+ function findCopilotSessionSummary(sessionDir) {
56322
+ const workspacePath = path7.join(sessionDir, "workspace.yaml");
56323
+ const metadata = readSimpleYaml(workspacePath);
56324
+ const sessionId = metadata.id || path7.basename(sessionDir);
56325
+ const cwd = metadata.cwd;
56326
+ if (!sessionId || !cwd) {
56327
+ return null;
56328
+ }
56329
+ const summary = metadata.name ? truncateSummary(metadata.name) : findFirstCopilotUserMessage(sessionDir);
56330
+ return {
56331
+ agent: "copilot",
56332
+ sessionId,
56333
+ cwd,
56334
+ summary: summary || `Copilot session ${sessionId.slice(0, 12)}`,
56335
+ updatedAt: metadata.updated_at || metadata.created_at || null
56336
+ };
56337
+ }
56153
56338
  function loadNativeSessionHistory(input) {
56154
56339
  if (input.agent === "claudecode") {
56155
56340
  return loadClaudeSessionHistory(input.sessionId);
56156
56341
  }
56342
+ if (input.agent === "copilot") {
56343
+ return loadCopilotSessionHistory(input.sessionId);
56344
+ }
56157
56345
  return loadCodexSessionHistory(input.sessionId);
56158
56346
  }
56159
56347
  function listNativeSessions(input) {
@@ -56177,6 +56365,23 @@ function listNativeSessions(input) {
56177
56365
  };
56178
56366
  }).filter((session) => session !== null).sort(compareUpdatedSessions).slice(0, limit);
56179
56367
  }
56368
+ if (input.agent === "copilot") {
56369
+ const sessionsDir2 = path7.join(getNativeHomeDir(), ".copilot", "session-state");
56370
+ if (!fs8.existsSync(sessionsDir2)) {
56371
+ return [];
56372
+ }
56373
+ return fs8.readdirSync(sessionsDir2, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => {
56374
+ const sessionDir = path7.join(sessionsDir2, entry.name);
56375
+ const summary = findCopilotSessionSummary(sessionDir);
56376
+ if (!summary) {
56377
+ return null;
56378
+ }
56379
+ return {
56380
+ ...summary,
56381
+ updatedAt: summary.updatedAt ?? readFileModifiedAt(path7.join(sessionDir, "events.jsonl")) ?? readFileModifiedAt(path7.join(sessionDir, "workspace.yaml"))
56382
+ };
56383
+ }).filter((session) => session !== null).sort(compareUpdatedSessions).slice(0, limit);
56384
+ }
56180
56385
  const sessionIndex = loadCodexSessionIndex();
56181
56386
  const sessionsDir = path7.join(getNativeHomeDir(), ".codex", "sessions");
56182
56387
  return findMatchingFiles(sessionsDir, (filePath) => filePath.toLowerCase().endsWith(".jsonl")).map((filePath) => {
@@ -56592,6 +56797,24 @@ function resolveCodexInvocation() {
56592
56797
  }
56593
56798
  return { command: "codex", argsPrefix: [] };
56594
56799
  }
56800
+ function resolveCopilotInvocation() {
56801
+ if (process.platform !== "win32") {
56802
+ return { command: "copilot", argsPrefix: [] };
56803
+ }
56804
+ const pathEntries = getPathEntries();
56805
+ for (const entry of pathEntries) {
56806
+ const shimPath = path8.join(entry, "copilot.cmd");
56807
+ if (!fs9.existsSync(shimPath)) continue;
56808
+ const cliPath = path8.join(entry, "node_modules", "@github", "copilot", "npm-loader.js");
56809
+ if (fs9.existsSync(cliPath)) {
56810
+ return {
56811
+ command: process.execPath,
56812
+ argsPrefix: [cliPath]
56813
+ };
56814
+ }
56815
+ }
56816
+ return { command: "copilot", argsPrefix: [] };
56817
+ }
56595
56818
 
56596
56819
  // ../../packages/core/src/agents/lite-functions/index.ts
56597
56820
  var TITLE_MAX_LENGTH = 72;
@@ -56651,7 +56874,7 @@ var LiteAgentRunner = class {
56651
56874
  }
56652
56875
  };
56653
56876
  function runProcessForOutput(command, args, prompt, cwd, extractOutput) {
56654
- return new Promise((resolve14, reject) => {
56877
+ return new Promise((resolve15, reject) => {
56655
56878
  const proc = (0, import_node_child_process3.spawn)(command, args, {
56656
56879
  cwd: cwd ?? process.cwd(),
56657
56880
  stdio: ["pipe", "pipe", "pipe"]
@@ -56671,7 +56894,7 @@ function runProcessForOutput(command, args, prompt, cwd, extractOutput) {
56671
56894
  return;
56672
56895
  }
56673
56896
  try {
56674
- resolve14(extractOutput ? extractOutput(stdout) : stdout.trim());
56897
+ resolve15(extractOutput ? extractOutput(stdout) : stdout.trim());
56675
56898
  } catch (error2) {
56676
56899
  reject(error2);
56677
56900
  }
@@ -56698,6 +56921,29 @@ function extractLastCodexAgentMessage(stdout) {
56698
56921
  }
56699
56922
  return lastMessage.trim();
56700
56923
  }
56924
+ function extractLastCopilotAssistantMessage(stdout) {
56925
+ let lastMessage = "";
56926
+ for (const line of stdout.split("\n")) {
56927
+ if (!line.trim()) continue;
56928
+ try {
56929
+ const event = JSON.parse(line);
56930
+ const message = typeof event.message === "object" && event.message !== null ? event.message : void 0;
56931
+ const data = typeof event.data === "object" && event.data !== null ? event.data : void 0;
56932
+ const dataMessage = typeof data?.message === "object" && data.message !== null ? data.message : void 0;
56933
+ const content = message?.content ?? event.content ?? event.text ?? dataMessage?.content ?? data?.content ?? data?.text ?? dataMessage?.text;
56934
+ const text = typeof content === "string" ? content.trim() : "";
56935
+ const type = typeof event.type === "string" ? event.type.toLowerCase() : "";
56936
+ if (text && (type.includes("assistant") || type === "message")) {
56937
+ lastMessage = text;
56938
+ }
56939
+ } catch {
56940
+ }
56941
+ }
56942
+ if (!lastMessage.trim()) {
56943
+ throw new Error("Copilot lite call did not return an assistant message");
56944
+ }
56945
+ return lastMessage.trim();
56946
+ }
56701
56947
  var ClaudeLiteAdapter = class {
56702
56948
  runLite(prompt, options) {
56703
56949
  const invocation = resolveClaudeInvocation();
@@ -56734,6 +56980,21 @@ var CodexLiteAdapter = class {
56734
56980
  return runProcessForOutput(invocation.command, args, prompt, options.cwd, extractLastCodexAgentMessage);
56735
56981
  }
56736
56982
  };
56983
+ var CopilotLiteAdapter = class {
56984
+ runLite(prompt, options) {
56985
+ const invocation = resolveCopilotInvocation();
56986
+ const args = [
56987
+ ...invocation.argsPrefix,
56988
+ "--output-format=json",
56989
+ "--no-ask-user",
56990
+ "--allow-all-tools",
56991
+ "-p",
56992
+ prompt
56993
+ ];
56994
+ if (options.model) args.splice(args.length - 2, 0, `--model=${options.model}`);
56995
+ return runProcessForOutput(invocation.command, args, "", options.cwd, extractLastCopilotAssistantMessage);
56996
+ }
56997
+ };
56737
56998
 
56738
56999
  // ../../packages/core/src/agents/engines/claude-code-engine.ts
56739
57000
  var fs10 = __toESM(require("fs"), 1);
@@ -57429,9 +57690,327 @@ var CodexEngine = class extends ExecutionEngine {
57429
57690
  }
57430
57691
  };
57431
57692
 
57693
+ // ../../packages/core/src/agents/engines/copilot-cli-engine.ts
57694
+ var fs12 = __toESM(require("fs"), 1);
57695
+ var path11 = __toESM(require("path"), 1);
57696
+ var import_node_child_process6 = require("child_process");
57697
+ function isRecord4(value) {
57698
+ return typeof value === "object" && value !== null;
57699
+ }
57700
+ function contentToPrompt(content) {
57701
+ const text = content.filter((part) => part.type === "text").map((part) => part.text.trim()).filter(Boolean).join("\n\n");
57702
+ const imageCount = content.filter((part) => part.type === "image").length;
57703
+ if (text) return text;
57704
+ return imageCount > 0 ? "Review the attached image(s) and continue this task." : "Continue this task.";
57705
+ }
57706
+ function buildPrompt(content, systemPrompt) {
57707
+ const prompt = contentToPrompt(content);
57708
+ return systemPrompt?.trim() ? `${systemPrompt.trim()}
57709
+
57710
+ ${prompt}` : prompt;
57711
+ }
57712
+ function buildCopilotModeArgs(mode, cwd) {
57713
+ switch (mode) {
57714
+ case "plan":
57715
+ return ["--mode=plan", "--allow-all-tools", `--add-dir=${cwd}`];
57716
+ case "dangerous":
57717
+ return ["--allow-all"];
57718
+ case "edit":
57719
+ case "bypass":
57720
+ default:
57721
+ return ["--allow-all-tools", `--add-dir=${cwd}`];
57722
+ }
57723
+ }
57724
+ function sanitizeFilename2(filename) {
57725
+ return filename.replace(/[^a-zA-Z0-9._-]/g, "-");
57726
+ }
57727
+ function inferExtension2(mediaType) {
57728
+ const subtype = mediaType.split("/")[1] ?? "bin";
57729
+ const normalized = subtype.toLowerCase();
57730
+ if (normalized === "jpeg") return "jpg";
57731
+ if (normalized === "svg+xml") return "svg";
57732
+ return normalized.replace(/[^a-z0-9]/g, "") || "bin";
57733
+ }
57734
+ function extractSessionId(event) {
57735
+ const data = isRecord4(event.data) ? event.data : void 0;
57736
+ const direct = event.session_id ?? event.sessionId ?? event.conversation_id ?? event.conversationId ?? data?.sessionId ?? data?.session_id ?? data?.conversationId ?? data?.conversation_id;
57737
+ if (typeof direct === "string" && direct.trim()) return direct.trim();
57738
+ const type = typeof event.type === "string" ? event.type.toLowerCase() : "";
57739
+ const isSessionStart = type === "session_started" || type === "session.started" || type === "session_start";
57740
+ if (isSessionStart && typeof event.id === "string" && event.id.trim()) return event.id.trim();
57741
+ if (isSessionStart && typeof data?.id === "string" && data.id.trim()) return data.id.trim();
57742
+ return null;
57743
+ }
57744
+ var CopilotCliEngine = class extends ExecutionEngine {
57745
+ sessions = /* @__PURE__ */ new Map();
57746
+ init() {
57747
+ const { tasks } = this.taskEngine.listTasks();
57748
+ for (const task of tasks) {
57749
+ if (task.agent !== "copilot") continue;
57750
+ const sessionId = task.payload.sessionId;
57751
+ if (!sessionId) continue;
57752
+ const cwd = path11.resolve(
57753
+ task.payload.sessionCwd ?? task.effectiveProjectPath ?? task.project ?? process.cwd()
57754
+ );
57755
+ this.sessions.set(task.id, { sessionId, cwd, title: task.title });
57756
+ }
57757
+ if (this.sessions.size > 0) {
57758
+ this.logger.info("Recovered Copilot CLI sessions from store", { count: this.sessions.size });
57759
+ }
57760
+ }
57761
+ run(task) {
57762
+ const config2 = this.buildConfig(task);
57763
+ const cwd = task.effectiveProjectPath ?? task.project ?? process.cwd();
57764
+ const initialContent = getTaskInitialMessageContent(task);
57765
+ const prompt = buildPrompt(initialContent, config2.systemPrompt);
57766
+ const attachmentPaths = this.prepareAttachments(task.id, initialContent);
57767
+ const args = this.buildArgs(prompt, {
57768
+ cwd,
57769
+ model: config2.model,
57770
+ mode: config2.mode ?? "bypass",
57771
+ allowedTools: config2.allowedTools,
57772
+ attachmentPaths
57773
+ });
57774
+ this.ensureLogDir();
57775
+ this.logger.info("Spawning copilot CLI", { taskId: task.id, title: task.title, cwd });
57776
+ const invocation = resolveCopilotInvocation();
57777
+ const proc = (0, import_node_child_process6.spawn)(invocation.command, [...invocation.argsPrefix, ...args], {
57778
+ cwd,
57779
+ stdio: ["ignore", "pipe", "pipe"]
57780
+ });
57781
+ this.attachProcess(task.id, task.title, cwd, proc, false);
57782
+ proc.unref();
57783
+ }
57784
+ sendMessage(taskId, content) {
57785
+ let session = this.sessions.get(taskId);
57786
+ if (!session) {
57787
+ const recovered = this.recoverSession(taskId) ?? this.recoverPersistedSession(taskId);
57788
+ if (recovered) {
57789
+ this.sessions.set(taskId, recovered);
57790
+ session = recovered;
57791
+ }
57792
+ }
57793
+ if (!session) {
57794
+ throw new MeshyError("TASK_NOT_FOUND", `No active session for task ${taskId}`, 404);
57795
+ }
57796
+ const current = this.taskEngine.getTask(taskId);
57797
+ const model = typeof current?.payload.model === "string" ? current.payload.model : void 0;
57798
+ const mode = current?.payload.mode;
57799
+ const systemPrompt = typeof current?.payload.systemPrompt === "string" ? current.payload.systemPrompt : void 0;
57800
+ const allowedTools = Array.isArray(current?.payload.allowedTools) && current.payload.allowedTools.every((tool) => typeof tool === "string") ? current.payload.allowedTools : void 0;
57801
+ const userEvent = buildTaskUserLogEvent(content);
57802
+ this.appendLog(taskId, userEvent);
57803
+ this.emitOutput(taskId, userEvent);
57804
+ const prompt = buildPrompt(content, systemPrompt);
57805
+ const attachmentPaths = this.prepareAttachments(taskId, content);
57806
+ const args = this.buildArgs(prompt, {
57807
+ cwd: session.cwd,
57808
+ model,
57809
+ sessionId: session.sessionId,
57810
+ mode: mode === "plan" || mode === "edit" || mode === "dangerous" || mode === "bypass" ? mode : "bypass",
57811
+ allowedTools,
57812
+ attachmentPaths
57813
+ });
57814
+ this.logger.info("Sending Copilot CLI follow-up message", { taskId, sessionId: session.sessionId });
57815
+ const invocation = resolveCopilotInvocation();
57816
+ const proc = (0, import_node_child_process6.spawn)(invocation.command, [...invocation.argsPrefix, ...args], {
57817
+ cwd: session.cwd,
57818
+ stdio: ["ignore", "pipe", "pipe"]
57819
+ });
57820
+ this.attachProcess(taskId, session.title, session.cwd, proc, true);
57821
+ proc.unref();
57822
+ }
57823
+ buildArgs(prompt, opts) {
57824
+ const args = ["--output-format=json", "--no-ask-user", ...buildCopilotModeArgs(opts.mode ?? "bypass", opts.cwd)];
57825
+ if (opts.model) args.push(`--model=${opts.model}`);
57826
+ if (opts.sessionId) args.push(`--resume=${opts.sessionId}`);
57827
+ if (opts.allowedTools && opts.allowedTools.length > 0 && !args.includes("--allow-all")) {
57828
+ const allowAllToolsIndex = args.indexOf("--allow-all-tools");
57829
+ if (allowAllToolsIndex >= 0) args.splice(allowAllToolsIndex, 1);
57830
+ args.push(`--allow-tool=${opts.allowedTools.join(",")}`);
57831
+ }
57832
+ for (const attachmentPath of opts.attachmentPaths ?? []) {
57833
+ args.push("--attachment", attachmentPath);
57834
+ }
57835
+ args.push("-p", prompt);
57836
+ return args;
57837
+ }
57838
+ prepareAttachments(taskId, content) {
57839
+ const images = content.filter((part) => part.type === "image");
57840
+ if (images.length === 0) return [];
57841
+ const attachmentDir = path11.join(this.logDir, "attachments", taskId);
57842
+ fs12.mkdirSync(attachmentDir, { recursive: true });
57843
+ const usedFilenames = /* @__PURE__ */ new Set();
57844
+ return images.map((image, index) => {
57845
+ const fallbackName = `image-${Date.now()}-${index}.${inferExtension2(image.mediaType)}`;
57846
+ const filename = this.makeUniqueAttachmentFilename(sanitizeFilename2(image.filename ?? fallbackName), usedFilenames);
57847
+ const filePath = path11.join(attachmentDir, filename);
57848
+ fs12.writeFileSync(filePath, Buffer.from(image.data, "base64"));
57849
+ return filePath;
57850
+ });
57851
+ }
57852
+ makeUniqueAttachmentFilename(filename, usedFilenames) {
57853
+ if (!usedFilenames.has(filename)) {
57854
+ usedFilenames.add(filename);
57855
+ return filename;
57856
+ }
57857
+ const extension = path11.extname(filename);
57858
+ const base = extension ? filename.slice(0, -extension.length) : filename;
57859
+ let suffix = 2;
57860
+ let candidate = `${base}-${suffix}${extension}`;
57861
+ while (usedFilenames.has(candidate)) {
57862
+ suffix += 1;
57863
+ candidate = `${base}-${suffix}${extension}`;
57864
+ }
57865
+ usedFilenames.add(candidate);
57866
+ return candidate;
57867
+ }
57868
+ attachProcess(taskId, title, cwd, proc, isFollowUp) {
57869
+ const activeProcess = this.trackProcess(taskId, proc);
57870
+ let buffer = "";
57871
+ let stderrBuffer = "";
57872
+ const processLine = (line) => {
57873
+ if (!line.trim()) return;
57874
+ try {
57875
+ const event = JSON.parse(line);
57876
+ for (const converted of this.handleEvent(taskId, title, cwd, event)) {
57877
+ this.emitOutput(taskId, converted);
57878
+ this.appendLog(taskId, converted);
57879
+ }
57880
+ } catch {
57881
+ }
57882
+ };
57883
+ proc.stdout?.on("data", (chunk) => {
57884
+ buffer += chunk.toString();
57885
+ const lines = buffer.split("\n");
57886
+ buffer = lines.pop() ?? "";
57887
+ for (const line of lines) {
57888
+ processLine(line);
57889
+ }
57890
+ });
57891
+ proc.stderr?.on("data", (chunk) => {
57892
+ stderrBuffer += chunk.toString();
57893
+ });
57894
+ proc.on("close", (code) => {
57895
+ if (buffer.trim()) {
57896
+ processLine(buffer);
57897
+ }
57898
+ if (this.shouldSkipProcessOutcome(activeProcess)) {
57899
+ this.releaseProcess(activeProcess);
57900
+ return;
57901
+ }
57902
+ try {
57903
+ if (code === 0) {
57904
+ this.logger.info(isFollowUp ? "Copilot CLI follow-up completed" : "Copilot CLI task completed successfully", {
57905
+ taskId,
57906
+ title
57907
+ });
57908
+ this.taskEngine.reportResult(taskId, { message: `Task "${title}" completed` });
57909
+ } else {
57910
+ const error2 = stderrBuffer.trim() || `Process exited with code ${code}`;
57911
+ this.logger.error(isFollowUp ? "Copilot CLI follow-up failed" : "Copilot CLI task failed", {
57912
+ taskId,
57913
+ title,
57914
+ exitCode: code,
57915
+ error: error2
57916
+ });
57917
+ this.taskEngine.reportFailure(taskId, error2);
57918
+ }
57919
+ } catch (err) {
57920
+ this.logger.warn("Failed to report Copilot CLI task status", {
57921
+ taskId,
57922
+ reason: err instanceof Error ? err.message : String(err)
57923
+ });
57924
+ } finally {
57925
+ this.releaseProcess(activeProcess);
57926
+ }
57927
+ });
57928
+ proc.on("error", (err) => {
57929
+ if (this.shouldSkipProcessOutcome(activeProcess)) {
57930
+ this.releaseProcess(activeProcess);
57931
+ return;
57932
+ }
57933
+ this.logger.error(isFollowUp ? "Failed to spawn copilot for follow-up" : "Failed to spawn copilot", {
57934
+ taskId,
57935
+ error: err.message
57936
+ });
57937
+ try {
57938
+ this.taskEngine.reportFailure(taskId, `Failed to spawn copilot: ${err.message}`);
57939
+ } catch (reportErr) {
57940
+ this.logger.warn("Failed to report Copilot CLI spawn error", {
57941
+ taskId,
57942
+ reason: reportErr instanceof Error ? reportErr.message : String(reportErr)
57943
+ });
57944
+ } finally {
57945
+ this.releaseProcess(activeProcess);
57946
+ }
57947
+ });
57948
+ }
57949
+ handleEvent(taskId, title, cwd, event) {
57950
+ const sessionId = extractSessionId(event);
57951
+ if (sessionId) {
57952
+ this.sessions.set(taskId, { sessionId, cwd, title });
57953
+ this.persistSession(taskId, sessionId, cwd);
57954
+ this.appendLog(taskId, event);
57955
+ this.emitOutput(taskId, event);
57956
+ this.logger.info("Copilot CLI session established", { taskId, sessionId });
57957
+ return [];
57958
+ }
57959
+ return convertCopilotTranscriptEvent(event).map((converted) => typeof converted.timestamp === "string" ? converted : { ...converted, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
57960
+ }
57961
+ persistSession(taskId, sessionId, cwd) {
57962
+ try {
57963
+ const current = this.taskEngine.getTask(taskId);
57964
+ const payload = current?.payload ?? {};
57965
+ this.taskEngine.updateTask(taskId, {
57966
+ payload: { ...payload, sessionId, sessionCwd: cwd }
57967
+ });
57968
+ } catch {
57969
+ }
57970
+ }
57971
+ recoverSession(taskId) {
57972
+ const logPath = this.getLogPath(taskId);
57973
+ if (!fs12.existsSync(logPath)) return null;
57974
+ const content = fs12.readFileSync(logPath, "utf-8").trim();
57975
+ if (!content) return null;
57976
+ const lines = content.split("\n");
57977
+ for (let i = lines.length - 1; i >= 0; i--) {
57978
+ try {
57979
+ const line = lines[i];
57980
+ if (!line) continue;
57981
+ const event = JSON.parse(line);
57982
+ const sessionId = extractSessionId(event);
57983
+ if (sessionId) {
57984
+ const task = this.taskEngine.getTask(taskId);
57985
+ const persistedCwd = typeof task?.payload.sessionCwd === "string" ? task.payload.sessionCwd : void 0;
57986
+ return {
57987
+ sessionId,
57988
+ cwd: path11.resolve(persistedCwd ?? task?.effectiveProjectPath ?? task?.project ?? process.cwd()),
57989
+ title: task?.title ?? taskId
57990
+ };
57991
+ }
57992
+ } catch {
57993
+ }
57994
+ }
57995
+ return null;
57996
+ }
57997
+ recoverPersistedSession(taskId) {
57998
+ const task = this.taskEngine.getTask(taskId);
57999
+ const sessionId = typeof task?.payload.sessionId === "string" ? task.payload.sessionId : void 0;
58000
+ if (!sessionId) return null;
58001
+ return {
58002
+ sessionId,
58003
+ cwd: path11.resolve(
58004
+ (typeof task?.payload.sessionCwd === "string" ? task.payload.sessionCwd : void 0) ?? task?.effectiveProjectPath ?? task?.project ?? process.cwd()
58005
+ ),
58006
+ title: task?.title ?? taskId
58007
+ };
58008
+ }
58009
+ };
58010
+
57432
58011
  // ../../packages/core/src/storage/storage-paths.ts
57433
58012
  var os5 = __toESM(require("os"), 1);
57434
- var path11 = __toESM(require("path"), 1);
58013
+ var path12 = __toESM(require("path"), 1);
57435
58014
  function resolveDefaultStorageMode(options = {}) {
57436
58015
  const envMode = options.env?.MESHY_STORAGE_MODE;
57437
58016
  if (envMode === "cwd" || envMode === "home") {
@@ -57447,18 +58026,18 @@ function resolveDefaultStoragePath(options = {}) {
57447
58026
  const mode = resolveDefaultStorageMode(options);
57448
58027
  const envBaseDir = options.env?.MESHY_STORAGE_BASE_DIR;
57449
58028
  const baseDir = mode === "cwd" ? envBaseDir ?? options.cwd ?? process.cwd() : options.homeDir ?? os5.homedir();
57450
- return path11.resolve(baseDir, ".meshy");
58029
+ return path12.resolve(baseDir, ".meshy");
57451
58030
  }
57452
58031
  function toSafeNodeStorageName(nodeName) {
57453
58032
  const safeName = nodeName.trim().replace(/[^a-zA-Z0-9_-]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
57454
58033
  return safeName.length > 0 ? safeName : "node";
57455
58034
  }
57456
58035
  function resolveNodeScopedStoragePath(storageRoot, nodeName) {
57457
- return path11.resolve(storageRoot, toSafeNodeStorageName(nodeName));
58036
+ return path12.resolve(storageRoot, toSafeNodeStorageName(nodeName));
57458
58037
  }
57459
58038
 
57460
58039
  // ../../packages/core/src/node/node.ts
57461
- var path13 = __toESM(require("path"), 1);
58040
+ var path14 = __toESM(require("path"), 1);
57462
58041
 
57463
58042
  // ../../packages/core/src/messaging/node-local-message-handler.ts
57464
58043
  async function handleLocalNodeMessage(deps, message) {
@@ -57509,8 +58088,8 @@ async function handleLocalNodeMessage(deps, message) {
57509
58088
  }
57510
58089
 
57511
58090
  // ../../packages/core/src/node/node-identity.ts
57512
- var fs12 = __toESM(require("fs"), 1);
57513
- var path12 = __toESM(require("path"), 1);
58091
+ var fs13 = __toESM(require("fs"), 1);
58092
+ var path13 = __toESM(require("path"), 1);
57514
58093
 
57515
58094
  // ../../node_modules/.pnpm/nanoid@5.1.7/node_modules/nanoid/index.js
57516
58095
  var import_node_crypto6 = require("crypto");
@@ -57544,17 +58123,17 @@ function nanoid(size = 21) {
57544
58123
 
57545
58124
  // ../../packages/core/src/node/node-identity.ts
57546
58125
  function loadOrCreateNodeId(storagePath, nodeName) {
57547
- const identityPath = path12.join(storagePath, "node-identity.json");
58126
+ const identityPath = path13.join(storagePath, "node-identity.json");
57548
58127
  try {
57549
- if (fs12.existsSync(identityPath)) {
57550
- const raw = JSON.parse(fs12.readFileSync(identityPath, "utf-8"));
58128
+ if (fs13.existsSync(identityPath)) {
58129
+ const raw = JSON.parse(fs13.readFileSync(identityPath, "utf-8"));
57551
58130
  if (typeof raw.id === "string" && raw.id.length > 0) return raw.id;
57552
58131
  }
57553
58132
  } catch {
57554
58133
  }
57555
58134
  const id = nanoid();
57556
- fs12.mkdirSync(path12.dirname(identityPath), { recursive: true });
57557
- fs12.writeFileSync(identityPath, JSON.stringify({ id, name: nodeName }, null, 2) + "\n", "utf-8");
58135
+ fs13.mkdirSync(path13.dirname(identityPath), { recursive: true });
58136
+ fs13.writeFileSync(identityPath, JSON.stringify({ id, name: nodeName }, null, 2) + "\n", "utf-8");
57558
58137
  return id;
57559
58138
  }
57560
58139
 
@@ -57598,7 +58177,7 @@ var MeshyNode = class {
57598
58177
  await this.transport.start(this.config.node.port);
57599
58178
  const endpoint = await this.transport.getEndpoint();
57600
58179
  const now = Date.now();
57601
- const workDir = path13.resolve(this.config.node.workDir ?? process.cwd());
58180
+ const workDir = path14.resolve(this.config.node.workDir ?? process.cwd());
57602
58181
  this.selfInfo = {
57603
58182
  id: nodeId,
57604
58183
  name: this.config.node.name,
@@ -57629,7 +58208,7 @@ var MeshyNode = class {
57629
58208
  this.logger,
57630
58209
  this.getSettingsSnapshot
57631
58210
  );
57632
- const logDir = path13.join(this.config.storage.path, "task-logs");
58211
+ const logDir = path14.join(this.config.storage.path, "task-logs");
57633
58212
  this.taskEngine = new TaskEngine(this.store, this.nodeRegistry, this.eventBus, logDir);
57634
58213
  this.heartbeat.setGetAssignedTasks((nodeId2) => {
57635
58214
  const result = this.taskEngine.listTasks({ assignedTo: nodeId2, status: "assigned" });
@@ -57638,10 +58217,13 @@ var MeshyNode = class {
57638
58217
  this.engineRegistry = new EngineRegistry();
57639
58218
  const claudeEngine = new ClaudeCodeEngine(this.eventBus, logDir, this.taskEngine, this.logger);
57640
58219
  const codexEngine = new CodexEngine(this.eventBus, logDir, this.taskEngine, this.logger);
58220
+ const copilotEngine = new CopilotCliEngine(this.eventBus, logDir, this.taskEngine, this.logger);
57641
58221
  this.engineRegistry.register("claudecode", claudeEngine, { displayName: "Claude Code" });
57642
58222
  this.engineRegistry.register("codex", codexEngine, { displayName: "Codex" });
58223
+ this.engineRegistry.register("copilot", copilotEngine, { displayName: "Copilot CLI" });
57643
58224
  claudeEngine.init();
57644
58225
  codexEngine.init();
58226
+ copilotEngine.init();
57645
58227
  this.selfInfo = {
57646
58228
  ...this.nodeRegistry.getSelf(),
57647
58229
  supportedAgents: this.engineRegistry.getSupportedAgents()
@@ -58436,7 +59018,7 @@ var GitRemoteBranchOptionSchema = external_exports.object({
58436
59018
  ref: external_exports.string()
58437
59019
  });
58438
59020
  var NativeSessionSummarySchema = external_exports.object({
58439
- agent: external_exports.enum(["codex", "claudecode"]),
59021
+ agent: external_exports.enum(["codex", "claudecode", "copilot"]),
58440
59022
  sessionId: external_exports.string(),
58441
59023
  cwd: external_exports.string(),
58442
59024
  summary: external_exports.string(),
@@ -58473,7 +59055,7 @@ var NodeWorkDirBranchQuery = external_exports.object({
58473
59055
  allowAbsolute: QueryBoolean
58474
59056
  });
58475
59057
  var NodeNativeSessionsQuery = external_exports.object({
58476
- agent: external_exports.enum(["codex", "claudecode"]),
59058
+ agent: external_exports.enum(["codex", "claudecode", "copilot"]),
58477
59059
  limit: external_exports.coerce.number().int().min(1).max(100).default(50)
58478
59060
  });
58479
59061
  var NodeTerminalSessionStartBody = external_exports.object({
@@ -58518,7 +59100,7 @@ var CreateNodeWorkDirBranchResponse = NodeWorkDirBranchResponse.extend({
58518
59100
  });
58519
59101
  var NodeNativeSessionsResponse = external_exports.object({
58520
59102
  nodeId: external_exports.string(),
58521
- agent: external_exports.enum(["codex", "claudecode"]),
59103
+ agent: external_exports.enum(["codex", "claudecode", "copilot"]),
58522
59104
  sessions: external_exports.array(NativeSessionSummarySchema)
58523
59105
  });
58524
59106
  var NodeTerminalSessionResponse = external_exports.object({
@@ -58552,8 +59134,8 @@ var ConfigureNodeDevBoxBody = external_exports.object({
58552
59134
  });
58553
59135
 
58554
59136
  // ../../packages/api/src/schemas/tasks.ts
58555
- var AGENT_OPTIONS = ["mars", "codex", "claudecode", "eureka"];
58556
- var NATIVE_SESSION_AGENT_OPTIONS = ["codex", "claudecode"];
59137
+ var AGENT_OPTIONS = ["mars", "codex", "claudecode", "copilot", "eureka"];
59138
+ var NATIVE_SESSION_AGENT_OPTIONS = ["codex", "claudecode", "copilot"];
58557
59139
  var TASK_MODE_OPTIONS = ["bypass", "plan", "edit", "dangerous"];
58558
59140
  var TASK_CONVERSATION_KIND_OPTIONS = ["meshyChat", "nativeSession"];
58559
59141
  var TaskPayload = external_exports.record(external_exports.unknown()).superRefine((payload, ctx) => {
@@ -58697,8 +59279,8 @@ var BatchTaskIdsBody = external_exports.object({
58697
59279
  });
58698
59280
 
58699
59281
  // ../../packages/api/src/app/server.ts
58700
- var path19 = __toESM(require("path"), 1);
58701
- var fs19 = __toESM(require("fs"), 1);
59282
+ var path20 = __toESM(require("path"), 1);
59283
+ var fs20 = __toESM(require("fs"), 1);
58702
59284
  var import_express15 = __toESM(require_express2(), 1);
58703
59285
 
58704
59286
  // ../../packages/api/src/middleware/auth.ts
@@ -58835,8 +59417,8 @@ function decodePathSegment(value) {
58835
59417
  return value;
58836
59418
  }
58837
59419
  }
58838
- function getSingleTaskDeleteId(path22) {
58839
- const match = /^\/api\/tasks\/([^/]+)$/.exec(path22);
59420
+ function getSingleTaskDeleteId(path23) {
59421
+ const match = /^\/api\/tasks\/([^/]+)$/.exec(path23);
58840
59422
  return match ? decodePathSegment(match[1]) : null;
58841
59423
  }
58842
59424
  function getSuccessfulBatchDeleteIds(body) {
@@ -59098,8 +59680,8 @@ function normalizeDevBoxStatus(status) {
59098
59680
  return status?.trim().toLowerCase().replace(/[\s_-]+/gu, "");
59099
59681
  }
59100
59682
  function sleep(ms) {
59101
- return new Promise((resolve14) => {
59102
- const timer = setTimeout(resolve14, ms);
59683
+ return new Promise((resolve15) => {
59684
+ const timer = setTimeout(resolve15, ms);
59103
59685
  if (typeof timer === "object" && timer !== null && "unref" in timer && typeof timer.unref === "function") {
59104
59686
  timer.unref();
59105
59687
  }
@@ -59181,13 +59763,13 @@ function cleanDevBoxInfo(devbox) {
59181
59763
  }
59182
59764
  function normalizeMcpDevBoxList(value) {
59183
59765
  const normalized = normalizeMcpValue(value);
59184
- const record2 = isRecord3(normalized) ? normalized : {};
59766
+ const record2 = isRecord5(normalized) ? normalized : {};
59185
59767
  const list = Array.isArray(normalized) ? normalized : Array.isArray(record2.devboxes) ? record2.devboxes : Array.isArray(record2.value) ? record2.value : [];
59186
59768
  return list.map((item) => normalizeDevBoxResource(item, void 0)).filter((item) => Boolean(item.name));
59187
59769
  }
59188
59770
  function normalizeDevBoxResource(value, fallback) {
59189
59771
  const record2 = normalizeRecord(value);
59190
- const additional = isRecord3(record2.additionalProperties) ? record2.additionalProperties : {};
59772
+ const additional = isRecord5(record2.additionalProperties) ? record2.additionalProperties : {};
59191
59773
  const fromUri = parseDevBoxUri(readString(record2, "uri"));
59192
59774
  const status = readString(record2, "status") ?? readString(record2, "powerState") ?? readString(record2, "lastStatus") ?? fallback?.lastStatus;
59193
59775
  const name2 = readString(record2, "name") ?? fromUri?.name ?? fallback?.name ?? "";
@@ -59241,7 +59823,7 @@ function parseDevCenterEndpoint(hostname4) {
59241
59823
  }
59242
59824
  function normalizeRecord(value) {
59243
59825
  const normalized = normalizeMcpValue(value);
59244
- return isRecord3(normalized) ? normalized : {};
59826
+ return isRecord5(normalized) ? normalized : {};
59245
59827
  }
59246
59828
  function normalizeMcpValue(value) {
59247
59829
  if (Array.isArray(value)) return value;
@@ -59276,7 +59858,7 @@ function tryParseJson(text) {
59276
59858
  return null;
59277
59859
  }
59278
59860
  }
59279
- function isRecord3(value) {
59861
+ function isRecord5(value) {
59280
59862
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
59281
59863
  }
59282
59864
  function readString(record2, key) {
@@ -59534,11 +60116,11 @@ function assertCanChangeNodeDevTunnel(taskEngine, nodeId) {
59534
60116
  var import_express3 = __toESM(require_express2(), 1);
59535
60117
 
59536
60118
  // ../../packages/api/src/node/node-workdir-service.ts
59537
- var path15 = __toESM(require("path"), 1);
60119
+ var path16 = __toESM(require("path"), 1);
59538
60120
 
59539
60121
  // ../../packages/api/src/output/helpers.ts
59540
- var fs13 = __toESM(require("fs"), 1);
59541
- var path14 = __toESM(require("path"), 1);
60122
+ var fs14 = __toESM(require("fs"), 1);
60123
+ var path15 = __toESM(require("path"), 1);
59542
60124
  var MAX_INLINE_SIZE = 512 * 1024;
59543
60125
  var TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
59544
60126
  ".txt",
@@ -59651,15 +60233,15 @@ function mimeForExt(ext) {
59651
60233
  return MIME_MAP[ext] ?? "application/octet-stream";
59652
60234
  }
59653
60235
  function resolveOutputPath(root, relativePath) {
59654
- const resolved = path14.resolve(root, relativePath);
59655
- const normalizedRoot = path14.resolve(root);
59656
- if (!resolved.startsWith(normalizedRoot + path14.sep) && resolved !== normalizedRoot) {
60236
+ const resolved = path15.resolve(root, relativePath);
60237
+ const normalizedRoot = path15.resolve(root);
60238
+ if (!resolved.startsWith(normalizedRoot + path15.sep) && resolved !== normalizedRoot) {
59657
60239
  throw new Error("Path traversal detected");
59658
60240
  }
59659
60241
  return resolved;
59660
60242
  }
59661
60243
  function classifyFile(filePath) {
59662
- const ext = path14.extname(filePath).toLowerCase();
60244
+ const ext = path15.extname(filePath).toLowerCase();
59663
60245
  if (ext === ".json" || ext === ".jsonl" || ext === ".ndjson") {
59664
60246
  return { kind: "json", mimeType: "application/json" };
59665
60247
  }
@@ -59689,21 +60271,21 @@ function listDirectory(root, relativePath, options = {}) {
59689
60271
  return listResolvedDirectory(absPath, relativePath, options);
59690
60272
  }
59691
60273
  function listAbsoluteDirectory(absoluteDir, options = {}) {
59692
- if (!path14.isAbsolute(absoluteDir)) {
60274
+ if (!path15.isAbsolute(absoluteDir)) {
59693
60275
  throw new Error("listAbsoluteDirectory requires an absolute path");
59694
60276
  }
59695
60277
  return listResolvedDirectory(absoluteDir, absoluteDir, { ...options, childPathStyle: "absolute" });
59696
60278
  }
59697
60279
  function listResolvedDirectory(absPath, relativeBase, options = {}) {
59698
- if (!fs13.existsSync(absPath) || !fs13.statSync(absPath).isDirectory()) {
60280
+ if (!fs14.existsSync(absPath) || !fs14.statSync(absPath).isDirectory()) {
59699
60281
  return [];
59700
60282
  }
59701
- const entries = fs13.readdirSync(absPath, { withFileTypes: true });
60283
+ const entries = fs14.readdirSync(absPath, { withFileTypes: true });
59702
60284
  const result = [];
59703
60285
  const childPathStyle = options.childPathStyle ?? "relative";
59704
60286
  for (const entry of entries) {
59705
60287
  if (entry.name.startsWith(".")) continue;
59706
- const entryRelPath = childPathStyle === "absolute" ? path14.join(absPath, entry.name) : path14.join(relativeBase || ".", entry.name).split(path14.sep).join("/");
60288
+ const entryRelPath = childPathStyle === "absolute" ? path15.join(absPath, entry.name) : path15.join(relativeBase || ".", entry.name).split(path15.sep).join("/");
59707
60289
  if (entry.isDirectory()) {
59708
60290
  result.push({
59709
60291
  path: entryRelPath,
@@ -59713,8 +60295,8 @@ function listResolvedDirectory(absPath, relativeBase, options = {}) {
59713
60295
  } else if (options.directoriesOnly) {
59714
60296
  continue;
59715
60297
  } else if (entry.isFile()) {
59716
- const fullPath = path14.join(absPath, entry.name);
59717
- const stat = fs13.statSync(fullPath);
60298
+ const fullPath = path15.join(absPath, entry.name);
60299
+ const stat = fs14.statSync(fullPath);
59718
60300
  const { kind, mimeType } = classifyFile(entry.name);
59719
60301
  result.push({
59720
60302
  path: entryRelPath,
@@ -59734,11 +60316,11 @@ function listResolvedDirectory(absPath, relativeBase, options = {}) {
59734
60316
  }
59735
60317
  function detectHtmlEntries(root) {
59736
60318
  const entries = [];
59737
- if (fs13.existsSync(path14.join(root, "index.html"))) {
60319
+ if (fs14.existsSync(path15.join(root, "index.html"))) {
59738
60320
  entries.push({ path: "index.html", label: "index.html" });
59739
60321
  }
59740
60322
  try {
59741
- const topLevel = fs13.readdirSync(root, { withFileTypes: true });
60323
+ const topLevel = fs14.readdirSync(root, { withFileTypes: true });
59742
60324
  const htmlFiles = topLevel.filter(
59743
60325
  (e) => e.isFile() && e.name.endsWith(".html") && !e.name.startsWith(".")
59744
60326
  );
@@ -59749,8 +60331,8 @@ function detectHtmlEntries(root) {
59749
60331
  }
59750
60332
  const subdirs = topLevel.filter((e) => e.isDirectory() && !e.name.startsWith("."));
59751
60333
  for (const dir of subdirs) {
59752
- const subIndex = path14.join(root, dir.name, "index.html");
59753
- if (fs13.existsSync(subIndex)) {
60334
+ const subIndex = path15.join(root, dir.name, "index.html");
60335
+ if (fs14.existsSync(subIndex)) {
59754
60336
  entries.push({
59755
60337
  path: `${dir.name}/index.html`,
59756
60338
  label: `${dir.name}/index.html`
@@ -59764,7 +60346,7 @@ function detectHtmlEntries(root) {
59764
60346
  function detectMarkdownEntries(root) {
59765
60347
  const entries = [];
59766
60348
  try {
59767
- const topLevel = fs13.readdirSync(root, { withFileTypes: true });
60349
+ const topLevel = fs14.readdirSync(root, { withFileTypes: true });
59768
60350
  for (const f of topLevel) {
59769
60351
  if (f.isFile() && !f.name.startsWith(".") && /\.mdx?$/i.test(f.name)) {
59770
60352
  entries.push({ path: f.name, label: f.name });
@@ -59773,8 +60355,8 @@ function detectMarkdownEntries(root) {
59773
60355
  const subdirs = topLevel.filter((e) => e.isDirectory() && !e.name.startsWith("."));
59774
60356
  for (const dir of subdirs) {
59775
60357
  for (const fileName of ["README.md", "readme.md"]) {
59776
- const readmePath = path14.join(root, dir.name, fileName);
59777
- if (fs13.existsSync(readmePath)) {
60358
+ const readmePath = path15.join(root, dir.name, fileName);
60359
+ if (fs14.existsSync(readmePath)) {
59778
60360
  entries.push({ path: `${dir.name}/${fileName}`, label: `${dir.name}/${fileName}` });
59779
60361
  break;
59780
60362
  }
@@ -59785,12 +60367,12 @@ function detectMarkdownEntries(root) {
59785
60367
  return entries;
59786
60368
  }
59787
60369
  function getOutputSummary(root) {
59788
- const rootName = path14.basename(root);
60370
+ const rootName = path15.basename(root);
59789
60371
  const htmlEntries = detectHtmlEntries(root);
59790
60372
  const markdownEntries = detectMarkdownEntries(root);
59791
60373
  let fileCount;
59792
60374
  try {
59793
- const entries = fs13.readdirSync(root, { withFileTypes: true });
60375
+ const entries = fs14.readdirSync(root, { withFileTypes: true });
59794
60376
  fileCount = entries.filter((e) => !e.name.startsWith(".")).length;
59795
60377
  } catch {
59796
60378
  fileCount = void 0;
@@ -59807,14 +60389,14 @@ function getOutputSummary(root) {
59807
60389
  }
59808
60390
  function readFileContent(root, relativePath) {
59809
60391
  const absPath = resolveOutputPath(root, relativePath);
59810
- if (!fs13.existsSync(absPath) || !fs13.statSync(absPath).isFile()) {
60392
+ if (!fs14.existsSync(absPath) || !fs14.statSync(absPath).isFile()) {
59811
60393
  throw new Error("File not found");
59812
60394
  }
59813
- const stat = fs13.statSync(absPath);
60395
+ const stat = fs14.statSync(absPath);
59814
60396
  const { kind, mimeType } = classifyFile(absPath);
59815
60397
  if (kind === "image" || kind === "pdf" || kind === "binary") {
59816
60398
  const truncated2 = stat.size > MAX_INLINE_SIZE;
59817
- const buffer = truncated2 ? Buffer.alloc(0) : fs13.readFileSync(absPath);
60399
+ const buffer = truncated2 ? Buffer.alloc(0) : fs14.readFileSync(absPath);
59818
60400
  return {
59819
60401
  path: relativePath,
59820
60402
  kind,
@@ -59825,7 +60407,7 @@ function readFileContent(root, relativePath) {
59825
60407
  };
59826
60408
  }
59827
60409
  const truncated = stat.size > MAX_INLINE_SIZE;
59828
- const content = truncated ? fs13.readFileSync(absPath, "utf-8").slice(0, MAX_INLINE_SIZE) : fs13.readFileSync(absPath, "utf-8");
60410
+ const content = truncated ? fs14.readFileSync(absPath, "utf-8").slice(0, MAX_INLINE_SIZE) : fs14.readFileSync(absPath, "utf-8");
59829
60411
  return {
59830
60412
  path: relativePath,
59831
60413
  kind,
@@ -59837,8 +60419,8 @@ function readFileContent(root, relativePath) {
59837
60419
  }
59838
60420
 
59839
60421
  // ../../packages/api/src/output/git-command.ts
59840
- var fs14 = __toESM(require("fs"), 1);
59841
- var import_node_child_process6 = require("child_process");
60422
+ var fs15 = __toESM(require("fs"), 1);
60423
+ var import_node_child_process7 = require("child_process");
59842
60424
  var COMMON_GIT_BINARIES = [
59843
60425
  "/opt/homebrew/bin/git",
59844
60426
  "/usr/local/bin/git",
@@ -59846,7 +60428,7 @@ var COMMON_GIT_BINARIES = [
59846
60428
  ];
59847
60429
  function isExecutable(filePath) {
59848
60430
  try {
59849
- fs14.accessSync(filePath, fs14.constants.X_OK);
60431
+ fs15.accessSync(filePath, fs15.constants.X_OK);
59850
60432
  return true;
59851
60433
  } catch {
59852
60434
  return false;
@@ -59867,7 +60449,7 @@ function execGit(args, cwd, timeout = 1e4) {
59867
60449
  let lastError;
59868
60450
  for (const command of getGitCandidates()) {
59869
60451
  try {
59870
- return (0, import_node_child_process6.execFileSync)(command, ["-C", cwd, ...args], {
60452
+ return (0, import_node_child_process7.execFileSync)(command, ["-C", cwd, ...args], {
59871
60453
  encoding: "utf-8",
59872
60454
  timeout,
59873
60455
  stdio: ["pipe", "pipe", "pipe"],
@@ -60099,14 +60681,14 @@ function getGitDiff(dirPath) {
60099
60681
 
60100
60682
  // ../../packages/api/src/node/node-workdir-service.ts
60101
60683
  function isAbsolutePath(p) {
60102
- return path15.isAbsolute(p) || /^[A-Za-z]:[\\/]/.test(p);
60684
+ return path16.isAbsolute(p) || /^[A-Za-z]:[\\/]/.test(p);
60103
60685
  }
60104
60686
  function resolveNodeWorkDirTarget(nodeId, rootPath, currentPath, allowAbsolute) {
60105
60687
  if (!rootPath) {
60106
60688
  throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
60107
60689
  }
60108
60690
  const useAbsolute = allowAbsolute && isAbsolutePath(currentPath);
60109
- const resolvedPath = useAbsolute ? path15.resolve(currentPath) : currentPath;
60691
+ const resolvedPath = useAbsolute ? path16.resolve(currentPath) : currentPath;
60110
60692
  const targetPath = useAbsolute ? resolvedPath : resolveRelativeNodeWorkDirTarget(rootPath, resolvedPath);
60111
60693
  return {
60112
60694
  rootPath,
@@ -60116,9 +60698,9 @@ function resolveNodeWorkDirTarget(nodeId, rootPath, currentPath, allowAbsolute)
60116
60698
  };
60117
60699
  }
60118
60700
  function resolveRelativeNodeWorkDirTarget(rootPath, relativePath) {
60119
- const resolvedRoot = path15.resolve(rootPath);
60120
- const resolved = path15.resolve(resolvedRoot, relativePath);
60121
- if (!resolved.startsWith(resolvedRoot + path15.sep) && resolved !== resolvedRoot) {
60701
+ const resolvedRoot = path16.resolve(rootPath);
60702
+ const resolved = path16.resolve(resolvedRoot, relativePath);
60703
+ if (!resolved.startsWith(resolvedRoot + path16.sep) && resolved !== resolvedRoot) {
60122
60704
  throw new MeshyError("VALIDATION_ERROR", "Invalid directory path", 400);
60123
60705
  }
60124
60706
  return resolved;
@@ -60201,13 +60783,13 @@ function createLocalNodeWorkDirBranch(nodeId, rootPath, currentPath, options) {
60201
60783
  }
60202
60784
  function computeParentPath(rootPath, currentPath, useAbsolute) {
60203
60785
  if (useAbsolute) {
60204
- const parent = path15.dirname(currentPath);
60786
+ const parent = path16.dirname(currentPath);
60205
60787
  return parent === currentPath ? null : parent;
60206
60788
  }
60207
60789
  const normalized = currentPath.replace(/\\/g, "/").replace(/\/+$/, "");
60208
60790
  if (normalized === "" || normalized === ".") {
60209
- const absParent = path15.dirname(path15.resolve(rootPath));
60210
- return absParent === path15.resolve(rootPath) ? null : absParent;
60791
+ const absParent = path16.dirname(path16.resolve(rootPath));
60792
+ return absParent === path16.resolve(rootPath) ? null : absParent;
60211
60793
  }
60212
60794
  const segments = normalized.split("/").filter(Boolean);
60213
60795
  segments.pop();
@@ -60218,14 +60800,15 @@ function computeParentPath(rootPath, currentPath, useAbsolute) {
60218
60800
  var import_node_crypto7 = require("crypto");
60219
60801
 
60220
60802
  // ../../packages/api/src/node/agent-upgrade-service.ts
60221
- var import_node_child_process8 = require("child_process");
60803
+ var import_node_child_process9 = require("child_process");
60222
60804
 
60223
60805
  // ../../packages/api/src/app/system-info.ts
60224
60806
  var os6 = __toESM(require("os"), 1);
60225
- var import_node_child_process7 = require("child_process");
60807
+ var import_node_child_process8 = require("child_process");
60226
60808
  var RUNTIME_TOOLS = [
60227
60809
  { id: "claude", label: "Claude Code", command: "claude", packageName: "@anthropic-ai/claude-code" },
60228
- { id: "codex", label: "Codex", command: "codex", packageName: "@openai/codex" }
60810
+ { id: "codex", label: "Codex", command: "codex", packageName: "@openai/codex" },
60811
+ { id: "copilot", label: "Copilot CLI", command: "copilot", packageName: "@github/copilot" }
60229
60812
  ];
60230
60813
  var runtimeToolUpdateCache = /* @__PURE__ */ new Map();
60231
60814
  function clearRuntimeToolUpdateCache(packageName) {
@@ -60236,7 +60819,7 @@ function clearRuntimeToolUpdateCache(packageName) {
60236
60819
  runtimeToolUpdateCache.clear();
60237
60820
  }
60238
60821
  function runRuntimeToolCommand(command, args, platform2) {
60239
- const result = (0, import_node_child_process7.spawnSync)(command, args, {
60822
+ const result = (0, import_node_child_process8.spawnSync)(command, args, {
60240
60823
  encoding: "utf-8",
60241
60824
  shell: platform2 === "win32" && command !== "where",
60242
60825
  windowsHide: true,
@@ -60433,7 +61016,8 @@ function buildNodeSettingsSnapshot(options) {
60433
61016
  // ../../packages/api/src/node/agent-upgrade-service.ts
60434
61017
  var AGENT_PACKAGES = {
60435
61018
  claude: "@anthropic-ai/claude-code",
60436
- codex: "@openai/codex"
61019
+ codex: "@openai/codex",
61020
+ copilot: "@github/copilot"
60437
61021
  };
60438
61022
  var OUTPUT_LIMIT = 4e3;
60439
61023
  function summarizeOutput(value) {
@@ -60441,7 +61025,7 @@ function summarizeOutput(value) {
60441
61025
  return text.length > OUTPUT_LIMIT ? `${text.slice(0, OUTPUT_LIMIT)}\u2026` : text;
60442
61026
  }
60443
61027
  function defaultCommandRunner(command, args) {
60444
- const result = (0, import_node_child_process8.spawnSync)(command, args, {
61028
+ const result = (0, import_node_child_process9.spawnSync)(command, args, {
60445
61029
  encoding: "utf-8",
60446
61030
  shell: process.platform === "win32",
60447
61031
  windowsHide: true,
@@ -60455,7 +61039,7 @@ function defaultCommandRunner(command, args) {
60455
61039
  };
60456
61040
  }
60457
61041
  function isRuntimeAgentId(value) {
60458
- return value === "claude" || value === "codex";
61042
+ return value === "claude" || value === "codex" || value === "copilot";
60459
61043
  }
60460
61044
  function buildUpgradeArgs(agent, packageName) {
60461
61045
  const args = ["install", "-g", `${packageName}@latest`];
@@ -60503,7 +61087,7 @@ function upgradeRuntimeAgentForDeps(deps, agent) {
60503
61087
 
60504
61088
  // ../../packages/api/src/node/runtime-restart-request.ts
60505
61089
  function parseRuntimeRestartRequest(value) {
60506
- const body = isRecord4(value) ? value : {};
61090
+ const body = isRecord6(value) ? value : {};
60507
61091
  const startArgs = parseRuntimeRestartStartArgs(body.startArgs);
60508
61092
  return {
60509
61093
  reason: body.reason === "update" ? "update" : "restart",
@@ -60512,7 +61096,7 @@ function parseRuntimeRestartRequest(value) {
60512
61096
  }
60513
61097
  function parseRuntimeRestartStartArgs(value) {
60514
61098
  if (value === void 0) return void 0;
60515
- if (!isRecord4(value)) {
61099
+ if (!isRecord6(value)) {
60516
61100
  throw new MeshyError("VALIDATION_ERROR", "Runtime restart startArgs must be an object", 400);
60517
61101
  }
60518
61102
  const startArgs = {};
@@ -60549,7 +61133,7 @@ function parseOptionalString(value, key) {
60549
61133
  const trimmed = value.trim();
60550
61134
  return trimmed || void 0;
60551
61135
  }
60552
- function isRecord4(value) {
61136
+ function isRecord6(value) {
60553
61137
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
60554
61138
  }
60555
61139
 
@@ -60987,7 +61571,7 @@ async function sendNodeWorkDirBranchCreateOperation(req, res, nodeId) {
60987
61571
  }
60988
61572
 
60989
61573
  // ../../packages/api/src/tasks/task-route-utils.ts
60990
- var fs15 = __toESM(require("fs"), 1);
61574
+ var fs16 = __toESM(require("fs"), 1);
60991
61575
  var import_node_stream3 = require("stream");
60992
61576
  var import_promises5 = require("stream/promises");
60993
61577
 
@@ -61032,7 +61616,7 @@ function toLegacyWorkerControl2(message) {
61032
61616
  }
61033
61617
 
61034
61618
  // ../../packages/api/src/tasks/task-route-utils.ts
61035
- function isRecord5(value) {
61619
+ function isRecord7(value) {
61036
61620
  return typeof value === "object" && value !== null;
61037
61621
  }
61038
61622
  function restoreTaskState(taskEngine, task) {
@@ -61049,10 +61633,10 @@ function readLocalTaskLogs(engineRegistry, taskId, after, agent) {
61049
61633
  throw new MeshyError("VALIDATION_ERROR", `Engine not registered for agent: ${agent}`, 400);
61050
61634
  }
61051
61635
  const logPath = engine.getLogPath(taskId);
61052
- if (!fs15.existsSync(logPath)) {
61636
+ if (!fs16.existsSync(logPath)) {
61053
61637
  return { logs: [], total: 0 };
61054
61638
  }
61055
- const content = fs15.readFileSync(logPath, "utf-8");
61639
+ const content = fs16.readFileSync(logPath, "utf-8");
61056
61640
  const allLines = content.trim().split("\n").filter(Boolean);
61057
61641
  const logs = [];
61058
61642
  for (let i = after; i < allLines.length; i++) {
@@ -61099,7 +61683,7 @@ function normalizeStructuredValue(value) {
61099
61683
  if (Array.isArray(value)) {
61100
61684
  return value.map((entry) => normalizeStructuredValue(entry));
61101
61685
  }
61102
- if (!isRecord5(value)) {
61686
+ if (!isRecord7(value)) {
61103
61687
  return value;
61104
61688
  }
61105
61689
  return Object.fromEntries(
@@ -61108,20 +61692,20 @@ function normalizeStructuredValue(value) {
61108
61692
  }
61109
61693
  function getTranscriptEventSignature(event) {
61110
61694
  if (event.type === "user") {
61111
- const signature = getTaskUserMessageSignature(isRecord5(event.message) ? event.message.content : event.message) ?? getTaskUserMessageSignature(event.content);
61695
+ const signature = getTaskUserMessageSignature(isRecord7(event.message) ? event.message.content : event.message) ?? getTaskUserMessageSignature(event.content);
61112
61696
  return signature ? `user:${signature}` : null;
61113
61697
  }
61114
61698
  if (event.type === "assistant") {
61115
61699
  if (typeof event.message === "string") {
61116
61700
  return `assistant:${JSON.stringify(event.message)}`;
61117
61701
  }
61118
- if (isRecord5(event.message) && "content" in event.message) {
61702
+ if (isRecord7(event.message) && "content" in event.message) {
61119
61703
  return `assistant:${JSON.stringify(normalizeStructuredValue(event.message.content))}`;
61120
61704
  }
61121
61705
  if (Array.isArray(event.content)) {
61122
61706
  return `assistant:${JSON.stringify(normalizeStructuredValue(event.content))}`;
61123
61707
  }
61124
- if (isRecord5(event.message)) {
61708
+ if (isRecord7(event.message)) {
61125
61709
  return `assistant:${JSON.stringify(normalizeStructuredValue(event.message))}`;
61126
61710
  }
61127
61711
  }
@@ -61179,7 +61763,7 @@ function mergeNativeSessionLogs(nativeLogs, localLogs) {
61179
61763
  function readLocalTaskLogsWithNativeHistory(engineRegistry, task, taskId, after, agent) {
61180
61764
  const local = readLocalTaskLogs(engineRegistry, taskId, after, agent);
61181
61765
  const sessionId = typeof task?.payload?.sessionId === "string" ? task.payload.sessionId : "";
61182
- if (after > 0 || task?.conversationKind !== "nativeSession" || !sessionId || task.agent !== "codex" && task.agent !== "claudecode") {
61766
+ if (after > 0 || task?.conversationKind !== "nativeSession" || !sessionId || task.agent !== "codex" && task.agent !== "claudecode" && task.agent !== "copilot") {
61183
61767
  return local;
61184
61768
  }
61185
61769
  const history = loadNativeSessionHistory({ agent: task.agent, sessionId });
@@ -61283,23 +61867,23 @@ async function maybeProxyReadToLeader(req, res, options = {}) {
61283
61867
  }
61284
61868
 
61285
61869
  // ../../packages/api/src/node/node-terminal-session-service.ts
61286
- var import_node_child_process9 = require("child_process");
61870
+ var import_node_child_process10 = require("child_process");
61287
61871
  var import_node_crypto8 = require("crypto");
61288
61872
 
61289
61873
  // ../../packages/api/src/node/node-terminal-service.ts
61290
- var fs16 = __toESM(require("fs"), 1);
61291
- var path16 = __toESM(require("path"), 1);
61874
+ var fs17 = __toESM(require("fs"), 1);
61875
+ var path17 = __toESM(require("path"), 1);
61292
61876
  var DEFAULT_OUTPUT_LIMIT_BYTES = 64 * 1024;
61293
61877
  function isAbsolutePath2(value) {
61294
- return path16.isAbsolute(value) || /^[A-Za-z]:[\/]/.test(value);
61878
+ return path17.isAbsolute(value) || /^[A-Za-z]:[\/]/.test(value);
61295
61879
  }
61296
61880
  function resolveNodeTerminalCwd(nodeId, rootPath, cwd) {
61297
61881
  if (!rootPath) {
61298
61882
  throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
61299
61883
  }
61300
61884
  const requestedCwd = cwd?.trim() || ".";
61301
- const resolved = isAbsolutePath2(requestedCwd) ? path16.resolve(requestedCwd) : path16.resolve(rootPath, requestedCwd);
61302
- if (!fs16.existsSync(resolved) || !fs16.statSync(resolved).isDirectory()) {
61885
+ const resolved = isAbsolutePath2(requestedCwd) ? path17.resolve(requestedCwd) : path17.resolve(rootPath, requestedCwd);
61886
+ if (!fs17.existsSync(resolved) || !fs17.statSync(resolved).isDirectory()) {
61303
61887
  throw new MeshyError("VALIDATION_ERROR", `Working directory does not exist: ${resolved}`, 400);
61304
61888
  }
61305
61889
  return resolved;
@@ -61363,7 +61947,7 @@ var NodeTerminalSessionService = class {
61363
61947
  }
61364
61948
  const cwd = resolveNodeTerminalCwd(nodeId, rootPath, options.cwd);
61365
61949
  const startedAt = Date.now();
61366
- const child = (0, import_node_child_process9.spawn)(normalizedCommand, {
61950
+ const child = (0, import_node_child_process10.spawn)(normalizedCommand, {
61367
61951
  cwd,
61368
61952
  shell: true,
61369
61953
  windowsHide: true,
@@ -61538,13 +62122,13 @@ function cancelTaskOnCurrentNode(deps, taskId, options = {}) {
61538
62122
  }
61539
62123
 
61540
62124
  // ../../packages/api/src/tasks/task-output-service.ts
61541
- var fs18 = __toESM(require("fs"), 1);
61542
- var path18 = __toESM(require("path"), 1);
62125
+ var fs19 = __toESM(require("fs"), 1);
62126
+ var path19 = __toESM(require("path"), 1);
61543
62127
 
61544
62128
  // ../../packages/api/src/preview/preview-server.ts
61545
62129
  var crypto3 = __toESM(require("crypto"), 1);
61546
- var fs17 = __toESM(require("fs"), 1);
61547
- var path17 = __toESM(require("path"), 1);
62130
+ var fs18 = __toESM(require("fs"), 1);
62131
+ var path18 = __toESM(require("path"), 1);
61548
62132
  var http2 = __toESM(require("http"), 1);
61549
62133
  var import_node_stream4 = require("stream");
61550
62134
  var import_promises6 = require("stream/promises");
@@ -61656,19 +62240,19 @@ function buildPreviewWorkerProxyHeaders(req) {
61656
62240
  // ../../packages/api/src/preview/preview-server.ts
61657
62241
  function resolvePreviewPath(rootPath, relativePath) {
61658
62242
  const sanitizedPath = relativePath.replace(/\\/g, "/");
61659
- const resolvedPath = path17.resolve(rootPath, sanitizedPath);
61660
- const normalizedRoot = path17.resolve(rootPath);
61661
- if (!resolvedPath.startsWith(normalizedRoot + path17.sep) && resolvedPath !== normalizedRoot) {
62243
+ const resolvedPath = path18.resolve(rootPath, sanitizedPath);
62244
+ const normalizedRoot = path18.resolve(rootPath);
62245
+ if (!resolvedPath.startsWith(normalizedRoot + path18.sep) && resolvedPath !== normalizedRoot) {
61662
62246
  throw new Error("Invalid preview path");
61663
62247
  }
61664
62248
  return {
61665
62249
  absolutePath: resolvedPath,
61666
- normalizedPath: path17.relative(normalizedRoot, resolvedPath).split(path17.sep).join("/")
62250
+ normalizedPath: path18.relative(normalizedRoot, resolvedPath).split(path18.sep).join("/")
61667
62251
  };
61668
62252
  }
61669
62253
  function resolvePreviewEntryPath(rootPath, entryPath) {
61670
62254
  const { absolutePath, normalizedPath } = resolvePreviewPath(rootPath, entryPath ?? "index.html");
61671
- if (!fs17.existsSync(absolutePath) || !fs17.statSync(absolutePath).isFile()) {
62255
+ if (!fs18.existsSync(absolutePath) || !fs18.statSync(absolutePath).isFile()) {
61672
62256
  throw new Error("Preview entry not found");
61673
62257
  }
61674
62258
  return normalizedPath;
@@ -61770,7 +62354,7 @@ var MIME_MAP2 = {
61770
62354
  ".mdx": "text/markdown"
61771
62355
  };
61772
62356
  function getMime(filePath) {
61773
- return MIME_MAP2[path17.extname(filePath).toLowerCase()] ?? "application/octet-stream";
62357
+ return MIME_MAP2[path18.extname(filePath).toLowerCase()] ?? "application/octet-stream";
61774
62358
  }
61775
62359
  function escapeHtml(value) {
61776
62360
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
@@ -62124,14 +62708,14 @@ async function sendPreviewAssetResponse(sessionManager, token, requestedPath, re
62124
62708
  res.end("Invalid path");
62125
62709
  return;
62126
62710
  }
62127
- if (!fs17.existsSync(resolved) || !fs17.statSync(resolved).isFile()) {
62711
+ if (!fs18.existsSync(resolved) || !fs18.statSync(resolved).isFile()) {
62128
62712
  res.writeHead(404, { "Content-Type": "text/plain" });
62129
62713
  res.end("File not found");
62130
62714
  return;
62131
62715
  }
62132
- const ext = path17.extname(resolved).toLowerCase();
62716
+ const ext = path18.extname(resolved).toLowerCase();
62133
62717
  const mime = ext === ".md" || ext === ".mdx" ? "text/html" : getMime(resolved);
62134
- const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(fs17.readFileSync(resolved, "utf8"), path17.basename(resolved)) : fs17.readFileSync(resolved);
62718
+ const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(fs18.readFileSync(resolved, "utf8"), path18.basename(resolved)) : fs18.readFileSync(resolved);
62135
62719
  res.writeHead(200, {
62136
62720
  "Content-Type": mime,
62137
62721
  "Content-Length": content.length,
@@ -62460,13 +63044,13 @@ function getLocalTaskOutputDownload(taskEngine, taskId, filePath) {
62460
63044
  const rootPath = getTaskOutputRoot(taskEngine, taskId);
62461
63045
  try {
62462
63046
  const absolutePath = resolveOutputPath(rootPath, filePath);
62463
- if (!fs18.existsSync(absolutePath) || !fs18.statSync(absolutePath).isFile()) {
63047
+ if (!fs19.existsSync(absolutePath) || !fs19.statSync(absolutePath).isFile()) {
62464
63048
  throw new MeshyError("TASK_NOT_FOUND", `File not found: ${filePath}`, 404);
62465
63049
  }
62466
63050
  const { mimeType } = classifyFile(absolutePath);
62467
- const fileName = path18.basename(absolutePath).replace(/"/g, "");
63051
+ const fileName = path19.basename(absolutePath).replace(/"/g, "");
62468
63052
  return {
62469
- content: fs18.readFileSync(absolutePath),
63053
+ content: fs19.readFileSync(absolutePath),
62470
63054
  headers: {
62471
63055
  "Content-Type": mimeType,
62472
63056
  "Content-Disposition": `inline; filename="${fileName}"`,
@@ -62679,12 +63263,13 @@ async function executeWorkerControlRequest(deps, request) {
62679
63263
  }
62680
63264
  case "node.sessions.list": {
62681
63265
  const self2 = deps.nodeRegistry.getSelf();
63266
+ const agent = payloadValue(request, "agent", "codex");
62682
63267
  response = jsonResponse(
62683
63268
  request.id,
62684
63269
  200,
62685
63270
  getLocalNodeNativeSessions(
62686
63271
  self2.id,
62687
- payloadValue(request, "agent", "codex"),
63272
+ agent === "claudecode" || agent === "copilot" ? agent : "codex",
62688
63273
  payloadValue(request, "limit", 50)
62689
63274
  )
62690
63275
  );
@@ -63742,10 +64327,15 @@ async function cancelRemoteTaskExecution(deps) {
63742
64327
  // ../../packages/api/src/tasks/task-session-import.ts
63743
64328
  var TASK_IMPORT_PROXY_TIMEOUT_MS = 1e4;
63744
64329
  function buildImportedSessionTitle(agent, sessionId) {
63745
- const label = agent === "codex" ? "Codex" : "Claude Code";
64330
+ const label = agent === "codex" ? "Codex" : agent === "copilot" ? "Copilot CLI" : "Claude Code";
63746
64331
  const suffix = sessionId.trim().slice(0, 12);
63747
64332
  return `${label} session ${suffix || "attached"}`;
63748
64333
  }
64334
+ function getNativeSessionAgentLabel(agent) {
64335
+ if (agent === "codex") return "Codex";
64336
+ if (agent === "copilot") return "Copilot CLI";
64337
+ return "Claude Code";
64338
+ }
63749
64339
  function resolveTargetImportNode(nodeRegistry, nodeId, agent) {
63750
64340
  const self2 = nodeRegistry.getSelf();
63751
64341
  const node = nodeRegistry.getNode(nodeId) ?? (self2?.id === nodeId ? self2 : null);
@@ -63775,7 +64365,7 @@ async function attachNativeSession(deps, body) {
63775
64365
  let importedLogs = history.logs;
63776
64366
  const task = deps.taskEngine.createTask({
63777
64367
  title: body.title?.trim() || buildImportedSessionTitle(body.agent, body.sessionId),
63778
- description: `Attached native ${body.agent === "codex" ? "Codex" : "Claude Code"} session`,
64368
+ description: `Attached native ${getNativeSessionAgentLabel(body.agent)} session`,
63779
64369
  agent: body.agent,
63780
64370
  project: body.cwd,
63781
64371
  conversationKind: "nativeSession",
@@ -65254,7 +65844,7 @@ function createWorkerRoutes() {
65254
65844
  let { logs } = body;
65255
65845
  if (logs.length === 0 && task.conversationKind === "nativeSession") {
65256
65846
  const sessionId = typeof task.payload?.sessionId === "string" ? task.payload.sessionId : "";
65257
- if (sessionId && (task.agent === "codex" || task.agent === "claudecode")) {
65847
+ if (sessionId && (task.agent === "codex" || task.agent === "claudecode" || task.agent === "copilot")) {
65258
65848
  logs = loadNativeSessionHistory({ agent: task.agent, sessionId }).logs;
65259
65849
  }
65260
65850
  }
@@ -65456,7 +66046,7 @@ function createSystemRoutes() {
65456
66046
  path: req.originalUrl || req.url,
65457
66047
  remoteAddress: req.ip || req.socket.remoteAddress
65458
66048
  });
65459
- res.json({ status: "ok", timestamp: Date.now() });
66049
+ res.json({ status: "ok", timestamp: Date.now(), pid: process.pid });
65460
66050
  }));
65461
66051
  router.get("/info", asyncHandler10(async (req, res) => {
65462
66052
  const {
@@ -65468,6 +66058,7 @@ function createSystemRoutes() {
65468
66058
  storagePath,
65469
66059
  inspectRuntimeTools: inspectTools,
65470
66060
  runtimeMetadata,
66061
+ getRuntimeUpdate,
65471
66062
  runtimeUpdate
65472
66063
  } = req.app.locals.deps;
65473
66064
  const self2 = nodeRegistry.getSelf();
@@ -65481,7 +66072,7 @@ function createSystemRoutes() {
65481
66072
  inspectRuntimeTools: inspectTools,
65482
66073
  localDashboardOrigin,
65483
66074
  runtimeMetadata,
65484
- runtimeUpdate,
66075
+ runtimeUpdate: getRuntimeUpdate?.() ?? runtimeUpdate,
65485
66076
  storagePath,
65486
66077
  workDir: self2.workDir
65487
66078
  });
@@ -65736,8 +66327,8 @@ function hasAuthorizationHeader(req) {
65736
66327
  function resolveRuntimeBaseDir() {
65737
66328
  const entryPath = process.argv[1];
65738
66329
  if (typeof entryPath === "string" && entryPath.length > 0) {
65739
- const resolved = fs19.realpathSync(path19.resolve(entryPath));
65740
- return path19.dirname(resolved);
66330
+ const resolved = fs20.realpathSync(path20.resolve(entryPath));
66331
+ return path20.dirname(resolved);
65741
66332
  }
65742
66333
  return process.cwd();
65743
66334
  }
@@ -65745,18 +66336,18 @@ function resolveStaticDir(baseDir) {
65745
66336
  const envStaticDir = process.env.MESHY_STATIC_DIR;
65746
66337
  const candidateDirs = [
65747
66338
  envStaticDir,
65748
- path19.resolve(baseDir, "dashboard"),
65749
- path19.resolve(baseDir, "../dashboard"),
65750
- path19.resolve(baseDir, "../../dashboard/dist"),
65751
- path19.resolve(baseDir, "../../../packages/dashboard/dist"),
65752
- path19.resolve(baseDir, "../public"),
65753
- path19.resolve(baseDir, "../../packages/api/public"),
65754
- path19.resolve(baseDir, "../../../packages/api/public"),
65755
- path19.resolve(process.cwd(), "packages/dashboard/dist"),
65756
- path19.resolve(process.cwd(), "packages/api/public")
66339
+ path20.resolve(baseDir, "dashboard"),
66340
+ path20.resolve(baseDir, "../dashboard"),
66341
+ path20.resolve(baseDir, "../../dashboard/dist"),
66342
+ path20.resolve(baseDir, "../../../packages/dashboard/dist"),
66343
+ path20.resolve(baseDir, "../public"),
66344
+ path20.resolve(baseDir, "../../packages/api/public"),
66345
+ path20.resolve(baseDir, "../../../packages/api/public"),
66346
+ path20.resolve(process.cwd(), "packages/dashboard/dist"),
66347
+ path20.resolve(process.cwd(), "packages/api/public")
65757
66348
  ].filter((value) => typeof value === "string" && value.length > 0);
65758
66349
  for (const candidate of candidateDirs) {
65759
- if (fs19.existsSync(candidate)) {
66350
+ if (fs20.existsSync(candidate)) {
65760
66351
  return candidate;
65761
66352
  }
65762
66353
  }
@@ -65864,8 +66455,8 @@ function createServer2(deps) {
65864
66455
  app.use("/api/node-operations", createNodeOperationRoutes());
65865
66456
  app.use("/api/events", createEventRoutes());
65866
66457
  if (staticDir) {
65867
- const indexPath = path19.join(staticDir, "index.html");
65868
- if (fs19.existsSync(indexPath)) {
66458
+ const indexPath = path20.join(staticDir, "index.html");
66459
+ if (fs20.existsSync(indexPath)) {
65869
66460
  app.get("*", (req, res, next) => {
65870
66461
  if (isApiRequest(req)) {
65871
66462
  next();
@@ -65979,12 +66570,12 @@ function detectLocalIp() {
65979
66570
  return "127.0.0.1";
65980
66571
  }
65981
66572
  function detectAvailablePort() {
65982
- return new Promise((resolve14, reject) => {
66573
+ return new Promise((resolve15, reject) => {
65983
66574
  const srv = (0, import_node_http2.createServer)();
65984
66575
  srv.listen(0, () => {
65985
66576
  const addr = srv.address();
65986
66577
  const port = addr && typeof addr !== "string" ? addr.port : 0;
65987
- srv.close((err) => err ? reject(err) : resolve14(port));
66578
+ srv.close((err) => err ? reject(err) : resolve15(port));
65988
66579
  });
65989
66580
  srv.on("error", reject);
65990
66581
  });
@@ -66029,10 +66620,10 @@ var DirectTransport = class {
66029
66620
  };
66030
66621
 
66031
66622
  // ../../packages/transport/src/devtunnel.ts
66032
- var import_node_child_process10 = require("child_process");
66623
+ var import_node_child_process11 = require("child_process");
66033
66624
  function isInstalled(cmd) {
66034
66625
  try {
66035
- (0, import_node_child_process10.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
66626
+ (0, import_node_child_process11.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
66036
66627
  return true;
66037
66628
  } catch {
66038
66629
  return false;
@@ -66055,18 +66646,18 @@ var DevTunnelTransport = class {
66055
66646
  );
66056
66647
  }
66057
66648
  try {
66058
- (0, import_node_child_process10.execSync)("devtunnel user show", { stdio: "pipe" });
66649
+ (0, import_node_child_process11.execSync)("devtunnel user show", { stdio: "pipe" });
66059
66650
  } catch {
66060
66651
  throw new Error(
66061
66652
  "Not logged in to devtunnel. Run: devtunnel user login"
66062
66653
  );
66063
66654
  }
66064
66655
  const hostArgs = this.buildHostArgs(localPort);
66065
- const child = (0, import_node_child_process10.spawn)("devtunnel", hostArgs, {
66656
+ const child = (0, import_node_child_process11.spawn)("devtunnel", hostArgs, {
66066
66657
  stdio: ["pipe", "pipe", "pipe"]
66067
66658
  });
66068
66659
  this.process = child;
66069
- this.publicUrl = await new Promise((resolve14, reject) => {
66660
+ this.publicUrl = await new Promise((resolve15, reject) => {
66070
66661
  const timeout = setTimeout(() => {
66071
66662
  child.kill();
66072
66663
  this.process = null;
@@ -66089,7 +66680,7 @@ var DevTunnelTransport = class {
66089
66680
  clearTimeout(timeout);
66090
66681
  child.stdout?.removeListener("data", onData);
66091
66682
  child.stderr?.removeListener("data", onErrData);
66092
- resolve14(url.replace(/\/+$/, ""));
66683
+ resolve15(url.replace(/\/+$/, ""));
66093
66684
  };
66094
66685
  child.stdout?.on("data", onData);
66095
66686
  child.stderr?.on("data", onErrData);
@@ -66121,14 +66712,14 @@ ${lines.join("")}`
66121
66712
  this.publicUrl = null;
66122
66713
  if (child.exitCode === null) {
66123
66714
  child.kill("SIGTERM");
66124
- await new Promise((resolve14) => {
66715
+ await new Promise((resolve15) => {
66125
66716
  const killTimer = setTimeout(() => {
66126
66717
  child.kill("SIGKILL");
66127
- resolve14();
66718
+ resolve15();
66128
66719
  }, 5e3);
66129
66720
  child.on("close", () => {
66130
66721
  clearTimeout(killTimer);
66131
- resolve14();
66722
+ resolve15();
66132
66723
  });
66133
66724
  });
66134
66725
  }
@@ -66167,7 +66758,7 @@ ${lines.join("")}`
66167
66758
  return;
66168
66759
  }
66169
66760
  try {
66170
- (0, import_node_child_process10.execFileSync)("devtunnel", ["access", "create", tunnelId, "--tenant"], { stdio: "pipe" });
66761
+ (0, import_node_child_process11.execFileSync)("devtunnel", ["access", "create", tunnelId, "--tenant"], { stdio: "pipe" });
66171
66762
  } catch (err) {
66172
66763
  if (isExistingTenantAccessError(err)) {
66173
66764
  return;
@@ -66183,7 +66774,7 @@ ${lines.join("")}`
66183
66774
  return void 0;
66184
66775
  }
66185
66776
  try {
66186
- (0, import_node_child_process10.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
66777
+ (0, import_node_child_process11.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
66187
66778
  return tunnelId;
66188
66779
  } catch {
66189
66780
  const createArgs = ["create", tunnelId];
@@ -66191,7 +66782,7 @@ ${lines.join("")}`
66191
66782
  createArgs.push("-a");
66192
66783
  }
66193
66784
  try {
66194
- (0, import_node_child_process10.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
66785
+ (0, import_node_child_process11.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
66195
66786
  return tunnelId;
66196
66787
  } catch (err) {
66197
66788
  throw new Error(
@@ -66203,13 +66794,13 @@ ${lines.join("")}`
66203
66794
  ensureTunnelPort(tunnelId, localPort) {
66204
66795
  const ports = this.listTunnelPorts(tunnelId);
66205
66796
  for (const stalePort of ports.filter((p) => p !== localPort)) {
66206
- (0, import_node_child_process10.execFileSync)("devtunnel", ["port", "delete", tunnelId, "-p", String(stalePort)], { stdio: "pipe" });
66797
+ (0, import_node_child_process11.execFileSync)("devtunnel", ["port", "delete", tunnelId, "-p", String(stalePort)], { stdio: "pipe" });
66207
66798
  }
66208
66799
  if (ports.includes(localPort)) {
66209
66800
  return;
66210
66801
  }
66211
66802
  try {
66212
- (0, import_node_child_process10.execFileSync)(
66803
+ (0, import_node_child_process11.execFileSync)(
66213
66804
  "devtunnel",
66214
66805
  ["port", "create", tunnelId, "-p", String(localPort), "--protocol", "http"],
66215
66806
  { stdio: "pipe" }
@@ -66225,7 +66816,7 @@ ${lines.join("")}`
66225
66816
  }
66226
66817
  listTunnelPorts(tunnelId) {
66227
66818
  try {
66228
- const output = (0, import_node_child_process10.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
66819
+ const output = (0, import_node_child_process11.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
66229
66820
  const parsed = JSON.parse(output.toString());
66230
66821
  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 : [];
66231
66822
  return items.map((item) => getPortNumber(item)).filter((value) => value !== void 0);
@@ -66237,7 +66828,7 @@ ${lines.join("")}`
66237
66828
  }
66238
66829
  hasTunnelPort(tunnelId, localPort) {
66239
66830
  try {
66240
- (0, import_node_child_process10.execFileSync)(
66831
+ (0, import_node_child_process11.execFileSync)(
66241
66832
  "devtunnel",
66242
66833
  ["port", "show", tunnelId, "-p", String(localPort), "-j"],
66243
66834
  { stdio: "pipe" }
@@ -66341,10 +66932,10 @@ var terminalWriter = {
66341
66932
  };
66342
66933
 
66343
66934
  // src/startup.ts
66344
- var fs20 = __toESM(require("fs"), 1);
66345
- var path20 = __toESM(require("path"), 1);
66935
+ var fs21 = __toESM(require("fs"), 1);
66936
+ var path21 = __toESM(require("path"), 1);
66346
66937
  var readline = __toESM(require("readline/promises"), 1);
66347
- var import_node_child_process11 = require("child_process");
66938
+ var import_node_child_process12 = require("child_process");
66348
66939
  function getDefaultNodeName() {
66349
66940
  return getDeviceNodeName();
66350
66941
  }
@@ -66354,7 +66945,7 @@ function isDevBoxEnvironment(env = process.env) {
66354
66945
  }
66355
66946
  var DEFAULT_NODE_NAME = getDefaultNodeName();
66356
66947
  var SUPPORTED_TRANSPORTS = ["direct", "devtunnel"];
66357
- var STARTUP_REQUIREMENTS = ["az", "devtunnel", "claude", "codex"];
66948
+ var STARTUP_REQUIREMENTS = ["az", "devtunnel", "claude", "codex", "copilot"];
66358
66949
  function createDefaultConfig(storagePath = resolveDefaultStoragePath(), nodeName = DEFAULT_NODE_NAME) {
66359
66950
  return {
66360
66951
  node: { name: nodeName, port: DEFAULT_NODE_PORT, workDir: process.cwd() },
@@ -66398,7 +66989,7 @@ function createPromptSession(prompt) {
66398
66989
  }
66399
66990
  function createDefaultCommandRunner(platform2) {
66400
66991
  return (command, args, interactive = false) => {
66401
- const result = (0, import_node_child_process11.spawnSync)(command, args, {
66992
+ const result = (0, import_node_child_process12.spawnSync)(command, args, {
66402
66993
  encoding: "utf-8",
66403
66994
  shell: platform2 === "win32",
66404
66995
  stdio: interactive ? "inherit" : "pipe"
@@ -66413,19 +67004,19 @@ function createDefaultCommandRunner(platform2) {
66413
67004
  };
66414
67005
  }
66415
67006
  function getNodeMetadataPath2(storagePath) {
66416
- return path20.join(storagePath, "metadata.json");
67007
+ return path21.join(storagePath, "metadata.json");
66417
67008
  }
66418
67009
  function readStartupMetadataFile(storagePath) {
66419
67010
  try {
66420
- const raw = JSON.parse(fs20.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
67011
+ const raw = JSON.parse(fs21.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
66421
67012
  return typeof raw === "object" && raw !== null ? raw : {};
66422
67013
  } catch {
66423
67014
  return {};
66424
67015
  }
66425
67016
  }
66426
67017
  function writeStartupMetadataFile(storagePath, metadata) {
66427
- fs20.mkdirSync(storagePath, { recursive: true });
66428
- fs20.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
67018
+ fs21.mkdirSync(storagePath, { recursive: true });
67019
+ fs21.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
66429
67020
  }
66430
67021
  function formatLocalDate2(now) {
66431
67022
  const year = now.getFullYear();
@@ -66476,6 +67067,8 @@ function buildInstallCommand(requirement, platform2) {
66476
67067
  return void 0;
66477
67068
  case "codex":
66478
67069
  return { command: "npm", args: ["install", "-g", "@openai/codex"] };
67070
+ case "copilot":
67071
+ return { command: "npm", args: ["install", "-g", "@github/copilot"] };
66479
67072
  }
66480
67073
  }
66481
67074
  function buildLoginCommand(requirement) {
@@ -66507,7 +67100,7 @@ function isRequirementSatisfied(requirement, status) {
66507
67100
  return true;
66508
67101
  }
66509
67102
  function sleep2(ms) {
66510
- return new Promise((resolve14) => setTimeout(resolve14, ms));
67103
+ return new Promise((resolve15) => setTimeout(resolve15, ms));
66511
67104
  }
66512
67105
  function areCachedAuthRequirementsCurrent(commandRunner) {
66513
67106
  return isAuthenticated("az", commandRunner) && isAuthenticated("devtunnel", commandRunner);
@@ -66664,9 +67257,9 @@ async function ensureStartupRequirements(storagePath, options = {}) {
66664
67257
  metadata
66665
67258
  };
66666
67259
  }
66667
- function loadConfigFile(path22) {
67260
+ function loadConfigFile(path23) {
66668
67261
  try {
66669
- const raw = fs20.readFileSync(path22, "utf-8");
67262
+ const raw = fs21.readFileSync(path23, "utf-8");
66670
67263
  return JSON.parse(raw);
66671
67264
  } catch {
66672
67265
  return {};
@@ -66845,26 +67438,26 @@ function formatLoadedStartMetadata(info, authEnabled) {
66845
67438
  }
66846
67439
 
66847
67440
  // src/runtime-metadata.ts
66848
- var fs21 = __toESM(require("fs"), 1);
66849
- var path21 = __toESM(require("path"), 1);
66850
- var import_node_child_process12 = require("child_process");
67441
+ var fs22 = __toESM(require("fs"), 1);
67442
+ var path22 = __toESM(require("path"), 1);
67443
+ var import_node_child_process13 = require("child_process");
66851
67444
  var runtimeDir = resolveRuntimeDir();
66852
67445
  var appRoot = resolveAppRoot(runtimeDir);
66853
- var repoRoot = path21.resolve(appRoot, "../..");
67446
+ var repoRoot = path22.resolve(appRoot, "../..");
66854
67447
  function resolveRuntimeDir() {
66855
67448
  const entryPath = process.argv[1];
66856
67449
  if (typeof entryPath === "string" && entryPath.length > 0) {
66857
67450
  try {
66858
- return path21.dirname(fs21.realpathSync(path21.resolve(entryPath)));
67451
+ return path22.dirname(fs22.realpathSync(path22.resolve(entryPath)));
66859
67452
  } catch {
66860
- return path21.dirname(path21.resolve(entryPath));
67453
+ return path22.dirname(path22.resolve(entryPath));
66861
67454
  }
66862
67455
  }
66863
67456
  return process.cwd();
66864
67457
  }
66865
67458
  function readJsonFile(filePath) {
66866
67459
  try {
66867
- return JSON.parse(fs21.readFileSync(filePath, "utf-8"));
67460
+ return JSON.parse(fs22.readFileSync(filePath, "utf-8"));
66868
67461
  } catch {
66869
67462
  return null;
66870
67463
  }
@@ -66874,9 +67467,9 @@ function readPackageManifest(filePath) {
66874
67467
  }
66875
67468
  function readEmbeddedRuntimeMetadata() {
66876
67469
  const candidates = [
66877
- path21.join(appRoot, "runtime-metadata.json"),
66878
- path21.join(runtimeDir, "runtime-metadata.json"),
66879
- path21.resolve(process.cwd(), "apps/node/dist/runtime-metadata.json")
67470
+ path22.join(appRoot, "runtime-metadata.json"),
67471
+ path22.join(runtimeDir, "runtime-metadata.json"),
67472
+ path22.resolve(process.cwd(), "apps/node/dist/runtime-metadata.json")
66880
67473
  ];
66881
67474
  for (const candidate of candidates) {
66882
67475
  const metadata = readJsonFile(candidate);
@@ -66889,23 +67482,23 @@ function readEmbeddedRuntimeMetadata() {
66889
67482
  function resolveAppRoot(baseDir) {
66890
67483
  const candidates = [
66891
67484
  baseDir,
66892
- path21.resolve(baseDir, ".."),
66893
- path21.resolve(process.cwd(), "apps/node/dist"),
66894
- path21.resolve(process.cwd(), "apps/node"),
67485
+ path22.resolve(baseDir, ".."),
67486
+ path22.resolve(process.cwd(), "apps/node/dist"),
67487
+ path22.resolve(process.cwd(), "apps/node"),
66895
67488
  process.cwd()
66896
67489
  ];
66897
67490
  for (const candidate of candidates) {
66898
- const manifest = readPackageManifest(path21.join(candidate, "package.json"));
67491
+ const manifest = readPackageManifest(path22.join(candidate, "package.json"));
66899
67492
  if (manifest?.name === "@meshy/node" || manifest?.name === "meshy-node") {
66900
67493
  return candidate;
66901
67494
  }
66902
67495
  }
66903
67496
  for (const candidate of candidates) {
66904
- if (fs21.existsSync(path21.join(candidate, "package.json"))) {
67497
+ if (fs22.existsSync(path22.join(candidate, "package.json"))) {
66905
67498
  return candidate;
66906
67499
  }
66907
67500
  }
66908
- return path21.resolve(baseDir, "..");
67501
+ return path22.resolve(baseDir, "..");
66909
67502
  }
66910
67503
  function toPackageInfo(filePath) {
66911
67504
  const manifest = readPackageManifest(filePath);
@@ -66943,7 +67536,7 @@ function readRepositoryUrlFromManifest(manifest) {
66943
67536
  }
66944
67537
  function readGitValue(args) {
66945
67538
  try {
66946
- const output = (0, import_node_child_process12.execFileSync)("git", args, {
67539
+ const output = (0, import_node_child_process13.execFileSync)("git", args, {
66947
67540
  cwd: repoRoot,
66948
67541
  encoding: "utf-8",
66949
67542
  stdio: ["ignore", "pipe", "ignore"],
@@ -66965,8 +67558,8 @@ function buildRuntimeMetadata(storagePath) {
66965
67558
  components: startupRequirements.components
66966
67559
  };
66967
67560
  }
66968
- const appPackage = toPackageInfo(path21.join(appRoot, "package.json"));
66969
- const workspaceManifest = readPackageManifest(path21.join(repoRoot, "package.json"));
67561
+ const appPackage = toPackageInfo(path22.join(appRoot, "package.json"));
67562
+ const workspaceManifest = readPackageManifest(path22.join(repoRoot, "package.json"));
66970
67563
  return {
66971
67564
  packageName: appPackage?.name ?? "meshy",
66972
67565
  packageVersion: appPackage?.version ?? "0.1.0",
@@ -66974,11 +67567,11 @@ function buildRuntimeMetadata(storagePath) {
66974
67567
  startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
66975
67568
  components: startupRequirements.components,
66976
67569
  packages: {
66977
- workspace: toPackageInfo(path21.join(repoRoot, "package.json")),
67570
+ workspace: toPackageInfo(path22.join(repoRoot, "package.json")),
66978
67571
  node: appPackage,
66979
- core: toPackageInfo(path21.join(repoRoot, "packages/core/package.json")),
66980
- dashboard: toPackageInfo(path21.join(repoRoot, "packages/dashboard/package.json")),
66981
- api: toPackageInfo(path21.join(repoRoot, "packages/api/package.json"))
67572
+ core: toPackageInfo(path22.join(repoRoot, "packages/core/package.json")),
67573
+ dashboard: toPackageInfo(path22.join(repoRoot, "packages/dashboard/package.json")),
67574
+ api: toPackageInfo(path22.join(repoRoot, "packages/api/package.json"))
66982
67575
  },
66983
67576
  repository: {
66984
67577
  url: normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.upstream.url"])) ?? normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.origin.url"])) ?? readRepositoryUrlFromManifest(workspaceManifest),
@@ -66989,9 +67582,10 @@ function buildRuntimeMetadata(storagePath) {
66989
67582
  }
66990
67583
 
66991
67584
  // src/bootstrap/runtime-restart.ts
66992
- var fs22 = __toESM(require("fs"), 1);
67585
+ var fs23 = __toESM(require("fs"), 1);
66993
67586
  var nodePath2 = __toESM(require("path"), 1);
66994
- var import_node_child_process13 = require("child_process");
67587
+ var import_node_child_process14 = require("child_process");
67588
+ var RUNTIME_UPDATE_CHECK_INTERVAL_MS = 6 * 60 * 60 * 1e3;
66995
67589
  function resolveRuntimeRestartStartArgs(hydratedArgs, restartArgs) {
66996
67590
  return restartArgs ? { ...restartArgs } : hydratedArgs;
66997
67591
  }
@@ -67074,12 +67668,6 @@ async function waitForEndpointDown() {
67074
67668
  process.exit(1);
67075
67669
  });
67076
67670
  `;
67077
- function formatLocalDate3(date3) {
67078
- const year = date3.getFullYear();
67079
- const month = String(date3.getMonth() + 1).padStart(2, "0");
67080
- const day = String(date3.getDate()).padStart(2, "0");
67081
- return `${year}-${month}-${day}`;
67082
- }
67083
67671
  function normalizeOutput2(output) {
67084
67672
  if (!output) return null;
67085
67673
  const firstLine = output.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
@@ -67105,7 +67693,7 @@ function compareSemver2(left, right) {
67105
67693
  return 0;
67106
67694
  }
67107
67695
  function runRuntimePackageCommand(command, args) {
67108
- const result = (0, import_node_child_process13.spawnSync)(command, args, {
67696
+ const result = (0, import_node_child_process14.spawnSync)(command, args, {
67109
67697
  encoding: "utf-8",
67110
67698
  windowsHide: true,
67111
67699
  timeout: 2500
@@ -67144,7 +67732,7 @@ function createSpawnableCommand(command, args, platform2) {
67144
67732
  }
67145
67733
  function readProcessCommand(pid, platform2) {
67146
67734
  if (platform2 === "win32") return null;
67147
- const result = (0, import_node_child_process13.spawnSync)("ps", ["-p", String(pid), "-o", "args="], {
67735
+ const result = (0, import_node_child_process14.spawnSync)("ps", ["-p", String(pid), "-o", "args="], {
67148
67736
  encoding: "utf-8",
67149
67737
  windowsHide: true,
67150
67738
  timeout: 1e3
@@ -67235,9 +67823,9 @@ function createRuntimeRestartLaunchPlan(options) {
67235
67823
  };
67236
67824
  }
67237
67825
  function scheduleRuntimeRestart(plan, options = {}) {
67238
- fs22.mkdirSync(nodePath2.dirname(plan.logPath), { recursive: true });
67239
- const logFd = fs22.openSync(plan.logPath, "a");
67240
- const spawnImpl = options.spawnImpl ?? import_node_child_process13.spawn;
67826
+ fs23.mkdirSync(nodePath2.dirname(plan.logPath), { recursive: true });
67827
+ const logFd = fs23.openSync(plan.logPath, "a");
67828
+ const spawnImpl = options.spawnImpl ?? import_node_child_process14.spawn;
67241
67829
  const env = {
67242
67830
  ...process.env,
67243
67831
  MESHY_RESTART_PARENT_PID: String(options.parentPid ?? process.pid),
@@ -67268,18 +67856,18 @@ function createRuntimeUpdateSnapshot(options) {
67268
67856
  };
67269
67857
  }
67270
67858
  const cache = options.updateCache ?? runtimeUpdateCache;
67271
- const checkedOn = formatLocalDate3(now);
67859
+ const nowMs = now.getTime();
67272
67860
  const cached2 = cache.get(packageName);
67273
67861
  let latestVersion = cached2?.latestVersion ?? null;
67274
67862
  let detail = cached2?.detail ?? null;
67275
67863
  let updateCheckedAt = cached2?.checkedAt ?? checkedAt;
67276
- if (cached2?.checkedOn !== checkedOn) {
67864
+ if (!cached2 || nowMs - cached2.checkedAtMs >= RUNTIME_UPDATE_CHECK_INTERVAL_MS) {
67277
67865
  const runner = options.commandRunner ?? runRuntimePackageCommand;
67278
67866
  const result = runner("npm", ["view", `${packageName}@latest`, "version", "--json"]);
67279
67867
  latestVersion = result.status === 0 ? normalizePackageVersion2(result.stdout) : null;
67280
67868
  detail = result.status === 0 ? null : normalizeOutput2(result.stderr) ?? result.error ?? "Runtime update check failed";
67281
67869
  updateCheckedAt = checkedAt;
67282
- cache.set(packageName, { checkedOn, checkedAt, latestVersion, detail });
67870
+ cache.set(packageName, { checkedAt, checkedAtMs: nowMs, latestVersion, detail });
67283
67871
  }
67284
67872
  return {
67285
67873
  packageName,
@@ -67831,7 +68419,7 @@ function registerShutdownHandlers(options) {
67831
68419
  }
67832
68420
  async function startNode(args) {
67833
68421
  const { authMetadata, config: config2, hydratedArgs, runtimeMetadata, storageRoot } = await resolveStartConfig(args);
67834
- terminalWriter.line("Checking startup requirements (az, devtunnel, claude, codex)...");
68422
+ terminalWriter.line("Checking startup requirements (az, devtunnel, claude, codex, copilot)...");
67835
68423
  const startupRequirements = await ensureStartupRequirements(config2.storage.path);
67836
68424
  terminalWriter.line(
67837
68425
  startupRequirements.skipped ? "Startup requirements already verified today; skipping checks." : "Startup requirements check complete."
@@ -67857,11 +68445,12 @@ async function startNode(args) {
67857
68445
  } else {
67858
68446
  setRequestAuthHeadersProvider(null);
67859
68447
  }
68448
+ const runtimeRestartMode = detectRuntimeRestartMode();
67860
68449
  const settingsSnapshotProvider = createSettingsSnapshotProvider({
67861
68450
  authMetadata,
67862
68451
  localDashboardOrigin,
67863
68452
  runtimeMetadata,
67864
- runtimeRestartMode: detectRuntimeRestartMode(),
68453
+ runtimeRestartMode,
67865
68454
  storagePath: config2.storage.path,
67866
68455
  workDir: nodePath3.resolve(config2.node.workDir ?? process.cwd())
67867
68456
  });
@@ -67905,7 +68494,8 @@ async function startNode(args) {
67905
68494
  engineRegistry: meshyNode.getEngineRegistry(),
67906
68495
  liteAgentRunner: new LiteAgentRunner({
67907
68496
  claudecode: new ClaudeLiteAdapter(),
67908
- codex: new CodexLiteAdapter()
68497
+ codex: new CodexLiteAdapter(),
68498
+ copilot: new CopilotLiteAdapter()
67909
68499
  }),
67910
68500
  logger: meshyNode.getLogger(),
67911
68501
  config: {
@@ -67985,8 +68575,8 @@ async function startNode(args) {
67985
68575
  return { ok: true, pid };
67986
68576
  },
67987
68577
  refreshSettingsSnapshot,
67988
- runtimeUpdate: createRuntimeUpdateSnapshot({
67989
- mode: detectRuntimeRestartMode(),
68578
+ getRuntimeUpdate: () => createRuntimeUpdateSnapshot({
68579
+ mode: runtimeRestartMode,
67990
68580
  runtimeMetadata
67991
68581
  }),
67992
68582
  dashboardOrigin: tunnelManager.getDashboardOrigin(),