meshy-node 0.6.1 → 0.6.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-SnCGw2xt.js +139 -0
- package/dashboard/assets/DashboardShared-BT6S17Jz.js +83 -0
- package/dashboard/assets/DiffTab-CvU4K64b.js +4 -0
- package/dashboard/assets/FilesTab-BaqQIowl.js +22 -0
- package/dashboard/assets/{PreviewTab-CCBU48Zo.js → PreviewTab-9Mfum0Jt.js} +4 -4
- package/dashboard/assets/SharedConversationPage-BHE9J9Xr.js +7 -0
- package/dashboard/assets/{file-BcPV0uZN.js → file-BS3FucfJ.js} +1 -1
- package/dashboard/assets/{folder-oNa1D_UG.js → folder-Ogzaq0pA.js} +1 -1
- package/dashboard/assets/index-DP2pi2M_.css +1 -0
- package/dashboard/assets/index-JZIFVxcO.js +301 -0
- package/dashboard/assets/{play-BL9B6w0z.js → play-B3eo_tM3.js} +1 -1
- package/dashboard/index.html +2 -2
- package/main.cjs +1352 -594
- package/package.json +1 -1
- package/runtime-metadata.json +5 -5
- package/dashboard/assets/DashboardPage-DphB8foZ.js +0 -134
- package/dashboard/assets/DashboardShared-CLQ9hQ5V.js +0 -82
- package/dashboard/assets/DiffTab-BZNeg4oU.js +0 -4
- package/dashboard/assets/FilesTab-BatUhoVH.js +0 -22
- package/dashboard/assets/SharedConversationPage-BasLb7a1.js +0 -7
- package/dashboard/assets/index-BXsDi4nu.js +0 -301
- package/dashboard/assets/index-CijdiUVq.css +0 -1
package/main.cjs
CHANGED
|
@@ -4649,8 +4649,8 @@ var require_helpers = __commonJS({
|
|
|
4649
4649
|
function req(url, opts = {}) {
|
|
4650
4650
|
const href = typeof url === "string" ? url : url.href;
|
|
4651
4651
|
const req2 = (href.startsWith("https:") ? https2 : http3).request(url, opts);
|
|
4652
|
-
const promise = new Promise((
|
|
4653
|
-
req2.once("response",
|
|
4652
|
+
const promise = new Promise((resolve15, reject) => {
|
|
4653
|
+
req2.once("response", resolve15).once("error", reject).end();
|
|
4654
4654
|
});
|
|
4655
4655
|
req2.then = promise.then.bind(promise);
|
|
4656
4656
|
return req2;
|
|
@@ -4827,7 +4827,7 @@ var require_parse_proxy_response = __commonJS({
|
|
|
4827
4827
|
var debug_1 = __importDefault(require_src());
|
|
4828
4828
|
var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
4829
4829
|
function parseProxyResponse(socket) {
|
|
4830
|
-
return new Promise((
|
|
4830
|
+
return new Promise((resolve15, reject) => {
|
|
4831
4831
|
let buffersLength = 0;
|
|
4832
4832
|
const buffers = [];
|
|
4833
4833
|
function read() {
|
|
@@ -4893,7 +4893,7 @@ var require_parse_proxy_response = __commonJS({
|
|
|
4893
4893
|
}
|
|
4894
4894
|
debug("got proxy server response: %o %o", firstLine, headers);
|
|
4895
4895
|
cleanup();
|
|
4896
|
-
|
|
4896
|
+
resolve15({
|
|
4897
4897
|
connect: {
|
|
4898
4898
|
statusCode,
|
|
4899
4899
|
statusText,
|
|
@@ -5782,8 +5782,8 @@ var init_parseUtil = __esm({
|
|
|
5782
5782
|
init_errors();
|
|
5783
5783
|
init_en();
|
|
5784
5784
|
makeIssue = (params) => {
|
|
5785
|
-
const { data, path:
|
|
5786
|
-
const fullPath = [...
|
|
5785
|
+
const { data, path: path23, errorMaps, issueData } = params;
|
|
5786
|
+
const fullPath = [...path23, ...issueData.path || []];
|
|
5787
5787
|
const fullIssue = {
|
|
5788
5788
|
...issueData,
|
|
5789
5789
|
path: fullPath
|
|
@@ -6094,11 +6094,11 @@ var init_types = __esm({
|
|
|
6094
6094
|
init_parseUtil();
|
|
6095
6095
|
init_util();
|
|
6096
6096
|
ParseInputLazyPath = class {
|
|
6097
|
-
constructor(parent, value,
|
|
6097
|
+
constructor(parent, value, path23, key) {
|
|
6098
6098
|
this._cachedPath = [];
|
|
6099
6099
|
this.parent = parent;
|
|
6100
6100
|
this.data = value;
|
|
6101
|
-
this._path =
|
|
6101
|
+
this._path = path23;
|
|
6102
6102
|
this._key = key;
|
|
6103
6103
|
}
|
|
6104
6104
|
get path() {
|
|
@@ -10739,8 +10739,8 @@ var require_node2 = __commonJS({
|
|
|
10739
10739
|
}
|
|
10740
10740
|
break;
|
|
10741
10741
|
case "FILE":
|
|
10742
|
-
var
|
|
10743
|
-
stream2 = new
|
|
10742
|
+
var fs24 = require("fs");
|
|
10743
|
+
stream2 = new fs24.SyncWriteStream(fd2, { autoClose: false });
|
|
10744
10744
|
stream2._type = "fs";
|
|
10745
10745
|
break;
|
|
10746
10746
|
case "PIPE":
|
|
@@ -14393,10 +14393,10 @@ var require_raw_body = __commonJS({
|
|
|
14393
14393
|
if (done) {
|
|
14394
14394
|
return readStream(stream, encoding, length, limit, wrap(done));
|
|
14395
14395
|
}
|
|
14396
|
-
return new Promise(function executor(
|
|
14396
|
+
return new Promise(function executor(resolve15, reject) {
|
|
14397
14397
|
readStream(stream, encoding, length, limit, function onRead(err, buf) {
|
|
14398
14398
|
if (err) return reject(err);
|
|
14399
|
-
|
|
14399
|
+
resolve15(buf);
|
|
14400
14400
|
});
|
|
14401
14401
|
});
|
|
14402
14402
|
}
|
|
@@ -23480,7 +23480,7 @@ var require_mime_types = __commonJS({
|
|
|
23480
23480
|
"../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js"(exports2) {
|
|
23481
23481
|
"use strict";
|
|
23482
23482
|
var db = require_mime_db();
|
|
23483
|
-
var
|
|
23483
|
+
var extname4 = require("path").extname;
|
|
23484
23484
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
23485
23485
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
23486
23486
|
exports2.charset = charset;
|
|
@@ -23530,11 +23530,11 @@ var require_mime_types = __commonJS({
|
|
|
23530
23530
|
}
|
|
23531
23531
|
return exts[0];
|
|
23532
23532
|
}
|
|
23533
|
-
function lookup(
|
|
23534
|
-
if (!
|
|
23533
|
+
function lookup(path23) {
|
|
23534
|
+
if (!path23 || typeof path23 !== "string") {
|
|
23535
23535
|
return false;
|
|
23536
23536
|
}
|
|
23537
|
-
var extension2 =
|
|
23537
|
+
var extension2 = extname4("x." + path23).toLowerCase().substr(1);
|
|
23538
23538
|
if (!extension2) {
|
|
23539
23539
|
return false;
|
|
23540
23540
|
}
|
|
@@ -27052,7 +27052,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
27052
27052
|
"use strict";
|
|
27053
27053
|
module2.exports = pathToRegexp;
|
|
27054
27054
|
var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
|
|
27055
|
-
function pathToRegexp(
|
|
27055
|
+
function pathToRegexp(path23, keys, options) {
|
|
27056
27056
|
options = options || {};
|
|
27057
27057
|
keys = keys || [];
|
|
27058
27058
|
var strict = options.strict;
|
|
@@ -27066,8 +27066,8 @@ var require_path_to_regexp = __commonJS({
|
|
|
27066
27066
|
var pos = 0;
|
|
27067
27067
|
var backtrack = "";
|
|
27068
27068
|
var m;
|
|
27069
|
-
if (
|
|
27070
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
27069
|
+
if (path23 instanceof RegExp) {
|
|
27070
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path23.source)) {
|
|
27071
27071
|
if (m[0][0] === "\\") continue;
|
|
27072
27072
|
keys.push({
|
|
27073
27073
|
name: m[1] || name2++,
|
|
@@ -27075,18 +27075,18 @@ var require_path_to_regexp = __commonJS({
|
|
|
27075
27075
|
offset: m.index
|
|
27076
27076
|
});
|
|
27077
27077
|
}
|
|
27078
|
-
return
|
|
27078
|
+
return path23;
|
|
27079
27079
|
}
|
|
27080
|
-
if (Array.isArray(
|
|
27081
|
-
|
|
27080
|
+
if (Array.isArray(path23)) {
|
|
27081
|
+
path23 = path23.map(function(value) {
|
|
27082
27082
|
return pathToRegexp(value, keys, options).source;
|
|
27083
27083
|
});
|
|
27084
|
-
return new RegExp(
|
|
27084
|
+
return new RegExp(path23.join("|"), flags);
|
|
27085
27085
|
}
|
|
27086
|
-
if (typeof
|
|
27086
|
+
if (typeof path23 !== "string") {
|
|
27087
27087
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
27088
27088
|
}
|
|
27089
|
-
|
|
27089
|
+
path23 = path23.replace(
|
|
27090
27090
|
/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
|
|
27091
27091
|
function(match, slash, format, key, capture, star, optional2, offset) {
|
|
27092
27092
|
if (match[0] === "\\") {
|
|
@@ -27103,7 +27103,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
27103
27103
|
if (slash || format) {
|
|
27104
27104
|
backtrack = "";
|
|
27105
27105
|
} else {
|
|
27106
|
-
backtrack +=
|
|
27106
|
+
backtrack += path23.slice(pos, offset);
|
|
27107
27107
|
}
|
|
27108
27108
|
pos = offset + match.length;
|
|
27109
27109
|
if (match === "*") {
|
|
@@ -27133,7 +27133,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
27133
27133
|
return result;
|
|
27134
27134
|
}
|
|
27135
27135
|
);
|
|
27136
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
27136
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path23)) {
|
|
27137
27137
|
if (m[0][0] === "\\") continue;
|
|
27138
27138
|
if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
|
|
27139
27139
|
keys.splice(keysOffset + i, 0, {
|
|
@@ -27145,13 +27145,13 @@ var require_path_to_regexp = __commonJS({
|
|
|
27145
27145
|
}
|
|
27146
27146
|
i++;
|
|
27147
27147
|
}
|
|
27148
|
-
|
|
27148
|
+
path23 += strict ? "" : path23[path23.length - 1] === "/" ? "?" : "/?";
|
|
27149
27149
|
if (end) {
|
|
27150
|
-
|
|
27151
|
-
} else if (
|
|
27152
|
-
|
|
27150
|
+
path23 += "$";
|
|
27151
|
+
} else if (path23[path23.length - 1] !== "/") {
|
|
27152
|
+
path23 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
27153
27153
|
}
|
|
27154
|
-
return new RegExp("^" +
|
|
27154
|
+
return new RegExp("^" + path23, flags);
|
|
27155
27155
|
}
|
|
27156
27156
|
}
|
|
27157
27157
|
});
|
|
@@ -27164,19 +27164,19 @@ var require_layer = __commonJS({
|
|
|
27164
27164
|
var debug = require_src2()("express:router:layer");
|
|
27165
27165
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
27166
27166
|
module2.exports = Layer;
|
|
27167
|
-
function Layer(
|
|
27167
|
+
function Layer(path23, options, fn) {
|
|
27168
27168
|
if (!(this instanceof Layer)) {
|
|
27169
|
-
return new Layer(
|
|
27169
|
+
return new Layer(path23, options, fn);
|
|
27170
27170
|
}
|
|
27171
|
-
debug("new %o",
|
|
27171
|
+
debug("new %o", path23);
|
|
27172
27172
|
var opts = options || {};
|
|
27173
27173
|
this.handle = fn;
|
|
27174
27174
|
this.name = fn.name || "<anonymous>";
|
|
27175
27175
|
this.params = void 0;
|
|
27176
27176
|
this.path = void 0;
|
|
27177
|
-
this.regexp = pathRegexp(
|
|
27178
|
-
this.regexp.fast_star =
|
|
27179
|
-
this.regexp.fast_slash =
|
|
27177
|
+
this.regexp = pathRegexp(path23, this.keys = [], opts);
|
|
27178
|
+
this.regexp.fast_star = path23 === "*";
|
|
27179
|
+
this.regexp.fast_slash = path23 === "/" && opts.end === false;
|
|
27180
27180
|
}
|
|
27181
27181
|
Layer.prototype.handle_error = function handle_error(error2, req, res, next) {
|
|
27182
27182
|
var fn = this.handle;
|
|
@@ -27200,20 +27200,20 @@ var require_layer = __commonJS({
|
|
|
27200
27200
|
next(err);
|
|
27201
27201
|
}
|
|
27202
27202
|
};
|
|
27203
|
-
Layer.prototype.match = function match(
|
|
27203
|
+
Layer.prototype.match = function match(path23) {
|
|
27204
27204
|
var match2;
|
|
27205
|
-
if (
|
|
27205
|
+
if (path23 != null) {
|
|
27206
27206
|
if (this.regexp.fast_slash) {
|
|
27207
27207
|
this.params = {};
|
|
27208
27208
|
this.path = "";
|
|
27209
27209
|
return true;
|
|
27210
27210
|
}
|
|
27211
27211
|
if (this.regexp.fast_star) {
|
|
27212
|
-
this.params = { "0": decode_param(
|
|
27213
|
-
this.path =
|
|
27212
|
+
this.params = { "0": decode_param(path23) };
|
|
27213
|
+
this.path = path23;
|
|
27214
27214
|
return true;
|
|
27215
27215
|
}
|
|
27216
|
-
match2 = this.regexp.exec(
|
|
27216
|
+
match2 = this.regexp.exec(path23);
|
|
27217
27217
|
}
|
|
27218
27218
|
if (!match2) {
|
|
27219
27219
|
this.params = void 0;
|
|
@@ -27306,10 +27306,10 @@ var require_route = __commonJS({
|
|
|
27306
27306
|
var slice = Array.prototype.slice;
|
|
27307
27307
|
var toString = Object.prototype.toString;
|
|
27308
27308
|
module2.exports = Route;
|
|
27309
|
-
function Route(
|
|
27310
|
-
this.path =
|
|
27309
|
+
function Route(path23) {
|
|
27310
|
+
this.path = path23;
|
|
27311
27311
|
this.stack = [];
|
|
27312
|
-
debug("new %o",
|
|
27312
|
+
debug("new %o", path23);
|
|
27313
27313
|
this.methods = {};
|
|
27314
27314
|
}
|
|
27315
27315
|
Route.prototype._handles_method = function _handles_method(method) {
|
|
@@ -27522,8 +27522,8 @@ var require_router = __commonJS({
|
|
|
27522
27522
|
if (++sync > 100) {
|
|
27523
27523
|
return setImmediate(next, err);
|
|
27524
27524
|
}
|
|
27525
|
-
var
|
|
27526
|
-
if (
|
|
27525
|
+
var path23 = getPathname(req);
|
|
27526
|
+
if (path23 == null) {
|
|
27527
27527
|
return done(layerError);
|
|
27528
27528
|
}
|
|
27529
27529
|
var layer;
|
|
@@ -27531,7 +27531,7 @@ var require_router = __commonJS({
|
|
|
27531
27531
|
var route;
|
|
27532
27532
|
while (match !== true && idx < stack.length) {
|
|
27533
27533
|
layer = stack[idx++];
|
|
27534
|
-
match = matchLayer(layer,
|
|
27534
|
+
match = matchLayer(layer, path23);
|
|
27535
27535
|
route = layer.route;
|
|
27536
27536
|
if (typeof match !== "boolean") {
|
|
27537
27537
|
layerError = layerError || match;
|
|
@@ -27569,18 +27569,18 @@ var require_router = __commonJS({
|
|
|
27569
27569
|
} else if (route) {
|
|
27570
27570
|
layer.handle_request(req, res, next);
|
|
27571
27571
|
} else {
|
|
27572
|
-
trim_prefix(layer, layerError, layerPath,
|
|
27572
|
+
trim_prefix(layer, layerError, layerPath, path23);
|
|
27573
27573
|
}
|
|
27574
27574
|
sync = 0;
|
|
27575
27575
|
});
|
|
27576
27576
|
}
|
|
27577
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
27577
|
+
function trim_prefix(layer, layerError, layerPath, path23) {
|
|
27578
27578
|
if (layerPath.length !== 0) {
|
|
27579
|
-
if (layerPath !==
|
|
27579
|
+
if (layerPath !== path23.slice(0, layerPath.length)) {
|
|
27580
27580
|
next(layerError);
|
|
27581
27581
|
return;
|
|
27582
27582
|
}
|
|
27583
|
-
var c =
|
|
27583
|
+
var c = path23[layerPath.length];
|
|
27584
27584
|
if (c && c !== "/" && c !== ".") return next(layerError);
|
|
27585
27585
|
debug("trim prefix (%s) from url %s", layerPath, req.url);
|
|
27586
27586
|
removed = layerPath;
|
|
@@ -27658,7 +27658,7 @@ var require_router = __commonJS({
|
|
|
27658
27658
|
};
|
|
27659
27659
|
proto.use = function use(fn) {
|
|
27660
27660
|
var offset = 0;
|
|
27661
|
-
var
|
|
27661
|
+
var path23 = "/";
|
|
27662
27662
|
if (typeof fn !== "function") {
|
|
27663
27663
|
var arg = fn;
|
|
27664
27664
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -27666,7 +27666,7 @@ var require_router = __commonJS({
|
|
|
27666
27666
|
}
|
|
27667
27667
|
if (typeof arg !== "function") {
|
|
27668
27668
|
offset = 1;
|
|
27669
|
-
|
|
27669
|
+
path23 = fn;
|
|
27670
27670
|
}
|
|
27671
27671
|
}
|
|
27672
27672
|
var callbacks = flatten(slice.call(arguments, offset));
|
|
@@ -27678,8 +27678,8 @@ var require_router = __commonJS({
|
|
|
27678
27678
|
if (typeof fn !== "function") {
|
|
27679
27679
|
throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
|
|
27680
27680
|
}
|
|
27681
|
-
debug("use %o %s",
|
|
27682
|
-
var layer = new Layer(
|
|
27681
|
+
debug("use %o %s", path23, fn.name || "<anonymous>");
|
|
27682
|
+
var layer = new Layer(path23, {
|
|
27683
27683
|
sensitive: this.caseSensitive,
|
|
27684
27684
|
strict: false,
|
|
27685
27685
|
end: false
|
|
@@ -27689,9 +27689,9 @@ var require_router = __commonJS({
|
|
|
27689
27689
|
}
|
|
27690
27690
|
return this;
|
|
27691
27691
|
};
|
|
27692
|
-
proto.route = function route(
|
|
27693
|
-
var route2 = new Route(
|
|
27694
|
-
var layer = new Layer(
|
|
27692
|
+
proto.route = function route(path23) {
|
|
27693
|
+
var route2 = new Route(path23);
|
|
27694
|
+
var layer = new Layer(path23, {
|
|
27695
27695
|
sensitive: this.caseSensitive,
|
|
27696
27696
|
strict: this.strict,
|
|
27697
27697
|
end: true
|
|
@@ -27701,8 +27701,8 @@ var require_router = __commonJS({
|
|
|
27701
27701
|
return route2;
|
|
27702
27702
|
};
|
|
27703
27703
|
methods.concat("all").forEach(function(method) {
|
|
27704
|
-
proto[method] = function(
|
|
27705
|
-
var route = this.route(
|
|
27704
|
+
proto[method] = function(path23) {
|
|
27705
|
+
var route = this.route(path23);
|
|
27706
27706
|
route[method].apply(route, slice.call(arguments, 1));
|
|
27707
27707
|
return this;
|
|
27708
27708
|
};
|
|
@@ -27738,9 +27738,9 @@ var require_router = __commonJS({
|
|
|
27738
27738
|
}
|
|
27739
27739
|
return toString.call(obj).replace(objectRegExp, "$1");
|
|
27740
27740
|
}
|
|
27741
|
-
function matchLayer(layer,
|
|
27741
|
+
function matchLayer(layer, path23) {
|
|
27742
27742
|
try {
|
|
27743
|
-
return layer.match(
|
|
27743
|
+
return layer.match(path23);
|
|
27744
27744
|
} catch (err) {
|
|
27745
27745
|
return err;
|
|
27746
27746
|
}
|
|
@@ -27858,18 +27858,18 @@ var require_view = __commonJS({
|
|
|
27858
27858
|
"../../node_modules/.pnpm/express@4.22.1/node_modules/express/lib/view.js"(exports2, module2) {
|
|
27859
27859
|
"use strict";
|
|
27860
27860
|
var debug = require_src2()("express:view");
|
|
27861
|
-
var
|
|
27862
|
-
var
|
|
27863
|
-
var dirname7 =
|
|
27864
|
-
var basename5 =
|
|
27865
|
-
var
|
|
27866
|
-
var
|
|
27867
|
-
var
|
|
27861
|
+
var path23 = require("path");
|
|
27862
|
+
var fs24 = require("fs");
|
|
27863
|
+
var dirname7 = path23.dirname;
|
|
27864
|
+
var basename5 = path23.basename;
|
|
27865
|
+
var extname4 = path23.extname;
|
|
27866
|
+
var join17 = path23.join;
|
|
27867
|
+
var resolve15 = path23.resolve;
|
|
27868
27868
|
module2.exports = View;
|
|
27869
27869
|
function View(name2, options) {
|
|
27870
27870
|
var opts = options || {};
|
|
27871
27871
|
this.defaultEngine = opts.defaultEngine;
|
|
27872
|
-
this.ext =
|
|
27872
|
+
this.ext = extname4(name2);
|
|
27873
27873
|
this.name = name2;
|
|
27874
27874
|
this.root = opts.root;
|
|
27875
27875
|
if (!this.ext && !this.defaultEngine) {
|
|
@@ -27893,39 +27893,39 @@ var require_view = __commonJS({
|
|
|
27893
27893
|
this.path = this.lookup(fileName);
|
|
27894
27894
|
}
|
|
27895
27895
|
View.prototype.lookup = function lookup(name2) {
|
|
27896
|
-
var
|
|
27896
|
+
var path24;
|
|
27897
27897
|
var roots = [].concat(this.root);
|
|
27898
27898
|
debug('lookup "%s"', name2);
|
|
27899
|
-
for (var i = 0; i < roots.length && !
|
|
27899
|
+
for (var i = 0; i < roots.length && !path24; i++) {
|
|
27900
27900
|
var root = roots[i];
|
|
27901
|
-
var loc =
|
|
27901
|
+
var loc = resolve15(root, name2);
|
|
27902
27902
|
var dir = dirname7(loc);
|
|
27903
27903
|
var file = basename5(loc);
|
|
27904
|
-
|
|
27904
|
+
path24 = this.resolve(dir, file);
|
|
27905
27905
|
}
|
|
27906
|
-
return
|
|
27906
|
+
return path24;
|
|
27907
27907
|
};
|
|
27908
27908
|
View.prototype.render = function render(options, callback) {
|
|
27909
27909
|
debug('render "%s"', this.path);
|
|
27910
27910
|
this.engine(this.path, options, callback);
|
|
27911
27911
|
};
|
|
27912
|
-
View.prototype.resolve = function
|
|
27912
|
+
View.prototype.resolve = function resolve16(dir, file) {
|
|
27913
27913
|
var ext = this.ext;
|
|
27914
|
-
var
|
|
27915
|
-
var stat = tryStat(
|
|
27914
|
+
var path24 = join17(dir, file);
|
|
27915
|
+
var stat = tryStat(path24);
|
|
27916
27916
|
if (stat && stat.isFile()) {
|
|
27917
|
-
return
|
|
27917
|
+
return path24;
|
|
27918
27918
|
}
|
|
27919
|
-
|
|
27920
|
-
stat = tryStat(
|
|
27919
|
+
path24 = join17(dir, basename5(file, ext), "index" + ext);
|
|
27920
|
+
stat = tryStat(path24);
|
|
27921
27921
|
if (stat && stat.isFile()) {
|
|
27922
|
-
return
|
|
27922
|
+
return path24;
|
|
27923
27923
|
}
|
|
27924
27924
|
};
|
|
27925
|
-
function tryStat(
|
|
27926
|
-
debug('stat "%s"',
|
|
27925
|
+
function tryStat(path24) {
|
|
27926
|
+
debug('stat "%s"', path24);
|
|
27927
27927
|
try {
|
|
27928
|
-
return
|
|
27928
|
+
return fs24.statSync(path24);
|
|
27929
27929
|
} catch (e) {
|
|
27930
27930
|
return void 0;
|
|
27931
27931
|
}
|
|
@@ -28222,8 +28222,8 @@ var require_types = __commonJS({
|
|
|
28222
28222
|
var require_mime = __commonJS({
|
|
28223
28223
|
"../../node_modules/.pnpm/mime@1.6.0/node_modules/mime/mime.js"(exports2, module2) {
|
|
28224
28224
|
"use strict";
|
|
28225
|
-
var
|
|
28226
|
-
var
|
|
28225
|
+
var path23 = require("path");
|
|
28226
|
+
var fs24 = require("fs");
|
|
28227
28227
|
function Mime() {
|
|
28228
28228
|
this.types = /* @__PURE__ */ Object.create(null);
|
|
28229
28229
|
this.extensions = /* @__PURE__ */ Object.create(null);
|
|
@@ -28244,7 +28244,7 @@ var require_mime = __commonJS({
|
|
|
28244
28244
|
};
|
|
28245
28245
|
Mime.prototype.load = function(file) {
|
|
28246
28246
|
this._loading = file;
|
|
28247
|
-
var map = {}, content =
|
|
28247
|
+
var map = {}, content = fs24.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
|
|
28248
28248
|
lines.forEach(function(line) {
|
|
28249
28249
|
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
|
|
28250
28250
|
map[fields.shift()] = fields;
|
|
@@ -28252,8 +28252,8 @@ var require_mime = __commonJS({
|
|
|
28252
28252
|
this.define(map);
|
|
28253
28253
|
this._loading = null;
|
|
28254
28254
|
};
|
|
28255
|
-
Mime.prototype.lookup = function(
|
|
28256
|
-
var ext =
|
|
28255
|
+
Mime.prototype.lookup = function(path24, fallback) {
|
|
28256
|
+
var ext = path24.replace(/^.*[\.\/\\]/, "").toLowerCase();
|
|
28257
28257
|
return this.types[ext] || fallback || this.default_type;
|
|
28258
28258
|
};
|
|
28259
28259
|
Mime.prototype.extension = function(mimeType) {
|
|
@@ -28366,33 +28366,33 @@ var require_send = __commonJS({
|
|
|
28366
28366
|
var escapeHtml2 = require_escape_html();
|
|
28367
28367
|
var etag = require_etag();
|
|
28368
28368
|
var fresh = require_fresh();
|
|
28369
|
-
var
|
|
28369
|
+
var fs24 = require("fs");
|
|
28370
28370
|
var mime = require_mime();
|
|
28371
28371
|
var ms = require_ms();
|
|
28372
28372
|
var onFinished = require_on_finished();
|
|
28373
28373
|
var parseRange = require_range_parser();
|
|
28374
|
-
var
|
|
28374
|
+
var path23 = require("path");
|
|
28375
28375
|
var statuses = require_statuses();
|
|
28376
28376
|
var Stream = require("stream");
|
|
28377
28377
|
var util3 = require("util");
|
|
28378
|
-
var
|
|
28379
|
-
var
|
|
28380
|
-
var normalize =
|
|
28381
|
-
var
|
|
28382
|
-
var sep5 =
|
|
28378
|
+
var extname4 = path23.extname;
|
|
28379
|
+
var join17 = path23.join;
|
|
28380
|
+
var normalize = path23.normalize;
|
|
28381
|
+
var resolve15 = path23.resolve;
|
|
28382
|
+
var sep5 = path23.sep;
|
|
28383
28383
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
28384
28384
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
28385
28385
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
28386
28386
|
module2.exports = send;
|
|
28387
28387
|
module2.exports.mime = mime;
|
|
28388
|
-
function send(req,
|
|
28389
|
-
return new SendStream(req,
|
|
28388
|
+
function send(req, path24, options) {
|
|
28389
|
+
return new SendStream(req, path24, options);
|
|
28390
28390
|
}
|
|
28391
|
-
function SendStream(req,
|
|
28391
|
+
function SendStream(req, path24, options) {
|
|
28392
28392
|
Stream.call(this);
|
|
28393
28393
|
var opts = options || {};
|
|
28394
28394
|
this.options = opts;
|
|
28395
|
-
this.path =
|
|
28395
|
+
this.path = path24;
|
|
28396
28396
|
this.req = req;
|
|
28397
28397
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
28398
28398
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -28415,7 +28415,7 @@ var require_send = __commonJS({
|
|
|
28415
28415
|
this._maxage = opts.maxAge || opts.maxage;
|
|
28416
28416
|
this._maxage = typeof this._maxage === "string" ? ms(this._maxage) : Number(this._maxage);
|
|
28417
28417
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
28418
|
-
this._root = opts.root ?
|
|
28418
|
+
this._root = opts.root ? resolve15(opts.root) : null;
|
|
28419
28419
|
if (!this._root && opts.from) {
|
|
28420
28420
|
this.from(opts.from);
|
|
28421
28421
|
}
|
|
@@ -28438,8 +28438,8 @@ var require_send = __commonJS({
|
|
|
28438
28438
|
this._index = index2;
|
|
28439
28439
|
return this;
|
|
28440
28440
|
}, "send.index: pass index as option");
|
|
28441
|
-
SendStream.prototype.root = function root(
|
|
28442
|
-
this._root =
|
|
28441
|
+
SendStream.prototype.root = function root(path24) {
|
|
28442
|
+
this._root = resolve15(String(path24));
|
|
28443
28443
|
debug("root %s", this._root);
|
|
28444
28444
|
return this;
|
|
28445
28445
|
};
|
|
@@ -28552,10 +28552,10 @@ var require_send = __commonJS({
|
|
|
28552
28552
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
28553
28553
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
28554
28554
|
};
|
|
28555
|
-
SendStream.prototype.redirect = function redirect(
|
|
28555
|
+
SendStream.prototype.redirect = function redirect(path24) {
|
|
28556
28556
|
var res = this.res;
|
|
28557
28557
|
if (hasListeners(this, "directory")) {
|
|
28558
|
-
this.emit("directory", res,
|
|
28558
|
+
this.emit("directory", res, path24);
|
|
28559
28559
|
return;
|
|
28560
28560
|
}
|
|
28561
28561
|
if (this.hasTrailingSlash()) {
|
|
@@ -28575,42 +28575,42 @@ var require_send = __commonJS({
|
|
|
28575
28575
|
SendStream.prototype.pipe = function pipe2(res) {
|
|
28576
28576
|
var root = this._root;
|
|
28577
28577
|
this.res = res;
|
|
28578
|
-
var
|
|
28579
|
-
if (
|
|
28578
|
+
var path24 = decode(this.path);
|
|
28579
|
+
if (path24 === -1) {
|
|
28580
28580
|
this.error(400);
|
|
28581
28581
|
return res;
|
|
28582
28582
|
}
|
|
28583
|
-
if (~
|
|
28583
|
+
if (~path24.indexOf("\0")) {
|
|
28584
28584
|
this.error(400);
|
|
28585
28585
|
return res;
|
|
28586
28586
|
}
|
|
28587
28587
|
var parts;
|
|
28588
28588
|
if (root !== null) {
|
|
28589
|
-
if (
|
|
28590
|
-
|
|
28589
|
+
if (path24) {
|
|
28590
|
+
path24 = normalize("." + sep5 + path24);
|
|
28591
28591
|
}
|
|
28592
|
-
if (UP_PATH_REGEXP.test(
|
|
28593
|
-
debug('malicious path "%s"',
|
|
28592
|
+
if (UP_PATH_REGEXP.test(path24)) {
|
|
28593
|
+
debug('malicious path "%s"', path24);
|
|
28594
28594
|
this.error(403);
|
|
28595
28595
|
return res;
|
|
28596
28596
|
}
|
|
28597
|
-
parts =
|
|
28598
|
-
|
|
28597
|
+
parts = path24.split(sep5);
|
|
28598
|
+
path24 = normalize(join17(root, path24));
|
|
28599
28599
|
} else {
|
|
28600
|
-
if (UP_PATH_REGEXP.test(
|
|
28601
|
-
debug('malicious path "%s"',
|
|
28600
|
+
if (UP_PATH_REGEXP.test(path24)) {
|
|
28601
|
+
debug('malicious path "%s"', path24);
|
|
28602
28602
|
this.error(403);
|
|
28603
28603
|
return res;
|
|
28604
28604
|
}
|
|
28605
|
-
parts = normalize(
|
|
28606
|
-
|
|
28605
|
+
parts = normalize(path24).split(sep5);
|
|
28606
|
+
path24 = resolve15(path24);
|
|
28607
28607
|
}
|
|
28608
28608
|
if (containsDotFile(parts)) {
|
|
28609
28609
|
var access = this._dotfiles;
|
|
28610
28610
|
if (access === void 0) {
|
|
28611
28611
|
access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
|
|
28612
28612
|
}
|
|
28613
|
-
debug('%s dotfile "%s"', access,
|
|
28613
|
+
debug('%s dotfile "%s"', access, path24);
|
|
28614
28614
|
switch (access) {
|
|
28615
28615
|
case "allow":
|
|
28616
28616
|
break;
|
|
@@ -28624,13 +28624,13 @@ var require_send = __commonJS({
|
|
|
28624
28624
|
}
|
|
28625
28625
|
}
|
|
28626
28626
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
28627
|
-
this.sendIndex(
|
|
28627
|
+
this.sendIndex(path24);
|
|
28628
28628
|
return res;
|
|
28629
28629
|
}
|
|
28630
|
-
this.sendFile(
|
|
28630
|
+
this.sendFile(path24);
|
|
28631
28631
|
return res;
|
|
28632
28632
|
};
|
|
28633
|
-
SendStream.prototype.send = function send2(
|
|
28633
|
+
SendStream.prototype.send = function send2(path24, stat) {
|
|
28634
28634
|
var len = stat.size;
|
|
28635
28635
|
var options = this.options;
|
|
28636
28636
|
var opts = {};
|
|
@@ -28642,9 +28642,9 @@ var require_send = __commonJS({
|
|
|
28642
28642
|
this.headersAlreadySent();
|
|
28643
28643
|
return;
|
|
28644
28644
|
}
|
|
28645
|
-
debug('pipe "%s"',
|
|
28646
|
-
this.setHeader(
|
|
28647
|
-
this.type(
|
|
28645
|
+
debug('pipe "%s"', path24);
|
|
28646
|
+
this.setHeader(path24, stat);
|
|
28647
|
+
this.type(path24);
|
|
28648
28648
|
if (this.isConditionalGET()) {
|
|
28649
28649
|
if (this.isPreconditionFailure()) {
|
|
28650
28650
|
this.error(412);
|
|
@@ -28693,28 +28693,28 @@ var require_send = __commonJS({
|
|
|
28693
28693
|
res.end();
|
|
28694
28694
|
return;
|
|
28695
28695
|
}
|
|
28696
|
-
this.stream(
|
|
28696
|
+
this.stream(path24, opts);
|
|
28697
28697
|
};
|
|
28698
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
28698
|
+
SendStream.prototype.sendFile = function sendFile(path24) {
|
|
28699
28699
|
var i = 0;
|
|
28700
28700
|
var self2 = this;
|
|
28701
|
-
debug('stat "%s"',
|
|
28702
|
-
|
|
28703
|
-
if (err && err.code === "ENOENT" && !
|
|
28701
|
+
debug('stat "%s"', path24);
|
|
28702
|
+
fs24.stat(path24, function onstat(err, stat) {
|
|
28703
|
+
if (err && err.code === "ENOENT" && !extname4(path24) && path24[path24.length - 1] !== sep5) {
|
|
28704
28704
|
return next(err);
|
|
28705
28705
|
}
|
|
28706
28706
|
if (err) return self2.onStatError(err);
|
|
28707
|
-
if (stat.isDirectory()) return self2.redirect(
|
|
28708
|
-
self2.emit("file",
|
|
28709
|
-
self2.send(
|
|
28707
|
+
if (stat.isDirectory()) return self2.redirect(path24);
|
|
28708
|
+
self2.emit("file", path24, stat);
|
|
28709
|
+
self2.send(path24, stat);
|
|
28710
28710
|
});
|
|
28711
28711
|
function next(err) {
|
|
28712
28712
|
if (self2._extensions.length <= i) {
|
|
28713
28713
|
return err ? self2.onStatError(err) : self2.error(404);
|
|
28714
28714
|
}
|
|
28715
|
-
var p =
|
|
28715
|
+
var p = path24 + "." + self2._extensions[i++];
|
|
28716
28716
|
debug('stat "%s"', p);
|
|
28717
|
-
|
|
28717
|
+
fs24.stat(p, function(err2, stat) {
|
|
28718
28718
|
if (err2) return next(err2);
|
|
28719
28719
|
if (stat.isDirectory()) return next();
|
|
28720
28720
|
self2.emit("file", p, stat);
|
|
@@ -28722,7 +28722,7 @@ var require_send = __commonJS({
|
|
|
28722
28722
|
});
|
|
28723
28723
|
}
|
|
28724
28724
|
};
|
|
28725
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
28725
|
+
SendStream.prototype.sendIndex = function sendIndex(path24) {
|
|
28726
28726
|
var i = -1;
|
|
28727
28727
|
var self2 = this;
|
|
28728
28728
|
function next(err) {
|
|
@@ -28730,9 +28730,9 @@ var require_send = __commonJS({
|
|
|
28730
28730
|
if (err) return self2.onStatError(err);
|
|
28731
28731
|
return self2.error(404);
|
|
28732
28732
|
}
|
|
28733
|
-
var p =
|
|
28733
|
+
var p = join17(path24, self2._index[i]);
|
|
28734
28734
|
debug('stat "%s"', p);
|
|
28735
|
-
|
|
28735
|
+
fs24.stat(p, function(err2, stat) {
|
|
28736
28736
|
if (err2) return next(err2);
|
|
28737
28737
|
if (stat.isDirectory()) return next();
|
|
28738
28738
|
self2.emit("file", p, stat);
|
|
@@ -28741,10 +28741,10 @@ var require_send = __commonJS({
|
|
|
28741
28741
|
}
|
|
28742
28742
|
next();
|
|
28743
28743
|
};
|
|
28744
|
-
SendStream.prototype.stream = function stream(
|
|
28744
|
+
SendStream.prototype.stream = function stream(path24, options) {
|
|
28745
28745
|
var self2 = this;
|
|
28746
28746
|
var res = this.res;
|
|
28747
|
-
var stream2 =
|
|
28747
|
+
var stream2 = fs24.createReadStream(path24, options);
|
|
28748
28748
|
this.emit("stream", stream2);
|
|
28749
28749
|
stream2.pipe(res);
|
|
28750
28750
|
function cleanup() {
|
|
@@ -28759,10 +28759,10 @@ var require_send = __commonJS({
|
|
|
28759
28759
|
self2.emit("end");
|
|
28760
28760
|
});
|
|
28761
28761
|
};
|
|
28762
|
-
SendStream.prototype.type = function type(
|
|
28762
|
+
SendStream.prototype.type = function type(path24) {
|
|
28763
28763
|
var res = this.res;
|
|
28764
28764
|
if (res.getHeader("Content-Type")) return;
|
|
28765
|
-
var type2 = mime.lookup(
|
|
28765
|
+
var type2 = mime.lookup(path24);
|
|
28766
28766
|
if (!type2) {
|
|
28767
28767
|
debug("no content-type");
|
|
28768
28768
|
return;
|
|
@@ -28771,9 +28771,9 @@ var require_send = __commonJS({
|
|
|
28771
28771
|
debug("content-type %s", type2);
|
|
28772
28772
|
res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
|
|
28773
28773
|
};
|
|
28774
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
28774
|
+
SendStream.prototype.setHeader = function setHeader(path24, stat) {
|
|
28775
28775
|
var res = this.res;
|
|
28776
|
-
this.emit("headers", res,
|
|
28776
|
+
this.emit("headers", res, path24, stat);
|
|
28777
28777
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
28778
28778
|
debug("accept ranges");
|
|
28779
28779
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -28832,9 +28832,9 @@ var require_send = __commonJS({
|
|
|
28832
28832
|
}
|
|
28833
28833
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
28834
28834
|
}
|
|
28835
|
-
function decode(
|
|
28835
|
+
function decode(path24) {
|
|
28836
28836
|
try {
|
|
28837
|
-
return decodeURIComponent(
|
|
28837
|
+
return decodeURIComponent(path24);
|
|
28838
28838
|
} catch (err) {
|
|
28839
28839
|
return -1;
|
|
28840
28840
|
}
|
|
@@ -29744,10 +29744,10 @@ var require_utils2 = __commonJS({
|
|
|
29744
29744
|
var querystring = require("querystring");
|
|
29745
29745
|
exports2.etag = createETagGenerator({ weak: false });
|
|
29746
29746
|
exports2.wetag = createETagGenerator({ weak: true });
|
|
29747
|
-
exports2.isAbsolute = function(
|
|
29748
|
-
if ("/" ===
|
|
29749
|
-
if (":" ===
|
|
29750
|
-
if ("\\\\" ===
|
|
29747
|
+
exports2.isAbsolute = function(path23) {
|
|
29748
|
+
if ("/" === path23[0]) return true;
|
|
29749
|
+
if (":" === path23[1] && ("\\" === path23[2] || "/" === path23[2])) return true;
|
|
29750
|
+
if ("\\\\" === path23.substring(0, 2)) return true;
|
|
29751
29751
|
};
|
|
29752
29752
|
exports2.flatten = deprecate.function(
|
|
29753
29753
|
flatten,
|
|
@@ -29883,7 +29883,7 @@ var require_application = __commonJS({
|
|
|
29883
29883
|
var deprecate = require_depd()("express");
|
|
29884
29884
|
var flatten = require_array_flatten();
|
|
29885
29885
|
var merge2 = require_utils_merge();
|
|
29886
|
-
var
|
|
29886
|
+
var resolve15 = require("path").resolve;
|
|
29887
29887
|
var setPrototypeOf = require_setprototypeof();
|
|
29888
29888
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
29889
29889
|
var slice = Array.prototype.slice;
|
|
@@ -29922,7 +29922,7 @@ var require_application = __commonJS({
|
|
|
29922
29922
|
this.mountpath = "/";
|
|
29923
29923
|
this.locals.settings = this.settings;
|
|
29924
29924
|
this.set("view", View);
|
|
29925
|
-
this.set("views",
|
|
29925
|
+
this.set("views", resolve15("views"));
|
|
29926
29926
|
this.set("jsonp callback name", "callback");
|
|
29927
29927
|
if (env === "production") {
|
|
29928
29928
|
this.enable("view cache");
|
|
@@ -29958,7 +29958,7 @@ var require_application = __commonJS({
|
|
|
29958
29958
|
};
|
|
29959
29959
|
app.use = function use(fn) {
|
|
29960
29960
|
var offset = 0;
|
|
29961
|
-
var
|
|
29961
|
+
var path23 = "/";
|
|
29962
29962
|
if (typeof fn !== "function") {
|
|
29963
29963
|
var arg = fn;
|
|
29964
29964
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -29966,7 +29966,7 @@ var require_application = __commonJS({
|
|
|
29966
29966
|
}
|
|
29967
29967
|
if (typeof arg !== "function") {
|
|
29968
29968
|
offset = 1;
|
|
29969
|
-
|
|
29969
|
+
path23 = fn;
|
|
29970
29970
|
}
|
|
29971
29971
|
}
|
|
29972
29972
|
var fns = flatten(slice.call(arguments, offset));
|
|
@@ -29977,12 +29977,12 @@ var require_application = __commonJS({
|
|
|
29977
29977
|
var router = this._router;
|
|
29978
29978
|
fns.forEach(function(fn2) {
|
|
29979
29979
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
29980
|
-
return router.use(
|
|
29980
|
+
return router.use(path23, fn2);
|
|
29981
29981
|
}
|
|
29982
|
-
debug(".use app under %s",
|
|
29983
|
-
fn2.mountpath =
|
|
29982
|
+
debug(".use app under %s", path23);
|
|
29983
|
+
fn2.mountpath = path23;
|
|
29984
29984
|
fn2.parent = this;
|
|
29985
|
-
router.use(
|
|
29985
|
+
router.use(path23, function mounted_app(req, res, next) {
|
|
29986
29986
|
var orig = req.app;
|
|
29987
29987
|
fn2.handle(req, res, function(err) {
|
|
29988
29988
|
setPrototypeOf(req, orig.request);
|
|
@@ -29994,9 +29994,9 @@ var require_application = __commonJS({
|
|
|
29994
29994
|
}, this);
|
|
29995
29995
|
return this;
|
|
29996
29996
|
};
|
|
29997
|
-
app.route = function route(
|
|
29997
|
+
app.route = function route(path23) {
|
|
29998
29998
|
this.lazyrouter();
|
|
29999
|
-
return this._router.route(
|
|
29999
|
+
return this._router.route(path23);
|
|
30000
30000
|
};
|
|
30001
30001
|
app.engine = function engine(ext, fn) {
|
|
30002
30002
|
if (typeof fn !== "function") {
|
|
@@ -30047,7 +30047,7 @@ var require_application = __commonJS({
|
|
|
30047
30047
|
}
|
|
30048
30048
|
return this;
|
|
30049
30049
|
};
|
|
30050
|
-
app.path = function
|
|
30050
|
+
app.path = function path23() {
|
|
30051
30051
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
30052
30052
|
};
|
|
30053
30053
|
app.enabled = function enabled2(setting) {
|
|
@@ -30063,19 +30063,19 @@ var require_application = __commonJS({
|
|
|
30063
30063
|
return this.set(setting, false);
|
|
30064
30064
|
};
|
|
30065
30065
|
methods.forEach(function(method) {
|
|
30066
|
-
app[method] = function(
|
|
30066
|
+
app[method] = function(path23) {
|
|
30067
30067
|
if (method === "get" && arguments.length === 1) {
|
|
30068
|
-
return this.set(
|
|
30068
|
+
return this.set(path23);
|
|
30069
30069
|
}
|
|
30070
30070
|
this.lazyrouter();
|
|
30071
|
-
var route = this._router.route(
|
|
30071
|
+
var route = this._router.route(path23);
|
|
30072
30072
|
route[method].apply(route, slice.call(arguments, 1));
|
|
30073
30073
|
return this;
|
|
30074
30074
|
};
|
|
30075
30075
|
});
|
|
30076
|
-
app.all = function all(
|
|
30076
|
+
app.all = function all(path23) {
|
|
30077
30077
|
this.lazyrouter();
|
|
30078
|
-
var route = this._router.route(
|
|
30078
|
+
var route = this._router.route(path23);
|
|
30079
30079
|
var args = slice.call(arguments, 1);
|
|
30080
30080
|
for (var i = 0; i < methods.length; i++) {
|
|
30081
30081
|
route[methods[i]].apply(route, args);
|
|
@@ -30834,7 +30834,7 @@ var require_request = __commonJS({
|
|
|
30834
30834
|
var subdomains2 = !isIP(hostname4) ? hostname4.split(".").reverse() : [hostname4];
|
|
30835
30835
|
return subdomains2.slice(offset);
|
|
30836
30836
|
});
|
|
30837
|
-
defineGetter(req, "path", function
|
|
30837
|
+
defineGetter(req, "path", function path23() {
|
|
30838
30838
|
return parse3(this).pathname;
|
|
30839
30839
|
});
|
|
30840
30840
|
defineGetter(req, "hostname", function hostname4() {
|
|
@@ -31157,7 +31157,7 @@ var require_response = __commonJS({
|
|
|
31157
31157
|
var http3 = require("http");
|
|
31158
31158
|
var isAbsolute5 = require_utils2().isAbsolute;
|
|
31159
31159
|
var onFinished = require_on_finished();
|
|
31160
|
-
var
|
|
31160
|
+
var path23 = require("path");
|
|
31161
31161
|
var statuses = require_statuses();
|
|
31162
31162
|
var merge2 = require_utils_merge();
|
|
31163
31163
|
var sign = require_cookie_signature().sign;
|
|
@@ -31166,9 +31166,9 @@ var require_response = __commonJS({
|
|
|
31166
31166
|
var setCharset = require_utils2().setCharset;
|
|
31167
31167
|
var cookie = require_cookie();
|
|
31168
31168
|
var send = require_send();
|
|
31169
|
-
var
|
|
31169
|
+
var extname4 = path23.extname;
|
|
31170
31170
|
var mime = send.mime;
|
|
31171
|
-
var
|
|
31171
|
+
var resolve15 = path23.resolve;
|
|
31172
31172
|
var vary = require_vary();
|
|
31173
31173
|
var res = Object.create(http3.ServerResponse.prototype);
|
|
31174
31174
|
module2.exports = res;
|
|
@@ -31345,26 +31345,26 @@ var require_response = __commonJS({
|
|
|
31345
31345
|
this.type("txt");
|
|
31346
31346
|
return this.send(body);
|
|
31347
31347
|
};
|
|
31348
|
-
res.sendFile = function sendFile(
|
|
31348
|
+
res.sendFile = function sendFile(path24, options, callback) {
|
|
31349
31349
|
var done = callback;
|
|
31350
31350
|
var req = this.req;
|
|
31351
31351
|
var res2 = this;
|
|
31352
31352
|
var next = req.next;
|
|
31353
31353
|
var opts = options || {};
|
|
31354
|
-
if (!
|
|
31354
|
+
if (!path24) {
|
|
31355
31355
|
throw new TypeError("path argument is required to res.sendFile");
|
|
31356
31356
|
}
|
|
31357
|
-
if (typeof
|
|
31357
|
+
if (typeof path24 !== "string") {
|
|
31358
31358
|
throw new TypeError("path must be a string to res.sendFile");
|
|
31359
31359
|
}
|
|
31360
31360
|
if (typeof options === "function") {
|
|
31361
31361
|
done = options;
|
|
31362
31362
|
opts = {};
|
|
31363
31363
|
}
|
|
31364
|
-
if (!opts.root && !isAbsolute5(
|
|
31364
|
+
if (!opts.root && !isAbsolute5(path24)) {
|
|
31365
31365
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
31366
31366
|
}
|
|
31367
|
-
var pathname = encodeURI(
|
|
31367
|
+
var pathname = encodeURI(path24);
|
|
31368
31368
|
var file = send(req, pathname, opts);
|
|
31369
31369
|
sendfile(res2, file, opts, function(err) {
|
|
31370
31370
|
if (done) return done(err);
|
|
@@ -31374,7 +31374,7 @@ var require_response = __commonJS({
|
|
|
31374
31374
|
}
|
|
31375
31375
|
});
|
|
31376
31376
|
};
|
|
31377
|
-
res.sendfile = function(
|
|
31377
|
+
res.sendfile = function(path24, options, callback) {
|
|
31378
31378
|
var done = callback;
|
|
31379
31379
|
var req = this.req;
|
|
31380
31380
|
var res2 = this;
|
|
@@ -31384,7 +31384,7 @@ var require_response = __commonJS({
|
|
|
31384
31384
|
done = options;
|
|
31385
31385
|
opts = {};
|
|
31386
31386
|
}
|
|
31387
|
-
var file = send(req,
|
|
31387
|
+
var file = send(req, path24, opts);
|
|
31388
31388
|
sendfile(res2, file, opts, function(err) {
|
|
31389
31389
|
if (done) return done(err);
|
|
31390
31390
|
if (err && err.code === "EISDIR") return next();
|
|
@@ -31397,7 +31397,7 @@ var require_response = __commonJS({
|
|
|
31397
31397
|
res.sendfile,
|
|
31398
31398
|
"res.sendfile: Use res.sendFile instead"
|
|
31399
31399
|
);
|
|
31400
|
-
res.download = function download(
|
|
31400
|
+
res.download = function download(path24, filename, options, callback) {
|
|
31401
31401
|
var done = callback;
|
|
31402
31402
|
var name2 = filename;
|
|
31403
31403
|
var opts = options || null;
|
|
@@ -31414,7 +31414,7 @@ var require_response = __commonJS({
|
|
|
31414
31414
|
opts = filename;
|
|
31415
31415
|
}
|
|
31416
31416
|
var headers = {
|
|
31417
|
-
"Content-Disposition": contentDisposition(name2 ||
|
|
31417
|
+
"Content-Disposition": contentDisposition(name2 || path24)
|
|
31418
31418
|
};
|
|
31419
31419
|
if (opts && opts.headers) {
|
|
31420
31420
|
var keys = Object.keys(opts.headers);
|
|
@@ -31427,7 +31427,7 @@ var require_response = __commonJS({
|
|
|
31427
31427
|
}
|
|
31428
31428
|
opts = Object.create(opts);
|
|
31429
31429
|
opts.headers = headers;
|
|
31430
|
-
var fullPath = !opts.root ?
|
|
31430
|
+
var fullPath = !opts.root ? resolve15(path24) : path24;
|
|
31431
31431
|
return this.sendFile(fullPath, opts, done);
|
|
31432
31432
|
};
|
|
31433
31433
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -31458,7 +31458,7 @@ var require_response = __commonJS({
|
|
|
31458
31458
|
};
|
|
31459
31459
|
res.attachment = function attachment(filename) {
|
|
31460
31460
|
if (filename) {
|
|
31461
|
-
this.type(
|
|
31461
|
+
this.type(extname4(filename));
|
|
31462
31462
|
}
|
|
31463
31463
|
this.set("Content-Disposition", contentDisposition(filename));
|
|
31464
31464
|
return this;
|
|
@@ -31693,7 +31693,7 @@ var require_serve_static = __commonJS({
|
|
|
31693
31693
|
var encodeUrl = require_encodeurl();
|
|
31694
31694
|
var escapeHtml2 = require_escape_html();
|
|
31695
31695
|
var parseUrl = require_parseurl();
|
|
31696
|
-
var
|
|
31696
|
+
var resolve15 = require("path").resolve;
|
|
31697
31697
|
var send = require_send();
|
|
31698
31698
|
var url = require("url");
|
|
31699
31699
|
module2.exports = serveStatic;
|
|
@@ -31713,7 +31713,7 @@ var require_serve_static = __commonJS({
|
|
|
31713
31713
|
throw new TypeError("option setHeaders must be function");
|
|
31714
31714
|
}
|
|
31715
31715
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
31716
|
-
opts.root =
|
|
31716
|
+
opts.root = resolve15(root);
|
|
31717
31717
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
31718
31718
|
return function serveStatic2(req, res, next) {
|
|
31719
31719
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -31728,11 +31728,11 @@ var require_serve_static = __commonJS({
|
|
|
31728
31728
|
}
|
|
31729
31729
|
var forwardError = !fallthrough;
|
|
31730
31730
|
var originalUrl = parseUrl.original(req);
|
|
31731
|
-
var
|
|
31732
|
-
if (
|
|
31733
|
-
|
|
31731
|
+
var path23 = parseUrl(req).pathname;
|
|
31732
|
+
if (path23 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
31733
|
+
path23 = "";
|
|
31734
31734
|
}
|
|
31735
|
-
var stream = send(req,
|
|
31735
|
+
var stream = send(req, path23, opts);
|
|
31736
31736
|
stream.on("directory", onDirectory);
|
|
31737
31737
|
if (setHeaders) {
|
|
31738
31738
|
stream.on("headers", setHeaders);
|
|
@@ -32069,10 +32069,10 @@ function assignProp(target, prop, value) {
|
|
|
32069
32069
|
configurable: true
|
|
32070
32070
|
});
|
|
32071
32071
|
}
|
|
32072
|
-
function getElementAtPath(obj,
|
|
32073
|
-
if (!
|
|
32072
|
+
function getElementAtPath(obj, path23) {
|
|
32073
|
+
if (!path23)
|
|
32074
32074
|
return obj;
|
|
32075
|
-
return
|
|
32075
|
+
return path23.reduce((acc, key) => acc?.[key], obj);
|
|
32076
32076
|
}
|
|
32077
32077
|
function promiseAllObject(promisesObj) {
|
|
32078
32078
|
const keys = Object.keys(promisesObj);
|
|
@@ -32321,11 +32321,11 @@ function aborted(x, startIndex = 0) {
|
|
|
32321
32321
|
}
|
|
32322
32322
|
return false;
|
|
32323
32323
|
}
|
|
32324
|
-
function prefixIssues(
|
|
32324
|
+
function prefixIssues(path23, issues) {
|
|
32325
32325
|
return issues.map((iss) => {
|
|
32326
32326
|
var _a;
|
|
32327
32327
|
(_a = iss).path ?? (_a.path = []);
|
|
32328
|
-
iss.path.unshift(
|
|
32328
|
+
iss.path.unshift(path23);
|
|
32329
32329
|
return iss;
|
|
32330
32330
|
});
|
|
32331
32331
|
}
|
|
@@ -38438,7 +38438,7 @@ var init_protocol = __esm({
|
|
|
38438
38438
|
return;
|
|
38439
38439
|
}
|
|
38440
38440
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
38441
|
-
await new Promise((
|
|
38441
|
+
await new Promise((resolve15) => setTimeout(resolve15, pollInterval));
|
|
38442
38442
|
options?.signal?.throwIfAborted();
|
|
38443
38443
|
}
|
|
38444
38444
|
} catch (error2) {
|
|
@@ -38455,7 +38455,7 @@ var init_protocol = __esm({
|
|
|
38455
38455
|
*/
|
|
38456
38456
|
request(request, resultSchema, options) {
|
|
38457
38457
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
38458
|
-
return new Promise((
|
|
38458
|
+
return new Promise((resolve15, reject) => {
|
|
38459
38459
|
const earlyReject = (error2) => {
|
|
38460
38460
|
reject(error2);
|
|
38461
38461
|
};
|
|
@@ -38533,7 +38533,7 @@ var init_protocol = __esm({
|
|
|
38533
38533
|
if (!parseResult.success) {
|
|
38534
38534
|
reject(parseResult.error);
|
|
38535
38535
|
} else {
|
|
38536
|
-
|
|
38536
|
+
resolve15(parseResult.data);
|
|
38537
38537
|
}
|
|
38538
38538
|
} catch (error2) {
|
|
38539
38539
|
reject(error2);
|
|
@@ -38794,12 +38794,12 @@ var init_protocol = __esm({
|
|
|
38794
38794
|
}
|
|
38795
38795
|
} catch {
|
|
38796
38796
|
}
|
|
38797
|
-
return new Promise((
|
|
38797
|
+
return new Promise((resolve15, reject) => {
|
|
38798
38798
|
if (signal.aborted) {
|
|
38799
38799
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
38800
38800
|
return;
|
|
38801
38801
|
}
|
|
38802
|
-
const timeoutId = setTimeout(
|
|
38802
|
+
const timeoutId = setTimeout(resolve15, interval);
|
|
38803
38803
|
signal.addEventListener("abort", () => {
|
|
38804
38804
|
clearTimeout(timeoutId);
|
|
38805
38805
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -41826,7 +41826,7 @@ var require_compile = __commonJS({
|
|
|
41826
41826
|
const schOrFunc = root.refs[ref];
|
|
41827
41827
|
if (schOrFunc)
|
|
41828
41828
|
return schOrFunc;
|
|
41829
|
-
let _sch =
|
|
41829
|
+
let _sch = resolve15.call(this, root, ref);
|
|
41830
41830
|
if (_sch === void 0) {
|
|
41831
41831
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
41832
41832
|
const { schemaId } = this.opts;
|
|
@@ -41853,7 +41853,7 @@ var require_compile = __commonJS({
|
|
|
41853
41853
|
function sameSchemaEnv(s1, s2) {
|
|
41854
41854
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
41855
41855
|
}
|
|
41856
|
-
function
|
|
41856
|
+
function resolve15(root, ref) {
|
|
41857
41857
|
let sch;
|
|
41858
41858
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
41859
41859
|
ref = sch;
|
|
@@ -42071,8 +42071,8 @@ var require_utils3 = __commonJS({
|
|
|
42071
42071
|
}
|
|
42072
42072
|
return ind;
|
|
42073
42073
|
}
|
|
42074
|
-
function removeDotSegments(
|
|
42075
|
-
let input =
|
|
42074
|
+
function removeDotSegments(path23) {
|
|
42075
|
+
let input = path23;
|
|
42076
42076
|
const output = [];
|
|
42077
42077
|
let nextSlash = -1;
|
|
42078
42078
|
let len = 0;
|
|
@@ -42324,8 +42324,8 @@ var require_schemes = __commonJS({
|
|
|
42324
42324
|
wsComponent.secure = void 0;
|
|
42325
42325
|
}
|
|
42326
42326
|
if (wsComponent.resourceName) {
|
|
42327
|
-
const [
|
|
42328
|
-
wsComponent.path =
|
|
42327
|
+
const [path23, query] = wsComponent.resourceName.split("?");
|
|
42328
|
+
wsComponent.path = path23 && path23 !== "/" ? path23 : void 0;
|
|
42329
42329
|
wsComponent.query = query;
|
|
42330
42330
|
wsComponent.resourceName = void 0;
|
|
42331
42331
|
}
|
|
@@ -42484,7 +42484,7 @@ var require_fast_uri = __commonJS({
|
|
|
42484
42484
|
}
|
|
42485
42485
|
return uri;
|
|
42486
42486
|
}
|
|
42487
|
-
function
|
|
42487
|
+
function resolve15(baseURI, relativeURI, options) {
|
|
42488
42488
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
42489
42489
|
const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
42490
42490
|
schemelessOptions.skipEscape = true;
|
|
@@ -42742,7 +42742,7 @@ var require_fast_uri = __commonJS({
|
|
|
42742
42742
|
var fastUri = {
|
|
42743
42743
|
SCHEMES,
|
|
42744
42744
|
normalize,
|
|
42745
|
-
resolve:
|
|
42745
|
+
resolve: resolve15,
|
|
42746
42746
|
resolveComponent,
|
|
42747
42747
|
equal,
|
|
42748
42748
|
serialize,
|
|
@@ -45718,12 +45718,12 @@ var require_dist4 = __commonJS({
|
|
|
45718
45718
|
throw new Error(`Unknown format "${name2}"`);
|
|
45719
45719
|
return f;
|
|
45720
45720
|
};
|
|
45721
|
-
function addFormats(ajv, list,
|
|
45721
|
+
function addFormats(ajv, list, fs24, exportName) {
|
|
45722
45722
|
var _a;
|
|
45723
45723
|
var _b;
|
|
45724
45724
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
45725
45725
|
for (const f of list)
|
|
45726
|
-
ajv.addFormat(f,
|
|
45726
|
+
ajv.addFormat(f, fs24[f]);
|
|
45727
45727
|
}
|
|
45728
45728
|
module2.exports = exports2 = formatsPlugin;
|
|
45729
45729
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -46549,8 +46549,8 @@ var require_windows = __commonJS({
|
|
|
46549
46549
|
"use strict";
|
|
46550
46550
|
module2.exports = isexe;
|
|
46551
46551
|
isexe.sync = sync;
|
|
46552
|
-
var
|
|
46553
|
-
function checkPathExt(
|
|
46552
|
+
var fs24 = require("fs");
|
|
46553
|
+
function checkPathExt(path23, options) {
|
|
46554
46554
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
46555
46555
|
if (!pathext) {
|
|
46556
46556
|
return true;
|
|
@@ -46561,25 +46561,25 @@ var require_windows = __commonJS({
|
|
|
46561
46561
|
}
|
|
46562
46562
|
for (var i = 0; i < pathext.length; i++) {
|
|
46563
46563
|
var p = pathext[i].toLowerCase();
|
|
46564
|
-
if (p &&
|
|
46564
|
+
if (p && path23.substr(-p.length).toLowerCase() === p) {
|
|
46565
46565
|
return true;
|
|
46566
46566
|
}
|
|
46567
46567
|
}
|
|
46568
46568
|
return false;
|
|
46569
46569
|
}
|
|
46570
|
-
function checkStat(stat,
|
|
46570
|
+
function checkStat(stat, path23, options) {
|
|
46571
46571
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
46572
46572
|
return false;
|
|
46573
46573
|
}
|
|
46574
|
-
return checkPathExt(
|
|
46574
|
+
return checkPathExt(path23, options);
|
|
46575
46575
|
}
|
|
46576
|
-
function isexe(
|
|
46577
|
-
|
|
46578
|
-
cb(er, er ? false : checkStat(stat,
|
|
46576
|
+
function isexe(path23, options, cb) {
|
|
46577
|
+
fs24.stat(path23, function(er, stat) {
|
|
46578
|
+
cb(er, er ? false : checkStat(stat, path23, options));
|
|
46579
46579
|
});
|
|
46580
46580
|
}
|
|
46581
|
-
function sync(
|
|
46582
|
-
return checkStat(
|
|
46581
|
+
function sync(path23, options) {
|
|
46582
|
+
return checkStat(fs24.statSync(path23), path23, options);
|
|
46583
46583
|
}
|
|
46584
46584
|
}
|
|
46585
46585
|
});
|
|
@@ -46590,14 +46590,14 @@ var require_mode = __commonJS({
|
|
|
46590
46590
|
"use strict";
|
|
46591
46591
|
module2.exports = isexe;
|
|
46592
46592
|
isexe.sync = sync;
|
|
46593
|
-
var
|
|
46594
|
-
function isexe(
|
|
46595
|
-
|
|
46593
|
+
var fs24 = require("fs");
|
|
46594
|
+
function isexe(path23, options, cb) {
|
|
46595
|
+
fs24.stat(path23, function(er, stat) {
|
|
46596
46596
|
cb(er, er ? false : checkStat(stat, options));
|
|
46597
46597
|
});
|
|
46598
46598
|
}
|
|
46599
|
-
function sync(
|
|
46600
|
-
return checkStat(
|
|
46599
|
+
function sync(path23, options) {
|
|
46600
|
+
return checkStat(fs24.statSync(path23), options);
|
|
46601
46601
|
}
|
|
46602
46602
|
function checkStat(stat, options) {
|
|
46603
46603
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -46622,7 +46622,7 @@ var require_mode = __commonJS({
|
|
|
46622
46622
|
var require_isexe = __commonJS({
|
|
46623
46623
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports2, module2) {
|
|
46624
46624
|
"use strict";
|
|
46625
|
-
var
|
|
46625
|
+
var fs24 = require("fs");
|
|
46626
46626
|
var core;
|
|
46627
46627
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
46628
46628
|
core = require_windows();
|
|
@@ -46631,7 +46631,7 @@ var require_isexe = __commonJS({
|
|
|
46631
46631
|
}
|
|
46632
46632
|
module2.exports = isexe;
|
|
46633
46633
|
isexe.sync = sync;
|
|
46634
|
-
function isexe(
|
|
46634
|
+
function isexe(path23, options, cb) {
|
|
46635
46635
|
if (typeof options === "function") {
|
|
46636
46636
|
cb = options;
|
|
46637
46637
|
options = {};
|
|
@@ -46640,17 +46640,17 @@ var require_isexe = __commonJS({
|
|
|
46640
46640
|
if (typeof Promise !== "function") {
|
|
46641
46641
|
throw new TypeError("callback not provided");
|
|
46642
46642
|
}
|
|
46643
|
-
return new Promise(function(
|
|
46644
|
-
isexe(
|
|
46643
|
+
return new Promise(function(resolve15, reject) {
|
|
46644
|
+
isexe(path23, options || {}, function(er, is) {
|
|
46645
46645
|
if (er) {
|
|
46646
46646
|
reject(er);
|
|
46647
46647
|
} else {
|
|
46648
|
-
|
|
46648
|
+
resolve15(is);
|
|
46649
46649
|
}
|
|
46650
46650
|
});
|
|
46651
46651
|
});
|
|
46652
46652
|
}
|
|
46653
|
-
core(
|
|
46653
|
+
core(path23, options || {}, function(er, is) {
|
|
46654
46654
|
if (er) {
|
|
46655
46655
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
46656
46656
|
er = null;
|
|
@@ -46660,9 +46660,9 @@ var require_isexe = __commonJS({
|
|
|
46660
46660
|
cb(er, is);
|
|
46661
46661
|
});
|
|
46662
46662
|
}
|
|
46663
|
-
function sync(
|
|
46663
|
+
function sync(path23, options) {
|
|
46664
46664
|
try {
|
|
46665
|
-
return core.sync(
|
|
46665
|
+
return core.sync(path23, options || {});
|
|
46666
46666
|
} catch (er) {
|
|
46667
46667
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
46668
46668
|
return false;
|
|
@@ -46679,7 +46679,7 @@ var require_which = __commonJS({
|
|
|
46679
46679
|
"../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports2, module2) {
|
|
46680
46680
|
"use strict";
|
|
46681
46681
|
var isWindows2 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
46682
|
-
var
|
|
46682
|
+
var path23 = require("path");
|
|
46683
46683
|
var COLON = isWindows2 ? ";" : ":";
|
|
46684
46684
|
var isexe = require_isexe();
|
|
46685
46685
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -46712,27 +46712,27 @@ var require_which = __commonJS({
|
|
|
46712
46712
|
opt = {};
|
|
46713
46713
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
46714
46714
|
const found = [];
|
|
46715
|
-
const step = (i) => new Promise((
|
|
46715
|
+
const step = (i) => new Promise((resolve15, reject) => {
|
|
46716
46716
|
if (i === pathEnv.length)
|
|
46717
|
-
return opt.all && found.length ?
|
|
46717
|
+
return opt.all && found.length ? resolve15(found) : reject(getNotFoundError(cmd));
|
|
46718
46718
|
const ppRaw = pathEnv[i];
|
|
46719
46719
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
46720
|
-
const pCmd =
|
|
46720
|
+
const pCmd = path23.join(pathPart, cmd);
|
|
46721
46721
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
46722
|
-
|
|
46722
|
+
resolve15(subStep(p, i, 0));
|
|
46723
46723
|
});
|
|
46724
|
-
const subStep = (p, i, ii) => new Promise((
|
|
46724
|
+
const subStep = (p, i, ii) => new Promise((resolve15, reject) => {
|
|
46725
46725
|
if (ii === pathExt.length)
|
|
46726
|
-
return
|
|
46726
|
+
return resolve15(step(i + 1));
|
|
46727
46727
|
const ext = pathExt[ii];
|
|
46728
46728
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
46729
46729
|
if (!er && is) {
|
|
46730
46730
|
if (opt.all)
|
|
46731
46731
|
found.push(p + ext);
|
|
46732
46732
|
else
|
|
46733
|
-
return
|
|
46733
|
+
return resolve15(p + ext);
|
|
46734
46734
|
}
|
|
46735
|
-
return
|
|
46735
|
+
return resolve15(subStep(p, i, ii + 1));
|
|
46736
46736
|
});
|
|
46737
46737
|
});
|
|
46738
46738
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -46744,7 +46744,7 @@ var require_which = __commonJS({
|
|
|
46744
46744
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
46745
46745
|
const ppRaw = pathEnv[i];
|
|
46746
46746
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
46747
|
-
const pCmd =
|
|
46747
|
+
const pCmd = path23.join(pathPart, cmd);
|
|
46748
46748
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
46749
46749
|
for (let j = 0; j < pathExt.length; j++) {
|
|
46750
46750
|
const cur = p + pathExt[j];
|
|
@@ -46792,7 +46792,7 @@ var require_path_key = __commonJS({
|
|
|
46792
46792
|
var require_resolveCommand = __commonJS({
|
|
46793
46793
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
|
|
46794
46794
|
"use strict";
|
|
46795
|
-
var
|
|
46795
|
+
var path23 = require("path");
|
|
46796
46796
|
var which = require_which();
|
|
46797
46797
|
var getPathKey = require_path_key();
|
|
46798
46798
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -46810,7 +46810,7 @@ var require_resolveCommand = __commonJS({
|
|
|
46810
46810
|
try {
|
|
46811
46811
|
resolved = which.sync(parsed.command, {
|
|
46812
46812
|
path: env[getPathKey({ env })],
|
|
46813
|
-
pathExt: withoutPathExt ?
|
|
46813
|
+
pathExt: withoutPathExt ? path23.delimiter : void 0
|
|
46814
46814
|
});
|
|
46815
46815
|
} catch (e) {
|
|
46816
46816
|
} finally {
|
|
@@ -46819,7 +46819,7 @@ var require_resolveCommand = __commonJS({
|
|
|
46819
46819
|
}
|
|
46820
46820
|
}
|
|
46821
46821
|
if (resolved) {
|
|
46822
|
-
resolved =
|
|
46822
|
+
resolved = path23.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
46823
46823
|
}
|
|
46824
46824
|
return resolved;
|
|
46825
46825
|
}
|
|
@@ -46873,8 +46873,8 @@ var require_shebang_command = __commonJS({
|
|
|
46873
46873
|
if (!match) {
|
|
46874
46874
|
return null;
|
|
46875
46875
|
}
|
|
46876
|
-
const [
|
|
46877
|
-
const binary =
|
|
46876
|
+
const [path23, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
46877
|
+
const binary = path23.split("/").pop();
|
|
46878
46878
|
if (binary === "env") {
|
|
46879
46879
|
return argument;
|
|
46880
46880
|
}
|
|
@@ -46887,16 +46887,16 @@ var require_shebang_command = __commonJS({
|
|
|
46887
46887
|
var require_readShebang = __commonJS({
|
|
46888
46888
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
|
|
46889
46889
|
"use strict";
|
|
46890
|
-
var
|
|
46890
|
+
var fs24 = require("fs");
|
|
46891
46891
|
var shebangCommand = require_shebang_command();
|
|
46892
46892
|
function readShebang(command) {
|
|
46893
46893
|
const size = 150;
|
|
46894
46894
|
const buffer = Buffer.alloc(size);
|
|
46895
46895
|
let fd;
|
|
46896
46896
|
try {
|
|
46897
|
-
fd =
|
|
46898
|
-
|
|
46899
|
-
|
|
46897
|
+
fd = fs24.openSync(command, "r");
|
|
46898
|
+
fs24.readSync(fd, buffer, 0, size, 0);
|
|
46899
|
+
fs24.closeSync(fd);
|
|
46900
46900
|
} catch (e) {
|
|
46901
46901
|
}
|
|
46902
46902
|
return shebangCommand(buffer.toString());
|
|
@@ -46909,7 +46909,7 @@ var require_readShebang = __commonJS({
|
|
|
46909
46909
|
var require_parse3 = __commonJS({
|
|
46910
46910
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
|
|
46911
46911
|
"use strict";
|
|
46912
|
-
var
|
|
46912
|
+
var path23 = require("path");
|
|
46913
46913
|
var resolveCommand = require_resolveCommand();
|
|
46914
46914
|
var escape2 = require_escape();
|
|
46915
46915
|
var readShebang = require_readShebang();
|
|
@@ -46934,7 +46934,7 @@ var require_parse3 = __commonJS({
|
|
|
46934
46934
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
46935
46935
|
if (parsed.options.forceShell || needsShell) {
|
|
46936
46936
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
46937
|
-
parsed.command =
|
|
46937
|
+
parsed.command = path23.normalize(parsed.command);
|
|
46938
46938
|
parsed.command = escape2.command(parsed.command);
|
|
46939
46939
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
46940
46940
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -47024,7 +47024,7 @@ var require_cross_spawn = __commonJS({
|
|
|
47024
47024
|
var cp = require("child_process");
|
|
47025
47025
|
var parse3 = require_parse3();
|
|
47026
47026
|
var enoent = require_enoent();
|
|
47027
|
-
function
|
|
47027
|
+
function spawn9(command, args, options) {
|
|
47028
47028
|
const parsed = parse3(command, args, options);
|
|
47029
47029
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
47030
47030
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -47036,8 +47036,8 @@ var require_cross_spawn = __commonJS({
|
|
|
47036
47036
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
47037
47037
|
return result;
|
|
47038
47038
|
}
|
|
47039
|
-
module2.exports =
|
|
47040
|
-
module2.exports.spawn =
|
|
47039
|
+
module2.exports = spawn9;
|
|
47040
|
+
module2.exports.spawn = spawn9;
|
|
47041
47041
|
module2.exports.sync = spawnSync5;
|
|
47042
47042
|
module2.exports._parse = parse3;
|
|
47043
47043
|
module2.exports._enoent = enoent;
|
|
@@ -47141,7 +47141,7 @@ var init_stdio2 = __esm({
|
|
|
47141
47141
|
if (this._process) {
|
|
47142
47142
|
throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");
|
|
47143
47143
|
}
|
|
47144
|
-
return new Promise((
|
|
47144
|
+
return new Promise((resolve15, reject) => {
|
|
47145
47145
|
this._process = (0, import_cross_spawn.default)(this._serverParams.command, this._serverParams.args ?? [], {
|
|
47146
47146
|
// merge default env with server env because mcp server needs some env vars
|
|
47147
47147
|
env: {
|
|
@@ -47158,7 +47158,7 @@ var init_stdio2 = __esm({
|
|
|
47158
47158
|
this.onerror?.(error2);
|
|
47159
47159
|
});
|
|
47160
47160
|
this._process.on("spawn", () => {
|
|
47161
|
-
|
|
47161
|
+
resolve15();
|
|
47162
47162
|
});
|
|
47163
47163
|
this._process.on("close", (_code) => {
|
|
47164
47164
|
this._process = void 0;
|
|
@@ -47217,22 +47217,22 @@ var init_stdio2 = __esm({
|
|
|
47217
47217
|
if (this._process) {
|
|
47218
47218
|
const processToClose = this._process;
|
|
47219
47219
|
this._process = void 0;
|
|
47220
|
-
const closePromise = new Promise((
|
|
47220
|
+
const closePromise = new Promise((resolve15) => {
|
|
47221
47221
|
processToClose.once("close", () => {
|
|
47222
|
-
|
|
47222
|
+
resolve15();
|
|
47223
47223
|
});
|
|
47224
47224
|
});
|
|
47225
47225
|
try {
|
|
47226
47226
|
processToClose.stdin?.end();
|
|
47227
47227
|
} catch {
|
|
47228
47228
|
}
|
|
47229
|
-
await Promise.race([closePromise, new Promise((
|
|
47229
|
+
await Promise.race([closePromise, new Promise((resolve15) => setTimeout(resolve15, 2e3).unref())]);
|
|
47230
47230
|
if (processToClose.exitCode === null) {
|
|
47231
47231
|
try {
|
|
47232
47232
|
processToClose.kill("SIGTERM");
|
|
47233
47233
|
} catch {
|
|
47234
47234
|
}
|
|
47235
|
-
await Promise.race([closePromise, new Promise((
|
|
47235
|
+
await Promise.race([closePromise, new Promise((resolve15) => setTimeout(resolve15, 2e3).unref())]);
|
|
47236
47236
|
}
|
|
47237
47237
|
if (processToClose.exitCode === null) {
|
|
47238
47238
|
try {
|
|
@@ -47244,15 +47244,15 @@ var init_stdio2 = __esm({
|
|
|
47244
47244
|
this._readBuffer.clear();
|
|
47245
47245
|
}
|
|
47246
47246
|
send(message) {
|
|
47247
|
-
return new Promise((
|
|
47247
|
+
return new Promise((resolve15) => {
|
|
47248
47248
|
if (!this._process?.stdin) {
|
|
47249
47249
|
throw new Error("Not connected");
|
|
47250
47250
|
}
|
|
47251
47251
|
const json = serializeMessage(message);
|
|
47252
47252
|
if (this._process.stdin.write(json)) {
|
|
47253
|
-
|
|
47253
|
+
resolve15();
|
|
47254
47254
|
} else {
|
|
47255
|
-
this._process.stdin.once("drain",
|
|
47255
|
+
this._process.stdin.once("drain", resolve15);
|
|
47256
47256
|
}
|
|
47257
47257
|
});
|
|
47258
47258
|
}
|
|
@@ -48064,7 +48064,7 @@ async function closeHttpServer(server, options = {}) {
|
|
|
48064
48064
|
return;
|
|
48065
48065
|
}
|
|
48066
48066
|
const forceAfterMs = options.forceAfterMs ?? 1e3;
|
|
48067
|
-
await new Promise((
|
|
48067
|
+
await new Promise((resolve15, reject) => {
|
|
48068
48068
|
const forceTimer = setTimeout(() => {
|
|
48069
48069
|
server.closeAllConnections?.();
|
|
48070
48070
|
server.closeIdleConnections?.();
|
|
@@ -48076,7 +48076,7 @@ async function closeHttpServer(server, options = {}) {
|
|
|
48076
48076
|
reject(err);
|
|
48077
48077
|
return;
|
|
48078
48078
|
}
|
|
48079
|
-
|
|
48079
|
+
resolve15();
|
|
48080
48080
|
});
|
|
48081
48081
|
server.closeIdleConnections?.();
|
|
48082
48082
|
});
|
|
@@ -50117,7 +50117,7 @@ function wasClockTurnedBack(cachedAt) {
|
|
|
50117
50117
|
return cachedAtSec > nowSeconds();
|
|
50118
50118
|
}
|
|
50119
50119
|
function delay(t, value) {
|
|
50120
|
-
return new Promise((
|
|
50120
|
+
return new Promise((resolve15) => setTimeout(() => resolve15(value), t));
|
|
50121
50121
|
}
|
|
50122
50122
|
|
|
50123
50123
|
// ../../node_modules/.pnpm/@azure+msal-common@16.5.0/node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.mjs
|
|
@@ -51611,7 +51611,7 @@ var developerCliCredentialInternals = {
|
|
|
51611
51611
|
const encodedClaims = btoa(claims);
|
|
51612
51612
|
claimsSections = ["--claims", encodedClaims];
|
|
51613
51613
|
}
|
|
51614
|
-
return new Promise((
|
|
51614
|
+
return new Promise((resolve15, reject) => {
|
|
51615
51615
|
try {
|
|
51616
51616
|
const args = [
|
|
51617
51617
|
"auth",
|
|
@@ -51628,7 +51628,7 @@ var developerCliCredentialInternals = {
|
|
|
51628
51628
|
cwd: developerCliCredentialInternals.getSafeWorkingDir(),
|
|
51629
51629
|
timeout
|
|
51630
51630
|
}, (error2, stdout, stderr) => {
|
|
51631
|
-
|
|
51631
|
+
resolve15({ stdout, stderr, error: error2 });
|
|
51632
51632
|
});
|
|
51633
51633
|
} catch (err) {
|
|
51634
51634
|
reject(err);
|
|
@@ -51776,7 +51776,7 @@ var cliCredentialInternals = {
|
|
|
51776
51776
|
if (subscription) {
|
|
51777
51777
|
subscriptionSection = ["--subscription", `"${subscription}"`];
|
|
51778
51778
|
}
|
|
51779
|
-
return new Promise((
|
|
51779
|
+
return new Promise((resolve15, reject) => {
|
|
51780
51780
|
try {
|
|
51781
51781
|
const args = [
|
|
51782
51782
|
"account",
|
|
@@ -51790,7 +51790,7 @@ var cliCredentialInternals = {
|
|
|
51790
51790
|
];
|
|
51791
51791
|
const command = ["az", ...args].join(" ");
|
|
51792
51792
|
import_child_process2.default.exec(command, { cwd: cliCredentialInternals.getSafeWorkingDir(), timeout }, (error2, stdout, stderr) => {
|
|
51793
|
-
|
|
51793
|
+
resolve15({ stdout, stderr, error: error2 });
|
|
51794
51794
|
});
|
|
51795
51795
|
} catch (err) {
|
|
51796
51796
|
reject(err);
|
|
@@ -51931,7 +51931,7 @@ var processUtils = {
|
|
|
51931
51931
|
* @internal
|
|
51932
51932
|
*/
|
|
51933
51933
|
execFile(file, params, options) {
|
|
51934
|
-
return new Promise((
|
|
51934
|
+
return new Promise((resolve15, reject) => {
|
|
51935
51935
|
import_node_child_process.default.execFile(file, params, options, (error2, stdout, stderr) => {
|
|
51936
51936
|
if (Buffer.isBuffer(stdout)) {
|
|
51937
51937
|
stdout = stdout.toString("utf8");
|
|
@@ -51942,7 +51942,7 @@ var processUtils = {
|
|
|
51942
51942
|
if (stderr || error2) {
|
|
51943
51943
|
reject(stderr ? new Error(stderr) : error2);
|
|
51944
51944
|
} else {
|
|
51945
|
-
|
|
51945
|
+
resolve15(stdout);
|
|
51946
51946
|
}
|
|
51947
51947
|
});
|
|
51948
51948
|
});
|
|
@@ -52367,11 +52367,11 @@ function persistNodeStartupTransport(storagePath, transport) {
|
|
|
52367
52367
|
transport
|
|
52368
52368
|
});
|
|
52369
52369
|
}
|
|
52370
|
-
function persistNodeStartupJoin(storagePath,
|
|
52370
|
+
function persistNodeStartupJoin(storagePath, join17) {
|
|
52371
52371
|
const startup = resolveNodeStartupMetadata(storagePath);
|
|
52372
52372
|
persistNodeStartupMetadata(storagePath, {
|
|
52373
52373
|
...startup,
|
|
52374
|
-
join:
|
|
52374
|
+
join: join17
|
|
52375
52375
|
});
|
|
52376
52376
|
}
|
|
52377
52377
|
function resolvePersistedDevTunnelId(storagePath, kind) {
|
|
@@ -53388,19 +53388,19 @@ async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_NODE_REQUEST_TIME
|
|
|
53388
53388
|
cleanup();
|
|
53389
53389
|
}
|
|
53390
53390
|
}
|
|
53391
|
-
async function fetchNodeWithFallback(node,
|
|
53391
|
+
async function fetchNodeWithFallback(node, path23, init, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS, trace, options) {
|
|
53392
53392
|
let lastError;
|
|
53393
53393
|
const endpoints = getNodeRequestEndpoints(node, options);
|
|
53394
53394
|
for (const [index, endpoint] of endpoints.entries()) {
|
|
53395
53395
|
const attempt = index + 1;
|
|
53396
|
-
trace?.onAttempt?.({ attempt, endpoint, path:
|
|
53396
|
+
trace?.onAttempt?.({ attempt, endpoint, path: path23, timeoutMs, totalEndpoints: endpoints.length });
|
|
53397
53397
|
try {
|
|
53398
|
-
const response = await fetchWithTimeout(`${endpoint}${
|
|
53399
|
-
trace?.onResponse?.({ attempt, endpoint, path:
|
|
53398
|
+
const response = await fetchWithTimeout(`${endpoint}${path23}`, init, timeoutMs);
|
|
53399
|
+
trace?.onResponse?.({ attempt, endpoint, path: path23, response, timeoutMs, totalEndpoints: endpoints.length });
|
|
53400
53400
|
return { endpoint, response };
|
|
53401
53401
|
} catch (error2) {
|
|
53402
53402
|
lastError = error2;
|
|
53403
|
-
trace?.onError?.({ attempt, endpoint, error: error2, path:
|
|
53403
|
+
trace?.onError?.({ attempt, endpoint, error: error2, path: path23, timeoutMs, totalEndpoints: endpoints.length });
|
|
53404
53404
|
}
|
|
53405
53405
|
}
|
|
53406
53406
|
throw lastError instanceof Error ? lastError : new Error("No reachable node endpoint");
|
|
@@ -54718,7 +54718,7 @@ var KeepaliveNodeMessageQueue = class {
|
|
|
54718
54718
|
queued.push(requestMessage);
|
|
54719
54719
|
this.queuedMessages.set(nodeId, queued);
|
|
54720
54720
|
this.log.info("queued keepalive node message request", { nodeId, ...describeNodeMessage(requestMessage) });
|
|
54721
|
-
return new Promise((
|
|
54721
|
+
return new Promise((resolve15, reject) => {
|
|
54722
54722
|
const timeoutId = setTimeout(() => {
|
|
54723
54723
|
this.pendingResponses.delete(requestMessage.id);
|
|
54724
54724
|
reject(new Error(`Timed out waiting for ${requestMessage.kind} response from ${nodeId}`));
|
|
@@ -54726,7 +54726,7 @@ var KeepaliveNodeMessageQueue = class {
|
|
|
54726
54726
|
this.pendingResponses.set(requestMessage.id, {
|
|
54727
54727
|
nodeId,
|
|
54728
54728
|
kind: requestMessage.kind,
|
|
54729
|
-
resolve:
|
|
54729
|
+
resolve: resolve15,
|
|
54730
54730
|
reject,
|
|
54731
54731
|
timeoutId
|
|
54732
54732
|
});
|
|
@@ -55624,9 +55624,9 @@ var DataRouter = class {
|
|
|
55624
55624
|
/**
|
|
55625
55625
|
* Returns true if the request should be proxied to the leader.
|
|
55626
55626
|
*/
|
|
55627
|
-
shouldProxy(method,
|
|
55627
|
+
shouldProxy(method, path23) {
|
|
55628
55628
|
if (this.election.isLeader()) return false;
|
|
55629
|
-
if (this.isExcludedPath(
|
|
55629
|
+
if (this.isExcludedPath(path23)) return false;
|
|
55630
55630
|
if (method.toUpperCase() === "GET") return false;
|
|
55631
55631
|
return WRITE_METHODS.has(method.toUpperCase());
|
|
55632
55632
|
}
|
|
@@ -55730,8 +55730,8 @@ var DataRouter = class {
|
|
|
55730
55730
|
};
|
|
55731
55731
|
}
|
|
55732
55732
|
// ── Helpers ───────────────────────────────────────────────────────────
|
|
55733
|
-
isExcludedPath(
|
|
55734
|
-
return EXCLUDED_PATH_PREFIXES.some((prefix) =>
|
|
55733
|
+
isExcludedPath(path23) {
|
|
55734
|
+
return EXCLUDED_PATH_PREFIXES.some((prefix) => path23.startsWith(prefix)) || EXCLUDED_PATH_SUFFIXES.some((suffix) => path23.endsWith(suffix));
|
|
55735
55735
|
}
|
|
55736
55736
|
};
|
|
55737
55737
|
|
|
@@ -55837,7 +55837,7 @@ var ExecutionEngine = class {
|
|
|
55837
55837
|
};
|
|
55838
55838
|
|
|
55839
55839
|
// ../../packages/core/src/agents/engine-capabilities.ts
|
|
55840
|
-
var FOLLOW_UP_AGENTS = ["claudecode", "codex"];
|
|
55840
|
+
var FOLLOW_UP_AGENTS = ["claudecode", "codex", "copilot"];
|
|
55841
55841
|
function supportsFollowUpAgent(agent) {
|
|
55842
55842
|
return FOLLOW_UP_AGENTS.includes(agent);
|
|
55843
55843
|
}
|
|
@@ -55873,9 +55873,253 @@ var EngineRegistry = class {
|
|
|
55873
55873
|
var fs8 = __toESM(require("fs"), 1);
|
|
55874
55874
|
var os4 = __toESM(require("os"), 1);
|
|
55875
55875
|
var path7 = __toESM(require("path"), 1);
|
|
55876
|
+
|
|
55877
|
+
// ../../packages/core/src/agents/codex-transcript-events.ts
|
|
55876
55878
|
function isRecord2(value) {
|
|
55877
55879
|
return typeof value === "object" && value !== null;
|
|
55878
55880
|
}
|
|
55881
|
+
function buildAssistantTextEvent(text, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
55882
|
+
return {
|
|
55883
|
+
type: "assistant",
|
|
55884
|
+
message: {
|
|
55885
|
+
role: "assistant",
|
|
55886
|
+
content: [{ type: "text", text }]
|
|
55887
|
+
},
|
|
55888
|
+
timestamp
|
|
55889
|
+
};
|
|
55890
|
+
}
|
|
55891
|
+
function buildAssistantThinkingEvent(thinking, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
55892
|
+
return {
|
|
55893
|
+
type: "assistant",
|
|
55894
|
+
message: {
|
|
55895
|
+
role: "assistant",
|
|
55896
|
+
content: [{ type: "thinking", thinking }]
|
|
55897
|
+
},
|
|
55898
|
+
timestamp
|
|
55899
|
+
};
|
|
55900
|
+
}
|
|
55901
|
+
function buildAssistantToolUseEvent(id, name2, input, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
55902
|
+
return {
|
|
55903
|
+
type: "assistant",
|
|
55904
|
+
message: {
|
|
55905
|
+
role: "assistant",
|
|
55906
|
+
content: [{ type: "tool_use", id, name: name2, input }]
|
|
55907
|
+
},
|
|
55908
|
+
timestamp
|
|
55909
|
+
};
|
|
55910
|
+
}
|
|
55911
|
+
function extractCodexReasoningText(item) {
|
|
55912
|
+
if (typeof item.text === "string") {
|
|
55913
|
+
return item.text.trim();
|
|
55914
|
+
}
|
|
55915
|
+
if (Array.isArray(item.summary)) {
|
|
55916
|
+
return item.summary.map((entry) => {
|
|
55917
|
+
if (typeof entry === "string") return entry.trim();
|
|
55918
|
+
if (isRecord2(entry) && typeof entry.text === "string") {
|
|
55919
|
+
return entry.text.trim();
|
|
55920
|
+
}
|
|
55921
|
+
return "";
|
|
55922
|
+
}).filter(Boolean).join("\n\n");
|
|
55923
|
+
}
|
|
55924
|
+
return "";
|
|
55925
|
+
}
|
|
55926
|
+
function parseCodexToolInput(value) {
|
|
55927
|
+
if (isRecord2(value)) return value;
|
|
55928
|
+
if (typeof value !== "string") return {};
|
|
55929
|
+
const trimmed = value.trim();
|
|
55930
|
+
if (!trimmed) return {};
|
|
55931
|
+
try {
|
|
55932
|
+
const parsed = JSON.parse(trimmed);
|
|
55933
|
+
if (isRecord2(parsed)) return parsed;
|
|
55934
|
+
} catch {
|
|
55935
|
+
}
|
|
55936
|
+
return { arguments: trimmed };
|
|
55937
|
+
}
|
|
55938
|
+
function getToolCallId(payload) {
|
|
55939
|
+
for (const key of ["call_id", "id", "tool_call_id"]) {
|
|
55940
|
+
const value = payload[key];
|
|
55941
|
+
if (typeof value === "string" && value.trim()) {
|
|
55942
|
+
return value.trim();
|
|
55943
|
+
}
|
|
55944
|
+
}
|
|
55945
|
+
return "";
|
|
55946
|
+
}
|
|
55947
|
+
function getToolName(payload) {
|
|
55948
|
+
for (const key of ["name", "tool_name"]) {
|
|
55949
|
+
const value = payload[key];
|
|
55950
|
+
if (typeof value === "string" && value.trim()) {
|
|
55951
|
+
return value.trim();
|
|
55952
|
+
}
|
|
55953
|
+
}
|
|
55954
|
+
return "tool";
|
|
55955
|
+
}
|
|
55956
|
+
function getToolOutput(payload) {
|
|
55957
|
+
for (const key of ["output", "content", "result"]) {
|
|
55958
|
+
const value = payload[key];
|
|
55959
|
+
if (typeof value === "string" && value.trim()) {
|
|
55960
|
+
return value.trim();
|
|
55961
|
+
}
|
|
55962
|
+
}
|
|
55963
|
+
return "";
|
|
55964
|
+
}
|
|
55965
|
+
function convertCodexTranscriptPayload(payload, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
55966
|
+
if (payload.type === "user_message" && typeof payload.message === "string" && payload.message.trim()) {
|
|
55967
|
+
return [buildTaskUserLogEvent([{ type: "text", text: payload.message.trim() }], timestamp)];
|
|
55968
|
+
}
|
|
55969
|
+
if (payload.type === "agent_message" && typeof payload.message === "string" && payload.message.trim()) {
|
|
55970
|
+
return [buildAssistantTextEvent(payload.message.trim(), timestamp)];
|
|
55971
|
+
}
|
|
55972
|
+
if (payload.type === "agent_message" && typeof payload.text === "string" && payload.text.trim()) {
|
|
55973
|
+
return [buildAssistantTextEvent(payload.text.trim(), timestamp)];
|
|
55974
|
+
}
|
|
55975
|
+
if (payload.type === "agent_reasoning" || payload.type === "reasoning") {
|
|
55976
|
+
const reasoning = extractCodexReasoningText(payload);
|
|
55977
|
+
return reasoning ? [buildAssistantThinkingEvent(reasoning, timestamp)] : [];
|
|
55978
|
+
}
|
|
55979
|
+
if (payload.type === "function_call" || payload.type === "tool_call") {
|
|
55980
|
+
const callId = getToolCallId(payload);
|
|
55981
|
+
if (!callId) return [];
|
|
55982
|
+
return [buildAssistantToolUseEvent(
|
|
55983
|
+
callId,
|
|
55984
|
+
getToolName(payload),
|
|
55985
|
+
parseCodexToolInput(payload.arguments ?? payload.input),
|
|
55986
|
+
timestamp
|
|
55987
|
+
)];
|
|
55988
|
+
}
|
|
55989
|
+
if (payload.type === "function_call_output" || payload.type === "tool_call_output") {
|
|
55990
|
+
const callId = getToolCallId(payload);
|
|
55991
|
+
const output = getToolOutput(payload);
|
|
55992
|
+
if (!callId || !output) return [];
|
|
55993
|
+
return [buildTaskUserLogEvent([{ type: "tool_result", toolUseId: callId, content: output }], timestamp)];
|
|
55994
|
+
}
|
|
55995
|
+
return [];
|
|
55996
|
+
}
|
|
55997
|
+
function convertCodexTranscriptEvent(event) {
|
|
55998
|
+
const timestamp = typeof event.timestamp === "string" ? event.timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
55999
|
+
if ((event.type === "event_msg" || event.type === "response_item") && isRecord2(event.payload)) {
|
|
56000
|
+
return convertCodexTranscriptPayload(event.payload, timestamp);
|
|
56001
|
+
}
|
|
56002
|
+
if (event.type === "item.completed" && isRecord2(event.item)) {
|
|
56003
|
+
return convertCodexTranscriptPayload(event.item, timestamp);
|
|
56004
|
+
}
|
|
56005
|
+
return [];
|
|
56006
|
+
}
|
|
56007
|
+
|
|
56008
|
+
// ../../packages/core/src/agents/copilot-transcript-events.ts
|
|
56009
|
+
function isRecord3(value) {
|
|
56010
|
+
return typeof value === "object" && value !== null;
|
|
56011
|
+
}
|
|
56012
|
+
function extractStringContent(value) {
|
|
56013
|
+
if (typeof value === "string") return value.trim();
|
|
56014
|
+
if (!Array.isArray(value)) return "";
|
|
56015
|
+
return value.map((part) => {
|
|
56016
|
+
if (typeof part === "string") return part.trim();
|
|
56017
|
+
if (isRecord3(part)) {
|
|
56018
|
+
if (typeof part.text === "string") return part.text.trim();
|
|
56019
|
+
if (typeof part.content === "string") return part.content.trim();
|
|
56020
|
+
}
|
|
56021
|
+
return "";
|
|
56022
|
+
}).filter(Boolean).join("\n\n");
|
|
56023
|
+
}
|
|
56024
|
+
function buildAssistantContentEvent(content, timestamp) {
|
|
56025
|
+
return {
|
|
56026
|
+
type: "assistant",
|
|
56027
|
+
message: {
|
|
56028
|
+
role: "assistant",
|
|
56029
|
+
content
|
|
56030
|
+
},
|
|
56031
|
+
...timestamp ? { timestamp } : {}
|
|
56032
|
+
};
|
|
56033
|
+
}
|
|
56034
|
+
function extractCopilotEventText(event) {
|
|
56035
|
+
const data = isRecord3(event.data) ? event.data : void 0;
|
|
56036
|
+
const message = isRecord3(event.message) ? event.message : void 0;
|
|
56037
|
+
const dataMessage = isRecord3(data?.message) ? data.message : void 0;
|
|
56038
|
+
return extractStringContent(data?.content) || extractStringContent(data?.text) || extractStringContent(dataMessage?.content) || extractStringContent(dataMessage?.text) || extractStringContent(event.content) || extractStringContent(event.text) || extractStringContent(message?.content) || extractStringContent(message?.text);
|
|
56039
|
+
}
|
|
56040
|
+
function getStringField(record2, field) {
|
|
56041
|
+
const value = record2?.[field];
|
|
56042
|
+
return typeof value === "string" ? value.trim() : "";
|
|
56043
|
+
}
|
|
56044
|
+
function normalizeCopilotToolInput(value) {
|
|
56045
|
+
if (isRecord3(value)) return value;
|
|
56046
|
+
if (typeof value === "string" && value.trim()) {
|
|
56047
|
+
return { arguments: value.trim() };
|
|
56048
|
+
}
|
|
56049
|
+
return {};
|
|
56050
|
+
}
|
|
56051
|
+
function extractCopilotAssistantContent(event) {
|
|
56052
|
+
const data = isRecord3(event.data) ? event.data : void 0;
|
|
56053
|
+
const content = [];
|
|
56054
|
+
const reasoning = extractStringContent(data?.reasoningText) || extractStringContent(data?.reasoning);
|
|
56055
|
+
const text = extractCopilotEventText(event);
|
|
56056
|
+
if (reasoning) {
|
|
56057
|
+
content.push({ type: "thinking", thinking: reasoning });
|
|
56058
|
+
}
|
|
56059
|
+
if (text) {
|
|
56060
|
+
content.push({ type: "text", text });
|
|
56061
|
+
}
|
|
56062
|
+
if (Array.isArray(data?.toolRequests)) {
|
|
56063
|
+
for (const request of data.toolRequests) {
|
|
56064
|
+
if (!isRecord3(request)) continue;
|
|
56065
|
+
const id = getStringField(request, "toolCallId") || getStringField(request, "id") || getStringField(request, "callId");
|
|
56066
|
+
const name2 = getStringField(request, "name") || getStringField(request, "toolName");
|
|
56067
|
+
if (!id || !name2) continue;
|
|
56068
|
+
content.push({
|
|
56069
|
+
type: "tool_use",
|
|
56070
|
+
id,
|
|
56071
|
+
name: name2,
|
|
56072
|
+
input: normalizeCopilotToolInput(request.arguments ?? request.input)
|
|
56073
|
+
});
|
|
56074
|
+
}
|
|
56075
|
+
}
|
|
56076
|
+
return content;
|
|
56077
|
+
}
|
|
56078
|
+
function extractCopilotToolResult(event) {
|
|
56079
|
+
const data = isRecord3(event.data) ? event.data : void 0;
|
|
56080
|
+
const result = isRecord3(data?.result) ? data.result : void 0;
|
|
56081
|
+
const toolUseId = getStringField(data, "toolCallId") || getStringField(data, "toolUseId") || getStringField(data, "id");
|
|
56082
|
+
const content = extractStringContent(result?.content) || extractStringContent(result?.detailedContent) || extractStringContent(data?.result) || extractStringContent(data?.content) || extractStringContent(data?.output);
|
|
56083
|
+
if (!toolUseId || !content) {
|
|
56084
|
+
return null;
|
|
56085
|
+
}
|
|
56086
|
+
return {
|
|
56087
|
+
toolUseId,
|
|
56088
|
+
content,
|
|
56089
|
+
...data?.success === false ? { isError: true } : {}
|
|
56090
|
+
};
|
|
56091
|
+
}
|
|
56092
|
+
function convertCopilotTranscriptEvent(event, opts = {}) {
|
|
56093
|
+
const type = typeof event.type === "string" ? event.type.toLowerCase() : "";
|
|
56094
|
+
const timestamp = typeof event.timestamp === "string" ? event.timestamp : void 0;
|
|
56095
|
+
if (opts.includeUserMessages === true && (type === "user.message" || type === "user_message")) {
|
|
56096
|
+
const text = extractCopilotEventText(event);
|
|
56097
|
+
if (!text) {
|
|
56098
|
+
return [];
|
|
56099
|
+
}
|
|
56100
|
+
return [buildTaskUserLogEvent([{ type: "text", text }], timestamp)];
|
|
56101
|
+
}
|
|
56102
|
+
if (type === "assistant.message" || type === "assistant_message" || type === "assistant" || type === "message") {
|
|
56103
|
+
const content = extractCopilotAssistantContent(event);
|
|
56104
|
+
if (content.length === 0) {
|
|
56105
|
+
return [];
|
|
56106
|
+
}
|
|
56107
|
+
return [buildAssistantContentEvent(content, timestamp)];
|
|
56108
|
+
}
|
|
56109
|
+
if (type === "tool.execution_complete" || type === "tool_execution_complete") {
|
|
56110
|
+
const result = extractCopilotToolResult(event);
|
|
56111
|
+
if (!result) {
|
|
56112
|
+
return [];
|
|
56113
|
+
}
|
|
56114
|
+
return [buildTaskUserLogEvent([{ type: "tool_result", ...result }], timestamp)];
|
|
56115
|
+
}
|
|
56116
|
+
return [];
|
|
56117
|
+
}
|
|
56118
|
+
|
|
56119
|
+
// ../../packages/core/src/agents/native-session-history.ts
|
|
56120
|
+
function isRecord4(value) {
|
|
56121
|
+
return typeof value === "object" && value !== null;
|
|
56122
|
+
}
|
|
55879
56123
|
function readJsonLines(filePath) {
|
|
55880
56124
|
if (!fs8.existsSync(filePath)) {
|
|
55881
56125
|
return [];
|
|
@@ -55887,7 +56131,7 @@ function readJsonLines(filePath) {
|
|
|
55887
56131
|
return content.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).flatMap((line) => {
|
|
55888
56132
|
try {
|
|
55889
56133
|
const parsed = JSON.parse(line);
|
|
55890
|
-
return
|
|
56134
|
+
return isRecord4(parsed) ? [parsed] : [];
|
|
55891
56135
|
} catch {
|
|
55892
56136
|
return [];
|
|
55893
56137
|
}
|
|
@@ -55960,41 +56204,6 @@ function findFirstMatchingFile(rootDir, predicate) {
|
|
|
55960
56204
|
}
|
|
55961
56205
|
return null;
|
|
55962
56206
|
}
|
|
55963
|
-
function buildAssistantTextEvent(text, timestamp) {
|
|
55964
|
-
return {
|
|
55965
|
-
type: "assistant",
|
|
55966
|
-
message: {
|
|
55967
|
-
role: "assistant",
|
|
55968
|
-
content: [{ type: "text", text }]
|
|
55969
|
-
},
|
|
55970
|
-
...timestamp ? { timestamp } : {}
|
|
55971
|
-
};
|
|
55972
|
-
}
|
|
55973
|
-
function buildAssistantThinkingEvent(thinking, timestamp) {
|
|
55974
|
-
return {
|
|
55975
|
-
type: "assistant",
|
|
55976
|
-
message: {
|
|
55977
|
-
role: "assistant",
|
|
55978
|
-
content: [{ type: "thinking", thinking }]
|
|
55979
|
-
},
|
|
55980
|
-
...timestamp ? { timestamp } : {}
|
|
55981
|
-
};
|
|
55982
|
-
}
|
|
55983
|
-
function extractCodexReasoningText(item) {
|
|
55984
|
-
if (typeof item.text === "string") {
|
|
55985
|
-
return item.text.trim();
|
|
55986
|
-
}
|
|
55987
|
-
if (Array.isArray(item.summary)) {
|
|
55988
|
-
return item.summary.map((entry) => {
|
|
55989
|
-
if (typeof entry === "string") return entry.trim();
|
|
55990
|
-
if (isRecord2(entry) && typeof entry.text === "string") {
|
|
55991
|
-
return entry.text.trim();
|
|
55992
|
-
}
|
|
55993
|
-
return "";
|
|
55994
|
-
}).filter(Boolean).join("\n\n");
|
|
55995
|
-
}
|
|
55996
|
-
return "";
|
|
55997
|
-
}
|
|
55998
56207
|
function truncateSummary(text, maxLength = 96) {
|
|
55999
56208
|
const normalized = text.replace(/\s+/g, " ").trim();
|
|
56000
56209
|
if (!normalized) {
|
|
@@ -56013,7 +56222,7 @@ function extractTextFromClaudeMessageContent(content) {
|
|
|
56013
56222
|
return "";
|
|
56014
56223
|
}
|
|
56015
56224
|
for (const part of content) {
|
|
56016
|
-
if (!
|
|
56225
|
+
if (!isRecord4(part)) continue;
|
|
56017
56226
|
if (typeof part.text === "string" && part.text.trim()) {
|
|
56018
56227
|
return truncateSummary(part.text);
|
|
56019
56228
|
}
|
|
@@ -56023,6 +56232,27 @@ function extractTextFromClaudeMessageContent(content) {
|
|
|
56023
56232
|
}
|
|
56024
56233
|
return "";
|
|
56025
56234
|
}
|
|
56235
|
+
function readSimpleYaml(filePath) {
|
|
56236
|
+
if (!fs8.existsSync(filePath)) {
|
|
56237
|
+
return {};
|
|
56238
|
+
}
|
|
56239
|
+
const metadata = {};
|
|
56240
|
+
for (const rawLine of fs8.readFileSync(filePath, "utf8").split(/\r?\n/)) {
|
|
56241
|
+
const line = rawLine.trim();
|
|
56242
|
+
if (!line || line.startsWith("#")) continue;
|
|
56243
|
+
const separatorIndex = line.indexOf(":");
|
|
56244
|
+
if (separatorIndex <= 0) continue;
|
|
56245
|
+
const key = line.slice(0, separatorIndex).trim();
|
|
56246
|
+
let value = line.slice(separatorIndex + 1).trim();
|
|
56247
|
+
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
56248
|
+
value = value.slice(1, -1);
|
|
56249
|
+
}
|
|
56250
|
+
if (key && value) {
|
|
56251
|
+
metadata[key] = value;
|
|
56252
|
+
}
|
|
56253
|
+
}
|
|
56254
|
+
return metadata;
|
|
56255
|
+
}
|
|
56026
56256
|
function findClaudeSessionSummary(entries, sessionId) {
|
|
56027
56257
|
let cwd = "";
|
|
56028
56258
|
let summary = "";
|
|
@@ -56034,7 +56264,7 @@ function findClaudeSessionSummary(entries, sessionId) {
|
|
|
56034
56264
|
if (!cwd && typeof entry.cwd === "string" && entry.cwd.trim()) {
|
|
56035
56265
|
cwd = entry.cwd.trim();
|
|
56036
56266
|
}
|
|
56037
|
-
if (summary || entry.type !== "user" || !
|
|
56267
|
+
if (summary || entry.type !== "user" || !isRecord4(entry.message)) {
|
|
56038
56268
|
continue;
|
|
56039
56269
|
}
|
|
56040
56270
|
const candidate = extractTextFromClaudeMessageContent(entry.message.content);
|
|
@@ -56053,6 +56283,63 @@ function findClaudeSessionSummary(entries, sessionId) {
|
|
|
56053
56283
|
updatedAt
|
|
56054
56284
|
};
|
|
56055
56285
|
}
|
|
56286
|
+
function getClaudeMessageContent(entry) {
|
|
56287
|
+
const message = entry.message;
|
|
56288
|
+
if (!isRecord4(message) || !Array.isArray(message.content)) {
|
|
56289
|
+
return [];
|
|
56290
|
+
}
|
|
56291
|
+
return message.content.filter(isRecord4);
|
|
56292
|
+
}
|
|
56293
|
+
function isClaudeToolResultEvent(entry) {
|
|
56294
|
+
if (!entry || entry.type !== "user") {
|
|
56295
|
+
return false;
|
|
56296
|
+
}
|
|
56297
|
+
const content = getClaudeMessageContent(entry);
|
|
56298
|
+
return content.length > 0 && content.every((block) => block.type === "tool_result");
|
|
56299
|
+
}
|
|
56300
|
+
function isClaudeTextOnlyUserEvent(entry) {
|
|
56301
|
+
if (entry.type !== "user") {
|
|
56302
|
+
return false;
|
|
56303
|
+
}
|
|
56304
|
+
const content = getClaudeMessageContent(entry);
|
|
56305
|
+
return content.length > 0 && content.every((block) => block.type === "text" && typeof block.text === "string");
|
|
56306
|
+
}
|
|
56307
|
+
function convertClaudeGeneratedPrompt(entry) {
|
|
56308
|
+
const content = getClaudeMessageContent(entry);
|
|
56309
|
+
const prompt = content.map((block) => typeof block.text === "string" ? block.text : "").filter(Boolean).join("\n\n").trim();
|
|
56310
|
+
if (!prompt) {
|
|
56311
|
+
return null;
|
|
56312
|
+
}
|
|
56313
|
+
const id = typeof entry.uuid === "string" && entry.uuid.trim() ? entry.uuid.trim() : typeof entry.parentUuid === "string" && entry.parentUuid.trim() ? `${entry.parentUuid.trim()}-generated-prompt` : `generated-prompt-${prompt.slice(0, 24)}`;
|
|
56314
|
+
return {
|
|
56315
|
+
...entry,
|
|
56316
|
+
type: "assistant",
|
|
56317
|
+
message: {
|
|
56318
|
+
role: "assistant",
|
|
56319
|
+
content: [{
|
|
56320
|
+
type: "tool_use",
|
|
56321
|
+
id,
|
|
56322
|
+
name: "AgentPrompt",
|
|
56323
|
+
input: { prompt }
|
|
56324
|
+
}]
|
|
56325
|
+
}
|
|
56326
|
+
};
|
|
56327
|
+
}
|
|
56328
|
+
function normalizeClaudeSessionLogs(entries) {
|
|
56329
|
+
const byUuid = /* @__PURE__ */ new Map();
|
|
56330
|
+
for (const entry of entries) {
|
|
56331
|
+
if (typeof entry.uuid === "string" && entry.uuid.trim()) {
|
|
56332
|
+
byUuid.set(entry.uuid.trim(), entry);
|
|
56333
|
+
}
|
|
56334
|
+
}
|
|
56335
|
+
return entries.map((entry) => {
|
|
56336
|
+
const parent = typeof entry.parentUuid === "string" ? byUuid.get(entry.parentUuid) : void 0;
|
|
56337
|
+
if (isClaudeTextOnlyUserEvent(entry) && isClaudeToolResultEvent(parent)) {
|
|
56338
|
+
return convertClaudeGeneratedPrompt(entry) ?? entry;
|
|
56339
|
+
}
|
|
56340
|
+
return entry;
|
|
56341
|
+
});
|
|
56342
|
+
}
|
|
56056
56343
|
function loadCodexSessionIndex() {
|
|
56057
56344
|
const indexPath = path7.join(getNativeHomeDir(), ".codex", "session_index.jsonl");
|
|
56058
56345
|
const index = /* @__PURE__ */ new Map();
|
|
@@ -56076,7 +56363,7 @@ function findCodexSessionSummary(entries, filePath, sessionIndex) {
|
|
|
56076
56363
|
if (typeof entry.timestamp === "string") {
|
|
56077
56364
|
updatedAt = entry.timestamp;
|
|
56078
56365
|
}
|
|
56079
|
-
if (entry.type === "session_meta" &&
|
|
56366
|
+
if (entry.type === "session_meta" && isRecord4(entry.payload)) {
|
|
56080
56367
|
if (typeof entry.payload.id === "string" && entry.payload.id.trim()) {
|
|
56081
56368
|
sessionId = entry.payload.id.trim();
|
|
56082
56369
|
}
|
|
@@ -56085,7 +56372,7 @@ function findCodexSessionSummary(entries, filePath, sessionIndex) {
|
|
|
56085
56372
|
}
|
|
56086
56373
|
continue;
|
|
56087
56374
|
}
|
|
56088
|
-
if (!summary && entry.type === "event_msg" &&
|
|
56375
|
+
if (!summary && entry.type === "event_msg" && isRecord4(entry.payload) && entry.payload.type === "user_message") {
|
|
56089
56376
|
if (typeof entry.payload.message === "string" && entry.payload.message.trim()) {
|
|
56090
56377
|
summary = truncateSummary(entry.payload.message);
|
|
56091
56378
|
}
|
|
@@ -56118,9 +56405,9 @@ function loadClaudeSessionHistory(sessionId) {
|
|
|
56118
56405
|
if (entry.type !== "user" && entry.type !== "assistant" || entry.isMeta === true || entry.isSidechain === true) {
|
|
56119
56406
|
return false;
|
|
56120
56407
|
}
|
|
56121
|
-
return
|
|
56408
|
+
return isRecord4(entry.message);
|
|
56122
56409
|
});
|
|
56123
|
-
return { logs, sourcePath: sessionFile };
|
|
56410
|
+
return { logs: normalizeClaudeSessionLogs(logs), sourcePath: sessionFile };
|
|
56124
56411
|
}
|
|
56125
56412
|
function loadCodexSessionHistory(sessionId) {
|
|
56126
56413
|
const sessionsDir = path7.join(getNativeHomeDir(), ".codex", "sessions");
|
|
@@ -56128,32 +56415,67 @@ function loadCodexSessionHistory(sessionId) {
|
|
|
56128
56415
|
if (!sessionFile) {
|
|
56129
56416
|
return { logs: [], sourcePath: null };
|
|
56130
56417
|
}
|
|
56131
|
-
const logs = readJsonLines(sessionFile).flatMap(
|
|
56132
|
-
if (entry.type !== "event_msg" || !isRecord2(entry.payload)) {
|
|
56133
|
-
return [];
|
|
56134
|
-
}
|
|
56135
|
-
const timestamp = typeof entry.timestamp === "string" ? entry.timestamp : void 0;
|
|
56136
|
-
const payload = entry.payload;
|
|
56137
|
-
if (payload.type === "user_message" && typeof payload.message === "string" && payload.message.trim()) {
|
|
56138
|
-
return [buildTaskUserLogEvent([{ type: "text", text: payload.message.trim() }], timestamp)];
|
|
56139
|
-
}
|
|
56140
|
-
if (payload.type === "agent_message" && typeof payload.message === "string" && payload.message.trim()) {
|
|
56141
|
-
return [buildAssistantTextEvent(payload.message.trim(), timestamp)];
|
|
56142
|
-
}
|
|
56143
|
-
if (payload.type === "agent_reasoning") {
|
|
56144
|
-
const reasoning = extractCodexReasoningText(payload);
|
|
56145
|
-
if (reasoning) {
|
|
56146
|
-
return [buildAssistantThinkingEvent(reasoning, timestamp)];
|
|
56147
|
-
}
|
|
56148
|
-
}
|
|
56149
|
-
return [];
|
|
56150
|
-
});
|
|
56418
|
+
const logs = readJsonLines(sessionFile).flatMap(convertCodexTranscriptEvent);
|
|
56151
56419
|
return { logs, sourcePath: sessionFile };
|
|
56152
56420
|
}
|
|
56421
|
+
function findCopilotSessionDir(sessionId) {
|
|
56422
|
+
const sessionsDir = path7.join(getNativeHomeDir(), ".copilot", "session-state");
|
|
56423
|
+
if (!fs8.existsSync(sessionsDir)) {
|
|
56424
|
+
return null;
|
|
56425
|
+
}
|
|
56426
|
+
const normalized = sessionId.toLowerCase();
|
|
56427
|
+
const entries = fs8.readdirSync(sessionsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort((left, right) => left.localeCompare(right));
|
|
56428
|
+
const match = entries.find((name2) => name2.toLowerCase() === normalized) ?? entries.find((name2) => name2.toLowerCase().startsWith(normalized));
|
|
56429
|
+
return match ? path7.join(sessionsDir, match) : null;
|
|
56430
|
+
}
|
|
56431
|
+
function loadCopilotSessionHistory(sessionId) {
|
|
56432
|
+
const sessionDir = findCopilotSessionDir(sessionId);
|
|
56433
|
+
if (!sessionDir) {
|
|
56434
|
+
return { logs: [], sourcePath: null };
|
|
56435
|
+
}
|
|
56436
|
+
const sessionFile = path7.join(sessionDir, "events.jsonl");
|
|
56437
|
+
if (!fs8.existsSync(sessionFile)) {
|
|
56438
|
+
return { logs: [], sourcePath: null };
|
|
56439
|
+
}
|
|
56440
|
+
const logs = readJsonLines(sessionFile).flatMap((entry) => convertCopilotTranscriptEvent(entry, { includeUserMessages: true }));
|
|
56441
|
+
return { logs, sourcePath: sessionFile };
|
|
56442
|
+
}
|
|
56443
|
+
function findFirstCopilotUserMessage(sessionDir) {
|
|
56444
|
+
const sessionFile = path7.join(sessionDir, "events.jsonl");
|
|
56445
|
+
for (const entry of readJsonLines(sessionFile)) {
|
|
56446
|
+
const type = typeof entry.type === "string" ? entry.type.toLowerCase() : "";
|
|
56447
|
+
if (type !== "user.message" && type !== "user_message") continue;
|
|
56448
|
+
const text = extractCopilotEventText(entry);
|
|
56449
|
+
if (text) {
|
|
56450
|
+
return truncateSummary(text);
|
|
56451
|
+
}
|
|
56452
|
+
}
|
|
56453
|
+
return "";
|
|
56454
|
+
}
|
|
56455
|
+
function findCopilotSessionSummary(sessionDir) {
|
|
56456
|
+
const workspacePath = path7.join(sessionDir, "workspace.yaml");
|
|
56457
|
+
const metadata = readSimpleYaml(workspacePath);
|
|
56458
|
+
const sessionId = metadata.id || path7.basename(sessionDir);
|
|
56459
|
+
const cwd = metadata.cwd;
|
|
56460
|
+
if (!sessionId || !cwd) {
|
|
56461
|
+
return null;
|
|
56462
|
+
}
|
|
56463
|
+
const summary = metadata.name ? truncateSummary(metadata.name) : findFirstCopilotUserMessage(sessionDir);
|
|
56464
|
+
return {
|
|
56465
|
+
agent: "copilot",
|
|
56466
|
+
sessionId,
|
|
56467
|
+
cwd,
|
|
56468
|
+
summary: summary || `Copilot session ${sessionId.slice(0, 12)}`,
|
|
56469
|
+
updatedAt: metadata.updated_at || metadata.created_at || null
|
|
56470
|
+
};
|
|
56471
|
+
}
|
|
56153
56472
|
function loadNativeSessionHistory(input) {
|
|
56154
56473
|
if (input.agent === "claudecode") {
|
|
56155
56474
|
return loadClaudeSessionHistory(input.sessionId);
|
|
56156
56475
|
}
|
|
56476
|
+
if (input.agent === "copilot") {
|
|
56477
|
+
return loadCopilotSessionHistory(input.sessionId);
|
|
56478
|
+
}
|
|
56157
56479
|
return loadCodexSessionHistory(input.sessionId);
|
|
56158
56480
|
}
|
|
56159
56481
|
function listNativeSessions(input) {
|
|
@@ -56177,6 +56499,23 @@ function listNativeSessions(input) {
|
|
|
56177
56499
|
};
|
|
56178
56500
|
}).filter((session) => session !== null).sort(compareUpdatedSessions).slice(0, limit);
|
|
56179
56501
|
}
|
|
56502
|
+
if (input.agent === "copilot") {
|
|
56503
|
+
const sessionsDir2 = path7.join(getNativeHomeDir(), ".copilot", "session-state");
|
|
56504
|
+
if (!fs8.existsSync(sessionsDir2)) {
|
|
56505
|
+
return [];
|
|
56506
|
+
}
|
|
56507
|
+
return fs8.readdirSync(sessionsDir2, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => {
|
|
56508
|
+
const sessionDir = path7.join(sessionsDir2, entry.name);
|
|
56509
|
+
const summary = findCopilotSessionSummary(sessionDir);
|
|
56510
|
+
if (!summary) {
|
|
56511
|
+
return null;
|
|
56512
|
+
}
|
|
56513
|
+
return {
|
|
56514
|
+
...summary,
|
|
56515
|
+
updatedAt: summary.updatedAt ?? readFileModifiedAt(path7.join(sessionDir, "events.jsonl")) ?? readFileModifiedAt(path7.join(sessionDir, "workspace.yaml"))
|
|
56516
|
+
};
|
|
56517
|
+
}).filter((session) => session !== null).sort(compareUpdatedSessions).slice(0, limit);
|
|
56518
|
+
}
|
|
56180
56519
|
const sessionIndex = loadCodexSessionIndex();
|
|
56181
56520
|
const sessionsDir = path7.join(getNativeHomeDir(), ".codex", "sessions");
|
|
56182
56521
|
return findMatchingFiles(sessionsDir, (filePath) => filePath.toLowerCase().endsWith(".jsonl")).map((filePath) => {
|
|
@@ -56592,6 +56931,24 @@ function resolveCodexInvocation() {
|
|
|
56592
56931
|
}
|
|
56593
56932
|
return { command: "codex", argsPrefix: [] };
|
|
56594
56933
|
}
|
|
56934
|
+
function resolveCopilotInvocation() {
|
|
56935
|
+
if (process.platform !== "win32") {
|
|
56936
|
+
return { command: "copilot", argsPrefix: [] };
|
|
56937
|
+
}
|
|
56938
|
+
const pathEntries = getPathEntries();
|
|
56939
|
+
for (const entry of pathEntries) {
|
|
56940
|
+
const shimPath = path8.join(entry, "copilot.cmd");
|
|
56941
|
+
if (!fs9.existsSync(shimPath)) continue;
|
|
56942
|
+
const cliPath = path8.join(entry, "node_modules", "@github", "copilot", "npm-loader.js");
|
|
56943
|
+
if (fs9.existsSync(cliPath)) {
|
|
56944
|
+
return {
|
|
56945
|
+
command: process.execPath,
|
|
56946
|
+
argsPrefix: [cliPath]
|
|
56947
|
+
};
|
|
56948
|
+
}
|
|
56949
|
+
}
|
|
56950
|
+
return { command: "copilot", argsPrefix: [] };
|
|
56951
|
+
}
|
|
56595
56952
|
|
|
56596
56953
|
// ../../packages/core/src/agents/lite-functions/index.ts
|
|
56597
56954
|
var TITLE_MAX_LENGTH = 72;
|
|
@@ -56651,7 +57008,7 @@ var LiteAgentRunner = class {
|
|
|
56651
57008
|
}
|
|
56652
57009
|
};
|
|
56653
57010
|
function runProcessForOutput(command, args, prompt, cwd, extractOutput) {
|
|
56654
|
-
return new Promise((
|
|
57011
|
+
return new Promise((resolve15, reject) => {
|
|
56655
57012
|
const proc = (0, import_node_child_process3.spawn)(command, args, {
|
|
56656
57013
|
cwd: cwd ?? process.cwd(),
|
|
56657
57014
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -56671,7 +57028,7 @@ function runProcessForOutput(command, args, prompt, cwd, extractOutput) {
|
|
|
56671
57028
|
return;
|
|
56672
57029
|
}
|
|
56673
57030
|
try {
|
|
56674
|
-
|
|
57031
|
+
resolve15(extractOutput ? extractOutput(stdout) : stdout.trim());
|
|
56675
57032
|
} catch (error2) {
|
|
56676
57033
|
reject(error2);
|
|
56677
57034
|
}
|
|
@@ -56698,6 +57055,29 @@ function extractLastCodexAgentMessage(stdout) {
|
|
|
56698
57055
|
}
|
|
56699
57056
|
return lastMessage.trim();
|
|
56700
57057
|
}
|
|
57058
|
+
function extractLastCopilotAssistantMessage(stdout) {
|
|
57059
|
+
let lastMessage = "";
|
|
57060
|
+
for (const line of stdout.split("\n")) {
|
|
57061
|
+
if (!line.trim()) continue;
|
|
57062
|
+
try {
|
|
57063
|
+
const event = JSON.parse(line);
|
|
57064
|
+
const message = typeof event.message === "object" && event.message !== null ? event.message : void 0;
|
|
57065
|
+
const data = typeof event.data === "object" && event.data !== null ? event.data : void 0;
|
|
57066
|
+
const dataMessage = typeof data?.message === "object" && data.message !== null ? data.message : void 0;
|
|
57067
|
+
const content = message?.content ?? event.content ?? event.text ?? dataMessage?.content ?? data?.content ?? data?.text ?? dataMessage?.text;
|
|
57068
|
+
const text = typeof content === "string" ? content.trim() : "";
|
|
57069
|
+
const type = typeof event.type === "string" ? event.type.toLowerCase() : "";
|
|
57070
|
+
if (text && (type.includes("assistant") || type === "message")) {
|
|
57071
|
+
lastMessage = text;
|
|
57072
|
+
}
|
|
57073
|
+
} catch {
|
|
57074
|
+
}
|
|
57075
|
+
}
|
|
57076
|
+
if (!lastMessage.trim()) {
|
|
57077
|
+
throw new Error("Copilot lite call did not return an assistant message");
|
|
57078
|
+
}
|
|
57079
|
+
return lastMessage.trim();
|
|
57080
|
+
}
|
|
56701
57081
|
var ClaudeLiteAdapter = class {
|
|
56702
57082
|
runLite(prompt, options) {
|
|
56703
57083
|
const invocation = resolveClaudeInvocation();
|
|
@@ -56734,6 +57114,21 @@ var CodexLiteAdapter = class {
|
|
|
56734
57114
|
return runProcessForOutput(invocation.command, args, prompt, options.cwd, extractLastCodexAgentMessage);
|
|
56735
57115
|
}
|
|
56736
57116
|
};
|
|
57117
|
+
var CopilotLiteAdapter = class {
|
|
57118
|
+
runLite(prompt, options) {
|
|
57119
|
+
const invocation = resolveCopilotInvocation();
|
|
57120
|
+
const args = [
|
|
57121
|
+
...invocation.argsPrefix,
|
|
57122
|
+
"--output-format=json",
|
|
57123
|
+
"--no-ask-user",
|
|
57124
|
+
"--allow-all-tools",
|
|
57125
|
+
"-p",
|
|
57126
|
+
prompt
|
|
57127
|
+
];
|
|
57128
|
+
if (options.model) args.splice(args.length - 2, 0, `--model=${options.model}`);
|
|
57129
|
+
return runProcessForOutput(invocation.command, args, "", options.cwd, extractLastCopilotAssistantMessage);
|
|
57130
|
+
}
|
|
57131
|
+
};
|
|
56737
57132
|
|
|
56738
57133
|
// ../../packages/core/src/agents/engines/claude-code-engine.ts
|
|
56739
57134
|
var fs10 = __toESM(require("fs"), 1);
|
|
@@ -56765,6 +57160,9 @@ function getClaudeStreamError(event) {
|
|
|
56765
57160
|
}
|
|
56766
57161
|
return null;
|
|
56767
57162
|
}
|
|
57163
|
+
function shouldSkipClaudeTranscriptEvent(event) {
|
|
57164
|
+
return event.isMeta === true || event.isSidechain === true || event.type === "attachment" || event.type === "last-prompt";
|
|
57165
|
+
}
|
|
56768
57166
|
var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
56769
57167
|
sessions = /* @__PURE__ */ new Map();
|
|
56770
57168
|
/** Rebuild in-memory sessions map from persisted task payloads. */
|
|
@@ -56821,6 +57219,9 @@ var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
|
56821
57219
|
try {
|
|
56822
57220
|
const event = JSON.parse(line);
|
|
56823
57221
|
streamError = getClaudeStreamError(event) ?? streamError;
|
|
57222
|
+
if (shouldSkipClaudeTranscriptEvent(event)) {
|
|
57223
|
+
return;
|
|
57224
|
+
}
|
|
56824
57225
|
if (event.type === "system" && event.subtype === "init" && typeof event.session_id === "string") {
|
|
56825
57226
|
this.sessions.set(task.id, {
|
|
56826
57227
|
sessionId: event.session_id,
|
|
@@ -56947,6 +57348,9 @@ var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
|
56947
57348
|
try {
|
|
56948
57349
|
const event = JSON.parse(line);
|
|
56949
57350
|
streamError = getClaudeStreamError(event) ?? streamError;
|
|
57351
|
+
if (shouldSkipClaudeTranscriptEvent(event)) {
|
|
57352
|
+
return;
|
|
57353
|
+
}
|
|
56950
57354
|
if (event.type === "system" && event.subtype === "init" && typeof event.session_id === "string") {
|
|
56951
57355
|
this.sessions.set(taskId, {
|
|
56952
57356
|
sessionId: event.session_id,
|
|
@@ -57086,40 +57490,25 @@ var ClaudeCodeEngine = class extends ExecutionEngine {
|
|
|
57086
57490
|
var fs11 = __toESM(require("fs"), 1);
|
|
57087
57491
|
var path10 = __toESM(require("path"), 1);
|
|
57088
57492
|
var import_node_child_process5 = require("child_process");
|
|
57089
|
-
|
|
57090
|
-
|
|
57091
|
-
|
|
57092
|
-
message: {
|
|
57093
|
-
role: "assistant",
|
|
57094
|
-
content: [{ type: "text", text }]
|
|
57095
|
-
},
|
|
57096
|
-
timestamp
|
|
57097
|
-
};
|
|
57098
|
-
}
|
|
57099
|
-
function buildAssistantThinkingEvent2(thinking, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
57100
|
-
return {
|
|
57101
|
-
type: "assistant",
|
|
57102
|
-
message: {
|
|
57103
|
-
role: "assistant",
|
|
57104
|
-
content: [{ type: "thinking", thinking }]
|
|
57105
|
-
},
|
|
57106
|
-
timestamp
|
|
57107
|
-
};
|
|
57493
|
+
var CODEX_SESSION_MIRROR_INTERVAL_MS = 500;
|
|
57494
|
+
function isRecord5(value) {
|
|
57495
|
+
return typeof value === "object" && value !== null;
|
|
57108
57496
|
}
|
|
57109
|
-
function
|
|
57110
|
-
if (
|
|
57111
|
-
return
|
|
57497
|
+
function stableStringify(value) {
|
|
57498
|
+
if (Array.isArray(value)) {
|
|
57499
|
+
return `[${value.map((entry) => stableStringify(entry)).join(",")}]`;
|
|
57112
57500
|
}
|
|
57113
|
-
if (
|
|
57114
|
-
return
|
|
57115
|
-
if (typeof entry === "string") return entry.trim();
|
|
57116
|
-
if (typeof entry === "object" && entry !== null && typeof entry.text === "string") {
|
|
57117
|
-
return String(entry.text).trim();
|
|
57118
|
-
}
|
|
57119
|
-
return "";
|
|
57120
|
-
}).filter(Boolean).join("\n\n");
|
|
57501
|
+
if (!isRecord5(value)) {
|
|
57502
|
+
return JSON.stringify(value);
|
|
57121
57503
|
}
|
|
57122
|
-
return ""
|
|
57504
|
+
return `{${Object.entries(value).filter(([, entryValue]) => entryValue !== void 0).sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey)).map(([key, entryValue]) => `${JSON.stringify(key)}:${stableStringify(entryValue)}`).join(",")}}`;
|
|
57505
|
+
}
|
|
57506
|
+
function transcriptEventSignature(event) {
|
|
57507
|
+
const message = event.message;
|
|
57508
|
+
if ((event.type === "assistant" || event.type === "user") && isRecord5(message) && Array.isArray(message.content)) {
|
|
57509
|
+
return `${event.type}:${stableStringify(message.content)}`;
|
|
57510
|
+
}
|
|
57511
|
+
return stableStringify(event);
|
|
57123
57512
|
}
|
|
57124
57513
|
function sanitizeFilename(filename) {
|
|
57125
57514
|
return filename.replace(/[^a-zA-Z0-9._-]/g, "-");
|
|
@@ -57157,6 +57546,8 @@ function buildCodexModeArgs(mode) {
|
|
|
57157
57546
|
}
|
|
57158
57547
|
var CodexEngine = class extends ExecutionEngine {
|
|
57159
57548
|
sessions = /* @__PURE__ */ new Map();
|
|
57549
|
+
nativeSessionMirrors = /* @__PURE__ */ new Map();
|
|
57550
|
+
emittedTranscriptSignatures = /* @__PURE__ */ new Map();
|
|
57160
57551
|
/** Rebuild in-memory sessions map from persisted task payloads. */
|
|
57161
57552
|
init() {
|
|
57162
57553
|
const { tasks } = this.taskEngine.listTasks();
|
|
@@ -57257,11 +57648,7 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
57257
57648
|
if (!line.trim()) return;
|
|
57258
57649
|
try {
|
|
57259
57650
|
const event = JSON.parse(line);
|
|
57260
|
-
|
|
57261
|
-
if (converted) {
|
|
57262
|
-
this.emitOutput(taskId, converted);
|
|
57263
|
-
this.appendLog(taskId, converted);
|
|
57264
|
-
}
|
|
57651
|
+
this.emitConvertedEvents(taskId, this.handleEvent(taskId, title, cwd, event));
|
|
57265
57652
|
} catch {
|
|
57266
57653
|
}
|
|
57267
57654
|
};
|
|
@@ -57281,10 +57668,12 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
57281
57668
|
processLine(buffer);
|
|
57282
57669
|
}
|
|
57283
57670
|
if (this.shouldSkipProcessOutcome(activeProcess)) {
|
|
57671
|
+
this.stopNativeSessionMirror(taskId);
|
|
57284
57672
|
this.releaseProcess(activeProcess);
|
|
57285
57673
|
return;
|
|
57286
57674
|
}
|
|
57287
57675
|
try {
|
|
57676
|
+
this.flushNativeSessionMirror(taskId);
|
|
57288
57677
|
if (code === 0) {
|
|
57289
57678
|
this.logger.info(isFollowUp ? "Codex follow-up completed" : "Codex task completed successfully", {
|
|
57290
57679
|
taskId,
|
|
@@ -57307,11 +57696,13 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
57307
57696
|
reason: err instanceof Error ? err.message : String(err)
|
|
57308
57697
|
});
|
|
57309
57698
|
} finally {
|
|
57699
|
+
this.stopNativeSessionMirror(taskId);
|
|
57310
57700
|
this.releaseProcess(activeProcess);
|
|
57311
57701
|
}
|
|
57312
57702
|
});
|
|
57313
57703
|
proc.on("error", (err) => {
|
|
57314
57704
|
if (this.shouldSkipProcessOutcome(activeProcess)) {
|
|
57705
|
+
this.stopNativeSessionMirror(taskId);
|
|
57315
57706
|
this.releaseProcess(activeProcess);
|
|
57316
57707
|
return;
|
|
57317
57708
|
}
|
|
@@ -57327,10 +57718,54 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
57327
57718
|
reason: reportErr instanceof Error ? reportErr.message : String(reportErr)
|
|
57328
57719
|
});
|
|
57329
57720
|
} finally {
|
|
57721
|
+
this.stopNativeSessionMirror(taskId);
|
|
57330
57722
|
this.releaseProcess(activeProcess);
|
|
57331
57723
|
}
|
|
57332
57724
|
});
|
|
57333
57725
|
}
|
|
57726
|
+
emitConvertedEvents(taskId, events) {
|
|
57727
|
+
if (events.length === 0) return;
|
|
57728
|
+
let emitted = this.emittedTranscriptSignatures.get(taskId);
|
|
57729
|
+
if (!emitted) {
|
|
57730
|
+
emitted = /* @__PURE__ */ new Set();
|
|
57731
|
+
this.emittedTranscriptSignatures.set(taskId, emitted);
|
|
57732
|
+
}
|
|
57733
|
+
for (const event of events) {
|
|
57734
|
+
const signature = transcriptEventSignature(event);
|
|
57735
|
+
if (emitted.has(signature)) {
|
|
57736
|
+
continue;
|
|
57737
|
+
}
|
|
57738
|
+
emitted.add(signature);
|
|
57739
|
+
this.emitOutput(taskId, event);
|
|
57740
|
+
this.appendLog(taskId, event);
|
|
57741
|
+
}
|
|
57742
|
+
}
|
|
57743
|
+
startNativeSessionMirror(taskId, sessionId) {
|
|
57744
|
+
this.stopNativeSessionMirror(taskId);
|
|
57745
|
+
const mirror = {
|
|
57746
|
+
sessionId,
|
|
57747
|
+
timer: setInterval(() => this.flushNativeSessionMirror(taskId), CODEX_SESSION_MIRROR_INTERVAL_MS)
|
|
57748
|
+
};
|
|
57749
|
+
mirror.timer.unref?.();
|
|
57750
|
+
this.nativeSessionMirrors.set(taskId, mirror);
|
|
57751
|
+
this.flushNativeSessionMirror(taskId);
|
|
57752
|
+
}
|
|
57753
|
+
stopNativeSessionMirror(taskId) {
|
|
57754
|
+
const mirror = this.nativeSessionMirrors.get(taskId);
|
|
57755
|
+
if (!mirror) return;
|
|
57756
|
+
clearInterval(mirror.timer);
|
|
57757
|
+
this.nativeSessionMirrors.delete(taskId);
|
|
57758
|
+
this.emittedTranscriptSignatures.delete(taskId);
|
|
57759
|
+
}
|
|
57760
|
+
flushNativeSessionMirror(taskId) {
|
|
57761
|
+
const mirror = this.nativeSessionMirrors.get(taskId);
|
|
57762
|
+
if (!mirror) return;
|
|
57763
|
+
try {
|
|
57764
|
+
const { logs } = loadNativeSessionHistory({ agent: "codex", sessionId: mirror.sessionId });
|
|
57765
|
+
this.emitConvertedEvents(taskId, logs);
|
|
57766
|
+
} catch {
|
|
57767
|
+
}
|
|
57768
|
+
}
|
|
57334
57769
|
/** Translate a Codex JSON event into a Meshy transcript event. */
|
|
57335
57770
|
handleEvent(taskId, title, cwd, event) {
|
|
57336
57771
|
if (event.type === "thread.started" && typeof event.thread_id === "string") {
|
|
@@ -57342,22 +57777,11 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
57342
57777
|
this.persistSession(taskId, event.thread_id, cwd);
|
|
57343
57778
|
this.appendLog(taskId, event);
|
|
57344
57779
|
this.emitOutput(taskId, event);
|
|
57780
|
+
this.startNativeSessionMirror(taskId, event.thread_id);
|
|
57345
57781
|
this.logger.info("Codex session established", { taskId, sessionId: event.thread_id });
|
|
57346
|
-
return
|
|
57347
|
-
}
|
|
57348
|
-
if (event.type === "item.completed") {
|
|
57349
|
-
const item = event.item;
|
|
57350
|
-
if (item?.type === "agent_message" && typeof item.text === "string" && item.text.trim()) {
|
|
57351
|
-
return buildAssistantEvent(item.text);
|
|
57352
|
-
}
|
|
57353
|
-
if (item?.type === "reasoning" || item?.type === "agent_reasoning") {
|
|
57354
|
-
const reasoning = extractCodexReasoningText2(item);
|
|
57355
|
-
if (reasoning) {
|
|
57356
|
-
return buildAssistantThinkingEvent2(reasoning);
|
|
57357
|
-
}
|
|
57358
|
-
}
|
|
57782
|
+
return [];
|
|
57359
57783
|
}
|
|
57360
|
-
return
|
|
57784
|
+
return convertCodexTranscriptEvent(event);
|
|
57361
57785
|
}
|
|
57362
57786
|
/** Write image attachments to disk and return the text prompt + file paths. */
|
|
57363
57787
|
prepareAssets(taskId, content) {
|
|
@@ -57429,9 +57853,327 @@ var CodexEngine = class extends ExecutionEngine {
|
|
|
57429
57853
|
}
|
|
57430
57854
|
};
|
|
57431
57855
|
|
|
57856
|
+
// ../../packages/core/src/agents/engines/copilot-cli-engine.ts
|
|
57857
|
+
var fs12 = __toESM(require("fs"), 1);
|
|
57858
|
+
var path11 = __toESM(require("path"), 1);
|
|
57859
|
+
var import_node_child_process6 = require("child_process");
|
|
57860
|
+
function isRecord6(value) {
|
|
57861
|
+
return typeof value === "object" && value !== null;
|
|
57862
|
+
}
|
|
57863
|
+
function contentToPrompt(content) {
|
|
57864
|
+
const text = content.filter((part) => part.type === "text").map((part) => part.text.trim()).filter(Boolean).join("\n\n");
|
|
57865
|
+
const imageCount = content.filter((part) => part.type === "image").length;
|
|
57866
|
+
if (text) return text;
|
|
57867
|
+
return imageCount > 0 ? "Review the attached image(s) and continue this task." : "Continue this task.";
|
|
57868
|
+
}
|
|
57869
|
+
function buildPrompt(content, systemPrompt) {
|
|
57870
|
+
const prompt = contentToPrompt(content);
|
|
57871
|
+
return systemPrompt?.trim() ? `${systemPrompt.trim()}
|
|
57872
|
+
|
|
57873
|
+
${prompt}` : prompt;
|
|
57874
|
+
}
|
|
57875
|
+
function buildCopilotModeArgs(mode, cwd) {
|
|
57876
|
+
switch (mode) {
|
|
57877
|
+
case "plan":
|
|
57878
|
+
return ["--mode=plan", "--allow-all-tools", `--add-dir=${cwd}`];
|
|
57879
|
+
case "dangerous":
|
|
57880
|
+
return ["--allow-all"];
|
|
57881
|
+
case "edit":
|
|
57882
|
+
case "bypass":
|
|
57883
|
+
default:
|
|
57884
|
+
return ["--allow-all-tools", `--add-dir=${cwd}`];
|
|
57885
|
+
}
|
|
57886
|
+
}
|
|
57887
|
+
function sanitizeFilename2(filename) {
|
|
57888
|
+
return filename.replace(/[^a-zA-Z0-9._-]/g, "-");
|
|
57889
|
+
}
|
|
57890
|
+
function inferExtension2(mediaType) {
|
|
57891
|
+
const subtype = mediaType.split("/")[1] ?? "bin";
|
|
57892
|
+
const normalized = subtype.toLowerCase();
|
|
57893
|
+
if (normalized === "jpeg") return "jpg";
|
|
57894
|
+
if (normalized === "svg+xml") return "svg";
|
|
57895
|
+
return normalized.replace(/[^a-z0-9]/g, "") || "bin";
|
|
57896
|
+
}
|
|
57897
|
+
function extractSessionId(event) {
|
|
57898
|
+
const data = isRecord6(event.data) ? event.data : void 0;
|
|
57899
|
+
const direct = event.session_id ?? event.sessionId ?? event.conversation_id ?? event.conversationId ?? data?.sessionId ?? data?.session_id ?? data?.conversationId ?? data?.conversation_id;
|
|
57900
|
+
if (typeof direct === "string" && direct.trim()) return direct.trim();
|
|
57901
|
+
const type = typeof event.type === "string" ? event.type.toLowerCase() : "";
|
|
57902
|
+
const isSessionStart = type === "session_started" || type === "session.started" || type === "session_start";
|
|
57903
|
+
if (isSessionStart && typeof event.id === "string" && event.id.trim()) return event.id.trim();
|
|
57904
|
+
if (isSessionStart && typeof data?.id === "string" && data.id.trim()) return data.id.trim();
|
|
57905
|
+
return null;
|
|
57906
|
+
}
|
|
57907
|
+
var CopilotCliEngine = class extends ExecutionEngine {
|
|
57908
|
+
sessions = /* @__PURE__ */ new Map();
|
|
57909
|
+
init() {
|
|
57910
|
+
const { tasks } = this.taskEngine.listTasks();
|
|
57911
|
+
for (const task of tasks) {
|
|
57912
|
+
if (task.agent !== "copilot") continue;
|
|
57913
|
+
const sessionId = task.payload.sessionId;
|
|
57914
|
+
if (!sessionId) continue;
|
|
57915
|
+
const cwd = path11.resolve(
|
|
57916
|
+
task.payload.sessionCwd ?? task.effectiveProjectPath ?? task.project ?? process.cwd()
|
|
57917
|
+
);
|
|
57918
|
+
this.sessions.set(task.id, { sessionId, cwd, title: task.title });
|
|
57919
|
+
}
|
|
57920
|
+
if (this.sessions.size > 0) {
|
|
57921
|
+
this.logger.info("Recovered Copilot CLI sessions from store", { count: this.sessions.size });
|
|
57922
|
+
}
|
|
57923
|
+
}
|
|
57924
|
+
run(task) {
|
|
57925
|
+
const config2 = this.buildConfig(task);
|
|
57926
|
+
const cwd = task.effectiveProjectPath ?? task.project ?? process.cwd();
|
|
57927
|
+
const initialContent = getTaskInitialMessageContent(task);
|
|
57928
|
+
const prompt = buildPrompt(initialContent, config2.systemPrompt);
|
|
57929
|
+
const attachmentPaths = this.prepareAttachments(task.id, initialContent);
|
|
57930
|
+
const args = this.buildArgs(prompt, {
|
|
57931
|
+
cwd,
|
|
57932
|
+
model: config2.model,
|
|
57933
|
+
mode: config2.mode ?? "bypass",
|
|
57934
|
+
allowedTools: config2.allowedTools,
|
|
57935
|
+
attachmentPaths
|
|
57936
|
+
});
|
|
57937
|
+
this.ensureLogDir();
|
|
57938
|
+
this.logger.info("Spawning copilot CLI", { taskId: task.id, title: task.title, cwd });
|
|
57939
|
+
const invocation = resolveCopilotInvocation();
|
|
57940
|
+
const proc = (0, import_node_child_process6.spawn)(invocation.command, [...invocation.argsPrefix, ...args], {
|
|
57941
|
+
cwd,
|
|
57942
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
57943
|
+
});
|
|
57944
|
+
this.attachProcess(task.id, task.title, cwd, proc, false);
|
|
57945
|
+
proc.unref();
|
|
57946
|
+
}
|
|
57947
|
+
sendMessage(taskId, content) {
|
|
57948
|
+
let session = this.sessions.get(taskId);
|
|
57949
|
+
if (!session) {
|
|
57950
|
+
const recovered = this.recoverSession(taskId) ?? this.recoverPersistedSession(taskId);
|
|
57951
|
+
if (recovered) {
|
|
57952
|
+
this.sessions.set(taskId, recovered);
|
|
57953
|
+
session = recovered;
|
|
57954
|
+
}
|
|
57955
|
+
}
|
|
57956
|
+
if (!session) {
|
|
57957
|
+
throw new MeshyError("TASK_NOT_FOUND", `No active session for task ${taskId}`, 404);
|
|
57958
|
+
}
|
|
57959
|
+
const current = this.taskEngine.getTask(taskId);
|
|
57960
|
+
const model = typeof current?.payload.model === "string" ? current.payload.model : void 0;
|
|
57961
|
+
const mode = current?.payload.mode;
|
|
57962
|
+
const systemPrompt = typeof current?.payload.systemPrompt === "string" ? current.payload.systemPrompt : void 0;
|
|
57963
|
+
const allowedTools = Array.isArray(current?.payload.allowedTools) && current.payload.allowedTools.every((tool) => typeof tool === "string") ? current.payload.allowedTools : void 0;
|
|
57964
|
+
const userEvent = buildTaskUserLogEvent(content);
|
|
57965
|
+
this.appendLog(taskId, userEvent);
|
|
57966
|
+
this.emitOutput(taskId, userEvent);
|
|
57967
|
+
const prompt = buildPrompt(content, systemPrompt);
|
|
57968
|
+
const attachmentPaths = this.prepareAttachments(taskId, content);
|
|
57969
|
+
const args = this.buildArgs(prompt, {
|
|
57970
|
+
cwd: session.cwd,
|
|
57971
|
+
model,
|
|
57972
|
+
sessionId: session.sessionId,
|
|
57973
|
+
mode: mode === "plan" || mode === "edit" || mode === "dangerous" || mode === "bypass" ? mode : "bypass",
|
|
57974
|
+
allowedTools,
|
|
57975
|
+
attachmentPaths
|
|
57976
|
+
});
|
|
57977
|
+
this.logger.info("Sending Copilot CLI follow-up message", { taskId, sessionId: session.sessionId });
|
|
57978
|
+
const invocation = resolveCopilotInvocation();
|
|
57979
|
+
const proc = (0, import_node_child_process6.spawn)(invocation.command, [...invocation.argsPrefix, ...args], {
|
|
57980
|
+
cwd: session.cwd,
|
|
57981
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
57982
|
+
});
|
|
57983
|
+
this.attachProcess(taskId, session.title, session.cwd, proc, true);
|
|
57984
|
+
proc.unref();
|
|
57985
|
+
}
|
|
57986
|
+
buildArgs(prompt, opts) {
|
|
57987
|
+
const args = ["--output-format=json", "--no-ask-user", ...buildCopilotModeArgs(opts.mode ?? "bypass", opts.cwd)];
|
|
57988
|
+
if (opts.model) args.push(`--model=${opts.model}`);
|
|
57989
|
+
if (opts.sessionId) args.push(`--resume=${opts.sessionId}`);
|
|
57990
|
+
if (opts.allowedTools && opts.allowedTools.length > 0 && !args.includes("--allow-all")) {
|
|
57991
|
+
const allowAllToolsIndex = args.indexOf("--allow-all-tools");
|
|
57992
|
+
if (allowAllToolsIndex >= 0) args.splice(allowAllToolsIndex, 1);
|
|
57993
|
+
args.push(`--allow-tool=${opts.allowedTools.join(",")}`);
|
|
57994
|
+
}
|
|
57995
|
+
for (const attachmentPath of opts.attachmentPaths ?? []) {
|
|
57996
|
+
args.push("--attachment", attachmentPath);
|
|
57997
|
+
}
|
|
57998
|
+
args.push("-p", prompt);
|
|
57999
|
+
return args;
|
|
58000
|
+
}
|
|
58001
|
+
prepareAttachments(taskId, content) {
|
|
58002
|
+
const images = content.filter((part) => part.type === "image");
|
|
58003
|
+
if (images.length === 0) return [];
|
|
58004
|
+
const attachmentDir = path11.join(this.logDir, "attachments", taskId);
|
|
58005
|
+
fs12.mkdirSync(attachmentDir, { recursive: true });
|
|
58006
|
+
const usedFilenames = /* @__PURE__ */ new Set();
|
|
58007
|
+
return images.map((image, index) => {
|
|
58008
|
+
const fallbackName = `image-${Date.now()}-${index}.${inferExtension2(image.mediaType)}`;
|
|
58009
|
+
const filename = this.makeUniqueAttachmentFilename(sanitizeFilename2(image.filename ?? fallbackName), usedFilenames);
|
|
58010
|
+
const filePath = path11.join(attachmentDir, filename);
|
|
58011
|
+
fs12.writeFileSync(filePath, Buffer.from(image.data, "base64"));
|
|
58012
|
+
return filePath;
|
|
58013
|
+
});
|
|
58014
|
+
}
|
|
58015
|
+
makeUniqueAttachmentFilename(filename, usedFilenames) {
|
|
58016
|
+
if (!usedFilenames.has(filename)) {
|
|
58017
|
+
usedFilenames.add(filename);
|
|
58018
|
+
return filename;
|
|
58019
|
+
}
|
|
58020
|
+
const extension = path11.extname(filename);
|
|
58021
|
+
const base = extension ? filename.slice(0, -extension.length) : filename;
|
|
58022
|
+
let suffix = 2;
|
|
58023
|
+
let candidate = `${base}-${suffix}${extension}`;
|
|
58024
|
+
while (usedFilenames.has(candidate)) {
|
|
58025
|
+
suffix += 1;
|
|
58026
|
+
candidate = `${base}-${suffix}${extension}`;
|
|
58027
|
+
}
|
|
58028
|
+
usedFilenames.add(candidate);
|
|
58029
|
+
return candidate;
|
|
58030
|
+
}
|
|
58031
|
+
attachProcess(taskId, title, cwd, proc, isFollowUp) {
|
|
58032
|
+
const activeProcess = this.trackProcess(taskId, proc);
|
|
58033
|
+
let buffer = "";
|
|
58034
|
+
let stderrBuffer = "";
|
|
58035
|
+
const processLine = (line) => {
|
|
58036
|
+
if (!line.trim()) return;
|
|
58037
|
+
try {
|
|
58038
|
+
const event = JSON.parse(line);
|
|
58039
|
+
for (const converted of this.handleEvent(taskId, title, cwd, event)) {
|
|
58040
|
+
this.emitOutput(taskId, converted);
|
|
58041
|
+
this.appendLog(taskId, converted);
|
|
58042
|
+
}
|
|
58043
|
+
} catch {
|
|
58044
|
+
}
|
|
58045
|
+
};
|
|
58046
|
+
proc.stdout?.on("data", (chunk) => {
|
|
58047
|
+
buffer += chunk.toString();
|
|
58048
|
+
const lines = buffer.split("\n");
|
|
58049
|
+
buffer = lines.pop() ?? "";
|
|
58050
|
+
for (const line of lines) {
|
|
58051
|
+
processLine(line);
|
|
58052
|
+
}
|
|
58053
|
+
});
|
|
58054
|
+
proc.stderr?.on("data", (chunk) => {
|
|
58055
|
+
stderrBuffer += chunk.toString();
|
|
58056
|
+
});
|
|
58057
|
+
proc.on("close", (code) => {
|
|
58058
|
+
if (buffer.trim()) {
|
|
58059
|
+
processLine(buffer);
|
|
58060
|
+
}
|
|
58061
|
+
if (this.shouldSkipProcessOutcome(activeProcess)) {
|
|
58062
|
+
this.releaseProcess(activeProcess);
|
|
58063
|
+
return;
|
|
58064
|
+
}
|
|
58065
|
+
try {
|
|
58066
|
+
if (code === 0) {
|
|
58067
|
+
this.logger.info(isFollowUp ? "Copilot CLI follow-up completed" : "Copilot CLI task completed successfully", {
|
|
58068
|
+
taskId,
|
|
58069
|
+
title
|
|
58070
|
+
});
|
|
58071
|
+
this.taskEngine.reportResult(taskId, { message: `Task "${title}" completed` });
|
|
58072
|
+
} else {
|
|
58073
|
+
const error2 = stderrBuffer.trim() || `Process exited with code ${code}`;
|
|
58074
|
+
this.logger.error(isFollowUp ? "Copilot CLI follow-up failed" : "Copilot CLI task failed", {
|
|
58075
|
+
taskId,
|
|
58076
|
+
title,
|
|
58077
|
+
exitCode: code,
|
|
58078
|
+
error: error2
|
|
58079
|
+
});
|
|
58080
|
+
this.taskEngine.reportFailure(taskId, error2);
|
|
58081
|
+
}
|
|
58082
|
+
} catch (err) {
|
|
58083
|
+
this.logger.warn("Failed to report Copilot CLI task status", {
|
|
58084
|
+
taskId,
|
|
58085
|
+
reason: err instanceof Error ? err.message : String(err)
|
|
58086
|
+
});
|
|
58087
|
+
} finally {
|
|
58088
|
+
this.releaseProcess(activeProcess);
|
|
58089
|
+
}
|
|
58090
|
+
});
|
|
58091
|
+
proc.on("error", (err) => {
|
|
58092
|
+
if (this.shouldSkipProcessOutcome(activeProcess)) {
|
|
58093
|
+
this.releaseProcess(activeProcess);
|
|
58094
|
+
return;
|
|
58095
|
+
}
|
|
58096
|
+
this.logger.error(isFollowUp ? "Failed to spawn copilot for follow-up" : "Failed to spawn copilot", {
|
|
58097
|
+
taskId,
|
|
58098
|
+
error: err.message
|
|
58099
|
+
});
|
|
58100
|
+
try {
|
|
58101
|
+
this.taskEngine.reportFailure(taskId, `Failed to spawn copilot: ${err.message}`);
|
|
58102
|
+
} catch (reportErr) {
|
|
58103
|
+
this.logger.warn("Failed to report Copilot CLI spawn error", {
|
|
58104
|
+
taskId,
|
|
58105
|
+
reason: reportErr instanceof Error ? reportErr.message : String(reportErr)
|
|
58106
|
+
});
|
|
58107
|
+
} finally {
|
|
58108
|
+
this.releaseProcess(activeProcess);
|
|
58109
|
+
}
|
|
58110
|
+
});
|
|
58111
|
+
}
|
|
58112
|
+
handleEvent(taskId, title, cwd, event) {
|
|
58113
|
+
const sessionId = extractSessionId(event);
|
|
58114
|
+
if (sessionId) {
|
|
58115
|
+
this.sessions.set(taskId, { sessionId, cwd, title });
|
|
58116
|
+
this.persistSession(taskId, sessionId, cwd);
|
|
58117
|
+
this.appendLog(taskId, event);
|
|
58118
|
+
this.emitOutput(taskId, event);
|
|
58119
|
+
this.logger.info("Copilot CLI session established", { taskId, sessionId });
|
|
58120
|
+
return [];
|
|
58121
|
+
}
|
|
58122
|
+
return convertCopilotTranscriptEvent(event).map((converted) => typeof converted.timestamp === "string" ? converted : { ...converted, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
58123
|
+
}
|
|
58124
|
+
persistSession(taskId, sessionId, cwd) {
|
|
58125
|
+
try {
|
|
58126
|
+
const current = this.taskEngine.getTask(taskId);
|
|
58127
|
+
const payload = current?.payload ?? {};
|
|
58128
|
+
this.taskEngine.updateTask(taskId, {
|
|
58129
|
+
payload: { ...payload, sessionId, sessionCwd: cwd }
|
|
58130
|
+
});
|
|
58131
|
+
} catch {
|
|
58132
|
+
}
|
|
58133
|
+
}
|
|
58134
|
+
recoverSession(taskId) {
|
|
58135
|
+
const logPath = this.getLogPath(taskId);
|
|
58136
|
+
if (!fs12.existsSync(logPath)) return null;
|
|
58137
|
+
const content = fs12.readFileSync(logPath, "utf-8").trim();
|
|
58138
|
+
if (!content) return null;
|
|
58139
|
+
const lines = content.split("\n");
|
|
58140
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
58141
|
+
try {
|
|
58142
|
+
const line = lines[i];
|
|
58143
|
+
if (!line) continue;
|
|
58144
|
+
const event = JSON.parse(line);
|
|
58145
|
+
const sessionId = extractSessionId(event);
|
|
58146
|
+
if (sessionId) {
|
|
58147
|
+
const task = this.taskEngine.getTask(taskId);
|
|
58148
|
+
const persistedCwd = typeof task?.payload.sessionCwd === "string" ? task.payload.sessionCwd : void 0;
|
|
58149
|
+
return {
|
|
58150
|
+
sessionId,
|
|
58151
|
+
cwd: path11.resolve(persistedCwd ?? task?.effectiveProjectPath ?? task?.project ?? process.cwd()),
|
|
58152
|
+
title: task?.title ?? taskId
|
|
58153
|
+
};
|
|
58154
|
+
}
|
|
58155
|
+
} catch {
|
|
58156
|
+
}
|
|
58157
|
+
}
|
|
58158
|
+
return null;
|
|
58159
|
+
}
|
|
58160
|
+
recoverPersistedSession(taskId) {
|
|
58161
|
+
const task = this.taskEngine.getTask(taskId);
|
|
58162
|
+
const sessionId = typeof task?.payload.sessionId === "string" ? task.payload.sessionId : void 0;
|
|
58163
|
+
if (!sessionId) return null;
|
|
58164
|
+
return {
|
|
58165
|
+
sessionId,
|
|
58166
|
+
cwd: path11.resolve(
|
|
58167
|
+
(typeof task?.payload.sessionCwd === "string" ? task.payload.sessionCwd : void 0) ?? task?.effectiveProjectPath ?? task?.project ?? process.cwd()
|
|
58168
|
+
),
|
|
58169
|
+
title: task?.title ?? taskId
|
|
58170
|
+
};
|
|
58171
|
+
}
|
|
58172
|
+
};
|
|
58173
|
+
|
|
57432
58174
|
// ../../packages/core/src/storage/storage-paths.ts
|
|
57433
58175
|
var os5 = __toESM(require("os"), 1);
|
|
57434
|
-
var
|
|
58176
|
+
var path12 = __toESM(require("path"), 1);
|
|
57435
58177
|
function resolveDefaultStorageMode(options = {}) {
|
|
57436
58178
|
const envMode = options.env?.MESHY_STORAGE_MODE;
|
|
57437
58179
|
if (envMode === "cwd" || envMode === "home") {
|
|
@@ -57447,18 +58189,18 @@ function resolveDefaultStoragePath(options = {}) {
|
|
|
57447
58189
|
const mode = resolveDefaultStorageMode(options);
|
|
57448
58190
|
const envBaseDir = options.env?.MESHY_STORAGE_BASE_DIR;
|
|
57449
58191
|
const baseDir = mode === "cwd" ? envBaseDir ?? options.cwd ?? process.cwd() : options.homeDir ?? os5.homedir();
|
|
57450
|
-
return
|
|
58192
|
+
return path12.resolve(baseDir, ".meshy");
|
|
57451
58193
|
}
|
|
57452
58194
|
function toSafeNodeStorageName(nodeName) {
|
|
57453
58195
|
const safeName = nodeName.trim().replace(/[^a-zA-Z0-9_-]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
|
|
57454
58196
|
return safeName.length > 0 ? safeName : "node";
|
|
57455
58197
|
}
|
|
57456
58198
|
function resolveNodeScopedStoragePath(storageRoot, nodeName) {
|
|
57457
|
-
return
|
|
58199
|
+
return path12.resolve(storageRoot, toSafeNodeStorageName(nodeName));
|
|
57458
58200
|
}
|
|
57459
58201
|
|
|
57460
58202
|
// ../../packages/core/src/node/node.ts
|
|
57461
|
-
var
|
|
58203
|
+
var path14 = __toESM(require("path"), 1);
|
|
57462
58204
|
|
|
57463
58205
|
// ../../packages/core/src/messaging/node-local-message-handler.ts
|
|
57464
58206
|
async function handleLocalNodeMessage(deps, message) {
|
|
@@ -57509,8 +58251,8 @@ async function handleLocalNodeMessage(deps, message) {
|
|
|
57509
58251
|
}
|
|
57510
58252
|
|
|
57511
58253
|
// ../../packages/core/src/node/node-identity.ts
|
|
57512
|
-
var
|
|
57513
|
-
var
|
|
58254
|
+
var fs13 = __toESM(require("fs"), 1);
|
|
58255
|
+
var path13 = __toESM(require("path"), 1);
|
|
57514
58256
|
|
|
57515
58257
|
// ../../node_modules/.pnpm/nanoid@5.1.7/node_modules/nanoid/index.js
|
|
57516
58258
|
var import_node_crypto6 = require("crypto");
|
|
@@ -57544,17 +58286,17 @@ function nanoid(size = 21) {
|
|
|
57544
58286
|
|
|
57545
58287
|
// ../../packages/core/src/node/node-identity.ts
|
|
57546
58288
|
function loadOrCreateNodeId(storagePath, nodeName) {
|
|
57547
|
-
const identityPath =
|
|
58289
|
+
const identityPath = path13.join(storagePath, "node-identity.json");
|
|
57548
58290
|
try {
|
|
57549
|
-
if (
|
|
57550
|
-
const raw = JSON.parse(
|
|
58291
|
+
if (fs13.existsSync(identityPath)) {
|
|
58292
|
+
const raw = JSON.parse(fs13.readFileSync(identityPath, "utf-8"));
|
|
57551
58293
|
if (typeof raw.id === "string" && raw.id.length > 0) return raw.id;
|
|
57552
58294
|
}
|
|
57553
58295
|
} catch {
|
|
57554
58296
|
}
|
|
57555
58297
|
const id = nanoid();
|
|
57556
|
-
|
|
57557
|
-
|
|
58298
|
+
fs13.mkdirSync(path13.dirname(identityPath), { recursive: true });
|
|
58299
|
+
fs13.writeFileSync(identityPath, JSON.stringify({ id, name: nodeName }, null, 2) + "\n", "utf-8");
|
|
57558
58300
|
return id;
|
|
57559
58301
|
}
|
|
57560
58302
|
|
|
@@ -57598,7 +58340,7 @@ var MeshyNode = class {
|
|
|
57598
58340
|
await this.transport.start(this.config.node.port);
|
|
57599
58341
|
const endpoint = await this.transport.getEndpoint();
|
|
57600
58342
|
const now = Date.now();
|
|
57601
|
-
const workDir =
|
|
58343
|
+
const workDir = path14.resolve(this.config.node.workDir ?? process.cwd());
|
|
57602
58344
|
this.selfInfo = {
|
|
57603
58345
|
id: nodeId,
|
|
57604
58346
|
name: this.config.node.name,
|
|
@@ -57629,7 +58371,7 @@ var MeshyNode = class {
|
|
|
57629
58371
|
this.logger,
|
|
57630
58372
|
this.getSettingsSnapshot
|
|
57631
58373
|
);
|
|
57632
|
-
const logDir =
|
|
58374
|
+
const logDir = path14.join(this.config.storage.path, "task-logs");
|
|
57633
58375
|
this.taskEngine = new TaskEngine(this.store, this.nodeRegistry, this.eventBus, logDir);
|
|
57634
58376
|
this.heartbeat.setGetAssignedTasks((nodeId2) => {
|
|
57635
58377
|
const result = this.taskEngine.listTasks({ assignedTo: nodeId2, status: "assigned" });
|
|
@@ -57638,10 +58380,13 @@ var MeshyNode = class {
|
|
|
57638
58380
|
this.engineRegistry = new EngineRegistry();
|
|
57639
58381
|
const claudeEngine = new ClaudeCodeEngine(this.eventBus, logDir, this.taskEngine, this.logger);
|
|
57640
58382
|
const codexEngine = new CodexEngine(this.eventBus, logDir, this.taskEngine, this.logger);
|
|
58383
|
+
const copilotEngine = new CopilotCliEngine(this.eventBus, logDir, this.taskEngine, this.logger);
|
|
57641
58384
|
this.engineRegistry.register("claudecode", claudeEngine, { displayName: "Claude Code" });
|
|
57642
58385
|
this.engineRegistry.register("codex", codexEngine, { displayName: "Codex" });
|
|
58386
|
+
this.engineRegistry.register("copilot", copilotEngine, { displayName: "Copilot CLI" });
|
|
57643
58387
|
claudeEngine.init();
|
|
57644
58388
|
codexEngine.init();
|
|
58389
|
+
copilotEngine.init();
|
|
57645
58390
|
this.selfInfo = {
|
|
57646
58391
|
...this.nodeRegistry.getSelf(),
|
|
57647
58392
|
supportedAgents: this.engineRegistry.getSupportedAgents()
|
|
@@ -58220,7 +58965,7 @@ var SystemAuthInfoSchema = external_exports.object({
|
|
|
58220
58965
|
allowedUsers: external_exports.array(external_exports.string())
|
|
58221
58966
|
});
|
|
58222
58967
|
var SystemAgentInfoSchema = external_exports.object({
|
|
58223
|
-
id: external_exports.enum(["claude", "codex"]),
|
|
58968
|
+
id: external_exports.enum(["claude", "codex", "copilot"]),
|
|
58224
58969
|
label: external_exports.string(),
|
|
58225
58970
|
command: external_exports.string(),
|
|
58226
58971
|
available: external_exports.boolean(),
|
|
@@ -58264,14 +59009,16 @@ var NodeSettingsSnapshotSchema = external_exports.object({
|
|
|
58264
59009
|
az: SystemComponentStatusSchema.optional(),
|
|
58265
59010
|
devtunnel: SystemComponentStatusSchema.optional(),
|
|
58266
59011
|
claude: SystemComponentStatusSchema.optional(),
|
|
58267
|
-
codex: SystemComponentStatusSchema.optional()
|
|
59012
|
+
codex: SystemComponentStatusSchema.optional(),
|
|
59013
|
+
copilot: SystemComponentStatusSchema.optional()
|
|
58268
59014
|
}).optional()
|
|
58269
59015
|
}).optional(),
|
|
58270
59016
|
components: external_exports.object({
|
|
58271
59017
|
az: SystemComponentStatusSchema.optional(),
|
|
58272
59018
|
devtunnel: SystemComponentStatusSchema.optional(),
|
|
58273
59019
|
claude: SystemComponentStatusSchema.optional(),
|
|
58274
|
-
codex: SystemComponentStatusSchema.optional()
|
|
59020
|
+
codex: SystemComponentStatusSchema.optional(),
|
|
59021
|
+
copilot: SystemComponentStatusSchema.optional()
|
|
58275
59022
|
}).optional(),
|
|
58276
59023
|
repository: SystemRepositoryInfoSchema.optional(),
|
|
58277
59024
|
packages: external_exports.object({
|
|
@@ -58436,7 +59183,7 @@ var GitRemoteBranchOptionSchema = external_exports.object({
|
|
|
58436
59183
|
ref: external_exports.string()
|
|
58437
59184
|
});
|
|
58438
59185
|
var NativeSessionSummarySchema = external_exports.object({
|
|
58439
|
-
agent: external_exports.enum(["codex", "claudecode"]),
|
|
59186
|
+
agent: external_exports.enum(["codex", "claudecode", "copilot"]),
|
|
58440
59187
|
sessionId: external_exports.string(),
|
|
58441
59188
|
cwd: external_exports.string(),
|
|
58442
59189
|
summary: external_exports.string(),
|
|
@@ -58473,7 +59220,7 @@ var NodeWorkDirBranchQuery = external_exports.object({
|
|
|
58473
59220
|
allowAbsolute: QueryBoolean
|
|
58474
59221
|
});
|
|
58475
59222
|
var NodeNativeSessionsQuery = external_exports.object({
|
|
58476
|
-
agent: external_exports.enum(["codex", "claudecode"]),
|
|
59223
|
+
agent: external_exports.enum(["codex", "claudecode", "copilot"]),
|
|
58477
59224
|
limit: external_exports.coerce.number().int().min(1).max(100).default(50)
|
|
58478
59225
|
});
|
|
58479
59226
|
var NodeTerminalSessionStartBody = external_exports.object({
|
|
@@ -58518,7 +59265,7 @@ var CreateNodeWorkDirBranchResponse = NodeWorkDirBranchResponse.extend({
|
|
|
58518
59265
|
});
|
|
58519
59266
|
var NodeNativeSessionsResponse = external_exports.object({
|
|
58520
59267
|
nodeId: external_exports.string(),
|
|
58521
|
-
agent: external_exports.enum(["codex", "claudecode"]),
|
|
59268
|
+
agent: external_exports.enum(["codex", "claudecode", "copilot"]),
|
|
58522
59269
|
sessions: external_exports.array(NativeSessionSummarySchema)
|
|
58523
59270
|
});
|
|
58524
59271
|
var NodeTerminalSessionResponse = external_exports.object({
|
|
@@ -58552,8 +59299,8 @@ var ConfigureNodeDevBoxBody = external_exports.object({
|
|
|
58552
59299
|
});
|
|
58553
59300
|
|
|
58554
59301
|
// ../../packages/api/src/schemas/tasks.ts
|
|
58555
|
-
var AGENT_OPTIONS = ["mars", "codex", "claudecode", "eureka"];
|
|
58556
|
-
var NATIVE_SESSION_AGENT_OPTIONS = ["codex", "claudecode"];
|
|
59302
|
+
var AGENT_OPTIONS = ["mars", "codex", "claudecode", "copilot", "eureka"];
|
|
59303
|
+
var NATIVE_SESSION_AGENT_OPTIONS = ["codex", "claudecode", "copilot"];
|
|
58557
59304
|
var TASK_MODE_OPTIONS = ["bypass", "plan", "edit", "dangerous"];
|
|
58558
59305
|
var TASK_CONVERSATION_KIND_OPTIONS = ["meshyChat", "nativeSession"];
|
|
58559
59306
|
var TaskPayload = external_exports.record(external_exports.unknown()).superRefine((payload, ctx) => {
|
|
@@ -58697,8 +59444,8 @@ var BatchTaskIdsBody = external_exports.object({
|
|
|
58697
59444
|
});
|
|
58698
59445
|
|
|
58699
59446
|
// ../../packages/api/src/app/server.ts
|
|
58700
|
-
var
|
|
58701
|
-
var
|
|
59447
|
+
var path20 = __toESM(require("path"), 1);
|
|
59448
|
+
var fs20 = __toESM(require("fs"), 1);
|
|
58702
59449
|
var import_express15 = __toESM(require_express2(), 1);
|
|
58703
59450
|
|
|
58704
59451
|
// ../../packages/api/src/middleware/auth.ts
|
|
@@ -58835,8 +59582,8 @@ function decodePathSegment(value) {
|
|
|
58835
59582
|
return value;
|
|
58836
59583
|
}
|
|
58837
59584
|
}
|
|
58838
|
-
function getSingleTaskDeleteId(
|
|
58839
|
-
const match = /^\/api\/tasks\/([^/]+)$/.exec(
|
|
59585
|
+
function getSingleTaskDeleteId(path23) {
|
|
59586
|
+
const match = /^\/api\/tasks\/([^/]+)$/.exec(path23);
|
|
58840
59587
|
return match ? decodePathSegment(match[1]) : null;
|
|
58841
59588
|
}
|
|
58842
59589
|
function getSuccessfulBatchDeleteIds(body) {
|
|
@@ -59098,8 +59845,8 @@ function normalizeDevBoxStatus(status) {
|
|
|
59098
59845
|
return status?.trim().toLowerCase().replace(/[\s_-]+/gu, "");
|
|
59099
59846
|
}
|
|
59100
59847
|
function sleep(ms) {
|
|
59101
|
-
return new Promise((
|
|
59102
|
-
const timer = setTimeout(
|
|
59848
|
+
return new Promise((resolve15) => {
|
|
59849
|
+
const timer = setTimeout(resolve15, ms);
|
|
59103
59850
|
if (typeof timer === "object" && timer !== null && "unref" in timer && typeof timer.unref === "function") {
|
|
59104
59851
|
timer.unref();
|
|
59105
59852
|
}
|
|
@@ -59181,13 +59928,13 @@ function cleanDevBoxInfo(devbox) {
|
|
|
59181
59928
|
}
|
|
59182
59929
|
function normalizeMcpDevBoxList(value) {
|
|
59183
59930
|
const normalized = normalizeMcpValue(value);
|
|
59184
|
-
const record2 =
|
|
59931
|
+
const record2 = isRecord7(normalized) ? normalized : {};
|
|
59185
59932
|
const list = Array.isArray(normalized) ? normalized : Array.isArray(record2.devboxes) ? record2.devboxes : Array.isArray(record2.value) ? record2.value : [];
|
|
59186
59933
|
return list.map((item) => normalizeDevBoxResource(item, void 0)).filter((item) => Boolean(item.name));
|
|
59187
59934
|
}
|
|
59188
59935
|
function normalizeDevBoxResource(value, fallback) {
|
|
59189
59936
|
const record2 = normalizeRecord(value);
|
|
59190
|
-
const additional =
|
|
59937
|
+
const additional = isRecord7(record2.additionalProperties) ? record2.additionalProperties : {};
|
|
59191
59938
|
const fromUri = parseDevBoxUri(readString(record2, "uri"));
|
|
59192
59939
|
const status = readString(record2, "status") ?? readString(record2, "powerState") ?? readString(record2, "lastStatus") ?? fallback?.lastStatus;
|
|
59193
59940
|
const name2 = readString(record2, "name") ?? fromUri?.name ?? fallback?.name ?? "";
|
|
@@ -59241,7 +59988,7 @@ function parseDevCenterEndpoint(hostname4) {
|
|
|
59241
59988
|
}
|
|
59242
59989
|
function normalizeRecord(value) {
|
|
59243
59990
|
const normalized = normalizeMcpValue(value);
|
|
59244
|
-
return
|
|
59991
|
+
return isRecord7(normalized) ? normalized : {};
|
|
59245
59992
|
}
|
|
59246
59993
|
function normalizeMcpValue(value) {
|
|
59247
59994
|
if (Array.isArray(value)) return value;
|
|
@@ -59276,7 +60023,7 @@ function tryParseJson(text) {
|
|
|
59276
60023
|
return null;
|
|
59277
60024
|
}
|
|
59278
60025
|
}
|
|
59279
|
-
function
|
|
60026
|
+
function isRecord7(value) {
|
|
59280
60027
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
59281
60028
|
}
|
|
59282
60029
|
function readString(record2, key) {
|
|
@@ -59534,11 +60281,11 @@ function assertCanChangeNodeDevTunnel(taskEngine, nodeId) {
|
|
|
59534
60281
|
var import_express3 = __toESM(require_express2(), 1);
|
|
59535
60282
|
|
|
59536
60283
|
// ../../packages/api/src/node/node-workdir-service.ts
|
|
59537
|
-
var
|
|
60284
|
+
var path16 = __toESM(require("path"), 1);
|
|
59538
60285
|
|
|
59539
60286
|
// ../../packages/api/src/output/helpers.ts
|
|
59540
|
-
var
|
|
59541
|
-
var
|
|
60287
|
+
var fs14 = __toESM(require("fs"), 1);
|
|
60288
|
+
var path15 = __toESM(require("path"), 1);
|
|
59542
60289
|
var MAX_INLINE_SIZE = 512 * 1024;
|
|
59543
60290
|
var TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
59544
60291
|
".txt",
|
|
@@ -59651,15 +60398,15 @@ function mimeForExt(ext) {
|
|
|
59651
60398
|
return MIME_MAP[ext] ?? "application/octet-stream";
|
|
59652
60399
|
}
|
|
59653
60400
|
function resolveOutputPath(root, relativePath) {
|
|
59654
|
-
const resolved =
|
|
59655
|
-
const normalizedRoot =
|
|
59656
|
-
if (!resolved.startsWith(normalizedRoot +
|
|
60401
|
+
const resolved = path15.resolve(root, relativePath);
|
|
60402
|
+
const normalizedRoot = path15.resolve(root);
|
|
60403
|
+
if (!resolved.startsWith(normalizedRoot + path15.sep) && resolved !== normalizedRoot) {
|
|
59657
60404
|
throw new Error("Path traversal detected");
|
|
59658
60405
|
}
|
|
59659
60406
|
return resolved;
|
|
59660
60407
|
}
|
|
59661
60408
|
function classifyFile(filePath) {
|
|
59662
|
-
const ext =
|
|
60409
|
+
const ext = path15.extname(filePath).toLowerCase();
|
|
59663
60410
|
if (ext === ".json" || ext === ".jsonl" || ext === ".ndjson") {
|
|
59664
60411
|
return { kind: "json", mimeType: "application/json" };
|
|
59665
60412
|
}
|
|
@@ -59689,21 +60436,21 @@ function listDirectory(root, relativePath, options = {}) {
|
|
|
59689
60436
|
return listResolvedDirectory(absPath, relativePath, options);
|
|
59690
60437
|
}
|
|
59691
60438
|
function listAbsoluteDirectory(absoluteDir, options = {}) {
|
|
59692
|
-
if (!
|
|
60439
|
+
if (!path15.isAbsolute(absoluteDir)) {
|
|
59693
60440
|
throw new Error("listAbsoluteDirectory requires an absolute path");
|
|
59694
60441
|
}
|
|
59695
60442
|
return listResolvedDirectory(absoluteDir, absoluteDir, { ...options, childPathStyle: "absolute" });
|
|
59696
60443
|
}
|
|
59697
60444
|
function listResolvedDirectory(absPath, relativeBase, options = {}) {
|
|
59698
|
-
if (!
|
|
60445
|
+
if (!fs14.existsSync(absPath) || !fs14.statSync(absPath).isDirectory()) {
|
|
59699
60446
|
return [];
|
|
59700
60447
|
}
|
|
59701
|
-
const entries =
|
|
60448
|
+
const entries = fs14.readdirSync(absPath, { withFileTypes: true });
|
|
59702
60449
|
const result = [];
|
|
59703
60450
|
const childPathStyle = options.childPathStyle ?? "relative";
|
|
59704
60451
|
for (const entry of entries) {
|
|
59705
60452
|
if (entry.name.startsWith(".")) continue;
|
|
59706
|
-
const entryRelPath = childPathStyle === "absolute" ?
|
|
60453
|
+
const entryRelPath = childPathStyle === "absolute" ? path15.join(absPath, entry.name) : path15.join(relativeBase || ".", entry.name).split(path15.sep).join("/");
|
|
59707
60454
|
if (entry.isDirectory()) {
|
|
59708
60455
|
result.push({
|
|
59709
60456
|
path: entryRelPath,
|
|
@@ -59713,8 +60460,8 @@ function listResolvedDirectory(absPath, relativeBase, options = {}) {
|
|
|
59713
60460
|
} else if (options.directoriesOnly) {
|
|
59714
60461
|
continue;
|
|
59715
60462
|
} else if (entry.isFile()) {
|
|
59716
|
-
const fullPath =
|
|
59717
|
-
const stat =
|
|
60463
|
+
const fullPath = path15.join(absPath, entry.name);
|
|
60464
|
+
const stat = fs14.statSync(fullPath);
|
|
59718
60465
|
const { kind, mimeType } = classifyFile(entry.name);
|
|
59719
60466
|
result.push({
|
|
59720
60467
|
path: entryRelPath,
|
|
@@ -59734,11 +60481,11 @@ function listResolvedDirectory(absPath, relativeBase, options = {}) {
|
|
|
59734
60481
|
}
|
|
59735
60482
|
function detectHtmlEntries(root) {
|
|
59736
60483
|
const entries = [];
|
|
59737
|
-
if (
|
|
60484
|
+
if (fs14.existsSync(path15.join(root, "index.html"))) {
|
|
59738
60485
|
entries.push({ path: "index.html", label: "index.html" });
|
|
59739
60486
|
}
|
|
59740
60487
|
try {
|
|
59741
|
-
const topLevel =
|
|
60488
|
+
const topLevel = fs14.readdirSync(root, { withFileTypes: true });
|
|
59742
60489
|
const htmlFiles = topLevel.filter(
|
|
59743
60490
|
(e) => e.isFile() && e.name.endsWith(".html") && !e.name.startsWith(".")
|
|
59744
60491
|
);
|
|
@@ -59749,8 +60496,8 @@ function detectHtmlEntries(root) {
|
|
|
59749
60496
|
}
|
|
59750
60497
|
const subdirs = topLevel.filter((e) => e.isDirectory() && !e.name.startsWith("."));
|
|
59751
60498
|
for (const dir of subdirs) {
|
|
59752
|
-
const subIndex =
|
|
59753
|
-
if (
|
|
60499
|
+
const subIndex = path15.join(root, dir.name, "index.html");
|
|
60500
|
+
if (fs14.existsSync(subIndex)) {
|
|
59754
60501
|
entries.push({
|
|
59755
60502
|
path: `${dir.name}/index.html`,
|
|
59756
60503
|
label: `${dir.name}/index.html`
|
|
@@ -59764,7 +60511,7 @@ function detectHtmlEntries(root) {
|
|
|
59764
60511
|
function detectMarkdownEntries(root) {
|
|
59765
60512
|
const entries = [];
|
|
59766
60513
|
try {
|
|
59767
|
-
const topLevel =
|
|
60514
|
+
const topLevel = fs14.readdirSync(root, { withFileTypes: true });
|
|
59768
60515
|
for (const f of topLevel) {
|
|
59769
60516
|
if (f.isFile() && !f.name.startsWith(".") && /\.mdx?$/i.test(f.name)) {
|
|
59770
60517
|
entries.push({ path: f.name, label: f.name });
|
|
@@ -59773,8 +60520,8 @@ function detectMarkdownEntries(root) {
|
|
|
59773
60520
|
const subdirs = topLevel.filter((e) => e.isDirectory() && !e.name.startsWith("."));
|
|
59774
60521
|
for (const dir of subdirs) {
|
|
59775
60522
|
for (const fileName of ["README.md", "readme.md"]) {
|
|
59776
|
-
const readmePath =
|
|
59777
|
-
if (
|
|
60523
|
+
const readmePath = path15.join(root, dir.name, fileName);
|
|
60524
|
+
if (fs14.existsSync(readmePath)) {
|
|
59778
60525
|
entries.push({ path: `${dir.name}/${fileName}`, label: `${dir.name}/${fileName}` });
|
|
59779
60526
|
break;
|
|
59780
60527
|
}
|
|
@@ -59785,12 +60532,12 @@ function detectMarkdownEntries(root) {
|
|
|
59785
60532
|
return entries;
|
|
59786
60533
|
}
|
|
59787
60534
|
function getOutputSummary(root) {
|
|
59788
|
-
const rootName =
|
|
60535
|
+
const rootName = path15.basename(root);
|
|
59789
60536
|
const htmlEntries = detectHtmlEntries(root);
|
|
59790
60537
|
const markdownEntries = detectMarkdownEntries(root);
|
|
59791
60538
|
let fileCount;
|
|
59792
60539
|
try {
|
|
59793
|
-
const entries =
|
|
60540
|
+
const entries = fs14.readdirSync(root, { withFileTypes: true });
|
|
59794
60541
|
fileCount = entries.filter((e) => !e.name.startsWith(".")).length;
|
|
59795
60542
|
} catch {
|
|
59796
60543
|
fileCount = void 0;
|
|
@@ -59807,14 +60554,14 @@ function getOutputSummary(root) {
|
|
|
59807
60554
|
}
|
|
59808
60555
|
function readFileContent(root, relativePath) {
|
|
59809
60556
|
const absPath = resolveOutputPath(root, relativePath);
|
|
59810
|
-
if (!
|
|
60557
|
+
if (!fs14.existsSync(absPath) || !fs14.statSync(absPath).isFile()) {
|
|
59811
60558
|
throw new Error("File not found");
|
|
59812
60559
|
}
|
|
59813
|
-
const stat =
|
|
60560
|
+
const stat = fs14.statSync(absPath);
|
|
59814
60561
|
const { kind, mimeType } = classifyFile(absPath);
|
|
59815
60562
|
if (kind === "image" || kind === "pdf" || kind === "binary") {
|
|
59816
60563
|
const truncated2 = stat.size > MAX_INLINE_SIZE;
|
|
59817
|
-
const buffer = truncated2 ? Buffer.alloc(0) :
|
|
60564
|
+
const buffer = truncated2 ? Buffer.alloc(0) : fs14.readFileSync(absPath);
|
|
59818
60565
|
return {
|
|
59819
60566
|
path: relativePath,
|
|
59820
60567
|
kind,
|
|
@@ -59825,7 +60572,7 @@ function readFileContent(root, relativePath) {
|
|
|
59825
60572
|
};
|
|
59826
60573
|
}
|
|
59827
60574
|
const truncated = stat.size > MAX_INLINE_SIZE;
|
|
59828
|
-
const content = truncated ?
|
|
60575
|
+
const content = truncated ? fs14.readFileSync(absPath, "utf-8").slice(0, MAX_INLINE_SIZE) : fs14.readFileSync(absPath, "utf-8");
|
|
59829
60576
|
return {
|
|
59830
60577
|
path: relativePath,
|
|
59831
60578
|
kind,
|
|
@@ -59837,8 +60584,8 @@ function readFileContent(root, relativePath) {
|
|
|
59837
60584
|
}
|
|
59838
60585
|
|
|
59839
60586
|
// ../../packages/api/src/output/git-command.ts
|
|
59840
|
-
var
|
|
59841
|
-
var
|
|
60587
|
+
var fs15 = __toESM(require("fs"), 1);
|
|
60588
|
+
var import_node_child_process7 = require("child_process");
|
|
59842
60589
|
var COMMON_GIT_BINARIES = [
|
|
59843
60590
|
"/opt/homebrew/bin/git",
|
|
59844
60591
|
"/usr/local/bin/git",
|
|
@@ -59846,7 +60593,7 @@ var COMMON_GIT_BINARIES = [
|
|
|
59846
60593
|
];
|
|
59847
60594
|
function isExecutable(filePath) {
|
|
59848
60595
|
try {
|
|
59849
|
-
|
|
60596
|
+
fs15.accessSync(filePath, fs15.constants.X_OK);
|
|
59850
60597
|
return true;
|
|
59851
60598
|
} catch {
|
|
59852
60599
|
return false;
|
|
@@ -59867,7 +60614,7 @@ function execGit(args, cwd, timeout = 1e4) {
|
|
|
59867
60614
|
let lastError;
|
|
59868
60615
|
for (const command of getGitCandidates()) {
|
|
59869
60616
|
try {
|
|
59870
|
-
return (0,
|
|
60617
|
+
return (0, import_node_child_process7.execFileSync)(command, ["-C", cwd, ...args], {
|
|
59871
60618
|
encoding: "utf-8",
|
|
59872
60619
|
timeout,
|
|
59873
60620
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -60099,14 +60846,14 @@ function getGitDiff(dirPath) {
|
|
|
60099
60846
|
|
|
60100
60847
|
// ../../packages/api/src/node/node-workdir-service.ts
|
|
60101
60848
|
function isAbsolutePath(p) {
|
|
60102
|
-
return
|
|
60849
|
+
return path16.isAbsolute(p) || /^[A-Za-z]:[\\/]/.test(p);
|
|
60103
60850
|
}
|
|
60104
60851
|
function resolveNodeWorkDirTarget(nodeId, rootPath, currentPath, allowAbsolute) {
|
|
60105
60852
|
if (!rootPath) {
|
|
60106
60853
|
throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
|
|
60107
60854
|
}
|
|
60108
60855
|
const useAbsolute = allowAbsolute && isAbsolutePath(currentPath);
|
|
60109
|
-
const resolvedPath = useAbsolute ?
|
|
60856
|
+
const resolvedPath = useAbsolute ? path16.resolve(currentPath) : currentPath;
|
|
60110
60857
|
const targetPath = useAbsolute ? resolvedPath : resolveRelativeNodeWorkDirTarget(rootPath, resolvedPath);
|
|
60111
60858
|
return {
|
|
60112
60859
|
rootPath,
|
|
@@ -60116,9 +60863,9 @@ function resolveNodeWorkDirTarget(nodeId, rootPath, currentPath, allowAbsolute)
|
|
|
60116
60863
|
};
|
|
60117
60864
|
}
|
|
60118
60865
|
function resolveRelativeNodeWorkDirTarget(rootPath, relativePath) {
|
|
60119
|
-
const resolvedRoot =
|
|
60120
|
-
const resolved =
|
|
60121
|
-
if (!resolved.startsWith(resolvedRoot +
|
|
60866
|
+
const resolvedRoot = path16.resolve(rootPath);
|
|
60867
|
+
const resolved = path16.resolve(resolvedRoot, relativePath);
|
|
60868
|
+
if (!resolved.startsWith(resolvedRoot + path16.sep) && resolved !== resolvedRoot) {
|
|
60122
60869
|
throw new MeshyError("VALIDATION_ERROR", "Invalid directory path", 400);
|
|
60123
60870
|
}
|
|
60124
60871
|
return resolved;
|
|
@@ -60201,13 +60948,13 @@ function createLocalNodeWorkDirBranch(nodeId, rootPath, currentPath, options) {
|
|
|
60201
60948
|
}
|
|
60202
60949
|
function computeParentPath(rootPath, currentPath, useAbsolute) {
|
|
60203
60950
|
if (useAbsolute) {
|
|
60204
|
-
const parent =
|
|
60951
|
+
const parent = path16.dirname(currentPath);
|
|
60205
60952
|
return parent === currentPath ? null : parent;
|
|
60206
60953
|
}
|
|
60207
60954
|
const normalized = currentPath.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
60208
60955
|
if (normalized === "" || normalized === ".") {
|
|
60209
|
-
const absParent =
|
|
60210
|
-
return absParent ===
|
|
60956
|
+
const absParent = path16.dirname(path16.resolve(rootPath));
|
|
60957
|
+
return absParent === path16.resolve(rootPath) ? null : absParent;
|
|
60211
60958
|
}
|
|
60212
60959
|
const segments = normalized.split("/").filter(Boolean);
|
|
60213
60960
|
segments.pop();
|
|
@@ -60218,14 +60965,15 @@ function computeParentPath(rootPath, currentPath, useAbsolute) {
|
|
|
60218
60965
|
var import_node_crypto7 = require("crypto");
|
|
60219
60966
|
|
|
60220
60967
|
// ../../packages/api/src/node/agent-upgrade-service.ts
|
|
60221
|
-
var
|
|
60968
|
+
var import_node_child_process9 = require("child_process");
|
|
60222
60969
|
|
|
60223
60970
|
// ../../packages/api/src/app/system-info.ts
|
|
60224
60971
|
var os6 = __toESM(require("os"), 1);
|
|
60225
|
-
var
|
|
60972
|
+
var import_node_child_process8 = require("child_process");
|
|
60226
60973
|
var RUNTIME_TOOLS = [
|
|
60227
60974
|
{ id: "claude", label: "Claude Code", command: "claude", packageName: "@anthropic-ai/claude-code" },
|
|
60228
|
-
{ id: "codex", label: "Codex", command: "codex", packageName: "@openai/codex" }
|
|
60975
|
+
{ id: "codex", label: "Codex", command: "codex", packageName: "@openai/codex" },
|
|
60976
|
+
{ id: "copilot", label: "Copilot CLI", command: "copilot", packageName: "@github/copilot" }
|
|
60229
60977
|
];
|
|
60230
60978
|
var runtimeToolUpdateCache = /* @__PURE__ */ new Map();
|
|
60231
60979
|
function clearRuntimeToolUpdateCache(packageName) {
|
|
@@ -60236,7 +60984,7 @@ function clearRuntimeToolUpdateCache(packageName) {
|
|
|
60236
60984
|
runtimeToolUpdateCache.clear();
|
|
60237
60985
|
}
|
|
60238
60986
|
function runRuntimeToolCommand(command, args, platform2) {
|
|
60239
|
-
const result = (0,
|
|
60987
|
+
const result = (0, import_node_child_process8.spawnSync)(command, args, {
|
|
60240
60988
|
encoding: "utf-8",
|
|
60241
60989
|
shell: platform2 === "win32" && command !== "where",
|
|
60242
60990
|
windowsHide: true,
|
|
@@ -60433,7 +61181,8 @@ function buildNodeSettingsSnapshot(options) {
|
|
|
60433
61181
|
// ../../packages/api/src/node/agent-upgrade-service.ts
|
|
60434
61182
|
var AGENT_PACKAGES = {
|
|
60435
61183
|
claude: "@anthropic-ai/claude-code",
|
|
60436
|
-
codex: "@openai/codex"
|
|
61184
|
+
codex: "@openai/codex",
|
|
61185
|
+
copilot: "@github/copilot"
|
|
60437
61186
|
};
|
|
60438
61187
|
var OUTPUT_LIMIT = 4e3;
|
|
60439
61188
|
function summarizeOutput(value) {
|
|
@@ -60441,7 +61190,7 @@ function summarizeOutput(value) {
|
|
|
60441
61190
|
return text.length > OUTPUT_LIMIT ? `${text.slice(0, OUTPUT_LIMIT)}\u2026` : text;
|
|
60442
61191
|
}
|
|
60443
61192
|
function defaultCommandRunner(command, args) {
|
|
60444
|
-
const result = (0,
|
|
61193
|
+
const result = (0, import_node_child_process9.spawnSync)(command, args, {
|
|
60445
61194
|
encoding: "utf-8",
|
|
60446
61195
|
shell: process.platform === "win32",
|
|
60447
61196
|
windowsHide: true,
|
|
@@ -60455,7 +61204,7 @@ function defaultCommandRunner(command, args) {
|
|
|
60455
61204
|
};
|
|
60456
61205
|
}
|
|
60457
61206
|
function isRuntimeAgentId(value) {
|
|
60458
|
-
return value === "claude" || value === "codex";
|
|
61207
|
+
return value === "claude" || value === "codex" || value === "copilot";
|
|
60459
61208
|
}
|
|
60460
61209
|
function buildUpgradeArgs(agent, packageName) {
|
|
60461
61210
|
const args = ["install", "-g", `${packageName}@latest`];
|
|
@@ -60503,7 +61252,7 @@ function upgradeRuntimeAgentForDeps(deps, agent) {
|
|
|
60503
61252
|
|
|
60504
61253
|
// ../../packages/api/src/node/runtime-restart-request.ts
|
|
60505
61254
|
function parseRuntimeRestartRequest(value) {
|
|
60506
|
-
const body =
|
|
61255
|
+
const body = isRecord8(value) ? value : {};
|
|
60507
61256
|
const startArgs = parseRuntimeRestartStartArgs(body.startArgs);
|
|
60508
61257
|
return {
|
|
60509
61258
|
reason: body.reason === "update" ? "update" : "restart",
|
|
@@ -60512,7 +61261,7 @@ function parseRuntimeRestartRequest(value) {
|
|
|
60512
61261
|
}
|
|
60513
61262
|
function parseRuntimeRestartStartArgs(value) {
|
|
60514
61263
|
if (value === void 0) return void 0;
|
|
60515
|
-
if (!
|
|
61264
|
+
if (!isRecord8(value)) {
|
|
60516
61265
|
throw new MeshyError("VALIDATION_ERROR", "Runtime restart startArgs must be an object", 400);
|
|
60517
61266
|
}
|
|
60518
61267
|
const startArgs = {};
|
|
@@ -60549,7 +61298,7 @@ function parseOptionalString(value, key) {
|
|
|
60549
61298
|
const trimmed = value.trim();
|
|
60550
61299
|
return trimmed || void 0;
|
|
60551
61300
|
}
|
|
60552
|
-
function
|
|
61301
|
+
function isRecord8(value) {
|
|
60553
61302
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
60554
61303
|
}
|
|
60555
61304
|
|
|
@@ -60987,7 +61736,7 @@ async function sendNodeWorkDirBranchCreateOperation(req, res, nodeId) {
|
|
|
60987
61736
|
}
|
|
60988
61737
|
|
|
60989
61738
|
// ../../packages/api/src/tasks/task-route-utils.ts
|
|
60990
|
-
var
|
|
61739
|
+
var fs16 = __toESM(require("fs"), 1);
|
|
60991
61740
|
var import_node_stream3 = require("stream");
|
|
60992
61741
|
var import_promises5 = require("stream/promises");
|
|
60993
61742
|
|
|
@@ -61032,7 +61781,7 @@ function toLegacyWorkerControl2(message) {
|
|
|
61032
61781
|
}
|
|
61033
61782
|
|
|
61034
61783
|
// ../../packages/api/src/tasks/task-route-utils.ts
|
|
61035
|
-
function
|
|
61784
|
+
function isRecord9(value) {
|
|
61036
61785
|
return typeof value === "object" && value !== null;
|
|
61037
61786
|
}
|
|
61038
61787
|
function restoreTaskState(taskEngine, task) {
|
|
@@ -61049,10 +61798,10 @@ function readLocalTaskLogs(engineRegistry, taskId, after, agent) {
|
|
|
61049
61798
|
throw new MeshyError("VALIDATION_ERROR", `Engine not registered for agent: ${agent}`, 400);
|
|
61050
61799
|
}
|
|
61051
61800
|
const logPath = engine.getLogPath(taskId);
|
|
61052
|
-
if (!
|
|
61801
|
+
if (!fs16.existsSync(logPath)) {
|
|
61053
61802
|
return { logs: [], total: 0 };
|
|
61054
61803
|
}
|
|
61055
|
-
const content =
|
|
61804
|
+
const content = fs16.readFileSync(logPath, "utf-8");
|
|
61056
61805
|
const allLines = content.trim().split("\n").filter(Boolean);
|
|
61057
61806
|
const logs = [];
|
|
61058
61807
|
for (let i = after; i < allLines.length; i++) {
|
|
@@ -61099,7 +61848,7 @@ function normalizeStructuredValue(value) {
|
|
|
61099
61848
|
if (Array.isArray(value)) {
|
|
61100
61849
|
return value.map((entry) => normalizeStructuredValue(entry));
|
|
61101
61850
|
}
|
|
61102
|
-
if (!
|
|
61851
|
+
if (!isRecord9(value)) {
|
|
61103
61852
|
return value;
|
|
61104
61853
|
}
|
|
61105
61854
|
return Object.fromEntries(
|
|
@@ -61108,20 +61857,20 @@ function normalizeStructuredValue(value) {
|
|
|
61108
61857
|
}
|
|
61109
61858
|
function getTranscriptEventSignature(event) {
|
|
61110
61859
|
if (event.type === "user") {
|
|
61111
|
-
const signature = getTaskUserMessageSignature(
|
|
61860
|
+
const signature = getTaskUserMessageSignature(isRecord9(event.message) ? event.message.content : event.message) ?? getTaskUserMessageSignature(event.content);
|
|
61112
61861
|
return signature ? `user:${signature}` : null;
|
|
61113
61862
|
}
|
|
61114
61863
|
if (event.type === "assistant") {
|
|
61115
61864
|
if (typeof event.message === "string") {
|
|
61116
61865
|
return `assistant:${JSON.stringify(event.message)}`;
|
|
61117
61866
|
}
|
|
61118
|
-
if (
|
|
61867
|
+
if (isRecord9(event.message) && "content" in event.message) {
|
|
61119
61868
|
return `assistant:${JSON.stringify(normalizeStructuredValue(event.message.content))}`;
|
|
61120
61869
|
}
|
|
61121
61870
|
if (Array.isArray(event.content)) {
|
|
61122
61871
|
return `assistant:${JSON.stringify(normalizeStructuredValue(event.content))}`;
|
|
61123
61872
|
}
|
|
61124
|
-
if (
|
|
61873
|
+
if (isRecord9(event.message)) {
|
|
61125
61874
|
return `assistant:${JSON.stringify(normalizeStructuredValue(event.message))}`;
|
|
61126
61875
|
}
|
|
61127
61876
|
}
|
|
@@ -61179,7 +61928,7 @@ function mergeNativeSessionLogs(nativeLogs, localLogs) {
|
|
|
61179
61928
|
function readLocalTaskLogsWithNativeHistory(engineRegistry, task, taskId, after, agent) {
|
|
61180
61929
|
const local = readLocalTaskLogs(engineRegistry, taskId, after, agent);
|
|
61181
61930
|
const sessionId = typeof task?.payload?.sessionId === "string" ? task.payload.sessionId : "";
|
|
61182
|
-
if (after > 0 || task?.conversationKind !== "nativeSession" || !sessionId || task.agent !== "codex" && task.agent !== "claudecode") {
|
|
61931
|
+
if (after > 0 || task?.conversationKind !== "nativeSession" || !sessionId || task.agent !== "codex" && task.agent !== "claudecode" && task.agent !== "copilot") {
|
|
61183
61932
|
return local;
|
|
61184
61933
|
}
|
|
61185
61934
|
const history = loadNativeSessionHistory({ agent: task.agent, sessionId });
|
|
@@ -61283,23 +62032,23 @@ async function maybeProxyReadToLeader(req, res, options = {}) {
|
|
|
61283
62032
|
}
|
|
61284
62033
|
|
|
61285
62034
|
// ../../packages/api/src/node/node-terminal-session-service.ts
|
|
61286
|
-
var
|
|
62035
|
+
var import_node_child_process10 = require("child_process");
|
|
61287
62036
|
var import_node_crypto8 = require("crypto");
|
|
61288
62037
|
|
|
61289
62038
|
// ../../packages/api/src/node/node-terminal-service.ts
|
|
61290
|
-
var
|
|
61291
|
-
var
|
|
62039
|
+
var fs17 = __toESM(require("fs"), 1);
|
|
62040
|
+
var path17 = __toESM(require("path"), 1);
|
|
61292
62041
|
var DEFAULT_OUTPUT_LIMIT_BYTES = 64 * 1024;
|
|
61293
62042
|
function isAbsolutePath2(value) {
|
|
61294
|
-
return
|
|
62043
|
+
return path17.isAbsolute(value) || /^[A-Za-z]:[\/]/.test(value);
|
|
61295
62044
|
}
|
|
61296
62045
|
function resolveNodeTerminalCwd(nodeId, rootPath, cwd) {
|
|
61297
62046
|
if (!rootPath) {
|
|
61298
62047
|
throw new MeshyError("VALIDATION_ERROR", `Node ${nodeId} does not expose a working directory`, 400);
|
|
61299
62048
|
}
|
|
61300
62049
|
const requestedCwd = cwd?.trim() || ".";
|
|
61301
|
-
const resolved = isAbsolutePath2(requestedCwd) ?
|
|
61302
|
-
if (!
|
|
62050
|
+
const resolved = isAbsolutePath2(requestedCwd) ? path17.resolve(requestedCwd) : path17.resolve(rootPath, requestedCwd);
|
|
62051
|
+
if (!fs17.existsSync(resolved) || !fs17.statSync(resolved).isDirectory()) {
|
|
61303
62052
|
throw new MeshyError("VALIDATION_ERROR", `Working directory does not exist: ${resolved}`, 400);
|
|
61304
62053
|
}
|
|
61305
62054
|
return resolved;
|
|
@@ -61363,7 +62112,7 @@ var NodeTerminalSessionService = class {
|
|
|
61363
62112
|
}
|
|
61364
62113
|
const cwd = resolveNodeTerminalCwd(nodeId, rootPath, options.cwd);
|
|
61365
62114
|
const startedAt = Date.now();
|
|
61366
|
-
const child = (0,
|
|
62115
|
+
const child = (0, import_node_child_process10.spawn)(normalizedCommand, {
|
|
61367
62116
|
cwd,
|
|
61368
62117
|
shell: true,
|
|
61369
62118
|
windowsHide: true,
|
|
@@ -61538,13 +62287,13 @@ function cancelTaskOnCurrentNode(deps, taskId, options = {}) {
|
|
|
61538
62287
|
}
|
|
61539
62288
|
|
|
61540
62289
|
// ../../packages/api/src/tasks/task-output-service.ts
|
|
61541
|
-
var
|
|
61542
|
-
var
|
|
62290
|
+
var fs19 = __toESM(require("fs"), 1);
|
|
62291
|
+
var path19 = __toESM(require("path"), 1);
|
|
61543
62292
|
|
|
61544
62293
|
// ../../packages/api/src/preview/preview-server.ts
|
|
61545
62294
|
var crypto3 = __toESM(require("crypto"), 1);
|
|
61546
|
-
var
|
|
61547
|
-
var
|
|
62295
|
+
var fs18 = __toESM(require("fs"), 1);
|
|
62296
|
+
var path18 = __toESM(require("path"), 1);
|
|
61548
62297
|
var http2 = __toESM(require("http"), 1);
|
|
61549
62298
|
var import_node_stream4 = require("stream");
|
|
61550
62299
|
var import_promises6 = require("stream/promises");
|
|
@@ -61656,19 +62405,19 @@ function buildPreviewWorkerProxyHeaders(req) {
|
|
|
61656
62405
|
// ../../packages/api/src/preview/preview-server.ts
|
|
61657
62406
|
function resolvePreviewPath(rootPath, relativePath) {
|
|
61658
62407
|
const sanitizedPath = relativePath.replace(/\\/g, "/");
|
|
61659
|
-
const resolvedPath =
|
|
61660
|
-
const normalizedRoot =
|
|
61661
|
-
if (!resolvedPath.startsWith(normalizedRoot +
|
|
62408
|
+
const resolvedPath = path18.resolve(rootPath, sanitizedPath);
|
|
62409
|
+
const normalizedRoot = path18.resolve(rootPath);
|
|
62410
|
+
if (!resolvedPath.startsWith(normalizedRoot + path18.sep) && resolvedPath !== normalizedRoot) {
|
|
61662
62411
|
throw new Error("Invalid preview path");
|
|
61663
62412
|
}
|
|
61664
62413
|
return {
|
|
61665
62414
|
absolutePath: resolvedPath,
|
|
61666
|
-
normalizedPath:
|
|
62415
|
+
normalizedPath: path18.relative(normalizedRoot, resolvedPath).split(path18.sep).join("/")
|
|
61667
62416
|
};
|
|
61668
62417
|
}
|
|
61669
62418
|
function resolvePreviewEntryPath(rootPath, entryPath) {
|
|
61670
62419
|
const { absolutePath, normalizedPath } = resolvePreviewPath(rootPath, entryPath ?? "index.html");
|
|
61671
|
-
if (!
|
|
62420
|
+
if (!fs18.existsSync(absolutePath) || !fs18.statSync(absolutePath).isFile()) {
|
|
61672
62421
|
throw new Error("Preview entry not found");
|
|
61673
62422
|
}
|
|
61674
62423
|
return normalizedPath;
|
|
@@ -61770,7 +62519,7 @@ var MIME_MAP2 = {
|
|
|
61770
62519
|
".mdx": "text/markdown"
|
|
61771
62520
|
};
|
|
61772
62521
|
function getMime(filePath) {
|
|
61773
|
-
return MIME_MAP2[
|
|
62522
|
+
return MIME_MAP2[path18.extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
61774
62523
|
}
|
|
61775
62524
|
function escapeHtml(value) {
|
|
61776
62525
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -62124,14 +62873,14 @@ async function sendPreviewAssetResponse(sessionManager, token, requestedPath, re
|
|
|
62124
62873
|
res.end("Invalid path");
|
|
62125
62874
|
return;
|
|
62126
62875
|
}
|
|
62127
|
-
if (!
|
|
62876
|
+
if (!fs18.existsSync(resolved) || !fs18.statSync(resolved).isFile()) {
|
|
62128
62877
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
62129
62878
|
res.end("File not found");
|
|
62130
62879
|
return;
|
|
62131
62880
|
}
|
|
62132
|
-
const ext =
|
|
62881
|
+
const ext = path18.extname(resolved).toLowerCase();
|
|
62133
62882
|
const mime = ext === ".md" || ext === ".mdx" ? "text/html" : getMime(resolved);
|
|
62134
|
-
const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(
|
|
62883
|
+
const content = ext === ".md" || ext === ".mdx" ? renderMarkdownDocument(fs18.readFileSync(resolved, "utf8"), path18.basename(resolved)) : fs18.readFileSync(resolved);
|
|
62135
62884
|
res.writeHead(200, {
|
|
62136
62885
|
"Content-Type": mime,
|
|
62137
62886
|
"Content-Length": content.length,
|
|
@@ -62460,13 +63209,13 @@ function getLocalTaskOutputDownload(taskEngine, taskId, filePath) {
|
|
|
62460
63209
|
const rootPath = getTaskOutputRoot(taskEngine, taskId);
|
|
62461
63210
|
try {
|
|
62462
63211
|
const absolutePath = resolveOutputPath(rootPath, filePath);
|
|
62463
|
-
if (!
|
|
63212
|
+
if (!fs19.existsSync(absolutePath) || !fs19.statSync(absolutePath).isFile()) {
|
|
62464
63213
|
throw new MeshyError("TASK_NOT_FOUND", `File not found: ${filePath}`, 404);
|
|
62465
63214
|
}
|
|
62466
63215
|
const { mimeType } = classifyFile(absolutePath);
|
|
62467
|
-
const fileName =
|
|
63216
|
+
const fileName = path19.basename(absolutePath).replace(/"/g, "");
|
|
62468
63217
|
return {
|
|
62469
|
-
content:
|
|
63218
|
+
content: fs19.readFileSync(absolutePath),
|
|
62470
63219
|
headers: {
|
|
62471
63220
|
"Content-Type": mimeType,
|
|
62472
63221
|
"Content-Disposition": `inline; filename="${fileName}"`,
|
|
@@ -62679,12 +63428,13 @@ async function executeWorkerControlRequest(deps, request) {
|
|
|
62679
63428
|
}
|
|
62680
63429
|
case "node.sessions.list": {
|
|
62681
63430
|
const self2 = deps.nodeRegistry.getSelf();
|
|
63431
|
+
const agent = payloadValue(request, "agent", "codex");
|
|
62682
63432
|
response = jsonResponse(
|
|
62683
63433
|
request.id,
|
|
62684
63434
|
200,
|
|
62685
63435
|
getLocalNodeNativeSessions(
|
|
62686
63436
|
self2.id,
|
|
62687
|
-
|
|
63437
|
+
agent === "claudecode" || agent === "copilot" ? agent : "codex",
|
|
62688
63438
|
payloadValue(request, "limit", 50)
|
|
62689
63439
|
)
|
|
62690
63440
|
);
|
|
@@ -63742,10 +64492,15 @@ async function cancelRemoteTaskExecution(deps) {
|
|
|
63742
64492
|
// ../../packages/api/src/tasks/task-session-import.ts
|
|
63743
64493
|
var TASK_IMPORT_PROXY_TIMEOUT_MS = 1e4;
|
|
63744
64494
|
function buildImportedSessionTitle(agent, sessionId) {
|
|
63745
|
-
const label = agent === "codex" ? "Codex" : "Claude Code";
|
|
64495
|
+
const label = agent === "codex" ? "Codex" : agent === "copilot" ? "Copilot CLI" : "Claude Code";
|
|
63746
64496
|
const suffix = sessionId.trim().slice(0, 12);
|
|
63747
64497
|
return `${label} session ${suffix || "attached"}`;
|
|
63748
64498
|
}
|
|
64499
|
+
function getNativeSessionAgentLabel(agent) {
|
|
64500
|
+
if (agent === "codex") return "Codex";
|
|
64501
|
+
if (agent === "copilot") return "Copilot CLI";
|
|
64502
|
+
return "Claude Code";
|
|
64503
|
+
}
|
|
63749
64504
|
function resolveTargetImportNode(nodeRegistry, nodeId, agent) {
|
|
63750
64505
|
const self2 = nodeRegistry.getSelf();
|
|
63751
64506
|
const node = nodeRegistry.getNode(nodeId) ?? (self2?.id === nodeId ? self2 : null);
|
|
@@ -63775,7 +64530,7 @@ async function attachNativeSession(deps, body) {
|
|
|
63775
64530
|
let importedLogs = history.logs;
|
|
63776
64531
|
const task = deps.taskEngine.createTask({
|
|
63777
64532
|
title: body.title?.trim() || buildImportedSessionTitle(body.agent, body.sessionId),
|
|
63778
|
-
description: `Attached native ${body.agent
|
|
64533
|
+
description: `Attached native ${getNativeSessionAgentLabel(body.agent)} session`,
|
|
63779
64534
|
agent: body.agent,
|
|
63780
64535
|
project: body.cwd,
|
|
63781
64536
|
conversationKind: "nativeSession",
|
|
@@ -65254,7 +66009,7 @@ function createWorkerRoutes() {
|
|
|
65254
66009
|
let { logs } = body;
|
|
65255
66010
|
if (logs.length === 0 && task.conversationKind === "nativeSession") {
|
|
65256
66011
|
const sessionId = typeof task.payload?.sessionId === "string" ? task.payload.sessionId : "";
|
|
65257
|
-
if (sessionId && (task.agent === "codex" || task.agent === "claudecode")) {
|
|
66012
|
+
if (sessionId && (task.agent === "codex" || task.agent === "claudecode" || task.agent === "copilot")) {
|
|
65258
66013
|
logs = loadNativeSessionHistory({ agent: task.agent, sessionId }).logs;
|
|
65259
66014
|
}
|
|
65260
66015
|
}
|
|
@@ -65737,8 +66492,8 @@ function hasAuthorizationHeader(req) {
|
|
|
65737
66492
|
function resolveRuntimeBaseDir() {
|
|
65738
66493
|
const entryPath = process.argv[1];
|
|
65739
66494
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
65740
|
-
const resolved =
|
|
65741
|
-
return
|
|
66495
|
+
const resolved = fs20.realpathSync(path20.resolve(entryPath));
|
|
66496
|
+
return path20.dirname(resolved);
|
|
65742
66497
|
}
|
|
65743
66498
|
return process.cwd();
|
|
65744
66499
|
}
|
|
@@ -65746,18 +66501,18 @@ function resolveStaticDir(baseDir) {
|
|
|
65746
66501
|
const envStaticDir = process.env.MESHY_STATIC_DIR;
|
|
65747
66502
|
const candidateDirs = [
|
|
65748
66503
|
envStaticDir,
|
|
65749
|
-
|
|
65750
|
-
|
|
65751
|
-
|
|
65752
|
-
|
|
65753
|
-
|
|
65754
|
-
|
|
65755
|
-
|
|
65756
|
-
|
|
65757
|
-
|
|
66504
|
+
path20.resolve(baseDir, "dashboard"),
|
|
66505
|
+
path20.resolve(baseDir, "../dashboard"),
|
|
66506
|
+
path20.resolve(baseDir, "../../dashboard/dist"),
|
|
66507
|
+
path20.resolve(baseDir, "../../../packages/dashboard/dist"),
|
|
66508
|
+
path20.resolve(baseDir, "../public"),
|
|
66509
|
+
path20.resolve(baseDir, "../../packages/api/public"),
|
|
66510
|
+
path20.resolve(baseDir, "../../../packages/api/public"),
|
|
66511
|
+
path20.resolve(process.cwd(), "packages/dashboard/dist"),
|
|
66512
|
+
path20.resolve(process.cwd(), "packages/api/public")
|
|
65758
66513
|
].filter((value) => typeof value === "string" && value.length > 0);
|
|
65759
66514
|
for (const candidate of candidateDirs) {
|
|
65760
|
-
if (
|
|
66515
|
+
if (fs20.existsSync(candidate)) {
|
|
65761
66516
|
return candidate;
|
|
65762
66517
|
}
|
|
65763
66518
|
}
|
|
@@ -65865,8 +66620,8 @@ function createServer2(deps) {
|
|
|
65865
66620
|
app.use("/api/node-operations", createNodeOperationRoutes());
|
|
65866
66621
|
app.use("/api/events", createEventRoutes());
|
|
65867
66622
|
if (staticDir) {
|
|
65868
|
-
const indexPath =
|
|
65869
|
-
if (
|
|
66623
|
+
const indexPath = path20.join(staticDir, "index.html");
|
|
66624
|
+
if (fs20.existsSync(indexPath)) {
|
|
65870
66625
|
app.get("*", (req, res, next) => {
|
|
65871
66626
|
if (isApiRequest(req)) {
|
|
65872
66627
|
next();
|
|
@@ -65980,12 +66735,12 @@ function detectLocalIp() {
|
|
|
65980
66735
|
return "127.0.0.1";
|
|
65981
66736
|
}
|
|
65982
66737
|
function detectAvailablePort() {
|
|
65983
|
-
return new Promise((
|
|
66738
|
+
return new Promise((resolve15, reject) => {
|
|
65984
66739
|
const srv = (0, import_node_http2.createServer)();
|
|
65985
66740
|
srv.listen(0, () => {
|
|
65986
66741
|
const addr = srv.address();
|
|
65987
66742
|
const port = addr && typeof addr !== "string" ? addr.port : 0;
|
|
65988
|
-
srv.close((err) => err ? reject(err) :
|
|
66743
|
+
srv.close((err) => err ? reject(err) : resolve15(port));
|
|
65989
66744
|
});
|
|
65990
66745
|
srv.on("error", reject);
|
|
65991
66746
|
});
|
|
@@ -66030,10 +66785,10 @@ var DirectTransport = class {
|
|
|
66030
66785
|
};
|
|
66031
66786
|
|
|
66032
66787
|
// ../../packages/transport/src/devtunnel.ts
|
|
66033
|
-
var
|
|
66788
|
+
var import_node_child_process11 = require("child_process");
|
|
66034
66789
|
function isInstalled(cmd) {
|
|
66035
66790
|
try {
|
|
66036
|
-
(0,
|
|
66791
|
+
(0, import_node_child_process11.execSync)(process.platform === "win32" ? `where ${cmd}` : `command -v ${cmd}`, { stdio: "pipe" });
|
|
66037
66792
|
return true;
|
|
66038
66793
|
} catch {
|
|
66039
66794
|
return false;
|
|
@@ -66056,18 +66811,18 @@ var DevTunnelTransport = class {
|
|
|
66056
66811
|
);
|
|
66057
66812
|
}
|
|
66058
66813
|
try {
|
|
66059
|
-
(0,
|
|
66814
|
+
(0, import_node_child_process11.execSync)("devtunnel user show", { stdio: "pipe" });
|
|
66060
66815
|
} catch {
|
|
66061
66816
|
throw new Error(
|
|
66062
66817
|
"Not logged in to devtunnel. Run: devtunnel user login"
|
|
66063
66818
|
);
|
|
66064
66819
|
}
|
|
66065
66820
|
const hostArgs = this.buildHostArgs(localPort);
|
|
66066
|
-
const child = (0,
|
|
66821
|
+
const child = (0, import_node_child_process11.spawn)("devtunnel", hostArgs, {
|
|
66067
66822
|
stdio: ["pipe", "pipe", "pipe"]
|
|
66068
66823
|
});
|
|
66069
66824
|
this.process = child;
|
|
66070
|
-
this.publicUrl = await new Promise((
|
|
66825
|
+
this.publicUrl = await new Promise((resolve15, reject) => {
|
|
66071
66826
|
const timeout = setTimeout(() => {
|
|
66072
66827
|
child.kill();
|
|
66073
66828
|
this.process = null;
|
|
@@ -66090,7 +66845,7 @@ var DevTunnelTransport = class {
|
|
|
66090
66845
|
clearTimeout(timeout);
|
|
66091
66846
|
child.stdout?.removeListener("data", onData);
|
|
66092
66847
|
child.stderr?.removeListener("data", onErrData);
|
|
66093
|
-
|
|
66848
|
+
resolve15(url.replace(/\/+$/, ""));
|
|
66094
66849
|
};
|
|
66095
66850
|
child.stdout?.on("data", onData);
|
|
66096
66851
|
child.stderr?.on("data", onErrData);
|
|
@@ -66122,14 +66877,14 @@ ${lines.join("")}`
|
|
|
66122
66877
|
this.publicUrl = null;
|
|
66123
66878
|
if (child.exitCode === null) {
|
|
66124
66879
|
child.kill("SIGTERM");
|
|
66125
|
-
await new Promise((
|
|
66880
|
+
await new Promise((resolve15) => {
|
|
66126
66881
|
const killTimer = setTimeout(() => {
|
|
66127
66882
|
child.kill("SIGKILL");
|
|
66128
|
-
|
|
66883
|
+
resolve15();
|
|
66129
66884
|
}, 5e3);
|
|
66130
66885
|
child.on("close", () => {
|
|
66131
66886
|
clearTimeout(killTimer);
|
|
66132
|
-
|
|
66887
|
+
resolve15();
|
|
66133
66888
|
});
|
|
66134
66889
|
});
|
|
66135
66890
|
}
|
|
@@ -66168,7 +66923,7 @@ ${lines.join("")}`
|
|
|
66168
66923
|
return;
|
|
66169
66924
|
}
|
|
66170
66925
|
try {
|
|
66171
|
-
(0,
|
|
66926
|
+
(0, import_node_child_process11.execFileSync)("devtunnel", ["access", "create", tunnelId, "--tenant"], { stdio: "pipe" });
|
|
66172
66927
|
} catch (err) {
|
|
66173
66928
|
if (isExistingTenantAccessError(err)) {
|
|
66174
66929
|
return;
|
|
@@ -66184,7 +66939,7 @@ ${lines.join("")}`
|
|
|
66184
66939
|
return void 0;
|
|
66185
66940
|
}
|
|
66186
66941
|
try {
|
|
66187
|
-
(0,
|
|
66942
|
+
(0, import_node_child_process11.execFileSync)("devtunnel", ["show", tunnelId], { stdio: "pipe" });
|
|
66188
66943
|
return tunnelId;
|
|
66189
66944
|
} catch {
|
|
66190
66945
|
const createArgs = ["create", tunnelId];
|
|
@@ -66192,7 +66947,7 @@ ${lines.join("")}`
|
|
|
66192
66947
|
createArgs.push("-a");
|
|
66193
66948
|
}
|
|
66194
66949
|
try {
|
|
66195
|
-
(0,
|
|
66950
|
+
(0, import_node_child_process11.execFileSync)("devtunnel", createArgs, { stdio: "pipe" });
|
|
66196
66951
|
return tunnelId;
|
|
66197
66952
|
} catch (err) {
|
|
66198
66953
|
throw new Error(
|
|
@@ -66204,13 +66959,13 @@ ${lines.join("")}`
|
|
|
66204
66959
|
ensureTunnelPort(tunnelId, localPort) {
|
|
66205
66960
|
const ports = this.listTunnelPorts(tunnelId);
|
|
66206
66961
|
for (const stalePort of ports.filter((p) => p !== localPort)) {
|
|
66207
|
-
(0,
|
|
66962
|
+
(0, import_node_child_process11.execFileSync)("devtunnel", ["port", "delete", tunnelId, "-p", String(stalePort)], { stdio: "pipe" });
|
|
66208
66963
|
}
|
|
66209
66964
|
if (ports.includes(localPort)) {
|
|
66210
66965
|
return;
|
|
66211
66966
|
}
|
|
66212
66967
|
try {
|
|
66213
|
-
(0,
|
|
66968
|
+
(0, import_node_child_process11.execFileSync)(
|
|
66214
66969
|
"devtunnel",
|
|
66215
66970
|
["port", "create", tunnelId, "-p", String(localPort), "--protocol", "http"],
|
|
66216
66971
|
{ stdio: "pipe" }
|
|
@@ -66226,7 +66981,7 @@ ${lines.join("")}`
|
|
|
66226
66981
|
}
|
|
66227
66982
|
listTunnelPorts(tunnelId) {
|
|
66228
66983
|
try {
|
|
66229
|
-
const output = (0,
|
|
66984
|
+
const output = (0, import_node_child_process11.execFileSync)("devtunnel", ["port", "list", tunnelId, "-j"], { stdio: "pipe" });
|
|
66230
66985
|
const parsed = JSON.parse(output.toString());
|
|
66231
66986
|
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 : [];
|
|
66232
66987
|
return items.map((item) => getPortNumber(item)).filter((value) => value !== void 0);
|
|
@@ -66238,7 +66993,7 @@ ${lines.join("")}`
|
|
|
66238
66993
|
}
|
|
66239
66994
|
hasTunnelPort(tunnelId, localPort) {
|
|
66240
66995
|
try {
|
|
66241
|
-
(0,
|
|
66996
|
+
(0, import_node_child_process11.execFileSync)(
|
|
66242
66997
|
"devtunnel",
|
|
66243
66998
|
["port", "show", tunnelId, "-p", String(localPort), "-j"],
|
|
66244
66999
|
{ stdio: "pipe" }
|
|
@@ -66342,10 +67097,10 @@ var terminalWriter = {
|
|
|
66342
67097
|
};
|
|
66343
67098
|
|
|
66344
67099
|
// src/startup.ts
|
|
66345
|
-
var
|
|
66346
|
-
var
|
|
67100
|
+
var fs21 = __toESM(require("fs"), 1);
|
|
67101
|
+
var path21 = __toESM(require("path"), 1);
|
|
66347
67102
|
var readline = __toESM(require("readline/promises"), 1);
|
|
66348
|
-
var
|
|
67103
|
+
var import_node_child_process12 = require("child_process");
|
|
66349
67104
|
function getDefaultNodeName() {
|
|
66350
67105
|
return getDeviceNodeName();
|
|
66351
67106
|
}
|
|
@@ -66355,7 +67110,7 @@ function isDevBoxEnvironment(env = process.env) {
|
|
|
66355
67110
|
}
|
|
66356
67111
|
var DEFAULT_NODE_NAME = getDefaultNodeName();
|
|
66357
67112
|
var SUPPORTED_TRANSPORTS = ["direct", "devtunnel"];
|
|
66358
|
-
var STARTUP_REQUIREMENTS = ["az", "devtunnel", "claude", "codex"];
|
|
67113
|
+
var STARTUP_REQUIREMENTS = ["az", "devtunnel", "claude", "codex", "copilot"];
|
|
66359
67114
|
function createDefaultConfig(storagePath = resolveDefaultStoragePath(), nodeName = DEFAULT_NODE_NAME) {
|
|
66360
67115
|
return {
|
|
66361
67116
|
node: { name: nodeName, port: DEFAULT_NODE_PORT, workDir: process.cwd() },
|
|
@@ -66399,7 +67154,7 @@ function createPromptSession(prompt) {
|
|
|
66399
67154
|
}
|
|
66400
67155
|
function createDefaultCommandRunner(platform2) {
|
|
66401
67156
|
return (command, args, interactive = false) => {
|
|
66402
|
-
const result = (0,
|
|
67157
|
+
const result = (0, import_node_child_process12.spawnSync)(command, args, {
|
|
66403
67158
|
encoding: "utf-8",
|
|
66404
67159
|
shell: platform2 === "win32",
|
|
66405
67160
|
stdio: interactive ? "inherit" : "pipe"
|
|
@@ -66414,19 +67169,19 @@ function createDefaultCommandRunner(platform2) {
|
|
|
66414
67169
|
};
|
|
66415
67170
|
}
|
|
66416
67171
|
function getNodeMetadataPath2(storagePath) {
|
|
66417
|
-
return
|
|
67172
|
+
return path21.join(storagePath, "metadata.json");
|
|
66418
67173
|
}
|
|
66419
67174
|
function readStartupMetadataFile(storagePath) {
|
|
66420
67175
|
try {
|
|
66421
|
-
const raw = JSON.parse(
|
|
67176
|
+
const raw = JSON.parse(fs21.readFileSync(getNodeMetadataPath2(storagePath), "utf-8"));
|
|
66422
67177
|
return typeof raw === "object" && raw !== null ? raw : {};
|
|
66423
67178
|
} catch {
|
|
66424
67179
|
return {};
|
|
66425
67180
|
}
|
|
66426
67181
|
}
|
|
66427
67182
|
function writeStartupMetadataFile(storagePath, metadata) {
|
|
66428
|
-
|
|
66429
|
-
|
|
67183
|
+
fs21.mkdirSync(storagePath, { recursive: true });
|
|
67184
|
+
fs21.writeFileSync(getNodeMetadataPath2(storagePath), JSON.stringify(metadata, null, 2) + "\n", "utf-8");
|
|
66430
67185
|
}
|
|
66431
67186
|
function formatLocalDate2(now) {
|
|
66432
67187
|
const year = now.getFullYear();
|
|
@@ -66477,6 +67232,8 @@ function buildInstallCommand(requirement, platform2) {
|
|
|
66477
67232
|
return void 0;
|
|
66478
67233
|
case "codex":
|
|
66479
67234
|
return { command: "npm", args: ["install", "-g", "@openai/codex"] };
|
|
67235
|
+
case "copilot":
|
|
67236
|
+
return { command: "npm", args: ["install", "-g", "@github/copilot"] };
|
|
66480
67237
|
}
|
|
66481
67238
|
}
|
|
66482
67239
|
function buildLoginCommand(requirement) {
|
|
@@ -66508,7 +67265,7 @@ function isRequirementSatisfied(requirement, status) {
|
|
|
66508
67265
|
return true;
|
|
66509
67266
|
}
|
|
66510
67267
|
function sleep2(ms) {
|
|
66511
|
-
return new Promise((
|
|
67268
|
+
return new Promise((resolve15) => setTimeout(resolve15, ms));
|
|
66512
67269
|
}
|
|
66513
67270
|
function areCachedAuthRequirementsCurrent(commandRunner) {
|
|
66514
67271
|
return isAuthenticated("az", commandRunner) && isAuthenticated("devtunnel", commandRunner);
|
|
@@ -66665,9 +67422,9 @@ async function ensureStartupRequirements(storagePath, options = {}) {
|
|
|
66665
67422
|
metadata
|
|
66666
67423
|
};
|
|
66667
67424
|
}
|
|
66668
|
-
function loadConfigFile(
|
|
67425
|
+
function loadConfigFile(path23) {
|
|
66669
67426
|
try {
|
|
66670
|
-
const raw =
|
|
67427
|
+
const raw = fs21.readFileSync(path23, "utf-8");
|
|
66671
67428
|
return JSON.parse(raw);
|
|
66672
67429
|
} catch {
|
|
66673
67430
|
return {};
|
|
@@ -66846,26 +67603,26 @@ function formatLoadedStartMetadata(info, authEnabled) {
|
|
|
66846
67603
|
}
|
|
66847
67604
|
|
|
66848
67605
|
// src/runtime-metadata.ts
|
|
66849
|
-
var
|
|
66850
|
-
var
|
|
66851
|
-
var
|
|
67606
|
+
var fs22 = __toESM(require("fs"), 1);
|
|
67607
|
+
var path22 = __toESM(require("path"), 1);
|
|
67608
|
+
var import_node_child_process13 = require("child_process");
|
|
66852
67609
|
var runtimeDir = resolveRuntimeDir();
|
|
66853
67610
|
var appRoot = resolveAppRoot(runtimeDir);
|
|
66854
|
-
var repoRoot =
|
|
67611
|
+
var repoRoot = path22.resolve(appRoot, "../..");
|
|
66855
67612
|
function resolveRuntimeDir() {
|
|
66856
67613
|
const entryPath = process.argv[1];
|
|
66857
67614
|
if (typeof entryPath === "string" && entryPath.length > 0) {
|
|
66858
67615
|
try {
|
|
66859
|
-
return
|
|
67616
|
+
return path22.dirname(fs22.realpathSync(path22.resolve(entryPath)));
|
|
66860
67617
|
} catch {
|
|
66861
|
-
return
|
|
67618
|
+
return path22.dirname(path22.resolve(entryPath));
|
|
66862
67619
|
}
|
|
66863
67620
|
}
|
|
66864
67621
|
return process.cwd();
|
|
66865
67622
|
}
|
|
66866
67623
|
function readJsonFile(filePath) {
|
|
66867
67624
|
try {
|
|
66868
|
-
return JSON.parse(
|
|
67625
|
+
return JSON.parse(fs22.readFileSync(filePath, "utf-8"));
|
|
66869
67626
|
} catch {
|
|
66870
67627
|
return null;
|
|
66871
67628
|
}
|
|
@@ -66875,9 +67632,9 @@ function readPackageManifest(filePath) {
|
|
|
66875
67632
|
}
|
|
66876
67633
|
function readEmbeddedRuntimeMetadata() {
|
|
66877
67634
|
const candidates = [
|
|
66878
|
-
|
|
66879
|
-
|
|
66880
|
-
|
|
67635
|
+
path22.join(appRoot, "runtime-metadata.json"),
|
|
67636
|
+
path22.join(runtimeDir, "runtime-metadata.json"),
|
|
67637
|
+
path22.resolve(process.cwd(), "apps/node/dist/runtime-metadata.json")
|
|
66881
67638
|
];
|
|
66882
67639
|
for (const candidate of candidates) {
|
|
66883
67640
|
const metadata = readJsonFile(candidate);
|
|
@@ -66890,23 +67647,23 @@ function readEmbeddedRuntimeMetadata() {
|
|
|
66890
67647
|
function resolveAppRoot(baseDir) {
|
|
66891
67648
|
const candidates = [
|
|
66892
67649
|
baseDir,
|
|
66893
|
-
|
|
66894
|
-
|
|
66895
|
-
|
|
67650
|
+
path22.resolve(baseDir, ".."),
|
|
67651
|
+
path22.resolve(process.cwd(), "apps/node/dist"),
|
|
67652
|
+
path22.resolve(process.cwd(), "apps/node"),
|
|
66896
67653
|
process.cwd()
|
|
66897
67654
|
];
|
|
66898
67655
|
for (const candidate of candidates) {
|
|
66899
|
-
const manifest = readPackageManifest(
|
|
67656
|
+
const manifest = readPackageManifest(path22.join(candidate, "package.json"));
|
|
66900
67657
|
if (manifest?.name === "@meshy/node" || manifest?.name === "meshy-node") {
|
|
66901
67658
|
return candidate;
|
|
66902
67659
|
}
|
|
66903
67660
|
}
|
|
66904
67661
|
for (const candidate of candidates) {
|
|
66905
|
-
if (
|
|
67662
|
+
if (fs22.existsSync(path22.join(candidate, "package.json"))) {
|
|
66906
67663
|
return candidate;
|
|
66907
67664
|
}
|
|
66908
67665
|
}
|
|
66909
|
-
return
|
|
67666
|
+
return path22.resolve(baseDir, "..");
|
|
66910
67667
|
}
|
|
66911
67668
|
function toPackageInfo(filePath) {
|
|
66912
67669
|
const manifest = readPackageManifest(filePath);
|
|
@@ -66944,7 +67701,7 @@ function readRepositoryUrlFromManifest(manifest) {
|
|
|
66944
67701
|
}
|
|
66945
67702
|
function readGitValue(args) {
|
|
66946
67703
|
try {
|
|
66947
|
-
const output = (0,
|
|
67704
|
+
const output = (0, import_node_child_process13.execFileSync)("git", args, {
|
|
66948
67705
|
cwd: repoRoot,
|
|
66949
67706
|
encoding: "utf-8",
|
|
66950
67707
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -66966,8 +67723,8 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
66966
67723
|
components: startupRequirements.components
|
|
66967
67724
|
};
|
|
66968
67725
|
}
|
|
66969
|
-
const appPackage = toPackageInfo(
|
|
66970
|
-
const workspaceManifest = readPackageManifest(
|
|
67726
|
+
const appPackage = toPackageInfo(path22.join(appRoot, "package.json"));
|
|
67727
|
+
const workspaceManifest = readPackageManifest(path22.join(repoRoot, "package.json"));
|
|
66971
67728
|
return {
|
|
66972
67729
|
packageName: appPackage?.name ?? "meshy",
|
|
66973
67730
|
packageVersion: appPackage?.version ?? "0.1.0",
|
|
@@ -66975,11 +67732,11 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
66975
67732
|
startupRequirementsLastCheckedOn: startupRequirements.lastCheckedOn,
|
|
66976
67733
|
components: startupRequirements.components,
|
|
66977
67734
|
packages: {
|
|
66978
|
-
workspace: toPackageInfo(
|
|
67735
|
+
workspace: toPackageInfo(path22.join(repoRoot, "package.json")),
|
|
66979
67736
|
node: appPackage,
|
|
66980
|
-
core: toPackageInfo(
|
|
66981
|
-
dashboard: toPackageInfo(
|
|
66982
|
-
api: toPackageInfo(
|
|
67737
|
+
core: toPackageInfo(path22.join(repoRoot, "packages/core/package.json")),
|
|
67738
|
+
dashboard: toPackageInfo(path22.join(repoRoot, "packages/dashboard/package.json")),
|
|
67739
|
+
api: toPackageInfo(path22.join(repoRoot, "packages/api/package.json"))
|
|
66983
67740
|
},
|
|
66984
67741
|
repository: {
|
|
66985
67742
|
url: normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.upstream.url"])) ?? normalizeRepositoryUrl(readGitValue(["config", "--get", "remote.origin.url"])) ?? readRepositoryUrlFromManifest(workspaceManifest),
|
|
@@ -66990,9 +67747,9 @@ function buildRuntimeMetadata(storagePath) {
|
|
|
66990
67747
|
}
|
|
66991
67748
|
|
|
66992
67749
|
// src/bootstrap/runtime-restart.ts
|
|
66993
|
-
var
|
|
67750
|
+
var fs23 = __toESM(require("fs"), 1);
|
|
66994
67751
|
var nodePath2 = __toESM(require("path"), 1);
|
|
66995
|
-
var
|
|
67752
|
+
var import_node_child_process14 = require("child_process");
|
|
66996
67753
|
var RUNTIME_UPDATE_CHECK_INTERVAL_MS = 6 * 60 * 60 * 1e3;
|
|
66997
67754
|
function resolveRuntimeRestartStartArgs(hydratedArgs, restartArgs) {
|
|
66998
67755
|
return restartArgs ? { ...restartArgs } : hydratedArgs;
|
|
@@ -67101,7 +67858,7 @@ function compareSemver2(left, right) {
|
|
|
67101
67858
|
return 0;
|
|
67102
67859
|
}
|
|
67103
67860
|
function runRuntimePackageCommand(command, args) {
|
|
67104
|
-
const result = (0,
|
|
67861
|
+
const result = (0, import_node_child_process14.spawnSync)(command, args, {
|
|
67105
67862
|
encoding: "utf-8",
|
|
67106
67863
|
windowsHide: true,
|
|
67107
67864
|
timeout: 2500
|
|
@@ -67140,7 +67897,7 @@ function createSpawnableCommand(command, args, platform2) {
|
|
|
67140
67897
|
}
|
|
67141
67898
|
function readProcessCommand(pid, platform2) {
|
|
67142
67899
|
if (platform2 === "win32") return null;
|
|
67143
|
-
const result = (0,
|
|
67900
|
+
const result = (0, import_node_child_process14.spawnSync)("ps", ["-p", String(pid), "-o", "args="], {
|
|
67144
67901
|
encoding: "utf-8",
|
|
67145
67902
|
windowsHide: true,
|
|
67146
67903
|
timeout: 1e3
|
|
@@ -67231,9 +67988,9 @@ function createRuntimeRestartLaunchPlan(options) {
|
|
|
67231
67988
|
};
|
|
67232
67989
|
}
|
|
67233
67990
|
function scheduleRuntimeRestart(plan, options = {}) {
|
|
67234
|
-
|
|
67235
|
-
const logFd =
|
|
67236
|
-
const spawnImpl = options.spawnImpl ??
|
|
67991
|
+
fs23.mkdirSync(nodePath2.dirname(plan.logPath), { recursive: true });
|
|
67992
|
+
const logFd = fs23.openSync(plan.logPath, "a");
|
|
67993
|
+
const spawnImpl = options.spawnImpl ?? import_node_child_process14.spawn;
|
|
67237
67994
|
const env = {
|
|
67238
67995
|
...process.env,
|
|
67239
67996
|
MESHY_RESTART_PARENT_PID: String(options.parentPid ?? process.pid),
|
|
@@ -67827,7 +68584,7 @@ function registerShutdownHandlers(options) {
|
|
|
67827
68584
|
}
|
|
67828
68585
|
async function startNode(args) {
|
|
67829
68586
|
const { authMetadata, config: config2, hydratedArgs, runtimeMetadata, storageRoot } = await resolveStartConfig(args);
|
|
67830
|
-
terminalWriter.line("Checking startup requirements (az, devtunnel, claude, codex)...");
|
|
68587
|
+
terminalWriter.line("Checking startup requirements (az, devtunnel, claude, codex, copilot)...");
|
|
67831
68588
|
const startupRequirements = await ensureStartupRequirements(config2.storage.path);
|
|
67832
68589
|
terminalWriter.line(
|
|
67833
68590
|
startupRequirements.skipped ? "Startup requirements already verified today; skipping checks." : "Startup requirements check complete."
|
|
@@ -67902,7 +68659,8 @@ async function startNode(args) {
|
|
|
67902
68659
|
engineRegistry: meshyNode.getEngineRegistry(),
|
|
67903
68660
|
liteAgentRunner: new LiteAgentRunner({
|
|
67904
68661
|
claudecode: new ClaudeLiteAdapter(),
|
|
67905
|
-
codex: new CodexLiteAdapter()
|
|
68662
|
+
codex: new CodexLiteAdapter(),
|
|
68663
|
+
copilot: new CopilotLiteAdapter()
|
|
67906
68664
|
}),
|
|
67907
68665
|
logger: meshyNode.getLogger(),
|
|
67908
68666
|
config: {
|