meshy-node 0.5.8 → 0.5.10
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/README.md +1 -1
- package/dashboard/assets/DashboardPage-D99zb0K5.js +134 -0
- package/dashboard/assets/{DashboardShared-EIrXwlKQ.js → DashboardShared-BxFVLWCW.js} +1 -1
- package/dashboard/assets/{DiffTab-RR71B7Td.js → DiffTab-CCkYhHjJ.js} +1 -1
- package/dashboard/assets/{FilesTab-BzAuq2V1.js → FilesTab-DE1KBLuK.js} +1 -1
- package/dashboard/assets/{PreviewTab-Dul4hiGt.js → PreviewTab-DyPteJzn.js} +1 -1
- package/dashboard/assets/{SharedConversationPage-DmimAj_x.js → SharedConversationPage-C5DPKR6h.js} +3 -3
- package/dashboard/assets/{file-CL1x0Gq_.js → file-CPgr4Lmg.js} +1 -1
- package/dashboard/assets/{folder-B7_msHnX.js → folder-Dz5kKBPA.js} +1 -1
- package/dashboard/assets/index-8cqzkk9G.css +1 -0
- package/dashboard/assets/index-zL1SJg1p.js +301 -0
- package/dashboard/assets/{play-IZPebZI4.js → play-DwWmtMUk.js} +1 -1
- package/dashboard/index.html +2 -2
- package/main.cjs +1085 -490
- package/package.json +1 -1
- package/runtime-metadata.json +5 -5
- package/dashboard/assets/DashboardPage-DZvoRYz2.js +0 -134
- package/dashboard/assets/index-BlCzIaoB.css +0 -1
- package/dashboard/assets/index-C8QVuMfU.js +0 -301
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((
|
|
4653
|
-
req2.once("response",
|
|
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((
|
|
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
|
-
|
|
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:
|
|
5786
|
-
const fullPath = [...
|
|
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,
|
|
6097
|
+
constructor(parent, value, path23, key) {
|
|
6098
6098
|
this._cachedPath = [];
|
|
6099
6099
|
this.parent = parent;
|
|
6100
6100
|
this.data = value;
|
|
6101
|
-
this._path =
|
|
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
|
|
10743
|
-
stream2 = new
|
|
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(
|
|
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
|
-
|
|
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
|
|
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(
|
|
23534
|
-
if (!
|
|
23533
|
+
function lookup(path23) {
|
|
23534
|
+
if (!path23 || typeof path23 !== "string") {
|
|
23535
23535
|
return false;
|
|
23536
23536
|
}
|
|
23537
|
-
var extension2 =
|
|
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(
|
|
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 (
|
|
27070
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
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
|
|
27078
|
+
return path23;
|
|
27079
27079
|
}
|
|
27080
|
-
if (Array.isArray(
|
|
27081
|
-
|
|
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(
|
|
27084
|
+
return new RegExp(path23.join("|"), flags);
|
|
27085
27085
|
}
|
|
27086
|
-
if (typeof
|
|
27086
|
+
if (typeof path23 !== "string") {
|
|
27087
27087
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
27088
27088
|
}
|
|
27089
|
-
|
|
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 +=
|
|
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(
|
|
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
|
-
|
|
27148
|
+
path23 += strict ? "" : path23[path23.length - 1] === "/" ? "?" : "/?";
|
|
27149
27149
|
if (end) {
|
|
27150
|
-
|
|
27151
|
-
} else if (
|
|
27152
|
-
|
|
27150
|
+
path23 += "$";
|
|
27151
|
+
} else if (path23[path23.length - 1] !== "/") {
|
|
27152
|
+
path23 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
27153
27153
|
}
|
|
27154
|
-
return new RegExp("^" +
|
|
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(
|
|
27167
|
+
function Layer(path23, options, fn) {
|
|
27168
27168
|
if (!(this instanceof Layer)) {
|
|
27169
|
-
return new Layer(
|
|
27169
|
+
return new Layer(path23, options, fn);
|
|
27170
27170
|
}
|
|
27171
|
-
debug("new %o",
|
|
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(
|
|
27178
|
-
this.regexp.fast_star =
|
|
27179
|
-
this.regexp.fast_slash =
|
|
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(
|
|
27203
|
+
Layer.prototype.match = function match(path23) {
|
|
27204
27204
|
var match2;
|
|
27205
|
-
if (
|
|
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(
|
|
27213
|
-
this.path =
|
|
27212
|
+
this.params = { "0": decode_param(path23) };
|
|
27213
|
+
this.path = path23;
|
|
27214
27214
|
return true;
|
|
27215
27215
|
}
|
|
27216
|
-
match2 = this.regexp.exec(
|
|
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(
|
|
27310
|
-
this.path =
|
|
27309
|
+
function Route(path23) {
|
|
27310
|
+
this.path = path23;
|
|
27311
27311
|
this.stack = [];
|
|
27312
|
-
debug("new %o",
|
|
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
|
|
27526
|
-
if (
|
|
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,
|
|
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,
|
|
27572
|
+
trim_prefix(layer, layerError, layerPath, path23);
|
|
27573
27573
|
}
|
|
27574
27574
|
sync = 0;
|
|
27575
27575
|
});
|
|
27576
27576
|
}
|
|
27577
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
27577
|
+
function trim_prefix(layer, layerError, layerPath, path23) {
|
|
27578
27578
|
if (layerPath.length !== 0) {
|
|
27579
|
-
if (layerPath !==
|
|
27579
|
+
if (layerPath !== path23.slice(0, layerPath.length)) {
|
|
27580
27580
|
next(layerError);
|
|
27581
27581
|
return;
|
|
27582
27582
|
}
|
|
27583
|
-
var c =
|
|
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
|
|
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
|
-
|
|
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",
|
|
27682
|
-
var layer = new Layer(
|
|
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(
|
|
27693
|
-
var route2 = new Route(
|
|
27694
|
-
var layer = new Layer(
|
|
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(
|
|
27705
|
-
var route = this.route(
|
|
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,
|
|
27741
|
+
function matchLayer(layer, path23) {
|
|
27742
27742
|
try {
|
|
27743
|
-
return layer.match(
|
|
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
|
|
27862
|
-
var
|
|
27863
|
-
var dirname7 =
|
|
27864
|
-
var basename5 =
|
|
27865
|
-
var
|
|
27866
|
-
var
|
|
27867
|
-
var
|
|
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 =
|
|
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
|
|
27896
|
+
var path24;
|
|
27897
27897
|
var roots = [].concat(this.root);
|
|
27898
27898
|
debug('lookup "%s"', name2);
|
|
27899
|
-
for (var i = 0; i < roots.length && !
|
|
27899
|
+
for (var i = 0; i < roots.length && !path24; i++) {
|
|
27900
27900
|
var root = roots[i];
|
|
27901
|
-
var loc =
|
|
27901
|
+
var loc = resolve15(root, name2);
|
|
27902
27902
|
var dir = dirname7(loc);
|
|
27903
27903
|
var file = basename5(loc);
|
|
27904
|
-
|
|
27904
|
+
path24 = this.resolve(dir, file);
|
|
27905
27905
|
}
|
|
27906
|
-
return
|
|
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
|
|
27912
|
+
View.prototype.resolve = function resolve16(dir, file) {
|
|
27913
27913
|
var ext = this.ext;
|
|
27914
|
-
var
|
|
27915
|
-
var stat = tryStat(
|
|
27914
|
+
var path24 = join17(dir, file);
|
|
27915
|
+
var stat = tryStat(path24);
|
|
27916
27916
|
if (stat && stat.isFile()) {
|
|
27917
|
-
return
|
|
27917
|
+
return path24;
|
|
27918
27918
|
}
|
|
27919
|
-
|
|
27920
|
-
stat = tryStat(
|
|
27919
|
+
path24 = join17(dir, basename5(file, ext), "index" + ext);
|
|
27920
|
+
stat = tryStat(path24);
|
|
27921
27921
|
if (stat && stat.isFile()) {
|
|
27922
|
-
return
|
|
27922
|
+
return path24;
|
|
27923
27923
|
}
|
|
27924
27924
|
};
|
|
27925
|
-
function tryStat(
|
|
27926
|
-
debug('stat "%s"',
|
|
27925
|
+
function tryStat(path24) {
|
|
27926
|
+
debug('stat "%s"', path24);
|
|
27927
27927
|
try {
|
|
27928
|
-
return
|
|
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
|
|
28226
|
-
var
|
|
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 =
|
|
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(
|
|
28256
|
-
var ext =
|
|
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
|
|
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
|
|
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
|
|
28379
|
-
var
|
|
28380
|
-
var normalize =
|
|
28381
|
-
var
|
|
28382
|
-
var sep5 =
|
|
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,
|
|
28389
|
-
return new SendStream(req,
|
|
28388
|
+
function send(req, path24, options) {
|
|
28389
|
+
return new SendStream(req, path24, options);
|
|
28390
28390
|
}
|
|
28391
|
-
function SendStream(req,
|
|
28391
|
+
function SendStream(req, path24, options) {
|
|
28392
28392
|
Stream.call(this);
|
|
28393
28393
|
var opts = options || {};
|
|
28394
28394
|
this.options = opts;
|
|
28395
|
-
this.path =
|
|
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 ?
|
|
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(
|
|
28442
|
-
this._root =
|
|
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(
|
|
28555
|
+
SendStream.prototype.redirect = function redirect(path24) {
|
|
28556
28556
|
var res = this.res;
|
|
28557
28557
|
if (hasListeners(this, "directory")) {
|
|
28558
|
-
this.emit("directory", res,
|
|
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
|
|
28579
|
-
if (
|
|
28578
|
+
var path24 = decode(this.path);
|
|
28579
|
+
if (path24 === -1) {
|
|
28580
28580
|
this.error(400);
|
|
28581
28581
|
return res;
|
|
28582
28582
|
}
|
|
28583
|
-
if (~
|
|
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 (
|
|
28590
|
-
|
|
28589
|
+
if (path24) {
|
|
28590
|
+
path24 = normalize("." + sep5 + path24);
|
|
28591
28591
|
}
|
|
28592
|
-
if (UP_PATH_REGEXP.test(
|
|
28593
|
-
debug('malicious path "%s"',
|
|
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 =
|
|
28598
|
-
|
|
28597
|
+
parts = path24.split(sep5);
|
|
28598
|
+
path24 = normalize(join17(root, path24));
|
|
28599
28599
|
} else {
|
|
28600
|
-
if (UP_PATH_REGEXP.test(
|
|
28601
|
-
debug('malicious path "%s"',
|
|
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(
|
|
28606
|
-
|
|
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,
|
|
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(
|
|
28627
|
+
this.sendIndex(path24);
|
|
28628
28628
|
return res;
|
|
28629
28629
|
}
|
|
28630
|
-
this.sendFile(
|
|
28630
|
+
this.sendFile(path24);
|
|
28631
28631
|
return res;
|
|
28632
28632
|
};
|
|
28633
|
-
SendStream.prototype.send = function send2(
|
|
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"',
|
|
28646
|
-
this.setHeader(
|
|
28647
|
-
this.type(
|
|
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(
|
|
28696
|
+
this.stream(path24, opts);
|
|
28697
28697
|
};
|
|
28698
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
28698
|
+
SendStream.prototype.sendFile = function sendFile(path24) {
|
|
28699
28699
|
var i = 0;
|
|
28700
28700
|
var self2 = this;
|
|
28701
|
-
debug('stat "%s"',
|
|
28702
|
-
|
|
28703
|
-
if (err && err.code === "ENOENT" && !
|
|
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(
|
|
28708
|
-
self2.emit("file",
|
|
28709
|
-
self2.send(
|
|
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 =
|
|
28715
|
+
var p = path24 + "." + self2._extensions[i++];
|
|
28716
28716
|
debug('stat "%s"', p);
|
|
28717
|
-
|
|
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(
|
|
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 =
|
|
28733
|
+
var p = join17(path24, self2._index[i]);
|
|
28734
28734
|
debug('stat "%s"', p);
|
|
28735
|
-
|
|
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(
|
|
28744
|
+
SendStream.prototype.stream = function stream(path24, options) {
|
|
28745
28745
|
var self2 = this;
|
|
28746
28746
|
var res = this.res;
|
|
28747
|
-
var stream2 =
|
|
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(
|
|
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(
|
|
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(
|
|
28774
|
+
SendStream.prototype.setHeader = function setHeader(path24, stat) {
|
|
28775
28775
|
var res = this.res;
|
|
28776
|
-
this.emit("headers", res,
|
|
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(
|
|
28835
|
+
function decode(path24) {
|
|
28836
28836
|
try {
|
|
28837
|
-
return decodeURIComponent(
|
|
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(
|
|
29748
|
-
if ("/" ===
|
|
29749
|
-
if (":" ===
|
|
29750
|
-
if ("\\\\" ===
|
|
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
|
|
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",
|
|
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
|
|
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
|
-
|
|
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(
|
|
29980
|
+
return router.use(path23, fn2);
|
|
29981
29981
|
}
|
|
29982
|
-
debug(".use app under %s",
|
|
29983
|
-
fn2.mountpath =
|
|
29982
|
+
debug(".use app under %s", path23);
|
|
29983
|
+
fn2.mountpath = path23;
|
|
29984
29984
|
fn2.parent = this;
|
|
29985
|
-
router.use(
|
|
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(
|
|
29997
|
+
app.route = function route(path23) {
|
|
29998
29998
|
this.lazyrouter();
|
|
29999
|
-
return this._router.route(
|
|
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
|
|
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(
|
|
30066
|
+
app[method] = function(path23) {
|
|
30067
30067
|
if (method === "get" && arguments.length === 1) {
|
|
30068
|
-
return this.set(
|
|
30068
|
+
return this.set(path23);
|
|
30069
30069
|
}
|
|
30070
30070
|
this.lazyrouter();
|
|
30071
|
-
var route = this._router.route(
|
|
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(
|
|
30076
|
+
app.all = function all(path23) {
|
|
30077
30077
|
this.lazyrouter();
|
|
30078
|
-
var route = this._router.route(
|
|
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
|
|
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
|
|
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
|
|
31169
|
+
var extname4 = path23.extname;
|
|
31170
31170
|
var mime = send.mime;
|
|
31171
|
-
var
|
|
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(
|
|
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 (!
|
|
31354
|
+
if (!path24) {
|
|
31355
31355
|
throw new TypeError("path argument is required to res.sendFile");
|
|
31356
31356
|
}
|
|
31357
|
-
if (typeof
|
|
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(
|
|
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(
|
|
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(
|
|
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,
|
|
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(
|
|
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 ||
|
|
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 ?
|
|
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(
|
|
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
|
|
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 =
|
|
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
|
|
31732
|
-
if (
|
|
31733
|
-
|
|
31731
|
+
var path23 = parseUrl(req).pathname;
|
|
31732
|
+
if (path23 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
31733
|
+
path23 = "";
|
|
31734
31734
|
}
|
|
31735
|
-
var stream = send(req,
|
|
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,
|
|
32073
|
-
if (!
|
|
32072
|
+
function getElementAtPath(obj, path23) {
|
|
32073
|
+
if (!path23)
|
|
32074
32074
|
return obj;
|
|
32075
|
-
return
|
|
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(
|
|
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(
|
|
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((
|
|
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((
|
|
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
|
-
|
|
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((
|
|
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(
|
|
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 =
|
|
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
|
|
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(
|
|
42075
|
-
let input =
|
|
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 [
|
|
42328
|
-
wsComponent.path =
|
|
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
|
|
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:
|
|
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,
|
|
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,
|
|
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
|
|
46553
|
-
function checkPathExt(
|
|
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 &&
|
|
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,
|
|
46570
|
+
function checkStat(stat, path23, options) {
|
|
46571
46571
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
46572
46572
|
return false;
|
|
46573
46573
|
}
|
|
46574
|
-
return checkPathExt(
|
|
46574
|
+
return checkPathExt(path23, options);
|
|
46575
46575
|
}
|
|
46576
|
-
function isexe(
|
|
46577
|
-
|
|
46578
|
-
cb(er, er ? false : checkStat(stat,
|
|
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(
|
|
46582
|
-
return checkStat(
|
|
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
|
|
46594
|
-
function isexe(
|
|
46595
|
-
|
|
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(
|
|
46600
|
-
return checkStat(
|
|
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
|
|
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(
|
|
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(
|
|
46644
|
-
isexe(
|
|
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
|
-
|
|
46648
|
+
resolve15(is);
|
|
46649
46649
|
}
|
|
46650
46650
|
});
|
|
46651
46651
|
});
|
|
46652
46652
|
}
|
|
46653
|
-
core(
|
|
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(
|
|
46663
|
+
function sync(path23, options) {
|
|
46664
46664
|
try {
|
|
46665
|
-
return core.sync(
|
|
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
|
|
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((
|
|
46715
|
+
const step = (i) => new Promise((resolve15, reject) => {
|
|
46716
46716
|
if (i === pathEnv.length)
|
|
46717
|
-
return opt.all && found.length ?
|
|
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 =
|
|
46720
|
+
const pCmd = path23.join(pathPart, cmd);
|
|
46721
46721
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
46722
|
-
|
|
46722
|
+
resolve15(subStep(p, i, 0));
|
|
46723
46723
|
});
|
|
46724
|
-
const subStep = (p, i, ii) => new Promise((
|
|
46724
|
+
const subStep = (p, i, ii) => new Promise((resolve15, reject) => {
|
|
46725
46725
|
if (ii === pathExt.length)
|
|
46726
|
-
return
|
|
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
|
|
46733
|
+
return resolve15(p + ext);
|
|
46734
46734
|
}
|
|
46735
|
-
return
|
|
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 =
|
|
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
|
|
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 ?
|
|
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 =
|
|
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 [
|
|
46877
|
-
const binary =
|
|
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
|
|
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 =
|
|
46898
|
-
|
|
46899
|
-
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
47040
|
-
module2.exports.spawn =
|
|
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((
|
|
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
|
-
|
|
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((
|
|
47220
|
+
const closePromise = new Promise((resolve15) => {
|
|
47221
47221
|
processToClose.once("close", () => {
|
|
47222
|
-
|
|
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((
|
|
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((
|
|
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((
|
|
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
|
-
|
|
47253
|
+
resolve15();
|
|
47254
47254
|
} else {
|
|
47255
|
-
this._process.stdin.once("drain",
|
|
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((
|
|
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
|
-
|
|
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((
|
|
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((
|
|
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
|
-
|
|
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((
|
|
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
|
-
|
|
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((
|
|
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
|
-
|
|
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,
|
|
52370
|
+
function persistNodeStartupJoin(storagePath, join17) {
|
|
52371
52371
|
const startup = resolveNodeStartupMetadata(storagePath);
|
|
52372
52372
|
persistNodeStartupMetadata(storagePath, {
|
|
52373
52373
|
...startup,
|
|
52374
|
-
join:
|
|
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,
|
|
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:
|
|
53396
|
+
trace?.onAttempt?.({ attempt, endpoint, path: path23, timeoutMs, totalEndpoints: endpoints.length });
|
|
53397
53397
|
try {
|
|
53398
|
-
const response = await fetchWithTimeout(`${endpoint}${
|
|
53399
|
-
trace?.onResponse?.({ attempt, endpoint, path:
|
|
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:
|
|
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((
|
|
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:
|
|
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,
|
|
55627
|
+
shouldProxy(method, path23) {
|
|
55628
55628
|
if (this.election.isLeader()) return false;
|
|
55629
|
-
if (this.isExcludedPath(
|
|
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(
|
|
55734
|
-
return EXCLUDED_PATH_PREFIXES.some((prefix) =>
|
|
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
|
|
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 (
|
|
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 (!
|
|
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" || !
|
|
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" &&
|
|
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" &&
|
|
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
|
|
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" || !
|
|
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((
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
58036
|
+
return path12.resolve(storageRoot, toSafeNodeStorageName(nodeName));
|
|
57458
58037
|
}
|
|
57459
58038
|
|
|
57460
58039
|
// ../../packages/core/src/node/node.ts
|
|
57461
|
-
var
|
|
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
|
|
57513
|
-
var
|
|
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 =
|
|
58126
|
+
const identityPath = path13.join(storagePath, "node-identity.json");
|
|
57548
58127
|
try {
|
|
57549
|
-
if (
|
|
57550
|
-
const raw = JSON.parse(
|
|
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
|
-
|
|
57557
|
-
|
|
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 =
|
|
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 =
|
|
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()
|
|
@@ -58220,7 +58802,7 @@ var SystemAuthInfoSchema = external_exports.object({
|
|
|
58220
58802
|
allowedUsers: external_exports.array(external_exports.string())
|
|
58221
58803
|
});
|
|
58222
58804
|
var SystemAgentInfoSchema = external_exports.object({
|
|
58223
|
-
id: external_exports.enum(["claude", "codex"]),
|
|
58805
|
+
id: external_exports.enum(["claude", "codex", "copilot"]),
|
|
58224
58806
|
label: external_exports.string(),
|
|
58225
58807
|
command: external_exports.string(),
|
|
58226
58808
|
available: external_exports.boolean(),
|
|
@@ -58264,14 +58846,16 @@ var NodeSettingsSnapshotSchema = external_exports.object({
|
|
|
58264
58846
|
az: SystemComponentStatusSchema.optional(),
|
|
58265
58847
|
devtunnel: SystemComponentStatusSchema.optional(),
|
|
58266
58848
|
claude: SystemComponentStatusSchema.optional(),
|
|
58267
|
-
codex: SystemComponentStatusSchema.optional()
|
|
58849
|
+
codex: SystemComponentStatusSchema.optional(),
|
|
58850
|
+
copilot: SystemComponentStatusSchema.optional()
|
|
58268
58851
|
}).optional()
|
|
58269
58852
|
}).optional(),
|
|
58270
58853
|
components: external_exports.object({
|
|
58271
58854
|
az: SystemComponentStatusSchema.optional(),
|
|
58272
58855
|
devtunnel: SystemComponentStatusSchema.optional(),
|
|
58273
58856
|
claude: SystemComponentStatusSchema.optional(),
|
|
58274
|
-
codex: SystemComponentStatusSchema.optional()
|
|
58857
|
+
codex: SystemComponentStatusSchema.optional(),
|
|
58858
|
+
copilot: SystemComponentStatusSchema.optional()
|
|
58275
58859
|
}).optional(),
|
|
58276
58860
|
repository: SystemRepositoryInfoSchema.optional(),
|
|
58277
58861
|
packages: external_exports.object({
|
|
@@ -58436,7 +59020,7 @@ var GitRemoteBranchOptionSchema = external_exports.object({
|
|
|
58436
59020
|
ref: external_exports.string()
|
|
58437
59021
|
});
|
|
58438
59022
|
var NativeSessionSummarySchema = external_exports.object({
|
|
58439
|
-
agent: external_exports.enum(["codex", "claudecode"]),
|
|
59023
|
+
agent: external_exports.enum(["codex", "claudecode", "copilot"]),
|
|
58440
59024
|
sessionId: external_exports.string(),
|
|
58441
59025
|
cwd: external_exports.string(),
|
|
58442
59026
|
summary: external_exports.string(),
|
|
@@ -58473,7 +59057,7 @@ var NodeWorkDirBranchQuery = external_exports.object({
|
|
|
58473
59057
|
allowAbsolute: QueryBoolean
|
|
58474
59058
|
});
|
|
58475
59059
|
var NodeNativeSessionsQuery = external_exports.object({
|
|
58476
|
-
agent: external_exports.enum(["codex", "claudecode"]),
|
|
59060
|
+
agent: external_exports.enum(["codex", "claudecode", "copilot"]),
|
|
58477
59061
|
limit: external_exports.coerce.number().int().min(1).max(100).default(50)
|
|
58478
59062
|
});
|
|
58479
59063
|
var NodeTerminalSessionStartBody = external_exports.object({
|
|
@@ -58518,7 +59102,7 @@ var CreateNodeWorkDirBranchResponse = NodeWorkDirBranchResponse.extend({
|
|
|
58518
59102
|
});
|
|
58519
59103
|
var NodeNativeSessionsResponse = external_exports.object({
|
|
58520
59104
|
nodeId: external_exports.string(),
|
|
58521
|
-
agent: external_exports.enum(["codex", "claudecode"]),
|
|
59105
|
+
agent: external_exports.enum(["codex", "claudecode", "copilot"]),
|
|
58522
59106
|
sessions: external_exports.array(NativeSessionSummarySchema)
|
|
58523
59107
|
});
|
|
58524
59108
|
var NodeTerminalSessionResponse = external_exports.object({
|
|
@@ -58552,8 +59136,8 @@ var ConfigureNodeDevBoxBody = external_exports.object({
|
|
|
58552
59136
|
});
|
|
58553
59137
|
|
|
58554
59138
|
// ../../packages/api/src/schemas/tasks.ts
|
|
58555
|
-
var AGENT_OPTIONS = ["mars", "codex", "claudecode", "eureka"];
|
|
58556
|
-
var NATIVE_SESSION_AGENT_OPTIONS = ["codex", "claudecode"];
|
|
59139
|
+
var AGENT_OPTIONS = ["mars", "codex", "claudecode", "copilot", "eureka"];
|
|
59140
|
+
var NATIVE_SESSION_AGENT_OPTIONS = ["codex", "claudecode", "copilot"];
|
|
58557
59141
|
var TASK_MODE_OPTIONS = ["bypass", "plan", "edit", "dangerous"];
|
|
58558
59142
|
var TASK_CONVERSATION_KIND_OPTIONS = ["meshyChat", "nativeSession"];
|
|
58559
59143
|
var TaskPayload = external_exports.record(external_exports.unknown()).superRefine((payload, ctx) => {
|
|
@@ -58697,8 +59281,8 @@ var BatchTaskIdsBody = external_exports.object({
|
|
|
58697
59281
|
});
|
|
58698
59282
|
|
|
58699
59283
|
// ../../packages/api/src/app/server.ts
|
|
58700
|
-
var
|
|
58701
|
-
var
|
|
59284
|
+
var path20 = __toESM(require("path"), 1);
|
|
59285
|
+
var fs20 = __toESM(require("fs"), 1);
|
|
58702
59286
|
var import_express15 = __toESM(require_express2(), 1);
|
|
58703
59287
|
|
|
58704
59288
|
// ../../packages/api/src/middleware/auth.ts
|
|
@@ -58835,8 +59419,8 @@ function decodePathSegment(value) {
|
|
|
58835
59419
|
return value;
|
|
58836
59420
|
}
|
|
58837
59421
|
}
|
|
58838
|
-
function getSingleTaskDeleteId(
|
|
58839
|
-
const match = /^\/api\/tasks\/([^/]+)$/.exec(
|
|
59422
|
+
function getSingleTaskDeleteId(path23) {
|
|
59423
|
+
const match = /^\/api\/tasks\/([^/]+)$/.exec(path23);
|
|
58840
59424
|
return match ? decodePathSegment(match[1]) : null;
|
|
58841
59425
|
}
|
|
58842
59426
|
function getSuccessfulBatchDeleteIds(body) {
|
|
@@ -59098,8 +59682,8 @@ function normalizeDevBoxStatus(status) {
|
|
|
59098
59682
|
return status?.trim().toLowerCase().replace(/[\s_-]+/gu, "");
|
|
59099
59683
|
}
|
|
59100
59684
|
function sleep(ms) {
|
|
59101
|
-
return new Promise((
|
|
59102
|
-
const timer = setTimeout(
|
|
59685
|
+
return new Promise((resolve15) => {
|
|
59686
|
+
const timer = setTimeout(resolve15, ms);
|
|
59103
59687
|
if (typeof timer === "object" && timer !== null && "unref" in timer && typeof timer.unref === "function") {
|
|
59104
59688
|
timer.unref();
|
|
59105
59689
|
}
|
|
@@ -59181,13 +59765,13 @@ function cleanDevBoxInfo(devbox) {
|
|
|
59181
59765
|
}
|
|
59182
59766
|
function normalizeMcpDevBoxList(value) {
|
|
59183
59767
|
const normalized = normalizeMcpValue(value);
|
|
59184
|
-
const record2 =
|
|
59768
|
+
const record2 = isRecord5(normalized) ? normalized : {};
|
|
59185
59769
|
const list = Array.isArray(normalized) ? normalized : Array.isArray(record2.devboxes) ? record2.devboxes : Array.isArray(record2.value) ? record2.value : [];
|
|
59186
59770
|
return list.map((item) => normalizeDevBoxResource(item, void 0)).filter((item) => Boolean(item.name));
|
|
59187
59771
|
}
|
|
59188
59772
|
function normalizeDevBoxResource(value, fallback) {
|
|
59189
59773
|
const record2 = normalizeRecord(value);
|
|
59190
|
-
const additional =
|
|
59774
|
+
const additional = isRecord5(record2.additionalProperties) ? record2.additionalProperties : {};
|
|
59191
59775
|
const fromUri = parseDevBoxUri(readString(record2, "uri"));
|
|
59192
59776
|
const status = readString(record2, "status") ?? readString(record2, "powerState") ?? readString(record2, "lastStatus") ?? fallback?.lastStatus;
|
|
59193
59777
|
const name2 = readString(record2, "name") ?? fromUri?.name ?? fallback?.name ?? "";
|
|
@@ -59241,7 +59825,7 @@ function parseDevCenterEndpoint(hostname4) {
|
|
|
59241
59825
|
}
|
|
59242
59826
|
function normalizeRecord(value) {
|
|
59243
59827
|
const normalized = normalizeMcpValue(value);
|
|
59244
|
-
return
|
|
59828
|
+
return isRecord5(normalized) ? normalized : {};
|
|
59245
59829
|
}
|
|
59246
59830
|
function normalizeMcpValue(value) {
|
|
59247
59831
|
if (Array.isArray(value)) return value;
|
|
@@ -59276,7 +59860,7 @@ function tryParseJson(text) {
|
|
|
59276
59860
|
return null;
|
|
59277
59861
|
}
|
|
59278
59862
|
}
|
|
59279
|
-
function
|
|
59863
|
+
function isRecord5(value) {
|
|
59280
59864
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
59281
59865
|
}
|
|
59282
59866
|
function readString(record2, key) {
|
|
@@ -59534,11 +60118,11 @@ function assertCanChangeNodeDevTunnel(taskEngine, nodeId) {
|
|
|
59534
60118
|
var import_express3 = __toESM(require_express2(), 1);
|
|
59535
60119
|
|
|
59536
60120
|
// ../../packages/api/src/node/node-workdir-service.ts
|
|
59537
|
-
var
|
|
60121
|
+
var path16 = __toESM(require("path"), 1);
|
|
59538
60122
|
|
|
59539
60123
|
// ../../packages/api/src/output/helpers.ts
|
|
59540
|
-
var
|
|
59541
|
-
var
|
|
60124
|
+
var fs14 = __toESM(require("fs"), 1);
|
|
60125
|
+
var path15 = __toESM(require("path"), 1);
|
|
59542
60126
|
var MAX_INLINE_SIZE = 512 * 1024;
|
|
59543
60127
|
var TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
59544
60128
|
".txt",
|
|
@@ -59651,15 +60235,15 @@ function mimeForExt(ext) {
|
|
|
59651
60235
|
return MIME_MAP[ext] ?? "application/octet-stream";
|
|
59652
60236
|
}
|
|
59653
60237
|
function resolveOutputPath(root, relativePath) {
|
|
59654
|
-
const resolved =
|
|
59655
|
-
const normalizedRoot =
|
|
59656
|
-
if (!resolved.startsWith(normalizedRoot +
|
|
60238
|
+
const resolved = path15.resolve(root, relativePath);
|
|
60239
|
+
const normalizedRoot = path15.resolve(root);
|
|
60240
|
+
if (!resolved.startsWith(normalizedRoot + path15.sep) && resolved !== normalizedRoot) {
|
|
59657
60241
|
throw new Error("Path traversal detected");
|
|
59658
60242
|
}
|
|
59659
60243
|
return resolved;
|
|
59660
60244
|
}
|
|
59661
60245
|
function classifyFile(filePath) {
|
|
59662
|
-
const ext =
|
|
60246
|
+
const ext = path15.extname(filePath).toLowerCase();
|
|
59663
60247
|
if (ext === ".json" || ext === ".jsonl" || ext === ".ndjson") {
|
|
59664
60248
|
return { kind: "json", mimeType: "application/json" };
|
|
59665
60249
|
}
|
|
@@ -59689,21 +60273,21 @@ function listDirectory(root, relativePath, options = {}) {
|
|
|
59689
60273
|
return listResolvedDirectory(absPath, relativePath, options);
|
|
59690
60274
|
}
|
|
59691
60275
|
function listAbsoluteDirectory(absoluteDir, options = {}) {
|
|
59692
|
-
if (!
|
|
60276
|
+
if (!path15.isAbsolute(absoluteDir)) {
|
|
59693
60277
|
throw new Error("listAbsoluteDirectory requires an absolute path");
|
|
59694
60278
|
}
|
|
59695
60279
|
return listResolvedDirectory(absoluteDir, absoluteDir, { ...options, childPathStyle: "absolute" });
|
|
59696
60280
|
}
|
|
59697
60281
|
function listResolvedDirectory(absPath, relativeBase, options = {}) {
|
|
59698
|
-
if (!
|
|
60282
|
+
if (!fs14.existsSync(absPath) || !fs14.statSync(absPath).isDirectory()) {
|
|
59699
60283
|
return [];
|
|
59700
60284
|
}
|
|
59701
|
-
const entries =
|
|
60285
|
+
const entries = fs14.readdirSync(absPath, { withFileTypes: true });
|
|
59702
60286
|
const result = [];
|
|
59703
60287
|
const childPathStyle = options.childPathStyle ?? "relative";
|
|
59704
60288
|
for (const entry of entries) {
|
|
59705
60289
|
if (entry.name.startsWith(".")) continue;
|
|
59706
|
-
const entryRelPath = childPathStyle === "absolute" ?
|
|
60290
|
+
const entryRelPath = childPathStyle === "absolute" ? path15.join(absPath, entry.name) : path15.join(relativeBase || ".", entry.name).split(path15.sep).join("/");
|
|
59707
60291
|
if (entry.isDirectory()) {
|
|
59708
60292
|
result.push({
|
|
59709
60293
|
path: entryRelPath,
|
|
@@ -59713,8 +60297,8 @@ function listResolvedDirectory(absPath, relativeBase, options = {}) {
|
|
|
59713
60297
|
} else if (options.directoriesOnly) {
|
|
59714
60298
|
continue;
|
|
59715
60299
|
} else if (entry.isFile()) {
|
|
59716
|
-
const fullPath =
|
|
59717
|
-
const stat =
|
|
60300
|
+
const fullPath = path15.join(absPath, entry.name);
|
|
60301
|
+
const stat = fs14.statSync(fullPath);
|
|
59718
60302
|
const { kind, mimeType } = classifyFile(entry.name);
|
|
59719
60303
|
result.push({
|
|
59720
60304
|
path: entryRelPath,
|
|
@@ -59734,11 +60318,11 @@ function listResolvedDirectory(absPath, relativeBase, options = {}) {
|
|
|
59734
60318
|
}
|
|
59735
60319
|
function detectHtmlEntries(root) {
|
|
59736
60320
|
const entries = [];
|
|
59737
|
-
if (
|
|
60321
|
+
if (fs14.existsSync(path15.join(root, "index.html"))) {
|
|
59738
60322
|
entries.push({ path: "index.html", label: "index.html" });
|
|
59739
60323
|
}
|
|
59740
60324
|
try {
|
|
59741
|
-
const topLevel =
|
|
60325
|
+
const topLevel = fs14.readdirSync(root, { withFileTypes: true });
|
|
59742
60326
|
const htmlFiles = topLevel.filter(
|
|
59743
60327
|
(e) => e.isFile() && e.name.endsWith(".html") && !e.name.startsWith(".")
|
|
59744
60328
|
);
|
|
@@ -59749,8 +60333,8 @@ function detectHtmlEntries(root) {
|
|
|
59749
60333
|
}
|
|
59750
60334
|
const subdirs = topLevel.filter((e) => e.isDirectory() && !e.name.startsWith("."));
|
|
59751
60335
|
for (const dir of subdirs) {
|
|
59752
|
-
const subIndex =
|
|
59753
|
-
if (
|
|
60336
|
+
const subIndex = path15.join(root, dir.name, "index.html");
|
|
60337
|
+
if (fs14.existsSync(subIndex)) {
|
|
59754
60338
|
entries.push({
|
|
59755
60339
|
path: `${dir.name}/index.html`,
|
|
59756
60340
|
label: `${dir.name}/index.html`
|
|
@@ -59764,7 +60348,7 @@ function detectHtmlEntries(root) {
|
|
|
59764
60348
|
function detectMarkdownEntries(root) {
|
|
59765
60349
|
const entries = [];
|
|
59766
60350
|
try {
|
|
59767
|
-
const topLevel =
|
|
60351
|
+
const topLevel = fs14.readdirSync(root, { withFileTypes: true });
|
|
59768
60352
|
for (const f of topLevel) {
|
|
59769
60353
|
if (f.isFile() && !f.name.startsWith(".") && /\.mdx?$/i.test(f.name)) {
|
|
59770
60354
|
entries.push({ path: f.name, label: f.name });
|
|
@@ -59773,8 +60357,8 @@ function detectMarkdownEntries(root) {
|
|
|
59773
60357
|
const subdirs = topLevel.filter((e) => e.isDirectory() && !e.name.startsWith("."));
|
|
59774
60358
|
for (const dir of subdirs) {
|
|
59775
60359
|
for (const fileName of ["README.md", "readme.md"]) {
|
|
59776
|
-
const readmePath =
|
|
59777
|
-
if (
|
|
60360
|
+
const readmePath = path15.join(root, dir.name, fileName);
|
|
60361
|
+
if (fs14.existsSync(readmePath)) {
|
|
59778
60362
|
entries.push({ path: `${dir.name}/${fileName}`, label: `${dir.name}/${fileName}` });
|
|
59779
60363
|
break;
|
|
59780
60364
|
}
|
|
@@ -59785,12 +60369,12 @@ function detectMarkdownEntries(root) {
|
|
|
59785
60369
|
return entries;
|
|
59786
60370
|
}
|
|
59787
60371
|
function getOutputSummary(root) {
|
|
59788
|
-
const rootName =
|
|
60372
|
+
const rootName = path15.basename(root);
|
|
59789
60373
|
const htmlEntries = detectHtmlEntries(root);
|
|
59790
60374
|
const markdownEntries = detectMarkdownEntries(root);
|
|
59791
60375
|
let fileCount;
|
|
59792
60376
|
try {
|
|
59793
|
-
const entries =
|
|
60377
|
+
const entries = fs14.readdirSync(root, { withFileTypes: true });
|
|
59794
60378
|
fileCount = entries.filter((e) => !e.name.startsWith(".")).length;
|
|
59795
60379
|
} catch {
|
|
59796
60380
|
fileCount = void 0;
|
|
@@ -59807,14 +60391,14 @@ function getOutputSummary(root) {
|
|
|
59807
60391
|
}
|
|
59808
60392
|
function readFileContent(root, relativePath) {
|
|
59809
60393
|
const absPath = resolveOutputPath(root, relativePath);
|
|
59810
|
-
if (!
|
|
60394
|
+
if (!fs14.existsSync(absPath) || !fs14.statSync(absPath).isFile()) {
|
|
59811
60395
|
throw new Error("File not found");
|
|
59812
60396
|
}
|
|
59813
|
-
const stat =
|
|
60397
|
+
const stat = fs14.statSync(absPath);
|
|
59814
60398
|
const { kind, mimeType } = classifyFile(absPath);
|
|
59815
60399
|
if (kind === "image" || kind === "pdf" || kind === "binary") {
|
|
59816
60400
|
const truncated2 = stat.size > MAX_INLINE_SIZE;
|
|
59817
|
-
const buffer = truncated2 ? Buffer.alloc(0) :
|
|
60401
|
+
const buffer = truncated2 ? Buffer.alloc(0) : fs14.readFileSync(absPath);
|
|
59818
60402
|
return {
|
|
59819
60403
|
path: relativePath,
|
|
59820
60404
|
kind,
|
|
@@ -59825,7 +60409,7 @@ function readFileContent(root, relativePath) {
|
|
|
59825
60409
|
};
|
|
59826
60410
|
}
|
|
59827
60411
|
const truncated = stat.size > MAX_INLINE_SIZE;
|
|
59828
|
-
const content = truncated ?
|
|
60412
|
+
const content = truncated ? fs14.readFileSync(absPath, "utf-8").slice(0, MAX_INLINE_SIZE) : fs14.readFileSync(absPath, "utf-8");
|
|
59829
60413
|
return {
|
|
59830
60414
|
path: relativePath,
|
|
59831
60415
|
kind,
|
|
@@ -59837,8 +60421,8 @@ function readFileContent(root, relativePath) {
|
|
|
59837
60421
|
}
|
|
59838
60422
|
|
|
59839
60423
|
// ../../packages/api/src/output/git-command.ts
|
|
59840
|
-
var
|
|
59841
|
-
var
|
|
60424
|
+
var fs15 = __toESM(require("fs"), 1);
|
|
60425
|
+
var import_node_child_process7 = require("child_process");
|
|
59842
60426
|
var COMMON_GIT_BINARIES = [
|
|
59843
60427
|
"/opt/homebrew/bin/git",
|
|
59844
60428
|
"/usr/local/bin/git",
|
|
@@ -59846,7 +60430,7 @@ var COMMON_GIT_BINARIES = [
|
|
|
59846
60430
|
];
|
|
59847
60431
|
function isExecutable(filePath) {
|
|
59848
60432
|
try {
|
|
59849
|
-
|
|
60433
|
+
fs15.accessSync(filePath, fs15.constants.X_OK);
|
|
59850
60434
|
return true;
|
|
59851
60435
|
} catch {
|
|
59852
60436
|
return false;
|
|
@@ -59867,7 +60451,7 @@ function execGit(args, cwd, timeout = 1e4) {
|
|
|
59867
60451
|
let lastError;
|
|
59868
60452
|
for (const command of getGitCandidates()) {
|
|
59869
60453
|
try {
|
|
59870
|
-
return (0,
|
|
60454
|
+
return (0, import_node_child_process7.execFileSync)(command, ["-C", cwd, ...args], {
|
|
59871
60455
|
encoding: "utf-8",
|
|
59872
60456
|
timeout,
|
|
59873
60457
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -60099,14 +60683,14 @@ function getGitDiff(dirPath) {
|
|
|
60099
60683
|
|
|
60100
60684
|
// ../../packages/api/src/node/node-workdir-service.ts
|
|
60101
60685
|
function isAbsolutePath(p) {
|
|
60102
|
-
return
|
|
60686
|
+
return path16.isAbsolute(p) || /^[A-Za-z]:[\\/]/.test(p);
|
|
60103
60687
|
}
|
|
60104
60688
|
function resolveNodeWorkDirTarget(nodeId, rootPath, currentPath, allowAbsolute) {
|
|
60105
60689
|
if (!rootPath) {
|
|
60106
60690
|
throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
|
|
60107
60691
|
}
|
|
60108
60692
|
const useAbsolute = allowAbsolute && isAbsolutePath(currentPath);
|
|
60109
|
-
const resolvedPath = useAbsolute ?
|
|
60693
|
+
const resolvedPath = useAbsolute ? path16.resolve(currentPath) : currentPath;
|
|
60110
60694
|
const targetPath = useAbsolute ? resolvedPath : resolveRelativeNodeWorkDirTarget(rootPath, resolvedPath);
|
|
60111
60695
|
return {
|
|
60112
60696
|
rootPath,
|
|
@@ -60116,9 +60700,9 @@ function resolveNodeWorkDirTarget(nodeId, rootPath, currentPath, allowAbsolute)
|
|
|
60116
60700
|
};
|
|
60117
60701
|
}
|
|
60118
60702
|
function resolveRelativeNodeWorkDirTarget(rootPath, relativePath) {
|
|
60119
|
-
const resolvedRoot =
|
|
60120
|
-
const resolved =
|
|
60121
|
-
if (!resolved.startsWith(resolvedRoot +
|
|
60703
|
+
const resolvedRoot = path16.resolve(rootPath);
|
|
60704
|
+
const resolved = path16.resolve(resolvedRoot, relativePath);
|
|
60705
|
+
if (!resolved.startsWith(resolvedRoot + path16.sep) && resolved !== resolvedRoot) {
|
|
60122
60706
|
throw new MeshyError("VALIDATION_ERROR", "Invalid directory path", 400);
|
|
60123
60707
|
}
|
|
60124
60708
|
return resolved;
|
|
@@ -60201,13 +60785,13 @@ function createLocalNodeWorkDirBranch(nodeId, rootPath, currentPath, options) {
|
|
|
60201
60785
|
}
|
|
60202
60786
|
function computeParentPath(rootPath, currentPath, useAbsolute) {
|
|
60203
60787
|
if (useAbsolute) {
|
|
60204
|
-
const parent =
|
|
60788
|
+
const parent = path16.dirname(currentPath);
|
|
60205
60789
|
return parent === currentPath ? null : parent;
|
|
60206
60790
|
}
|
|
60207
60791
|
const normalized = currentPath.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
60208
60792
|
if (normalized === "" || normalized === ".") {
|
|
60209
|
-
const absParent =
|
|
60210
|
-
return absParent ===
|
|
60793
|
+
const absParent = path16.dirname(path16.resolve(rootPath));
|
|
60794
|
+
return absParent === path16.resolve(rootPath) ? null : absParent;
|
|
60211
60795
|
}
|
|
60212
60796
|
const segments = normalized.split("/").filter(Boolean);
|
|
60213
60797
|
segments.pop();
|
|
@@ -60218,14 +60802,15 @@ function computeParentPath(rootPath, currentPath, useAbsolute) {
|
|
|
60218
60802
|
var import_node_crypto7 = require("crypto");
|
|
60219
60803
|
|
|
60220
60804
|
// ../../packages/api/src/node/agent-upgrade-service.ts
|
|
60221
|
-
var
|
|
60805
|
+
var import_node_child_process9 = require("child_process");
|
|
60222
60806
|
|
|
60223
60807
|
// ../../packages/api/src/app/system-info.ts
|
|
60224
60808
|
var os6 = __toESM(require("os"), 1);
|
|
60225
|
-
var
|
|
60809
|
+
var import_node_child_process8 = require("child_process");
|
|
60226
60810
|
var RUNTIME_TOOLS = [
|
|
60227
60811
|
{ id: "claude", label: "Claude Code", command: "claude", packageName: "@anthropic-ai/claude-code" },
|
|
60228
|
-
{ id: "codex", label: "Codex", command: "codex", packageName: "@openai/codex" }
|
|
60812
|
+
{ id: "codex", label: "Codex", command: "codex", packageName: "@openai/codex" },
|
|
60813
|
+
{ id: "copilot", label: "Copilot CLI", command: "copilot", packageName: "@github/copilot" }
|
|
60229
60814
|
];
|
|
60230
60815
|
var runtimeToolUpdateCache = /* @__PURE__ */ new Map();
|
|
60231
60816
|
function clearRuntimeToolUpdateCache(packageName) {
|
|
@@ -60236,7 +60821,7 @@ function clearRuntimeToolUpdateCache(packageName) {
|
|
|
60236
60821
|
runtimeToolUpdateCache.clear();
|
|
60237
60822
|
}
|
|
60238
60823
|
function runRuntimeToolCommand(command, args, platform2) {
|
|
60239
|
-
const result = (0,
|
|
60824
|
+
const result = (0, import_node_child_process8.spawnSync)(command, args, {
|
|
60240
60825
|
encoding: "utf-8",
|
|
60241
60826
|
shell: platform2 === "win32" && command !== "where",
|
|
60242
60827
|
windowsHide: true,
|
|
@@ -60433,7 +61018,8 @@ function buildNodeSettingsSnapshot(options) {
|
|
|
60433
61018
|
// ../../packages/api/src/node/agent-upgrade-service.ts
|
|
60434
61019
|
var AGENT_PACKAGES = {
|
|
60435
61020
|
claude: "@anthropic-ai/claude-code",
|
|
60436
|
-
codex: "@openai/codex"
|
|
61021
|
+
codex: "@openai/codex",
|
|
61022
|
+
copilot: "@github/copilot"
|
|
60437
61023
|
};
|
|
60438
61024
|
var OUTPUT_LIMIT = 4e3;
|
|
60439
61025
|
function summarizeOutput(value) {
|
|
@@ -60441,7 +61027,7 @@ function summarizeOutput(value) {
|
|
|
60441
61027
|
return text.length > OUTPUT_LIMIT ? `${text.slice(0, OUTPUT_LIMIT)}\u2026` : text;
|
|
60442
61028
|
}
|
|
60443
61029
|
function defaultCommandRunner(command, args) {
|
|
60444
|
-
const result = (0,
|
|
61030
|
+
const result = (0, import_node_child_process9.spawnSync)(command, args, {
|
|
60445
61031
|
encoding: "utf-8",
|
|
60446
61032
|
shell: process.platform === "win32",
|
|
60447
61033
|
windowsHide: true,
|
|
@@ -60455,7 +61041,7 @@ function defaultCommandRunner(command, args) {
|
|
|
60455
61041
|
};
|
|
60456
61042
|
}
|
|
60457
61043
|
function isRuntimeAgentId(value) {
|
|
60458
|
-
return value === "claude" || value === "codex";
|
|
61044
|
+
return value === "claude" || value === "codex" || value === "copilot";
|
|
60459
61045
|
}
|
|
60460
61046
|
function buildUpgradeArgs(agent, packageName) {
|
|
60461
61047
|
const args = ["install", "-g", `${packageName}@latest`];
|
|
@@ -60503,7 +61089,7 @@ function upgradeRuntimeAgentForDeps(deps, agent) {
|
|
|
60503
61089
|
|
|
60504
61090
|
// ../../packages/api/src/node/runtime-restart-request.ts
|
|
60505
61091
|
function parseRuntimeRestartRequest(value) {
|
|
60506
|
-
const body =
|
|
61092
|
+
const body = isRecord6(value) ? value : {};
|
|
60507
61093
|
const startArgs = parseRuntimeRestartStartArgs(body.startArgs);
|
|
60508
61094
|
return {
|
|
60509
61095
|
reason: body.reason === "update" ? "update" : "restart",
|
|
@@ -60512,7 +61098,7 @@ function parseRuntimeRestartRequest(value) {
|
|
|
60512
61098
|
}
|
|
60513
61099
|
function parseRuntimeRestartStartArgs(value) {
|
|
60514
61100
|
if (value === void 0) return void 0;
|
|
60515
|
-
if (!
|
|
61101
|
+
if (!isRecord6(value)) {
|
|
60516
61102
|
throw new MeshyError("VALIDATION_ERROR", "Runtime restart startArgs must be an object", 400);
|
|
60517
61103
|
}
|
|
60518
61104
|
const startArgs = {};
|
|
@@ -60549,7 +61135,7 @@ function parseOptionalString(value, key) {
|
|
|
60549
61135
|
const trimmed = value.trim();
|
|
60550
61136
|
return trimmed || void 0;
|
|
60551
61137
|
}
|
|
60552
|
-
function
|
|
61138
|
+
function isRecord6(value) {
|
|
60553
61139
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
60554
61140
|
}
|
|
60555
61141
|
|
|
@@ -60987,7 +61573,7 @@ async function sendNodeWorkDirBranchCreateOperation(req, res, nodeId) {
|
|
|
60987
61573
|
}
|
|
60988
61574
|
|
|
60989
61575
|
// ../../packages/api/src/tasks/task-route-utils.ts
|
|
60990
|
-
var
|
|
61576
|
+
var fs16 = __toESM(require("fs"), 1);
|
|
60991
61577
|
var import_node_stream3 = require("stream");
|
|
60992
61578
|
var import_promises5 = require("stream/promises");
|
|
60993
61579
|
|
|
@@ -61032,7 +61618,7 @@ function toLegacyWorkerControl2(message) {
|
|
|
61032
61618
|
}
|
|
61033
61619
|
|
|
61034
61620
|
// ../../packages/api/src/tasks/task-route-utils.ts
|
|
61035
|
-
function
|
|
61621
|
+
function isRecord7(value) {
|
|
61036
61622
|
return typeof value === "object" && value !== null;
|
|
61037
61623
|
}
|
|
61038
61624
|
function restoreTaskState(taskEngine, task) {
|
|
@@ -61049,10 +61635,10 @@ function readLocalTaskLogs(engineRegistry, taskId, after, agent) {
|
|
|
61049
61635
|
throw new MeshyError("VALIDATION_ERROR", `Engine not registered for agent: ${agent}`, 400);
|
|
61050
61636
|
}
|
|
61051
61637
|
const logPath = engine.getLogPath(taskId);
|
|
61052
|
-
if (!
|
|
61638
|
+
if (!fs16.existsSync(logPath)) {
|
|
61053
61639
|
return { logs: [], total: 0 };
|
|
61054
61640
|
}
|
|
61055
|
-
const content =
|
|
61641
|
+
const content = fs16.readFileSync(logPath, "utf-8");
|
|
61056
61642
|
const allLines = content.trim().split("\n").filter(Boolean);
|
|
61057
61643
|
const logs = [];
|
|
61058
61644
|
for (let i = after; i < allLines.length; i++) {
|
|
@@ -61099,7 +61685,7 @@ function normalizeStructuredValue(value) {
|
|
|
61099
61685
|
if (Array.isArray(value)) {
|
|
61100
61686
|
return value.map((entry) => normalizeStructuredValue(entry));
|
|
61101
61687
|
}
|
|
61102
|
-
if (!
|
|
61688
|
+
if (!isRecord7(value)) {
|
|
61103
61689
|
return value;
|
|
61104
61690
|
}
|
|
61105
61691
|
return Object.fromEntries(
|
|
@@ -61108,20 +61694,20 @@ function normalizeStructuredValue(value) {
|
|
|
61108
61694
|
}
|
|
61109
61695
|
function getTranscriptEventSignature(event) {
|
|
61110
61696
|
if (event.type === "user") {
|
|
61111
|
-
const signature = getTaskUserMessageSignature(
|
|
61697
|
+
const signature = getTaskUserMessageSignature(isRecord7(event.message) ? event.message.content : event.message) ?? getTaskUserMessageSignature(event.content);
|
|
61112
61698
|
return signature ? `user:${signature}` : null;
|
|
61113
61699
|
}
|
|
61114
61700
|
if (event.type === "assistant") {
|
|
61115
61701
|
if (typeof event.message === "string") {
|
|
61116
61702
|
return `assistant:${JSON.stringify(event.message)}`;
|
|
61117
61703
|
}
|
|
61118
|
-
if (
|
|
61704
|
+
if (isRecord7(event.message) && "content" in event.message) {
|
|
61119
61705
|
return `assistant:${JSON.stringify(normalizeStructuredValue(event.message.content))}`;
|
|
61120
61706
|
}
|
|
61121
61707
|
if (Array.isArray(event.content)) {
|
|
61122
61708
|
return `assistant:${JSON.stringify(normalizeStructuredValue(event.content))}`;
|
|
61123
61709
|
}
|
|
61124
|
-
if (
|
|
61710
|
+
if (isRecord7(event.message)) {
|
|
61125
61711
|
return `assistant:${JSON.stringify(normalizeStructuredValue(event.message))}`;
|
|
61126
61712
|
}
|
|
61127
61713
|
}
|
|
@@ -61179,7 +61765,7 @@ function mergeNativeSessionLogs(nativeLogs, localLogs) {
|
|
|
61179
61765
|
function readLocalTaskLogsWithNativeHistory(engineRegistry, task, taskId, after, agent) {
|
|
61180
61766
|
const local = readLocalTaskLogs(engineRegistry, taskId, after, agent);
|
|
61181
61767
|
const sessionId = typeof task?.payload?.sessionId === "string" ? task.payload.sessionId : "";
|
|
61182
|
-
if (after > 0 || task?.conversationKind !== "nativeSession" || !sessionId || task.agent !== "codex" && task.agent !== "claudecode") {
|
|
61768
|
+
if (after > 0 || task?.conversationKind !== "nativeSession" || !sessionId || task.agent !== "codex" && task.agent !== "claudecode" && task.agent !== "copilot") {
|
|
61183
61769
|
return local;
|
|
61184
61770
|
}
|
|
61185
61771
|
const history = loadNativeSessionHistory({ agent: task.agent, sessionId });
|
|
@@ -61283,23 +61869,23 @@ async function maybeProxyReadToLeader(req, res, options = {}) {
|
|
|
61283
61869
|
}
|
|
61284
61870
|
|
|
61285
61871
|
// ../../packages/api/src/node/node-terminal-session-service.ts
|
|
61286
|
-
var
|
|
61872
|
+
var import_node_child_process10 = require("child_process");
|
|
61287
61873
|
var import_node_crypto8 = require("crypto");
|
|
61288
61874
|
|
|
61289
61875
|
// ../../packages/api/src/node/node-terminal-service.ts
|
|
61290
|
-
var
|
|
61291
|
-
var
|
|
61876
|
+
var fs17 = __toESM(require("fs"), 1);
|
|
61877
|
+
var path17 = __toESM(require("path"), 1);
|
|
61292
61878
|
var DEFAULT_OUTPUT_LIMIT_BYTES = 64 * 1024;
|
|
61293
61879
|
function isAbsolutePath2(value) {
|
|
61294
|
-
return
|
|
61880
|
+
return path17.isAbsolute(value) || /^[A-Za-z]:[\/]/.test(value);
|
|
61295
61881
|
}
|
|
61296
61882
|
function resolveNodeTerminalCwd(nodeId, rootPath, cwd) {
|
|
61297
61883
|
if (!rootPath) {
|
|
61298
61884
|
throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
|
|
61299
61885
|
}
|
|
61300
61886
|
const requestedCwd = cwd?.trim() || ".";
|
|
61301
|
-
const resolved = isAbsolutePath2(requestedCwd) ?
|
|
61302
|
-
if (!
|
|
61887
|
+
const resolved = isAbsolutePath2(requestedCwd) ? path17.resolve(requestedCwd) : path17.resolve(rootPath, requestedCwd);
|
|
61888
|
+
if (!fs17.existsSync(resolved) || !fs17.statSync(resolved).isDirectory()) {
|
|
61303
61889
|
throw new MeshyError("VALIDATION_ERROR", `Working directory does not exist: ${resolved}`, 400);
|
|
61304
61890
|
}
|
|
61305
61891
|
return resolved;
|
|
@@ -61363,7 +61949,7 @@ var NodeTerminalSessionService = class {
|
|
|
61363
61949
|
}
|
|
61364
61950
|
const cwd = resolveNodeTerminalCwd(nodeId, rootPath, options.cwd);
|
|
61365
61951
|
const startedAt = Date.now();
|
|
61366
|
-
const child = (0,
|
|
61952
|
+
const child = (0, import_node_child_process10.spawn)(normalizedCommand, {
|
|
61367
61953
|
cwd,
|
|
61368
61954
|
shell: true,
|
|
61369
61955
|
windowsHide: true,
|
|
@@ -61538,13 +62124,13 @@ function cancelTaskOnCurrentNode(deps, taskId, options = {}) {
|
|
|
61538
62124
|
}
|
|
61539
62125
|
|
|
61540
62126
|
// ../../packages/api/src/tasks/task-output-service.ts
|
|
61541
|
-
var
|
|
61542
|
-
var
|
|
62127
|
+
var fs19 = __toESM(require("fs"), 1);
|
|
62128
|
+
var path19 = __toESM(require("path"), 1);
|
|
61543
62129
|
|
|
61544
62130
|
// ../../packages/api/src/preview/preview-server.ts
|
|
61545
62131
|
var crypto3 = __toESM(require("crypto"), 1);
|
|
61546
|
-
var
|
|
61547
|
-
var
|
|
62132
|
+
var fs18 = __toESM(require("fs"), 1);
|
|
62133
|
+
var path18 = __toESM(require("path"), 1);
|
|
61548
62134
|
var http2 = __toESM(require("http"), 1);
|
|
61549
62135
|
var import_node_stream4 = require("stream");
|
|
61550
62136
|
var import_promises6 = require("stream/promises");
|
|
@@ -61656,19 +62242,19 @@ function buildPreviewWorkerProxyHeaders(req) {
|
|
|
61656
62242
|
// ../../packages/api/src/preview/preview-server.ts
|
|
61657
62243
|
function resolvePreviewPath(rootPath, relativePath) {
|
|
61658
62244
|
const sanitizedPath = relativePath.replace(/\\/g, "/");
|
|
61659
|
-
const resolvedPath =
|
|
61660
|
-
const normalizedRoot =
|
|
61661
|
-
if (!resolvedPath.startsWith(normalizedRoot +
|
|
62245
|
+
const resolvedPath = path18.resolve(rootPath, sanitizedPath);
|
|
62246
|
+
const normalizedRoot = path18.resolve(rootPath);
|
|
62247
|
+
if (!resolvedPath.startsWith(normalizedRoot + path18.sep) && resolvedPath !== normalizedRoot) {
|
|
61662
62248
|
throw new Error("Invalid preview path");
|
|
61663
62249
|
}
|
|
61664
62250
|
return {
|
|
61665
62251
|
absolutePath: resolvedPath,
|
|
61666
|
-
normalizedPath:
|
|
62252
|
+
normalizedPath: path18.relative(normalizedRoot, resolvedPath).split(path18.sep).join("/")
|
|
61667
62253
|
};
|
|
61668
62254
|
}
|
|
61669
62255
|
function resolvePreviewEntryPath(rootPath, entryPath) {
|
|
61670
62256
|
const { absolutePath, normalizedPath } = resolvePreviewPath(rootPath, entryPath ?? "index.html");
|
|
61671
|
-
if (!
|
|
62257
|
+
if (!fs18.existsSync(absolutePath) || !fs18.statSync(absolutePath).isFile()) {
|
|
61672
62258
|
throw new Error("Preview entry not found");
|
|
61673
62259
|
}
|
|
61674
62260
|
return normalizedPath;
|
|
@@ -61770,7 +62356,7 @@ var MIME_MAP2 = {
|
|
|
61770
62356
|
".mdx": "text/markdown"
|
|
61771
62357
|
};
|
|
61772
62358
|
function getMime(filePath) {
|
|
61773
|
-
return MIME_MAP2[
|
|
62359
|
+
return MIME_MAP2[path18.extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
61774
62360
|
}
|
|
61775
62361
|
function escapeHtml(value) {
|
|
61776
62362
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -62124,14 +62710,14 @@ async function sendPreviewAssetResponse(sessionManager, token, requestedPath, re
|
|
|
62124
62710
|
res.end("Invalid path");
|
|
62125
62711
|
return;
|
|
62126
62712
|
}
|
|
62127
|
-
if (!
|
|
62713
|
+
if (!fs18.existsSync(resolved) || !fs18.statSync(resolved).isFile()) {
|
|
62128
62714
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
62129
62715
|
res.end("File not found");
|
|
62130
62716
|
return;
|
|
62131
62717
|
}
|
|
62132
|
-
const ext =
|
|
62718
|
+
const ext = path18.extname(resolved).toLowerCase();
|
|
62133
62719
|
const mime = ext === ".md" || ext === ".mdx" ? "text/html" : getMime(resolved);
|
|
62134
|
-
const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(
|
|
62720
|
+
const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(fs18.readFileSync(resolved, "utf8"), path18.basename(resolved)) : fs18.readFileSync(resolved);
|
|
62135
62721
|
res.writeHead(200, {
|
|
62136
62722
|
"Content-Type": mime,
|
|
62137
62723
|
"Content-Length": content.length,
|
|
@@ -62460,13 +63046,13 @@ function getLocalTaskOutputDownload(taskEngine, taskId, filePath) {
|
|
|
62460
63046
|
const rootPath = getTaskOutputRoot(taskEngine, taskId);
|
|
62461
63047
|
try {
|
|
62462
63048
|
const absolutePath = resolveOutputPath(rootPath, filePath);
|
|
62463
|
-
if (!
|
|
63049
|
+
if (!fs19.existsSync(absolutePath) || !fs19.statSync(absolutePath).isFile()) {
|
|
62464
63050
|
throw new MeshyError("TASK_NOT_FOUND", `File not found: ${filePath}`, 404);
|
|
62465
63051
|
}
|
|
62466
63052
|
const { mimeType } = classifyFile(absolutePath);
|
|
62467
|
-
const fileName =
|
|
63053
|
+
const fileName = path19.basename(absolutePath).replace(/"/g, "");
|
|
62468
63054
|
return {
|
|
62469
|
-
content:
|
|
63055
|
+
content: fs19.readFileSync(absolutePath),
|
|
62470
63056
|
headers: {
|
|
62471
63057
|
"Content-Type": mimeType,
|
|
62472
63058
|
"Content-Disposition": `inline; filename="${fileName}"`,
|
|
@@ -62679,12 +63265,13 @@ async function executeWorkerControlRequest(deps, request) {
|
|
|
62679
63265
|
}
|
|
62680
63266
|
case "node.sessions.list": {
|
|
62681
63267
|
const self2 = deps.nodeRegistry.getSelf();
|
|
63268
|
+
const agent = payloadValue(request, "agent", "codex");
|
|
62682
63269
|
response = jsonResponse(
|
|
62683
63270
|
request.id,
|
|
62684
63271
|
200,
|
|
62685
63272
|
getLocalNodeNativeSessions(
|
|
62686
63273
|
self2.id,
|
|
62687
|
-
|
|
63274
|
+
agent === "claudecode" || agent === "copilot" ? agent : "codex",
|
|
62688
63275
|
payloadValue(request, "limit", 50)
|
|
62689
63276
|
)
|
|
62690
63277
|
);
|
|
@@ -63742,10 +64329,15 @@ async function cancelRemoteTaskExecution(deps) {
|
|
|
63742
64329
|
// ../../packages/api/src/tasks/task-session-import.ts
|
|
63743
64330
|
var TASK_IMPORT_PROXY_TIMEOUT_MS = 1e4;
|
|
63744
64331
|
function buildImportedSessionTitle(agent, sessionId) {
|
|
63745
|
-
const label = agent === "codex" ? "Codex" : "Claude Code";
|
|
64332
|
+
const label = agent === "codex" ? "Codex" : agent === "copilot" ? "Copilot CLI" : "Claude Code";
|
|
63746
64333
|
const suffix = sessionId.trim().slice(0, 12);
|
|
63747
64334
|
return `${label} session ${suffix || "attached"}`;
|
|
63748
64335
|
}
|
|
64336
|
+
function getNativeSessionAgentLabel(agent) {
|
|
64337
|
+
if (agent === "codex") return "Codex";
|
|
64338
|
+
if (agent === "copilot") return "Copilot CLI";
|
|
64339
|
+
return "Claude Code";
|
|
64340
|
+
}
|
|
63749
64341
|
function resolveTargetImportNode(nodeRegistry, nodeId, agent) {
|
|
63750
64342
|
const self2 = nodeRegistry.getSelf();
|
|
63751
64343
|
const node = nodeRegistry.getNode(nodeId) ?? (self2?.id === nodeId ? self2 : null);
|
|
@@ -63775,7 +64367,7 @@ async function attachNativeSession(deps, body) {
|
|
|
63775
64367
|
let importedLogs = history.logs;
|
|
63776
64368
|
const task = deps.taskEngine.createTask({
|
|
63777
64369
|
title: body.title?.trim() || buildImportedSessionTitle(body.agent, body.sessionId),
|
|
63778
|
-
description: `Attached native ${body.agent
|
|
64370
|
+
description: `Attached native ${getNativeSessionAgentLabel(body.agent)} session`,
|
|
63779
64371
|
agent: body.agent,
|
|
63780
64372
|
project: body.cwd,
|
|
63781
64373
|
conversationKind: "nativeSession",
|
|
@@ -65254,7 +65846,7 @@ function createWorkerRoutes() {
|
|
|
65254
65846
|
let { logs } = body;
|
|
65255
65847
|
if (logs.length === 0 && task.conversationKind === "nativeSession") {
|
|
65256
65848
|
const sessionId = typeof task.payload?.sessionId === "string" ? task.payload.sessionId : "";
|
|
65257
|
-
if (sessionId && (task.agent === "codex" || task.agent === "claudecode")) {
|
|
65849
|
+
if (sessionId && (task.agent === "codex" || task.agent === "claudecode" || task.agent === "copilot")) {
|
|
65258
65850
|
logs = loadNativeSessionHistory({ agent: task.agent, sessionId }).logs;
|
|
65259
65851
|
}
|
|
65260
65852
|
}
|
|
@@ -65737,8 +66329,8 @@ function hasAuthorizationHeader(req) {
|
|
|
65737
66329
|
function resolveRuntimeBaseDir() {
|
|
65738
66330
|
const entryPath = process.argv[1];
|
|
65739
66331
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
65740
|
-
const resolved =
|
|
65741
|
-
return
|
|
66332
|
+
const resolved = fs20.realpathSync(path20.resolve(entryPath));
|
|
66333
|
+
return path20.dirname(resolved);
|
|
65742
66334
|
}
|
|
65743
66335
|
return process.cwd();
|
|
65744
66336
|
}
|
|
@@ -65746,18 +66338,18 @@ function resolveStaticDir(baseDir) {
|
|
|
65746
66338
|
const envStaticDir = process.env.MESHY_STATIC_DIR;
|
|
65747
66339
|
const candidateDirs = [
|
|
65748
66340
|
envStaticDir,
|
|
65749
|
-
|
|
65750
|
-
|
|
65751
|
-
|
|
65752
|
-
|
|
65753
|
-
|
|
65754
|
-
|
|
65755
|
-
|
|
65756
|
-
|
|
65757
|
-
|
|
66341
|
+
path20.resolve(baseDir, "dashboard"),
|
|
66342
|
+
path20.resolve(baseDir, "../dashboard"),
|
|
66343
|
+
path20.resolve(baseDir, "../../dashboard/dist"),
|
|
66344
|
+
path20.resolve(baseDir, "../../../packages/dashboard/dist"),
|
|
66345
|
+
path20.resolve(baseDir, "../public"),
|
|
66346
|
+
path20.resolve(baseDir, "../../packages/api/public"),
|
|
66347
|
+
path20.resolve(baseDir, "../../../packages/api/public"),
|
|
66348
|
+
path20.resolve(process.cwd(), "packages/dashboard/dist"),
|
|
66349
|
+
path20.resolve(process.cwd(), "packages/api/public")
|
|
65758
66350
|
].filter((value) => typeof value === "string" && value.length > 0);
|
|
65759
66351
|
for (const candidate of candidateDirs) {
|
|
65760
|
-
if (
|
|
66352
|
+
if (fs20.existsSync(candidate)) {
|
|
65761
66353
|
return candidate;
|
|
65762
66354
|
}
|
|
65763
66355
|
}
|
|
@@ -65865,8 +66457,8 @@ function createServer2(deps) {
|
|
|
65865
66457
|
app.use("/api/node-operations", createNodeOperationRoutes());
|
|
65866
66458
|
app.use("/api/events", createEventRoutes());
|
|
65867
66459
|
if (staticDir) {
|
|
65868
|
-
const indexPath =
|
|
65869
|
-
if (
|
|
66460
|
+
const indexPath = path20.join(staticDir, "index.html");
|
|
66461
|
+
if (fs20.existsSync(indexPath)) {
|
|
65870
66462
|
app.get("*", (req, res, next) => {
|
|
65871
66463
|
if (isApiRequest(req)) {
|
|
65872
66464
|
next();
|
|
@@ -65980,12 +66572,12 @@ function detectLocalIp() {
|
|
|
65980
66572
|
return "127.0.0.1";
|
|
65981
66573
|
}
|
|
65982
66574
|
function detectAvailablePort() {
|
|
65983
|
-
return new Promise((
|
|
66575
|
+
return new Promise((resolve15, reject) => {
|
|
65984
66576
|
const srv = (0, import_node_http2.createServer)();
|
|
65985
66577
|
srv.listen(0, () => {
|
|
65986
66578
|
const addr = srv.address();
|
|
65987
66579
|
const port = addr && typeof addr !== "string" ? addr.port : 0;
|
|
65988
|
-
srv.close((err) => err ? reject(err) :
|
|
66580
|
+
srv.close((err) => err ? reject(err) : resolve15(port));
|
|
65989
66581
|
});
|
|
65990
66582
|
srv.on("error", reject);
|
|
65991
66583
|
});
|
|
@@ -66030,10 +66622,10 @@ var DirectTransport = class {
|
|
|
66030
66622
|
};
|
|
66031
66623
|
|
|
66032
66624
|
// ../../packages/transport/src/devtunnel.ts
|
|
66033
|
-
var
|
|
66625
|
+
var import_node_child_process11 = require("child_process");
|
|
66034
66626
|
function isInstalled(cmd) {
|
|
66035
66627
|
try {
|
|
66036
|
-
(0,
|
|
66628
|
+
(0, import_node_child_process11.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
|
|
66037
66629
|
return true;
|
|
66038
66630
|
} catch {
|
|
66039
66631
|
return false;
|
|
@@ -66056,18 +66648,18 @@ var DevTunnelTransport = class {
|
|
|
66056
66648
|
);
|
|
66057
66649
|
}
|
|
66058
66650
|
try {
|
|
66059
|
-
(0,
|
|
66651
|
+
(0, import_node_child_process11.execSync)("devtunnel user show", { stdio: "pipe" });
|
|
66060
66652
|
} catch {
|
|
66061
66653
|
throw new Error(
|
|
66062
66654
|
"Not logged in to devtunnel. Run: devtunnel user login"
|
|
66063
66655
|
);
|
|
66064
66656
|
}
|
|
66065
66657
|
const hostArgs = this.buildHostArgs(localPort);
|
|
66066
|
-
const child = (0,
|
|
66658
|
+
const child = (0, import_node_child_process11.spawn)("devtunnel", hostArgs, {
|
|
66067
66659
|
stdio: ["pipe", "pipe", "pipe"]
|
|
66068
66660
|
});
|
|
66069
66661
|
this.process = child;
|
|
66070
|
-
this.publicUrl = await new Promise((
|
|
66662
|
+
this.publicUrl = await new Promise((resolve15, reject) => {
|
|
66071
66663
|
const timeout = setTimeout(() => {
|
|
66072
66664
|
child.kill();
|
|
66073
66665
|
this.process = null;
|
|
@@ -66090,7 +66682,7 @@ var DevTunnelTransport = class {
|
|
|
66090
66682
|
clearTimeout(timeout);
|
|
66091
66683
|
child.stdout?.removeListener("data", onData);
|
|
66092
66684
|
child.stderr?.removeListener("data", onErrData);
|
|
66093
|
-
|
|
66685
|
+
resolve15(url.replace(/\/+$/, ""));
|
|
66094
66686
|
};
|
|
66095
66687
|
child.stdout?.on("data", onData);
|
|
66096
66688
|
child.stderr?.on("data", onErrData);
|
|
@@ -66122,14 +66714,14 @@ ${lines.join("")}`
|
|
|
66122
66714
|
this.publicUrl = null;
|
|
66123
66715
|
if (child.exitCode === null) {
|
|
66124
66716
|
child.kill("SIGTERM");
|
|
66125
|
-
await new Promise((
|
|
66717
|
+
await new Promise((resolve15) => {
|
|
66126
66718
|
const killTimer = setTimeout(() => {
|
|
66127
66719
|
child.kill("SIGKILL");
|
|
66128
|
-
|
|
66720
|
+
resolve15();
|
|
66129
66721
|
}, 5e3);
|
|
66130
66722
|
child.on("close", () => {
|
|
66131
66723
|
clearTimeout(killTimer);
|
|
66132
|
-
|
|
66724
|
+
resolve15();
|
|
66133
66725
|
});
|
|
66134
66726
|
});
|
|
66135
66727
|
}
|
|
@@ -66168,7 +66760,7 @@ ${lines.join("")}`
|
|
|
66168
66760
|
return;
|
|
66169
66761
|
}
|
|
66170
66762
|
try {
|
|
66171
|
-
(0,
|
|
66763
|
+
(0, import_node_child_process11.execFileSync)("devtunnel", ["access", "create", tunnelId, "--tenant"], { stdio: "pipe" });
|
|
66172
66764
|
} catch (err) {
|
|
66173
66765
|
if (isExistingTenantAccessError(err)) {
|
|
66174
66766
|
return;
|
|
@@ -66184,7 +66776,7 @@ ${lines.join("")}`
|
|
|
66184
66776
|
return void 0;
|
|
66185
66777
|
}
|
|
66186
66778
|
try {
|
|
66187
|
-
(0,
|
|
66779
|
+
(0, import_node_child_process11.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
|
|
66188
66780
|
return tunnelId;
|
|
66189
66781
|
} catch {
|
|
66190
66782
|
const createArgs = ["create", tunnelId];
|
|
@@ -66192,7 +66784,7 @@ ${lines.join("")}`
|
|
|
66192
66784
|
createArgs.push("-a");
|
|
66193
66785
|
}
|
|
66194
66786
|
try {
|
|
66195
|
-
(0,
|
|
66787
|
+
(0, import_node_child_process11.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
|
|
66196
66788
|
return tunnelId;
|
|
66197
66789
|
} catch (err) {
|
|
66198
66790
|
throw new Error(
|
|
@@ -66204,13 +66796,13 @@ ${lines.join("")}`
|
|
|
66204
66796
|
ensureTunnelPort(tunnelId, localPort) {
|
|
66205
66797
|
const ports = this.listTunnelPorts(tunnelId);
|
|
66206
66798
|
for (const stalePort of ports.filter((p) => p !== localPort)) {
|
|
66207
|
-
(0,
|
|
66799
|
+
(0, import_node_child_process11.execFileSync)("devtunnel", ["port", "delete", tunnelId, "-p", String(stalePort)], { stdio: "pipe" });
|
|
66208
66800
|
}
|
|
66209
66801
|
if (ports.includes(localPort)) {
|
|
66210
66802
|
return;
|
|
66211
66803
|
}
|
|
66212
66804
|
try {
|
|
66213
|
-
(0,
|
|
66805
|
+
(0, import_node_child_process11.execFileSync)(
|
|
66214
66806
|
"devtunnel",
|
|
66215
66807
|
["port", "create", tunnelId, "-p", String(localPort), "--protocol", "http"],
|
|
66216
66808
|
{ stdio: "pipe" }
|
|
@@ -66226,7 +66818,7 @@ ${lines.join("")}`
|
|
|
66226
66818
|
}
|
|
66227
66819
|
listTunnelPorts(tunnelId) {
|
|
66228
66820
|
try {
|
|
66229
|
-
const output = (0,
|
|
66821
|
+
const output = (0, import_node_child_process11.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
|
|
66230
66822
|
const parsed = JSON.parse(output.toString());
|
|
66231
66823
|
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 : [];
|
|
66232
66824
|
return items.map((item) => getPortNumber(item)).filter((value) => value !== void 0);
|
|
@@ -66238,7 +66830,7 @@ ${lines.join("")}`
|
|
|
66238
66830
|
}
|
|
66239
66831
|
hasTunnelPort(tunnelId, localPort) {
|
|
66240
66832
|
try {
|
|
66241
|
-
(0,
|
|
66833
|
+
(0, import_node_child_process11.execFileSync)(
|
|
66242
66834
|
"devtunnel",
|
|
66243
66835
|
["port", "show", tunnelId, "-p", String(localPort), "-j"],
|
|
66244
66836
|
{ stdio: "pipe" }
|
|
@@ -66342,10 +66934,10 @@ var terminalWriter = {
|
|
|
66342
66934
|
};
|
|
66343
66935
|
|
|
66344
66936
|
// src/startup.ts
|
|
66345
|
-
var
|
|
66346
|
-
var
|
|
66937
|
+
var fs21 = __toESM(require("fs"), 1);
|
|
66938
|
+
var path21 = __toESM(require("path"), 1);
|
|
66347
66939
|
var readline = __toESM(require("readline/promises"), 1);
|
|
66348
|
-
var
|
|
66940
|
+
var import_node_child_process12 = require("child_process");
|
|
66349
66941
|
function getDefaultNodeName() {
|
|
66350
66942
|
return getDeviceNodeName();
|
|
66351
66943
|
}
|
|
@@ -66355,7 +66947,7 @@ function isDevBoxEnvironment(env = process.env) {
|
|
|
66355
66947
|
}
|
|
66356
66948
|
var DEFAULT_NODE_NAME = getDefaultNodeName();
|
|
66357
66949
|
var SUPPORTED_TRANSPORTS = ["direct", "devtunnel"];
|
|
66358
|
-
var STARTUP_REQUIREMENTS = ["az", "devtunnel", "claude", "codex"];
|
|
66950
|
+
var STARTUP_REQUIREMENTS = ["az", "devtunnel", "claude", "codex", "copilot"];
|
|
66359
66951
|
function createDefaultConfig(storagePath = resolveDefaultStoragePath(), nodeName = DEFAULT_NODE_NAME) {
|
|
66360
66952
|
return {
|
|
66361
66953
|
node: { name: nodeName, port: DEFAULT_NODE_PORT, workDir: process.cwd() },
|
|
@@ -66399,7 +66991,7 @@ function createPromptSession(prompt) {
|
|
|
66399
66991
|
}
|
|
66400
66992
|
function createDefaultCommandRunner(platform2) {
|
|
66401
66993
|
return (command, args, interactive = false) => {
|
|
66402
|
-
const result = (0,
|
|
66994
|
+
const result = (0, import_node_child_process12.spawnSync)(command, args, {
|
|
66403
66995
|
encoding: "utf-8",
|
|
66404
66996
|
shell: platform2 === "win32",
|
|
66405
66997
|
stdio: interactive ? "inherit" : "pipe"
|
|
@@ -66414,19 +67006,19 @@ function createDefaultCommandRunner(platform2) {
|
|
|
66414
67006
|
};
|
|
66415
67007
|
}
|
|
66416
67008
|
function getNodeMetadataPath2(storagePath) {
|
|
66417
|
-
return
|
|
67009
|
+
return path21.join(storagePath, "metadata.json");
|
|
66418
67010
|
}
|
|
66419
67011
|
function readStartupMetadataFile(storagePath) {
|
|
66420
67012
|
try {
|
|
66421
|
-
const raw = JSON.parse(
|
|
67013
|
+
const raw = JSON.parse(fs21.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
|
|
66422
67014
|
return typeof raw === "object" && raw !== null ? raw : {};
|
|
66423
67015
|
} catch {
|
|
66424
67016
|
return {};
|
|
66425
67017
|
}
|
|
66426
67018
|
}
|
|
66427
67019
|
function writeStartupMetadataFile(storagePath, metadata) {
|
|
66428
|
-
|
|
66429
|
-
|
|
67020
|
+
fs21.mkdirSync(storagePath, { recursive: true });
|
|
67021
|
+
fs21.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
|
|
66430
67022
|
}
|
|
66431
67023
|
function formatLocalDate2(now) {
|
|
66432
67024
|
const year = now.getFullYear();
|
|
@@ -66477,6 +67069,8 @@ function buildInstallCommand(requirement, platform2) {
|
|
|
66477
67069
|
return void 0;
|
|
66478
67070
|
case "codex":
|
|
66479
67071
|
return { command: "npm", args: ["install", "-g", "@openai/codex"] };
|
|
67072
|
+
case "copilot":
|
|
67073
|
+
return { command: "npm", args: ["install", "-g", "@github/copilot"] };
|
|
66480
67074
|
}
|
|
66481
67075
|
}
|
|
66482
67076
|
function buildLoginCommand(requirement) {
|
|
@@ -66508,7 +67102,7 @@ function isRequirementSatisfied(requirement, status) {
|
|
|
66508
67102
|
return true;
|
|
66509
67103
|
}
|
|
66510
67104
|
function sleep2(ms) {
|
|
66511
|
-
return new Promise((
|
|
67105
|
+
return new Promise((resolve15) => setTimeout(resolve15, ms));
|
|
66512
67106
|
}
|
|
66513
67107
|
function areCachedAuthRequirementsCurrent(commandRunner) {
|
|
66514
67108
|
return isAuthenticated("az", commandRunner) && isAuthenticated("devtunnel", commandRunner);
|
|
@@ -66665,9 +67259,9 @@ async function ensureStartupRequirements(storagePath, options = {}) {
|
|
|
66665
67259
|
metadata
|
|
66666
67260
|
};
|
|
66667
67261
|
}
|
|
66668
|
-
function loadConfigFile(
|
|
67262
|
+
function loadConfigFile(path23) {
|
|
66669
67263
|
try {
|
|
66670
|
-
const raw =
|
|
67264
|
+
const raw = fs21.readFileSync(path23, "utf-8");
|
|
66671
67265
|
return JSON.parse(raw);
|
|
66672
67266
|
} catch {
|
|
66673
67267
|
return {};
|
|
@@ -66846,26 +67440,26 @@ function formatLoadedStartMetadata(info, authEnabled) {
|
|
|
66846
67440
|
}
|
|
66847
67441
|
|
|
66848
67442
|
// src/runtime-metadata.ts
|
|
66849
|
-
var
|
|
66850
|
-
var
|
|
66851
|
-
var
|
|
67443
|
+
var fs22 = __toESM(require("fs"), 1);
|
|
67444
|
+
var path22 = __toESM(require("path"), 1);
|
|
67445
|
+
var import_node_child_process13 = require("child_process");
|
|
66852
67446
|
var runtimeDir = resolveRuntimeDir();
|
|
66853
67447
|
var appRoot = resolveAppRoot(runtimeDir);
|
|
66854
|
-
var repoRoot =
|
|
67448
|
+
var repoRoot = path22.resolve(appRoot, "../..");
|
|
66855
67449
|
function resolveRuntimeDir() {
|
|
66856
67450
|
const entryPath = process.argv[1];
|
|
66857
67451
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
66858
67452
|
try {
|
|
66859
|
-
return
|
|
67453
|
+
return path22.dirname(fs22.realpathSync(path22.resolve(entryPath)));
|
|
66860
67454
|
} catch {
|
|
66861
|
-
return
|
|
67455
|
+
return path22.dirname(path22.resolve(entryPath));
|
|
66862
67456
|
}
|
|
66863
67457
|
}
|
|
66864
67458
|
return process.cwd();
|
|
66865
67459
|
}
|
|
66866
67460
|
function readJsonFile(filePath) {
|
|
66867
67461
|
try {
|
|
66868
|
-
return JSON.parse(
|
|
67462
|
+
return JSON.parse(fs22.readFileSync(filePath, "utf-8"));
|
|
66869
67463
|
} catch {
|
|
66870
67464
|
return null;
|
|
66871
67465
|
}
|
|
@@ -66875,9 +67469,9 @@ function readPackageManifest(filePath) {
|
|
|
66875
67469
|
}
|
|
66876
67470
|
function readEmbeddedRuntimeMetadata() {
|
|
66877
67471
|
const candidates = [
|
|
66878
|
-
|
|
66879
|
-
|
|
66880
|
-
|
|
67472
|
+
path22.join(appRoot, "runtime-metadata.json"),
|
|
67473
|
+
path22.join(runtimeDir, "runtime-metadata.json"),
|
|
67474
|
+
path22.resolve(process.cwd(), "apps/node/dist/runtime-metadata.json")
|
|
66881
67475
|
];
|
|
66882
67476
|
for (const candidate of candidates) {
|
|
66883
67477
|
const metadata = readJsonFile(candidate);
|
|
@@ -66890,23 +67484,23 @@ function readEmbeddedRuntimeMetadata() {
|
|
|
66890
67484
|
function resolveAppRoot(baseDir) {
|
|
66891
67485
|
const candidates = [
|
|
66892
67486
|
baseDir,
|
|
66893
|
-
|
|
66894
|
-
|
|
66895
|
-
|
|
67487
|
+
path22.resolve(baseDir, ".."),
|
|
67488
|
+
path22.resolve(process.cwd(), "apps/node/dist"),
|
|
67489
|
+
path22.resolve(process.cwd(), "apps/node"),
|
|
66896
67490
|
process.cwd()
|
|
66897
67491
|
];
|
|
66898
67492
|
for (const candidate of candidates) {
|
|
66899
|
-
const manifest = readPackageManifest(
|
|
67493
|
+
const manifest = readPackageManifest(path22.join(candidate, "package.json"));
|
|
66900
67494
|
if (manifest?.name === "@meshy/node" || manifest?.name === "meshy-node") {
|
|
66901
67495
|
return candidate;
|
|
66902
67496
|
}
|
|
66903
67497
|
}
|
|
66904
67498
|
for (const candidate of candidates) {
|
|
66905
|
-
if (
|
|
67499
|
+
if (fs22.existsSync(path22.join(candidate, "package.json"))) {
|
|
66906
67500
|
return candidate;
|
|
66907
67501
|
}
|
|
66908
67502
|
}
|
|
66909
|
-
return
|
|
67503
|
+
return path22.resolve(baseDir, "..");
|
|
66910
67504
|
}
|
|
66911
67505
|
function toPackageInfo(filePath) {
|
|
66912
67506
|
const manifest = readPackageManifest(filePath);
|
|
@@ -66944,7 +67538,7 @@ function readRepositoryUrlFromManifest(manifest) {
|
|
|
66944
67538
|
}
|
|
66945
67539
|
function readGitValue(args) {
|
|
66946
67540
|
try {
|
|
66947
|
-
const output = (0,
|
|
67541
|
+
const output = (0, import_node_child_process13.execFileSync)("git", args, {
|
|
66948
67542
|
cwd: repoRoot,
|
|
66949
67543
|
encoding: "utf-8",
|
|
66950
67544
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -66966,8 +67560,8 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
66966
67560
|
components: startupRequirements.components
|
|
66967
67561
|
};
|
|
66968
67562
|
}
|
|
66969
|
-
const appPackage = toPackageInfo(
|
|
66970
|
-
const workspaceManifest = readPackageManifest(
|
|
67563
|
+
const appPackage = toPackageInfo(path22.join(appRoot, "package.json"));
|
|
67564
|
+
const workspaceManifest = readPackageManifest(path22.join(repoRoot, "package.json"));
|
|
66971
67565
|
return {
|
|
66972
67566
|
packageName: appPackage?.name ?? "meshy",
|
|
66973
67567
|
packageVersion: appPackage?.version ?? "0.1.0",
|
|
@@ -66975,11 +67569,11 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
66975
67569
|
startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
|
|
66976
67570
|
components: startupRequirements.components,
|
|
66977
67571
|
packages: {
|
|
66978
|
-
workspace: toPackageInfo(
|
|
67572
|
+
workspace: toPackageInfo(path22.join(repoRoot, "package.json")),
|
|
66979
67573
|
node: appPackage,
|
|
66980
|
-
core: toPackageInfo(
|
|
66981
|
-
dashboard: toPackageInfo(
|
|
66982
|
-
api: toPackageInfo(
|
|
67574
|
+
core: toPackageInfo(path22.join(repoRoot, "packages/core/package.json")),
|
|
67575
|
+
dashboard: toPackageInfo(path22.join(repoRoot, "packages/dashboard/package.json")),
|
|
67576
|
+
api: toPackageInfo(path22.join(repoRoot, "packages/api/package.json"))
|
|
66983
67577
|
},
|
|
66984
67578
|
repository: {
|
|
66985
67579
|
url: normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.upstream.url"])) ?? normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.origin.url"])) ?? readRepositoryUrlFromManifest(workspaceManifest),
|
|
@@ -66990,9 +67584,9 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
66990
67584
|
}
|
|
66991
67585
|
|
|
66992
67586
|
// src/bootstrap/runtime-restart.ts
|
|
66993
|
-
var
|
|
67587
|
+
var fs23 = __toESM(require("fs"), 1);
|
|
66994
67588
|
var nodePath2 = __toESM(require("path"), 1);
|
|
66995
|
-
var
|
|
67589
|
+
var import_node_child_process14 = require("child_process");
|
|
66996
67590
|
var RUNTIME_UPDATE_CHECK_INTERVAL_MS = 6 * 60 * 60 * 1e3;
|
|
66997
67591
|
function resolveRuntimeRestartStartArgs(hydratedArgs, restartArgs) {
|
|
66998
67592
|
return restartArgs ? { ...restartArgs } : hydratedArgs;
|
|
@@ -67101,7 +67695,7 @@ function compareSemver2(left, right) {
|
|
|
67101
67695
|
return 0;
|
|
67102
67696
|
}
|
|
67103
67697
|
function runRuntimePackageCommand(command, args) {
|
|
67104
|
-
const result = (0,
|
|
67698
|
+
const result = (0, import_node_child_process14.spawnSync)(command, args, {
|
|
67105
67699
|
encoding: "utf-8",
|
|
67106
67700
|
windowsHide: true,
|
|
67107
67701
|
timeout: 2500
|
|
@@ -67140,7 +67734,7 @@ function createSpawnableCommand(command, args, platform2) {
|
|
|
67140
67734
|
}
|
|
67141
67735
|
function readProcessCommand(pid, platform2) {
|
|
67142
67736
|
if (platform2 === "win32") return null;
|
|
67143
|
-
const result = (0,
|
|
67737
|
+
const result = (0, import_node_child_process14.spawnSync)("ps", ["-p", String(pid), "-o", "args="], {
|
|
67144
67738
|
encoding: "utf-8",
|
|
67145
67739
|
windowsHide: true,
|
|
67146
67740
|
timeout: 1e3
|
|
@@ -67231,9 +67825,9 @@ function createRuntimeRestartLaunchPlan(options) {
|
|
|
67231
67825
|
};
|
|
67232
67826
|
}
|
|
67233
67827
|
function scheduleRuntimeRestart(plan, options = {}) {
|
|
67234
|
-
|
|
67235
|
-
const logFd =
|
|
67236
|
-
const spawnImpl = options.spawnImpl ??
|
|
67828
|
+
fs23.mkdirSync(nodePath2.dirname(plan.logPath), { recursive: true });
|
|
67829
|
+
const logFd = fs23.openSync(plan.logPath, "a");
|
|
67830
|
+
const spawnImpl = options.spawnImpl ?? import_node_child_process14.spawn;
|
|
67237
67831
|
const env = {
|
|
67238
67832
|
...process.env,
|
|
67239
67833
|
MESHY_RESTART_PARENT_PID: String(options.parentPid ?? process.pid),
|
|
@@ -67827,7 +68421,7 @@ function registerShutdownHandlers(options) {
|
|
|
67827
68421
|
}
|
|
67828
68422
|
async function startNode(args) {
|
|
67829
68423
|
const { authMetadata, config: config2, hydratedArgs, runtimeMetadata, storageRoot } = await resolveStartConfig(args);
|
|
67830
|
-
terminalWriter.line("Checking startup requirements (az, devtunnel, claude, codex)...");
|
|
68424
|
+
terminalWriter.line("Checking startup requirements (az, devtunnel, claude, codex, copilot)...");
|
|
67831
68425
|
const startupRequirements = await ensureStartupRequirements(config2.storage.path);
|
|
67832
68426
|
terminalWriter.line(
|
|
67833
68427
|
startupRequirements.skipped ? "Startup requirements already verified today; skipping checks." : "Startup requirements check complete."
|
|
@@ -67902,7 +68496,8 @@ async function startNode(args) {
|
|
|
67902
68496
|
engineRegistry: meshyNode.getEngineRegistry(),
|
|
67903
68497
|
liteAgentRunner: new LiteAgentRunner({
|
|
67904
68498
|
claudecode: new ClaudeLiteAdapter(),
|
|
67905
|
-
codex: new CodexLiteAdapter()
|
|
68499
|
+
codex: new CodexLiteAdapter(),
|
|
68500
|
+
copilot: new CopilotLiteAdapter()
|
|
67906
68501
|
}),
|
|
67907
68502
|
logger: meshyNode.getLogger(),
|
|
67908
68503
|
config: {
|