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