meshy-node 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dashboard/assets/DashboardPage-vTNa1p9t.js +172 -0
- package/dashboard/assets/{DiffTab-L7XOR2ma.js → DiffTab-Cul1vyzx.js} +4 -4
- package/dashboard/assets/{FilesTab-MiZ3rGO0.js → FilesTab-lmhjg0sO.js} +5 -5
- package/dashboard/assets/{PreviewTab-DdT_r4GF.js → PreviewTab-DPnxufTZ.js} +4 -4
- package/dashboard/assets/{file-DP1hVNzm.js → file-DOpaEqEq.js} +1 -1
- package/dashboard/assets/index-BaryQ110.css +1 -0
- package/dashboard/assets/index-BgqvdxOA.js +249 -0
- package/dashboard/index.html +2 -2
- package/main.cjs +786 -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
|
|
|
@@ -35398,6 +35457,31 @@ function buildAssistantEvent(text, timestamp = (/* @__PURE__ */ new Date()).toIS
|
|
|
35398
35457
|
timestamp
|
|
35399
35458
|
};
|
|
35400
35459
|
}
|
|
35460
|
+
function buildAssistantThinkingEvent(thinking, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
35461
|
+
return {
|
|
35462
|
+
type: "assistant",
|
|
35463
|
+
message: {
|
|
35464
|
+
role: "assistant",
|
|
35465
|
+
content: [{ type: "thinking", thinking }]
|
|
35466
|
+
},
|
|
35467
|
+
timestamp
|
|
35468
|
+
};
|
|
35469
|
+
}
|
|
35470
|
+
function extractCodexReasoningText(item) {
|
|
35471
|
+
if (typeof item.text === "string") {
|
|
35472
|
+
return item.text.trim();
|
|
35473
|
+
}
|
|
35474
|
+
if (Array.isArray(item.summary)) {
|
|
35475
|
+
return item.summary.map((entry) => {
|
|
35476
|
+
if (typeof entry === "string") return entry.trim();
|
|
35477
|
+
if (typeof entry === "object" && entry !== null && typeof entry.text === "string") {
|
|
35478
|
+
return String(entry.text).trim();
|
|
35479
|
+
}
|
|
35480
|
+
return "";
|
|
35481
|
+
}).filter(Boolean).join("\n\n");
|
|
35482
|
+
}
|
|
35483
|
+
return "";
|
|
35484
|
+
}
|
|
35401
35485
|
function sanitizeFilename(filename) {
|
|
35402
35486
|
return filename.replace(/[^a-zA-Z0-9._-]/g, "-");
|
|
35403
35487
|
}
|
|
@@ -35612,6 +35696,12 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
35612
35696
|
if (item?.type === "agent_message" && typeof item.text === "string" && item.text.trim()) {
|
|
35613
35697
|
return buildAssistantEvent(item.text);
|
|
35614
35698
|
}
|
|
35699
|
+
if (item?.type === "reasoning" || item?.type === "agent_reasoning") {
|
|
35700
|
+
const reasoning = extractCodexReasoningText(item);
|
|
35701
|
+
if (reasoning) {
|
|
35702
|
+
return buildAssistantThinkingEvent(reasoning);
|
|
35703
|
+
}
|
|
35704
|
+
}
|
|
35615
35705
|
}
|
|
35616
35706
|
return null;
|
|
35617
35707
|
}
|
|
@@ -35745,10 +35835,12 @@ var MeshyNode = class {
|
|
|
35745
35835
|
started = false;
|
|
35746
35836
|
devtunnelTransport = null;
|
|
35747
35837
|
externalLogger;
|
|
35838
|
+
getSettingsSnapshot;
|
|
35748
35839
|
constructor(config, deps) {
|
|
35749
35840
|
this.config = config;
|
|
35750
35841
|
this.transportFactory = deps.transportFactory;
|
|
35751
35842
|
this.externalLogger = deps.logger;
|
|
35843
|
+
this.getSettingsSnapshot = deps.getSettingsSnapshot;
|
|
35752
35844
|
}
|
|
35753
35845
|
// ── Lifecycle ──────────────────────────────────────────────────────────
|
|
35754
35846
|
async start() {
|
|
@@ -35790,7 +35882,8 @@ var MeshyNode = class {
|
|
|
35790
35882
|
heartbeatInterval: this.config.cluster.heartbeatInterval,
|
|
35791
35883
|
electionTimeout: this.config.cluster.electionTimeout
|
|
35792
35884
|
},
|
|
35793
|
-
this.logger
|
|
35885
|
+
this.logger,
|
|
35886
|
+
this.getSettingsSnapshot
|
|
35794
35887
|
);
|
|
35795
35888
|
const logDir = path10.join(this.config.storage.path, "task-logs");
|
|
35796
35889
|
this.taskEngine = new TaskEngine(this.store, this.nodeRegistry, this.eventBus, logDir);
|
|
@@ -35880,6 +35973,10 @@ ${joinErrors.map((e) => ` - ${e}`).join("\n")}`
|
|
|
35880
35973
|
if (self2.dashboardOrigin) {
|
|
35881
35974
|
joinBody.dashboardOrigin = self2.dashboardOrigin;
|
|
35882
35975
|
}
|
|
35976
|
+
const settingsSnapshot = this.getSettingsSnapshot?.();
|
|
35977
|
+
if (settingsSnapshot) {
|
|
35978
|
+
joinBody.settingsSnapshot = settingsSnapshot;
|
|
35979
|
+
}
|
|
35883
35980
|
log2.info("sending cluster join request", {
|
|
35884
35981
|
seedUrl,
|
|
35885
35982
|
nodeId: self2.id,
|
|
@@ -36206,7 +36303,8 @@ ${joinErrors.map((e) => ` - ${e}`).join("\n")}`
|
|
|
36206
36303
|
workDir: currentSelf.workDir,
|
|
36207
36304
|
workDirFolders: listWorkDirFolders(this.getWorkDir()),
|
|
36208
36305
|
...currentSelf.devtunnelEndpoint ? { devtunnelEndpoint: currentSelf.devtunnelEndpoint } : {},
|
|
36209
|
-
...currentSelf.dashboardOrigin ? { dashboardOrigin: currentSelf.dashboardOrigin } : {}
|
|
36306
|
+
...currentSelf.dashboardOrigin ? { dashboardOrigin: currentSelf.dashboardOrigin } : {},
|
|
36307
|
+
...currentSelf.settingsSnapshot ? { settingsSnapshot: currentSelf.settingsSnapshot } : {}
|
|
36210
36308
|
};
|
|
36211
36309
|
this.selfInfo = nextSelf;
|
|
36212
36310
|
this.nodeRegistry.setSelf(nextSelf);
|
|
@@ -36908,8 +37006,8 @@ function getErrorMap() {
|
|
|
36908
37006
|
|
|
36909
37007
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
36910
37008
|
var makeIssue = (params) => {
|
|
36911
|
-
const { data, path:
|
|
36912
|
-
const fullPath = [...
|
|
37009
|
+
const { data, path: path18, errorMaps, issueData } = params;
|
|
37010
|
+
const fullPath = [...path18, ...issueData.path || []];
|
|
36913
37011
|
const fullIssue = {
|
|
36914
37012
|
...issueData,
|
|
36915
37013
|
path: fullPath
|
|
@@ -37025,11 +37123,11 @@ var errorUtil;
|
|
|
37025
37123
|
|
|
37026
37124
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
37027
37125
|
var ParseInputLazyPath = class {
|
|
37028
|
-
constructor(parent, value,
|
|
37126
|
+
constructor(parent, value, path18, key) {
|
|
37029
37127
|
this._cachedPath = [];
|
|
37030
37128
|
this.parent = parent;
|
|
37031
37129
|
this.data = value;
|
|
37032
|
-
this._path =
|
|
37130
|
+
this._path = path18;
|
|
37033
37131
|
this._key = key;
|
|
37034
37132
|
}
|
|
37035
37133
|
get path() {
|
|
@@ -40486,6 +40584,90 @@ var ErrorResponse = external_exports.object({
|
|
|
40486
40584
|
var OkResponse = external_exports.object({
|
|
40487
40585
|
ok: external_exports.literal(true)
|
|
40488
40586
|
});
|
|
40587
|
+
var SystemComponentStatusSchema = external_exports.object({
|
|
40588
|
+
installed: external_exports.boolean(),
|
|
40589
|
+
authenticated: external_exports.boolean().optional(),
|
|
40590
|
+
status: external_exports.enum(["ok", "missing", "not-authenticated", "install-failed", "login-failed", "unsupported-platform", "unknown"]),
|
|
40591
|
+
checkedAt: external_exports.string().optional()
|
|
40592
|
+
});
|
|
40593
|
+
var SystemPackageInfoSchema = external_exports.object({
|
|
40594
|
+
name: external_exports.string(),
|
|
40595
|
+
version: external_exports.string()
|
|
40596
|
+
});
|
|
40597
|
+
var SystemRepositoryInfoSchema = external_exports.object({
|
|
40598
|
+
url: external_exports.string().optional(),
|
|
40599
|
+
branch: external_exports.string().optional(),
|
|
40600
|
+
commit: external_exports.string().optional()
|
|
40601
|
+
});
|
|
40602
|
+
var SystemOsInfoSchema = external_exports.object({
|
|
40603
|
+
platform: external_exports.string(),
|
|
40604
|
+
release: external_exports.string(),
|
|
40605
|
+
arch: external_exports.string(),
|
|
40606
|
+
hostname: external_exports.string(),
|
|
40607
|
+
cpuModel: external_exports.string().nullable().optional(),
|
|
40608
|
+
cpuCount: external_exports.number(),
|
|
40609
|
+
totalMemoryBytes: external_exports.number(),
|
|
40610
|
+
freeMemoryBytes: external_exports.number()
|
|
40611
|
+
});
|
|
40612
|
+
var SystemRuntimeInfoSchema = external_exports.object({
|
|
40613
|
+
nodeVersion: external_exports.string(),
|
|
40614
|
+
pid: external_exports.number(),
|
|
40615
|
+
startedAt: external_exports.number(),
|
|
40616
|
+
cwd: external_exports.string(),
|
|
40617
|
+
workDir: external_exports.string().nullable().optional(),
|
|
40618
|
+
storagePath: external_exports.string().nullable().optional(),
|
|
40619
|
+
localDashboardOrigin: external_exports.string().nullable().optional()
|
|
40620
|
+
});
|
|
40621
|
+
var SystemAuthInfoSchema = external_exports.object({
|
|
40622
|
+
enabled: external_exports.boolean(),
|
|
40623
|
+
allowSameTenant: external_exports.boolean(),
|
|
40624
|
+
allowedUsers: external_exports.array(external_exports.string())
|
|
40625
|
+
});
|
|
40626
|
+
var SystemAgentInfoSchema = external_exports.object({
|
|
40627
|
+
id: external_exports.enum(["claude", "codex"]),
|
|
40628
|
+
label: external_exports.string(),
|
|
40629
|
+
command: external_exports.string(),
|
|
40630
|
+
available: external_exports.boolean(),
|
|
40631
|
+
path: external_exports.string().nullable(),
|
|
40632
|
+
version: external_exports.string().nullable(),
|
|
40633
|
+
checkedAt: external_exports.string(),
|
|
40634
|
+
detail: external_exports.string().nullable().optional(),
|
|
40635
|
+
metadataStatus: external_exports.string().nullable().optional()
|
|
40636
|
+
});
|
|
40637
|
+
var NodeSettingsSnapshotSchema = external_exports.object({
|
|
40638
|
+
collectedAt: external_exports.number(),
|
|
40639
|
+
version: external_exports.string(),
|
|
40640
|
+
packageName: external_exports.string().optional(),
|
|
40641
|
+
uptime: external_exports.number(),
|
|
40642
|
+
auth: SystemAuthInfoSchema.optional(),
|
|
40643
|
+
os: SystemOsInfoSchema.optional(),
|
|
40644
|
+
runtime: SystemRuntimeInfoSchema.optional(),
|
|
40645
|
+
agents: external_exports.array(SystemAgentInfoSchema).optional(),
|
|
40646
|
+
startupRequirements: external_exports.object({
|
|
40647
|
+
lastCheckedAt: external_exports.string().optional(),
|
|
40648
|
+
lastCheckedOn: external_exports.string().optional(),
|
|
40649
|
+
components: external_exports.object({
|
|
40650
|
+
az: SystemComponentStatusSchema.optional(),
|
|
40651
|
+
devtunnel: SystemComponentStatusSchema.optional(),
|
|
40652
|
+
claude: SystemComponentStatusSchema.optional(),
|
|
40653
|
+
codex: SystemComponentStatusSchema.optional()
|
|
40654
|
+
}).optional()
|
|
40655
|
+
}).optional(),
|
|
40656
|
+
components: external_exports.object({
|
|
40657
|
+
az: SystemComponentStatusSchema.optional(),
|
|
40658
|
+
devtunnel: SystemComponentStatusSchema.optional(),
|
|
40659
|
+
claude: SystemComponentStatusSchema.optional(),
|
|
40660
|
+
codex: SystemComponentStatusSchema.optional()
|
|
40661
|
+
}).optional(),
|
|
40662
|
+
repository: SystemRepositoryInfoSchema.optional(),
|
|
40663
|
+
packages: external_exports.object({
|
|
40664
|
+
workspace: SystemPackageInfoSchema.optional(),
|
|
40665
|
+
node: SystemPackageInfoSchema.optional(),
|
|
40666
|
+
core: SystemPackageInfoSchema.optional(),
|
|
40667
|
+
dashboard: SystemPackageInfoSchema.optional(),
|
|
40668
|
+
api: SystemPackageInfoSchema.optional()
|
|
40669
|
+
}).optional()
|
|
40670
|
+
});
|
|
40489
40671
|
|
|
40490
40672
|
// ../../packages/api/src/schemas/cluster.ts
|
|
40491
40673
|
var NodeInfoSchema = external_exports.object({
|
|
@@ -40499,7 +40681,10 @@ var NodeInfoSchema = external_exports.object({
|
|
|
40499
40681
|
lastHeartbeat: external_exports.number(),
|
|
40500
40682
|
transportType: external_exports.string().optional(),
|
|
40501
40683
|
devtunnelEndpoint: external_exports.string().optional(),
|
|
40502
|
-
dashboardOrigin: external_exports.string().optional()
|
|
40684
|
+
dashboardOrigin: external_exports.string().optional(),
|
|
40685
|
+
workDir: external_exports.string().optional(),
|
|
40686
|
+
workDirFolders: external_exports.array(external_exports.string()).optional(),
|
|
40687
|
+
settingsSnapshot: NodeSettingsSnapshotSchema.optional()
|
|
40503
40688
|
});
|
|
40504
40689
|
var JoinTaskSchema = external_exports.object({
|
|
40505
40690
|
id: external_exports.string(),
|
|
@@ -40531,6 +40716,7 @@ var JoinClusterBody = external_exports.object({
|
|
|
40531
40716
|
workDirFolders: external_exports.array(external_exports.string()).optional(),
|
|
40532
40717
|
devtunnelEndpoint: external_exports.string().url().optional(),
|
|
40533
40718
|
dashboardOrigin: external_exports.string().url().optional(),
|
|
40719
|
+
settingsSnapshot: NodeSettingsSnapshotSchema.optional(),
|
|
40534
40720
|
tasks: external_exports.array(JoinTaskSchema).default([])
|
|
40535
40721
|
});
|
|
40536
40722
|
var JoinClusterResponse = external_exports.object({
|
|
@@ -40574,7 +40760,8 @@ var NodeInfoSchema2 = external_exports.object({
|
|
|
40574
40760
|
devtunnelEndpoint: external_exports.string().optional(),
|
|
40575
40761
|
dashboardOrigin: external_exports.string().optional(),
|
|
40576
40762
|
workDir: external_exports.string().optional(),
|
|
40577
|
-
workDirFolders: external_exports.array(external_exports.string()).optional()
|
|
40763
|
+
workDirFolders: external_exports.array(external_exports.string()).optional(),
|
|
40764
|
+
settingsSnapshot: NodeSettingsSnapshotSchema.optional()
|
|
40578
40765
|
});
|
|
40579
40766
|
var QueryBoolean = external_exports.preprocess((value) => {
|
|
40580
40767
|
if (value === void 0) {
|
|
@@ -41046,7 +41233,8 @@ function createClusterRoutes() {
|
|
|
41046
41233
|
...body.workDir && { workDir: body.workDir },
|
|
41047
41234
|
...body.workDirFolders && { workDirFolders: body.workDirFolders },
|
|
41048
41235
|
...body.devtunnelEndpoint && { devtunnelEndpoint: body.devtunnelEndpoint },
|
|
41049
|
-
...body.dashboardOrigin && { dashboardOrigin: body.dashboardOrigin }
|
|
41236
|
+
...body.dashboardOrigin && { dashboardOrigin: body.dashboardOrigin },
|
|
41237
|
+
...body.settingsSnapshot && { settingsSnapshot: body.settingsSnapshot }
|
|
41050
41238
|
};
|
|
41051
41239
|
nodeRegistry.addNode(node);
|
|
41052
41240
|
taskEngine.importTasks(body.tasks ?? []);
|
|
@@ -41469,7 +41657,7 @@ function getGitDiff(dirPath) {
|
|
|
41469
41657
|
if (!isGitRepo(dirPath)) {
|
|
41470
41658
|
return { available: false };
|
|
41471
41659
|
}
|
|
41472
|
-
const
|
|
41660
|
+
const repoRoot2 = git(["rev-parse", "--show-toplevel"], dirPath);
|
|
41473
41661
|
const branch = git(["rev-parse", "--abbrev-ref", "HEAD"], dirPath) || null;
|
|
41474
41662
|
const staged = git(["diff", "--cached"], dirPath);
|
|
41475
41663
|
const unstaged = git(["diff"], dirPath);
|
|
@@ -41488,7 +41676,7 @@ function getGitDiff(dirPath) {
|
|
|
41488
41676
|
}
|
|
41489
41677
|
return {
|
|
41490
41678
|
available: true,
|
|
41491
|
-
repoRoot,
|
|
41679
|
+
repoRoot: repoRoot2,
|
|
41492
41680
|
branch,
|
|
41493
41681
|
staged: staged || void 0,
|
|
41494
41682
|
unstaged: unstaged || void 0,
|
|
@@ -43479,6 +43667,123 @@ function createWorkerRoutes() {
|
|
|
43479
43667
|
|
|
43480
43668
|
// ../../packages/api/src/routes/system.ts
|
|
43481
43669
|
var import_express7 = __toESM(require_express2(), 1);
|
|
43670
|
+
|
|
43671
|
+
// ../../packages/api/src/system-info.ts
|
|
43672
|
+
var os5 = __toESM(require("os"), 1);
|
|
43673
|
+
var import_node_child_process5 = require("child_process");
|
|
43674
|
+
var RUNTIME_TOOLS = [
|
|
43675
|
+
{ id: "claude", label: "Claude Code", command: "claude" },
|
|
43676
|
+
{ id: "codex", label: "Codex", command: "codex" }
|
|
43677
|
+
];
|
|
43678
|
+
function normalizeOutput(output) {
|
|
43679
|
+
if (!output) {
|
|
43680
|
+
return null;
|
|
43681
|
+
}
|
|
43682
|
+
const firstLine = output.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
43683
|
+
return firstLine ?? null;
|
|
43684
|
+
}
|
|
43685
|
+
function resolveCommandPath(command) {
|
|
43686
|
+
const lookupCommand = process.platform === "win32" ? "where" : "which";
|
|
43687
|
+
const result = (0, import_node_child_process5.spawnSync)(lookupCommand, [command], {
|
|
43688
|
+
encoding: "utf-8",
|
|
43689
|
+
shell: false,
|
|
43690
|
+
windowsHide: true,
|
|
43691
|
+
timeout: 1500
|
|
43692
|
+
});
|
|
43693
|
+
if (result.status === 0) {
|
|
43694
|
+
return { path: normalizeOutput(result.stdout) };
|
|
43695
|
+
}
|
|
43696
|
+
return {
|
|
43697
|
+
path: null,
|
|
43698
|
+
detail: normalizeOutput(result.stderr) ?? result.error?.message ?? null
|
|
43699
|
+
};
|
|
43700
|
+
}
|
|
43701
|
+
function inspectTool(definition) {
|
|
43702
|
+
const checkedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
43703
|
+
const resolved = resolveCommandPath(definition.command);
|
|
43704
|
+
if (!resolved.path) {
|
|
43705
|
+
return {
|
|
43706
|
+
id: definition.id,
|
|
43707
|
+
label: definition.label,
|
|
43708
|
+
command: definition.command,
|
|
43709
|
+
available: false,
|
|
43710
|
+
path: null,
|
|
43711
|
+
version: null,
|
|
43712
|
+
checkedAt,
|
|
43713
|
+
detail: resolved.detail ?? "Command not found on PATH"
|
|
43714
|
+
};
|
|
43715
|
+
}
|
|
43716
|
+
const versionResult = (0, import_node_child_process5.spawnSync)(definition.command, ["--version"], {
|
|
43717
|
+
encoding: "utf-8",
|
|
43718
|
+
shell: process.platform === "win32",
|
|
43719
|
+
windowsHide: true,
|
|
43720
|
+
timeout: 2500
|
|
43721
|
+
});
|
|
43722
|
+
const version2 = normalizeOutput(versionResult.stdout) ?? normalizeOutput(versionResult.stderr);
|
|
43723
|
+
const detail = versionResult.status === 0 ? null : normalizeOutput(versionResult.stderr) ?? versionResult.error?.message ?? "Version check failed";
|
|
43724
|
+
return {
|
|
43725
|
+
id: definition.id,
|
|
43726
|
+
label: definition.label,
|
|
43727
|
+
command: definition.command,
|
|
43728
|
+
available: true,
|
|
43729
|
+
path: resolved.path,
|
|
43730
|
+
version: version2,
|
|
43731
|
+
checkedAt,
|
|
43732
|
+
detail
|
|
43733
|
+
};
|
|
43734
|
+
}
|
|
43735
|
+
function inspectRuntimeTools() {
|
|
43736
|
+
return RUNTIME_TOOLS.map(inspectTool);
|
|
43737
|
+
}
|
|
43738
|
+
function getOsSnapshot() {
|
|
43739
|
+
const cpus2 = os5.cpus();
|
|
43740
|
+
return {
|
|
43741
|
+
platform: os5.platform(),
|
|
43742
|
+
release: os5.release(),
|
|
43743
|
+
arch: os5.arch(),
|
|
43744
|
+
hostname: os5.hostname(),
|
|
43745
|
+
cpuModel: cpus2[0]?.model ?? null,
|
|
43746
|
+
cpuCount: cpus2.length,
|
|
43747
|
+
totalMemoryBytes: os5.totalmem(),
|
|
43748
|
+
freeMemoryBytes: os5.freemem()
|
|
43749
|
+
};
|
|
43750
|
+
}
|
|
43751
|
+
function buildNodeSettingsSnapshot(options) {
|
|
43752
|
+
const uptime = process.uptime();
|
|
43753
|
+
const runtimeMetadata = options.runtimeMetadata;
|
|
43754
|
+
const agents = (options.inspectRuntimeTools?.() ?? inspectRuntimeTools()).map((agent) => ({
|
|
43755
|
+
...agent,
|
|
43756
|
+
metadataStatus: runtimeMetadata?.components?.[agent.id]?.status ?? null
|
|
43757
|
+
}));
|
|
43758
|
+
return {
|
|
43759
|
+
collectedAt: Date.now(),
|
|
43760
|
+
version: runtimeMetadata?.packageVersion ?? "0.1.0",
|
|
43761
|
+
packageName: runtimeMetadata?.packageName ?? "meshy",
|
|
43762
|
+
uptime,
|
|
43763
|
+
auth: options.auth,
|
|
43764
|
+
os: getOsSnapshot(),
|
|
43765
|
+
runtime: {
|
|
43766
|
+
nodeVersion: process.version,
|
|
43767
|
+
pid: process.pid,
|
|
43768
|
+
startedAt: Date.now() - Math.floor(uptime * 1e3),
|
|
43769
|
+
cwd: process.cwd(),
|
|
43770
|
+
workDir: options.workDir ?? null,
|
|
43771
|
+
storagePath: options.storagePath ?? null,
|
|
43772
|
+
localDashboardOrigin: options.localDashboardOrigin ?? null
|
|
43773
|
+
},
|
|
43774
|
+
agents,
|
|
43775
|
+
startupRequirements: {
|
|
43776
|
+
lastCheckedAt: runtimeMetadata?.startupRequirementsLastCheckedAt,
|
|
43777
|
+
lastCheckedOn: runtimeMetadata?.startupRequirementsLastCheckedOn,
|
|
43778
|
+
components: runtimeMetadata?.components ?? {}
|
|
43779
|
+
},
|
|
43780
|
+
components: runtimeMetadata?.components ?? {},
|
|
43781
|
+
repository: runtimeMetadata?.repository ?? {},
|
|
43782
|
+
packages: runtimeMetadata?.packages ?? {}
|
|
43783
|
+
};
|
|
43784
|
+
}
|
|
43785
|
+
|
|
43786
|
+
// ../../packages/api/src/routes/system.ts
|
|
43482
43787
|
function asyncHandler6(fn) {
|
|
43483
43788
|
return (req, res, next) => fn(req, res, next).catch(next);
|
|
43484
43789
|
}
|
|
@@ -43494,19 +43799,47 @@ function createSystemRoutes() {
|
|
|
43494
43799
|
res.json({ status: "ok", timestamp: Date.now() });
|
|
43495
43800
|
}));
|
|
43496
43801
|
router.get("/info", asyncHandler6(async (req, res) => {
|
|
43497
|
-
const {
|
|
43802
|
+
const {
|
|
43803
|
+
nodeRegistry,
|
|
43804
|
+
getTransportType,
|
|
43805
|
+
config,
|
|
43806
|
+
dashboardOrigin,
|
|
43807
|
+
localDashboardOrigin,
|
|
43808
|
+
storagePath,
|
|
43809
|
+
inspectRuntimeTools: inspectTools,
|
|
43810
|
+
runtimeMetadata
|
|
43811
|
+
} = req.app.locals.deps;
|
|
43498
43812
|
const self2 = nodeRegistry.getSelf();
|
|
43813
|
+
const auth = config.authMetadata ?? {
|
|
43814
|
+
enabled: false,
|
|
43815
|
+
allowSameTenant: false,
|
|
43816
|
+
allowedUsers: []
|
|
43817
|
+
};
|
|
43818
|
+
const settingsSnapshot = buildNodeSettingsSnapshot({
|
|
43819
|
+
auth,
|
|
43820
|
+
inspectRuntimeTools: inspectTools,
|
|
43821
|
+
localDashboardOrigin,
|
|
43822
|
+
runtimeMetadata,
|
|
43823
|
+
storagePath,
|
|
43824
|
+
workDir: self2.workDir
|
|
43825
|
+
});
|
|
43499
43826
|
res.json({
|
|
43500
43827
|
...self2,
|
|
43501
|
-
|
|
43502
|
-
|
|
43828
|
+
nodeId: self2.id,
|
|
43829
|
+
version: settingsSnapshot.version,
|
|
43830
|
+
packageName: settingsSnapshot.packageName,
|
|
43831
|
+
uptime: settingsSnapshot.uptime,
|
|
43503
43832
|
transportType: getTransportType?.() ?? "direct",
|
|
43504
43833
|
dashboardOrigin: dashboardOrigin ?? self2.dashboardOrigin,
|
|
43505
|
-
|
|
43506
|
-
|
|
43507
|
-
|
|
43508
|
-
|
|
43509
|
-
|
|
43834
|
+
localDashboardOrigin,
|
|
43835
|
+
auth: settingsSnapshot.auth,
|
|
43836
|
+
os: settingsSnapshot.os,
|
|
43837
|
+
runtime: settingsSnapshot.runtime,
|
|
43838
|
+
agents: settingsSnapshot.agents,
|
|
43839
|
+
startupRequirements: settingsSnapshot.startupRequirements,
|
|
43840
|
+
components: settingsSnapshot.components,
|
|
43841
|
+
repository: settingsSnapshot.repository,
|
|
43842
|
+
packages: settingsSnapshot.packages
|
|
43510
43843
|
});
|
|
43511
43844
|
}));
|
|
43512
43845
|
router.post("/transport", asyncHandler6(async (req, res) => {
|
|
@@ -43776,12 +44109,12 @@ function detectLocalIp() {
|
|
|
43776
44109
|
return "127.0.0.1";
|
|
43777
44110
|
}
|
|
43778
44111
|
function detectAvailablePort() {
|
|
43779
|
-
return new Promise((
|
|
44112
|
+
return new Promise((resolve13, reject) => {
|
|
43780
44113
|
const srv = (0, import_node_http2.createServer)();
|
|
43781
44114
|
srv.listen(0, () => {
|
|
43782
44115
|
const addr = srv.address();
|
|
43783
44116
|
const port = addr && typeof addr !== "string" ? addr.port : 0;
|
|
43784
|
-
srv.close((err) => err ? reject(err) :
|
|
44117
|
+
srv.close((err) => err ? reject(err) : resolve13(port));
|
|
43785
44118
|
});
|
|
43786
44119
|
srv.on("error", reject);
|
|
43787
44120
|
});
|
|
@@ -43826,10 +44159,10 @@ var DirectTransport = class {
|
|
|
43826
44159
|
};
|
|
43827
44160
|
|
|
43828
44161
|
// ../../packages/transport/src/devtunnel.ts
|
|
43829
|
-
var
|
|
44162
|
+
var import_node_child_process6 = require("child_process");
|
|
43830
44163
|
function isInstalled(cmd) {
|
|
43831
44164
|
try {
|
|
43832
|
-
(0,
|
|
44165
|
+
(0, import_node_child_process6.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
|
|
43833
44166
|
return true;
|
|
43834
44167
|
} catch {
|
|
43835
44168
|
return false;
|
|
@@ -43852,18 +44185,18 @@ var DevTunnelTransport = class {
|
|
|
43852
44185
|
);
|
|
43853
44186
|
}
|
|
43854
44187
|
try {
|
|
43855
|
-
(0,
|
|
44188
|
+
(0, import_node_child_process6.execSync)("devtunnel user show", { stdio: "pipe" });
|
|
43856
44189
|
} catch {
|
|
43857
44190
|
throw new Error(
|
|
43858
44191
|
"Not logged in to devtunnel. Run: devtunnel user login"
|
|
43859
44192
|
);
|
|
43860
44193
|
}
|
|
43861
44194
|
const hostArgs = this.buildHostArgs(localPort);
|
|
43862
|
-
const child = (0,
|
|
44195
|
+
const child = (0, import_node_child_process6.spawn)("devtunnel", hostArgs, {
|
|
43863
44196
|
stdio: ["pipe", "pipe", "pipe"]
|
|
43864
44197
|
});
|
|
43865
44198
|
this.process = child;
|
|
43866
|
-
this.publicUrl = await new Promise((
|
|
44199
|
+
this.publicUrl = await new Promise((resolve13, reject) => {
|
|
43867
44200
|
const timeout = setTimeout(() => {
|
|
43868
44201
|
child.kill();
|
|
43869
44202
|
this.process = null;
|
|
@@ -43886,7 +44219,7 @@ var DevTunnelTransport = class {
|
|
|
43886
44219
|
clearTimeout(timeout);
|
|
43887
44220
|
child.stdout?.removeListener("data", onData);
|
|
43888
44221
|
child.stderr?.removeListener("data", onErrData);
|
|
43889
|
-
|
|
44222
|
+
resolve13(url.replace(/\/+$/, ""));
|
|
43890
44223
|
};
|
|
43891
44224
|
child.stdout?.on("data", onData);
|
|
43892
44225
|
child.stderr?.on("data", onErrData);
|
|
@@ -43918,14 +44251,14 @@ ${lines.join("")}`
|
|
|
43918
44251
|
this.publicUrl = null;
|
|
43919
44252
|
if (child.exitCode === null) {
|
|
43920
44253
|
child.kill("SIGTERM");
|
|
43921
|
-
await new Promise((
|
|
44254
|
+
await new Promise((resolve13) => {
|
|
43922
44255
|
const killTimer = setTimeout(() => {
|
|
43923
44256
|
child.kill("SIGKILL");
|
|
43924
|
-
|
|
44257
|
+
resolve13();
|
|
43925
44258
|
}, 5e3);
|
|
43926
44259
|
child.on("close", () => {
|
|
43927
44260
|
clearTimeout(killTimer);
|
|
43928
|
-
|
|
44261
|
+
resolve13();
|
|
43929
44262
|
});
|
|
43930
44263
|
});
|
|
43931
44264
|
}
|
|
@@ -43964,7 +44297,7 @@ ${lines.join("")}`
|
|
|
43964
44297
|
return void 0;
|
|
43965
44298
|
}
|
|
43966
44299
|
try {
|
|
43967
|
-
(0,
|
|
44300
|
+
(0, import_node_child_process6.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
|
|
43968
44301
|
return tunnelId;
|
|
43969
44302
|
} catch {
|
|
43970
44303
|
const createArgs = ["create", tunnelId];
|
|
@@ -43972,7 +44305,7 @@ ${lines.join("")}`
|
|
|
43972
44305
|
createArgs.push("-a");
|
|
43973
44306
|
}
|
|
43974
44307
|
try {
|
|
43975
|
-
(0,
|
|
44308
|
+
(0, import_node_child_process6.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
|
|
43976
44309
|
return tunnelId;
|
|
43977
44310
|
} catch (err) {
|
|
43978
44311
|
throw new Error(
|
|
@@ -43987,7 +44320,7 @@ ${lines.join("")}`
|
|
|
43987
44320
|
return;
|
|
43988
44321
|
}
|
|
43989
44322
|
try {
|
|
43990
|
-
(0,
|
|
44323
|
+
(0, import_node_child_process6.execFileSync)(
|
|
43991
44324
|
"devtunnel",
|
|
43992
44325
|
["port", "create", tunnelId, "-p", String(localPort), "--protocol", "http"],
|
|
43993
44326
|
{ stdio: "pipe" }
|
|
@@ -44003,7 +44336,7 @@ ${lines.join("")}`
|
|
|
44003
44336
|
}
|
|
44004
44337
|
listTunnelPorts(tunnelId) {
|
|
44005
44338
|
try {
|
|
44006
|
-
const output = (0,
|
|
44339
|
+
const output = (0, import_node_child_process6.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
|
|
44007
44340
|
const parsed = JSON.parse(output.toString());
|
|
44008
44341
|
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
44342
|
return items.map((item) => getPortNumber(item)).filter((value) => value !== void 0);
|
|
@@ -44015,7 +44348,7 @@ ${lines.join("")}`
|
|
|
44015
44348
|
}
|
|
44016
44349
|
hasTunnelPort(tunnelId, localPort) {
|
|
44017
44350
|
try {
|
|
44018
|
-
(0,
|
|
44351
|
+
(0, import_node_child_process6.execFileSync)(
|
|
44019
44352
|
"devtunnel",
|
|
44020
44353
|
["port", "show", tunnelId, "-p", String(localPort), "-j"],
|
|
44021
44354
|
{ stdio: "pipe" }
|
|
@@ -44073,7 +44406,7 @@ function createTransport(config) {
|
|
|
44073
44406
|
var fs15 = __toESM(require("fs"), 1);
|
|
44074
44407
|
var path16 = __toESM(require("path"), 1);
|
|
44075
44408
|
var readline = __toESM(require("readline/promises"), 1);
|
|
44076
|
-
var
|
|
44409
|
+
var import_node_child_process7 = require("child_process");
|
|
44077
44410
|
function getDefaultNodeName() {
|
|
44078
44411
|
return getDeviceNodeName();
|
|
44079
44412
|
}
|
|
@@ -44118,11 +44451,11 @@ function createPromptSession(prompt) {
|
|
|
44118
44451
|
close: async () => rl.close()
|
|
44119
44452
|
};
|
|
44120
44453
|
}
|
|
44121
|
-
function createDefaultCommandRunner(
|
|
44454
|
+
function createDefaultCommandRunner(platform2) {
|
|
44122
44455
|
return (command, args, interactive = false) => {
|
|
44123
|
-
const result = (0,
|
|
44456
|
+
const result = (0, import_node_child_process7.spawnSync)(command, args, {
|
|
44124
44457
|
encoding: "utf-8",
|
|
44125
|
-
shell:
|
|
44458
|
+
shell: platform2 === "win32",
|
|
44126
44459
|
stdio: interactive ? "inherit" : "pipe"
|
|
44127
44460
|
});
|
|
44128
44461
|
return {
|
|
@@ -44163,33 +44496,33 @@ async function confirm(ask, question) {
|
|
|
44163
44496
|
const answer = await ask(`${question} [y/N]: `);
|
|
44164
44497
|
return isYesAnswer(answer);
|
|
44165
44498
|
}
|
|
44166
|
-
function isCommandAvailable(commandRunner,
|
|
44167
|
-
const lookupCommand =
|
|
44499
|
+
function isCommandAvailable(commandRunner, platform2, command) {
|
|
44500
|
+
const lookupCommand = platform2 === "win32" ? "where" : "which";
|
|
44168
44501
|
return commandRunner(lookupCommand, [command], false).ok;
|
|
44169
44502
|
}
|
|
44170
|
-
function buildInstallCommand(requirement,
|
|
44503
|
+
function buildInstallCommand(requirement, platform2) {
|
|
44171
44504
|
switch (requirement) {
|
|
44172
44505
|
case "az":
|
|
44173
|
-
if (
|
|
44506
|
+
if (platform2 === "darwin") {
|
|
44174
44507
|
return { command: "brew", args: ["install", "azure-cli"] };
|
|
44175
44508
|
}
|
|
44176
|
-
if (
|
|
44509
|
+
if (platform2 === "win32") {
|
|
44177
44510
|
return { command: "winget", args: ["install", "--exact", "--id", "Microsoft.AzureCLI"] };
|
|
44178
44511
|
}
|
|
44179
44512
|
return void 0;
|
|
44180
44513
|
case "devtunnel":
|
|
44181
|
-
if (
|
|
44514
|
+
if (platform2 === "darwin") {
|
|
44182
44515
|
return { command: "brew", args: ["install", "--cask", "devtunnel"] };
|
|
44183
44516
|
}
|
|
44184
|
-
if (
|
|
44517
|
+
if (platform2 === "win32") {
|
|
44185
44518
|
return { command: "winget", args: ["install", "--exact", "--id", "Microsoft.devtunnel"] };
|
|
44186
44519
|
}
|
|
44187
44520
|
return void 0;
|
|
44188
44521
|
case "claude":
|
|
44189
|
-
if (
|
|
44522
|
+
if (platform2 === "darwin") {
|
|
44190
44523
|
return { command: "bash", args: ["-lc", "curl -fsSL https://claude.ai/install.sh | bash"] };
|
|
44191
44524
|
}
|
|
44192
|
-
if (
|
|
44525
|
+
if (platform2 === "win32") {
|
|
44193
44526
|
return {
|
|
44194
44527
|
command: "powershell",
|
|
44195
44528
|
args: ["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", "irm https://claude.ai/install.ps1 | iex"]
|
|
@@ -44230,17 +44563,17 @@ function shouldSkipStartupRequirementsCheck(storagePath, now = /* @__PURE__ */ n
|
|
|
44230
44563
|
}
|
|
44231
44564
|
return STARTUP_REQUIREMENTS.every((requirement) => isRequirementSatisfied(requirement, metadata.components?.[requirement]));
|
|
44232
44565
|
}
|
|
44233
|
-
async function ensureRequirementInstalled(requirement,
|
|
44234
|
-
if (isCommandAvailable(commandRunner,
|
|
44566
|
+
async function ensureRequirementInstalled(requirement, platform2, ask, commandRunner, stdout, stderr) {
|
|
44567
|
+
if (isCommandAvailable(commandRunner, platform2, requirement)) {
|
|
44235
44568
|
return { installed: true, status: "ok" };
|
|
44236
44569
|
}
|
|
44237
44570
|
if (!ask) {
|
|
44238
44571
|
writeLine(stderr, `Missing required component "${requirement}". Start in a TTY to install it automatically.`);
|
|
44239
44572
|
return { installed: false, status: "missing" };
|
|
44240
44573
|
}
|
|
44241
|
-
const install = buildInstallCommand(requirement,
|
|
44574
|
+
const install = buildInstallCommand(requirement, platform2);
|
|
44242
44575
|
if (!install) {
|
|
44243
|
-
writeLine(stderr, `Missing required component "${requirement}", and automatic install is not supported on ${
|
|
44576
|
+
writeLine(stderr, `Missing required component "${requirement}", and automatic install is not supported on ${platform2}.`);
|
|
44244
44577
|
return { installed: false, status: "unsupported-platform" };
|
|
44245
44578
|
}
|
|
44246
44579
|
if (!await confirm(ask, `Required component "${requirement}" is missing. Install it now?`)) {
|
|
@@ -44252,7 +44585,7 @@ async function ensureRequirementInstalled(requirement, platform, ask, commandRun
|
|
|
44252
44585
|
writeLine(stderr, `Failed to install ${requirement}.`);
|
|
44253
44586
|
return { installed: false, status: "install-failed" };
|
|
44254
44587
|
}
|
|
44255
|
-
return isCommandAvailable(commandRunner,
|
|
44588
|
+
return isCommandAvailable(commandRunner, platform2, requirement) ? { installed: true, status: "ok" } : { installed: false, status: "install-failed" };
|
|
44256
44589
|
}
|
|
44257
44590
|
async function ensureRequirementAuthenticated(requirement, ask, commandRunner, stdout, stderr) {
|
|
44258
44591
|
if (isAuthenticated(requirement, commandRunner)) {
|
|
@@ -44282,10 +44615,10 @@ async function ensureStartupRequirements(storagePath, options = {}) {
|
|
|
44282
44615
|
metadata: resolveStartupRequirementsMetadata(storagePath)
|
|
44283
44616
|
};
|
|
44284
44617
|
}
|
|
44285
|
-
const
|
|
44618
|
+
const platform2 = options.platform ?? process.platform;
|
|
44286
44619
|
const stdout = options.stdout ?? process.stdout;
|
|
44287
44620
|
const stderr = options.stderr ?? process.stderr;
|
|
44288
|
-
const commandRunner = options.commandRunner ?? createDefaultCommandRunner(
|
|
44621
|
+
const commandRunner = options.commandRunner ?? createDefaultCommandRunner(platform2);
|
|
44289
44622
|
const promptSession = createPromptSession(options.prompt);
|
|
44290
44623
|
const checkedAt = now.toISOString();
|
|
44291
44624
|
const checkedOn = formatLocalDate(now);
|
|
@@ -44294,7 +44627,7 @@ async function ensureStartupRequirements(storagePath, options = {}) {
|
|
|
44294
44627
|
for (const requirement of STARTUP_REQUIREMENTS) {
|
|
44295
44628
|
const installResult = await ensureRequirementInstalled(
|
|
44296
44629
|
requirement,
|
|
44297
|
-
|
|
44630
|
+
platform2,
|
|
44298
44631
|
promptSession?.ask,
|
|
44299
44632
|
commandRunner,
|
|
44300
44633
|
stdout,
|
|
@@ -44392,9 +44725,9 @@ function parseArgs(argv) {
|
|
|
44392
44725
|
}
|
|
44393
44726
|
return result;
|
|
44394
44727
|
}
|
|
44395
|
-
function loadConfigFile(
|
|
44728
|
+
function loadConfigFile(path18) {
|
|
44396
44729
|
try {
|
|
44397
|
-
const raw = fs15.readFileSync(
|
|
44730
|
+
const raw = fs15.readFileSync(path18, "utf-8");
|
|
44398
44731
|
return JSON.parse(raw);
|
|
44399
44732
|
} catch {
|
|
44400
44733
|
return {};
|
|
@@ -44558,6 +44891,149 @@ function formatLoadedStartMetadata(info, authEnabled) {
|
|
|
44558
44891
|
return lines.join("\n");
|
|
44559
44892
|
}
|
|
44560
44893
|
|
|
44894
|
+
// src/runtime-metadata.ts
|
|
44895
|
+
var fs16 = __toESM(require("fs"), 1);
|
|
44896
|
+
var path17 = __toESM(require("path"), 1);
|
|
44897
|
+
var import_node_child_process8 = require("child_process");
|
|
44898
|
+
var runtimeDir = resolveRuntimeDir();
|
|
44899
|
+
var appRoot = resolveAppRoot(runtimeDir);
|
|
44900
|
+
var repoRoot = path17.resolve(appRoot, "../..");
|
|
44901
|
+
function resolveRuntimeDir() {
|
|
44902
|
+
const entryPath = process.argv[1];
|
|
44903
|
+
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
44904
|
+
try {
|
|
44905
|
+
return path17.dirname(fs16.realpathSync(path17.resolve(entryPath)));
|
|
44906
|
+
} catch {
|
|
44907
|
+
return path17.dirname(path17.resolve(entryPath));
|
|
44908
|
+
}
|
|
44909
|
+
}
|
|
44910
|
+
return process.cwd();
|
|
44911
|
+
}
|
|
44912
|
+
function readJsonFile(filePath) {
|
|
44913
|
+
try {
|
|
44914
|
+
return JSON.parse(fs16.readFileSync(filePath, "utf-8"));
|
|
44915
|
+
} catch {
|
|
44916
|
+
return null;
|
|
44917
|
+
}
|
|
44918
|
+
}
|
|
44919
|
+
function readPackageManifest(filePath) {
|
|
44920
|
+
return readJsonFile(filePath);
|
|
44921
|
+
}
|
|
44922
|
+
function readEmbeddedRuntimeMetadata() {
|
|
44923
|
+
const candidates = [
|
|
44924
|
+
path17.join(appRoot, "runtime-metadata.json"),
|
|
44925
|
+
path17.join(runtimeDir, "runtime-metadata.json")
|
|
44926
|
+
];
|
|
44927
|
+
for (const candidate of candidates) {
|
|
44928
|
+
const metadata = readJsonFile(candidate);
|
|
44929
|
+
if (metadata) {
|
|
44930
|
+
return metadata;
|
|
44931
|
+
}
|
|
44932
|
+
}
|
|
44933
|
+
return null;
|
|
44934
|
+
}
|
|
44935
|
+
function resolveAppRoot(baseDir) {
|
|
44936
|
+
const candidates = [
|
|
44937
|
+
baseDir,
|
|
44938
|
+
path17.resolve(baseDir, ".."),
|
|
44939
|
+
path17.resolve(process.cwd(), "apps/node/dist"),
|
|
44940
|
+
path17.resolve(process.cwd(), "apps/node"),
|
|
44941
|
+
process.cwd()
|
|
44942
|
+
];
|
|
44943
|
+
for (const candidate of candidates) {
|
|
44944
|
+
const manifest = readPackageManifest(path17.join(candidate, "package.json"));
|
|
44945
|
+
if (manifest?.name === "@meshy/node" || manifest?.name === "meshy-node") {
|
|
44946
|
+
return candidate;
|
|
44947
|
+
}
|
|
44948
|
+
}
|
|
44949
|
+
for (const candidate of candidates) {
|
|
44950
|
+
if (fs16.existsSync(path17.join(candidate, "package.json"))) {
|
|
44951
|
+
return candidate;
|
|
44952
|
+
}
|
|
44953
|
+
}
|
|
44954
|
+
return path17.resolve(baseDir, "..");
|
|
44955
|
+
}
|
|
44956
|
+
function toPackageInfo(filePath) {
|
|
44957
|
+
const manifest = readPackageManifest(filePath);
|
|
44958
|
+
if (!manifest?.name || !manifest.version) {
|
|
44959
|
+
return void 0;
|
|
44960
|
+
}
|
|
44961
|
+
return {
|
|
44962
|
+
name: manifest.name,
|
|
44963
|
+
version: manifest.version
|
|
44964
|
+
};
|
|
44965
|
+
}
|
|
44966
|
+
function normalizeRepositoryUrl(value) {
|
|
44967
|
+
const trimmed = value?.trim().replace(/\.git$/i, "");
|
|
44968
|
+
if (!trimmed) {
|
|
44969
|
+
return void 0;
|
|
44970
|
+
}
|
|
44971
|
+
const sshMatch = trimmed.match(/^git@github\.com:(.+)$/i);
|
|
44972
|
+
if (sshMatch?.[1]) {
|
|
44973
|
+
return `https://github.com/${sshMatch[1]}`;
|
|
44974
|
+
}
|
|
44975
|
+
const sshProtocolMatch = trimmed.match(/^ssh:\/\/git@github\.com\/(.+)$/i);
|
|
44976
|
+
if (sshProtocolMatch?.[1]) {
|
|
44977
|
+
return `https://github.com/${sshProtocolMatch[1]}`;
|
|
44978
|
+
}
|
|
44979
|
+
return trimmed;
|
|
44980
|
+
}
|
|
44981
|
+
function readRepositoryUrlFromManifest(manifest) {
|
|
44982
|
+
if (!manifest?.repository) {
|
|
44983
|
+
return void 0;
|
|
44984
|
+
}
|
|
44985
|
+
if (typeof manifest.repository === "string") {
|
|
44986
|
+
return normalizeRepositoryUrl(manifest.repository);
|
|
44987
|
+
}
|
|
44988
|
+
return normalizeRepositoryUrl(manifest.repository.url);
|
|
44989
|
+
}
|
|
44990
|
+
function readGitValue(args) {
|
|
44991
|
+
try {
|
|
44992
|
+
const output = (0, import_node_child_process8.execFileSync)("git", args, {
|
|
44993
|
+
cwd: repoRoot,
|
|
44994
|
+
encoding: "utf-8",
|
|
44995
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
44996
|
+
windowsHide: true
|
|
44997
|
+
}).trim();
|
|
44998
|
+
return output || void 0;
|
|
44999
|
+
} catch {
|
|
45000
|
+
return void 0;
|
|
45001
|
+
}
|
|
45002
|
+
}
|
|
45003
|
+
function buildRuntimeMetadata(storagePath) {
|
|
45004
|
+
const startupRequirements = resolveStartupRequirementsMetadata(storagePath);
|
|
45005
|
+
const embedded = readEmbeddedRuntimeMetadata();
|
|
45006
|
+
if (embedded) {
|
|
45007
|
+
return {
|
|
45008
|
+
...embedded,
|
|
45009
|
+
startupRequirementsLastCheckedAt: startupRequirements.lastCheckedAt,
|
|
45010
|
+
startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
|
|
45011
|
+
components: startupRequirements.components
|
|
45012
|
+
};
|
|
45013
|
+
}
|
|
45014
|
+
const appPackage = toPackageInfo(path17.join(appRoot, "package.json"));
|
|
45015
|
+
const workspaceManifest = readPackageManifest(path17.join(repoRoot, "package.json"));
|
|
45016
|
+
return {
|
|
45017
|
+
packageName: appPackage?.name ?? "meshy",
|
|
45018
|
+
packageVersion: appPackage?.version ?? "0.1.0",
|
|
45019
|
+
startupRequirementsLastCheckedAt: startupRequirements.lastCheckedAt,
|
|
45020
|
+
startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
|
|
45021
|
+
components: startupRequirements.components,
|
|
45022
|
+
packages: {
|
|
45023
|
+
workspace: toPackageInfo(path17.join(repoRoot, "package.json")),
|
|
45024
|
+
node: appPackage,
|
|
45025
|
+
core: toPackageInfo(path17.join(repoRoot, "packages/core/package.json")),
|
|
45026
|
+
dashboard: toPackageInfo(path17.join(repoRoot, "packages/dashboard/package.json")),
|
|
45027
|
+
api: toPackageInfo(path17.join(repoRoot, "packages/api/package.json"))
|
|
45028
|
+
},
|
|
45029
|
+
repository: {
|
|
45030
|
+
url: normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.origin.url"])) ?? readRepositoryUrlFromManifest(workspaceManifest),
|
|
45031
|
+
branch: readGitValue(["rev-parse", "--abbrev-ref", "HEAD"]),
|
|
45032
|
+
commit: readGitValue(["rev-parse", "--short", "HEAD"])
|
|
45033
|
+
}
|
|
45034
|
+
};
|
|
45035
|
+
}
|
|
45036
|
+
|
|
44561
45037
|
// src/main.ts
|
|
44562
45038
|
function formatBanner(info) {
|
|
44563
45039
|
const lines = [
|
|
@@ -44616,6 +45092,8 @@ async function main() {
|
|
|
44616
45092
|
console.log(
|
|
44617
45093
|
startupRequirements.skipped ? "Startup requirements already verified today; skipping checks." : "Startup requirements check complete."
|
|
44618
45094
|
);
|
|
45095
|
+
const runtimeMetadata = buildRuntimeMetadata(config.storage.path);
|
|
45096
|
+
const localDashboardOrigin = `http://localhost:${config.node.port}`;
|
|
44619
45097
|
const logDir = nodePath.join(config.storage.path, "logs");
|
|
44620
45098
|
const logger27 = createLogger({
|
|
44621
45099
|
component: "node",
|
|
@@ -44637,11 +45115,30 @@ async function main() {
|
|
|
44637
45115
|
} else {
|
|
44638
45116
|
setRequestAuthHeadersProvider(null);
|
|
44639
45117
|
}
|
|
45118
|
+
let cachedSettingsSnapshot = null;
|
|
45119
|
+
let cachedSettingsSnapshotAt = 0;
|
|
45120
|
+
const getSettingsSnapshot = () => {
|
|
45121
|
+
const now = Date.now();
|
|
45122
|
+
if (cachedSettingsSnapshot && now - cachedSettingsSnapshotAt < 3e4) {
|
|
45123
|
+
return structuredClone(cachedSettingsSnapshot);
|
|
45124
|
+
}
|
|
45125
|
+
cachedSettingsSnapshot = buildNodeSettingsSnapshot({
|
|
45126
|
+
auth: authMetadata,
|
|
45127
|
+
localDashboardOrigin,
|
|
45128
|
+
runtimeMetadata,
|
|
45129
|
+
storagePath: config.storage.path,
|
|
45130
|
+
workDir: nodePath.resolve(config.node.workDir ?? process.cwd())
|
|
45131
|
+
});
|
|
45132
|
+
cachedSettingsSnapshotAt = now;
|
|
45133
|
+
return structuredClone(cachedSettingsSnapshot);
|
|
45134
|
+
};
|
|
44640
45135
|
const meshyNode = new MeshyNode(config, {
|
|
44641
45136
|
logger: logger27,
|
|
44642
|
-
transportFactory: createTransport
|
|
45137
|
+
transportFactory: createTransport,
|
|
45138
|
+
getSettingsSnapshot
|
|
44643
45139
|
});
|
|
44644
45140
|
await meshyNode.start();
|
|
45141
|
+
meshyNode.getNodeRegistry().updateSettingsSnapshot(meshyNode.getNodeRegistry().getSelf().id, getSettingsSnapshot());
|
|
44645
45142
|
const previewSessionManager = new PreviewSessionManager();
|
|
44646
45143
|
const previewProxyManager = new PreviewProxyManager();
|
|
44647
45144
|
let dashboardTransport = null;
|
|
@@ -44651,13 +45148,13 @@ async function main() {
|
|
|
44651
45148
|
if (!server2) {
|
|
44652
45149
|
return;
|
|
44653
45150
|
}
|
|
44654
|
-
await new Promise((
|
|
45151
|
+
await new Promise((resolve13, reject) => {
|
|
44655
45152
|
server2.close((err) => {
|
|
44656
45153
|
if (err) {
|
|
44657
45154
|
reject(err);
|
|
44658
45155
|
return;
|
|
44659
45156
|
}
|
|
44660
|
-
|
|
45157
|
+
resolve13();
|
|
44661
45158
|
});
|
|
44662
45159
|
});
|
|
44663
45160
|
}
|
|
@@ -44775,6 +45272,7 @@ async function main() {
|
|
|
44775
45272
|
validateBearerToken: authMetadata.enabled ? (header) => nodeAuth.validateAuthorizationHeader(header) : void 0
|
|
44776
45273
|
},
|
|
44777
45274
|
workDir: meshyNode.getWorkDir(),
|
|
45275
|
+
storagePath: config.storage.path,
|
|
44778
45276
|
persistNodeNamePreference: (name2) => persistDefaultNodeName(config.storage.path, name2),
|
|
44779
45277
|
joinCurrentNodeToCluster: async (leaderEndpoint) => {
|
|
44780
45278
|
await meshyNode.joinCluster(leaderEndpoint);
|
|
@@ -44805,8 +45303,9 @@ async function main() {
|
|
|
44805
45303
|
await syncDashboardTransport("disableDevTunnel");
|
|
44806
45304
|
},
|
|
44807
45305
|
isDevTunnelEnabled: () => meshyNode.isDevTunnelEnabled(),
|
|
44808
|
-
localDashboardOrigin
|
|
44809
|
-
dashboardOrigin
|
|
45306
|
+
localDashboardOrigin,
|
|
45307
|
+
dashboardOrigin,
|
|
45308
|
+
runtimeMetadata
|
|
44810
45309
|
};
|
|
44811
45310
|
deps.previewSessionManager = previewSessionManager;
|
|
44812
45311
|
deps.previewProxyManager = previewProxyManager;
|