meshy-node 0.2.2 → 0.2.3
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-CcD2IDII.js +183 -0
- package/dashboard/assets/{DiffTab-Cp1x6gu_.js → DiffTab-BNtQFb4c.js} +1 -1
- package/dashboard/assets/{FilesTab-BTvBjcVj.js → FilesTab-DT4JyvzA.js} +1 -1
- package/dashboard/assets/{PreviewTab-K1eOyj6G.js → PreviewTab-DhvYgvSm.js} +1 -1
- package/dashboard/assets/{file-f8EEICoF.js → file-B9Sgu9EP.js} +1 -1
- package/dashboard/assets/{index-kMP08Pcy.js → index-Br6dysEj.js} +2 -2
- package/dashboard/index.html +1 -1
- package/main.cjs +629 -355
- package/package.json +1 -1
- package/runtime-metadata.json +5 -5
- package/dashboard/assets/DashboardPage-B4dS4kx6.js +0 -182
package/main.cjs
CHANGED
|
@@ -4029,8 +4029,8 @@ var require_common = __commonJS({
|
|
|
4029
4029
|
}
|
|
4030
4030
|
return debug;
|
|
4031
4031
|
}
|
|
4032
|
-
function extend2(namespace,
|
|
4033
|
-
const newDebug = createDebug(this.namespace + (typeof
|
|
4032
|
+
function extend2(namespace, delimiter2) {
|
|
4033
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter2 === "undefined" ? ":" : delimiter2) + namespace);
|
|
4034
4034
|
newDebug.log = this.log;
|
|
4035
4035
|
return newDebug;
|
|
4036
4036
|
}
|
|
@@ -6629,8 +6629,8 @@ var require_node2 = __commonJS({
|
|
|
6629
6629
|
}
|
|
6630
6630
|
break;
|
|
6631
6631
|
case "FILE":
|
|
6632
|
-
var
|
|
6633
|
-
stream2 = new
|
|
6632
|
+
var fs18 = require("fs");
|
|
6633
|
+
stream2 = new fs18.SyncWriteStream(fd2, { autoClose: false });
|
|
6634
6634
|
stream2._type = "fs";
|
|
6635
6635
|
break;
|
|
6636
6636
|
case "PIPE":
|
|
@@ -19420,11 +19420,11 @@ var require_mime_types = __commonJS({
|
|
|
19420
19420
|
}
|
|
19421
19421
|
return exts[0];
|
|
19422
19422
|
}
|
|
19423
|
-
function lookup(
|
|
19424
|
-
if (!
|
|
19423
|
+
function lookup(path19) {
|
|
19424
|
+
if (!path19 || typeof path19 !== "string") {
|
|
19425
19425
|
return false;
|
|
19426
19426
|
}
|
|
19427
|
-
var extension2 = extname3("x." +
|
|
19427
|
+
var extension2 = extname3("x." + path19).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(path19, 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 (path19 instanceof RegExp) {
|
|
22960
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path19.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 path19;
|
|
22969
22969
|
}
|
|
22970
|
-
if (Array.isArray(
|
|
22971
|
-
|
|
22970
|
+
if (Array.isArray(path19)) {
|
|
22971
|
+
path19 = path19.map(function(value) {
|
|
22972
22972
|
return pathToRegexp(value, keys, options).source;
|
|
22973
22973
|
});
|
|
22974
|
-
return new RegExp(
|
|
22974
|
+
return new RegExp(path19.join("|"), flags);
|
|
22975
22975
|
}
|
|
22976
|
-
if (typeof
|
|
22976
|
+
if (typeof path19 !== "string") {
|
|
22977
22977
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
22978
22978
|
}
|
|
22979
|
-
|
|
22979
|
+
path19 = path19.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 += path19.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(path19)) {
|
|
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
|
+
path19 += strict ? "" : path19[path19.length - 1] === "/" ? "?" : "/?";
|
|
23039
23039
|
if (end) {
|
|
23040
|
-
|
|
23041
|
-
} else if (
|
|
23042
|
-
|
|
23040
|
+
path19 += "$";
|
|
23041
|
+
} else if (path19[path19.length - 1] !== "/") {
|
|
23042
|
+
path19 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
23043
23043
|
}
|
|
23044
|
-
return new RegExp("^" +
|
|
23044
|
+
return new RegExp("^" + path19, 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(path19, options, fn) {
|
|
23058
23058
|
if (!(this instanceof Layer)) {
|
|
23059
|
-
return new Layer(
|
|
23059
|
+
return new Layer(path19, options, fn);
|
|
23060
23060
|
}
|
|
23061
|
-
debug("new %o",
|
|
23061
|
+
debug("new %o", path19);
|
|
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(path19, this.keys = [], opts);
|
|
23068
|
+
this.regexp.fast_star = path19 === "*";
|
|
23069
|
+
this.regexp.fast_slash = path19 === "/" && 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(path19) {
|
|
23094
23094
|
var match2;
|
|
23095
|
-
if (
|
|
23095
|
+
if (path19 != 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(path19) };
|
|
23103
|
+
this.path = path19;
|
|
23104
23104
|
return true;
|
|
23105
23105
|
}
|
|
23106
|
-
match2 = this.regexp.exec(
|
|
23106
|
+
match2 = this.regexp.exec(path19);
|
|
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(path19) {
|
|
23200
|
+
this.path = path19;
|
|
23201
23201
|
this.stack = [];
|
|
23202
|
-
debug("new %o",
|
|
23202
|
+
debug("new %o", path19);
|
|
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 path19 = getPathname(req);
|
|
23416
|
+
if (path19 == 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, path19);
|
|
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, path19);
|
|
23463
23463
|
}
|
|
23464
23464
|
sync = 0;
|
|
23465
23465
|
});
|
|
23466
23466
|
}
|
|
23467
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
23467
|
+
function trim_prefix(layer, layerError, layerPath, path19) {
|
|
23468
23468
|
if (layerPath.length !== 0) {
|
|
23469
|
-
if (layerPath !==
|
|
23469
|
+
if (layerPath !== path19.slice(0, layerPath.length)) {
|
|
23470
23470
|
next(layerError);
|
|
23471
23471
|
return;
|
|
23472
23472
|
}
|
|
23473
|
-
var c =
|
|
23473
|
+
var c = path19[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 path19 = "/";
|
|
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
|
+
path19 = 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", path19, fn.name || "<anonymous>");
|
|
23572
|
+
var layer = new Layer(path19, {
|
|
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(path19) {
|
|
23583
|
+
var route2 = new Route(path19);
|
|
23584
|
+
var layer = new Layer(path19, {
|
|
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(path19) {
|
|
23595
|
+
var route = this.route(path19);
|
|
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, path19) {
|
|
23632
23632
|
try {
|
|
23633
|
-
return layer.match(
|
|
23633
|
+
return layer.match(path19);
|
|
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 dirname5 =
|
|
23754
|
-
var basename3 =
|
|
23755
|
-
var extname3 =
|
|
23756
|
-
var join14 =
|
|
23757
|
-
var resolve13 =
|
|
23751
|
+
var path19 = require("path");
|
|
23752
|
+
var fs18 = require("fs");
|
|
23753
|
+
var dirname5 = path19.dirname;
|
|
23754
|
+
var basename3 = path19.basename;
|
|
23755
|
+
var extname3 = path19.extname;
|
|
23756
|
+
var join14 = path19.join;
|
|
23757
|
+
var resolve13 = path19.resolve;
|
|
23758
23758
|
module2.exports = View;
|
|
23759
23759
|
function View(name2, options) {
|
|
23760
23760
|
var opts = options || {};
|
|
@@ -23783,17 +23783,17 @@ var require_view = __commonJS({
|
|
|
23783
23783
|
this.path = this.lookup(fileName);
|
|
23784
23784
|
}
|
|
23785
23785
|
View.prototype.lookup = function lookup(name2) {
|
|
23786
|
-
var
|
|
23786
|
+
var path20;
|
|
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 && !path20; i++) {
|
|
23790
23790
|
var root = roots[i];
|
|
23791
23791
|
var loc = resolve13(root, name2);
|
|
23792
23792
|
var dir = dirname5(loc);
|
|
23793
23793
|
var file = basename3(loc);
|
|
23794
|
-
|
|
23794
|
+
path20 = this.resolve(dir, file);
|
|
23795
23795
|
}
|
|
23796
|
-
return
|
|
23796
|
+
return path20;
|
|
23797
23797
|
};
|
|
23798
23798
|
View.prototype.render = function render(options, callback) {
|
|
23799
23799
|
debug('render "%s"', this.path);
|
|
@@ -23801,21 +23801,21 @@ var require_view = __commonJS({
|
|
|
23801
23801
|
};
|
|
23802
23802
|
View.prototype.resolve = function resolve14(dir, file) {
|
|
23803
23803
|
var ext = this.ext;
|
|
23804
|
-
var
|
|
23805
|
-
var stat = tryStat(
|
|
23804
|
+
var path20 = join14(dir, file);
|
|
23805
|
+
var stat = tryStat(path20);
|
|
23806
23806
|
if (stat && stat.isFile()) {
|
|
23807
|
-
return
|
|
23807
|
+
return path20;
|
|
23808
23808
|
}
|
|
23809
|
-
|
|
23810
|
-
stat = tryStat(
|
|
23809
|
+
path20 = join14(dir, basename3(file, ext), "index" + ext);
|
|
23810
|
+
stat = tryStat(path20);
|
|
23811
23811
|
if (stat && stat.isFile()) {
|
|
23812
|
-
return
|
|
23812
|
+
return path20;
|
|
23813
23813
|
}
|
|
23814
23814
|
};
|
|
23815
|
-
function tryStat(
|
|
23816
|
-
debug('stat "%s"',
|
|
23815
|
+
function tryStat(path20) {
|
|
23816
|
+
debug('stat "%s"', path20);
|
|
23817
23817
|
try {
|
|
23818
|
-
return
|
|
23818
|
+
return fs18.statSync(path20);
|
|
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 path19 = require("path");
|
|
24116
|
+
var fs18 = 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 = fs18.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(path20, fallback) {
|
|
24146
|
+
var ext = path20.replace(/^.*[\.\/\\]/, "").toLowerCase();
|
|
24147
24147
|
return this.types[ext] || fallback || this.default_type;
|
|
24148
24148
|
};
|
|
24149
24149
|
Mime.prototype.extension = function(mimeType) {
|
|
@@ -24256,33 +24256,33 @@ var require_send = __commonJS({
|
|
|
24256
24256
|
var escapeHtml = require_escape_html();
|
|
24257
24257
|
var etag = require_etag();
|
|
24258
24258
|
var fresh = require_fresh();
|
|
24259
|
-
var
|
|
24259
|
+
var fs18 = 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 path19 = 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 join14 =
|
|
24270
|
-
var normalize =
|
|
24271
|
-
var resolve13 =
|
|
24272
|
-
var sep3 =
|
|
24268
|
+
var extname3 = path19.extname;
|
|
24269
|
+
var join14 = path19.join;
|
|
24270
|
+
var normalize = path19.normalize;
|
|
24271
|
+
var resolve13 = path19.resolve;
|
|
24272
|
+
var sep3 = path19.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, path20, options) {
|
|
24279
|
+
return new SendStream(req, path20, options);
|
|
24280
24280
|
}
|
|
24281
|
-
function SendStream(req,
|
|
24281
|
+
function SendStream(req, path20, options) {
|
|
24282
24282
|
Stream.call(this);
|
|
24283
24283
|
var opts = options || {};
|
|
24284
24284
|
this.options = opts;
|
|
24285
|
-
this.path =
|
|
24285
|
+
this.path = path20;
|
|
24286
24286
|
this.req = req;
|
|
24287
24287
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
24288
24288
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -24328,8 +24328,8 @@ var require_send = __commonJS({
|
|
|
24328
24328
|
this._index = index2;
|
|
24329
24329
|
return this;
|
|
24330
24330
|
}, "send.index: pass index as option");
|
|
24331
|
-
SendStream.prototype.root = function root(
|
|
24332
|
-
this._root = resolve13(String(
|
|
24331
|
+
SendStream.prototype.root = function root(path20) {
|
|
24332
|
+
this._root = resolve13(String(path20));
|
|
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(path20) {
|
|
24446
24446
|
var res = this.res;
|
|
24447
24447
|
if (hasListeners(this, "directory")) {
|
|
24448
|
-
this.emit("directory", res,
|
|
24448
|
+
this.emit("directory", res, path20);
|
|
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 path20 = decode(this.path);
|
|
24469
|
+
if (path20 === -1) {
|
|
24470
24470
|
this.error(400);
|
|
24471
24471
|
return res;
|
|
24472
24472
|
}
|
|
24473
|
-
if (~
|
|
24473
|
+
if (~path20.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 (path20) {
|
|
24480
|
+
path20 = normalize("." + sep3 + path20);
|
|
24481
24481
|
}
|
|
24482
|
-
if (UP_PATH_REGEXP.test(
|
|
24483
|
-
debug('malicious path "%s"',
|
|
24482
|
+
if (UP_PATH_REGEXP.test(path20)) {
|
|
24483
|
+
debug('malicious path "%s"', path20);
|
|
24484
24484
|
this.error(403);
|
|
24485
24485
|
return res;
|
|
24486
24486
|
}
|
|
24487
|
-
parts =
|
|
24488
|
-
|
|
24487
|
+
parts = path20.split(sep3);
|
|
24488
|
+
path20 = normalize(join14(root, path20));
|
|
24489
24489
|
} else {
|
|
24490
|
-
if (UP_PATH_REGEXP.test(
|
|
24491
|
-
debug('malicious path "%s"',
|
|
24490
|
+
if (UP_PATH_REGEXP.test(path20)) {
|
|
24491
|
+
debug('malicious path "%s"', path20);
|
|
24492
24492
|
this.error(403);
|
|
24493
24493
|
return res;
|
|
24494
24494
|
}
|
|
24495
|
-
parts = normalize(
|
|
24496
|
-
|
|
24495
|
+
parts = normalize(path20).split(sep3);
|
|
24496
|
+
path20 = resolve13(path20);
|
|
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, path20);
|
|
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(path20);
|
|
24518
24518
|
return res;
|
|
24519
24519
|
}
|
|
24520
|
-
this.sendFile(
|
|
24520
|
+
this.sendFile(path20);
|
|
24521
24521
|
return res;
|
|
24522
24522
|
};
|
|
24523
|
-
SendStream.prototype.send = function send2(
|
|
24523
|
+
SendStream.prototype.send = function send2(path20, 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"', path20);
|
|
24536
|
+
this.setHeader(path20, stat);
|
|
24537
|
+
this.type(path20);
|
|
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(path20, opts);
|
|
24587
24587
|
};
|
|
24588
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
24588
|
+
SendStream.prototype.sendFile = function sendFile(path20) {
|
|
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"', path20);
|
|
24592
|
+
fs18.stat(path20, function onstat(err, stat) {
|
|
24593
|
+
if (err && err.code === "ENOENT" && !extname3(path20) && path20[path20.length - 1] !== sep3) {
|
|
24594
24594
|
return next(err);
|
|
24595
24595
|
}
|
|
24596
24596
|
if (err) return self2.onStatError(err);
|
|
24597
|
-
if (stat.isDirectory()) return self2.redirect(
|
|
24598
|
-
self2.emit("file",
|
|
24599
|
-
self2.send(
|
|
24597
|
+
if (stat.isDirectory()) return self2.redirect(path20);
|
|
24598
|
+
self2.emit("file", path20, stat);
|
|
24599
|
+
self2.send(path20, 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 = path20 + "." + self2._extensions[i++];
|
|
24606
24606
|
debug('stat "%s"', p);
|
|
24607
|
-
|
|
24607
|
+
fs18.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(path20) {
|
|
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 = join14(
|
|
24623
|
+
var p = join14(path20, self2._index[i]);
|
|
24624
24624
|
debug('stat "%s"', p);
|
|
24625
|
-
|
|
24625
|
+
fs18.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(path20, options) {
|
|
24635
24635
|
var self2 = this;
|
|
24636
24636
|
var res = this.res;
|
|
24637
|
-
var stream2 =
|
|
24637
|
+
var stream2 = fs18.createReadStream(path20, 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(path20) {
|
|
24653
24653
|
var res = this.res;
|
|
24654
24654
|
if (res.getHeader("Content-Type")) return;
|
|
24655
|
-
var type2 = mime.lookup(
|
|
24655
|
+
var type2 = mime.lookup(path20);
|
|
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(path20, stat) {
|
|
24665
24665
|
var res = this.res;
|
|
24666
|
-
this.emit("headers", res,
|
|
24666
|
+
this.emit("headers", res, path20, 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(path20) {
|
|
24726
24726
|
try {
|
|
24727
|
-
return decodeURIComponent(
|
|
24727
|
+
return decodeURIComponent(path20);
|
|
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(path19) {
|
|
25638
|
+
if ("/" === path19[0]) return true;
|
|
25639
|
+
if (":" === path19[1] && ("\\" === path19[2] || "/" === path19[2])) return true;
|
|
25640
|
+
if ("\\\\" === path19.substring(0, 2)) return true;
|
|
25641
25641
|
};
|
|
25642
25642
|
exports2.flatten = deprecate.function(
|
|
25643
25643
|
flatten,
|
|
@@ -25848,7 +25848,7 @@ var require_application = __commonJS({
|
|
|
25848
25848
|
};
|
|
25849
25849
|
app.use = function use(fn) {
|
|
25850
25850
|
var offset = 0;
|
|
25851
|
-
var
|
|
25851
|
+
var path19 = "/";
|
|
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
|
+
path19 = 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(path19, fn2);
|
|
25871
25871
|
}
|
|
25872
|
-
debug(".use app under %s",
|
|
25873
|
-
fn2.mountpath =
|
|
25872
|
+
debug(".use app under %s", path19);
|
|
25873
|
+
fn2.mountpath = path19;
|
|
25874
25874
|
fn2.parent = this;
|
|
25875
|
-
router.use(
|
|
25875
|
+
router.use(path19, 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(path19) {
|
|
25888
25888
|
this.lazyrouter();
|
|
25889
|
-
return this._router.route(
|
|
25889
|
+
return this._router.route(path19);
|
|
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 path19() {
|
|
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(path19) {
|
|
25957
25957
|
if (method === "get" && arguments.length === 1) {
|
|
25958
|
-
return this.set(
|
|
25958
|
+
return this.set(path19);
|
|
25959
25959
|
}
|
|
25960
25960
|
this.lazyrouter();
|
|
25961
|
-
var route = this._router.route(
|
|
25961
|
+
var route = this._router.route(path19);
|
|
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(path19) {
|
|
25967
25967
|
this.lazyrouter();
|
|
25968
|
-
var route = this._router.route(
|
|
25968
|
+
var route = this._router.route(path19);
|
|
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 path19() {
|
|
26728
26728
|
return parse(this).pathname;
|
|
26729
26729
|
});
|
|
26730
26730
|
defineGetter(req, "hostname", function hostname3() {
|
|
@@ -27047,7 +27047,7 @@ var require_response = __commonJS({
|
|
|
27047
27047
|
var http3 = require("http");
|
|
27048
27048
|
var isAbsolute4 = require_utils2().isAbsolute;
|
|
27049
27049
|
var onFinished = require_on_finished();
|
|
27050
|
-
var
|
|
27050
|
+
var path19 = 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 = path19.extname;
|
|
27060
27060
|
var mime = send.mime;
|
|
27061
|
-
var resolve13 =
|
|
27061
|
+
var resolve13 = path19.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(path20, 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 (!path20) {
|
|
27245
27245
|
throw new TypeError("path argument is required to res.sendFile");
|
|
27246
27246
|
}
|
|
27247
|
-
if (typeof
|
|
27247
|
+
if (typeof path20 !== "string") {
|
|
27248
27248
|
throw new TypeError("path must be a string to res.sendFile");
|
|
27249
27249
|
}
|
|
27250
27250
|
if (typeof options === "function") {
|
|
27251
27251
|
done = options;
|
|
27252
27252
|
opts = {};
|
|
27253
27253
|
}
|
|
27254
|
-
if (!opts.root && !isAbsolute4(
|
|
27254
|
+
if (!opts.root && !isAbsolute4(path20)) {
|
|
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(path20);
|
|
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(path20, 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, path20, 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(path20, 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 || path20)
|
|
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 ? resolve13(
|
|
27320
|
+
var fullPath = !opts.root ? resolve13(path20) : path20;
|
|
27321
27321
|
return this.sendFile(fullPath, opts, done);
|
|
27322
27322
|
};
|
|
27323
27323
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -27618,11 +27618,11 @@ var require_serve_static = __commonJS({
|
|
|
27618
27618
|
}
|
|
27619
27619
|
var forwardError = !fallthrough;
|
|
27620
27620
|
var originalUrl = parseUrl.original(req);
|
|
27621
|
-
var
|
|
27622
|
-
if (
|
|
27623
|
-
|
|
27621
|
+
var path19 = parseUrl(req).pathname;
|
|
27622
|
+
if (path19 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
27623
|
+
path19 = "";
|
|
27624
27624
|
}
|
|
27625
|
-
var stream = send(req,
|
|
27625
|
+
var stream = send(req, path19, opts);
|
|
27626
27626
|
stream.on("directory", onDirectory);
|
|
27627
27627
|
if (setHeaders) {
|
|
27628
27628
|
stream.on("headers", setHeaders);
|
|
@@ -32867,19 +32867,19 @@ async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_NODE_REQUEST_TIME
|
|
|
32867
32867
|
cleanup();
|
|
32868
32868
|
}
|
|
32869
32869
|
}
|
|
32870
|
-
async function fetchNodeWithFallback(node,
|
|
32870
|
+
async function fetchNodeWithFallback(node, path19, init, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS, trace, options) {
|
|
32871
32871
|
let lastError;
|
|
32872
32872
|
const endpoints = getNodeRequestEndpoints(node, options);
|
|
32873
32873
|
for (const [index, endpoint] of endpoints.entries()) {
|
|
32874
32874
|
const attempt = index + 1;
|
|
32875
|
-
trace?.onAttempt?.({ attempt, endpoint, path:
|
|
32875
|
+
trace?.onAttempt?.({ attempt, endpoint, path: path19, timeoutMs, totalEndpoints: endpoints.length });
|
|
32876
32876
|
try {
|
|
32877
|
-
const response = await fetchWithTimeout(`${endpoint}${
|
|
32878
|
-
trace?.onResponse?.({ attempt, endpoint, path:
|
|
32877
|
+
const response = await fetchWithTimeout(`${endpoint}${path19}`, init, timeoutMs);
|
|
32878
|
+
trace?.onResponse?.({ attempt, endpoint, path: path19, response, timeoutMs, totalEndpoints: endpoints.length });
|
|
32879
32879
|
return { endpoint, response };
|
|
32880
32880
|
} catch (error) {
|
|
32881
32881
|
lastError = error;
|
|
32882
|
-
trace?.onError?.({ attempt, endpoint, error, path:
|
|
32882
|
+
trace?.onError?.({ attempt, endpoint, error, path: path19, timeoutMs, totalEndpoints: endpoints.length });
|
|
32883
32883
|
}
|
|
32884
32884
|
}
|
|
32885
32885
|
throw lastError instanceof Error ? lastError : new Error("No reachable node endpoint");
|
|
@@ -33319,6 +33319,20 @@ var LeaderElection = class {
|
|
|
33319
33319
|
var import_node_crypto4 = require("crypto");
|
|
33320
33320
|
var fs4 = __toESM(require("fs"), 1);
|
|
33321
33321
|
var path4 = __toESM(require("path"), 1);
|
|
33322
|
+
function getPublicTaskUpdates(updates, updatedAt) {
|
|
33323
|
+
const publicUpdates = { updatedAt };
|
|
33324
|
+
if (updates.title !== void 0) publicUpdates.title = updates.title;
|
|
33325
|
+
if (updates.description !== void 0) publicUpdates.description = updates.description;
|
|
33326
|
+
if (updates.priority !== void 0) publicUpdates.priority = updates.priority;
|
|
33327
|
+
if (updates.status !== void 0) publicUpdates.status = updates.status;
|
|
33328
|
+
if (updates.assignedTo !== void 0) publicUpdates.assignedTo = updates.assignedTo;
|
|
33329
|
+
if (updates.assignedNodeName !== void 0) publicUpdates.assignedNodeName = updates.assignedNodeName;
|
|
33330
|
+
if (updates.result !== void 0) publicUpdates.result = updates.result;
|
|
33331
|
+
if (updates.error !== void 0) publicUpdates.error = updates.error;
|
|
33332
|
+
if (updates.effectiveProjectPath !== void 0) publicUpdates.effectiveProjectPath = updates.effectiveProjectPath;
|
|
33333
|
+
if (updates.branch !== void 0) publicUpdates.branch = updates.branch;
|
|
33334
|
+
return publicUpdates;
|
|
33335
|
+
}
|
|
33322
33336
|
var PRIORITY_ORDER = {
|
|
33323
33337
|
low: 0,
|
|
33324
33338
|
normal: 1,
|
|
@@ -33437,6 +33451,10 @@ var TaskEngine = class {
|
|
|
33437
33451
|
if (updates.error) eventData.error = updates.error;
|
|
33438
33452
|
this.eventBus.emit("task.status", eventData);
|
|
33439
33453
|
}
|
|
33454
|
+
const publicUpdates = getPublicTaskUpdates(updates, merged.updatedAt);
|
|
33455
|
+
if (Object.keys(publicUpdates).length > 1) {
|
|
33456
|
+
this.eventBus.emit("task.updated", { taskId: id, updates: publicUpdates });
|
|
33457
|
+
}
|
|
33440
33458
|
return merged;
|
|
33441
33459
|
}
|
|
33442
33460
|
deleteTask(id) {
|
|
@@ -34721,9 +34739,9 @@ var DataRouter = class {
|
|
|
34721
34739
|
/**
|
|
34722
34740
|
* Returns true if the request should be proxied to the leader.
|
|
34723
34741
|
*/
|
|
34724
|
-
shouldProxy(method,
|
|
34742
|
+
shouldProxy(method, path19) {
|
|
34725
34743
|
if (this.election.isLeader()) return false;
|
|
34726
|
-
if (this.isExcludedPath(
|
|
34744
|
+
if (this.isExcludedPath(path19)) return false;
|
|
34727
34745
|
if (method.toUpperCase() === "GET") return false;
|
|
34728
34746
|
return WRITE_METHODS.has(method.toUpperCase());
|
|
34729
34747
|
}
|
|
@@ -34824,8 +34842,8 @@ var DataRouter = class {
|
|
|
34824
34842
|
};
|
|
34825
34843
|
}
|
|
34826
34844
|
// ── Helpers ───────────────────────────────────────────────────────────
|
|
34827
|
-
isExcludedPath(
|
|
34828
|
-
return EXCLUDED_PATH_PREFIXES.some((prefix) =>
|
|
34845
|
+
isExcludedPath(path19) {
|
|
34846
|
+
return EXCLUDED_PATH_PREFIXES.some((prefix) => path19.startsWith(prefix)) || EXCLUDED_PATH_SUFFIXES.some((suffix) => path19.endsWith(suffix));
|
|
34829
34847
|
}
|
|
34830
34848
|
};
|
|
34831
34849
|
|
|
@@ -34953,6 +34971,7 @@ function getEventType(event) {
|
|
|
34953
34971
|
}
|
|
34954
34972
|
function buildLeaderTaskPatch(data) {
|
|
34955
34973
|
const body = { status: data.status };
|
|
34974
|
+
if (data.title !== void 0) body.title = data.title;
|
|
34956
34975
|
if (data.result !== void 0) body.result = data.result;
|
|
34957
34976
|
if (data.error !== void 0) body.error = data.error;
|
|
34958
34977
|
if (data.effectiveProjectPath !== void 0) body.effectiveProjectPath = data.effectiveProjectPath;
|
|
@@ -35088,11 +35107,12 @@ function registerLeaderForwarding(eventBus, nodeRegistry, log2, taskId, agent) {
|
|
|
35088
35107
|
return cleanup;
|
|
35089
35108
|
}
|
|
35090
35109
|
|
|
35091
|
-
// ../../packages/core/src/
|
|
35110
|
+
// ../../packages/core/src/lite-functions/index.ts
|
|
35111
|
+
var import_node_child_process2 = require("child_process");
|
|
35112
|
+
|
|
35113
|
+
// ../../packages/core/src/cli-invocations.ts
|
|
35092
35114
|
var fs7 = __toESM(require("fs"), 1);
|
|
35093
35115
|
var path7 = __toESM(require("path"), 1);
|
|
35094
|
-
var import_node_child_process2 = require("child_process");
|
|
35095
|
-
var DEFAULT_CLAUDE_MODEL = "sonnet";
|
|
35096
35116
|
function resolveClaudeInvocation() {
|
|
35097
35117
|
if (process.platform !== "win32") {
|
|
35098
35118
|
return { command: "claude", argsPrefix: [] };
|
|
@@ -35111,6 +35131,172 @@ function resolveClaudeInvocation() {
|
|
|
35111
35131
|
}
|
|
35112
35132
|
return { command: "claude", argsPrefix: [] };
|
|
35113
35133
|
}
|
|
35134
|
+
function resolveCodexInvocation() {
|
|
35135
|
+
if (process.platform !== "win32") {
|
|
35136
|
+
return { command: "codex", argsPrefix: [] };
|
|
35137
|
+
}
|
|
35138
|
+
const pathEntries = (process.env.PATH ?? "").split(path7.delimiter).filter(Boolean);
|
|
35139
|
+
for (const entry of pathEntries) {
|
|
35140
|
+
const shimPath = path7.join(entry, "codex.cmd");
|
|
35141
|
+
if (!fs7.existsSync(shimPath)) continue;
|
|
35142
|
+
const cliPath = path7.join(entry, "node_modules", "@openai", "codex", "bin", "codex.js");
|
|
35143
|
+
if (fs7.existsSync(cliPath)) {
|
|
35144
|
+
return {
|
|
35145
|
+
command: process.execPath,
|
|
35146
|
+
argsPrefix: [cliPath]
|
|
35147
|
+
};
|
|
35148
|
+
}
|
|
35149
|
+
}
|
|
35150
|
+
return { command: "codex", argsPrefix: [] };
|
|
35151
|
+
}
|
|
35152
|
+
|
|
35153
|
+
// ../../packages/core/src/lite-functions/index.ts
|
|
35154
|
+
var TITLE_MAX_LENGTH = 72;
|
|
35155
|
+
function sanitizeTitle(value) {
|
|
35156
|
+
const normalized = value.replace(/\s+/g, " ").trim().replace(/^['"]|['"]$/g, "");
|
|
35157
|
+
if (normalized.length <= TITLE_MAX_LENGTH) return normalized;
|
|
35158
|
+
return `${normalized.slice(0, TITLE_MAX_LENGTH - 3).trimEnd()}...`;
|
|
35159
|
+
}
|
|
35160
|
+
function parseJsonObject(raw) {
|
|
35161
|
+
const trimmed = raw.trim();
|
|
35162
|
+
const parsed = JSON.parse(trimmed);
|
|
35163
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
35164
|
+
throw new Error("Lite function output must be a JSON object");
|
|
35165
|
+
}
|
|
35166
|
+
return parsed;
|
|
35167
|
+
}
|
|
35168
|
+
function unwrapClaudeJsonOutput(raw) {
|
|
35169
|
+
try {
|
|
35170
|
+
const parsed = parseJsonObject(raw);
|
|
35171
|
+
if (typeof parsed.result === "string") return parsed.result;
|
|
35172
|
+
} catch {
|
|
35173
|
+
}
|
|
35174
|
+
return raw;
|
|
35175
|
+
}
|
|
35176
|
+
var generateTitleFunction = {
|
|
35177
|
+
name: "generateTitle",
|
|
35178
|
+
buildPrompt(input) {
|
|
35179
|
+
return [
|
|
35180
|
+
"Generate a short task title for the user request below.",
|
|
35181
|
+
'Return JSON only with this exact shape: {"title":"short task title"}.',
|
|
35182
|
+
"Rules: 3-8 words, max 72 characters, no trailing punctuation, no markdown.",
|
|
35183
|
+
input.existingTitle ? `Current fallback title: ${input.existingTitle}` : "",
|
|
35184
|
+
"User request:",
|
|
35185
|
+
input.prompt.trim()
|
|
35186
|
+
].filter(Boolean).join("\n");
|
|
35187
|
+
},
|
|
35188
|
+
parseOutput(raw) {
|
|
35189
|
+
const parsed = parseJsonObject(unwrapClaudeJsonOutput(raw));
|
|
35190
|
+
const title = typeof parsed.title === "string" ? sanitizeTitle(parsed.title) : "";
|
|
35191
|
+
if (!title) {
|
|
35192
|
+
throw new Error("Lite title output did not include a non-empty title");
|
|
35193
|
+
}
|
|
35194
|
+
return { title };
|
|
35195
|
+
}
|
|
35196
|
+
};
|
|
35197
|
+
var LiteAgentRunner = class {
|
|
35198
|
+
constructor(adapters) {
|
|
35199
|
+
this.adapters = adapters;
|
|
35200
|
+
}
|
|
35201
|
+
async run(fn, input, options) {
|
|
35202
|
+
const adapter = this.adapters[options.agent];
|
|
35203
|
+
if (!adapter) {
|
|
35204
|
+
throw new MeshyError("VALIDATION_ERROR", `No lite adapter registered for agent: ${options.agent}`, 400);
|
|
35205
|
+
}
|
|
35206
|
+
const raw = await adapter.runLite(fn.buildPrompt(input), options);
|
|
35207
|
+
return fn.parseOutput(raw);
|
|
35208
|
+
}
|
|
35209
|
+
};
|
|
35210
|
+
function runProcessForOutput(command, args, prompt, cwd, extractOutput) {
|
|
35211
|
+
return new Promise((resolve13, reject) => {
|
|
35212
|
+
const proc = (0, import_node_child_process2.spawn)(command, args, {
|
|
35213
|
+
cwd: cwd ?? process.cwd(),
|
|
35214
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
35215
|
+
});
|
|
35216
|
+
let stdout = "";
|
|
35217
|
+
let stderr = "";
|
|
35218
|
+
proc.stdout?.on("data", (chunk) => {
|
|
35219
|
+
stdout += chunk.toString();
|
|
35220
|
+
});
|
|
35221
|
+
proc.stderr?.on("data", (chunk) => {
|
|
35222
|
+
stderr += chunk.toString();
|
|
35223
|
+
});
|
|
35224
|
+
proc.on("error", reject);
|
|
35225
|
+
proc.on("close", (code) => {
|
|
35226
|
+
if (code !== 0) {
|
|
35227
|
+
reject(new Error(stderr.trim() || `Lite agent exited with code ${code}`));
|
|
35228
|
+
return;
|
|
35229
|
+
}
|
|
35230
|
+
try {
|
|
35231
|
+
resolve13(extractOutput ? extractOutput(stdout) : stdout.trim());
|
|
35232
|
+
} catch (error) {
|
|
35233
|
+
reject(error);
|
|
35234
|
+
}
|
|
35235
|
+
});
|
|
35236
|
+
proc.stdin?.write(prompt);
|
|
35237
|
+
proc.stdin?.end();
|
|
35238
|
+
});
|
|
35239
|
+
}
|
|
35240
|
+
function extractLastCodexAgentMessage(stdout) {
|
|
35241
|
+
let lastMessage = "";
|
|
35242
|
+
for (const line of stdout.split("\n")) {
|
|
35243
|
+
if (!line.trim()) continue;
|
|
35244
|
+
try {
|
|
35245
|
+
const event = JSON.parse(line);
|
|
35246
|
+
const item = event.item;
|
|
35247
|
+
if (event.type === "item.completed" && item?.type === "agent_message" && typeof item.text === "string") {
|
|
35248
|
+
lastMessage = item.text;
|
|
35249
|
+
}
|
|
35250
|
+
} catch {
|
|
35251
|
+
}
|
|
35252
|
+
}
|
|
35253
|
+
if (!lastMessage.trim()) {
|
|
35254
|
+
throw new Error("Codex lite call did not return an agent message");
|
|
35255
|
+
}
|
|
35256
|
+
return lastMessage.trim();
|
|
35257
|
+
}
|
|
35258
|
+
var ClaudeLiteAdapter = class {
|
|
35259
|
+
runLite(prompt, options) {
|
|
35260
|
+
const invocation = resolveClaudeInvocation();
|
|
35261
|
+
const args = [
|
|
35262
|
+
...invocation.argsPrefix,
|
|
35263
|
+
"--print",
|
|
35264
|
+
"--output-format",
|
|
35265
|
+
"json",
|
|
35266
|
+
"--no-session-persistence",
|
|
35267
|
+
"--model",
|
|
35268
|
+
options.model ?? "sonnet",
|
|
35269
|
+
"--permission-mode",
|
|
35270
|
+
"default",
|
|
35271
|
+
"--tools",
|
|
35272
|
+
""
|
|
35273
|
+
];
|
|
35274
|
+
return runProcessForOutput(invocation.command, args, prompt, options.cwd, (output) => unwrapClaudeJsonOutput(output).trim());
|
|
35275
|
+
}
|
|
35276
|
+
};
|
|
35277
|
+
var CodexLiteAdapter = class {
|
|
35278
|
+
runLite(prompt, options) {
|
|
35279
|
+
const invocation = resolveCodexInvocation();
|
|
35280
|
+
const args = [
|
|
35281
|
+
...invocation.argsPrefix,
|
|
35282
|
+
"exec",
|
|
35283
|
+
"--json",
|
|
35284
|
+
"--ephemeral",
|
|
35285
|
+
"--skip-git-repo-check",
|
|
35286
|
+
"--sandbox",
|
|
35287
|
+
"read-only"
|
|
35288
|
+
];
|
|
35289
|
+
if (options.model) args.push("--model", options.model);
|
|
35290
|
+
args.push("--", "-");
|
|
35291
|
+
return runProcessForOutput(invocation.command, args, prompt, options.cwd, extractLastCodexAgentMessage);
|
|
35292
|
+
}
|
|
35293
|
+
};
|
|
35294
|
+
|
|
35295
|
+
// ../../packages/core/src/engines/claude-code-engine.ts
|
|
35296
|
+
var fs8 = __toESM(require("fs"), 1);
|
|
35297
|
+
var path8 = __toESM(require("path"), 1);
|
|
35298
|
+
var import_node_child_process3 = require("child_process");
|
|
35299
|
+
var DEFAULT_CLAUDE_MODEL = "sonnet";
|
|
35114
35300
|
function buildClaudeModeArgs(mode) {
|
|
35115
35301
|
switch (mode) {
|
|
35116
35302
|
case "plan":
|
|
@@ -35145,7 +35331,7 @@ var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
|
35145
35331
|
if (task.agent !== "claudecode") continue;
|
|
35146
35332
|
const sessionId = task.payload.sessionId;
|
|
35147
35333
|
if (!sessionId) continue;
|
|
35148
|
-
const cwd =
|
|
35334
|
+
const cwd = path8.resolve(
|
|
35149
35335
|
task.payload.sessionCwd ?? task.effectiveProjectPath ?? task.project ?? process.cwd()
|
|
35150
35336
|
);
|
|
35151
35337
|
this.sessions.set(task.id, { sessionId, cwd, title: task.title });
|
|
@@ -35179,7 +35365,7 @@ var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
|
35179
35365
|
this.ensureLogDir();
|
|
35180
35366
|
this.logger.info("Spawning claude CLI", { taskId: task.id, title: task.title, cwd, model });
|
|
35181
35367
|
const invocation = resolveClaudeInvocation();
|
|
35182
|
-
const proc = (0,
|
|
35368
|
+
const proc = (0, import_node_child_process3.spawn)(invocation.command, [...invocation.argsPrefix, ...args], {
|
|
35183
35369
|
cwd,
|
|
35184
35370
|
stdio: ["pipe", "pipe", "pipe"]
|
|
35185
35371
|
});
|
|
@@ -35298,7 +35484,7 @@ var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
|
35298
35484
|
model
|
|
35299
35485
|
];
|
|
35300
35486
|
const invocation = resolveClaudeInvocation();
|
|
35301
|
-
const proc = (0,
|
|
35487
|
+
const proc = (0, import_node_child_process3.spawn)(invocation.command, [...invocation.argsPrefix, ...args], {
|
|
35302
35488
|
cwd: session.cwd,
|
|
35303
35489
|
stdio: ["pipe", "pipe", "pipe"]
|
|
35304
35490
|
});
|
|
@@ -35405,8 +35591,8 @@ var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
|
35405
35591
|
/** Recover a session by scanning the JSONL log file for the last system.init event. */
|
|
35406
35592
|
recoverSession(taskId) {
|
|
35407
35593
|
const logPath = this.getLogPath(taskId);
|
|
35408
|
-
if (!
|
|
35409
|
-
const content =
|
|
35594
|
+
if (!fs8.existsSync(logPath)) return null;
|
|
35595
|
+
const content = fs8.readFileSync(logPath, "utf-8").trim();
|
|
35410
35596
|
if (!content) return null;
|
|
35411
35597
|
const lines = content.split("\n");
|
|
35412
35598
|
for (let i = lines.length - 1; i >= 0; i--) {
|
|
@@ -35419,7 +35605,7 @@ var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
|
35419
35605
|
const persistedCwd = typeof task?.payload.sessionCwd === "string" ? task.payload.sessionCwd : void 0;
|
|
35420
35606
|
return {
|
|
35421
35607
|
sessionId: event.session_id,
|
|
35422
|
-
cwd:
|
|
35608
|
+
cwd: path8.resolve(
|
|
35423
35609
|
(typeof event.cwd === "string" ? event.cwd : persistedCwd) ?? task?.effectiveProjectPath ?? task?.project ?? process.cwd()
|
|
35424
35610
|
),
|
|
35425
35611
|
title: task?.title ?? taskId
|
|
@@ -35433,27 +35619,9 @@ var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
|
35433
35619
|
};
|
|
35434
35620
|
|
|
35435
35621
|
// ../../packages/core/src/engines/codex-engine.ts
|
|
35436
|
-
var
|
|
35437
|
-
var
|
|
35438
|
-
var
|
|
35439
|
-
function resolveCodexInvocation() {
|
|
35440
|
-
if (process.platform !== "win32") {
|
|
35441
|
-
return { command: "codex", argsPrefix: [] };
|
|
35442
|
-
}
|
|
35443
|
-
const pathEntries = (process.env.PATH ?? "").split(path8.delimiter).filter(Boolean);
|
|
35444
|
-
for (const entry of pathEntries) {
|
|
35445
|
-
const shimPath = path8.join(entry, "codex.cmd");
|
|
35446
|
-
if (!fs8.existsSync(shimPath)) continue;
|
|
35447
|
-
const cliPath = path8.join(entry, "node_modules", "@openai", "codex", "bin", "codex.js");
|
|
35448
|
-
if (fs8.existsSync(cliPath)) {
|
|
35449
|
-
return {
|
|
35450
|
-
command: process.execPath,
|
|
35451
|
-
argsPrefix: [cliPath]
|
|
35452
|
-
};
|
|
35453
|
-
}
|
|
35454
|
-
}
|
|
35455
|
-
return { command: "codex", argsPrefix: [] };
|
|
35456
|
-
}
|
|
35622
|
+
var fs9 = __toESM(require("fs"), 1);
|
|
35623
|
+
var path9 = __toESM(require("path"), 1);
|
|
35624
|
+
var import_node_child_process4 = require("child_process");
|
|
35457
35625
|
function buildAssistantEvent(text, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
35458
35626
|
return {
|
|
35459
35627
|
type: "assistant",
|
|
@@ -35532,7 +35700,7 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
35532
35700
|
if (task.agent !== "codex") continue;
|
|
35533
35701
|
const sessionId = task.payload.sessionId;
|
|
35534
35702
|
if (!sessionId) continue;
|
|
35535
|
-
const cwd =
|
|
35703
|
+
const cwd = path9.resolve(
|
|
35536
35704
|
task.payload.sessionCwd ?? task.effectiveProjectPath ?? task.project ?? process.cwd()
|
|
35537
35705
|
);
|
|
35538
35706
|
this.sessions.set(task.id, { sessionId, cwd, title: task.title });
|
|
@@ -35546,15 +35714,16 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
35546
35714
|
const cwd = task.effectiveProjectPath ?? task.project ?? process.cwd();
|
|
35547
35715
|
const initialContent = getTaskInitialMessageContent(task);
|
|
35548
35716
|
const { prompt, imagePaths } = this.prepareAssets(task.id, initialContent);
|
|
35549
|
-
const args = this.buildArgs(
|
|
35717
|
+
const args = this.buildArgs(imagePaths, { model: config.model, mode: config.mode ?? "bypass" });
|
|
35550
35718
|
this.ensureLogDir();
|
|
35551
35719
|
this.logger.info("Spawning codex CLI", { taskId: task.id, title: task.title, cwd });
|
|
35552
35720
|
const invocation = resolveCodexInvocation();
|
|
35553
|
-
const proc = (0,
|
|
35721
|
+
const proc = (0, import_node_child_process4.spawn)(invocation.command, [...invocation.argsPrefix, ...args], {
|
|
35554
35722
|
cwd,
|
|
35555
|
-
stdio: ["
|
|
35723
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
35556
35724
|
});
|
|
35557
35725
|
this.attachProcess(task.id, task.title, cwd, proc, false);
|
|
35726
|
+
this.writePrompt(proc.stdin, prompt);
|
|
35558
35727
|
proc.unref();
|
|
35559
35728
|
}
|
|
35560
35729
|
sendMessage(taskId, content) {
|
|
@@ -35576,31 +35745,38 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
35576
35745
|
this.appendLog(taskId, userEvent);
|
|
35577
35746
|
this.emitOutput(taskId, userEvent);
|
|
35578
35747
|
const { prompt, imagePaths } = this.prepareAssets(taskId, content);
|
|
35579
|
-
const args = this.buildArgs(
|
|
35748
|
+
const args = this.buildArgs(imagePaths, {
|
|
35580
35749
|
model,
|
|
35581
35750
|
sessionId: session.sessionId,
|
|
35582
35751
|
mode: mode === "plan" || mode === "edit" || mode === "dangerous" || mode === "bypass" ? mode : "bypass"
|
|
35583
35752
|
});
|
|
35584
35753
|
this.logger.info("Sending Codex follow-up message", { taskId, sessionId: session.sessionId });
|
|
35585
35754
|
const invocation = resolveCodexInvocation();
|
|
35586
|
-
const proc = (0,
|
|
35755
|
+
const proc = (0, import_node_child_process4.spawn)(invocation.command, [...invocation.argsPrefix, ...args], {
|
|
35587
35756
|
cwd: session.cwd,
|
|
35588
|
-
stdio: ["
|
|
35757
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
35589
35758
|
});
|
|
35590
35759
|
this.attachProcess(taskId, session.title, session.cwd, proc, true);
|
|
35760
|
+
this.writePrompt(proc.stdin, prompt);
|
|
35591
35761
|
proc.unref();
|
|
35592
35762
|
}
|
|
35593
35763
|
/** Build CLI args for both initial runs and resume follow-ups. */
|
|
35594
|
-
buildArgs(
|
|
35764
|
+
buildArgs(imagePaths, opts = {}) {
|
|
35595
35765
|
const args = ["exec"];
|
|
35596
35766
|
if (opts.sessionId) args.push("resume");
|
|
35597
35767
|
args.push("--json", "--skip-git-repo-check", ...buildCodexModeArgs(opts.mode ?? "bypass"));
|
|
35598
35768
|
if (opts.model) args.push("--model", opts.model);
|
|
35599
35769
|
for (const imagePath of imagePaths) args.push("--image", imagePath);
|
|
35770
|
+
args.push("--");
|
|
35600
35771
|
if (opts.sessionId) args.push(opts.sessionId);
|
|
35601
|
-
args.push(
|
|
35772
|
+
args.push("-");
|
|
35602
35773
|
return args;
|
|
35603
35774
|
}
|
|
35775
|
+
writePrompt(stdin, prompt) {
|
|
35776
|
+
if (!stdin) return;
|
|
35777
|
+
stdin.write(prompt);
|
|
35778
|
+
stdin.end();
|
|
35779
|
+
}
|
|
35604
35780
|
/** Wire up stdout/stderr/close/error handlers for a spawned codex process. */
|
|
35605
35781
|
attachProcess(taskId, title, cwd, proc, isFollowUp) {
|
|
35606
35782
|
const activeProcess = this.trackProcess(taskId, proc);
|
|
@@ -35718,13 +35894,13 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
35718
35894
|
if (images.length === 0) {
|
|
35719
35895
|
return { prompt, imagePaths: [] };
|
|
35720
35896
|
}
|
|
35721
|
-
const attachmentDir =
|
|
35722
|
-
|
|
35897
|
+
const attachmentDir = path9.join(this.logDir, "attachments", taskId);
|
|
35898
|
+
fs9.mkdirSync(attachmentDir, { recursive: true });
|
|
35723
35899
|
const imagePaths = images.map((image, index) => {
|
|
35724
35900
|
const fallbackName = `image-${Date.now()}-${index}.${inferExtension(image.mediaType)}`;
|
|
35725
35901
|
const filename = sanitizeFilename(image.filename ?? fallbackName);
|
|
35726
|
-
const filePath =
|
|
35727
|
-
|
|
35902
|
+
const filePath = path9.join(attachmentDir, filename);
|
|
35903
|
+
fs9.writeFileSync(filePath, Buffer.from(image.data, "base64"));
|
|
35728
35904
|
return filePath;
|
|
35729
35905
|
});
|
|
35730
35906
|
return { prompt, imagePaths };
|
|
@@ -35743,8 +35919,8 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
35743
35919
|
/** Recover a session by scanning the JSONL log for the thread.started event. */
|
|
35744
35920
|
recoverSession(taskId) {
|
|
35745
35921
|
const logPath = this.getLogPath(taskId);
|
|
35746
|
-
if (!
|
|
35747
|
-
const content =
|
|
35922
|
+
if (!fs9.existsSync(logPath)) return null;
|
|
35923
|
+
const content = fs9.readFileSync(logPath, "utf-8").trim();
|
|
35748
35924
|
if (!content) return null;
|
|
35749
35925
|
const lines = content.split("\n");
|
|
35750
35926
|
for (let i = lines.length - 1; i >= 0; i--) {
|
|
@@ -35757,7 +35933,7 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
35757
35933
|
const persistedCwd = typeof task?.payload.sessionCwd === "string" ? task.payload.sessionCwd : void 0;
|
|
35758
35934
|
return {
|
|
35759
35935
|
sessionId: event.thread_id,
|
|
35760
|
-
cwd:
|
|
35936
|
+
cwd: path9.resolve(persistedCwd ?? task?.effectiveProjectPath ?? task?.project ?? process.cwd()),
|
|
35761
35937
|
title: task?.title ?? taskId
|
|
35762
35938
|
};
|
|
35763
35939
|
}
|
|
@@ -35770,7 +35946,7 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
35770
35946
|
|
|
35771
35947
|
// ../../packages/core/src/storage-paths.ts
|
|
35772
35948
|
var os4 = __toESM(require("os"), 1);
|
|
35773
|
-
var
|
|
35949
|
+
var path10 = __toESM(require("path"), 1);
|
|
35774
35950
|
function resolveDefaultStorageMode(options = {}) {
|
|
35775
35951
|
const envMode = options.env?.MESHY_STORAGE_MODE;
|
|
35776
35952
|
if (envMode === "cwd" || envMode === "home") {
|
|
@@ -35786,12 +35962,12 @@ function resolveDefaultStoragePath(options = {}) {
|
|
|
35786
35962
|
const mode = resolveDefaultStorageMode(options);
|
|
35787
35963
|
const envBaseDir = options.env?.MESHY_STORAGE_BASE_DIR;
|
|
35788
35964
|
const baseDir = mode === "cwd" ? envBaseDir ?? options.cwd ?? process.cwd() : options.homeDir ?? os4.homedir();
|
|
35789
|
-
return
|
|
35965
|
+
return path10.resolve(baseDir, ".meshy");
|
|
35790
35966
|
}
|
|
35791
35967
|
|
|
35792
35968
|
// ../../packages/core/src/node.ts
|
|
35793
|
-
var
|
|
35794
|
-
var
|
|
35969
|
+
var fs10 = __toESM(require("fs"), 1);
|
|
35970
|
+
var path11 = __toESM(require("path"), 1);
|
|
35795
35971
|
|
|
35796
35972
|
// ../../node_modules/.pnpm/nanoid@5.1.7/node_modules/nanoid/index.js
|
|
35797
35973
|
var import_node_crypto6 = require("crypto");
|
|
@@ -35862,7 +36038,7 @@ var MeshyNode = class {
|
|
|
35862
36038
|
await this.transport.start(this.config.node.port);
|
|
35863
36039
|
const endpoint = await this.transport.getEndpoint();
|
|
35864
36040
|
const now = Date.now();
|
|
35865
|
-
const workDir =
|
|
36041
|
+
const workDir = path11.resolve(this.config.node.workDir ?? process.cwd());
|
|
35866
36042
|
this.selfInfo = {
|
|
35867
36043
|
id: nodeId,
|
|
35868
36044
|
name: this.config.node.name,
|
|
@@ -35892,7 +36068,7 @@ var MeshyNode = class {
|
|
|
35892
36068
|
this.logger,
|
|
35893
36069
|
this.getSettingsSnapshot
|
|
35894
36070
|
);
|
|
35895
|
-
const logDir =
|
|
36071
|
+
const logDir = path11.join(this.config.storage.path, "task-logs");
|
|
35896
36072
|
this.taskEngine = new TaskEngine(this.store, this.nodeRegistry, this.eventBus, logDir);
|
|
35897
36073
|
this.heartbeat.setGetAssignedTasks((nodeId2) => {
|
|
35898
36074
|
const result = this.taskEngine.listTasks({ assignedTo: nodeId2, status: "assigned" });
|
|
@@ -36511,13 +36687,13 @@ ${joinErrors.map((e) => ` - ${e}`).join("\n")}`
|
|
|
36511
36687
|
}
|
|
36512
36688
|
getIdentityPath() {
|
|
36513
36689
|
const safeName = this.config.node.name.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
36514
|
-
return
|
|
36690
|
+
return path11.join(this.config.storage.path, `node-identity-${safeName}.json`);
|
|
36515
36691
|
}
|
|
36516
36692
|
loadOrCreateNodeId() {
|
|
36517
36693
|
const identityPath = this.getIdentityPath();
|
|
36518
36694
|
try {
|
|
36519
|
-
if (
|
|
36520
|
-
const raw = JSON.parse(
|
|
36695
|
+
if (fs10.existsSync(identityPath)) {
|
|
36696
|
+
const raw = JSON.parse(fs10.readFileSync(identityPath, "utf-8"));
|
|
36521
36697
|
if (typeof raw.id === "string" && raw.id.length > 0) {
|
|
36522
36698
|
return raw.id;
|
|
36523
36699
|
}
|
|
@@ -36525,8 +36701,8 @@ ${joinErrors.map((e) => ` - ${e}`).join("\n")}`
|
|
|
36525
36701
|
} catch {
|
|
36526
36702
|
}
|
|
36527
36703
|
const id = nanoid();
|
|
36528
|
-
|
|
36529
|
-
|
|
36704
|
+
fs10.mkdirSync(path11.dirname(identityPath), { recursive: true });
|
|
36705
|
+
fs10.writeFileSync(
|
|
36530
36706
|
identityPath,
|
|
36531
36707
|
JSON.stringify({ id, name: this.config.node.name }, null, 2) + "\n",
|
|
36532
36708
|
"utf-8"
|
|
@@ -37013,8 +37189,8 @@ function getErrorMap() {
|
|
|
37013
37189
|
|
|
37014
37190
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
37015
37191
|
var makeIssue = (params) => {
|
|
37016
|
-
const { data, path:
|
|
37017
|
-
const fullPath = [...
|
|
37192
|
+
const { data, path: path19, errorMaps, issueData } = params;
|
|
37193
|
+
const fullPath = [...path19, ...issueData.path || []];
|
|
37018
37194
|
const fullIssue = {
|
|
37019
37195
|
...issueData,
|
|
37020
37196
|
path: fullPath
|
|
@@ -37130,11 +37306,11 @@ var errorUtil;
|
|
|
37130
37306
|
|
|
37131
37307
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
37132
37308
|
var ParseInputLazyPath = class {
|
|
37133
|
-
constructor(parent, value,
|
|
37309
|
+
constructor(parent, value, path19, key) {
|
|
37134
37310
|
this._cachedPath = [];
|
|
37135
37311
|
this.parent = parent;
|
|
37136
37312
|
this.data = value;
|
|
37137
|
-
this._path =
|
|
37313
|
+
this._path = path19;
|
|
37138
37314
|
this._key = key;
|
|
37139
37315
|
}
|
|
37140
37316
|
get path() {
|
|
@@ -40922,6 +41098,7 @@ var TaskListResponse = external_exports.object({
|
|
|
40922
41098
|
total: external_exports.number().int().min(0)
|
|
40923
41099
|
});
|
|
40924
41100
|
var UpdateTaskBody = external_exports.object({
|
|
41101
|
+
title: external_exports.string().trim().min(1).optional(),
|
|
40925
41102
|
priority: external_exports.enum(["low", "normal", "high", "critical"]).optional(),
|
|
40926
41103
|
assignedTo: external_exports.string().nullable().optional(),
|
|
40927
41104
|
status: external_exports.enum(["pending", "assigned", "running", "completed", "failed", "cancelled", "archived"]).optional(),
|
|
@@ -40984,8 +41161,8 @@ var BatchTaskIdsBody = external_exports.object({
|
|
|
40984
41161
|
});
|
|
40985
41162
|
|
|
40986
41163
|
// ../../packages/api/src/server.ts
|
|
40987
|
-
var
|
|
40988
|
-
var
|
|
41164
|
+
var path16 = __toESM(require("path"), 1);
|
|
41165
|
+
var fs15 = __toESM(require("fs"), 1);
|
|
40989
41166
|
var import_express9 = __toESM(require_express2(), 1);
|
|
40990
41167
|
|
|
40991
41168
|
// ../../packages/api/src/middleware/auth.ts
|
|
@@ -41406,11 +41583,11 @@ function assertCanChangeNodeDevTunnel(taskEngine, nodeId) {
|
|
|
41406
41583
|
var import_express2 = __toESM(require_express2(), 1);
|
|
41407
41584
|
|
|
41408
41585
|
// ../../packages/api/src/node-workdir-service.ts
|
|
41409
|
-
var
|
|
41586
|
+
var path13 = __toESM(require("path"), 1);
|
|
41410
41587
|
|
|
41411
41588
|
// ../../packages/api/src/output/helpers.ts
|
|
41412
|
-
var
|
|
41413
|
-
var
|
|
41589
|
+
var fs11 = __toESM(require("fs"), 1);
|
|
41590
|
+
var path12 = __toESM(require("path"), 1);
|
|
41414
41591
|
var MAX_INLINE_SIZE = 512 * 1024;
|
|
41415
41592
|
var TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
41416
41593
|
".txt",
|
|
@@ -41523,15 +41700,15 @@ function mimeForExt(ext) {
|
|
|
41523
41700
|
return MIME_MAP[ext] ?? "application/octet-stream";
|
|
41524
41701
|
}
|
|
41525
41702
|
function resolveOutputPath(root, relativePath) {
|
|
41526
|
-
const resolved =
|
|
41527
|
-
const normalizedRoot =
|
|
41528
|
-
if (!resolved.startsWith(normalizedRoot +
|
|
41703
|
+
const resolved = path12.resolve(root, relativePath);
|
|
41704
|
+
const normalizedRoot = path12.resolve(root);
|
|
41705
|
+
if (!resolved.startsWith(normalizedRoot + path12.sep) && resolved !== normalizedRoot) {
|
|
41529
41706
|
throw new Error("Path traversal detected");
|
|
41530
41707
|
}
|
|
41531
41708
|
return resolved;
|
|
41532
41709
|
}
|
|
41533
41710
|
function classifyFile(filePath) {
|
|
41534
|
-
const ext =
|
|
41711
|
+
const ext = path12.extname(filePath).toLowerCase();
|
|
41535
41712
|
if (ext === ".json" || ext === ".jsonl" || ext === ".ndjson") {
|
|
41536
41713
|
return { kind: "json", mimeType: "application/json" };
|
|
41537
41714
|
}
|
|
@@ -41561,21 +41738,21 @@ function listDirectory(root, relativePath) {
|
|
|
41561
41738
|
return listResolvedDirectory(absPath, relativePath);
|
|
41562
41739
|
}
|
|
41563
41740
|
function listAbsoluteDirectory(absoluteDir) {
|
|
41564
|
-
if (!
|
|
41741
|
+
if (!path12.isAbsolute(absoluteDir)) {
|
|
41565
41742
|
throw new Error("listAbsoluteDirectory requires an absolute path");
|
|
41566
41743
|
}
|
|
41567
41744
|
return listResolvedDirectory(absoluteDir, absoluteDir, { childPathStyle: "absolute" });
|
|
41568
41745
|
}
|
|
41569
41746
|
function listResolvedDirectory(absPath, relativeBase, options = {}) {
|
|
41570
|
-
if (!
|
|
41747
|
+
if (!fs11.existsSync(absPath) || !fs11.statSync(absPath).isDirectory()) {
|
|
41571
41748
|
return [];
|
|
41572
41749
|
}
|
|
41573
|
-
const entries =
|
|
41750
|
+
const entries = fs11.readdirSync(absPath, { withFileTypes: true });
|
|
41574
41751
|
const result = [];
|
|
41575
41752
|
const childPathStyle = options.childPathStyle ?? "relative";
|
|
41576
41753
|
for (const entry of entries) {
|
|
41577
41754
|
if (entry.name.startsWith(".")) continue;
|
|
41578
|
-
const entryRelPath = childPathStyle === "absolute" ?
|
|
41755
|
+
const entryRelPath = childPathStyle === "absolute" ? path12.join(absPath, entry.name) : path12.join(relativeBase || ".", entry.name).split(path12.sep).join("/");
|
|
41579
41756
|
if (entry.isDirectory()) {
|
|
41580
41757
|
result.push({
|
|
41581
41758
|
path: entryRelPath,
|
|
@@ -41583,8 +41760,8 @@ function listResolvedDirectory(absPath, relativeBase, options = {}) {
|
|
|
41583
41760
|
type: "directory"
|
|
41584
41761
|
});
|
|
41585
41762
|
} else if (entry.isFile()) {
|
|
41586
|
-
const fullPath =
|
|
41587
|
-
const stat =
|
|
41763
|
+
const fullPath = path12.join(absPath, entry.name);
|
|
41764
|
+
const stat = fs11.statSync(fullPath);
|
|
41588
41765
|
const { kind, mimeType } = classifyFile(entry.name);
|
|
41589
41766
|
result.push({
|
|
41590
41767
|
path: entryRelPath,
|
|
@@ -41604,11 +41781,11 @@ function listResolvedDirectory(absPath, relativeBase, options = {}) {
|
|
|
41604
41781
|
}
|
|
41605
41782
|
function detectHtmlEntries(root) {
|
|
41606
41783
|
const entries = [];
|
|
41607
|
-
if (
|
|
41784
|
+
if (fs11.existsSync(path12.join(root, "index.html"))) {
|
|
41608
41785
|
entries.push({ path: "index.html", label: "index.html" });
|
|
41609
41786
|
}
|
|
41610
41787
|
try {
|
|
41611
|
-
const topLevel =
|
|
41788
|
+
const topLevel = fs11.readdirSync(root, { withFileTypes: true });
|
|
41612
41789
|
const htmlFiles = topLevel.filter(
|
|
41613
41790
|
(e) => e.isFile() && e.name.endsWith(".html") && !e.name.startsWith(".")
|
|
41614
41791
|
);
|
|
@@ -41619,8 +41796,8 @@ function detectHtmlEntries(root) {
|
|
|
41619
41796
|
}
|
|
41620
41797
|
const subdirs = topLevel.filter((e) => e.isDirectory() && !e.name.startsWith("."));
|
|
41621
41798
|
for (const dir of subdirs) {
|
|
41622
|
-
const subIndex =
|
|
41623
|
-
if (
|
|
41799
|
+
const subIndex = path12.join(root, dir.name, "index.html");
|
|
41800
|
+
if (fs11.existsSync(subIndex)) {
|
|
41624
41801
|
entries.push({
|
|
41625
41802
|
path: `${dir.name}/index.html`,
|
|
41626
41803
|
label: `${dir.name}/index.html`
|
|
@@ -41632,11 +41809,11 @@ function detectHtmlEntries(root) {
|
|
|
41632
41809
|
return entries;
|
|
41633
41810
|
}
|
|
41634
41811
|
function getOutputSummary(root) {
|
|
41635
|
-
const rootName =
|
|
41812
|
+
const rootName = path12.basename(root);
|
|
41636
41813
|
const htmlEntries = detectHtmlEntries(root);
|
|
41637
41814
|
let fileCount;
|
|
41638
41815
|
try {
|
|
41639
|
-
const entries =
|
|
41816
|
+
const entries = fs11.readdirSync(root, { withFileTypes: true });
|
|
41640
41817
|
fileCount = entries.filter((e) => !e.name.startsWith(".")).length;
|
|
41641
41818
|
} catch {
|
|
41642
41819
|
fileCount = void 0;
|
|
@@ -41652,14 +41829,14 @@ function getOutputSummary(root) {
|
|
|
41652
41829
|
}
|
|
41653
41830
|
function readFileContent(root, relativePath) {
|
|
41654
41831
|
const absPath = resolveOutputPath(root, relativePath);
|
|
41655
|
-
if (!
|
|
41832
|
+
if (!fs11.existsSync(absPath) || !fs11.statSync(absPath).isFile()) {
|
|
41656
41833
|
throw new Error("File not found");
|
|
41657
41834
|
}
|
|
41658
|
-
const stat =
|
|
41835
|
+
const stat = fs11.statSync(absPath);
|
|
41659
41836
|
const { kind, mimeType } = classifyFile(absPath);
|
|
41660
41837
|
if (kind === "image" || kind === "pdf" || kind === "binary") {
|
|
41661
41838
|
const truncated2 = stat.size > MAX_INLINE_SIZE;
|
|
41662
|
-
const buffer = truncated2 ? Buffer.alloc(0) :
|
|
41839
|
+
const buffer = truncated2 ? Buffer.alloc(0) : fs11.readFileSync(absPath);
|
|
41663
41840
|
return {
|
|
41664
41841
|
path: relativePath,
|
|
41665
41842
|
kind,
|
|
@@ -41670,7 +41847,7 @@ function readFileContent(root, relativePath) {
|
|
|
41670
41847
|
};
|
|
41671
41848
|
}
|
|
41672
41849
|
const truncated = stat.size > MAX_INLINE_SIZE;
|
|
41673
|
-
const content = truncated ?
|
|
41850
|
+
const content = truncated ? fs11.readFileSync(absPath, "utf-8").slice(0, MAX_INLINE_SIZE) : fs11.readFileSync(absPath, "utf-8");
|
|
41674
41851
|
return {
|
|
41675
41852
|
path: relativePath,
|
|
41676
41853
|
kind,
|
|
@@ -41682,10 +41859,10 @@ function readFileContent(root, relativePath) {
|
|
|
41682
41859
|
}
|
|
41683
41860
|
|
|
41684
41861
|
// ../../packages/api/src/output/git-branches.ts
|
|
41685
|
-
var
|
|
41862
|
+
var import_node_child_process5 = require("child_process");
|
|
41686
41863
|
function git(args, cwd) {
|
|
41687
41864
|
try {
|
|
41688
|
-
return (0,
|
|
41865
|
+
return (0, import_node_child_process5.execFileSync)("git", ["-C", cwd, ...args], {
|
|
41689
41866
|
encoding: "utf-8",
|
|
41690
41867
|
timeout: 1e4,
|
|
41691
41868
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -41696,7 +41873,7 @@ function git(args, cwd) {
|
|
|
41696
41873
|
}
|
|
41697
41874
|
function gitSucceeds(args, cwd) {
|
|
41698
41875
|
try {
|
|
41699
|
-
(0,
|
|
41876
|
+
(0, import_node_child_process5.execFileSync)("git", ["-C", cwd, ...args], {
|
|
41700
41877
|
encoding: "utf-8",
|
|
41701
41878
|
timeout: 1e4,
|
|
41702
41879
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -41707,7 +41884,7 @@ function gitSucceeds(args, cwd) {
|
|
|
41707
41884
|
}
|
|
41708
41885
|
}
|
|
41709
41886
|
function runGit(args, cwd) {
|
|
41710
|
-
return (0,
|
|
41887
|
+
return (0, import_node_child_process5.execFileSync)("git", ["-C", cwd, ...args], {
|
|
41711
41888
|
encoding: "utf-8",
|
|
41712
41889
|
timeout: 1e4,
|
|
41713
41890
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -41771,6 +41948,14 @@ function listRemoteBranches(repoRoot2) {
|
|
|
41771
41948
|
}
|
|
41772
41949
|
return output.split("\n").map(parseRemoteBranch).filter((value) => value !== null).sort(compareRemoteBranches);
|
|
41773
41950
|
}
|
|
41951
|
+
function fetchRemoteBranches(repoRoot2) {
|
|
41952
|
+
for (const remote of ["upstream", "origin"]) {
|
|
41953
|
+
if (!gitSucceeds(["remote", "get-url", remote], repoRoot2)) {
|
|
41954
|
+
continue;
|
|
41955
|
+
}
|
|
41956
|
+
git(["fetch", remote, "--prune"], repoRoot2);
|
|
41957
|
+
}
|
|
41958
|
+
}
|
|
41774
41959
|
function getRemoteStartPoint(repoRoot2, value) {
|
|
41775
41960
|
const trimmed = value.trim();
|
|
41776
41961
|
if (!trimmed) {
|
|
@@ -41810,6 +41995,7 @@ function getGitBranchInfo(dirPath, options) {
|
|
|
41810
41995
|
};
|
|
41811
41996
|
}
|
|
41812
41997
|
const repoRoot2 = git(["rev-parse", "--show-toplevel"], dirPath);
|
|
41998
|
+
fetchRemoteBranches(repoRoot2);
|
|
41813
41999
|
const currentBranch = normalizeCurrentBranch(git(["rev-parse", "--abbrev-ref", "HEAD"], dirPath));
|
|
41814
42000
|
const remoteBranches = listRemoteBranches(repoRoot2);
|
|
41815
42001
|
const branches = remoteBranches.slice(offset, offset + limit);
|
|
@@ -41841,6 +42027,7 @@ function createGitBranch(dirPath, branchName, startPoint, options) {
|
|
|
41841
42027
|
if (gitSucceeds(["show-ref", "--verify", "--quiet", `refs/heads/${name2}`], repoRoot2)) {
|
|
41842
42028
|
throw new Error(`Local branch ${name2} already exists`);
|
|
41843
42029
|
}
|
|
42030
|
+
fetchRemoteBranches(repoRoot2);
|
|
41844
42031
|
const target = getRemoteStartPoint(repoRoot2, startPoint);
|
|
41845
42032
|
if (target.track) {
|
|
41846
42033
|
runGit(["switch", "-c", name2, "--track", target.ref], repoRoot2);
|
|
@@ -41855,10 +42042,10 @@ function createGitBranch(dirPath, branchName, startPoint, options) {
|
|
|
41855
42042
|
}
|
|
41856
42043
|
|
|
41857
42044
|
// ../../packages/api/src/output/git-diff.ts
|
|
41858
|
-
var
|
|
42045
|
+
var import_node_child_process6 = require("child_process");
|
|
41859
42046
|
function git2(args, cwd) {
|
|
41860
42047
|
try {
|
|
41861
|
-
return (0,
|
|
42048
|
+
return (0, import_node_child_process6.execFileSync)("git", ["-C", cwd, ...args], {
|
|
41862
42049
|
encoding: "utf-8",
|
|
41863
42050
|
timeout: 1e4,
|
|
41864
42051
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -41905,14 +42092,14 @@ function getGitDiff(dirPath) {
|
|
|
41905
42092
|
|
|
41906
42093
|
// ../../packages/api/src/node-workdir-service.ts
|
|
41907
42094
|
function isAbsolutePath(p) {
|
|
41908
|
-
return
|
|
42095
|
+
return path13.isAbsolute(p) || /^[A-Za-z]:[\\/]/.test(p);
|
|
41909
42096
|
}
|
|
41910
42097
|
function resolveNodeWorkDirTarget(nodeId, rootPath, currentPath, allowAbsolute) {
|
|
41911
42098
|
if (!rootPath) {
|
|
41912
42099
|
throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
|
|
41913
42100
|
}
|
|
41914
42101
|
const useAbsolute = allowAbsolute && isAbsolutePath(currentPath);
|
|
41915
|
-
const resolvedPath = useAbsolute ?
|
|
42102
|
+
const resolvedPath = useAbsolute ? path13.resolve(currentPath) : currentPath;
|
|
41916
42103
|
return {
|
|
41917
42104
|
rootPath,
|
|
41918
42105
|
resolvedPath,
|
|
@@ -41997,13 +42184,13 @@ function createLocalNodeWorkDirBranch(nodeId, rootPath, currentPath, options) {
|
|
|
41997
42184
|
}
|
|
41998
42185
|
function computeParentPath(rootPath, currentPath, useAbsolute) {
|
|
41999
42186
|
if (useAbsolute) {
|
|
42000
|
-
const parent =
|
|
42187
|
+
const parent = path13.dirname(currentPath);
|
|
42001
42188
|
return parent === currentPath ? null : parent;
|
|
42002
42189
|
}
|
|
42003
42190
|
const normalized = currentPath.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
42004
42191
|
if (normalized === "" || normalized === ".") {
|
|
42005
|
-
const absParent =
|
|
42006
|
-
return absParent ===
|
|
42192
|
+
const absParent = path13.dirname(path13.resolve(rootPath));
|
|
42193
|
+
return absParent === path13.resolve(rootPath) ? null : absParent;
|
|
42007
42194
|
}
|
|
42008
42195
|
const segments = normalized.split("/").filter(Boolean);
|
|
42009
42196
|
segments.pop();
|
|
@@ -42070,7 +42257,7 @@ function sendLocalNodeWorkDirBranchCreate(req, res, nodeId, options = {}) {
|
|
|
42070
42257
|
}
|
|
42071
42258
|
|
|
42072
42259
|
// ../../packages/api/src/task-route-utils.ts
|
|
42073
|
-
var
|
|
42260
|
+
var fs12 = __toESM(require("fs"), 1);
|
|
42074
42261
|
function restoreTaskState(taskEngine, task) {
|
|
42075
42262
|
taskEngine.updateTask(task.id, {
|
|
42076
42263
|
status: task.status,
|
|
@@ -42085,10 +42272,10 @@ function readLocalTaskLogs(engineRegistry, taskId, after, agent) {
|
|
|
42085
42272
|
throw new MeshyError("VALIDATION_ERROR", `Engine not registered for agent: ${agent}`, 400);
|
|
42086
42273
|
}
|
|
42087
42274
|
const logPath = engine.getLogPath(taskId);
|
|
42088
|
-
if (!
|
|
42275
|
+
if (!fs12.existsSync(logPath)) {
|
|
42089
42276
|
return { logs: [], total: 0 };
|
|
42090
42277
|
}
|
|
42091
|
-
const content =
|
|
42278
|
+
const content = fs12.readFileSync(logPath, "utf-8");
|
|
42092
42279
|
const allLines = content.trim().split("\n").filter(Boolean);
|
|
42093
42280
|
const logs = [];
|
|
42094
42281
|
for (let i = after; i < allLines.length; i++) {
|
|
@@ -42170,29 +42357,29 @@ function cancelTaskOnCurrentNode(deps, taskId, options = {}) {
|
|
|
42170
42357
|
}
|
|
42171
42358
|
|
|
42172
42359
|
// ../../packages/api/src/task-output-service.ts
|
|
42173
|
-
var
|
|
42174
|
-
var
|
|
42360
|
+
var fs14 = __toESM(require("fs"), 1);
|
|
42361
|
+
var path15 = __toESM(require("path"), 1);
|
|
42175
42362
|
|
|
42176
42363
|
// ../../packages/api/src/preview/preview-server.ts
|
|
42177
42364
|
var crypto3 = __toESM(require("crypto"), 1);
|
|
42178
|
-
var
|
|
42179
|
-
var
|
|
42365
|
+
var fs13 = __toESM(require("fs"), 1);
|
|
42366
|
+
var path14 = __toESM(require("path"), 1);
|
|
42180
42367
|
var http2 = __toESM(require("http"), 1);
|
|
42181
42368
|
function resolvePreviewPath(rootPath, relativePath) {
|
|
42182
42369
|
const sanitizedPath = relativePath.replace(/\\/g, "/");
|
|
42183
|
-
const resolvedPath =
|
|
42184
|
-
const normalizedRoot =
|
|
42185
|
-
if (!resolvedPath.startsWith(normalizedRoot +
|
|
42370
|
+
const resolvedPath = path14.resolve(rootPath, sanitizedPath);
|
|
42371
|
+
const normalizedRoot = path14.resolve(rootPath);
|
|
42372
|
+
if (!resolvedPath.startsWith(normalizedRoot + path14.sep) && resolvedPath !== normalizedRoot) {
|
|
42186
42373
|
throw new Error("Invalid preview path");
|
|
42187
42374
|
}
|
|
42188
42375
|
return {
|
|
42189
42376
|
absolutePath: resolvedPath,
|
|
42190
|
-
normalizedPath:
|
|
42377
|
+
normalizedPath: path14.relative(normalizedRoot, resolvedPath).split(path14.sep).join("/")
|
|
42191
42378
|
};
|
|
42192
42379
|
}
|
|
42193
42380
|
function resolvePreviewEntryPath(rootPath, entryPath) {
|
|
42194
42381
|
const { absolutePath, normalizedPath } = resolvePreviewPath(rootPath, entryPath ?? "index.html");
|
|
42195
|
-
if (!
|
|
42382
|
+
if (!fs13.existsSync(absolutePath) || !fs13.statSync(absolutePath).isFile()) {
|
|
42196
42383
|
throw new Error("Preview entry not found");
|
|
42197
42384
|
}
|
|
42198
42385
|
return normalizedPath;
|
|
@@ -42256,7 +42443,7 @@ var MIME_MAP2 = {
|
|
|
42256
42443
|
".pdf": "application/pdf"
|
|
42257
42444
|
};
|
|
42258
42445
|
function getMime(filePath) {
|
|
42259
|
-
return MIME_MAP2[
|
|
42446
|
+
return MIME_MAP2[path14.extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
42260
42447
|
}
|
|
42261
42448
|
function sendPreviewAssetResponse(sessionManager, token, requestedPath, res) {
|
|
42262
42449
|
const session = sessionManager.get(token);
|
|
@@ -42274,13 +42461,13 @@ function sendPreviewAssetResponse(sessionManager, token, requestedPath, res) {
|
|
|
42274
42461
|
res.end("Invalid path");
|
|
42275
42462
|
return;
|
|
42276
42463
|
}
|
|
42277
|
-
if (!
|
|
42464
|
+
if (!fs13.existsSync(resolved) || !fs13.statSync(resolved).isFile()) {
|
|
42278
42465
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
42279
42466
|
res.end("File not found");
|
|
42280
42467
|
return;
|
|
42281
42468
|
}
|
|
42282
42469
|
const mime = getMime(resolved);
|
|
42283
|
-
const content =
|
|
42470
|
+
const content = fs13.readFileSync(resolved);
|
|
42284
42471
|
res.writeHead(200, {
|
|
42285
42472
|
"Content-Type": mime,
|
|
42286
42473
|
"Content-Length": content.length,
|
|
@@ -42482,13 +42669,13 @@ function getLocalTaskOutputDownload(taskEngine, taskId, filePath) {
|
|
|
42482
42669
|
const rootPath = getTaskOutputRoot(taskEngine, taskId);
|
|
42483
42670
|
try {
|
|
42484
42671
|
const absolutePath = resolveOutputPath(rootPath, filePath);
|
|
42485
|
-
if (!
|
|
42672
|
+
if (!fs14.existsSync(absolutePath) || !fs14.statSync(absolutePath).isFile()) {
|
|
42486
42673
|
throw new MeshyError("TASK_NOT_FOUND", `File not found: ${filePath}`, 404);
|
|
42487
42674
|
}
|
|
42488
42675
|
const { mimeType } = classifyFile(absolutePath);
|
|
42489
|
-
const fileName =
|
|
42676
|
+
const fileName = path15.basename(absolutePath).replace(/"/g, "");
|
|
42490
42677
|
return {
|
|
42491
|
-
content:
|
|
42678
|
+
content: fs14.readFileSync(absolutePath),
|
|
42492
42679
|
headers: {
|
|
42493
42680
|
"Content-Type": mimeType,
|
|
42494
42681
|
"Content-Disposition": `inline; filename="${fileName}"`,
|
|
@@ -43574,6 +43761,86 @@ function createTaskOutputRoutes(options = {}) {
|
|
|
43574
43761
|
var TERMINAL_STATUSES3 = /* @__PURE__ */ new Set(["completed", "failed", "cancelled", "archived"]);
|
|
43575
43762
|
var ARCHIVABLE_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled", "archived"]);
|
|
43576
43763
|
var ACTIVE_STATUSES = /* @__PURE__ */ new Set(["pending", "assigned", "running"]);
|
|
43764
|
+
function shouldGenerateTitle(task) {
|
|
43765
|
+
return task.payload.titleSource === "derived";
|
|
43766
|
+
}
|
|
43767
|
+
function getTitlePrompt(task) {
|
|
43768
|
+
return task.description.trim() || task.title;
|
|
43769
|
+
}
|
|
43770
|
+
function scheduleTitleGeneration(deps, task) {
|
|
43771
|
+
const log2 = deps.logger.child("tasks/title");
|
|
43772
|
+
if (!shouldGenerateTitle(task)) {
|
|
43773
|
+
log2.debug("skipping task title generation", {
|
|
43774
|
+
taskId: task.id,
|
|
43775
|
+
agent: task.agent,
|
|
43776
|
+
titleSource: task.payload.titleSource
|
|
43777
|
+
});
|
|
43778
|
+
return;
|
|
43779
|
+
}
|
|
43780
|
+
if (!deps.liteAgentRunner) {
|
|
43781
|
+
log2.warn("skipping generated task title because lite agent runner is unavailable", {
|
|
43782
|
+
taskId: task.id,
|
|
43783
|
+
agent: task.agent
|
|
43784
|
+
});
|
|
43785
|
+
return;
|
|
43786
|
+
}
|
|
43787
|
+
const prompt = getTitlePrompt(task);
|
|
43788
|
+
const cwd = deps.workDir;
|
|
43789
|
+
log2.info("generating task title", {
|
|
43790
|
+
taskId: task.id,
|
|
43791
|
+
agent: task.agent,
|
|
43792
|
+
cwd,
|
|
43793
|
+
promptLength: prompt.length,
|
|
43794
|
+
fallbackTitleLength: task.title.length
|
|
43795
|
+
});
|
|
43796
|
+
void deps.liteAgentRunner.run(generateTitleFunction, {
|
|
43797
|
+
prompt,
|
|
43798
|
+
existingTitle: task.title
|
|
43799
|
+
}, {
|
|
43800
|
+
agent: task.agent,
|
|
43801
|
+
cwd
|
|
43802
|
+
}).then(({ title }) => {
|
|
43803
|
+
const current = deps.taskEngine.getTask(task.id);
|
|
43804
|
+
if (!current) {
|
|
43805
|
+
log2.debug("skipping generated title update because task no longer exists", {
|
|
43806
|
+
taskId: task.id,
|
|
43807
|
+
agent: task.agent
|
|
43808
|
+
});
|
|
43809
|
+
return;
|
|
43810
|
+
}
|
|
43811
|
+
if (current.title !== task.title) {
|
|
43812
|
+
log2.info("skipping generated title update because task title changed", {
|
|
43813
|
+
taskId: task.id,
|
|
43814
|
+
agent: task.agent,
|
|
43815
|
+
originalTitleLength: task.title.length,
|
|
43816
|
+
currentTitleLength: current.title.length,
|
|
43817
|
+
generatedTitleLength: title.length
|
|
43818
|
+
});
|
|
43819
|
+
return;
|
|
43820
|
+
}
|
|
43821
|
+
if (current.title === title) {
|
|
43822
|
+
log2.debug("skipping generated title update because title is unchanged", {
|
|
43823
|
+
taskId: task.id,
|
|
43824
|
+
agent: task.agent,
|
|
43825
|
+
titleLength: title.length
|
|
43826
|
+
});
|
|
43827
|
+
return;
|
|
43828
|
+
}
|
|
43829
|
+
deps.taskEngine.updateTask(task.id, { title });
|
|
43830
|
+
log2.info("updated task title from lite agent", {
|
|
43831
|
+
taskId: task.id,
|
|
43832
|
+
agent: task.agent,
|
|
43833
|
+
generatedTitleLength: title.length
|
|
43834
|
+
});
|
|
43835
|
+
}).catch((err) => {
|
|
43836
|
+
log2.warn("failed to generate task title", {
|
|
43837
|
+
taskId: task.id,
|
|
43838
|
+
agent: task.agent,
|
|
43839
|
+
cwd,
|
|
43840
|
+
error: err instanceof Error ? err.message : String(err)
|
|
43841
|
+
});
|
|
43842
|
+
});
|
|
43843
|
+
}
|
|
43577
43844
|
function asyncHandler4(fn) {
|
|
43578
43845
|
return (req, res, next) => fn(req, res, next).catch(next);
|
|
43579
43846
|
}
|
|
@@ -43591,7 +43858,7 @@ function withAssignedNodeMetadata(task, nodeRegistry) {
|
|
|
43591
43858
|
function createTaskRoutes() {
|
|
43592
43859
|
const router = (0, import_express5.Router)();
|
|
43593
43860
|
router.post("/", asyncHandler4(async (req, res) => {
|
|
43594
|
-
const { taskEngine, nodeRegistry } = req.app.locals.deps;
|
|
43861
|
+
const { taskEngine, nodeRegistry, liteAgentRunner, logger: rootLogger, workDir } = req.app.locals.deps;
|
|
43595
43862
|
const body = CreateTaskBody.parse(req.body);
|
|
43596
43863
|
const task = taskEngine.createTask({
|
|
43597
43864
|
title: body.title,
|
|
@@ -43605,9 +43872,11 @@ function createTaskRoutes() {
|
|
|
43605
43872
|
});
|
|
43606
43873
|
if (body.assignTo) {
|
|
43607
43874
|
const assigned = taskEngine.assignTask(task.id, body.assignTo);
|
|
43875
|
+
scheduleTitleGeneration({ taskEngine, liteAgentRunner, logger: rootLogger, workDir }, assigned);
|
|
43608
43876
|
res.status(201).json(withAssignedNodeMetadata(assigned, nodeRegistry));
|
|
43609
43877
|
return;
|
|
43610
43878
|
}
|
|
43879
|
+
scheduleTitleGeneration({ taskEngine, liteAgentRunner, logger: rootLogger, workDir }, task);
|
|
43611
43880
|
res.status(201).json(withAssignedNodeMetadata(task, nodeRegistry));
|
|
43612
43881
|
}));
|
|
43613
43882
|
router.get("/", asyncHandler4(async (req, res) => {
|
|
@@ -44181,7 +44450,7 @@ var import_express7 = __toESM(require_express2(), 1);
|
|
|
44181
44450
|
|
|
44182
44451
|
// ../../packages/api/src/system-info.ts
|
|
44183
44452
|
var os5 = __toESM(require("os"), 1);
|
|
44184
|
-
var
|
|
44453
|
+
var import_node_child_process7 = require("child_process");
|
|
44185
44454
|
var RUNTIME_TOOLS = [
|
|
44186
44455
|
{ id: "claude", label: "Claude Code", command: "claude" },
|
|
44187
44456
|
{ id: "codex", label: "Codex", command: "codex" }
|
|
@@ -44195,7 +44464,7 @@ function normalizeOutput(output) {
|
|
|
44195
44464
|
}
|
|
44196
44465
|
function resolveCommandPath(command) {
|
|
44197
44466
|
const lookupCommand = process.platform === "win32" ? "where" : "which";
|
|
44198
|
-
const result = (0,
|
|
44467
|
+
const result = (0, import_node_child_process7.spawnSync)(lookupCommand, [command], {
|
|
44199
44468
|
encoding: "utf-8",
|
|
44200
44469
|
shell: false,
|
|
44201
44470
|
windowsHide: true,
|
|
@@ -44224,7 +44493,7 @@ function inspectTool(definition) {
|
|
|
44224
44493
|
detail: resolved.detail ?? "Command not found on PATH"
|
|
44225
44494
|
};
|
|
44226
44495
|
}
|
|
44227
|
-
const versionResult = (0,
|
|
44496
|
+
const versionResult = (0, import_node_child_process7.spawnSync)(definition.command, ["--version"], {
|
|
44228
44497
|
encoding: "utf-8",
|
|
44229
44498
|
shell: process.platform === "win32",
|
|
44230
44499
|
windowsHide: true,
|
|
@@ -44420,6 +44689,7 @@ var ALL_EVENT_NAMES = [
|
|
|
44420
44689
|
"task.created",
|
|
44421
44690
|
"task.assigned",
|
|
44422
44691
|
"task.status",
|
|
44692
|
+
"task.updated",
|
|
44423
44693
|
"task.deleted",
|
|
44424
44694
|
"task.output",
|
|
44425
44695
|
"election.started",
|
|
@@ -44491,8 +44761,8 @@ var JSON_BODY_LIMIT_LARGE = "25mb";
|
|
|
44491
44761
|
function resolveRuntimeBaseDir() {
|
|
44492
44762
|
const entryPath = process.argv[1];
|
|
44493
44763
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
44494
|
-
const resolved =
|
|
44495
|
-
return
|
|
44764
|
+
const resolved = fs15.realpathSync(path16.resolve(entryPath));
|
|
44765
|
+
return path16.dirname(resolved);
|
|
44496
44766
|
}
|
|
44497
44767
|
return process.cwd();
|
|
44498
44768
|
}
|
|
@@ -44500,18 +44770,18 @@ function resolveStaticDir(baseDir) {
|
|
|
44500
44770
|
const envStaticDir = process.env.MESHY_STATIC_DIR;
|
|
44501
44771
|
const candidateDirs = [
|
|
44502
44772
|
envStaticDir,
|
|
44503
|
-
|
|
44504
|
-
|
|
44505
|
-
|
|
44506
|
-
|
|
44507
|
-
|
|
44508
|
-
|
|
44509
|
-
|
|
44510
|
-
|
|
44511
|
-
|
|
44773
|
+
path16.resolve(baseDir, "dashboard"),
|
|
44774
|
+
path16.resolve(baseDir, "../dashboard"),
|
|
44775
|
+
path16.resolve(baseDir, "../../dashboard/dist"),
|
|
44776
|
+
path16.resolve(baseDir, "../../../packages/dashboard/dist"),
|
|
44777
|
+
path16.resolve(baseDir, "../public"),
|
|
44778
|
+
path16.resolve(baseDir, "../../packages/api/public"),
|
|
44779
|
+
path16.resolve(baseDir, "../../../packages/api/public"),
|
|
44780
|
+
path16.resolve(process.cwd(), "packages/dashboard/dist"),
|
|
44781
|
+
path16.resolve(process.cwd(), "packages/api/public")
|
|
44512
44782
|
].filter((value) => typeof value === "string" && value.length > 0);
|
|
44513
44783
|
for (const candidate of candidateDirs) {
|
|
44514
|
-
if (
|
|
44784
|
+
if (fs15.existsSync(candidate)) {
|
|
44515
44785
|
return candidate;
|
|
44516
44786
|
}
|
|
44517
44787
|
}
|
|
@@ -44585,8 +44855,8 @@ function createServer2(deps) {
|
|
|
44585
44855
|
app.use("/api/system", createSystemRoutes());
|
|
44586
44856
|
app.use("/api/events", createEventRoutes());
|
|
44587
44857
|
if (staticDir) {
|
|
44588
|
-
const indexPath =
|
|
44589
|
-
if (
|
|
44858
|
+
const indexPath = path16.join(staticDir, "index.html");
|
|
44859
|
+
if (fs15.existsSync(indexPath)) {
|
|
44590
44860
|
app.get("*", (req, res, next) => {
|
|
44591
44861
|
if (isApiRequest(req)) {
|
|
44592
44862
|
next();
|
|
@@ -44670,10 +44940,10 @@ var DirectTransport = class {
|
|
|
44670
44940
|
};
|
|
44671
44941
|
|
|
44672
44942
|
// ../../packages/transport/src/devtunnel.ts
|
|
44673
|
-
var
|
|
44943
|
+
var import_node_child_process8 = require("child_process");
|
|
44674
44944
|
function isInstalled(cmd) {
|
|
44675
44945
|
try {
|
|
44676
|
-
(0,
|
|
44946
|
+
(0, import_node_child_process8.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
|
|
44677
44947
|
return true;
|
|
44678
44948
|
} catch {
|
|
44679
44949
|
return false;
|
|
@@ -44696,14 +44966,14 @@ var DevTunnelTransport = class {
|
|
|
44696
44966
|
);
|
|
44697
44967
|
}
|
|
44698
44968
|
try {
|
|
44699
|
-
(0,
|
|
44969
|
+
(0, import_node_child_process8.execSync)("devtunnel user show", { stdio: "pipe" });
|
|
44700
44970
|
} catch {
|
|
44701
44971
|
throw new Error(
|
|
44702
44972
|
"Not logged in to devtunnel. Run: devtunnel user login"
|
|
44703
44973
|
);
|
|
44704
44974
|
}
|
|
44705
44975
|
const hostArgs = this.buildHostArgs(localPort);
|
|
44706
|
-
const child = (0,
|
|
44976
|
+
const child = (0, import_node_child_process8.spawn)("devtunnel", hostArgs, {
|
|
44707
44977
|
stdio: ["pipe", "pipe", "pipe"]
|
|
44708
44978
|
});
|
|
44709
44979
|
this.process = child;
|
|
@@ -44808,7 +45078,7 @@ ${lines.join("")}`
|
|
|
44808
45078
|
return void 0;
|
|
44809
45079
|
}
|
|
44810
45080
|
try {
|
|
44811
|
-
(0,
|
|
45081
|
+
(0, import_node_child_process8.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
|
|
44812
45082
|
return tunnelId;
|
|
44813
45083
|
} catch {
|
|
44814
45084
|
const createArgs = ["create", tunnelId];
|
|
@@ -44816,7 +45086,7 @@ ${lines.join("")}`
|
|
|
44816
45086
|
createArgs.push("-a");
|
|
44817
45087
|
}
|
|
44818
45088
|
try {
|
|
44819
|
-
(0,
|
|
45089
|
+
(0, import_node_child_process8.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
|
|
44820
45090
|
return tunnelId;
|
|
44821
45091
|
} catch (err) {
|
|
44822
45092
|
throw new Error(
|
|
@@ -44831,7 +45101,7 @@ ${lines.join("")}`
|
|
|
44831
45101
|
return;
|
|
44832
45102
|
}
|
|
44833
45103
|
try {
|
|
44834
|
-
(0,
|
|
45104
|
+
(0, import_node_child_process8.execFileSync)(
|
|
44835
45105
|
"devtunnel",
|
|
44836
45106
|
["port", "create", tunnelId, "-p", String(localPort), "--protocol", "http"],
|
|
44837
45107
|
{ stdio: "pipe" }
|
|
@@ -44847,7 +45117,7 @@ ${lines.join("")}`
|
|
|
44847
45117
|
}
|
|
44848
45118
|
listTunnelPorts(tunnelId) {
|
|
44849
45119
|
try {
|
|
44850
|
-
const output = (0,
|
|
45120
|
+
const output = (0, import_node_child_process8.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
|
|
44851
45121
|
const parsed = JSON.parse(output.toString());
|
|
44852
45122
|
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 : [];
|
|
44853
45123
|
return items.map((item) => getPortNumber(item)).filter((value) => value !== void 0);
|
|
@@ -44859,7 +45129,7 @@ ${lines.join("")}`
|
|
|
44859
45129
|
}
|
|
44860
45130
|
hasTunnelPort(tunnelId, localPort) {
|
|
44861
45131
|
try {
|
|
44862
|
-
(0,
|
|
45132
|
+
(0, import_node_child_process8.execFileSync)(
|
|
44863
45133
|
"devtunnel",
|
|
44864
45134
|
["port", "show", tunnelId, "-p", String(localPort), "-j"],
|
|
44865
45135
|
{ stdio: "pipe" }
|
|
@@ -44933,10 +45203,10 @@ function createTransport(config) {
|
|
|
44933
45203
|
}
|
|
44934
45204
|
|
|
44935
45205
|
// src/startup.ts
|
|
44936
|
-
var
|
|
44937
|
-
var
|
|
45206
|
+
var fs16 = __toESM(require("fs"), 1);
|
|
45207
|
+
var path17 = __toESM(require("path"), 1);
|
|
44938
45208
|
var readline = __toESM(require("readline/promises"), 1);
|
|
44939
|
-
var
|
|
45209
|
+
var import_node_child_process9 = require("child_process");
|
|
44940
45210
|
function getDefaultNodeName() {
|
|
44941
45211
|
return getDeviceNodeName();
|
|
44942
45212
|
}
|
|
@@ -44983,7 +45253,7 @@ function createPromptSession(prompt) {
|
|
|
44983
45253
|
}
|
|
44984
45254
|
function createDefaultCommandRunner(platform2) {
|
|
44985
45255
|
return (command, args, interactive = false) => {
|
|
44986
|
-
const result = (0,
|
|
45256
|
+
const result = (0, import_node_child_process9.spawnSync)(command, args, {
|
|
44987
45257
|
encoding: "utf-8",
|
|
44988
45258
|
shell: platform2 === "win32",
|
|
44989
45259
|
stdio: interactive ? "inherit" : "pipe"
|
|
@@ -44998,19 +45268,19 @@ function createDefaultCommandRunner(platform2) {
|
|
|
44998
45268
|
};
|
|
44999
45269
|
}
|
|
45000
45270
|
function getNodeMetadataPath2(storagePath) {
|
|
45001
|
-
return
|
|
45271
|
+
return path17.join(storagePath, "metadata.json");
|
|
45002
45272
|
}
|
|
45003
45273
|
function readStartupMetadataFile(storagePath) {
|
|
45004
45274
|
try {
|
|
45005
|
-
const raw = JSON.parse(
|
|
45275
|
+
const raw = JSON.parse(fs16.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
|
|
45006
45276
|
return typeof raw === "object" && raw !== null ? raw : {};
|
|
45007
45277
|
} catch {
|
|
45008
45278
|
return {};
|
|
45009
45279
|
}
|
|
45010
45280
|
}
|
|
45011
45281
|
function writeStartupMetadataFile(storagePath, metadata) {
|
|
45012
|
-
|
|
45013
|
-
|
|
45282
|
+
fs16.mkdirSync(storagePath, { recursive: true });
|
|
45283
|
+
fs16.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
|
|
45014
45284
|
}
|
|
45015
45285
|
function formatLocalDate(now) {
|
|
45016
45286
|
const year = now.getFullYear();
|
|
@@ -45255,9 +45525,9 @@ function parseArgs(argv) {
|
|
|
45255
45525
|
}
|
|
45256
45526
|
return result;
|
|
45257
45527
|
}
|
|
45258
|
-
function loadConfigFile(
|
|
45528
|
+
function loadConfigFile(path19) {
|
|
45259
45529
|
try {
|
|
45260
|
-
const raw =
|
|
45530
|
+
const raw = fs16.readFileSync(path19, "utf-8");
|
|
45261
45531
|
return JSON.parse(raw);
|
|
45262
45532
|
} catch {
|
|
45263
45533
|
return {};
|
|
@@ -45422,26 +45692,26 @@ function formatLoadedStartMetadata(info, authEnabled) {
|
|
|
45422
45692
|
}
|
|
45423
45693
|
|
|
45424
45694
|
// src/runtime-metadata.ts
|
|
45425
|
-
var
|
|
45426
|
-
var
|
|
45427
|
-
var
|
|
45695
|
+
var fs17 = __toESM(require("fs"), 1);
|
|
45696
|
+
var path18 = __toESM(require("path"), 1);
|
|
45697
|
+
var import_node_child_process10 = require("child_process");
|
|
45428
45698
|
var runtimeDir = resolveRuntimeDir();
|
|
45429
45699
|
var appRoot = resolveAppRoot(runtimeDir);
|
|
45430
|
-
var repoRoot =
|
|
45700
|
+
var repoRoot = path18.resolve(appRoot, "../..");
|
|
45431
45701
|
function resolveRuntimeDir() {
|
|
45432
45702
|
const entryPath = process.argv[1];
|
|
45433
45703
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
45434
45704
|
try {
|
|
45435
|
-
return
|
|
45705
|
+
return path18.dirname(fs17.realpathSync(path18.resolve(entryPath)));
|
|
45436
45706
|
} catch {
|
|
45437
|
-
return
|
|
45707
|
+
return path18.dirname(path18.resolve(entryPath));
|
|
45438
45708
|
}
|
|
45439
45709
|
}
|
|
45440
45710
|
return process.cwd();
|
|
45441
45711
|
}
|
|
45442
45712
|
function readJsonFile(filePath) {
|
|
45443
45713
|
try {
|
|
45444
|
-
return JSON.parse(
|
|
45714
|
+
return JSON.parse(fs17.readFileSync(filePath, "utf-8"));
|
|
45445
45715
|
} catch {
|
|
45446
45716
|
return null;
|
|
45447
45717
|
}
|
|
@@ -45451,8 +45721,8 @@ function readPackageManifest(filePath) {
|
|
|
45451
45721
|
}
|
|
45452
45722
|
function readEmbeddedRuntimeMetadata() {
|
|
45453
45723
|
const candidates = [
|
|
45454
|
-
|
|
45455
|
-
|
|
45724
|
+
path18.join(appRoot, "runtime-metadata.json"),
|
|
45725
|
+
path18.join(runtimeDir, "runtime-metadata.json")
|
|
45456
45726
|
];
|
|
45457
45727
|
for (const candidate of candidates) {
|
|
45458
45728
|
const metadata = readJsonFile(candidate);
|
|
@@ -45465,23 +45735,23 @@ function readEmbeddedRuntimeMetadata() {
|
|
|
45465
45735
|
function resolveAppRoot(baseDir) {
|
|
45466
45736
|
const candidates = [
|
|
45467
45737
|
baseDir,
|
|
45468
|
-
|
|
45469
|
-
|
|
45470
|
-
|
|
45738
|
+
path18.resolve(baseDir, ".."),
|
|
45739
|
+
path18.resolve(process.cwd(), "apps/node/dist"),
|
|
45740
|
+
path18.resolve(process.cwd(), "apps/node"),
|
|
45471
45741
|
process.cwd()
|
|
45472
45742
|
];
|
|
45473
45743
|
for (const candidate of candidates) {
|
|
45474
|
-
const manifest = readPackageManifest(
|
|
45744
|
+
const manifest = readPackageManifest(path18.join(candidate, "package.json"));
|
|
45475
45745
|
if (manifest?.name === "@meshy/node" || manifest?.name === "meshy-node") {
|
|
45476
45746
|
return candidate;
|
|
45477
45747
|
}
|
|
45478
45748
|
}
|
|
45479
45749
|
for (const candidate of candidates) {
|
|
45480
|
-
if (
|
|
45750
|
+
if (fs17.existsSync(path18.join(candidate, "package.json"))) {
|
|
45481
45751
|
return candidate;
|
|
45482
45752
|
}
|
|
45483
45753
|
}
|
|
45484
|
-
return
|
|
45754
|
+
return path18.resolve(baseDir, "..");
|
|
45485
45755
|
}
|
|
45486
45756
|
function toPackageInfo(filePath) {
|
|
45487
45757
|
const manifest = readPackageManifest(filePath);
|
|
@@ -45519,7 +45789,7 @@ function readRepositoryUrlFromManifest(manifest) {
|
|
|
45519
45789
|
}
|
|
45520
45790
|
function readGitValue(args) {
|
|
45521
45791
|
try {
|
|
45522
|
-
const output = (0,
|
|
45792
|
+
const output = (0, import_node_child_process10.execFileSync)("git", args, {
|
|
45523
45793
|
cwd: repoRoot,
|
|
45524
45794
|
encoding: "utf-8",
|
|
45525
45795
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -45541,8 +45811,8 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
45541
45811
|
components: startupRequirements.components
|
|
45542
45812
|
};
|
|
45543
45813
|
}
|
|
45544
|
-
const appPackage = toPackageInfo(
|
|
45545
|
-
const workspaceManifest = readPackageManifest(
|
|
45814
|
+
const appPackage = toPackageInfo(path18.join(appRoot, "package.json"));
|
|
45815
|
+
const workspaceManifest = readPackageManifest(path18.join(repoRoot, "package.json"));
|
|
45546
45816
|
return {
|
|
45547
45817
|
packageName: appPackage?.name ?? "meshy",
|
|
45548
45818
|
packageVersion: appPackage?.version ?? "0.1.0",
|
|
@@ -45550,11 +45820,11 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
45550
45820
|
startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
|
|
45551
45821
|
components: startupRequirements.components,
|
|
45552
45822
|
packages: {
|
|
45553
|
-
workspace: toPackageInfo(
|
|
45823
|
+
workspace: toPackageInfo(path18.join(repoRoot, "package.json")),
|
|
45554
45824
|
node: appPackage,
|
|
45555
|
-
core: toPackageInfo(
|
|
45556
|
-
dashboard: toPackageInfo(
|
|
45557
|
-
api: toPackageInfo(
|
|
45825
|
+
core: toPackageInfo(path18.join(repoRoot, "packages/core/package.json")),
|
|
45826
|
+
dashboard: toPackageInfo(path18.join(repoRoot, "packages/dashboard/package.json")),
|
|
45827
|
+
api: toPackageInfo(path18.join(repoRoot, "packages/api/package.json"))
|
|
45558
45828
|
},
|
|
45559
45829
|
repository: {
|
|
45560
45830
|
url: normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.origin.url"])) ?? readRepositoryUrlFromManifest(workspaceManifest),
|
|
@@ -45795,6 +46065,10 @@ async function main() {
|
|
|
45795
46065
|
heartbeat: meshyNode.getHeartbeat(),
|
|
45796
46066
|
eventBus: meshyNode.getEventBus(),
|
|
45797
46067
|
engineRegistry: meshyNode.getEngineRegistry(),
|
|
46068
|
+
liteAgentRunner: new LiteAgentRunner({
|
|
46069
|
+
claudecode: new ClaudeLiteAdapter(),
|
|
46070
|
+
codex: new CodexLiteAdapter()
|
|
46071
|
+
}),
|
|
45798
46072
|
logger: meshyNode.getLogger(),
|
|
45799
46073
|
config: {
|
|
45800
46074
|
apiKey: config.cluster.apiKey,
|