meshy-node 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dashboard/assets/DashboardPage-Da_VtP_l.js +172 -0
- package/dashboard/assets/{DiffTab-L7XOR2ma.js → DiffTab-C1s6zab_.js} +4 -4
- package/dashboard/assets/{FilesTab-MiZ3rGO0.js → FilesTab-oATTYGJa.js} +5 -5
- package/dashboard/assets/{PreviewTab-DdT_r4GF.js → PreviewTab--9Iy_Xpu.js} +4 -4
- package/dashboard/assets/{file-DP1hVNzm.js → file-XG11YnWT.js} +1 -1
- package/dashboard/assets/index-C49tlczJ.js +249 -0
- package/dashboard/assets/index-DOX-2CnC.css +1 -0
- package/dashboard/index.html +2 -2
- package/main.cjs +755 -287
- package/package.json +2 -1
- package/runtime-metadata.json +31 -0
- package/dashboard/assets/DashboardPage-Bu_7sWoy.js +0 -256
- package/dashboard/assets/index-2UShBZ7T.css +0 -1
- package/dashboard/assets/index-Dc0APxmT.js +0 -115
package/main.cjs
CHANGED
|
@@ -1375,8 +1375,8 @@ var require_semver = __commonJS({
|
|
|
1375
1375
|
}
|
|
1376
1376
|
// preminor will bump the version up to the next minor release, and immediately
|
|
1377
1377
|
// down to pre-release. premajor and prepatch work the same way.
|
|
1378
|
-
inc(
|
|
1379
|
-
if (
|
|
1378
|
+
inc(release2, identifier, identifierBase) {
|
|
1379
|
+
if (release2.startsWith("pre")) {
|
|
1380
1380
|
if (!identifier && identifierBase === false) {
|
|
1381
1381
|
throw new Error("invalid increment argument: identifier is empty");
|
|
1382
1382
|
}
|
|
@@ -1387,7 +1387,7 @@ var require_semver = __commonJS({
|
|
|
1387
1387
|
}
|
|
1388
1388
|
}
|
|
1389
1389
|
}
|
|
1390
|
-
switch (
|
|
1390
|
+
switch (release2) {
|
|
1391
1391
|
case "premajor":
|
|
1392
1392
|
this.prerelease.length = 0;
|
|
1393
1393
|
this.patch = 0;
|
|
@@ -1478,7 +1478,7 @@ var require_semver = __commonJS({
|
|
|
1478
1478
|
break;
|
|
1479
1479
|
}
|
|
1480
1480
|
default:
|
|
1481
|
-
throw new Error(`invalid increment argument: ${
|
|
1481
|
+
throw new Error(`invalid increment argument: ${release2}`);
|
|
1482
1482
|
}
|
|
1483
1483
|
this.raw = this.format();
|
|
1484
1484
|
if (this.build.length) {
|
|
@@ -1544,7 +1544,7 @@ var require_inc = __commonJS({
|
|
|
1544
1544
|
"../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js"(exports2, module2) {
|
|
1545
1545
|
"use strict";
|
|
1546
1546
|
var SemVer = require_semver();
|
|
1547
|
-
var inc = (version2,
|
|
1547
|
+
var inc = (version2, release2, options, identifier, identifierBase) => {
|
|
1548
1548
|
if (typeof options === "string") {
|
|
1549
1549
|
identifierBase = identifier;
|
|
1550
1550
|
identifier = options;
|
|
@@ -1554,7 +1554,7 @@ var require_inc = __commonJS({
|
|
|
1554
1554
|
return new SemVer(
|
|
1555
1555
|
version2 instanceof SemVer ? version2.version : version2,
|
|
1556
1556
|
options
|
|
1557
|
-
).inc(
|
|
1557
|
+
).inc(release2, identifier, identifierBase).version;
|
|
1558
1558
|
} catch (er) {
|
|
1559
1559
|
return null;
|
|
1560
1560
|
}
|
|
@@ -4301,7 +4301,7 @@ var require_has_flag = __commonJS({
|
|
|
4301
4301
|
var require_supports_color = __commonJS({
|
|
4302
4302
|
"../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports2, module2) {
|
|
4303
4303
|
"use strict";
|
|
4304
|
-
var
|
|
4304
|
+
var os6 = require("os");
|
|
4305
4305
|
var tty = require("tty");
|
|
4306
4306
|
var hasFlag = require_has_flag();
|
|
4307
4307
|
var { env } = process;
|
|
@@ -4349,7 +4349,7 @@ var require_supports_color = __commonJS({
|
|
|
4349
4349
|
return min;
|
|
4350
4350
|
}
|
|
4351
4351
|
if (process.platform === "win32") {
|
|
4352
|
-
const osRelease =
|
|
4352
|
+
const osRelease = os6.release().split(".");
|
|
4353
4353
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
4354
4354
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
4355
4355
|
}
|
|
@@ -4646,8 +4646,8 @@ var require_helpers = __commonJS({
|
|
|
4646
4646
|
function req(url, opts = {}) {
|
|
4647
4647
|
const href = typeof url === "string" ? url : url.href;
|
|
4648
4648
|
const req2 = (href.startsWith("https:") ? https2 : http3).request(url, opts);
|
|
4649
|
-
const promise = new Promise((
|
|
4650
|
-
req2.once("response",
|
|
4649
|
+
const promise = new Promise((resolve13, reject) => {
|
|
4650
|
+
req2.once("response", resolve13).once("error", reject).end();
|
|
4651
4651
|
});
|
|
4652
4652
|
req2.then = promise.then.bind(promise);
|
|
4653
4653
|
return req2;
|
|
@@ -4824,7 +4824,7 @@ var require_parse_proxy_response = __commonJS({
|
|
|
4824
4824
|
var debug_1 = __importDefault(require_src());
|
|
4825
4825
|
var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
4826
4826
|
function parseProxyResponse(socket) {
|
|
4827
|
-
return new Promise((
|
|
4827
|
+
return new Promise((resolve13, reject) => {
|
|
4828
4828
|
let buffersLength = 0;
|
|
4829
4829
|
const buffers = [];
|
|
4830
4830
|
function read() {
|
|
@@ -4890,7 +4890,7 @@ var require_parse_proxy_response = __commonJS({
|
|
|
4890
4890
|
}
|
|
4891
4891
|
debug("got proxy server response: %o %o", firstLine, headers);
|
|
4892
4892
|
cleanup();
|
|
4893
|
-
|
|
4893
|
+
resolve13({
|
|
4894
4894
|
connect: {
|
|
4895
4895
|
statusCode,
|
|
4896
4896
|
statusText,
|
|
@@ -5123,8 +5123,8 @@ var require_dist3 = __commonJS({
|
|
|
5123
5123
|
setRequestProps(req, opts) {
|
|
5124
5124
|
const { proxy } = this;
|
|
5125
5125
|
const protocol = opts.secureEndpoint ? "https:" : "http:";
|
|
5126
|
-
const
|
|
5127
|
-
const base = `${protocol}//${
|
|
5126
|
+
const hostname3 = req.getHeader("host") || "localhost";
|
|
5127
|
+
const base = `${protocol}//${hostname3}`;
|
|
5128
5128
|
const url = new url_1.URL(req.path, base);
|
|
5129
5129
|
if (opts.port !== 80) {
|
|
5130
5130
|
url.port = String(opts.port);
|
|
@@ -6629,8 +6629,8 @@ var require_node2 = __commonJS({
|
|
|
6629
6629
|
}
|
|
6630
6630
|
break;
|
|
6631
6631
|
case "FILE":
|
|
6632
|
-
var
|
|
6633
|
-
stream2 = new
|
|
6632
|
+
var fs17 = require("fs");
|
|
6633
|
+
stream2 = new fs17.SyncWriteStream(fd2, { autoClose: false });
|
|
6634
6634
|
stream2._type = "fs";
|
|
6635
6635
|
break;
|
|
6636
6636
|
case "PIPE":
|
|
@@ -10283,10 +10283,10 @@ var require_raw_body = __commonJS({
|
|
|
10283
10283
|
if (done) {
|
|
10284
10284
|
return readStream(stream, encoding, length, limit, wrap(done));
|
|
10285
10285
|
}
|
|
10286
|
-
return new Promise(function executor(
|
|
10286
|
+
return new Promise(function executor(resolve13, reject) {
|
|
10287
10287
|
readStream(stream, encoding, length, limit, function onRead(err, buf) {
|
|
10288
10288
|
if (err) return reject(err);
|
|
10289
|
-
|
|
10289
|
+
resolve13(buf);
|
|
10290
10290
|
});
|
|
10291
10291
|
});
|
|
10292
10292
|
}
|
|
@@ -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(path18) {
|
|
19424
|
+
if (!path18 || typeof path18 !== "string") {
|
|
19425
19425
|
return false;
|
|
19426
19426
|
}
|
|
19427
|
-
var extension2 = extname3("x." +
|
|
19427
|
+
var extension2 = extname3("x." + path18).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(path18, 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 (path18 instanceof RegExp) {
|
|
22960
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path18.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 path18;
|
|
22969
22969
|
}
|
|
22970
|
-
if (Array.isArray(
|
|
22971
|
-
|
|
22970
|
+
if (Array.isArray(path18)) {
|
|
22971
|
+
path18 = path18.map(function(value) {
|
|
22972
22972
|
return pathToRegexp(value, keys, options).source;
|
|
22973
22973
|
});
|
|
22974
|
-
return new RegExp(
|
|
22974
|
+
return new RegExp(path18.join("|"), flags);
|
|
22975
22975
|
}
|
|
22976
|
-
if (typeof
|
|
22976
|
+
if (typeof path18 !== "string") {
|
|
22977
22977
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
22978
22978
|
}
|
|
22979
|
-
|
|
22979
|
+
path18 = path18.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 += path18.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(path18)) {
|
|
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
|
+
path18 += strict ? "" : path18[path18.length - 1] === "/" ? "?" : "/?";
|
|
23039
23039
|
if (end) {
|
|
23040
|
-
|
|
23041
|
-
} else if (
|
|
23042
|
-
|
|
23040
|
+
path18 += "$";
|
|
23041
|
+
} else if (path18[path18.length - 1] !== "/") {
|
|
23042
|
+
path18 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
23043
23043
|
}
|
|
23044
|
-
return new RegExp("^" +
|
|
23044
|
+
return new RegExp("^" + path18, 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(path18, options, fn) {
|
|
23058
23058
|
if (!(this instanceof Layer)) {
|
|
23059
|
-
return new Layer(
|
|
23059
|
+
return new Layer(path18, options, fn);
|
|
23060
23060
|
}
|
|
23061
|
-
debug("new %o",
|
|
23061
|
+
debug("new %o", path18);
|
|
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(path18, this.keys = [], opts);
|
|
23068
|
+
this.regexp.fast_star = path18 === "*";
|
|
23069
|
+
this.regexp.fast_slash = path18 === "/" && 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(path18) {
|
|
23094
23094
|
var match2;
|
|
23095
|
-
if (
|
|
23095
|
+
if (path18 != 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(path18) };
|
|
23103
|
+
this.path = path18;
|
|
23104
23104
|
return true;
|
|
23105
23105
|
}
|
|
23106
|
-
match2 = this.regexp.exec(
|
|
23106
|
+
match2 = this.regexp.exec(path18);
|
|
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(path18) {
|
|
23200
|
+
this.path = path18;
|
|
23201
23201
|
this.stack = [];
|
|
23202
|
-
debug("new %o",
|
|
23202
|
+
debug("new %o", path18);
|
|
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 path18 = getPathname(req);
|
|
23416
|
+
if (path18 == 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, path18);
|
|
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, path18);
|
|
23463
23463
|
}
|
|
23464
23464
|
sync = 0;
|
|
23465
23465
|
});
|
|
23466
23466
|
}
|
|
23467
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
23467
|
+
function trim_prefix(layer, layerError, layerPath, path18) {
|
|
23468
23468
|
if (layerPath.length !== 0) {
|
|
23469
|
-
if (layerPath !==
|
|
23469
|
+
if (layerPath !== path18.slice(0, layerPath.length)) {
|
|
23470
23470
|
next(layerError);
|
|
23471
23471
|
return;
|
|
23472
23472
|
}
|
|
23473
|
-
var c =
|
|
23473
|
+
var c = path18[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 path18 = "/";
|
|
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
|
+
path18 = 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", path18, fn.name || "<anonymous>");
|
|
23572
|
+
var layer = new Layer(path18, {
|
|
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(path18) {
|
|
23583
|
+
var route2 = new Route(path18);
|
|
23584
|
+
var layer = new Layer(path18, {
|
|
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(path18) {
|
|
23595
|
+
var route = this.route(path18);
|
|
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, path18) {
|
|
23632
23632
|
try {
|
|
23633
|
-
return layer.match(
|
|
23633
|
+
return layer.match(path18);
|
|
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
|
|
23754
|
-
var basename3 =
|
|
23755
|
-
var extname3 =
|
|
23756
|
-
var
|
|
23757
|
-
var
|
|
23751
|
+
var path18 = require("path");
|
|
23752
|
+
var fs17 = require("fs");
|
|
23753
|
+
var dirname5 = path18.dirname;
|
|
23754
|
+
var basename3 = path18.basename;
|
|
23755
|
+
var extname3 = path18.extname;
|
|
23756
|
+
var join14 = path18.join;
|
|
23757
|
+
var resolve13 = path18.resolve;
|
|
23758
23758
|
module2.exports = View;
|
|
23759
23759
|
function View(name2, options) {
|
|
23760
23760
|
var opts = options || {};
|
|
@@ -23783,39 +23783,39 @@ 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 path19;
|
|
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 && !path19; i++) {
|
|
23790
23790
|
var root = roots[i];
|
|
23791
|
-
var loc =
|
|
23792
|
-
var dir =
|
|
23791
|
+
var loc = resolve13(root, name2);
|
|
23792
|
+
var dir = dirname5(loc);
|
|
23793
23793
|
var file = basename3(loc);
|
|
23794
|
-
|
|
23794
|
+
path19 = this.resolve(dir, file);
|
|
23795
23795
|
}
|
|
23796
|
-
return
|
|
23796
|
+
return path19;
|
|
23797
23797
|
};
|
|
23798
23798
|
View.prototype.render = function render(options, callback) {
|
|
23799
23799
|
debug('render "%s"', this.path);
|
|
23800
23800
|
this.engine(this.path, options, callback);
|
|
23801
23801
|
};
|
|
23802
|
-
View.prototype.resolve = function
|
|
23802
|
+
View.prototype.resolve = function resolve14(dir, file) {
|
|
23803
23803
|
var ext = this.ext;
|
|
23804
|
-
var
|
|
23805
|
-
var stat = tryStat(
|
|
23804
|
+
var path19 = join14(dir, file);
|
|
23805
|
+
var stat = tryStat(path19);
|
|
23806
23806
|
if (stat && stat.isFile()) {
|
|
23807
|
-
return
|
|
23807
|
+
return path19;
|
|
23808
23808
|
}
|
|
23809
|
-
|
|
23810
|
-
stat = tryStat(
|
|
23809
|
+
path19 = join14(dir, basename3(file, ext), "index" + ext);
|
|
23810
|
+
stat = tryStat(path19);
|
|
23811
23811
|
if (stat && stat.isFile()) {
|
|
23812
|
-
return
|
|
23812
|
+
return path19;
|
|
23813
23813
|
}
|
|
23814
23814
|
};
|
|
23815
|
-
function tryStat(
|
|
23816
|
-
debug('stat "%s"',
|
|
23815
|
+
function tryStat(path19) {
|
|
23816
|
+
debug('stat "%s"', path19);
|
|
23817
23817
|
try {
|
|
23818
|
-
return
|
|
23818
|
+
return fs17.statSync(path19);
|
|
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 path18 = require("path");
|
|
24116
|
+
var fs17 = 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 = fs17.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(path19, fallback) {
|
|
24146
|
+
var ext = path19.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 escapeHtml = require_escape_html();
|
|
24257
24257
|
var etag = require_etag();
|
|
24258
24258
|
var fresh = require_fresh();
|
|
24259
|
-
var
|
|
24259
|
+
var fs17 = 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 path18 = 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
|
|
24272
|
-
var sep3 =
|
|
24268
|
+
var extname3 = path18.extname;
|
|
24269
|
+
var join14 = path18.join;
|
|
24270
|
+
var normalize = path18.normalize;
|
|
24271
|
+
var resolve13 = path18.resolve;
|
|
24272
|
+
var sep3 = path18.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, path19, options) {
|
|
24279
|
+
return new SendStream(req, path19, options);
|
|
24280
24280
|
}
|
|
24281
|
-
function SendStream(req,
|
|
24281
|
+
function SendStream(req, path19, options) {
|
|
24282
24282
|
Stream.call(this);
|
|
24283
24283
|
var opts = options || {};
|
|
24284
24284
|
this.options = opts;
|
|
24285
|
-
this.path =
|
|
24285
|
+
this.path = path19;
|
|
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;
|
|
@@ -24305,7 +24305,7 @@ var require_send = __commonJS({
|
|
|
24305
24305
|
this._maxage = opts.maxAge || opts.maxage;
|
|
24306
24306
|
this._maxage = typeof this._maxage === "string" ? ms(this._maxage) : Number(this._maxage);
|
|
24307
24307
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
24308
|
-
this._root = opts.root ?
|
|
24308
|
+
this._root = opts.root ? resolve13(opts.root) : null;
|
|
24309
24309
|
if (!this._root && opts.from) {
|
|
24310
24310
|
this.from(opts.from);
|
|
24311
24311
|
}
|
|
@@ -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 =
|
|
24331
|
+
SendStream.prototype.root = function root(path19) {
|
|
24332
|
+
this._root = resolve13(String(path19));
|
|
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(path19) {
|
|
24446
24446
|
var res = this.res;
|
|
24447
24447
|
if (hasListeners(this, "directory")) {
|
|
24448
|
-
this.emit("directory", res,
|
|
24448
|
+
this.emit("directory", res, path19);
|
|
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 path19 = decode(this.path);
|
|
24469
|
+
if (path19 === -1) {
|
|
24470
24470
|
this.error(400);
|
|
24471
24471
|
return res;
|
|
24472
24472
|
}
|
|
24473
|
-
if (~
|
|
24473
|
+
if (~path19.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 (path19) {
|
|
24480
|
+
path19 = normalize("." + sep3 + path19);
|
|
24481
24481
|
}
|
|
24482
|
-
if (UP_PATH_REGEXP.test(
|
|
24483
|
-
debug('malicious path "%s"',
|
|
24482
|
+
if (UP_PATH_REGEXP.test(path19)) {
|
|
24483
|
+
debug('malicious path "%s"', path19);
|
|
24484
24484
|
this.error(403);
|
|
24485
24485
|
return res;
|
|
24486
24486
|
}
|
|
24487
|
-
parts =
|
|
24488
|
-
|
|
24487
|
+
parts = path19.split(sep3);
|
|
24488
|
+
path19 = normalize(join14(root, path19));
|
|
24489
24489
|
} else {
|
|
24490
|
-
if (UP_PATH_REGEXP.test(
|
|
24491
|
-
debug('malicious path "%s"',
|
|
24490
|
+
if (UP_PATH_REGEXP.test(path19)) {
|
|
24491
|
+
debug('malicious path "%s"', path19);
|
|
24492
24492
|
this.error(403);
|
|
24493
24493
|
return res;
|
|
24494
24494
|
}
|
|
24495
|
-
parts = normalize(
|
|
24496
|
-
|
|
24495
|
+
parts = normalize(path19).split(sep3);
|
|
24496
|
+
path19 = resolve13(path19);
|
|
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, path19);
|
|
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(path19);
|
|
24518
24518
|
return res;
|
|
24519
24519
|
}
|
|
24520
|
-
this.sendFile(
|
|
24520
|
+
this.sendFile(path19);
|
|
24521
24521
|
return res;
|
|
24522
24522
|
};
|
|
24523
|
-
SendStream.prototype.send = function send2(
|
|
24523
|
+
SendStream.prototype.send = function send2(path19, 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"', path19);
|
|
24536
|
+
this.setHeader(path19, stat);
|
|
24537
|
+
this.type(path19);
|
|
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(path19, opts);
|
|
24587
24587
|
};
|
|
24588
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
24588
|
+
SendStream.prototype.sendFile = function sendFile(path19) {
|
|
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"', path19);
|
|
24592
|
+
fs17.stat(path19, function onstat(err, stat) {
|
|
24593
|
+
if (err && err.code === "ENOENT" && !extname3(path19) && path19[path19.length - 1] !== sep3) {
|
|
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(path19);
|
|
24598
|
+
self2.emit("file", path19, stat);
|
|
24599
|
+
self2.send(path19, 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 = path19 + "." + self2._extensions[i++];
|
|
24606
24606
|
debug('stat "%s"', p);
|
|
24607
|
-
|
|
24607
|
+
fs17.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(path19) {
|
|
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 = join14(path19, self2._index[i]);
|
|
24624
24624
|
debug('stat "%s"', p);
|
|
24625
|
-
|
|
24625
|
+
fs17.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(path19, options) {
|
|
24635
24635
|
var self2 = this;
|
|
24636
24636
|
var res = this.res;
|
|
24637
|
-
var stream2 =
|
|
24637
|
+
var stream2 = fs17.createReadStream(path19, 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(path19) {
|
|
24653
24653
|
var res = this.res;
|
|
24654
24654
|
if (res.getHeader("Content-Type")) return;
|
|
24655
|
-
var type2 = mime.lookup(
|
|
24655
|
+
var type2 = mime.lookup(path19);
|
|
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(path19, stat) {
|
|
24665
24665
|
var res = this.res;
|
|
24666
|
-
this.emit("headers", res,
|
|
24666
|
+
this.emit("headers", res, path19, 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(path19) {
|
|
24726
24726
|
try {
|
|
24727
|
-
return decodeURIComponent(
|
|
24727
|
+
return decodeURIComponent(path19);
|
|
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(path18) {
|
|
25638
|
+
if ("/" === path18[0]) return true;
|
|
25639
|
+
if (":" === path18[1] && ("\\" === path18[2] || "/" === path18[2])) return true;
|
|
25640
|
+
if ("\\\\" === path18.substring(0, 2)) return true;
|
|
25641
25641
|
};
|
|
25642
25642
|
exports2.flatten = deprecate.function(
|
|
25643
25643
|
flatten,
|
|
@@ -25773,7 +25773,7 @@ var require_application = __commonJS({
|
|
|
25773
25773
|
var deprecate = require_depd()("express");
|
|
25774
25774
|
var flatten = require_array_flatten();
|
|
25775
25775
|
var merge = require_utils_merge();
|
|
25776
|
-
var
|
|
25776
|
+
var resolve13 = require("path").resolve;
|
|
25777
25777
|
var setPrototypeOf = require_setprototypeof();
|
|
25778
25778
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
25779
25779
|
var slice = Array.prototype.slice;
|
|
@@ -25812,7 +25812,7 @@ var require_application = __commonJS({
|
|
|
25812
25812
|
this.mountpath = "/";
|
|
25813
25813
|
this.locals.settings = this.settings;
|
|
25814
25814
|
this.set("view", View);
|
|
25815
|
-
this.set("views",
|
|
25815
|
+
this.set("views", resolve13("views"));
|
|
25816
25816
|
this.set("jsonp callback name", "callback");
|
|
25817
25817
|
if (env === "production") {
|
|
25818
25818
|
this.enable("view cache");
|
|
@@ -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 path18 = "/";
|
|
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
|
+
path18 = 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(path18, fn2);
|
|
25871
25871
|
}
|
|
25872
|
-
debug(".use app under %s",
|
|
25873
|
-
fn2.mountpath =
|
|
25872
|
+
debug(".use app under %s", path18);
|
|
25873
|
+
fn2.mountpath = path18;
|
|
25874
25874
|
fn2.parent = this;
|
|
25875
|
-
router.use(
|
|
25875
|
+
router.use(path18, 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(path18) {
|
|
25888
25888
|
this.lazyrouter();
|
|
25889
|
-
return this._router.route(
|
|
25889
|
+
return this._router.route(path18);
|
|
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 path18() {
|
|
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(path18) {
|
|
25957
25957
|
if (method === "get" && arguments.length === 1) {
|
|
25958
|
-
return this.set(
|
|
25958
|
+
return this.set(path18);
|
|
25959
25959
|
}
|
|
25960
25960
|
this.lazyrouter();
|
|
25961
|
-
var route = this._router.route(
|
|
25961
|
+
var route = this._router.route(path18);
|
|
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(path18) {
|
|
25967
25967
|
this.lazyrouter();
|
|
25968
|
-
var route = this._router.route(
|
|
25968
|
+
var route = this._router.route(path18);
|
|
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);
|
|
@@ -26718,16 +26718,16 @@ var require_request = __commonJS({
|
|
|
26718
26718
|
return addrs;
|
|
26719
26719
|
});
|
|
26720
26720
|
defineGetter(req, "subdomains", function subdomains() {
|
|
26721
|
-
var
|
|
26722
|
-
if (!
|
|
26721
|
+
var hostname3 = this.hostname;
|
|
26722
|
+
if (!hostname3) return [];
|
|
26723
26723
|
var offset = this.app.get("subdomain offset");
|
|
26724
|
-
var subdomains2 = !isIP(
|
|
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 path18() {
|
|
26728
26728
|
return parse(this).pathname;
|
|
26729
26729
|
});
|
|
26730
|
-
defineGetter(req, "hostname", function
|
|
26730
|
+
defineGetter(req, "hostname", function hostname3() {
|
|
26731
26731
|
var trust = this.app.get("trust proxy fn");
|
|
26732
26732
|
var host = this.get("X-Forwarded-Host");
|
|
26733
26733
|
if (!host || !trust(this.connection.remoteAddress, 0)) {
|
|
@@ -27047,7 +27047,7 @@ var require_response = __commonJS({
|
|
|
27047
27047
|
var http3 = require("http");
|
|
27048
27048
|
var isAbsolute4 = require_utils2().isAbsolute;
|
|
27049
27049
|
var onFinished = require_on_finished();
|
|
27050
|
-
var
|
|
27050
|
+
var path18 = 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 = path18.extname;
|
|
27060
27060
|
var mime = send.mime;
|
|
27061
|
-
var
|
|
27061
|
+
var resolve13 = path18.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(path19, 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 (!path19) {
|
|
27245
27245
|
throw new TypeError("path argument is required to res.sendFile");
|
|
27246
27246
|
}
|
|
27247
|
-
if (typeof
|
|
27247
|
+
if (typeof path19 !== "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 && !isAbsolute4(
|
|
27254
|
+
if (!opts.root && !isAbsolute4(path19)) {
|
|
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(path19);
|
|
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(path19, 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, path19, 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(path19, 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 || path19)
|
|
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 ?
|
|
27320
|
+
var fullPath = !opts.root ? resolve13(path19) : path19;
|
|
27321
27321
|
return this.sendFile(fullPath, opts, done);
|
|
27322
27322
|
};
|
|
27323
27323
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -27583,7 +27583,7 @@ var require_serve_static = __commonJS({
|
|
|
27583
27583
|
var encodeUrl = require_encodeurl();
|
|
27584
27584
|
var escapeHtml = require_escape_html();
|
|
27585
27585
|
var parseUrl = require_parseurl();
|
|
27586
|
-
var
|
|
27586
|
+
var resolve13 = require("path").resolve;
|
|
27587
27587
|
var send = require_send();
|
|
27588
27588
|
var url = require("url");
|
|
27589
27589
|
module2.exports = serveStatic;
|
|
@@ -27603,7 +27603,7 @@ var require_serve_static = __commonJS({
|
|
|
27603
27603
|
throw new TypeError("option setHeaders must be function");
|
|
27604
27604
|
}
|
|
27605
27605
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
27606
|
-
opts.root =
|
|
27606
|
+
opts.root = resolve13(root);
|
|
27607
27607
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
27608
27608
|
return function serveStatic2(req, res, next) {
|
|
27609
27609
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -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 path18 = parseUrl(req).pathname;
|
|
27622
|
+
if (path18 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
27623
|
+
path18 = "";
|
|
27624
27624
|
}
|
|
27625
|
-
var stream = send(req,
|
|
27625
|
+
var stream = send(req, path18, opts);
|
|
27626
27626
|
stream.on("directory", onDirectory);
|
|
27627
27627
|
if (setHeaders) {
|
|
27628
27628
|
stream.on("headers", setHeaders);
|
|
@@ -29771,7 +29771,7 @@ function wasClockTurnedBack(cachedAt) {
|
|
|
29771
29771
|
return cachedAtSec > nowSeconds();
|
|
29772
29772
|
}
|
|
29773
29773
|
function delay(t, value) {
|
|
29774
|
-
return new Promise((
|
|
29774
|
+
return new Promise((resolve13) => setTimeout(() => resolve13(value), t));
|
|
29775
29775
|
}
|
|
29776
29776
|
|
|
29777
29777
|
// ../../node_modules/.pnpm/@azure+msal-common@16.5.0/node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.mjs
|
|
@@ -31265,7 +31265,7 @@ var developerCliCredentialInternals = {
|
|
|
31265
31265
|
const encodedClaims = btoa(claims);
|
|
31266
31266
|
claimsSections = ["--claims", encodedClaims];
|
|
31267
31267
|
}
|
|
31268
|
-
return new Promise((
|
|
31268
|
+
return new Promise((resolve13, reject) => {
|
|
31269
31269
|
try {
|
|
31270
31270
|
const args = [
|
|
31271
31271
|
"auth",
|
|
@@ -31282,7 +31282,7 @@ var developerCliCredentialInternals = {
|
|
|
31282
31282
|
cwd: developerCliCredentialInternals.getSafeWorkingDir(),
|
|
31283
31283
|
timeout
|
|
31284
31284
|
}, (error, stdout, stderr) => {
|
|
31285
|
-
|
|
31285
|
+
resolve13({ stdout, stderr, error });
|
|
31286
31286
|
});
|
|
31287
31287
|
} catch (err) {
|
|
31288
31288
|
reject(err);
|
|
@@ -31430,7 +31430,7 @@ var cliCredentialInternals = {
|
|
|
31430
31430
|
if (subscription) {
|
|
31431
31431
|
subscriptionSection = ["--subscription", `"${subscription}"`];
|
|
31432
31432
|
}
|
|
31433
|
-
return new Promise((
|
|
31433
|
+
return new Promise((resolve13, reject) => {
|
|
31434
31434
|
try {
|
|
31435
31435
|
const args = [
|
|
31436
31436
|
"account",
|
|
@@ -31444,7 +31444,7 @@ var cliCredentialInternals = {
|
|
|
31444
31444
|
];
|
|
31445
31445
|
const command = ["az", ...args].join(" ");
|
|
31446
31446
|
import_child_process2.default.exec(command, { cwd: cliCredentialInternals.getSafeWorkingDir(), timeout }, (error, stdout, stderr) => {
|
|
31447
|
-
|
|
31447
|
+
resolve13({ stdout, stderr, error });
|
|
31448
31448
|
});
|
|
31449
31449
|
} catch (err) {
|
|
31450
31450
|
reject(err);
|
|
@@ -31585,7 +31585,7 @@ var processUtils = {
|
|
|
31585
31585
|
* @internal
|
|
31586
31586
|
*/
|
|
31587
31587
|
execFile(file, params, options) {
|
|
31588
|
-
return new Promise((
|
|
31588
|
+
return new Promise((resolve13, reject) => {
|
|
31589
31589
|
import_node_child_process.default.execFile(file, params, options, (error, stdout, stderr) => {
|
|
31590
31590
|
if (Buffer.isBuffer(stdout)) {
|
|
31591
31591
|
stdout = stdout.toString("utf8");
|
|
@@ -31596,7 +31596,7 @@ var processUtils = {
|
|
|
31596
31596
|
if (stderr || error) {
|
|
31597
31597
|
reject(stderr ? new Error(stderr) : error);
|
|
31598
31598
|
} else {
|
|
31599
|
-
|
|
31599
|
+
resolve13(stdout);
|
|
31600
31600
|
}
|
|
31601
31601
|
});
|
|
31602
31602
|
});
|
|
@@ -31977,11 +31977,11 @@ function persistNodeStartupTransport(storagePath, transport) {
|
|
|
31977
31977
|
transport
|
|
31978
31978
|
});
|
|
31979
31979
|
}
|
|
31980
|
-
function persistNodeStartupJoin(storagePath,
|
|
31980
|
+
function persistNodeStartupJoin(storagePath, join14) {
|
|
31981
31981
|
const startup = resolveNodeStartupMetadata(storagePath);
|
|
31982
31982
|
persistNodeStartupMetadata(storagePath, {
|
|
31983
31983
|
...startup,
|
|
31984
|
-
join:
|
|
31984
|
+
join: join14
|
|
31985
31985
|
});
|
|
31986
31986
|
}
|
|
31987
31987
|
function resolvePersistedDevTunnelId(storagePath, kind) {
|
|
@@ -32680,6 +32680,18 @@ function createPriorityCounter() {
|
|
|
32680
32680
|
function isPlainObject(value) {
|
|
32681
32681
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
32682
32682
|
}
|
|
32683
|
+
function parseStringArray(value) {
|
|
32684
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string") ? [...value] : void 0;
|
|
32685
|
+
}
|
|
32686
|
+
function parseNodeSettingsSnapshot(value) {
|
|
32687
|
+
if (!isPlainObject(value)) {
|
|
32688
|
+
return void 0;
|
|
32689
|
+
}
|
|
32690
|
+
if (typeof value.collectedAt !== "number" || !Number.isFinite(value.collectedAt) || typeof value.version !== "string" || typeof value.uptime !== "number" || !Number.isFinite(value.uptime)) {
|
|
32691
|
+
return void 0;
|
|
32692
|
+
}
|
|
32693
|
+
return clone(value);
|
|
32694
|
+
}
|
|
32683
32695
|
function isClusterInfo(value) {
|
|
32684
32696
|
return isPlainObject(value) && typeof value.clusterId === "string" && typeof value.createdAt === "number" && Number.isFinite(value.createdAt);
|
|
32685
32697
|
}
|
|
@@ -32703,7 +32715,10 @@ function parseNodeInfo(value) {
|
|
|
32703
32715
|
lastHeartbeat: value.lastHeartbeat,
|
|
32704
32716
|
transportType: typeof value.transportType === "string" ? value.transportType : void 0,
|
|
32705
32717
|
devtunnelEndpoint: typeof value.devtunnelEndpoint === "string" ? value.devtunnelEndpoint : void 0,
|
|
32706
|
-
dashboardOrigin: typeof value.dashboardOrigin === "string" ? value.dashboardOrigin : void 0
|
|
32718
|
+
dashboardOrigin: typeof value.dashboardOrigin === "string" ? value.dashboardOrigin : void 0,
|
|
32719
|
+
workDir: typeof value.workDir === "string" ? value.workDir : void 0,
|
|
32720
|
+
workDirFolders: parseStringArray(value.workDirFolders),
|
|
32721
|
+
settingsSnapshot: parseNodeSettingsSnapshot(value.settingsSnapshot)
|
|
32707
32722
|
};
|
|
32708
32723
|
}
|
|
32709
32724
|
function parseTask(value) {
|
|
@@ -32851,19 +32866,19 @@ async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_NODE_REQUEST_TIME
|
|
|
32851
32866
|
cleanup();
|
|
32852
32867
|
}
|
|
32853
32868
|
}
|
|
32854
|
-
async function fetchNodeWithFallback(node,
|
|
32869
|
+
async function fetchNodeWithFallback(node, path18, init, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS, trace, options) {
|
|
32855
32870
|
let lastError;
|
|
32856
32871
|
const endpoints = getNodeRequestEndpoints(node, options);
|
|
32857
32872
|
for (const [index, endpoint] of endpoints.entries()) {
|
|
32858
32873
|
const attempt = index + 1;
|
|
32859
|
-
trace?.onAttempt?.({ attempt, endpoint, path:
|
|
32874
|
+
trace?.onAttempt?.({ attempt, endpoint, path: path18, timeoutMs, totalEndpoints: endpoints.length });
|
|
32860
32875
|
try {
|
|
32861
|
-
const response = await fetchWithTimeout(`${endpoint}${
|
|
32862
|
-
trace?.onResponse?.({ attempt, endpoint, path:
|
|
32876
|
+
const response = await fetchWithTimeout(`${endpoint}${path18}`, init, timeoutMs);
|
|
32877
|
+
trace?.onResponse?.({ attempt, endpoint, path: path18, response, timeoutMs, totalEndpoints: endpoints.length });
|
|
32863
32878
|
return { endpoint, response };
|
|
32864
32879
|
} catch (error) {
|
|
32865
32880
|
lastError = error;
|
|
32866
|
-
trace?.onError?.({ attempt, endpoint, error, path:
|
|
32881
|
+
trace?.onError?.({ attempt, endpoint, error, path: path18, timeoutMs, totalEndpoints: endpoints.length });
|
|
32867
32882
|
}
|
|
32868
32883
|
}
|
|
32869
32884
|
throw lastError instanceof Error ? lastError : new Error("No reachable node endpoint");
|
|
@@ -32942,6 +32957,28 @@ var NodeRegistry = class {
|
|
|
32942
32957
|
const node = this.nodes.get(id);
|
|
32943
32958
|
if (!node) return;
|
|
32944
32959
|
node.workDirFolders = folders;
|
|
32960
|
+
this.store.upsertNode(node);
|
|
32961
|
+
if (this.selfNode && this.selfNode.id === id) {
|
|
32962
|
+
this.selfNode.workDirFolders = [...folders];
|
|
32963
|
+
}
|
|
32964
|
+
}
|
|
32965
|
+
updateSettingsSnapshot(id, settingsSnapshot) {
|
|
32966
|
+
const node = this.nodes.get(id);
|
|
32967
|
+
if (node) {
|
|
32968
|
+
if (settingsSnapshot) {
|
|
32969
|
+
node.settingsSnapshot = structuredClone(settingsSnapshot);
|
|
32970
|
+
} else {
|
|
32971
|
+
delete node.settingsSnapshot;
|
|
32972
|
+
}
|
|
32973
|
+
this.store.upsertNode(node);
|
|
32974
|
+
}
|
|
32975
|
+
if (this.selfNode && this.selfNode.id === id) {
|
|
32976
|
+
if (settingsSnapshot) {
|
|
32977
|
+
this.selfNode.settingsSnapshot = structuredClone(settingsSnapshot);
|
|
32978
|
+
} else {
|
|
32979
|
+
delete this.selfNode.settingsSnapshot;
|
|
32980
|
+
}
|
|
32981
|
+
}
|
|
32945
32982
|
}
|
|
32946
32983
|
updateEndpoint(id, endpoint) {
|
|
32947
32984
|
const node = this.nodes.get(id);
|
|
@@ -33886,7 +33923,7 @@ function describeControlRequest(request) {
|
|
|
33886
33923
|
};
|
|
33887
33924
|
}
|
|
33888
33925
|
var HeartbeatMonitor = class {
|
|
33889
|
-
constructor(nodeRegistry, election, eventBus, config, logger27) {
|
|
33926
|
+
constructor(nodeRegistry, election, eventBus, config, logger27, getSettingsSnapshot) {
|
|
33890
33927
|
this.nodeRegistry = nodeRegistry;
|
|
33891
33928
|
this.election = election;
|
|
33892
33929
|
this.eventBus = eventBus;
|
|
@@ -33898,6 +33935,7 @@ var HeartbeatMonitor = class {
|
|
|
33898
33935
|
}, child() {
|
|
33899
33936
|
return this;
|
|
33900
33937
|
} };
|
|
33938
|
+
this.getSettingsSnapshot = getSettingsSnapshot;
|
|
33901
33939
|
this.eventBus.on("election.complete", (data) => {
|
|
33902
33940
|
const self2 = this.nodeRegistry.getSelf();
|
|
33903
33941
|
if (data.leaderId === self2.id) {
|
|
@@ -33937,6 +33975,8 @@ var HeartbeatMonitor = class {
|
|
|
33937
33975
|
pendingControlResponses = /* @__PURE__ */ new Map();
|
|
33938
33976
|
/** Follower-side callback for executing keepalive-delivered control requests. */
|
|
33939
33977
|
controlRequestHandler;
|
|
33978
|
+
/** Optional callback to compute the current node's settings snapshot for gossip. */
|
|
33979
|
+
getSettingsSnapshot;
|
|
33940
33980
|
/** Throttle repetitive heartbeat / keepalive logs while preserving periodic visibility. */
|
|
33941
33981
|
throttledLogs = /* @__PURE__ */ new Map();
|
|
33942
33982
|
/** Set the callback used to query tasks assigned to a follower for pull-based dispatch. */
|
|
@@ -33983,7 +34023,7 @@ var HeartbeatMonitor = class {
|
|
|
33983
34023
|
nodeId,
|
|
33984
34024
|
...describeControlRequest(fullRequest)
|
|
33985
34025
|
});
|
|
33986
|
-
return new Promise((
|
|
34026
|
+
return new Promise((resolve13, reject) => {
|
|
33987
34027
|
const timeoutId = setTimeout(() => {
|
|
33988
34028
|
this.pendingControlResponses.delete(fullRequest.requestId);
|
|
33989
34029
|
reject(new Error(`Timed out waiting for ${fullRequest.kind} response from ${nodeId}`));
|
|
@@ -33991,7 +34031,7 @@ var HeartbeatMonitor = class {
|
|
|
33991
34031
|
this.pendingControlResponses.set(fullRequest.requestId, {
|
|
33992
34032
|
nodeId,
|
|
33993
34033
|
kind: fullRequest.kind,
|
|
33994
|
-
resolve:
|
|
34034
|
+
resolve: resolve13,
|
|
33995
34035
|
reject,
|
|
33996
34036
|
timeoutId
|
|
33997
34037
|
});
|
|
@@ -34053,6 +34093,7 @@ var HeartbeatMonitor = class {
|
|
|
34053
34093
|
// ── Leader: send heartbeats ─────────────────────────────────────────
|
|
34054
34094
|
async sendHeartbeat() {
|
|
34055
34095
|
const self2 = this.nodeRegistry.getSelf();
|
|
34096
|
+
this.refreshSelfSettingsSnapshot();
|
|
34056
34097
|
if (self2.workDir) {
|
|
34057
34098
|
this.nodeRegistry.updateFolders(self2.id, listWorkDirFolders(self2.workDir));
|
|
34058
34099
|
}
|
|
@@ -34185,7 +34226,8 @@ var HeartbeatMonitor = class {
|
|
|
34185
34226
|
devtunnelEnabled: self2.devtunnelEndpoint !== void 0,
|
|
34186
34227
|
devtunnelEndpoint: self2.devtunnelEndpoint,
|
|
34187
34228
|
dashboardOrigin: self2.dashboardOrigin,
|
|
34188
|
-
workDirFolders: self2.workDir ? listWorkDirFolders(self2.workDir) : void 0
|
|
34229
|
+
workDirFolders: self2.workDir ? listWorkDirFolders(self2.workDir) : void 0,
|
|
34230
|
+
settingsSnapshot: this.resolveCurrentSettingsSnapshot()
|
|
34189
34231
|
};
|
|
34190
34232
|
return response;
|
|
34191
34233
|
}
|
|
@@ -34203,7 +34245,8 @@ var HeartbeatMonitor = class {
|
|
|
34203
34245
|
devtunnelEnabled,
|
|
34204
34246
|
devtunnelEndpoint,
|
|
34205
34247
|
dashboardOrigin,
|
|
34206
|
-
workDirFolders
|
|
34248
|
+
workDirFolders,
|
|
34249
|
+
settingsSnapshot
|
|
34207
34250
|
} = req;
|
|
34208
34251
|
const existingNode = this.nodeRegistry.getNode(nodeId);
|
|
34209
34252
|
const normalizedName = name2 ?? existingNode?.name ?? nodeId;
|
|
@@ -34227,7 +34270,8 @@ var HeartbeatMonitor = class {
|
|
|
34227
34270
|
...workDir ? { workDir } : {},
|
|
34228
34271
|
...devtunnelEnabled && devtunnelEndpoint ? { devtunnelEndpoint } : {},
|
|
34229
34272
|
...dashboardOrigin ? { dashboardOrigin } : {},
|
|
34230
|
-
...workDirFolders ? { workDirFolders } : {}
|
|
34273
|
+
...workDirFolders ? { workDirFolders } : {},
|
|
34274
|
+
...settingsSnapshot ? { settingsSnapshot } : {}
|
|
34231
34275
|
});
|
|
34232
34276
|
this.log.info("keepalive restored missing follower", { nodeId, endpoint: normalizedEndpoint });
|
|
34233
34277
|
node = this.nodeRegistry.getNode(nodeId);
|
|
@@ -34263,6 +34307,7 @@ var HeartbeatMonitor = class {
|
|
|
34263
34307
|
if (workDirFolders) {
|
|
34264
34308
|
this.nodeRegistry.updateFolders(nodeId, workDirFolders);
|
|
34265
34309
|
}
|
|
34310
|
+
this.nodeRegistry.updateSettingsSnapshot(nodeId, settingsSnapshot);
|
|
34266
34311
|
const clusterState = this.nodeRegistry.getClusterState();
|
|
34267
34312
|
const self2 = this.nodeRegistry.getSelf();
|
|
34268
34313
|
const dispatchedTasks = this.getAssignedTasks?.(nodeId) ?? [];
|
|
@@ -34305,6 +34350,7 @@ var HeartbeatMonitor = class {
|
|
|
34305
34350
|
return;
|
|
34306
34351
|
}
|
|
34307
34352
|
const self2 = this.nodeRegistry.getSelf();
|
|
34353
|
+
const settingsSnapshot = this.resolveCurrentSettingsSnapshot();
|
|
34308
34354
|
const request = {
|
|
34309
34355
|
nodeId: self2.id,
|
|
34310
34356
|
name: self2.name,
|
|
@@ -34317,7 +34363,8 @@ var HeartbeatMonitor = class {
|
|
|
34317
34363
|
devtunnelEnabled: self2.devtunnelEndpoint !== void 0,
|
|
34318
34364
|
devtunnelEndpoint: self2.devtunnelEndpoint,
|
|
34319
34365
|
dashboardOrigin: self2.dashboardOrigin,
|
|
34320
|
-
workDirFolders: self2.workDir ? listWorkDirFolders(self2.workDir) : void 0
|
|
34366
|
+
workDirFolders: self2.workDir ? listWorkDirFolders(self2.workDir) : void 0,
|
|
34367
|
+
settingsSnapshot
|
|
34321
34368
|
};
|
|
34322
34369
|
this.log.debug("sending keepalive request", {
|
|
34323
34370
|
nodeId: self2.id,
|
|
@@ -34426,6 +34473,7 @@ var HeartbeatMonitor = class {
|
|
|
34426
34473
|
startLeaderMode() {
|
|
34427
34474
|
this.heartbeatTimer = setInterval(() => {
|
|
34428
34475
|
const self2 = this.nodeRegistry.getSelf();
|
|
34476
|
+
this.refreshSelfSettingsSnapshot();
|
|
34429
34477
|
if (self2.workDir) {
|
|
34430
34478
|
this.nodeRegistry.updateFolders(self2.id, listWorkDirFolders(self2.workDir));
|
|
34431
34479
|
}
|
|
@@ -34532,6 +34580,17 @@ var HeartbeatMonitor = class {
|
|
|
34532
34580
|
this.nodeRegistry.updateDevTunnelEndpoint(nodeId, endpoint);
|
|
34533
34581
|
}
|
|
34534
34582
|
}
|
|
34583
|
+
resolveCurrentSettingsSnapshot() {
|
|
34584
|
+
const snapshot = this.getSettingsSnapshot?.();
|
|
34585
|
+
return snapshot ? structuredClone(snapshot) : void 0;
|
|
34586
|
+
}
|
|
34587
|
+
refreshSelfSettingsSnapshot() {
|
|
34588
|
+
const snapshot = this.resolveCurrentSettingsSnapshot();
|
|
34589
|
+
if (!snapshot) {
|
|
34590
|
+
return;
|
|
34591
|
+
}
|
|
34592
|
+
this.nodeRegistry.updateSettingsSnapshot(this.nodeRegistry.getSelf().id, snapshot);
|
|
34593
|
+
}
|
|
34535
34594
|
clearAllTimers() {
|
|
34536
34595
|
if (this.heartbeatTimer !== null) {
|
|
34537
34596
|
clearInterval(this.heartbeatTimer);
|
|
@@ -34657,9 +34716,9 @@ var DataRouter = class {
|
|
|
34657
34716
|
/**
|
|
34658
34717
|
* Returns true if the request should be proxied to the leader.
|
|
34659
34718
|
*/
|
|
34660
|
-
shouldProxy(method,
|
|
34719
|
+
shouldProxy(method, path18) {
|
|
34661
34720
|
if (this.election.isLeader()) return false;
|
|
34662
|
-
if (this.isExcludedPath(
|
|
34721
|
+
if (this.isExcludedPath(path18)) return false;
|
|
34663
34722
|
if (method.toUpperCase() === "GET") return false;
|
|
34664
34723
|
return WRITE_METHODS.has(method.toUpperCase());
|
|
34665
34724
|
}
|
|
@@ -34760,8 +34819,8 @@ var DataRouter = class {
|
|
|
34760
34819
|
};
|
|
34761
34820
|
}
|
|
34762
34821
|
// ── Helpers ───────────────────────────────────────────────────────────
|
|
34763
|
-
isExcludedPath(
|
|
34764
|
-
return EXCLUDED_PATH_PREFIXES.some((prefix) =>
|
|
34822
|
+
isExcludedPath(path18) {
|
|
34823
|
+
return EXCLUDED_PATH_PREFIXES.some((prefix) => path18.startsWith(prefix)) || EXCLUDED_PATH_SUFFIXES.some((suffix) => path18.endsWith(suffix));
|
|
34765
34824
|
}
|
|
34766
34825
|
};
|
|
34767
34826
|
|
|
@@ -35745,10 +35804,12 @@ var MeshyNode = class {
|
|
|
35745
35804
|
started = false;
|
|
35746
35805
|
devtunnelTransport = null;
|
|
35747
35806
|
externalLogger;
|
|
35807
|
+
getSettingsSnapshot;
|
|
35748
35808
|
constructor(config, deps) {
|
|
35749
35809
|
this.config = config;
|
|
35750
35810
|
this.transportFactory = deps.transportFactory;
|
|
35751
35811
|
this.externalLogger = deps.logger;
|
|
35812
|
+
this.getSettingsSnapshot = deps.getSettingsSnapshot;
|
|
35752
35813
|
}
|
|
35753
35814
|
// ── Lifecycle ──────────────────────────────────────────────────────────
|
|
35754
35815
|
async start() {
|
|
@@ -35790,7 +35851,8 @@ var MeshyNode = class {
|
|
|
35790
35851
|
heartbeatInterval: this.config.cluster.heartbeatInterval,
|
|
35791
35852
|
electionTimeout: this.config.cluster.electionTimeout
|
|
35792
35853
|
},
|
|
35793
|
-
this.logger
|
|
35854
|
+
this.logger,
|
|
35855
|
+
this.getSettingsSnapshot
|
|
35794
35856
|
);
|
|
35795
35857
|
const logDir = path10.join(this.config.storage.path, "task-logs");
|
|
35796
35858
|
this.taskEngine = new TaskEngine(this.store, this.nodeRegistry, this.eventBus, logDir);
|
|
@@ -35880,6 +35942,10 @@ ${joinErrors.map((e) => ` - ${e}`).join("\n")}`
|
|
|
35880
35942
|
if (self2.dashboardOrigin) {
|
|
35881
35943
|
joinBody.dashboardOrigin = self2.dashboardOrigin;
|
|
35882
35944
|
}
|
|
35945
|
+
const settingsSnapshot = this.getSettingsSnapshot?.();
|
|
35946
|
+
if (settingsSnapshot) {
|
|
35947
|
+
joinBody.settingsSnapshot = settingsSnapshot;
|
|
35948
|
+
}
|
|
35883
35949
|
log2.info("sending cluster join request", {
|
|
35884
35950
|
seedUrl,
|
|
35885
35951
|
nodeId: self2.id,
|
|
@@ -36206,7 +36272,8 @@ ${joinErrors.map((e) => ` - ${e}`).join("\n")}`
|
|
|
36206
36272
|
workDir: currentSelf.workDir,
|
|
36207
36273
|
workDirFolders: listWorkDirFolders(this.getWorkDir()),
|
|
36208
36274
|
...currentSelf.devtunnelEndpoint ? { devtunnelEndpoint: currentSelf.devtunnelEndpoint } : {},
|
|
36209
|
-
...currentSelf.dashboardOrigin ? { dashboardOrigin: currentSelf.dashboardOrigin } : {}
|
|
36275
|
+
...currentSelf.dashboardOrigin ? { dashboardOrigin: currentSelf.dashboardOrigin } : {},
|
|
36276
|
+
...currentSelf.settingsSnapshot ? { settingsSnapshot: currentSelf.settingsSnapshot } : {}
|
|
36210
36277
|
};
|
|
36211
36278
|
this.selfInfo = nextSelf;
|
|
36212
36279
|
this.nodeRegistry.setSelf(nextSelf);
|
|
@@ -36908,8 +36975,8 @@ function getErrorMap() {
|
|
|
36908
36975
|
|
|
36909
36976
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
36910
36977
|
var makeIssue = (params) => {
|
|
36911
|
-
const { data, path:
|
|
36912
|
-
const fullPath = [...
|
|
36978
|
+
const { data, path: path18, errorMaps, issueData } = params;
|
|
36979
|
+
const fullPath = [...path18, ...issueData.path || []];
|
|
36913
36980
|
const fullIssue = {
|
|
36914
36981
|
...issueData,
|
|
36915
36982
|
path: fullPath
|
|
@@ -37025,11 +37092,11 @@ var errorUtil;
|
|
|
37025
37092
|
|
|
37026
37093
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
37027
37094
|
var ParseInputLazyPath = class {
|
|
37028
|
-
constructor(parent, value,
|
|
37095
|
+
constructor(parent, value, path18, key) {
|
|
37029
37096
|
this._cachedPath = [];
|
|
37030
37097
|
this.parent = parent;
|
|
37031
37098
|
this.data = value;
|
|
37032
|
-
this._path =
|
|
37099
|
+
this._path = path18;
|
|
37033
37100
|
this._key = key;
|
|
37034
37101
|
}
|
|
37035
37102
|
get path() {
|
|
@@ -40486,6 +40553,90 @@ var ErrorResponse = external_exports.object({
|
|
|
40486
40553
|
var OkResponse = external_exports.object({
|
|
40487
40554
|
ok: external_exports.literal(true)
|
|
40488
40555
|
});
|
|
40556
|
+
var SystemComponentStatusSchema = external_exports.object({
|
|
40557
|
+
installed: external_exports.boolean(),
|
|
40558
|
+
authenticated: external_exports.boolean().optional(),
|
|
40559
|
+
status: external_exports.enum(["ok", "missing", "not-authenticated", "install-failed", "login-failed", "unsupported-platform", "unknown"]),
|
|
40560
|
+
checkedAt: external_exports.string().optional()
|
|
40561
|
+
});
|
|
40562
|
+
var SystemPackageInfoSchema = external_exports.object({
|
|
40563
|
+
name: external_exports.string(),
|
|
40564
|
+
version: external_exports.string()
|
|
40565
|
+
});
|
|
40566
|
+
var SystemRepositoryInfoSchema = external_exports.object({
|
|
40567
|
+
url: external_exports.string().optional(),
|
|
40568
|
+
branch: external_exports.string().optional(),
|
|
40569
|
+
commit: external_exports.string().optional()
|
|
40570
|
+
});
|
|
40571
|
+
var SystemOsInfoSchema = external_exports.object({
|
|
40572
|
+
platform: external_exports.string(),
|
|
40573
|
+
release: external_exports.string(),
|
|
40574
|
+
arch: external_exports.string(),
|
|
40575
|
+
hostname: external_exports.string(),
|
|
40576
|
+
cpuModel: external_exports.string().nullable().optional(),
|
|
40577
|
+
cpuCount: external_exports.number(),
|
|
40578
|
+
totalMemoryBytes: external_exports.number(),
|
|
40579
|
+
freeMemoryBytes: external_exports.number()
|
|
40580
|
+
});
|
|
40581
|
+
var SystemRuntimeInfoSchema = external_exports.object({
|
|
40582
|
+
nodeVersion: external_exports.string(),
|
|
40583
|
+
pid: external_exports.number(),
|
|
40584
|
+
startedAt: external_exports.number(),
|
|
40585
|
+
cwd: external_exports.string(),
|
|
40586
|
+
workDir: external_exports.string().nullable().optional(),
|
|
40587
|
+
storagePath: external_exports.string().nullable().optional(),
|
|
40588
|
+
localDashboardOrigin: external_exports.string().nullable().optional()
|
|
40589
|
+
});
|
|
40590
|
+
var SystemAuthInfoSchema = external_exports.object({
|
|
40591
|
+
enabled: external_exports.boolean(),
|
|
40592
|
+
allowSameTenant: external_exports.boolean(),
|
|
40593
|
+
allowedUsers: external_exports.array(external_exports.string())
|
|
40594
|
+
});
|
|
40595
|
+
var SystemAgentInfoSchema = external_exports.object({
|
|
40596
|
+
id: external_exports.enum(["claude", "codex"]),
|
|
40597
|
+
label: external_exports.string(),
|
|
40598
|
+
command: external_exports.string(),
|
|
40599
|
+
available: external_exports.boolean(),
|
|
40600
|
+
path: external_exports.string().nullable(),
|
|
40601
|
+
version: external_exports.string().nullable(),
|
|
40602
|
+
checkedAt: external_exports.string(),
|
|
40603
|
+
detail: external_exports.string().nullable().optional(),
|
|
40604
|
+
metadataStatus: external_exports.string().nullable().optional()
|
|
40605
|
+
});
|
|
40606
|
+
var NodeSettingsSnapshotSchema = external_exports.object({
|
|
40607
|
+
collectedAt: external_exports.number(),
|
|
40608
|
+
version: external_exports.string(),
|
|
40609
|
+
packageName: external_exports.string().optional(),
|
|
40610
|
+
uptime: external_exports.number(),
|
|
40611
|
+
auth: SystemAuthInfoSchema.optional(),
|
|
40612
|
+
os: SystemOsInfoSchema.optional(),
|
|
40613
|
+
runtime: SystemRuntimeInfoSchema.optional(),
|
|
40614
|
+
agents: external_exports.array(SystemAgentInfoSchema).optional(),
|
|
40615
|
+
startupRequirements: external_exports.object({
|
|
40616
|
+
lastCheckedAt: external_exports.string().optional(),
|
|
40617
|
+
lastCheckedOn: external_exports.string().optional(),
|
|
40618
|
+
components: external_exports.object({
|
|
40619
|
+
az: SystemComponentStatusSchema.optional(),
|
|
40620
|
+
devtunnel: SystemComponentStatusSchema.optional(),
|
|
40621
|
+
claude: SystemComponentStatusSchema.optional(),
|
|
40622
|
+
codex: SystemComponentStatusSchema.optional()
|
|
40623
|
+
}).optional()
|
|
40624
|
+
}).optional(),
|
|
40625
|
+
components: external_exports.object({
|
|
40626
|
+
az: SystemComponentStatusSchema.optional(),
|
|
40627
|
+
devtunnel: SystemComponentStatusSchema.optional(),
|
|
40628
|
+
claude: SystemComponentStatusSchema.optional(),
|
|
40629
|
+
codex: SystemComponentStatusSchema.optional()
|
|
40630
|
+
}).optional(),
|
|
40631
|
+
repository: SystemRepositoryInfoSchema.optional(),
|
|
40632
|
+
packages: external_exports.object({
|
|
40633
|
+
workspace: SystemPackageInfoSchema.optional(),
|
|
40634
|
+
node: SystemPackageInfoSchema.optional(),
|
|
40635
|
+
core: SystemPackageInfoSchema.optional(),
|
|
40636
|
+
dashboard: SystemPackageInfoSchema.optional(),
|
|
40637
|
+
api: SystemPackageInfoSchema.optional()
|
|
40638
|
+
}).optional()
|
|
40639
|
+
});
|
|
40489
40640
|
|
|
40490
40641
|
// ../../packages/api/src/schemas/cluster.ts
|
|
40491
40642
|
var NodeInfoSchema = external_exports.object({
|
|
@@ -40499,7 +40650,10 @@ var NodeInfoSchema = external_exports.object({
|
|
|
40499
40650
|
lastHeartbeat: external_exports.number(),
|
|
40500
40651
|
transportType: external_exports.string().optional(),
|
|
40501
40652
|
devtunnelEndpoint: external_exports.string().optional(),
|
|
40502
|
-
dashboardOrigin: external_exports.string().optional()
|
|
40653
|
+
dashboardOrigin: external_exports.string().optional(),
|
|
40654
|
+
workDir: external_exports.string().optional(),
|
|
40655
|
+
workDirFolders: external_exports.array(external_exports.string()).optional(),
|
|
40656
|
+
settingsSnapshot: NodeSettingsSnapshotSchema.optional()
|
|
40503
40657
|
});
|
|
40504
40658
|
var JoinTaskSchema = external_exports.object({
|
|
40505
40659
|
id: external_exports.string(),
|
|
@@ -40531,6 +40685,7 @@ var JoinClusterBody = external_exports.object({
|
|
|
40531
40685
|
workDirFolders: external_exports.array(external_exports.string()).optional(),
|
|
40532
40686
|
devtunnelEndpoint: external_exports.string().url().optional(),
|
|
40533
40687
|
dashboardOrigin: external_exports.string().url().optional(),
|
|
40688
|
+
settingsSnapshot: NodeSettingsSnapshotSchema.optional(),
|
|
40534
40689
|
tasks: external_exports.array(JoinTaskSchema).default([])
|
|
40535
40690
|
});
|
|
40536
40691
|
var JoinClusterResponse = external_exports.object({
|
|
@@ -40574,7 +40729,8 @@ var NodeInfoSchema2 = external_exports.object({
|
|
|
40574
40729
|
devtunnelEndpoint: external_exports.string().optional(),
|
|
40575
40730
|
dashboardOrigin: external_exports.string().optional(),
|
|
40576
40731
|
workDir: external_exports.string().optional(),
|
|
40577
|
-
workDirFolders: external_exports.array(external_exports.string()).optional()
|
|
40732
|
+
workDirFolders: external_exports.array(external_exports.string()).optional(),
|
|
40733
|
+
settingsSnapshot: NodeSettingsSnapshotSchema.optional()
|
|
40578
40734
|
});
|
|
40579
40735
|
var QueryBoolean = external_exports.preprocess((value) => {
|
|
40580
40736
|
if (value === void 0) {
|
|
@@ -41046,7 +41202,8 @@ function createClusterRoutes() {
|
|
|
41046
41202
|
...body.workDir && { workDir: body.workDir },
|
|
41047
41203
|
...body.workDirFolders && { workDirFolders: body.workDirFolders },
|
|
41048
41204
|
...body.devtunnelEndpoint && { devtunnelEndpoint: body.devtunnelEndpoint },
|
|
41049
|
-
...body.dashboardOrigin && { dashboardOrigin: body.dashboardOrigin }
|
|
41205
|
+
...body.dashboardOrigin && { dashboardOrigin: body.dashboardOrigin },
|
|
41206
|
+
...body.settingsSnapshot && { settingsSnapshot: body.settingsSnapshot }
|
|
41050
41207
|
};
|
|
41051
41208
|
nodeRegistry.addNode(node);
|
|
41052
41209
|
taskEngine.importTasks(body.tasks ?? []);
|
|
@@ -41469,7 +41626,7 @@ function getGitDiff(dirPath) {
|
|
|
41469
41626
|
if (!isGitRepo(dirPath)) {
|
|
41470
41627
|
return { available: false };
|
|
41471
41628
|
}
|
|
41472
|
-
const
|
|
41629
|
+
const repoRoot2 = git(["rev-parse", "--show-toplevel"], dirPath);
|
|
41473
41630
|
const branch = git(["rev-parse", "--abbrev-ref", "HEAD"], dirPath) || null;
|
|
41474
41631
|
const staged = git(["diff", "--cached"], dirPath);
|
|
41475
41632
|
const unstaged = git(["diff"], dirPath);
|
|
@@ -41488,7 +41645,7 @@ function getGitDiff(dirPath) {
|
|
|
41488
41645
|
}
|
|
41489
41646
|
return {
|
|
41490
41647
|
available: true,
|
|
41491
|
-
repoRoot,
|
|
41648
|
+
repoRoot: repoRoot2,
|
|
41492
41649
|
branch,
|
|
41493
41650
|
staged: staged || void 0,
|
|
41494
41651
|
unstaged: unstaged || void 0,
|
|
@@ -43479,6 +43636,123 @@ function createWorkerRoutes() {
|
|
|
43479
43636
|
|
|
43480
43637
|
// ../../packages/api/src/routes/system.ts
|
|
43481
43638
|
var import_express7 = __toESM(require_express2(), 1);
|
|
43639
|
+
|
|
43640
|
+
// ../../packages/api/src/system-info.ts
|
|
43641
|
+
var os5 = __toESM(require("os"), 1);
|
|
43642
|
+
var import_node_child_process5 = require("child_process");
|
|
43643
|
+
var RUNTIME_TOOLS = [
|
|
43644
|
+
{ id: "claude", label: "Claude Code", command: "claude" },
|
|
43645
|
+
{ id: "codex", label: "Codex", command: "codex" }
|
|
43646
|
+
];
|
|
43647
|
+
function normalizeOutput(output) {
|
|
43648
|
+
if (!output) {
|
|
43649
|
+
return null;
|
|
43650
|
+
}
|
|
43651
|
+
const firstLine = output.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
43652
|
+
return firstLine ?? null;
|
|
43653
|
+
}
|
|
43654
|
+
function resolveCommandPath(command) {
|
|
43655
|
+
const lookupCommand = process.platform === "win32" ? "where" : "which";
|
|
43656
|
+
const result = (0, import_node_child_process5.spawnSync)(lookupCommand, [command], {
|
|
43657
|
+
encoding: "utf-8",
|
|
43658
|
+
shell: false,
|
|
43659
|
+
windowsHide: true,
|
|
43660
|
+
timeout: 1500
|
|
43661
|
+
});
|
|
43662
|
+
if (result.status === 0) {
|
|
43663
|
+
return { path: normalizeOutput(result.stdout) };
|
|
43664
|
+
}
|
|
43665
|
+
return {
|
|
43666
|
+
path: null,
|
|
43667
|
+
detail: normalizeOutput(result.stderr) ?? result.error?.message ?? null
|
|
43668
|
+
};
|
|
43669
|
+
}
|
|
43670
|
+
function inspectTool(definition) {
|
|
43671
|
+
const checkedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
43672
|
+
const resolved = resolveCommandPath(definition.command);
|
|
43673
|
+
if (!resolved.path) {
|
|
43674
|
+
return {
|
|
43675
|
+
id: definition.id,
|
|
43676
|
+
label: definition.label,
|
|
43677
|
+
command: definition.command,
|
|
43678
|
+
available: false,
|
|
43679
|
+
path: null,
|
|
43680
|
+
version: null,
|
|
43681
|
+
checkedAt,
|
|
43682
|
+
detail: resolved.detail ?? "Command not found on PATH"
|
|
43683
|
+
};
|
|
43684
|
+
}
|
|
43685
|
+
const versionResult = (0, import_node_child_process5.spawnSync)(definition.command, ["--version"], {
|
|
43686
|
+
encoding: "utf-8",
|
|
43687
|
+
shell: process.platform === "win32",
|
|
43688
|
+
windowsHide: true,
|
|
43689
|
+
timeout: 2500
|
|
43690
|
+
});
|
|
43691
|
+
const version2 = normalizeOutput(versionResult.stdout) ?? normalizeOutput(versionResult.stderr);
|
|
43692
|
+
const detail = versionResult.status === 0 ? null : normalizeOutput(versionResult.stderr) ?? versionResult.error?.message ?? "Version check failed";
|
|
43693
|
+
return {
|
|
43694
|
+
id: definition.id,
|
|
43695
|
+
label: definition.label,
|
|
43696
|
+
command: definition.command,
|
|
43697
|
+
available: true,
|
|
43698
|
+
path: resolved.path,
|
|
43699
|
+
version: version2,
|
|
43700
|
+
checkedAt,
|
|
43701
|
+
detail
|
|
43702
|
+
};
|
|
43703
|
+
}
|
|
43704
|
+
function inspectRuntimeTools() {
|
|
43705
|
+
return RUNTIME_TOOLS.map(inspectTool);
|
|
43706
|
+
}
|
|
43707
|
+
function getOsSnapshot() {
|
|
43708
|
+
const cpus2 = os5.cpus();
|
|
43709
|
+
return {
|
|
43710
|
+
platform: os5.platform(),
|
|
43711
|
+
release: os5.release(),
|
|
43712
|
+
arch: os5.arch(),
|
|
43713
|
+
hostname: os5.hostname(),
|
|
43714
|
+
cpuModel: cpus2[0]?.model ?? null,
|
|
43715
|
+
cpuCount: cpus2.length,
|
|
43716
|
+
totalMemoryBytes: os5.totalmem(),
|
|
43717
|
+
freeMemoryBytes: os5.freemem()
|
|
43718
|
+
};
|
|
43719
|
+
}
|
|
43720
|
+
function buildNodeSettingsSnapshot(options) {
|
|
43721
|
+
const uptime = process.uptime();
|
|
43722
|
+
const runtimeMetadata = options.runtimeMetadata;
|
|
43723
|
+
const agents = (options.inspectRuntimeTools?.() ?? inspectRuntimeTools()).map((agent) => ({
|
|
43724
|
+
...agent,
|
|
43725
|
+
metadataStatus: runtimeMetadata?.components?.[agent.id]?.status ?? null
|
|
43726
|
+
}));
|
|
43727
|
+
return {
|
|
43728
|
+
collectedAt: Date.now(),
|
|
43729
|
+
version: runtimeMetadata?.packageVersion ?? "0.1.0",
|
|
43730
|
+
packageName: runtimeMetadata?.packageName ?? "meshy",
|
|
43731
|
+
uptime,
|
|
43732
|
+
auth: options.auth,
|
|
43733
|
+
os: getOsSnapshot(),
|
|
43734
|
+
runtime: {
|
|
43735
|
+
nodeVersion: process.version,
|
|
43736
|
+
pid: process.pid,
|
|
43737
|
+
startedAt: Date.now() - Math.floor(uptime * 1e3),
|
|
43738
|
+
cwd: process.cwd(),
|
|
43739
|
+
workDir: options.workDir ?? null,
|
|
43740
|
+
storagePath: options.storagePath ?? null,
|
|
43741
|
+
localDashboardOrigin: options.localDashboardOrigin ?? null
|
|
43742
|
+
},
|
|
43743
|
+
agents,
|
|
43744
|
+
startupRequirements: {
|
|
43745
|
+
lastCheckedAt: runtimeMetadata?.startupRequirementsLastCheckedAt,
|
|
43746
|
+
lastCheckedOn: runtimeMetadata?.startupRequirementsLastCheckedOn,
|
|
43747
|
+
components: runtimeMetadata?.components ?? {}
|
|
43748
|
+
},
|
|
43749
|
+
components: runtimeMetadata?.components ?? {},
|
|
43750
|
+
repository: runtimeMetadata?.repository ?? {},
|
|
43751
|
+
packages: runtimeMetadata?.packages ?? {}
|
|
43752
|
+
};
|
|
43753
|
+
}
|
|
43754
|
+
|
|
43755
|
+
// ../../packages/api/src/routes/system.ts
|
|
43482
43756
|
function asyncHandler6(fn) {
|
|
43483
43757
|
return (req, res, next) => fn(req, res, next).catch(next);
|
|
43484
43758
|
}
|
|
@@ -43494,19 +43768,47 @@ function createSystemRoutes() {
|
|
|
43494
43768
|
res.json({ status: "ok", timestamp: Date.now() });
|
|
43495
43769
|
}));
|
|
43496
43770
|
router.get("/info", asyncHandler6(async (req, res) => {
|
|
43497
|
-
const {
|
|
43771
|
+
const {
|
|
43772
|
+
nodeRegistry,
|
|
43773
|
+
getTransportType,
|
|
43774
|
+
config,
|
|
43775
|
+
dashboardOrigin,
|
|
43776
|
+
localDashboardOrigin,
|
|
43777
|
+
storagePath,
|
|
43778
|
+
inspectRuntimeTools: inspectTools,
|
|
43779
|
+
runtimeMetadata
|
|
43780
|
+
} = req.app.locals.deps;
|
|
43498
43781
|
const self2 = nodeRegistry.getSelf();
|
|
43782
|
+
const auth = config.authMetadata ?? {
|
|
43783
|
+
enabled: false,
|
|
43784
|
+
allowSameTenant: false,
|
|
43785
|
+
allowedUsers: []
|
|
43786
|
+
};
|
|
43787
|
+
const settingsSnapshot = buildNodeSettingsSnapshot({
|
|
43788
|
+
auth,
|
|
43789
|
+
inspectRuntimeTools: inspectTools,
|
|
43790
|
+
localDashboardOrigin,
|
|
43791
|
+
runtimeMetadata,
|
|
43792
|
+
storagePath,
|
|
43793
|
+
workDir: self2.workDir
|
|
43794
|
+
});
|
|
43499
43795
|
res.json({
|
|
43500
43796
|
...self2,
|
|
43501
|
-
|
|
43502
|
-
|
|
43797
|
+
nodeId: self2.id,
|
|
43798
|
+
version: settingsSnapshot.version,
|
|
43799
|
+
packageName: settingsSnapshot.packageName,
|
|
43800
|
+
uptime: settingsSnapshot.uptime,
|
|
43503
43801
|
transportType: getTransportType?.() ?? "direct",
|
|
43504
43802
|
dashboardOrigin: dashboardOrigin ?? self2.dashboardOrigin,
|
|
43505
|
-
|
|
43506
|
-
|
|
43507
|
-
|
|
43508
|
-
|
|
43509
|
-
|
|
43803
|
+
localDashboardOrigin,
|
|
43804
|
+
auth: settingsSnapshot.auth,
|
|
43805
|
+
os: settingsSnapshot.os,
|
|
43806
|
+
runtime: settingsSnapshot.runtime,
|
|
43807
|
+
agents: settingsSnapshot.agents,
|
|
43808
|
+
startupRequirements: settingsSnapshot.startupRequirements,
|
|
43809
|
+
components: settingsSnapshot.components,
|
|
43810
|
+
repository: settingsSnapshot.repository,
|
|
43811
|
+
packages: settingsSnapshot.packages
|
|
43510
43812
|
});
|
|
43511
43813
|
}));
|
|
43512
43814
|
router.post("/transport", asyncHandler6(async (req, res) => {
|
|
@@ -43776,12 +44078,12 @@ function detectLocalIp() {
|
|
|
43776
44078
|
return "127.0.0.1";
|
|
43777
44079
|
}
|
|
43778
44080
|
function detectAvailablePort() {
|
|
43779
|
-
return new Promise((
|
|
44081
|
+
return new Promise((resolve13, reject) => {
|
|
43780
44082
|
const srv = (0, import_node_http2.createServer)();
|
|
43781
44083
|
srv.listen(0, () => {
|
|
43782
44084
|
const addr = srv.address();
|
|
43783
44085
|
const port = addr && typeof addr !== "string" ? addr.port : 0;
|
|
43784
|
-
srv.close((err) => err ? reject(err) :
|
|
44086
|
+
srv.close((err) => err ? reject(err) : resolve13(port));
|
|
43785
44087
|
});
|
|
43786
44088
|
srv.on("error", reject);
|
|
43787
44089
|
});
|
|
@@ -43826,10 +44128,10 @@ var DirectTransport = class {
|
|
|
43826
44128
|
};
|
|
43827
44129
|
|
|
43828
44130
|
// ../../packages/transport/src/devtunnel.ts
|
|
43829
|
-
var
|
|
44131
|
+
var import_node_child_process6 = require("child_process");
|
|
43830
44132
|
function isInstalled(cmd) {
|
|
43831
44133
|
try {
|
|
43832
|
-
(0,
|
|
44134
|
+
(0, import_node_child_process6.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
|
|
43833
44135
|
return true;
|
|
43834
44136
|
} catch {
|
|
43835
44137
|
return false;
|
|
@@ -43852,18 +44154,18 @@ var DevTunnelTransport = class {
|
|
|
43852
44154
|
);
|
|
43853
44155
|
}
|
|
43854
44156
|
try {
|
|
43855
|
-
(0,
|
|
44157
|
+
(0, import_node_child_process6.execSync)("devtunnel user show", { stdio: "pipe" });
|
|
43856
44158
|
} catch {
|
|
43857
44159
|
throw new Error(
|
|
43858
44160
|
"Not logged in to devtunnel. Run: devtunnel user login"
|
|
43859
44161
|
);
|
|
43860
44162
|
}
|
|
43861
44163
|
const hostArgs = this.buildHostArgs(localPort);
|
|
43862
|
-
const child = (0,
|
|
44164
|
+
const child = (0, import_node_child_process6.spawn)("devtunnel", hostArgs, {
|
|
43863
44165
|
stdio: ["pipe", "pipe", "pipe"]
|
|
43864
44166
|
});
|
|
43865
44167
|
this.process = child;
|
|
43866
|
-
this.publicUrl = await new Promise((
|
|
44168
|
+
this.publicUrl = await new Promise((resolve13, reject) => {
|
|
43867
44169
|
const timeout = setTimeout(() => {
|
|
43868
44170
|
child.kill();
|
|
43869
44171
|
this.process = null;
|
|
@@ -43886,7 +44188,7 @@ var DevTunnelTransport = class {
|
|
|
43886
44188
|
clearTimeout(timeout);
|
|
43887
44189
|
child.stdout?.removeListener("data", onData);
|
|
43888
44190
|
child.stderr?.removeListener("data", onErrData);
|
|
43889
|
-
|
|
44191
|
+
resolve13(url.replace(/\/+$/, ""));
|
|
43890
44192
|
};
|
|
43891
44193
|
child.stdout?.on("data", onData);
|
|
43892
44194
|
child.stderr?.on("data", onErrData);
|
|
@@ -43918,14 +44220,14 @@ ${lines.join("")}`
|
|
|
43918
44220
|
this.publicUrl = null;
|
|
43919
44221
|
if (child.exitCode === null) {
|
|
43920
44222
|
child.kill("SIGTERM");
|
|
43921
|
-
await new Promise((
|
|
44223
|
+
await new Promise((resolve13) => {
|
|
43922
44224
|
const killTimer = setTimeout(() => {
|
|
43923
44225
|
child.kill("SIGKILL");
|
|
43924
|
-
|
|
44226
|
+
resolve13();
|
|
43925
44227
|
}, 5e3);
|
|
43926
44228
|
child.on("close", () => {
|
|
43927
44229
|
clearTimeout(killTimer);
|
|
43928
|
-
|
|
44230
|
+
resolve13();
|
|
43929
44231
|
});
|
|
43930
44232
|
});
|
|
43931
44233
|
}
|
|
@@ -43964,7 +44266,7 @@ ${lines.join("")}`
|
|
|
43964
44266
|
return void 0;
|
|
43965
44267
|
}
|
|
43966
44268
|
try {
|
|
43967
|
-
(0,
|
|
44269
|
+
(0, import_node_child_process6.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
|
|
43968
44270
|
return tunnelId;
|
|
43969
44271
|
} catch {
|
|
43970
44272
|
const createArgs = ["create", tunnelId];
|
|
@@ -43972,7 +44274,7 @@ ${lines.join("")}`
|
|
|
43972
44274
|
createArgs.push("-a");
|
|
43973
44275
|
}
|
|
43974
44276
|
try {
|
|
43975
|
-
(0,
|
|
44277
|
+
(0, import_node_child_process6.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
|
|
43976
44278
|
return tunnelId;
|
|
43977
44279
|
} catch (err) {
|
|
43978
44280
|
throw new Error(
|
|
@@ -43987,7 +44289,7 @@ ${lines.join("")}`
|
|
|
43987
44289
|
return;
|
|
43988
44290
|
}
|
|
43989
44291
|
try {
|
|
43990
|
-
(0,
|
|
44292
|
+
(0, import_node_child_process6.execFileSync)(
|
|
43991
44293
|
"devtunnel",
|
|
43992
44294
|
["port", "create", tunnelId, "-p", String(localPort), "--protocol", "http"],
|
|
43993
44295
|
{ stdio: "pipe" }
|
|
@@ -44003,7 +44305,7 @@ ${lines.join("")}`
|
|
|
44003
44305
|
}
|
|
44004
44306
|
listTunnelPorts(tunnelId) {
|
|
44005
44307
|
try {
|
|
44006
|
-
const output = (0,
|
|
44308
|
+
const output = (0, import_node_child_process6.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
|
|
44007
44309
|
const parsed = JSON.parse(output.toString());
|
|
44008
44310
|
const items = Array.isArray(parsed) ? parsed : parsed && typeof parsed === "object" && Array.isArray(parsed.ports) ? parsed.ports : parsed && typeof parsed === "object" && Array.isArray(parsed.value) ? parsed.value : [];
|
|
44009
44311
|
return items.map((item) => getPortNumber(item)).filter((value) => value !== void 0);
|
|
@@ -44015,7 +44317,7 @@ ${lines.join("")}`
|
|
|
44015
44317
|
}
|
|
44016
44318
|
hasTunnelPort(tunnelId, localPort) {
|
|
44017
44319
|
try {
|
|
44018
|
-
(0,
|
|
44320
|
+
(0, import_node_child_process6.execFileSync)(
|
|
44019
44321
|
"devtunnel",
|
|
44020
44322
|
["port", "show", tunnelId, "-p", String(localPort), "-j"],
|
|
44021
44323
|
{ stdio: "pipe" }
|
|
@@ -44073,7 +44375,7 @@ function createTransport(config) {
|
|
|
44073
44375
|
var fs15 = __toESM(require("fs"), 1);
|
|
44074
44376
|
var path16 = __toESM(require("path"), 1);
|
|
44075
44377
|
var readline = __toESM(require("readline/promises"), 1);
|
|
44076
|
-
var
|
|
44378
|
+
var import_node_child_process7 = require("child_process");
|
|
44077
44379
|
function getDefaultNodeName() {
|
|
44078
44380
|
return getDeviceNodeName();
|
|
44079
44381
|
}
|
|
@@ -44118,11 +44420,11 @@ function createPromptSession(prompt) {
|
|
|
44118
44420
|
close: async () => rl.close()
|
|
44119
44421
|
};
|
|
44120
44422
|
}
|
|
44121
|
-
function createDefaultCommandRunner(
|
|
44423
|
+
function createDefaultCommandRunner(platform2) {
|
|
44122
44424
|
return (command, args, interactive = false) => {
|
|
44123
|
-
const result = (0,
|
|
44425
|
+
const result = (0, import_node_child_process7.spawnSync)(command, args, {
|
|
44124
44426
|
encoding: "utf-8",
|
|
44125
|
-
shell:
|
|
44427
|
+
shell: platform2 === "win32",
|
|
44126
44428
|
stdio: interactive ? "inherit" : "pipe"
|
|
44127
44429
|
});
|
|
44128
44430
|
return {
|
|
@@ -44163,33 +44465,33 @@ async function confirm(ask, question) {
|
|
|
44163
44465
|
const answer = await ask(`${question} [y/N]: `);
|
|
44164
44466
|
return isYesAnswer(answer);
|
|
44165
44467
|
}
|
|
44166
|
-
function isCommandAvailable(commandRunner,
|
|
44167
|
-
const lookupCommand =
|
|
44468
|
+
function isCommandAvailable(commandRunner, platform2, command) {
|
|
44469
|
+
const lookupCommand = platform2 === "win32" ? "where" : "which";
|
|
44168
44470
|
return commandRunner(lookupCommand, [command], false).ok;
|
|
44169
44471
|
}
|
|
44170
|
-
function buildInstallCommand(requirement,
|
|
44472
|
+
function buildInstallCommand(requirement, platform2) {
|
|
44171
44473
|
switch (requirement) {
|
|
44172
44474
|
case "az":
|
|
44173
|
-
if (
|
|
44475
|
+
if (platform2 === "darwin") {
|
|
44174
44476
|
return { command: "brew", args: ["install", "azure-cli"] };
|
|
44175
44477
|
}
|
|
44176
|
-
if (
|
|
44478
|
+
if (platform2 === "win32") {
|
|
44177
44479
|
return { command: "winget", args: ["install", "--exact", "--id", "Microsoft.AzureCLI"] };
|
|
44178
44480
|
}
|
|
44179
44481
|
return void 0;
|
|
44180
44482
|
case "devtunnel":
|
|
44181
|
-
if (
|
|
44483
|
+
if (platform2 === "darwin") {
|
|
44182
44484
|
return { command: "brew", args: ["install", "--cask", "devtunnel"] };
|
|
44183
44485
|
}
|
|
44184
|
-
if (
|
|
44486
|
+
if (platform2 === "win32") {
|
|
44185
44487
|
return { command: "winget", args: ["install", "--exact", "--id", "Microsoft.devtunnel"] };
|
|
44186
44488
|
}
|
|
44187
44489
|
return void 0;
|
|
44188
44490
|
case "claude":
|
|
44189
|
-
if (
|
|
44491
|
+
if (platform2 === "darwin") {
|
|
44190
44492
|
return { command: "bash", args: ["-lc", "curl -fsSL https://claude.ai/install.sh | bash"] };
|
|
44191
44493
|
}
|
|
44192
|
-
if (
|
|
44494
|
+
if (platform2 === "win32") {
|
|
44193
44495
|
return {
|
|
44194
44496
|
command: "powershell",
|
|
44195
44497
|
args: ["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", "irm https://claude.ai/install.ps1 | iex"]
|
|
@@ -44230,17 +44532,17 @@ function shouldSkipStartupRequirementsCheck(storagePath, now = /* @__PURE__ */ n
|
|
|
44230
44532
|
}
|
|
44231
44533
|
return STARTUP_REQUIREMENTS.every((requirement) => isRequirementSatisfied(requirement, metadata.components?.[requirement]));
|
|
44232
44534
|
}
|
|
44233
|
-
async function ensureRequirementInstalled(requirement,
|
|
44234
|
-
if (isCommandAvailable(commandRunner,
|
|
44535
|
+
async function ensureRequirementInstalled(requirement, platform2, ask, commandRunner, stdout, stderr) {
|
|
44536
|
+
if (isCommandAvailable(commandRunner, platform2, requirement)) {
|
|
44235
44537
|
return { installed: true, status: "ok" };
|
|
44236
44538
|
}
|
|
44237
44539
|
if (!ask) {
|
|
44238
44540
|
writeLine(stderr, `Missing required component "${requirement}". Start in a TTY to install it automatically.`);
|
|
44239
44541
|
return { installed: false, status: "missing" };
|
|
44240
44542
|
}
|
|
44241
|
-
const install = buildInstallCommand(requirement,
|
|
44543
|
+
const install = buildInstallCommand(requirement, platform2);
|
|
44242
44544
|
if (!install) {
|
|
44243
|
-
writeLine(stderr, `Missing required component "${requirement}", and automatic install is not supported on ${
|
|
44545
|
+
writeLine(stderr, `Missing required component "${requirement}", and automatic install is not supported on ${platform2}.`);
|
|
44244
44546
|
return { installed: false, status: "unsupported-platform" };
|
|
44245
44547
|
}
|
|
44246
44548
|
if (!await confirm(ask, `Required component "${requirement}" is missing. Install it now?`)) {
|
|
@@ -44252,7 +44554,7 @@ async function ensureRequirementInstalled(requirement, platform, ask, commandRun
|
|
|
44252
44554
|
writeLine(stderr, `Failed to install ${requirement}.`);
|
|
44253
44555
|
return { installed: false, status: "install-failed" };
|
|
44254
44556
|
}
|
|
44255
|
-
return isCommandAvailable(commandRunner,
|
|
44557
|
+
return isCommandAvailable(commandRunner, platform2, requirement) ? { installed: true, status: "ok" } : { installed: false, status: "install-failed" };
|
|
44256
44558
|
}
|
|
44257
44559
|
async function ensureRequirementAuthenticated(requirement, ask, commandRunner, stdout, stderr) {
|
|
44258
44560
|
if (isAuthenticated(requirement, commandRunner)) {
|
|
@@ -44282,10 +44584,10 @@ async function ensureStartupRequirements(storagePath, options = {}) {
|
|
|
44282
44584
|
metadata: resolveStartupRequirementsMetadata(storagePath)
|
|
44283
44585
|
};
|
|
44284
44586
|
}
|
|
44285
|
-
const
|
|
44587
|
+
const platform2 = options.platform ?? process.platform;
|
|
44286
44588
|
const stdout = options.stdout ?? process.stdout;
|
|
44287
44589
|
const stderr = options.stderr ?? process.stderr;
|
|
44288
|
-
const commandRunner = options.commandRunner ?? createDefaultCommandRunner(
|
|
44590
|
+
const commandRunner = options.commandRunner ?? createDefaultCommandRunner(platform2);
|
|
44289
44591
|
const promptSession = createPromptSession(options.prompt);
|
|
44290
44592
|
const checkedAt = now.toISOString();
|
|
44291
44593
|
const checkedOn = formatLocalDate(now);
|
|
@@ -44294,7 +44596,7 @@ async function ensureStartupRequirements(storagePath, options = {}) {
|
|
|
44294
44596
|
for (const requirement of STARTUP_REQUIREMENTS) {
|
|
44295
44597
|
const installResult = await ensureRequirementInstalled(
|
|
44296
44598
|
requirement,
|
|
44297
|
-
|
|
44599
|
+
platform2,
|
|
44298
44600
|
promptSession?.ask,
|
|
44299
44601
|
commandRunner,
|
|
44300
44602
|
stdout,
|
|
@@ -44392,9 +44694,9 @@ function parseArgs(argv) {
|
|
|
44392
44694
|
}
|
|
44393
44695
|
return result;
|
|
44394
44696
|
}
|
|
44395
|
-
function loadConfigFile(
|
|
44697
|
+
function loadConfigFile(path18) {
|
|
44396
44698
|
try {
|
|
44397
|
-
const raw = fs15.readFileSync(
|
|
44699
|
+
const raw = fs15.readFileSync(path18, "utf-8");
|
|
44398
44700
|
return JSON.parse(raw);
|
|
44399
44701
|
} catch {
|
|
44400
44702
|
return {};
|
|
@@ -44558,6 +44860,149 @@ function formatLoadedStartMetadata(info, authEnabled) {
|
|
|
44558
44860
|
return lines.join("\n");
|
|
44559
44861
|
}
|
|
44560
44862
|
|
|
44863
|
+
// src/runtime-metadata.ts
|
|
44864
|
+
var fs16 = __toESM(require("fs"), 1);
|
|
44865
|
+
var path17 = __toESM(require("path"), 1);
|
|
44866
|
+
var import_node_child_process8 = require("child_process");
|
|
44867
|
+
var runtimeDir = resolveRuntimeDir();
|
|
44868
|
+
var appRoot = resolveAppRoot(runtimeDir);
|
|
44869
|
+
var repoRoot = path17.resolve(appRoot, "../..");
|
|
44870
|
+
function resolveRuntimeDir() {
|
|
44871
|
+
const entryPath = process.argv[1];
|
|
44872
|
+
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
44873
|
+
try {
|
|
44874
|
+
return path17.dirname(fs16.realpathSync(path17.resolve(entryPath)));
|
|
44875
|
+
} catch {
|
|
44876
|
+
return path17.dirname(path17.resolve(entryPath));
|
|
44877
|
+
}
|
|
44878
|
+
}
|
|
44879
|
+
return process.cwd();
|
|
44880
|
+
}
|
|
44881
|
+
function readJsonFile(filePath) {
|
|
44882
|
+
try {
|
|
44883
|
+
return JSON.parse(fs16.readFileSync(filePath, "utf-8"));
|
|
44884
|
+
} catch {
|
|
44885
|
+
return null;
|
|
44886
|
+
}
|
|
44887
|
+
}
|
|
44888
|
+
function readPackageManifest(filePath) {
|
|
44889
|
+
return readJsonFile(filePath);
|
|
44890
|
+
}
|
|
44891
|
+
function readEmbeddedRuntimeMetadata() {
|
|
44892
|
+
const candidates = [
|
|
44893
|
+
path17.join(appRoot, "runtime-metadata.json"),
|
|
44894
|
+
path17.join(runtimeDir, "runtime-metadata.json")
|
|
44895
|
+
];
|
|
44896
|
+
for (const candidate of candidates) {
|
|
44897
|
+
const metadata = readJsonFile(candidate);
|
|
44898
|
+
if (metadata) {
|
|
44899
|
+
return metadata;
|
|
44900
|
+
}
|
|
44901
|
+
}
|
|
44902
|
+
return null;
|
|
44903
|
+
}
|
|
44904
|
+
function resolveAppRoot(baseDir) {
|
|
44905
|
+
const candidates = [
|
|
44906
|
+
baseDir,
|
|
44907
|
+
path17.resolve(baseDir, ".."),
|
|
44908
|
+
path17.resolve(process.cwd(), "apps/node/dist"),
|
|
44909
|
+
path17.resolve(process.cwd(), "apps/node"),
|
|
44910
|
+
process.cwd()
|
|
44911
|
+
];
|
|
44912
|
+
for (const candidate of candidates) {
|
|
44913
|
+
const manifest = readPackageManifest(path17.join(candidate, "package.json"));
|
|
44914
|
+
if (manifest?.name === "@meshy/node" || manifest?.name === "meshy-node") {
|
|
44915
|
+
return candidate;
|
|
44916
|
+
}
|
|
44917
|
+
}
|
|
44918
|
+
for (const candidate of candidates) {
|
|
44919
|
+
if (fs16.existsSync(path17.join(candidate, "package.json"))) {
|
|
44920
|
+
return candidate;
|
|
44921
|
+
}
|
|
44922
|
+
}
|
|
44923
|
+
return path17.resolve(baseDir, "..");
|
|
44924
|
+
}
|
|
44925
|
+
function toPackageInfo(filePath) {
|
|
44926
|
+
const manifest = readPackageManifest(filePath);
|
|
44927
|
+
if (!manifest?.name || !manifest.version) {
|
|
44928
|
+
return void 0;
|
|
44929
|
+
}
|
|
44930
|
+
return {
|
|
44931
|
+
name: manifest.name,
|
|
44932
|
+
version: manifest.version
|
|
44933
|
+
};
|
|
44934
|
+
}
|
|
44935
|
+
function normalizeRepositoryUrl(value) {
|
|
44936
|
+
const trimmed = value?.trim().replace(/\.git$/i, "");
|
|
44937
|
+
if (!trimmed) {
|
|
44938
|
+
return void 0;
|
|
44939
|
+
}
|
|
44940
|
+
const sshMatch = trimmed.match(/^git@github\.com:(.+)$/i);
|
|
44941
|
+
if (sshMatch?.[1]) {
|
|
44942
|
+
return `https://github.com/${sshMatch[1]}`;
|
|
44943
|
+
}
|
|
44944
|
+
const sshProtocolMatch = trimmed.match(/^ssh:\/\/git@github\.com\/(.+)$/i);
|
|
44945
|
+
if (sshProtocolMatch?.[1]) {
|
|
44946
|
+
return `https://github.com/${sshProtocolMatch[1]}`;
|
|
44947
|
+
}
|
|
44948
|
+
return trimmed;
|
|
44949
|
+
}
|
|
44950
|
+
function readRepositoryUrlFromManifest(manifest) {
|
|
44951
|
+
if (!manifest?.repository) {
|
|
44952
|
+
return void 0;
|
|
44953
|
+
}
|
|
44954
|
+
if (typeof manifest.repository === "string") {
|
|
44955
|
+
return normalizeRepositoryUrl(manifest.repository);
|
|
44956
|
+
}
|
|
44957
|
+
return normalizeRepositoryUrl(manifest.repository.url);
|
|
44958
|
+
}
|
|
44959
|
+
function readGitValue(args) {
|
|
44960
|
+
try {
|
|
44961
|
+
const output = (0, import_node_child_process8.execFileSync)("git", args, {
|
|
44962
|
+
cwd: repoRoot,
|
|
44963
|
+
encoding: "utf-8",
|
|
44964
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
44965
|
+
windowsHide: true
|
|
44966
|
+
}).trim();
|
|
44967
|
+
return output || void 0;
|
|
44968
|
+
} catch {
|
|
44969
|
+
return void 0;
|
|
44970
|
+
}
|
|
44971
|
+
}
|
|
44972
|
+
function buildRuntimeMetadata(storagePath) {
|
|
44973
|
+
const startupRequirements = resolveStartupRequirementsMetadata(storagePath);
|
|
44974
|
+
const embedded = readEmbeddedRuntimeMetadata();
|
|
44975
|
+
if (embedded) {
|
|
44976
|
+
return {
|
|
44977
|
+
...embedded,
|
|
44978
|
+
startupRequirementsLastCheckedAt: startupRequirements.lastCheckedAt,
|
|
44979
|
+
startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
|
|
44980
|
+
components: startupRequirements.components
|
|
44981
|
+
};
|
|
44982
|
+
}
|
|
44983
|
+
const appPackage = toPackageInfo(path17.join(appRoot, "package.json"));
|
|
44984
|
+
const workspaceManifest = readPackageManifest(path17.join(repoRoot, "package.json"));
|
|
44985
|
+
return {
|
|
44986
|
+
packageName: appPackage?.name ?? "meshy",
|
|
44987
|
+
packageVersion: appPackage?.version ?? "0.1.0",
|
|
44988
|
+
startupRequirementsLastCheckedAt: startupRequirements.lastCheckedAt,
|
|
44989
|
+
startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
|
|
44990
|
+
components: startupRequirements.components,
|
|
44991
|
+
packages: {
|
|
44992
|
+
workspace: toPackageInfo(path17.join(repoRoot, "package.json")),
|
|
44993
|
+
node: appPackage,
|
|
44994
|
+
core: toPackageInfo(path17.join(repoRoot, "packages/core/package.json")),
|
|
44995
|
+
dashboard: toPackageInfo(path17.join(repoRoot, "packages/dashboard/package.json")),
|
|
44996
|
+
api: toPackageInfo(path17.join(repoRoot, "packages/api/package.json"))
|
|
44997
|
+
},
|
|
44998
|
+
repository: {
|
|
44999
|
+
url: normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.origin.url"])) ?? readRepositoryUrlFromManifest(workspaceManifest),
|
|
45000
|
+
branch: readGitValue(["rev-parse", "--abbrev-ref", "HEAD"]),
|
|
45001
|
+
commit: readGitValue(["rev-parse", "--short", "HEAD"])
|
|
45002
|
+
}
|
|
45003
|
+
};
|
|
45004
|
+
}
|
|
45005
|
+
|
|
44561
45006
|
// src/main.ts
|
|
44562
45007
|
function formatBanner(info) {
|
|
44563
45008
|
const lines = [
|
|
@@ -44616,6 +45061,8 @@ async function main() {
|
|
|
44616
45061
|
console.log(
|
|
44617
45062
|
startupRequirements.skipped ? "Startup requirements already verified today; skipping checks." : "Startup requirements check complete."
|
|
44618
45063
|
);
|
|
45064
|
+
const runtimeMetadata = buildRuntimeMetadata(config.storage.path);
|
|
45065
|
+
const localDashboardOrigin = `http://localhost:${config.node.port}`;
|
|
44619
45066
|
const logDir = nodePath.join(config.storage.path, "logs");
|
|
44620
45067
|
const logger27 = createLogger({
|
|
44621
45068
|
component: "node",
|
|
@@ -44637,11 +45084,30 @@ async function main() {
|
|
|
44637
45084
|
} else {
|
|
44638
45085
|
setRequestAuthHeadersProvider(null);
|
|
44639
45086
|
}
|
|
45087
|
+
let cachedSettingsSnapshot = null;
|
|
45088
|
+
let cachedSettingsSnapshotAt = 0;
|
|
45089
|
+
const getSettingsSnapshot = () => {
|
|
45090
|
+
const now = Date.now();
|
|
45091
|
+
if (cachedSettingsSnapshot && now - cachedSettingsSnapshotAt < 3e4) {
|
|
45092
|
+
return structuredClone(cachedSettingsSnapshot);
|
|
45093
|
+
}
|
|
45094
|
+
cachedSettingsSnapshot = buildNodeSettingsSnapshot({
|
|
45095
|
+
auth: authMetadata,
|
|
45096
|
+
localDashboardOrigin,
|
|
45097
|
+
runtimeMetadata,
|
|
45098
|
+
storagePath: config.storage.path,
|
|
45099
|
+
workDir: nodePath.resolve(config.node.workDir ?? process.cwd())
|
|
45100
|
+
});
|
|
45101
|
+
cachedSettingsSnapshotAt = now;
|
|
45102
|
+
return structuredClone(cachedSettingsSnapshot);
|
|
45103
|
+
};
|
|
44640
45104
|
const meshyNode = new MeshyNode(config, {
|
|
44641
45105
|
logger: logger27,
|
|
44642
|
-
transportFactory: createTransport
|
|
45106
|
+
transportFactory: createTransport,
|
|
45107
|
+
getSettingsSnapshot
|
|
44643
45108
|
});
|
|
44644
45109
|
await meshyNode.start();
|
|
45110
|
+
meshyNode.getNodeRegistry().updateSettingsSnapshot(meshyNode.getNodeRegistry().getSelf().id, getSettingsSnapshot());
|
|
44645
45111
|
const previewSessionManager = new PreviewSessionManager();
|
|
44646
45112
|
const previewProxyManager = new PreviewProxyManager();
|
|
44647
45113
|
let dashboardTransport = null;
|
|
@@ -44651,13 +45117,13 @@ async function main() {
|
|
|
44651
45117
|
if (!server2) {
|
|
44652
45118
|
return;
|
|
44653
45119
|
}
|
|
44654
|
-
await new Promise((
|
|
45120
|
+
await new Promise((resolve13, reject) => {
|
|
44655
45121
|
server2.close((err) => {
|
|
44656
45122
|
if (err) {
|
|
44657
45123
|
reject(err);
|
|
44658
45124
|
return;
|
|
44659
45125
|
}
|
|
44660
|
-
|
|
45126
|
+
resolve13();
|
|
44661
45127
|
});
|
|
44662
45128
|
});
|
|
44663
45129
|
}
|
|
@@ -44775,6 +45241,7 @@ async function main() {
|
|
|
44775
45241
|
validateBearerToken: authMetadata.enabled ? (header) => nodeAuth.validateAuthorizationHeader(header) : void 0
|
|
44776
45242
|
},
|
|
44777
45243
|
workDir: meshyNode.getWorkDir(),
|
|
45244
|
+
storagePath: config.storage.path,
|
|
44778
45245
|
persistNodeNamePreference: (name2) => persistDefaultNodeName(config.storage.path, name2),
|
|
44779
45246
|
joinCurrentNodeToCluster: async (leaderEndpoint) => {
|
|
44780
45247
|
await meshyNode.joinCluster(leaderEndpoint);
|
|
@@ -44805,8 +45272,9 @@ async function main() {
|
|
|
44805
45272
|
await syncDashboardTransport("disableDevTunnel");
|
|
44806
45273
|
},
|
|
44807
45274
|
isDevTunnelEnabled: () => meshyNode.isDevTunnelEnabled(),
|
|
44808
|
-
localDashboardOrigin
|
|
44809
|
-
dashboardOrigin
|
|
45275
|
+
localDashboardOrigin,
|
|
45276
|
+
dashboardOrigin,
|
|
45277
|
+
runtimeMetadata
|
|
44810
45278
|
};
|
|
44811
45279
|
deps.previewSessionManager = previewSessionManager;
|
|
44812
45280
|
deps.previewProxyManager = previewProxyManager;
|