@chosengeneration/light-code 0.186.0 → 0.188.0
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/dist/bin/fire-fs.exe +0 -0
- package/dist/cli.cjs +1206 -707
- package/dist/server.cjs +1163 -664
- package/package.json +1 -1
package/dist/server.cjs
CHANGED
|
@@ -494,14 +494,14 @@ var require_util = __commonJS({
|
|
|
494
494
|
}
|
|
495
495
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
496
496
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol}//${url2.hostname}:${port}`;
|
|
497
|
-
let
|
|
497
|
+
let path67 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
498
498
|
if (origin.endsWith("/")) {
|
|
499
499
|
origin = origin.substring(0, origin.length - 1);
|
|
500
500
|
}
|
|
501
|
-
if (
|
|
502
|
-
|
|
501
|
+
if (path67 && !path67.startsWith("/")) {
|
|
502
|
+
path67 = `/${path67}`;
|
|
503
503
|
}
|
|
504
|
-
url2 = new URL(origin +
|
|
504
|
+
url2 = new URL(origin + path67);
|
|
505
505
|
}
|
|
506
506
|
return url2;
|
|
507
507
|
}
|
|
@@ -2115,20 +2115,20 @@ var require_parseParams = __commonJS({
|
|
|
2115
2115
|
var require_basename = __commonJS({
|
|
2116
2116
|
"../../node_modules/.pnpm/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/basename.js"(exports2, module2) {
|
|
2117
2117
|
"use strict";
|
|
2118
|
-
module2.exports = function basename(
|
|
2119
|
-
if (typeof
|
|
2118
|
+
module2.exports = function basename(path67) {
|
|
2119
|
+
if (typeof path67 !== "string") {
|
|
2120
2120
|
return "";
|
|
2121
2121
|
}
|
|
2122
|
-
for (var i =
|
|
2123
|
-
switch (
|
|
2122
|
+
for (var i = path67.length - 1; i >= 0; --i) {
|
|
2123
|
+
switch (path67.charCodeAt(i)) {
|
|
2124
2124
|
case 47:
|
|
2125
2125
|
// '/'
|
|
2126
2126
|
case 92:
|
|
2127
|
-
|
|
2128
|
-
return
|
|
2127
|
+
path67 = path67.slice(i + 1);
|
|
2128
|
+
return path67 === ".." || path67 === "." ? "" : path67;
|
|
2129
2129
|
}
|
|
2130
2130
|
}
|
|
2131
|
-
return
|
|
2131
|
+
return path67 === ".." || path67 === "." ? "" : path67;
|
|
2132
2132
|
};
|
|
2133
2133
|
}
|
|
2134
2134
|
});
|
|
@@ -5158,7 +5158,7 @@ var require_request = __commonJS({
|
|
|
5158
5158
|
}
|
|
5159
5159
|
var Request = class _Request {
|
|
5160
5160
|
constructor(origin, {
|
|
5161
|
-
path:
|
|
5161
|
+
path: path67,
|
|
5162
5162
|
method,
|
|
5163
5163
|
body,
|
|
5164
5164
|
headers,
|
|
@@ -5172,11 +5172,11 @@ var require_request = __commonJS({
|
|
|
5172
5172
|
throwOnError,
|
|
5173
5173
|
expectContinue
|
|
5174
5174
|
}, handler) {
|
|
5175
|
-
if (typeof
|
|
5175
|
+
if (typeof path67 !== "string") {
|
|
5176
5176
|
throw new InvalidArgumentError("path must be a string");
|
|
5177
|
-
} else if (
|
|
5177
|
+
} else if (path67[0] !== "/" && !(path67.startsWith("http://") || path67.startsWith("https://")) && method !== "CONNECT") {
|
|
5178
5178
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
5179
|
-
} else if (invalidPathRegex.exec(
|
|
5179
|
+
} else if (invalidPathRegex.exec(path67) !== null) {
|
|
5180
5180
|
throw new InvalidArgumentError("invalid request path");
|
|
5181
5181
|
}
|
|
5182
5182
|
if (typeof method !== "string") {
|
|
@@ -5239,7 +5239,7 @@ var require_request = __commonJS({
|
|
|
5239
5239
|
this.completed = false;
|
|
5240
5240
|
this.aborted = false;
|
|
5241
5241
|
this.upgrade = upgrade || null;
|
|
5242
|
-
this.path = query ? util.buildURL(
|
|
5242
|
+
this.path = query ? util.buildURL(path67, query) : path67;
|
|
5243
5243
|
this.origin = origin;
|
|
5244
5244
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
5245
5245
|
this.blocking = blocking == null ? false : blocking;
|
|
@@ -6247,9 +6247,9 @@ var require_RedirectHandler = __commonJS({
|
|
|
6247
6247
|
return this.handler.onHeaders(statusCode, headers, resume, statusText);
|
|
6248
6248
|
}
|
|
6249
6249
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
6250
|
-
const
|
|
6250
|
+
const path67 = search ? `${pathname}${search}` : pathname;
|
|
6251
6251
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
6252
|
-
this.opts.path =
|
|
6252
|
+
this.opts.path = path67;
|
|
6253
6253
|
this.opts.origin = origin;
|
|
6254
6254
|
this.opts.maxRedirections = 0;
|
|
6255
6255
|
this.opts.query = null;
|
|
@@ -7489,7 +7489,7 @@ var require_client = __commonJS({
|
|
|
7489
7489
|
writeH2(client, client[kHTTP2Session], request2);
|
|
7490
7490
|
return;
|
|
7491
7491
|
}
|
|
7492
|
-
const { body, method, path:
|
|
7492
|
+
const { body, method, path: path67, host, upgrade, headers, blocking, reset } = request2;
|
|
7493
7493
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
7494
7494
|
if (body && typeof body.read === "function") {
|
|
7495
7495
|
body.read(0);
|
|
@@ -7539,7 +7539,7 @@ var require_client = __commonJS({
|
|
|
7539
7539
|
if (blocking) {
|
|
7540
7540
|
socket[kBlocking] = true;
|
|
7541
7541
|
}
|
|
7542
|
-
let header2 = `${method} ${
|
|
7542
|
+
let header2 = `${method} ${path67} HTTP/1.1\r
|
|
7543
7543
|
`;
|
|
7544
7544
|
if (typeof host === "string") {
|
|
7545
7545
|
header2 += `host: ${host}\r
|
|
@@ -7602,7 +7602,7 @@ upgrade: ${upgrade}\r
|
|
|
7602
7602
|
return true;
|
|
7603
7603
|
}
|
|
7604
7604
|
function writeH2(client, session, request2) {
|
|
7605
|
-
const { body, method, path:
|
|
7605
|
+
const { body, method, path: path67, host, upgrade, expectContinue, signal, headers: reqHeaders } = request2;
|
|
7606
7606
|
let headers;
|
|
7607
7607
|
if (typeof reqHeaders === "string") headers = Request[kHTTP2CopyHeaders](reqHeaders.trim());
|
|
7608
7608
|
else headers = reqHeaders;
|
|
@@ -7645,7 +7645,7 @@ upgrade: ${upgrade}\r
|
|
|
7645
7645
|
});
|
|
7646
7646
|
return true;
|
|
7647
7647
|
}
|
|
7648
|
-
headers[HTTP2_HEADER_PATH] =
|
|
7648
|
+
headers[HTTP2_HEADER_PATH] = path67;
|
|
7649
7649
|
headers[HTTP2_HEADER_SCHEME] = "https";
|
|
7650
7650
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
7651
7651
|
if (body && typeof body.read === "function") {
|
|
@@ -9885,20 +9885,20 @@ var require_mock_utils = __commonJS({
|
|
|
9885
9885
|
}
|
|
9886
9886
|
return true;
|
|
9887
9887
|
}
|
|
9888
|
-
function safeUrl(
|
|
9889
|
-
if (typeof
|
|
9890
|
-
return
|
|
9888
|
+
function safeUrl(path67) {
|
|
9889
|
+
if (typeof path67 !== "string") {
|
|
9890
|
+
return path67;
|
|
9891
9891
|
}
|
|
9892
|
-
const pathSegments =
|
|
9892
|
+
const pathSegments = path67.split("?");
|
|
9893
9893
|
if (pathSegments.length !== 2) {
|
|
9894
|
-
return
|
|
9894
|
+
return path67;
|
|
9895
9895
|
}
|
|
9896
9896
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
9897
9897
|
qp.sort();
|
|
9898
9898
|
return [...pathSegments, qp.toString()].join("?");
|
|
9899
9899
|
}
|
|
9900
|
-
function matchKey(mockDispatch2, { path:
|
|
9901
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
9900
|
+
function matchKey(mockDispatch2, { path: path67, method, body, headers }) {
|
|
9901
|
+
const pathMatch = matchValue(mockDispatch2.path, path67);
|
|
9902
9902
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
9903
9903
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
9904
9904
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -9916,7 +9916,7 @@ var require_mock_utils = __commonJS({
|
|
|
9916
9916
|
function getMockDispatch(mockDispatches, key3) {
|
|
9917
9917
|
const basePath = key3.query ? buildURL(key3.path, key3.query) : key3.path;
|
|
9918
9918
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
9919
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
9919
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path67 }) => matchValue(safeUrl(path67), resolvedPath));
|
|
9920
9920
|
if (matchedMockDispatches.length === 0) {
|
|
9921
9921
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
9922
9922
|
}
|
|
@@ -9953,9 +9953,9 @@ var require_mock_utils = __commonJS({
|
|
|
9953
9953
|
}
|
|
9954
9954
|
}
|
|
9955
9955
|
function buildKey(opts) {
|
|
9956
|
-
const { path:
|
|
9956
|
+
const { path: path67, method, body, headers, query } = opts;
|
|
9957
9957
|
return {
|
|
9958
|
-
path:
|
|
9958
|
+
path: path67,
|
|
9959
9959
|
method,
|
|
9960
9960
|
body,
|
|
9961
9961
|
headers,
|
|
@@ -10404,10 +10404,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
10404
10404
|
}
|
|
10405
10405
|
format(pendingInterceptors) {
|
|
10406
10406
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
10407
|
-
({ method, path:
|
|
10407
|
+
({ method, path: path67, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
10408
10408
|
Method: method,
|
|
10409
10409
|
Origin: origin,
|
|
10410
|
-
Path:
|
|
10410
|
+
Path: path67,
|
|
10411
10411
|
"Status code": statusCode,
|
|
10412
10412
|
Persistent: persist ? "\u2705" : "\u274C",
|
|
10413
10413
|
Invocations: timesInvoked,
|
|
@@ -15027,8 +15027,8 @@ var require_util6 = __commonJS({
|
|
|
15027
15027
|
}
|
|
15028
15028
|
}
|
|
15029
15029
|
}
|
|
15030
|
-
function validateCookiePath(
|
|
15031
|
-
for (const char of
|
|
15030
|
+
function validateCookiePath(path67) {
|
|
15031
|
+
for (const char of path67) {
|
|
15032
15032
|
const code = char.charCodeAt(0);
|
|
15033
15033
|
if (code < 33 || char === ";") {
|
|
15034
15034
|
throw new Error("Invalid cookie path");
|
|
@@ -16708,11 +16708,11 @@ var require_undici = __commonJS({
|
|
|
16708
16708
|
if (typeof opts.path !== "string") {
|
|
16709
16709
|
throw new InvalidArgumentError("invalid opts.path");
|
|
16710
16710
|
}
|
|
16711
|
-
let
|
|
16711
|
+
let path67 = opts.path;
|
|
16712
16712
|
if (!opts.path.startsWith("/")) {
|
|
16713
|
-
|
|
16713
|
+
path67 = `/${path67}`;
|
|
16714
16714
|
}
|
|
16715
|
-
url2 = new URL(util.parseOrigin(url2).origin +
|
|
16715
|
+
url2 = new URL(util.parseOrigin(url2).origin + path67);
|
|
16716
16716
|
} else {
|
|
16717
16717
|
if (!opts) {
|
|
16718
16718
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -19983,8 +19983,8 @@ var require_utils2 = __commonJS({
|
|
|
19983
19983
|
}
|
|
19984
19984
|
return ind;
|
|
19985
19985
|
}
|
|
19986
|
-
function removeDotSegments(
|
|
19987
|
-
let input =
|
|
19986
|
+
function removeDotSegments(path67) {
|
|
19987
|
+
let input = path67;
|
|
19988
19988
|
const output = [];
|
|
19989
19989
|
let nextSlash = -1;
|
|
19990
19990
|
let len = 0;
|
|
@@ -20236,8 +20236,8 @@ var require_schemes = __commonJS({
|
|
|
20236
20236
|
wsComponent.secure = void 0;
|
|
20237
20237
|
}
|
|
20238
20238
|
if (wsComponent.resourceName) {
|
|
20239
|
-
const [
|
|
20240
|
-
wsComponent.path =
|
|
20239
|
+
const [path67, query] = wsComponent.resourceName.split("?");
|
|
20240
|
+
wsComponent.path = path67 && path67 !== "/" ? path67 : void 0;
|
|
20241
20241
|
wsComponent.query = query;
|
|
20242
20242
|
wsComponent.resourceName = void 0;
|
|
20243
20243
|
}
|
|
@@ -20392,21 +20392,21 @@ var require_fast_uri = __commonJS({
|
|
|
20392
20392
|
normalizeString(uri, options);
|
|
20393
20393
|
} else if (typeof uri === "object") {
|
|
20394
20394
|
uri = /** @type {T} */
|
|
20395
|
-
|
|
20395
|
+
parse4(serialize(uri, options), options);
|
|
20396
20396
|
}
|
|
20397
20397
|
return uri;
|
|
20398
20398
|
}
|
|
20399
20399
|
function resolve(baseURI, relativeURI, options) {
|
|
20400
20400
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
20401
|
-
const resolved = resolveComponent(
|
|
20401
|
+
const resolved = resolveComponent(parse4(baseURI, schemelessOptions), parse4(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
20402
20402
|
schemelessOptions.skipEscape = true;
|
|
20403
20403
|
return serialize(resolved, schemelessOptions);
|
|
20404
20404
|
}
|
|
20405
20405
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
20406
20406
|
const target = {};
|
|
20407
20407
|
if (!skipNormalization) {
|
|
20408
|
-
base =
|
|
20409
|
-
relative =
|
|
20408
|
+
base = parse4(serialize(base, options), options);
|
|
20409
|
+
relative = parse4(serialize(relative, options), options);
|
|
20410
20410
|
}
|
|
20411
20411
|
options = options || {};
|
|
20412
20412
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -20635,7 +20635,7 @@ var require_fast_uri = __commonJS({
|
|
|
20635
20635
|
}
|
|
20636
20636
|
return { parsed, malformedAuthorityOrPort };
|
|
20637
20637
|
}
|
|
20638
|
-
function
|
|
20638
|
+
function parse4(uri, opts) {
|
|
20639
20639
|
return parseWithStatus(uri, opts).parsed;
|
|
20640
20640
|
}
|
|
20641
20641
|
function normalizeString(uri, opts) {
|
|
@@ -20664,7 +20664,7 @@ var require_fast_uri = __commonJS({
|
|
|
20664
20664
|
resolveComponent,
|
|
20665
20665
|
equal,
|
|
20666
20666
|
serialize,
|
|
20667
|
-
parse:
|
|
20667
|
+
parse: parse4
|
|
20668
20668
|
};
|
|
20669
20669
|
module2.exports = fastUri;
|
|
20670
20670
|
module2.exports.default = fastUri;
|
|
@@ -23636,12 +23636,12 @@ var require_dist = __commonJS({
|
|
|
23636
23636
|
throw new Error(`Unknown format "${name}"`);
|
|
23637
23637
|
return f;
|
|
23638
23638
|
};
|
|
23639
|
-
function addFormats(ajv, list2,
|
|
23639
|
+
function addFormats(ajv, list2, fs47, exportName) {
|
|
23640
23640
|
var _a3;
|
|
23641
23641
|
var _b;
|
|
23642
23642
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
23643
23643
|
for (const f of list2)
|
|
23644
|
-
ajv.addFormat(f,
|
|
23644
|
+
ajv.addFormat(f, fs47[f]);
|
|
23645
23645
|
}
|
|
23646
23646
|
module2.exports = exports2 = formatsPlugin;
|
|
23647
23647
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -23654,8 +23654,8 @@ var require_windows = __commonJS({
|
|
|
23654
23654
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports2, module2) {
|
|
23655
23655
|
module2.exports = isexe;
|
|
23656
23656
|
isexe.sync = sync;
|
|
23657
|
-
var
|
|
23658
|
-
function checkPathExt(
|
|
23657
|
+
var fs47 = require("fs");
|
|
23658
|
+
function checkPathExt(path67, options) {
|
|
23659
23659
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
23660
23660
|
if (!pathext) {
|
|
23661
23661
|
return true;
|
|
@@ -23666,25 +23666,25 @@ var require_windows = __commonJS({
|
|
|
23666
23666
|
}
|
|
23667
23667
|
for (var i = 0; i < pathext.length; i++) {
|
|
23668
23668
|
var p = pathext[i].toLowerCase();
|
|
23669
|
-
if (p &&
|
|
23669
|
+
if (p && path67.substr(-p.length).toLowerCase() === p) {
|
|
23670
23670
|
return true;
|
|
23671
23671
|
}
|
|
23672
23672
|
}
|
|
23673
23673
|
return false;
|
|
23674
23674
|
}
|
|
23675
|
-
function checkStat(stat,
|
|
23675
|
+
function checkStat(stat, path67, options) {
|
|
23676
23676
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
23677
23677
|
return false;
|
|
23678
23678
|
}
|
|
23679
|
-
return checkPathExt(
|
|
23679
|
+
return checkPathExt(path67, options);
|
|
23680
23680
|
}
|
|
23681
|
-
function isexe(
|
|
23682
|
-
|
|
23683
|
-
cb(er, er ? false : checkStat(stat,
|
|
23681
|
+
function isexe(path67, options, cb) {
|
|
23682
|
+
fs47.stat(path67, function(er, stat) {
|
|
23683
|
+
cb(er, er ? false : checkStat(stat, path67, options));
|
|
23684
23684
|
});
|
|
23685
23685
|
}
|
|
23686
|
-
function sync(
|
|
23687
|
-
return checkStat(
|
|
23686
|
+
function sync(path67, options) {
|
|
23687
|
+
return checkStat(fs47.statSync(path67), path67, options);
|
|
23688
23688
|
}
|
|
23689
23689
|
}
|
|
23690
23690
|
});
|
|
@@ -23694,14 +23694,14 @@ var require_mode = __commonJS({
|
|
|
23694
23694
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports2, module2) {
|
|
23695
23695
|
module2.exports = isexe;
|
|
23696
23696
|
isexe.sync = sync;
|
|
23697
|
-
var
|
|
23698
|
-
function isexe(
|
|
23699
|
-
|
|
23697
|
+
var fs47 = require("fs");
|
|
23698
|
+
function isexe(path67, options, cb) {
|
|
23699
|
+
fs47.stat(path67, function(er, stat) {
|
|
23700
23700
|
cb(er, er ? false : checkStat(stat, options));
|
|
23701
23701
|
});
|
|
23702
23702
|
}
|
|
23703
|
-
function sync(
|
|
23704
|
-
return checkStat(
|
|
23703
|
+
function sync(path67, options) {
|
|
23704
|
+
return checkStat(fs47.statSync(path67), options);
|
|
23705
23705
|
}
|
|
23706
23706
|
function checkStat(stat, options) {
|
|
23707
23707
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -23725,7 +23725,7 @@ var require_mode = __commonJS({
|
|
|
23725
23725
|
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
23726
23726
|
var require_isexe = __commonJS({
|
|
23727
23727
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports2, module2) {
|
|
23728
|
-
var
|
|
23728
|
+
var fs47 = require("fs");
|
|
23729
23729
|
var core;
|
|
23730
23730
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
23731
23731
|
core = require_windows();
|
|
@@ -23734,7 +23734,7 @@ var require_isexe = __commonJS({
|
|
|
23734
23734
|
}
|
|
23735
23735
|
module2.exports = isexe;
|
|
23736
23736
|
isexe.sync = sync;
|
|
23737
|
-
function isexe(
|
|
23737
|
+
function isexe(path67, options, cb) {
|
|
23738
23738
|
if (typeof options === "function") {
|
|
23739
23739
|
cb = options;
|
|
23740
23740
|
options = {};
|
|
@@ -23744,7 +23744,7 @@ var require_isexe = __commonJS({
|
|
|
23744
23744
|
throw new TypeError("callback not provided");
|
|
23745
23745
|
}
|
|
23746
23746
|
return new Promise(function(resolve, reject2) {
|
|
23747
|
-
isexe(
|
|
23747
|
+
isexe(path67, options || {}, function(er, is) {
|
|
23748
23748
|
if (er) {
|
|
23749
23749
|
reject2(er);
|
|
23750
23750
|
} else {
|
|
@@ -23753,7 +23753,7 @@ var require_isexe = __commonJS({
|
|
|
23753
23753
|
});
|
|
23754
23754
|
});
|
|
23755
23755
|
}
|
|
23756
|
-
core(
|
|
23756
|
+
core(path67, options || {}, function(er, is) {
|
|
23757
23757
|
if (er) {
|
|
23758
23758
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
23759
23759
|
er = null;
|
|
@@ -23763,9 +23763,9 @@ var require_isexe = __commonJS({
|
|
|
23763
23763
|
cb(er, is);
|
|
23764
23764
|
});
|
|
23765
23765
|
}
|
|
23766
|
-
function sync(
|
|
23766
|
+
function sync(path67, options) {
|
|
23767
23767
|
try {
|
|
23768
|
-
return core.sync(
|
|
23768
|
+
return core.sync(path67, options || {});
|
|
23769
23769
|
} catch (er) {
|
|
23770
23770
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
23771
23771
|
return false;
|
|
@@ -23781,7 +23781,7 @@ var require_isexe = __commonJS({
|
|
|
23781
23781
|
var require_which = __commonJS({
|
|
23782
23782
|
"../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports2, module2) {
|
|
23783
23783
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
23784
|
-
var
|
|
23784
|
+
var path67 = require("path");
|
|
23785
23785
|
var COLON = isWindows ? ";" : ":";
|
|
23786
23786
|
var isexe = require_isexe();
|
|
23787
23787
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -23819,7 +23819,7 @@ var require_which = __commonJS({
|
|
|
23819
23819
|
return opt.all && found2.length ? resolve(found2) : reject2(getNotFoundError(cmd));
|
|
23820
23820
|
const ppRaw = pathEnv[i];
|
|
23821
23821
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
23822
|
-
const pCmd =
|
|
23822
|
+
const pCmd = path67.join(pathPart, cmd);
|
|
23823
23823
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
23824
23824
|
resolve(subStep(p, i, 0));
|
|
23825
23825
|
});
|
|
@@ -23846,7 +23846,7 @@ var require_which = __commonJS({
|
|
|
23846
23846
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
23847
23847
|
const ppRaw = pathEnv[i];
|
|
23848
23848
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
23849
|
-
const pCmd =
|
|
23849
|
+
const pCmd = path67.join(pathPart, cmd);
|
|
23850
23850
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
23851
23851
|
for (let j = 0; j < pathExt.length; j++) {
|
|
23852
23852
|
const cur = p + pathExt[j];
|
|
@@ -23894,7 +23894,7 @@ var require_path_key = __commonJS({
|
|
|
23894
23894
|
var require_resolveCommand = __commonJS({
|
|
23895
23895
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
|
|
23896
23896
|
"use strict";
|
|
23897
|
-
var
|
|
23897
|
+
var path67 = require("path");
|
|
23898
23898
|
var which = require_which();
|
|
23899
23899
|
var getPathKey = require_path_key();
|
|
23900
23900
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -23912,7 +23912,7 @@ var require_resolveCommand = __commonJS({
|
|
|
23912
23912
|
try {
|
|
23913
23913
|
resolved = which.sync(parsed.command, {
|
|
23914
23914
|
path: env2[getPathKey({ env: env2 })],
|
|
23915
|
-
pathExt: withoutPathExt ?
|
|
23915
|
+
pathExt: withoutPathExt ? path67.delimiter : void 0
|
|
23916
23916
|
});
|
|
23917
23917
|
} catch (e) {
|
|
23918
23918
|
} finally {
|
|
@@ -23921,7 +23921,7 @@ var require_resolveCommand = __commonJS({
|
|
|
23921
23921
|
}
|
|
23922
23922
|
}
|
|
23923
23923
|
if (resolved) {
|
|
23924
|
-
resolved =
|
|
23924
|
+
resolved = path67.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
23925
23925
|
}
|
|
23926
23926
|
return resolved;
|
|
23927
23927
|
}
|
|
@@ -23975,8 +23975,8 @@ var require_shebang_command = __commonJS({
|
|
|
23975
23975
|
if (!match) {
|
|
23976
23976
|
return null;
|
|
23977
23977
|
}
|
|
23978
|
-
const [
|
|
23979
|
-
const binary =
|
|
23978
|
+
const [path67, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
23979
|
+
const binary = path67.split("/").pop();
|
|
23980
23980
|
if (binary === "env") {
|
|
23981
23981
|
return argument;
|
|
23982
23982
|
}
|
|
@@ -23989,16 +23989,16 @@ var require_shebang_command = __commonJS({
|
|
|
23989
23989
|
var require_readShebang = __commonJS({
|
|
23990
23990
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
|
|
23991
23991
|
"use strict";
|
|
23992
|
-
var
|
|
23992
|
+
var fs47 = require("fs");
|
|
23993
23993
|
var shebangCommand = require_shebang_command();
|
|
23994
23994
|
function readShebang(command) {
|
|
23995
23995
|
const size = 150;
|
|
23996
23996
|
const buffer = Buffer.alloc(size);
|
|
23997
23997
|
let fd;
|
|
23998
23998
|
try {
|
|
23999
|
-
fd =
|
|
24000
|
-
|
|
24001
|
-
|
|
23999
|
+
fd = fs47.openSync(command, "r");
|
|
24000
|
+
fs47.readSync(fd, buffer, 0, size, 0);
|
|
24001
|
+
fs47.closeSync(fd);
|
|
24002
24002
|
} catch (e) {
|
|
24003
24003
|
}
|
|
24004
24004
|
return shebangCommand(buffer.toString());
|
|
@@ -24011,7 +24011,7 @@ var require_readShebang = __commonJS({
|
|
|
24011
24011
|
var require_parse2 = __commonJS({
|
|
24012
24012
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
|
|
24013
24013
|
"use strict";
|
|
24014
|
-
var
|
|
24014
|
+
var path67 = require("path");
|
|
24015
24015
|
var resolveCommand = require_resolveCommand();
|
|
24016
24016
|
var escape4 = require_escape();
|
|
24017
24017
|
var readShebang = require_readShebang();
|
|
@@ -24036,7 +24036,7 @@ var require_parse2 = __commonJS({
|
|
|
24036
24036
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
24037
24037
|
if (parsed.options.forceShell || needsShell) {
|
|
24038
24038
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
24039
|
-
parsed.command =
|
|
24039
|
+
parsed.command = path67.normalize(parsed.command);
|
|
24040
24040
|
parsed.command = escape4.command(parsed.command);
|
|
24041
24041
|
parsed.args = parsed.args.map((arg) => escape4.argument(arg, needsDoubleEscapeMetaChars));
|
|
24042
24042
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -24046,7 +24046,7 @@ var require_parse2 = __commonJS({
|
|
|
24046
24046
|
}
|
|
24047
24047
|
return parsed;
|
|
24048
24048
|
}
|
|
24049
|
-
function
|
|
24049
|
+
function parse4(command, args, options) {
|
|
24050
24050
|
if (args && !Array.isArray(args)) {
|
|
24051
24051
|
options = args;
|
|
24052
24052
|
args = null;
|
|
@@ -24065,7 +24065,7 @@ var require_parse2 = __commonJS({
|
|
|
24065
24065
|
};
|
|
24066
24066
|
return options.shell ? parsed : parseNonShell(parsed);
|
|
24067
24067
|
}
|
|
24068
|
-
module2.exports =
|
|
24068
|
+
module2.exports = parse4;
|
|
24069
24069
|
}
|
|
24070
24070
|
});
|
|
24071
24071
|
|
|
@@ -24124,16 +24124,16 @@ var require_cross_spawn = __commonJS({
|
|
|
24124
24124
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports2, module2) {
|
|
24125
24125
|
"use strict";
|
|
24126
24126
|
var cp = require("child_process");
|
|
24127
|
-
var
|
|
24127
|
+
var parse4 = require_parse2();
|
|
24128
24128
|
var enoent = require_enoent();
|
|
24129
24129
|
function spawn16(command, args, options) {
|
|
24130
|
-
const parsed =
|
|
24130
|
+
const parsed = parse4(command, args, options);
|
|
24131
24131
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
24132
24132
|
enoent.hookChildProcess(spawned, parsed);
|
|
24133
24133
|
return spawned;
|
|
24134
24134
|
}
|
|
24135
24135
|
function spawnSync(command, args, options) {
|
|
24136
|
-
const parsed =
|
|
24136
|
+
const parsed = parse4(command, args, options);
|
|
24137
24137
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
24138
24138
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
24139
24139
|
return result;
|
|
@@ -24141,7 +24141,7 @@ var require_cross_spawn = __commonJS({
|
|
|
24141
24141
|
module2.exports = spawn16;
|
|
24142
24142
|
module2.exports.spawn = spawn16;
|
|
24143
24143
|
module2.exports.sync = spawnSync;
|
|
24144
|
-
module2.exports._parse =
|
|
24144
|
+
module2.exports._parse = parse4;
|
|
24145
24145
|
module2.exports._enoent = enoent;
|
|
24146
24146
|
}
|
|
24147
24147
|
});
|
|
@@ -24157,7 +24157,7 @@ var require_content_type = __commonJS({
|
|
|
24157
24157
|
var QUOTE_REGEXP = /([\\"])/g;
|
|
24158
24158
|
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
24159
24159
|
exports2.format = format;
|
|
24160
|
-
exports2.parse =
|
|
24160
|
+
exports2.parse = parse4;
|
|
24161
24161
|
function format(obj) {
|
|
24162
24162
|
if (!obj || typeof obj !== "object") {
|
|
24163
24163
|
throw new TypeError("argument obj is required");
|
|
@@ -24181,7 +24181,7 @@ var require_content_type = __commonJS({
|
|
|
24181
24181
|
}
|
|
24182
24182
|
return string4;
|
|
24183
24183
|
}
|
|
24184
|
-
function
|
|
24184
|
+
function parse4(string4) {
|
|
24185
24185
|
if (!string4) {
|
|
24186
24186
|
throw new TypeError("argument string is required");
|
|
24187
24187
|
}
|
|
@@ -24258,9 +24258,9 @@ __export(server_exports, {
|
|
|
24258
24258
|
});
|
|
24259
24259
|
module.exports = __toCommonJS(server_exports);
|
|
24260
24260
|
var import_promises38 = __toESM(require("node:fs/promises"), 1);
|
|
24261
|
-
var
|
|
24261
|
+
var import_node_fs18 = require("node:fs");
|
|
24262
24262
|
var import_node_http = require("node:http");
|
|
24263
|
-
var
|
|
24263
|
+
var import_node_path67 = __toESM(require("node:path"), 1);
|
|
24264
24264
|
|
|
24265
24265
|
// ../../packages/core/dist/platform/http.js
|
|
24266
24266
|
var import_node_crypto = require("node:crypto");
|
|
@@ -24414,6 +24414,8 @@ function buildConnectOptions(options, env2 = process.env) {
|
|
|
24414
24414
|
}
|
|
24415
24415
|
|
|
24416
24416
|
// ../../packages/core/dist/platform/http.js
|
|
24417
|
+
var CONNECT_TIMEOUT_MS = 6e4;
|
|
24418
|
+
var FAMILY_ATTEMPT_MS = 1e3;
|
|
24417
24419
|
function tlsKey(tls2) {
|
|
24418
24420
|
const hash3 = (0, import_node_crypto.createHash)("sha256");
|
|
24419
24421
|
for (const part of [tls2.cert, tls2.key, tls2.pfx, ...tls2.ca ?? []]) {
|
|
@@ -24468,8 +24470,11 @@ var FetchHttpClient = class {
|
|
|
24468
24470
|
...tls2 !== void 0 ? buildConnectOptions(tls2) : { ca: buildConnectOptions({}).ca },
|
|
24469
24471
|
// Happy Eyeballs. Without it a host whose AAAA record is black-holed — ordinary on a
|
|
24470
24472
|
// corporate network with partial IPv6 — hangs instead of falling back to IPv4.
|
|
24471
|
-
autoSelectFamily: true
|
|
24472
|
-
|
|
24473
|
+
autoSelectFamily: true,
|
|
24474
|
+
autoSelectFamilyAttemptTimeout: FAMILY_ATTEMPT_MS,
|
|
24475
|
+
timeout: CONNECT_TIMEOUT_MS
|
|
24476
|
+
},
|
|
24477
|
+
proxyTls: { timeout: CONNECT_TIMEOUT_MS }
|
|
24473
24478
|
});
|
|
24474
24479
|
this.proxyAgents.set(key3, agent);
|
|
24475
24480
|
return agent;
|
|
@@ -24484,7 +24489,9 @@ var FetchHttpClient = class {
|
|
|
24484
24489
|
...buildConnectOptions(tls2),
|
|
24485
24490
|
// Happy Eyeballs, for the same reason as the proxy path: a black-holed AAAA record is a
|
|
24486
24491
|
// hang rather than an error, and every other client on the machine falls back.
|
|
24487
|
-
autoSelectFamily: true
|
|
24492
|
+
autoSelectFamily: true,
|
|
24493
|
+
autoSelectFamilyAttemptTimeout: FAMILY_ATTEMPT_MS,
|
|
24494
|
+
timeout: CONNECT_TIMEOUT_MS
|
|
24488
24495
|
}
|
|
24489
24496
|
});
|
|
24490
24497
|
this.agents.set(key3, agent);
|
|
@@ -25421,10 +25428,10 @@ function mergeDefs(...defs) {
|
|
|
25421
25428
|
function cloneDef(schema12) {
|
|
25422
25429
|
return mergeDefs(schema12._zod.def);
|
|
25423
25430
|
}
|
|
25424
|
-
function getElementAtPath(obj,
|
|
25425
|
-
if (!
|
|
25431
|
+
function getElementAtPath(obj, path67) {
|
|
25432
|
+
if (!path67)
|
|
25426
25433
|
return obj;
|
|
25427
|
-
return
|
|
25434
|
+
return path67.reduce((acc, key3) => acc?.[key3], obj);
|
|
25428
25435
|
}
|
|
25429
25436
|
function promiseAllObject(promisesObj) {
|
|
25430
25437
|
const keys = Object.keys(promisesObj);
|
|
@@ -25833,11 +25840,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
25833
25840
|
}
|
|
25834
25841
|
return false;
|
|
25835
25842
|
}
|
|
25836
|
-
function prefixIssues(
|
|
25843
|
+
function prefixIssues(path67, issues) {
|
|
25837
25844
|
return issues.map((iss) => {
|
|
25838
25845
|
var _a3;
|
|
25839
25846
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
25840
|
-
iss.path.unshift(
|
|
25847
|
+
iss.path.unshift(path67);
|
|
25841
25848
|
return iss;
|
|
25842
25849
|
});
|
|
25843
25850
|
}
|
|
@@ -25984,16 +25991,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
25984
25991
|
}
|
|
25985
25992
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
25986
25993
|
const fieldErrors = { _errors: [] };
|
|
25987
|
-
const processError = (error52,
|
|
25994
|
+
const processError = (error52, path67 = []) => {
|
|
25988
25995
|
for (const issue2 of error52.issues) {
|
|
25989
25996
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
25990
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
25997
|
+
issue2.errors.map((issues) => processError({ issues }, [...path67, ...issue2.path]));
|
|
25991
25998
|
} else if (issue2.code === "invalid_key") {
|
|
25992
|
-
processError({ issues: issue2.issues }, [...
|
|
25999
|
+
processError({ issues: issue2.issues }, [...path67, ...issue2.path]);
|
|
25993
26000
|
} else if (issue2.code === "invalid_element") {
|
|
25994
|
-
processError({ issues: issue2.issues }, [...
|
|
26001
|
+
processError({ issues: issue2.issues }, [...path67, ...issue2.path]);
|
|
25995
26002
|
} else {
|
|
25996
|
-
const fullpath = [...
|
|
26003
|
+
const fullpath = [...path67, ...issue2.path];
|
|
25997
26004
|
if (fullpath.length === 0) {
|
|
25998
26005
|
fieldErrors._errors.push(mapper(issue2));
|
|
25999
26006
|
} else {
|
|
@@ -26020,17 +26027,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
26020
26027
|
}
|
|
26021
26028
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
26022
26029
|
const result = { errors: [] };
|
|
26023
|
-
const processError = (error52,
|
|
26030
|
+
const processError = (error52, path67 = []) => {
|
|
26024
26031
|
var _a3, _b;
|
|
26025
26032
|
for (const issue2 of error52.issues) {
|
|
26026
26033
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
26027
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
26034
|
+
issue2.errors.map((issues) => processError({ issues }, [...path67, ...issue2.path]));
|
|
26028
26035
|
} else if (issue2.code === "invalid_key") {
|
|
26029
|
-
processError({ issues: issue2.issues }, [...
|
|
26036
|
+
processError({ issues: issue2.issues }, [...path67, ...issue2.path]);
|
|
26030
26037
|
} else if (issue2.code === "invalid_element") {
|
|
26031
|
-
processError({ issues: issue2.issues }, [...
|
|
26038
|
+
processError({ issues: issue2.issues }, [...path67, ...issue2.path]);
|
|
26032
26039
|
} else {
|
|
26033
|
-
const fullpath = [...
|
|
26040
|
+
const fullpath = [...path67, ...issue2.path];
|
|
26034
26041
|
if (fullpath.length === 0) {
|
|
26035
26042
|
result.errors.push(mapper(issue2));
|
|
26036
26043
|
continue;
|
|
@@ -26062,8 +26069,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
26062
26069
|
}
|
|
26063
26070
|
function toDotPath(_path) {
|
|
26064
26071
|
const segs = [];
|
|
26065
|
-
const
|
|
26066
|
-
for (const seg of
|
|
26072
|
+
const path67 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
26073
|
+
for (const seg of path67) {
|
|
26067
26074
|
if (typeof seg === "number")
|
|
26068
26075
|
segs.push(`[${seg}]`);
|
|
26069
26076
|
else if (typeof seg === "symbol")
|
|
@@ -38755,13 +38762,13 @@ function resolveRef(ref, ctx) {
|
|
|
38755
38762
|
if (!ref.startsWith("#")) {
|
|
38756
38763
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
38757
38764
|
}
|
|
38758
|
-
const
|
|
38759
|
-
if (
|
|
38765
|
+
const path67 = ref.slice(1).split("/").filter(Boolean);
|
|
38766
|
+
if (path67.length === 0) {
|
|
38760
38767
|
return ctx.rootSchema;
|
|
38761
38768
|
}
|
|
38762
38769
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
38763
|
-
if (
|
|
38764
|
-
const key3 =
|
|
38770
|
+
if (path67[0] === defsKey) {
|
|
38771
|
+
const key3 = path67[1];
|
|
38765
38772
|
if (!key3 || !ctx.defs[key3]) {
|
|
38766
38773
|
throw new Error(`Reference not found: ${ref}`);
|
|
38767
38774
|
}
|
|
@@ -39358,6 +39365,7 @@ var strategyNodeSchema = external_exports.object({
|
|
|
39358
39365
|
var strategyGroupSchema = external_exports.object({
|
|
39359
39366
|
id: external_exports.string().min(1).max(40),
|
|
39360
39367
|
label: external_exports.string().max(80).optional(),
|
|
39368
|
+
kind: external_exports.enum(["parallel", "together"]).optional(),
|
|
39361
39369
|
x: external_exports.number().finite(),
|
|
39362
39370
|
y: external_exports.number().finite(),
|
|
39363
39371
|
w: external_exports.number().finite().min(60),
|
|
@@ -39365,7 +39373,9 @@ var strategyGroupSchema = external_exports.object({
|
|
|
39365
39373
|
});
|
|
39366
39374
|
var strategyEdgeSchema = external_exports.object({
|
|
39367
39375
|
id: external_exports.string().min(1).max(40),
|
|
39376
|
+
/** A step's id, or a box's (`StrategyGroup.id`): from a box means "once every step inside has answered". */
|
|
39368
39377
|
from: external_exports.string().min(1).max(40),
|
|
39378
|
+
/** A step's id, or a box's: to a box means every step inside starts from what arrives. */
|
|
39369
39379
|
to: external_exports.string().min(1).max(40),
|
|
39370
39380
|
/** Back and forth between the two: `from` works, `to` checks, and back to `from` until `until` or `maxRounds`. */
|
|
39371
39381
|
twoWay: external_exports.boolean().optional(),
|
|
@@ -39400,6 +39410,21 @@ var DEFAULT_LOOP_ROUNDS = 10;
|
|
|
39400
39410
|
function roundsOf(edge) {
|
|
39401
39411
|
return edge.maxRounds ?? DEFAULT_LOOP_ROUNDS;
|
|
39402
39412
|
}
|
|
39413
|
+
function groupKind(group) {
|
|
39414
|
+
return group.kind ?? "parallel";
|
|
39415
|
+
}
|
|
39416
|
+
function groupName(group) {
|
|
39417
|
+
return group.label?.trim() || (groupKind(group) === "parallel" ? "Parallel box" : "Box");
|
|
39418
|
+
}
|
|
39419
|
+
function groupMembers(strategy, groupId) {
|
|
39420
|
+
return strategy.nodes.filter((node) => node.group === groupId);
|
|
39421
|
+
}
|
|
39422
|
+
function endpointNodes(strategy, id) {
|
|
39423
|
+
const node = strategy.nodes.find((n) => n.id === id);
|
|
39424
|
+
if (node !== void 0)
|
|
39425
|
+
return [node];
|
|
39426
|
+
return (strategy.groups ?? []).some((group) => group.id === id) ? groupMembers(strategy, id) : [];
|
|
39427
|
+
}
|
|
39403
39428
|
function strategyProblems(strategy, knownRoles2, assigned) {
|
|
39404
39429
|
const problems = [];
|
|
39405
39430
|
if (strategy.nodes.length === 0)
|
|
@@ -39414,12 +39439,21 @@ function strategyProblems(strategy, knownRoles2, assigned) {
|
|
|
39414
39439
|
else if (!assigned.has(node.role))
|
|
39415
39440
|
problems.push(`Nobody is assigned to ${node.role}: give it a model in Settings \u2192 Agents.`);
|
|
39416
39441
|
}
|
|
39442
|
+
const groups = new Map((strategy.groups ?? []).map((group) => [group.id, group]));
|
|
39417
39443
|
const pairs = /* @__PURE__ */ new Set();
|
|
39418
39444
|
for (const edge of strategy.edges) {
|
|
39419
|
-
if (!ids.has(edge.from) || !ids.has(edge.to))
|
|
39445
|
+
if (!ids.has(edge.from) && !groups.has(edge.from) || !ids.has(edge.to) && !groups.has(edge.to))
|
|
39420
39446
|
problems.push("A connector points at a step that is not there.");
|
|
39421
39447
|
if (edge.from === edge.to)
|
|
39422
39448
|
problems.push("A connector goes from a step to itself.");
|
|
39449
|
+
if (edge.twoWay === true && (groups.has(edge.from) || groups.has(edge.to))) {
|
|
39450
|
+
problems.push("A back-and-forth joins two steps, not a box: connect it to one step inside the box.");
|
|
39451
|
+
}
|
|
39452
|
+
const fromNode = strategy.nodes.find((n) => n.id === edge.from);
|
|
39453
|
+
const toNode = strategy.nodes.find((n) => n.id === edge.to);
|
|
39454
|
+
if (groups.has(edge.to) && fromNode?.group === edge.to || groups.has(edge.from) && toNode?.group === edge.from) {
|
|
39455
|
+
problems.push("A connector joins a box to a step inside it; connect the steps inside to each other instead.");
|
|
39456
|
+
}
|
|
39423
39457
|
const pair = [edge.from, edge.to].sort().join("|");
|
|
39424
39458
|
if (edge.twoWay === true && pairs.has(pair))
|
|
39425
39459
|
problems.push("Two back-and-forth connectors join the same two steps.");
|
|
@@ -39427,34 +39461,74 @@ function strategyProblems(strategy, knownRoles2, assigned) {
|
|
|
39427
39461
|
pairs.add(pair);
|
|
39428
39462
|
}
|
|
39429
39463
|
for (const group of strategy.groups ?? []) {
|
|
39430
|
-
const inside = strategy
|
|
39464
|
+
const inside = groupMembers(strategy, group.id);
|
|
39465
|
+
if (inside.length === 0 && strategy.edges.some((edge) => edge.from === group.id || edge.to === group.id)) {
|
|
39466
|
+
problems.push(`${groupName(group)} is connected but has no steps inside.`);
|
|
39467
|
+
}
|
|
39468
|
+
if (groupKind(group) !== "parallel")
|
|
39469
|
+
continue;
|
|
39431
39470
|
const roles = inside.map((node) => node.role);
|
|
39432
39471
|
if (new Set(roles).size !== roles.length)
|
|
39433
|
-
problems.push(`${group
|
|
39472
|
+
problems.push(`${groupName(group)} holds one role twice; one specialist answers one question at a time, so they would not run in parallel.`);
|
|
39434
39473
|
}
|
|
39435
39474
|
return [...new Set(problems)];
|
|
39436
39475
|
}
|
|
39437
39476
|
function strategyOrder(strategy) {
|
|
39438
|
-
const
|
|
39439
|
-
const
|
|
39440
|
-
|
|
39441
|
-
|
|
39477
|
+
const groups = new Set((strategy.groups ?? []).map((group) => group.id));
|
|
39478
|
+
const unitOf = (id) => {
|
|
39479
|
+
if (groups.has(id))
|
|
39480
|
+
return id;
|
|
39481
|
+
const node = strategy.nodes.find((n) => n.id === id);
|
|
39482
|
+
return node?.group !== void 0 && groups.has(node.group) ? node.group : id;
|
|
39483
|
+
};
|
|
39484
|
+
const position = (unit) => {
|
|
39485
|
+
const group = strategy.groups?.find((g) => g.id === unit);
|
|
39486
|
+
if (group !== void 0)
|
|
39487
|
+
return group;
|
|
39488
|
+
return strategy.nodes.find((n) => n.id === unit) ?? { x: 0, y: 0 };
|
|
39489
|
+
};
|
|
39490
|
+
const canvasUnits = (a, b) => position(a).x - position(b).x || position(a).y - position(b).y;
|
|
39491
|
+
const units = [...new Set(strategy.nodes.map((node) => unitOf(node.id)))];
|
|
39492
|
+
const between = strategy.edges.map((edge) => ({ from: unitOf(edge.from), to: unitOf(edge.to) })).filter((edge) => edge.from !== edge.to);
|
|
39493
|
+
const order2 = orderBy(units, between, canvasUnits);
|
|
39442
39494
|
const canvas = (a, b) => a.x - b.x || a.y - b.y;
|
|
39443
|
-
const
|
|
39495
|
+
const out = [];
|
|
39496
|
+
for (const unit of order2) {
|
|
39497
|
+
if (!groups.has(unit)) {
|
|
39498
|
+
const node = strategy.nodes.find((n) => n.id === unit);
|
|
39499
|
+
if (node !== void 0)
|
|
39500
|
+
out.push(node);
|
|
39501
|
+
continue;
|
|
39502
|
+
}
|
|
39503
|
+
const inside = groupMembers(strategy, unit);
|
|
39504
|
+
const ids = new Set(inside.map((node) => node.id));
|
|
39505
|
+
const inner = strategy.edges.filter((edge) => ids.has(edge.from) && ids.has(edge.to));
|
|
39506
|
+
const byId = new Map(inside.map((node) => [node.id, node]));
|
|
39507
|
+
for (const id of orderBy(inside.map((node) => node.id), inner, (a, b) => canvas(byId.get(a), byId.get(b))))
|
|
39508
|
+
out.push(byId.get(id));
|
|
39509
|
+
}
|
|
39510
|
+
return out;
|
|
39511
|
+
}
|
|
39512
|
+
function orderBy(items, edges, compare) {
|
|
39513
|
+
const incoming = new Map(items.map((item2) => [item2, 0]));
|
|
39514
|
+
for (const edge of edges)
|
|
39515
|
+
if (incoming.has(edge.to) && incoming.has(edge.from))
|
|
39516
|
+
incoming.set(edge.to, (incoming.get(edge.to) ?? 0) + 1);
|
|
39517
|
+
const queue = items.filter((item2) => (incoming.get(item2) ?? 0) === 0).sort(compare);
|
|
39444
39518
|
const seen = /* @__PURE__ */ new Set();
|
|
39445
39519
|
const out = [];
|
|
39446
39520
|
while (queue.length > 0) {
|
|
39447
|
-
const
|
|
39448
|
-
if (seen.has(
|
|
39521
|
+
const item2 = queue.shift();
|
|
39522
|
+
if (seen.has(item2))
|
|
39449
39523
|
continue;
|
|
39450
|
-
seen.add(
|
|
39451
|
-
out.push(
|
|
39452
|
-
const next =
|
|
39524
|
+
seen.add(item2);
|
|
39525
|
+
out.push(item2);
|
|
39526
|
+
const next = [...new Set(edges.filter((edge) => edge.from === item2 && incoming.has(edge.to) && !seen.has(edge.to)).map((edge) => edge.to))].sort(compare);
|
|
39453
39527
|
queue.push(...next);
|
|
39454
39528
|
}
|
|
39455
|
-
for (const
|
|
39456
|
-
if (!seen.has(
|
|
39457
|
-
out.push(
|
|
39529
|
+
for (const item2 of [...items].sort(compare))
|
|
39530
|
+
if (!seen.has(item2))
|
|
39531
|
+
out.push(item2);
|
|
39458
39532
|
return out;
|
|
39459
39533
|
}
|
|
39460
39534
|
function firstLine(text2) {
|
|
@@ -39464,14 +39538,38 @@ function firstLine(text2) {
|
|
|
39464
39538
|
function describeStrategy(strategy, roleName) {
|
|
39465
39539
|
const order2 = strategyOrder(strategy);
|
|
39466
39540
|
const number5 = new Map(order2.map((node, i) => [node.id, i + 1]));
|
|
39541
|
+
const groups = strategy.groups ?? [];
|
|
39467
39542
|
const label = (id) => {
|
|
39468
39543
|
const node = strategy.nodes.find((n) => n.id === id);
|
|
39469
|
-
|
|
39470
|
-
|
|
39544
|
+
if (node !== void 0)
|
|
39545
|
+
return `${roleName(node.role)} (step ${String(number5.get(id) ?? "?")})`;
|
|
39546
|
+
const group = groups.find((g) => g.id === id);
|
|
39547
|
+
if (group === void 0)
|
|
39548
|
+
return id;
|
|
39549
|
+
const inside = groupMembers(strategy, id).map((member) => number5.get(member.id)).filter((n) => n !== void 0).sort((a, b) => a - b);
|
|
39550
|
+
return `the box "${groupName(group)}" (step${inside.length === 1 ? "" : "s"} ${inside.join(", ")})`;
|
|
39551
|
+
};
|
|
39552
|
+
const onward = (edge) => `${label(edge.to)}${edge.contract !== void 0 && edge.contract.trim().length > 0 ? ` (passing on: ${firstLine(edge.contract)})` : ""}${requiredOf(edge).length > 0 && !groups.some((g) => g.id === edge.from) ? ` [required: ${requiredOf(edge).join(", ")}]` : ""}`;
|
|
39471
39553
|
const lines2 = [`## Strategy: ${strategy.name}`, "", "The user drew how this work must be done. Steps, each done by consulting that role with ask_agent:"];
|
|
39554
|
+
const announced = /* @__PURE__ */ new Set();
|
|
39472
39555
|
for (const node of order2) {
|
|
39473
|
-
const
|
|
39474
|
-
|
|
39556
|
+
const group = node.group === void 0 ? void 0 : groups.find((g) => g.id === node.group);
|
|
39557
|
+
if (group !== void 0 && !announced.has(group.id)) {
|
|
39558
|
+
announced.add(group.id);
|
|
39559
|
+
const into = strategy.edges.filter((edge) => edge.to === group.id).map((edge) => label(edge.from));
|
|
39560
|
+
lines2.push(`${label(group.id)[0].toUpperCase()}${label(group.id).slice(1)} - ${groupKind(group) === "parallel" ? "consulted together, in ONE ask_agents call" : "done as a group, in the order below"}${into.length > 0 ? `, after ${into.join(" and ")}` : ""}:`);
|
|
39561
|
+
}
|
|
39562
|
+
const next = strategy.edges.filter((edge) => edge.from === node.id && edge.twoWay !== true).map(onward);
|
|
39563
|
+
lines2.push(`${group !== void 0 ? " " : ""}${String(number5.get(node.id))}. ${roleName(node.role)}${node.readOnly === true ? " - read-only: may not change anything" : ""}${node.instructions !== void 0 && node.instructions.trim().length > 0 ? ` - the user's instructions for it: "${firstLine(node.instructions)}"` : " - what it does here is yours to plan"}` + (next.length > 0 ? `; then ${next.join(" and ")}` : ""));
|
|
39564
|
+
if (group !== void 0) {
|
|
39565
|
+
const members = groupMembers(strategy, group.id);
|
|
39566
|
+
const last = order2.filter((n) => members.some((m) => m.id === n.id)).at(-1);
|
|
39567
|
+
if (last?.id === node.id) {
|
|
39568
|
+
const after = strategy.edges.filter((edge) => edge.from === group.id).map(onward);
|
|
39569
|
+
if (after.length > 0)
|
|
39570
|
+
lines2.push(` When every step in ${label(group.id)} has answered: then ${after.join(" and ")}.`);
|
|
39571
|
+
}
|
|
39572
|
+
}
|
|
39475
39573
|
}
|
|
39476
39574
|
const loops = strategy.edges.filter((edge) => edge.twoWay === true);
|
|
39477
39575
|
if (loops.length > 0) {
|
|
@@ -39481,11 +39579,15 @@ function describeStrategy(strategy, roleName) {
|
|
|
39481
39579
|
lines2.push(`- ${label(edge.from)} and ${judge}: after ${label(edge.from)}, ${judge} checks; if not done, back to ${label(edge.from)}. ` + (edge.until !== void 0 && edge.until.trim().length > 0 ? `Repeat until: "${edge.until.trim()}" (judged by ${judge}), ` : "Repeat ") + `at most ${String(roundsOf(edge))} round${roundsOf(edge) === 1 ? "" : "s"}.${edge.label !== void 0 ? ` (${edge.label})` : ""}` + (edge.contract !== void 0 && edge.contract.trim().length > 0 ? ` Each round ${label(edge.from)} passes on: ${firstLine(edge.contract)}.` : "") + (requiredOf(edge).length > 0 ? ` Required in every hand-over: ${requiredOf(edge).join(", ")}.` : ""));
|
|
39482
39580
|
}
|
|
39483
39581
|
}
|
|
39484
|
-
const boxes =
|
|
39485
|
-
|
|
39582
|
+
const boxes = groups.map((group) => ({ group, inside: order2.filter((node) => node.group === group.id) })).filter((box) => box.inside.length > 1);
|
|
39583
|
+
const parallel = boxes.filter((box) => groupKind(box.group) === "parallel");
|
|
39584
|
+
if (parallel.length > 0) {
|
|
39486
39585
|
lines2.push("", "In parallel (consult these together in ONE ask_agents call, and continue when all have answered):");
|
|
39487
|
-
for (const box of
|
|
39488
|
-
lines2.push(`- ${box.group
|
|
39586
|
+
for (const box of parallel)
|
|
39587
|
+
lines2.push(`- ${groupName(box.group)}: ${box.inside.map((node) => label(node.id)).join(", ")}`);
|
|
39588
|
+
}
|
|
39589
|
+
if (boxes.length > 0) {
|
|
39590
|
+
lines2.push("", "A connector leaving a box is followed only once every step inside it has answered. A connector into a box gives every step inside what arrives along it.");
|
|
39489
39591
|
}
|
|
39490
39592
|
lines2.push("", "How to follow it:", "- Before doing anything else in a task, propose a plan with update_plan that carries out every step above in order, naming the role for each step and writing each back-and-forth as one step with its condition and its maximum rounds. Then follow the plan.", "- Give each specialist what it needs from the earlier steps: it does not see this conversation, only what you send it. A step's own instructions from the user reach it with every question; plan the steps that have none.", "- Connectors with no contract: before starting, propose what should pass along them with set_strategy_contracts (the user approves it). Light Code checks every required item after each answer, asks the specialist again for what is missing, and tells you if it is still missing - pass on what arrived, and say what did not.", "- In a back-and-forth, Light Code counts the rounds and tells you after each answer where the loop stands; it refuses a round past the maximum. If the maximum is reached without the condition, stop and tell the user what is still open rather than working around it.", "- A question from the user that is not part of the strategy is answered normally.");
|
|
39491
39593
|
return lines2.join("\n");
|
|
@@ -39525,24 +39627,27 @@ function beforeConsult(strategy, progress, lastRole, role, roleName) {
|
|
|
39525
39627
|
for (const edge of strategy.edges) {
|
|
39526
39628
|
const items = requiredOf(edge);
|
|
39527
39629
|
const from = strategy.nodes.find((n) => n.id === edge.from);
|
|
39528
|
-
|
|
39529
|
-
if (items.length === 0 || from === void 0 || to === void 0 || role !== from.role)
|
|
39630
|
+
if (items.length === 0 || from === void 0 || endpointNodes(strategy, edge.to).length === 0 || role !== from.role)
|
|
39530
39631
|
continue;
|
|
39531
|
-
notes.push(`Required in your answer for ${
|
|
39632
|
+
notes.push(`Required in your answer for ${targetName(strategy, edge.to, roleName)}, each on a line of its own starting with its name and a colon:
|
|
39532
39633
|
` + items.map((item2) => `${item2}: ...`).join("\n") + "\nLight Code checks these and will ask you again for any that are missing.");
|
|
39533
39634
|
}
|
|
39635
|
+
const endName = (id) => targetName(strategy, id, roleName);
|
|
39534
39636
|
for (const edge of strategy.edges) {
|
|
39535
|
-
const
|
|
39637
|
+
const fromBox = strategy.groups?.some((g) => g.id === edge.from) === true;
|
|
39638
|
+
const items = fromBox ? requiredOf(edge) : [];
|
|
39639
|
+
const contract = [edge.contract?.trim() ?? "", items.length > 0 ? `each of ${items.join(", ")}` : ""].filter((part) => part.length > 0).join("; ");
|
|
39536
39640
|
if (contract.length === 0)
|
|
39537
39641
|
continue;
|
|
39538
|
-
const from = strategy
|
|
39539
|
-
const to = strategy
|
|
39540
|
-
if (from ===
|
|
39642
|
+
const from = endpointNodes(strategy, edge.from);
|
|
39643
|
+
const to = endpointNodes(strategy, edge.to);
|
|
39644
|
+
if (from.length === 0 || to.length === 0)
|
|
39541
39645
|
continue;
|
|
39542
|
-
if (role ===
|
|
39543
|
-
notes.push(`Your answer is passed on to ${
|
|
39544
|
-
|
|
39545
|
-
|
|
39646
|
+
if (from.some((n) => n.role === role)) {
|
|
39647
|
+
notes.push(fromBox ? `Your answer, with the others from ${endName(edge.from)}, is passed on to ${endName(edge.to)}. As agreed, together they must contain: ${contract}. Give your part of it.` : `Your answer is passed on to ${endName(edge.to)}. As agreed, it must contain: ${contract}`);
|
|
39648
|
+
}
|
|
39649
|
+
if (to.some((n) => n.role === role))
|
|
39650
|
+
notes.push(`From ${endName(edge.from)} you are given, as agreed: ${contract}. If any of it is missing from the question, say exactly what is missing.`);
|
|
39546
39651
|
}
|
|
39547
39652
|
const instructed = nodes.map((node) => node.instructions?.trim() ?? "").filter((text2) => text2.length > 0);
|
|
39548
39653
|
if (instructed.length > 0)
|
|
@@ -39620,13 +39725,25 @@ function contractCheck(strategy, role, answer) {
|
|
|
39620
39725
|
for (const edge of strategy.edges) {
|
|
39621
39726
|
const items = requiredOf(edge);
|
|
39622
39727
|
const from = strategy.nodes.find((n) => n.id === edge.from);
|
|
39623
|
-
|
|
39624
|
-
|
|
39728
|
+
if (items.length === 0 || from === void 0 || from.role !== role)
|
|
39729
|
+
continue;
|
|
39730
|
+
const toNode = strategy.nodes.find((n) => n.id === edge.to);
|
|
39731
|
+
const toGroup = strategy.groups?.find((g) => g.id === edge.to);
|
|
39732
|
+
if (toNode === void 0 && toGroup === void 0)
|
|
39625
39733
|
continue;
|
|
39626
|
-
out.push({ edgeId: edge.id, to:
|
|
39734
|
+
out.push({ edgeId: edge.id, to: toNode?.role ?? groupName(toGroup), required: items, missing: missingItems(answer, items) });
|
|
39627
39735
|
}
|
|
39628
39736
|
return out;
|
|
39629
39737
|
}
|
|
39738
|
+
function targetName(strategy, id, roleName) {
|
|
39739
|
+
const node = strategy.nodes.find((n) => n.id === id);
|
|
39740
|
+
if (node !== void 0)
|
|
39741
|
+
return roleName(node.role);
|
|
39742
|
+
const group = strategy.groups?.find((g) => g.id === id);
|
|
39743
|
+
if (group === void 0)
|
|
39744
|
+
return id;
|
|
39745
|
+
return `the box "${groupName(group)}" (${groupMembers(strategy, id).map((n) => roleName(n.role)).join(", ")})`;
|
|
39746
|
+
}
|
|
39630
39747
|
function askForMissing(missing, previous) {
|
|
39631
39748
|
return [
|
|
39632
39749
|
`Your answer is missing what the strategy requires: ${missing.join(", ")}.`,
|
|
@@ -41469,13 +41586,17 @@ function compareMentionCandidates(query) {
|
|
|
41469
41586
|
return a.localeCompare(b);
|
|
41470
41587
|
};
|
|
41471
41588
|
}
|
|
41589
|
+
function withoutTrailingSlash(candidate) {
|
|
41590
|
+
return candidate.endsWith("/") ? candidate.slice(0, -1) : candidate;
|
|
41591
|
+
}
|
|
41472
41592
|
function fileNameOf(candidate) {
|
|
41473
|
-
const
|
|
41474
|
-
|
|
41593
|
+
const trimmed = withoutTrailingSlash(candidate);
|
|
41594
|
+
const slash = trimmed.lastIndexOf("/");
|
|
41595
|
+
return slash < 0 ? trimmed : trimmed.slice(slash + 1);
|
|
41475
41596
|
}
|
|
41476
41597
|
function depthOf(candidate) {
|
|
41477
41598
|
let depth = 0;
|
|
41478
|
-
for (const character of candidate)
|
|
41599
|
+
for (const character of withoutTrailingSlash(candidate))
|
|
41479
41600
|
if (character === "/")
|
|
41480
41601
|
depth += 1;
|
|
41481
41602
|
return depth;
|
|
@@ -41492,6 +41613,13 @@ function rank(candidate, needle) {
|
|
|
41492
41613
|
return 2;
|
|
41493
41614
|
if (name.includes(needle))
|
|
41494
41615
|
return 3;
|
|
41616
|
+
const folders = withoutTrailingSlash(candidate).toLowerCase().split("/").slice(0, -1);
|
|
41617
|
+
if (folders.some((folder) => folder === needle))
|
|
41618
|
+
return 3.25;
|
|
41619
|
+
if (folders.some((folder) => folder.startsWith(needle)))
|
|
41620
|
+
return 3.5;
|
|
41621
|
+
if (folders.some((folder) => folder.includes(needle)))
|
|
41622
|
+
return 3.75;
|
|
41495
41623
|
return 4;
|
|
41496
41624
|
}
|
|
41497
41625
|
function matchesMentionQuery(query) {
|
|
@@ -41524,8 +41652,28 @@ function mentionSegment(query) {
|
|
|
41524
41652
|
|
|
41525
41653
|
// ../../packages/core/dist/context/mentionSearch.js
|
|
41526
41654
|
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
41655
|
+
var FOLDER_SCAN_LIMIT = 300;
|
|
41656
|
+
var FOLDERS_OPENED = 2;
|
|
41657
|
+
var FILES_PER_FOLDER = 40;
|
|
41527
41658
|
async function searchMentions(find2, workspaceRoot, query, excludeFolders, scanLimit, resultLimit, otherRoot) {
|
|
41528
41659
|
const segment = mentionSegment(query);
|
|
41660
|
+
const base = otherRoot ?? workspaceRoot;
|
|
41661
|
+
const relative = (absolute) => import_node_path2.default.relative(workspaceRoot, absolute).split(import_node_path2.default.sep).join("/");
|
|
41662
|
+
const typedFolder = folderPart(query);
|
|
41663
|
+
if (typedFolder !== void 0) {
|
|
41664
|
+
const inside = import_node_path2.default.resolve(base, typedFolder);
|
|
41665
|
+
const within = import_node_path2.default.relative(base, inside);
|
|
41666
|
+
if (within.length > 0 && !within.startsWith("..") && !import_node_path2.default.isAbsolute(within)) {
|
|
41667
|
+
const [files2, folders2] = await Promise.all([
|
|
41668
|
+
find2(segment, scanLimit, excludeFolders, void 0, void 0, inside).catch(() => []),
|
|
41669
|
+
find2(segment, FOLDER_SCAN_LIMIT, excludeFolders, "folders", void 0, inside).catch(() => [])
|
|
41670
|
+
]);
|
|
41671
|
+
if (files2.length > 0 || folders2.length > 0) {
|
|
41672
|
+
const insideQuery = `${typedFolder.replace(/\\/g, "/").replace(/\/+$/, "")}/${segment}`;
|
|
41673
|
+
return rank2([...folders2.map((f) => `${relative(f)}/`), ...files2.map(relative)], insideQuery, resultLimit);
|
|
41674
|
+
}
|
|
41675
|
+
}
|
|
41676
|
+
}
|
|
41529
41677
|
let found2 = await find2(segment, scanLimit, excludeFolders, void 0, void 0, otherRoot);
|
|
41530
41678
|
if (found2.length >= scanLimit && segment.length > 0) {
|
|
41531
41679
|
const leading = [];
|
|
@@ -41534,7 +41682,32 @@ async function searchMentions(find2, workspaceRoot, query, excludeFolders, scanL
|
|
|
41534
41682
|
}
|
|
41535
41683
|
found2 = [.../* @__PURE__ */ new Set([...leading, ...found2])];
|
|
41536
41684
|
}
|
|
41537
|
-
|
|
41685
|
+
const files = found2.map(relative);
|
|
41686
|
+
if (segment.length === 0)
|
|
41687
|
+
return rank2(files, query, resultLimit);
|
|
41688
|
+
const needle = segment.toLowerCase();
|
|
41689
|
+
const folderList = await find2(segment, FOLDER_SCAN_LIMIT, excludeFolders, "folders", void 0, otherRoot).catch(() => []);
|
|
41690
|
+
const folders = new Set(folderList.map((f) => `${relative(f)}/`));
|
|
41691
|
+
for (const file2 of files) {
|
|
41692
|
+
const parts = file2.split("/");
|
|
41693
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
41694
|
+
if ((parts[i] ?? "").toLowerCase().includes(needle))
|
|
41695
|
+
folders.add(`${parts.slice(0, i + 1).join("/")}/`);
|
|
41696
|
+
}
|
|
41697
|
+
}
|
|
41698
|
+
const best = [...folders].filter(matchesMentionQuery(query)).sort(compareMentionCandidates(query)).slice(0, FOLDERS_OPENED);
|
|
41699
|
+
const opened = await Promise.all(best.map((folder) => find2("", FILES_PER_FOLDER, excludeFolders, void 0, void 0, import_node_path2.default.join(workspaceRoot, folder)).catch(() => [])));
|
|
41700
|
+
return rank2([...folders, ...files, ...opened.flat().map(relative)], query, resultLimit);
|
|
41701
|
+
}
|
|
41702
|
+
function rank2(candidates, query, limit) {
|
|
41703
|
+
return [...new Set(candidates)].filter((c2) => c2 !== "/" && !c2.startsWith("../")).filter(matchesMentionQuery(query)).sort(compareMentionCandidates(query)).slice(0, limit);
|
|
41704
|
+
}
|
|
41705
|
+
function folderPart(query) {
|
|
41706
|
+
const trimmed = query.trim();
|
|
41707
|
+
const separator = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
|
|
41708
|
+
if (separator <= 0)
|
|
41709
|
+
return void 0;
|
|
41710
|
+
return trimmed.slice(0, separator);
|
|
41538
41711
|
}
|
|
41539
41712
|
|
|
41540
41713
|
// ../../packages/core/dist/python/jupyter.js
|
|
@@ -42774,16 +42947,26 @@ function describeTlsError(error51) {
|
|
|
42774
42947
|
if (/EPROTO|SSL routines|SSL alert|handshake|TLSV1|BAD_CERTIFICATE/i.test(combined)) {
|
|
42775
42948
|
return "the TLS handshake failed. The gateway may require a client certificate, or may have rejected the one presented.";
|
|
42776
42949
|
}
|
|
42950
|
+
const code = transportCode(combined);
|
|
42951
|
+
if (/UND_ERR_CONNECT_TIMEOUT|Connect Timeout/i.test(combined)) {
|
|
42952
|
+
return `the connection could not be made in time (${code ?? "UND_ERR_CONNECT_TIMEOUT"}). The network may be slow or the host unreachable.`;
|
|
42953
|
+
}
|
|
42777
42954
|
if (/ECONNREFUSED/i.test(combined))
|
|
42778
|
-
return "the connection was refused.";
|
|
42955
|
+
return "the connection was refused (ECONNREFUSED).";
|
|
42779
42956
|
if (/ENOTFOUND|EAI_AGAIN/i.test(combined))
|
|
42780
|
-
return
|
|
42957
|
+
return `the host could not be resolved (${code ?? "ENOTFOUND"}). Check the address, or the network's name lookup.`;
|
|
42781
42958
|
if (/ECONNRESET|socket hang up/i.test(combined)) {
|
|
42782
|
-
return
|
|
42959
|
+
return `the connection was closed before an answer came (${code ?? "ECONNRESET"}). On an unreliable network this passes on a second try; if it happens every time, the gateway may want a client identity that was not presented.`;
|
|
42783
42960
|
}
|
|
42961
|
+
if (/ETIMEDOUT/i.test(combined))
|
|
42962
|
+
return "the connection timed out (ETIMEDOUT). The network may be slow or the host unreachable.";
|
|
42784
42963
|
const deepest = chain[chain.length - 1];
|
|
42785
42964
|
const deepestMessage = deepest instanceof Error ? deepest.message : String(deepest);
|
|
42786
|
-
|
|
42965
|
+
const chosen = message6 === "fetch failed" && deepestMessage !== message6 ? deepestMessage : message6;
|
|
42966
|
+
return code !== void 0 && !chosen.includes(code) ? `${chosen} (${code})` : chosen;
|
|
42967
|
+
}
|
|
42968
|
+
function transportCode(combined) {
|
|
42969
|
+
return /\b(UND_ERR_[A-Z_]+|E(?:CONNRESET|CONNREFUSED|CONNABORTED|TIMEDOUT|NOTFOUND|PIPE|HOSTUNREACH|NETUNREACH|AI_AGAIN))\b/.exec(combined)?.[1];
|
|
42787
42970
|
}
|
|
42788
42971
|
|
|
42789
42972
|
// ../../packages/core/dist/providers/auth/certs.js
|
|
@@ -43429,8 +43612,8 @@ function restoreArguments(argumentsJson, reshaped) {
|
|
|
43429
43612
|
restoreAt(args, entry.path, entry.kind);
|
|
43430
43613
|
return JSON.stringify(args);
|
|
43431
43614
|
}
|
|
43432
|
-
function restoreAt(value,
|
|
43433
|
-
if (
|
|
43615
|
+
function restoreAt(value, path67, kind) {
|
|
43616
|
+
if (path67.length === 0) {
|
|
43434
43617
|
if (typeof value !== "string")
|
|
43435
43618
|
return value;
|
|
43436
43619
|
if (kind === "number") {
|
|
@@ -43443,7 +43626,7 @@ function restoreAt(value, path66, kind) {
|
|
|
43443
43626
|
return value;
|
|
43444
43627
|
}
|
|
43445
43628
|
}
|
|
43446
|
-
const [head, ...rest] =
|
|
43629
|
+
const [head, ...rest] = path67;
|
|
43447
43630
|
if (head === "[]") {
|
|
43448
43631
|
if (Array.isArray(value))
|
|
43449
43632
|
for (let i = 0; i < value.length; i += 1)
|
|
@@ -43456,16 +43639,16 @@ function restoreAt(value, path66, kind) {
|
|
|
43456
43639
|
}
|
|
43457
43640
|
var SCALARS = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean"]);
|
|
43458
43641
|
var MAX_DEPTH = 12;
|
|
43459
|
-
function convert(schema12, root,
|
|
43642
|
+
function convert(schema12, root, path67, found2, depth, isRoot = false) {
|
|
43460
43643
|
if (!isRecord2(schema12))
|
|
43461
43644
|
return { type: "string" };
|
|
43462
43645
|
if (depth > MAX_DEPTH)
|
|
43463
|
-
return asJsonString(schema12,
|
|
43646
|
+
return asJsonString(schema12, path67, found2, "nested too deeply to describe here");
|
|
43464
43647
|
let node = { ...schema12 };
|
|
43465
43648
|
if (typeof node.$ref === "string") {
|
|
43466
43649
|
const target = resolveRef2(node.$ref, root);
|
|
43467
43650
|
if (target === void 0)
|
|
43468
|
-
return asJsonString(node,
|
|
43651
|
+
return asJsonString(node, path67, found2, "a structured value");
|
|
43469
43652
|
const { $ref: _ref, ...siblings } = node;
|
|
43470
43653
|
void _ref;
|
|
43471
43654
|
node = { ...target, ...siblings };
|
|
@@ -43481,7 +43664,7 @@ function convert(schema12, root, path66, found2, depth, isRoot = false) {
|
|
|
43481
43664
|
const merged = { ...branches[0] };
|
|
43482
43665
|
if (describedBase !== void 0 && merged.description === void 0)
|
|
43483
43666
|
merged.description = describedBase;
|
|
43484
|
-
const converted = convert(merged, root,
|
|
43667
|
+
const converted = convert(merged, root, path67, found2, depth + 1);
|
|
43485
43668
|
if (nullable2)
|
|
43486
43669
|
converted.nullable = true;
|
|
43487
43670
|
return converted;
|
|
@@ -43489,16 +43672,16 @@ function convert(schema12, root, path66, found2, depth, isRoot = false) {
|
|
|
43489
43672
|
const allEnums = branches.every((branch) => Array.isArray(branch.enum) || branch.const !== void 0);
|
|
43490
43673
|
if (allEnums) {
|
|
43491
43674
|
const values = branches.flatMap((branch) => Array.isArray(branch.enum) ? branch.enum : [branch.const]);
|
|
43492
|
-
return convert({ ...withoutUnion(node), enum: values, ...nullable2 ? { nullable: true } : {} }, root,
|
|
43675
|
+
return convert({ ...withoutUnion(node), enum: values, ...nullable2 ? { nullable: true } : {} }, root, path67, found2, depth + 1);
|
|
43493
43676
|
}
|
|
43494
43677
|
const allScalars = branches.every((branch) => typeof branch.type === "string" && SCALARS.has(branch.type));
|
|
43495
43678
|
if (allScalars) {
|
|
43496
43679
|
const types = branches.map((branch) => branch.type);
|
|
43497
43680
|
const chosen = types.includes("string") ? "string" : types[0];
|
|
43498
43681
|
const note = `Accepts ${types.join(" or ")}.`;
|
|
43499
|
-
return convert({ ...withoutUnion(node), type: chosen, description: join(baseDescription(node), note), ...nullable2 ? { nullable: true } : {} }, root,
|
|
43682
|
+
return convert({ ...withoutUnion(node), type: chosen, description: join(baseDescription(node), note), ...nullable2 ? { nullable: true } : {} }, root, path67, found2, depth + 1);
|
|
43500
43683
|
}
|
|
43501
|
-
return asJsonString(node,
|
|
43684
|
+
return asJsonString(node, path67, found2, describeUnion(branches));
|
|
43502
43685
|
}
|
|
43503
43686
|
const type = node.type;
|
|
43504
43687
|
const notes = describeDropped(node);
|
|
@@ -43510,10 +43693,10 @@ function convert(schema12, root, path66, found2, depth, isRoot = false) {
|
|
|
43510
43693
|
const properties = isRecord2(node.properties) ? node.properties : {};
|
|
43511
43694
|
const names = Object.keys(properties);
|
|
43512
43695
|
if (names.length === 0 && !isRoot)
|
|
43513
|
-
return asJsonString(node,
|
|
43696
|
+
return asJsonString(node, path67, found2, "an object with any keys");
|
|
43514
43697
|
const converted = {};
|
|
43515
43698
|
for (const name of names)
|
|
43516
|
-
converted[name] = convert(properties[name], root, [...
|
|
43699
|
+
converted[name] = convert(properties[name], root, [...path67, name], found2, depth + 1);
|
|
43517
43700
|
out.properties = converted;
|
|
43518
43701
|
if (Array.isArray(node.required)) {
|
|
43519
43702
|
const required2 = node.required.filter((name) => typeof name === "string" && name in converted);
|
|
@@ -43521,9 +43704,9 @@ function convert(schema12, root, path66, found2, depth, isRoot = false) {
|
|
|
43521
43704
|
out.required = required2;
|
|
43522
43705
|
}
|
|
43523
43706
|
} else if (type === "array") {
|
|
43524
|
-
out.items = node.items === void 0 ? { type: "string" } : convert(node.items, root, [...
|
|
43707
|
+
out.items = node.items === void 0 ? { type: "string" } : convert(node.items, root, [...path67, "[]"], found2, depth + 1);
|
|
43525
43708
|
} else if (type === void 0 && node.enum === void 0) {
|
|
43526
|
-
return asJsonString(node,
|
|
43709
|
+
return asJsonString(node, path67, found2, "any JSON value");
|
|
43527
43710
|
}
|
|
43528
43711
|
if (Array.isArray(node.enum)) {
|
|
43529
43712
|
const values = node.enum.filter((value) => value !== null);
|
|
@@ -43533,7 +43716,7 @@ function convert(schema12, root, path66, found2, depth, isRoot = false) {
|
|
|
43533
43716
|
} else if (values.every((value) => typeof value === "number")) {
|
|
43534
43717
|
out.type = "string";
|
|
43535
43718
|
out.enum = values.map(String);
|
|
43536
|
-
found2.push({ path:
|
|
43719
|
+
found2.push({ path: path67, kind: "number" });
|
|
43537
43720
|
} else {
|
|
43538
43721
|
notes.push(`One of: ${values.map((value) => JSON.stringify(value)).join(", ")}.`);
|
|
43539
43722
|
}
|
|
@@ -43547,8 +43730,8 @@ function convert(schema12, root, path66, found2, depth, isRoot = false) {
|
|
|
43547
43730
|
out.description = description;
|
|
43548
43731
|
return out;
|
|
43549
43732
|
}
|
|
43550
|
-
function asJsonString(node,
|
|
43551
|
-
found2.push({ path:
|
|
43733
|
+
function asJsonString(node, path67, found2, what) {
|
|
43734
|
+
found2.push({ path: path67, kind: "json" });
|
|
43552
43735
|
const example = exampleFor(node);
|
|
43553
43736
|
return {
|
|
43554
43737
|
type: "string",
|
|
@@ -44927,8 +45110,8 @@ var SUPERSEDED_MARKER = "[Superseded: this file was read again later in the conv
|
|
|
44927
45110
|
function readFilePath(argumentsJson) {
|
|
44928
45111
|
try {
|
|
44929
45112
|
const parsed = JSON.parse(argumentsJson.length > 0 ? argumentsJson : "{}");
|
|
44930
|
-
const
|
|
44931
|
-
return typeof
|
|
45113
|
+
const path67 = parsed.path;
|
|
45114
|
+
return typeof path67 === "string" && path67.length > 0 ? path67 : void 0;
|
|
44932
45115
|
} catch {
|
|
44933
45116
|
return void 0;
|
|
44934
45117
|
}
|
|
@@ -44941,8 +45124,8 @@ function dropSupersededReads(messages) {
|
|
|
44941
45124
|
for (const toolCall of message6.toolCalls ?? []) {
|
|
44942
45125
|
if (toolCall.name !== "read_file")
|
|
44943
45126
|
continue;
|
|
44944
|
-
const
|
|
44945
|
-
if (
|
|
45127
|
+
const path67 = readFilePath(toolCall.arguments);
|
|
45128
|
+
if (path67 === void 0)
|
|
44946
45129
|
continue;
|
|
44947
45130
|
keyByCallId.set(toolCall.id, toolCall.arguments);
|
|
44948
45131
|
}
|
|
@@ -48051,13 +48234,13 @@ var OpenSearchClient = class {
|
|
|
48051
48234
|
* `_bulk`, `_delete_by_query`, index creation — is refused here rather than merely
|
|
48052
48235
|
* unused, so no future edit or crafted argument can turn a read client into a writer.
|
|
48053
48236
|
*/
|
|
48054
|
-
async request(
|
|
48237
|
+
async request(path67, options = {}) {
|
|
48055
48238
|
const method = options.method ?? "GET";
|
|
48056
|
-
const isSearchPost = method === "POST" && /\/_search(\?|$)/.test(
|
|
48239
|
+
const isSearchPost = method === "POST" && /\/_search(\?|$)/.test(path67);
|
|
48057
48240
|
if (method !== "GET" && !isSearchPost) {
|
|
48058
|
-
throw new OpenSearchError(`Refusing ${method} ${
|
|
48241
|
+
throw new OpenSearchError(`Refusing ${method} ${path67}: this client is read-only. Indexing goes through the indexer, which the user starts from Settings.`);
|
|
48059
48242
|
}
|
|
48060
|
-
const url2 = `${this.base}${
|
|
48243
|
+
const url2 = `${this.base}${path67}`;
|
|
48061
48244
|
const request2 = {
|
|
48062
48245
|
method,
|
|
48063
48246
|
headers: this.headers()
|
|
@@ -48224,11 +48407,11 @@ function collectFields(properties, prefix, out) {
|
|
|
48224
48407
|
return;
|
|
48225
48408
|
for (const [name, raw] of Object.entries(properties)) {
|
|
48226
48409
|
const field2 = raw;
|
|
48227
|
-
const
|
|
48410
|
+
const path67 = prefix.length > 0 ? `${prefix}.${name}` : name;
|
|
48228
48411
|
if (typeof field2.type === "string")
|
|
48229
|
-
out[
|
|
48412
|
+
out[path67] = field2.type;
|
|
48230
48413
|
if (field2.properties !== void 0)
|
|
48231
|
-
collectFields(field2.properties,
|
|
48414
|
+
collectFields(field2.properties, path67, out);
|
|
48232
48415
|
}
|
|
48233
48416
|
}
|
|
48234
48417
|
function describeStatus(status2, url2, body) {
|
|
@@ -48247,23 +48430,23 @@ function describeStatus(status2, url2, body) {
|
|
|
48247
48430
|
var TEXT_TYPES = /* @__PURE__ */ new Set(["text", "match_only_text", "search_as_you_type", "wildcard"]);
|
|
48248
48431
|
var KEYWORD_TYPES = /* @__PURE__ */ new Set(["keyword", "constant_keyword"]);
|
|
48249
48432
|
var NOISE_FIELDS = /* @__PURE__ */ new Set(["@version", "ecs", "tags", "stream", "input", "agent", "host", "event"]);
|
|
48250
|
-
function leafName(
|
|
48251
|
-
const parts =
|
|
48252
|
-
return parts[parts.length - 1] ??
|
|
48433
|
+
function leafName(path67) {
|
|
48434
|
+
const parts = path67.split(".");
|
|
48435
|
+
return parts[parts.length - 1] ?? path67;
|
|
48253
48436
|
}
|
|
48254
48437
|
function selectQueryFields(mapping, limit = 25) {
|
|
48255
48438
|
const text2 = [];
|
|
48256
48439
|
const keyword = [];
|
|
48257
|
-
for (const [
|
|
48258
|
-
if (NOISE_FIELDS.has(leafName(
|
|
48440
|
+
for (const [path67, type] of Object.entries(mapping)) {
|
|
48441
|
+
if (NOISE_FIELDS.has(leafName(path67)) || NOISE_FIELDS.has(path67.split(".")[0] ?? ""))
|
|
48259
48442
|
continue;
|
|
48260
48443
|
if (TEXT_TYPES.has(type)) {
|
|
48261
|
-
text2.push(
|
|
48444
|
+
text2.push(path67);
|
|
48262
48445
|
} else if (KEYWORD_TYPES.has(type)) {
|
|
48263
|
-
const parent =
|
|
48264
|
-
if (
|
|
48446
|
+
const parent = path67.replace(/\.keyword$/, "");
|
|
48447
|
+
if (path67.endsWith(".keyword") && TEXT_TYPES.has(mapping[parent] ?? ""))
|
|
48265
48448
|
continue;
|
|
48266
|
-
keyword.push(
|
|
48449
|
+
keyword.push(path67);
|
|
48267
48450
|
}
|
|
48268
48451
|
}
|
|
48269
48452
|
const byDepth = (a, b) => a.split(".").length - b.split(".").length || a.localeCompare(b);
|
|
@@ -48405,8 +48588,8 @@ var OpenSearchIndexWriter = class {
|
|
|
48405
48588
|
}
|
|
48406
48589
|
return headers;
|
|
48407
48590
|
}
|
|
48408
|
-
async request(
|
|
48409
|
-
const url2 = `${this.connection.url.replace(/\/+$/, "")}${
|
|
48591
|
+
async request(path67, method, body, signal) {
|
|
48592
|
+
const url2 = `${this.connection.url.replace(/\/+$/, "")}${path67}`;
|
|
48410
48593
|
const request2 = { method, headers: this.headers() };
|
|
48411
48594
|
if (body !== void 0) {
|
|
48412
48595
|
if (typeof body === "string") {
|
|
@@ -48620,13 +48803,13 @@ var OpenSearchIndexWriter = class {
|
|
|
48620
48803
|
for (const hit of hits) {
|
|
48621
48804
|
const source = hit._source ?? {};
|
|
48622
48805
|
const vector = source.vector;
|
|
48623
|
-
const
|
|
48624
|
-
if (typeof
|
|
48806
|
+
const path67 = source.path;
|
|
48807
|
+
if (typeof path67 !== "string" || !Array.isArray(vector))
|
|
48625
48808
|
continue;
|
|
48626
48809
|
documents.push({
|
|
48627
48810
|
id: hit._id ?? "",
|
|
48628
48811
|
text: typeof source.text === "string" ? source.text : "",
|
|
48629
|
-
path:
|
|
48812
|
+
path: path67,
|
|
48630
48813
|
startLine: typeof source.startLine === "number" ? source.startLine : 1,
|
|
48631
48814
|
endLine: typeof source.endLine === "number" ? source.endLine : 1,
|
|
48632
48815
|
vector
|
|
@@ -48702,8 +48885,8 @@ var RestTransport = class {
|
|
|
48702
48885
|
* threw would push every caller into catching and re-inspecting an error to find out
|
|
48703
48886
|
* whether it was really an error. `expectOk` is there for the cases that are.
|
|
48704
48887
|
*/
|
|
48705
|
-
async send(
|
|
48706
|
-
const url2 = `${this.connection.url.replace(/\/+$/, "")}${
|
|
48888
|
+
async send(path67, method, body, signal) {
|
|
48889
|
+
const url2 = `${this.connection.url.replace(/\/+$/, "")}${path67}`;
|
|
48707
48890
|
const request2 = { method, headers: this.headers() };
|
|
48708
48891
|
if (body !== void 0)
|
|
48709
48892
|
request2.body = JSON.stringify(body);
|
|
@@ -48729,11 +48912,11 @@ var RestTransport = class {
|
|
|
48729
48912
|
return { status: response.status, body: parsed };
|
|
48730
48913
|
}
|
|
48731
48914
|
/** Sends, and throws unless the status is 2xx. */
|
|
48732
|
-
async expectOk(
|
|
48733
|
-
const result = await this.send(
|
|
48915
|
+
async expectOk(path67, method, body, signal) {
|
|
48916
|
+
const result = await this.send(path67, method, body, signal);
|
|
48734
48917
|
if (result.status < 200 || result.status >= 300) {
|
|
48735
48918
|
const detail = typeof result.body === "string" ? result.body : JSON.stringify(result.body ?? "");
|
|
48736
|
-
throw new VectorStoreError(`${method} ${
|
|
48919
|
+
throw new VectorStoreError(`${method} ${path67} on ${this.label} returned HTTP ${String(result.status)}. ${detail.slice(0, 300)}` + this.explain(result.body), result.status);
|
|
48737
48920
|
}
|
|
48738
48921
|
return result.body;
|
|
48739
48922
|
}
|
|
@@ -48919,10 +49102,10 @@ var ChromaSearcher = class extends ChromaBase {
|
|
|
48919
49102
|
const matches = [];
|
|
48920
49103
|
for (let index = 0; index < ids.length; index++) {
|
|
48921
49104
|
const metadata = metadatas[index] ?? {};
|
|
48922
|
-
const
|
|
48923
|
-
if (
|
|
49105
|
+
const path67 = typeof metadata.path === "string" ? metadata.path : void 0;
|
|
49106
|
+
if (path67 === void 0)
|
|
48924
49107
|
continue;
|
|
48925
|
-
if (prefix !== void 0 && prefix.length > 0 && !
|
|
49108
|
+
if (prefix !== void 0 && prefix.length > 0 && !path67.startsWith(prefix))
|
|
48926
49109
|
continue;
|
|
48927
49110
|
if (projectHere && typeof metadata.project === "string" && !options.project?.names.includes(metadata.project))
|
|
48928
49111
|
continue;
|
|
@@ -48936,7 +49119,7 @@ var ChromaSearcher = class extends ChromaBase {
|
|
|
48936
49119
|
*/
|
|
48937
49120
|
score: typeof distance === "number" ? 1 / (1 + Math.max(0, distance)) : 0,
|
|
48938
49121
|
text: documents[index] ?? (typeof metadata.text === "string" ? metadata.text : ""),
|
|
48939
|
-
path:
|
|
49122
|
+
path: path67
|
|
48940
49123
|
};
|
|
48941
49124
|
if (typeof metadata.startLine === "number")
|
|
48942
49125
|
match.startLine = metadata.startLine;
|
|
@@ -49047,13 +49230,13 @@ var ChromaIndexWriter = class extends ChromaBase {
|
|
|
49047
49230
|
for (let index = 0; index < ids.length; index++) {
|
|
49048
49231
|
const metadata = result.metadatas?.[index] ?? {};
|
|
49049
49232
|
const vector = result.embeddings?.[index];
|
|
49050
|
-
const
|
|
49051
|
-
if (
|
|
49233
|
+
const path67 = typeof metadata.path === "string" ? metadata.path : void 0;
|
|
49234
|
+
if (path67 === void 0 || !Array.isArray(vector))
|
|
49052
49235
|
continue;
|
|
49053
49236
|
documents.push({
|
|
49054
49237
|
id: ids[index] ?? "",
|
|
49055
49238
|
text: result.documents?.[index] ?? "",
|
|
49056
|
-
path:
|
|
49239
|
+
path: path67,
|
|
49057
49240
|
startLine: typeof metadata.startLine === "number" ? metadata.startLine : 1,
|
|
49058
49241
|
endLine: typeof metadata.endLine === "number" ? metadata.endLine : 1,
|
|
49059
49242
|
vector
|
|
@@ -49070,9 +49253,9 @@ var ChromaIndexWriter = class extends ChromaBase {
|
|
|
49070
49253
|
const result = await this.rest.expectOk(`${this.base}/collections/${found2.id}/get`, "POST", { include: ["metadatas"], limit }, options.signal);
|
|
49071
49254
|
const paths = /* @__PURE__ */ new Set();
|
|
49072
49255
|
for (const metadata of result.metadatas ?? []) {
|
|
49073
|
-
const
|
|
49074
|
-
if (typeof
|
|
49075
|
-
paths.add(
|
|
49256
|
+
const path67 = metadata?.path;
|
|
49257
|
+
if (typeof path67 === "string")
|
|
49258
|
+
paths.add(path67);
|
|
49076
49259
|
}
|
|
49077
49260
|
return [...paths];
|
|
49078
49261
|
}
|
|
@@ -49099,14 +49282,14 @@ var MARKER_ID = "5f6d2a41-0000-5000-8000-6c69676874c0";
|
|
|
49099
49282
|
var MARKER_MARK = "light-code";
|
|
49100
49283
|
function toMatch(point) {
|
|
49101
49284
|
const payload = point.payload ?? {};
|
|
49102
|
-
const
|
|
49103
|
-
if (
|
|
49285
|
+
const path67 = typeof payload.path === "string" ? payload.path : void 0;
|
|
49286
|
+
if (path67 === void 0)
|
|
49104
49287
|
return void 0;
|
|
49105
49288
|
const match = {
|
|
49106
49289
|
id: typeof payload.chunkId === "string" ? payload.chunkId : point.id,
|
|
49107
49290
|
score: typeof point.score === "number" ? point.score : 0,
|
|
49108
49291
|
text: typeof payload.text === "string" ? payload.text : "",
|
|
49109
|
-
path:
|
|
49292
|
+
path: path67
|
|
49110
49293
|
};
|
|
49111
49294
|
if (typeof payload.startLine === "number")
|
|
49112
49295
|
match.startLine = payload.startLine;
|
|
@@ -49300,13 +49483,13 @@ var QdrantIndexWriter = class extends QdrantBase {
|
|
|
49300
49483
|
const documents = [];
|
|
49301
49484
|
for (const point of result.body.result?.points ?? []) {
|
|
49302
49485
|
const payload = point.payload ?? {};
|
|
49303
|
-
const
|
|
49304
|
-
if (
|
|
49486
|
+
const path67 = typeof payload.path === "string" ? payload.path : void 0;
|
|
49487
|
+
if (path67 === void 0 || !Array.isArray(point.vector))
|
|
49305
49488
|
continue;
|
|
49306
49489
|
documents.push({
|
|
49307
49490
|
id: typeof payload.chunkId === "string" ? payload.chunkId : point.id,
|
|
49308
49491
|
text: typeof payload.text === "string" ? payload.text : "",
|
|
49309
|
-
path:
|
|
49492
|
+
path: path67,
|
|
49310
49493
|
startLine: typeof payload.startLine === "number" ? payload.startLine : 1,
|
|
49311
49494
|
endLine: typeof payload.endLine === "number" ? payload.endLine : 1,
|
|
49312
49495
|
vector: point.vector
|
|
@@ -49333,9 +49516,9 @@ var QdrantIndexWriter = class extends QdrantBase {
|
|
|
49333
49516
|
throw new VectorStoreError(`Could not list "${collection}" (HTTP ${String(result.status)}).` + wrongServerHint("qdrant", result.body, this.rest.label), result.status);
|
|
49334
49517
|
}
|
|
49335
49518
|
for (const point of result.body.result?.points ?? []) {
|
|
49336
|
-
const
|
|
49337
|
-
if (typeof
|
|
49338
|
-
paths.add(
|
|
49519
|
+
const path67 = point.payload?.path;
|
|
49520
|
+
if (typeof path67 === "string")
|
|
49521
|
+
paths.add(path67);
|
|
49339
49522
|
}
|
|
49340
49523
|
offset = result.body.result?.next_page_offset;
|
|
49341
49524
|
if (offset === void 0 || offset === null)
|
|
@@ -49869,8 +50052,8 @@ function teamSkillDocument(skill, body, vector, attribution) {
|
|
|
49869
50052
|
vector
|
|
49870
50053
|
};
|
|
49871
50054
|
}
|
|
49872
|
-
function nameFromPath(
|
|
49873
|
-
return
|
|
50055
|
+
function nameFromPath(path67) {
|
|
50056
|
+
return path67.startsWith("skill:") ? path67.slice("skill:".length) : path67;
|
|
49874
50057
|
}
|
|
49875
50058
|
function toHit(match, self) {
|
|
49876
50059
|
return {
|
|
@@ -52722,15 +52905,15 @@ ${record2.preview}`.toLowerCase();
|
|
|
52722
52905
|
const hits = await options.semantic.searcher.searchByVector(options.semantic.collection, vector, {
|
|
52723
52906
|
size: Math.min(100, Math.max(limit * 4, 40))
|
|
52724
52907
|
});
|
|
52725
|
-
const
|
|
52908
|
+
const rank4 = /* @__PURE__ */ new Map();
|
|
52726
52909
|
hits.forEach((hit, position) => {
|
|
52727
52910
|
const id = hit.path.startsWith("mail:") ? hit.path.slice("mail:".length) : hit.path;
|
|
52728
|
-
if (!
|
|
52729
|
-
|
|
52911
|
+
if (!rank4.has(id))
|
|
52912
|
+
rank4.set(id, position);
|
|
52730
52913
|
});
|
|
52731
52914
|
ordered = [...candidates].sort((a, b) => {
|
|
52732
|
-
const left =
|
|
52733
|
-
const right =
|
|
52915
|
+
const left = rank4.get(a.id);
|
|
52916
|
+
const right = rank4.get(b.id);
|
|
52734
52917
|
if (left !== void 0 && right !== void 0)
|
|
52735
52918
|
return left - right;
|
|
52736
52919
|
if (left !== void 0)
|
|
@@ -52956,8 +53139,8 @@ function createMailCoverageTool(options) {
|
|
|
52956
53139
|
}
|
|
52957
53140
|
};
|
|
52958
53141
|
}
|
|
52959
|
-
function normaliseFolder(
|
|
52960
|
-
return
|
|
53142
|
+
function normaliseFolder(path67) {
|
|
53143
|
+
return path67.toLowerCase().replace(/[\\/]+/g, "\\");
|
|
52961
53144
|
}
|
|
52962
53145
|
function haystackOf(record2) {
|
|
52963
53146
|
return `${record2.subject}
|
|
@@ -53453,7 +53636,7 @@ async function refreshMail(options) {
|
|
|
53453
53636
|
const limit = options.batchLimit ?? 2e3;
|
|
53454
53637
|
const previewChars = options.previewChars ?? 400;
|
|
53455
53638
|
const sinceMs = Date.now() - options.days * 24 * 60 * 60 * 1e3;
|
|
53456
|
-
const harvested = await options.harvest(options.folders.map((
|
|
53639
|
+
const harvested = await options.harvest(options.folders.map((path67) => ({ path: path67, sinceMs })), { limit, previewChars });
|
|
53457
53640
|
const fetched = harvested.messages.map(toRecord);
|
|
53458
53641
|
if (fetched.length === 0) {
|
|
53459
53642
|
return { added: 0, more: false, total: known.length, embedded: 0, backfilled: 0, complete: [] };
|
|
@@ -53494,9 +53677,9 @@ async function syncMail(options) {
|
|
|
53494
53677
|
const backfillDone = await options.store.loadBackfillState();
|
|
53495
53678
|
const limit = options.batchLimit ?? 500;
|
|
53496
53679
|
const previewChars = options.previewChars ?? 400;
|
|
53497
|
-
const forwardRequests = options.folders.map((
|
|
53498
|
-
const mark = marks.get(
|
|
53499
|
-
return mark === void 0 ? { path:
|
|
53680
|
+
const forwardRequests = options.folders.map((path67) => {
|
|
53681
|
+
const mark = marks.get(path67);
|
|
53682
|
+
return mark === void 0 ? { path: path67 } : { path: path67, sinceMs: mark.newest - 1e3 };
|
|
53500
53683
|
});
|
|
53501
53684
|
const forward = await options.harvest(forwardRequests, { limit, previewChars });
|
|
53502
53685
|
let candidates = forward.messages.map(toRecord);
|
|
@@ -53505,15 +53688,15 @@ async function syncMail(options) {
|
|
|
53505
53688
|
let more = forward.truncated;
|
|
53506
53689
|
const remaining = limit - candidates.length;
|
|
53507
53690
|
const floor = options.retentionMonths === void 0 ? void 0 : monthsBefore(options.now ?? Date.now(), options.retentionMonths);
|
|
53508
|
-
const outstanding = options.folders.filter((
|
|
53509
|
-
const atFloor = floor === void 0 ? [] : outstanding.filter((
|
|
53510
|
-
const behind = outstanding.filter((
|
|
53691
|
+
const outstanding = options.folders.filter((path67) => marks.has(path67) && backfillDone[path67] !== true);
|
|
53692
|
+
const atFloor = floor === void 0 ? [] : outstanding.filter((path67) => marks.get(path67).oldest <= floor);
|
|
53693
|
+
const behind = outstanding.filter((path67) => !atFloor.includes(path67));
|
|
53511
53694
|
completed.push(...atFloor);
|
|
53512
53695
|
if (remaining > 0 && behind.length > 0 && options.signal?.aborted !== true) {
|
|
53513
|
-
const backRequests = behind.map((
|
|
53514
|
-
path:
|
|
53696
|
+
const backRequests = behind.map((path67) => ({
|
|
53697
|
+
path: path67,
|
|
53515
53698
|
// Strictly older, so the oldest held message is not fetched again every pass.
|
|
53516
|
-
beforeMs: marks.get(
|
|
53699
|
+
beforeMs: marks.get(path67).oldest,
|
|
53517
53700
|
// And no older than retention wants. The harvest ANDs the two into one window.
|
|
53518
53701
|
...floor === void 0 ? {} : { sinceMs: floor }
|
|
53519
53702
|
}));
|
|
@@ -53521,9 +53704,9 @@ async function syncMail(options) {
|
|
|
53521
53704
|
backfilled = backward.messages.length;
|
|
53522
53705
|
candidates = [...candidates, ...backward.messages.map(toRecord)];
|
|
53523
53706
|
const returnedFor = new Set(backward.messages.map((message6) => message6.folder));
|
|
53524
|
-
for (const
|
|
53525
|
-
if (!returnedFor.has(
|
|
53526
|
-
completed.push(
|
|
53707
|
+
for (const path67 of behind) {
|
|
53708
|
+
if (!returnedFor.has(path67))
|
|
53709
|
+
completed.push(path67);
|
|
53527
53710
|
}
|
|
53528
53711
|
if (backward.truncated || backfilled > 0)
|
|
53529
53712
|
more = true;
|
|
@@ -53531,7 +53714,7 @@ async function syncMail(options) {
|
|
|
53531
53714
|
if (completed.length > 0) {
|
|
53532
53715
|
await options.store.saveBackfillState({
|
|
53533
53716
|
...backfillDone,
|
|
53534
|
-
...Object.fromEntries(completed.map((
|
|
53717
|
+
...Object.fromEntries(completed.map((path67) => [path67, true]))
|
|
53535
53718
|
});
|
|
53536
53719
|
}
|
|
53537
53720
|
const fresh = withoutKnown(candidates, known);
|
|
@@ -53878,14 +54061,14 @@ function formatBytes(size) {
|
|
|
53878
54061
|
return `${(size / (1 << 10)).toFixed(1)}KB`;
|
|
53879
54062
|
return `${String(size)}B`;
|
|
53880
54063
|
}
|
|
53881
|
-
async function readTail(
|
|
54064
|
+
async function readTail(fs47, path67, size, count3) {
|
|
53882
54065
|
let span = Math.min(size, CHUNK);
|
|
53883
54066
|
let text2;
|
|
53884
54067
|
let start;
|
|
53885
54068
|
for (; ; ) {
|
|
53886
54069
|
start = Math.max(0, size - span);
|
|
53887
54070
|
const decoder2 = new import_node_string_decoder.StringDecoder("utf8");
|
|
53888
|
-
text2 = decoder2.write(await
|
|
54071
|
+
text2 = decoder2.write(await fs47.readBytesSlice(path67, start, size)) + decoder2.end();
|
|
53889
54072
|
const enough = text2.split("\n").length > count3;
|
|
53890
54073
|
if (enough || start === 0 || span >= size)
|
|
53891
54074
|
break;
|
|
@@ -53903,7 +54086,7 @@ async function readTail(fs46, path66, size, count3) {
|
|
|
53903
54086
|
hasMoreAfter: false
|
|
53904
54087
|
};
|
|
53905
54088
|
}
|
|
53906
|
-
async function readLineWindow(
|
|
54089
|
+
async function readLineWindow(fs47, path67, size, from, count3) {
|
|
53907
54090
|
const decoder2 = new import_node_string_decoder.StringDecoder("utf8");
|
|
53908
54091
|
const lines2 = [];
|
|
53909
54092
|
let pending = "";
|
|
@@ -53918,7 +54101,7 @@ async function readLineWindow(fs46, path66, size, from, count3) {
|
|
|
53918
54101
|
};
|
|
53919
54102
|
scan: while (position < size) {
|
|
53920
54103
|
const end = Math.min(size, position + CHUNK);
|
|
53921
|
-
pending += decoder2.write(await
|
|
54104
|
+
pending += decoder2.write(await fs47.readBytesSlice(path67, position, end));
|
|
53922
54105
|
position = end;
|
|
53923
54106
|
const parts = pending.split(/\r\n|\r|\n/);
|
|
53924
54107
|
pending = parts.pop() ?? "";
|
|
@@ -53941,13 +54124,13 @@ async function readLineWindow(fs46, path66, size, from, count3) {
|
|
|
53941
54124
|
hasMoreAfter: !reachedEnd || lineNumber > from + lines2.length
|
|
53942
54125
|
};
|
|
53943
54126
|
}
|
|
53944
|
-
async function countLines(
|
|
54127
|
+
async function countLines(fs47, path67, size) {
|
|
53945
54128
|
let newlines = 0;
|
|
53946
54129
|
let position = 0;
|
|
53947
54130
|
let lastByte = -1;
|
|
53948
54131
|
while (position < size) {
|
|
53949
54132
|
const end = Math.min(size, position + CHUNK);
|
|
53950
|
-
const buffer = await
|
|
54133
|
+
const buffer = await fs47.readBytesSlice(path67, position, end);
|
|
53951
54134
|
for (const byte of buffer)
|
|
53952
54135
|
if (byte === 10)
|
|
53953
54136
|
newlines += 1;
|
|
@@ -60315,6 +60498,7 @@ var McpRegistry = class {
|
|
|
60315
60498
|
getAlwaysAllowed;
|
|
60316
60499
|
defaultTimeout;
|
|
60317
60500
|
isRepositoryServer;
|
|
60501
|
+
toolCache;
|
|
60318
60502
|
connections = /* @__PURE__ */ new Map();
|
|
60319
60503
|
statuses = /* @__PURE__ */ new Map();
|
|
60320
60504
|
errors = /* @__PURE__ */ new Map();
|
|
@@ -60323,13 +60507,90 @@ var McpRegistry = class {
|
|
|
60323
60507
|
panelTools = /* @__PURE__ */ new Map();
|
|
60324
60508
|
logs = /* @__PURE__ */ new Map();
|
|
60325
60509
|
servers = {};
|
|
60326
|
-
constructor(secrets, events, logger, getAlwaysAllowed = () => [], defaultTimeout = void 0, isRepositoryServer = async () => false) {
|
|
60510
|
+
constructor(secrets, events, logger, getAlwaysAllowed = () => [], defaultTimeout = void 0, isRepositoryServer = async () => false, toolCache = void 0) {
|
|
60327
60511
|
this.secrets = secrets;
|
|
60328
60512
|
this.events = events;
|
|
60329
60513
|
this.logger = logger;
|
|
60330
60514
|
this.getAlwaysAllowed = getAlwaysAllowed;
|
|
60331
60515
|
this.defaultTimeout = defaultTimeout;
|
|
60332
60516
|
this.isRepositoryServer = isRepositoryServer;
|
|
60517
|
+
this.toolCache = toolCache;
|
|
60518
|
+
}
|
|
60519
|
+
/** Connections being opened, so two callers asking at once share one start rather than spawning two servers. */
|
|
60520
|
+
connecting = /* @__PURE__ */ new Map();
|
|
60521
|
+
/** Servers whose tools are, for now, the remembered list rather than one the server gave this session. */
|
|
60522
|
+
fromCache = /* @__PURE__ */ new Set();
|
|
60523
|
+
/**
|
|
60524
|
+
* Offers the remembered tools of every enabled server that has not listed its own yet in this session,
|
|
60525
|
+
* when its connection settings are the ones the list was read under. A call to one waits for the server.
|
|
60526
|
+
*/
|
|
60527
|
+
async primeFromCache() {
|
|
60528
|
+
if (this.toolCache === void 0)
|
|
60529
|
+
return;
|
|
60530
|
+
let cached2;
|
|
60531
|
+
try {
|
|
60532
|
+
cached2 = await this.toolCache.read();
|
|
60533
|
+
} catch {
|
|
60534
|
+
return;
|
|
60535
|
+
}
|
|
60536
|
+
for (const [name, config2] of Object.entries(this.servers)) {
|
|
60537
|
+
if (config2.disabled === true || this.toolsByServer.has(name))
|
|
60538
|
+
continue;
|
|
60539
|
+
const entry = cached2[name];
|
|
60540
|
+
if (entry === void 0 || entry.signature !== connectionSignature(config2))
|
|
60541
|
+
continue;
|
|
60542
|
+
this.setTools(name, entry.tools, async () => this.liveConnection(name));
|
|
60543
|
+
this.fromCache.add(name);
|
|
60544
|
+
}
|
|
60545
|
+
}
|
|
60546
|
+
/** The server's connection, started (or waited for) when it is not open yet. Throws with the reason it failed. */
|
|
60547
|
+
async liveConnection(name) {
|
|
60548
|
+
const open = this.connections.get(name);
|
|
60549
|
+
if (open !== void 0)
|
|
60550
|
+
return open;
|
|
60551
|
+
await this.connectServer(name);
|
|
60552
|
+
const connection = this.connections.get(name);
|
|
60553
|
+
if (connection === void 0)
|
|
60554
|
+
throw new Error(`the server did not start${this.errors.has(name) ? `: ${this.errors.get(name) ?? ""}` : ""}`);
|
|
60555
|
+
return connection;
|
|
60556
|
+
}
|
|
60557
|
+
/** Records a server's tools - live or remembered - as tools the loop can call. */
|
|
60558
|
+
setTools(name, listed, connectionFor) {
|
|
60559
|
+
this.panelTools.set(name, new Set(listed.filter((descriptor) => descriptor.panelOnly === true).map((descriptor) => descriptor.name)));
|
|
60560
|
+
const descriptors = listed.filter((descriptor) => descriptor.panelOnly !== true);
|
|
60561
|
+
this.toolsByServer.set(name, descriptors.map((descriptor) => ({
|
|
60562
|
+
descriptor,
|
|
60563
|
+
tool: adaptTool(name, descriptor.name, descriptor.description, descriptor.inputSchema, async (args) => {
|
|
60564
|
+
const decision = denyCheck(descriptor.name, args, this.servers[name]?.deny);
|
|
60565
|
+
if (decision.denied) {
|
|
60566
|
+
this.appendLog(name, decision.message ?? "Refused by a deny rule.");
|
|
60567
|
+
throw new Error(decision.message ?? "Refused by a deny rule.");
|
|
60568
|
+
}
|
|
60569
|
+
return (await connectionFor()).callTool(descriptor.name, args);
|
|
60570
|
+
})
|
|
60571
|
+
})));
|
|
60572
|
+
}
|
|
60573
|
+
/**
|
|
60574
|
+
* Starts every enabled server that is not connected yet and waits only for those this session has no
|
|
60575
|
+
* tools for: a server whose remembered list is offered keeps starting in the background, and a call to it
|
|
60576
|
+
* waits for it then. Waits at most `maxWaitMs` even for the others, so one server that never answers
|
|
60577
|
+
* cannot hold a reply - its tools join the turn after it does. Returns the servers still starting.
|
|
60578
|
+
*/
|
|
60579
|
+
async ensureReady(maxWaitMs = 45e3) {
|
|
60580
|
+
const starting = Object.entries(this.servers).filter(([name, config2]) => config2.disabled !== true && !this.connections.has(name)).map(([name]) => ({ name, done: this.connectServer(name).catch(() => void 0) }));
|
|
60581
|
+
const needed = starting.filter((entry) => !this.toolsByServer.has(entry.name));
|
|
60582
|
+
if (needed.length > 0) {
|
|
60583
|
+
let timer;
|
|
60584
|
+
await Promise.race([
|
|
60585
|
+
Promise.all(needed.map((entry) => entry.done)),
|
|
60586
|
+
new Promise((resolve) => {
|
|
60587
|
+
timer = setTimeout(resolve, maxWaitMs);
|
|
60588
|
+
})
|
|
60589
|
+
]);
|
|
60590
|
+
if (timer !== void 0)
|
|
60591
|
+
clearTimeout(timer);
|
|
60592
|
+
}
|
|
60593
|
+
return starting.filter((entry) => this.statuses.get(entry.name) === "connecting").map((entry) => entry.name);
|
|
60333
60594
|
}
|
|
60334
60595
|
/** Replaces the configured server set, closing any that disappeared or changed. */
|
|
60335
60596
|
async configure(servers) {
|
|
@@ -60347,6 +60608,7 @@ var McpRegistry = class {
|
|
|
60347
60608
|
if (config2.disabled === true) {
|
|
60348
60609
|
this.statuses.set(name, "disabled");
|
|
60349
60610
|
this.toolsByServer.delete(name);
|
|
60611
|
+
this.fromCache.delete(name);
|
|
60350
60612
|
await this.disconnect(name, { silent: true });
|
|
60351
60613
|
} else if (!this.statuses.has(name) || this.statuses.get(name) === "disabled") {
|
|
60352
60614
|
this.statuses.set(name, "idle");
|
|
@@ -60357,15 +60619,17 @@ var McpRegistry = class {
|
|
|
60357
60619
|
this.statuses.delete(name);
|
|
60358
60620
|
this.errors.delete(name);
|
|
60359
60621
|
this.toolsByServer.delete(name);
|
|
60622
|
+
this.fromCache.delete(name);
|
|
60360
60623
|
}
|
|
60361
60624
|
}
|
|
60362
60625
|
for (const name of reconnect) {
|
|
60363
60626
|
const config2 = servers[name];
|
|
60364
60627
|
if (config2 !== void 0 && config2.disabled !== true) {
|
|
60365
|
-
void this.
|
|
60628
|
+
void this.connectServer(name).catch(() => {
|
|
60366
60629
|
});
|
|
60367
60630
|
}
|
|
60368
60631
|
}
|
|
60632
|
+
await this.primeFromCache();
|
|
60369
60633
|
this.events.onStateChanged();
|
|
60370
60634
|
}
|
|
60371
60635
|
/** Warnings the UI should surface before a server is started, e.g. package runners. */
|
|
@@ -60388,14 +60652,22 @@ var McpRegistry = class {
|
|
|
60388
60652
|
async connectServer(name) {
|
|
60389
60653
|
if (this.connections.has(name))
|
|
60390
60654
|
return;
|
|
60655
|
+
const already = this.connecting.get(name);
|
|
60656
|
+
if (already !== void 0)
|
|
60657
|
+
return already;
|
|
60391
60658
|
const config2 = this.servers[name];
|
|
60392
60659
|
if (config2 === void 0 || config2.disabled === true)
|
|
60393
60660
|
return;
|
|
60394
|
-
|
|
60661
|
+
const started = this.connect(name, config2).finally(() => {
|
|
60662
|
+
if (this.connecting.get(name) === started)
|
|
60663
|
+
this.connecting.delete(name);
|
|
60664
|
+
});
|
|
60665
|
+
this.connecting.set(name, started);
|
|
60666
|
+
return started;
|
|
60395
60667
|
}
|
|
60396
60668
|
/** Connects every enabled server that is not connected yet. Failures are per-server. */
|
|
60397
60669
|
async ensureConnected() {
|
|
60398
|
-
await Promise.all(Object.entries(this.servers).filter(([name, config2]) => config2.disabled !== true && !this.connections.has(name)).map(([name
|
|
60670
|
+
await Promise.all(Object.entries(this.servers).filter(([name, config2]) => config2.disabled !== true && !this.connections.has(name)).map(([name]) => this.connectServer(name)));
|
|
60399
60671
|
}
|
|
60400
60672
|
/** Bounded so a chatty server cannot grow this without limit over a long session. */
|
|
60401
60673
|
appendLog(name, line) {
|
|
@@ -60426,14 +60698,20 @@ var McpRegistry = class {
|
|
|
60426
60698
|
this.defaultTimeout,
|
|
60427
60699
|
{ repositoryDefined: await this.isRepositoryServer(name) }
|
|
60428
60700
|
);
|
|
60701
|
+
const startedAt = Date.now();
|
|
60429
60702
|
try {
|
|
60430
60703
|
await connection.connect();
|
|
60431
60704
|
this.connections.set(name, connection);
|
|
60432
60705
|
this.appendLog(name, "Connected.");
|
|
60433
60706
|
await this.refreshTools(name);
|
|
60707
|
+
const seconds = (Date.now() - startedAt) / 1e3;
|
|
60708
|
+
if (seconds >= 2)
|
|
60709
|
+
this.logger?.info(`[startup] MCP server "${name}" took ${seconds.toFixed(1)}s to start and list its tools`);
|
|
60434
60710
|
} catch (error51) {
|
|
60435
60711
|
const message6 = error51 instanceof Error ? error51.message : String(error51);
|
|
60436
|
-
this.
|
|
60712
|
+
if (this.fromCache.delete(name))
|
|
60713
|
+
this.toolsByServer.delete(name);
|
|
60714
|
+
this.logger?.warn(`MCP server "${name}" failed to connect after ${((Date.now() - startedAt) / 1e3).toFixed(1)}s: ${message6}`);
|
|
60437
60715
|
this.statuses.set(name, "failed");
|
|
60438
60716
|
this.errors.set(name, message6);
|
|
60439
60717
|
this.appendLog(name, `Failed: ${message6}`);
|
|
@@ -60446,22 +60724,15 @@ var McpRegistry = class {
|
|
|
60446
60724
|
return;
|
|
60447
60725
|
try {
|
|
60448
60726
|
const listed = await connection.listTools();
|
|
60449
|
-
this.
|
|
60450
|
-
|
|
60451
|
-
this.
|
|
60452
|
-
|
|
60453
|
-
|
|
60454
|
-
|
|
60455
|
-
if (decision.denied) {
|
|
60456
|
-
this.appendLog(name, decision.message ?? "Refused by a deny rule.");
|
|
60457
|
-
throw new Error(decision.message ?? "Refused by a deny rule.");
|
|
60458
|
-
}
|
|
60459
|
-
return connection.callTool(descriptor.name, args);
|
|
60460
|
-
})
|
|
60461
|
-
})));
|
|
60727
|
+
this.setTools(name, listed, async () => connection);
|
|
60728
|
+
this.fromCache.delete(name);
|
|
60729
|
+
const config2 = this.servers[name];
|
|
60730
|
+
if (config2 !== void 0 && this.toolCache !== void 0) {
|
|
60731
|
+
void this.toolCache.write(name, { signature: connectionSignature(config2), tools: listed, at: (/* @__PURE__ */ new Date()).toISOString() });
|
|
60732
|
+
}
|
|
60462
60733
|
this.statuses.set(name, "ready");
|
|
60463
60734
|
this.errors.delete(name);
|
|
60464
|
-
this.appendLog(name, `Discovered ${
|
|
60735
|
+
this.appendLog(name, `Discovered ${listed.filter((descriptor) => descriptor.panelOnly !== true).length} tool(s).`);
|
|
60465
60736
|
} catch (error51) {
|
|
60466
60737
|
this.statuses.set(name, "failed");
|
|
60467
60738
|
this.errors.set(name, error51 instanceof Error ? error51.message : String(error51));
|
|
@@ -60472,6 +60743,7 @@ var McpRegistry = class {
|
|
|
60472
60743
|
await this.connections.get(name)?.close();
|
|
60473
60744
|
this.connections.delete(name);
|
|
60474
60745
|
this.toolsByServer.delete(name);
|
|
60746
|
+
this.fromCache.delete(name);
|
|
60475
60747
|
if (this.servers[name] !== void 0 && this.servers[name]?.disabled !== true) {
|
|
60476
60748
|
this.statuses.set(name, "idle");
|
|
60477
60749
|
}
|
|
@@ -61318,13 +61590,13 @@ function appendSkillImages(body, images) {
|
|
|
61318
61590
|
const trimmed = body.replace(/\s+$/, "");
|
|
61319
61591
|
return [trimmed, "", "## Images", "", ...missing.map(renderSkillImage)].join("\n");
|
|
61320
61592
|
}
|
|
61321
|
-
async function listSkillImages(skillFilePath,
|
|
61593
|
+
async function listSkillImages(skillFilePath, fs47) {
|
|
61322
61594
|
const asPosix = skillFilePath.split(String.fromCharCode(92)).join("/");
|
|
61323
61595
|
if (!asPosix.toLowerCase().endsWith("/skill.md"))
|
|
61324
61596
|
return [];
|
|
61325
61597
|
const dir = `${skillFilePath.slice(0, skillFilePath.length - "SKILL.md".length)}${SKILL_IMAGE_DIR}`;
|
|
61326
61598
|
try {
|
|
61327
|
-
const entries = await
|
|
61599
|
+
const entries = await fs47.readdir(dir);
|
|
61328
61600
|
return entries.filter((entry) => !entry.isDirectory && skillImageType(entry.name) !== void 0).map((entry) => entry.name).sort();
|
|
61329
61601
|
} catch {
|
|
61330
61602
|
return [];
|
|
@@ -61374,12 +61646,12 @@ function skillFilesDir(skillFilePath) {
|
|
|
61374
61646
|
return void 0;
|
|
61375
61647
|
return `${skillFilePath.slice(0, skillFilePath.length - "SKILL.md".length)}${SKILL_FILE_DIR}`;
|
|
61376
61648
|
}
|
|
61377
|
-
async function listSkillFiles(skillFilePath,
|
|
61649
|
+
async function listSkillFiles(skillFilePath, fs47) {
|
|
61378
61650
|
const dir = skillFilesDir(skillFilePath);
|
|
61379
61651
|
if (dir === void 0)
|
|
61380
61652
|
return [];
|
|
61381
61653
|
try {
|
|
61382
|
-
const entries = await
|
|
61654
|
+
const entries = await fs47.readdir(dir);
|
|
61383
61655
|
return entries.filter((entry) => !entry.isDirectory).map((entry) => entry.name).sort();
|
|
61384
61656
|
} catch {
|
|
61385
61657
|
return [];
|
|
@@ -62034,9 +62306,9 @@ function secretRefsFor(section, config2) {
|
|
|
62034
62306
|
}
|
|
62035
62307
|
return refs;
|
|
62036
62308
|
}
|
|
62037
|
-
function getPath2(source,
|
|
62309
|
+
function getPath2(source, path67) {
|
|
62038
62310
|
let value = source;
|
|
62039
|
-
for (const part of
|
|
62311
|
+
for (const part of path67.split(".")) {
|
|
62040
62312
|
if (typeof value !== "object" || value === null)
|
|
62041
62313
|
return void 0;
|
|
62042
62314
|
value = value[part];
|
|
@@ -62050,8 +62322,8 @@ function hasValue(value) {
|
|
|
62050
62322
|
return Object.keys(value).length > 0;
|
|
62051
62323
|
return true;
|
|
62052
62324
|
}
|
|
62053
|
-
function setPath(target,
|
|
62054
|
-
const [head, ...rest] =
|
|
62325
|
+
function setPath(target, path67, value) {
|
|
62326
|
+
const [head, ...rest] = path67.split(".");
|
|
62055
62327
|
if (head === void 0)
|
|
62056
62328
|
return;
|
|
62057
62329
|
if (rest.length === 0) {
|
|
@@ -62071,8 +62343,8 @@ function setPath(target, path66, value) {
|
|
|
62071
62343
|
var NESTED_PATHS = SHARE_SECTIONS.flatMap((section) => section.nested ?? []);
|
|
62072
62344
|
function withoutNested(config2) {
|
|
62073
62345
|
const copy = { ...config2 };
|
|
62074
|
-
for (const
|
|
62075
|
-
setPath(copy,
|
|
62346
|
+
for (const path67 of NESTED_PATHS)
|
|
62347
|
+
setPath(copy, path67, void 0);
|
|
62076
62348
|
return copy;
|
|
62077
62349
|
}
|
|
62078
62350
|
function describeSections(config2) {
|
|
@@ -62081,7 +62353,7 @@ function describeSections(config2) {
|
|
|
62081
62353
|
id: section.id,
|
|
62082
62354
|
label: section.label,
|
|
62083
62355
|
description: section.description,
|
|
62084
|
-
present: section.keys.some((key3) => has(owned, key3)) || (section.nested ?? []).some((
|
|
62356
|
+
present: section.keys.some((key3) => has(owned, key3)) || (section.nested ?? []).some((path67) => hasValue(getPath2(config2, path67))),
|
|
62085
62357
|
detail: detailFor(section, config2),
|
|
62086
62358
|
secretRefs: secretRefsFor(section, config2),
|
|
62087
62359
|
...section.machineSpecific === true ? { machineSpecific: true } : {},
|
|
@@ -62102,18 +62374,18 @@ function buildExport(config2, selected) {
|
|
|
62102
62374
|
if (has(config2, key3))
|
|
62103
62375
|
exported[key3] = config2[key3];
|
|
62104
62376
|
}
|
|
62105
|
-
for (const
|
|
62106
|
-
const value = getPath2(config2,
|
|
62377
|
+
for (const path67 of section.nested ?? []) {
|
|
62378
|
+
const value = getPath2(config2, path67);
|
|
62107
62379
|
if (hasValue(value))
|
|
62108
|
-
setPath(exported,
|
|
62380
|
+
setPath(exported, path67, value);
|
|
62109
62381
|
}
|
|
62110
|
-
for (const
|
|
62111
|
-
stripPath(exported,
|
|
62382
|
+
for (const path67 of section.strip ?? [])
|
|
62383
|
+
stripPath(exported, path67);
|
|
62112
62384
|
}
|
|
62113
62385
|
return exported;
|
|
62114
62386
|
}
|
|
62115
|
-
function stripPath(target,
|
|
62116
|
-
const [head, ...rest] =
|
|
62387
|
+
function stripPath(target, path67) {
|
|
62388
|
+
const [head, ...rest] = path67.split(".");
|
|
62117
62389
|
if (head === void 0)
|
|
62118
62390
|
return;
|
|
62119
62391
|
const value = target[head];
|
|
@@ -62141,22 +62413,22 @@ function applyImport(existing, imported, selected) {
|
|
|
62141
62413
|
else
|
|
62142
62414
|
delete merged[key3];
|
|
62143
62415
|
}
|
|
62144
|
-
for (const
|
|
62145
|
-
carryPath(existing, merged,
|
|
62416
|
+
for (const path67 of section.strip ?? []) {
|
|
62417
|
+
carryPath(existing, merged, path67);
|
|
62146
62418
|
}
|
|
62147
62419
|
}
|
|
62148
62420
|
for (const section of SHARE_SECTIONS) {
|
|
62149
62421
|
if (!chosen.has(section.id))
|
|
62150
62422
|
continue;
|
|
62151
|
-
for (const
|
|
62152
|
-
const value = getPath2(imported,
|
|
62153
|
-
setPath(merged,
|
|
62423
|
+
for (const path67 of section.nested ?? []) {
|
|
62424
|
+
const value = getPath2(imported, path67);
|
|
62425
|
+
setPath(merged, path67, hasValue(value) ? value : void 0);
|
|
62154
62426
|
}
|
|
62155
62427
|
}
|
|
62156
62428
|
return merged;
|
|
62157
62429
|
}
|
|
62158
|
-
function carryPath(from, to,
|
|
62159
|
-
const [head, ...rest] =
|
|
62430
|
+
function carryPath(from, to, path67) {
|
|
62431
|
+
const [head, ...rest] = path67.split(".");
|
|
62160
62432
|
if (head === void 0)
|
|
62161
62433
|
return;
|
|
62162
62434
|
const source = from[head];
|
|
@@ -64143,9 +64415,9 @@ async function truncateToolResult(content, store, maxChars = DEFAULT_MAX_CHARS,
|
|
|
64143
64415
|
|
|
64144
64416
|
// ../../packages/core/dist/agent/transient.js
|
|
64145
64417
|
var TRANSIENT_STATUS = /HTTP (408|409|425|429|500|502|503|504|520|521|522|523|524|529)\b/;
|
|
64146
|
-
var TRANSIENT_TRANSPORT = /ECONNRESET|ECONNREFUSED|ETIMEDOUT|ECONNABORTED|EPIPE|EAI_AGAIN|ENETUNREACH|EHOSTUNREACH|socket hang up|other side closed|terminated|fetch failed|network error|UND_ERR_(SOCKET|CONNECT_TIMEOUT|HEADERS_TIMEOUT|BODY_TIMEOUT|CLOSED)|No reply from .* within/i;
|
|
64418
|
+
var TRANSIENT_TRANSPORT = /ECONNRESET|ECONNREFUSED|ETIMEDOUT|ECONNABORTED|EPIPE|EAI_AGAIN|ENOTFOUND|ENETUNREACH|EHOSTUNREACH|socket hang up|other side closed|terminated|fetch failed|network error|Connect Timeout|UND_ERR_(SOCKET|CONNECT_TIMEOUT|HEADERS_TIMEOUT|BODY_TIMEOUT|CLOSED)|No reply from .* within/i;
|
|
64147
64419
|
var TRANSIENT_PROVIDER = /overloaded|rate.?limit|too many requests|temporarily unavailable|service unavailable|RESOURCE_EXHAUSTED|UNAVAILABLE|try again later|server_error|internal server error/i;
|
|
64148
|
-
var PERMANENT = /HTTP (400|401|402|403|404|405|413|422)\b|credits? (are |is )?depleted|insufficient (credit|balance|funds)|billing|certificate|self[- ]signed|unable to verify|CERT_|key (does not|doesn't) match|passphrase|credential missing|context.{0,20}(length|window|limit)|too many tokens|prompt is too long/i;
|
|
64420
|
+
var PERMANENT = /HTTP (400|401|402|403|404|405|413|422)\b|credits? (are |is )?depleted|insufficient (credit|balance|funds)|billing|server certificate|certificate (could not|has expired|is not valid)|TLS handshake failed|self[- ]signed|unable to verify|CERT_|key (does not|doesn't) match|passphrase|credential missing|context.{0,20}(length|window|limit)|too many tokens|prompt is too long/i;
|
|
64149
64421
|
function isTransientError(message6) {
|
|
64150
64422
|
if (PERMANENT.test(message6))
|
|
64151
64423
|
return false;
|
|
@@ -64734,7 +65006,7 @@ function gatewayFromSettings(input, stored) {
|
|
|
64734
65006
|
}
|
|
64735
65007
|
|
|
64736
65008
|
// ../../packages/core/dist/host/bridge.js
|
|
64737
|
-
var
|
|
65009
|
+
var import_node_fs13 = require("node:fs");
|
|
64738
65010
|
var import_node_child_process19 = require("node:child_process");
|
|
64739
65011
|
var import_promises31 = __toESM(require("node:fs/promises"), 1);
|
|
64740
65012
|
|
|
@@ -65518,7 +65790,7 @@ function ignoreDecision(rules, relative, isDirectory2, initial) {
|
|
|
65518
65790
|
}
|
|
65519
65791
|
return ignored;
|
|
65520
65792
|
}
|
|
65521
|
-
async function repositoryWideRules(
|
|
65793
|
+
async function repositoryWideRules(fs47, root, globalIgnoreFile) {
|
|
65522
65794
|
const sources = [
|
|
65523
65795
|
globalIgnoreFile ?? import_node_path29.default.join(process.env["XDG_CONFIG_HOME"] ?? import_node_path29.default.join(import_node_os4.default.homedir(), ".config"), "git", "ignore"),
|
|
65524
65796
|
import_node_path29.default.join(root, ".git", "info", "exclude")
|
|
@@ -65526,16 +65798,16 @@ async function repositoryWideRules(fs46, root, globalIgnoreFile) {
|
|
|
65526
65798
|
const rules = [];
|
|
65527
65799
|
for (const source of sources) {
|
|
65528
65800
|
try {
|
|
65529
|
-
rules.push(...parseIgnoreFile(await
|
|
65801
|
+
rules.push(...parseIgnoreFile(await fs47.readFile(source), ""));
|
|
65530
65802
|
} catch {
|
|
65531
65803
|
}
|
|
65532
65804
|
}
|
|
65533
65805
|
return rules;
|
|
65534
65806
|
}
|
|
65535
|
-
async function walkFiles(
|
|
65807
|
+
async function walkFiles(fs47, root, options) {
|
|
65536
65808
|
const maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
|
|
65537
65809
|
const files = [];
|
|
65538
|
-
const baseRules = options.includeIgnored ? [] : await repositoryWideRules(
|
|
65810
|
+
const baseRules = options.includeIgnored ? [] : await repositoryWideRules(fs47, root, options.globalIgnoreFile);
|
|
65539
65811
|
const pending = [{ relative: "", rules: baseRules }];
|
|
65540
65812
|
while (pending.length > 0) {
|
|
65541
65813
|
if (options.signal?.aborted === true)
|
|
@@ -65544,14 +65816,14 @@ async function walkFiles(fs46, root, options) {
|
|
|
65544
65816
|
const absolute = relative.length > 0 ? import_node_path29.default.join(root, ...relative.split("/")) : root;
|
|
65545
65817
|
let entries;
|
|
65546
65818
|
try {
|
|
65547
|
-
entries = await
|
|
65819
|
+
entries = await fs47.readdir(absolute);
|
|
65548
65820
|
} catch {
|
|
65549
65821
|
continue;
|
|
65550
65822
|
}
|
|
65551
65823
|
let rules = inherited;
|
|
65552
65824
|
if (!options.includeIgnored && entries.some((entry) => entry.name === ".gitignore" && !entry.isDirectory)) {
|
|
65553
65825
|
try {
|
|
65554
|
-
const text2 = await
|
|
65826
|
+
const text2 = await fs47.readFile(import_node_path29.default.join(absolute, ".gitignore"));
|
|
65555
65827
|
rules = [...inherited, ...parseIgnoreFile(text2, relative)];
|
|
65556
65828
|
} catch {
|
|
65557
65829
|
}
|
|
@@ -65613,12 +65885,12 @@ function fileFilter(filePattern) {
|
|
|
65613
65885
|
const regex = globToRegExp(glob.startsWith("/") ? glob.slice(1) : glob, anchored);
|
|
65614
65886
|
return (relative) => regex.test(relative) !== exclude;
|
|
65615
65887
|
}
|
|
65616
|
-
async function searchFiles(
|
|
65888
|
+
async function searchFiles(fs47, root, options) {
|
|
65617
65889
|
const regex = compilePattern(options.pattern);
|
|
65618
65890
|
const admits = fileFilter(options.filePattern);
|
|
65619
65891
|
const context = options.contextLines ?? 2;
|
|
65620
65892
|
const maxOutput = options.maxOutputChars ?? DEFAULT_MAX_OUTPUT;
|
|
65621
|
-
const { files, truncated: walkTruncated } = await walkFiles(
|
|
65893
|
+
const { files, truncated: walkTruncated } = await walkFiles(fs47, root, options);
|
|
65622
65894
|
const separator = process.platform === "win32" ? "\\" : "/";
|
|
65623
65895
|
const chunks = [];
|
|
65624
65896
|
let size = 0;
|
|
@@ -65631,10 +65903,10 @@ async function searchFiles(fs46, root, options) {
|
|
|
65631
65903
|
const absolute = import_node_path29.default.join(root, ...relative.split("/"));
|
|
65632
65904
|
let bytes;
|
|
65633
65905
|
try {
|
|
65634
|
-
const stat = await
|
|
65906
|
+
const stat = await fs47.stat(absolute);
|
|
65635
65907
|
if (stat.size > MAX_FILE_BYTES)
|
|
65636
65908
|
continue;
|
|
65637
|
-
bytes = await
|
|
65909
|
+
bytes = await fs47.readBytes(absolute);
|
|
65638
65910
|
} catch {
|
|
65639
65911
|
continue;
|
|
65640
65912
|
}
|
|
@@ -67664,8 +67936,8 @@ function pick2(hubs, name) {
|
|
|
67664
67936
|
|
|
67665
67937
|
// ../../packages/core/dist/host/bridge.js
|
|
67666
67938
|
var import_node_os7 = __toESM(require("node:os"), 1);
|
|
67667
|
-
var
|
|
67668
|
-
var
|
|
67939
|
+
var import_node_fs14 = require("node:fs");
|
|
67940
|
+
var import_node_path56 = __toESM(require("node:path"), 1);
|
|
67669
67941
|
|
|
67670
67942
|
// ../../packages/core/dist/modes/autoGuidance.js
|
|
67671
67943
|
function idiomsFor(environment) {
|
|
@@ -69824,8 +70096,8 @@ var ChangeLedger = class {
|
|
|
69824
70096
|
this.chat = chat;
|
|
69825
70097
|
}
|
|
69826
70098
|
/** Best effort: a ledger that cannot be written must never fail an edit that happened. */
|
|
69827
|
-
record(
|
|
69828
|
-
const line = JSON.stringify({ chat: this.chat, path: normalizeForComparison(
|
|
70099
|
+
record(path67) {
|
|
70100
|
+
const line = JSON.stringify({ chat: this.chat, path: normalizeForComparison(path67), at: Date.now() });
|
|
69829
70101
|
void (0, import_promises24.appendFile)(this.file, `${line}
|
|
69830
70102
|
`).catch(() => void 0);
|
|
69831
70103
|
}
|
|
@@ -74107,7 +74379,7 @@ function backEdges(spec) {
|
|
|
74107
74379
|
visit(node.id);
|
|
74108
74380
|
return back;
|
|
74109
74381
|
}
|
|
74110
|
-
function
|
|
74382
|
+
function rank3(spec, back) {
|
|
74111
74383
|
const incoming = /* @__PURE__ */ new Map();
|
|
74112
74384
|
for (const node of spec.nodes)
|
|
74113
74385
|
incoming.set(node.id, []);
|
|
@@ -74168,7 +74440,7 @@ function order(spec, ranks, back) {
|
|
|
74168
74440
|
function layoutDiagram(spec) {
|
|
74169
74441
|
const sideways = spec.direction === "right";
|
|
74170
74442
|
const back = backEdges(spec);
|
|
74171
|
-
const ranks =
|
|
74443
|
+
const ranks = rank3(spec, back);
|
|
74172
74444
|
const rows = order(spec, ranks, back);
|
|
74173
74445
|
const byId = new Map(spec.nodes.map((node) => [node.id, node]));
|
|
74174
74446
|
const sizes = /* @__PURE__ */ new Map();
|
|
@@ -74832,10 +75104,10 @@ function isSafeSegment(value) {
|
|
|
74832
75104
|
function isSafeTagName(name) {
|
|
74833
75105
|
return /^[A-Za-z0-9._/-]+$/.test(name) && !name.startsWith("-") && !name.startsWith("/") && !name.endsWith("/") && !name.endsWith(".") && !name.endsWith(".lock") && !name.includes("..") && !name.includes("//") && !name.split("/").some((part) => part.startsWith("."));
|
|
74834
75106
|
}
|
|
74835
|
-
function encodeRepoPath(
|
|
74836
|
-
const segments =
|
|
75107
|
+
function encodeRepoPath(path67) {
|
|
75108
|
+
const segments = path67.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0);
|
|
74837
75109
|
if (segments.length === 0 || segments.some((segment) => segment === ".." || segment === ".")) {
|
|
74838
|
-
throw new AtlassianError(`"${
|
|
75110
|
+
throw new AtlassianError(`"${path67}" is not a file path inside the repository.`);
|
|
74839
75111
|
}
|
|
74840
75112
|
return segments.map(encodeURIComponent).join("/");
|
|
74841
75113
|
}
|
|
@@ -74920,24 +75192,24 @@ var BitbucketClient = class {
|
|
|
74920
75192
|
* redirect was followed, the login page came back, and the file "could not be read" although
|
|
74921
75193
|
* pull requests on the same repository could. `browse` is REST, so it authenticates like those.
|
|
74922
75194
|
*/
|
|
74923
|
-
async file(repo,
|
|
74924
|
-
const target = encodeRepoPath(
|
|
75195
|
+
async file(repo, path67, ref, signal) {
|
|
75196
|
+
const target = encodeRepoPath(path67);
|
|
74925
75197
|
const lines2 = [];
|
|
74926
75198
|
let start = 0;
|
|
74927
75199
|
for (let page = 0; page < MAX_FILE_PAGES; page += 1) {
|
|
74928
75200
|
const query = new URLSearchParams({ start: String(start), limit: String(FILE_PAGE_LINES) });
|
|
74929
75201
|
if (ref !== void 0 && ref.length > 0)
|
|
74930
75202
|
query.set("at", ref);
|
|
74931
|
-
const body = await this.rest.json(`reading ${
|
|
75203
|
+
const body = await this.rest.json(`reading ${path67}`, `${this.repoPath(repo)}/browse/${target}?${query.toString()}`, { method: "GET" }, signal);
|
|
74932
75204
|
if (body.children !== void 0) {
|
|
74933
75205
|
const names = (body.children.values ?? []).map((child) => {
|
|
74934
75206
|
const name = child.path?.toString ?? child.path?.name ?? "?";
|
|
74935
75207
|
return child.type === "DIRECTORY" ? `${name}/` : name;
|
|
74936
75208
|
});
|
|
74937
|
-
throw new AtlassianError(`${
|
|
75209
|
+
throw new AtlassianError(`${path67} is a folder, not a file. It holds: ${names.join(", ") || "nothing"}.`);
|
|
74938
75210
|
}
|
|
74939
75211
|
if (body.binary === true)
|
|
74940
|
-
throw new AtlassianError(`${
|
|
75212
|
+
throw new AtlassianError(`${path67} is a binary file, so there is no text to read.`);
|
|
74941
75213
|
for (const line of body.lines ?? [])
|
|
74942
75214
|
lines2.push(line.text ?? "");
|
|
74943
75215
|
if (body.isLastPage !== false || body.nextPageStart === void 0 || body.nextPageStart <= start)
|
|
@@ -75048,9 +75320,9 @@ var BitbucketClient = class {
|
|
|
75048
75320
|
return out;
|
|
75049
75321
|
}
|
|
75050
75322
|
/** A file's bytes at `at`, or undefined when it is not there. */
|
|
75051
|
-
async readBytes(repo,
|
|
75323
|
+
async readBytes(repo, path67, at, signal) {
|
|
75052
75324
|
try {
|
|
75053
|
-
return await this.rest.bytes(`reading ${
|
|
75325
|
+
return await this.rest.bytes(`reading ${path67}`, `${this.repoPath(repo)}/raw/${encodeRepoPath(path67)}?${new URLSearchParams({ at }).toString()}`, signal);
|
|
75054
75326
|
} catch (error51) {
|
|
75055
75327
|
if (error51 instanceof AtlassianError && error51.status === 404)
|
|
75056
75328
|
return void 0;
|
|
@@ -75874,8 +76146,8 @@ ${text2.slice(-2e4)}`);
|
|
|
75874
76146
|
}
|
|
75875
76147
|
/** Queues a build, then follows the queue item briefly to learn its number. */
|
|
75876
76148
|
async startBuild(job, parameters, signal) {
|
|
75877
|
-
const
|
|
75878
|
-
const response = await this.post(`starting ${job}`, parameters !== void 0 && Object.keys(parameters).length > 0 ? `${
|
|
76149
|
+
const path67 = jobPath(job, this.base);
|
|
76150
|
+
const response = await this.post(`starting ${job}`, parameters !== void 0 && Object.keys(parameters).length > 0 ? `${path67}/buildWithParameters` : `${path67}/build`, parameters ?? {}, signal);
|
|
75879
76151
|
const location = response.headers["location"];
|
|
75880
76152
|
const queueId = location === void 0 ? void 0 : /\/queue\/item\/(\d+)/.exec(location)?.[1];
|
|
75881
76153
|
if (queueId === void 0)
|
|
@@ -75912,10 +76184,10 @@ ${text2.slice(-2e4)}`);
|
|
|
75912
76184
|
}
|
|
75913
76185
|
/** Creates a job from a whole config.xml, in the folder its name gives (`folder/sub/new-job`). */
|
|
75914
76186
|
async createJob(job, xml, signal) {
|
|
75915
|
-
const
|
|
75916
|
-
const cut =
|
|
75917
|
-
const parent =
|
|
75918
|
-
const name = decodeURIComponent(
|
|
76187
|
+
const path67 = jobPath(job, this.base);
|
|
76188
|
+
const cut = path67.lastIndexOf("/job/");
|
|
76189
|
+
const parent = path67.slice(0, cut);
|
|
76190
|
+
const name = decodeURIComponent(path67.slice(cut + "/job/".length));
|
|
75919
76191
|
await this.postBody(`creating ${job}`, `${parent}/createItem?${new URLSearchParams({ name }).toString()}`, xml, "application/xml", signal);
|
|
75920
76192
|
}
|
|
75921
76193
|
/** Replaces a job's config.xml. */
|
|
@@ -76228,14 +76500,14 @@ ${client.base}${jobPath(job, client.base)}/${buildRef(params3.build)}/`
|
|
|
76228
76500
|
};
|
|
76229
76501
|
return tool;
|
|
76230
76502
|
}
|
|
76231
|
-
async function readJenkinsfile(
|
|
76232
|
-
const resolved = await resolveToolPath(context,
|
|
76503
|
+
async function readJenkinsfile(path67, context) {
|
|
76504
|
+
const resolved = await resolveToolPath(context, path67);
|
|
76233
76505
|
if (!resolved.ok)
|
|
76234
76506
|
return { ok: false, message: resolved.message };
|
|
76235
76507
|
try {
|
|
76236
76508
|
return { ok: true, text: await context.fs.readFile(resolved.realPath), realPath: resolved.realPath };
|
|
76237
76509
|
} catch (error51) {
|
|
76238
|
-
return { ok: false, message: `Could not read ${
|
|
76510
|
+
return { ok: false, message: `Could not read ${path67}: ${error51 instanceof Error ? error51.message : String(error51)}` };
|
|
76239
76511
|
}
|
|
76240
76512
|
}
|
|
76241
76513
|
var checkSchema = external_exports.object({
|
|
@@ -77011,9 +77283,9 @@ var AutosysClient = class _AutosysClient {
|
|
|
77011
77283
|
* Something this server may not offer at the documented address: undefined for a 404, so a tool can
|
|
77012
77284
|
* say which setting (`autosys.paths`) points elsewhere, rather than reporting "found nothing".
|
|
77013
77285
|
*/
|
|
77014
|
-
async optional(doing,
|
|
77286
|
+
async optional(doing, path67, signal) {
|
|
77015
77287
|
try {
|
|
77016
|
-
return asList(await this.rest.json(doing,
|
|
77288
|
+
return asList(await this.rest.json(doing, path67, { method: "GET" }, signal));
|
|
77017
77289
|
} catch (error51) {
|
|
77018
77290
|
if (error51 instanceof AtlassianError && error51.status === 404)
|
|
77019
77291
|
return void 0;
|
|
@@ -78316,13 +78588,13 @@ var MonitorHistoryStore = class {
|
|
|
78316
78588
|
if (!isSafeIndexName(index))
|
|
78317
78589
|
throw new MonitorHistoryError(`"${index}" is not a usable index name (lowercase letters, digits, - and _).`);
|
|
78318
78590
|
}
|
|
78319
|
-
async send(method,
|
|
78591
|
+
async send(method, path67, body) {
|
|
78320
78592
|
const headers = { "Content-Type": "application/json" };
|
|
78321
78593
|
const { username, password } = this.connection;
|
|
78322
78594
|
if (username !== void 0 && username.length > 0) {
|
|
78323
78595
|
headers.Authorization = `Basic ${Buffer.from(`${username}:${password ?? ""}`).toString("base64")}`;
|
|
78324
78596
|
}
|
|
78325
|
-
const url2 = `${this.connection.url.replace(/\/+$/, "")}/${encodeURIComponent(this.index)}${
|
|
78597
|
+
const url2 = `${this.connection.url.replace(/\/+$/, "")}/${encodeURIComponent(this.index)}${path67}`;
|
|
78326
78598
|
const request2 = { method, headers };
|
|
78327
78599
|
if (body !== void 0)
|
|
78328
78600
|
request2.body = JSON.stringify(body);
|
|
@@ -81961,7 +82233,7 @@ function message4(error51) {
|
|
|
81961
82233
|
}
|
|
81962
82234
|
function filesIn(params3) {
|
|
81963
82235
|
return [
|
|
81964
|
-
...(params3.attachments ?? []).map((
|
|
82236
|
+
...(params3.attachments ?? []).map((path67) => ({ path: path67, inline: false })),
|
|
81965
82237
|
...(params3.inlineImages ?? []).map((image) => ({ path: image.path, inline: true }))
|
|
81966
82238
|
];
|
|
81967
82239
|
}
|
|
@@ -82609,6 +82881,66 @@ function isTranscriptMessage(type) {
|
|
|
82609
82881
|
return TRANSCRIPT_MESSAGES.has(type);
|
|
82610
82882
|
}
|
|
82611
82883
|
|
|
82884
|
+
// ../../packages/core/dist/mcp/toolCache.js
|
|
82885
|
+
var import_node_fs8 = require("node:fs");
|
|
82886
|
+
var import_node_path49 = __toESM(require("node:path"), 1);
|
|
82887
|
+
var MAX_SERVERS = 200;
|
|
82888
|
+
function parse3(text2) {
|
|
82889
|
+
const out = {};
|
|
82890
|
+
let raw;
|
|
82891
|
+
try {
|
|
82892
|
+
raw = JSON.parse(text2);
|
|
82893
|
+
} catch {
|
|
82894
|
+
return out;
|
|
82895
|
+
}
|
|
82896
|
+
if (raw === null || typeof raw !== "object")
|
|
82897
|
+
return out;
|
|
82898
|
+
const servers = raw.servers;
|
|
82899
|
+
if (servers === null || typeof servers !== "object")
|
|
82900
|
+
return out;
|
|
82901
|
+
for (const [name, value] of Object.entries(servers)) {
|
|
82902
|
+
if (value === null || typeof value !== "object")
|
|
82903
|
+
continue;
|
|
82904
|
+
const entry = value;
|
|
82905
|
+
if (typeof entry.signature !== "string" || !Array.isArray(entry.tools))
|
|
82906
|
+
continue;
|
|
82907
|
+
const tools = entry.tools.filter((tool) => tool !== null && typeof tool === "object" && typeof tool.name === "string" && typeof tool.description === "string");
|
|
82908
|
+
out[name] = { signature: entry.signature, tools, at: typeof entry.at === "string" ? entry.at : "" };
|
|
82909
|
+
}
|
|
82910
|
+
return out;
|
|
82911
|
+
}
|
|
82912
|
+
function fileMcpToolCache(file2) {
|
|
82913
|
+
let writing = Promise.resolve();
|
|
82914
|
+
const read = async () => {
|
|
82915
|
+
try {
|
|
82916
|
+
return parse3(await import_node_fs8.promises.readFile(file2, "utf8"));
|
|
82917
|
+
} catch {
|
|
82918
|
+
return {};
|
|
82919
|
+
}
|
|
82920
|
+
};
|
|
82921
|
+
return {
|
|
82922
|
+
read,
|
|
82923
|
+
write(server, entry) {
|
|
82924
|
+
writing = writing.then(async () => {
|
|
82925
|
+
const servers = await read();
|
|
82926
|
+
servers[server] = entry;
|
|
82927
|
+
const names = Object.keys(servers);
|
|
82928
|
+
if (names.length > MAX_SERVERS) {
|
|
82929
|
+
names.sort((a, b) => (servers[a]?.at ?? "").localeCompare(servers[b]?.at ?? ""));
|
|
82930
|
+
for (const name of names.slice(0, names.length - MAX_SERVERS))
|
|
82931
|
+
delete servers[name];
|
|
82932
|
+
}
|
|
82933
|
+
await writeFileAtomically(file2, JSON.stringify({ version: 1, servers }));
|
|
82934
|
+
}).catch(() => void 0);
|
|
82935
|
+
return writing;
|
|
82936
|
+
}
|
|
82937
|
+
};
|
|
82938
|
+
}
|
|
82939
|
+
var MCP_TOOL_CACHE_FILE = "mcp-tools.json";
|
|
82940
|
+
function mcpToolCacheFile(dir) {
|
|
82941
|
+
return import_node_path49.default.join(dir, MCP_TOOL_CACHE_FILE);
|
|
82942
|
+
}
|
|
82943
|
+
|
|
82612
82944
|
// ../../packages/core/dist/host/approvalGate.js
|
|
82613
82945
|
var WebviewApprovalGate = class {
|
|
82614
82946
|
post;
|
|
@@ -82659,17 +82991,17 @@ var WebviewApprovalGate = class {
|
|
|
82659
82991
|
// ../../packages/core/dist/platform/node/filesystem.js
|
|
82660
82992
|
var import_promises29 = __toESM(require("node:fs/promises"), 1);
|
|
82661
82993
|
var NodeFileSystem = class {
|
|
82662
|
-
async readFile(
|
|
82663
|
-
return import_promises29.default.readFile(
|
|
82994
|
+
async readFile(path67) {
|
|
82995
|
+
return import_promises29.default.readFile(path67, "utf8");
|
|
82664
82996
|
}
|
|
82665
|
-
async readBytes(
|
|
82666
|
-
return import_promises29.default.readFile(
|
|
82997
|
+
async readBytes(path67) {
|
|
82998
|
+
return import_promises29.default.readFile(path67);
|
|
82667
82999
|
}
|
|
82668
|
-
async readBytesSlice(
|
|
83000
|
+
async readBytesSlice(path67, start, end) {
|
|
82669
83001
|
const length = Math.max(0, end - start);
|
|
82670
83002
|
if (length === 0)
|
|
82671
83003
|
return Buffer.alloc(0);
|
|
82672
|
-
const handle = await import_promises29.default.open(
|
|
83004
|
+
const handle = await import_promises29.default.open(path67, "r");
|
|
82673
83005
|
try {
|
|
82674
83006
|
const buffer = Buffer.alloc(length);
|
|
82675
83007
|
const { bytesRead } = await handle.read(buffer, 0, length, start);
|
|
@@ -82678,18 +83010,18 @@ var NodeFileSystem = class {
|
|
|
82678
83010
|
await handle.close();
|
|
82679
83011
|
}
|
|
82680
83012
|
}
|
|
82681
|
-
async writeFile(
|
|
82682
|
-
await import_promises29.default.writeFile(
|
|
83013
|
+
async writeFile(path67, contents) {
|
|
83014
|
+
await import_promises29.default.writeFile(path67, contents, "utf8");
|
|
82683
83015
|
}
|
|
82684
83016
|
/** The counterpart of `readBytes`, and deliberately as bare as `writeFile` beside it. */
|
|
82685
|
-
async writeBytes(
|
|
82686
|
-
await import_promises29.default.writeFile(
|
|
83017
|
+
async writeBytes(path67, contents) {
|
|
83018
|
+
await import_promises29.default.writeFile(path67, contents);
|
|
82687
83019
|
}
|
|
82688
83020
|
async rename(from, to) {
|
|
82689
83021
|
await replaceFile(from, to);
|
|
82690
83022
|
}
|
|
82691
|
-
async stat(
|
|
82692
|
-
const stat = await import_promises29.default.lstat(
|
|
83023
|
+
async stat(path67) {
|
|
83024
|
+
const stat = await import_promises29.default.lstat(path67);
|
|
82693
83025
|
return {
|
|
82694
83026
|
size: stat.size,
|
|
82695
83027
|
mtimeMs: stat.mtimeMs,
|
|
@@ -82698,8 +83030,8 @@ var NodeFileSystem = class {
|
|
|
82698
83030
|
isSymbolicLink: stat.isSymbolicLink()
|
|
82699
83031
|
};
|
|
82700
83032
|
}
|
|
82701
|
-
async readdir(
|
|
82702
|
-
const entries = await import_promises29.default.readdir(
|
|
83033
|
+
async readdir(path67) {
|
|
83034
|
+
const entries = await import_promises29.default.readdir(path67, { withFileTypes: true });
|
|
82703
83035
|
return entries.map((entry) => ({
|
|
82704
83036
|
name: entry.name,
|
|
82705
83037
|
isFile: entry.isFile(),
|
|
@@ -82707,21 +83039,21 @@ var NodeFileSystem = class {
|
|
|
82707
83039
|
isSymbolicLink: entry.isSymbolicLink()
|
|
82708
83040
|
}));
|
|
82709
83041
|
}
|
|
82710
|
-
async exists(
|
|
83042
|
+
async exists(path67) {
|
|
82711
83043
|
try {
|
|
82712
|
-
await import_promises29.default.access(
|
|
83044
|
+
await import_promises29.default.access(path67);
|
|
82713
83045
|
return true;
|
|
82714
83046
|
} catch {
|
|
82715
83047
|
return false;
|
|
82716
83048
|
}
|
|
82717
83049
|
}
|
|
82718
|
-
async mkdir(
|
|
82719
|
-
await import_promises29.default.mkdir(
|
|
83050
|
+
async mkdir(path67) {
|
|
83051
|
+
await import_promises29.default.mkdir(path67, { recursive: true });
|
|
82720
83052
|
}
|
|
82721
83053
|
};
|
|
82722
83054
|
|
|
82723
83055
|
// ../../packages/core/dist/config/project.js
|
|
82724
|
-
var
|
|
83056
|
+
var import_node_path50 = __toESM(require("node:path"), 1);
|
|
82725
83057
|
function configuredProjectName(config2) {
|
|
82726
83058
|
const name = config2?.project?.name?.trim();
|
|
82727
83059
|
return name !== void 0 && name.length > 0 ? name : void 0;
|
|
@@ -82730,7 +83062,7 @@ function projectName(config2, workspaceRoot) {
|
|
|
82730
83062
|
const configured = configuredProjectName(config2);
|
|
82731
83063
|
if (configured !== void 0)
|
|
82732
83064
|
return configured;
|
|
82733
|
-
return workspaceRoot === void 0 ? void 0 :
|
|
83065
|
+
return workspaceRoot === void 0 ? void 0 : import_node_path50.default.basename(import_node_path50.default.resolve(workspaceRoot));
|
|
82734
83066
|
}
|
|
82735
83067
|
function projectSlug(name) {
|
|
82736
83068
|
if (name === void 0)
|
|
@@ -82740,8 +83072,8 @@ function projectSlug(name) {
|
|
|
82740
83072
|
}
|
|
82741
83073
|
|
|
82742
83074
|
// ../../packages/core/dist/rag/renameIndexes.js
|
|
82743
|
-
var
|
|
82744
|
-
var
|
|
83075
|
+
var import_node_path51 = __toESM(require("node:path"), 1);
|
|
83076
|
+
var import_node_fs9 = require("node:fs");
|
|
82745
83077
|
function planIndexRenames(names) {
|
|
82746
83078
|
const plans = [];
|
|
82747
83079
|
for (const kind of ["codebase", "docs", "skills"]) {
|
|
@@ -82793,7 +83125,7 @@ async function copyIndex(options) {
|
|
|
82793
83125
|
async function copyBookkeeping(directory, from, to, storeId) {
|
|
82794
83126
|
let entries;
|
|
82795
83127
|
try {
|
|
82796
|
-
entries = await
|
|
83128
|
+
entries = await import_node_fs9.promises.readdir(directory);
|
|
82797
83129
|
} catch {
|
|
82798
83130
|
return [];
|
|
82799
83131
|
}
|
|
@@ -82804,7 +83136,7 @@ async function copyBookkeeping(directory, from, to, storeId) {
|
|
|
82804
83136
|
continue;
|
|
82805
83137
|
const target = `${to}@${storeId}.${entry.slice(prefix.length)}`;
|
|
82806
83138
|
try {
|
|
82807
|
-
await
|
|
83139
|
+
await import_node_fs9.promises.copyFile(import_node_path51.default.join(directory, entry), import_node_path51.default.join(directory, target), import_node_fs9.constants.COPYFILE_EXCL);
|
|
82808
83140
|
copied.push(target);
|
|
82809
83141
|
} catch {
|
|
82810
83142
|
}
|
|
@@ -82893,7 +83225,7 @@ var NodeTerminal = class {
|
|
|
82893
83225
|
|
|
82894
83226
|
// ../../packages/core/dist/platform/node/taskStore.js
|
|
82895
83227
|
var import_promises30 = __toESM(require("node:fs/promises"), 1);
|
|
82896
|
-
var
|
|
83228
|
+
var import_node_path52 = __toESM(require("node:path"), 1);
|
|
82897
83229
|
|
|
82898
83230
|
// ../../packages/core/dist/history/types.js
|
|
82899
83231
|
function taskSummary(task) {
|
|
@@ -82916,7 +83248,7 @@ var JsonTaskStore = class {
|
|
|
82916
83248
|
constructor(globalStoragePath, truncationStore, logger) {
|
|
82917
83249
|
this.truncationStore = truncationStore;
|
|
82918
83250
|
this.logger = logger;
|
|
82919
|
-
this.directory =
|
|
83251
|
+
this.directory = import_node_path52.default.join(globalStoragePath, "tasks");
|
|
82920
83252
|
}
|
|
82921
83253
|
async list(workspaceRoot) {
|
|
82922
83254
|
const index = await this.readIndex();
|
|
@@ -82965,11 +83297,11 @@ var JsonTaskStore = class {
|
|
|
82965
83297
|
await this.writeIndex(index.filter((entry) => entry.id !== id));
|
|
82966
83298
|
}
|
|
82967
83299
|
fileFor(id) {
|
|
82968
|
-
return
|
|
83300
|
+
return import_node_path52.default.join(this.directory, `${id}.json`);
|
|
82969
83301
|
}
|
|
82970
83302
|
async readIndex() {
|
|
82971
83303
|
try {
|
|
82972
|
-
const raw = await import_promises30.default.readFile(
|
|
83304
|
+
const raw = await import_promises30.default.readFile(import_node_path52.default.join(this.directory, INDEX_FILE), "utf8");
|
|
82973
83305
|
const parsed = JSON.parse(raw);
|
|
82974
83306
|
if (Array.isArray(parsed))
|
|
82975
83307
|
return parsed.filter(isIndexEntry);
|
|
@@ -83004,7 +83336,7 @@ var JsonTaskStore = class {
|
|
|
83004
83336
|
}
|
|
83005
83337
|
async writeIndex(entries) {
|
|
83006
83338
|
await import_promises30.default.mkdir(this.directory, { recursive: true });
|
|
83007
|
-
const target =
|
|
83339
|
+
const target = import_node_path52.default.join(this.directory, INDEX_FILE);
|
|
83008
83340
|
const temporary = `${target}.tmp`;
|
|
83009
83341
|
await import_promises30.default.writeFile(temporary, JSON.stringify(entries, null, 2), "utf8");
|
|
83010
83342
|
await replaceFile(temporary, target);
|
|
@@ -83048,8 +83380,8 @@ function isRecord3(value) {
|
|
|
83048
83380
|
}
|
|
83049
83381
|
|
|
83050
83382
|
// ../../packages/core/dist/usage/store.js
|
|
83051
|
-
var
|
|
83052
|
-
var
|
|
83383
|
+
var import_node_fs10 = require("node:fs");
|
|
83384
|
+
var import_node_path53 = __toESM(require("node:path"), 1);
|
|
83053
83385
|
|
|
83054
83386
|
// ../../packages/core/dist/s3/keys.js
|
|
83055
83387
|
function normalisePrefix(prefix) {
|
|
@@ -83182,7 +83514,7 @@ var FolderShardStore = class {
|
|
|
83182
83514
|
await this.ask({ action: "write", user: shardSegment(shard.user), day: shard.day, instance: shard.instance, events });
|
|
83183
83515
|
return;
|
|
83184
83516
|
}
|
|
83185
|
-
await this.writeAtomically(
|
|
83517
|
+
await this.writeAtomically(import_node_path53.default.join(this.root, shardSegment(shard.user), `${shard.day}__${shard.instance}.jsonl`), shardText(events));
|
|
83186
83518
|
}
|
|
83187
83519
|
async read(fromDay, toDay) {
|
|
83188
83520
|
this.lastProblems = [];
|
|
@@ -83202,8 +83534,8 @@ var FolderShardStore = class {
|
|
|
83202
83534
|
}
|
|
83203
83535
|
const files = await this.listFiles();
|
|
83204
83536
|
const wanted = selectShards(files, fromDay, toDay);
|
|
83205
|
-
const texts = await pooled(wanted, 8, (file2) =>
|
|
83206
|
-
this.lastProblems.push(`${
|
|
83537
|
+
const texts = await pooled(wanted, 8, (file2) => import_node_fs10.promises.readFile(import_node_path53.default.join(this.root, file2.user, file2.name), "utf8").catch((error51) => {
|
|
83538
|
+
this.lastProblems.push(`${import_node_path53.default.join(this.root, file2.user, file2.name)}: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
83207
83539
|
return "";
|
|
83208
83540
|
}));
|
|
83209
83541
|
return texts.flatMap(parseUsageLines);
|
|
@@ -83212,7 +83544,7 @@ var FolderShardStore = class {
|
|
|
83212
83544
|
async listFiles() {
|
|
83213
83545
|
let users;
|
|
83214
83546
|
try {
|
|
83215
|
-
users = (await
|
|
83547
|
+
users = (await import_node_fs10.promises.readdir(this.root, { withFileTypes: true })).filter((entry) => entry.isDirectory() && entry.name !== "_profiles").map((entry) => entry.name);
|
|
83216
83548
|
} catch (error51) {
|
|
83217
83549
|
if (error51.code === "ENOENT")
|
|
83218
83550
|
return [];
|
|
@@ -83220,10 +83552,10 @@ var FolderShardStore = class {
|
|
|
83220
83552
|
}
|
|
83221
83553
|
const files = [];
|
|
83222
83554
|
for (const user of users) {
|
|
83223
|
-
const folder =
|
|
83555
|
+
const folder = import_node_path53.default.join(this.root, user);
|
|
83224
83556
|
let names;
|
|
83225
83557
|
try {
|
|
83226
|
-
names = await
|
|
83558
|
+
names = await import_node_fs10.promises.readdir(folder);
|
|
83227
83559
|
} catch (error51) {
|
|
83228
83560
|
names = [];
|
|
83229
83561
|
this.lastProblems.push(`${folder}: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
@@ -83239,7 +83571,7 @@ var FolderShardStore = class {
|
|
|
83239
83571
|
}
|
|
83240
83572
|
async readShard(shard) {
|
|
83241
83573
|
try {
|
|
83242
|
-
return parseUsageLines(await
|
|
83574
|
+
return parseUsageLines(await import_node_fs10.promises.readFile(import_node_path53.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), "utf8"));
|
|
83243
83575
|
} catch (error51) {
|
|
83244
83576
|
if (error51.code === "ENOENT")
|
|
83245
83577
|
return void 0;
|
|
@@ -83247,10 +83579,10 @@ var FolderShardStore = class {
|
|
|
83247
83579
|
}
|
|
83248
83580
|
}
|
|
83249
83581
|
async putMonth(shard, events) {
|
|
83250
|
-
await this.writeAtomically(
|
|
83582
|
+
await this.writeAtomically(import_node_path53.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), shardText(events));
|
|
83251
83583
|
}
|
|
83252
83584
|
async removeShard(shard) {
|
|
83253
|
-
await
|
|
83585
|
+
await import_node_fs10.promises.rm(import_node_path53.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), { force: true });
|
|
83254
83586
|
}
|
|
83255
83587
|
async putProfile(user, profile) {
|
|
83256
83588
|
this.profilesFromRead = void 0;
|
|
@@ -83258,7 +83590,7 @@ var FolderShardStore = class {
|
|
|
83258
83590
|
await this.ask({ action: "writeProfile", user: shardSegment(user), profile: cleanProfile(profile) });
|
|
83259
83591
|
return;
|
|
83260
83592
|
}
|
|
83261
|
-
await this.writeAtomically(
|
|
83593
|
+
await this.writeAtomically(import_node_path53.default.join(this.root, "_profiles", `${shardSegment(user)}.json`), JSON.stringify(cleanProfile(profile)));
|
|
83262
83594
|
}
|
|
83263
83595
|
async readProfiles() {
|
|
83264
83596
|
if (this.profilesFromRead !== void 0)
|
|
@@ -83267,13 +83599,13 @@ var FolderShardStore = class {
|
|
|
83267
83599
|
await this.read("9999-12-31", "9999-12-31");
|
|
83268
83600
|
return this.profilesFromRead ?? {};
|
|
83269
83601
|
}
|
|
83270
|
-
const folder =
|
|
83602
|
+
const folder = import_node_path53.default.join(this.root, "_profiles");
|
|
83271
83603
|
const profiles = {};
|
|
83272
|
-
for (const name of await
|
|
83604
|
+
for (const name of await import_node_fs10.promises.readdir(folder).catch(() => [])) {
|
|
83273
83605
|
if (!name.endsWith(".json"))
|
|
83274
83606
|
continue;
|
|
83275
83607
|
try {
|
|
83276
|
-
profiles[name.slice(0, -5)] = cleanProfile(JSON.parse(await
|
|
83608
|
+
profiles[name.slice(0, -5)] = cleanProfile(JSON.parse(await import_node_fs10.promises.readFile(import_node_path53.default.join(folder, name), "utf8")));
|
|
83277
83609
|
} catch {
|
|
83278
83610
|
}
|
|
83279
83611
|
}
|
|
@@ -84088,8 +84420,8 @@ function usageCollectionOn(config2, choice) {
|
|
|
84088
84420
|
}
|
|
84089
84421
|
|
|
84090
84422
|
// ../../packages/core/dist/usage/backfill.js
|
|
84091
|
-
var
|
|
84092
|
-
var
|
|
84423
|
+
var import_node_fs11 = require("node:fs");
|
|
84424
|
+
var import_node_path54 = __toESM(require("node:path"), 1);
|
|
84093
84425
|
function comparablePath(value) {
|
|
84094
84426
|
return value.replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
|
|
84095
84427
|
}
|
|
@@ -84099,7 +84431,7 @@ function eventsFromTask(task, context) {
|
|
|
84099
84431
|
return [];
|
|
84100
84432
|
const created = typeof task.createdAt === "number" && task.createdAt <= updated ? task.createdAt : updated;
|
|
84101
84433
|
const root = typeof task.workspaceRoot === "string" ? task.workspaceRoot : void 0;
|
|
84102
|
-
const project = root !== void 0 && context.workspaceRoot !== void 0 && comparablePath(root) === comparablePath(context.workspaceRoot) ? context.project : root !== void 0 ?
|
|
84434
|
+
const project = root !== void 0 && context.workspaceRoot !== void 0 && comparablePath(root) === comparablePath(context.workspaceRoot) ? context.project : root !== void 0 ? import_node_path54.default.basename(root.replace(/\\/g, "/")) : void 0;
|
|
84103
84435
|
const skillsByPath = new Map(context.skills.map((skill) => [comparablePath(skill.filePath), skill]));
|
|
84104
84436
|
const skip = new Set(context.skip);
|
|
84105
84437
|
const calls = [];
|
|
@@ -84136,7 +84468,7 @@ function eventsFromTask(task, context) {
|
|
|
84136
84468
|
let skill;
|
|
84137
84469
|
if (call.name === "read_file" && typeof call.args["path"] === "string") {
|
|
84138
84470
|
const requested2 = call.args["path"];
|
|
84139
|
-
const absolute =
|
|
84471
|
+
const absolute = import_node_path54.default.isAbsolute(requested2) || /^[A-Za-z]:[\\/]/.test(requested2) || root === void 0 ? requested2 : import_node_path54.default.join(root, requested2);
|
|
84140
84472
|
skill = skillsByPath.get(comparablePath(absolute));
|
|
84141
84473
|
}
|
|
84142
84474
|
if (call.name === "use_skill_file" && typeof call.args["skill"] === "string") {
|
|
@@ -84173,7 +84505,7 @@ async function backfillFromTasks(tasksDir, context, helper) {
|
|
|
84173
84505
|
}
|
|
84174
84506
|
let names;
|
|
84175
84507
|
try {
|
|
84176
|
-
names = (await
|
|
84508
|
+
names = (await import_node_fs11.promises.readdir(tasksDir)).filter((name) => name.endsWith(".json") && name !== "index.json");
|
|
84177
84509
|
} catch {
|
|
84178
84510
|
return { events: [], tasks: 0, unreadable: 0, via: "node" };
|
|
84179
84511
|
}
|
|
@@ -84181,7 +84513,7 @@ async function backfillFromTasks(tasksDir, context, helper) {
|
|
|
84181
84513
|
let unreadable = 0;
|
|
84182
84514
|
for (const name of names) {
|
|
84183
84515
|
try {
|
|
84184
|
-
events.push(...eventsFromTask(JSON.parse(await
|
|
84516
|
+
events.push(...eventsFromTask(JSON.parse(await import_node_fs11.promises.readFile(import_node_path54.default.join(tasksDir, name), "utf8")), context));
|
|
84185
84517
|
} catch {
|
|
84186
84518
|
unreadable++;
|
|
84187
84519
|
}
|
|
@@ -84189,24 +84521,24 @@ async function backfillFromTasks(tasksDir, context, helper) {
|
|
|
84189
84521
|
return { events, tasks: names.length, unreadable, via: "node" };
|
|
84190
84522
|
}
|
|
84191
84523
|
async function backfillOnce(options) {
|
|
84192
|
-
const doneFile =
|
|
84524
|
+
const doneFile = import_node_path54.default.join(options.usageDir, "backfill.json");
|
|
84193
84525
|
for (const file2 of [doneFile, ...options.legacyDoneFile !== void 0 ? [options.legacyDoneFile] : []]) {
|
|
84194
|
-
if (await
|
|
84526
|
+
if (await import_node_fs11.promises.stat(file2).then(() => true, () => false))
|
|
84195
84527
|
return { ran: false };
|
|
84196
84528
|
}
|
|
84197
|
-
await
|
|
84198
|
-
const startFile =
|
|
84529
|
+
await import_node_fs11.promises.mkdir(options.usageDir, { recursive: true });
|
|
84530
|
+
const startFile = import_node_path54.default.join(options.usageDir, "backfill-start.json");
|
|
84199
84531
|
let before;
|
|
84200
84532
|
try {
|
|
84201
84533
|
before = (options.now ?? Date.now)();
|
|
84202
|
-
await
|
|
84534
|
+
await import_node_fs11.promises.writeFile(startFile, JSON.stringify({ before }), { encoding: "utf8", flag: "wx" });
|
|
84203
84535
|
} catch (error51) {
|
|
84204
84536
|
if (error51.code !== "EEXIST")
|
|
84205
84537
|
throw error51;
|
|
84206
84538
|
let claimed;
|
|
84207
84539
|
for (let attempt = 0; attempt < 40 && claimed === void 0; attempt++) {
|
|
84208
84540
|
try {
|
|
84209
|
-
const parsed = JSON.parse(await
|
|
84541
|
+
const parsed = JSON.parse(await import_node_fs11.promises.readFile(startFile, "utf8"));
|
|
84210
84542
|
if (typeof parsed.before === "number")
|
|
84211
84543
|
claimed = parsed.before;
|
|
84212
84544
|
} catch {
|
|
@@ -84243,12 +84575,12 @@ var params = external_exports.object({
|
|
|
84243
84575
|
limit: external_exports.number().int().min(1).max(2e5).optional().describe("events: at most this many rows, newest first (default 20000).")
|
|
84244
84576
|
});
|
|
84245
84577
|
function statsRange(input, now = Date.now()) {
|
|
84246
|
-
const
|
|
84247
|
-
const to = input.to !== void 0 ?
|
|
84578
|
+
const parse4 = (value, endOfDay) => Date.parse(`${value}T${endOfDay ? "23:59:59.999" : "00:00:00"}Z`);
|
|
84579
|
+
const to = input.to !== void 0 ? parse4(input.to, true) : now;
|
|
84248
84580
|
if (!Number.isFinite(to))
|
|
84249
84581
|
return { problem: `"${String(input.to)}" is not a date. Use YYYY-MM-DD.` };
|
|
84250
84582
|
if (input.from !== void 0) {
|
|
84251
|
-
const from =
|
|
84583
|
+
const from = parse4(input.from, false);
|
|
84252
84584
|
if (!Number.isFinite(from))
|
|
84253
84585
|
return { problem: `"${input.from}" is not a date. Use YYYY-MM-DD.` };
|
|
84254
84586
|
if (from > to)
|
|
@@ -84563,13 +84895,13 @@ var AuditIndex = class {
|
|
|
84563
84895
|
if (!isSafeIndexName(index))
|
|
84564
84896
|
throw new Error(`"${index}" is not a usable index name (lowercase letters, digits, - and _).`);
|
|
84565
84897
|
}
|
|
84566
|
-
async send(method,
|
|
84898
|
+
async send(method, path67, body, contentType2 = "application/json") {
|
|
84567
84899
|
const headers = { "Content-Type": contentType2 };
|
|
84568
84900
|
const { username, password } = this.connection;
|
|
84569
84901
|
if (username !== void 0 && username.length > 0) {
|
|
84570
84902
|
headers.Authorization = `Basic ${Buffer.from(`${username}:${password ?? ""}`).toString("base64")}`;
|
|
84571
84903
|
}
|
|
84572
|
-
const url2 = `${this.connection.url.replace(/\/+$/, "")}/${encodeURIComponent(this.index)}${
|
|
84904
|
+
const url2 = `${this.connection.url.replace(/\/+$/, "")}/${encodeURIComponent(this.index)}${path67}`;
|
|
84573
84905
|
const request2 = { method, headers };
|
|
84574
84906
|
if (body !== void 0)
|
|
84575
84907
|
request2.body = body;
|
|
@@ -84664,15 +84996,15 @@ var AuditIndex = class {
|
|
|
84664
84996
|
|
|
84665
84997
|
// ../../packages/core/dist/observers/journal.js
|
|
84666
84998
|
var import_node_crypto18 = require("node:crypto");
|
|
84667
|
-
var
|
|
84668
|
-
var
|
|
84999
|
+
var import_node_fs12 = require("node:fs");
|
|
85000
|
+
var import_node_path55 = __toESM(require("node:path"), 1);
|
|
84669
85001
|
function auditRoot(storageDir) {
|
|
84670
|
-
return
|
|
85002
|
+
return import_node_path55.default.join(storageDir, "audit");
|
|
84671
85003
|
}
|
|
84672
85004
|
function workspaceAuditFolder(workspace) {
|
|
84673
|
-
const resolved =
|
|
85005
|
+
const resolved = import_node_path55.default.resolve(workspace);
|
|
84674
85006
|
const key3 = process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
84675
|
-
const base =
|
|
85007
|
+
const base = import_node_path55.default.basename(key3).replace(/[^A-Za-z0-9._-]+/g, "-").slice(0, 40) || "workspace";
|
|
84676
85008
|
return `${base}-${(0, import_node_crypto18.createHash)("sha256").update(key3).digest("hex").slice(0, 10)}`;
|
|
84677
85009
|
}
|
|
84678
85010
|
function newSessionId() {
|
|
@@ -84688,17 +85020,17 @@ var AuditJournal = class {
|
|
|
84688
85020
|
folder;
|
|
84689
85021
|
constructor(storageDir, workspace, session) {
|
|
84690
85022
|
this.session = session;
|
|
84691
|
-
this.folder =
|
|
85023
|
+
this.folder = import_node_path55.default.join(auditRoot(storageDir), workspaceAuditFolder(workspace));
|
|
84692
85024
|
}
|
|
84693
85025
|
/** Appends in order; a failure is reported to `onError` and never blocks the next record. */
|
|
84694
85026
|
append(record2, onError) {
|
|
84695
85027
|
const line = `${JSON.stringify(record2)}
|
|
84696
85028
|
`;
|
|
84697
|
-
const file2 =
|
|
85029
|
+
const file2 = import_node_path55.default.join(this.folder, `${day(record2.at)}__${this.session}.jsonl`);
|
|
84698
85030
|
this.chain = this.chain.then(async () => {
|
|
84699
85031
|
try {
|
|
84700
|
-
await
|
|
84701
|
-
await
|
|
85032
|
+
await import_node_fs12.promises.mkdir(this.folder, { recursive: true });
|
|
85033
|
+
await import_node_fs12.promises.appendFile(file2, line, "utf8");
|
|
84702
85034
|
} catch (error51) {
|
|
84703
85035
|
onError(error51);
|
|
84704
85036
|
}
|
|
@@ -84714,11 +85046,11 @@ async function pruneAudit(storageDir, days, now = Date.now()) {
|
|
|
84714
85046
|
const cutoff = day(now - days * 864e5);
|
|
84715
85047
|
let removed = 0;
|
|
84716
85048
|
const root = auditRoot(storageDir);
|
|
84717
|
-
for (const folder of await
|
|
84718
|
-
for (const name of await
|
|
85049
|
+
for (const folder of await import_node_fs12.promises.readdir(root).catch(() => [])) {
|
|
85050
|
+
for (const name of await import_node_fs12.promises.readdir(import_node_path55.default.join(root, folder)).catch(() => [])) {
|
|
84719
85051
|
const fileDay = /^(\d{4}-\d{2}-\d{2})__/.exec(name)?.[1];
|
|
84720
85052
|
if (fileDay !== void 0 && fileDay < cutoff) {
|
|
84721
|
-
await
|
|
85053
|
+
await import_node_fs12.promises.rm(import_node_path55.default.join(root, folder, name), { force: true }).then(() => removed += 1, () => void 0);
|
|
84722
85054
|
}
|
|
84723
85055
|
}
|
|
84724
85056
|
}
|
|
@@ -84726,12 +85058,12 @@ async function pruneAudit(storageDir, days, now = Date.now()) {
|
|
|
84726
85058
|
}
|
|
84727
85059
|
async function readAudit(storageDir, workspace, query) {
|
|
84728
85060
|
const root = auditRoot(storageDir);
|
|
84729
|
-
const folders = query.allWorkspaces === true || workspace === void 0 ? await
|
|
85061
|
+
const folders = query.allWorkspaces === true || workspace === void 0 ? await import_node_fs12.promises.readdir(root).catch(() => []) : [workspaceAuditFolder(workspace)];
|
|
84730
85062
|
const fromDay = query.from !== void 0 ? day(query.from) : void 0;
|
|
84731
85063
|
const untilDay = query.until !== void 0 ? day(query.until) : void 0;
|
|
84732
85064
|
const files = [];
|
|
84733
85065
|
for (const folder of folders) {
|
|
84734
|
-
for (const name of await
|
|
85066
|
+
for (const name of await import_node_fs12.promises.readdir(import_node_path55.default.join(root, folder)).catch(() => [])) {
|
|
84735
85067
|
const fileDay = /^(\d{4}-\d{2}-\d{2})__(.+)\.jsonl$/.exec(name);
|
|
84736
85068
|
if (fileDay === null)
|
|
84737
85069
|
continue;
|
|
@@ -84741,7 +85073,7 @@ async function readAudit(storageDir, workspace, query) {
|
|
|
84741
85073
|
continue;
|
|
84742
85074
|
if (query.session !== void 0 && fileDay[2] !== query.session)
|
|
84743
85075
|
continue;
|
|
84744
|
-
files.push(
|
|
85076
|
+
files.push(import_node_path55.default.join(root, folder, name));
|
|
84745
85077
|
}
|
|
84746
85078
|
}
|
|
84747
85079
|
const needle = query.contains?.toLowerCase();
|
|
@@ -84751,7 +85083,7 @@ async function readAudit(storageDir, workspace, query) {
|
|
|
84751
85083
|
for (const file2 of files) {
|
|
84752
85084
|
let text2;
|
|
84753
85085
|
try {
|
|
84754
|
-
text2 = await
|
|
85086
|
+
text2 = await import_node_fs12.promises.readFile(file2, "utf8");
|
|
84755
85087
|
} catch (error51) {
|
|
84756
85088
|
unreadable.push(`${file2}: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
84757
85089
|
continue;
|
|
@@ -85689,8 +86021,8 @@ function createStrategyHistoryTool(deps) {
|
|
|
85689
86021
|
|
|
85690
86022
|
// ../../packages/core/dist/strategy/contractsTool.js
|
|
85691
86023
|
var item = external_exports.object({
|
|
85692
|
-
from: external_exports.string().min(1).describe(
|
|
85693
|
-
to: external_exports.string().min(1).describe(
|
|
86024
|
+
from: external_exports.string().min(1).describe(`The role that hands over, e.g. "programmer" - or a box's name, as the strategy text quotes it.`),
|
|
86025
|
+
to: external_exports.string().min(1).describe(`The role that receives it, e.g. "tester" - or a box's name, as the strategy text quotes it.`),
|
|
85694
86026
|
contract: external_exports.string().max(1e3).optional().describe("What passes along this connector, in a sentence."),
|
|
85695
86027
|
requires: external_exports.array(external_exports.string().trim().min(1).max(80)).max(10).optional().describe('The items the hand-over must contain, each a short name ("Changed files", "Tests run"). Light Code checks every one.')
|
|
85696
86028
|
});
|
|
@@ -85698,7 +86030,10 @@ var schema8 = external_exports.object({
|
|
|
85698
86030
|
contracts: external_exports.array(item).min(1).max(20).describe("One entry per connector to set. A connector is named by the two roles it joins.")
|
|
85699
86031
|
});
|
|
85700
86032
|
function findEdge(strategy, from, to) {
|
|
85701
|
-
const roleOf = (id) => strategy.nodes.find((n) => n.id === id)?.role
|
|
86033
|
+
const roleOf = (id) => strategy.nodes.find((n) => n.id === id)?.role ?? (() => {
|
|
86034
|
+
const group = strategy.groups?.find((g) => g.id === id);
|
|
86035
|
+
return group === void 0 ? void 0 : groupName(group).toLowerCase();
|
|
86036
|
+
})();
|
|
85702
86037
|
return strategy.edges.find((e) => roleOf(e.from) === from && roleOf(e.to) === to) ?? strategy.edges.find((e) => e.twoWay === true && roleOf(e.from) === to && roleOf(e.to) === from);
|
|
85703
86038
|
}
|
|
85704
86039
|
function applyContracts(strategy, params3, roleName) {
|
|
@@ -85834,13 +86169,13 @@ var TeamStore = class {
|
|
|
85834
86169
|
if (!isSafeIndexName(index))
|
|
85835
86170
|
throw new TeamStoreError(`"${index}" is not a usable index name (lowercase letters, digits, - and _).`);
|
|
85836
86171
|
}
|
|
85837
|
-
async send(method,
|
|
86172
|
+
async send(method, path67, body) {
|
|
85838
86173
|
const headers = { "Content-Type": "application/json" };
|
|
85839
86174
|
const { username, password } = this.connection;
|
|
85840
86175
|
if (username !== void 0 && username.length > 0) {
|
|
85841
86176
|
headers.Authorization = `Basic ${Buffer.from(`${username}:${password ?? ""}`).toString("base64")}`;
|
|
85842
86177
|
}
|
|
85843
|
-
const url2 = `${this.connection.url.replace(/\/+$/, "")}/${encodeURIComponent(this.index)}${
|
|
86178
|
+
const url2 = `${this.connection.url.replace(/\/+$/, "")}/${encodeURIComponent(this.index)}${path67}`;
|
|
85844
86179
|
const request2 = { method, headers };
|
|
85845
86180
|
if (body !== void 0)
|
|
85846
86181
|
request2.body = JSON.stringify(body);
|
|
@@ -86117,8 +86452,8 @@ function wireChatBridge(services) {
|
|
|
86117
86452
|
const workspaceBranch = workspaceRoot !== void 0 ? currentBranchOf(workspaceRoot) : void 0;
|
|
86118
86453
|
const machineApprovals = services.machineApprovalsFile !== void 0 ? new FileMachineApprovals(services.machineApprovalsFile) : void 0;
|
|
86119
86454
|
const mirrorRoot = services.mirrorRoot ?? storageDir;
|
|
86120
|
-
const personalSkillsDir = services.personalDir !== void 0 ?
|
|
86121
|
-
const personalToolsDir = services.personalDir !== void 0 ?
|
|
86455
|
+
const personalSkillsDir = services.personalDir !== void 0 ? import_node_path56.default.join(services.personalDir, "skills") : void 0;
|
|
86456
|
+
const personalToolsDir = services.personalDir !== void 0 ? import_node_path56.default.join(services.personalDir, "tools") : void 0;
|
|
86122
86457
|
const logger = new Logger({ level: "debug", sink: services.logSink });
|
|
86123
86458
|
let fastFsOps;
|
|
86124
86459
|
const fastFsAnswered = services.fastFs === void 0 ? Promise.resolve(void 0) : fastFsCapabilities(services.fastFs).then((answer) => {
|
|
@@ -86140,14 +86475,14 @@ function wireChatBridge(services) {
|
|
|
86140
86475
|
let cachedSecretValues = [];
|
|
86141
86476
|
const droppedFilesRoot2 = droppedFilesRoot();
|
|
86142
86477
|
const mailAttachmentsRoot2 = mailAttachmentsRoot();
|
|
86143
|
-
const droppedFilesDir =
|
|
86144
|
-
const truncationStore = new RecordingTruncationStore(new DiskTruncationStore(
|
|
86478
|
+
const droppedFilesDir = import_node_path56.default.join(droppedFilesRoot2, (0, import_node_crypto20.randomUUID)().slice(0, 8));
|
|
86479
|
+
const truncationStore = new RecordingTruncationStore(new DiskTruncationStore(import_node_path56.default.join(storageDir, "tool-results"), () => cachedSecretValues));
|
|
86145
86480
|
const taskStore = new JsonTaskStore(storageDir, truncationStore, logger);
|
|
86146
86481
|
const manifestsRoot = services.codebaseDir ?? storageDir;
|
|
86147
86482
|
const codebaseInstructionsFile = codebaseInstructionsPath({ codebaseDir: services.codebaseDir, storageDir, workspaceRoot: projectRoot });
|
|
86148
86483
|
if (services.codebaseDir !== void 0) {
|
|
86149
|
-
const shared =
|
|
86150
|
-
void import_promises31.default.access(shared).catch(() => import_promises31.default.cp(
|
|
86484
|
+
const shared = import_node_path56.default.join(services.codebaseDir, "index-manifests");
|
|
86485
|
+
void import_promises31.default.access(shared).catch(() => import_promises31.default.cp(import_node_path56.default.join(storageDir, "index-manifests"), shared, { recursive: true, errorOnExist: false, force: false })).catch(() => void 0);
|
|
86151
86486
|
}
|
|
86152
86487
|
const python = new PythonManager({
|
|
86153
86488
|
workspaceRoot,
|
|
@@ -86291,7 +86626,41 @@ ${preview.text}` } : {}
|
|
|
86291
86626
|
void postDatasetStatus();
|
|
86292
86627
|
}
|
|
86293
86628
|
});
|
|
86294
|
-
const
|
|
86629
|
+
const indexNames = /* @__PURE__ */ new WeakMap();
|
|
86630
|
+
function indexNamesFor(client) {
|
|
86631
|
+
const held = indexNames.get(client);
|
|
86632
|
+
if (held !== void 0 && Date.now() - held.at < 5 * 6e4)
|
|
86633
|
+
return held.names;
|
|
86634
|
+
const names = Promise.race([
|
|
86635
|
+
client.listIndexes().then((list2) => list2.map((i) => i.name)),
|
|
86636
|
+
new Promise((resolve) => setTimeout(() => resolve([]), 5e3).unref?.())
|
|
86637
|
+
]).catch(() => []);
|
|
86638
|
+
indexNames.set(client, { at: Date.now(), names });
|
|
86639
|
+
return names;
|
|
86640
|
+
}
|
|
86641
|
+
function early(promise2) {
|
|
86642
|
+
promise2.catch(() => void 0);
|
|
86643
|
+
return promise2;
|
|
86644
|
+
}
|
|
86645
|
+
let pythonConfiguring = Promise.resolve();
|
|
86646
|
+
function configurePython(config2) {
|
|
86647
|
+
const next = pythonConfiguring.catch(() => void 0).then(() => python.configure({ ...config2.python ?? {}, ...pythonFolders(config2) }));
|
|
86648
|
+
pythonConfiguring = next;
|
|
86649
|
+
return next;
|
|
86650
|
+
}
|
|
86651
|
+
let gitCheck;
|
|
86652
|
+
function gitAvailable() {
|
|
86653
|
+
if (gitCheck === void 0 || Date.now() - gitCheck.at > 6e4) {
|
|
86654
|
+
const answer = ShadowGit.isGitAvailable();
|
|
86655
|
+
gitCheck = { at: Date.now(), answer };
|
|
86656
|
+
void answer.then((ok) => {
|
|
86657
|
+
if (ok)
|
|
86658
|
+
gitCheck = { at: Number.POSITIVE_INFINITY, answer };
|
|
86659
|
+
});
|
|
86660
|
+
}
|
|
86661
|
+
return gitCheck.answer;
|
|
86662
|
+
}
|
|
86663
|
+
const defaultSkillsDir = workspaceRoot !== void 0 ? import_node_path56.default.join(workspaceRoot, ".lightcode", "skills") : void 0;
|
|
86295
86664
|
let skillsDir = defaultSkillsDir;
|
|
86296
86665
|
let localSkillsDir = defaultSkillsDir;
|
|
86297
86666
|
let extraSkillDirs = [];
|
|
@@ -86314,9 +86683,9 @@ ${preview.text}` } : {}
|
|
|
86314
86683
|
const trimmed = entry.trim();
|
|
86315
86684
|
if (trimmed.length === 0)
|
|
86316
86685
|
return void 0;
|
|
86317
|
-
if (
|
|
86318
|
-
return
|
|
86319
|
-
return workspaceRoot === void 0 ? void 0 :
|
|
86686
|
+
if (import_node_path56.default.isAbsolute(trimmed))
|
|
86687
|
+
return import_node_path56.default.resolve(trimmed);
|
|
86688
|
+
return workspaceRoot === void 0 ? void 0 : import_node_path56.default.resolve(workspaceRoot, trimmed);
|
|
86320
86689
|
}
|
|
86321
86690
|
function skillSearchPath() {
|
|
86322
86691
|
return [skillsDir, ...extraSkillDirs].filter((dir) => dir !== void 0);
|
|
@@ -86353,12 +86722,12 @@ ${preview.text}` } : {}
|
|
|
86353
86722
|
function watchSkillFolders() {
|
|
86354
86723
|
stopWatchingSkills();
|
|
86355
86724
|
const dirs = skillSearchPath();
|
|
86356
|
-
for (const dir of [...dirs, ...dirs.map((entry) =>
|
|
86725
|
+
for (const dir of [...dirs, ...dirs.map((entry) => import_node_path56.default.dirname(entry))]) {
|
|
86357
86726
|
try {
|
|
86358
86727
|
skillWatchers.push(
|
|
86359
86728
|
// Recursive, because a skill may be a folder with SKILL.md inside — a non-recursive
|
|
86360
86729
|
// watch sees the folder appear and then never hears about the file written into it.
|
|
86361
|
-
(0,
|
|
86730
|
+
(0, import_node_fs13.watch)(dir, { recursive: true }, () => {
|
|
86362
86731
|
if (skillWatchTimer !== void 0)
|
|
86363
86732
|
clearTimeout(skillWatchTimer);
|
|
86364
86733
|
skillWatchTimer = setTimeout(() => {
|
|
@@ -86430,7 +86799,7 @@ ${preview.text}` } : {}
|
|
|
86430
86799
|
await openInPanelEditor(filePath);
|
|
86431
86800
|
return;
|
|
86432
86801
|
}
|
|
86433
|
-
const real = await confineToAny(
|
|
86802
|
+
const real = await confineToAny(import_node_path56.default.resolve(filePath), roots);
|
|
86434
86803
|
await ui.openFile?.(real);
|
|
86435
86804
|
} catch (error51) {
|
|
86436
86805
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
@@ -86441,9 +86810,9 @@ ${preview.text}` } : {}
|
|
|
86441
86810
|
python.toolsDirectory(),
|
|
86442
86811
|
...skillsDir === void 0 ? [] : [skillsDir],
|
|
86443
86812
|
...extraSkillDirs.filter((dir) => dir !== void 0),
|
|
86444
|
-
|
|
86813
|
+
import_node_path56.default.join(storageDir, "reports"),
|
|
86445
86814
|
// Its own folder: nothing else lives there.
|
|
86446
|
-
...codebaseInstructionsFile === void 0 ? [] : [
|
|
86815
|
+
...codebaseInstructionsFile === void 0 ? [] : [import_node_path56.default.dirname(codebaseInstructionsFile)]
|
|
86447
86816
|
].filter((dir) => dir.length > 0);
|
|
86448
86817
|
}
|
|
86449
86818
|
function mostlyCrlf(text2) {
|
|
@@ -86452,17 +86821,17 @@ ${preview.text}` } : {}
|
|
|
86452
86821
|
}
|
|
86453
86822
|
const EDITOR_MAX_BYTES = 2 * 1024 * 1024;
|
|
86454
86823
|
async function openInPanelEditor(filePath) {
|
|
86455
|
-
const real = await confineToAny(
|
|
86824
|
+
const real = await confineToAny(import_node_path56.default.resolve(filePath), managedRoots());
|
|
86456
86825
|
const stat = await import_promises31.default.stat(real);
|
|
86457
86826
|
if (stat.size > EDITOR_MAX_BYTES)
|
|
86458
|
-
throw new Error(`${
|
|
86827
|
+
throw new Error(`${import_node_path56.default.basename(real)} is too large to edit here (${String(Math.round(stat.size / 1024))} KB).`);
|
|
86459
86828
|
const raw = await import_promises31.default.readFile(real, "utf8");
|
|
86460
86829
|
const crlf = mostlyCrlf(raw);
|
|
86461
|
-
post({ type: "editorFile", path: real, name:
|
|
86830
|
+
post({ type: "editorFile", path: real, name: import_node_path56.default.basename(real), content: raw.split("\r\n").join("\n"), mtimeMs: stat.mtimeMs, eol: crlf ? "crlf" : "lf" });
|
|
86462
86831
|
}
|
|
86463
86832
|
async function handleSaveEditorFile(filePath, content, mtimeMs) {
|
|
86464
86833
|
try {
|
|
86465
|
-
const real = await confineToAny(
|
|
86834
|
+
const real = await confineToAny(import_node_path56.default.resolve(filePath), managedRoots());
|
|
86466
86835
|
const current = await import_promises31.default.stat(real).catch(() => void 0);
|
|
86467
86836
|
if (current !== void 0 && Math.abs(current.mtimeMs - mtimeMs) > 1) {
|
|
86468
86837
|
post({
|
|
@@ -86470,7 +86839,7 @@ ${preview.text}` } : {}
|
|
|
86470
86839
|
path: real,
|
|
86471
86840
|
ok: false,
|
|
86472
86841
|
conflict: true,
|
|
86473
|
-
message: `${
|
|
86842
|
+
message: `${import_node_path56.default.basename(real)} was changed on disk after you opened it. Copy your text, close the editor, and open it again to see the new version.`
|
|
86474
86843
|
});
|
|
86475
86844
|
return;
|
|
86476
86845
|
}
|
|
@@ -86494,7 +86863,7 @@ ${preview.text}` } : {}
|
|
|
86494
86863
|
await handleOpenManagedFile(existing.filePath);
|
|
86495
86864
|
return;
|
|
86496
86865
|
}
|
|
86497
|
-
const target =
|
|
86866
|
+
const target = import_node_path56.default.join(skillsDir, "standing-instructions.md");
|
|
86498
86867
|
try {
|
|
86499
86868
|
await import_promises31.default.mkdir(skillsDir, { recursive: true });
|
|
86500
86869
|
await import_promises31.default.writeFile(target, STANDING_SKILL_TEMPLATE, { encoding: "utf8", flag: "wx" });
|
|
@@ -86514,7 +86883,7 @@ ${preview.text}` } : {}
|
|
|
86514
86883
|
return;
|
|
86515
86884
|
}
|
|
86516
86885
|
try {
|
|
86517
|
-
await import_promises31.default.mkdir(
|
|
86886
|
+
await import_promises31.default.mkdir(import_node_path56.default.dirname(codebaseInstructionsFile), { recursive: true });
|
|
86518
86887
|
await import_promises31.default.writeFile(codebaseInstructionsFile, "", { encoding: "utf8", flag: "wx" });
|
|
86519
86888
|
} catch (error51) {
|
|
86520
86889
|
if (error51.code !== "EEXIST") {
|
|
@@ -86531,11 +86900,11 @@ ${preview.text}` } : {}
|
|
|
86531
86900
|
return;
|
|
86532
86901
|
if (!isValidToolName(name))
|
|
86533
86902
|
throw new Error(`"${name}" is not a valid tool name.`);
|
|
86534
|
-
const ownCopy =
|
|
86903
|
+
const ownCopy = import_node_path56.default.join(dir, toolFileName(name));
|
|
86535
86904
|
if (filePath !== void 0) {
|
|
86536
|
-
const same2 = (a, b) => normalizeForComparison(
|
|
86905
|
+
const same2 = (a, b) => normalizeForComparison(import_node_path56.default.resolve(a)) === normalizeForComparison(import_node_path56.default.resolve(b));
|
|
86537
86906
|
if (!same2(filePath, ownCopy)) {
|
|
86538
|
-
const fromBucket = mirroredToolsDirs.some((mirror) => same2(
|
|
86907
|
+
const fromBucket = mirroredToolsDirs.some((mirror) => same2(import_node_path56.default.dirname(filePath), mirror));
|
|
86539
86908
|
throw new Error(fromBucket ? `"${name}" at ${filePath} comes from a bucket folder, so deleting it here would be undone by the next sync. Decline it to hide this version, or remove it from the bucket to remove it for everyone.` : `${filePath} is not in the tools folder this machine writes to (${dir}), so it was not deleted.`);
|
|
86540
86909
|
}
|
|
86541
86910
|
}
|
|
@@ -86561,7 +86930,7 @@ ${preview.text}` } : {}
|
|
|
86561
86930
|
let dir;
|
|
86562
86931
|
let filePath = "";
|
|
86563
86932
|
for (const candidate of python.toolDirectories()) {
|
|
86564
|
-
const attempt =
|
|
86933
|
+
const attempt = import_node_path56.default.join(candidate, toolFileName(name));
|
|
86565
86934
|
if (await onDisk(attempt)) {
|
|
86566
86935
|
dir = candidate;
|
|
86567
86936
|
filePath = attempt;
|
|
@@ -86592,7 +86961,7 @@ ${preview.text}` } : {}
|
|
|
86592
86961
|
function samePath(a, b) {
|
|
86593
86962
|
if (a === void 0 || b === void 0)
|
|
86594
86963
|
return false;
|
|
86595
|
-
const norm2 = (value) => process.platform === "win32" ?
|
|
86964
|
+
const norm2 = (value) => process.platform === "win32" ? import_node_path56.default.resolve(value).toLowerCase() : import_node_path56.default.resolve(value);
|
|
86596
86965
|
return norm2(a) === norm2(b);
|
|
86597
86966
|
}
|
|
86598
86967
|
function publishFolder(kind, mirrors) {
|
|
@@ -86701,7 +87070,7 @@ ${preview.text}` } : {}
|
|
|
86701
87070
|
target,
|
|
86702
87071
|
...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {},
|
|
86703
87072
|
relative: entry,
|
|
86704
|
-
contents: await import_promises31.default.readFile(
|
|
87073
|
+
contents: await import_promises31.default.readFile(import_node_path56.default.join(dir, entry))
|
|
86705
87074
|
});
|
|
86706
87075
|
uploaded += 1;
|
|
86707
87076
|
} catch (error51) {
|
|
@@ -86723,7 +87092,7 @@ ${preview.text}` } : {}
|
|
|
86723
87092
|
if (!isValidToolName(name))
|
|
86724
87093
|
throw new Error(`"${name}" is not a valid tool name.`);
|
|
86725
87094
|
for (const candidate of python.toolDirectories()) {
|
|
86726
|
-
const attempt =
|
|
87095
|
+
const attempt = import_node_path56.default.join(candidate, toolFileName(name));
|
|
86727
87096
|
try {
|
|
86728
87097
|
post({ type: "pythonToolSource", name, source: await import_promises31.default.readFile(attempt, "utf8") });
|
|
86729
87098
|
return;
|
|
@@ -86776,7 +87145,7 @@ ${preview.text}` } : {}
|
|
|
86776
87145
|
continue;
|
|
86777
87146
|
for (const candidate of python.toolDirectories()) {
|
|
86778
87147
|
try {
|
|
86779
|
-
const source = await import_promises31.default.readFile(
|
|
87148
|
+
const source = await import_promises31.default.readFile(import_node_path56.default.join(candidate, toolFileName(name)), "utf8");
|
|
86780
87149
|
declined[name] = hashSource(source);
|
|
86781
87150
|
recorded += 1;
|
|
86782
87151
|
break;
|
|
@@ -86790,7 +87159,7 @@ ${preview.text}` } : {}
|
|
|
86790
87159
|
});
|
|
86791
87160
|
{
|
|
86792
87161
|
const latest = (await configManager.load()).config;
|
|
86793
|
-
await
|
|
87162
|
+
await configurePython(latest);
|
|
86794
87163
|
}
|
|
86795
87164
|
await python.refresh();
|
|
86796
87165
|
await postPython();
|
|
@@ -86810,7 +87179,7 @@ ${preview.text}` } : {}
|
|
|
86810
87179
|
});
|
|
86811
87180
|
{
|
|
86812
87181
|
const latest = (await configManager.load()).config;
|
|
86813
|
-
await
|
|
87182
|
+
await configurePython(latest);
|
|
86814
87183
|
}
|
|
86815
87184
|
await python.refresh();
|
|
86816
87185
|
await postPython();
|
|
@@ -86834,7 +87203,7 @@ ${preview.text}` } : {}
|
|
|
86834
87203
|
let dir;
|
|
86835
87204
|
let filePath = "";
|
|
86836
87205
|
for (const candidate of python.toolDirectories()) {
|
|
86837
|
-
const attempt =
|
|
87206
|
+
const attempt = import_node_path56.default.join(candidate, toolFileName(name));
|
|
86838
87207
|
if (await onDisk(attempt)) {
|
|
86839
87208
|
dir = candidate;
|
|
86840
87209
|
filePath = attempt;
|
|
@@ -86860,7 +87229,7 @@ ${preview.text}` } : {}
|
|
|
86860
87229
|
function mirrorForDir(sourceDir) {
|
|
86861
87230
|
if (sourceDir === void 0)
|
|
86862
87231
|
return void 0;
|
|
86863
|
-
const wanted =
|
|
87232
|
+
const wanted = import_node_path56.default.resolve(sourceDir).toLowerCase();
|
|
86864
87233
|
for (const mirror of cachedSkillMirrors) {
|
|
86865
87234
|
if (mirror.enabled !== true)
|
|
86866
87235
|
continue;
|
|
@@ -86870,7 +87239,7 @@ ${preview.text}` } : {}
|
|
|
86870
87239
|
kind: "skills",
|
|
86871
87240
|
...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}
|
|
86872
87241
|
});
|
|
86873
|
-
if (
|
|
87242
|
+
if (import_node_path56.default.resolve(localDir).toLowerCase() === wanted)
|
|
86874
87243
|
return { mirror, localDir };
|
|
86875
87244
|
}
|
|
86876
87245
|
return void 0;
|
|
@@ -86935,8 +87304,8 @@ ${preview.text}` } : {}
|
|
|
86935
87304
|
});
|
|
86936
87305
|
let localProblem;
|
|
86937
87306
|
try {
|
|
86938
|
-
await import_promises31.default.rm(
|
|
86939
|
-
await import_promises31.default.rm(
|
|
87307
|
+
await import_promises31.default.rm(import_node_path56.default.join(found2.localDir, `${name}.md`), { force: true });
|
|
87308
|
+
await import_promises31.default.rm(import_node_path56.default.join(found2.localDir, name), { recursive: true, force: true });
|
|
86940
87309
|
} catch (error51) {
|
|
86941
87310
|
localProblem = error51 instanceof Error ? error51.message : String(error51);
|
|
86942
87311
|
}
|
|
@@ -86971,7 +87340,7 @@ ${preview.text}` } : {}
|
|
|
86971
87340
|
throw new Error(`"${name}" lives in ${existing.sourceDir}, which is a read-only skills folder. Delete the file there, or remove the folder in Settings.`);
|
|
86972
87341
|
}
|
|
86973
87342
|
const from = existing?.sourceDir !== void 0 && samePath(existing.sourceDir, personalSkillsDir) ? existing.sourceDir : skillsDir;
|
|
86974
|
-
await import_promises31.default.rm(
|
|
87343
|
+
await import_promises31.default.rm(import_node_path56.default.join(from, skillFileName(name)), { force: true });
|
|
86975
87344
|
await postSkills();
|
|
86976
87345
|
} catch (error51) {
|
|
86977
87346
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
@@ -87156,7 +87525,7 @@ ${preview.text}` } : {}
|
|
|
87156
87525
|
let scheduleToolAccess;
|
|
87157
87526
|
const approvalsKey = projectRoot ?? "__no_workspace__";
|
|
87158
87527
|
function comparableApprovalsKey(key3) {
|
|
87159
|
-
return key3 === "__no_workspace__" ? key3 : normalizeForComparison(
|
|
87528
|
+
return key3 === "__no_workspace__" ? key3 : normalizeForComparison(import_node_path56.default.resolve(key3));
|
|
87160
87529
|
}
|
|
87161
87530
|
function approvalsFrom(stored) {
|
|
87162
87531
|
if (stored === void 0)
|
|
@@ -87370,7 +87739,7 @@ ${preview.text}` } : {}
|
|
|
87370
87739
|
...taskExpertEstimate === void 0 ? {} : { estimate: taskExpertEstimate }
|
|
87371
87740
|
});
|
|
87372
87741
|
}
|
|
87373
|
-
const expertEventsPath =
|
|
87742
|
+
const expertEventsPath = import_node_path56.default.join(storageDir, "expert-events.jsonl");
|
|
87374
87743
|
let expertEvents;
|
|
87375
87744
|
let juniorTurnWithoutExpert = false;
|
|
87376
87745
|
async function loadExpertEvents() {
|
|
@@ -87398,7 +87767,7 @@ ${preview.text}` } : {}
|
|
|
87398
87767
|
try {
|
|
87399
87768
|
const events = await loadExpertEvents();
|
|
87400
87769
|
events.push(event);
|
|
87401
|
-
await import_promises31.default.mkdir(
|
|
87770
|
+
await import_promises31.default.mkdir(import_node_path56.default.dirname(expertEventsPath), { recursive: true });
|
|
87402
87771
|
await import_promises31.default.appendFile(expertEventsPath, `${JSON.stringify(event)}
|
|
87403
87772
|
`, "utf8");
|
|
87404
87773
|
} catch (error51) {
|
|
@@ -87686,15 +88055,15 @@ ${preview.text}` } : {}
|
|
|
87686
88055
|
function contextMentionPath(file2) {
|
|
87687
88056
|
if (workspaceRoot === void 0)
|
|
87688
88057
|
return file2;
|
|
87689
|
-
const relative =
|
|
87690
|
-
return relative.length > 0 && !relative.startsWith("..") && !
|
|
88058
|
+
const relative = import_node_path56.default.relative(workspaceRoot, file2);
|
|
88059
|
+
return relative.length > 0 && !relative.startsWith("..") && !import_node_path56.default.isAbsolute(relative) ? relative.split(import_node_path56.default.sep).join("/") : file2;
|
|
87691
88060
|
}
|
|
87692
88061
|
function hostCapabilities() {
|
|
87693
88062
|
return {
|
|
87694
88063
|
// The branch this window or tab works on, shown under the chat's name; and the repository, when this
|
|
87695
88064
|
// folder is one of its branch folders (git/worktrees.ts).
|
|
87696
88065
|
...workspaceBranch !== void 0 ? { workspaceBranch } : {},
|
|
87697
|
-
...projectRoot !== void 0 && workspaceRoot !== void 0 && projectRoot !== workspaceRoot ? { branchFolderOf:
|
|
88066
|
+
...projectRoot !== void 0 && workspaceRoot !== void 0 && projectRoot !== workspaceRoot ? { branchFolderOf: import_node_path56.default.basename(projectRoot) } : {},
|
|
87698
88067
|
// The GitHub Copilot preset, offered only where VS Code's models can be reached.
|
|
87699
88068
|
hostModels: services.languageModels !== void 0,
|
|
87700
88069
|
nativeGuide: ui.openWalkthrough !== void 0,
|
|
@@ -87774,7 +88143,10 @@ ${preview.text}` } : {}
|
|
|
87774
88143
|
} catch {
|
|
87775
88144
|
return true;
|
|
87776
88145
|
}
|
|
87777
|
-
}
|
|
88146
|
+
},
|
|
88147
|
+
// Shared by every chat of a codebase in Fire Code (`codebaseDir`), so a chat starting after a crash or a
|
|
88148
|
+
// sleep offers the servers' tools at once instead of waiting for each to start (`mcp/toolCache.ts`).
|
|
88149
|
+
fileMcpToolCache(mcpToolCacheFile(services.codebaseDir ?? storageDir))
|
|
87778
88150
|
);
|
|
87779
88151
|
function postMcp() {
|
|
87780
88152
|
const servers = mcp.states_();
|
|
@@ -88257,14 +88629,14 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
88257
88629
|
}
|
|
88258
88630
|
function readUserNpmrc() {
|
|
88259
88631
|
try {
|
|
88260
|
-
return (0,
|
|
88632
|
+
return (0, import_node_fs14.readFileSync)(process.env["NPM_CONFIG_USERCONFIG"] ?? import_node_path56.default.join(import_node_os7.default.homedir(), ".npmrc"), "utf8");
|
|
88261
88633
|
} catch {
|
|
88262
88634
|
return void 0;
|
|
88263
88635
|
}
|
|
88264
88636
|
}
|
|
88265
88637
|
function addonFolders(config2) {
|
|
88266
88638
|
return {
|
|
88267
|
-
configured: (config2.addons?.folders ?? []).map((folder) =>
|
|
88639
|
+
configured: (config2.addons?.folders ?? []).map((folder) => import_node_path56.default.resolve(folder)),
|
|
88268
88640
|
defaults: defaultAddonFolders(process.env, process.execPath, process.platform, readUserNpmrc())
|
|
88269
88641
|
};
|
|
88270
88642
|
}
|
|
@@ -88545,7 +88917,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
88545
88917
|
}
|
|
88546
88918
|
async function handleSaveAddonFolders(folders) {
|
|
88547
88919
|
const cleaned = [...new Set(folders.map((folder) => folder.trim()).filter((folder) => folder.length > 0))];
|
|
88548
|
-
const relative = cleaned.find((folder) => !
|
|
88920
|
+
const relative = cleaned.find((folder) => !import_node_path56.default.isAbsolute(folder));
|
|
88549
88921
|
if (relative !== void 0) {
|
|
88550
88922
|
await postAddons(`"${relative}" is not a full path. Add-on folders are full paths, such as C:\\addons.`);
|
|
88551
88923
|
return;
|
|
@@ -88556,7 +88928,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
88556
88928
|
postMcp();
|
|
88557
88929
|
await postAddons();
|
|
88558
88930
|
}
|
|
88559
|
-
const shadowGit = workspaceRoot !== void 0 ? new ShadowGit(workspaceRoot,
|
|
88931
|
+
const shadowGit = workspaceRoot !== void 0 ? new ShadowGit(workspaceRoot, import_node_path56.default.join(storageDir, "checkpoints", "shadow.git"), services.codebaseDir !== void 0 ? import_node_path56.default.join(services.codebaseDir, "checkpoint-objects") : void 0) : void 0;
|
|
88560
88932
|
async function postProfiles() {
|
|
88561
88933
|
const { config: config2 } = await configManager.load();
|
|
88562
88934
|
const profiles = await Promise.all((config2.profiles ?? []).map((profile) => toSummary(profile, secrets)));
|
|
@@ -88725,7 +89097,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
88725
89097
|
await observerHub.configure(settings);
|
|
88726
89098
|
if (restart)
|
|
88727
89099
|
await observerHub.restart();
|
|
88728
|
-
auditRecordExists = settings.auditor.enabled || (0,
|
|
89100
|
+
auditRecordExists = settings.auditor.enabled || (0, import_node_fs14.existsSync)(observerHub.journalFolder);
|
|
88729
89101
|
if (settings.auditor.enabled && !auditPruned) {
|
|
88730
89102
|
auditPruned = true;
|
|
88731
89103
|
void pruneAudit(storageDir, o.auditor?.retentionDays ?? 90).then((n) => {
|
|
@@ -88770,7 +89142,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
88770
89142
|
return;
|
|
88771
89143
|
}
|
|
88772
89144
|
if (ui.openFile !== void 0)
|
|
88773
|
-
await ui.openFile(
|
|
89145
|
+
await ui.openFile(import_node_path56.default.join(folder, newest));
|
|
88774
89146
|
else
|
|
88775
89147
|
ui.showInfo(`The audit journal is in ${folder} (newest: ${newest}).`);
|
|
88776
89148
|
}
|
|
@@ -88808,7 +89180,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
88808
89180
|
async function handleOpenArtifact(relative, how) {
|
|
88809
89181
|
if (workspaceRoot === void 0)
|
|
88810
89182
|
return;
|
|
88811
|
-
const absolute = await confine(
|
|
89183
|
+
const absolute = await confine(import_node_path56.default.resolve(workspaceRoot, relative), workspaceRoot);
|
|
88812
89184
|
if (await denylist.isDenied(absolute)) {
|
|
88813
89185
|
ui.showWarning(`${relative} is on the deny list, so it is not opened.`);
|
|
88814
89186
|
return;
|
|
@@ -88921,7 +89293,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
88921
89293
|
return { ok: true, message: `Saved in ${file2}; it reaches colleagues through this project's own sharing.` };
|
|
88922
89294
|
}
|
|
88923
89295
|
const enabled = cachedToolMirrors.filter((each) => each.enabled === true);
|
|
88924
|
-
const index = mirroredToolsDirs.findIndex((dir) => samePath(
|
|
89296
|
+
const index = mirroredToolsDirs.findIndex((dir) => samePath(import_node_path56.default.dirname(file2), dir));
|
|
88925
89297
|
try {
|
|
88926
89298
|
await writeFileAtomically(file2, review.content);
|
|
88927
89299
|
const mirror = index >= 0 ? enabled[index] : void 0;
|
|
@@ -88929,7 +89301,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
88929
89301
|
const target = targetById(cachedS3, mirror.connectionId);
|
|
88930
89302
|
if (target === void 0 || target.readOnly === true)
|
|
88931
89303
|
return { ok: false, message: `${target?.label ?? mirror.connectionId} is read-only here, so the approved tool cannot be published from this computer.` };
|
|
88932
|
-
await uploadToS3({ target, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, relative:
|
|
89304
|
+
await uploadToS3({ target, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, relative: import_node_path56.default.basename(file2), contents: Buffer.from(review.content, "utf8") });
|
|
88933
89305
|
return { ok: true, message: `Uploaded to the bucket ${target.label}; colleagues get it at their next sync and approve its code once, as for any tool.` };
|
|
88934
89306
|
}
|
|
88935
89307
|
scheduleTeamRepoPush();
|
|
@@ -89211,7 +89583,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
89211
89583
|
}
|
|
89212
89584
|
function composerDraftFile() {
|
|
89213
89585
|
const id = (0, import_node_crypto20.createHash)("sha256").update((workspaceRoot ?? "").toLowerCase()).digest("hex").slice(0, 16);
|
|
89214
|
-
return
|
|
89586
|
+
return import_node_path56.default.join(storageDir, "drafts", `${id}.txt`);
|
|
89215
89587
|
}
|
|
89216
89588
|
let draftWrites = Promise.resolve();
|
|
89217
89589
|
function saveComposerDraft(text2) {
|
|
@@ -89504,8 +89876,19 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
89504
89876
|
await knownSecretValues();
|
|
89505
89877
|
const profile = resolveActiveProfile(config2);
|
|
89506
89878
|
const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
|
|
89507
|
-
const
|
|
89508
|
-
const
|
|
89879
|
+
const windowReady = early(reportedWindowFor(config2, profile));
|
|
89880
|
+
const expertReady = early(resolveExpert(config2));
|
|
89881
|
+
const skillsReady = early(refreshSkills());
|
|
89882
|
+
const instructionsReady = early(readCodebaseInstructions(codebaseInstructionsFile));
|
|
89883
|
+
const toolsReady = early((async () => {
|
|
89884
|
+
await syncMcpFromConfig(config2);
|
|
89885
|
+
const still = await mcp.ensureReady();
|
|
89886
|
+
if (still.length > 0)
|
|
89887
|
+
logger.info(`[startup] replying without waiting longer for MCP server(s) still starting: ${still.join(", ")}`);
|
|
89888
|
+
await configurePython(config2);
|
|
89889
|
+
})());
|
|
89890
|
+
const capabilities = withReportedWindow(resolveModelCapabilities(profile.model, profile.modelCapabilities), await windowReady, profile.modelCapabilities);
|
|
89891
|
+
const expertCliInfo = await expertReady;
|
|
89509
89892
|
const search = await resolveSearch(config2);
|
|
89510
89893
|
const embedder = await resolveEmbedder(config2);
|
|
89511
89894
|
const codebaseIndex = codebaseIndexName(config2);
|
|
@@ -89513,9 +89896,9 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
89513
89896
|
const teamSkillsResolved = resolveTeamSkills(config2, search, embedder);
|
|
89514
89897
|
const mailCollection = config2.mail?.enabled === true ? mailCollectionName(config2) : void 0;
|
|
89515
89898
|
const mailSearch = mailCollection === void 0 ? void 0 : await resolveMailSearch(config2);
|
|
89516
|
-
const searchIndexes = search?.opensearch !== void 0 ? await search.opensearch
|
|
89517
|
-
await
|
|
89518
|
-
const codebaseInstructions = renderCodebaseInstructions(await
|
|
89899
|
+
const searchIndexes = search?.opensearch !== void 0 ? await indexNamesFor(search.opensearch) : [];
|
|
89900
|
+
await skillsReady;
|
|
89901
|
+
const codebaseInstructions = renderCodebaseInstructions(await instructionsReady);
|
|
89519
89902
|
const activeMode = findMode(config2.modeId);
|
|
89520
89903
|
juniorTurnWithoutExpert = activeMode.id === "junior" && schedule === void 0;
|
|
89521
89904
|
const scheduledGuidance = schedule === void 0 ? void 0 : scheduledRunGuidance(schedule, filterToolsForSchedule(currentToolRegistry(void 0, void 0, void 0, void 0, false).list(), schedule).map((tool) => tool.name).filter((name) => name !== "attempt_completion"));
|
|
@@ -89641,9 +90024,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
89641
90024
|
});
|
|
89642
90025
|
if (conversation.systemPrompt() !== desiredPrompt)
|
|
89643
90026
|
conversation.setSystemPrompt(desiredPrompt);
|
|
89644
|
-
await
|
|
89645
|
-
await mcp.ensureConnected();
|
|
89646
|
-
await python.configure({ ...config2.python ?? {}, ...pythonFolders(config2) });
|
|
90027
|
+
await toolsReady;
|
|
89647
90028
|
const toolContext = {
|
|
89648
90029
|
fs: new NodeFileSystem(),
|
|
89649
90030
|
// The shell the user chose, or the platform default. Read per turn, so changing it
|
|
@@ -89699,7 +90080,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
89699
90080
|
...schedule === void 0 ? { requestForm } : {},
|
|
89700
90081
|
// A skill read with the user's defaults for its placeholders carries them (`skills/defaults.ts`).
|
|
89701
90082
|
annotateRead: (realPath) => {
|
|
89702
|
-
const fold = (value) => process.platform === "win32" ?
|
|
90083
|
+
const fold = (value) => process.platform === "win32" ? import_node_path56.default.resolve(value).toLowerCase() : import_node_path56.default.resolve(value);
|
|
89703
90084
|
const skill = skills.find((each) => fold(each.filePath) === fold(realPath));
|
|
89704
90085
|
return skill === void 0 ? void 0 : skillDefaultsReadNote(skill.name, config2.skillDefaults?.[skill.name]);
|
|
89705
90086
|
},
|
|
@@ -89802,7 +90183,7 @@ ${direction}` : attachMentions(text2, mentions);
|
|
|
89802
90183
|
message: `${profile.model} does not accept images. Attachments were not sent \u2014 set "Supports images" in the profile's advanced settings if that is wrong.`
|
|
89803
90184
|
});
|
|
89804
90185
|
}
|
|
89805
|
-
if (shadowGit !== void 0 && await
|
|
90186
|
+
if (shadowGit !== void 0 && await gitAvailable()) {
|
|
89806
90187
|
turnOptions.shadowGit = shadowGit;
|
|
89807
90188
|
} else {
|
|
89808
90189
|
logger.warn("git not found on PATH \u2014 edits will proceed without a rollback checkpoint");
|
|
@@ -91007,7 +91388,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
91007
91388
|
return { mode: cachedSearchScope, author: cachedAttribution.author };
|
|
91008
91389
|
}
|
|
91009
91390
|
function currentProjectNames() {
|
|
91010
|
-
const names = [cachedAttribution.project, workspaceRoot !== void 0 ?
|
|
91391
|
+
const names = [cachedAttribution.project, workspaceRoot !== void 0 ? import_node_path56.default.basename(workspaceRoot) : void 0];
|
|
91011
91392
|
return names.filter((name) => name !== void 0 && name.length > 0);
|
|
91012
91393
|
}
|
|
91013
91394
|
function indexProject(config2) {
|
|
@@ -91110,8 +91491,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
91110
91491
|
limit: limits.limit,
|
|
91111
91492
|
previewChars: limits.previewChars
|
|
91112
91493
|
});
|
|
91113
|
-
for (const
|
|
91114
|
-
skipped2.add(
|
|
91494
|
+
for (const path67 of answer.skipped ?? [])
|
|
91495
|
+
skipped2.add(path67);
|
|
91115
91496
|
return { messages: answer.messages, truncated: answer.truncated };
|
|
91116
91497
|
},
|
|
91117
91498
|
...embedder !== void 0 && search !== void 0 && collection !== void 0 ? {
|
|
@@ -91410,9 +91791,9 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
91410
91791
|
});
|
|
91411
91792
|
const all = result.folders.map((entry) => entry.path);
|
|
91412
91793
|
const wanted = new Set(chosen);
|
|
91413
|
-
for (const
|
|
91414
|
-
if (chosen.some((root) =>
|
|
91415
|
-
wanted.add(
|
|
91794
|
+
for (const path67 of all) {
|
|
91795
|
+
if (chosen.some((root) => path67 === root || path67.startsWith(`${root}\\`)))
|
|
91796
|
+
wanted.add(path67);
|
|
91416
91797
|
}
|
|
91417
91798
|
return [...wanted];
|
|
91418
91799
|
} catch {
|
|
@@ -91420,7 +91801,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
91420
91801
|
}
|
|
91421
91802
|
}
|
|
91422
91803
|
async function handleRequestOutlookFolders(depth, force = false) {
|
|
91423
|
-
const cachePath =
|
|
91804
|
+
const cachePath = import_node_path56.default.join(storageDir, "outlook-folders.json");
|
|
91424
91805
|
let served = false;
|
|
91425
91806
|
try {
|
|
91426
91807
|
const cached2 = JSON.parse(await import_promises31.default.readFile(cachePath, "utf8"));
|
|
@@ -91440,7 +91821,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
91440
91821
|
const scannedAt = Date.now();
|
|
91441
91822
|
post({ type: "outlookFolders", folders: result.folders, scannedAt });
|
|
91442
91823
|
try {
|
|
91443
|
-
await import_promises31.default.mkdir(
|
|
91824
|
+
await import_promises31.default.mkdir(import_node_path56.default.dirname(cachePath), { recursive: true });
|
|
91444
91825
|
await import_promises31.default.writeFile(cachePath, JSON.stringify({ scannedAt, folders: result.folders }), "utf8");
|
|
91445
91826
|
} catch {
|
|
91446
91827
|
}
|
|
@@ -91838,7 +92219,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
91838
92219
|
}
|
|
91839
92220
|
await syncMcpFromConfig(config2);
|
|
91840
92221
|
await mcp.ensureConnected();
|
|
91841
|
-
await
|
|
92222
|
+
await configurePython(config2);
|
|
91842
92223
|
const registry2 = currentToolRegistry();
|
|
91843
92224
|
const tool = registry2.get(name) ?? registry2.get(`py__${name}`);
|
|
91844
92225
|
if (tool === void 0) {
|
|
@@ -92358,12 +92739,12 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
92358
92739
|
if (!isSafeSegment(settings.project) || !isSafeSegment(settings.repo))
|
|
92359
92740
|
return { reason: "Enter the project key and repository slug." };
|
|
92360
92741
|
const digest = (0, import_node_crypto20.createHash)("sha256").update(JSON.stringify([bitbucket.baseUrl, settings.project, settings.repo, settings.branch, settings.folder]).toLowerCase()).digest("hex").slice(0, 12);
|
|
92361
|
-
const root =
|
|
92742
|
+
const root = import_node_path56.default.join(mirrorRoot, "teamrepo", `${settings.project}-${settings.repo}-${digest}`.toLowerCase());
|
|
92362
92743
|
return {
|
|
92363
|
-
dirs: { skills:
|
|
92744
|
+
dirs: { skills: import_node_path56.default.join(root, "skills"), tools: import_node_path56.default.join(root, "tools") },
|
|
92364
92745
|
// Where new skills and tools are saved while the repository is on - see loadSettings and pythonFolders.
|
|
92365
|
-
own: { skills:
|
|
92366
|
-
stateFile:
|
|
92746
|
+
own: { skills: import_node_path56.default.join(root, "saved-here", "skills"), tools: import_node_path56.default.join(root, "saved-here", "tools") },
|
|
92747
|
+
stateFile: import_node_path56.default.join(root, TEAM_REPO_STATE_FILE),
|
|
92367
92748
|
settings
|
|
92368
92749
|
};
|
|
92369
92750
|
}
|
|
@@ -92406,14 +92787,14 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
92406
92787
|
const config2 = await loadSettings();
|
|
92407
92788
|
const plan3 = teamRepoPlan(config2);
|
|
92408
92789
|
if (!("reason" in plan3)) {
|
|
92409
|
-
const norm2 = (value) => process.platform === "win32" ?
|
|
92790
|
+
const norm2 = (value) => process.platform === "win32" ? import_node_path56.default.resolve(value).toLowerCase() : import_node_path56.default.resolve(value);
|
|
92410
92791
|
const folders = [
|
|
92411
92792
|
...[plan3.dirs.skills, plan3.own.skills, ...skillSearchPath()].map((dir) => [dir, "skills"]),
|
|
92412
92793
|
...[plan3.dirs.tools, plan3.own.tools, ...python.toolDirectories()].map((dir) => [dir, "tools"])
|
|
92413
92794
|
];
|
|
92414
|
-
const holder = folders.find(([dir]) => norm2(file2).startsWith(norm2(dir) +
|
|
92795
|
+
const holder = folders.find(([dir]) => norm2(file2).startsWith(norm2(dir) + import_node_path56.default.sep));
|
|
92415
92796
|
if (holder !== void 0) {
|
|
92416
|
-
const relative =
|
|
92797
|
+
const relative = import_node_path56.default.relative(import_node_path56.default.resolve(holder[0]), import_node_path56.default.resolve(file2)).split(import_node_path56.default.sep).join("/");
|
|
92417
92798
|
const where = repoPathFor(plan3.settings.folder, holder[1], relative);
|
|
92418
92799
|
try {
|
|
92419
92800
|
const client = await bitbucketClient();
|
|
@@ -92445,21 +92826,21 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
92445
92826
|
const has2 = async (target) => import_promises31.default.stat(target).then(() => true, () => false);
|
|
92446
92827
|
if (kind === "skill") {
|
|
92447
92828
|
for (const dir of unique([skillsDir, localSkillsDir, personalSkillsDir, ...mirroredSkillsDirs])) {
|
|
92448
|
-
if (await has2(
|
|
92449
|
-
plan3.local.push(
|
|
92450
|
-
if (await has2(
|
|
92451
|
-
plan3.local.push(
|
|
92829
|
+
if (await has2(import_node_path56.default.join(dir, skillFileName(name))))
|
|
92830
|
+
plan3.local.push(import_node_path56.default.join(dir, skillFileName(name)));
|
|
92831
|
+
if (await has2(import_node_path56.default.join(dir, name, "SKILL.md")))
|
|
92832
|
+
plan3.local.push(import_node_path56.default.join(dir, name));
|
|
92452
92833
|
}
|
|
92453
92834
|
for (const extra of config2.skills?.paths ?? []) {
|
|
92454
92835
|
const dir = resolveSkillDir(extra);
|
|
92455
|
-
if (dir !== void 0 && (await has2(
|
|
92836
|
+
if (dir !== void 0 && (await has2(import_node_path56.default.join(dir, skillFileName(name))) || await has2(import_node_path56.default.join(dir, name, "SKILL.md")))) {
|
|
92456
92837
|
plan3.notes.push(`Also in ${dir}, a folder you added in Settings -> Skills - not removed; delete it there.`);
|
|
92457
92838
|
}
|
|
92458
92839
|
}
|
|
92459
92840
|
} else {
|
|
92460
92841
|
for (const dir of unique([pythonFolders(config2).toolsDir, localToolsDir(config2), personalToolsDir, ...mirroredToolsDirs])) {
|
|
92461
|
-
if (await has2(
|
|
92462
|
-
plan3.local.push(
|
|
92842
|
+
if (await has2(import_node_path56.default.join(dir, toolFileName(name))))
|
|
92843
|
+
plan3.local.push(import_node_path56.default.join(dir, toolFileName(name)));
|
|
92463
92844
|
}
|
|
92464
92845
|
}
|
|
92465
92846
|
const mirrors = (kind === "skill" ? cachedSkillMirrors : cachedToolMirrors).filter((mirror) => mirror.enabled === true);
|
|
@@ -92557,7 +92938,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
92557
92938
|
try {
|
|
92558
92939
|
await import_promises31.default.rm(entry, { recursive: true, force: true });
|
|
92559
92940
|
if (kind === "tool")
|
|
92560
|
-
await forgetTool(
|
|
92941
|
+
await forgetTool(import_node_path56.default.dirname(entry), name).catch(() => void 0);
|
|
92561
92942
|
} catch (error51) {
|
|
92562
92943
|
localProblems.push(`${entry} (${error51 instanceof Error ? error51.message : String(error51)})`);
|
|
92563
92944
|
}
|
|
@@ -92583,24 +92964,24 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
92583
92964
|
}
|
|
92584
92965
|
async function writeTeamMonitorSkill(file2, content) {
|
|
92585
92966
|
const config2 = await loadSettings();
|
|
92586
|
-
const norm2 = (value) => process.platform === "win32" ?
|
|
92967
|
+
const norm2 = (value) => process.platform === "win32" ? import_node_path56.default.resolve(value).toLowerCase() : import_node_path56.default.resolve(value);
|
|
92587
92968
|
const inside = (dir) => {
|
|
92588
92969
|
const target = norm2(file2);
|
|
92589
92970
|
const root = norm2(dir);
|
|
92590
|
-
return target.startsWith(root +
|
|
92971
|
+
return target.startsWith(root + import_node_path56.default.sep) ? import_node_path56.default.relative(import_node_path56.default.resolve(dir), import_node_path56.default.resolve(file2)) : void 0;
|
|
92591
92972
|
};
|
|
92592
92973
|
const saveIn = async (dir, relative) => {
|
|
92593
|
-
const destination =
|
|
92974
|
+
const destination = import_node_path56.default.join(dir, relative);
|
|
92594
92975
|
const enabled = cachedSkillMirrors.filter((each) => each.enabled === true);
|
|
92595
92976
|
const mirror = enabled.find((_, i) => samePath(mirroredSkillsDirs[i], dir));
|
|
92596
92977
|
const target = mirror !== void 0 ? targetById(cachedS3, mirror.connectionId) : void 0;
|
|
92597
92978
|
if (mirror !== void 0 && (target === void 0 || target.readOnly === true)) {
|
|
92598
92979
|
throw new Error(`${target?.label ?? mirror.connectionId} is read-only here, so this team monitor cannot be changed from this computer - ask whoever owns that bucket.`);
|
|
92599
92980
|
}
|
|
92600
|
-
await import_promises31.default.mkdir(
|
|
92981
|
+
await import_promises31.default.mkdir(import_node_path56.default.dirname(destination), { recursive: true });
|
|
92601
92982
|
await writeFileAtomically(destination, content);
|
|
92602
92983
|
if (mirror !== void 0 && target !== void 0) {
|
|
92603
|
-
await uploadToS3({ target, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, relative: relative.split(
|
|
92984
|
+
await uploadToS3({ target, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, relative: relative.split(import_node_path56.default.sep).join("/"), contents: Buffer.from(content, "utf8") });
|
|
92604
92985
|
return `uploaded to the bucket ${target.label}`;
|
|
92605
92986
|
}
|
|
92606
92987
|
return `saved in ${dir}`;
|
|
@@ -92622,7 +93003,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
92622
93003
|
throw new Error("There is no folder to save skills in, so the change cannot reach the team repository.");
|
|
92623
93004
|
const where = await saveIn(skillsDir, relative);
|
|
92624
93005
|
await handleTeamRepoSync("a monitor changed on the dashboard");
|
|
92625
|
-
const problem = teamRepoStatus?.error ?? teamRepoStatus?.conflicts.find((c2) => c2.path.endsWith(relative.split(
|
|
93006
|
+
const problem = teamRepoStatus?.error ?? teamRepoStatus?.conflicts.find((c2) => c2.path.endsWith(relative.split(import_node_path56.default.sep).join("/")))?.reason;
|
|
92626
93007
|
if (problem !== void 0) {
|
|
92627
93008
|
return { ok: false, message: `Saved here (${where}), but not committed to the team repository: ${problem}. Nothing was overwritten - see Settings \u2192 DevOps \u2192 Team repository.` };
|
|
92628
93009
|
}
|
|
@@ -92652,8 +93033,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
92652
93033
|
function isPersonalSkill(skill) {
|
|
92653
93034
|
if (personalSkillsDir === void 0)
|
|
92654
93035
|
return false;
|
|
92655
|
-
const norm2 = (value) => process.platform === "win32" ?
|
|
92656
|
-
return norm2(skill.filePath).startsWith(norm2(personalSkillsDir) +
|
|
93036
|
+
const norm2 = (value) => process.platform === "win32" ? import_node_path56.default.resolve(value).toLowerCase() : import_node_path56.default.resolve(value);
|
|
93037
|
+
return norm2(skill.filePath).startsWith(norm2(personalSkillsDir) + import_node_path56.default.sep);
|
|
92657
93038
|
}
|
|
92658
93039
|
function bucketFolderLabels(config2) {
|
|
92659
93040
|
const label = (kind, mirror) => {
|
|
@@ -92901,7 +93282,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
92901
93282
|
}
|
|
92902
93283
|
const command = config2.branches?.setupCommand?.trim();
|
|
92903
93284
|
if (command !== void 0 && command.length > 0) {
|
|
92904
|
-
const label = workspaceBranch ??
|
|
93285
|
+
const label = workspaceBranch ?? import_node_path56.default.basename(workspaceRoot);
|
|
92905
93286
|
if (ui.runInTerminal !== void 0) {
|
|
92906
93287
|
ui.runInTerminal({ name: `Set up ${label}`, command, cwd: workspaceRoot, env: branchEnv });
|
|
92907
93288
|
parts.push(`running "${command}" in a terminal`);
|
|
@@ -92975,7 +93356,7 @@ ${last}` : ""}`);
|
|
|
92975
93356
|
approvalStamps.set("machine", stamp2);
|
|
92976
93357
|
}
|
|
92977
93358
|
for (const dir of python.toolDirectories()) {
|
|
92978
|
-
const file2 =
|
|
93359
|
+
const file2 = import_node_path56.default.join(dir, REGISTRY_FILE);
|
|
92979
93360
|
const stamp2 = await import_promises31.default.stat(file2).then((stat) => stat.mtimeMs, () => 0);
|
|
92980
93361
|
if (approvalStamps.has(file2) && approvalStamps.get(file2) !== stamp2)
|
|
92981
93362
|
changed = true;
|
|
@@ -93077,7 +93458,7 @@ ${last}` : ""}`);
|
|
|
93077
93458
|
return;
|
|
93078
93459
|
}
|
|
93079
93460
|
const folder = skill.filePath.slice(0, skill.filePath.length - "SKILL.md".length);
|
|
93080
|
-
const bytes = await import_promises31.default.readFile(
|
|
93461
|
+
const bytes = await import_promises31.default.readFile(import_node_path56.default.join(folder, SKILL_IMAGE_DIR, image));
|
|
93081
93462
|
const dataUri = skillImageDataUri(image, bytes);
|
|
93082
93463
|
post({
|
|
93083
93464
|
type: "skillImage",
|
|
@@ -93443,13 +93824,13 @@ ${last}` : ""}`);
|
|
|
93443
93824
|
}
|
|
93444
93825
|
function docsFingerprintPath(index, storeId, kind) {
|
|
93445
93826
|
const suffix = kind === void 0 ? "docs" : `docs.${kind}`;
|
|
93446
|
-
return
|
|
93827
|
+
return import_node_path56.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.${suffix}.json`);
|
|
93447
93828
|
}
|
|
93448
93829
|
function manifestKey(index, storeId) {
|
|
93449
93830
|
return `${index}@${storeId}`;
|
|
93450
93831
|
}
|
|
93451
93832
|
function manifestPath(index, storeId) {
|
|
93452
|
-
return
|
|
93833
|
+
return import_node_path56.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.json`);
|
|
93453
93834
|
}
|
|
93454
93835
|
async function readDocsFingerprint(index, storeId, kind) {
|
|
93455
93836
|
try {
|
|
@@ -93513,7 +93894,7 @@ ${last}` : ""}`);
|
|
|
93513
93894
|
}
|
|
93514
93895
|
options.report?.("Writing", { done: 0, total: documents.length });
|
|
93515
93896
|
await writer.upsert(index, documents);
|
|
93516
|
-
await import_promises31.default.mkdir(
|
|
93897
|
+
await import_promises31.default.mkdir(import_node_path56.default.dirname(docsFingerprintPath(index, search.id, wanted)), {
|
|
93517
93898
|
recursive: true
|
|
93518
93899
|
});
|
|
93519
93900
|
await import_promises31.default.writeFile(docsFingerprintPath(index, search.id, wanted), JSON.stringify({ fingerprint, indexedAt: Date.now(), count: documents.length }), "utf8");
|
|
@@ -93703,7 +94084,7 @@ ${last}` : ""}`);
|
|
|
93703
94084
|
});
|
|
93704
94085
|
if (manifest !== void 0) {
|
|
93705
94086
|
const targetPath = manifestPath(index, target.id);
|
|
93706
|
-
await import_promises31.default.mkdir(
|
|
94087
|
+
await import_promises31.default.mkdir(import_node_path56.default.dirname(targetPath), { recursive: true });
|
|
93707
94088
|
await import_promises31.default.writeFile(targetPath, JSON.stringify(manifest), "utf8");
|
|
93708
94089
|
}
|
|
93709
94090
|
post({ type: "storeSync", running: false, copied: result.copied, fromLabel: source.label });
|
|
@@ -93752,7 +94133,7 @@ ${last}` : ""}`);
|
|
|
93752
94133
|
type: "project",
|
|
93753
94134
|
hasWorkspace: workspaceRoot !== void 0,
|
|
93754
94135
|
...configured !== void 0 ? { configured } : {},
|
|
93755
|
-
...workspaceRoot !== void 0 ? { folder:
|
|
94136
|
+
...workspaceRoot !== void 0 ? { folder: import_node_path56.default.basename(workspaceRoot) } : {},
|
|
93756
94137
|
...author !== void 0 ? { author } : {},
|
|
93757
94138
|
...index !== void 0 ? { indexName: index } : {},
|
|
93758
94139
|
...ownerConfigured !== void 0 && ownerConfigured.length > 0 ? { ownerConfigured } : {},
|
|
@@ -93892,8 +94273,8 @@ ${last}` : ""}`);
|
|
|
93892
94273
|
if (workspaceRoot === void 0)
|
|
93893
94274
|
return found2;
|
|
93894
94275
|
const root = workspaceRoot;
|
|
93895
|
-
const relative =
|
|
93896
|
-
if (relative.startsWith("..") ||
|
|
94276
|
+
const relative = import_node_path56.default.relative(root, folder);
|
|
94277
|
+
if (relative.startsWith("..") || import_node_path56.default.isAbsolute(relative))
|
|
93897
94278
|
return found2;
|
|
93898
94279
|
const output = await new Promise((resolve) => {
|
|
93899
94280
|
const child = (0, import_node_child_process19.spawn)("git", ["-c", "core.quotePath=false", "log", "--diff-filter=A", "--relative", "--format=@@%an", "--name-only", "--", relative.length > 0 ? relative : "."], {
|
|
@@ -93910,7 +94291,7 @@ ${last}` : ""}`);
|
|
|
93910
94291
|
if (line.startsWith("@@"))
|
|
93911
94292
|
author = line.slice(2).trim();
|
|
93912
94293
|
else if (line.trim().length > 0 && author !== void 0 && author.length > 0) {
|
|
93913
|
-
found2.set(normalizeForComparison(
|
|
94294
|
+
found2.set(normalizeForComparison(import_node_path56.default.resolve(root, line.trim())), author);
|
|
93914
94295
|
}
|
|
93915
94296
|
}
|
|
93916
94297
|
return found2;
|
|
@@ -93954,7 +94335,7 @@ ${last}` : ""}`);
|
|
|
93954
94335
|
},
|
|
93955
94336
|
source,
|
|
93956
94337
|
folder,
|
|
93957
|
-
relative:
|
|
94338
|
+
relative: import_node_path56.default.relative(folder, filePath).split(import_node_path56.default.sep).join("/")
|
|
93958
94339
|
});
|
|
93959
94340
|
};
|
|
93960
94341
|
for (const folder of skillFolders) {
|
|
@@ -93972,7 +94353,7 @@ ${last}` : ""}`);
|
|
|
93972
94353
|
const name = entry.slice(0, -3);
|
|
93973
94354
|
if (!isValidToolName(name))
|
|
93974
94355
|
continue;
|
|
93975
|
-
await consider("tool", name,
|
|
94356
|
+
await consider("tool", name, import_node_path56.default.join(folder, entry), folder, location);
|
|
93976
94357
|
}
|
|
93977
94358
|
}
|
|
93978
94359
|
const readOnly = skills.filter((skill) => skill.sourceDir !== void 0 && !skillFolders.some((folder) => samePath(folder, skill.sourceDir))).length;
|
|
@@ -94004,7 +94385,7 @@ ${last}` : ""}`);
|
|
|
94004
94385
|
} catch {
|
|
94005
94386
|
}
|
|
94006
94387
|
}
|
|
94007
|
-
const gitAuthor = gitAuthors.get(normalizeForComparison(
|
|
94388
|
+
const gitAuthor = gitAuthors.get(normalizeForComparison(import_node_path56.default.resolve(candidate.entry.filePath)));
|
|
94008
94389
|
if (gitAuthor !== void 0) {
|
|
94009
94390
|
candidate.entry.suggestion = { author: gitAuthor, source: "git: the commit that added this file" };
|
|
94010
94391
|
}
|
|
@@ -94113,7 +94494,7 @@ ${last}` : ""}`);
|
|
|
94113
94494
|
aliases: plan3.kind === "codebase" ? codebaseAliases(config2) : plan3.kind === "skills" ? skillAliases(config2) : [],
|
|
94114
94495
|
onProgress: (count3) => post({ type: "indexRenames", running: true, plans, store, current: plan3.to, copied: count3 })
|
|
94115
94496
|
});
|
|
94116
|
-
await copyBookkeeping(
|
|
94497
|
+
await copyBookkeeping(import_node_path56.default.join(manifestsRoot, "index-manifests"), plan3.from, plan3.to, search.id);
|
|
94117
94498
|
done.push({ ...plan3, copied });
|
|
94118
94499
|
}
|
|
94119
94500
|
post({ type: "indexRenames", running: false, plans: [], store, done });
|
|
@@ -94143,7 +94524,7 @@ ${last}` : ""}`);
|
|
|
94143
94524
|
project: projectName(config2, workspaceRoot),
|
|
94144
94525
|
aliases: codebaseAliases(config2)
|
|
94145
94526
|
});
|
|
94146
|
-
await copyBookkeeping(
|
|
94527
|
+
await copyBookkeeping(import_node_path56.default.join(manifestsRoot, "index-manifests"), legacy, current, search.id);
|
|
94147
94528
|
post({ type: "indexRenames", running: false, plans: [], done: [{ kind: "codebase", from: legacy, to: current, copied }] });
|
|
94148
94529
|
logger.info(`copied ${String(copied)} chunks from ${legacy} to ${current} rather than re-embedding them`);
|
|
94149
94530
|
}
|
|
@@ -94309,7 +94690,7 @@ ${last}` : ""}`);
|
|
|
94309
94690
|
denylist,
|
|
94310
94691
|
manifest,
|
|
94311
94692
|
saveManifest: async (next) => {
|
|
94312
|
-
await import_promises31.default.mkdir(
|
|
94693
|
+
await import_promises31.default.mkdir(import_node_path56.default.dirname(manifestFile), { recursive: true });
|
|
94313
94694
|
await import_promises31.default.writeFile(manifestFile, JSON.stringify(next), "utf8");
|
|
94314
94695
|
},
|
|
94315
94696
|
...isIgnored2 !== void 0 ? { isIgnored: isIgnored2 } : {},
|
|
@@ -94391,13 +94772,13 @@ ${last}` : ""}`);
|
|
|
94391
94772
|
if (userTurnRunning || runningScheduleId !== void 0)
|
|
94392
94773
|
return;
|
|
94393
94774
|
const config2 = await loadSettings();
|
|
94394
|
-
await
|
|
94775
|
+
await configurePython(config2);
|
|
94395
94776
|
}
|
|
94396
94777
|
const usageLog = new UsageLog(storageDir);
|
|
94397
94778
|
const usageInstance = usageInstanceId(storageDir);
|
|
94398
|
-
const usageProfileFile =
|
|
94399
|
-
const legacyBackfillFile =
|
|
94400
|
-
const usageDir =
|
|
94779
|
+
const usageProfileFile = import_node_path56.default.join(storageDir, "usage-profile.json");
|
|
94780
|
+
const legacyBackfillFile = import_node_path56.default.join(storageDir, "usage-backfill.json");
|
|
94781
|
+
const usageDir = import_node_path56.default.join(storageDir, "usage");
|
|
94401
94782
|
const toolStartedAt = /* @__PURE__ */ new Map();
|
|
94402
94783
|
let usagePushTimer;
|
|
94403
94784
|
let usagePushing;
|
|
@@ -94415,7 +94796,7 @@ ${last}` : ""}`);
|
|
|
94415
94796
|
return (request2) => runFastFs(exe, request2);
|
|
94416
94797
|
}
|
|
94417
94798
|
function skillAtPath(requested2) {
|
|
94418
|
-
const absolute =
|
|
94799
|
+
const absolute = import_node_path56.default.isAbsolute(requested2) ? requested2 : workspaceRoot === void 0 ? void 0 : import_node_path56.default.resolve(workspaceRoot, requested2);
|
|
94419
94800
|
if (absolute === void 0)
|
|
94420
94801
|
return void 0;
|
|
94421
94802
|
return skills.find((skill) => samePath(skill.filePath, absolute));
|
|
@@ -94505,7 +94886,7 @@ ${last}` : ""}`);
|
|
|
94505
94886
|
const folder = chosen.path?.trim();
|
|
94506
94887
|
if (folder === void 0 || folder.length === 0)
|
|
94507
94888
|
return { problem: "The shared folder has no path." };
|
|
94508
|
-
if (!
|
|
94889
|
+
if (!import_node_path56.default.isAbsolute(folder))
|
|
94509
94890
|
return { problem: `"${folder}" is not an absolute path. Use the full path of a folder everybody can reach, such as a network share.` };
|
|
94510
94891
|
const helper = usageHelper();
|
|
94511
94892
|
return { store: new FolderShardStore(folder, ...helper !== void 0 ? [helper] : []), target };
|
|
@@ -94534,7 +94915,7 @@ ${last}` : ""}`);
|
|
|
94534
94915
|
}
|
|
94535
94916
|
async function readUsageBackfill() {
|
|
94536
94917
|
try {
|
|
94537
|
-
const text2 = await import_promises31.default.readFile(
|
|
94918
|
+
const text2 = await import_promises31.default.readFile(import_node_path56.default.join(usageDir, "backfill.json"), "utf8").catch(() => import_promises31.default.readFile(legacyBackfillFile, "utf8"));
|
|
94538
94919
|
const saved = JSON.parse(text2);
|
|
94539
94920
|
if (typeof saved.at !== "number")
|
|
94540
94921
|
return void 0;
|
|
@@ -94550,7 +94931,7 @@ ${last}` : ""}`);
|
|
|
94550
94931
|
legacyDoneFile: legacyBackfillFile,
|
|
94551
94932
|
run: async (before) => {
|
|
94552
94933
|
const status2 = python.status();
|
|
94553
|
-
return backfillFromTasks(
|
|
94934
|
+
return backfillFromTasks(import_node_path56.default.join(storageDir, "tasks"), {
|
|
94554
94935
|
user: cachedAttribution.author ?? "unknown",
|
|
94555
94936
|
project: cachedAttribution.project,
|
|
94556
94937
|
workspaceRoot,
|
|
@@ -94723,14 +95104,14 @@ ${last}` : ""}`);
|
|
|
94723
95104
|
kind: "tool",
|
|
94724
95105
|
name: issue2.name,
|
|
94725
95106
|
filePath: issue2.filePath,
|
|
94726
|
-
deletable: samePath(
|
|
94727
|
-
location: where(
|
|
95107
|
+
deletable: samePath(import_node_path56.default.dirname(issue2.filePath), status2.toolsDir),
|
|
95108
|
+
location: where(import_node_path56.default.dirname(issue2.filePath), status2.toolsDir),
|
|
94728
95109
|
issue: issue2.kind === "unapproved" ? "waiting for approval" : issue2.kind === "hash-mismatch" ? "changed since approval" : issue2.detail.split("\n")[0] ?? "not loaded"
|
|
94729
95110
|
});
|
|
94730
95111
|
}
|
|
94731
95112
|
return items;
|
|
94732
95113
|
}
|
|
94733
|
-
const usageDirectoryFile =
|
|
95114
|
+
const usageDirectoryFile = import_node_path56.default.join(storageDir, "usage-directory.json");
|
|
94734
95115
|
let directoryRunning;
|
|
94735
95116
|
async function readDirectoryCache() {
|
|
94736
95117
|
try {
|
|
@@ -95054,7 +95435,7 @@ ${last}` : ""}`);
|
|
|
95054
95435
|
}
|
|
95055
95436
|
});
|
|
95056
95437
|
const { config: config2 } = await configManager.load();
|
|
95057
|
-
await
|
|
95438
|
+
await configurePython(config2);
|
|
95058
95439
|
await postPython();
|
|
95059
95440
|
} catch (error51) {
|
|
95060
95441
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
@@ -95065,7 +95446,7 @@ ${last}` : ""}`);
|
|
|
95065
95446
|
let indexedFiles = 0;
|
|
95066
95447
|
if (index !== void 0) {
|
|
95067
95448
|
try {
|
|
95068
|
-
const manifest = JSON.parse(await import_promises31.default.readFile(
|
|
95449
|
+
const manifest = JSON.parse(await import_promises31.default.readFile(import_node_path56.default.join(manifestsRoot, "index-manifests", `${index}.json`), "utf8"));
|
|
95069
95450
|
indexedFiles = Object.keys(manifest.files ?? {}).length;
|
|
95070
95451
|
} catch {
|
|
95071
95452
|
}
|
|
@@ -95545,11 +95926,11 @@ ${last}` : ""}`);
|
|
|
95545
95926
|
answer({ error: bytes.length === 0 ? "There was nothing to save." : "That file is too large to save from here." });
|
|
95546
95927
|
return;
|
|
95547
95928
|
}
|
|
95548
|
-
const safeName = [...
|
|
95549
|
-
const extension =
|
|
95929
|
+
const safeName = [...import_node_path56.default.basename(name)].map((c2) => c2.charCodeAt(0) < 32 || '<>:"/\\|?*'.includes(c2) ? "-" : c2).join("") || "file";
|
|
95930
|
+
const extension = import_node_path56.default.extname(safeName).slice(1);
|
|
95550
95931
|
try {
|
|
95551
95932
|
const target = await ui.showSaveDialog({
|
|
95552
|
-
defaultName: workspaceRoot !== void 0 ?
|
|
95933
|
+
defaultName: workspaceRoot !== void 0 ? import_node_path56.default.join(workspaceRoot, safeName) : safeName,
|
|
95553
95934
|
...extension.length > 0 ? { extensions: [extension] } : {}
|
|
95554
95935
|
});
|
|
95555
95936
|
if (target === void 0) {
|
|
@@ -95630,8 +96011,8 @@ ${last}` : ""}`);
|
|
|
95630
96011
|
continue;
|
|
95631
96012
|
for (const key3 of section.keys)
|
|
95632
96013
|
patch[key3] = key3 === "profiles" && merged.profiles !== void 0 ? reconciled : merged[key3];
|
|
95633
|
-
for (const
|
|
95634
|
-
const head =
|
|
96014
|
+
for (const path67 of section.nested ?? []) {
|
|
96015
|
+
const head = path67.split(".")[0];
|
|
95635
96016
|
patch[head] = merged[head];
|
|
95636
96017
|
}
|
|
95637
96018
|
}
|
|
@@ -95675,7 +96056,7 @@ ${last}` : ""}`);
|
|
|
95675
96056
|
if (changeLedger !== void 0) {
|
|
95676
96057
|
const shared = await changeLedger.othersSince(targets, taskCheckpoint.createdAt);
|
|
95677
96058
|
if (shared.size > 0) {
|
|
95678
|
-
const shown2 = (file2) =>
|
|
96059
|
+
const shown2 = (file2) => import_node_path56.default.relative(workspaceRoot ?? "", file2).split(import_node_path56.default.sep).join("/");
|
|
95679
96060
|
const detail = [...shared].map(([file2, chats]) => `${shown2(file2)} (${chats.join(", ")})`).join("; ");
|
|
95680
96061
|
const all = await ui.showActionMessage(`Another chat also changed ${String(shared.size)} of these files after this chat started: ${detail}. Rolling them back would undo that chat's changes too.`, "Roll those back too", "warning");
|
|
95681
96062
|
if (!all) {
|
|
@@ -95713,9 +96094,15 @@ ${last}` : ""}`);
|
|
|
95713
96094
|
recordExchange({ at: Date.now(), role: agent.role, question: request2.question.slice(0, 4e3), answer: "", refused: planned.refuse });
|
|
95714
96095
|
throw new Error(planned.refuse);
|
|
95715
96096
|
}
|
|
95716
|
-
|
|
96097
|
+
let stepNotes = planned.addToPrompt;
|
|
96098
|
+
if (stepNotes.includes("@") && workspaceRoot !== void 0) {
|
|
96099
|
+
const mentioned = await resolveMentions(stepNotes, { fs: new NodeFileSystem(), workspaceRoot, denylist, siblings: mentionCodebases() }).catch(() => []);
|
|
96100
|
+
if (mentioned.length > 0)
|
|
96101
|
+
stepNotes = attachMentions(stepNotes, mentioned);
|
|
96102
|
+
}
|
|
96103
|
+
const question = stepNotes.length > 0 ? `${request2.question}
|
|
95717
96104
|
|
|
95718
|
-
${
|
|
96105
|
+
${stepNotes}` : request2.question;
|
|
95719
96106
|
strategyRunning.add(agent.role);
|
|
95720
96107
|
strategyLastRole = agent.role;
|
|
95721
96108
|
void postStrategies();
|
|
@@ -95959,7 +96346,7 @@ ${notes.join("\n")}` } : answer;
|
|
|
95959
96346
|
const pathRequest = pendingPathApprovals.get(id);
|
|
95960
96347
|
userGate.resolve(id, "approve");
|
|
95961
96348
|
if (pathRequest !== void 0) {
|
|
95962
|
-
const folder =
|
|
96349
|
+
const folder = import_node_path56.default.dirname(pathRequest);
|
|
95963
96350
|
sessionPathGrants.add(normalizeForComparison(pathRequest));
|
|
95964
96351
|
if (scope === "folder" && !cachedReadRoots.includes(folder)) {
|
|
95965
96352
|
const { config: config2 } = await configManager.load();
|
|
@@ -96199,10 +96586,10 @@ ${notes.join("\n")}` } : answer;
|
|
|
96199
96586
|
});
|
|
96200
96587
|
return;
|
|
96201
96588
|
}
|
|
96202
|
-
let dir =
|
|
96589
|
+
let dir = import_node_path56.default.dirname(import_node_path56.default.resolve(scriptPath));
|
|
96203
96590
|
for (let depth = 0; depth < 3; depth++) {
|
|
96204
96591
|
for (const name of VENV_DIR_NAMES) {
|
|
96205
|
-
const candidate =
|
|
96592
|
+
const candidate = import_node_path56.default.join(dir, name);
|
|
96206
96593
|
const found2 = await search(candidate);
|
|
96207
96594
|
if (found2 !== void 0) {
|
|
96208
96595
|
post({
|
|
@@ -96214,7 +96601,7 @@ ${notes.join("\n")}` } : answer;
|
|
|
96214
96601
|
return;
|
|
96215
96602
|
}
|
|
96216
96603
|
}
|
|
96217
|
-
const parent =
|
|
96604
|
+
const parent = import_node_path56.default.dirname(dir);
|
|
96218
96605
|
if (parent === dir)
|
|
96219
96606
|
break;
|
|
96220
96607
|
dir = parent;
|
|
@@ -97026,7 +97413,7 @@ ${notes.join("\n")}` } : answer;
|
|
|
97026
97413
|
try {
|
|
97027
97414
|
const { config: config2 } = await configManager.load();
|
|
97028
97415
|
await syncMcpFromConfig(config2);
|
|
97029
|
-
await mcp.
|
|
97416
|
+
await mcp.ensureReady();
|
|
97030
97417
|
mcpStartProblem = void 0;
|
|
97031
97418
|
} catch (error51) {
|
|
97032
97419
|
logger.warn(`Could not start MCP servers: ${describeFailure2(error51, true)}`);
|
|
@@ -97034,6 +97421,40 @@ ${notes.join("\n")}` } : answer;
|
|
|
97034
97421
|
await postAddons().catch(() => void 0);
|
|
97035
97422
|
}
|
|
97036
97423
|
})();
|
|
97424
|
+
void (async () => {
|
|
97425
|
+
try {
|
|
97426
|
+
const config2 = await loadSettings();
|
|
97427
|
+
const startedAt = Date.now();
|
|
97428
|
+
const timed = (label, work) => work.finally(() => {
|
|
97429
|
+
const seconds = (Date.now() - startedAt) / 1e3;
|
|
97430
|
+
if (seconds >= 2)
|
|
97431
|
+
logger.info(`[startup] ${label} ready after ${seconds.toFixed(1)}s`);
|
|
97432
|
+
});
|
|
97433
|
+
const parts = [
|
|
97434
|
+
timed("secrets", knownSecretValues()),
|
|
97435
|
+
timed("skills", refreshSkills()),
|
|
97436
|
+
timed("Python tools", configurePython(config2)),
|
|
97437
|
+
timed("git check", gitAvailable()),
|
|
97438
|
+
timed("expert", resolveExpert(config2)),
|
|
97439
|
+
timed("MCP tools", mcpStarted)
|
|
97440
|
+
];
|
|
97441
|
+
if ((config2.profiles ?? []).length > 0) {
|
|
97442
|
+
const profile = resolveActiveProfile(config2);
|
|
97443
|
+
parts.push(timed("model gateway (sign-in and context window)", (async () => {
|
|
97444
|
+
if (profile.wireFormat !== "vscode-lm")
|
|
97445
|
+
await authStrategyFor(config2, profile).resolveHeaders();
|
|
97446
|
+
await reportedWindowFor(config2, profile);
|
|
97447
|
+
})()));
|
|
97448
|
+
}
|
|
97449
|
+
const results = await Promise.allSettled(parts);
|
|
97450
|
+
for (const result of results) {
|
|
97451
|
+
if (result.status === "rejected")
|
|
97452
|
+
logger.info(`Preparing the session: ${describeFailure2(result.reason, true)}`);
|
|
97453
|
+
}
|
|
97454
|
+
} catch (error51) {
|
|
97455
|
+
logger.info(`Preparing the session was skipped: ${describeFailure2(error51, true)}`);
|
|
97456
|
+
}
|
|
97457
|
+
})();
|
|
97037
97458
|
void (async () => {
|
|
97038
97459
|
try {
|
|
97039
97460
|
await restoreActiveTaskOnLoad();
|
|
@@ -97126,11 +97547,11 @@ ${entry.content}`);
|
|
|
97126
97547
|
let lastReportPath;
|
|
97127
97548
|
async function saveReport(title, contents) {
|
|
97128
97549
|
try {
|
|
97129
|
-
const directory =
|
|
97550
|
+
const directory = import_node_path56.default.join(storageDir, "reports");
|
|
97130
97551
|
await import_promises31.default.mkdir(directory, { recursive: true });
|
|
97131
97552
|
const stamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
97132
97553
|
const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
|
|
97133
|
-
const target =
|
|
97554
|
+
const target = import_node_path56.default.join(directory, `${stamp2}${slug.length > 0 ? `-${slug}` : ""}.md`);
|
|
97134
97555
|
await import_promises31.default.writeFile(target, `# ${title}
|
|
97135
97556
|
|
|
97136
97557
|
${contents}
|
|
@@ -97146,7 +97567,7 @@ ${contents}
|
|
|
97146
97567
|
const keep = 100;
|
|
97147
97568
|
const entries = (await import_promises31.default.readdir(directory)).filter((name) => name.endsWith(".md")).sort();
|
|
97148
97569
|
for (const name of entries.slice(0, Math.max(0, entries.length - keep))) {
|
|
97149
|
-
await import_promises31.default.rm(
|
|
97570
|
+
await import_promises31.default.rm(import_node_path56.default.join(directory, name), { force: true });
|
|
97150
97571
|
}
|
|
97151
97572
|
}
|
|
97152
97573
|
let scheduleTimer;
|
|
@@ -97259,10 +97680,10 @@ ${contents}
|
|
|
97259
97680
|
}
|
|
97260
97681
|
const CLAIM_STALE_MS = 60 * 60 * 1e3;
|
|
97261
97682
|
async function claimSchedule(id) {
|
|
97262
|
-
const claimPath =
|
|
97683
|
+
const claimPath = import_node_path56.default.join(storageDir, "schedule-claims", `${id}.json`);
|
|
97263
97684
|
const mine = JSON.stringify({ pid: process.pid, at: Date.now() });
|
|
97264
97685
|
try {
|
|
97265
|
-
await import_promises31.default.mkdir(
|
|
97686
|
+
await import_promises31.default.mkdir(import_node_path56.default.dirname(claimPath), { recursive: true });
|
|
97266
97687
|
await import_promises31.default.writeFile(claimPath, mine, { encoding: "utf8", flag: "wx" });
|
|
97267
97688
|
return true;
|
|
97268
97689
|
} catch (error51) {
|
|
@@ -97287,7 +97708,7 @@ ${contents}
|
|
|
97287
97708
|
}
|
|
97288
97709
|
}
|
|
97289
97710
|
async function releaseSchedule(id) {
|
|
97290
|
-
await import_promises31.default.rm(
|
|
97711
|
+
await import_promises31.default.rm(import_node_path56.default.join(storageDir, "schedule-claims", `${id}.json`), { force: true }).catch(() => void 0);
|
|
97291
97712
|
}
|
|
97292
97713
|
async function runSchedule(id, reason) {
|
|
97293
97714
|
if (reason === "due" && !await claimSchedule(id))
|
|
@@ -97982,11 +98403,11 @@ function createShowDiagramTool() {
|
|
|
97982
98403
|
|
|
97983
98404
|
// ../../packages/core/dist/lsp/manager.js
|
|
97984
98405
|
var import_promises32 = __toESM(require("node:fs/promises"), 1);
|
|
97985
|
-
var
|
|
98406
|
+
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
97986
98407
|
|
|
97987
98408
|
// ../../packages/core/dist/lsp/catalog.js
|
|
97988
|
-
var
|
|
97989
|
-
var
|
|
98409
|
+
var import_node_fs15 = require("node:fs");
|
|
98410
|
+
var import_node_path57 = __toESM(require("node:path"), 1);
|
|
97990
98411
|
var c = (command, ...args) => ({ command, args });
|
|
97991
98412
|
var LSP_LANGUAGES = [
|
|
97992
98413
|
{ id: "python", label: "Python", extensions: ["py", "pyi"], candidates: [c("pyright-langserver", "--stdio"), c("basedpyright-langserver", "--stdio"), c("pylsp"), c("jedi-language-server")] },
|
|
@@ -98034,17 +98455,17 @@ var LSP_LANGUAGES = [
|
|
|
98034
98455
|
{ id: "sql", label: "SQL", extensions: ["sql"], candidates: [c("sql-language-server", "up", "--method", "stdio")] }
|
|
98035
98456
|
];
|
|
98036
98457
|
function languageFor(file2) {
|
|
98037
|
-
const ext =
|
|
98458
|
+
const ext = import_node_path57.default.extname(file2).slice(1).toLowerCase();
|
|
98038
98459
|
return LSP_LANGUAGES.find((l) => l.extensions.includes(ext));
|
|
98039
98460
|
}
|
|
98040
98461
|
function languageIdFor(language, file2) {
|
|
98041
|
-
const ext =
|
|
98462
|
+
const ext = import_node_path57.default.extname(file2).slice(1).toLowerCase();
|
|
98042
98463
|
return language.languageIdFor?.(ext) ?? language.id;
|
|
98043
98464
|
}
|
|
98044
98465
|
var found = /* @__PURE__ */ new Map();
|
|
98045
98466
|
function findOnPath(command, env2 = process.env) {
|
|
98046
|
-
if (
|
|
98047
|
-
return (0,
|
|
98467
|
+
if (import_node_path57.default.isAbsolute(command))
|
|
98468
|
+
return (0, import_node_fs15.existsSync)(command) ? command : void 0;
|
|
98048
98469
|
if (env2 !== process.env)
|
|
98049
98470
|
return searchPath(command, env2);
|
|
98050
98471
|
const hit = found.get(command);
|
|
@@ -98055,12 +98476,12 @@ function findOnPath(command, env2 = process.env) {
|
|
|
98055
98476
|
return value;
|
|
98056
98477
|
}
|
|
98057
98478
|
function searchPath(command, env2) {
|
|
98058
|
-
const dirs = (env2.PATH ?? env2.Path ?? "").split(
|
|
98479
|
+
const dirs = (env2.PATH ?? env2.Path ?? "").split(import_node_path57.default.delimiter).filter((d) => d.length > 0);
|
|
98059
98480
|
const exts = process.platform === "win32" ? ["", ...(env2.PATHEXT ?? ".EXE;.CMD;.BAT").toLowerCase().split(";")] : [""];
|
|
98060
98481
|
for (const dir of dirs) {
|
|
98061
98482
|
for (const ext of exts) {
|
|
98062
|
-
const candidate =
|
|
98063
|
-
if ((0,
|
|
98483
|
+
const candidate = import_node_path57.default.join(dir, command + ext);
|
|
98484
|
+
if ((0, import_node_fs15.existsSync)(candidate) && (process.platform !== "win32" || ext !== "" || /\.(exe|cmd|bat)$/i.test(candidate)))
|
|
98064
98485
|
return candidate;
|
|
98065
98486
|
}
|
|
98066
98487
|
}
|
|
@@ -98292,7 +98713,7 @@ var LspManager = class {
|
|
|
98292
98713
|
return void 0;
|
|
98293
98714
|
const args = [...found2.candidate.args];
|
|
98294
98715
|
if (language.id === "java" && !args.includes("-data"))
|
|
98295
|
-
args.push("-data",
|
|
98716
|
+
args.push("-data", import_node_path58.default.join(this.storageDir, "jdtls-workspace"));
|
|
98296
98717
|
try {
|
|
98297
98718
|
client = new LspClient(found2.executable, args, this.root, this.log);
|
|
98298
98719
|
this.clients.set(language.id, client);
|
|
@@ -98313,7 +98734,7 @@ var LspManager = class {
|
|
|
98313
98734
|
this.failed.set(language.id, client.lastError ?? "stopped");
|
|
98314
98735
|
return void 0;
|
|
98315
98736
|
}
|
|
98316
|
-
return { server:
|
|
98737
|
+
return { server: import_node_path58.default.basename(client.executable).replace(/\.(exe|cmd|bat)$/i, ""), diagnostics: diagnostics ?? [] };
|
|
98317
98738
|
} catch (error51) {
|
|
98318
98739
|
this.failed.set(language.id, error51 instanceof Error ? error51.message : String(error51));
|
|
98319
98740
|
client.dispose();
|
|
@@ -100954,7 +101375,8 @@ reported for these codebases. Commands run with execute_command run on this comp
|
|
|
100954
101375
|
|
|
100955
101376
|
**Git runs on the hub too**: the repository, its remote and its credentials are there, not in the
|
|
100956
101377
|
copy. Fire Code's sidebar counts and its Commit and push / Pull buttons work for a hub codebase while
|
|
100957
|
-
|
|
101378
|
+
any chat of it can run - whichever chat is loaded answers, an unloaded chat page is loaded again, and a
|
|
101379
|
+
sleeping codebase is woken for a Commit or Pull - local edits are saved to the hub first, then git commits and pushes there
|
|
100958
101380
|
(fast-forward-only pulls, fetched here afterwards); "Write with agent" describes the hub's diff. The
|
|
100959
101381
|
agent runs any other git command with \`hub_run\` shell, approved like any command.
|
|
100960
101382
|
**Outside the added folders**: \`hub_browse\` lists folders, finds files by name and reads text files
|
|
@@ -101378,9 +101800,29 @@ always asks you).
|
|
|
101378
101800
|
"needs my approval",
|
|
101379
101801
|
"short name",
|
|
101380
101802
|
"codebase name",
|
|
101381
|
-
"review python tools once"
|
|
101803
|
+
"review python tools once",
|
|
101804
|
+
"export setup",
|
|
101805
|
+
"import setup",
|
|
101806
|
+
"new machine",
|
|
101807
|
+
"another computer",
|
|
101808
|
+
"other machine",
|
|
101809
|
+
"move to a new laptop",
|
|
101810
|
+
"same setup",
|
|
101811
|
+
"set up again",
|
|
101812
|
+
"export codebases",
|
|
101813
|
+
"import codebases",
|
|
101814
|
+
"export chats",
|
|
101815
|
+
"migrate fire code"
|
|
101382
101816
|
],
|
|
101383
101817
|
body: `
|
|
101818
|
+
**Moving to another computer**: Settings \u2192 Setup \u2192 **Export\u2026** saves every codebase with its open chats by name (and,
|
|
101819
|
+
if ticked, each codebase's Light Code settings) to \`fire-code-setup.json\`. On the other computer, Settings \u2192 Setup \u2192
|
|
101820
|
+
**Import\u2026** lists them: each folder can be pointed at where that codebase is there (Browse), a codebase already in
|
|
101821
|
+
Fire Code is left alone, and a JupyterHub codebase keeps its hub, user and folders and asks for its token - a saved
|
|
101822
|
+
credential with the same name is picked by itself. Chats arrive empty under their names; conversations stay where they
|
|
101823
|
+
were. The file holds no password or token: export credentials separately (Settings \u2192 Credentials \u2192 Export, under a
|
|
101824
|
+
passphrase) if the other computer needs them.
|
|
101825
|
+
|
|
101384
101826
|
**Agents asking each other**: the agent in one codebase can ask the agent in another for help, or to do something
|
|
101385
101827
|
there, with \`ask_codebase_agent\` - you approve it, seeing the exact request and which codebase it goes to. Fire Code
|
|
101386
101828
|
opens a new tab on that codebase ("From <codebase>: ...") without switching to it, and that agent starts on the
|
|
@@ -101547,6 +101989,14 @@ the idle time set there. The chats of one codebase **share** its checkpoint stor
|
|
|
101547
101989
|
and its index bookkeeping, so a new chat no longer adds another copy of the codebase's snapshots.
|
|
101548
101990
|
WebView2's cache is capped at 32 MB.
|
|
101549
101991
|
|
|
101992
|
+
**Starting a chat quickly.** MCP servers are processes of each chat's own agent, so they cannot be shared
|
|
101993
|
+
between chats - but what they offer can. Every chat of a codebase remembers each server's tool list in
|
|
101994
|
+
one shared file, so a chat started after a crash or a sleep offers those tools at once and replies
|
|
101995
|
+
without waiting for the servers; a server keeps starting in the background, and a call to one of its
|
|
101996
|
+
tools waits for it. A server with no remembered list is waited for at most 45 seconds, after which the
|
|
101997
|
+
reply goes ahead and its tools join the next message. When starting is still slow, the agent log
|
|
101998
|
+
(\`host.log\`) names each slow part with a \`[startup]\` line - the server, Python, skills or the gateway.
|
|
101999
|
+
|
|
101550
102000
|
**Not in Fire Code**: editor file pickers \u2014 paths are typed. Fire Code's
|
|
101551
102001
|
Settings \u2192 Export source code saves the whole repository as a zip that builds offline.
|
|
101552
102002
|
`
|
|
@@ -101833,6 +102283,13 @@ morning, by which time a toast is long gone. The run log keeps a Report button.
|
|
|
101833
102283
|
"parallel",
|
|
101834
102284
|
"parallel box",
|
|
101835
102285
|
"contract",
|
|
102286
|
+
"connect a box",
|
|
102287
|
+
"box to an agent",
|
|
102288
|
+
"group of agents",
|
|
102289
|
+
"box of agents",
|
|
102290
|
+
"when they all complete",
|
|
102291
|
+
"instructions for each agent",
|
|
102292
|
+
"reference files in instructions",
|
|
101836
102293
|
"read-only role",
|
|
101837
102294
|
"instructions for a role",
|
|
101838
102295
|
"what passed between",
|
|
@@ -101892,12 +102349,25 @@ refuses a round past the maximum - the agent then stops and tells you what is st
|
|
|
101892
102349
|
|
|
101893
102350
|
**A parallel box.** Press **Add a parallel box** on the left and drop steps into it: they are consulted at the same
|
|
101894
102351
|
time, each specialist in its own process, and the strategy carries on when all have answered (the agent uses one
|
|
101895
|
-
ask_agents call). Drag the box to move it with its steps, its corner to resize it. One role belongs in a box
|
|
101896
|
-
If several of them need your approval at once, the prompts come one at a time.
|
|
101897
|
-
|
|
101898
|
-
**
|
|
101899
|
-
|
|
101900
|
-
|
|
102352
|
+
ask_agents call). Drag the box to move it with its steps, its corner to resize it. One role belongs in a parallel box
|
|
102353
|
+
once. If several of them need your approval at once, the prompts come one at a time.
|
|
102354
|
+
|
|
102355
|
+
**A box (a group of steps).** Press **Add a box** for steps done as a group, one after another - in the order of the
|
|
102356
|
+
connectors between them, else as drawn. A box of either kind can be switched on the right ("Run at the same time" or
|
|
102357
|
+
"Run as a group").
|
|
102358
|
+
|
|
102359
|
+
**Connecting a box.** A box is one step of the flow: connect it like a step, from its own dot on the right edge or with
|
|
102360
|
+
**Connect to...** when it is selected, to a step or to another box - and connect a step or a box into it. A connector
|
|
102361
|
+
out of a box is followed only once every step inside has answered; a connector into a box gives every step inside what
|
|
102362
|
+
arrives along it. A back-and-forth joins two steps, never a box, and a box is not connected to a step inside it -
|
|
102363
|
+
connect the steps inside to each other instead. A contract on a connector out of a box is told to every step inside;
|
|
102364
|
+
its required items are part of that contract rather than checked, since no single answer holds all of them.
|
|
102365
|
+
|
|
102366
|
+
**Each step:** the \u270E on a step opens **Instructions for this specialist** - what is expected of it in this strategy -
|
|
102367
|
+
sent to it with every question it is asked under this strategy. Type **@** in it to name a workspace file or folder,
|
|
102368
|
+
as in the message box: its contents are attached each time the specialist is asked, with the same confinement and
|
|
102369
|
+
deny list as @ in the chat. Leave it empty and the main agent decides what to ask it, from its plan. **Read-only** means
|
|
102370
|
+
it cannot change anything: it gets no tool that edits or runs commands, and recommends instead.
|
|
101901
102371
|
|
|
101902
102372
|
**A contract on a connector** ("What passes along here"): what one step hands to the next, such as "the failing
|
|
101903
102373
|
tests, each with file:line". The first is told its answer must contain it, the second that it will be given it and to
|
|
@@ -102592,7 +103062,19 @@ walkthrough, whose steps link straight into the tab each one is about. On the No
|
|
|
102592
103062
|
"crash log",
|
|
102593
103063
|
"why did it crash",
|
|
102594
103064
|
"exit code",
|
|
102595
|
-
"out of memory"
|
|
103065
|
+
"out of memory",
|
|
103066
|
+
"slow network",
|
|
103067
|
+
"network slowness",
|
|
103068
|
+
"flaky network",
|
|
103069
|
+
"unreliable network",
|
|
103070
|
+
"connection reset",
|
|
103071
|
+
"could not reach",
|
|
103072
|
+
"reaching the model",
|
|
103073
|
+
"first reply slow",
|
|
103074
|
+
"first message slow",
|
|
103075
|
+
"first prompt slow",
|
|
103076
|
+
"folder names",
|
|
103077
|
+
"directory names"
|
|
102596
103078
|
],
|
|
102597
103079
|
body: `
|
|
102598
103080
|
**The agent crashed, or python.exe "stopped working".** A Python tool's worker that crashes is restarted on the
|
|
@@ -102642,7 +103124,20 @@ Then check that the command is on the list, which the panel shows in full.
|
|
|
102642
103124
|
**\`@\` does not find a file** \u2014 the picker searches the workspace only, and skips \`node_modules\`,
|
|
102643
103125
|
\`.venv\`, build output and similar. config:filesystem.excludeFromMentions changes that list. Typing
|
|
102644
103126
|
more of the name narrows it; matching is case-insensitive and matches letters in order, so
|
|
102645
|
-
\`mrank\` finds \`mentionRanking.ts\`.
|
|
103127
|
+
\`mrank\` finds \`mentionRanking.ts\`. Folder names count too: \`@reports\` offers the \`reports/\` folder
|
|
103128
|
+
and the files in it, and choosing a folder keeps the picker open inside it, as does typing a path
|
|
103129
|
+
such as \`@src/reports/\`.
|
|
103130
|
+
|
|
103131
|
+
**Errors reaching the model on a slow or unreliable network** \u2014 a connection gets a minute to come up
|
|
103132
|
+
(it used to be ten seconds), and a dropped or reset connection, a slow name lookup or a timeout is
|
|
103133
|
+
tried again by itself, up to config:connection (retries) times, showing "Retrying in Ns" with the
|
|
103134
|
+
reason. An error that says nothing about retrying is one a retry would not fix: a certificate this
|
|
103135
|
+
computer does not trust, a 401, an address that is wrong.
|
|
103136
|
+
|
|
103137
|
+
**The first reply of a chat is slow and the rest are quick** \u2014 the first message used to wait for
|
|
103138
|
+
Python tools to load, skills to be read and the gateway's sign-in, one after another. These now start
|
|
103139
|
+
as soon as the chat opens, while you type; if you send before they finish, the message waits only for
|
|
103140
|
+
what is still running.
|
|
102646
103141
|
|
|
102647
103142
|
**A tool call times out** \u2014 config:tools.timeoutSeconds is the global limit, and a single tool or
|
|
102648
103143
|
MCP server can have its own; the Tools tab shows which number applies. If raising it changes
|
|
@@ -102869,7 +103364,7 @@ function createLightCodeHelpTool() {
|
|
|
102869
103364
|
|
|
102870
103365
|
// ../../packages/core/dist/tools/listFiles.js
|
|
102871
103366
|
var import_node_child_process21 = require("node:child_process");
|
|
102872
|
-
var
|
|
103367
|
+
var import_node_path59 = __toESM(require("node:path"), 1);
|
|
102873
103368
|
|
|
102874
103369
|
// ../../packages/core/dist/tools/ripgrepError.js
|
|
102875
103370
|
function ripgrepDidNotStart(error51) {
|
|
@@ -102950,7 +103445,7 @@ var listFilesTool = {
|
|
|
102950
103445
|
});
|
|
102951
103446
|
if (files.length === 0)
|
|
102952
103447
|
return noFiles;
|
|
102953
|
-
const listed = files.map((file2) => file2.split("/").join(
|
|
103448
|
+
const listed = files.map((file2) => file2.split("/").join(import_node_path59.default.sep)).join("\n");
|
|
102954
103449
|
return { content: truncated ? `${listed}
|
|
102955
103450
|
(listing cut short \u2014 list a narrower folder)` : listed };
|
|
102956
103451
|
}
|
|
@@ -103018,10 +103513,10 @@ function readSmall(raw, params3) {
|
|
|
103018
103513
|
const end = params3.limit !== void 0 ? start + params3.limit : lines2.length;
|
|
103019
103514
|
return number4(lines2.slice(start, end), start + 1);
|
|
103020
103515
|
}
|
|
103021
|
-
async function readLarge(
|
|
103516
|
+
async function readLarge(fs47, realPath, params3, size) {
|
|
103022
103517
|
const human = formatBytes(size);
|
|
103023
103518
|
if (params3.tail !== void 0) {
|
|
103024
|
-
const part = await readTail(
|
|
103519
|
+
const part = await readTail(fs47, realPath, size, params3.tail);
|
|
103025
103520
|
return [
|
|
103026
103521
|
`${human} file \u2014 last ${String(part.lines.length)} lines.`,
|
|
103027
103522
|
/*
|
|
@@ -103036,7 +103531,7 @@ async function readLarge(fs46, realPath, params3, size) {
|
|
|
103036
103531
|
}
|
|
103037
103532
|
if (params3.offset !== void 0) {
|
|
103038
103533
|
const limit = params3.limit ?? DEFAULT_LARGE_LIMIT;
|
|
103039
|
-
const part = await readLineWindow(
|
|
103534
|
+
const part = await readLineWindow(fs47, realPath, size, params3.offset, limit);
|
|
103040
103535
|
const shown2 = part.lines.length;
|
|
103041
103536
|
return [
|
|
103042
103537
|
`${human} file \u2014 lines ${String(params3.offset)}\u2013${String(params3.offset + shown2 - 1)}${part.hasMoreAfter ? ", more follows" : " (end of file)"}.`,
|
|
@@ -103044,7 +103539,7 @@ async function readLarge(fs46, realPath, params3, size) {
|
|
|
103044
103539
|
number4(part.lines, params3.offset)
|
|
103045
103540
|
].join("\n");
|
|
103046
103541
|
}
|
|
103047
|
-
const total = await countLines(
|
|
103542
|
+
const total = await countLines(fs47, realPath, size);
|
|
103048
103543
|
return [
|
|
103049
103544
|
`${realPathName(realPath)} is ${human} (${total.toLocaleString()} lines) \u2014 too large to read at once.`,
|
|
103050
103545
|
"",
|
|
@@ -103179,7 +103674,7 @@ var searchFilesTool = {
|
|
|
103179
103674
|
};
|
|
103180
103675
|
|
|
103181
103676
|
// ../../packages/core/dist/tools/writeToFile.js
|
|
103182
|
-
var
|
|
103677
|
+
var import_node_path60 = __toESM(require("node:path"), 1);
|
|
103183
103678
|
var paramsSchema23 = external_exports.object({
|
|
103184
103679
|
path: external_exports.string().min(1).describe("Path to the file, relative to the workspace root."),
|
|
103185
103680
|
content: external_exports.string().describe("Full file content to write.")
|
|
@@ -103207,7 +103702,7 @@ var writeToFileTool = {
|
|
|
103207
103702
|
return { content: changed, isError: true, path: params3.path };
|
|
103208
103703
|
}
|
|
103209
103704
|
if (!exists2) {
|
|
103210
|
-
await context.fs.mkdir(
|
|
103705
|
+
await context.fs.mkdir(import_node_path60.default.dirname(resolved.realPath));
|
|
103211
103706
|
}
|
|
103212
103707
|
await context.fs.writeFile(resolved.realPath, params3.content);
|
|
103213
103708
|
await recordWrite(context, resolved.realPath);
|
|
@@ -103309,14 +103804,14 @@ function createDefaultToolRegistry() {
|
|
|
103309
103804
|
|
|
103310
103805
|
// ../../packages/core/dist/dataset/store.js
|
|
103311
103806
|
var import_promises33 = __toESM(require("node:fs/promises"), 1);
|
|
103312
|
-
var
|
|
103807
|
+
var import_node_path61 = __toESM(require("node:path"), 1);
|
|
103313
103808
|
var DatasetStore = class {
|
|
103314
103809
|
filePath;
|
|
103315
103810
|
statePath;
|
|
103316
103811
|
constructor(storageDir, datasetId) {
|
|
103317
103812
|
const safe = datasetId.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
103318
|
-
this.filePath =
|
|
103319
|
-
this.statePath =
|
|
103813
|
+
this.filePath = import_node_path61.default.join(storageDir, "datasets", `${safe}.jsonl`);
|
|
103814
|
+
this.statePath = import_node_path61.default.join(storageDir, "datasets", `${safe}.state.json`);
|
|
103320
103815
|
}
|
|
103321
103816
|
/** Every record. A malformed line is skipped — one bad line costs one record, not the corpus. */
|
|
103322
103817
|
async load() {
|
|
@@ -103344,7 +103839,7 @@ var DatasetStore = class {
|
|
|
103344
103839
|
async append(records) {
|
|
103345
103840
|
if (records.length === 0)
|
|
103346
103841
|
return;
|
|
103347
|
-
await import_promises33.default.mkdir(
|
|
103842
|
+
await import_promises33.default.mkdir(import_node_path61.default.dirname(this.filePath), { recursive: true });
|
|
103348
103843
|
await import_promises33.default.writeFile(this.filePath, "", { flag: "a" });
|
|
103349
103844
|
const lines2 = records.map((record2) => JSON.stringify(record2)).join("\n");
|
|
103350
103845
|
await import_promises33.default.appendFile(this.filePath, `${lines2}
|
|
@@ -103352,7 +103847,7 @@ var DatasetStore = class {
|
|
|
103352
103847
|
}
|
|
103353
103848
|
/** Rewrites with exactly these. Temp-and-rename, so an interrupted prune leaves the old file. */
|
|
103354
103849
|
async replace(records) {
|
|
103355
|
-
await import_promises33.default.mkdir(
|
|
103850
|
+
await import_promises33.default.mkdir(import_node_path61.default.dirname(this.filePath), { recursive: true });
|
|
103356
103851
|
const temporary = `${this.filePath}.tmp`;
|
|
103357
103852
|
const body = records.map((record2) => JSON.stringify(record2)).join("\n");
|
|
103358
103853
|
await import_promises33.default.writeFile(temporary, records.length === 0 ? "" : `${body}
|
|
@@ -103406,7 +103901,7 @@ var DatasetStore = class {
|
|
|
103406
103901
|
}
|
|
103407
103902
|
}
|
|
103408
103903
|
async recordSync(at) {
|
|
103409
|
-
await import_promises33.default.mkdir(
|
|
103904
|
+
await import_promises33.default.mkdir(import_node_path61.default.dirname(this.statePath), { recursive: true });
|
|
103410
103905
|
const temporary = `${this.statePath}.tmp`;
|
|
103411
103906
|
await import_promises33.default.writeFile(temporary, JSON.stringify({ lastSyncedAt: at }), "utf8");
|
|
103412
103907
|
await replaceFile(temporary, this.statePath);
|
|
@@ -103600,14 +104095,14 @@ ${entry.record.text}`.toLowerCase();
|
|
|
103600
104095
|
const hits = await options.semantic.searcher.searchByVector(options.semantic.collection, vector, {
|
|
103601
104096
|
size: Math.min(100, Math.max(limit * 4, 40))
|
|
103602
104097
|
});
|
|
103603
|
-
const
|
|
104098
|
+
const rank4 = /* @__PURE__ */ new Map();
|
|
103604
104099
|
hits.forEach((hit, position) => {
|
|
103605
|
-
if (!
|
|
103606
|
-
|
|
104100
|
+
if (!rank4.has(hit.path))
|
|
104101
|
+
rank4.set(hit.path, position);
|
|
103607
104102
|
});
|
|
103608
104103
|
ordered = [...candidates].sort((a, b) => {
|
|
103609
|
-
const left =
|
|
103610
|
-
const right =
|
|
104104
|
+
const left = rank4.get(`data:${a.datasetId}:${a.record.id}`);
|
|
104105
|
+
const right = rank4.get(`data:${b.datasetId}:${b.record.id}`);
|
|
103611
104106
|
if (left !== void 0 && right !== void 0)
|
|
103612
104107
|
return left - right;
|
|
103613
104108
|
if (left !== void 0)
|
|
@@ -103838,8 +104333,8 @@ var S3Client = class {
|
|
|
103838
104333
|
const host = inPath ? origin.host : `${bucket}.${origin.host}`;
|
|
103839
104334
|
const mount = origin.pathname === "/" ? "" : origin.pathname.replace(/\/+$/, "");
|
|
103840
104335
|
const prefix = inPath ? `${mount}/${bucket}` : mount;
|
|
103841
|
-
const
|
|
103842
|
-
const url2 = new URL(`${origin.protocol}//${host}${prefix}${
|
|
104336
|
+
const path67 = key3 === "" ? "" : `/${key3.split("/").map((part) => encodeURIComponent(part)).join("/")}`;
|
|
104337
|
+
const url2 = new URL(`${origin.protocol}//${host}${prefix}${path67}`);
|
|
103843
104338
|
for (const [name, value] of Object.entries(call.query ?? {}))
|
|
103844
104339
|
url2.searchParams.set(name, value);
|
|
103845
104340
|
return url2.toString();
|
|
@@ -104106,9 +104601,9 @@ async function syncFromS3(options) {
|
|
|
104106
104601
|
return result;
|
|
104107
104602
|
}
|
|
104108
104603
|
var MANIFEST_NAME = ".lightcode-sync.json";
|
|
104109
|
-
async function readManifest(
|
|
104604
|
+
async function readManifest(fs47, manifestPath) {
|
|
104110
104605
|
try {
|
|
104111
|
-
const parsed = JSON.parse((await
|
|
104606
|
+
const parsed = JSON.parse((await fs47.readBytes(manifestPath)).toString("utf8"));
|
|
104112
104607
|
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : {};
|
|
104113
104608
|
} catch {
|
|
104114
104609
|
return {};
|
|
@@ -104126,14 +104621,14 @@ function join2(dir, relative) {
|
|
|
104126
104621
|
const left = dir.replace(/[\\/]+$/, "");
|
|
104127
104622
|
return `${left}/${relative}`;
|
|
104128
104623
|
}
|
|
104129
|
-
async function writeWhole3(
|
|
104130
|
-
if (
|
|
104131
|
-
await
|
|
104624
|
+
async function writeWhole3(fs47, target, bytes) {
|
|
104625
|
+
if (fs47.rename === void 0) {
|
|
104626
|
+
await fs47.writeBytes(target, bytes);
|
|
104132
104627
|
return;
|
|
104133
104628
|
}
|
|
104134
104629
|
const temporary = `${target}.${String(process.pid)}.${String(Date.now())}.part`;
|
|
104135
|
-
await
|
|
104136
|
-
await
|
|
104630
|
+
await fs47.writeBytes(temporary, bytes);
|
|
104631
|
+
await fs47.rename(temporary, target);
|
|
104137
104632
|
}
|
|
104138
104633
|
function dirname(filePath) {
|
|
104139
104634
|
const cut = filePath.lastIndexOf("/");
|
|
@@ -104817,7 +105312,7 @@ async function readJsonBody(request2, maxBytes = 32 * 1024 * 1024) {
|
|
|
104817
105312
|
|
|
104818
105313
|
// src/fileSecretStore.ts
|
|
104819
105314
|
var import_promises34 = __toESM(require("node:fs/promises"), 1);
|
|
104820
|
-
var
|
|
105315
|
+
var import_node_path62 = __toESM(require("node:path"), 1);
|
|
104821
105316
|
|
|
104822
105317
|
// src/vaultCrypto.ts
|
|
104823
105318
|
var import_node_crypto24 = require("node:crypto");
|
|
@@ -104915,7 +105410,7 @@ var FileSecretStore = class {
|
|
|
104915
105410
|
);
|
|
104916
105411
|
}
|
|
104917
105412
|
mutate(secrets);
|
|
104918
|
-
await import_promises34.default.mkdir(
|
|
105413
|
+
await import_promises34.default.mkdir(import_node_path62.default.dirname(this.filePath), { recursive: true });
|
|
104919
105414
|
const temp = `${this.filePath}.${process.pid}.tmp`;
|
|
104920
105415
|
const body = this.key === void 0 ? secrets : sealSecrets(secrets, this.key);
|
|
104921
105416
|
await import_promises34.default.writeFile(temp, JSON.stringify(body, null, 2), { encoding: "utf8", mode: 384 });
|
|
@@ -104952,7 +105447,7 @@ var FileSecretStore = class {
|
|
|
104952
105447
|
// src/reviewQueue.ts
|
|
104953
105448
|
var import_node_crypto25 = __toESM(require("node:crypto"), 1);
|
|
104954
105449
|
var import_promises35 = __toESM(require("node:fs/promises"), 1);
|
|
104955
|
-
var
|
|
105450
|
+
var import_node_path63 = __toESM(require("node:path"), 1);
|
|
104956
105451
|
var ReviewQueue = class {
|
|
104957
105452
|
constructor(filePath) {
|
|
104958
105453
|
this.filePath = filePath;
|
|
@@ -104971,7 +105466,7 @@ var ReviewQueue = class {
|
|
|
104971
105466
|
}
|
|
104972
105467
|
async persist(items) {
|
|
104973
105468
|
this.cache = items;
|
|
104974
|
-
await import_promises35.default.mkdir(
|
|
105469
|
+
await import_promises35.default.mkdir(import_node_path63.default.dirname(this.filePath), { recursive: true });
|
|
104975
105470
|
const temporary = `${this.filePath}.tmp`;
|
|
104976
105471
|
await import_promises35.default.writeFile(temporary, JSON.stringify(items, null, 2), { encoding: "utf8", mode: 384 });
|
|
104977
105472
|
await replaceFile(temporary, this.filePath);
|
|
@@ -105212,8 +105707,8 @@ var RoutedSecretStore = class {
|
|
|
105212
105707
|
|
|
105213
105708
|
// src/userVariables.ts
|
|
105214
105709
|
var import_promises36 = __toESM(require("node:fs/promises"), 1);
|
|
105215
|
-
var
|
|
105216
|
-
var
|
|
105710
|
+
var import_node_fs16 = require("node:fs");
|
|
105711
|
+
var import_node_path64 = __toESM(require("node:path"), 1);
|
|
105217
105712
|
var UserVariableStore = class {
|
|
105218
105713
|
constructor(filePath) {
|
|
105219
105714
|
this.filePath = filePath;
|
|
@@ -105228,7 +105723,7 @@ var UserVariableStore = class {
|
|
|
105228
105723
|
}
|
|
105229
105724
|
async save(variables) {
|
|
105230
105725
|
const parsed = sessionVariablesSchema.parse(variables);
|
|
105231
|
-
await import_promises36.default.mkdir(
|
|
105726
|
+
await import_promises36.default.mkdir(import_node_path64.default.dirname(this.filePath), { recursive: true });
|
|
105232
105727
|
const temporary = `${this.filePath}.tmp`;
|
|
105233
105728
|
await import_promises36.default.writeFile(temporary, JSON.stringify({ variables: parsed }, null, 2), {
|
|
105234
105729
|
encoding: "utf8",
|
|
@@ -105239,14 +105734,14 @@ var UserVariableStore = class {
|
|
|
105239
105734
|
}
|
|
105240
105735
|
};
|
|
105241
105736
|
function userVariableStoreFor(dataDir, principal) {
|
|
105242
|
-
return new UserVariableStore(userVariablesPath(
|
|
105737
|
+
return new UserVariableStore(userVariablesPath(import_node_path64.default.join(dataDir, "users", storageKeyFor(principal))));
|
|
105243
105738
|
}
|
|
105244
105739
|
function userVariablesPath(userDir) {
|
|
105245
|
-
return
|
|
105740
|
+
return import_node_path64.default.join(userDir, "variables.json");
|
|
105246
105741
|
}
|
|
105247
105742
|
function readVariablesFile(filePath) {
|
|
105248
105743
|
try {
|
|
105249
|
-
const raw = JSON.parse((0,
|
|
105744
|
+
const raw = JSON.parse((0, import_node_fs16.readFileSync)(filePath, "utf8"));
|
|
105250
105745
|
const parsed = sessionVariablesSchema.safeParse(raw["variables"]);
|
|
105251
105746
|
return parsed.success ? parsed.data : [];
|
|
105252
105747
|
} catch {
|
|
@@ -105270,13 +105765,13 @@ function hostedUser(env2 = process.env) {
|
|
|
105270
105765
|
}
|
|
105271
105766
|
|
|
105272
105767
|
// src/session.ts
|
|
105273
|
-
var
|
|
105768
|
+
var import_node_fs17 = require("node:fs");
|
|
105274
105769
|
var import_promises37 = __toESM(require("node:fs/promises"), 1);
|
|
105275
|
-
var
|
|
105770
|
+
var import_node_path66 = __toESM(require("node:path"), 1);
|
|
105276
105771
|
|
|
105277
105772
|
// src/credentialTool.ts
|
|
105278
105773
|
var import_node_child_process23 = require("node:child_process");
|
|
105279
|
-
var
|
|
105774
|
+
var import_node_path65 = __toESM(require("node:path"), 1);
|
|
105280
105775
|
var CREDENTIAL_PREFIX2 = "tool:";
|
|
105281
105776
|
var WRAPPER = [
|
|
105282
105777
|
"import importlib.util, json, sys",
|
|
@@ -105296,7 +105791,7 @@ async function fetchCredential(options, reference) {
|
|
|
105296
105791
|
if (name.length === 0) return { problem: "A credential reference needs a name: tool:<name>." };
|
|
105297
105792
|
const budget = options.timeoutMs ?? 3e4;
|
|
105298
105793
|
const run3 = await new Promise((resolve) => {
|
|
105299
|
-
const child = (0, import_node_child_process23.spawn)(options.interpreter, ["-c", WRAPPER,
|
|
105794
|
+
const child = (0, import_node_child_process23.spawn)(options.interpreter, ["-c", WRAPPER, import_node_path65.default.resolve(options.file), name], {
|
|
105300
105795
|
windowsHide: true,
|
|
105301
105796
|
// The environment this was started in, as with the identity function: the libraries that
|
|
105302
105797
|
// hold credentials are configured through it, and nothing here is model-authored.
|
|
@@ -105422,7 +105917,7 @@ var ToolBackedSecretStore = class _ToolBackedSecretStore {
|
|
|
105422
105917
|
};
|
|
105423
105918
|
|
|
105424
105919
|
// src/httpDeadline.ts
|
|
105425
|
-
var HEADERS_DEADLINE_MS =
|
|
105920
|
+
var HEADERS_DEADLINE_MS = 15e4;
|
|
105426
105921
|
function withHeadersDeadline(inner, budgetMs = HEADERS_DEADLINE_MS) {
|
|
105427
105922
|
return {
|
|
105428
105923
|
/*
|
|
@@ -105492,7 +105987,7 @@ var FileConfigStore = class {
|
|
|
105492
105987
|
const filePath = this.pathFor(scope);
|
|
105493
105988
|
if (filePath === void 0)
|
|
105494
105989
|
throw new Error(`Cannot write ${scope} config: no workspace is open`);
|
|
105495
|
-
await import_promises37.default.mkdir(
|
|
105990
|
+
await import_promises37.default.mkdir(import_node_path66.default.dirname(filePath), { recursive: true });
|
|
105496
105991
|
const temporary = `${filePath}.${process.pid.toString(36)}.tmp`;
|
|
105497
105992
|
await import_promises37.default.writeFile(temporary, contents, { encoding: "utf8", mode: 384 });
|
|
105498
105993
|
await replaceFile(temporary, filePath);
|
|
@@ -105529,8 +106024,8 @@ var FileConfigStore = class {
|
|
|
105529
106024
|
};
|
|
105530
106025
|
let watcher;
|
|
105531
106026
|
try {
|
|
105532
|
-
watcher = (0,
|
|
105533
|
-
if (filename ===
|
|
106027
|
+
watcher = (0, import_node_fs17.watch)(import_node_path66.default.dirname(filePath), (_event, filename) => {
|
|
106028
|
+
if (filename === import_node_path66.default.basename(filePath)) onChange();
|
|
105534
106029
|
});
|
|
105535
106030
|
} catch {
|
|
105536
106031
|
}
|
|
@@ -105558,7 +106053,7 @@ var FileWorkspaceState = class {
|
|
|
105558
106053
|
async set(key3, value) {
|
|
105559
106054
|
if (value === void 0) delete this.values[key3];
|
|
105560
106055
|
else this.values[key3] = value;
|
|
105561
|
-
await import_promises37.default.mkdir(
|
|
106056
|
+
await import_promises37.default.mkdir(import_node_path66.default.dirname(this.filePath), { recursive: true });
|
|
105562
106057
|
await import_promises37.default.writeFile(this.filePath, JSON.stringify(this.values, null, 2), {
|
|
105563
106058
|
encoding: "utf8",
|
|
105564
106059
|
mode: 384
|
|
@@ -105608,7 +106103,7 @@ function createBrowserUi(workspaceRoot, post, fastFs, shared) {
|
|
|
105608
106103
|
openFile: async (filePath) => {
|
|
105609
106104
|
try {
|
|
105610
106105
|
post(
|
|
105611
|
-
[`[info] ${
|
|
106106
|
+
[`[info] ${import_node_path66.default.basename(filePath)}`, "", await import_promises37.default.readFile(filePath, "utf8")].join("\n")
|
|
105612
106107
|
);
|
|
105613
106108
|
} catch (error51) {
|
|
105614
106109
|
post(`[warning] Could not read ${filePath}: ${String(error51)}`);
|
|
@@ -105628,11 +106123,13 @@ function createBrowserUi(workspaceRoot, post, fastFs, shared) {
|
|
|
105628
106123
|
root: searchRoot,
|
|
105629
106124
|
needle: segment,
|
|
105630
106125
|
mode: mode ?? "contains",
|
|
106126
|
+
...mode === "folders" ? { folders: true } : {},
|
|
105631
106127
|
...depth !== void 0 ? { depth } : {},
|
|
105632
106128
|
limit,
|
|
105633
106129
|
exclude: excludeFolders
|
|
105634
106130
|
});
|
|
105635
|
-
|
|
106131
|
+
const understood = mode !== "folders" || answer.folders === true;
|
|
106132
|
+
if (understood && answer.ok === true && Array.isArray(answer.paths)) return answer.paths;
|
|
105636
106133
|
} catch {
|
|
105637
106134
|
}
|
|
105638
106135
|
}
|
|
@@ -105650,10 +106147,12 @@ function createBrowserUi(workspaceRoot, post, fastFs, shared) {
|
|
|
105650
106147
|
for (const entry of entries) {
|
|
105651
106148
|
if (found2.length >= limit) return;
|
|
105652
106149
|
if (entry.name.startsWith(".") && entry.name !== ".env") continue;
|
|
105653
|
-
const full =
|
|
106150
|
+
const full = import_node_path66.default.join(dir, entry.name);
|
|
105654
106151
|
if (entry.isDirectory()) {
|
|
105655
|
-
if (
|
|
105656
|
-
|
|
106152
|
+
if (skip.has(entry.name)) continue;
|
|
106153
|
+
if (mode === "folders" && (needle.length === 0 || entry.name.toLowerCase().includes(needle))) found2.push(full);
|
|
106154
|
+
await walk(full, level2 + 1);
|
|
106155
|
+
} else if (mode === "folders" || depth !== void 0 && level2 !== depth) {
|
|
105657
106156
|
continue;
|
|
105658
106157
|
} else if (needle.length === 0 || (mode === "prefix" ? entry.name.toLowerCase().startsWith(needle) : entry.name.toLowerCase().includes(needle))) {
|
|
105659
106158
|
found2.push(full);
|
|
@@ -105686,11 +106185,11 @@ var SHARED_COLLECTIONS = [
|
|
|
105686
106185
|
{ key: "mcpServers" }
|
|
105687
106186
|
];
|
|
105688
106187
|
async function createSession(options) {
|
|
105689
|
-
const userDir =
|
|
106188
|
+
const userDir = import_node_path66.default.join(options.dataDir, "users", storageKeyFor(options.principal));
|
|
105690
106189
|
await import_promises37.default.mkdir(userDir, { recursive: true, mode: 448 });
|
|
105691
106190
|
const variableStore = new UserVariableStore(userVariablesPath(userDir));
|
|
105692
106191
|
const userVariables = () => variableStore.read();
|
|
105693
|
-
const workspaceState = new FileWorkspaceState(
|
|
106192
|
+
const workspaceState = new FileWorkspaceState(import_node_path66.default.join(userDir, "workspace-state.json"));
|
|
105694
106193
|
await workspaceState.load();
|
|
105695
106194
|
const services = {
|
|
105696
106195
|
/*
|
|
@@ -105785,16 +106284,16 @@ async function createSession(options) {
|
|
|
105785
106284
|
*/
|
|
105786
106285
|
secrets: new CredentialPointerStore(
|
|
105787
106286
|
withCredentialTool(
|
|
105788
|
-
options.sharedSecrets === void 0 ? new FileSecretStore(options.secretsFile ??
|
|
105789
|
-
new FileSecretStore(options.secretsFile ??
|
|
106287
|
+
options.sharedSecrets === void 0 ? new FileSecretStore(options.secretsFile ?? import_node_path66.default.join(userDir, "secrets.json"), options.secretsKey) : new RoutedSecretStore(
|
|
106288
|
+
new FileSecretStore(options.secretsFile ?? import_node_path66.default.join(userDir, "secrets.json"), options.secretsKey),
|
|
105790
106289
|
options.sharedSecrets
|
|
105791
106290
|
),
|
|
105792
106291
|
options
|
|
105793
106292
|
)
|
|
105794
106293
|
),
|
|
105795
106294
|
configStore: withSharedEntries(
|
|
105796
|
-
options.sharedProfiles === void 0 ? new FileConfigStore(options.configFile ??
|
|
105797
|
-
new FileConfigStore(options.configFile ??
|
|
106295
|
+
options.sharedProfiles === void 0 ? new FileConfigStore(options.configFile ?? import_node_path66.default.join(userDir, "config.json"), options.workspaceRoot) : new SharedProfileConfigStore(
|
|
106296
|
+
new FileConfigStore(options.configFile ?? import_node_path66.default.join(userDir, "config.json"), options.workspaceRoot),
|
|
105798
106297
|
options.sharedProfiles
|
|
105799
106298
|
),
|
|
105800
106299
|
options
|
|
@@ -105912,8 +106411,8 @@ async function startServer(options) {
|
|
|
105912
106411
|
));
|
|
105913
106412
|
const roles = options.roles ?? SINGLE_USER_POLICY;
|
|
105914
106413
|
const sharedStore = options.sharedConfig;
|
|
105915
|
-
const sharedSecretStore = new FileSecretStore(
|
|
105916
|
-
const reviews = new ReviewQueue(
|
|
106414
|
+
const sharedSecretStore = new FileSecretStore(import_node_path67.default.join(options.dataDir, "shared-secrets.json"));
|
|
106415
|
+
const reviews = new ReviewQueue(import_node_path67.default.join(options.dataDir, "reviews.json"));
|
|
105917
106416
|
let sharedCache = {
|
|
105918
106417
|
variables: [],
|
|
105919
106418
|
adminIds: [],
|
|
@@ -106294,14 +106793,14 @@ async function startServer(options) {
|
|
|
106294
106793
|
return "No workspace is open, so there is nowhere to write it.";
|
|
106295
106794
|
try {
|
|
106296
106795
|
if (item2.kind === "skill") {
|
|
106297
|
-
const dir2 =
|
|
106796
|
+
const dir2 = import_node_path67.default.join(options.workspaceRoot, ".lightcode", "skills");
|
|
106298
106797
|
await import_promises38.default.mkdir(dir2, { recursive: true });
|
|
106299
|
-
await import_promises38.default.writeFile(
|
|
106798
|
+
await import_promises38.default.writeFile(import_node_path67.default.join(dir2, `${item2.name}.md`), item2.content, "utf8");
|
|
106300
106799
|
return void 0;
|
|
106301
106800
|
}
|
|
106302
|
-
const dir =
|
|
106801
|
+
const dir = import_node_path67.default.join(options.workspaceRoot, ".lightcode", "tools");
|
|
106303
106802
|
await import_promises38.default.mkdir(dir, { recursive: true });
|
|
106304
|
-
await import_promises38.default.writeFile(
|
|
106803
|
+
await import_promises38.default.writeFile(import_node_path67.default.join(dir, `${item2.name}.py`), item2.content, "utf8");
|
|
106305
106804
|
return void 0;
|
|
106306
106805
|
} catch (error51) {
|
|
106307
106806
|
return error51 instanceof Error ? error51.message : String(error51);
|
|
@@ -106340,7 +106839,7 @@ async function startServer(options) {
|
|
|
106340
106839
|
connection.transport.post({ type: "credentials", credentials: await readCredentials() });
|
|
106341
106840
|
}
|
|
106342
106841
|
if (options.credentialsFile !== void 0) {
|
|
106343
|
-
(0,
|
|
106842
|
+
(0, import_node_fs18.watchFile)(options.credentialsFile, { interval: 1500 }, () => {
|
|
106344
106843
|
for (const connection of connections.values()) void postCredentials(connection);
|
|
106345
106844
|
});
|
|
106346
106845
|
}
|
|
@@ -106450,7 +106949,7 @@ async function startServer(options) {
|
|
|
106450
106949
|
return;
|
|
106451
106950
|
}
|
|
106452
106951
|
response.writeHead(200, {
|
|
106453
|
-
"Content-Type": CONTENT_TYPES2[
|
|
106952
|
+
"Content-Type": CONTENT_TYPES2[import_node_path67.default.extname(asset)] ?? "application/octet-stream",
|
|
106454
106953
|
...securityHeaders()
|
|
106455
106954
|
});
|
|
106456
106955
|
response.end(body);
|