meshy-node 0.3.9 → 0.4.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-BUtwv0kD.js +124 -0
- package/dashboard/assets/{DashboardShared-BfSOAHkB.js → DashboardShared-BSDgKTOF.js} +3 -3
- package/dashboard/assets/{DiffTab-Dkqx4lg8.js → DiffTab-_2QRJdG0.js} +3 -3
- package/dashboard/assets/{FilesTab-BWK1YZk0.js → FilesTab-_pFba0dN.js} +1 -1
- package/dashboard/assets/{PreviewTab-CgGqqXSW.js → PreviewTab-C5UehUZ1.js} +1 -1
- package/dashboard/assets/{SharedConversationPage-COhUZENs.js → SharedConversationPage-e35GHbGI.js} +3 -3
- package/dashboard/assets/{file-BdIshbRs.js → file-3EwPAA-4.js} +1 -1
- package/dashboard/assets/{folder-Cl9WN_cx.js → folder-B6d9_x4J.js} +1 -1
- package/dashboard/assets/index-6tOxJBZf.js +276 -0
- package/dashboard/assets/index-Ch6zIZ6Y.css +1 -0
- package/dashboard/assets/{input-CdkmqjGJ.js → input-DMp80MWI.js} +1 -1
- package/dashboard/index.html +2 -2
- package/main.cjs +602 -455
- package/package.json +1 -1
- package/runtime-metadata.json +5 -5
- package/dashboard/assets/DashboardPage-0TdEZxup.js +0 -119
- package/dashboard/assets/index-DHC5U3_j.js +0 -276
- package/dashboard/assets/index-DfiptIs_.css +0 -1
package/main.cjs
CHANGED
|
@@ -6629,8 +6629,8 @@ var require_node2 = __commonJS({
|
|
|
6629
6629
|
}
|
|
6630
6630
|
break;
|
|
6631
6631
|
case "FILE":
|
|
6632
|
-
var
|
|
6633
|
-
stream2 = new
|
|
6632
|
+
var fs22 = require("fs");
|
|
6633
|
+
stream2 = new fs22.SyncWriteStream(fd2, { autoClose: false });
|
|
6634
6634
|
stream2._type = "fs";
|
|
6635
6635
|
break;
|
|
6636
6636
|
case "PIPE":
|
|
@@ -19420,11 +19420,11 @@ var require_mime_types = __commonJS({
|
|
|
19420
19420
|
}
|
|
19421
19421
|
return exts[0];
|
|
19422
19422
|
}
|
|
19423
|
-
function lookup(
|
|
19424
|
-
if (!
|
|
19423
|
+
function lookup(path23) {
|
|
19424
|
+
if (!path23 || typeof path23 !== "string") {
|
|
19425
19425
|
return false;
|
|
19426
19426
|
}
|
|
19427
|
-
var extension2 = extname3("x." +
|
|
19427
|
+
var extension2 = extname3("x." + path23).toLowerCase().substr(1);
|
|
19428
19428
|
if (!extension2) {
|
|
19429
19429
|
return false;
|
|
19430
19430
|
}
|
|
@@ -22942,7 +22942,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
22942
22942
|
"use strict";
|
|
22943
22943
|
module2.exports = pathToRegexp;
|
|
22944
22944
|
var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
|
|
22945
|
-
function pathToRegexp(
|
|
22945
|
+
function pathToRegexp(path23, keys, options) {
|
|
22946
22946
|
options = options || {};
|
|
22947
22947
|
keys = keys || [];
|
|
22948
22948
|
var strict = options.strict;
|
|
@@ -22956,8 +22956,8 @@ var require_path_to_regexp = __commonJS({
|
|
|
22956
22956
|
var pos = 0;
|
|
22957
22957
|
var backtrack = "";
|
|
22958
22958
|
var m;
|
|
22959
|
-
if (
|
|
22960
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
22959
|
+
if (path23 instanceof RegExp) {
|
|
22960
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path23.source)) {
|
|
22961
22961
|
if (m[0][0] === "\\") continue;
|
|
22962
22962
|
keys.push({
|
|
22963
22963
|
name: m[1] || name2++,
|
|
@@ -22965,18 +22965,18 @@ var require_path_to_regexp = __commonJS({
|
|
|
22965
22965
|
offset: m.index
|
|
22966
22966
|
});
|
|
22967
22967
|
}
|
|
22968
|
-
return
|
|
22968
|
+
return path23;
|
|
22969
22969
|
}
|
|
22970
|
-
if (Array.isArray(
|
|
22971
|
-
|
|
22970
|
+
if (Array.isArray(path23)) {
|
|
22971
|
+
path23 = path23.map(function(value) {
|
|
22972
22972
|
return pathToRegexp(value, keys, options).source;
|
|
22973
22973
|
});
|
|
22974
|
-
return new RegExp(
|
|
22974
|
+
return new RegExp(path23.join("|"), flags);
|
|
22975
22975
|
}
|
|
22976
|
-
if (typeof
|
|
22976
|
+
if (typeof path23 !== "string") {
|
|
22977
22977
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
22978
22978
|
}
|
|
22979
|
-
|
|
22979
|
+
path23 = path23.replace(
|
|
22980
22980
|
/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
|
|
22981
22981
|
function(match, slash, format, key, capture, star, optional, offset) {
|
|
22982
22982
|
if (match[0] === "\\") {
|
|
@@ -22993,7 +22993,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
22993
22993
|
if (slash || format) {
|
|
22994
22994
|
backtrack = "";
|
|
22995
22995
|
} else {
|
|
22996
|
-
backtrack +=
|
|
22996
|
+
backtrack += path23.slice(pos, offset);
|
|
22997
22997
|
}
|
|
22998
22998
|
pos = offset + match.length;
|
|
22999
22999
|
if (match === "*") {
|
|
@@ -23023,7 +23023,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
23023
23023
|
return result;
|
|
23024
23024
|
}
|
|
23025
23025
|
);
|
|
23026
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
23026
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path23)) {
|
|
23027
23027
|
if (m[0][0] === "\\") continue;
|
|
23028
23028
|
if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
|
|
23029
23029
|
keys.splice(keysOffset + i, 0, {
|
|
@@ -23035,13 +23035,13 @@ var require_path_to_regexp = __commonJS({
|
|
|
23035
23035
|
}
|
|
23036
23036
|
i++;
|
|
23037
23037
|
}
|
|
23038
|
-
|
|
23038
|
+
path23 += strict ? "" : path23[path23.length - 1] === "/" ? "?" : "/?";
|
|
23039
23039
|
if (end) {
|
|
23040
|
-
|
|
23041
|
-
} else if (
|
|
23042
|
-
|
|
23040
|
+
path23 += "$";
|
|
23041
|
+
} else if (path23[path23.length - 1] !== "/") {
|
|
23042
|
+
path23 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
23043
23043
|
}
|
|
23044
|
-
return new RegExp("^" +
|
|
23044
|
+
return new RegExp("^" + path23, flags);
|
|
23045
23045
|
}
|
|
23046
23046
|
}
|
|
23047
23047
|
});
|
|
@@ -23054,19 +23054,19 @@ var require_layer = __commonJS({
|
|
|
23054
23054
|
var debug = require_src2()("express:router:layer");
|
|
23055
23055
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
23056
23056
|
module2.exports = Layer;
|
|
23057
|
-
function Layer(
|
|
23057
|
+
function Layer(path23, options, fn) {
|
|
23058
23058
|
if (!(this instanceof Layer)) {
|
|
23059
|
-
return new Layer(
|
|
23059
|
+
return new Layer(path23, options, fn);
|
|
23060
23060
|
}
|
|
23061
|
-
debug("new %o",
|
|
23061
|
+
debug("new %o", path23);
|
|
23062
23062
|
var opts = options || {};
|
|
23063
23063
|
this.handle = fn;
|
|
23064
23064
|
this.name = fn.name || "<anonymous>";
|
|
23065
23065
|
this.params = void 0;
|
|
23066
23066
|
this.path = void 0;
|
|
23067
|
-
this.regexp = pathRegexp(
|
|
23068
|
-
this.regexp.fast_star =
|
|
23069
|
-
this.regexp.fast_slash =
|
|
23067
|
+
this.regexp = pathRegexp(path23, this.keys = [], opts);
|
|
23068
|
+
this.regexp.fast_star = path23 === "*";
|
|
23069
|
+
this.regexp.fast_slash = path23 === "/" && opts.end === false;
|
|
23070
23070
|
}
|
|
23071
23071
|
Layer.prototype.handle_error = function handle_error(error, req, res, next) {
|
|
23072
23072
|
var fn = this.handle;
|
|
@@ -23090,20 +23090,20 @@ var require_layer = __commonJS({
|
|
|
23090
23090
|
next(err);
|
|
23091
23091
|
}
|
|
23092
23092
|
};
|
|
23093
|
-
Layer.prototype.match = function match(
|
|
23093
|
+
Layer.prototype.match = function match(path23) {
|
|
23094
23094
|
var match2;
|
|
23095
|
-
if (
|
|
23095
|
+
if (path23 != null) {
|
|
23096
23096
|
if (this.regexp.fast_slash) {
|
|
23097
23097
|
this.params = {};
|
|
23098
23098
|
this.path = "";
|
|
23099
23099
|
return true;
|
|
23100
23100
|
}
|
|
23101
23101
|
if (this.regexp.fast_star) {
|
|
23102
|
-
this.params = { "0": decode_param(
|
|
23103
|
-
this.path =
|
|
23102
|
+
this.params = { "0": decode_param(path23) };
|
|
23103
|
+
this.path = path23;
|
|
23104
23104
|
return true;
|
|
23105
23105
|
}
|
|
23106
|
-
match2 = this.regexp.exec(
|
|
23106
|
+
match2 = this.regexp.exec(path23);
|
|
23107
23107
|
}
|
|
23108
23108
|
if (!match2) {
|
|
23109
23109
|
this.params = void 0;
|
|
@@ -23196,10 +23196,10 @@ var require_route = __commonJS({
|
|
|
23196
23196
|
var slice = Array.prototype.slice;
|
|
23197
23197
|
var toString = Object.prototype.toString;
|
|
23198
23198
|
module2.exports = Route;
|
|
23199
|
-
function Route(
|
|
23200
|
-
this.path =
|
|
23199
|
+
function Route(path23) {
|
|
23200
|
+
this.path = path23;
|
|
23201
23201
|
this.stack = [];
|
|
23202
|
-
debug("new %o",
|
|
23202
|
+
debug("new %o", path23);
|
|
23203
23203
|
this.methods = {};
|
|
23204
23204
|
}
|
|
23205
23205
|
Route.prototype._handles_method = function _handles_method(method) {
|
|
@@ -23412,8 +23412,8 @@ var require_router = __commonJS({
|
|
|
23412
23412
|
if (++sync > 100) {
|
|
23413
23413
|
return setImmediate(next, err);
|
|
23414
23414
|
}
|
|
23415
|
-
var
|
|
23416
|
-
if (
|
|
23415
|
+
var path23 = getPathname(req);
|
|
23416
|
+
if (path23 == null) {
|
|
23417
23417
|
return done(layerError);
|
|
23418
23418
|
}
|
|
23419
23419
|
var layer;
|
|
@@ -23421,7 +23421,7 @@ var require_router = __commonJS({
|
|
|
23421
23421
|
var route;
|
|
23422
23422
|
while (match !== true && idx < stack.length) {
|
|
23423
23423
|
layer = stack[idx++];
|
|
23424
|
-
match = matchLayer(layer,
|
|
23424
|
+
match = matchLayer(layer, path23);
|
|
23425
23425
|
route = layer.route;
|
|
23426
23426
|
if (typeof match !== "boolean") {
|
|
23427
23427
|
layerError = layerError || match;
|
|
@@ -23459,18 +23459,18 @@ var require_router = __commonJS({
|
|
|
23459
23459
|
} else if (route) {
|
|
23460
23460
|
layer.handle_request(req, res, next);
|
|
23461
23461
|
} else {
|
|
23462
|
-
trim_prefix(layer, layerError, layerPath,
|
|
23462
|
+
trim_prefix(layer, layerError, layerPath, path23);
|
|
23463
23463
|
}
|
|
23464
23464
|
sync = 0;
|
|
23465
23465
|
});
|
|
23466
23466
|
}
|
|
23467
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
23467
|
+
function trim_prefix(layer, layerError, layerPath, path23) {
|
|
23468
23468
|
if (layerPath.length !== 0) {
|
|
23469
|
-
if (layerPath !==
|
|
23469
|
+
if (layerPath !== path23.slice(0, layerPath.length)) {
|
|
23470
23470
|
next(layerError);
|
|
23471
23471
|
return;
|
|
23472
23472
|
}
|
|
23473
|
-
var c =
|
|
23473
|
+
var c = path23[layerPath.length];
|
|
23474
23474
|
if (c && c !== "/" && c !== ".") return next(layerError);
|
|
23475
23475
|
debug("trim prefix (%s) from url %s", layerPath, req.url);
|
|
23476
23476
|
removed = layerPath;
|
|
@@ -23548,7 +23548,7 @@ var require_router = __commonJS({
|
|
|
23548
23548
|
};
|
|
23549
23549
|
proto.use = function use(fn) {
|
|
23550
23550
|
var offset = 0;
|
|
23551
|
-
var
|
|
23551
|
+
var path23 = "/";
|
|
23552
23552
|
if (typeof fn !== "function") {
|
|
23553
23553
|
var arg = fn;
|
|
23554
23554
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -23556,7 +23556,7 @@ var require_router = __commonJS({
|
|
|
23556
23556
|
}
|
|
23557
23557
|
if (typeof arg !== "function") {
|
|
23558
23558
|
offset = 1;
|
|
23559
|
-
|
|
23559
|
+
path23 = fn;
|
|
23560
23560
|
}
|
|
23561
23561
|
}
|
|
23562
23562
|
var callbacks = flatten(slice.call(arguments, offset));
|
|
@@ -23568,8 +23568,8 @@ var require_router = __commonJS({
|
|
|
23568
23568
|
if (typeof fn !== "function") {
|
|
23569
23569
|
throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
|
|
23570
23570
|
}
|
|
23571
|
-
debug("use %o %s",
|
|
23572
|
-
var layer = new Layer(
|
|
23571
|
+
debug("use %o %s", path23, fn.name || "<anonymous>");
|
|
23572
|
+
var layer = new Layer(path23, {
|
|
23573
23573
|
sensitive: this.caseSensitive,
|
|
23574
23574
|
strict: false,
|
|
23575
23575
|
end: false
|
|
@@ -23579,9 +23579,9 @@ var require_router = __commonJS({
|
|
|
23579
23579
|
}
|
|
23580
23580
|
return this;
|
|
23581
23581
|
};
|
|
23582
|
-
proto.route = function route(
|
|
23583
|
-
var route2 = new Route(
|
|
23584
|
-
var layer = new Layer(
|
|
23582
|
+
proto.route = function route(path23) {
|
|
23583
|
+
var route2 = new Route(path23);
|
|
23584
|
+
var layer = new Layer(path23, {
|
|
23585
23585
|
sensitive: this.caseSensitive,
|
|
23586
23586
|
strict: this.strict,
|
|
23587
23587
|
end: true
|
|
@@ -23591,8 +23591,8 @@ var require_router = __commonJS({
|
|
|
23591
23591
|
return route2;
|
|
23592
23592
|
};
|
|
23593
23593
|
methods.concat("all").forEach(function(method) {
|
|
23594
|
-
proto[method] = function(
|
|
23595
|
-
var route = this.route(
|
|
23594
|
+
proto[method] = function(path23) {
|
|
23595
|
+
var route = this.route(path23);
|
|
23596
23596
|
route[method].apply(route, slice.call(arguments, 1));
|
|
23597
23597
|
return this;
|
|
23598
23598
|
};
|
|
@@ -23628,9 +23628,9 @@ var require_router = __commonJS({
|
|
|
23628
23628
|
}
|
|
23629
23629
|
return toString.call(obj).replace(objectRegExp, "$1");
|
|
23630
23630
|
}
|
|
23631
|
-
function matchLayer(layer,
|
|
23631
|
+
function matchLayer(layer, path23) {
|
|
23632
23632
|
try {
|
|
23633
|
-
return layer.match(
|
|
23633
|
+
return layer.match(path23);
|
|
23634
23634
|
} catch (err) {
|
|
23635
23635
|
return err;
|
|
23636
23636
|
}
|
|
@@ -23748,13 +23748,13 @@ var require_view = __commonJS({
|
|
|
23748
23748
|
"../../node_modules/.pnpm/express@4.22.1/node_modules/express/lib/view.js"(exports2, module2) {
|
|
23749
23749
|
"use strict";
|
|
23750
23750
|
var debug = require_src2()("express:view");
|
|
23751
|
-
var
|
|
23752
|
-
var
|
|
23753
|
-
var dirname7 =
|
|
23754
|
-
var basename5 =
|
|
23755
|
-
var extname3 =
|
|
23756
|
-
var
|
|
23757
|
-
var resolve15 =
|
|
23751
|
+
var path23 = require("path");
|
|
23752
|
+
var fs22 = require("fs");
|
|
23753
|
+
var dirname7 = path23.dirname;
|
|
23754
|
+
var basename5 = path23.basename;
|
|
23755
|
+
var extname3 = path23.extname;
|
|
23756
|
+
var join17 = path23.join;
|
|
23757
|
+
var resolve15 = path23.resolve;
|
|
23758
23758
|
module2.exports = View;
|
|
23759
23759
|
function View(name2, options) {
|
|
23760
23760
|
var opts = options || {};
|
|
@@ -23783,17 +23783,17 @@ var require_view = __commonJS({
|
|
|
23783
23783
|
this.path = this.lookup(fileName);
|
|
23784
23784
|
}
|
|
23785
23785
|
View.prototype.lookup = function lookup(name2) {
|
|
23786
|
-
var
|
|
23786
|
+
var path24;
|
|
23787
23787
|
var roots = [].concat(this.root);
|
|
23788
23788
|
debug('lookup "%s"', name2);
|
|
23789
|
-
for (var i = 0; i < roots.length && !
|
|
23789
|
+
for (var i = 0; i < roots.length && !path24; i++) {
|
|
23790
23790
|
var root = roots[i];
|
|
23791
23791
|
var loc = resolve15(root, name2);
|
|
23792
23792
|
var dir = dirname7(loc);
|
|
23793
23793
|
var file = basename5(loc);
|
|
23794
|
-
|
|
23794
|
+
path24 = this.resolve(dir, file);
|
|
23795
23795
|
}
|
|
23796
|
-
return
|
|
23796
|
+
return path24;
|
|
23797
23797
|
};
|
|
23798
23798
|
View.prototype.render = function render(options, callback) {
|
|
23799
23799
|
debug('render "%s"', this.path);
|
|
@@ -23801,21 +23801,21 @@ var require_view = __commonJS({
|
|
|
23801
23801
|
};
|
|
23802
23802
|
View.prototype.resolve = function resolve16(dir, file) {
|
|
23803
23803
|
var ext = this.ext;
|
|
23804
|
-
var
|
|
23805
|
-
var stat = tryStat(
|
|
23804
|
+
var path24 = join17(dir, file);
|
|
23805
|
+
var stat = tryStat(path24);
|
|
23806
23806
|
if (stat && stat.isFile()) {
|
|
23807
|
-
return
|
|
23807
|
+
return path24;
|
|
23808
23808
|
}
|
|
23809
|
-
|
|
23810
|
-
stat = tryStat(
|
|
23809
|
+
path24 = join17(dir, basename5(file, ext), "index" + ext);
|
|
23810
|
+
stat = tryStat(path24);
|
|
23811
23811
|
if (stat && stat.isFile()) {
|
|
23812
|
-
return
|
|
23812
|
+
return path24;
|
|
23813
23813
|
}
|
|
23814
23814
|
};
|
|
23815
|
-
function tryStat(
|
|
23816
|
-
debug('stat "%s"',
|
|
23815
|
+
function tryStat(path24) {
|
|
23816
|
+
debug('stat "%s"', path24);
|
|
23817
23817
|
try {
|
|
23818
|
-
return
|
|
23818
|
+
return fs22.statSync(path24);
|
|
23819
23819
|
} catch (e) {
|
|
23820
23820
|
return void 0;
|
|
23821
23821
|
}
|
|
@@ -24112,8 +24112,8 @@ var require_types = __commonJS({
|
|
|
24112
24112
|
var require_mime = __commonJS({
|
|
24113
24113
|
"../../node_modules/.pnpm/mime@1.6.0/node_modules/mime/mime.js"(exports2, module2) {
|
|
24114
24114
|
"use strict";
|
|
24115
|
-
var
|
|
24116
|
-
var
|
|
24115
|
+
var path23 = require("path");
|
|
24116
|
+
var fs22 = require("fs");
|
|
24117
24117
|
function Mime() {
|
|
24118
24118
|
this.types = /* @__PURE__ */ Object.create(null);
|
|
24119
24119
|
this.extensions = /* @__PURE__ */ Object.create(null);
|
|
@@ -24134,7 +24134,7 @@ var require_mime = __commonJS({
|
|
|
24134
24134
|
};
|
|
24135
24135
|
Mime.prototype.load = function(file) {
|
|
24136
24136
|
this._loading = file;
|
|
24137
|
-
var map = {}, content =
|
|
24137
|
+
var map = {}, content = fs22.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
|
|
24138
24138
|
lines.forEach(function(line) {
|
|
24139
24139
|
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
|
|
24140
24140
|
map[fields.shift()] = fields;
|
|
@@ -24142,8 +24142,8 @@ var require_mime = __commonJS({
|
|
|
24142
24142
|
this.define(map);
|
|
24143
24143
|
this._loading = null;
|
|
24144
24144
|
};
|
|
24145
|
-
Mime.prototype.lookup = function(
|
|
24146
|
-
var ext =
|
|
24145
|
+
Mime.prototype.lookup = function(path24, fallback) {
|
|
24146
|
+
var ext = path24.replace(/^.*[\.\/\\]/, "").toLowerCase();
|
|
24147
24147
|
return this.types[ext] || fallback || this.default_type;
|
|
24148
24148
|
};
|
|
24149
24149
|
Mime.prototype.extension = function(mimeType) {
|
|
@@ -24256,33 +24256,33 @@ var require_send = __commonJS({
|
|
|
24256
24256
|
var escapeHtml2 = require_escape_html();
|
|
24257
24257
|
var etag = require_etag();
|
|
24258
24258
|
var fresh = require_fresh();
|
|
24259
|
-
var
|
|
24259
|
+
var fs22 = require("fs");
|
|
24260
24260
|
var mime = require_mime();
|
|
24261
24261
|
var ms = require_ms();
|
|
24262
24262
|
var onFinished = require_on_finished();
|
|
24263
24263
|
var parseRange = require_range_parser();
|
|
24264
|
-
var
|
|
24264
|
+
var path23 = require("path");
|
|
24265
24265
|
var statuses = require_statuses();
|
|
24266
24266
|
var Stream = require("stream");
|
|
24267
24267
|
var util3 = require("util");
|
|
24268
|
-
var extname3 =
|
|
24269
|
-
var
|
|
24270
|
-
var normalize =
|
|
24271
|
-
var resolve15 =
|
|
24272
|
-
var sep4 =
|
|
24268
|
+
var extname3 = path23.extname;
|
|
24269
|
+
var join17 = path23.join;
|
|
24270
|
+
var normalize = path23.normalize;
|
|
24271
|
+
var resolve15 = path23.resolve;
|
|
24272
|
+
var sep4 = path23.sep;
|
|
24273
24273
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
24274
24274
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
24275
24275
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
24276
24276
|
module2.exports = send;
|
|
24277
24277
|
module2.exports.mime = mime;
|
|
24278
|
-
function send(req,
|
|
24279
|
-
return new SendStream(req,
|
|
24278
|
+
function send(req, path24, options) {
|
|
24279
|
+
return new SendStream(req, path24, options);
|
|
24280
24280
|
}
|
|
24281
|
-
function SendStream(req,
|
|
24281
|
+
function SendStream(req, path24, options) {
|
|
24282
24282
|
Stream.call(this);
|
|
24283
24283
|
var opts = options || {};
|
|
24284
24284
|
this.options = opts;
|
|
24285
|
-
this.path =
|
|
24285
|
+
this.path = path24;
|
|
24286
24286
|
this.req = req;
|
|
24287
24287
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
24288
24288
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -24328,8 +24328,8 @@ var require_send = __commonJS({
|
|
|
24328
24328
|
this._index = index2;
|
|
24329
24329
|
return this;
|
|
24330
24330
|
}, "send.index: pass index as option");
|
|
24331
|
-
SendStream.prototype.root = function root(
|
|
24332
|
-
this._root = resolve15(String(
|
|
24331
|
+
SendStream.prototype.root = function root(path24) {
|
|
24332
|
+
this._root = resolve15(String(path24));
|
|
24333
24333
|
debug("root %s", this._root);
|
|
24334
24334
|
return this;
|
|
24335
24335
|
};
|
|
@@ -24442,10 +24442,10 @@ var require_send = __commonJS({
|
|
|
24442
24442
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
24443
24443
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
24444
24444
|
};
|
|
24445
|
-
SendStream.prototype.redirect = function redirect(
|
|
24445
|
+
SendStream.prototype.redirect = function redirect(path24) {
|
|
24446
24446
|
var res = this.res;
|
|
24447
24447
|
if (hasListeners(this, "directory")) {
|
|
24448
|
-
this.emit("directory", res,
|
|
24448
|
+
this.emit("directory", res, path24);
|
|
24449
24449
|
return;
|
|
24450
24450
|
}
|
|
24451
24451
|
if (this.hasTrailingSlash()) {
|
|
@@ -24465,42 +24465,42 @@ var require_send = __commonJS({
|
|
|
24465
24465
|
SendStream.prototype.pipe = function pipe(res) {
|
|
24466
24466
|
var root = this._root;
|
|
24467
24467
|
this.res = res;
|
|
24468
|
-
var
|
|
24469
|
-
if (
|
|
24468
|
+
var path24 = decode(this.path);
|
|
24469
|
+
if (path24 === -1) {
|
|
24470
24470
|
this.error(400);
|
|
24471
24471
|
return res;
|
|
24472
24472
|
}
|
|
24473
|
-
if (~
|
|
24473
|
+
if (~path24.indexOf("\0")) {
|
|
24474
24474
|
this.error(400);
|
|
24475
24475
|
return res;
|
|
24476
24476
|
}
|
|
24477
24477
|
var parts;
|
|
24478
24478
|
if (root !== null) {
|
|
24479
|
-
if (
|
|
24480
|
-
|
|
24479
|
+
if (path24) {
|
|
24480
|
+
path24 = normalize("." + sep4 + path24);
|
|
24481
24481
|
}
|
|
24482
|
-
if (UP_PATH_REGEXP.test(
|
|
24483
|
-
debug('malicious path "%s"',
|
|
24482
|
+
if (UP_PATH_REGEXP.test(path24)) {
|
|
24483
|
+
debug('malicious path "%s"', path24);
|
|
24484
24484
|
this.error(403);
|
|
24485
24485
|
return res;
|
|
24486
24486
|
}
|
|
24487
|
-
parts =
|
|
24488
|
-
|
|
24487
|
+
parts = path24.split(sep4);
|
|
24488
|
+
path24 = normalize(join17(root, path24));
|
|
24489
24489
|
} else {
|
|
24490
|
-
if (UP_PATH_REGEXP.test(
|
|
24491
|
-
debug('malicious path "%s"',
|
|
24490
|
+
if (UP_PATH_REGEXP.test(path24)) {
|
|
24491
|
+
debug('malicious path "%s"', path24);
|
|
24492
24492
|
this.error(403);
|
|
24493
24493
|
return res;
|
|
24494
24494
|
}
|
|
24495
|
-
parts = normalize(
|
|
24496
|
-
|
|
24495
|
+
parts = normalize(path24).split(sep4);
|
|
24496
|
+
path24 = resolve15(path24);
|
|
24497
24497
|
}
|
|
24498
24498
|
if (containsDotFile(parts)) {
|
|
24499
24499
|
var access = this._dotfiles;
|
|
24500
24500
|
if (access === void 0) {
|
|
24501
24501
|
access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
|
|
24502
24502
|
}
|
|
24503
|
-
debug('%s dotfile "%s"', access,
|
|
24503
|
+
debug('%s dotfile "%s"', access, path24);
|
|
24504
24504
|
switch (access) {
|
|
24505
24505
|
case "allow":
|
|
24506
24506
|
break;
|
|
@@ -24514,13 +24514,13 @@ var require_send = __commonJS({
|
|
|
24514
24514
|
}
|
|
24515
24515
|
}
|
|
24516
24516
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
24517
|
-
this.sendIndex(
|
|
24517
|
+
this.sendIndex(path24);
|
|
24518
24518
|
return res;
|
|
24519
24519
|
}
|
|
24520
|
-
this.sendFile(
|
|
24520
|
+
this.sendFile(path24);
|
|
24521
24521
|
return res;
|
|
24522
24522
|
};
|
|
24523
|
-
SendStream.prototype.send = function send2(
|
|
24523
|
+
SendStream.prototype.send = function send2(path24, stat) {
|
|
24524
24524
|
var len = stat.size;
|
|
24525
24525
|
var options = this.options;
|
|
24526
24526
|
var opts = {};
|
|
@@ -24532,9 +24532,9 @@ var require_send = __commonJS({
|
|
|
24532
24532
|
this.headersAlreadySent();
|
|
24533
24533
|
return;
|
|
24534
24534
|
}
|
|
24535
|
-
debug('pipe "%s"',
|
|
24536
|
-
this.setHeader(
|
|
24537
|
-
this.type(
|
|
24535
|
+
debug('pipe "%s"', path24);
|
|
24536
|
+
this.setHeader(path24, stat);
|
|
24537
|
+
this.type(path24);
|
|
24538
24538
|
if (this.isConditionalGET()) {
|
|
24539
24539
|
if (this.isPreconditionFailure()) {
|
|
24540
24540
|
this.error(412);
|
|
@@ -24583,28 +24583,28 @@ var require_send = __commonJS({
|
|
|
24583
24583
|
res.end();
|
|
24584
24584
|
return;
|
|
24585
24585
|
}
|
|
24586
|
-
this.stream(
|
|
24586
|
+
this.stream(path24, opts);
|
|
24587
24587
|
};
|
|
24588
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
24588
|
+
SendStream.prototype.sendFile = function sendFile(path24) {
|
|
24589
24589
|
var i = 0;
|
|
24590
24590
|
var self2 = this;
|
|
24591
|
-
debug('stat "%s"',
|
|
24592
|
-
|
|
24593
|
-
if (err && err.code === "ENOENT" && !extname3(
|
|
24591
|
+
debug('stat "%s"', path24);
|
|
24592
|
+
fs22.stat(path24, function onstat(err, stat) {
|
|
24593
|
+
if (err && err.code === "ENOENT" && !extname3(path24) && path24[path24.length - 1] !== sep4) {
|
|
24594
24594
|
return next(err);
|
|
24595
24595
|
}
|
|
24596
24596
|
if (err) return self2.onStatError(err);
|
|
24597
|
-
if (stat.isDirectory()) return self2.redirect(
|
|
24598
|
-
self2.emit("file",
|
|
24599
|
-
self2.send(
|
|
24597
|
+
if (stat.isDirectory()) return self2.redirect(path24);
|
|
24598
|
+
self2.emit("file", path24, stat);
|
|
24599
|
+
self2.send(path24, stat);
|
|
24600
24600
|
});
|
|
24601
24601
|
function next(err) {
|
|
24602
24602
|
if (self2._extensions.length <= i) {
|
|
24603
24603
|
return err ? self2.onStatError(err) : self2.error(404);
|
|
24604
24604
|
}
|
|
24605
|
-
var p =
|
|
24605
|
+
var p = path24 + "." + self2._extensions[i++];
|
|
24606
24606
|
debug('stat "%s"', p);
|
|
24607
|
-
|
|
24607
|
+
fs22.stat(p, function(err2, stat) {
|
|
24608
24608
|
if (err2) return next(err2);
|
|
24609
24609
|
if (stat.isDirectory()) return next();
|
|
24610
24610
|
self2.emit("file", p, stat);
|
|
@@ -24612,7 +24612,7 @@ var require_send = __commonJS({
|
|
|
24612
24612
|
});
|
|
24613
24613
|
}
|
|
24614
24614
|
};
|
|
24615
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
24615
|
+
SendStream.prototype.sendIndex = function sendIndex(path24) {
|
|
24616
24616
|
var i = -1;
|
|
24617
24617
|
var self2 = this;
|
|
24618
24618
|
function next(err) {
|
|
@@ -24620,9 +24620,9 @@ var require_send = __commonJS({
|
|
|
24620
24620
|
if (err) return self2.onStatError(err);
|
|
24621
24621
|
return self2.error(404);
|
|
24622
24622
|
}
|
|
24623
|
-
var p =
|
|
24623
|
+
var p = join17(path24, self2._index[i]);
|
|
24624
24624
|
debug('stat "%s"', p);
|
|
24625
|
-
|
|
24625
|
+
fs22.stat(p, function(err2, stat) {
|
|
24626
24626
|
if (err2) return next(err2);
|
|
24627
24627
|
if (stat.isDirectory()) return next();
|
|
24628
24628
|
self2.emit("file", p, stat);
|
|
@@ -24631,10 +24631,10 @@ var require_send = __commonJS({
|
|
|
24631
24631
|
}
|
|
24632
24632
|
next();
|
|
24633
24633
|
};
|
|
24634
|
-
SendStream.prototype.stream = function stream(
|
|
24634
|
+
SendStream.prototype.stream = function stream(path24, options) {
|
|
24635
24635
|
var self2 = this;
|
|
24636
24636
|
var res = this.res;
|
|
24637
|
-
var stream2 =
|
|
24637
|
+
var stream2 = fs22.createReadStream(path24, options);
|
|
24638
24638
|
this.emit("stream", stream2);
|
|
24639
24639
|
stream2.pipe(res);
|
|
24640
24640
|
function cleanup() {
|
|
@@ -24649,10 +24649,10 @@ var require_send = __commonJS({
|
|
|
24649
24649
|
self2.emit("end");
|
|
24650
24650
|
});
|
|
24651
24651
|
};
|
|
24652
|
-
SendStream.prototype.type = function type(
|
|
24652
|
+
SendStream.prototype.type = function type(path24) {
|
|
24653
24653
|
var res = this.res;
|
|
24654
24654
|
if (res.getHeader("Content-Type")) return;
|
|
24655
|
-
var type2 = mime.lookup(
|
|
24655
|
+
var type2 = mime.lookup(path24);
|
|
24656
24656
|
if (!type2) {
|
|
24657
24657
|
debug("no content-type");
|
|
24658
24658
|
return;
|
|
@@ -24661,9 +24661,9 @@ var require_send = __commonJS({
|
|
|
24661
24661
|
debug("content-type %s", type2);
|
|
24662
24662
|
res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
|
|
24663
24663
|
};
|
|
24664
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
24664
|
+
SendStream.prototype.setHeader = function setHeader(path24, stat) {
|
|
24665
24665
|
var res = this.res;
|
|
24666
|
-
this.emit("headers", res,
|
|
24666
|
+
this.emit("headers", res, path24, stat);
|
|
24667
24667
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
24668
24668
|
debug("accept ranges");
|
|
24669
24669
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -24722,9 +24722,9 @@ var require_send = __commonJS({
|
|
|
24722
24722
|
}
|
|
24723
24723
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
24724
24724
|
}
|
|
24725
|
-
function decode(
|
|
24725
|
+
function decode(path24) {
|
|
24726
24726
|
try {
|
|
24727
|
-
return decodeURIComponent(
|
|
24727
|
+
return decodeURIComponent(path24);
|
|
24728
24728
|
} catch (err) {
|
|
24729
24729
|
return -1;
|
|
24730
24730
|
}
|
|
@@ -25634,10 +25634,10 @@ var require_utils2 = __commonJS({
|
|
|
25634
25634
|
var querystring = require("querystring");
|
|
25635
25635
|
exports2.etag = createETagGenerator({ weak: false });
|
|
25636
25636
|
exports2.wetag = createETagGenerator({ weak: true });
|
|
25637
|
-
exports2.isAbsolute = function(
|
|
25638
|
-
if ("/" ===
|
|
25639
|
-
if (":" ===
|
|
25640
|
-
if ("\\\\" ===
|
|
25637
|
+
exports2.isAbsolute = function(path23) {
|
|
25638
|
+
if ("/" === path23[0]) return true;
|
|
25639
|
+
if (":" === path23[1] && ("\\" === path23[2] || "/" === path23[2])) return true;
|
|
25640
|
+
if ("\\\\" === path23.substring(0, 2)) return true;
|
|
25641
25641
|
};
|
|
25642
25642
|
exports2.flatten = deprecate.function(
|
|
25643
25643
|
flatten,
|
|
@@ -25848,7 +25848,7 @@ var require_application = __commonJS({
|
|
|
25848
25848
|
};
|
|
25849
25849
|
app.use = function use(fn) {
|
|
25850
25850
|
var offset = 0;
|
|
25851
|
-
var
|
|
25851
|
+
var path23 = "/";
|
|
25852
25852
|
if (typeof fn !== "function") {
|
|
25853
25853
|
var arg = fn;
|
|
25854
25854
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -25856,7 +25856,7 @@ var require_application = __commonJS({
|
|
|
25856
25856
|
}
|
|
25857
25857
|
if (typeof arg !== "function") {
|
|
25858
25858
|
offset = 1;
|
|
25859
|
-
|
|
25859
|
+
path23 = fn;
|
|
25860
25860
|
}
|
|
25861
25861
|
}
|
|
25862
25862
|
var fns = flatten(slice.call(arguments, offset));
|
|
@@ -25867,12 +25867,12 @@ var require_application = __commonJS({
|
|
|
25867
25867
|
var router = this._router;
|
|
25868
25868
|
fns.forEach(function(fn2) {
|
|
25869
25869
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
25870
|
-
return router.use(
|
|
25870
|
+
return router.use(path23, fn2);
|
|
25871
25871
|
}
|
|
25872
|
-
debug(".use app under %s",
|
|
25873
|
-
fn2.mountpath =
|
|
25872
|
+
debug(".use app under %s", path23);
|
|
25873
|
+
fn2.mountpath = path23;
|
|
25874
25874
|
fn2.parent = this;
|
|
25875
|
-
router.use(
|
|
25875
|
+
router.use(path23, function mounted_app(req, res, next) {
|
|
25876
25876
|
var orig = req.app;
|
|
25877
25877
|
fn2.handle(req, res, function(err) {
|
|
25878
25878
|
setPrototypeOf(req, orig.request);
|
|
@@ -25884,9 +25884,9 @@ var require_application = __commonJS({
|
|
|
25884
25884
|
}, this);
|
|
25885
25885
|
return this;
|
|
25886
25886
|
};
|
|
25887
|
-
app.route = function route(
|
|
25887
|
+
app.route = function route(path23) {
|
|
25888
25888
|
this.lazyrouter();
|
|
25889
|
-
return this._router.route(
|
|
25889
|
+
return this._router.route(path23);
|
|
25890
25890
|
};
|
|
25891
25891
|
app.engine = function engine(ext, fn) {
|
|
25892
25892
|
if (typeof fn !== "function") {
|
|
@@ -25937,7 +25937,7 @@ var require_application = __commonJS({
|
|
|
25937
25937
|
}
|
|
25938
25938
|
return this;
|
|
25939
25939
|
};
|
|
25940
|
-
app.path = function
|
|
25940
|
+
app.path = function path23() {
|
|
25941
25941
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
25942
25942
|
};
|
|
25943
25943
|
app.enabled = function enabled2(setting) {
|
|
@@ -25953,19 +25953,19 @@ var require_application = __commonJS({
|
|
|
25953
25953
|
return this.set(setting, false);
|
|
25954
25954
|
};
|
|
25955
25955
|
methods.forEach(function(method) {
|
|
25956
|
-
app[method] = function(
|
|
25956
|
+
app[method] = function(path23) {
|
|
25957
25957
|
if (method === "get" && arguments.length === 1) {
|
|
25958
|
-
return this.set(
|
|
25958
|
+
return this.set(path23);
|
|
25959
25959
|
}
|
|
25960
25960
|
this.lazyrouter();
|
|
25961
|
-
var route = this._router.route(
|
|
25961
|
+
var route = this._router.route(path23);
|
|
25962
25962
|
route[method].apply(route, slice.call(arguments, 1));
|
|
25963
25963
|
return this;
|
|
25964
25964
|
};
|
|
25965
25965
|
});
|
|
25966
|
-
app.all = function all(
|
|
25966
|
+
app.all = function all(path23) {
|
|
25967
25967
|
this.lazyrouter();
|
|
25968
|
-
var route = this._router.route(
|
|
25968
|
+
var route = this._router.route(path23);
|
|
25969
25969
|
var args = slice.call(arguments, 1);
|
|
25970
25970
|
for (var i = 0; i < methods.length; i++) {
|
|
25971
25971
|
route[methods[i]].apply(route, args);
|
|
@@ -26724,7 +26724,7 @@ var require_request = __commonJS({
|
|
|
26724
26724
|
var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
|
|
26725
26725
|
return subdomains2.slice(offset);
|
|
26726
26726
|
});
|
|
26727
|
-
defineGetter(req, "path", function
|
|
26727
|
+
defineGetter(req, "path", function path23() {
|
|
26728
26728
|
return parse(this).pathname;
|
|
26729
26729
|
});
|
|
26730
26730
|
defineGetter(req, "hostname", function hostname3() {
|
|
@@ -27047,7 +27047,7 @@ var require_response = __commonJS({
|
|
|
27047
27047
|
var http3 = require("http");
|
|
27048
27048
|
var isAbsolute5 = require_utils2().isAbsolute;
|
|
27049
27049
|
var onFinished = require_on_finished();
|
|
27050
|
-
var
|
|
27050
|
+
var path23 = require("path");
|
|
27051
27051
|
var statuses = require_statuses();
|
|
27052
27052
|
var merge = require_utils_merge();
|
|
27053
27053
|
var sign = require_cookie_signature().sign;
|
|
@@ -27056,9 +27056,9 @@ var require_response = __commonJS({
|
|
|
27056
27056
|
var setCharset = require_utils2().setCharset;
|
|
27057
27057
|
var cookie = require_cookie();
|
|
27058
27058
|
var send = require_send();
|
|
27059
|
-
var extname3 =
|
|
27059
|
+
var extname3 = path23.extname;
|
|
27060
27060
|
var mime = send.mime;
|
|
27061
|
-
var resolve15 =
|
|
27061
|
+
var resolve15 = path23.resolve;
|
|
27062
27062
|
var vary = require_vary();
|
|
27063
27063
|
var res = Object.create(http3.ServerResponse.prototype);
|
|
27064
27064
|
module2.exports = res;
|
|
@@ -27235,26 +27235,26 @@ var require_response = __commonJS({
|
|
|
27235
27235
|
this.type("txt");
|
|
27236
27236
|
return this.send(body);
|
|
27237
27237
|
};
|
|
27238
|
-
res.sendFile = function sendFile(
|
|
27238
|
+
res.sendFile = function sendFile(path24, options, callback) {
|
|
27239
27239
|
var done = callback;
|
|
27240
27240
|
var req = this.req;
|
|
27241
27241
|
var res2 = this;
|
|
27242
27242
|
var next = req.next;
|
|
27243
27243
|
var opts = options || {};
|
|
27244
|
-
if (!
|
|
27244
|
+
if (!path24) {
|
|
27245
27245
|
throw new TypeError("path argument is required to res.sendFile");
|
|
27246
27246
|
}
|
|
27247
|
-
if (typeof
|
|
27247
|
+
if (typeof path24 !== "string") {
|
|
27248
27248
|
throw new TypeError("path must be a string to res.sendFile");
|
|
27249
27249
|
}
|
|
27250
27250
|
if (typeof options === "function") {
|
|
27251
27251
|
done = options;
|
|
27252
27252
|
opts = {};
|
|
27253
27253
|
}
|
|
27254
|
-
if (!opts.root && !isAbsolute5(
|
|
27254
|
+
if (!opts.root && !isAbsolute5(path24)) {
|
|
27255
27255
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
27256
27256
|
}
|
|
27257
|
-
var pathname = encodeURI(
|
|
27257
|
+
var pathname = encodeURI(path24);
|
|
27258
27258
|
var file = send(req, pathname, opts);
|
|
27259
27259
|
sendfile(res2, file, opts, function(err) {
|
|
27260
27260
|
if (done) return done(err);
|
|
@@ -27264,7 +27264,7 @@ var require_response = __commonJS({
|
|
|
27264
27264
|
}
|
|
27265
27265
|
});
|
|
27266
27266
|
};
|
|
27267
|
-
res.sendfile = function(
|
|
27267
|
+
res.sendfile = function(path24, options, callback) {
|
|
27268
27268
|
var done = callback;
|
|
27269
27269
|
var req = this.req;
|
|
27270
27270
|
var res2 = this;
|
|
@@ -27274,7 +27274,7 @@ var require_response = __commonJS({
|
|
|
27274
27274
|
done = options;
|
|
27275
27275
|
opts = {};
|
|
27276
27276
|
}
|
|
27277
|
-
var file = send(req,
|
|
27277
|
+
var file = send(req, path24, opts);
|
|
27278
27278
|
sendfile(res2, file, opts, function(err) {
|
|
27279
27279
|
if (done) return done(err);
|
|
27280
27280
|
if (err && err.code === "EISDIR") return next();
|
|
@@ -27287,7 +27287,7 @@ var require_response = __commonJS({
|
|
|
27287
27287
|
res.sendfile,
|
|
27288
27288
|
"res.sendfile: Use res.sendFile instead"
|
|
27289
27289
|
);
|
|
27290
|
-
res.download = function download(
|
|
27290
|
+
res.download = function download(path24, filename, options, callback) {
|
|
27291
27291
|
var done = callback;
|
|
27292
27292
|
var name2 = filename;
|
|
27293
27293
|
var opts = options || null;
|
|
@@ -27304,7 +27304,7 @@ var require_response = __commonJS({
|
|
|
27304
27304
|
opts = filename;
|
|
27305
27305
|
}
|
|
27306
27306
|
var headers = {
|
|
27307
|
-
"Content-Disposition": contentDisposition(name2 ||
|
|
27307
|
+
"Content-Disposition": contentDisposition(name2 || path24)
|
|
27308
27308
|
};
|
|
27309
27309
|
if (opts && opts.headers) {
|
|
27310
27310
|
var keys = Object.keys(opts.headers);
|
|
@@ -27317,7 +27317,7 @@ var require_response = __commonJS({
|
|
|
27317
27317
|
}
|
|
27318
27318
|
opts = Object.create(opts);
|
|
27319
27319
|
opts.headers = headers;
|
|
27320
|
-
var fullPath = !opts.root ? resolve15(
|
|
27320
|
+
var fullPath = !opts.root ? resolve15(path24) : path24;
|
|
27321
27321
|
return this.sendFile(fullPath, opts, done);
|
|
27322
27322
|
};
|
|
27323
27323
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -27618,11 +27618,11 @@ var require_serve_static = __commonJS({
|
|
|
27618
27618
|
}
|
|
27619
27619
|
var forwardError = !fallthrough;
|
|
27620
27620
|
var originalUrl = parseUrl.original(req);
|
|
27621
|
-
var
|
|
27622
|
-
if (
|
|
27623
|
-
|
|
27621
|
+
var path23 = parseUrl(req).pathname;
|
|
27622
|
+
if (path23 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
27623
|
+
path23 = "";
|
|
27624
27624
|
}
|
|
27625
|
-
var stream = send(req,
|
|
27625
|
+
var stream = send(req, path23, opts);
|
|
27626
27626
|
stream.on("directory", onDirectory);
|
|
27627
27627
|
if (setHeaders) {
|
|
27628
27628
|
stream.on("headers", setHeaders);
|
|
@@ -32265,11 +32265,11 @@ function persistNodeStartupTransport(storagePath, transport) {
|
|
|
32265
32265
|
transport
|
|
32266
32266
|
});
|
|
32267
32267
|
}
|
|
32268
|
-
function persistNodeStartupJoin(storagePath,
|
|
32268
|
+
function persistNodeStartupJoin(storagePath, join17) {
|
|
32269
32269
|
const startup = resolveNodeStartupMetadata(storagePath);
|
|
32270
32270
|
persistNodeStartupMetadata(storagePath, {
|
|
32271
32271
|
...startup,
|
|
32272
|
-
join:
|
|
32272
|
+
join: join17
|
|
32273
32273
|
});
|
|
32274
32274
|
}
|
|
32275
32275
|
function resolvePersistedDevTunnelId(storagePath, kind) {
|
|
@@ -33266,19 +33266,19 @@ async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_NODE_REQUEST_TIME
|
|
|
33266
33266
|
cleanup();
|
|
33267
33267
|
}
|
|
33268
33268
|
}
|
|
33269
|
-
async function fetchNodeWithFallback(node,
|
|
33269
|
+
async function fetchNodeWithFallback(node, path23, init, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS, trace, options) {
|
|
33270
33270
|
let lastError;
|
|
33271
33271
|
const endpoints = getNodeRequestEndpoints(node, options);
|
|
33272
33272
|
for (const [index, endpoint] of endpoints.entries()) {
|
|
33273
33273
|
const attempt = index + 1;
|
|
33274
|
-
trace?.onAttempt?.({ attempt, endpoint, path:
|
|
33274
|
+
trace?.onAttempt?.({ attempt, endpoint, path: path23, timeoutMs, totalEndpoints: endpoints.length });
|
|
33275
33275
|
try {
|
|
33276
|
-
const response = await fetchWithTimeout(`${endpoint}${
|
|
33277
|
-
trace?.onResponse?.({ attempt, endpoint, path:
|
|
33276
|
+
const response = await fetchWithTimeout(`${endpoint}${path23}`, init, timeoutMs);
|
|
33277
|
+
trace?.onResponse?.({ attempt, endpoint, path: path23, response, timeoutMs, totalEndpoints: endpoints.length });
|
|
33278
33278
|
return { endpoint, response };
|
|
33279
33279
|
} catch (error) {
|
|
33280
33280
|
lastError = error;
|
|
33281
|
-
trace?.onError?.({ attempt, endpoint, error, path:
|
|
33281
|
+
trace?.onError?.({ attempt, endpoint, error, path: path23, timeoutMs, totalEndpoints: endpoints.length });
|
|
33282
33282
|
}
|
|
33283
33283
|
}
|
|
33284
33284
|
throw lastError instanceof Error ? lastError : new Error("No reachable node endpoint");
|
|
@@ -34569,6 +34569,10 @@ var NODE_KIND_BY_LEGACY = {
|
|
|
34569
34569
|
"node-workdir-tree": "node.workdir.tree",
|
|
34570
34570
|
"node-workdir-branch-info": "node.workdir.branch-info",
|
|
34571
34571
|
"node-workdir-branch-create": "node.workdir.branch-create",
|
|
34572
|
+
"node-terminal-session-start": "node.terminal.session.start",
|
|
34573
|
+
"node-terminal-session-list": "node.terminal.session.list",
|
|
34574
|
+
"node-terminal-session-get": "node.terminal.session.get",
|
|
34575
|
+
"node-terminal-session-stop": "node.terminal.session.stop",
|
|
34572
34576
|
"node-sessions-list": "node.sessions.list",
|
|
34573
34577
|
devtunnel: "node.transport.set",
|
|
34574
34578
|
"node-agent-upgrade": "node.agent.upgrade",
|
|
@@ -35337,9 +35341,9 @@ var DataRouter = class {
|
|
|
35337
35341
|
/**
|
|
35338
35342
|
* Returns true if the request should be proxied to the leader.
|
|
35339
35343
|
*/
|
|
35340
|
-
shouldProxy(method,
|
|
35344
|
+
shouldProxy(method, path23) {
|
|
35341
35345
|
if (this.election.isLeader()) return false;
|
|
35342
|
-
if (this.isExcludedPath(
|
|
35346
|
+
if (this.isExcludedPath(path23)) return false;
|
|
35343
35347
|
if (method.toUpperCase() === "GET") return false;
|
|
35344
35348
|
return WRITE_METHODS.has(method.toUpperCase());
|
|
35345
35349
|
}
|
|
@@ -35443,8 +35447,8 @@ var DataRouter = class {
|
|
|
35443
35447
|
};
|
|
35444
35448
|
}
|
|
35445
35449
|
// ── Helpers ───────────────────────────────────────────────────────────
|
|
35446
|
-
isExcludedPath(
|
|
35447
|
-
return EXCLUDED_PATH_PREFIXES.some((prefix) =>
|
|
35450
|
+
isExcludedPath(path23) {
|
|
35451
|
+
return EXCLUDED_PATH_PREFIXES.some((prefix) => path23.startsWith(prefix)) || EXCLUDED_PATH_SUFFIXES.some((suffix) => path23.endsWith(suffix));
|
|
35448
35452
|
}
|
|
35449
35453
|
};
|
|
35450
35454
|
|
|
@@ -37167,7 +37171,6 @@ var LEGACY_FILES = [
|
|
|
37167
37171
|
"nodes.json",
|
|
37168
37172
|
"tasks.json",
|
|
37169
37173
|
"shares.json",
|
|
37170
|
-
"node-operations.json",
|
|
37171
37174
|
"election.json"
|
|
37172
37175
|
];
|
|
37173
37176
|
var LEGACY_DIRS = ["logs", "task-logs"];
|
|
@@ -39272,8 +39275,8 @@ function getErrorMap() {
|
|
|
39272
39275
|
|
|
39273
39276
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
39274
39277
|
var makeIssue = (params) => {
|
|
39275
|
-
const { data, path:
|
|
39276
|
-
const fullPath = [...
|
|
39278
|
+
const { data, path: path23, errorMaps, issueData } = params;
|
|
39279
|
+
const fullPath = [...path23, ...issueData.path || []];
|
|
39277
39280
|
const fullIssue = {
|
|
39278
39281
|
...issueData,
|
|
39279
39282
|
path: fullPath
|
|
@@ -39389,11 +39392,11 @@ var errorUtil;
|
|
|
39389
39392
|
|
|
39390
39393
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
39391
39394
|
var ParseInputLazyPath = class {
|
|
39392
|
-
constructor(parent, value,
|
|
39395
|
+
constructor(parent, value, path23, key) {
|
|
39393
39396
|
this._cachedPath = [];
|
|
39394
39397
|
this.parent = parent;
|
|
39395
39398
|
this.data = value;
|
|
39396
|
-
this._path =
|
|
39399
|
+
this._path = path23;
|
|
39397
39400
|
this._key = key;
|
|
39398
39401
|
}
|
|
39399
39402
|
get path() {
|
|
@@ -43074,7 +43077,7 @@ var NativeSessionSummarySchema = external_exports.object({
|
|
|
43074
43077
|
summary: external_exports.string(),
|
|
43075
43078
|
updatedAt: external_exports.string().nullable()
|
|
43076
43079
|
});
|
|
43077
|
-
var
|
|
43080
|
+
var NodeTerminalSessionStatusSchema = external_exports.enum(["running", "exited", "failed", "stopped"]);
|
|
43078
43081
|
var NodeListQuery = external_exports.object({
|
|
43079
43082
|
status: external_exports.enum(["online", "busy", "offline"]).optional(),
|
|
43080
43083
|
capability: external_exports.string().optional()
|
|
@@ -43108,7 +43111,7 @@ var NodeNativeSessionsQuery = external_exports.object({
|
|
|
43108
43111
|
agent: external_exports.enum(["codex", "claudecode"]),
|
|
43109
43112
|
limit: external_exports.coerce.number().int().min(1).max(100).default(50)
|
|
43110
43113
|
});
|
|
43111
|
-
var
|
|
43114
|
+
var NodeTerminalSessionStartBody = external_exports.object({
|
|
43112
43115
|
command: external_exports.string().trim().min(1),
|
|
43113
43116
|
cwd: external_exports.string().trim().min(1).optional()
|
|
43114
43117
|
});
|
|
@@ -43153,31 +43156,27 @@ var NodeNativeSessionsResponse = external_exports.object({
|
|
|
43153
43156
|
agent: external_exports.enum(["codex", "claudecode"]),
|
|
43154
43157
|
sessions: external_exports.array(NativeSessionSummarySchema)
|
|
43155
43158
|
});
|
|
43156
|
-
var
|
|
43159
|
+
var NodeTerminalSessionResponse = external_exports.object({
|
|
43160
|
+
id: external_exports.string(),
|
|
43157
43161
|
nodeId: external_exports.string(),
|
|
43158
43162
|
cwd: external_exports.string(),
|
|
43159
43163
|
command: external_exports.string(),
|
|
43164
|
+
pid: external_exports.number().int().nullable(),
|
|
43165
|
+
status: NodeTerminalSessionStatusSchema,
|
|
43160
43166
|
exitCode: external_exports.number().int().nullable(),
|
|
43167
|
+
signal: external_exports.string().nullable(),
|
|
43161
43168
|
stdout: external_exports.string(),
|
|
43162
43169
|
stderr: external_exports.string(),
|
|
43170
|
+
startedAt: external_exports.number(),
|
|
43171
|
+
updatedAt: external_exports.number(),
|
|
43172
|
+
completedAt: external_exports.number().optional(),
|
|
43163
43173
|
durationMs: external_exports.number().int().min(0),
|
|
43164
|
-
timedOut: external_exports.boolean(),
|
|
43165
43174
|
stdoutTruncated: external_exports.boolean(),
|
|
43166
43175
|
stderrTruncated: external_exports.boolean()
|
|
43167
43176
|
});
|
|
43168
|
-
var
|
|
43169
|
-
id: external_exports.string(),
|
|
43170
|
-
kind: external_exports.literal("terminal.execute"),
|
|
43177
|
+
var NodeTerminalSessionListResponse = external_exports.object({
|
|
43171
43178
|
nodeId: external_exports.string(),
|
|
43172
|
-
|
|
43173
|
-
status: NodeOperationStatusSchema,
|
|
43174
|
-
payload: NodeTerminalExecuteBody,
|
|
43175
|
-
result: NodeTerminalExecuteResult.optional(),
|
|
43176
|
-
error: external_exports.string().optional(),
|
|
43177
|
-
createdAt: external_exports.number(),
|
|
43178
|
-
updatedAt: external_exports.number(),
|
|
43179
|
-
startedAt: external_exports.number().optional(),
|
|
43180
|
-
completedAt: external_exports.number().optional()
|
|
43179
|
+
sessions: external_exports.array(NodeTerminalSessionResponse)
|
|
43181
43180
|
});
|
|
43182
43181
|
var UpdateNodeBody = external_exports.object({
|
|
43183
43182
|
name: external_exports.string().min(1).optional(),
|
|
@@ -43325,8 +43324,8 @@ var BatchTaskIdsBody = external_exports.object({
|
|
|
43325
43324
|
});
|
|
43326
43325
|
|
|
43327
43326
|
// ../../packages/api/src/app/server.ts
|
|
43328
|
-
var
|
|
43329
|
-
var
|
|
43327
|
+
var path20 = __toESM(require("path"), 1);
|
|
43328
|
+
var fs19 = __toESM(require("fs"), 1);
|
|
43330
43329
|
var import_express14 = __toESM(require_express2(), 1);
|
|
43331
43330
|
|
|
43332
43331
|
// ../../packages/api/src/middleware/auth.ts
|
|
@@ -43463,8 +43462,8 @@ function decodePathSegment(value) {
|
|
|
43463
43462
|
return value;
|
|
43464
43463
|
}
|
|
43465
43464
|
}
|
|
43466
|
-
function getSingleTaskDeleteId(
|
|
43467
|
-
const match = /^\/api\/tasks\/([^/]+)$/.exec(
|
|
43465
|
+
function getSingleTaskDeleteId(path23) {
|
|
43466
|
+
const match = /^\/api\/tasks\/([^/]+)$/.exec(path23);
|
|
43468
43467
|
return match ? decodePathSegment(match[1]) : null;
|
|
43469
43468
|
}
|
|
43470
43469
|
function getSuccessfulBatchDeleteIds(body) {
|
|
@@ -44503,8 +44502,6 @@ function computeParentPath(rootPath, currentPath, useAbsolute) {
|
|
|
44503
44502
|
}
|
|
44504
44503
|
|
|
44505
44504
|
// ../../packages/api/src/node/node-operation-service.ts
|
|
44506
|
-
var fs16 = __toESM(require("fs"), 1);
|
|
44507
|
-
var path18 = __toESM(require("path"), 1);
|
|
44508
44505
|
var import_node_crypto7 = require("crypto");
|
|
44509
44506
|
|
|
44510
44507
|
// ../../packages/api/src/node/agent-upgrade-service.ts
|
|
@@ -44790,96 +44787,8 @@ function upgradeRuntimeAgentForDeps(deps, agent) {
|
|
|
44790
44787
|
return result;
|
|
44791
44788
|
}
|
|
44792
44789
|
|
|
44793
|
-
// ../../packages/api/src/node/node-terminal-service.ts
|
|
44794
|
-
var import_node_child_process10 = require("child_process");
|
|
44795
|
-
var fs15 = __toESM(require("fs"), 1);
|
|
44796
|
-
var path17 = __toESM(require("path"), 1);
|
|
44797
|
-
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
44798
|
-
var DEFAULT_OUTPUT_LIMIT_BYTES = 64 * 1024;
|
|
44799
|
-
function isAbsolutePath2(value) {
|
|
44800
|
-
return path17.isAbsolute(value) || /^[A-Za-z]:[\/]/.test(value);
|
|
44801
|
-
}
|
|
44802
|
-
function resolveCommandCwd(nodeId, rootPath, cwd) {
|
|
44803
|
-
if (!rootPath) {
|
|
44804
|
-
throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
|
|
44805
|
-
}
|
|
44806
|
-
const requestedCwd = cwd?.trim() || ".";
|
|
44807
|
-
const resolved = isAbsolutePath2(requestedCwd) ? path17.resolve(requestedCwd) : path17.resolve(rootPath, requestedCwd);
|
|
44808
|
-
if (!fs15.existsSync(resolved) || !fs15.statSync(resolved).isDirectory()) {
|
|
44809
|
-
throw new MeshyError("VALIDATION_ERROR", `Working directory does not exist: ${resolved}`, 400);
|
|
44810
|
-
}
|
|
44811
|
-
return resolved;
|
|
44812
|
-
}
|
|
44813
|
-
function captureLimited(chunks, chunk, currentBytes, limitBytes) {
|
|
44814
|
-
if (currentBytes >= limitBytes) {
|
|
44815
|
-
return currentBytes + chunk.length;
|
|
44816
|
-
}
|
|
44817
|
-
const remaining = limitBytes - currentBytes;
|
|
44818
|
-
chunks.push(chunk.length <= remaining ? chunk : chunk.subarray(0, remaining));
|
|
44819
|
-
return currentBytes + chunk.length;
|
|
44820
|
-
}
|
|
44821
|
-
function toCapturedOutput(chunks, observedBytes, limitBytes) {
|
|
44822
|
-
return {
|
|
44823
|
-
text: Buffer.concat(chunks).toString("utf8"),
|
|
44824
|
-
truncated: observedBytes > limitBytes
|
|
44825
|
-
};
|
|
44826
|
-
}
|
|
44827
|
-
function executeLocalNodeTerminalCommand(nodeId, rootPath, command, options = {}) {
|
|
44828
|
-
const normalizedCommand = command.trim();
|
|
44829
|
-
if (!normalizedCommand) {
|
|
44830
|
-
throw new MeshyError("VALIDATION_ERROR", "Command must not be empty", 400);
|
|
44831
|
-
}
|
|
44832
|
-
const cwd = resolveCommandCwd(nodeId, rootPath, options.cwd);
|
|
44833
|
-
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
44834
|
-
const outputLimitBytes = options.outputLimitBytes ?? DEFAULT_OUTPUT_LIMIT_BYTES;
|
|
44835
|
-
const startedAt = Date.now();
|
|
44836
|
-
const stdoutChunks = [];
|
|
44837
|
-
const stderrChunks = [];
|
|
44838
|
-
let stdoutBytes = 0;
|
|
44839
|
-
let stderrBytes = 0;
|
|
44840
|
-
let timedOut = false;
|
|
44841
|
-
return new Promise((resolve15, reject) => {
|
|
44842
|
-
const child = (0, import_node_child_process10.spawn)(normalizedCommand, {
|
|
44843
|
-
cwd,
|
|
44844
|
-
shell: true,
|
|
44845
|
-
windowsHide: true,
|
|
44846
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
44847
|
-
});
|
|
44848
|
-
const timeout = setTimeout(() => {
|
|
44849
|
-
timedOut = true;
|
|
44850
|
-
child.kill("SIGTERM");
|
|
44851
|
-
}, timeoutMs);
|
|
44852
|
-
child.stdout?.on("data", (chunk) => {
|
|
44853
|
-
stdoutBytes = captureLimited(stdoutChunks, chunk, stdoutBytes, outputLimitBytes);
|
|
44854
|
-
});
|
|
44855
|
-
child.stderr?.on("data", (chunk) => {
|
|
44856
|
-
stderrBytes = captureLimited(stderrChunks, chunk, stderrBytes, outputLimitBytes);
|
|
44857
|
-
});
|
|
44858
|
-
child.on("error", (err) => {
|
|
44859
|
-
clearTimeout(timeout);
|
|
44860
|
-
reject(new MeshyError("VALIDATION_ERROR", err.message, 400));
|
|
44861
|
-
});
|
|
44862
|
-
child.on("close", (code) => {
|
|
44863
|
-
clearTimeout(timeout);
|
|
44864
|
-
const stdout = toCapturedOutput(stdoutChunks, stdoutBytes, outputLimitBytes);
|
|
44865
|
-
const stderr = toCapturedOutput(stderrChunks, stderrBytes, outputLimitBytes);
|
|
44866
|
-
resolve15({
|
|
44867
|
-
nodeId,
|
|
44868
|
-
cwd,
|
|
44869
|
-
command: normalizedCommand,
|
|
44870
|
-
exitCode: code,
|
|
44871
|
-
stdout: stdout.text,
|
|
44872
|
-
stderr: stderr.text,
|
|
44873
|
-
durationMs: Date.now() - startedAt,
|
|
44874
|
-
timedOut,
|
|
44875
|
-
stdoutTruncated: stdout.truncated,
|
|
44876
|
-
stderrTruncated: stderr.truncated
|
|
44877
|
-
});
|
|
44878
|
-
});
|
|
44879
|
-
});
|
|
44880
|
-
}
|
|
44881
|
-
|
|
44882
44790
|
// ../../packages/api/src/node/node-operation-service.ts
|
|
44791
|
+
var LEADER_REPORT_RETRY_MS = 5e3;
|
|
44883
44792
|
var NodeOperationFailure = class extends Error {
|
|
44884
44793
|
constructor(message, result) {
|
|
44885
44794
|
super(message);
|
|
@@ -44908,69 +44817,15 @@ var InMemoryNodeOperationStore = class {
|
|
|
44908
44817
|
return clone2(next);
|
|
44909
44818
|
}
|
|
44910
44819
|
};
|
|
44911
|
-
var FileNodeOperationStore = class {
|
|
44912
|
-
constructor(storagePath) {
|
|
44913
|
-
this.storagePath = storagePath;
|
|
44914
|
-
}
|
|
44915
|
-
operations = /* @__PURE__ */ new Map();
|
|
44916
|
-
loaded = false;
|
|
44917
|
-
get(id) {
|
|
44918
|
-
this.load();
|
|
44919
|
-
const operation = this.operations.get(id);
|
|
44920
|
-
return operation ? clone2(operation) : null;
|
|
44921
|
-
}
|
|
44922
|
-
list(filter = {}) {
|
|
44923
|
-
this.load();
|
|
44924
|
-
return Array.from(this.operations.values()).filter((operation) => matchesFilter(operation, filter)).sort((a, b) => b.createdAt - a.createdAt).map((operation) => clone2(operation));
|
|
44925
|
-
}
|
|
44926
|
-
upsert(operation) {
|
|
44927
|
-
this.load();
|
|
44928
|
-
const copy = clone2(operation);
|
|
44929
|
-
this.operations.set(copy.id, copy);
|
|
44930
|
-
this.persist();
|
|
44931
|
-
return clone2(copy);
|
|
44932
|
-
}
|
|
44933
|
-
update(id, updates) {
|
|
44934
|
-
this.load();
|
|
44935
|
-
const current = this.operations.get(id);
|
|
44936
|
-
if (!current) return null;
|
|
44937
|
-
const next = { ...current, ...clone2(updates), id, createdAt: current.createdAt };
|
|
44938
|
-
this.operations.set(id, next);
|
|
44939
|
-
this.persist();
|
|
44940
|
-
return clone2(next);
|
|
44941
|
-
}
|
|
44942
|
-
load() {
|
|
44943
|
-
if (this.loaded) return;
|
|
44944
|
-
this.loaded = true;
|
|
44945
|
-
if (!fs16.existsSync(this.filePath)) return;
|
|
44946
|
-
const raw = JSON.parse(fs16.readFileSync(this.filePath, "utf-8"));
|
|
44947
|
-
const entries = Array.isArray(raw) ? raw : Object.values(raw);
|
|
44948
|
-
for (const entry of entries) {
|
|
44949
|
-
if (isNodeOperation(entry)) {
|
|
44950
|
-
this.operations.set(entry.id, clone2(entry));
|
|
44951
|
-
}
|
|
44952
|
-
}
|
|
44953
|
-
}
|
|
44954
|
-
persist() {
|
|
44955
|
-
fs16.mkdirSync(this.storagePath, { recursive: true });
|
|
44956
|
-
const body = JSON.stringify(Object.fromEntries(this.operations), null, 2);
|
|
44957
|
-
const tmpPath = `${this.filePath}.tmp`;
|
|
44958
|
-
fs16.writeFileSync(tmpPath, body, "utf-8");
|
|
44959
|
-
fs16.renameSync(tmpPath, this.filePath);
|
|
44960
|
-
}
|
|
44961
|
-
get filePath() {
|
|
44962
|
-
return path18.join(this.storagePath, "node-operations.json");
|
|
44963
|
-
}
|
|
44964
|
-
};
|
|
44965
44820
|
var NodeOperationService = class {
|
|
44966
44821
|
constructor(deps, store) {
|
|
44967
44822
|
this.deps = deps;
|
|
44968
44823
|
this.store = store;
|
|
44969
44824
|
this.registerHandler("agent.upgrade", runAgentUpgradeOperation);
|
|
44970
|
-
this.registerHandler("terminal.execute", runTerminalExecuteOperation);
|
|
44971
44825
|
this.registerHandler("workdir.branch-create", runWorkDirBranchCreateOperation);
|
|
44972
44826
|
}
|
|
44973
44827
|
handlers = /* @__PURE__ */ new Map();
|
|
44828
|
+
leaderReportRetryTimers = /* @__PURE__ */ new Map();
|
|
44974
44829
|
registerHandler(kind, handler) {
|
|
44975
44830
|
this.handlers.set(kind, handler);
|
|
44976
44831
|
}
|
|
@@ -45066,25 +44921,46 @@ var NodeOperationService = class {
|
|
|
45066
44921
|
async reportToLeader(operation) {
|
|
45067
44922
|
if (this.deps.nodeRegistry.isLeader()) return;
|
|
45068
44923
|
const leaderEndpoint = this.deps.nodeRegistry.getLeaderEndpoint?.();
|
|
45069
|
-
if (!leaderEndpoint)
|
|
44924
|
+
if (!leaderEndpoint) {
|
|
44925
|
+
this.scheduleLeaderReportRetry(operation);
|
|
44926
|
+
return;
|
|
44927
|
+
}
|
|
45070
44928
|
try {
|
|
45071
|
-
await fetch(`${leaderEndpoint}/api/worker/node-operations/${operation.id}`, applyRequestAuthHeaders({
|
|
44929
|
+
const response = await fetch(`${leaderEndpoint}/api/worker/node-operations/${operation.id}`, applyRequestAuthHeaders({
|
|
45072
44930
|
method: "POST",
|
|
45073
44931
|
headers: { "Content-Type": "application/json" },
|
|
45074
44932
|
body: JSON.stringify(operation)
|
|
45075
44933
|
}));
|
|
44934
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
44935
|
+
this.clearLeaderReportRetry(operation.id);
|
|
45076
44936
|
} catch (err) {
|
|
45077
44937
|
this.deps.logger.child("node-operation").warn("failed to report node operation update to leader", {
|
|
45078
44938
|
operationId: operation.id,
|
|
45079
44939
|
kind: operation.kind,
|
|
44940
|
+
status: operation.status,
|
|
45080
44941
|
error: err instanceof Error ? err.message : String(err)
|
|
45081
44942
|
});
|
|
44943
|
+
this.scheduleLeaderReportRetry(operation);
|
|
45082
44944
|
}
|
|
45083
44945
|
}
|
|
44946
|
+
scheduleLeaderReportRetry(operation) {
|
|
44947
|
+
if (!isTerminalStatus(operation.status) || this.leaderReportRetryTimers.has(operation.id)) return;
|
|
44948
|
+
const timer = setTimeout(() => {
|
|
44949
|
+
this.leaderReportRetryTimers.delete(operation.id);
|
|
44950
|
+
void this.reportToLeader(operation);
|
|
44951
|
+
}, LEADER_REPORT_RETRY_MS);
|
|
44952
|
+
this.leaderReportRetryTimers.set(operation.id, timer);
|
|
44953
|
+
}
|
|
44954
|
+
clearLeaderReportRetry(id) {
|
|
44955
|
+
const timer = this.leaderReportRetryTimers.get(id);
|
|
44956
|
+
if (!timer) return;
|
|
44957
|
+
clearTimeout(timer);
|
|
44958
|
+
this.leaderReportRetryTimers.delete(id);
|
|
44959
|
+
}
|
|
45084
44960
|
};
|
|
45085
44961
|
function getNodeOperationService(deps) {
|
|
45086
44962
|
if (deps.nodeOperationService) return deps.nodeOperationService;
|
|
45087
|
-
const store = deps.nodeOperationStore ??
|
|
44963
|
+
const store = deps.nodeOperationStore ?? new InMemoryNodeOperationStore();
|
|
45088
44964
|
const service = new NodeOperationService(deps, store);
|
|
45089
44965
|
deps.nodeOperationStore = store;
|
|
45090
44966
|
deps.nodeOperationService = service;
|
|
@@ -45113,15 +44989,6 @@ function runAgentUpgradeOperation(operation, deps) {
|
|
|
45113
44989
|
}
|
|
45114
44990
|
return result;
|
|
45115
44991
|
}
|
|
45116
|
-
async function runTerminalExecuteOperation(operation, deps) {
|
|
45117
|
-
const self2 = deps.nodeRegistry.getSelf();
|
|
45118
|
-
return executeLocalNodeTerminalCommand(
|
|
45119
|
-
self2.id,
|
|
45120
|
-
self2.workDir ?? deps.workDir,
|
|
45121
|
-
readPayloadString(operation, "command"),
|
|
45122
|
-
{ cwd: readPayloadString(operation, "cwd") || void 0 }
|
|
45123
|
-
);
|
|
45124
|
-
}
|
|
45125
44992
|
function runWorkDirBranchCreateOperation(operation, deps) {
|
|
45126
44993
|
const self2 = deps.nodeRegistry.getSelf();
|
|
45127
44994
|
return createLocalNodeWorkDirBranch(
|
|
@@ -45163,10 +45030,8 @@ function readSettingsSnapshot(value) {
|
|
|
45163
45030
|
function matchesFilter(operation, filter) {
|
|
45164
45031
|
return (!filter.nodeId || operation.nodeId === filter.nodeId) && (!filter.status || operation.status === filter.status) && (!filter.kind || operation.kind === filter.kind);
|
|
45165
45032
|
}
|
|
45166
|
-
function
|
|
45167
|
-
|
|
45168
|
-
const record = value;
|
|
45169
|
-
return typeof record.id === "string" && typeof record.kind === "string" && typeof record.nodeId === "string" && typeof record.status === "string" && typeof record.createdAt === "number" && typeof record.updatedAt === "number";
|
|
45033
|
+
function isTerminalStatus(status) {
|
|
45034
|
+
return status === "succeeded" || status === "failed";
|
|
45170
45035
|
}
|
|
45171
45036
|
function clone2(value) {
|
|
45172
45037
|
return JSON.parse(JSON.stringify(value));
|
|
@@ -45279,7 +45144,7 @@ async function sendNodeWorkDirBranchCreateOperation(req, res, nodeId) {
|
|
|
45279
45144
|
}
|
|
45280
45145
|
|
|
45281
45146
|
// ../../packages/api/src/tasks/task-route-utils.ts
|
|
45282
|
-
var
|
|
45147
|
+
var fs15 = __toESM(require("fs"), 1);
|
|
45283
45148
|
var import_node_stream2 = require("stream");
|
|
45284
45149
|
var import_promises5 = require("stream/promises");
|
|
45285
45150
|
|
|
@@ -45288,7 +45153,10 @@ var LEGACY_KIND_BY_NODE_MESSAGE = {
|
|
|
45288
45153
|
"node.workdir.tree": "node-workdir-tree",
|
|
45289
45154
|
"node.workdir.branch-info": "node-workdir-branch-info",
|
|
45290
45155
|
"node.workdir.branch-create": "node-workdir-branch-create",
|
|
45291
|
-
"node.terminal.
|
|
45156
|
+
"node.terminal.session.start": "node-terminal-session-start",
|
|
45157
|
+
"node.terminal.session.list": "node-terminal-session-list",
|
|
45158
|
+
"node.terminal.session.get": "node-terminal-session-get",
|
|
45159
|
+
"node.terminal.session.stop": "node-terminal-session-stop",
|
|
45292
45160
|
"node.sessions.list": "node-sessions-list",
|
|
45293
45161
|
"node.transport.set": "devtunnel",
|
|
45294
45162
|
"node.agent.upgrade": "node-agent-upgrade",
|
|
@@ -45304,9 +45172,13 @@ var LEGACY_KIND_BY_NODE_MESSAGE = {
|
|
|
45304
45172
|
function canRequestNodeMessage(heartbeat) {
|
|
45305
45173
|
return !!(heartbeat?.requestNodeMessage || heartbeat?.requestWorkerControl);
|
|
45306
45174
|
}
|
|
45307
|
-
function requestFallbackNodeMessage(heartbeat, nodeId, message) {
|
|
45308
|
-
if (heartbeat.requestNodeMessage)
|
|
45309
|
-
|
|
45175
|
+
function requestFallbackNodeMessage(heartbeat, nodeId, message, timeoutMs) {
|
|
45176
|
+
if (heartbeat.requestNodeMessage) {
|
|
45177
|
+
return timeoutMs === void 0 ? heartbeat.requestNodeMessage(nodeId, message) : heartbeat.requestNodeMessage(nodeId, message, timeoutMs);
|
|
45178
|
+
}
|
|
45179
|
+
if (heartbeat.requestWorkerControl) {
|
|
45180
|
+
return timeoutMs === void 0 ? heartbeat.requestWorkerControl(nodeId, toLegacyWorkerControl2(message)) : heartbeat.requestWorkerControl(nodeId, toLegacyWorkerControl2(message), timeoutMs);
|
|
45181
|
+
}
|
|
45310
45182
|
throw new Error("Node message fallback is not available");
|
|
45311
45183
|
}
|
|
45312
45184
|
function toLegacyWorkerControl2(message) {
|
|
@@ -45334,10 +45206,10 @@ function readLocalTaskLogs(engineRegistry, taskId, after, agent) {
|
|
|
45334
45206
|
throw new MeshyError("VALIDATION_ERROR", `Engine not registered for agent: ${agent}`, 400);
|
|
45335
45207
|
}
|
|
45336
45208
|
const logPath = engine.getLogPath(taskId);
|
|
45337
|
-
if (!
|
|
45209
|
+
if (!fs15.existsSync(logPath)) {
|
|
45338
45210
|
return { logs: [], total: 0 };
|
|
45339
45211
|
}
|
|
45340
|
-
const content =
|
|
45212
|
+
const content = fs15.readFileSync(logPath, "utf-8");
|
|
45341
45213
|
const allLines = content.trim().split("\n").filter(Boolean);
|
|
45342
45214
|
const logs = [];
|
|
45343
45215
|
for (let i = after; i < allLines.length; i++) {
|
|
@@ -45567,6 +45439,193 @@ async function maybeProxyReadToLeader(req, res, options = {}) {
|
|
|
45567
45439
|
}
|
|
45568
45440
|
}
|
|
45569
45441
|
|
|
45442
|
+
// ../../packages/api/src/node/node-terminal-session-service.ts
|
|
45443
|
+
var import_node_child_process10 = require("child_process");
|
|
45444
|
+
var import_node_crypto8 = require("crypto");
|
|
45445
|
+
|
|
45446
|
+
// ../../packages/api/src/node/node-terminal-service.ts
|
|
45447
|
+
var fs16 = __toESM(require("fs"), 1);
|
|
45448
|
+
var path17 = __toESM(require("path"), 1);
|
|
45449
|
+
var DEFAULT_OUTPUT_LIMIT_BYTES = 64 * 1024;
|
|
45450
|
+
function isAbsolutePath2(value) {
|
|
45451
|
+
return path17.isAbsolute(value) || /^[A-Za-z]:[\/]/.test(value);
|
|
45452
|
+
}
|
|
45453
|
+
function resolveNodeTerminalCwd(nodeId, rootPath, cwd) {
|
|
45454
|
+
if (!rootPath) {
|
|
45455
|
+
throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
|
|
45456
|
+
}
|
|
45457
|
+
const requestedCwd = cwd?.trim() || ".";
|
|
45458
|
+
const resolved = isAbsolutePath2(requestedCwd) ? path17.resolve(requestedCwd) : path17.resolve(rootPath, requestedCwd);
|
|
45459
|
+
if (!fs16.existsSync(resolved) || !fs16.statSync(resolved).isDirectory()) {
|
|
45460
|
+
throw new MeshyError("VALIDATION_ERROR", `Working directory does not exist: ${resolved}`, 400);
|
|
45461
|
+
}
|
|
45462
|
+
return resolved;
|
|
45463
|
+
}
|
|
45464
|
+
|
|
45465
|
+
// ../../packages/api/src/node/node-terminal-session-service.ts
|
|
45466
|
+
var MAX_COMPLETED_SESSIONS = 10;
|
|
45467
|
+
function createOutputBuffer() {
|
|
45468
|
+
return { chunks: [], bytes: 0, observedBytes: 0 };
|
|
45469
|
+
}
|
|
45470
|
+
function appendTail(buffer, chunk, limitBytes) {
|
|
45471
|
+
buffer.observedBytes += chunk.length;
|
|
45472
|
+
const nextChunk = chunk.length > limitBytes ? chunk.subarray(chunk.length - limitBytes) : chunk;
|
|
45473
|
+
buffer.chunks.push(nextChunk);
|
|
45474
|
+
buffer.bytes += nextChunk.length;
|
|
45475
|
+
while (buffer.bytes > limitBytes && buffer.chunks.length > 0) {
|
|
45476
|
+
const first = buffer.chunks[0];
|
|
45477
|
+
if (!first) break;
|
|
45478
|
+
const overflow = buffer.bytes - limitBytes;
|
|
45479
|
+
if (first.length <= overflow) {
|
|
45480
|
+
buffer.chunks.shift();
|
|
45481
|
+
buffer.bytes -= first.length;
|
|
45482
|
+
continue;
|
|
45483
|
+
}
|
|
45484
|
+
buffer.chunks[0] = first.subarray(overflow);
|
|
45485
|
+
buffer.bytes -= overflow;
|
|
45486
|
+
}
|
|
45487
|
+
}
|
|
45488
|
+
function readBuffer(buffer, limitBytes) {
|
|
45489
|
+
return {
|
|
45490
|
+
text: Buffer.concat(buffer.chunks, buffer.bytes).toString("utf8"),
|
|
45491
|
+
truncated: buffer.observedBytes > limitBytes
|
|
45492
|
+
};
|
|
45493
|
+
}
|
|
45494
|
+
function cloneSession(session) {
|
|
45495
|
+
return { ...session };
|
|
45496
|
+
}
|
|
45497
|
+
function killSessionProcess(state3, signal) {
|
|
45498
|
+
const child = state3.process;
|
|
45499
|
+
if (!child) return;
|
|
45500
|
+
const pid = child.pid;
|
|
45501
|
+
if (process.platform !== "win32" && typeof pid === "number") {
|
|
45502
|
+
try {
|
|
45503
|
+
process.kill(-pid, signal);
|
|
45504
|
+
return;
|
|
45505
|
+
} catch {
|
|
45506
|
+
}
|
|
45507
|
+
}
|
|
45508
|
+
try {
|
|
45509
|
+
child.kill(signal);
|
|
45510
|
+
} catch {
|
|
45511
|
+
}
|
|
45512
|
+
}
|
|
45513
|
+
var NodeTerminalSessionService = class {
|
|
45514
|
+
sessions = /* @__PURE__ */ new Map();
|
|
45515
|
+
nextSequence = 0;
|
|
45516
|
+
start(nodeId, rootPath, command, options = {}) {
|
|
45517
|
+
const normalizedCommand = command.trim();
|
|
45518
|
+
if (!normalizedCommand) {
|
|
45519
|
+
throw new MeshyError("VALIDATION_ERROR", "Command must not be empty", 400);
|
|
45520
|
+
}
|
|
45521
|
+
const cwd = resolveNodeTerminalCwd(nodeId, rootPath, options.cwd);
|
|
45522
|
+
const startedAt = Date.now();
|
|
45523
|
+
const child = (0, import_node_child_process10.spawn)(normalizedCommand, {
|
|
45524
|
+
cwd,
|
|
45525
|
+
shell: true,
|
|
45526
|
+
windowsHide: true,
|
|
45527
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
45528
|
+
detached: process.platform !== "win32"
|
|
45529
|
+
});
|
|
45530
|
+
const session = {
|
|
45531
|
+
id: (0, import_node_crypto8.randomUUID)(),
|
|
45532
|
+
nodeId,
|
|
45533
|
+
cwd,
|
|
45534
|
+
command: normalizedCommand,
|
|
45535
|
+
pid: child.pid ?? null,
|
|
45536
|
+
status: "running",
|
|
45537
|
+
exitCode: null,
|
|
45538
|
+
signal: null,
|
|
45539
|
+
stdout: "",
|
|
45540
|
+
stderr: "",
|
|
45541
|
+
startedAt,
|
|
45542
|
+
updatedAt: startedAt,
|
|
45543
|
+
durationMs: 0,
|
|
45544
|
+
stdoutTruncated: false,
|
|
45545
|
+
stderrTruncated: false
|
|
45546
|
+
};
|
|
45547
|
+
const state3 = {
|
|
45548
|
+
session,
|
|
45549
|
+
process: child,
|
|
45550
|
+
stdout: createOutputBuffer(),
|
|
45551
|
+
stderr: createOutputBuffer(),
|
|
45552
|
+
sequence: this.nextSequence++
|
|
45553
|
+
};
|
|
45554
|
+
const outputLimitBytes = options.outputLimitBytes ?? DEFAULT_OUTPUT_LIMIT_BYTES;
|
|
45555
|
+
this.sessions.set(session.id, state3);
|
|
45556
|
+
child.stdout?.on("data", (chunk) => {
|
|
45557
|
+
appendTail(state3.stdout, chunk, outputLimitBytes);
|
|
45558
|
+
this.refreshOutput(state3, outputLimitBytes);
|
|
45559
|
+
});
|
|
45560
|
+
child.stderr?.on("data", (chunk) => {
|
|
45561
|
+
if (state3.session.status === "stopped") return;
|
|
45562
|
+
appendTail(state3.stderr, chunk, outputLimitBytes);
|
|
45563
|
+
this.refreshOutput(state3, outputLimitBytes);
|
|
45564
|
+
});
|
|
45565
|
+
child.on("error", (err) => {
|
|
45566
|
+
state3.session.status = "failed";
|
|
45567
|
+
state3.session.stderr = state3.session.stderr ? `${state3.session.stderr}
|
|
45568
|
+
${err.message}` : err.message;
|
|
45569
|
+
this.complete(state3, null, null, outputLimitBytes);
|
|
45570
|
+
});
|
|
45571
|
+
child.on("close", (code, signal) => {
|
|
45572
|
+
if (state3.session.status !== "stopped") {
|
|
45573
|
+
state3.session.status = code === 0 ? "exited" : "failed";
|
|
45574
|
+
}
|
|
45575
|
+
this.complete(state3, code, signal, outputLimitBytes);
|
|
45576
|
+
});
|
|
45577
|
+
return cloneSession(session);
|
|
45578
|
+
}
|
|
45579
|
+
list() {
|
|
45580
|
+
return Array.from(this.sessions.values()).sort((a, b) => b.sequence - a.sequence).map((state3) => cloneSession(state3.session));
|
|
45581
|
+
}
|
|
45582
|
+
get(id) {
|
|
45583
|
+
const state3 = this.sessions.get(id);
|
|
45584
|
+
return state3 ? cloneSession(state3.session) : null;
|
|
45585
|
+
}
|
|
45586
|
+
stop(id) {
|
|
45587
|
+
const state3 = this.sessions.get(id);
|
|
45588
|
+
if (!state3) return null;
|
|
45589
|
+
if (state3.session.status === "running") {
|
|
45590
|
+
state3.session.status = "stopped";
|
|
45591
|
+
state3.session.updatedAt = Date.now();
|
|
45592
|
+
killSessionProcess(state3, "SIGTERM");
|
|
45593
|
+
setTimeout(() => {
|
|
45594
|
+
if (state3.session.status === "stopped" && !state3.session.completedAt) {
|
|
45595
|
+
killSessionProcess(state3, "SIGKILL");
|
|
45596
|
+
}
|
|
45597
|
+
}, 2e3).unref?.();
|
|
45598
|
+
}
|
|
45599
|
+
return cloneSession(state3.session);
|
|
45600
|
+
}
|
|
45601
|
+
refreshOutput(state3, outputLimitBytes) {
|
|
45602
|
+
const stdout = readBuffer(state3.stdout, outputLimitBytes);
|
|
45603
|
+
const stderr = readBuffer(state3.stderr, outputLimitBytes);
|
|
45604
|
+
state3.session.stdout = stdout.text;
|
|
45605
|
+
state3.session.stderr = stderr.text;
|
|
45606
|
+
state3.session.stdoutTruncated = stdout.truncated;
|
|
45607
|
+
state3.session.stderrTruncated = stderr.truncated;
|
|
45608
|
+
state3.session.updatedAt = Date.now();
|
|
45609
|
+
state3.session.durationMs = state3.session.updatedAt - state3.session.startedAt;
|
|
45610
|
+
}
|
|
45611
|
+
complete(state3, exitCode, signal, outputLimitBytes) {
|
|
45612
|
+
this.refreshOutput(state3, outputLimitBytes);
|
|
45613
|
+
state3.session.exitCode = exitCode;
|
|
45614
|
+
state3.session.signal = signal;
|
|
45615
|
+
state3.session.completedAt = Date.now();
|
|
45616
|
+
state3.session.updatedAt = state3.session.completedAt;
|
|
45617
|
+
state3.session.durationMs = state3.session.completedAt - state3.session.startedAt;
|
|
45618
|
+
state3.process = null;
|
|
45619
|
+
this.pruneCompletedSessions();
|
|
45620
|
+
}
|
|
45621
|
+
pruneCompletedSessions() {
|
|
45622
|
+
const completed = Array.from(this.sessions.values()).filter((state3) => state3.session.status !== "running").sort((a, b) => b.sequence - a.sequence);
|
|
45623
|
+
for (const state3 of completed.slice(MAX_COMPLETED_SESSIONS)) {
|
|
45624
|
+
this.sessions.delete(state3.session.id);
|
|
45625
|
+
}
|
|
45626
|
+
}
|
|
45627
|
+
};
|
|
45628
|
+
|
|
45570
45629
|
// ../../packages/api/src/node/node-native-session-service.ts
|
|
45571
45630
|
function getLocalNodeNativeSessions(nodeId, agent, limit) {
|
|
45572
45631
|
return {
|
|
@@ -45636,13 +45695,13 @@ function cancelTaskOnCurrentNode(deps, taskId, options = {}) {
|
|
|
45636
45695
|
}
|
|
45637
45696
|
|
|
45638
45697
|
// ../../packages/api/src/tasks/task-output-service.ts
|
|
45639
|
-
var
|
|
45640
|
-
var
|
|
45698
|
+
var fs18 = __toESM(require("fs"), 1);
|
|
45699
|
+
var path19 = __toESM(require("path"), 1);
|
|
45641
45700
|
|
|
45642
45701
|
// ../../packages/api/src/preview/preview-server.ts
|
|
45643
45702
|
var crypto3 = __toESM(require("crypto"), 1);
|
|
45644
|
-
var
|
|
45645
|
-
var
|
|
45703
|
+
var fs17 = __toESM(require("fs"), 1);
|
|
45704
|
+
var path18 = __toESM(require("path"), 1);
|
|
45646
45705
|
var http2 = __toESM(require("http"), 1);
|
|
45647
45706
|
var import_node_stream3 = require("stream");
|
|
45648
45707
|
var import_promises6 = require("stream/promises");
|
|
@@ -45754,19 +45813,19 @@ function buildPreviewWorkerProxyHeaders(req) {
|
|
|
45754
45813
|
// ../../packages/api/src/preview/preview-server.ts
|
|
45755
45814
|
function resolvePreviewPath(rootPath, relativePath) {
|
|
45756
45815
|
const sanitizedPath = relativePath.replace(/\\/g, "/");
|
|
45757
|
-
const resolvedPath =
|
|
45758
|
-
const normalizedRoot =
|
|
45759
|
-
if (!resolvedPath.startsWith(normalizedRoot +
|
|
45816
|
+
const resolvedPath = path18.resolve(rootPath, sanitizedPath);
|
|
45817
|
+
const normalizedRoot = path18.resolve(rootPath);
|
|
45818
|
+
if (!resolvedPath.startsWith(normalizedRoot + path18.sep) && resolvedPath !== normalizedRoot) {
|
|
45760
45819
|
throw new Error("Invalid preview path");
|
|
45761
45820
|
}
|
|
45762
45821
|
return {
|
|
45763
45822
|
absolutePath: resolvedPath,
|
|
45764
|
-
normalizedPath:
|
|
45823
|
+
normalizedPath: path18.relative(normalizedRoot, resolvedPath).split(path18.sep).join("/")
|
|
45765
45824
|
};
|
|
45766
45825
|
}
|
|
45767
45826
|
function resolvePreviewEntryPath(rootPath, entryPath) {
|
|
45768
45827
|
const { absolutePath, normalizedPath } = resolvePreviewPath(rootPath, entryPath ?? "index.html");
|
|
45769
|
-
if (!
|
|
45828
|
+
if (!fs17.existsSync(absolutePath) || !fs17.statSync(absolutePath).isFile()) {
|
|
45770
45829
|
throw new Error("Preview entry not found");
|
|
45771
45830
|
}
|
|
45772
45831
|
return normalizedPath;
|
|
@@ -45868,7 +45927,7 @@ var MIME_MAP2 = {
|
|
|
45868
45927
|
".mdx": "text/markdown"
|
|
45869
45928
|
};
|
|
45870
45929
|
function getMime(filePath) {
|
|
45871
|
-
return MIME_MAP2[
|
|
45930
|
+
return MIME_MAP2[path18.extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
45872
45931
|
}
|
|
45873
45932
|
function escapeHtml(value) {
|
|
45874
45933
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -46222,14 +46281,14 @@ async function sendPreviewAssetResponse(sessionManager, token, requestedPath, re
|
|
|
46222
46281
|
res.end("Invalid path");
|
|
46223
46282
|
return;
|
|
46224
46283
|
}
|
|
46225
|
-
if (!
|
|
46284
|
+
if (!fs17.existsSync(resolved) || !fs17.statSync(resolved).isFile()) {
|
|
46226
46285
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
46227
46286
|
res.end("File not found");
|
|
46228
46287
|
return;
|
|
46229
46288
|
}
|
|
46230
|
-
const ext =
|
|
46289
|
+
const ext = path18.extname(resolved).toLowerCase();
|
|
46231
46290
|
const mime = ext === ".md" || ext === ".mdx" ? "text/html" : getMime(resolved);
|
|
46232
|
-
const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(
|
|
46291
|
+
const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(fs17.readFileSync(resolved, "utf8"), path18.basename(resolved)) : fs17.readFileSync(resolved);
|
|
46233
46292
|
res.writeHead(200, {
|
|
46234
46293
|
"Content-Type": mime,
|
|
46235
46294
|
"Content-Length": content.length,
|
|
@@ -46551,13 +46610,13 @@ function getLocalTaskOutputDownload(taskEngine, taskId, filePath) {
|
|
|
46551
46610
|
const rootPath = getTaskOutputRoot(taskEngine, taskId);
|
|
46552
46611
|
try {
|
|
46553
46612
|
const absolutePath = resolveOutputPath(rootPath, filePath);
|
|
46554
|
-
if (!
|
|
46613
|
+
if (!fs18.existsSync(absolutePath) || !fs18.statSync(absolutePath).isFile()) {
|
|
46555
46614
|
throw new MeshyError("TASK_NOT_FOUND", `File not found: ${filePath}`, 404);
|
|
46556
46615
|
}
|
|
46557
46616
|
const { mimeType } = classifyFile(absolutePath);
|
|
46558
|
-
const fileName =
|
|
46617
|
+
const fileName = path19.basename(absolutePath).replace(/"/g, "");
|
|
46559
46618
|
return {
|
|
46560
|
-
content:
|
|
46619
|
+
content: fs18.readFileSync(absolutePath),
|
|
46561
46620
|
headers: {
|
|
46562
46621
|
"Content-Type": mimeType,
|
|
46563
46622
|
"Content-Disposition": `inline; filename="${fileName}"`,
|
|
@@ -46651,6 +46710,10 @@ function payloadValue(request, key, fallback) {
|
|
|
46651
46710
|
const value = request.payload[key];
|
|
46652
46711
|
return value === void 0 ? fallback : value;
|
|
46653
46712
|
}
|
|
46713
|
+
function getTerminalSessionService(deps) {
|
|
46714
|
+
deps.terminalSessionService ??= new NodeTerminalSessionService();
|
|
46715
|
+
return deps.terminalSessionService;
|
|
46716
|
+
}
|
|
46654
46717
|
function maybeImportTaskSnapshot(deps, request) {
|
|
46655
46718
|
if (!request.kind.startsWith("task.output.") && request.kind !== "task.preview.create" && request.kind !== "task.logs") return;
|
|
46656
46719
|
const task = payloadValue(request, "task", null);
|
|
@@ -46728,12 +46791,12 @@ async function executeWorkerControlRequest(deps, request) {
|
|
|
46728
46791
|
);
|
|
46729
46792
|
break;
|
|
46730
46793
|
}
|
|
46731
|
-
case "node.terminal.
|
|
46794
|
+
case "node.terminal.session.start": {
|
|
46732
46795
|
const self2 = deps.nodeRegistry.getSelf();
|
|
46733
46796
|
response = jsonResponse(
|
|
46734
46797
|
request.id,
|
|
46735
|
-
|
|
46736
|
-
|
|
46798
|
+
202,
|
|
46799
|
+
getTerminalSessionService(deps).start(
|
|
46737
46800
|
self2.id,
|
|
46738
46801
|
self2.workDir ?? deps.workDir,
|
|
46739
46802
|
payloadValue(request, "command", ""),
|
|
@@ -46742,6 +46805,28 @@ async function executeWorkerControlRequest(deps, request) {
|
|
|
46742
46805
|
);
|
|
46743
46806
|
break;
|
|
46744
46807
|
}
|
|
46808
|
+
case "node.terminal.session.list": {
|
|
46809
|
+
const self2 = deps.nodeRegistry.getSelf();
|
|
46810
|
+
response = jsonResponse(request.id, 200, {
|
|
46811
|
+
nodeId: self2.id,
|
|
46812
|
+
sessions: getTerminalSessionService(deps).list()
|
|
46813
|
+
});
|
|
46814
|
+
break;
|
|
46815
|
+
}
|
|
46816
|
+
case "node.terminal.session.get": {
|
|
46817
|
+
const sessionId = payloadValue(request, "sessionId", "");
|
|
46818
|
+
const session = getTerminalSessionService(deps).get(sessionId);
|
|
46819
|
+
if (!session) throw new MeshyError("NODE_NOT_FOUND", `Terminal session ${sessionId} not found`, 404);
|
|
46820
|
+
response = jsonResponse(request.id, 200, session);
|
|
46821
|
+
break;
|
|
46822
|
+
}
|
|
46823
|
+
case "node.terminal.session.stop": {
|
|
46824
|
+
const sessionId = payloadValue(request, "sessionId", "");
|
|
46825
|
+
const session = getTerminalSessionService(deps).stop(sessionId);
|
|
46826
|
+
if (!session) throw new MeshyError("NODE_NOT_FOUND", `Terminal session ${sessionId} not found`, 404);
|
|
46827
|
+
response = jsonResponse(request.id, 200, session);
|
|
46828
|
+
break;
|
|
46829
|
+
}
|
|
46745
46830
|
case "node.sessions.list": {
|
|
46746
46831
|
const self2 = deps.nodeRegistry.getSelf();
|
|
46747
46832
|
response = jsonResponse(
|
|
@@ -46990,28 +47075,82 @@ async function sendNodeAgentUpgrade(req, res, nodeId, agentParam) {
|
|
|
46990
47075
|
}
|
|
46991
47076
|
|
|
46992
47077
|
// ../../packages/api/src/routes/node-terminal.ts
|
|
46993
|
-
|
|
46994
|
-
|
|
47078
|
+
var TERMINAL_SESSION_PROXY_TIMEOUT_MS = 1e4;
|
|
47079
|
+
function getTerminalSessionService2(deps) {
|
|
47080
|
+
deps.terminalSessionService ??= new NodeTerminalSessionService();
|
|
47081
|
+
return deps.terminalSessionService;
|
|
47082
|
+
}
|
|
47083
|
+
async function sendRemoteTerminalSessionRequest(req, res, nodeId, message) {
|
|
46995
47084
|
const deps = req.app.locals.deps;
|
|
46996
|
-
const
|
|
46997
|
-
const selfId = nodeRegistry.getSelf().id;
|
|
46998
|
-
const node = nodeId === selfId ? nodeRegistry.getSelf() : nodeRegistry.getNode(nodeId);
|
|
47085
|
+
const node = deps.nodeRegistry.getNode(nodeId);
|
|
46999
47086
|
if (!node) throw new MeshyError("NODE_NOT_FOUND", `Node ${nodeId} not found`, 404);
|
|
47000
|
-
const
|
|
47001
|
-
const
|
|
47002
|
-
|
|
47003
|
-
|
|
47004
|
-
|
|
47005
|
-
if (nodeId === selfId) {
|
|
47006
|
-
operations.runLocal(operation.id);
|
|
47087
|
+
const heartbeat = deps.heartbeat;
|
|
47088
|
+
const canPushToNode = heartbeat.canPushToNode?.(nodeId) ?? true;
|
|
47089
|
+
let response;
|
|
47090
|
+
if (!canPushToNode && canRequestNodeMessage(heartbeat)) {
|
|
47091
|
+
response = await requestFallbackNodeMessage(heartbeat, nodeId, message, TERMINAL_SESSION_PROXY_TIMEOUT_MS);
|
|
47007
47092
|
} else {
|
|
47008
47093
|
try {
|
|
47009
|
-
await
|
|
47094
|
+
response = await new NodeMessageClient({
|
|
47095
|
+
logger: deps.logger,
|
|
47096
|
+
timeoutMs: TERMINAL_SESSION_PROXY_TIMEOUT_MS
|
|
47097
|
+
}).request(node, message);
|
|
47010
47098
|
} catch (err) {
|
|
47011
|
-
|
|
47099
|
+
if (canRequestNodeMessage(heartbeat)) {
|
|
47100
|
+
response = await requestFallbackNodeMessage(heartbeat, nodeId, message, TERMINAL_SESSION_PROXY_TIMEOUT_MS);
|
|
47101
|
+
} else {
|
|
47102
|
+
throw new MeshyError("NODE_OFFLINE", `Cannot reach node ${nodeId} for terminal session control`, 502, {
|
|
47103
|
+
error: err instanceof Error ? err.message : String(err)
|
|
47104
|
+
});
|
|
47105
|
+
}
|
|
47012
47106
|
}
|
|
47013
47107
|
}
|
|
47014
|
-
res
|
|
47108
|
+
sendWorkerControlResponse(res, response);
|
|
47109
|
+
}
|
|
47110
|
+
async function sendNodeTerminalSessionStart(req, res, nodeId) {
|
|
47111
|
+
const body = NodeTerminalSessionStartBody.parse(req.body);
|
|
47112
|
+
const deps = req.app.locals.deps;
|
|
47113
|
+
const self2 = deps.nodeRegistry.getSelf();
|
|
47114
|
+
if (nodeId !== self2.id) {
|
|
47115
|
+
await sendRemoteTerminalSessionRequest(req, res, nodeId, createNodeMessage("node.terminal.session.start", {
|
|
47116
|
+
command: body.command,
|
|
47117
|
+
cwd: body.cwd
|
|
47118
|
+
}, { expectsResponse: true }));
|
|
47119
|
+
return;
|
|
47120
|
+
}
|
|
47121
|
+
const session = getTerminalSessionService2(deps).start(self2.id, self2.workDir ?? deps.workDir, body.command, { cwd: body.cwd });
|
|
47122
|
+
res.status(202).json(session);
|
|
47123
|
+
}
|
|
47124
|
+
async function sendNodeTerminalSessionList(req, res, nodeId) {
|
|
47125
|
+
const deps = req.app.locals.deps;
|
|
47126
|
+
const self2 = deps.nodeRegistry.getSelf();
|
|
47127
|
+
if (nodeId !== self2.id) {
|
|
47128
|
+
await sendRemoteTerminalSessionRequest(req, res, nodeId, createNodeMessage("node.terminal.session.list", {}, { expectsResponse: true }));
|
|
47129
|
+
return;
|
|
47130
|
+
}
|
|
47131
|
+
res.json({ nodeId: self2.id, sessions: getTerminalSessionService2(deps).list() });
|
|
47132
|
+
}
|
|
47133
|
+
async function sendNodeTerminalSessionGet(req, res, nodeId, sessionId) {
|
|
47134
|
+
const deps = req.app.locals.deps;
|
|
47135
|
+
const self2 = deps.nodeRegistry.getSelf();
|
|
47136
|
+
if (nodeId !== self2.id) {
|
|
47137
|
+
await sendRemoteTerminalSessionRequest(req, res, nodeId, createNodeMessage("node.terminal.session.get", { sessionId }, { expectsResponse: true }));
|
|
47138
|
+
return;
|
|
47139
|
+
}
|
|
47140
|
+
const session = getTerminalSessionService2(deps).get(sessionId);
|
|
47141
|
+
if (!session) throw new MeshyError("NODE_NOT_FOUND", `Terminal session ${sessionId} not found`, 404);
|
|
47142
|
+
res.json(session);
|
|
47143
|
+
}
|
|
47144
|
+
async function sendNodeTerminalSessionStop(req, res, nodeId, sessionId) {
|
|
47145
|
+
const deps = req.app.locals.deps;
|
|
47146
|
+
const self2 = deps.nodeRegistry.getSelf();
|
|
47147
|
+
if (nodeId !== self2.id) {
|
|
47148
|
+
await sendRemoteTerminalSessionRequest(req, res, nodeId, createNodeMessage("node.terminal.session.stop", { sessionId }, { expectsResponse: true }));
|
|
47149
|
+
return;
|
|
47150
|
+
}
|
|
47151
|
+
const session = getTerminalSessionService2(deps).stop(sessionId);
|
|
47152
|
+
if (!session) throw new MeshyError("NODE_NOT_FOUND", `Terminal session ${sessionId} not found`, 404);
|
|
47153
|
+
res.json(session);
|
|
47015
47154
|
}
|
|
47016
47155
|
|
|
47017
47156
|
// ../../packages/api/src/routes/nodes.ts
|
|
@@ -47339,9 +47478,17 @@ function createNodeRoutes() {
|
|
|
47339
47478
|
}
|
|
47340
47479
|
sendLocalNodeWorkDirBranchInfo(req, res, nodeId);
|
|
47341
47480
|
}));
|
|
47342
|
-
router.
|
|
47343
|
-
|
|
47344
|
-
|
|
47481
|
+
router.get("/:id/terminal/sessions", asyncHandler3(async (req, res) => {
|
|
47482
|
+
await sendNodeTerminalSessionList(req, res, req.params.id);
|
|
47483
|
+
}));
|
|
47484
|
+
router.post("/:id/terminal/sessions", asyncHandler3(async (req, res) => {
|
|
47485
|
+
await sendNodeTerminalSessionStart(req, res, req.params.id);
|
|
47486
|
+
}));
|
|
47487
|
+
router.get("/:id/terminal/sessions/:sessionId", asyncHandler3(async (req, res) => {
|
|
47488
|
+
await sendNodeTerminalSessionGet(req, res, req.params.id, req.params.sessionId);
|
|
47489
|
+
}));
|
|
47490
|
+
router.post("/:id/terminal/sessions/:sessionId/stop", asyncHandler3(async (req, res) => {
|
|
47491
|
+
await sendNodeTerminalSessionStop(req, res, req.params.id, req.params.sessionId);
|
|
47345
47492
|
}));
|
|
47346
47493
|
router.post("/:id/workdir/branch", asyncHandler3(async (req, res) => {
|
|
47347
47494
|
const nodeId = req.params.id;
|
|
@@ -49426,8 +49573,8 @@ function hasAuthorizationHeader(req) {
|
|
|
49426
49573
|
function resolveRuntimeBaseDir() {
|
|
49427
49574
|
const entryPath = process.argv[1];
|
|
49428
49575
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
49429
|
-
const resolved =
|
|
49430
|
-
return
|
|
49576
|
+
const resolved = fs19.realpathSync(path20.resolve(entryPath));
|
|
49577
|
+
return path20.dirname(resolved);
|
|
49431
49578
|
}
|
|
49432
49579
|
return process.cwd();
|
|
49433
49580
|
}
|
|
@@ -49435,18 +49582,18 @@ function resolveStaticDir(baseDir) {
|
|
|
49435
49582
|
const envStaticDir = process.env.MESHY_STATIC_DIR;
|
|
49436
49583
|
const candidateDirs = [
|
|
49437
49584
|
envStaticDir,
|
|
49438
|
-
|
|
49439
|
-
|
|
49440
|
-
|
|
49441
|
-
|
|
49442
|
-
|
|
49443
|
-
|
|
49444
|
-
|
|
49445
|
-
|
|
49446
|
-
|
|
49585
|
+
path20.resolve(baseDir, "dashboard"),
|
|
49586
|
+
path20.resolve(baseDir, "../dashboard"),
|
|
49587
|
+
path20.resolve(baseDir, "../../dashboard/dist"),
|
|
49588
|
+
path20.resolve(baseDir, "../../../packages/dashboard/dist"),
|
|
49589
|
+
path20.resolve(baseDir, "../public"),
|
|
49590
|
+
path20.resolve(baseDir, "../../packages/api/public"),
|
|
49591
|
+
path20.resolve(baseDir, "../../../packages/api/public"),
|
|
49592
|
+
path20.resolve(process.cwd(), "packages/dashboard/dist"),
|
|
49593
|
+
path20.resolve(process.cwd(), "packages/api/public")
|
|
49447
49594
|
].filter((value) => typeof value === "string" && value.length > 0);
|
|
49448
49595
|
for (const candidate of candidateDirs) {
|
|
49449
|
-
if (
|
|
49596
|
+
if (fs19.existsSync(candidate)) {
|
|
49450
49597
|
return candidate;
|
|
49451
49598
|
}
|
|
49452
49599
|
}
|
|
@@ -49547,8 +49694,8 @@ function createServer2(deps) {
|
|
|
49547
49694
|
app.use("/api/node-operations", createNodeOperationRoutes());
|
|
49548
49695
|
app.use("/api/events", createEventRoutes());
|
|
49549
49696
|
if (staticDir) {
|
|
49550
|
-
const indexPath =
|
|
49551
|
-
if (
|
|
49697
|
+
const indexPath = path20.join(staticDir, "index.html");
|
|
49698
|
+
if (fs19.existsSync(indexPath)) {
|
|
49552
49699
|
app.get("*", (req, res, next) => {
|
|
49553
49700
|
if (isApiRequest(req)) {
|
|
49554
49701
|
next();
|
|
@@ -49944,8 +50091,8 @@ var terminalWriter = {
|
|
|
49944
50091
|
};
|
|
49945
50092
|
|
|
49946
50093
|
// src/startup.ts
|
|
49947
|
-
var
|
|
49948
|
-
var
|
|
50094
|
+
var fs20 = __toESM(require("fs"), 1);
|
|
50095
|
+
var path21 = __toESM(require("path"), 1);
|
|
49949
50096
|
var readline = __toESM(require("readline/promises"), 1);
|
|
49950
50097
|
var import_node_child_process12 = require("child_process");
|
|
49951
50098
|
function getDefaultNodeName() {
|
|
@@ -50008,19 +50155,19 @@ function createDefaultCommandRunner(platform2) {
|
|
|
50008
50155
|
};
|
|
50009
50156
|
}
|
|
50010
50157
|
function getNodeMetadataPath2(storagePath) {
|
|
50011
|
-
return
|
|
50158
|
+
return path21.join(storagePath, "metadata.json");
|
|
50012
50159
|
}
|
|
50013
50160
|
function readStartupMetadataFile(storagePath) {
|
|
50014
50161
|
try {
|
|
50015
|
-
const raw = JSON.parse(
|
|
50162
|
+
const raw = JSON.parse(fs20.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
|
|
50016
50163
|
return typeof raw === "object" && raw !== null ? raw : {};
|
|
50017
50164
|
} catch {
|
|
50018
50165
|
return {};
|
|
50019
50166
|
}
|
|
50020
50167
|
}
|
|
50021
50168
|
function writeStartupMetadataFile(storagePath, metadata) {
|
|
50022
|
-
|
|
50023
|
-
|
|
50169
|
+
fs20.mkdirSync(storagePath, { recursive: true });
|
|
50170
|
+
fs20.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
|
|
50024
50171
|
}
|
|
50025
50172
|
function formatLocalDate2(now) {
|
|
50026
50173
|
const year = now.getFullYear();
|
|
@@ -50259,9 +50406,9 @@ async function ensureStartupRequirements(storagePath, options = {}) {
|
|
|
50259
50406
|
metadata
|
|
50260
50407
|
};
|
|
50261
50408
|
}
|
|
50262
|
-
function loadConfigFile(
|
|
50409
|
+
function loadConfigFile(path23) {
|
|
50263
50410
|
try {
|
|
50264
|
-
const raw =
|
|
50411
|
+
const raw = fs20.readFileSync(path23, "utf-8");
|
|
50265
50412
|
return JSON.parse(raw);
|
|
50266
50413
|
} catch {
|
|
50267
50414
|
return {};
|
|
@@ -50439,26 +50586,26 @@ function formatLoadedStartMetadata(info, authEnabled) {
|
|
|
50439
50586
|
}
|
|
50440
50587
|
|
|
50441
50588
|
// src/runtime-metadata.ts
|
|
50442
|
-
var
|
|
50443
|
-
var
|
|
50589
|
+
var fs21 = __toESM(require("fs"), 1);
|
|
50590
|
+
var path22 = __toESM(require("path"), 1);
|
|
50444
50591
|
var import_node_child_process13 = require("child_process");
|
|
50445
50592
|
var runtimeDir = resolveRuntimeDir();
|
|
50446
50593
|
var appRoot = resolveAppRoot(runtimeDir);
|
|
50447
|
-
var repoRoot =
|
|
50594
|
+
var repoRoot = path22.resolve(appRoot, "../..");
|
|
50448
50595
|
function resolveRuntimeDir() {
|
|
50449
50596
|
const entryPath = process.argv[1];
|
|
50450
50597
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
50451
50598
|
try {
|
|
50452
|
-
return
|
|
50599
|
+
return path22.dirname(fs21.realpathSync(path22.resolve(entryPath)));
|
|
50453
50600
|
} catch {
|
|
50454
|
-
return
|
|
50601
|
+
return path22.dirname(path22.resolve(entryPath));
|
|
50455
50602
|
}
|
|
50456
50603
|
}
|
|
50457
50604
|
return process.cwd();
|
|
50458
50605
|
}
|
|
50459
50606
|
function readJsonFile(filePath) {
|
|
50460
50607
|
try {
|
|
50461
|
-
return JSON.parse(
|
|
50608
|
+
return JSON.parse(fs21.readFileSync(filePath, "utf-8"));
|
|
50462
50609
|
} catch {
|
|
50463
50610
|
return null;
|
|
50464
50611
|
}
|
|
@@ -50468,9 +50615,9 @@ function readPackageManifest(filePath) {
|
|
|
50468
50615
|
}
|
|
50469
50616
|
function readEmbeddedRuntimeMetadata() {
|
|
50470
50617
|
const candidates = [
|
|
50471
|
-
|
|
50472
|
-
|
|
50473
|
-
|
|
50618
|
+
path22.join(appRoot, "runtime-metadata.json"),
|
|
50619
|
+
path22.join(runtimeDir, "runtime-metadata.json"),
|
|
50620
|
+
path22.resolve(process.cwd(), "apps/node/dist/runtime-metadata.json")
|
|
50474
50621
|
];
|
|
50475
50622
|
for (const candidate of candidates) {
|
|
50476
50623
|
const metadata = readJsonFile(candidate);
|
|
@@ -50483,23 +50630,23 @@ function readEmbeddedRuntimeMetadata() {
|
|
|
50483
50630
|
function resolveAppRoot(baseDir) {
|
|
50484
50631
|
const candidates = [
|
|
50485
50632
|
baseDir,
|
|
50486
|
-
|
|
50487
|
-
|
|
50488
|
-
|
|
50633
|
+
path22.resolve(baseDir, ".."),
|
|
50634
|
+
path22.resolve(process.cwd(), "apps/node/dist"),
|
|
50635
|
+
path22.resolve(process.cwd(), "apps/node"),
|
|
50489
50636
|
process.cwd()
|
|
50490
50637
|
];
|
|
50491
50638
|
for (const candidate of candidates) {
|
|
50492
|
-
const manifest = readPackageManifest(
|
|
50639
|
+
const manifest = readPackageManifest(path22.join(candidate, "package.json"));
|
|
50493
50640
|
if (manifest?.name === "@meshy/node" || manifest?.name === "meshy-node") {
|
|
50494
50641
|
return candidate;
|
|
50495
50642
|
}
|
|
50496
50643
|
}
|
|
50497
50644
|
for (const candidate of candidates) {
|
|
50498
|
-
if (
|
|
50645
|
+
if (fs21.existsSync(path22.join(candidate, "package.json"))) {
|
|
50499
50646
|
return candidate;
|
|
50500
50647
|
}
|
|
50501
50648
|
}
|
|
50502
|
-
return
|
|
50649
|
+
return path22.resolve(baseDir, "..");
|
|
50503
50650
|
}
|
|
50504
50651
|
function toPackageInfo(filePath) {
|
|
50505
50652
|
const manifest = readPackageManifest(filePath);
|
|
@@ -50559,8 +50706,8 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
50559
50706
|
components: startupRequirements.components
|
|
50560
50707
|
};
|
|
50561
50708
|
}
|
|
50562
|
-
const appPackage = toPackageInfo(
|
|
50563
|
-
const workspaceManifest = readPackageManifest(
|
|
50709
|
+
const appPackage = toPackageInfo(path22.join(appRoot, "package.json"));
|
|
50710
|
+
const workspaceManifest = readPackageManifest(path22.join(repoRoot, "package.json"));
|
|
50564
50711
|
return {
|
|
50565
50712
|
packageName: appPackage?.name ?? "meshy",
|
|
50566
50713
|
packageVersion: appPackage?.version ?? "0.1.0",
|
|
@@ -50568,11 +50715,11 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
50568
50715
|
startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
|
|
50569
50716
|
components: startupRequirements.components,
|
|
50570
50717
|
packages: {
|
|
50571
|
-
workspace: toPackageInfo(
|
|
50718
|
+
workspace: toPackageInfo(path22.join(repoRoot, "package.json")),
|
|
50572
50719
|
node: appPackage,
|
|
50573
|
-
core: toPackageInfo(
|
|
50574
|
-
dashboard: toPackageInfo(
|
|
50575
|
-
api: toPackageInfo(
|
|
50720
|
+
core: toPackageInfo(path22.join(repoRoot, "packages/core/package.json")),
|
|
50721
|
+
dashboard: toPackageInfo(path22.join(repoRoot, "packages/dashboard/package.json")),
|
|
50722
|
+
api: toPackageInfo(path22.join(repoRoot, "packages/api/package.json"))
|
|
50576
50723
|
},
|
|
50577
50724
|
repository: {
|
|
50578
50725
|
url: normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.upstream.url"])) ?? normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.origin.url"])) ?? readRepositoryUrlFromManifest(workspaceManifest),
|