meshy-node 0.5.9 → 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 +487 -1080
- 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()
|
|
@@ -59018,7 +58436,7 @@ var GitRemoteBranchOptionSchema = external_exports.object({
|
|
|
59018
58436
|
ref: external_exports.string()
|
|
59019
58437
|
});
|
|
59020
58438
|
var NativeSessionSummarySchema = external_exports.object({
|
|
59021
|
-
agent: external_exports.enum(["codex", "claudecode"
|
|
58439
|
+
agent: external_exports.enum(["codex", "claudecode"]),
|
|
59022
58440
|
sessionId: external_exports.string(),
|
|
59023
58441
|
cwd: external_exports.string(),
|
|
59024
58442
|
summary: external_exports.string(),
|
|
@@ -59055,7 +58473,7 @@ var NodeWorkDirBranchQuery = external_exports.object({
|
|
|
59055
58473
|
allowAbsolute: QueryBoolean
|
|
59056
58474
|
});
|
|
59057
58475
|
var NodeNativeSessionsQuery = external_exports.object({
|
|
59058
|
-
agent: external_exports.enum(["codex", "claudecode"
|
|
58476
|
+
agent: external_exports.enum(["codex", "claudecode"]),
|
|
59059
58477
|
limit: external_exports.coerce.number().int().min(1).max(100).default(50)
|
|
59060
58478
|
});
|
|
59061
58479
|
var NodeTerminalSessionStartBody = external_exports.object({
|
|
@@ -59100,7 +58518,7 @@ var CreateNodeWorkDirBranchResponse = NodeWorkDirBranchResponse.extend({
|
|
|
59100
58518
|
});
|
|
59101
58519
|
var NodeNativeSessionsResponse = external_exports.object({
|
|
59102
58520
|
nodeId: external_exports.string(),
|
|
59103
|
-
agent: external_exports.enum(["codex", "claudecode"
|
|
58521
|
+
agent: external_exports.enum(["codex", "claudecode"]),
|
|
59104
58522
|
sessions: external_exports.array(NativeSessionSummarySchema)
|
|
59105
58523
|
});
|
|
59106
58524
|
var NodeTerminalSessionResponse = external_exports.object({
|
|
@@ -59134,8 +58552,8 @@ var ConfigureNodeDevBoxBody = external_exports.object({
|
|
|
59134
58552
|
});
|
|
59135
58553
|
|
|
59136
58554
|
// ../../packages/api/src/schemas/tasks.ts
|
|
59137
|
-
var AGENT_OPTIONS = ["mars", "codex", "claudecode", "
|
|
59138
|
-
var NATIVE_SESSION_AGENT_OPTIONS = ["codex", "claudecode"
|
|
58555
|
+
var AGENT_OPTIONS = ["mars", "codex", "claudecode", "eureka"];
|
|
58556
|
+
var NATIVE_SESSION_AGENT_OPTIONS = ["codex", "claudecode"];
|
|
59139
58557
|
var TASK_MODE_OPTIONS = ["bypass", "plan", "edit", "dangerous"];
|
|
59140
58558
|
var TASK_CONVERSATION_KIND_OPTIONS = ["meshyChat", "nativeSession"];
|
|
59141
58559
|
var TaskPayload = external_exports.record(external_exports.unknown()).superRefine((payload, ctx) => {
|
|
@@ -59279,8 +58697,8 @@ var BatchTaskIdsBody = external_exports.object({
|
|
|
59279
58697
|
});
|
|
59280
58698
|
|
|
59281
58699
|
// ../../packages/api/src/app/server.ts
|
|
59282
|
-
var
|
|
59283
|
-
var
|
|
58700
|
+
var path19 = __toESM(require("path"), 1);
|
|
58701
|
+
var fs19 = __toESM(require("fs"), 1);
|
|
59284
58702
|
var import_express15 = __toESM(require_express2(), 1);
|
|
59285
58703
|
|
|
59286
58704
|
// ../../packages/api/src/middleware/auth.ts
|
|
@@ -59417,8 +58835,8 @@ function decodePathSegment(value) {
|
|
|
59417
58835
|
return value;
|
|
59418
58836
|
}
|
|
59419
58837
|
}
|
|
59420
|
-
function getSingleTaskDeleteId(
|
|
59421
|
-
const match = /^\/api\/tasks\/([^/]+)$/.exec(
|
|
58838
|
+
function getSingleTaskDeleteId(path22) {
|
|
58839
|
+
const match = /^\/api\/tasks\/([^/]+)$/.exec(path22);
|
|
59422
58840
|
return match ? decodePathSegment(match[1]) : null;
|
|
59423
58841
|
}
|
|
59424
58842
|
function getSuccessfulBatchDeleteIds(body) {
|
|
@@ -59680,8 +59098,8 @@ function normalizeDevBoxStatus(status) {
|
|
|
59680
59098
|
return status?.trim().toLowerCase().replace(/[\s_-]+/gu, "");
|
|
59681
59099
|
}
|
|
59682
59100
|
function sleep(ms) {
|
|
59683
|
-
return new Promise((
|
|
59684
|
-
const timer = setTimeout(
|
|
59101
|
+
return new Promise((resolve14) => {
|
|
59102
|
+
const timer = setTimeout(resolve14, ms);
|
|
59685
59103
|
if (typeof timer === "object" && timer !== null && "unref" in timer && typeof timer.unref === "function") {
|
|
59686
59104
|
timer.unref();
|
|
59687
59105
|
}
|
|
@@ -59763,13 +59181,13 @@ function cleanDevBoxInfo(devbox) {
|
|
|
59763
59181
|
}
|
|
59764
59182
|
function normalizeMcpDevBoxList(value) {
|
|
59765
59183
|
const normalized = normalizeMcpValue(value);
|
|
59766
|
-
const record2 =
|
|
59184
|
+
const record2 = isRecord3(normalized) ? normalized : {};
|
|
59767
59185
|
const list = Array.isArray(normalized) ? normalized : Array.isArray(record2.devboxes) ? record2.devboxes : Array.isArray(record2.value) ? record2.value : [];
|
|
59768
59186
|
return list.map((item) => normalizeDevBoxResource(item, void 0)).filter((item) => Boolean(item.name));
|
|
59769
59187
|
}
|
|
59770
59188
|
function normalizeDevBoxResource(value, fallback) {
|
|
59771
59189
|
const record2 = normalizeRecord(value);
|
|
59772
|
-
const additional =
|
|
59190
|
+
const additional = isRecord3(record2.additionalProperties) ? record2.additionalProperties : {};
|
|
59773
59191
|
const fromUri = parseDevBoxUri(readString(record2, "uri"));
|
|
59774
59192
|
const status = readString(record2, "status") ?? readString(record2, "powerState") ?? readString(record2, "lastStatus") ?? fallback?.lastStatus;
|
|
59775
59193
|
const name2 = readString(record2, "name") ?? fromUri?.name ?? fallback?.name ?? "";
|
|
@@ -59823,7 +59241,7 @@ function parseDevCenterEndpoint(hostname4) {
|
|
|
59823
59241
|
}
|
|
59824
59242
|
function normalizeRecord(value) {
|
|
59825
59243
|
const normalized = normalizeMcpValue(value);
|
|
59826
|
-
return
|
|
59244
|
+
return isRecord3(normalized) ? normalized : {};
|
|
59827
59245
|
}
|
|
59828
59246
|
function normalizeMcpValue(value) {
|
|
59829
59247
|
if (Array.isArray(value)) return value;
|
|
@@ -59858,7 +59276,7 @@ function tryParseJson(text) {
|
|
|
59858
59276
|
return null;
|
|
59859
59277
|
}
|
|
59860
59278
|
}
|
|
59861
|
-
function
|
|
59279
|
+
function isRecord3(value) {
|
|
59862
59280
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
59863
59281
|
}
|
|
59864
59282
|
function readString(record2, key) {
|
|
@@ -60116,11 +59534,11 @@ function assertCanChangeNodeDevTunnel(taskEngine, nodeId) {
|
|
|
60116
59534
|
var import_express3 = __toESM(require_express2(), 1);
|
|
60117
59535
|
|
|
60118
59536
|
// ../../packages/api/src/node/node-workdir-service.ts
|
|
60119
|
-
var
|
|
59537
|
+
var path15 = __toESM(require("path"), 1);
|
|
60120
59538
|
|
|
60121
59539
|
// ../../packages/api/src/output/helpers.ts
|
|
60122
|
-
var
|
|
60123
|
-
var
|
|
59540
|
+
var fs13 = __toESM(require("fs"), 1);
|
|
59541
|
+
var path14 = __toESM(require("path"), 1);
|
|
60124
59542
|
var MAX_INLINE_SIZE = 512 * 1024;
|
|
60125
59543
|
var TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
60126
59544
|
".txt",
|
|
@@ -60233,15 +59651,15 @@ function mimeForExt(ext) {
|
|
|
60233
59651
|
return MIME_MAP[ext] ?? "application/octet-stream";
|
|
60234
59652
|
}
|
|
60235
59653
|
function resolveOutputPath(root, relativePath) {
|
|
60236
|
-
const resolved =
|
|
60237
|
-
const normalizedRoot =
|
|
60238
|
-
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) {
|
|
60239
59657
|
throw new Error("Path traversal detected");
|
|
60240
59658
|
}
|
|
60241
59659
|
return resolved;
|
|
60242
59660
|
}
|
|
60243
59661
|
function classifyFile(filePath) {
|
|
60244
|
-
const ext =
|
|
59662
|
+
const ext = path14.extname(filePath).toLowerCase();
|
|
60245
59663
|
if (ext === ".json" || ext === ".jsonl" || ext === ".ndjson") {
|
|
60246
59664
|
return { kind: "json", mimeType: "application/json" };
|
|
60247
59665
|
}
|
|
@@ -60271,21 +59689,21 @@ function listDirectory(root, relativePath, options = {}) {
|
|
|
60271
59689
|
return listResolvedDirectory(absPath, relativePath, options);
|
|
60272
59690
|
}
|
|
60273
59691
|
function listAbsoluteDirectory(absoluteDir, options = {}) {
|
|
60274
|
-
if (!
|
|
59692
|
+
if (!path14.isAbsolute(absoluteDir)) {
|
|
60275
59693
|
throw new Error("listAbsoluteDirectory requires an absolute path");
|
|
60276
59694
|
}
|
|
60277
59695
|
return listResolvedDirectory(absoluteDir, absoluteDir, { ...options, childPathStyle: "absolute" });
|
|
60278
59696
|
}
|
|
60279
59697
|
function listResolvedDirectory(absPath, relativeBase, options = {}) {
|
|
60280
|
-
if (!
|
|
59698
|
+
if (!fs13.existsSync(absPath) || !fs13.statSync(absPath).isDirectory()) {
|
|
60281
59699
|
return [];
|
|
60282
59700
|
}
|
|
60283
|
-
const entries =
|
|
59701
|
+
const entries = fs13.readdirSync(absPath, { withFileTypes: true });
|
|
60284
59702
|
const result = [];
|
|
60285
59703
|
const childPathStyle = options.childPathStyle ?? "relative";
|
|
60286
59704
|
for (const entry of entries) {
|
|
60287
59705
|
if (entry.name.startsWith(".")) continue;
|
|
60288
|
-
const entryRelPath = childPathStyle === "absolute" ?
|
|
59706
|
+
const entryRelPath = childPathStyle === "absolute" ? path14.join(absPath, entry.name) : path14.join(relativeBase || ".", entry.name).split(path14.sep).join("/");
|
|
60289
59707
|
if (entry.isDirectory()) {
|
|
60290
59708
|
result.push({
|
|
60291
59709
|
path: entryRelPath,
|
|
@@ -60295,8 +59713,8 @@ function listResolvedDirectory(absPath, relativeBase, options = {}) {
|
|
|
60295
59713
|
} else if (options.directoriesOnly) {
|
|
60296
59714
|
continue;
|
|
60297
59715
|
} else if (entry.isFile()) {
|
|
60298
|
-
const fullPath =
|
|
60299
|
-
const stat =
|
|
59716
|
+
const fullPath = path14.join(absPath, entry.name);
|
|
59717
|
+
const stat = fs13.statSync(fullPath);
|
|
60300
59718
|
const { kind, mimeType } = classifyFile(entry.name);
|
|
60301
59719
|
result.push({
|
|
60302
59720
|
path: entryRelPath,
|
|
@@ -60316,11 +59734,11 @@ function listResolvedDirectory(absPath, relativeBase, options = {}) {
|
|
|
60316
59734
|
}
|
|
60317
59735
|
function detectHtmlEntries(root) {
|
|
60318
59736
|
const entries = [];
|
|
60319
|
-
if (
|
|
59737
|
+
if (fs13.existsSync(path14.join(root, "index.html"))) {
|
|
60320
59738
|
entries.push({ path: "index.html", label: "index.html" });
|
|
60321
59739
|
}
|
|
60322
59740
|
try {
|
|
60323
|
-
const topLevel =
|
|
59741
|
+
const topLevel = fs13.readdirSync(root, { withFileTypes: true });
|
|
60324
59742
|
const htmlFiles = topLevel.filter(
|
|
60325
59743
|
(e) => e.isFile() && e.name.endsWith(".html") && !e.name.startsWith(".")
|
|
60326
59744
|
);
|
|
@@ -60331,8 +59749,8 @@ function detectHtmlEntries(root) {
|
|
|
60331
59749
|
}
|
|
60332
59750
|
const subdirs = topLevel.filter((e) => e.isDirectory() && !e.name.startsWith("."));
|
|
60333
59751
|
for (const dir of subdirs) {
|
|
60334
|
-
const subIndex =
|
|
60335
|
-
if (
|
|
59752
|
+
const subIndex = path14.join(root, dir.name, "index.html");
|
|
59753
|
+
if (fs13.existsSync(subIndex)) {
|
|
60336
59754
|
entries.push({
|
|
60337
59755
|
path: `${dir.name}/index.html`,
|
|
60338
59756
|
label: `${dir.name}/index.html`
|
|
@@ -60346,7 +59764,7 @@ function detectHtmlEntries(root) {
|
|
|
60346
59764
|
function detectMarkdownEntries(root) {
|
|
60347
59765
|
const entries = [];
|
|
60348
59766
|
try {
|
|
60349
|
-
const topLevel =
|
|
59767
|
+
const topLevel = fs13.readdirSync(root, { withFileTypes: true });
|
|
60350
59768
|
for (const f of topLevel) {
|
|
60351
59769
|
if (f.isFile() && !f.name.startsWith(".") && /\.mdx?$/i.test(f.name)) {
|
|
60352
59770
|
entries.push({ path: f.name, label: f.name });
|
|
@@ -60355,8 +59773,8 @@ function detectMarkdownEntries(root) {
|
|
|
60355
59773
|
const subdirs = topLevel.filter((e) => e.isDirectory() && !e.name.startsWith("."));
|
|
60356
59774
|
for (const dir of subdirs) {
|
|
60357
59775
|
for (const fileName of ["README.md", "readme.md"]) {
|
|
60358
|
-
const readmePath =
|
|
60359
|
-
if (
|
|
59776
|
+
const readmePath = path14.join(root, dir.name, fileName);
|
|
59777
|
+
if (fs13.existsSync(readmePath)) {
|
|
60360
59778
|
entries.push({ path: `${dir.name}/${fileName}`, label: `${dir.name}/${fileName}` });
|
|
60361
59779
|
break;
|
|
60362
59780
|
}
|
|
@@ -60367,12 +59785,12 @@ function detectMarkdownEntries(root) {
|
|
|
60367
59785
|
return entries;
|
|
60368
59786
|
}
|
|
60369
59787
|
function getOutputSummary(root) {
|
|
60370
|
-
const rootName =
|
|
59788
|
+
const rootName = path14.basename(root);
|
|
60371
59789
|
const htmlEntries = detectHtmlEntries(root);
|
|
60372
59790
|
const markdownEntries = detectMarkdownEntries(root);
|
|
60373
59791
|
let fileCount;
|
|
60374
59792
|
try {
|
|
60375
|
-
const entries =
|
|
59793
|
+
const entries = fs13.readdirSync(root, { withFileTypes: true });
|
|
60376
59794
|
fileCount = entries.filter((e) => !e.name.startsWith(".")).length;
|
|
60377
59795
|
} catch {
|
|
60378
59796
|
fileCount = void 0;
|
|
@@ -60389,14 +59807,14 @@ function getOutputSummary(root) {
|
|
|
60389
59807
|
}
|
|
60390
59808
|
function readFileContent(root, relativePath) {
|
|
60391
59809
|
const absPath = resolveOutputPath(root, relativePath);
|
|
60392
|
-
if (!
|
|
59810
|
+
if (!fs13.existsSync(absPath) || !fs13.statSync(absPath).isFile()) {
|
|
60393
59811
|
throw new Error("File not found");
|
|
60394
59812
|
}
|
|
60395
|
-
const stat =
|
|
59813
|
+
const stat = fs13.statSync(absPath);
|
|
60396
59814
|
const { kind, mimeType } = classifyFile(absPath);
|
|
60397
59815
|
if (kind === "image" || kind === "pdf" || kind === "binary") {
|
|
60398
59816
|
const truncated2 = stat.size > MAX_INLINE_SIZE;
|
|
60399
|
-
const buffer = truncated2 ? Buffer.alloc(0) :
|
|
59817
|
+
const buffer = truncated2 ? Buffer.alloc(0) : fs13.readFileSync(absPath);
|
|
60400
59818
|
return {
|
|
60401
59819
|
path: relativePath,
|
|
60402
59820
|
kind,
|
|
@@ -60407,7 +59825,7 @@ function readFileContent(root, relativePath) {
|
|
|
60407
59825
|
};
|
|
60408
59826
|
}
|
|
60409
59827
|
const truncated = stat.size > MAX_INLINE_SIZE;
|
|
60410
|
-
const content = truncated ?
|
|
59828
|
+
const content = truncated ? fs13.readFileSync(absPath, "utf-8").slice(0, MAX_INLINE_SIZE) : fs13.readFileSync(absPath, "utf-8");
|
|
60411
59829
|
return {
|
|
60412
59830
|
path: relativePath,
|
|
60413
59831
|
kind,
|
|
@@ -60419,8 +59837,8 @@ function readFileContent(root, relativePath) {
|
|
|
60419
59837
|
}
|
|
60420
59838
|
|
|
60421
59839
|
// ../../packages/api/src/output/git-command.ts
|
|
60422
|
-
var
|
|
60423
|
-
var
|
|
59840
|
+
var fs14 = __toESM(require("fs"), 1);
|
|
59841
|
+
var import_node_child_process6 = require("child_process");
|
|
60424
59842
|
var COMMON_GIT_BINARIES = [
|
|
60425
59843
|
"/opt/homebrew/bin/git",
|
|
60426
59844
|
"/usr/local/bin/git",
|
|
@@ -60428,7 +59846,7 @@ var COMMON_GIT_BINARIES = [
|
|
|
60428
59846
|
];
|
|
60429
59847
|
function isExecutable(filePath) {
|
|
60430
59848
|
try {
|
|
60431
|
-
|
|
59849
|
+
fs14.accessSync(filePath, fs14.constants.X_OK);
|
|
60432
59850
|
return true;
|
|
60433
59851
|
} catch {
|
|
60434
59852
|
return false;
|
|
@@ -60449,7 +59867,7 @@ function execGit(args, cwd, timeout = 1e4) {
|
|
|
60449
59867
|
let lastError;
|
|
60450
59868
|
for (const command of getGitCandidates()) {
|
|
60451
59869
|
try {
|
|
60452
|
-
return (0,
|
|
59870
|
+
return (0, import_node_child_process6.execFileSync)(command, ["-C", cwd, ...args], {
|
|
60453
59871
|
encoding: "utf-8",
|
|
60454
59872
|
timeout,
|
|
60455
59873
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -60681,14 +60099,14 @@ function getGitDiff(dirPath) {
|
|
|
60681
60099
|
|
|
60682
60100
|
// ../../packages/api/src/node/node-workdir-service.ts
|
|
60683
60101
|
function isAbsolutePath(p) {
|
|
60684
|
-
return
|
|
60102
|
+
return path15.isAbsolute(p) || /^[A-Za-z]:[\\/]/.test(p);
|
|
60685
60103
|
}
|
|
60686
60104
|
function resolveNodeWorkDirTarget(nodeId, rootPath, currentPath, allowAbsolute) {
|
|
60687
60105
|
if (!rootPath) {
|
|
60688
60106
|
throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
|
|
60689
60107
|
}
|
|
60690
60108
|
const useAbsolute = allowAbsolute && isAbsolutePath(currentPath);
|
|
60691
|
-
const resolvedPath = useAbsolute ?
|
|
60109
|
+
const resolvedPath = useAbsolute ? path15.resolve(currentPath) : currentPath;
|
|
60692
60110
|
const targetPath = useAbsolute ? resolvedPath : resolveRelativeNodeWorkDirTarget(rootPath, resolvedPath);
|
|
60693
60111
|
return {
|
|
60694
60112
|
rootPath,
|
|
@@ -60698,9 +60116,9 @@ function resolveNodeWorkDirTarget(nodeId, rootPath, currentPath, allowAbsolute)
|
|
|
60698
60116
|
};
|
|
60699
60117
|
}
|
|
60700
60118
|
function resolveRelativeNodeWorkDirTarget(rootPath, relativePath) {
|
|
60701
|
-
const resolvedRoot =
|
|
60702
|
-
const resolved =
|
|
60703
|
-
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) {
|
|
60704
60122
|
throw new MeshyError("VALIDATION_ERROR", "Invalid directory path", 400);
|
|
60705
60123
|
}
|
|
60706
60124
|
return resolved;
|
|
@@ -60783,13 +60201,13 @@ function createLocalNodeWorkDirBranch(nodeId, rootPath, currentPath, options) {
|
|
|
60783
60201
|
}
|
|
60784
60202
|
function computeParentPath(rootPath, currentPath, useAbsolute) {
|
|
60785
60203
|
if (useAbsolute) {
|
|
60786
|
-
const parent =
|
|
60204
|
+
const parent = path15.dirname(currentPath);
|
|
60787
60205
|
return parent === currentPath ? null : parent;
|
|
60788
60206
|
}
|
|
60789
60207
|
const normalized = currentPath.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
60790
60208
|
if (normalized === "" || normalized === ".") {
|
|
60791
|
-
const absParent =
|
|
60792
|
-
return absParent ===
|
|
60209
|
+
const absParent = path15.dirname(path15.resolve(rootPath));
|
|
60210
|
+
return absParent === path15.resolve(rootPath) ? null : absParent;
|
|
60793
60211
|
}
|
|
60794
60212
|
const segments = normalized.split("/").filter(Boolean);
|
|
60795
60213
|
segments.pop();
|
|
@@ -60800,15 +60218,14 @@ function computeParentPath(rootPath, currentPath, useAbsolute) {
|
|
|
60800
60218
|
var import_node_crypto7 = require("crypto");
|
|
60801
60219
|
|
|
60802
60220
|
// ../../packages/api/src/node/agent-upgrade-service.ts
|
|
60803
|
-
var
|
|
60221
|
+
var import_node_child_process8 = require("child_process");
|
|
60804
60222
|
|
|
60805
60223
|
// ../../packages/api/src/app/system-info.ts
|
|
60806
60224
|
var os6 = __toESM(require("os"), 1);
|
|
60807
|
-
var
|
|
60225
|
+
var import_node_child_process7 = require("child_process");
|
|
60808
60226
|
var RUNTIME_TOOLS = [
|
|
60809
60227
|
{ id: "claude", label: "Claude Code", command: "claude", packageName: "@anthropic-ai/claude-code" },
|
|
60810
|
-
{ id: "codex", label: "Codex", command: "codex", packageName: "@openai/codex" }
|
|
60811
|
-
{ id: "copilot", label: "Copilot CLI", command: "copilot", packageName: "@github/copilot" }
|
|
60228
|
+
{ id: "codex", label: "Codex", command: "codex", packageName: "@openai/codex" }
|
|
60812
60229
|
];
|
|
60813
60230
|
var runtimeToolUpdateCache = /* @__PURE__ */ new Map();
|
|
60814
60231
|
function clearRuntimeToolUpdateCache(packageName) {
|
|
@@ -60819,7 +60236,7 @@ function clearRuntimeToolUpdateCache(packageName) {
|
|
|
60819
60236
|
runtimeToolUpdateCache.clear();
|
|
60820
60237
|
}
|
|
60821
60238
|
function runRuntimeToolCommand(command, args, platform2) {
|
|
60822
|
-
const result = (0,
|
|
60239
|
+
const result = (0, import_node_child_process7.spawnSync)(command, args, {
|
|
60823
60240
|
encoding: "utf-8",
|
|
60824
60241
|
shell: platform2 === "win32" && command !== "where",
|
|
60825
60242
|
windowsHide: true,
|
|
@@ -61016,8 +60433,7 @@ function buildNodeSettingsSnapshot(options) {
|
|
|
61016
60433
|
// ../../packages/api/src/node/agent-upgrade-service.ts
|
|
61017
60434
|
var AGENT_PACKAGES = {
|
|
61018
60435
|
claude: "@anthropic-ai/claude-code",
|
|
61019
|
-
codex: "@openai/codex"
|
|
61020
|
-
copilot: "@github/copilot"
|
|
60436
|
+
codex: "@openai/codex"
|
|
61021
60437
|
};
|
|
61022
60438
|
var OUTPUT_LIMIT = 4e3;
|
|
61023
60439
|
function summarizeOutput(value) {
|
|
@@ -61025,7 +60441,7 @@ function summarizeOutput(value) {
|
|
|
61025
60441
|
return text.length > OUTPUT_LIMIT ? `${text.slice(0, OUTPUT_LIMIT)}\u2026` : text;
|
|
61026
60442
|
}
|
|
61027
60443
|
function defaultCommandRunner(command, args) {
|
|
61028
|
-
const result = (0,
|
|
60444
|
+
const result = (0, import_node_child_process8.spawnSync)(command, args, {
|
|
61029
60445
|
encoding: "utf-8",
|
|
61030
60446
|
shell: process.platform === "win32",
|
|
61031
60447
|
windowsHide: true,
|
|
@@ -61039,7 +60455,7 @@ function defaultCommandRunner(command, args) {
|
|
|
61039
60455
|
};
|
|
61040
60456
|
}
|
|
61041
60457
|
function isRuntimeAgentId(value) {
|
|
61042
|
-
return value === "claude" || value === "codex"
|
|
60458
|
+
return value === "claude" || value === "codex";
|
|
61043
60459
|
}
|
|
61044
60460
|
function buildUpgradeArgs(agent, packageName) {
|
|
61045
60461
|
const args = ["install", "-g", `${packageName}@latest`];
|
|
@@ -61087,7 +60503,7 @@ function upgradeRuntimeAgentForDeps(deps, agent) {
|
|
|
61087
60503
|
|
|
61088
60504
|
// ../../packages/api/src/node/runtime-restart-request.ts
|
|
61089
60505
|
function parseRuntimeRestartRequest(value) {
|
|
61090
|
-
const body =
|
|
60506
|
+
const body = isRecord4(value) ? value : {};
|
|
61091
60507
|
const startArgs = parseRuntimeRestartStartArgs(body.startArgs);
|
|
61092
60508
|
return {
|
|
61093
60509
|
reason: body.reason === "update" ? "update" : "restart",
|
|
@@ -61096,7 +60512,7 @@ function parseRuntimeRestartRequest(value) {
|
|
|
61096
60512
|
}
|
|
61097
60513
|
function parseRuntimeRestartStartArgs(value) {
|
|
61098
60514
|
if (value === void 0) return void 0;
|
|
61099
|
-
if (!
|
|
60515
|
+
if (!isRecord4(value)) {
|
|
61100
60516
|
throw new MeshyError("VALIDATION_ERROR", "Runtime restart startArgs must be an object", 400);
|
|
61101
60517
|
}
|
|
61102
60518
|
const startArgs = {};
|
|
@@ -61133,7 +60549,7 @@ function parseOptionalString(value, key) {
|
|
|
61133
60549
|
const trimmed = value.trim();
|
|
61134
60550
|
return trimmed || void 0;
|
|
61135
60551
|
}
|
|
61136
|
-
function
|
|
60552
|
+
function isRecord4(value) {
|
|
61137
60553
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
61138
60554
|
}
|
|
61139
60555
|
|
|
@@ -61571,7 +60987,7 @@ async function sendNodeWorkDirBranchCreateOperation(req, res, nodeId) {
|
|
|
61571
60987
|
}
|
|
61572
60988
|
|
|
61573
60989
|
// ../../packages/api/src/tasks/task-route-utils.ts
|
|
61574
|
-
var
|
|
60990
|
+
var fs15 = __toESM(require("fs"), 1);
|
|
61575
60991
|
var import_node_stream3 = require("stream");
|
|
61576
60992
|
var import_promises5 = require("stream/promises");
|
|
61577
60993
|
|
|
@@ -61616,7 +61032,7 @@ function toLegacyWorkerControl2(message) {
|
|
|
61616
61032
|
}
|
|
61617
61033
|
|
|
61618
61034
|
// ../../packages/api/src/tasks/task-route-utils.ts
|
|
61619
|
-
function
|
|
61035
|
+
function isRecord5(value) {
|
|
61620
61036
|
return typeof value === "object" && value !== null;
|
|
61621
61037
|
}
|
|
61622
61038
|
function restoreTaskState(taskEngine, task) {
|
|
@@ -61633,10 +61049,10 @@ function readLocalTaskLogs(engineRegistry, taskId, after, agent) {
|
|
|
61633
61049
|
throw new MeshyError("VALIDATION_ERROR", `Engine not registered for agent: ${agent}`, 400);
|
|
61634
61050
|
}
|
|
61635
61051
|
const logPath = engine.getLogPath(taskId);
|
|
61636
|
-
if (!
|
|
61052
|
+
if (!fs15.existsSync(logPath)) {
|
|
61637
61053
|
return { logs: [], total: 0 };
|
|
61638
61054
|
}
|
|
61639
|
-
const content =
|
|
61055
|
+
const content = fs15.readFileSync(logPath, "utf-8");
|
|
61640
61056
|
const allLines = content.trim().split("\n").filter(Boolean);
|
|
61641
61057
|
const logs = [];
|
|
61642
61058
|
for (let i = after; i < allLines.length; i++) {
|
|
@@ -61683,7 +61099,7 @@ function normalizeStructuredValue(value) {
|
|
|
61683
61099
|
if (Array.isArray(value)) {
|
|
61684
61100
|
return value.map((entry) => normalizeStructuredValue(entry));
|
|
61685
61101
|
}
|
|
61686
|
-
if (!
|
|
61102
|
+
if (!isRecord5(value)) {
|
|
61687
61103
|
return value;
|
|
61688
61104
|
}
|
|
61689
61105
|
return Object.fromEntries(
|
|
@@ -61692,20 +61108,20 @@ function normalizeStructuredValue(value) {
|
|
|
61692
61108
|
}
|
|
61693
61109
|
function getTranscriptEventSignature(event) {
|
|
61694
61110
|
if (event.type === "user") {
|
|
61695
|
-
const signature = getTaskUserMessageSignature(
|
|
61111
|
+
const signature = getTaskUserMessageSignature(isRecord5(event.message) ? event.message.content : event.message) ?? getTaskUserMessageSignature(event.content);
|
|
61696
61112
|
return signature ? `user:${signature}` : null;
|
|
61697
61113
|
}
|
|
61698
61114
|
if (event.type === "assistant") {
|
|
61699
61115
|
if (typeof event.message === "string") {
|
|
61700
61116
|
return `assistant:${JSON.stringify(event.message)}`;
|
|
61701
61117
|
}
|
|
61702
|
-
if (
|
|
61118
|
+
if (isRecord5(event.message) && "content" in event.message) {
|
|
61703
61119
|
return `assistant:${JSON.stringify(normalizeStructuredValue(event.message.content))}`;
|
|
61704
61120
|
}
|
|
61705
61121
|
if (Array.isArray(event.content)) {
|
|
61706
61122
|
return `assistant:${JSON.stringify(normalizeStructuredValue(event.content))}`;
|
|
61707
61123
|
}
|
|
61708
|
-
if (
|
|
61124
|
+
if (isRecord5(event.message)) {
|
|
61709
61125
|
return `assistant:${JSON.stringify(normalizeStructuredValue(event.message))}`;
|
|
61710
61126
|
}
|
|
61711
61127
|
}
|
|
@@ -61763,7 +61179,7 @@ function mergeNativeSessionLogs(nativeLogs, localLogs) {
|
|
|
61763
61179
|
function readLocalTaskLogsWithNativeHistory(engineRegistry, task, taskId, after, agent) {
|
|
61764
61180
|
const local = readLocalTaskLogs(engineRegistry, taskId, after, agent);
|
|
61765
61181
|
const sessionId = typeof task?.payload?.sessionId === "string" ? task.payload.sessionId : "";
|
|
61766
|
-
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") {
|
|
61767
61183
|
return local;
|
|
61768
61184
|
}
|
|
61769
61185
|
const history = loadNativeSessionHistory({ agent: task.agent, sessionId });
|
|
@@ -61867,23 +61283,23 @@ async function maybeProxyReadToLeader(req, res, options = {}) {
|
|
|
61867
61283
|
}
|
|
61868
61284
|
|
|
61869
61285
|
// ../../packages/api/src/node/node-terminal-session-service.ts
|
|
61870
|
-
var
|
|
61286
|
+
var import_node_child_process9 = require("child_process");
|
|
61871
61287
|
var import_node_crypto8 = require("crypto");
|
|
61872
61288
|
|
|
61873
61289
|
// ../../packages/api/src/node/node-terminal-service.ts
|
|
61874
|
-
var
|
|
61875
|
-
var
|
|
61290
|
+
var fs16 = __toESM(require("fs"), 1);
|
|
61291
|
+
var path16 = __toESM(require("path"), 1);
|
|
61876
61292
|
var DEFAULT_OUTPUT_LIMIT_BYTES = 64 * 1024;
|
|
61877
61293
|
function isAbsolutePath2(value) {
|
|
61878
|
-
return
|
|
61294
|
+
return path16.isAbsolute(value) || /^[A-Za-z]:[\/]/.test(value);
|
|
61879
61295
|
}
|
|
61880
61296
|
function resolveNodeTerminalCwd(nodeId, rootPath, cwd) {
|
|
61881
61297
|
if (!rootPath) {
|
|
61882
61298
|
throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
|
|
61883
61299
|
}
|
|
61884
61300
|
const requestedCwd = cwd?.trim() || ".";
|
|
61885
|
-
const resolved = isAbsolutePath2(requestedCwd) ?
|
|
61886
|
-
if (!
|
|
61301
|
+
const resolved = isAbsolutePath2(requestedCwd) ? path16.resolve(requestedCwd) : path16.resolve(rootPath, requestedCwd);
|
|
61302
|
+
if (!fs16.existsSync(resolved) || !fs16.statSync(resolved).isDirectory()) {
|
|
61887
61303
|
throw new MeshyError("VALIDATION_ERROR", `Working directory does not exist: ${resolved}`, 400);
|
|
61888
61304
|
}
|
|
61889
61305
|
return resolved;
|
|
@@ -61947,7 +61363,7 @@ var NodeTerminalSessionService = class {
|
|
|
61947
61363
|
}
|
|
61948
61364
|
const cwd = resolveNodeTerminalCwd(nodeId, rootPath, options.cwd);
|
|
61949
61365
|
const startedAt = Date.now();
|
|
61950
|
-
const child = (0,
|
|
61366
|
+
const child = (0, import_node_child_process9.spawn)(normalizedCommand, {
|
|
61951
61367
|
cwd,
|
|
61952
61368
|
shell: true,
|
|
61953
61369
|
windowsHide: true,
|
|
@@ -62122,13 +61538,13 @@ function cancelTaskOnCurrentNode(deps, taskId, options = {}) {
|
|
|
62122
61538
|
}
|
|
62123
61539
|
|
|
62124
61540
|
// ../../packages/api/src/tasks/task-output-service.ts
|
|
62125
|
-
var
|
|
62126
|
-
var
|
|
61541
|
+
var fs18 = __toESM(require("fs"), 1);
|
|
61542
|
+
var path18 = __toESM(require("path"), 1);
|
|
62127
61543
|
|
|
62128
61544
|
// ../../packages/api/src/preview/preview-server.ts
|
|
62129
61545
|
var crypto3 = __toESM(require("crypto"), 1);
|
|
62130
|
-
var
|
|
62131
|
-
var
|
|
61546
|
+
var fs17 = __toESM(require("fs"), 1);
|
|
61547
|
+
var path17 = __toESM(require("path"), 1);
|
|
62132
61548
|
var http2 = __toESM(require("http"), 1);
|
|
62133
61549
|
var import_node_stream4 = require("stream");
|
|
62134
61550
|
var import_promises6 = require("stream/promises");
|
|
@@ -62240,19 +61656,19 @@ function buildPreviewWorkerProxyHeaders(req) {
|
|
|
62240
61656
|
// ../../packages/api/src/preview/preview-server.ts
|
|
62241
61657
|
function resolvePreviewPath(rootPath, relativePath) {
|
|
62242
61658
|
const sanitizedPath = relativePath.replace(/\\/g, "/");
|
|
62243
|
-
const resolvedPath =
|
|
62244
|
-
const normalizedRoot =
|
|
62245
|
-
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) {
|
|
62246
61662
|
throw new Error("Invalid preview path");
|
|
62247
61663
|
}
|
|
62248
61664
|
return {
|
|
62249
61665
|
absolutePath: resolvedPath,
|
|
62250
|
-
normalizedPath:
|
|
61666
|
+
normalizedPath: path17.relative(normalizedRoot, resolvedPath).split(path17.sep).join("/")
|
|
62251
61667
|
};
|
|
62252
61668
|
}
|
|
62253
61669
|
function resolvePreviewEntryPath(rootPath, entryPath) {
|
|
62254
61670
|
const { absolutePath, normalizedPath } = resolvePreviewPath(rootPath, entryPath ?? "index.html");
|
|
62255
|
-
if (!
|
|
61671
|
+
if (!fs17.existsSync(absolutePath) || !fs17.statSync(absolutePath).isFile()) {
|
|
62256
61672
|
throw new Error("Preview entry not found");
|
|
62257
61673
|
}
|
|
62258
61674
|
return normalizedPath;
|
|
@@ -62354,7 +61770,7 @@ var MIME_MAP2 = {
|
|
|
62354
61770
|
".mdx": "text/markdown"
|
|
62355
61771
|
};
|
|
62356
61772
|
function getMime(filePath) {
|
|
62357
|
-
return MIME_MAP2[
|
|
61773
|
+
return MIME_MAP2[path17.extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
62358
61774
|
}
|
|
62359
61775
|
function escapeHtml(value) {
|
|
62360
61776
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -62708,14 +62124,14 @@ async function sendPreviewAssetResponse(sessionManager, token, requestedPath, re
|
|
|
62708
62124
|
res.end("Invalid path");
|
|
62709
62125
|
return;
|
|
62710
62126
|
}
|
|
62711
|
-
if (!
|
|
62127
|
+
if (!fs17.existsSync(resolved) || !fs17.statSync(resolved).isFile()) {
|
|
62712
62128
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
62713
62129
|
res.end("File not found");
|
|
62714
62130
|
return;
|
|
62715
62131
|
}
|
|
62716
|
-
const ext =
|
|
62132
|
+
const ext = path17.extname(resolved).toLowerCase();
|
|
62717
62133
|
const mime = ext === ".md" || ext === ".mdx" ? "text/html" : getMime(resolved);
|
|
62718
|
-
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);
|
|
62719
62135
|
res.writeHead(200, {
|
|
62720
62136
|
"Content-Type": mime,
|
|
62721
62137
|
"Content-Length": content.length,
|
|
@@ -63044,13 +62460,13 @@ function getLocalTaskOutputDownload(taskEngine, taskId, filePath) {
|
|
|
63044
62460
|
const rootPath = getTaskOutputRoot(taskEngine, taskId);
|
|
63045
62461
|
try {
|
|
63046
62462
|
const absolutePath = resolveOutputPath(rootPath, filePath);
|
|
63047
|
-
if (!
|
|
62463
|
+
if (!fs18.existsSync(absolutePath) || !fs18.statSync(absolutePath).isFile()) {
|
|
63048
62464
|
throw new MeshyError("TASK_NOT_FOUND", `File not found: ${filePath}`, 404);
|
|
63049
62465
|
}
|
|
63050
62466
|
const { mimeType } = classifyFile(absolutePath);
|
|
63051
|
-
const fileName =
|
|
62467
|
+
const fileName = path18.basename(absolutePath).replace(/"/g, "");
|
|
63052
62468
|
return {
|
|
63053
|
-
content:
|
|
62469
|
+
content: fs18.readFileSync(absolutePath),
|
|
63054
62470
|
headers: {
|
|
63055
62471
|
"Content-Type": mimeType,
|
|
63056
62472
|
"Content-Disposition": `inline; filename="${fileName}"`,
|
|
@@ -63263,13 +62679,12 @@ async function executeWorkerControlRequest(deps, request) {
|
|
|
63263
62679
|
}
|
|
63264
62680
|
case "node.sessions.list": {
|
|
63265
62681
|
const self2 = deps.nodeRegistry.getSelf();
|
|
63266
|
-
const agent = payloadValue(request, "agent", "codex");
|
|
63267
62682
|
response = jsonResponse(
|
|
63268
62683
|
request.id,
|
|
63269
62684
|
200,
|
|
63270
62685
|
getLocalNodeNativeSessions(
|
|
63271
62686
|
self2.id,
|
|
63272
|
-
|
|
62687
|
+
payloadValue(request, "agent", "codex"),
|
|
63273
62688
|
payloadValue(request, "limit", 50)
|
|
63274
62689
|
)
|
|
63275
62690
|
);
|
|
@@ -64327,15 +63742,10 @@ async function cancelRemoteTaskExecution(deps) {
|
|
|
64327
63742
|
// ../../packages/api/src/tasks/task-session-import.ts
|
|
64328
63743
|
var TASK_IMPORT_PROXY_TIMEOUT_MS = 1e4;
|
|
64329
63744
|
function buildImportedSessionTitle(agent, sessionId) {
|
|
64330
|
-
const label = agent === "codex" ? "Codex" :
|
|
63745
|
+
const label = agent === "codex" ? "Codex" : "Claude Code";
|
|
64331
63746
|
const suffix = sessionId.trim().slice(0, 12);
|
|
64332
63747
|
return `${label} session ${suffix || "attached"}`;
|
|
64333
63748
|
}
|
|
64334
|
-
function getNativeSessionAgentLabel(agent) {
|
|
64335
|
-
if (agent === "codex") return "Codex";
|
|
64336
|
-
if (agent === "copilot") return "Copilot CLI";
|
|
64337
|
-
return "Claude Code";
|
|
64338
|
-
}
|
|
64339
63749
|
function resolveTargetImportNode(nodeRegistry, nodeId, agent) {
|
|
64340
63750
|
const self2 = nodeRegistry.getSelf();
|
|
64341
63751
|
const node = nodeRegistry.getNode(nodeId) ?? (self2?.id === nodeId ? self2 : null);
|
|
@@ -64365,7 +63775,7 @@ async function attachNativeSession(deps, body) {
|
|
|
64365
63775
|
let importedLogs = history.logs;
|
|
64366
63776
|
const task = deps.taskEngine.createTask({
|
|
64367
63777
|
title: body.title?.trim() || buildImportedSessionTitle(body.agent, body.sessionId),
|
|
64368
|
-
description: `Attached native ${
|
|
63778
|
+
description: `Attached native ${body.agent === "codex" ? "Codex" : "Claude Code"} session`,
|
|
64369
63779
|
agent: body.agent,
|
|
64370
63780
|
project: body.cwd,
|
|
64371
63781
|
conversationKind: "nativeSession",
|
|
@@ -65844,7 +65254,7 @@ function createWorkerRoutes() {
|
|
|
65844
65254
|
let { logs } = body;
|
|
65845
65255
|
if (logs.length === 0 && task.conversationKind === "nativeSession") {
|
|
65846
65256
|
const sessionId = typeof task.payload?.sessionId === "string" ? task.payload.sessionId : "";
|
|
65847
|
-
if (sessionId && (task.agent === "codex" || task.agent === "claudecode"
|
|
65257
|
+
if (sessionId && (task.agent === "codex" || task.agent === "claudecode")) {
|
|
65848
65258
|
logs = loadNativeSessionHistory({ agent: task.agent, sessionId }).logs;
|
|
65849
65259
|
}
|
|
65850
65260
|
}
|
|
@@ -66327,8 +65737,8 @@ function hasAuthorizationHeader(req) {
|
|
|
66327
65737
|
function resolveRuntimeBaseDir() {
|
|
66328
65738
|
const entryPath = process.argv[1];
|
|
66329
65739
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
66330
|
-
const resolved =
|
|
66331
|
-
return
|
|
65740
|
+
const resolved = fs19.realpathSync(path19.resolve(entryPath));
|
|
65741
|
+
return path19.dirname(resolved);
|
|
66332
65742
|
}
|
|
66333
65743
|
return process.cwd();
|
|
66334
65744
|
}
|
|
@@ -66336,18 +65746,18 @@ function resolveStaticDir(baseDir) {
|
|
|
66336
65746
|
const envStaticDir = process.env.MESHY_STATIC_DIR;
|
|
66337
65747
|
const candidateDirs = [
|
|
66338
65748
|
envStaticDir,
|
|
66339
|
-
|
|
66340
|
-
|
|
66341
|
-
|
|
66342
|
-
|
|
66343
|
-
|
|
66344
|
-
|
|
66345
|
-
|
|
66346
|
-
|
|
66347
|
-
|
|
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")
|
|
66348
65758
|
].filter((value) => typeof value === "string" && value.length > 0);
|
|
66349
65759
|
for (const candidate of candidateDirs) {
|
|
66350
|
-
if (
|
|
65760
|
+
if (fs19.existsSync(candidate)) {
|
|
66351
65761
|
return candidate;
|
|
66352
65762
|
}
|
|
66353
65763
|
}
|
|
@@ -66455,8 +65865,8 @@ function createServer2(deps) {
|
|
|
66455
65865
|
app.use("/api/node-operations", createNodeOperationRoutes());
|
|
66456
65866
|
app.use("/api/events", createEventRoutes());
|
|
66457
65867
|
if (staticDir) {
|
|
66458
|
-
const indexPath =
|
|
66459
|
-
if (
|
|
65868
|
+
const indexPath = path19.join(staticDir, "index.html");
|
|
65869
|
+
if (fs19.existsSync(indexPath)) {
|
|
66460
65870
|
app.get("*", (req, res, next) => {
|
|
66461
65871
|
if (isApiRequest(req)) {
|
|
66462
65872
|
next();
|
|
@@ -66570,12 +65980,12 @@ function detectLocalIp() {
|
|
|
66570
65980
|
return "127.0.0.1";
|
|
66571
65981
|
}
|
|
66572
65982
|
function detectAvailablePort() {
|
|
66573
|
-
return new Promise((
|
|
65983
|
+
return new Promise((resolve14, reject) => {
|
|
66574
65984
|
const srv = (0, import_node_http2.createServer)();
|
|
66575
65985
|
srv.listen(0, () => {
|
|
66576
65986
|
const addr = srv.address();
|
|
66577
65987
|
const port = addr && typeof addr !== "string" ? addr.port : 0;
|
|
66578
|
-
srv.close((err) => err ? reject(err) :
|
|
65988
|
+
srv.close((err) => err ? reject(err) : resolve14(port));
|
|
66579
65989
|
});
|
|
66580
65990
|
srv.on("error", reject);
|
|
66581
65991
|
});
|
|
@@ -66620,10 +66030,10 @@ var DirectTransport = class {
|
|
|
66620
66030
|
};
|
|
66621
66031
|
|
|
66622
66032
|
// ../../packages/transport/src/devtunnel.ts
|
|
66623
|
-
var
|
|
66033
|
+
var import_node_child_process10 = require("child_process");
|
|
66624
66034
|
function isInstalled(cmd) {
|
|
66625
66035
|
try {
|
|
66626
|
-
(0,
|
|
66036
|
+
(0, import_node_child_process10.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
|
|
66627
66037
|
return true;
|
|
66628
66038
|
} catch {
|
|
66629
66039
|
return false;
|
|
@@ -66646,18 +66056,18 @@ var DevTunnelTransport = class {
|
|
|
66646
66056
|
);
|
|
66647
66057
|
}
|
|
66648
66058
|
try {
|
|
66649
|
-
(0,
|
|
66059
|
+
(0, import_node_child_process10.execSync)("devtunnel user show", { stdio: "pipe" });
|
|
66650
66060
|
} catch {
|
|
66651
66061
|
throw new Error(
|
|
66652
66062
|
"Not logged in to devtunnel. Run: devtunnel user login"
|
|
66653
66063
|
);
|
|
66654
66064
|
}
|
|
66655
66065
|
const hostArgs = this.buildHostArgs(localPort);
|
|
66656
|
-
const child = (0,
|
|
66066
|
+
const child = (0, import_node_child_process10.spawn)("devtunnel", hostArgs, {
|
|
66657
66067
|
stdio: ["pipe", "pipe", "pipe"]
|
|
66658
66068
|
});
|
|
66659
66069
|
this.process = child;
|
|
66660
|
-
this.publicUrl = await new Promise((
|
|
66070
|
+
this.publicUrl = await new Promise((resolve14, reject) => {
|
|
66661
66071
|
const timeout = setTimeout(() => {
|
|
66662
66072
|
child.kill();
|
|
66663
66073
|
this.process = null;
|
|
@@ -66680,7 +66090,7 @@ var DevTunnelTransport = class {
|
|
|
66680
66090
|
clearTimeout(timeout);
|
|
66681
66091
|
child.stdout?.removeListener("data", onData);
|
|
66682
66092
|
child.stderr?.removeListener("data", onErrData);
|
|
66683
|
-
|
|
66093
|
+
resolve14(url.replace(/\/+$/, ""));
|
|
66684
66094
|
};
|
|
66685
66095
|
child.stdout?.on("data", onData);
|
|
66686
66096
|
child.stderr?.on("data", onErrData);
|
|
@@ -66712,14 +66122,14 @@ ${lines.join("")}`
|
|
|
66712
66122
|
this.publicUrl = null;
|
|
66713
66123
|
if (child.exitCode === null) {
|
|
66714
66124
|
child.kill("SIGTERM");
|
|
66715
|
-
await new Promise((
|
|
66125
|
+
await new Promise((resolve14) => {
|
|
66716
66126
|
const killTimer = setTimeout(() => {
|
|
66717
66127
|
child.kill("SIGKILL");
|
|
66718
|
-
|
|
66128
|
+
resolve14();
|
|
66719
66129
|
}, 5e3);
|
|
66720
66130
|
child.on("close", () => {
|
|
66721
66131
|
clearTimeout(killTimer);
|
|
66722
|
-
|
|
66132
|
+
resolve14();
|
|
66723
66133
|
});
|
|
66724
66134
|
});
|
|
66725
66135
|
}
|
|
@@ -66758,7 +66168,7 @@ ${lines.join("")}`
|
|
|
66758
66168
|
return;
|
|
66759
66169
|
}
|
|
66760
66170
|
try {
|
|
66761
|
-
(0,
|
|
66171
|
+
(0, import_node_child_process10.execFileSync)("devtunnel", ["access", "create", tunnelId, "--tenant"], { stdio: "pipe" });
|
|
66762
66172
|
} catch (err) {
|
|
66763
66173
|
if (isExistingTenantAccessError(err)) {
|
|
66764
66174
|
return;
|
|
@@ -66774,7 +66184,7 @@ ${lines.join("")}`
|
|
|
66774
66184
|
return void 0;
|
|
66775
66185
|
}
|
|
66776
66186
|
try {
|
|
66777
|
-
(0,
|
|
66187
|
+
(0, import_node_child_process10.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
|
|
66778
66188
|
return tunnelId;
|
|
66779
66189
|
} catch {
|
|
66780
66190
|
const createArgs = ["create", tunnelId];
|
|
@@ -66782,7 +66192,7 @@ ${lines.join("")}`
|
|
|
66782
66192
|
createArgs.push("-a");
|
|
66783
66193
|
}
|
|
66784
66194
|
try {
|
|
66785
|
-
(0,
|
|
66195
|
+
(0, import_node_child_process10.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
|
|
66786
66196
|
return tunnelId;
|
|
66787
66197
|
} catch (err) {
|
|
66788
66198
|
throw new Error(
|
|
@@ -66794,13 +66204,13 @@ ${lines.join("")}`
|
|
|
66794
66204
|
ensureTunnelPort(tunnelId, localPort) {
|
|
66795
66205
|
const ports = this.listTunnelPorts(tunnelId);
|
|
66796
66206
|
for (const stalePort of ports.filter((p) => p !== localPort)) {
|
|
66797
|
-
(0,
|
|
66207
|
+
(0, import_node_child_process10.execFileSync)("devtunnel", ["port", "delete", tunnelId, "-p", String(stalePort)], { stdio: "pipe" });
|
|
66798
66208
|
}
|
|
66799
66209
|
if (ports.includes(localPort)) {
|
|
66800
66210
|
return;
|
|
66801
66211
|
}
|
|
66802
66212
|
try {
|
|
66803
|
-
(0,
|
|
66213
|
+
(0, import_node_child_process10.execFileSync)(
|
|
66804
66214
|
"devtunnel",
|
|
66805
66215
|
["port", "create", tunnelId, "-p", String(localPort), "--protocol", "http"],
|
|
66806
66216
|
{ stdio: "pipe" }
|
|
@@ -66816,7 +66226,7 @@ ${lines.join("")}`
|
|
|
66816
66226
|
}
|
|
66817
66227
|
listTunnelPorts(tunnelId) {
|
|
66818
66228
|
try {
|
|
66819
|
-
const output = (0,
|
|
66229
|
+
const output = (0, import_node_child_process10.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
|
|
66820
66230
|
const parsed = JSON.parse(output.toString());
|
|
66821
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 : [];
|
|
66822
66232
|
return items.map((item) => getPortNumber(item)).filter((value) => value !== void 0);
|
|
@@ -66828,7 +66238,7 @@ ${lines.join("")}`
|
|
|
66828
66238
|
}
|
|
66829
66239
|
hasTunnelPort(tunnelId, localPort) {
|
|
66830
66240
|
try {
|
|
66831
|
-
(0,
|
|
66241
|
+
(0, import_node_child_process10.execFileSync)(
|
|
66832
66242
|
"devtunnel",
|
|
66833
66243
|
["port", "show", tunnelId, "-p", String(localPort), "-j"],
|
|
66834
66244
|
{ stdio: "pipe" }
|
|
@@ -66932,10 +66342,10 @@ var terminalWriter = {
|
|
|
66932
66342
|
};
|
|
66933
66343
|
|
|
66934
66344
|
// src/startup.ts
|
|
66935
|
-
var
|
|
66936
|
-
var
|
|
66345
|
+
var fs20 = __toESM(require("fs"), 1);
|
|
66346
|
+
var path20 = __toESM(require("path"), 1);
|
|
66937
66347
|
var readline = __toESM(require("readline/promises"), 1);
|
|
66938
|
-
var
|
|
66348
|
+
var import_node_child_process11 = require("child_process");
|
|
66939
66349
|
function getDefaultNodeName() {
|
|
66940
66350
|
return getDeviceNodeName();
|
|
66941
66351
|
}
|
|
@@ -66945,7 +66355,7 @@ function isDevBoxEnvironment(env = process.env) {
|
|
|
66945
66355
|
}
|
|
66946
66356
|
var DEFAULT_NODE_NAME = getDefaultNodeName();
|
|
66947
66357
|
var SUPPORTED_TRANSPORTS = ["direct", "devtunnel"];
|
|
66948
|
-
var STARTUP_REQUIREMENTS = ["az", "devtunnel", "claude", "codex"
|
|
66358
|
+
var STARTUP_REQUIREMENTS = ["az", "devtunnel", "claude", "codex"];
|
|
66949
66359
|
function createDefaultConfig(storagePath = resolveDefaultStoragePath(), nodeName = DEFAULT_NODE_NAME) {
|
|
66950
66360
|
return {
|
|
66951
66361
|
node: { name: nodeName, port: DEFAULT_NODE_PORT, workDir: process.cwd() },
|
|
@@ -66989,7 +66399,7 @@ function createPromptSession(prompt) {
|
|
|
66989
66399
|
}
|
|
66990
66400
|
function createDefaultCommandRunner(platform2) {
|
|
66991
66401
|
return (command, args, interactive = false) => {
|
|
66992
|
-
const result = (0,
|
|
66402
|
+
const result = (0, import_node_child_process11.spawnSync)(command, args, {
|
|
66993
66403
|
encoding: "utf-8",
|
|
66994
66404
|
shell: platform2 === "win32",
|
|
66995
66405
|
stdio: interactive ? "inherit" : "pipe"
|
|
@@ -67004,19 +66414,19 @@ function createDefaultCommandRunner(platform2) {
|
|
|
67004
66414
|
};
|
|
67005
66415
|
}
|
|
67006
66416
|
function getNodeMetadataPath2(storagePath) {
|
|
67007
|
-
return
|
|
66417
|
+
return path20.join(storagePath, "metadata.json");
|
|
67008
66418
|
}
|
|
67009
66419
|
function readStartupMetadataFile(storagePath) {
|
|
67010
66420
|
try {
|
|
67011
|
-
const raw = JSON.parse(
|
|
66421
|
+
const raw = JSON.parse(fs20.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
|
|
67012
66422
|
return typeof raw === "object" && raw !== null ? raw : {};
|
|
67013
66423
|
} catch {
|
|
67014
66424
|
return {};
|
|
67015
66425
|
}
|
|
67016
66426
|
}
|
|
67017
66427
|
function writeStartupMetadataFile(storagePath, metadata) {
|
|
67018
|
-
|
|
67019
|
-
|
|
66428
|
+
fs20.mkdirSync(storagePath, { recursive: true });
|
|
66429
|
+
fs20.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
|
|
67020
66430
|
}
|
|
67021
66431
|
function formatLocalDate2(now) {
|
|
67022
66432
|
const year = now.getFullYear();
|
|
@@ -67067,8 +66477,6 @@ function buildInstallCommand(requirement, platform2) {
|
|
|
67067
66477
|
return void 0;
|
|
67068
66478
|
case "codex":
|
|
67069
66479
|
return { command: "npm", args: ["install", "-g", "@openai/codex"] };
|
|
67070
|
-
case "copilot":
|
|
67071
|
-
return { command: "npm", args: ["install", "-g", "@github/copilot"] };
|
|
67072
66480
|
}
|
|
67073
66481
|
}
|
|
67074
66482
|
function buildLoginCommand(requirement) {
|
|
@@ -67100,7 +66508,7 @@ function isRequirementSatisfied(requirement, status) {
|
|
|
67100
66508
|
return true;
|
|
67101
66509
|
}
|
|
67102
66510
|
function sleep2(ms) {
|
|
67103
|
-
return new Promise((
|
|
66511
|
+
return new Promise((resolve14) => setTimeout(resolve14, ms));
|
|
67104
66512
|
}
|
|
67105
66513
|
function areCachedAuthRequirementsCurrent(commandRunner) {
|
|
67106
66514
|
return isAuthenticated("az", commandRunner) && isAuthenticated("devtunnel", commandRunner);
|
|
@@ -67257,9 +66665,9 @@ async function ensureStartupRequirements(storagePath, options = {}) {
|
|
|
67257
66665
|
metadata
|
|
67258
66666
|
};
|
|
67259
66667
|
}
|
|
67260
|
-
function loadConfigFile(
|
|
66668
|
+
function loadConfigFile(path22) {
|
|
67261
66669
|
try {
|
|
67262
|
-
const raw =
|
|
66670
|
+
const raw = fs20.readFileSync(path22, "utf-8");
|
|
67263
66671
|
return JSON.parse(raw);
|
|
67264
66672
|
} catch {
|
|
67265
66673
|
return {};
|
|
@@ -67438,26 +66846,26 @@ function formatLoadedStartMetadata(info, authEnabled) {
|
|
|
67438
66846
|
}
|
|
67439
66847
|
|
|
67440
66848
|
// src/runtime-metadata.ts
|
|
67441
|
-
var
|
|
67442
|
-
var
|
|
67443
|
-
var
|
|
66849
|
+
var fs21 = __toESM(require("fs"), 1);
|
|
66850
|
+
var path21 = __toESM(require("path"), 1);
|
|
66851
|
+
var import_node_child_process12 = require("child_process");
|
|
67444
66852
|
var runtimeDir = resolveRuntimeDir();
|
|
67445
66853
|
var appRoot = resolveAppRoot(runtimeDir);
|
|
67446
|
-
var repoRoot =
|
|
66854
|
+
var repoRoot = path21.resolve(appRoot, "../..");
|
|
67447
66855
|
function resolveRuntimeDir() {
|
|
67448
66856
|
const entryPath = process.argv[1];
|
|
67449
66857
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
67450
66858
|
try {
|
|
67451
|
-
return
|
|
66859
|
+
return path21.dirname(fs21.realpathSync(path21.resolve(entryPath)));
|
|
67452
66860
|
} catch {
|
|
67453
|
-
return
|
|
66861
|
+
return path21.dirname(path21.resolve(entryPath));
|
|
67454
66862
|
}
|
|
67455
66863
|
}
|
|
67456
66864
|
return process.cwd();
|
|
67457
66865
|
}
|
|
67458
66866
|
function readJsonFile(filePath) {
|
|
67459
66867
|
try {
|
|
67460
|
-
return JSON.parse(
|
|
66868
|
+
return JSON.parse(fs21.readFileSync(filePath, "utf-8"));
|
|
67461
66869
|
} catch {
|
|
67462
66870
|
return null;
|
|
67463
66871
|
}
|
|
@@ -67467,9 +66875,9 @@ function readPackageManifest(filePath) {
|
|
|
67467
66875
|
}
|
|
67468
66876
|
function readEmbeddedRuntimeMetadata() {
|
|
67469
66877
|
const candidates = [
|
|
67470
|
-
|
|
67471
|
-
|
|
67472
|
-
|
|
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")
|
|
67473
66881
|
];
|
|
67474
66882
|
for (const candidate of candidates) {
|
|
67475
66883
|
const metadata = readJsonFile(candidate);
|
|
@@ -67482,23 +66890,23 @@ function readEmbeddedRuntimeMetadata() {
|
|
|
67482
66890
|
function resolveAppRoot(baseDir) {
|
|
67483
66891
|
const candidates = [
|
|
67484
66892
|
baseDir,
|
|
67485
|
-
|
|
67486
|
-
|
|
67487
|
-
|
|
66893
|
+
path21.resolve(baseDir, ".."),
|
|
66894
|
+
path21.resolve(process.cwd(), "apps/node/dist"),
|
|
66895
|
+
path21.resolve(process.cwd(), "apps/node"),
|
|
67488
66896
|
process.cwd()
|
|
67489
66897
|
];
|
|
67490
66898
|
for (const candidate of candidates) {
|
|
67491
|
-
const manifest = readPackageManifest(
|
|
66899
|
+
const manifest = readPackageManifest(path21.join(candidate, "package.json"));
|
|
67492
66900
|
if (manifest?.name === "@meshy/node" || manifest?.name === "meshy-node") {
|
|
67493
66901
|
return candidate;
|
|
67494
66902
|
}
|
|
67495
66903
|
}
|
|
67496
66904
|
for (const candidate of candidates) {
|
|
67497
|
-
if (
|
|
66905
|
+
if (fs21.existsSync(path21.join(candidate, "package.json"))) {
|
|
67498
66906
|
return candidate;
|
|
67499
66907
|
}
|
|
67500
66908
|
}
|
|
67501
|
-
return
|
|
66909
|
+
return path21.resolve(baseDir, "..");
|
|
67502
66910
|
}
|
|
67503
66911
|
function toPackageInfo(filePath) {
|
|
67504
66912
|
const manifest = readPackageManifest(filePath);
|
|
@@ -67536,7 +66944,7 @@ function readRepositoryUrlFromManifest(manifest) {
|
|
|
67536
66944
|
}
|
|
67537
66945
|
function readGitValue(args) {
|
|
67538
66946
|
try {
|
|
67539
|
-
const output = (0,
|
|
66947
|
+
const output = (0, import_node_child_process12.execFileSync)("git", args, {
|
|
67540
66948
|
cwd: repoRoot,
|
|
67541
66949
|
encoding: "utf-8",
|
|
67542
66950
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -67558,8 +66966,8 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
67558
66966
|
components: startupRequirements.components
|
|
67559
66967
|
};
|
|
67560
66968
|
}
|
|
67561
|
-
const appPackage = toPackageInfo(
|
|
67562
|
-
const workspaceManifest = readPackageManifest(
|
|
66969
|
+
const appPackage = toPackageInfo(path21.join(appRoot, "package.json"));
|
|
66970
|
+
const workspaceManifest = readPackageManifest(path21.join(repoRoot, "package.json"));
|
|
67563
66971
|
return {
|
|
67564
66972
|
packageName: appPackage?.name ?? "meshy",
|
|
67565
66973
|
packageVersion: appPackage?.version ?? "0.1.0",
|
|
@@ -67567,11 +66975,11 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
67567
66975
|
startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
|
|
67568
66976
|
components: startupRequirements.components,
|
|
67569
66977
|
packages: {
|
|
67570
|
-
workspace: toPackageInfo(
|
|
66978
|
+
workspace: toPackageInfo(path21.join(repoRoot, "package.json")),
|
|
67571
66979
|
node: appPackage,
|
|
67572
|
-
core: toPackageInfo(
|
|
67573
|
-
dashboard: toPackageInfo(
|
|
67574
|
-
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"))
|
|
67575
66983
|
},
|
|
67576
66984
|
repository: {
|
|
67577
66985
|
url: normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.upstream.url"])) ?? normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.origin.url"])) ?? readRepositoryUrlFromManifest(workspaceManifest),
|
|
@@ -67582,9 +66990,9 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
67582
66990
|
}
|
|
67583
66991
|
|
|
67584
66992
|
// src/bootstrap/runtime-restart.ts
|
|
67585
|
-
var
|
|
66993
|
+
var fs22 = __toESM(require("fs"), 1);
|
|
67586
66994
|
var nodePath2 = __toESM(require("path"), 1);
|
|
67587
|
-
var
|
|
66995
|
+
var import_node_child_process13 = require("child_process");
|
|
67588
66996
|
var RUNTIME_UPDATE_CHECK_INTERVAL_MS = 6 * 60 * 60 * 1e3;
|
|
67589
66997
|
function resolveRuntimeRestartStartArgs(hydratedArgs, restartArgs) {
|
|
67590
66998
|
return restartArgs ? { ...restartArgs } : hydratedArgs;
|
|
@@ -67693,7 +67101,7 @@ function compareSemver2(left, right) {
|
|
|
67693
67101
|
return 0;
|
|
67694
67102
|
}
|
|
67695
67103
|
function runRuntimePackageCommand(command, args) {
|
|
67696
|
-
const result = (0,
|
|
67104
|
+
const result = (0, import_node_child_process13.spawnSync)(command, args, {
|
|
67697
67105
|
encoding: "utf-8",
|
|
67698
67106
|
windowsHide: true,
|
|
67699
67107
|
timeout: 2500
|
|
@@ -67732,7 +67140,7 @@ function createSpawnableCommand(command, args, platform2) {
|
|
|
67732
67140
|
}
|
|
67733
67141
|
function readProcessCommand(pid, platform2) {
|
|
67734
67142
|
if (platform2 === "win32") return null;
|
|
67735
|
-
const result = (0,
|
|
67143
|
+
const result = (0, import_node_child_process13.spawnSync)("ps", ["-p", String(pid), "-o", "args="], {
|
|
67736
67144
|
encoding: "utf-8",
|
|
67737
67145
|
windowsHide: true,
|
|
67738
67146
|
timeout: 1e3
|
|
@@ -67823,9 +67231,9 @@ function createRuntimeRestartLaunchPlan(options) {
|
|
|
67823
67231
|
};
|
|
67824
67232
|
}
|
|
67825
67233
|
function scheduleRuntimeRestart(plan, options = {}) {
|
|
67826
|
-
|
|
67827
|
-
const logFd =
|
|
67828
|
-
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;
|
|
67829
67237
|
const env = {
|
|
67830
67238
|
...process.env,
|
|
67831
67239
|
MESHY_RESTART_PARENT_PID: String(options.parentPid ?? process.pid),
|
|
@@ -68419,7 +67827,7 @@ function registerShutdownHandlers(options) {
|
|
|
68419
67827
|
}
|
|
68420
67828
|
async function startNode(args) {
|
|
68421
67829
|
const { authMetadata, config: config2, hydratedArgs, runtimeMetadata, storageRoot } = await resolveStartConfig(args);
|
|
68422
|
-
terminalWriter.line("Checking startup requirements (az, devtunnel, claude, codex
|
|
67830
|
+
terminalWriter.line("Checking startup requirements (az, devtunnel, claude, codex)...");
|
|
68423
67831
|
const startupRequirements = await ensureStartupRequirements(config2.storage.path);
|
|
68424
67832
|
terminalWriter.line(
|
|
68425
67833
|
startupRequirements.skipped ? "Startup requirements already verified today; skipping checks." : "Startup requirements check complete."
|
|
@@ -68494,8 +67902,7 @@ async function startNode(args) {
|
|
|
68494
67902
|
engineRegistry: meshyNode.getEngineRegistry(),
|
|
68495
67903
|
liteAgentRunner: new LiteAgentRunner({
|
|
68496
67904
|
claudecode: new ClaudeLiteAdapter(),
|
|
68497
|
-
codex: new CodexLiteAdapter()
|
|
68498
|
-
copilot: new CopilotLiteAdapter()
|
|
67905
|
+
codex: new CodexLiteAdapter()
|
|
68499
67906
|
}),
|
|
68500
67907
|
logger: meshyNode.getLogger(),
|
|
68501
67908
|
config: {
|