meshy-node 0.3.7 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dashboard/assets/DashboardPage-0TdEZxup.js +119 -0
- package/dashboard/assets/{DashboardShared-CGZZTe4C.js → DashboardShared-BfSOAHkB.js} +4 -4
- package/dashboard/assets/{DiffTab-DoG4Hq6_.js → DiffTab-Dkqx4lg8.js} +3 -3
- package/dashboard/assets/{FilesTab-BX-UYwna.js → FilesTab-BWK1YZk0.js} +1 -1
- package/dashboard/assets/{PreviewTab-DnhQ_cTw.js → PreviewTab-CgGqqXSW.js} +5 -10
- package/dashboard/assets/SharedConversationPage-COhUZENs.js +7 -0
- package/dashboard/assets/{file-CFaB5QBp.js → file-BdIshbRs.js} +1 -1
- package/dashboard/assets/{folder-DhIVX8_W.js → folder-Cl9WN_cx.js} +1 -1
- package/dashboard/assets/{index-Bb1MuUmE.js → index-DHC5U3_j.js} +56 -51
- package/dashboard/assets/index-DfiptIs_.css +1 -0
- package/dashboard/assets/input-CdkmqjGJ.js +6 -0
- package/dashboard/index.html +2 -2
- package/main.cjs +492 -307
- package/package.json +1 -1
- package/runtime-metadata.json +5 -5
- package/dashboard/assets/DashboardPage-DqRPTnH6.js +0 -119
- package/dashboard/assets/SharedConversationPage--7Zq1FFl.js +0 -12
- package/dashboard/assets/index-CmW82hgD.css +0 -1
- package/dashboard/assets/input-CgtqVNV3.js +0 -1
package/main.cjs
CHANGED
|
@@ -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((resolve15, reject) => {
|
|
4650
|
+
req2.once("response", resolve15).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((resolve15, 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
|
+
resolve15({
|
|
4894
4894
|
connect: {
|
|
4895
4895
|
statusCode,
|
|
4896
4896
|
statusText,
|
|
@@ -6629,8 +6629,8 @@ var require_node2 = __commonJS({
|
|
|
6629
6629
|
}
|
|
6630
6630
|
break;
|
|
6631
6631
|
case "FILE":
|
|
6632
|
-
var
|
|
6633
|
-
stream2 = new
|
|
6632
|
+
var fs23 = require("fs");
|
|
6633
|
+
stream2 = new fs23.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(resolve15, reject) {
|
|
10287
10287
|
readStream(stream, encoding, length, limit, function onRead(err, buf) {
|
|
10288
10288
|
if (err) return reject(err);
|
|
10289
|
-
|
|
10289
|
+
resolve15(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(path24) {
|
|
19424
|
+
if (!path24 || typeof path24 !== "string") {
|
|
19425
19425
|
return false;
|
|
19426
19426
|
}
|
|
19427
|
-
var extension2 = extname3("x." +
|
|
19427
|
+
var extension2 = extname3("x." + path24).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(path24, 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 (path24 instanceof RegExp) {
|
|
22960
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path24.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 path24;
|
|
22969
22969
|
}
|
|
22970
|
-
if (Array.isArray(
|
|
22971
|
-
|
|
22970
|
+
if (Array.isArray(path24)) {
|
|
22971
|
+
path24 = path24.map(function(value) {
|
|
22972
22972
|
return pathToRegexp(value, keys, options).source;
|
|
22973
22973
|
});
|
|
22974
|
-
return new RegExp(
|
|
22974
|
+
return new RegExp(path24.join("|"), flags);
|
|
22975
22975
|
}
|
|
22976
|
-
if (typeof
|
|
22976
|
+
if (typeof path24 !== "string") {
|
|
22977
22977
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
22978
22978
|
}
|
|
22979
|
-
|
|
22979
|
+
path24 = path24.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 += path24.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(path24)) {
|
|
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
|
+
path24 += strict ? "" : path24[path24.length - 1] === "/" ? "?" : "/?";
|
|
23039
23039
|
if (end) {
|
|
23040
|
-
|
|
23041
|
-
} else if (
|
|
23042
|
-
|
|
23040
|
+
path24 += "$";
|
|
23041
|
+
} else if (path24[path24.length - 1] !== "/") {
|
|
23042
|
+
path24 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
23043
23043
|
}
|
|
23044
|
-
return new RegExp("^" +
|
|
23044
|
+
return new RegExp("^" + path24, 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(path24, options, fn) {
|
|
23058
23058
|
if (!(this instanceof Layer)) {
|
|
23059
|
-
return new Layer(
|
|
23059
|
+
return new Layer(path24, options, fn);
|
|
23060
23060
|
}
|
|
23061
|
-
debug("new %o",
|
|
23061
|
+
debug("new %o", path24);
|
|
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(path24, this.keys = [], opts);
|
|
23068
|
+
this.regexp.fast_star = path24 === "*";
|
|
23069
|
+
this.regexp.fast_slash = path24 === "/" && 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(path24) {
|
|
23094
23094
|
var match2;
|
|
23095
|
-
if (
|
|
23095
|
+
if (path24 != 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(path24) };
|
|
23103
|
+
this.path = path24;
|
|
23104
23104
|
return true;
|
|
23105
23105
|
}
|
|
23106
|
-
match2 = this.regexp.exec(
|
|
23106
|
+
match2 = this.regexp.exec(path24);
|
|
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(path24) {
|
|
23200
|
+
this.path = path24;
|
|
23201
23201
|
this.stack = [];
|
|
23202
|
-
debug("new %o",
|
|
23202
|
+
debug("new %o", path24);
|
|
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 path24 = getPathname(req);
|
|
23416
|
+
if (path24 == 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, path24);
|
|
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, path24);
|
|
23463
23463
|
}
|
|
23464
23464
|
sync = 0;
|
|
23465
23465
|
});
|
|
23466
23466
|
}
|
|
23467
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
23467
|
+
function trim_prefix(layer, layerError, layerPath, path24) {
|
|
23468
23468
|
if (layerPath.length !== 0) {
|
|
23469
|
-
if (layerPath !==
|
|
23469
|
+
if (layerPath !== path24.slice(0, layerPath.length)) {
|
|
23470
23470
|
next(layerError);
|
|
23471
23471
|
return;
|
|
23472
23472
|
}
|
|
23473
|
-
var c =
|
|
23473
|
+
var c = path24[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 path24 = "/";
|
|
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
|
+
path24 = 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", path24, fn.name || "<anonymous>");
|
|
23572
|
+
var layer = new Layer(path24, {
|
|
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(path24) {
|
|
23583
|
+
var route2 = new Route(path24);
|
|
23584
|
+
var layer = new Layer(path24, {
|
|
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(path24) {
|
|
23595
|
+
var route = this.route(path24);
|
|
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, path24) {
|
|
23632
23632
|
try {
|
|
23633
|
-
return layer.match(
|
|
23633
|
+
return layer.match(path24);
|
|
23634
23634
|
} catch (err) {
|
|
23635
23635
|
return err;
|
|
23636
23636
|
}
|
|
@@ -23748,13 +23748,13 @@ var require_view = __commonJS({
|
|
|
23748
23748
|
"../../node_modules/.pnpm/express@4.22.1/node_modules/express/lib/view.js"(exports2, module2) {
|
|
23749
23749
|
"use strict";
|
|
23750
23750
|
var debug = require_src2()("express:view");
|
|
23751
|
-
var
|
|
23752
|
-
var
|
|
23753
|
-
var dirname7 =
|
|
23754
|
-
var basename5 =
|
|
23755
|
-
var extname3 =
|
|
23756
|
-
var join18 =
|
|
23757
|
-
var
|
|
23751
|
+
var path24 = require("path");
|
|
23752
|
+
var fs23 = require("fs");
|
|
23753
|
+
var dirname7 = path24.dirname;
|
|
23754
|
+
var basename5 = path24.basename;
|
|
23755
|
+
var extname3 = path24.extname;
|
|
23756
|
+
var join18 = path24.join;
|
|
23757
|
+
var resolve15 = path24.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 path25;
|
|
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 && !path25; i++) {
|
|
23790
23790
|
var root = roots[i];
|
|
23791
|
-
var loc =
|
|
23791
|
+
var loc = resolve15(root, name2);
|
|
23792
23792
|
var dir = dirname7(loc);
|
|
23793
23793
|
var file = basename5(loc);
|
|
23794
|
-
|
|
23794
|
+
path25 = this.resolve(dir, file);
|
|
23795
23795
|
}
|
|
23796
|
-
return
|
|
23796
|
+
return path25;
|
|
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 resolve16(dir, file) {
|
|
23803
23803
|
var ext = this.ext;
|
|
23804
|
-
var
|
|
23805
|
-
var stat = tryStat(
|
|
23804
|
+
var path25 = join18(dir, file);
|
|
23805
|
+
var stat = tryStat(path25);
|
|
23806
23806
|
if (stat && stat.isFile()) {
|
|
23807
|
-
return
|
|
23807
|
+
return path25;
|
|
23808
23808
|
}
|
|
23809
|
-
|
|
23810
|
-
stat = tryStat(
|
|
23809
|
+
path25 = join18(dir, basename5(file, ext), "index" + ext);
|
|
23810
|
+
stat = tryStat(path25);
|
|
23811
23811
|
if (stat && stat.isFile()) {
|
|
23812
|
-
return
|
|
23812
|
+
return path25;
|
|
23813
23813
|
}
|
|
23814
23814
|
};
|
|
23815
|
-
function tryStat(
|
|
23816
|
-
debug('stat "%s"',
|
|
23815
|
+
function tryStat(path25) {
|
|
23816
|
+
debug('stat "%s"', path25);
|
|
23817
23817
|
try {
|
|
23818
|
-
return
|
|
23818
|
+
return fs23.statSync(path25);
|
|
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 path24 = require("path");
|
|
24116
|
+
var fs23 = 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 = fs23.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(path25, fallback) {
|
|
24146
|
+
var ext = path25.replace(/^.*[\.\/\\]/, "").toLowerCase();
|
|
24147
24147
|
return this.types[ext] || fallback || this.default_type;
|
|
24148
24148
|
};
|
|
24149
24149
|
Mime.prototype.extension = function(mimeType) {
|
|
@@ -24256,33 +24256,33 @@ var require_send = __commonJS({
|
|
|
24256
24256
|
var escapeHtml2 = require_escape_html();
|
|
24257
24257
|
var etag = require_etag();
|
|
24258
24258
|
var fresh = require_fresh();
|
|
24259
|
-
var
|
|
24259
|
+
var fs23 = 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 path24 = 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 join18 =
|
|
24270
|
-
var normalize =
|
|
24271
|
-
var
|
|
24272
|
-
var sep4 =
|
|
24268
|
+
var extname3 = path24.extname;
|
|
24269
|
+
var join18 = path24.join;
|
|
24270
|
+
var normalize = path24.normalize;
|
|
24271
|
+
var resolve15 = path24.resolve;
|
|
24272
|
+
var sep4 = path24.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, path25, options) {
|
|
24279
|
+
return new SendStream(req, path25, options);
|
|
24280
24280
|
}
|
|
24281
|
-
function SendStream(req,
|
|
24281
|
+
function SendStream(req, path25, options) {
|
|
24282
24282
|
Stream.call(this);
|
|
24283
24283
|
var opts = options || {};
|
|
24284
24284
|
this.options = opts;
|
|
24285
|
-
this.path =
|
|
24285
|
+
this.path = path25;
|
|
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 ? resolve15(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(path25) {
|
|
24332
|
+
this._root = resolve15(String(path25));
|
|
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(path25) {
|
|
24446
24446
|
var res = this.res;
|
|
24447
24447
|
if (hasListeners(this, "directory")) {
|
|
24448
|
-
this.emit("directory", res,
|
|
24448
|
+
this.emit("directory", res, path25);
|
|
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 path25 = decode(this.path);
|
|
24469
|
+
if (path25 === -1) {
|
|
24470
24470
|
this.error(400);
|
|
24471
24471
|
return res;
|
|
24472
24472
|
}
|
|
24473
|
-
if (~
|
|
24473
|
+
if (~path25.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 (path25) {
|
|
24480
|
+
path25 = normalize("." + sep4 + path25);
|
|
24481
24481
|
}
|
|
24482
|
-
if (UP_PATH_REGEXP.test(
|
|
24483
|
-
debug('malicious path "%s"',
|
|
24482
|
+
if (UP_PATH_REGEXP.test(path25)) {
|
|
24483
|
+
debug('malicious path "%s"', path25);
|
|
24484
24484
|
this.error(403);
|
|
24485
24485
|
return res;
|
|
24486
24486
|
}
|
|
24487
|
-
parts =
|
|
24488
|
-
|
|
24487
|
+
parts = path25.split(sep4);
|
|
24488
|
+
path25 = normalize(join18(root, path25));
|
|
24489
24489
|
} else {
|
|
24490
|
-
if (UP_PATH_REGEXP.test(
|
|
24491
|
-
debug('malicious path "%s"',
|
|
24490
|
+
if (UP_PATH_REGEXP.test(path25)) {
|
|
24491
|
+
debug('malicious path "%s"', path25);
|
|
24492
24492
|
this.error(403);
|
|
24493
24493
|
return res;
|
|
24494
24494
|
}
|
|
24495
|
-
parts = normalize(
|
|
24496
|
-
|
|
24495
|
+
parts = normalize(path25).split(sep4);
|
|
24496
|
+
path25 = resolve15(path25);
|
|
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, path25);
|
|
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(path25);
|
|
24518
24518
|
return res;
|
|
24519
24519
|
}
|
|
24520
|
-
this.sendFile(
|
|
24520
|
+
this.sendFile(path25);
|
|
24521
24521
|
return res;
|
|
24522
24522
|
};
|
|
24523
|
-
SendStream.prototype.send = function send2(
|
|
24523
|
+
SendStream.prototype.send = function send2(path25, 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"', path25);
|
|
24536
|
+
this.setHeader(path25, stat);
|
|
24537
|
+
this.type(path25);
|
|
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(path25, opts);
|
|
24587
24587
|
};
|
|
24588
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
24588
|
+
SendStream.prototype.sendFile = function sendFile(path25) {
|
|
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"', path25);
|
|
24592
|
+
fs23.stat(path25, function onstat(err, stat) {
|
|
24593
|
+
if (err && err.code === "ENOENT" && !extname3(path25) && path25[path25.length - 1] !== sep4) {
|
|
24594
24594
|
return next(err);
|
|
24595
24595
|
}
|
|
24596
24596
|
if (err) return self2.onStatError(err);
|
|
24597
|
-
if (stat.isDirectory()) return self2.redirect(
|
|
24598
|
-
self2.emit("file",
|
|
24599
|
-
self2.send(
|
|
24597
|
+
if (stat.isDirectory()) return self2.redirect(path25);
|
|
24598
|
+
self2.emit("file", path25, stat);
|
|
24599
|
+
self2.send(path25, 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 = path25 + "." + self2._extensions[i++];
|
|
24606
24606
|
debug('stat "%s"', p);
|
|
24607
|
-
|
|
24607
|
+
fs23.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(path25) {
|
|
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 = join18(
|
|
24623
|
+
var p = join18(path25, self2._index[i]);
|
|
24624
24624
|
debug('stat "%s"', p);
|
|
24625
|
-
|
|
24625
|
+
fs23.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(path25, options) {
|
|
24635
24635
|
var self2 = this;
|
|
24636
24636
|
var res = this.res;
|
|
24637
|
-
var stream2 =
|
|
24637
|
+
var stream2 = fs23.createReadStream(path25, 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(path25) {
|
|
24653
24653
|
var res = this.res;
|
|
24654
24654
|
if (res.getHeader("Content-Type")) return;
|
|
24655
|
-
var type2 = mime.lookup(
|
|
24655
|
+
var type2 = mime.lookup(path25);
|
|
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(path25, stat) {
|
|
24665
24665
|
var res = this.res;
|
|
24666
|
-
this.emit("headers", res,
|
|
24666
|
+
this.emit("headers", res, path25, 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(path25) {
|
|
24726
24726
|
try {
|
|
24727
|
-
return decodeURIComponent(
|
|
24727
|
+
return decodeURIComponent(path25);
|
|
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(path24) {
|
|
25638
|
+
if ("/" === path24[0]) return true;
|
|
25639
|
+
if (":" === path24[1] && ("\\" === path24[2] || "/" === path24[2])) return true;
|
|
25640
|
+
if ("\\\\" === path24.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 resolve15 = 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", resolve15("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 path24 = "/";
|
|
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
|
+
path24 = 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(path24, fn2);
|
|
25871
25871
|
}
|
|
25872
|
-
debug(".use app under %s",
|
|
25873
|
-
fn2.mountpath =
|
|
25872
|
+
debug(".use app under %s", path24);
|
|
25873
|
+
fn2.mountpath = path24;
|
|
25874
25874
|
fn2.parent = this;
|
|
25875
|
-
router.use(
|
|
25875
|
+
router.use(path24, 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(path24) {
|
|
25888
25888
|
this.lazyrouter();
|
|
25889
|
-
return this._router.route(
|
|
25889
|
+
return this._router.route(path24);
|
|
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 path24() {
|
|
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(path24) {
|
|
25957
25957
|
if (method === "get" && arguments.length === 1) {
|
|
25958
|
-
return this.set(
|
|
25958
|
+
return this.set(path24);
|
|
25959
25959
|
}
|
|
25960
25960
|
this.lazyrouter();
|
|
25961
|
-
var route = this._router.route(
|
|
25961
|
+
var route = this._router.route(path24);
|
|
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(path24) {
|
|
25967
25967
|
this.lazyrouter();
|
|
25968
|
-
var route = this._router.route(
|
|
25968
|
+
var route = this._router.route(path24);
|
|
25969
25969
|
var args = slice.call(arguments, 1);
|
|
25970
25970
|
for (var i = 0; i < methods.length; i++) {
|
|
25971
25971
|
route[methods[i]].apply(route, args);
|
|
@@ -26724,7 +26724,7 @@ var require_request = __commonJS({
|
|
|
26724
26724
|
var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
|
|
26725
26725
|
return subdomains2.slice(offset);
|
|
26726
26726
|
});
|
|
26727
|
-
defineGetter(req, "path", function
|
|
26727
|
+
defineGetter(req, "path", function path24() {
|
|
26728
26728
|
return parse(this).pathname;
|
|
26729
26729
|
});
|
|
26730
26730
|
defineGetter(req, "hostname", function hostname3() {
|
|
@@ -27045,9 +27045,9 @@ var require_response = __commonJS({
|
|
|
27045
27045
|
var encodeUrl = require_encodeurl();
|
|
27046
27046
|
var escapeHtml2 = require_escape_html();
|
|
27047
27047
|
var http3 = require("http");
|
|
27048
|
-
var
|
|
27048
|
+
var isAbsolute5 = require_utils2().isAbsolute;
|
|
27049
27049
|
var onFinished = require_on_finished();
|
|
27050
|
-
var
|
|
27050
|
+
var path24 = 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 = path24.extname;
|
|
27060
27060
|
var mime = send.mime;
|
|
27061
|
-
var
|
|
27061
|
+
var resolve15 = path24.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(path25, 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 (!path25) {
|
|
27245
27245
|
throw new TypeError("path argument is required to res.sendFile");
|
|
27246
27246
|
}
|
|
27247
|
-
if (typeof
|
|
27247
|
+
if (typeof path25 !== "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 && !
|
|
27254
|
+
if (!opts.root && !isAbsolute5(path25)) {
|
|
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(path25);
|
|
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(path25, 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, path25, 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(path25, 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 || path25)
|
|
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 ? resolve15(path25) : path25;
|
|
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 escapeHtml2 = require_escape_html();
|
|
27585
27585
|
var parseUrl = require_parseurl();
|
|
27586
|
-
var
|
|
27586
|
+
var resolve15 = 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 = resolve15(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 path24 = parseUrl(req).pathname;
|
|
27622
|
+
if (path24 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
27623
|
+
path24 = "";
|
|
27624
27624
|
}
|
|
27625
|
-
var stream = send(req,
|
|
27625
|
+
var stream = send(req, path24, opts);
|
|
27626
27626
|
stream.on("directory", onDirectory);
|
|
27627
27627
|
if (setHeaders) {
|
|
27628
27628
|
stream.on("headers", setHeaders);
|
|
@@ -30059,7 +30059,7 @@ function wasClockTurnedBack(cachedAt) {
|
|
|
30059
30059
|
return cachedAtSec > nowSeconds();
|
|
30060
30060
|
}
|
|
30061
30061
|
function delay(t, value) {
|
|
30062
|
-
return new Promise((
|
|
30062
|
+
return new Promise((resolve15) => setTimeout(() => resolve15(value), t));
|
|
30063
30063
|
}
|
|
30064
30064
|
|
|
30065
30065
|
// ../../node_modules/.pnpm/@azure+msal-common@16.5.0/node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.mjs
|
|
@@ -31553,7 +31553,7 @@ var developerCliCredentialInternals = {
|
|
|
31553
31553
|
const encodedClaims = btoa(claims);
|
|
31554
31554
|
claimsSections = ["--claims", encodedClaims];
|
|
31555
31555
|
}
|
|
31556
|
-
return new Promise((
|
|
31556
|
+
return new Promise((resolve15, reject) => {
|
|
31557
31557
|
try {
|
|
31558
31558
|
const args = [
|
|
31559
31559
|
"auth",
|
|
@@ -31570,7 +31570,7 @@ var developerCliCredentialInternals = {
|
|
|
31570
31570
|
cwd: developerCliCredentialInternals.getSafeWorkingDir(),
|
|
31571
31571
|
timeout
|
|
31572
31572
|
}, (error, stdout, stderr) => {
|
|
31573
|
-
|
|
31573
|
+
resolve15({ stdout, stderr, error });
|
|
31574
31574
|
});
|
|
31575
31575
|
} catch (err) {
|
|
31576
31576
|
reject(err);
|
|
@@ -31718,7 +31718,7 @@ var cliCredentialInternals = {
|
|
|
31718
31718
|
if (subscription) {
|
|
31719
31719
|
subscriptionSection = ["--subscription", `"${subscription}"`];
|
|
31720
31720
|
}
|
|
31721
|
-
return new Promise((
|
|
31721
|
+
return new Promise((resolve15, reject) => {
|
|
31722
31722
|
try {
|
|
31723
31723
|
const args = [
|
|
31724
31724
|
"account",
|
|
@@ -31732,7 +31732,7 @@ var cliCredentialInternals = {
|
|
|
31732
31732
|
];
|
|
31733
31733
|
const command = ["az", ...args].join(" ");
|
|
31734
31734
|
import_child_process2.default.exec(command, { cwd: cliCredentialInternals.getSafeWorkingDir(), timeout }, (error, stdout, stderr) => {
|
|
31735
|
-
|
|
31735
|
+
resolve15({ stdout, stderr, error });
|
|
31736
31736
|
});
|
|
31737
31737
|
} catch (err) {
|
|
31738
31738
|
reject(err);
|
|
@@ -31873,7 +31873,7 @@ var processUtils = {
|
|
|
31873
31873
|
* @internal
|
|
31874
31874
|
*/
|
|
31875
31875
|
execFile(file, params, options) {
|
|
31876
|
-
return new Promise((
|
|
31876
|
+
return new Promise((resolve15, reject) => {
|
|
31877
31877
|
import_node_child_process.default.execFile(file, params, options, (error, stdout, stderr) => {
|
|
31878
31878
|
if (Buffer.isBuffer(stdout)) {
|
|
31879
31879
|
stdout = stdout.toString("utf8");
|
|
@@ -31884,7 +31884,7 @@ var processUtils = {
|
|
|
31884
31884
|
if (stderr || error) {
|
|
31885
31885
|
reject(stderr ? new Error(stderr) : error);
|
|
31886
31886
|
} else {
|
|
31887
|
-
|
|
31887
|
+
resolve15(stdout);
|
|
31888
31888
|
}
|
|
31889
31889
|
});
|
|
31890
31890
|
});
|
|
@@ -33266,19 +33266,19 @@ async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_NODE_REQUEST_TIME
|
|
|
33266
33266
|
cleanup();
|
|
33267
33267
|
}
|
|
33268
33268
|
}
|
|
33269
|
-
async function fetchNodeWithFallback(node,
|
|
33269
|
+
async function fetchNodeWithFallback(node, path24, init, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS, trace, options) {
|
|
33270
33270
|
let lastError;
|
|
33271
33271
|
const endpoints = getNodeRequestEndpoints(node, options);
|
|
33272
33272
|
for (const [index, endpoint] of endpoints.entries()) {
|
|
33273
33273
|
const attempt = index + 1;
|
|
33274
|
-
trace?.onAttempt?.({ attempt, endpoint, path:
|
|
33274
|
+
trace?.onAttempt?.({ attempt, endpoint, path: path24, timeoutMs, totalEndpoints: endpoints.length });
|
|
33275
33275
|
try {
|
|
33276
|
-
const response = await fetchWithTimeout(`${endpoint}${
|
|
33277
|
-
trace?.onResponse?.({ attempt, endpoint, path:
|
|
33276
|
+
const response = await fetchWithTimeout(`${endpoint}${path24}`, init, timeoutMs);
|
|
33277
|
+
trace?.onResponse?.({ attempt, endpoint, path: path24, response, timeoutMs, totalEndpoints: endpoints.length });
|
|
33278
33278
|
return { endpoint, response };
|
|
33279
33279
|
} catch (error) {
|
|
33280
33280
|
lastError = error;
|
|
33281
|
-
trace?.onError?.({ attempt, endpoint, error, path:
|
|
33281
|
+
trace?.onError?.({ attempt, endpoint, error, path: path24, timeoutMs, totalEndpoints: endpoints.length });
|
|
33282
33282
|
}
|
|
33283
33283
|
}
|
|
33284
33284
|
throw lastError instanceof Error ? lastError : new Error("No reachable node endpoint");
|
|
@@ -33297,6 +33297,7 @@ function createNodeMessage(kind, payload, options = {}) {
|
|
|
33297
33297
|
}
|
|
33298
33298
|
|
|
33299
33299
|
// ../../packages/core/src/messaging/node-message-client.ts
|
|
33300
|
+
var RETRYABLE_NODE_MESSAGE_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
33300
33301
|
var NodeMessageClient = class {
|
|
33301
33302
|
constructor(options = {}) {
|
|
33302
33303
|
this.options = options;
|
|
@@ -33335,6 +33336,16 @@ var NodeMessageClient = class {
|
|
|
33335
33336
|
throw error;
|
|
33336
33337
|
}
|
|
33337
33338
|
if (!response.ok) {
|
|
33339
|
+
if (RETRYABLE_NODE_MESSAGE_STATUSES.has(response.status) && this.options.heartbeat?.enqueueNodeMessage) {
|
|
33340
|
+
this.log?.warn("direct node message delivery returned retryable status; queued for keepalive", {
|
|
33341
|
+
nodeId: node.id,
|
|
33342
|
+
messageId: message.id,
|
|
33343
|
+
kind: message.kind,
|
|
33344
|
+
statusCode: response.status
|
|
33345
|
+
});
|
|
33346
|
+
this.options.heartbeat.enqueueNodeMessage(node.id, message);
|
|
33347
|
+
return { queued: true };
|
|
33348
|
+
}
|
|
33338
33349
|
throw new Error(await formatHttpError(response));
|
|
33339
33350
|
}
|
|
33340
33351
|
return { queued: false };
|
|
@@ -34431,7 +34442,7 @@ var KeepaliveNodeMessageQueue = class {
|
|
|
34431
34442
|
queued.push(requestMessage);
|
|
34432
34443
|
this.queuedMessages.set(nodeId, queued);
|
|
34433
34444
|
this.log.info("queued keepalive node message request", { nodeId, ...describeNodeMessage(requestMessage) });
|
|
34434
|
-
return new Promise((
|
|
34445
|
+
return new Promise((resolve15, reject) => {
|
|
34435
34446
|
const timeoutId = setTimeout(() => {
|
|
34436
34447
|
this.pendingResponses.delete(requestMessage.id);
|
|
34437
34448
|
reject(new Error(`Timed out waiting for ${requestMessage.kind} response from ${nodeId}`));
|
|
@@ -34439,7 +34450,7 @@ var KeepaliveNodeMessageQueue = class {
|
|
|
34439
34450
|
this.pendingResponses.set(requestMessage.id, {
|
|
34440
34451
|
nodeId,
|
|
34441
34452
|
kind: requestMessage.kind,
|
|
34442
|
-
resolve:
|
|
34453
|
+
resolve: resolve15,
|
|
34443
34454
|
reject,
|
|
34444
34455
|
timeoutId
|
|
34445
34456
|
});
|
|
@@ -35326,9 +35337,9 @@ var DataRouter = class {
|
|
|
35326
35337
|
/**
|
|
35327
35338
|
* Returns true if the request should be proxied to the leader.
|
|
35328
35339
|
*/
|
|
35329
|
-
shouldProxy(method,
|
|
35340
|
+
shouldProxy(method, path24) {
|
|
35330
35341
|
if (this.election.isLeader()) return false;
|
|
35331
|
-
if (this.isExcludedPath(
|
|
35342
|
+
if (this.isExcludedPath(path24)) return false;
|
|
35332
35343
|
if (method.toUpperCase() === "GET") return false;
|
|
35333
35344
|
return WRITE_METHODS.has(method.toUpperCase());
|
|
35334
35345
|
}
|
|
@@ -35432,8 +35443,8 @@ var DataRouter = class {
|
|
|
35432
35443
|
};
|
|
35433
35444
|
}
|
|
35434
35445
|
// ── Helpers ───────────────────────────────────────────────────────────
|
|
35435
|
-
isExcludedPath(
|
|
35436
|
-
return EXCLUDED_PATH_PREFIXES.some((prefix) =>
|
|
35446
|
+
isExcludedPath(path24) {
|
|
35447
|
+
return EXCLUDED_PATH_PREFIXES.some((prefix) => path24.startsWith(prefix)) || EXCLUDED_PATH_SUFFIXES.some((suffix) => path24.endsWith(suffix));
|
|
35437
35448
|
}
|
|
35438
35449
|
};
|
|
35439
35450
|
|
|
@@ -36341,7 +36352,7 @@ var LiteAgentRunner = class {
|
|
|
36341
36352
|
}
|
|
36342
36353
|
};
|
|
36343
36354
|
function runProcessForOutput(command, args, prompt, cwd, extractOutput) {
|
|
36344
|
-
return new Promise((
|
|
36355
|
+
return new Promise((resolve15, reject) => {
|
|
36345
36356
|
const proc = (0, import_node_child_process3.spawn)(command, args, {
|
|
36346
36357
|
cwd: cwd ?? process.cwd(),
|
|
36347
36358
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -36361,7 +36372,7 @@ function runProcessForOutput(command, args, prompt, cwd, extractOutput) {
|
|
|
36361
36372
|
return;
|
|
36362
36373
|
}
|
|
36363
36374
|
try {
|
|
36364
|
-
|
|
36375
|
+
resolve15(extractOutput ? extractOutput(stdout) : stdout.trim());
|
|
36365
36376
|
} catch (error) {
|
|
36366
36377
|
reject(error);
|
|
36367
36378
|
}
|
|
@@ -38752,7 +38763,7 @@ async function closeHttpServer(server, options = {}) {
|
|
|
38752
38763
|
return;
|
|
38753
38764
|
}
|
|
38754
38765
|
const forceAfterMs = options.forceAfterMs ?? 1e3;
|
|
38755
|
-
await new Promise((
|
|
38766
|
+
await new Promise((resolve15, reject) => {
|
|
38756
38767
|
const forceTimer = setTimeout(() => {
|
|
38757
38768
|
server.closeAllConnections?.();
|
|
38758
38769
|
server.closeIdleConnections?.();
|
|
@@ -38764,7 +38775,7 @@ async function closeHttpServer(server, options = {}) {
|
|
|
38764
38775
|
reject(err);
|
|
38765
38776
|
return;
|
|
38766
38777
|
}
|
|
38767
|
-
|
|
38778
|
+
resolve15();
|
|
38768
38779
|
});
|
|
38769
38780
|
server.closeIdleConnections?.();
|
|
38770
38781
|
});
|
|
@@ -39261,8 +39272,8 @@ function getErrorMap() {
|
|
|
39261
39272
|
|
|
39262
39273
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
39263
39274
|
var makeIssue = (params) => {
|
|
39264
|
-
const { data, path:
|
|
39265
|
-
const fullPath = [...
|
|
39275
|
+
const { data, path: path24, errorMaps, issueData } = params;
|
|
39276
|
+
const fullPath = [...path24, ...issueData.path || []];
|
|
39266
39277
|
const fullIssue = {
|
|
39267
39278
|
...issueData,
|
|
39268
39279
|
path: fullPath
|
|
@@ -39378,11 +39389,11 @@ var errorUtil;
|
|
|
39378
39389
|
|
|
39379
39390
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
39380
39391
|
var ParseInputLazyPath = class {
|
|
39381
|
-
constructor(parent, value,
|
|
39392
|
+
constructor(parent, value, path24, key) {
|
|
39382
39393
|
this._cachedPath = [];
|
|
39383
39394
|
this.parent = parent;
|
|
39384
39395
|
this.data = value;
|
|
39385
|
-
this._path =
|
|
39396
|
+
this._path = path24;
|
|
39386
39397
|
this._key = key;
|
|
39387
39398
|
}
|
|
39388
39399
|
get path() {
|
|
@@ -43063,6 +43074,7 @@ var NativeSessionSummarySchema = external_exports.object({
|
|
|
43063
43074
|
summary: external_exports.string(),
|
|
43064
43075
|
updatedAt: external_exports.string().nullable()
|
|
43065
43076
|
});
|
|
43077
|
+
var NodeOperationStatusSchema = external_exports.enum(["queued", "running", "succeeded", "failed"]);
|
|
43066
43078
|
var NodeListQuery = external_exports.object({
|
|
43067
43079
|
status: external_exports.enum(["online", "busy", "offline"]).optional(),
|
|
43068
43080
|
capability: external_exports.string().optional()
|
|
@@ -43096,6 +43108,10 @@ var NodeNativeSessionsQuery = external_exports.object({
|
|
|
43096
43108
|
agent: external_exports.enum(["codex", "claudecode"]),
|
|
43097
43109
|
limit: external_exports.coerce.number().int().min(1).max(100).default(50)
|
|
43098
43110
|
});
|
|
43111
|
+
var NodeTerminalExecuteBody = external_exports.object({
|
|
43112
|
+
command: external_exports.string().trim().min(1),
|
|
43113
|
+
cwd: external_exports.string().trim().min(1).optional()
|
|
43114
|
+
});
|
|
43099
43115
|
var NodeWorkDirTreeResponse = external_exports.object({
|
|
43100
43116
|
nodeId: external_exports.string(),
|
|
43101
43117
|
rootPath: external_exports.string(),
|
|
@@ -43137,6 +43153,32 @@ var NodeNativeSessionsResponse = external_exports.object({
|
|
|
43137
43153
|
agent: external_exports.enum(["codex", "claudecode"]),
|
|
43138
43154
|
sessions: external_exports.array(NativeSessionSummarySchema)
|
|
43139
43155
|
});
|
|
43156
|
+
var NodeTerminalExecuteResult = external_exports.object({
|
|
43157
|
+
nodeId: external_exports.string(),
|
|
43158
|
+
cwd: external_exports.string(),
|
|
43159
|
+
command: external_exports.string(),
|
|
43160
|
+
exitCode: external_exports.number().int().nullable(),
|
|
43161
|
+
stdout: external_exports.string(),
|
|
43162
|
+
stderr: external_exports.string(),
|
|
43163
|
+
durationMs: external_exports.number().int().min(0),
|
|
43164
|
+
timedOut: external_exports.boolean(),
|
|
43165
|
+
stdoutTruncated: external_exports.boolean(),
|
|
43166
|
+
stderrTruncated: external_exports.boolean()
|
|
43167
|
+
});
|
|
43168
|
+
var NodeTerminalExecuteResponse = external_exports.object({
|
|
43169
|
+
id: external_exports.string(),
|
|
43170
|
+
kind: external_exports.literal("terminal.execute"),
|
|
43171
|
+
nodeId: external_exports.string(),
|
|
43172
|
+
requestedByNodeId: external_exports.string().optional(),
|
|
43173
|
+
status: NodeOperationStatusSchema,
|
|
43174
|
+
payload: NodeTerminalExecuteBody,
|
|
43175
|
+
result: NodeTerminalExecuteResult.optional(),
|
|
43176
|
+
error: external_exports.string().optional(),
|
|
43177
|
+
createdAt: external_exports.number(),
|
|
43178
|
+
updatedAt: external_exports.number(),
|
|
43179
|
+
startedAt: external_exports.number().optional(),
|
|
43180
|
+
completedAt: external_exports.number().optional()
|
|
43181
|
+
});
|
|
43140
43182
|
var UpdateNodeBody = external_exports.object({
|
|
43141
43183
|
name: external_exports.string().min(1).optional(),
|
|
43142
43184
|
capabilities: external_exports.array(external_exports.string()).optional()
|
|
@@ -43283,8 +43325,8 @@ var BatchTaskIdsBody = external_exports.object({
|
|
|
43283
43325
|
});
|
|
43284
43326
|
|
|
43285
43327
|
// ../../packages/api/src/app/server.ts
|
|
43286
|
-
var
|
|
43287
|
-
var
|
|
43328
|
+
var path21 = __toESM(require("path"), 1);
|
|
43329
|
+
var fs20 = __toESM(require("fs"), 1);
|
|
43288
43330
|
var import_express14 = __toESM(require_express2(), 1);
|
|
43289
43331
|
|
|
43290
43332
|
// ../../packages/api/src/middleware/auth.ts
|
|
@@ -43421,8 +43463,8 @@ function decodePathSegment(value) {
|
|
|
43421
43463
|
return value;
|
|
43422
43464
|
}
|
|
43423
43465
|
}
|
|
43424
|
-
function getSingleTaskDeleteId(
|
|
43425
|
-
const match = /^\/api\/tasks\/([^/]+)$/.exec(
|
|
43466
|
+
function getSingleTaskDeleteId(path24) {
|
|
43467
|
+
const match = /^\/api\/tasks\/([^/]+)$/.exec(path24);
|
|
43426
43468
|
return match ? decodePathSegment(match[1]) : null;
|
|
43427
43469
|
}
|
|
43428
43470
|
function getSuccessfulBatchDeleteIds(body) {
|
|
@@ -44461,8 +44503,8 @@ function computeParentPath(rootPath, currentPath, useAbsolute) {
|
|
|
44461
44503
|
}
|
|
44462
44504
|
|
|
44463
44505
|
// ../../packages/api/src/node/node-operation-service.ts
|
|
44464
|
-
var
|
|
44465
|
-
var
|
|
44506
|
+
var fs16 = __toESM(require("fs"), 1);
|
|
44507
|
+
var path18 = __toESM(require("path"), 1);
|
|
44466
44508
|
var import_node_crypto7 = require("crypto");
|
|
44467
44509
|
|
|
44468
44510
|
// ../../packages/api/src/node/agent-upgrade-service.ts
|
|
@@ -44748,6 +44790,95 @@ function upgradeRuntimeAgentForDeps(deps, agent) {
|
|
|
44748
44790
|
return result;
|
|
44749
44791
|
}
|
|
44750
44792
|
|
|
44793
|
+
// ../../packages/api/src/node/node-terminal-service.ts
|
|
44794
|
+
var import_node_child_process10 = require("child_process");
|
|
44795
|
+
var fs15 = __toESM(require("fs"), 1);
|
|
44796
|
+
var path17 = __toESM(require("path"), 1);
|
|
44797
|
+
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
44798
|
+
var DEFAULT_OUTPUT_LIMIT_BYTES = 64 * 1024;
|
|
44799
|
+
function isAbsolutePath2(value) {
|
|
44800
|
+
return path17.isAbsolute(value) || /^[A-Za-z]:[\/]/.test(value);
|
|
44801
|
+
}
|
|
44802
|
+
function resolveCommandCwd(nodeId, rootPath, cwd) {
|
|
44803
|
+
if (!rootPath) {
|
|
44804
|
+
throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
|
|
44805
|
+
}
|
|
44806
|
+
const requestedCwd = cwd?.trim() || ".";
|
|
44807
|
+
const resolved = isAbsolutePath2(requestedCwd) ? path17.resolve(requestedCwd) : path17.resolve(rootPath, requestedCwd);
|
|
44808
|
+
if (!fs15.existsSync(resolved) || !fs15.statSync(resolved).isDirectory()) {
|
|
44809
|
+
throw new MeshyError("VALIDATION_ERROR", `Working directory does not exist: ${resolved}`, 400);
|
|
44810
|
+
}
|
|
44811
|
+
return resolved;
|
|
44812
|
+
}
|
|
44813
|
+
function captureLimited(chunks, chunk, currentBytes, limitBytes) {
|
|
44814
|
+
if (currentBytes >= limitBytes) {
|
|
44815
|
+
return currentBytes + chunk.length;
|
|
44816
|
+
}
|
|
44817
|
+
const remaining = limitBytes - currentBytes;
|
|
44818
|
+
chunks.push(chunk.length <= remaining ? chunk : chunk.subarray(0, remaining));
|
|
44819
|
+
return currentBytes + chunk.length;
|
|
44820
|
+
}
|
|
44821
|
+
function toCapturedOutput(chunks, observedBytes, limitBytes) {
|
|
44822
|
+
return {
|
|
44823
|
+
text: Buffer.concat(chunks).toString("utf8"),
|
|
44824
|
+
truncated: observedBytes > limitBytes
|
|
44825
|
+
};
|
|
44826
|
+
}
|
|
44827
|
+
function executeLocalNodeTerminalCommand(nodeId, rootPath, command, options = {}) {
|
|
44828
|
+
const normalizedCommand = command.trim();
|
|
44829
|
+
if (!normalizedCommand) {
|
|
44830
|
+
throw new MeshyError("VALIDATION_ERROR", "Command must not be empty", 400);
|
|
44831
|
+
}
|
|
44832
|
+
const cwd = resolveCommandCwd(nodeId, rootPath, options.cwd);
|
|
44833
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
44834
|
+
const outputLimitBytes = options.outputLimitBytes ?? DEFAULT_OUTPUT_LIMIT_BYTES;
|
|
44835
|
+
const startedAt = Date.now();
|
|
44836
|
+
const stdoutChunks = [];
|
|
44837
|
+
const stderrChunks = [];
|
|
44838
|
+
let stdoutBytes = 0;
|
|
44839
|
+
let stderrBytes = 0;
|
|
44840
|
+
let timedOut = false;
|
|
44841
|
+
return new Promise((resolve15, reject) => {
|
|
44842
|
+
const child = (0, import_node_child_process10.spawn)(normalizedCommand, {
|
|
44843
|
+
cwd,
|
|
44844
|
+
shell: true,
|
|
44845
|
+
windowsHide: true,
|
|
44846
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
44847
|
+
});
|
|
44848
|
+
const timeout = setTimeout(() => {
|
|
44849
|
+
timedOut = true;
|
|
44850
|
+
child.kill("SIGTERM");
|
|
44851
|
+
}, timeoutMs);
|
|
44852
|
+
child.stdout?.on("data", (chunk) => {
|
|
44853
|
+
stdoutBytes = captureLimited(stdoutChunks, chunk, stdoutBytes, outputLimitBytes);
|
|
44854
|
+
});
|
|
44855
|
+
child.stderr?.on("data", (chunk) => {
|
|
44856
|
+
stderrBytes = captureLimited(stderrChunks, chunk, stderrBytes, outputLimitBytes);
|
|
44857
|
+
});
|
|
44858
|
+
child.on("error", (err) => {
|
|
44859
|
+
clearTimeout(timeout);
|
|
44860
|
+
reject(new MeshyError("VALIDATION_ERROR", err.message, 400));
|
|
44861
|
+
});
|
|
44862
|
+
child.on("close", (code) => {
|
|
44863
|
+
clearTimeout(timeout);
|
|
44864
|
+
const stdout = toCapturedOutput(stdoutChunks, stdoutBytes, outputLimitBytes);
|
|
44865
|
+
const stderr = toCapturedOutput(stderrChunks, stderrBytes, outputLimitBytes);
|
|
44866
|
+
resolve15({
|
|
44867
|
+
nodeId,
|
|
44868
|
+
cwd,
|
|
44869
|
+
command: normalizedCommand,
|
|
44870
|
+
exitCode: code,
|
|
44871
|
+
stdout: stdout.text,
|
|
44872
|
+
stderr: stderr.text,
|
|
44873
|
+
durationMs: Date.now() - startedAt,
|
|
44874
|
+
timedOut,
|
|
44875
|
+
stdoutTruncated: stdout.truncated,
|
|
44876
|
+
stderrTruncated: stderr.truncated
|
|
44877
|
+
});
|
|
44878
|
+
});
|
|
44879
|
+
});
|
|
44880
|
+
}
|
|
44881
|
+
|
|
44751
44882
|
// ../../packages/api/src/node/node-operation-service.ts
|
|
44752
44883
|
var NodeOperationFailure = class extends Error {
|
|
44753
44884
|
constructor(message, result) {
|
|
@@ -44811,8 +44942,8 @@ var FileNodeOperationStore = class {
|
|
|
44811
44942
|
load() {
|
|
44812
44943
|
if (this.loaded) return;
|
|
44813
44944
|
this.loaded = true;
|
|
44814
|
-
if (!
|
|
44815
|
-
const raw = JSON.parse(
|
|
44945
|
+
if (!fs16.existsSync(this.filePath)) return;
|
|
44946
|
+
const raw = JSON.parse(fs16.readFileSync(this.filePath, "utf-8"));
|
|
44816
44947
|
const entries = Array.isArray(raw) ? raw : Object.values(raw);
|
|
44817
44948
|
for (const entry of entries) {
|
|
44818
44949
|
if (isNodeOperation(entry)) {
|
|
@@ -44821,14 +44952,14 @@ var FileNodeOperationStore = class {
|
|
|
44821
44952
|
}
|
|
44822
44953
|
}
|
|
44823
44954
|
persist() {
|
|
44824
|
-
|
|
44955
|
+
fs16.mkdirSync(this.storagePath, { recursive: true });
|
|
44825
44956
|
const body = JSON.stringify(Object.fromEntries(this.operations), null, 2);
|
|
44826
44957
|
const tmpPath = `${this.filePath}.tmp`;
|
|
44827
|
-
|
|
44828
|
-
|
|
44958
|
+
fs16.writeFileSync(tmpPath, body, "utf-8");
|
|
44959
|
+
fs16.renameSync(tmpPath, this.filePath);
|
|
44829
44960
|
}
|
|
44830
44961
|
get filePath() {
|
|
44831
|
-
return
|
|
44962
|
+
return path18.join(this.storagePath, "node-operations.json");
|
|
44832
44963
|
}
|
|
44833
44964
|
};
|
|
44834
44965
|
var NodeOperationService = class {
|
|
@@ -44836,6 +44967,7 @@ var NodeOperationService = class {
|
|
|
44836
44967
|
this.deps = deps;
|
|
44837
44968
|
this.store = store;
|
|
44838
44969
|
this.registerHandler("agent.upgrade", runAgentUpgradeOperation);
|
|
44970
|
+
this.registerHandler("terminal.execute", runTerminalExecuteOperation);
|
|
44839
44971
|
this.registerHandler("workdir.branch-create", runWorkDirBranchCreateOperation);
|
|
44840
44972
|
}
|
|
44841
44973
|
handlers = /* @__PURE__ */ new Map();
|
|
@@ -44981,6 +45113,15 @@ function runAgentUpgradeOperation(operation, deps) {
|
|
|
44981
45113
|
}
|
|
44982
45114
|
return result;
|
|
44983
45115
|
}
|
|
45116
|
+
async function runTerminalExecuteOperation(operation, deps) {
|
|
45117
|
+
const self2 = deps.nodeRegistry.getSelf();
|
|
45118
|
+
return executeLocalNodeTerminalCommand(
|
|
45119
|
+
self2.id,
|
|
45120
|
+
self2.workDir ?? deps.workDir,
|
|
45121
|
+
readPayloadString(operation, "command"),
|
|
45122
|
+
{ cwd: readPayloadString(operation, "cwd") || void 0 }
|
|
45123
|
+
);
|
|
45124
|
+
}
|
|
44984
45125
|
function runWorkDirBranchCreateOperation(operation, deps) {
|
|
44985
45126
|
const self2 = deps.nodeRegistry.getSelf();
|
|
44986
45127
|
return createLocalNodeWorkDirBranch(
|
|
@@ -45138,7 +45279,7 @@ async function sendNodeWorkDirBranchCreateOperation(req, res, nodeId) {
|
|
|
45138
45279
|
}
|
|
45139
45280
|
|
|
45140
45281
|
// ../../packages/api/src/tasks/task-route-utils.ts
|
|
45141
|
-
var
|
|
45282
|
+
var fs17 = __toESM(require("fs"), 1);
|
|
45142
45283
|
var import_node_stream2 = require("stream");
|
|
45143
45284
|
var import_promises5 = require("stream/promises");
|
|
45144
45285
|
|
|
@@ -45147,6 +45288,7 @@ var LEGACY_KIND_BY_NODE_MESSAGE = {
|
|
|
45147
45288
|
"node.workdir.tree": "node-workdir-tree",
|
|
45148
45289
|
"node.workdir.branch-info": "node-workdir-branch-info",
|
|
45149
45290
|
"node.workdir.branch-create": "node-workdir-branch-create",
|
|
45291
|
+
"node.terminal.execute": "node-terminal-execute",
|
|
45150
45292
|
"node.sessions.list": "node-sessions-list",
|
|
45151
45293
|
"node.transport.set": "devtunnel",
|
|
45152
45294
|
"node.agent.upgrade": "node-agent-upgrade",
|
|
@@ -45192,10 +45334,10 @@ function readLocalTaskLogs(engineRegistry, taskId, after, agent) {
|
|
|
45192
45334
|
throw new MeshyError("VALIDATION_ERROR", `Engine not registered for agent: ${agent}`, 400);
|
|
45193
45335
|
}
|
|
45194
45336
|
const logPath = engine.getLogPath(taskId);
|
|
45195
|
-
if (!
|
|
45337
|
+
if (!fs17.existsSync(logPath)) {
|
|
45196
45338
|
return { logs: [], total: 0 };
|
|
45197
45339
|
}
|
|
45198
|
-
const content =
|
|
45340
|
+
const content = fs17.readFileSync(logPath, "utf-8");
|
|
45199
45341
|
const allLines = content.trim().split("\n").filter(Boolean);
|
|
45200
45342
|
const logs = [];
|
|
45201
45343
|
for (let i = after; i < allLines.length; i++) {
|
|
@@ -45494,13 +45636,13 @@ function cancelTaskOnCurrentNode(deps, taskId, options = {}) {
|
|
|
45494
45636
|
}
|
|
45495
45637
|
|
|
45496
45638
|
// ../../packages/api/src/tasks/task-output-service.ts
|
|
45497
|
-
var
|
|
45498
|
-
var
|
|
45639
|
+
var fs19 = __toESM(require("fs"), 1);
|
|
45640
|
+
var path20 = __toESM(require("path"), 1);
|
|
45499
45641
|
|
|
45500
45642
|
// ../../packages/api/src/preview/preview-server.ts
|
|
45501
45643
|
var crypto3 = __toESM(require("crypto"), 1);
|
|
45502
|
-
var
|
|
45503
|
-
var
|
|
45644
|
+
var fs18 = __toESM(require("fs"), 1);
|
|
45645
|
+
var path19 = __toESM(require("path"), 1);
|
|
45504
45646
|
var http2 = __toESM(require("http"), 1);
|
|
45505
45647
|
var import_node_stream3 = require("stream");
|
|
45506
45648
|
var import_promises6 = require("stream/promises");
|
|
@@ -45612,19 +45754,19 @@ function buildPreviewWorkerProxyHeaders(req) {
|
|
|
45612
45754
|
// ../../packages/api/src/preview/preview-server.ts
|
|
45613
45755
|
function resolvePreviewPath(rootPath, relativePath) {
|
|
45614
45756
|
const sanitizedPath = relativePath.replace(/\\/g, "/");
|
|
45615
|
-
const resolvedPath =
|
|
45616
|
-
const normalizedRoot =
|
|
45617
|
-
if (!resolvedPath.startsWith(normalizedRoot +
|
|
45757
|
+
const resolvedPath = path19.resolve(rootPath, sanitizedPath);
|
|
45758
|
+
const normalizedRoot = path19.resolve(rootPath);
|
|
45759
|
+
if (!resolvedPath.startsWith(normalizedRoot + path19.sep) && resolvedPath !== normalizedRoot) {
|
|
45618
45760
|
throw new Error("Invalid preview path");
|
|
45619
45761
|
}
|
|
45620
45762
|
return {
|
|
45621
45763
|
absolutePath: resolvedPath,
|
|
45622
|
-
normalizedPath:
|
|
45764
|
+
normalizedPath: path19.relative(normalizedRoot, resolvedPath).split(path19.sep).join("/")
|
|
45623
45765
|
};
|
|
45624
45766
|
}
|
|
45625
45767
|
function resolvePreviewEntryPath(rootPath, entryPath) {
|
|
45626
45768
|
const { absolutePath, normalizedPath } = resolvePreviewPath(rootPath, entryPath ?? "index.html");
|
|
45627
|
-
if (!
|
|
45769
|
+
if (!fs18.existsSync(absolutePath) || !fs18.statSync(absolutePath).isFile()) {
|
|
45628
45770
|
throw new Error("Preview entry not found");
|
|
45629
45771
|
}
|
|
45630
45772
|
return normalizedPath;
|
|
@@ -45726,7 +45868,7 @@ var MIME_MAP2 = {
|
|
|
45726
45868
|
".mdx": "text/markdown"
|
|
45727
45869
|
};
|
|
45728
45870
|
function getMime(filePath) {
|
|
45729
|
-
return MIME_MAP2[
|
|
45871
|
+
return MIME_MAP2[path19.extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
45730
45872
|
}
|
|
45731
45873
|
function escapeHtml(value) {
|
|
45732
45874
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -46080,14 +46222,14 @@ async function sendPreviewAssetResponse(sessionManager, token, requestedPath, re
|
|
|
46080
46222
|
res.end("Invalid path");
|
|
46081
46223
|
return;
|
|
46082
46224
|
}
|
|
46083
|
-
if (!
|
|
46225
|
+
if (!fs18.existsSync(resolved) || !fs18.statSync(resolved).isFile()) {
|
|
46084
46226
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
46085
46227
|
res.end("File not found");
|
|
46086
46228
|
return;
|
|
46087
46229
|
}
|
|
46088
|
-
const ext =
|
|
46230
|
+
const ext = path19.extname(resolved).toLowerCase();
|
|
46089
46231
|
const mime = ext === ".md" || ext === ".mdx" ? "text/html" : getMime(resolved);
|
|
46090
|
-
const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(
|
|
46232
|
+
const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(fs18.readFileSync(resolved, "utf8"), path19.basename(resolved)) : fs18.readFileSync(resolved);
|
|
46091
46233
|
res.writeHead(200, {
|
|
46092
46234
|
"Content-Type": mime,
|
|
46093
46235
|
"Content-Length": content.length,
|
|
@@ -46409,13 +46551,13 @@ function getLocalTaskOutputDownload(taskEngine, taskId, filePath) {
|
|
|
46409
46551
|
const rootPath = getTaskOutputRoot(taskEngine, taskId);
|
|
46410
46552
|
try {
|
|
46411
46553
|
const absolutePath = resolveOutputPath(rootPath, filePath);
|
|
46412
|
-
if (!
|
|
46554
|
+
if (!fs19.existsSync(absolutePath) || !fs19.statSync(absolutePath).isFile()) {
|
|
46413
46555
|
throw new MeshyError("TASK_NOT_FOUND", `File not found: ${filePath}`, 404);
|
|
46414
46556
|
}
|
|
46415
46557
|
const { mimeType } = classifyFile(absolutePath);
|
|
46416
|
-
const fileName =
|
|
46558
|
+
const fileName = path20.basename(absolutePath).replace(/"/g, "");
|
|
46417
46559
|
return {
|
|
46418
|
-
content:
|
|
46560
|
+
content: fs19.readFileSync(absolutePath),
|
|
46419
46561
|
headers: {
|
|
46420
46562
|
"Content-Type": mimeType,
|
|
46421
46563
|
"Content-Disposition": `inline; filename="${fileName}"`,
|
|
@@ -46586,6 +46728,20 @@ async function executeWorkerControlRequest(deps, request) {
|
|
|
46586
46728
|
);
|
|
46587
46729
|
break;
|
|
46588
46730
|
}
|
|
46731
|
+
case "node.terminal.execute": {
|
|
46732
|
+
const self2 = deps.nodeRegistry.getSelf();
|
|
46733
|
+
response = jsonResponse(
|
|
46734
|
+
request.id,
|
|
46735
|
+
200,
|
|
46736
|
+
await executeLocalNodeTerminalCommand(
|
|
46737
|
+
self2.id,
|
|
46738
|
+
self2.workDir ?? deps.workDir,
|
|
46739
|
+
payloadValue(request, "command", ""),
|
|
46740
|
+
{ cwd: payloadValue(request, "cwd", void 0) }
|
|
46741
|
+
)
|
|
46742
|
+
);
|
|
46743
|
+
break;
|
|
46744
|
+
}
|
|
46589
46745
|
case "node.sessions.list": {
|
|
46590
46746
|
const self2 = deps.nodeRegistry.getSelf();
|
|
46591
46747
|
response = jsonResponse(
|
|
@@ -46833,6 +46989,31 @@ async function sendNodeAgentUpgrade(req, res, nodeId, agentParam) {
|
|
|
46833
46989
|
res.status(202).json(operation);
|
|
46834
46990
|
}
|
|
46835
46991
|
|
|
46992
|
+
// ../../packages/api/src/routes/node-terminal.ts
|
|
46993
|
+
async function sendNodeTerminalExecuteOperation(req, res, nodeId) {
|
|
46994
|
+
const body = NodeTerminalExecuteBody.parse(req.body);
|
|
46995
|
+
const deps = req.app.locals.deps;
|
|
46996
|
+
const { nodeRegistry } = deps;
|
|
46997
|
+
const selfId = nodeRegistry.getSelf().id;
|
|
46998
|
+
const node = nodeId === selfId ? nodeRegistry.getSelf() : nodeRegistry.getNode(nodeId);
|
|
46999
|
+
if (!node) throw new MeshyError("NODE_NOT_FOUND", `Node ${nodeId} not found`, 404);
|
|
47000
|
+
const operations = getNodeOperationService(deps);
|
|
47001
|
+
const operation = operations.create("terminal.execute", nodeId, {
|
|
47002
|
+
command: body.command,
|
|
47003
|
+
cwd: body.cwd
|
|
47004
|
+
});
|
|
47005
|
+
if (nodeId === selfId) {
|
|
47006
|
+
operations.runLocal(operation.id);
|
|
47007
|
+
} else {
|
|
47008
|
+
try {
|
|
47009
|
+
await dispatchNodeOperation(deps, operation, node);
|
|
47010
|
+
} catch (err) {
|
|
47011
|
+
operations.markFailed(operation.id, err instanceof Error ? err.message : String(err));
|
|
47012
|
+
}
|
|
47013
|
+
}
|
|
47014
|
+
res.status(202).json(operation);
|
|
47015
|
+
}
|
|
47016
|
+
|
|
46836
47017
|
// ../../packages/api/src/routes/nodes.ts
|
|
46837
47018
|
var NODE_WORKDIR_PROXY_TIMEOUT_MS = 1e4;
|
|
46838
47019
|
var NODE_WORKDIR_BRANCH_PROXY_TIMEOUT_MS = 25e3;
|
|
@@ -47158,6 +47339,10 @@ function createNodeRoutes() {
|
|
|
47158
47339
|
}
|
|
47159
47340
|
sendLocalNodeWorkDirBranchInfo(req, res, nodeId);
|
|
47160
47341
|
}));
|
|
47342
|
+
router.post("/:id/terminal/execute", asyncHandler3(async (req, res) => {
|
|
47343
|
+
const nodeId = req.params.id;
|
|
47344
|
+
await sendNodeTerminalExecuteOperation(req, res, nodeId);
|
|
47345
|
+
}));
|
|
47161
47346
|
router.post("/:id/workdir/branch", asyncHandler3(async (req, res) => {
|
|
47162
47347
|
const nodeId = req.params.id;
|
|
47163
47348
|
await sendNodeWorkDirBranchCreateOperation(req, res, nodeId);
|
|
@@ -49241,8 +49426,8 @@ function hasAuthorizationHeader(req) {
|
|
|
49241
49426
|
function resolveRuntimeBaseDir() {
|
|
49242
49427
|
const entryPath = process.argv[1];
|
|
49243
49428
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
49244
|
-
const resolved =
|
|
49245
|
-
return
|
|
49429
|
+
const resolved = fs20.realpathSync(path21.resolve(entryPath));
|
|
49430
|
+
return path21.dirname(resolved);
|
|
49246
49431
|
}
|
|
49247
49432
|
return process.cwd();
|
|
49248
49433
|
}
|
|
@@ -49250,18 +49435,18 @@ function resolveStaticDir(baseDir) {
|
|
|
49250
49435
|
const envStaticDir = process.env.MESHY_STATIC_DIR;
|
|
49251
49436
|
const candidateDirs = [
|
|
49252
49437
|
envStaticDir,
|
|
49253
|
-
|
|
49254
|
-
|
|
49255
|
-
|
|
49256
|
-
|
|
49257
|
-
|
|
49258
|
-
|
|
49259
|
-
|
|
49260
|
-
|
|
49261
|
-
|
|
49438
|
+
path21.resolve(baseDir, "dashboard"),
|
|
49439
|
+
path21.resolve(baseDir, "../dashboard"),
|
|
49440
|
+
path21.resolve(baseDir, "../../dashboard/dist"),
|
|
49441
|
+
path21.resolve(baseDir, "../../../packages/dashboard/dist"),
|
|
49442
|
+
path21.resolve(baseDir, "../public"),
|
|
49443
|
+
path21.resolve(baseDir, "../../packages/api/public"),
|
|
49444
|
+
path21.resolve(baseDir, "../../../packages/api/public"),
|
|
49445
|
+
path21.resolve(process.cwd(), "packages/dashboard/dist"),
|
|
49446
|
+
path21.resolve(process.cwd(), "packages/api/public")
|
|
49262
49447
|
].filter((value) => typeof value === "string" && value.length > 0);
|
|
49263
49448
|
for (const candidate of candidateDirs) {
|
|
49264
|
-
if (
|
|
49449
|
+
if (fs20.existsSync(candidate)) {
|
|
49265
49450
|
return candidate;
|
|
49266
49451
|
}
|
|
49267
49452
|
}
|
|
@@ -49362,8 +49547,8 @@ function createServer2(deps) {
|
|
|
49362
49547
|
app.use("/api/node-operations", createNodeOperationRoutes());
|
|
49363
49548
|
app.use("/api/events", createEventRoutes());
|
|
49364
49549
|
if (staticDir) {
|
|
49365
|
-
const indexPath =
|
|
49366
|
-
if (
|
|
49550
|
+
const indexPath = path21.join(staticDir, "index.html");
|
|
49551
|
+
if (fs20.existsSync(indexPath)) {
|
|
49367
49552
|
app.get("*", (req, res, next) => {
|
|
49368
49553
|
if (isApiRequest(req)) {
|
|
49369
49554
|
next();
|
|
@@ -49397,12 +49582,12 @@ function detectLocalIp() {
|
|
|
49397
49582
|
return "127.0.0.1";
|
|
49398
49583
|
}
|
|
49399
49584
|
function detectAvailablePort() {
|
|
49400
|
-
return new Promise((
|
|
49585
|
+
return new Promise((resolve15, reject) => {
|
|
49401
49586
|
const srv = (0, import_node_http2.createServer)();
|
|
49402
49587
|
srv.listen(0, () => {
|
|
49403
49588
|
const addr = srv.address();
|
|
49404
49589
|
const port = addr && typeof addr !== "string" ? addr.port : 0;
|
|
49405
|
-
srv.close((err) => err ? reject(err) :
|
|
49590
|
+
srv.close((err) => err ? reject(err) : resolve15(port));
|
|
49406
49591
|
});
|
|
49407
49592
|
srv.on("error", reject);
|
|
49408
49593
|
});
|
|
@@ -49447,10 +49632,10 @@ var DirectTransport = class {
|
|
|
49447
49632
|
};
|
|
49448
49633
|
|
|
49449
49634
|
// ../../packages/transport/src/devtunnel.ts
|
|
49450
|
-
var
|
|
49635
|
+
var import_node_child_process11 = require("child_process");
|
|
49451
49636
|
function isInstalled(cmd) {
|
|
49452
49637
|
try {
|
|
49453
|
-
(0,
|
|
49638
|
+
(0, import_node_child_process11.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
|
|
49454
49639
|
return true;
|
|
49455
49640
|
} catch {
|
|
49456
49641
|
return false;
|
|
@@ -49473,18 +49658,18 @@ var DevTunnelTransport = class {
|
|
|
49473
49658
|
);
|
|
49474
49659
|
}
|
|
49475
49660
|
try {
|
|
49476
|
-
(0,
|
|
49661
|
+
(0, import_node_child_process11.execSync)("devtunnel user show", { stdio: "pipe" });
|
|
49477
49662
|
} catch {
|
|
49478
49663
|
throw new Error(
|
|
49479
49664
|
"Not logged in to devtunnel. Run: devtunnel user login"
|
|
49480
49665
|
);
|
|
49481
49666
|
}
|
|
49482
49667
|
const hostArgs = this.buildHostArgs(localPort);
|
|
49483
|
-
const child = (0,
|
|
49668
|
+
const child = (0, import_node_child_process11.spawn)("devtunnel", hostArgs, {
|
|
49484
49669
|
stdio: ["pipe", "pipe", "pipe"]
|
|
49485
49670
|
});
|
|
49486
49671
|
this.process = child;
|
|
49487
|
-
this.publicUrl = await new Promise((
|
|
49672
|
+
this.publicUrl = await new Promise((resolve15, reject) => {
|
|
49488
49673
|
const timeout = setTimeout(() => {
|
|
49489
49674
|
child.kill();
|
|
49490
49675
|
this.process = null;
|
|
@@ -49507,7 +49692,7 @@ var DevTunnelTransport = class {
|
|
|
49507
49692
|
clearTimeout(timeout);
|
|
49508
49693
|
child.stdout?.removeListener("data", onData);
|
|
49509
49694
|
child.stderr?.removeListener("data", onErrData);
|
|
49510
|
-
|
|
49695
|
+
resolve15(url.replace(/\/+$/, ""));
|
|
49511
49696
|
};
|
|
49512
49697
|
child.stdout?.on("data", onData);
|
|
49513
49698
|
child.stderr?.on("data", onErrData);
|
|
@@ -49539,14 +49724,14 @@ ${lines.join("")}`
|
|
|
49539
49724
|
this.publicUrl = null;
|
|
49540
49725
|
if (child.exitCode === null) {
|
|
49541
49726
|
child.kill("SIGTERM");
|
|
49542
|
-
await new Promise((
|
|
49727
|
+
await new Promise((resolve15) => {
|
|
49543
49728
|
const killTimer = setTimeout(() => {
|
|
49544
49729
|
child.kill("SIGKILL");
|
|
49545
|
-
|
|
49730
|
+
resolve15();
|
|
49546
49731
|
}, 5e3);
|
|
49547
49732
|
child.on("close", () => {
|
|
49548
49733
|
clearTimeout(killTimer);
|
|
49549
|
-
|
|
49734
|
+
resolve15();
|
|
49550
49735
|
});
|
|
49551
49736
|
});
|
|
49552
49737
|
}
|
|
@@ -49585,7 +49770,7 @@ ${lines.join("")}`
|
|
|
49585
49770
|
return;
|
|
49586
49771
|
}
|
|
49587
49772
|
try {
|
|
49588
|
-
(0,
|
|
49773
|
+
(0, import_node_child_process11.execFileSync)("devtunnel", ["access", "create", tunnelId, "--tenant"], { stdio: "pipe" });
|
|
49589
49774
|
} catch (err) {
|
|
49590
49775
|
if (isExistingTenantAccessError(err)) {
|
|
49591
49776
|
return;
|
|
@@ -49601,7 +49786,7 @@ ${lines.join("")}`
|
|
|
49601
49786
|
return void 0;
|
|
49602
49787
|
}
|
|
49603
49788
|
try {
|
|
49604
|
-
(0,
|
|
49789
|
+
(0, import_node_child_process11.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
|
|
49605
49790
|
return tunnelId;
|
|
49606
49791
|
} catch {
|
|
49607
49792
|
const createArgs = ["create", tunnelId];
|
|
@@ -49609,7 +49794,7 @@ ${lines.join("")}`
|
|
|
49609
49794
|
createArgs.push("-a");
|
|
49610
49795
|
}
|
|
49611
49796
|
try {
|
|
49612
|
-
(0,
|
|
49797
|
+
(0, import_node_child_process11.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
|
|
49613
49798
|
return tunnelId;
|
|
49614
49799
|
} catch (err) {
|
|
49615
49800
|
throw new Error(
|
|
@@ -49621,13 +49806,13 @@ ${lines.join("")}`
|
|
|
49621
49806
|
ensureTunnelPort(tunnelId, localPort) {
|
|
49622
49807
|
const ports = this.listTunnelPorts(tunnelId);
|
|
49623
49808
|
for (const stalePort of ports.filter((p) => p !== localPort)) {
|
|
49624
|
-
(0,
|
|
49809
|
+
(0, import_node_child_process11.execFileSync)("devtunnel", ["port", "delete", tunnelId, "-p", String(stalePort)], { stdio: "pipe" });
|
|
49625
49810
|
}
|
|
49626
49811
|
if (ports.includes(localPort)) {
|
|
49627
49812
|
return;
|
|
49628
49813
|
}
|
|
49629
49814
|
try {
|
|
49630
|
-
(0,
|
|
49815
|
+
(0, import_node_child_process11.execFileSync)(
|
|
49631
49816
|
"devtunnel",
|
|
49632
49817
|
["port", "create", tunnelId, "-p", String(localPort), "--protocol", "http"],
|
|
49633
49818
|
{ stdio: "pipe" }
|
|
@@ -49643,7 +49828,7 @@ ${lines.join("")}`
|
|
|
49643
49828
|
}
|
|
49644
49829
|
listTunnelPorts(tunnelId) {
|
|
49645
49830
|
try {
|
|
49646
|
-
const output = (0,
|
|
49831
|
+
const output = (0, import_node_child_process11.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
|
|
49647
49832
|
const parsed = JSON.parse(output.toString());
|
|
49648
49833
|
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 : [];
|
|
49649
49834
|
return items.map((item) => getPortNumber(item)).filter((value) => value !== void 0);
|
|
@@ -49655,7 +49840,7 @@ ${lines.join("")}`
|
|
|
49655
49840
|
}
|
|
49656
49841
|
hasTunnelPort(tunnelId, localPort) {
|
|
49657
49842
|
try {
|
|
49658
|
-
(0,
|
|
49843
|
+
(0, import_node_child_process11.execFileSync)(
|
|
49659
49844
|
"devtunnel",
|
|
49660
49845
|
["port", "show", tunnelId, "-p", String(localPort), "-j"],
|
|
49661
49846
|
{ stdio: "pipe" }
|
|
@@ -49759,10 +49944,10 @@ var terminalWriter = {
|
|
|
49759
49944
|
};
|
|
49760
49945
|
|
|
49761
49946
|
// src/startup.ts
|
|
49762
|
-
var
|
|
49763
|
-
var
|
|
49947
|
+
var fs21 = __toESM(require("fs"), 1);
|
|
49948
|
+
var path22 = __toESM(require("path"), 1);
|
|
49764
49949
|
var readline = __toESM(require("readline/promises"), 1);
|
|
49765
|
-
var
|
|
49950
|
+
var import_node_child_process12 = require("child_process");
|
|
49766
49951
|
function getDefaultNodeName() {
|
|
49767
49952
|
return getDeviceNodeName();
|
|
49768
49953
|
}
|
|
@@ -49808,7 +49993,7 @@ function createPromptSession(prompt) {
|
|
|
49808
49993
|
}
|
|
49809
49994
|
function createDefaultCommandRunner(platform2) {
|
|
49810
49995
|
return (command, args, interactive = false) => {
|
|
49811
|
-
const result = (0,
|
|
49996
|
+
const result = (0, import_node_child_process12.spawnSync)(command, args, {
|
|
49812
49997
|
encoding: "utf-8",
|
|
49813
49998
|
shell: platform2 === "win32",
|
|
49814
49999
|
stdio: interactive ? "inherit" : "pipe"
|
|
@@ -49823,19 +50008,19 @@ function createDefaultCommandRunner(platform2) {
|
|
|
49823
50008
|
};
|
|
49824
50009
|
}
|
|
49825
50010
|
function getNodeMetadataPath2(storagePath) {
|
|
49826
|
-
return
|
|
50011
|
+
return path22.join(storagePath, "metadata.json");
|
|
49827
50012
|
}
|
|
49828
50013
|
function readStartupMetadataFile(storagePath) {
|
|
49829
50014
|
try {
|
|
49830
|
-
const raw = JSON.parse(
|
|
50015
|
+
const raw = JSON.parse(fs21.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
|
|
49831
50016
|
return typeof raw === "object" && raw !== null ? raw : {};
|
|
49832
50017
|
} catch {
|
|
49833
50018
|
return {};
|
|
49834
50019
|
}
|
|
49835
50020
|
}
|
|
49836
50021
|
function writeStartupMetadataFile(storagePath, metadata) {
|
|
49837
|
-
|
|
49838
|
-
|
|
50022
|
+
fs21.mkdirSync(storagePath, { recursive: true });
|
|
50023
|
+
fs21.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
|
|
49839
50024
|
}
|
|
49840
50025
|
function formatLocalDate2(now) {
|
|
49841
50026
|
const year = now.getFullYear();
|
|
@@ -49917,7 +50102,7 @@ function isRequirementSatisfied(requirement, status) {
|
|
|
49917
50102
|
return true;
|
|
49918
50103
|
}
|
|
49919
50104
|
function sleep(ms) {
|
|
49920
|
-
return new Promise((
|
|
50105
|
+
return new Promise((resolve15) => setTimeout(resolve15, ms));
|
|
49921
50106
|
}
|
|
49922
50107
|
function areCachedAuthRequirementsCurrent(commandRunner) {
|
|
49923
50108
|
return isAuthenticated("az", commandRunner) && isAuthenticated("devtunnel", commandRunner);
|
|
@@ -50074,9 +50259,9 @@ async function ensureStartupRequirements(storagePath, options = {}) {
|
|
|
50074
50259
|
metadata
|
|
50075
50260
|
};
|
|
50076
50261
|
}
|
|
50077
|
-
function loadConfigFile(
|
|
50262
|
+
function loadConfigFile(path24) {
|
|
50078
50263
|
try {
|
|
50079
|
-
const raw =
|
|
50264
|
+
const raw = fs21.readFileSync(path24, "utf-8");
|
|
50080
50265
|
return JSON.parse(raw);
|
|
50081
50266
|
} catch {
|
|
50082
50267
|
return {};
|
|
@@ -50254,26 +50439,26 @@ function formatLoadedStartMetadata(info, authEnabled) {
|
|
|
50254
50439
|
}
|
|
50255
50440
|
|
|
50256
50441
|
// src/runtime-metadata.ts
|
|
50257
|
-
var
|
|
50258
|
-
var
|
|
50259
|
-
var
|
|
50442
|
+
var fs22 = __toESM(require("fs"), 1);
|
|
50443
|
+
var path23 = __toESM(require("path"), 1);
|
|
50444
|
+
var import_node_child_process13 = require("child_process");
|
|
50260
50445
|
var runtimeDir = resolveRuntimeDir();
|
|
50261
50446
|
var appRoot = resolveAppRoot(runtimeDir);
|
|
50262
|
-
var repoRoot =
|
|
50447
|
+
var repoRoot = path23.resolve(appRoot, "../..");
|
|
50263
50448
|
function resolveRuntimeDir() {
|
|
50264
50449
|
const entryPath = process.argv[1];
|
|
50265
50450
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
50266
50451
|
try {
|
|
50267
|
-
return
|
|
50452
|
+
return path23.dirname(fs22.realpathSync(path23.resolve(entryPath)));
|
|
50268
50453
|
} catch {
|
|
50269
|
-
return
|
|
50454
|
+
return path23.dirname(path23.resolve(entryPath));
|
|
50270
50455
|
}
|
|
50271
50456
|
}
|
|
50272
50457
|
return process.cwd();
|
|
50273
50458
|
}
|
|
50274
50459
|
function readJsonFile(filePath) {
|
|
50275
50460
|
try {
|
|
50276
|
-
return JSON.parse(
|
|
50461
|
+
return JSON.parse(fs22.readFileSync(filePath, "utf-8"));
|
|
50277
50462
|
} catch {
|
|
50278
50463
|
return null;
|
|
50279
50464
|
}
|
|
@@ -50283,9 +50468,9 @@ function readPackageManifest(filePath) {
|
|
|
50283
50468
|
}
|
|
50284
50469
|
function readEmbeddedRuntimeMetadata() {
|
|
50285
50470
|
const candidates = [
|
|
50286
|
-
|
|
50287
|
-
|
|
50288
|
-
|
|
50471
|
+
path23.join(appRoot, "runtime-metadata.json"),
|
|
50472
|
+
path23.join(runtimeDir, "runtime-metadata.json"),
|
|
50473
|
+
path23.resolve(process.cwd(), "apps/node/dist/runtime-metadata.json")
|
|
50289
50474
|
];
|
|
50290
50475
|
for (const candidate of candidates) {
|
|
50291
50476
|
const metadata = readJsonFile(candidate);
|
|
@@ -50298,23 +50483,23 @@ function readEmbeddedRuntimeMetadata() {
|
|
|
50298
50483
|
function resolveAppRoot(baseDir) {
|
|
50299
50484
|
const candidates = [
|
|
50300
50485
|
baseDir,
|
|
50301
|
-
|
|
50302
|
-
|
|
50303
|
-
|
|
50486
|
+
path23.resolve(baseDir, ".."),
|
|
50487
|
+
path23.resolve(process.cwd(), "apps/node/dist"),
|
|
50488
|
+
path23.resolve(process.cwd(), "apps/node"),
|
|
50304
50489
|
process.cwd()
|
|
50305
50490
|
];
|
|
50306
50491
|
for (const candidate of candidates) {
|
|
50307
|
-
const manifest = readPackageManifest(
|
|
50492
|
+
const manifest = readPackageManifest(path23.join(candidate, "package.json"));
|
|
50308
50493
|
if (manifest?.name === "@meshy/node" || manifest?.name === "meshy-node") {
|
|
50309
50494
|
return candidate;
|
|
50310
50495
|
}
|
|
50311
50496
|
}
|
|
50312
50497
|
for (const candidate of candidates) {
|
|
50313
|
-
if (
|
|
50498
|
+
if (fs22.existsSync(path23.join(candidate, "package.json"))) {
|
|
50314
50499
|
return candidate;
|
|
50315
50500
|
}
|
|
50316
50501
|
}
|
|
50317
|
-
return
|
|
50502
|
+
return path23.resolve(baseDir, "..");
|
|
50318
50503
|
}
|
|
50319
50504
|
function toPackageInfo(filePath) {
|
|
50320
50505
|
const manifest = readPackageManifest(filePath);
|
|
@@ -50352,7 +50537,7 @@ function readRepositoryUrlFromManifest(manifest) {
|
|
|
50352
50537
|
}
|
|
50353
50538
|
function readGitValue(args) {
|
|
50354
50539
|
try {
|
|
50355
|
-
const output = (0,
|
|
50540
|
+
const output = (0, import_node_child_process13.execFileSync)("git", args, {
|
|
50356
50541
|
cwd: repoRoot,
|
|
50357
50542
|
encoding: "utf-8",
|
|
50358
50543
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -50374,8 +50559,8 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
50374
50559
|
components: startupRequirements.components
|
|
50375
50560
|
};
|
|
50376
50561
|
}
|
|
50377
|
-
const appPackage = toPackageInfo(
|
|
50378
|
-
const workspaceManifest = readPackageManifest(
|
|
50562
|
+
const appPackage = toPackageInfo(path23.join(appRoot, "package.json"));
|
|
50563
|
+
const workspaceManifest = readPackageManifest(path23.join(repoRoot, "package.json"));
|
|
50379
50564
|
return {
|
|
50380
50565
|
packageName: appPackage?.name ?? "meshy",
|
|
50381
50566
|
packageVersion: appPackage?.version ?? "0.1.0",
|
|
@@ -50383,11 +50568,11 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
50383
50568
|
startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
|
|
50384
50569
|
components: startupRequirements.components,
|
|
50385
50570
|
packages: {
|
|
50386
|
-
workspace: toPackageInfo(
|
|
50571
|
+
workspace: toPackageInfo(path23.join(repoRoot, "package.json")),
|
|
50387
50572
|
node: appPackage,
|
|
50388
|
-
core: toPackageInfo(
|
|
50389
|
-
dashboard: toPackageInfo(
|
|
50390
|
-
api: toPackageInfo(
|
|
50573
|
+
core: toPackageInfo(path23.join(repoRoot, "packages/core/package.json")),
|
|
50574
|
+
dashboard: toPackageInfo(path23.join(repoRoot, "packages/dashboard/package.json")),
|
|
50575
|
+
api: toPackageInfo(path23.join(repoRoot, "packages/api/package.json"))
|
|
50391
50576
|
},
|
|
50392
50577
|
repository: {
|
|
50393
50578
|
url: normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.upstream.url"])) ?? normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.origin.url"])) ?? readRepositoryUrlFromManifest(workspaceManifest),
|