@chosengeneration/light-code 0.157.0 → 0.158.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/cli.cjs +921 -667
- package/dist/server.cjs +867 -613
- 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 path63 = 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 (path63 && !path63.startsWith("/")) {
|
|
502
|
+
path63 = `/${path63}`;
|
|
503
503
|
}
|
|
504
|
-
url2 = new URL(origin +
|
|
504
|
+
url2 = new URL(origin + path63);
|
|
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(path63) {
|
|
2119
|
+
if (typeof path63 !== "string") {
|
|
2120
2120
|
return "";
|
|
2121
2121
|
}
|
|
2122
|
-
for (var i =
|
|
2123
|
-
switch (
|
|
2122
|
+
for (var i = path63.length - 1; i >= 0; --i) {
|
|
2123
|
+
switch (path63.charCodeAt(i)) {
|
|
2124
2124
|
case 47:
|
|
2125
2125
|
// '/'
|
|
2126
2126
|
case 92:
|
|
2127
|
-
|
|
2128
|
-
return
|
|
2127
|
+
path63 = path63.slice(i + 1);
|
|
2128
|
+
return path63 === ".." || path63 === "." ? "" : path63;
|
|
2129
2129
|
}
|
|
2130
2130
|
}
|
|
2131
|
-
return
|
|
2131
|
+
return path63 === ".." || path63 === "." ? "" : path63;
|
|
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: path63,
|
|
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 path63 !== "string") {
|
|
5176
5176
|
throw new InvalidArgumentError("path must be a string");
|
|
5177
|
-
} else if (
|
|
5177
|
+
} else if (path63[0] !== "/" && !(path63.startsWith("http://") || path63.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(path63) !== 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(path63, query) : path63;
|
|
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 path63 = 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 = path63;
|
|
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], request);
|
|
7490
7490
|
return;
|
|
7491
7491
|
}
|
|
7492
|
-
const { body, method, path:
|
|
7492
|
+
const { body, method, path: path63, host, upgrade, headers, blocking, reset } = request;
|
|
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} ${path63} 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, request) {
|
|
7605
|
-
const { body, method, path:
|
|
7605
|
+
const { body, method, path: path63, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
|
|
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] = path63;
|
|
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(path63) {
|
|
9889
|
+
if (typeof path63 !== "string") {
|
|
9890
|
+
return path63;
|
|
9891
9891
|
}
|
|
9892
|
-
const pathSegments =
|
|
9892
|
+
const pathSegments = path63.split("?");
|
|
9893
9893
|
if (pathSegments.length !== 2) {
|
|
9894
|
-
return
|
|
9894
|
+
return path63;
|
|
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: path63, method, body, headers }) {
|
|
9901
|
+
const pathMatch = matchValue(mockDispatch2.path, path63);
|
|
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, key2) {
|
|
9917
9917
|
const basePath = key2.query ? buildURL(key2.path, key2.query) : key2.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: path63 }) => matchValue(safeUrl(path63), 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: path63, method, body, headers, query } = opts;
|
|
9957
9957
|
return {
|
|
9958
|
-
path:
|
|
9958
|
+
path: path63,
|
|
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: path63, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
10408
10408
|
Method: method,
|
|
10409
10409
|
Origin: origin,
|
|
10410
|
-
Path:
|
|
10410
|
+
Path: path63,
|
|
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(path63) {
|
|
15031
|
+
for (const char of path63) {
|
|
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 path63 = opts.path;
|
|
16712
16712
|
if (!opts.path.startsWith("/")) {
|
|
16713
|
-
|
|
16713
|
+
path63 = `/${path63}`;
|
|
16714
16714
|
}
|
|
16715
|
-
url2 = new URL(util.parseOrigin(url2).origin +
|
|
16715
|
+
url2 = new URL(util.parseOrigin(url2).origin + path63);
|
|
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(path63) {
|
|
19987
|
+
let input = path63;
|
|
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 [path63, query] = wsComponent.resourceName.split("?");
|
|
20240
|
+
wsComponent.path = path63 && path63 !== "/" ? path63 : void 0;
|
|
20241
20241
|
wsComponent.query = query;
|
|
20242
20242
|
wsComponent.resourceName = void 0;
|
|
20243
20243
|
}
|
|
@@ -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, fs43, 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, fs43[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 fs43 = require("fs");
|
|
23658
|
+
function checkPathExt(path63, 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 && path63.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, path63, options) {
|
|
23676
23676
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
23677
23677
|
return false;
|
|
23678
23678
|
}
|
|
23679
|
-
return checkPathExt(
|
|
23679
|
+
return checkPathExt(path63, options);
|
|
23680
23680
|
}
|
|
23681
|
-
function isexe(
|
|
23682
|
-
|
|
23683
|
-
cb(er, er ? false : checkStat(stat,
|
|
23681
|
+
function isexe(path63, options, cb) {
|
|
23682
|
+
fs43.stat(path63, function(er, stat) {
|
|
23683
|
+
cb(er, er ? false : checkStat(stat, path63, options));
|
|
23684
23684
|
});
|
|
23685
23685
|
}
|
|
23686
|
-
function sync(
|
|
23687
|
-
return checkStat(
|
|
23686
|
+
function sync(path63, options) {
|
|
23687
|
+
return checkStat(fs43.statSync(path63), path63, 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 fs43 = require("fs");
|
|
23698
|
+
function isexe(path63, options, cb) {
|
|
23699
|
+
fs43.stat(path63, 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(path63, options) {
|
|
23704
|
+
return checkStat(fs43.statSync(path63), 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 fs43 = 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(path63, 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(path63, 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(path63, 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(path63, options) {
|
|
23767
23767
|
try {
|
|
23768
|
-
return core.sync(
|
|
23768
|
+
return core.sync(path63, 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 path63 = 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 = path63.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 = path63.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 path63 = 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 ? path63.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 = path63.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 [path63, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
23979
|
+
const binary = path63.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 fs43 = 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 = fs43.openSync(command, "r");
|
|
24000
|
+
fs43.readSync(fd, buffer, 0, size, 0);
|
|
24001
|
+
fs43.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 path63 = 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 = path63.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(" ");
|
|
@@ -24257,10 +24257,10 @@ __export(server_exports, {
|
|
|
24257
24257
|
startServer: () => startServer
|
|
24258
24258
|
});
|
|
24259
24259
|
module.exports = __toCommonJS(server_exports);
|
|
24260
|
-
var
|
|
24261
|
-
var
|
|
24260
|
+
var import_promises36 = __toESM(require("node:fs/promises"), 1);
|
|
24261
|
+
var import_node_fs16 = require("node:fs");
|
|
24262
24262
|
var import_node_http = require("node:http");
|
|
24263
|
-
var
|
|
24263
|
+
var import_node_path63 = __toESM(require("node:path"), 1);
|
|
24264
24264
|
|
|
24265
24265
|
// ../../packages/core/dist/platform/http.js
|
|
24266
24266
|
var import_node_crypto = require("node:crypto");
|
|
@@ -25421,10 +25421,10 @@ function mergeDefs(...defs) {
|
|
|
25421
25421
|
function cloneDef(schema8) {
|
|
25422
25422
|
return mergeDefs(schema8._zod.def);
|
|
25423
25423
|
}
|
|
25424
|
-
function getElementAtPath(obj,
|
|
25425
|
-
if (!
|
|
25424
|
+
function getElementAtPath(obj, path63) {
|
|
25425
|
+
if (!path63)
|
|
25426
25426
|
return obj;
|
|
25427
|
-
return
|
|
25427
|
+
return path63.reduce((acc, key2) => acc?.[key2], obj);
|
|
25428
25428
|
}
|
|
25429
25429
|
function promiseAllObject(promisesObj) {
|
|
25430
25430
|
const keys = Object.keys(promisesObj);
|
|
@@ -25833,11 +25833,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
25833
25833
|
}
|
|
25834
25834
|
return false;
|
|
25835
25835
|
}
|
|
25836
|
-
function prefixIssues(
|
|
25836
|
+
function prefixIssues(path63, issues) {
|
|
25837
25837
|
return issues.map((iss) => {
|
|
25838
25838
|
var _a3;
|
|
25839
25839
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
25840
|
-
iss.path.unshift(
|
|
25840
|
+
iss.path.unshift(path63);
|
|
25841
25841
|
return iss;
|
|
25842
25842
|
});
|
|
25843
25843
|
}
|
|
@@ -25984,16 +25984,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
25984
25984
|
}
|
|
25985
25985
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
25986
25986
|
const fieldErrors = { _errors: [] };
|
|
25987
|
-
const processError = (error52,
|
|
25987
|
+
const processError = (error52, path63 = []) => {
|
|
25988
25988
|
for (const issue2 of error52.issues) {
|
|
25989
25989
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
25990
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
25990
|
+
issue2.errors.map((issues) => processError({ issues }, [...path63, ...issue2.path]));
|
|
25991
25991
|
} else if (issue2.code === "invalid_key") {
|
|
25992
|
-
processError({ issues: issue2.issues }, [...
|
|
25992
|
+
processError({ issues: issue2.issues }, [...path63, ...issue2.path]);
|
|
25993
25993
|
} else if (issue2.code === "invalid_element") {
|
|
25994
|
-
processError({ issues: issue2.issues }, [...
|
|
25994
|
+
processError({ issues: issue2.issues }, [...path63, ...issue2.path]);
|
|
25995
25995
|
} else {
|
|
25996
|
-
const fullpath = [...
|
|
25996
|
+
const fullpath = [...path63, ...issue2.path];
|
|
25997
25997
|
if (fullpath.length === 0) {
|
|
25998
25998
|
fieldErrors._errors.push(mapper(issue2));
|
|
25999
25999
|
} else {
|
|
@@ -26020,17 +26020,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
26020
26020
|
}
|
|
26021
26021
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
26022
26022
|
const result = { errors: [] };
|
|
26023
|
-
const processError = (error52,
|
|
26023
|
+
const processError = (error52, path63 = []) => {
|
|
26024
26024
|
var _a3, _b;
|
|
26025
26025
|
for (const issue2 of error52.issues) {
|
|
26026
26026
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
26027
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
26027
|
+
issue2.errors.map((issues) => processError({ issues }, [...path63, ...issue2.path]));
|
|
26028
26028
|
} else if (issue2.code === "invalid_key") {
|
|
26029
|
-
processError({ issues: issue2.issues }, [...
|
|
26029
|
+
processError({ issues: issue2.issues }, [...path63, ...issue2.path]);
|
|
26030
26030
|
} else if (issue2.code === "invalid_element") {
|
|
26031
|
-
processError({ issues: issue2.issues }, [...
|
|
26031
|
+
processError({ issues: issue2.issues }, [...path63, ...issue2.path]);
|
|
26032
26032
|
} else {
|
|
26033
|
-
const fullpath = [...
|
|
26033
|
+
const fullpath = [...path63, ...issue2.path];
|
|
26034
26034
|
if (fullpath.length === 0) {
|
|
26035
26035
|
result.errors.push(mapper(issue2));
|
|
26036
26036
|
continue;
|
|
@@ -26062,8 +26062,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
26062
26062
|
}
|
|
26063
26063
|
function toDotPath(_path) {
|
|
26064
26064
|
const segs = [];
|
|
26065
|
-
const
|
|
26066
|
-
for (const seg of
|
|
26065
|
+
const path63 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
26066
|
+
for (const seg of path63) {
|
|
26067
26067
|
if (typeof seg === "number")
|
|
26068
26068
|
segs.push(`[${seg}]`);
|
|
26069
26069
|
else if (typeof seg === "symbol")
|
|
@@ -38755,13 +38755,13 @@ function resolveRef(ref, ctx) {
|
|
|
38755
38755
|
if (!ref.startsWith("#")) {
|
|
38756
38756
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
38757
38757
|
}
|
|
38758
|
-
const
|
|
38759
|
-
if (
|
|
38758
|
+
const path63 = ref.slice(1).split("/").filter(Boolean);
|
|
38759
|
+
if (path63.length === 0) {
|
|
38760
38760
|
return ctx.rootSchema;
|
|
38761
38761
|
}
|
|
38762
38762
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
38763
|
-
if (
|
|
38764
|
-
const key2 =
|
|
38763
|
+
if (path63[0] === defsKey) {
|
|
38764
|
+
const key2 = path63[1];
|
|
38765
38765
|
if (!key2 || !ctx.defs[key2]) {
|
|
38766
38766
|
throw new Error(`Reference not found: ${ref}`);
|
|
38767
38767
|
}
|
|
@@ -40670,6 +40670,17 @@ var configSchema = external_exports.object({
|
|
|
40670
40670
|
* committed there, everyone's brought back. Uses the Bitbucket connection and its token.
|
|
40671
40671
|
* **User-scope only**: it chooses where this person's skills and tools are sent.
|
|
40672
40672
|
*/
|
|
40673
|
+
/**
|
|
40674
|
+
* Branch folders - several branches of one repository open at once (git worktrees, git/worktrees.ts).
|
|
40675
|
+
* `folder`: where they go (default beside the repository, `<repo>.worktrees`); `setupCommand`: run once in a
|
|
40676
|
+
* new one (`pnpm install`); `copyFiles`: untracked files copied from the main checkout (`.env`).
|
|
40677
|
+
* **User-scope only** - the command runs on this machine - and per project.
|
|
40678
|
+
*/
|
|
40679
|
+
branches: external_exports.object({
|
|
40680
|
+
folder: external_exports.string(),
|
|
40681
|
+
setupCommand: external_exports.string(),
|
|
40682
|
+
copyFiles: external_exports.array(external_exports.string())
|
|
40683
|
+
}).partial(),
|
|
40673
40684
|
teamRepo: external_exports.object({
|
|
40674
40685
|
enabled: external_exports.boolean(),
|
|
40675
40686
|
project: external_exports.string().min(1),
|
|
@@ -41478,6 +41489,8 @@ var USER_SCOPE_ONLY_KEYS = [
|
|
|
41478
41489
|
"skills",
|
|
41479
41490
|
// Where this person's skills and tools are committed: a repository able to set it would send them elsewhere.
|
|
41480
41491
|
"teamRepo",
|
|
41492
|
+
// A command run in every new branch folder: a repository able to set it would run a program of its choosing.
|
|
41493
|
+
"branches",
|
|
41481
41494
|
// Which skills go to the team pool: a repository able to set it could publish skills the user
|
|
41482
41495
|
// chose to keep to themselves.
|
|
41483
41496
|
"teamSkills",
|
|
@@ -41560,7 +41573,9 @@ var OVERRIDABLE_KEYS = [
|
|
|
41560
41573
|
/** One repository on a slow share needs longer than another on local disk. */
|
|
41561
41574
|
"tools",
|
|
41562
41575
|
/** What this project is called. A project name that did not vary by project would be no name. */
|
|
41563
|
-
"project"
|
|
41576
|
+
"project",
|
|
41577
|
+
/** Branch folders: one project's setup is pnpm install, another's uv sync. */
|
|
41578
|
+
"branches"
|
|
41564
41579
|
];
|
|
41565
41580
|
function workspaceOverrideKey(workspaceRoot) {
|
|
41566
41581
|
const resolved = import_node_path3.default.resolve(workspaceRoot);
|
|
@@ -44085,8 +44100,8 @@ var SUPERSEDED_MARKER = "[Superseded: this file was read again later in the conv
|
|
|
44085
44100
|
function readFilePath(argumentsJson) {
|
|
44086
44101
|
try {
|
|
44087
44102
|
const parsed = JSON.parse(argumentsJson.length > 0 ? argumentsJson : "{}");
|
|
44088
|
-
const
|
|
44089
|
-
return typeof
|
|
44103
|
+
const path63 = parsed.path;
|
|
44104
|
+
return typeof path63 === "string" && path63.length > 0 ? path63 : void 0;
|
|
44090
44105
|
} catch {
|
|
44091
44106
|
return void 0;
|
|
44092
44107
|
}
|
|
@@ -44099,8 +44114,8 @@ function dropSupersededReads(messages) {
|
|
|
44099
44114
|
for (const toolCall of message4.toolCalls ?? []) {
|
|
44100
44115
|
if (toolCall.name !== "read_file")
|
|
44101
44116
|
continue;
|
|
44102
|
-
const
|
|
44103
|
-
if (
|
|
44117
|
+
const path63 = readFilePath(toolCall.arguments);
|
|
44118
|
+
if (path63 === void 0)
|
|
44104
44119
|
continue;
|
|
44105
44120
|
keyByCallId.set(toolCall.id, toolCall.arguments);
|
|
44106
44121
|
}
|
|
@@ -46950,13 +46965,13 @@ var OpenSearchClient = class {
|
|
|
46950
46965
|
* `_bulk`, `_delete_by_query`, index creation — is refused here rather than merely
|
|
46951
46966
|
* unused, so no future edit or crafted argument can turn a read client into a writer.
|
|
46952
46967
|
*/
|
|
46953
|
-
async request(
|
|
46968
|
+
async request(path63, options = {}) {
|
|
46954
46969
|
const method = options.method ?? "GET";
|
|
46955
|
-
const isSearchPost = method === "POST" && /\/_search(\?|$)/.test(
|
|
46970
|
+
const isSearchPost = method === "POST" && /\/_search(\?|$)/.test(path63);
|
|
46956
46971
|
if (method !== "GET" && !isSearchPost) {
|
|
46957
|
-
throw new OpenSearchError(`Refusing ${method} ${
|
|
46972
|
+
throw new OpenSearchError(`Refusing ${method} ${path63}: this client is read-only. Indexing goes through the indexer, which the user starts from Settings.`);
|
|
46958
46973
|
}
|
|
46959
|
-
const url2 = `${this.base}${
|
|
46974
|
+
const url2 = `${this.base}${path63}`;
|
|
46960
46975
|
const request = {
|
|
46961
46976
|
method,
|
|
46962
46977
|
headers: this.headers()
|
|
@@ -47123,11 +47138,11 @@ function collectFields(properties, prefix, out) {
|
|
|
47123
47138
|
return;
|
|
47124
47139
|
for (const [name, raw] of Object.entries(properties)) {
|
|
47125
47140
|
const field2 = raw;
|
|
47126
|
-
const
|
|
47141
|
+
const path63 = prefix.length > 0 ? `${prefix}.${name}` : name;
|
|
47127
47142
|
if (typeof field2.type === "string")
|
|
47128
|
-
out[
|
|
47143
|
+
out[path63] = field2.type;
|
|
47129
47144
|
if (field2.properties !== void 0)
|
|
47130
|
-
collectFields(field2.properties,
|
|
47145
|
+
collectFields(field2.properties, path63, out);
|
|
47131
47146
|
}
|
|
47132
47147
|
}
|
|
47133
47148
|
function describeStatus(status2, url2, body) {
|
|
@@ -47146,23 +47161,23 @@ function describeStatus(status2, url2, body) {
|
|
|
47146
47161
|
var TEXT_TYPES = /* @__PURE__ */ new Set(["text", "match_only_text", "search_as_you_type", "wildcard"]);
|
|
47147
47162
|
var KEYWORD_TYPES = /* @__PURE__ */ new Set(["keyword", "constant_keyword"]);
|
|
47148
47163
|
var NOISE_FIELDS = /* @__PURE__ */ new Set(["@version", "ecs", "tags", "stream", "input", "agent", "host", "event"]);
|
|
47149
|
-
function leafName(
|
|
47150
|
-
const parts =
|
|
47151
|
-
return parts[parts.length - 1] ??
|
|
47164
|
+
function leafName(path63) {
|
|
47165
|
+
const parts = path63.split(".");
|
|
47166
|
+
return parts[parts.length - 1] ?? path63;
|
|
47152
47167
|
}
|
|
47153
47168
|
function selectQueryFields(mapping, limit = 25) {
|
|
47154
47169
|
const text2 = [];
|
|
47155
47170
|
const keyword = [];
|
|
47156
|
-
for (const [
|
|
47157
|
-
if (NOISE_FIELDS.has(leafName(
|
|
47171
|
+
for (const [path63, type] of Object.entries(mapping)) {
|
|
47172
|
+
if (NOISE_FIELDS.has(leafName(path63)) || NOISE_FIELDS.has(path63.split(".")[0] ?? ""))
|
|
47158
47173
|
continue;
|
|
47159
47174
|
if (TEXT_TYPES.has(type)) {
|
|
47160
|
-
text2.push(
|
|
47175
|
+
text2.push(path63);
|
|
47161
47176
|
} else if (KEYWORD_TYPES.has(type)) {
|
|
47162
|
-
const parent =
|
|
47163
|
-
if (
|
|
47177
|
+
const parent = path63.replace(/\.keyword$/, "");
|
|
47178
|
+
if (path63.endsWith(".keyword") && TEXT_TYPES.has(mapping[parent] ?? ""))
|
|
47164
47179
|
continue;
|
|
47165
|
-
keyword.push(
|
|
47180
|
+
keyword.push(path63);
|
|
47166
47181
|
}
|
|
47167
47182
|
}
|
|
47168
47183
|
const byDepth = (a, b) => a.split(".").length - b.split(".").length || a.localeCompare(b);
|
|
@@ -47304,8 +47319,8 @@ var OpenSearchIndexWriter = class {
|
|
|
47304
47319
|
}
|
|
47305
47320
|
return headers;
|
|
47306
47321
|
}
|
|
47307
|
-
async request(
|
|
47308
|
-
const url2 = `${this.connection.url.replace(/\/+$/, "")}${
|
|
47322
|
+
async request(path63, method, body, signal) {
|
|
47323
|
+
const url2 = `${this.connection.url.replace(/\/+$/, "")}${path63}`;
|
|
47309
47324
|
const request = { method, headers: this.headers() };
|
|
47310
47325
|
if (body !== void 0) {
|
|
47311
47326
|
if (typeof body === "string") {
|
|
@@ -47519,13 +47534,13 @@ var OpenSearchIndexWriter = class {
|
|
|
47519
47534
|
for (const hit of hits) {
|
|
47520
47535
|
const source = hit._source ?? {};
|
|
47521
47536
|
const vector = source.vector;
|
|
47522
|
-
const
|
|
47523
|
-
if (typeof
|
|
47537
|
+
const path63 = source.path;
|
|
47538
|
+
if (typeof path63 !== "string" || !Array.isArray(vector))
|
|
47524
47539
|
continue;
|
|
47525
47540
|
documents.push({
|
|
47526
47541
|
id: hit._id ?? "",
|
|
47527
47542
|
text: typeof source.text === "string" ? source.text : "",
|
|
47528
|
-
path:
|
|
47543
|
+
path: path63,
|
|
47529
47544
|
startLine: typeof source.startLine === "number" ? source.startLine : 1,
|
|
47530
47545
|
endLine: typeof source.endLine === "number" ? source.endLine : 1,
|
|
47531
47546
|
vector
|
|
@@ -47599,8 +47614,8 @@ var RestTransport = class {
|
|
|
47599
47614
|
* threw would push every caller into catching and re-inspecting an error to find out
|
|
47600
47615
|
* whether it was really an error. `expectOk` is there for the cases that are.
|
|
47601
47616
|
*/
|
|
47602
|
-
async send(
|
|
47603
|
-
const url2 = `${this.connection.url.replace(/\/+$/, "")}${
|
|
47617
|
+
async send(path63, method, body, signal) {
|
|
47618
|
+
const url2 = `${this.connection.url.replace(/\/+$/, "")}${path63}`;
|
|
47604
47619
|
const request = { method, headers: this.headers() };
|
|
47605
47620
|
if (body !== void 0)
|
|
47606
47621
|
request.body = JSON.stringify(body);
|
|
@@ -47626,11 +47641,11 @@ var RestTransport = class {
|
|
|
47626
47641
|
return { status: response.status, body: parsed };
|
|
47627
47642
|
}
|
|
47628
47643
|
/** Sends, and throws unless the status is 2xx. */
|
|
47629
|
-
async expectOk(
|
|
47630
|
-
const result = await this.send(
|
|
47644
|
+
async expectOk(path63, method, body, signal) {
|
|
47645
|
+
const result = await this.send(path63, method, body, signal);
|
|
47631
47646
|
if (result.status < 200 || result.status >= 300) {
|
|
47632
47647
|
const detail = typeof result.body === "string" ? result.body : JSON.stringify(result.body ?? "");
|
|
47633
|
-
throw new VectorStoreError(`${method} ${
|
|
47648
|
+
throw new VectorStoreError(`${method} ${path63} on ${this.label} returned HTTP ${String(result.status)}. ${detail.slice(0, 300)}`, result.status);
|
|
47634
47649
|
}
|
|
47635
47650
|
return result.body;
|
|
47636
47651
|
}
|
|
@@ -47738,10 +47753,10 @@ var ChromaSearcher = class extends ChromaBase {
|
|
|
47738
47753
|
const matches = [];
|
|
47739
47754
|
for (let index = 0; index < ids.length; index++) {
|
|
47740
47755
|
const metadata = metadatas[index] ?? {};
|
|
47741
|
-
const
|
|
47742
|
-
if (
|
|
47756
|
+
const path63 = typeof metadata.path === "string" ? metadata.path : void 0;
|
|
47757
|
+
if (path63 === void 0)
|
|
47743
47758
|
continue;
|
|
47744
|
-
if (prefix !== void 0 && prefix.length > 0 && !
|
|
47759
|
+
if (prefix !== void 0 && prefix.length > 0 && !path63.startsWith(prefix))
|
|
47745
47760
|
continue;
|
|
47746
47761
|
if (projectHere && typeof metadata.project === "string" && !options.project?.names.includes(metadata.project))
|
|
47747
47762
|
continue;
|
|
@@ -47755,7 +47770,7 @@ var ChromaSearcher = class extends ChromaBase {
|
|
|
47755
47770
|
*/
|
|
47756
47771
|
score: typeof distance === "number" ? 1 / (1 + Math.max(0, distance)) : 0,
|
|
47757
47772
|
text: documents[index] ?? (typeof metadata.text === "string" ? metadata.text : ""),
|
|
47758
|
-
path:
|
|
47773
|
+
path: path63
|
|
47759
47774
|
};
|
|
47760
47775
|
if (typeof metadata.startLine === "number")
|
|
47761
47776
|
match.startLine = metadata.startLine;
|
|
@@ -47866,13 +47881,13 @@ var ChromaIndexWriter = class extends ChromaBase {
|
|
|
47866
47881
|
for (let index = 0; index < ids.length; index++) {
|
|
47867
47882
|
const metadata = result.metadatas?.[index] ?? {};
|
|
47868
47883
|
const vector = result.embeddings?.[index];
|
|
47869
|
-
const
|
|
47870
|
-
if (
|
|
47884
|
+
const path63 = typeof metadata.path === "string" ? metadata.path : void 0;
|
|
47885
|
+
if (path63 === void 0 || !Array.isArray(vector))
|
|
47871
47886
|
continue;
|
|
47872
47887
|
documents.push({
|
|
47873
47888
|
id: ids[index] ?? "",
|
|
47874
47889
|
text: result.documents?.[index] ?? "",
|
|
47875
|
-
path:
|
|
47890
|
+
path: path63,
|
|
47876
47891
|
startLine: typeof metadata.startLine === "number" ? metadata.startLine : 1,
|
|
47877
47892
|
endLine: typeof metadata.endLine === "number" ? metadata.endLine : 1,
|
|
47878
47893
|
vector
|
|
@@ -47889,9 +47904,9 @@ var ChromaIndexWriter = class extends ChromaBase {
|
|
|
47889
47904
|
const result = await this.rest.expectOk(`${this.base}/collections/${found2.id}/get`, "POST", { include: ["metadatas"], limit }, options.signal);
|
|
47890
47905
|
const paths = /* @__PURE__ */ new Set();
|
|
47891
47906
|
for (const metadata of result.metadatas ?? []) {
|
|
47892
|
-
const
|
|
47893
|
-
if (typeof
|
|
47894
|
-
paths.add(
|
|
47907
|
+
const path63 = metadata?.path;
|
|
47908
|
+
if (typeof path63 === "string")
|
|
47909
|
+
paths.add(path63);
|
|
47895
47910
|
}
|
|
47896
47911
|
return [...paths];
|
|
47897
47912
|
}
|
|
@@ -47918,14 +47933,14 @@ var MARKER_ID = "5f6d2a41-0000-5000-8000-6c69676874c0";
|
|
|
47918
47933
|
var MARKER_MARK = "light-code";
|
|
47919
47934
|
function toMatch(point) {
|
|
47920
47935
|
const payload = point.payload ?? {};
|
|
47921
|
-
const
|
|
47922
|
-
if (
|
|
47936
|
+
const path63 = typeof payload.path === "string" ? payload.path : void 0;
|
|
47937
|
+
if (path63 === void 0)
|
|
47923
47938
|
return void 0;
|
|
47924
47939
|
const match = {
|
|
47925
47940
|
id: typeof payload.chunkId === "string" ? payload.chunkId : point.id,
|
|
47926
47941
|
score: typeof point.score === "number" ? point.score : 0,
|
|
47927
47942
|
text: typeof payload.text === "string" ? payload.text : "",
|
|
47928
|
-
path:
|
|
47943
|
+
path: path63
|
|
47929
47944
|
};
|
|
47930
47945
|
if (typeof payload.startLine === "number")
|
|
47931
47946
|
match.startLine = payload.startLine;
|
|
@@ -48119,13 +48134,13 @@ var QdrantIndexWriter = class extends QdrantBase {
|
|
|
48119
48134
|
const documents = [];
|
|
48120
48135
|
for (const point of result.body.result?.points ?? []) {
|
|
48121
48136
|
const payload = point.payload ?? {};
|
|
48122
|
-
const
|
|
48123
|
-
if (
|
|
48137
|
+
const path63 = typeof payload.path === "string" ? payload.path : void 0;
|
|
48138
|
+
if (path63 === void 0 || !Array.isArray(point.vector))
|
|
48124
48139
|
continue;
|
|
48125
48140
|
documents.push({
|
|
48126
48141
|
id: typeof payload.chunkId === "string" ? payload.chunkId : point.id,
|
|
48127
48142
|
text: typeof payload.text === "string" ? payload.text : "",
|
|
48128
|
-
path:
|
|
48143
|
+
path: path63,
|
|
48129
48144
|
startLine: typeof payload.startLine === "number" ? payload.startLine : 1,
|
|
48130
48145
|
endLine: typeof payload.endLine === "number" ? payload.endLine : 1,
|
|
48131
48146
|
vector: point.vector
|
|
@@ -48152,9 +48167,9 @@ var QdrantIndexWriter = class extends QdrantBase {
|
|
|
48152
48167
|
throw new VectorStoreError(`Could not list "${collection}" (HTTP ${String(result.status)}).`, result.status);
|
|
48153
48168
|
}
|
|
48154
48169
|
for (const point of result.body.result?.points ?? []) {
|
|
48155
|
-
const
|
|
48156
|
-
if (typeof
|
|
48157
|
-
paths.add(
|
|
48170
|
+
const path63 = point.payload?.path;
|
|
48171
|
+
if (typeof path63 === "string")
|
|
48172
|
+
paths.add(path63);
|
|
48158
48173
|
}
|
|
48159
48174
|
offset = result.body.result?.next_page_offset;
|
|
48160
48175
|
if (offset === void 0 || offset === null)
|
|
@@ -48688,8 +48703,8 @@ function teamSkillDocument(skill, body, vector, attribution) {
|
|
|
48688
48703
|
vector
|
|
48689
48704
|
};
|
|
48690
48705
|
}
|
|
48691
|
-
function nameFromPath(
|
|
48692
|
-
return
|
|
48706
|
+
function nameFromPath(path63) {
|
|
48707
|
+
return path63.startsWith("skill:") ? path63.slice("skill:".length) : path63;
|
|
48693
48708
|
}
|
|
48694
48709
|
function toHit(match, self) {
|
|
48695
48710
|
return {
|
|
@@ -51775,8 +51790,8 @@ function createMailCoverageTool(options) {
|
|
|
51775
51790
|
}
|
|
51776
51791
|
};
|
|
51777
51792
|
}
|
|
51778
|
-
function normaliseFolder(
|
|
51779
|
-
return
|
|
51793
|
+
function normaliseFolder(path63) {
|
|
51794
|
+
return path63.toLowerCase().replace(/[\\/]+/g, "\\");
|
|
51780
51795
|
}
|
|
51781
51796
|
function haystackOf(record2) {
|
|
51782
51797
|
return `${record2.subject}
|
|
@@ -52272,7 +52287,7 @@ async function refreshMail(options) {
|
|
|
52272
52287
|
const limit = options.batchLimit ?? 2e3;
|
|
52273
52288
|
const previewChars = options.previewChars ?? 400;
|
|
52274
52289
|
const sinceMs = Date.now() - options.days * 24 * 60 * 60 * 1e3;
|
|
52275
|
-
const harvested = await options.harvest(options.folders.map((
|
|
52290
|
+
const harvested = await options.harvest(options.folders.map((path63) => ({ path: path63, sinceMs })), { limit, previewChars });
|
|
52276
52291
|
const fetched = harvested.messages.map(toRecord);
|
|
52277
52292
|
if (fetched.length === 0) {
|
|
52278
52293
|
return { added: 0, more: false, total: known.length, embedded: 0, backfilled: 0, complete: [] };
|
|
@@ -52313,9 +52328,9 @@ async function syncMail(options) {
|
|
|
52313
52328
|
const backfillDone = await options.store.loadBackfillState();
|
|
52314
52329
|
const limit = options.batchLimit ?? 500;
|
|
52315
52330
|
const previewChars = options.previewChars ?? 400;
|
|
52316
|
-
const forwardRequests = options.folders.map((
|
|
52317
|
-
const mark = marks.get(
|
|
52318
|
-
return mark === void 0 ? { path:
|
|
52331
|
+
const forwardRequests = options.folders.map((path63) => {
|
|
52332
|
+
const mark = marks.get(path63);
|
|
52333
|
+
return mark === void 0 ? { path: path63 } : { path: path63, sinceMs: mark.newest - 1e3 };
|
|
52319
52334
|
});
|
|
52320
52335
|
const forward = await options.harvest(forwardRequests, { limit, previewChars });
|
|
52321
52336
|
let candidates = forward.messages.map(toRecord);
|
|
@@ -52324,15 +52339,15 @@ async function syncMail(options) {
|
|
|
52324
52339
|
let more = forward.truncated;
|
|
52325
52340
|
const remaining = limit - candidates.length;
|
|
52326
52341
|
const floor = options.retentionMonths === void 0 ? void 0 : monthsBefore(options.now ?? Date.now(), options.retentionMonths);
|
|
52327
|
-
const outstanding = options.folders.filter((
|
|
52328
|
-
const atFloor = floor === void 0 ? [] : outstanding.filter((
|
|
52329
|
-
const behind = outstanding.filter((
|
|
52342
|
+
const outstanding = options.folders.filter((path63) => marks.has(path63) && backfillDone[path63] !== true);
|
|
52343
|
+
const atFloor = floor === void 0 ? [] : outstanding.filter((path63) => marks.get(path63).oldest <= floor);
|
|
52344
|
+
const behind = outstanding.filter((path63) => !atFloor.includes(path63));
|
|
52330
52345
|
completed.push(...atFloor);
|
|
52331
52346
|
if (remaining > 0 && behind.length > 0 && options.signal?.aborted !== true) {
|
|
52332
|
-
const backRequests = behind.map((
|
|
52333
|
-
path:
|
|
52347
|
+
const backRequests = behind.map((path63) => ({
|
|
52348
|
+
path: path63,
|
|
52334
52349
|
// Strictly older, so the oldest held message is not fetched again every pass.
|
|
52335
|
-
beforeMs: marks.get(
|
|
52350
|
+
beforeMs: marks.get(path63).oldest,
|
|
52336
52351
|
// And no older than retention wants. The harvest ANDs the two into one window.
|
|
52337
52352
|
...floor === void 0 ? {} : { sinceMs: floor }
|
|
52338
52353
|
}));
|
|
@@ -52340,9 +52355,9 @@ async function syncMail(options) {
|
|
|
52340
52355
|
backfilled = backward.messages.length;
|
|
52341
52356
|
candidates = [...candidates, ...backward.messages.map(toRecord)];
|
|
52342
52357
|
const returnedFor = new Set(backward.messages.map((message4) => message4.folder));
|
|
52343
|
-
for (const
|
|
52344
|
-
if (!returnedFor.has(
|
|
52345
|
-
completed.push(
|
|
52358
|
+
for (const path63 of behind) {
|
|
52359
|
+
if (!returnedFor.has(path63))
|
|
52360
|
+
completed.push(path63);
|
|
52346
52361
|
}
|
|
52347
52362
|
if (backward.truncated || backfilled > 0)
|
|
52348
52363
|
more = true;
|
|
@@ -52350,7 +52365,7 @@ async function syncMail(options) {
|
|
|
52350
52365
|
if (completed.length > 0) {
|
|
52351
52366
|
await options.store.saveBackfillState({
|
|
52352
52367
|
...backfillDone,
|
|
52353
|
-
...Object.fromEntries(completed.map((
|
|
52368
|
+
...Object.fromEntries(completed.map((path63) => [path63, true]))
|
|
52354
52369
|
});
|
|
52355
52370
|
}
|
|
52356
52371
|
const fresh = withoutKnown(candidates, known);
|
|
@@ -52685,14 +52700,14 @@ function formatBytes(size) {
|
|
|
52685
52700
|
return `${(size / (1 << 10)).toFixed(1)}KB`;
|
|
52686
52701
|
return `${String(size)}B`;
|
|
52687
52702
|
}
|
|
52688
|
-
async function readTail(
|
|
52703
|
+
async function readTail(fs43, path63, size, count3) {
|
|
52689
52704
|
let span = Math.min(size, CHUNK);
|
|
52690
52705
|
let text2;
|
|
52691
52706
|
let start;
|
|
52692
52707
|
for (; ; ) {
|
|
52693
52708
|
start = Math.max(0, size - span);
|
|
52694
52709
|
const decoder2 = new import_node_string_decoder.StringDecoder("utf8");
|
|
52695
|
-
text2 = decoder2.write(await
|
|
52710
|
+
text2 = decoder2.write(await fs43.readBytesSlice(path63, start, size)) + decoder2.end();
|
|
52696
52711
|
const enough = text2.split("\n").length > count3;
|
|
52697
52712
|
if (enough || start === 0 || span >= size)
|
|
52698
52713
|
break;
|
|
@@ -52710,7 +52725,7 @@ async function readTail(fs42, path62, size, count3) {
|
|
|
52710
52725
|
hasMoreAfter: false
|
|
52711
52726
|
};
|
|
52712
52727
|
}
|
|
52713
|
-
async function readLineWindow(
|
|
52728
|
+
async function readLineWindow(fs43, path63, size, from, count3) {
|
|
52714
52729
|
const decoder2 = new import_node_string_decoder.StringDecoder("utf8");
|
|
52715
52730
|
const lines2 = [];
|
|
52716
52731
|
let pending = "";
|
|
@@ -52725,7 +52740,7 @@ async function readLineWindow(fs42, path62, size, from, count3) {
|
|
|
52725
52740
|
};
|
|
52726
52741
|
scan: while (position < size) {
|
|
52727
52742
|
const end = Math.min(size, position + CHUNK);
|
|
52728
|
-
pending += decoder2.write(await
|
|
52743
|
+
pending += decoder2.write(await fs43.readBytesSlice(path63, position, end));
|
|
52729
52744
|
position = end;
|
|
52730
52745
|
const parts = pending.split(/\r\n|\r|\n/);
|
|
52731
52746
|
pending = parts.pop() ?? "";
|
|
@@ -52748,13 +52763,13 @@ async function readLineWindow(fs42, path62, size, from, count3) {
|
|
|
52748
52763
|
hasMoreAfter: !reachedEnd || lineNumber > from + lines2.length
|
|
52749
52764
|
};
|
|
52750
52765
|
}
|
|
52751
|
-
async function countLines(
|
|
52766
|
+
async function countLines(fs43, path63, size) {
|
|
52752
52767
|
let newlines = 0;
|
|
52753
52768
|
let position = 0;
|
|
52754
52769
|
let lastByte = -1;
|
|
52755
52770
|
while (position < size) {
|
|
52756
52771
|
const end = Math.min(size, position + CHUNK);
|
|
52757
|
-
const buffer = await
|
|
52772
|
+
const buffer = await fs43.readBytesSlice(path63, position, end);
|
|
52758
52773
|
for (const byte of buffer)
|
|
52759
52774
|
if (byte === 10)
|
|
52760
52775
|
newlines += 1;
|
|
@@ -60085,13 +60100,13 @@ function appendSkillImages(body, images) {
|
|
|
60085
60100
|
const trimmed = body.replace(/\s+$/, "");
|
|
60086
60101
|
return [trimmed, "", "## Images", "", ...missing.map(renderSkillImage)].join("\n");
|
|
60087
60102
|
}
|
|
60088
|
-
async function listSkillImages(skillFilePath,
|
|
60103
|
+
async function listSkillImages(skillFilePath, fs43) {
|
|
60089
60104
|
const asPosix = skillFilePath.split(String.fromCharCode(92)).join("/");
|
|
60090
60105
|
if (!asPosix.toLowerCase().endsWith("/skill.md"))
|
|
60091
60106
|
return [];
|
|
60092
60107
|
const dir = `${skillFilePath.slice(0, skillFilePath.length - "SKILL.md".length)}${SKILL_IMAGE_DIR}`;
|
|
60093
60108
|
try {
|
|
60094
|
-
const entries = await
|
|
60109
|
+
const entries = await fs43.readdir(dir);
|
|
60095
60110
|
return entries.filter((entry) => !entry.isDirectory && skillImageType(entry.name) !== void 0).map((entry) => entry.name).sort();
|
|
60096
60111
|
} catch {
|
|
60097
60112
|
return [];
|
|
@@ -60141,12 +60156,12 @@ function skillFilesDir(skillFilePath) {
|
|
|
60141
60156
|
return void 0;
|
|
60142
60157
|
return `${skillFilePath.slice(0, skillFilePath.length - "SKILL.md".length)}${SKILL_FILE_DIR}`;
|
|
60143
60158
|
}
|
|
60144
|
-
async function listSkillFiles(skillFilePath,
|
|
60159
|
+
async function listSkillFiles(skillFilePath, fs43) {
|
|
60145
60160
|
const dir = skillFilesDir(skillFilePath);
|
|
60146
60161
|
if (dir === void 0)
|
|
60147
60162
|
return [];
|
|
60148
60163
|
try {
|
|
60149
|
-
const entries = await
|
|
60164
|
+
const entries = await fs43.readdir(dir);
|
|
60150
60165
|
return entries.filter((entry) => !entry.isDirectory).map((entry) => entry.name).sort();
|
|
60151
60166
|
} catch {
|
|
60152
60167
|
return [];
|
|
@@ -60778,13 +60793,13 @@ function buildExport(config2, selected) {
|
|
|
60778
60793
|
if (has(config2, key2))
|
|
60779
60794
|
exported[key2] = config2[key2];
|
|
60780
60795
|
}
|
|
60781
|
-
for (const
|
|
60782
|
-
stripPath(exported,
|
|
60796
|
+
for (const path63 of section.strip ?? [])
|
|
60797
|
+
stripPath(exported, path63);
|
|
60783
60798
|
}
|
|
60784
60799
|
return exported;
|
|
60785
60800
|
}
|
|
60786
|
-
function stripPath(target,
|
|
60787
|
-
const [head, ...rest] =
|
|
60801
|
+
function stripPath(target, path63) {
|
|
60802
|
+
const [head, ...rest] = path63.split(".");
|
|
60788
60803
|
if (head === void 0)
|
|
60789
60804
|
return;
|
|
60790
60805
|
const value = target[head];
|
|
@@ -60812,14 +60827,14 @@ function applyImport(existing, imported, selected) {
|
|
|
60812
60827
|
else
|
|
60813
60828
|
delete merged[key2];
|
|
60814
60829
|
}
|
|
60815
|
-
for (const
|
|
60816
|
-
carryPath(existing, merged,
|
|
60830
|
+
for (const path63 of section.strip ?? []) {
|
|
60831
|
+
carryPath(existing, merged, path63);
|
|
60817
60832
|
}
|
|
60818
60833
|
}
|
|
60819
60834
|
return merged;
|
|
60820
60835
|
}
|
|
60821
|
-
function carryPath(from, to,
|
|
60822
|
-
const [head, ...rest] =
|
|
60836
|
+
function carryPath(from, to, path63) {
|
|
60837
|
+
const [head, ...rest] = path63.split(".");
|
|
60823
60838
|
if (head === void 0)
|
|
60824
60839
|
return;
|
|
60825
60840
|
const source = from[head];
|
|
@@ -63301,9 +63316,9 @@ function gatewayFromSettings(input, stored) {
|
|
|
63301
63316
|
}
|
|
63302
63317
|
|
|
63303
63318
|
// ../../packages/core/dist/host/bridge.js
|
|
63304
|
-
var
|
|
63305
|
-
var
|
|
63306
|
-
var
|
|
63319
|
+
var import_node_fs11 = require("node:fs");
|
|
63320
|
+
var import_node_child_process15 = require("node:child_process");
|
|
63321
|
+
var import_promises29 = __toESM(require("node:fs/promises"), 1);
|
|
63307
63322
|
|
|
63308
63323
|
// ../../packages/core/dist/jupyter/spec.js
|
|
63309
63324
|
var jupyterHubSpecSchema = external_exports.object({
|
|
@@ -63829,7 +63844,7 @@ function ignoreDecision(rules, relative, isDirectory2, initial) {
|
|
|
63829
63844
|
}
|
|
63830
63845
|
return ignored;
|
|
63831
63846
|
}
|
|
63832
|
-
async function repositoryWideRules(
|
|
63847
|
+
async function repositoryWideRules(fs43, root, globalIgnoreFile) {
|
|
63833
63848
|
const sources = [
|
|
63834
63849
|
globalIgnoreFile ?? import_node_path29.default.join(process.env["XDG_CONFIG_HOME"] ?? import_node_path29.default.join(import_node_os4.default.homedir(), ".config"), "git", "ignore"),
|
|
63835
63850
|
import_node_path29.default.join(root, ".git", "info", "exclude")
|
|
@@ -63837,16 +63852,16 @@ async function repositoryWideRules(fs42, root, globalIgnoreFile) {
|
|
|
63837
63852
|
const rules = [];
|
|
63838
63853
|
for (const source of sources) {
|
|
63839
63854
|
try {
|
|
63840
|
-
rules.push(...parseIgnoreFile(await
|
|
63855
|
+
rules.push(...parseIgnoreFile(await fs43.readFile(source), ""));
|
|
63841
63856
|
} catch {
|
|
63842
63857
|
}
|
|
63843
63858
|
}
|
|
63844
63859
|
return rules;
|
|
63845
63860
|
}
|
|
63846
|
-
async function walkFiles(
|
|
63861
|
+
async function walkFiles(fs43, root, options) {
|
|
63847
63862
|
const maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
|
|
63848
63863
|
const files = [];
|
|
63849
|
-
const baseRules = options.includeIgnored ? [] : await repositoryWideRules(
|
|
63864
|
+
const baseRules = options.includeIgnored ? [] : await repositoryWideRules(fs43, root, options.globalIgnoreFile);
|
|
63850
63865
|
const pending = [{ relative: "", rules: baseRules }];
|
|
63851
63866
|
while (pending.length > 0) {
|
|
63852
63867
|
if (options.signal?.aborted === true)
|
|
@@ -63855,14 +63870,14 @@ async function walkFiles(fs42, root, options) {
|
|
|
63855
63870
|
const absolute = relative.length > 0 ? import_node_path29.default.join(root, ...relative.split("/")) : root;
|
|
63856
63871
|
let entries;
|
|
63857
63872
|
try {
|
|
63858
|
-
entries = await
|
|
63873
|
+
entries = await fs43.readdir(absolute);
|
|
63859
63874
|
} catch {
|
|
63860
63875
|
continue;
|
|
63861
63876
|
}
|
|
63862
63877
|
let rules = inherited;
|
|
63863
63878
|
if (!options.includeIgnored && entries.some((entry) => entry.name === ".gitignore" && !entry.isDirectory)) {
|
|
63864
63879
|
try {
|
|
63865
|
-
const text2 = await
|
|
63880
|
+
const text2 = await fs43.readFile(import_node_path29.default.join(absolute, ".gitignore"));
|
|
63866
63881
|
rules = [...inherited, ...parseIgnoreFile(text2, relative)];
|
|
63867
63882
|
} catch {
|
|
63868
63883
|
}
|
|
@@ -63924,12 +63939,12 @@ function fileFilter(filePattern) {
|
|
|
63924
63939
|
const regex = globToRegExp(glob.startsWith("/") ? glob.slice(1) : glob, anchored);
|
|
63925
63940
|
return (relative) => regex.test(relative) !== exclude;
|
|
63926
63941
|
}
|
|
63927
|
-
async function searchFiles(
|
|
63942
|
+
async function searchFiles(fs43, root, options) {
|
|
63928
63943
|
const regex = compilePattern(options.pattern);
|
|
63929
63944
|
const admits = fileFilter(options.filePattern);
|
|
63930
63945
|
const context = options.contextLines ?? 2;
|
|
63931
63946
|
const maxOutput = options.maxOutputChars ?? DEFAULT_MAX_OUTPUT;
|
|
63932
|
-
const { files, truncated: walkTruncated } = await walkFiles(
|
|
63947
|
+
const { files, truncated: walkTruncated } = await walkFiles(fs43, root, options);
|
|
63933
63948
|
const separator = process.platform === "win32" ? "\\" : "/";
|
|
63934
63949
|
const chunks = [];
|
|
63935
63950
|
let size = 0;
|
|
@@ -63942,10 +63957,10 @@ async function searchFiles(fs42, root, options) {
|
|
|
63942
63957
|
const absolute = import_node_path29.default.join(root, ...relative.split("/"));
|
|
63943
63958
|
let bytes;
|
|
63944
63959
|
try {
|
|
63945
|
-
const stat = await
|
|
63960
|
+
const stat = await fs43.stat(absolute);
|
|
63946
63961
|
if (stat.size > MAX_FILE_BYTES)
|
|
63947
63962
|
continue;
|
|
63948
|
-
bytes = await
|
|
63963
|
+
bytes = await fs43.readBytes(absolute);
|
|
63949
63964
|
} catch {
|
|
63950
63965
|
continue;
|
|
63951
63966
|
}
|
|
@@ -65884,8 +65899,8 @@ function pick2(hubs, name) {
|
|
|
65884
65899
|
|
|
65885
65900
|
// ../../packages/core/dist/host/bridge.js
|
|
65886
65901
|
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
65887
|
-
var
|
|
65888
|
-
var
|
|
65902
|
+
var import_node_fs12 = require("node:fs");
|
|
65903
|
+
var import_node_path52 = __toESM(require("node:path"), 1);
|
|
65889
65904
|
|
|
65890
65905
|
// ../../packages/core/dist/modes/autoGuidance.js
|
|
65891
65906
|
function idiomsFor(environment) {
|
|
@@ -67749,8 +67764,8 @@ var ChangeLedger = class {
|
|
|
67749
67764
|
this.chat = chat;
|
|
67750
67765
|
}
|
|
67751
67766
|
/** Best effort: a ledger that cannot be written must never fail an edit that happened. */
|
|
67752
|
-
record(
|
|
67753
|
-
const line = JSON.stringify({ chat: this.chat, path: normalizeForComparison(
|
|
67767
|
+
record(path63) {
|
|
67768
|
+
const line = JSON.stringify({ chat: this.chat, path: normalizeForComparison(path63), at: Date.now() });
|
|
67754
67769
|
void (0, import_promises23.appendFile)(this.file, `${line}
|
|
67755
67770
|
`).catch(() => void 0);
|
|
67756
67771
|
}
|
|
@@ -72097,10 +72112,10 @@ function isSafeSegment(value) {
|
|
|
72097
72112
|
function isSafeTagName(name) {
|
|
72098
72113
|
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("."));
|
|
72099
72114
|
}
|
|
72100
|
-
function encodeRepoPath(
|
|
72101
|
-
const segments =
|
|
72115
|
+
function encodeRepoPath(path63) {
|
|
72116
|
+
const segments = path63.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0);
|
|
72102
72117
|
if (segments.length === 0 || segments.some((segment) => segment === ".." || segment === ".")) {
|
|
72103
|
-
throw new AtlassianError(`"${
|
|
72118
|
+
throw new AtlassianError(`"${path63}" is not a file path inside the repository.`);
|
|
72104
72119
|
}
|
|
72105
72120
|
return segments.map(encodeURIComponent).join("/");
|
|
72106
72121
|
}
|
|
@@ -72185,24 +72200,24 @@ var BitbucketClient = class {
|
|
|
72185
72200
|
* redirect was followed, the login page came back, and the file "could not be read" although
|
|
72186
72201
|
* pull requests on the same repository could. `browse` is REST, so it authenticates like those.
|
|
72187
72202
|
*/
|
|
72188
|
-
async file(repo,
|
|
72189
|
-
const target = encodeRepoPath(
|
|
72203
|
+
async file(repo, path63, ref, signal) {
|
|
72204
|
+
const target = encodeRepoPath(path63);
|
|
72190
72205
|
const lines2 = [];
|
|
72191
72206
|
let start = 0;
|
|
72192
72207
|
for (let page = 0; page < MAX_FILE_PAGES; page += 1) {
|
|
72193
72208
|
const query = new URLSearchParams({ start: String(start), limit: String(FILE_PAGE_LINES) });
|
|
72194
72209
|
if (ref !== void 0 && ref.length > 0)
|
|
72195
72210
|
query.set("at", ref);
|
|
72196
|
-
const body = await this.rest.json(`reading ${
|
|
72211
|
+
const body = await this.rest.json(`reading ${path63}`, `${this.repoPath(repo)}/browse/${target}?${query.toString()}`, { method: "GET" }, signal);
|
|
72197
72212
|
if (body.children !== void 0) {
|
|
72198
72213
|
const names = (body.children.values ?? []).map((child) => {
|
|
72199
72214
|
const name = child.path?.toString ?? child.path?.name ?? "?";
|
|
72200
72215
|
return child.type === "DIRECTORY" ? `${name}/` : name;
|
|
72201
72216
|
});
|
|
72202
|
-
throw new AtlassianError(`${
|
|
72217
|
+
throw new AtlassianError(`${path63} is a folder, not a file. It holds: ${names.join(", ") || "nothing"}.`);
|
|
72203
72218
|
}
|
|
72204
72219
|
if (body.binary === true)
|
|
72205
|
-
throw new AtlassianError(`${
|
|
72220
|
+
throw new AtlassianError(`${path63} is a binary file, so there is no text to read.`);
|
|
72206
72221
|
for (const line of body.lines ?? [])
|
|
72207
72222
|
lines2.push(line.text ?? "");
|
|
72208
72223
|
if (body.isLastPage !== false || body.nextPageStart === void 0 || body.nextPageStart <= start)
|
|
@@ -72292,9 +72307,9 @@ var BitbucketClient = class {
|
|
|
72292
72307
|
return out;
|
|
72293
72308
|
}
|
|
72294
72309
|
/** A file's bytes at `at`, or undefined when it is not there. */
|
|
72295
|
-
async readBytes(repo,
|
|
72310
|
+
async readBytes(repo, path63, at, signal) {
|
|
72296
72311
|
try {
|
|
72297
|
-
return await this.rest.bytes(`reading ${
|
|
72312
|
+
return await this.rest.bytes(`reading ${path63}`, `${this.repoPath(repo)}/raw/${encodeRepoPath(path63)}?${new URLSearchParams({ at }).toString()}`, signal);
|
|
72298
72313
|
} catch (error51) {
|
|
72299
72314
|
if (error51 instanceof AtlassianError && error51.status === 404)
|
|
72300
72315
|
return void 0;
|
|
@@ -73118,8 +73133,8 @@ ${text2.slice(-2e4)}`);
|
|
|
73118
73133
|
}
|
|
73119
73134
|
/** Queues a build, then follows the queue item briefly to learn its number. */
|
|
73120
73135
|
async startBuild(job, parameters, signal) {
|
|
73121
|
-
const
|
|
73122
|
-
const response = await this.post(`starting ${job}`, parameters !== void 0 && Object.keys(parameters).length > 0 ? `${
|
|
73136
|
+
const path63 = jobPath(job, this.base);
|
|
73137
|
+
const response = await this.post(`starting ${job}`, parameters !== void 0 && Object.keys(parameters).length > 0 ? `${path63}/buildWithParameters` : `${path63}/build`, parameters ?? {}, signal);
|
|
73123
73138
|
const location = response.headers["location"];
|
|
73124
73139
|
const queueId = location === void 0 ? void 0 : /\/queue\/item\/(\d+)/.exec(location)?.[1];
|
|
73125
73140
|
if (queueId === void 0)
|
|
@@ -73156,10 +73171,10 @@ ${text2.slice(-2e4)}`);
|
|
|
73156
73171
|
}
|
|
73157
73172
|
/** Creates a job from a whole config.xml, in the folder its name gives (`folder/sub/new-job`). */
|
|
73158
73173
|
async createJob(job, xml, signal) {
|
|
73159
|
-
const
|
|
73160
|
-
const cut =
|
|
73161
|
-
const parent =
|
|
73162
|
-
const name = decodeURIComponent(
|
|
73174
|
+
const path63 = jobPath(job, this.base);
|
|
73175
|
+
const cut = path63.lastIndexOf("/job/");
|
|
73176
|
+
const parent = path63.slice(0, cut);
|
|
73177
|
+
const name = decodeURIComponent(path63.slice(cut + "/job/".length));
|
|
73163
73178
|
await this.postBody(`creating ${job}`, `${parent}/createItem?${new URLSearchParams({ name }).toString()}`, xml, "application/xml", signal);
|
|
73164
73179
|
}
|
|
73165
73180
|
/** Replaces a job's config.xml. */
|
|
@@ -73472,14 +73487,14 @@ ${client.base}${jobPath(job, client.base)}/${buildRef(params3.build)}/`
|
|
|
73472
73487
|
};
|
|
73473
73488
|
return tool;
|
|
73474
73489
|
}
|
|
73475
|
-
async function readJenkinsfile(
|
|
73476
|
-
const resolved = await resolveToolPath(context,
|
|
73490
|
+
async function readJenkinsfile(path63, context) {
|
|
73491
|
+
const resolved = await resolveToolPath(context, path63);
|
|
73477
73492
|
if (!resolved.ok)
|
|
73478
73493
|
return { ok: false, message: resolved.message };
|
|
73479
73494
|
try {
|
|
73480
73495
|
return { ok: true, text: await context.fs.readFile(resolved.realPath), realPath: resolved.realPath };
|
|
73481
73496
|
} catch (error51) {
|
|
73482
|
-
return { ok: false, message: `Could not read ${
|
|
73497
|
+
return { ok: false, message: `Could not read ${path63}: ${error51 instanceof Error ? error51.message : String(error51)}` };
|
|
73483
73498
|
}
|
|
73484
73499
|
}
|
|
73485
73500
|
var checkSchema = external_exports.object({
|
|
@@ -74052,8 +74067,8 @@ var AutosysClient = class {
|
|
|
74052
74067
|
async runInfo(pattern, signal) {
|
|
74053
74068
|
if (!isAutosysName(pattern, true))
|
|
74054
74069
|
throw new AtlassianError(`"${pattern}" is not a job name or pattern.`);
|
|
74055
|
-
const
|
|
74056
|
-
return asList(await this.rest.json(`reading the status of ${pattern}`,
|
|
74070
|
+
const path63 = pattern.includes("*") ? fill(this.paths.runInfo, { pattern }) : fill(this.paths.jobRunInfo, { job: pattern });
|
|
74071
|
+
return asList(await this.rest.json(`reading the status of ${pattern}`, path63, { method: "GET" }, signal)).map(toRun);
|
|
74057
74072
|
}
|
|
74058
74073
|
/** A job's log, or undefined when this server has no log endpoint (404). */
|
|
74059
74074
|
async log(name, runNum, type, signal) {
|
|
@@ -74079,9 +74094,9 @@ var AutosysClient = class {
|
|
|
74079
74094
|
* Something this server may not offer at the documented address: undefined for a 404, so a tool can
|
|
74080
74095
|
* say which setting (`autosys.paths`) points elsewhere, rather than reporting "found nothing".
|
|
74081
74096
|
*/
|
|
74082
|
-
async optional(doing,
|
|
74097
|
+
async optional(doing, path63, signal) {
|
|
74083
74098
|
try {
|
|
74084
|
-
return asList(await this.rest.json(doing,
|
|
74099
|
+
return asList(await this.rest.json(doing, path63, { method: "GET" }, signal));
|
|
74085
74100
|
} catch (error51) {
|
|
74086
74101
|
if (error51 instanceof AtlassianError && error51.status === 404)
|
|
74087
74102
|
return void 0;
|
|
@@ -75065,10 +75080,121 @@ function toolsForAccess(tools, readOnly, label) {
|
|
|
75065
75080
|
return tools.filter((tool) => tool.group === "read").map((tool) => ({ ...tool, description: tool.description + note }));
|
|
75066
75081
|
}
|
|
75067
75082
|
|
|
75068
|
-
// ../../packages/core/dist/
|
|
75069
|
-
var
|
|
75083
|
+
// ../../packages/core/dist/git/worktrees.js
|
|
75084
|
+
var import_node_child_process13 = require("node:child_process");
|
|
75085
|
+
var import_node_fs7 = require("node:fs");
|
|
75070
75086
|
var import_promises25 = __toESM(require("node:fs/promises"), 1);
|
|
75071
75087
|
var import_node_path45 = __toESM(require("node:path"), 1);
|
|
75088
|
+
var GitError = class extends Error {
|
|
75089
|
+
};
|
|
75090
|
+
function git(args, cwd) {
|
|
75091
|
+
return new Promise((resolve, reject2) => {
|
|
75092
|
+
(0, import_node_child_process13.execFile)("git", [...args], { cwd, maxBuffer: 16 * 1024 * 1024, windowsHide: true }, (error51, stdout, stderr) => {
|
|
75093
|
+
if (error51 !== null) {
|
|
75094
|
+
if (typeof error51.code !== "number") {
|
|
75095
|
+
reject2(new GitError("git could not be started - is it installed and on PATH?"));
|
|
75096
|
+
return;
|
|
75097
|
+
}
|
|
75098
|
+
reject2(new GitError((stderr || stdout || error51.message).trim()));
|
|
75099
|
+
return;
|
|
75100
|
+
}
|
|
75101
|
+
resolve(stdout);
|
|
75102
|
+
});
|
|
75103
|
+
});
|
|
75104
|
+
}
|
|
75105
|
+
function mainCheckoutOf(folder) {
|
|
75106
|
+
try {
|
|
75107
|
+
const dotGit = import_node_path45.default.join(folder, ".git");
|
|
75108
|
+
if (!(0, import_node_fs7.existsSync)(dotGit) || (0, import_node_fs7.statSync)(dotGit).isDirectory())
|
|
75109
|
+
return void 0;
|
|
75110
|
+
const match = /^gitdir:\s*(.+)\s*$/m.exec((0, import_node_fs7.readFileSync)(dotGit, "utf8"));
|
|
75111
|
+
if (match?.[1] === void 0)
|
|
75112
|
+
return void 0;
|
|
75113
|
+
const gitDir = import_node_path45.default.resolve(folder, match[1].trim());
|
|
75114
|
+
const common = import_node_path45.default.resolve(gitDir, (0, import_node_fs7.readFileSync)(import_node_path45.default.join(gitDir, "commondir"), "utf8").trim());
|
|
75115
|
+
return import_node_path45.default.basename(common) === ".git" ? import_node_path45.default.dirname(common) : void 0;
|
|
75116
|
+
} catch {
|
|
75117
|
+
return void 0;
|
|
75118
|
+
}
|
|
75119
|
+
}
|
|
75120
|
+
function currentBranchOf(folder) {
|
|
75121
|
+
try {
|
|
75122
|
+
const dotGit = import_node_path45.default.join(folder, ".git");
|
|
75123
|
+
let gitDir = dotGit;
|
|
75124
|
+
if (!(0, import_node_fs7.statSync)(dotGit).isDirectory()) {
|
|
75125
|
+
const match = /^gitdir:\s*(.+)\s*$/m.exec((0, import_node_fs7.readFileSync)(dotGit, "utf8"));
|
|
75126
|
+
if (match?.[1] === void 0)
|
|
75127
|
+
return void 0;
|
|
75128
|
+
gitDir = import_node_path45.default.resolve(folder, match[1].trim());
|
|
75129
|
+
}
|
|
75130
|
+
const head = (0, import_node_fs7.readFileSync)(import_node_path45.default.join(gitDir, "HEAD"), "utf8").trim();
|
|
75131
|
+
return head.startsWith("ref: refs/heads/") ? head.slice("ref: refs/heads/".length) : void 0;
|
|
75132
|
+
} catch {
|
|
75133
|
+
return void 0;
|
|
75134
|
+
}
|
|
75135
|
+
}
|
|
75136
|
+
async function listWorktrees(folder) {
|
|
75137
|
+
const out = await git(["worktree", "list", "--porcelain"], folder);
|
|
75138
|
+
const worktrees = [];
|
|
75139
|
+
let current;
|
|
75140
|
+
const flush = () => {
|
|
75141
|
+
if (current?.path !== void 0)
|
|
75142
|
+
worktrees.push({ path: current.path, main: worktrees.length === 0, ...current });
|
|
75143
|
+
current = void 0;
|
|
75144
|
+
};
|
|
75145
|
+
for (const line of out.split(/\r?\n/)) {
|
|
75146
|
+
if (line.startsWith("worktree ")) {
|
|
75147
|
+
flush();
|
|
75148
|
+
current = { path: import_node_path45.default.normalize(line.slice("worktree ".length)) };
|
|
75149
|
+
} else if (current !== void 0 && line.startsWith("branch ")) {
|
|
75150
|
+
current.branch = line.slice("branch ".length).replace(/^refs\/heads\//, "");
|
|
75151
|
+
} else if (current !== void 0 && line.startsWith("HEAD ")) {
|
|
75152
|
+
current.head = line.slice("HEAD ".length);
|
|
75153
|
+
} else if (current !== void 0 && line.startsWith("prunable")) {
|
|
75154
|
+
current.missing = true;
|
|
75155
|
+
}
|
|
75156
|
+
}
|
|
75157
|
+
flush();
|
|
75158
|
+
return worktrees.map((each, index) => ({ ...each, main: index === 0 }));
|
|
75159
|
+
}
|
|
75160
|
+
function setupMarkerFor(folder) {
|
|
75161
|
+
try {
|
|
75162
|
+
const match = /^gitdir:\s*(.+)\s*$/m.exec((0, import_node_fs7.readFileSync)(import_node_path45.default.join(folder, ".git"), "utf8"));
|
|
75163
|
+
return match?.[1] === void 0 ? void 0 : import_node_path45.default.join(import_node_path45.default.resolve(folder, match[1].trim()), "light-code-setup-pending");
|
|
75164
|
+
} catch {
|
|
75165
|
+
return void 0;
|
|
75166
|
+
}
|
|
75167
|
+
}
|
|
75168
|
+
async function copySetupFiles(mainCheckout, folder, names) {
|
|
75169
|
+
const copied = [];
|
|
75170
|
+
const skipped = [];
|
|
75171
|
+
for (const name of names) {
|
|
75172
|
+
const from = import_node_path45.default.resolve(mainCheckout, name);
|
|
75173
|
+
const to = import_node_path45.default.resolve(folder, name);
|
|
75174
|
+
const inside = (root, target) => {
|
|
75175
|
+
const relative = import_node_path45.default.relative(root, target);
|
|
75176
|
+
return relative.length > 0 && !relative.startsWith("..") && !import_node_path45.default.isAbsolute(relative);
|
|
75177
|
+
};
|
|
75178
|
+
if (!inside(mainCheckout, from) || !inside(folder, to)) {
|
|
75179
|
+
skipped.push(`${name} (outside the checkout)`);
|
|
75180
|
+
continue;
|
|
75181
|
+
}
|
|
75182
|
+
try {
|
|
75183
|
+
await import_promises25.default.mkdir(import_node_path45.default.dirname(to), { recursive: true });
|
|
75184
|
+
await import_promises25.default.copyFile(from, to, import_node_fs7.constants.COPYFILE_EXCL);
|
|
75185
|
+
copied.push(name);
|
|
75186
|
+
} catch (error51) {
|
|
75187
|
+
const code = error51.code;
|
|
75188
|
+
skipped.push(`${name} (${code === "EEXIST" ? "already there" : code === "ENOENT" ? "not in the main checkout" : String(code)})`);
|
|
75189
|
+
}
|
|
75190
|
+
}
|
|
75191
|
+
return { copied, skipped };
|
|
75192
|
+
}
|
|
75193
|
+
|
|
75194
|
+
// ../../packages/core/dist/teamrepo/sync.js
|
|
75195
|
+
var import_node_crypto15 = require("node:crypto");
|
|
75196
|
+
var import_promises26 = __toESM(require("node:fs/promises"), 1);
|
|
75197
|
+
var import_node_path46 = __toESM(require("node:path"), 1);
|
|
75072
75198
|
var TOMBSTONE_PREFIX = "LIGHT-CODE-DELETED:";
|
|
75073
75199
|
function tombstoneText(who, when3) {
|
|
75074
75200
|
return `${TOMBSTONE_PREFIX} removed for the team by ${who} on ${when3.toISOString().slice(0, 10)}. Light Code no longer loads this file; writing a new one of the same name brings it back.
|
|
@@ -75117,7 +75243,7 @@ function classifyRepoPath(folder, repoPath) {
|
|
|
75117
75243
|
}
|
|
75118
75244
|
async function readState(file2, mirrorFile) {
|
|
75119
75245
|
try {
|
|
75120
|
-
const parsed = JSON.parse(await
|
|
75246
|
+
const parsed = JSON.parse(await import_promises26.default.readFile(file2, "utf8"));
|
|
75121
75247
|
const head = parsed.head !== void 0 ? { head: parsed.head } : {};
|
|
75122
75248
|
if (parsed.version === 2) {
|
|
75123
75249
|
return { version: 2, files: parsed.files ?? {}, pushed: parsed.pushed ?? {}, ...head, ...parsed.released !== void 0 ? { released: parsed.released } : {} };
|
|
@@ -75129,7 +75255,7 @@ async function readState(file2, mirrorFile) {
|
|
|
75129
75255
|
const local = mirrorFile(repoPath);
|
|
75130
75256
|
if (local === void 0)
|
|
75131
75257
|
continue;
|
|
75132
|
-
const bytes = await
|
|
75258
|
+
const bytes = await import_promises26.default.readFile(local).catch(() => void 0);
|
|
75133
75259
|
if (bytes === void 0 || rawHash(bytes) !== entry.hash)
|
|
75134
75260
|
continue;
|
|
75135
75261
|
files[repoPath] = { commit: entry.commit, hash: contentHash(bytes) };
|
|
@@ -75143,9 +75269,9 @@ async function readState(file2, mirrorFile) {
|
|
|
75143
75269
|
return { version: 2, files: {}, pushed: {} };
|
|
75144
75270
|
}
|
|
75145
75271
|
async function writeWhole2(file2, bytes) {
|
|
75146
|
-
await
|
|
75272
|
+
await import_promises26.default.mkdir(import_node_path46.default.dirname(file2), { recursive: true });
|
|
75147
75273
|
const temp = `${file2}.${process.pid.toString(36)}${Math.random().toString(36).slice(2)}.tmp`;
|
|
75148
|
-
await
|
|
75274
|
+
await import_promises26.default.writeFile(temp, bytes);
|
|
75149
75275
|
await replaceFile(temp, file2);
|
|
75150
75276
|
}
|
|
75151
75277
|
async function localFiles(dir, kind) {
|
|
@@ -75155,7 +75281,7 @@ async function localFiles(dir, kind) {
|
|
|
75155
75281
|
const walk = async (folder, prefix) => {
|
|
75156
75282
|
let entries;
|
|
75157
75283
|
try {
|
|
75158
|
-
entries = await
|
|
75284
|
+
entries = await import_promises26.default.readdir(folder, { withFileTypes: true });
|
|
75159
75285
|
} catch {
|
|
75160
75286
|
return;
|
|
75161
75287
|
}
|
|
@@ -75165,9 +75291,9 @@ async function localFiles(dir, kind) {
|
|
|
75165
75291
|
const relative = prefix.length > 0 ? `${prefix}/${entry.name}` : entry.name;
|
|
75166
75292
|
if (entry.isDirectory()) {
|
|
75167
75293
|
if (kind === "skills")
|
|
75168
|
-
await walk(
|
|
75294
|
+
await walk(import_node_path46.default.join(folder, entry.name), relative);
|
|
75169
75295
|
} else if (entry.isFile() && (kind === "skills" || entry.name.endsWith(".py"))) {
|
|
75170
|
-
out.push({ relative, file:
|
|
75296
|
+
out.push({ relative, file: import_node_path46.default.join(folder, entry.name) });
|
|
75171
75297
|
}
|
|
75172
75298
|
}
|
|
75173
75299
|
};
|
|
@@ -75176,7 +75302,7 @@ async function localFiles(dir, kind) {
|
|
|
75176
75302
|
}
|
|
75177
75303
|
async function syncTeamRepo(options) {
|
|
75178
75304
|
const { api, branch, folder } = options;
|
|
75179
|
-
const mirrorFile = (kind, relative) =>
|
|
75305
|
+
const mirrorFile = (kind, relative) => import_node_path46.default.join(options.mirror[kind], ...relative.split("/"));
|
|
75180
75306
|
const state = await readState(options.stateFile, (repoPath) => {
|
|
75181
75307
|
const target = classifyRepoPath(folder, repoPath);
|
|
75182
75308
|
return target === void 0 ? void 0 : mirrorFile(target.kind, target.relative);
|
|
@@ -75193,7 +75319,7 @@ async function syncTeamRepo(options) {
|
|
|
75193
75319
|
if (gone !== void 0) {
|
|
75194
75320
|
const was = classifyRepoPath(folder, gone);
|
|
75195
75321
|
if (was !== void 0) {
|
|
75196
|
-
await
|
|
75322
|
+
await import_promises26.default.rm(mirrorFile(was.kind, was.relative), { force: true });
|
|
75197
75323
|
delete state.files[gone];
|
|
75198
75324
|
report.removed.push(gone);
|
|
75199
75325
|
}
|
|
@@ -75211,7 +75337,7 @@ async function syncTeamRepo(options) {
|
|
|
75211
75337
|
if (isTombstone(bytes)) {
|
|
75212
75338
|
state.files[change.path] = { commit: head, hash: fetched, deleted: true };
|
|
75213
75339
|
if (before?.deleted !== true) {
|
|
75214
|
-
await
|
|
75340
|
+
await import_promises26.default.rm(mirrorFile(target.kind, target.relative), { force: true });
|
|
75215
75341
|
report.removed.push(change.path);
|
|
75216
75342
|
}
|
|
75217
75343
|
continue;
|
|
@@ -75227,7 +75353,7 @@ async function syncTeamRepo(options) {
|
|
|
75227
75353
|
if (options.push !== false) {
|
|
75228
75354
|
const locals = [];
|
|
75229
75355
|
for (const kind of ["skills", "tools"]) {
|
|
75230
|
-
for (const dir of new Set(options.local[kind].filter((entry) => entry !== void 0).map((entry) =>
|
|
75356
|
+
for (const dir of new Set(options.local[kind].filter((entry) => entry !== void 0).map((entry) => import_node_path46.default.resolve(entry)))) {
|
|
75231
75357
|
locals.push(...(await localFiles(dir, kind)).map((entry) => ({ ...entry, kind })));
|
|
75232
75358
|
}
|
|
75233
75359
|
}
|
|
@@ -75236,7 +75362,7 @@ async function syncTeamRepo(options) {
|
|
|
75236
75362
|
for (const entry of locals) {
|
|
75237
75363
|
const repoPath = repoPathFor(folder, entry.kind, entry.relative);
|
|
75238
75364
|
present2.add(repoPath);
|
|
75239
|
-
const bytes = new Uint8Array(await
|
|
75365
|
+
const bytes = new Uint8Array(await import_promises26.default.readFile(entry.file));
|
|
75240
75366
|
const mine = hash2(bytes);
|
|
75241
75367
|
const earlier = chosen.get(repoPath);
|
|
75242
75368
|
if (earlier !== void 0) {
|
|
@@ -75252,9 +75378,9 @@ async function syncTeamRepo(options) {
|
|
|
75252
75378
|
const known = state.files[repoPath];
|
|
75253
75379
|
if (known?.deleted === true && state.pushed[repoPath] !== known.hash) {
|
|
75254
75380
|
if (mine === state.pushed[repoPath]) {
|
|
75255
|
-
const inside = (options.removable ?? []).some((dir) => entry.file.toLowerCase().startsWith(
|
|
75381
|
+
const inside = (options.removable ?? []).some((dir) => entry.file.toLowerCase().startsWith(import_node_path46.default.resolve(dir).toLowerCase() + import_node_path46.default.sep));
|
|
75256
75382
|
if (inside) {
|
|
75257
|
-
await
|
|
75383
|
+
await import_promises26.default.rm(entry.file, { force: true });
|
|
75258
75384
|
state.pushed[repoPath] = known.hash;
|
|
75259
75385
|
report.removed.push(`${repoPath} (copy on this computer)`);
|
|
75260
75386
|
} else {
|
|
@@ -75363,16 +75489,16 @@ async function checkCoverage(options) {
|
|
|
75363
75489
|
const { folder } = options;
|
|
75364
75490
|
const state = await readState(options.stateFile, (repoPath) => {
|
|
75365
75491
|
const target = classifyRepoPath(folder, repoPath);
|
|
75366
|
-
return target === void 0 ? void 0 :
|
|
75492
|
+
return target === void 0 ? void 0 : import_node_path46.default.join(options.mirror[target.kind], ...target.relative.split("/"));
|
|
75367
75493
|
});
|
|
75368
75494
|
const covered = { skills: 0, tools: 0 };
|
|
75369
75495
|
const problems = [];
|
|
75370
75496
|
const repoPaths = [];
|
|
75371
75497
|
for (const kind of ["skills", "tools"]) {
|
|
75372
|
-
for (const dir of new Set(options.dirs[kind].map((entry) =>
|
|
75498
|
+
for (const dir of new Set(options.dirs[kind].map((entry) => import_node_path46.default.resolve(entry)))) {
|
|
75373
75499
|
for (const entry of await localFiles(dir, kind)) {
|
|
75374
75500
|
const repoPath = repoPathFor(folder, kind, entry.relative);
|
|
75375
|
-
const mine = hash2(new Uint8Array(await
|
|
75501
|
+
const mine = hash2(new Uint8Array(await import_promises26.default.readFile(entry.file)));
|
|
75376
75502
|
const known = state.files[repoPath];
|
|
75377
75503
|
if (known?.deleted === true)
|
|
75378
75504
|
continue;
|
|
@@ -75392,7 +75518,7 @@ async function checkCoverage(options) {
|
|
|
75392
75518
|
async function releaseFromRecord(stateFile, repoPaths) {
|
|
75393
75519
|
let parsed;
|
|
75394
75520
|
try {
|
|
75395
|
-
parsed = JSON.parse(await
|
|
75521
|
+
parsed = JSON.parse(await import_promises26.default.readFile(stateFile, "utf8"));
|
|
75396
75522
|
} catch {
|
|
75397
75523
|
return;
|
|
75398
75524
|
}
|
|
@@ -75403,7 +75529,7 @@ async function tombstoneInRepo(options) {
|
|
|
75403
75529
|
const { folder } = options;
|
|
75404
75530
|
const mirrorFile = (repoPath) => {
|
|
75405
75531
|
const target = classifyRepoPath(folder, repoPath);
|
|
75406
|
-
return target === void 0 ? void 0 :
|
|
75532
|
+
return target === void 0 ? void 0 : import_node_path46.default.join(options.mirror[target.kind], ...target.relative.split("/"));
|
|
75407
75533
|
};
|
|
75408
75534
|
const state = await readState(options.stateFile, mirrorFile);
|
|
75409
75535
|
const bytes = new TextEncoder().encode(tombstoneText(options.who, options.now ?? /* @__PURE__ */ new Date()));
|
|
@@ -75427,7 +75553,7 @@ async function tombstoneInRepo(options) {
|
|
|
75427
75553
|
state.pushed[repoPath] = marker;
|
|
75428
75554
|
const local = mirrorFile(repoPath);
|
|
75429
75555
|
if (local !== void 0)
|
|
75430
|
-
await
|
|
75556
|
+
await import_promises26.default.rm(local, { force: true });
|
|
75431
75557
|
done.push(repoPath);
|
|
75432
75558
|
} catch (error51) {
|
|
75433
75559
|
const status2 = error51.status;
|
|
@@ -77026,7 +77152,7 @@ function message2(error51) {
|
|
|
77026
77152
|
}
|
|
77027
77153
|
function filesIn(params3) {
|
|
77028
77154
|
return [
|
|
77029
|
-
...(params3.attachments ?? []).map((
|
|
77155
|
+
...(params3.attachments ?? []).map((path63) => ({ path: path63, inline: false })),
|
|
77030
77156
|
...(params3.inlineImages ?? []).map((image) => ({ path: image.path, inline: true }))
|
|
77031
77157
|
];
|
|
77032
77158
|
}
|
|
@@ -77707,19 +77833,19 @@ var WebviewApprovalGate = class {
|
|
|
77707
77833
|
};
|
|
77708
77834
|
|
|
77709
77835
|
// ../../packages/core/dist/platform/node/filesystem.js
|
|
77710
|
-
var
|
|
77836
|
+
var import_promises27 = __toESM(require("node:fs/promises"), 1);
|
|
77711
77837
|
var NodeFileSystem = class {
|
|
77712
|
-
async readFile(
|
|
77713
|
-
return
|
|
77838
|
+
async readFile(path63) {
|
|
77839
|
+
return import_promises27.default.readFile(path63, "utf8");
|
|
77714
77840
|
}
|
|
77715
|
-
async readBytes(
|
|
77716
|
-
return
|
|
77841
|
+
async readBytes(path63) {
|
|
77842
|
+
return import_promises27.default.readFile(path63);
|
|
77717
77843
|
}
|
|
77718
|
-
async readBytesSlice(
|
|
77844
|
+
async readBytesSlice(path63, start, end) {
|
|
77719
77845
|
const length = Math.max(0, end - start);
|
|
77720
77846
|
if (length === 0)
|
|
77721
77847
|
return Buffer.alloc(0);
|
|
77722
|
-
const handle = await
|
|
77848
|
+
const handle = await import_promises27.default.open(path63, "r");
|
|
77723
77849
|
try {
|
|
77724
77850
|
const buffer = Buffer.alloc(length);
|
|
77725
77851
|
const { bytesRead } = await handle.read(buffer, 0, length, start);
|
|
@@ -77728,18 +77854,18 @@ var NodeFileSystem = class {
|
|
|
77728
77854
|
await handle.close();
|
|
77729
77855
|
}
|
|
77730
77856
|
}
|
|
77731
|
-
async writeFile(
|
|
77732
|
-
await
|
|
77857
|
+
async writeFile(path63, contents) {
|
|
77858
|
+
await import_promises27.default.writeFile(path63, contents, "utf8");
|
|
77733
77859
|
}
|
|
77734
77860
|
/** The counterpart of `readBytes`, and deliberately as bare as `writeFile` beside it. */
|
|
77735
|
-
async writeBytes(
|
|
77736
|
-
await
|
|
77861
|
+
async writeBytes(path63, contents) {
|
|
77862
|
+
await import_promises27.default.writeFile(path63, contents);
|
|
77737
77863
|
}
|
|
77738
77864
|
async rename(from, to) {
|
|
77739
77865
|
await replaceFile(from, to);
|
|
77740
77866
|
}
|
|
77741
|
-
async stat(
|
|
77742
|
-
const stat = await
|
|
77867
|
+
async stat(path63) {
|
|
77868
|
+
const stat = await import_promises27.default.lstat(path63);
|
|
77743
77869
|
return {
|
|
77744
77870
|
size: stat.size,
|
|
77745
77871
|
mtimeMs: stat.mtimeMs,
|
|
@@ -77748,8 +77874,8 @@ var NodeFileSystem = class {
|
|
|
77748
77874
|
isSymbolicLink: stat.isSymbolicLink()
|
|
77749
77875
|
};
|
|
77750
77876
|
}
|
|
77751
|
-
async readdir(
|
|
77752
|
-
const entries = await
|
|
77877
|
+
async readdir(path63) {
|
|
77878
|
+
const entries = await import_promises27.default.readdir(path63, { withFileTypes: true });
|
|
77753
77879
|
return entries.map((entry) => ({
|
|
77754
77880
|
name: entry.name,
|
|
77755
77881
|
isFile: entry.isFile(),
|
|
@@ -77757,21 +77883,21 @@ var NodeFileSystem = class {
|
|
|
77757
77883
|
isSymbolicLink: entry.isSymbolicLink()
|
|
77758
77884
|
}));
|
|
77759
77885
|
}
|
|
77760
|
-
async exists(
|
|
77886
|
+
async exists(path63) {
|
|
77761
77887
|
try {
|
|
77762
|
-
await
|
|
77888
|
+
await import_promises27.default.access(path63);
|
|
77763
77889
|
return true;
|
|
77764
77890
|
} catch {
|
|
77765
77891
|
return false;
|
|
77766
77892
|
}
|
|
77767
77893
|
}
|
|
77768
|
-
async mkdir(
|
|
77769
|
-
await
|
|
77894
|
+
async mkdir(path63) {
|
|
77895
|
+
await import_promises27.default.mkdir(path63, { recursive: true });
|
|
77770
77896
|
}
|
|
77771
77897
|
};
|
|
77772
77898
|
|
|
77773
77899
|
// ../../packages/core/dist/config/project.js
|
|
77774
|
-
var
|
|
77900
|
+
var import_node_path47 = __toESM(require("node:path"), 1);
|
|
77775
77901
|
function configuredProjectName(config2) {
|
|
77776
77902
|
const name = config2?.project?.name?.trim();
|
|
77777
77903
|
return name !== void 0 && name.length > 0 ? name : void 0;
|
|
@@ -77780,7 +77906,7 @@ function projectName(config2, workspaceRoot) {
|
|
|
77780
77906
|
const configured = configuredProjectName(config2);
|
|
77781
77907
|
if (configured !== void 0)
|
|
77782
77908
|
return configured;
|
|
77783
|
-
return workspaceRoot === void 0 ? void 0 :
|
|
77909
|
+
return workspaceRoot === void 0 ? void 0 : import_node_path47.default.basename(import_node_path47.default.resolve(workspaceRoot));
|
|
77784
77910
|
}
|
|
77785
77911
|
function projectSlug(name) {
|
|
77786
77912
|
if (name === void 0)
|
|
@@ -77790,8 +77916,8 @@ function projectSlug(name) {
|
|
|
77790
77916
|
}
|
|
77791
77917
|
|
|
77792
77918
|
// ../../packages/core/dist/rag/renameIndexes.js
|
|
77793
|
-
var
|
|
77794
|
-
var
|
|
77919
|
+
var import_node_path48 = __toESM(require("node:path"), 1);
|
|
77920
|
+
var import_node_fs8 = require("node:fs");
|
|
77795
77921
|
function planIndexRenames(names) {
|
|
77796
77922
|
const plans = [];
|
|
77797
77923
|
for (const kind of ["codebase", "docs", "skills"]) {
|
|
@@ -77843,7 +77969,7 @@ async function copyIndex(options) {
|
|
|
77843
77969
|
async function copyBookkeeping(directory, from, to, storeId) {
|
|
77844
77970
|
let entries;
|
|
77845
77971
|
try {
|
|
77846
|
-
entries = await
|
|
77972
|
+
entries = await import_node_fs8.promises.readdir(directory);
|
|
77847
77973
|
} catch {
|
|
77848
77974
|
return [];
|
|
77849
77975
|
}
|
|
@@ -77854,7 +77980,7 @@ async function copyBookkeeping(directory, from, to, storeId) {
|
|
|
77854
77980
|
continue;
|
|
77855
77981
|
const target = `${to}@${storeId}.${entry.slice(prefix.length)}`;
|
|
77856
77982
|
try {
|
|
77857
|
-
await
|
|
77983
|
+
await import_node_fs8.promises.copyFile(import_node_path48.default.join(directory, entry), import_node_path48.default.join(directory, target), import_node_fs8.constants.COPYFILE_EXCL);
|
|
77858
77984
|
copied.push(target);
|
|
77859
77985
|
} catch {
|
|
77860
77986
|
}
|
|
@@ -77863,7 +77989,7 @@ async function copyBookkeeping(directory, from, to, storeId) {
|
|
|
77863
77989
|
}
|
|
77864
77990
|
|
|
77865
77991
|
// ../../packages/core/dist/platform/node/terminal.js
|
|
77866
|
-
var
|
|
77992
|
+
var import_node_child_process14 = require("node:child_process");
|
|
77867
77993
|
var NodeTerminalProcess = class {
|
|
77868
77994
|
child;
|
|
77869
77995
|
dataListeners = [];
|
|
@@ -77893,7 +78019,7 @@ var NodeTerminalProcess = class {
|
|
|
77893
78019
|
return;
|
|
77894
78020
|
if (process.platform === "win32") {
|
|
77895
78021
|
await new Promise((resolve) => {
|
|
77896
|
-
(0,
|
|
78022
|
+
(0, import_node_child_process14.execFile)("taskkill", ["/PID", String(pid), "/T", "/F"], () => resolve());
|
|
77897
78023
|
});
|
|
77898
78024
|
return;
|
|
77899
78025
|
}
|
|
@@ -77928,7 +78054,7 @@ var NodeTerminal = class {
|
|
|
77928
78054
|
}
|
|
77929
78055
|
run(command, options = {}) {
|
|
77930
78056
|
const chosen = this.shell?.trim();
|
|
77931
|
-
const child = (0,
|
|
78057
|
+
const child = (0, import_node_child_process14.spawn)(command, {
|
|
77932
78058
|
cwd: options.cwd,
|
|
77933
78059
|
env: options.env ? { ...process.env, ...options.env } : process.env,
|
|
77934
78060
|
// `true` is Node's own default shell, which is what has always run. A string names one.
|
|
@@ -77940,8 +78066,8 @@ var NodeTerminal = class {
|
|
|
77940
78066
|
};
|
|
77941
78067
|
|
|
77942
78068
|
// ../../packages/core/dist/platform/node/taskStore.js
|
|
77943
|
-
var
|
|
77944
|
-
var
|
|
78069
|
+
var import_promises28 = __toESM(require("node:fs/promises"), 1);
|
|
78070
|
+
var import_node_path49 = __toESM(require("node:path"), 1);
|
|
77945
78071
|
|
|
77946
78072
|
// ../../packages/core/dist/history/types.js
|
|
77947
78073
|
function taskSummary(task) {
|
|
@@ -77964,7 +78090,7 @@ var JsonTaskStore = class {
|
|
|
77964
78090
|
constructor(globalStoragePath, truncationStore, logger) {
|
|
77965
78091
|
this.truncationStore = truncationStore;
|
|
77966
78092
|
this.logger = logger;
|
|
77967
|
-
this.directory =
|
|
78093
|
+
this.directory = import_node_path49.default.join(globalStoragePath, "tasks");
|
|
77968
78094
|
}
|
|
77969
78095
|
async list(workspaceRoot) {
|
|
77970
78096
|
const index = await this.readIndex();
|
|
@@ -77980,7 +78106,7 @@ var JsonTaskStore = class {
|
|
|
77980
78106
|
if (!isValidId(id))
|
|
77981
78107
|
return void 0;
|
|
77982
78108
|
try {
|
|
77983
|
-
const raw = await
|
|
78109
|
+
const raw = await import_promises28.default.readFile(this.fileFor(id), "utf8");
|
|
77984
78110
|
return parseTask(raw);
|
|
77985
78111
|
} catch (error51) {
|
|
77986
78112
|
if (error51.code !== "ENOENT") {
|
|
@@ -77992,10 +78118,10 @@ var JsonTaskStore = class {
|
|
|
77992
78118
|
async save(task) {
|
|
77993
78119
|
if (!isValidId(task.id))
|
|
77994
78120
|
throw new Error(`Refusing to save a task with an unexpected id: ${task.id}`);
|
|
77995
|
-
await
|
|
78121
|
+
await import_promises28.default.mkdir(this.directory, { recursive: true });
|
|
77996
78122
|
const target = this.fileFor(task.id);
|
|
77997
78123
|
const temporary = `${target}.tmp`;
|
|
77998
|
-
await
|
|
78124
|
+
await import_promises28.default.writeFile(temporary, JSON.stringify(task, null, 2), "utf8");
|
|
77999
78125
|
await replaceFile(temporary, target);
|
|
78000
78126
|
const index = await this.readIndex();
|
|
78001
78127
|
const entry = { ...taskSummary(task), workspaceRoot: task.workspaceRoot };
|
|
@@ -78008,16 +78134,16 @@ var JsonTaskStore = class {
|
|
|
78008
78134
|
if (task !== void 0 && task.resultHandles.length > 0) {
|
|
78009
78135
|
await this.truncationStore.deleteMany(task.resultHandles);
|
|
78010
78136
|
}
|
|
78011
|
-
await
|
|
78137
|
+
await import_promises28.default.rm(this.fileFor(id), { force: true });
|
|
78012
78138
|
const index = await this.readIndex();
|
|
78013
78139
|
await this.writeIndex(index.filter((entry) => entry.id !== id));
|
|
78014
78140
|
}
|
|
78015
78141
|
fileFor(id) {
|
|
78016
|
-
return
|
|
78142
|
+
return import_node_path49.default.join(this.directory, `${id}.json`);
|
|
78017
78143
|
}
|
|
78018
78144
|
async readIndex() {
|
|
78019
78145
|
try {
|
|
78020
|
-
const raw = await
|
|
78146
|
+
const raw = await import_promises28.default.readFile(import_node_path49.default.join(this.directory, INDEX_FILE), "utf8");
|
|
78021
78147
|
const parsed = JSON.parse(raw);
|
|
78022
78148
|
if (Array.isArray(parsed))
|
|
78023
78149
|
return parsed.filter(isIndexEntry);
|
|
@@ -78034,7 +78160,7 @@ var JsonTaskStore = class {
|
|
|
78034
78160
|
async rebuildIndex() {
|
|
78035
78161
|
let names;
|
|
78036
78162
|
try {
|
|
78037
|
-
names = await
|
|
78163
|
+
names = await import_promises28.default.readdir(this.directory);
|
|
78038
78164
|
} catch {
|
|
78039
78165
|
return [];
|
|
78040
78166
|
}
|
|
@@ -78051,10 +78177,10 @@ var JsonTaskStore = class {
|
|
|
78051
78177
|
return entries;
|
|
78052
78178
|
}
|
|
78053
78179
|
async writeIndex(entries) {
|
|
78054
|
-
await
|
|
78055
|
-
const target =
|
|
78180
|
+
await import_promises28.default.mkdir(this.directory, { recursive: true });
|
|
78181
|
+
const target = import_node_path49.default.join(this.directory, INDEX_FILE);
|
|
78056
78182
|
const temporary = `${target}.tmp`;
|
|
78057
|
-
await
|
|
78183
|
+
await import_promises28.default.writeFile(temporary, JSON.stringify(entries, null, 2), "utf8");
|
|
78058
78184
|
await replaceFile(temporary, target);
|
|
78059
78185
|
}
|
|
78060
78186
|
};
|
|
@@ -78083,8 +78209,8 @@ function parseTask(raw) {
|
|
|
78083
78209
|
}
|
|
78084
78210
|
|
|
78085
78211
|
// ../../packages/core/dist/usage/store.js
|
|
78086
|
-
var
|
|
78087
|
-
var
|
|
78212
|
+
var import_node_fs9 = require("node:fs");
|
|
78213
|
+
var import_node_path50 = __toESM(require("node:path"), 1);
|
|
78088
78214
|
|
|
78089
78215
|
// ../../packages/core/dist/s3/keys.js
|
|
78090
78216
|
function normalisePrefix(prefix) {
|
|
@@ -78217,7 +78343,7 @@ var FolderShardStore = class {
|
|
|
78217
78343
|
await this.ask({ action: "write", user: shardSegment(shard.user), day: shard.day, instance: shard.instance, events });
|
|
78218
78344
|
return;
|
|
78219
78345
|
}
|
|
78220
|
-
await this.writeAtomically(
|
|
78346
|
+
await this.writeAtomically(import_node_path50.default.join(this.root, shardSegment(shard.user), `${shard.day}__${shard.instance}.jsonl`), shardText(events));
|
|
78221
78347
|
}
|
|
78222
78348
|
async read(fromDay, toDay) {
|
|
78223
78349
|
this.lastProblems = [];
|
|
@@ -78237,8 +78363,8 @@ var FolderShardStore = class {
|
|
|
78237
78363
|
}
|
|
78238
78364
|
const files = await this.listFiles();
|
|
78239
78365
|
const wanted = selectShards(files, fromDay, toDay);
|
|
78240
|
-
const texts = await pooled(wanted, 8, (file2) =>
|
|
78241
|
-
this.lastProblems.push(`${
|
|
78366
|
+
const texts = await pooled(wanted, 8, (file2) => import_node_fs9.promises.readFile(import_node_path50.default.join(this.root, file2.user, file2.name), "utf8").catch((error51) => {
|
|
78367
|
+
this.lastProblems.push(`${import_node_path50.default.join(this.root, file2.user, file2.name)}: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
78242
78368
|
return "";
|
|
78243
78369
|
}));
|
|
78244
78370
|
return texts.flatMap(parseUsageLines);
|
|
@@ -78247,7 +78373,7 @@ var FolderShardStore = class {
|
|
|
78247
78373
|
async listFiles() {
|
|
78248
78374
|
let users;
|
|
78249
78375
|
try {
|
|
78250
|
-
users = (await
|
|
78376
|
+
users = (await import_node_fs9.promises.readdir(this.root, { withFileTypes: true })).filter((entry) => entry.isDirectory() && entry.name !== "_profiles").map((entry) => entry.name);
|
|
78251
78377
|
} catch (error51) {
|
|
78252
78378
|
if (error51.code === "ENOENT")
|
|
78253
78379
|
return [];
|
|
@@ -78255,10 +78381,10 @@ var FolderShardStore = class {
|
|
|
78255
78381
|
}
|
|
78256
78382
|
const files = [];
|
|
78257
78383
|
for (const user of users) {
|
|
78258
|
-
const folder =
|
|
78384
|
+
const folder = import_node_path50.default.join(this.root, user);
|
|
78259
78385
|
let names;
|
|
78260
78386
|
try {
|
|
78261
|
-
names = await
|
|
78387
|
+
names = await import_node_fs9.promises.readdir(folder);
|
|
78262
78388
|
} catch (error51) {
|
|
78263
78389
|
names = [];
|
|
78264
78390
|
this.lastProblems.push(`${folder}: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
@@ -78274,7 +78400,7 @@ var FolderShardStore = class {
|
|
|
78274
78400
|
}
|
|
78275
78401
|
async readShard(shard) {
|
|
78276
78402
|
try {
|
|
78277
|
-
return parseUsageLines(await
|
|
78403
|
+
return parseUsageLines(await import_node_fs9.promises.readFile(import_node_path50.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), "utf8"));
|
|
78278
78404
|
} catch (error51) {
|
|
78279
78405
|
if (error51.code === "ENOENT")
|
|
78280
78406
|
return void 0;
|
|
@@ -78282,10 +78408,10 @@ var FolderShardStore = class {
|
|
|
78282
78408
|
}
|
|
78283
78409
|
}
|
|
78284
78410
|
async putMonth(shard, events) {
|
|
78285
|
-
await this.writeAtomically(
|
|
78411
|
+
await this.writeAtomically(import_node_path50.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), shardText(events));
|
|
78286
78412
|
}
|
|
78287
78413
|
async removeShard(shard) {
|
|
78288
|
-
await
|
|
78414
|
+
await import_node_fs9.promises.rm(import_node_path50.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), { force: true });
|
|
78289
78415
|
}
|
|
78290
78416
|
async putProfile(user, profile) {
|
|
78291
78417
|
this.profilesFromRead = void 0;
|
|
@@ -78293,7 +78419,7 @@ var FolderShardStore = class {
|
|
|
78293
78419
|
await this.ask({ action: "writeProfile", user: shardSegment(user), profile: cleanProfile(profile) });
|
|
78294
78420
|
return;
|
|
78295
78421
|
}
|
|
78296
|
-
await this.writeAtomically(
|
|
78422
|
+
await this.writeAtomically(import_node_path50.default.join(this.root, "_profiles", `${shardSegment(user)}.json`), JSON.stringify(cleanProfile(profile)));
|
|
78297
78423
|
}
|
|
78298
78424
|
async readProfiles() {
|
|
78299
78425
|
if (this.profilesFromRead !== void 0)
|
|
@@ -78302,13 +78428,13 @@ var FolderShardStore = class {
|
|
|
78302
78428
|
await this.read("9999-12-31", "9999-12-31");
|
|
78303
78429
|
return this.profilesFromRead ?? {};
|
|
78304
78430
|
}
|
|
78305
|
-
const folder =
|
|
78431
|
+
const folder = import_node_path50.default.join(this.root, "_profiles");
|
|
78306
78432
|
const profiles = {};
|
|
78307
|
-
for (const name of await
|
|
78433
|
+
for (const name of await import_node_fs9.promises.readdir(folder).catch(() => [])) {
|
|
78308
78434
|
if (!name.endsWith(".json"))
|
|
78309
78435
|
continue;
|
|
78310
78436
|
try {
|
|
78311
|
-
profiles[name.slice(0, -5)] = cleanProfile(JSON.parse(await
|
|
78437
|
+
profiles[name.slice(0, -5)] = cleanProfile(JSON.parse(await import_node_fs9.promises.readFile(import_node_path50.default.join(folder, name), "utf8")));
|
|
78312
78438
|
} catch {
|
|
78313
78439
|
}
|
|
78314
78440
|
}
|
|
@@ -79056,8 +79182,8 @@ function usageCollectionOn(config2, choice) {
|
|
|
79056
79182
|
}
|
|
79057
79183
|
|
|
79058
79184
|
// ../../packages/core/dist/usage/backfill.js
|
|
79059
|
-
var
|
|
79060
|
-
var
|
|
79185
|
+
var import_node_fs10 = require("node:fs");
|
|
79186
|
+
var import_node_path51 = __toESM(require("node:path"), 1);
|
|
79061
79187
|
function comparablePath(value) {
|
|
79062
79188
|
return value.replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
|
|
79063
79189
|
}
|
|
@@ -79067,7 +79193,7 @@ function eventsFromTask(task, context) {
|
|
|
79067
79193
|
return [];
|
|
79068
79194
|
const created = typeof task.createdAt === "number" && task.createdAt <= updated ? task.createdAt : updated;
|
|
79069
79195
|
const root = typeof task.workspaceRoot === "string" ? task.workspaceRoot : void 0;
|
|
79070
|
-
const project = root !== void 0 && context.workspaceRoot !== void 0 && comparablePath(root) === comparablePath(context.workspaceRoot) ? context.project : root !== void 0 ?
|
|
79196
|
+
const project = root !== void 0 && context.workspaceRoot !== void 0 && comparablePath(root) === comparablePath(context.workspaceRoot) ? context.project : root !== void 0 ? import_node_path51.default.basename(root.replace(/\\/g, "/")) : void 0;
|
|
79071
79197
|
const skillsByPath = new Map(context.skills.map((skill) => [comparablePath(skill.filePath), skill]));
|
|
79072
79198
|
const skip = new Set(context.skip);
|
|
79073
79199
|
const calls = [];
|
|
@@ -79104,7 +79230,7 @@ function eventsFromTask(task, context) {
|
|
|
79104
79230
|
let skill;
|
|
79105
79231
|
if (call.name === "read_file" && typeof call.args["path"] === "string") {
|
|
79106
79232
|
const requested2 = call.args["path"];
|
|
79107
|
-
const absolute =
|
|
79233
|
+
const absolute = import_node_path51.default.isAbsolute(requested2) || /^[A-Za-z]:[\\/]/.test(requested2) || root === void 0 ? requested2 : import_node_path51.default.join(root, requested2);
|
|
79108
79234
|
skill = skillsByPath.get(comparablePath(absolute));
|
|
79109
79235
|
}
|
|
79110
79236
|
if (call.name === "use_skill_file" && typeof call.args["skill"] === "string") {
|
|
@@ -79141,7 +79267,7 @@ async function backfillFromTasks(tasksDir, context, helper) {
|
|
|
79141
79267
|
}
|
|
79142
79268
|
let names;
|
|
79143
79269
|
try {
|
|
79144
|
-
names = (await
|
|
79270
|
+
names = (await import_node_fs10.promises.readdir(tasksDir)).filter((name) => name.endsWith(".json") && name !== "index.json");
|
|
79145
79271
|
} catch {
|
|
79146
79272
|
return { events: [], tasks: 0, unreadable: 0, via: "node" };
|
|
79147
79273
|
}
|
|
@@ -79149,7 +79275,7 @@ async function backfillFromTasks(tasksDir, context, helper) {
|
|
|
79149
79275
|
let unreadable = 0;
|
|
79150
79276
|
for (const name of names) {
|
|
79151
79277
|
try {
|
|
79152
|
-
events.push(...eventsFromTask(JSON.parse(await
|
|
79278
|
+
events.push(...eventsFromTask(JSON.parse(await import_node_fs10.promises.readFile(import_node_path51.default.join(tasksDir, name), "utf8")), context));
|
|
79153
79279
|
} catch {
|
|
79154
79280
|
unreadable++;
|
|
79155
79281
|
}
|
|
@@ -79157,24 +79283,24 @@ async function backfillFromTasks(tasksDir, context, helper) {
|
|
|
79157
79283
|
return { events, tasks: names.length, unreadable, via: "node" };
|
|
79158
79284
|
}
|
|
79159
79285
|
async function backfillOnce(options) {
|
|
79160
|
-
const doneFile =
|
|
79286
|
+
const doneFile = import_node_path51.default.join(options.usageDir, "backfill.json");
|
|
79161
79287
|
for (const file2 of [doneFile, ...options.legacyDoneFile !== void 0 ? [options.legacyDoneFile] : []]) {
|
|
79162
|
-
if (await
|
|
79288
|
+
if (await import_node_fs10.promises.stat(file2).then(() => true, () => false))
|
|
79163
79289
|
return { ran: false };
|
|
79164
79290
|
}
|
|
79165
|
-
await
|
|
79166
|
-
const startFile =
|
|
79291
|
+
await import_node_fs10.promises.mkdir(options.usageDir, { recursive: true });
|
|
79292
|
+
const startFile = import_node_path51.default.join(options.usageDir, "backfill-start.json");
|
|
79167
79293
|
let before;
|
|
79168
79294
|
try {
|
|
79169
79295
|
before = (options.now ?? Date.now)();
|
|
79170
|
-
await
|
|
79296
|
+
await import_node_fs10.promises.writeFile(startFile, JSON.stringify({ before }), { encoding: "utf8", flag: "wx" });
|
|
79171
79297
|
} catch (error51) {
|
|
79172
79298
|
if (error51.code !== "EEXIST")
|
|
79173
79299
|
throw error51;
|
|
79174
79300
|
let claimed;
|
|
79175
79301
|
for (let attempt = 0; attempt < 40 && claimed === void 0; attempt++) {
|
|
79176
79302
|
try {
|
|
79177
|
-
const parsed = JSON.parse(await
|
|
79303
|
+
const parsed = JSON.parse(await import_node_fs10.promises.readFile(startFile, "utf8"));
|
|
79178
79304
|
if (typeof parsed.before === "number")
|
|
79179
79305
|
claimed = parsed.before;
|
|
79180
79306
|
} catch {
|
|
@@ -79556,10 +79682,12 @@ var SCHEDULE_TICK_MS = 15e3;
|
|
|
79556
79682
|
var STUCK_RUN_MS = 30 * 6e4;
|
|
79557
79683
|
function wireChatBridge(services) {
|
|
79558
79684
|
const { transport, secrets, ui, workspaceRoot, storageDir } = services;
|
|
79685
|
+
const projectRoot = workspaceRoot !== void 0 ? mainCheckoutOf(workspaceRoot) ?? workspaceRoot : void 0;
|
|
79686
|
+
const workspaceBranch = workspaceRoot !== void 0 ? currentBranchOf(workspaceRoot) : void 0;
|
|
79559
79687
|
const machineApprovals = services.machineApprovalsFile !== void 0 ? new FileMachineApprovals(services.machineApprovalsFile) : void 0;
|
|
79560
79688
|
const mirrorRoot = services.mirrorRoot ?? storageDir;
|
|
79561
|
-
const personalSkillsDir = services.personalDir !== void 0 ?
|
|
79562
|
-
const personalToolsDir = services.personalDir !== void 0 ?
|
|
79689
|
+
const personalSkillsDir = services.personalDir !== void 0 ? import_node_path52.default.join(services.personalDir, "skills") : void 0;
|
|
79690
|
+
const personalToolsDir = services.personalDir !== void 0 ? import_node_path52.default.join(services.personalDir, "tools") : void 0;
|
|
79563
79691
|
const logger = new Logger({ level: "debug", sink: services.logSink });
|
|
79564
79692
|
let fastFsOps;
|
|
79565
79693
|
if (services.fastFs !== void 0) {
|
|
@@ -79568,20 +79696,20 @@ function wireChatBridge(services) {
|
|
|
79568
79696
|
logger.info(`Rust helper ${services.fastFs ?? ""}: ${answer === void 0 ? "did not answer; its tools are off" : `version ${answer.version ?? "unknown"}, ${String(answer.ops.size)} operations`}`);
|
|
79569
79697
|
});
|
|
79570
79698
|
}
|
|
79571
|
-
const configManager = new ConfigManager(services.configStore,
|
|
79699
|
+
const configManager = new ConfigManager(services.configStore, projectRoot);
|
|
79572
79700
|
const httpClient = services.httpClient ?? new FetchHttpClient({ useEnvProxy: true });
|
|
79573
79701
|
const conversation = new Conversation(workspaceRoot !== void 0 ? buildSystemPrompt(workspaceRoot) : void 0);
|
|
79574
79702
|
let cachedSecretValues = [];
|
|
79575
79703
|
const droppedFilesRoot2 = droppedFilesRoot();
|
|
79576
79704
|
const mailAttachmentsRoot2 = mailAttachmentsRoot();
|
|
79577
|
-
const droppedFilesDir =
|
|
79578
|
-
const truncationStore = new RecordingTruncationStore(new DiskTruncationStore(
|
|
79705
|
+
const droppedFilesDir = import_node_path52.default.join(droppedFilesRoot2, (0, import_node_crypto16.randomUUID)().slice(0, 8));
|
|
79706
|
+
const truncationStore = new RecordingTruncationStore(new DiskTruncationStore(import_node_path52.default.join(storageDir, "tool-results"), () => cachedSecretValues));
|
|
79579
79707
|
const taskStore = new JsonTaskStore(storageDir, truncationStore, logger);
|
|
79580
79708
|
const manifestsRoot = services.codebaseDir ?? storageDir;
|
|
79581
|
-
const codebaseInstructionsFile = codebaseInstructionsPath({ codebaseDir: services.codebaseDir, storageDir, workspaceRoot });
|
|
79709
|
+
const codebaseInstructionsFile = codebaseInstructionsPath({ codebaseDir: services.codebaseDir, storageDir, workspaceRoot: projectRoot });
|
|
79582
79710
|
if (services.codebaseDir !== void 0) {
|
|
79583
|
-
const shared =
|
|
79584
|
-
void
|
|
79711
|
+
const shared = import_node_path52.default.join(services.codebaseDir, "index-manifests");
|
|
79712
|
+
void import_promises29.default.access(shared).catch(() => import_promises29.default.cp(import_node_path52.default.join(storageDir, "index-manifests"), shared, { recursive: true, errorOnExist: false, force: false })).catch(() => void 0);
|
|
79585
79713
|
}
|
|
79586
79714
|
const python = new PythonManager({
|
|
79587
79715
|
workspaceRoot,
|
|
@@ -79709,7 +79837,7 @@ ${preview.text}` } : {}
|
|
|
79709
79837
|
void postDatasetStatus();
|
|
79710
79838
|
}
|
|
79711
79839
|
});
|
|
79712
|
-
const defaultSkillsDir = workspaceRoot !== void 0 ?
|
|
79840
|
+
const defaultSkillsDir = workspaceRoot !== void 0 ? import_node_path52.default.join(workspaceRoot, ".lightcode", "skills") : void 0;
|
|
79713
79841
|
let skillsDir = defaultSkillsDir;
|
|
79714
79842
|
let localSkillsDir = defaultSkillsDir;
|
|
79715
79843
|
let extraSkillDirs = [];
|
|
@@ -79732,9 +79860,9 @@ ${preview.text}` } : {}
|
|
|
79732
79860
|
const trimmed = entry.trim();
|
|
79733
79861
|
if (trimmed.length === 0)
|
|
79734
79862
|
return void 0;
|
|
79735
|
-
if (
|
|
79736
|
-
return
|
|
79737
|
-
return workspaceRoot === void 0 ? void 0 :
|
|
79863
|
+
if (import_node_path52.default.isAbsolute(trimmed))
|
|
79864
|
+
return import_node_path52.default.resolve(trimmed);
|
|
79865
|
+
return workspaceRoot === void 0 ? void 0 : import_node_path52.default.resolve(workspaceRoot, trimmed);
|
|
79738
79866
|
}
|
|
79739
79867
|
function skillSearchPath() {
|
|
79740
79868
|
return [skillsDir, ...extraSkillDirs].filter((dir) => dir !== void 0);
|
|
@@ -79766,12 +79894,12 @@ ${preview.text}` } : {}
|
|
|
79766
79894
|
function watchSkillFolders() {
|
|
79767
79895
|
stopWatchingSkills();
|
|
79768
79896
|
const dirs = skillSearchPath();
|
|
79769
|
-
for (const dir of [...dirs, ...dirs.map((entry) =>
|
|
79897
|
+
for (const dir of [...dirs, ...dirs.map((entry) => import_node_path52.default.dirname(entry))]) {
|
|
79770
79898
|
try {
|
|
79771
79899
|
skillWatchers.push(
|
|
79772
79900
|
// Recursive, because a skill may be a folder with SKILL.md inside — a non-recursive
|
|
79773
79901
|
// watch sees the folder appear and then never hears about the file written into it.
|
|
79774
|
-
(0,
|
|
79902
|
+
(0, import_node_fs11.watch)(dir, { recursive: true }, () => {
|
|
79775
79903
|
if (skillWatchTimer !== void 0)
|
|
79776
79904
|
clearTimeout(skillWatchTimer);
|
|
79777
79905
|
skillWatchTimer = setTimeout(() => {
|
|
@@ -79794,12 +79922,12 @@ ${preview.text}` } : {}
|
|
|
79794
79922
|
// instruction on the wire twice.
|
|
79795
79923
|
skills: await Promise.all(skills.map(async (skill) => {
|
|
79796
79924
|
const readdir = async (dir) => {
|
|
79797
|
-
const entries = await
|
|
79925
|
+
const entries = await import_promises29.default.readdir(dir, { withFileTypes: true });
|
|
79798
79926
|
return entries.map((entry) => ({ name: entry.name, isDirectory: entry.isDirectory() }));
|
|
79799
79927
|
};
|
|
79800
79928
|
const images = await listSkillImages(skill.filePath, { readdir });
|
|
79801
79929
|
const files = await listSkillFiles(skill.filePath, { readdir });
|
|
79802
|
-
const placeholders = findPlaceholders(await
|
|
79930
|
+
const placeholders = findPlaceholders(await import_promises29.default.readFile(skill.filePath, "utf8").catch(() => ""));
|
|
79803
79931
|
return {
|
|
79804
79932
|
name: skill.name,
|
|
79805
79933
|
description: skill.description,
|
|
@@ -79843,7 +79971,7 @@ ${preview.text}` } : {}
|
|
|
79843
79971
|
await openInPanelEditor(filePath);
|
|
79844
79972
|
return;
|
|
79845
79973
|
}
|
|
79846
|
-
const real = await confineToAny(
|
|
79974
|
+
const real = await confineToAny(import_node_path52.default.resolve(filePath), roots);
|
|
79847
79975
|
await ui.openFile?.(real);
|
|
79848
79976
|
} catch (error51) {
|
|
79849
79977
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
@@ -79854,9 +79982,9 @@ ${preview.text}` } : {}
|
|
|
79854
79982
|
python.toolsDirectory(),
|
|
79855
79983
|
...skillsDir === void 0 ? [] : [skillsDir],
|
|
79856
79984
|
...extraSkillDirs.filter((dir) => dir !== void 0),
|
|
79857
|
-
|
|
79985
|
+
import_node_path52.default.join(storageDir, "reports"),
|
|
79858
79986
|
// Its own folder: nothing else lives there.
|
|
79859
|
-
...codebaseInstructionsFile === void 0 ? [] : [
|
|
79987
|
+
...codebaseInstructionsFile === void 0 ? [] : [import_node_path52.default.dirname(codebaseInstructionsFile)]
|
|
79860
79988
|
].filter((dir) => dir.length > 0);
|
|
79861
79989
|
}
|
|
79862
79990
|
function mostlyCrlf(text2) {
|
|
@@ -79865,32 +79993,32 @@ ${preview.text}` } : {}
|
|
|
79865
79993
|
}
|
|
79866
79994
|
const EDITOR_MAX_BYTES = 2 * 1024 * 1024;
|
|
79867
79995
|
async function openInPanelEditor(filePath) {
|
|
79868
|
-
const real = await confineToAny(
|
|
79869
|
-
const stat = await
|
|
79996
|
+
const real = await confineToAny(import_node_path52.default.resolve(filePath), managedRoots());
|
|
79997
|
+
const stat = await import_promises29.default.stat(real);
|
|
79870
79998
|
if (stat.size > EDITOR_MAX_BYTES)
|
|
79871
|
-
throw new Error(`${
|
|
79872
|
-
const raw = await
|
|
79999
|
+
throw new Error(`${import_node_path52.default.basename(real)} is too large to edit here (${String(Math.round(stat.size / 1024))} KB).`);
|
|
80000
|
+
const raw = await import_promises29.default.readFile(real, "utf8");
|
|
79873
80001
|
const crlf = mostlyCrlf(raw);
|
|
79874
|
-
post({ type: "editorFile", path: real, name:
|
|
80002
|
+
post({ type: "editorFile", path: real, name: import_node_path52.default.basename(real), content: raw.split("\r\n").join("\n"), mtimeMs: stat.mtimeMs, eol: crlf ? "crlf" : "lf" });
|
|
79875
80003
|
}
|
|
79876
80004
|
async function handleSaveEditorFile(filePath, content, mtimeMs) {
|
|
79877
80005
|
try {
|
|
79878
|
-
const real = await confineToAny(
|
|
79879
|
-
const current = await
|
|
80006
|
+
const real = await confineToAny(import_node_path52.default.resolve(filePath), managedRoots());
|
|
80007
|
+
const current = await import_promises29.default.stat(real).catch(() => void 0);
|
|
79880
80008
|
if (current !== void 0 && Math.abs(current.mtimeMs - mtimeMs) > 1) {
|
|
79881
80009
|
post({
|
|
79882
80010
|
type: "editorSaved",
|
|
79883
80011
|
path: real,
|
|
79884
80012
|
ok: false,
|
|
79885
80013
|
conflict: true,
|
|
79886
|
-
message: `${
|
|
80014
|
+
message: `${import_node_path52.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.`
|
|
79887
80015
|
});
|
|
79888
80016
|
return;
|
|
79889
80017
|
}
|
|
79890
|
-
const before = current === void 0 ? "" : await
|
|
80018
|
+
const before = current === void 0 ? "" : await import_promises29.default.readFile(real, "utf8");
|
|
79891
80019
|
const crlf = mostlyCrlf(before);
|
|
79892
80020
|
await writeFileAtomically(real, crlf ? content.split("\r\n").join("\n").split("\n").join("\r\n") : content);
|
|
79893
|
-
const saved = await
|
|
80021
|
+
const saved = await import_promises29.default.stat(real);
|
|
79894
80022
|
post({ type: "editorSaved", path: real, ok: true, mtimeMs: saved.mtimeMs });
|
|
79895
80023
|
await postSkills().catch(() => void 0);
|
|
79896
80024
|
} catch (error51) {
|
|
@@ -79907,10 +80035,10 @@ ${preview.text}` } : {}
|
|
|
79907
80035
|
await handleOpenManagedFile(existing.filePath);
|
|
79908
80036
|
return;
|
|
79909
80037
|
}
|
|
79910
|
-
const target =
|
|
80038
|
+
const target = import_node_path52.default.join(skillsDir, "standing-instructions.md");
|
|
79911
80039
|
try {
|
|
79912
|
-
await
|
|
79913
|
-
await
|
|
80040
|
+
await import_promises29.default.mkdir(skillsDir, { recursive: true });
|
|
80041
|
+
await import_promises29.default.writeFile(target, STANDING_SKILL_TEMPLATE, { encoding: "utf8", flag: "wx" });
|
|
79914
80042
|
} catch (error51) {
|
|
79915
80043
|
const code = error51.code;
|
|
79916
80044
|
if (code !== "EEXIST") {
|
|
@@ -79927,8 +80055,8 @@ ${preview.text}` } : {}
|
|
|
79927
80055
|
return;
|
|
79928
80056
|
}
|
|
79929
80057
|
try {
|
|
79930
|
-
await
|
|
79931
|
-
await
|
|
80058
|
+
await import_promises29.default.mkdir(import_node_path52.default.dirname(codebaseInstructionsFile), { recursive: true });
|
|
80059
|
+
await import_promises29.default.writeFile(codebaseInstructionsFile, "", { encoding: "utf8", flag: "wx" });
|
|
79932
80060
|
} catch (error51) {
|
|
79933
80061
|
if (error51.code !== "EEXIST") {
|
|
79934
80062
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
@@ -79944,15 +80072,15 @@ ${preview.text}` } : {}
|
|
|
79944
80072
|
return;
|
|
79945
80073
|
if (!isValidToolName(name))
|
|
79946
80074
|
throw new Error(`"${name}" is not a valid tool name.`);
|
|
79947
|
-
const ownCopy =
|
|
80075
|
+
const ownCopy = import_node_path52.default.join(dir, toolFileName(name));
|
|
79948
80076
|
if (filePath !== void 0) {
|
|
79949
|
-
const same2 = (a, b) => normalizeForComparison(
|
|
80077
|
+
const same2 = (a, b) => normalizeForComparison(import_node_path52.default.resolve(a)) === normalizeForComparison(import_node_path52.default.resolve(b));
|
|
79950
80078
|
if (!same2(filePath, ownCopy)) {
|
|
79951
|
-
const fromBucket = mirroredToolsDirs.some((mirror) => same2(
|
|
80079
|
+
const fromBucket = mirroredToolsDirs.some((mirror) => same2(import_node_path52.default.dirname(filePath), mirror));
|
|
79952
80080
|
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.`);
|
|
79953
80081
|
}
|
|
79954
80082
|
}
|
|
79955
|
-
await
|
|
80083
|
+
await import_promises29.default.rm(ownCopy, { force: true });
|
|
79956
80084
|
await forgetTool(dir, name);
|
|
79957
80085
|
await python.refresh();
|
|
79958
80086
|
await postPython();
|
|
@@ -79965,7 +80093,7 @@ ${preview.text}` } : {}
|
|
|
79965
80093
|
return `"${name}" is not a valid tool name.`;
|
|
79966
80094
|
const onDisk = async (candidate) => {
|
|
79967
80095
|
try {
|
|
79968
|
-
await
|
|
80096
|
+
await import_promises29.default.stat(candidate);
|
|
79969
80097
|
return true;
|
|
79970
80098
|
} catch {
|
|
79971
80099
|
return false;
|
|
@@ -79974,7 +80102,7 @@ ${preview.text}` } : {}
|
|
|
79974
80102
|
let dir;
|
|
79975
80103
|
let filePath = "";
|
|
79976
80104
|
for (const candidate of python.toolDirectories()) {
|
|
79977
|
-
const attempt =
|
|
80105
|
+
const attempt = import_node_path52.default.join(candidate, toolFileName(name));
|
|
79978
80106
|
if (await onDisk(attempt)) {
|
|
79979
80107
|
dir = candidate;
|
|
79980
80108
|
filePath = attempt;
|
|
@@ -79983,7 +80111,7 @@ ${preview.text}` } : {}
|
|
|
79983
80111
|
}
|
|
79984
80112
|
if (dir === void 0)
|
|
79985
80113
|
return `no file for "${name}" in any configured tools folder`;
|
|
79986
|
-
const source = await
|
|
80114
|
+
const source = await import_promises29.default.readFile(filePath, "utf8");
|
|
79987
80115
|
const described = await python.describe(name, filePath);
|
|
79988
80116
|
if (described === void 0)
|
|
79989
80117
|
return `"${name}" could not be loaded, so it was not approved`;
|
|
@@ -80005,7 +80133,7 @@ ${preview.text}` } : {}
|
|
|
80005
80133
|
function samePath(a, b) {
|
|
80006
80134
|
if (a === void 0 || b === void 0)
|
|
80007
80135
|
return false;
|
|
80008
|
-
const norm2 = (value) => process.platform === "win32" ?
|
|
80136
|
+
const norm2 = (value) => process.platform === "win32" ? import_node_path52.default.resolve(value).toLowerCase() : import_node_path52.default.resolve(value);
|
|
80009
80137
|
return norm2(a) === norm2(b);
|
|
80010
80138
|
}
|
|
80011
80139
|
function publishFolder(kind, mirrors) {
|
|
@@ -80093,12 +80221,12 @@ ${preview.text}` } : {}
|
|
|
80093
80221
|
const suffix = kind === "skills" ? ".md" : ".py";
|
|
80094
80222
|
let entries = [];
|
|
80095
80223
|
try {
|
|
80096
|
-
entries = (await
|
|
80224
|
+
entries = (await import_promises29.default.readdir(dir)).filter((entry) => !entry.startsWith(".") && entry.toLowerCase().endsWith(suffix));
|
|
80097
80225
|
} catch {
|
|
80098
80226
|
entries = [];
|
|
80099
80227
|
}
|
|
80100
80228
|
if (entries.length === 0) {
|
|
80101
|
-
const exists2 = await
|
|
80229
|
+
const exists2 = await import_promises29.default.stat(dir).then(() => true).catch(() => false);
|
|
80102
80230
|
ui.showInfo(exists2 ? `Nothing in ${dir} to upload.` : `${dir} does not exist yet, so there is nothing to upload.`);
|
|
80103
80231
|
return;
|
|
80104
80232
|
}
|
|
@@ -80113,7 +80241,7 @@ ${preview.text}` } : {}
|
|
|
80113
80241
|
target,
|
|
80114
80242
|
...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {},
|
|
80115
80243
|
relative: entry,
|
|
80116
|
-
contents: await
|
|
80244
|
+
contents: await import_promises29.default.readFile(import_node_path52.default.join(dir, entry))
|
|
80117
80245
|
});
|
|
80118
80246
|
uploaded += 1;
|
|
80119
80247
|
} catch (error51) {
|
|
@@ -80135,9 +80263,9 @@ ${preview.text}` } : {}
|
|
|
80135
80263
|
if (!isValidToolName(name))
|
|
80136
80264
|
throw new Error(`"${name}" is not a valid tool name.`);
|
|
80137
80265
|
for (const candidate of python.toolDirectories()) {
|
|
80138
|
-
const attempt =
|
|
80266
|
+
const attempt = import_node_path52.default.join(candidate, toolFileName(name));
|
|
80139
80267
|
try {
|
|
80140
|
-
post({ type: "pythonToolSource", name, source: await
|
|
80268
|
+
post({ type: "pythonToolSource", name, source: await import_promises29.default.readFile(attempt, "utf8") });
|
|
80141
80269
|
return;
|
|
80142
80270
|
} catch {
|
|
80143
80271
|
}
|
|
@@ -80188,7 +80316,7 @@ ${preview.text}` } : {}
|
|
|
80188
80316
|
continue;
|
|
80189
80317
|
for (const candidate of python.toolDirectories()) {
|
|
80190
80318
|
try {
|
|
80191
|
-
const source = await
|
|
80319
|
+
const source = await import_promises29.default.readFile(import_node_path52.default.join(candidate, toolFileName(name)), "utf8");
|
|
80192
80320
|
declined[name] = hashSource(source);
|
|
80193
80321
|
recorded += 1;
|
|
80194
80322
|
break;
|
|
@@ -80237,7 +80365,7 @@ ${preview.text}` } : {}
|
|
|
80237
80365
|
throw new Error(`"${name}" is not a valid tool name.`);
|
|
80238
80366
|
const onDisk = async (candidate) => {
|
|
80239
80367
|
try {
|
|
80240
|
-
await
|
|
80368
|
+
await import_promises29.default.stat(candidate);
|
|
80241
80369
|
return true;
|
|
80242
80370
|
} catch {
|
|
80243
80371
|
return false;
|
|
@@ -80246,7 +80374,7 @@ ${preview.text}` } : {}
|
|
|
80246
80374
|
let dir;
|
|
80247
80375
|
let filePath = "";
|
|
80248
80376
|
for (const candidate of python.toolDirectories()) {
|
|
80249
|
-
const attempt =
|
|
80377
|
+
const attempt = import_node_path52.default.join(candidate, toolFileName(name));
|
|
80250
80378
|
if (await onDisk(attempt)) {
|
|
80251
80379
|
dir = candidate;
|
|
80252
80380
|
filePath = attempt;
|
|
@@ -80256,7 +80384,7 @@ ${preview.text}` } : {}
|
|
|
80256
80384
|
if (dir === void 0) {
|
|
80257
80385
|
throw new Error(`No file for "${name}" was found in any configured tools folder.`);
|
|
80258
80386
|
}
|
|
80259
|
-
const source = await
|
|
80387
|
+
const source = await import_promises29.default.readFile(filePath, "utf8");
|
|
80260
80388
|
const described = await python.describe(name, filePath);
|
|
80261
80389
|
if (described === void 0) {
|
|
80262
80390
|
throw new Error(`"${name}" could not be loaded, so it was not approved. Fix the file and try again.`);
|
|
@@ -80272,7 +80400,7 @@ ${preview.text}` } : {}
|
|
|
80272
80400
|
function mirrorForDir(sourceDir) {
|
|
80273
80401
|
if (sourceDir === void 0)
|
|
80274
80402
|
return void 0;
|
|
80275
|
-
const wanted =
|
|
80403
|
+
const wanted = import_node_path52.default.resolve(sourceDir).toLowerCase();
|
|
80276
80404
|
for (const mirror of cachedSkillMirrors) {
|
|
80277
80405
|
if (mirror.enabled !== true)
|
|
80278
80406
|
continue;
|
|
@@ -80282,7 +80410,7 @@ ${preview.text}` } : {}
|
|
|
80282
80410
|
kind: "skills",
|
|
80283
80411
|
...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}
|
|
80284
80412
|
});
|
|
80285
|
-
if (
|
|
80413
|
+
if (import_node_path52.default.resolve(localDir).toLowerCase() === wanted)
|
|
80286
80414
|
return { mirror, localDir };
|
|
80287
80415
|
}
|
|
80288
80416
|
return void 0;
|
|
@@ -80347,8 +80475,8 @@ ${preview.text}` } : {}
|
|
|
80347
80475
|
});
|
|
80348
80476
|
let localProblem;
|
|
80349
80477
|
try {
|
|
80350
|
-
await
|
|
80351
|
-
await
|
|
80478
|
+
await import_promises29.default.rm(import_node_path52.default.join(found2.localDir, `${name}.md`), { force: true });
|
|
80479
|
+
await import_promises29.default.rm(import_node_path52.default.join(found2.localDir, name), { recursive: true, force: true });
|
|
80352
80480
|
} catch (error51) {
|
|
80353
80481
|
localProblem = error51 instanceof Error ? error51.message : String(error51);
|
|
80354
80482
|
}
|
|
@@ -80383,7 +80511,7 @@ ${preview.text}` } : {}
|
|
|
80383
80511
|
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.`);
|
|
80384
80512
|
}
|
|
80385
80513
|
const from = existing?.sourceDir !== void 0 && samePath(existing.sourceDir, personalSkillsDir) ? existing.sourceDir : skillsDir;
|
|
80386
|
-
await
|
|
80514
|
+
await import_promises29.default.rm(import_node_path52.default.join(from, skillFileName(name)), { force: true });
|
|
80387
80515
|
await postSkills();
|
|
80388
80516
|
} catch (error51) {
|
|
80389
80517
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
@@ -80563,9 +80691,9 @@ ${preview.text}` } : {}
|
|
|
80563
80691
|
const MENTION_SCAN_LIMIT = 2e3;
|
|
80564
80692
|
const MENTION_RESULT_LIMIT = 30;
|
|
80565
80693
|
let scheduleToolAccess;
|
|
80566
|
-
const approvalsKey =
|
|
80694
|
+
const approvalsKey = projectRoot ?? "__no_workspace__";
|
|
80567
80695
|
function comparableApprovalsKey(key2) {
|
|
80568
|
-
return key2 === "__no_workspace__" ? key2 : normalizeForComparison(
|
|
80696
|
+
return key2 === "__no_workspace__" ? key2 : normalizeForComparison(import_node_path52.default.resolve(key2));
|
|
80569
80697
|
}
|
|
80570
80698
|
function approvalsFrom(stored) {
|
|
80571
80699
|
if (stored === void 0)
|
|
@@ -80776,14 +80904,14 @@ ${preview.text}` } : {}
|
|
|
80776
80904
|
...taskExpertEstimate === void 0 ? {} : { estimate: taskExpertEstimate }
|
|
80777
80905
|
});
|
|
80778
80906
|
}
|
|
80779
|
-
const expertEventsPath =
|
|
80907
|
+
const expertEventsPath = import_node_path52.default.join(storageDir, "expert-events.jsonl");
|
|
80780
80908
|
let expertEvents;
|
|
80781
80909
|
let juniorTurnWithoutExpert = false;
|
|
80782
80910
|
async function loadExpertEvents() {
|
|
80783
80911
|
if (expertEvents !== void 0)
|
|
80784
80912
|
return expertEvents;
|
|
80785
80913
|
try {
|
|
80786
|
-
const raw = await
|
|
80914
|
+
const raw = await import_promises29.default.readFile(expertEventsPath, "utf8");
|
|
80787
80915
|
const parsed = [];
|
|
80788
80916
|
for (const line of raw.split("\n")) {
|
|
80789
80917
|
if (line.trim().length === 0)
|
|
@@ -80804,8 +80932,8 @@ ${preview.text}` } : {}
|
|
|
80804
80932
|
try {
|
|
80805
80933
|
const events = await loadExpertEvents();
|
|
80806
80934
|
events.push(event);
|
|
80807
|
-
await
|
|
80808
|
-
await
|
|
80935
|
+
await import_promises29.default.mkdir(import_node_path52.default.dirname(expertEventsPath), { recursive: true });
|
|
80936
|
+
await import_promises29.default.appendFile(expertEventsPath, `${JSON.stringify(event)}
|
|
80809
80937
|
`, "utf8");
|
|
80810
80938
|
} catch (error51) {
|
|
80811
80939
|
logger.warn(`could not record expert spend: ${String(error51)}`);
|
|
@@ -81090,11 +81218,15 @@ ${preview.text}` } : {}
|
|
|
81090
81218
|
function contextMentionPath(file2) {
|
|
81091
81219
|
if (workspaceRoot === void 0)
|
|
81092
81220
|
return file2;
|
|
81093
|
-
const relative =
|
|
81094
|
-
return relative.length > 0 && !relative.startsWith("..") && !
|
|
81221
|
+
const relative = import_node_path52.default.relative(workspaceRoot, file2);
|
|
81222
|
+
return relative.length > 0 && !relative.startsWith("..") && !import_node_path52.default.isAbsolute(relative) ? relative.split(import_node_path52.default.sep).join("/") : file2;
|
|
81095
81223
|
}
|
|
81096
81224
|
function hostCapabilities() {
|
|
81097
81225
|
return {
|
|
81226
|
+
// The branch this window or tab works on, shown under the chat's name; and the repository, when this
|
|
81227
|
+
// folder is one of its branch folders (git/worktrees.ts).
|
|
81228
|
+
...workspaceBranch !== void 0 ? { workspaceBranch } : {},
|
|
81229
|
+
...projectRoot !== void 0 && workspaceRoot !== void 0 && projectRoot !== workspaceRoot ? { branchFolderOf: import_node_path52.default.basename(projectRoot) } : {},
|
|
81098
81230
|
// The GitHub Copilot preset, offered only where VS Code's models can be reached.
|
|
81099
81231
|
hostModels: services.languageModels !== void 0,
|
|
81100
81232
|
nativeGuide: ui.openWalkthrough !== void 0,
|
|
@@ -81609,14 +81741,14 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
81609
81741
|
}
|
|
81610
81742
|
function readUserNpmrc() {
|
|
81611
81743
|
try {
|
|
81612
|
-
return (0,
|
|
81744
|
+
return (0, import_node_fs12.readFileSync)(process.env["NPM_CONFIG_USERCONFIG"] ?? import_node_path52.default.join(import_node_os6.default.homedir(), ".npmrc"), "utf8");
|
|
81613
81745
|
} catch {
|
|
81614
81746
|
return void 0;
|
|
81615
81747
|
}
|
|
81616
81748
|
}
|
|
81617
81749
|
function addonFolders(config2) {
|
|
81618
81750
|
return {
|
|
81619
|
-
configured: (config2.addons?.folders ?? []).map((folder) =>
|
|
81751
|
+
configured: (config2.addons?.folders ?? []).map((folder) => import_node_path52.default.resolve(folder)),
|
|
81620
81752
|
defaults: defaultAddonFolders(process.env, process.execPath, process.platform, readUserNpmrc())
|
|
81621
81753
|
};
|
|
81622
81754
|
}
|
|
@@ -81640,7 +81772,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
81640
81772
|
stored.add(ref);
|
|
81641
81773
|
const delivery = deliveryFor(addonRoot, addon, settings, stored);
|
|
81642
81774
|
await writeFileAtomically(delivery.file, JSON.stringify(delivery.contents, null, 2));
|
|
81643
|
-
await
|
|
81775
|
+
await import_promises29.default.mkdir(addonDownloadsDir(addonRoot, addon), { recursive: true });
|
|
81644
81776
|
delivered.set(addon.package, delivery.env);
|
|
81645
81777
|
} catch (error51) {
|
|
81646
81778
|
logger.warn(`Could not prepare the settings for add-on ${addon.package}: ${describeFailure2(error51)}`);
|
|
@@ -81897,7 +82029,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
81897
82029
|
}
|
|
81898
82030
|
async function handleSaveAddonFolders(folders) {
|
|
81899
82031
|
const cleaned = [...new Set(folders.map((folder) => folder.trim()).filter((folder) => folder.length > 0))];
|
|
81900
|
-
const relative = cleaned.find((folder) => !
|
|
82032
|
+
const relative = cleaned.find((folder) => !import_node_path52.default.isAbsolute(folder));
|
|
81901
82033
|
if (relative !== void 0) {
|
|
81902
82034
|
await postAddons(`"${relative}" is not a full path. Add-on folders are full paths, such as C:\\addons.`);
|
|
81903
82035
|
return;
|
|
@@ -81908,7 +82040,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
81908
82040
|
postMcp();
|
|
81909
82041
|
await postAddons();
|
|
81910
82042
|
}
|
|
81911
|
-
const shadowGit = workspaceRoot !== void 0 ? new ShadowGit(workspaceRoot,
|
|
82043
|
+
const shadowGit = workspaceRoot !== void 0 ? new ShadowGit(workspaceRoot, import_node_path52.default.join(storageDir, "checkpoints", "shadow.git"), services.codebaseDir !== void 0 ? import_node_path52.default.join(services.codebaseDir, "checkpoint-objects") : void 0) : void 0;
|
|
81912
82044
|
async function postProfiles() {
|
|
81913
82045
|
const { config: config2 } = await configManager.load();
|
|
81914
82046
|
const profiles = await Promise.all((config2.profiles ?? []).map((profile) => toSummary(profile, secrets)));
|
|
@@ -82333,7 +82465,8 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
82333
82465
|
...services.fileReach === "anywhere" ? { reach: "anywhere" } : {},
|
|
82334
82466
|
// Resolved per turn by the host, so an edit applies to the next command rather than
|
|
82335
82467
|
// needing a new session. Absent in the extension, where there is nothing to resolve.
|
|
82336
|
-
|
|
82468
|
+
// The host's own values, and this branch folder's (LIGHT_CODE_BRANCH, LIGHT_CODE_PORT_OFFSET).
|
|
82469
|
+
...services.sessionEnv !== void 0 || Object.keys(branchEnv).length > 0 ? { sessionEnv: { ...services.sessionEnv?.() ?? {}, ...branchEnv } } : {},
|
|
82337
82470
|
/*
|
|
82338
82471
|
* Omitted for a scheduled run: there is nobody to answer, and a run that could grant
|
|
82339
82472
|
* itself new filesystem access would defeat the point of its allowlist.
|
|
@@ -82344,7 +82477,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
82344
82477
|
...schedule === void 0 ? { requestForm } : {},
|
|
82345
82478
|
// A skill read with the user's defaults for its placeholders carries them (`skills/defaults.ts`).
|
|
82346
82479
|
annotateRead: (realPath) => {
|
|
82347
|
-
const fold = (value) => process.platform === "win32" ?
|
|
82480
|
+
const fold = (value) => process.platform === "win32" ? import_node_path52.default.resolve(value).toLowerCase() : import_node_path52.default.resolve(value);
|
|
82348
82481
|
const skill = skills.find((each) => fold(each.filePath) === fold(realPath));
|
|
82349
82482
|
return skill === void 0 ? void 0 : skillDefaultsReadNote(skill.name, config2.skillDefaults?.[skill.name]);
|
|
82350
82483
|
},
|
|
@@ -82973,8 +83106,8 @@ ${direction}` : attachMentions(text2, mentions);
|
|
|
82973
83106
|
const fromHub = hub === void 0 || root !== workspaceRoot ? void 0 : await hubGitDiff(hub);
|
|
82974
83107
|
if (typeof fromHub === "string")
|
|
82975
83108
|
throw new Error(fromHub);
|
|
82976
|
-
const
|
|
82977
|
-
const child = (0,
|
|
83109
|
+
const git2 = (args) => new Promise((resolve) => {
|
|
83110
|
+
const child = (0, import_node_child_process15.spawn)("git", ["--no-optional-locks", "-C", root, ...args], {
|
|
82978
83111
|
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" },
|
|
82979
83112
|
windowsHide: true
|
|
82980
83113
|
});
|
|
@@ -82990,15 +83123,15 @@ ${direction}` : attachMentions(text2, mentions);
|
|
|
82990
83123
|
resolve({ ok: code === 0, out });
|
|
82991
83124
|
});
|
|
82992
83125
|
});
|
|
82993
|
-
const status2 = fromHub !== void 0 ? { ok: true, out: fromHub.status } : await
|
|
83126
|
+
const status2 = fromHub !== void 0 ? { ok: true, out: fromHub.status } : await git2(["status", "--short", "--untracked-files=normal"]);
|
|
82994
83127
|
if (!status2.ok)
|
|
82995
83128
|
throw new Error("This folder is not a git repository, or git could not be run.");
|
|
82996
83129
|
if (status2.out.trim().length === 0)
|
|
82997
83130
|
throw new Error("Nothing has changed, so there is nothing to describe.");
|
|
82998
|
-
const staged = fromHub === void 0 && options.preferStaged === true ? await
|
|
82999
|
-
let diff = fromHub !== void 0 ? { ok: true, out: fromHub.diff } : staged !== void 0 && staged.ok && staged.out.trim().length > 0 ? staged : await
|
|
83131
|
+
const staged = fromHub === void 0 && options.preferStaged === true ? await git2(["diff", "--cached", "--no-color", "--no-ext-diff", "--stat", "--patch"]) : void 0;
|
|
83132
|
+
let diff = fromHub !== void 0 ? { ok: true, out: fromHub.diff } : staged !== void 0 && staged.ok && staged.out.trim().length > 0 ? staged : await git2(["diff", "HEAD", "--no-color", "--no-ext-diff", "--stat", "--patch"]);
|
|
83000
83133
|
if (!diff.ok)
|
|
83001
|
-
diff = await
|
|
83134
|
+
diff = await git2(["diff", "--no-color", "--no-ext-diff", "--stat", "--patch"]);
|
|
83002
83135
|
const shown2 = diff.out.length > 24e3 ? `${diff.out.slice(0, 24e3)}
|
|
83003
83136
|
... (diff cut here)` : diff.out;
|
|
83004
83137
|
const config2 = await loadSettings();
|
|
@@ -83605,7 +83738,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83605
83738
|
return { mode: cachedSearchScope, author: cachedAttribution.author };
|
|
83606
83739
|
}
|
|
83607
83740
|
function currentProjectNames() {
|
|
83608
|
-
const names = [cachedAttribution.project, workspaceRoot !== void 0 ?
|
|
83741
|
+
const names = [cachedAttribution.project, workspaceRoot !== void 0 ? import_node_path52.default.basename(workspaceRoot) : void 0];
|
|
83609
83742
|
return names.filter((name) => name !== void 0 && name.length > 0);
|
|
83610
83743
|
}
|
|
83611
83744
|
function indexProject(config2) {
|
|
@@ -83708,8 +83841,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83708
83841
|
limit: limits.limit,
|
|
83709
83842
|
previewChars: limits.previewChars
|
|
83710
83843
|
});
|
|
83711
|
-
for (const
|
|
83712
|
-
skipped.add(
|
|
83844
|
+
for (const path63 of answer.skipped ?? [])
|
|
83845
|
+
skipped.add(path63);
|
|
83713
83846
|
return { messages: answer.messages, truncated: answer.truncated };
|
|
83714
83847
|
},
|
|
83715
83848
|
...embedder !== void 0 && search !== void 0 && collection !== void 0 ? {
|
|
@@ -84008,9 +84141,9 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84008
84141
|
});
|
|
84009
84142
|
const all = result.folders.map((entry) => entry.path);
|
|
84010
84143
|
const wanted = new Set(chosen);
|
|
84011
|
-
for (const
|
|
84012
|
-
if (chosen.some((root) =>
|
|
84013
|
-
wanted.add(
|
|
84144
|
+
for (const path63 of all) {
|
|
84145
|
+
if (chosen.some((root) => path63 === root || path63.startsWith(`${root}\\`)))
|
|
84146
|
+
wanted.add(path63);
|
|
84014
84147
|
}
|
|
84015
84148
|
return [...wanted];
|
|
84016
84149
|
} catch {
|
|
@@ -84018,10 +84151,10 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84018
84151
|
}
|
|
84019
84152
|
}
|
|
84020
84153
|
async function handleRequestOutlookFolders(depth, force = false) {
|
|
84021
|
-
const cachePath =
|
|
84154
|
+
const cachePath = import_node_path52.default.join(storageDir, "outlook-folders.json");
|
|
84022
84155
|
let served = false;
|
|
84023
84156
|
try {
|
|
84024
|
-
const cached2 = JSON.parse(await
|
|
84157
|
+
const cached2 = JSON.parse(await import_promises29.default.readFile(cachePath, "utf8"));
|
|
84025
84158
|
post({
|
|
84026
84159
|
type: "outlookFolders",
|
|
84027
84160
|
folders: cached2.folders,
|
|
@@ -84038,8 +84171,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84038
84171
|
const scannedAt = Date.now();
|
|
84039
84172
|
post({ type: "outlookFolders", folders: result.folders, scannedAt });
|
|
84040
84173
|
try {
|
|
84041
|
-
await
|
|
84042
|
-
await
|
|
84174
|
+
await import_promises29.default.mkdir(import_node_path52.default.dirname(cachePath), { recursive: true });
|
|
84175
|
+
await import_promises29.default.writeFile(cachePath, JSON.stringify({ scannedAt, folders: result.folders }), "utf8");
|
|
84043
84176
|
} catch {
|
|
84044
84177
|
}
|
|
84045
84178
|
} catch (error51) {
|
|
@@ -84757,12 +84890,12 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84757
84890
|
if (!isSafeSegment(settings.project) || !isSafeSegment(settings.repo))
|
|
84758
84891
|
return { reason: "Enter the project key and repository slug." };
|
|
84759
84892
|
const digest = (0, import_node_crypto16.createHash)("sha256").update(JSON.stringify([bitbucket.baseUrl, settings.project, settings.repo, settings.branch, settings.folder]).toLowerCase()).digest("hex").slice(0, 12);
|
|
84760
|
-
const root =
|
|
84893
|
+
const root = import_node_path52.default.join(mirrorRoot, "teamrepo", `${settings.project}-${settings.repo}-${digest}`.toLowerCase());
|
|
84761
84894
|
return {
|
|
84762
|
-
dirs: { skills:
|
|
84895
|
+
dirs: { skills: import_node_path52.default.join(root, "skills"), tools: import_node_path52.default.join(root, "tools") },
|
|
84763
84896
|
// Where new skills and tools are saved while the repository is on - see loadSettings and pythonFolders.
|
|
84764
|
-
own: { skills:
|
|
84765
|
-
stateFile:
|
|
84897
|
+
own: { skills: import_node_path52.default.join(root, "saved-here", "skills"), tools: import_node_path52.default.join(root, "saved-here", "tools") },
|
|
84898
|
+
stateFile: import_node_path52.default.join(root, TEAM_REPO_STATE_FILE),
|
|
84766
84899
|
settings
|
|
84767
84900
|
};
|
|
84768
84901
|
}
|
|
@@ -84816,24 +84949,24 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84816
84949
|
out.push(dir);
|
|
84817
84950
|
return out;
|
|
84818
84951
|
};
|
|
84819
|
-
const has2 = async (target) =>
|
|
84952
|
+
const has2 = async (target) => import_promises29.default.stat(target).then(() => true, () => false);
|
|
84820
84953
|
if (kind === "skill") {
|
|
84821
84954
|
for (const dir of unique([skillsDir, localSkillsDir, personalSkillsDir, ...mirroredSkillsDirs])) {
|
|
84822
|
-
if (await has2(
|
|
84823
|
-
plan2.local.push(
|
|
84824
|
-
if (await has2(
|
|
84825
|
-
plan2.local.push(
|
|
84955
|
+
if (await has2(import_node_path52.default.join(dir, skillFileName(name))))
|
|
84956
|
+
plan2.local.push(import_node_path52.default.join(dir, skillFileName(name)));
|
|
84957
|
+
if (await has2(import_node_path52.default.join(dir, name, "SKILL.md")))
|
|
84958
|
+
plan2.local.push(import_node_path52.default.join(dir, name));
|
|
84826
84959
|
}
|
|
84827
84960
|
for (const extra of config2.skills?.paths ?? []) {
|
|
84828
84961
|
const dir = resolveSkillDir(extra);
|
|
84829
|
-
if (dir !== void 0 && (await has2(
|
|
84962
|
+
if (dir !== void 0 && (await has2(import_node_path52.default.join(dir, skillFileName(name))) || await has2(import_node_path52.default.join(dir, name, "SKILL.md")))) {
|
|
84830
84963
|
plan2.notes.push(`Also in ${dir}, a folder you added in Settings -> Skills - not removed; delete it there.`);
|
|
84831
84964
|
}
|
|
84832
84965
|
}
|
|
84833
84966
|
} else {
|
|
84834
84967
|
for (const dir of unique([pythonFolders(config2).toolsDir, localToolsDir(config2), personalToolsDir, ...mirroredToolsDirs])) {
|
|
84835
|
-
if (await has2(
|
|
84836
|
-
plan2.local.push(
|
|
84968
|
+
if (await has2(import_node_path52.default.join(dir, toolFileName(name))))
|
|
84969
|
+
plan2.local.push(import_node_path52.default.join(dir, toolFileName(name)));
|
|
84837
84970
|
}
|
|
84838
84971
|
}
|
|
84839
84972
|
const mirrors = (kind === "skill" ? cachedSkillMirrors : cachedToolMirrors).filter((mirror) => mirror.enabled === true);
|
|
@@ -84912,9 +85045,9 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84912
85045
|
const localProblems = [];
|
|
84913
85046
|
for (const entry of local) {
|
|
84914
85047
|
try {
|
|
84915
|
-
await
|
|
85048
|
+
await import_promises29.default.rm(entry, { recursive: true, force: true });
|
|
84916
85049
|
if (kind === "tool")
|
|
84917
|
-
await forgetTool(
|
|
85050
|
+
await forgetTool(import_node_path52.default.dirname(entry), name).catch(() => void 0);
|
|
84918
85051
|
} catch (error51) {
|
|
84919
85052
|
localProblems.push(`${entry} (${error51 instanceof Error ? error51.message : String(error51)})`);
|
|
84920
85053
|
}
|
|
@@ -84951,8 +85084,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84951
85084
|
function isPersonalSkill(skill) {
|
|
84952
85085
|
if (personalSkillsDir === void 0)
|
|
84953
85086
|
return false;
|
|
84954
|
-
const norm2 = (value) => process.platform === "win32" ?
|
|
84955
|
-
return norm2(skill.filePath).startsWith(norm2(personalSkillsDir) +
|
|
85087
|
+
const norm2 = (value) => process.platform === "win32" ? import_node_path52.default.resolve(value).toLowerCase() : import_node_path52.default.resolve(value);
|
|
85088
|
+
return norm2(skill.filePath).startsWith(norm2(personalSkillsDir) + import_node_path52.default.sep);
|
|
84956
85089
|
}
|
|
84957
85090
|
function bucketFolderLabels(config2) {
|
|
84958
85091
|
const label = (kind, mirror) => {
|
|
@@ -85170,6 +85303,66 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85170
85303
|
const mirrorSyncInFlight = /* @__PURE__ */ new Set();
|
|
85171
85304
|
let mirrorSyncTimer;
|
|
85172
85305
|
let lastAutoMirrorSync = 0;
|
|
85306
|
+
const branchEnv = {};
|
|
85307
|
+
async function prepareBranchFolder() {
|
|
85308
|
+
if (workspaceRoot === void 0)
|
|
85309
|
+
return;
|
|
85310
|
+
try {
|
|
85311
|
+
if (workspaceBranch !== void 0)
|
|
85312
|
+
branchEnv["LIGHT_CODE_BRANCH"] = workspaceBranch;
|
|
85313
|
+
if (projectRoot !== void 0 && projectRoot !== workspaceRoot) {
|
|
85314
|
+
const list2 = await listWorktrees(workspaceRoot).catch(() => []);
|
|
85315
|
+
const index = list2.findIndex((each) => samePath(each.path, workspaceRoot));
|
|
85316
|
+
branchEnv["LIGHT_CODE_PORT_OFFSET"] = String(Math.max(index, 1));
|
|
85317
|
+
} else if (workspaceBranch !== void 0) {
|
|
85318
|
+
branchEnv["LIGHT_CODE_PORT_OFFSET"] = "0";
|
|
85319
|
+
}
|
|
85320
|
+
const marker = setupMarkerFor(workspaceRoot);
|
|
85321
|
+
if (marker === void 0 || !await import_promises29.default.stat(marker).then(() => true, () => false))
|
|
85322
|
+
return;
|
|
85323
|
+
await import_promises29.default.rm(marker, { force: true });
|
|
85324
|
+
const { config: config2 } = await configManager.load();
|
|
85325
|
+
const parts = [];
|
|
85326
|
+
const copy = config2.branches?.copyFiles ?? [];
|
|
85327
|
+
if (copy.length > 0 && projectRoot !== void 0 && projectRoot !== workspaceRoot) {
|
|
85328
|
+
const result = await copySetupFiles(projectRoot, workspaceRoot, copy);
|
|
85329
|
+
if (result.copied.length > 0)
|
|
85330
|
+
parts.push(`copied ${result.copied.join(", ")} from the main checkout`);
|
|
85331
|
+
if (result.skipped.length > 0)
|
|
85332
|
+
parts.push(`not copied: ${result.skipped.join(", ")}`);
|
|
85333
|
+
}
|
|
85334
|
+
const command = config2.branches?.setupCommand?.trim();
|
|
85335
|
+
if (command !== void 0 && command.length > 0) {
|
|
85336
|
+
const label = workspaceBranch ?? import_node_path52.default.basename(workspaceRoot);
|
|
85337
|
+
if (ui.runInTerminal !== void 0) {
|
|
85338
|
+
ui.runInTerminal({ name: `Set up ${label}`, command, cwd: workspaceRoot, env: branchEnv });
|
|
85339
|
+
parts.push(`running "${command}" in a terminal`);
|
|
85340
|
+
} else {
|
|
85341
|
+
ui.showInfo(`Setting up branch ${label}: running "${command}"\u2026`);
|
|
85342
|
+
const child = new NodeTerminal(cachedCommandRules.shell).run(command, { cwd: workspaceRoot, env: branchEnv });
|
|
85343
|
+
let tail = "";
|
|
85344
|
+
child.onData((chunk) => {
|
|
85345
|
+
tail = (tail + chunk).slice(-2e3);
|
|
85346
|
+
});
|
|
85347
|
+
child.onExit((code) => {
|
|
85348
|
+
const last = tail.trim().split(/\r?\n/).slice(-5).join("\n");
|
|
85349
|
+
if (code === 0)
|
|
85350
|
+
ui.showInfo(`Branch ${label} is set up ("${command}" finished).`);
|
|
85351
|
+
else
|
|
85352
|
+
ui.showWarning(`Setting up branch ${label}: "${command}" ended with code ${String(code)}.${last.length > 0 ? `
|
|
85353
|
+
${last}` : ""}`);
|
|
85354
|
+
});
|
|
85355
|
+
}
|
|
85356
|
+
}
|
|
85357
|
+
if (parts.length > 0) {
|
|
85358
|
+
logger.info(`branch folder setup: ${parts.join("; ")}`);
|
|
85359
|
+
if (ui.runInTerminal !== void 0 || copy.length > 0)
|
|
85360
|
+
ui.showInfo(`Setting up this branch folder: ${parts.join("; ")}.`);
|
|
85361
|
+
}
|
|
85362
|
+
} catch (error51) {
|
|
85363
|
+
logger.warn("branch folder setup failed", error51 instanceof Error ? error51.message : String(error51));
|
|
85364
|
+
}
|
|
85365
|
+
}
|
|
85173
85366
|
function startMirrorSync() {
|
|
85174
85367
|
const tick = async () => {
|
|
85175
85368
|
const { config: config2 } = await configManager.load();
|
|
@@ -85214,8 +85407,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85214
85407
|
approvalStamps.set("machine", stamp2);
|
|
85215
85408
|
}
|
|
85216
85409
|
for (const dir of python.toolDirectories()) {
|
|
85217
|
-
const file2 =
|
|
85218
|
-
const stamp2 = await
|
|
85410
|
+
const file2 = import_node_path52.default.join(dir, REGISTRY_FILE);
|
|
85411
|
+
const stamp2 = await import_promises29.default.stat(file2).then((stat) => stat.mtimeMs, () => 0);
|
|
85219
85412
|
if (approvalStamps.has(file2) && approvalStamps.get(file2) !== stamp2)
|
|
85220
85413
|
changed = true;
|
|
85221
85414
|
approvalStamps.set(file2, stamp2);
|
|
@@ -85307,7 +85500,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85307
85500
|
try {
|
|
85308
85501
|
const available = await listSkillImages(skill.filePath, {
|
|
85309
85502
|
readdir: async (dir) => {
|
|
85310
|
-
const entries = await
|
|
85503
|
+
const entries = await import_promises29.default.readdir(dir, { withFileTypes: true });
|
|
85311
85504
|
return entries.map((entry) => ({ name: entry.name, isDirectory: entry.isDirectory() }));
|
|
85312
85505
|
}
|
|
85313
85506
|
});
|
|
@@ -85316,7 +85509,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85316
85509
|
return;
|
|
85317
85510
|
}
|
|
85318
85511
|
const folder = skill.filePath.slice(0, skill.filePath.length - "SKILL.md".length);
|
|
85319
|
-
const bytes = await
|
|
85512
|
+
const bytes = await import_promises29.default.readFile(import_node_path52.default.join(folder, SKILL_IMAGE_DIR, image));
|
|
85320
85513
|
const dataUri = skillImageDataUri(image, bytes);
|
|
85321
85514
|
post({
|
|
85322
85515
|
type: "skillImage",
|
|
@@ -85436,7 +85629,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85436
85629
|
for (const skill of sending) {
|
|
85437
85630
|
let body = "";
|
|
85438
85631
|
try {
|
|
85439
|
-
body = await
|
|
85632
|
+
body = await import_promises29.default.readFile(skill.filePath, "utf8");
|
|
85440
85633
|
} catch {
|
|
85441
85634
|
continue;
|
|
85442
85635
|
}
|
|
@@ -85547,7 +85740,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85547
85740
|
return { name: skill.name, state: "missing" };
|
|
85548
85741
|
let body;
|
|
85549
85742
|
try {
|
|
85550
|
-
body = await
|
|
85743
|
+
body = await import_promises29.default.readFile(skill.filePath, "utf8");
|
|
85551
85744
|
} catch {
|
|
85552
85745
|
return { name: skill.name, state: "stale" };
|
|
85553
85746
|
}
|
|
@@ -85643,7 +85836,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85643
85836
|
return withoutRipgrep();
|
|
85644
85837
|
try {
|
|
85645
85838
|
const listed = await new Promise((resolve, reject2) => {
|
|
85646
|
-
const child = (0,
|
|
85839
|
+
const child = (0, import_node_child_process15.spawn)(ripgrepPath, ["--files", "--hidden", "--glob", "!.git"], {
|
|
85647
85840
|
cwd: workspaceRoot
|
|
85648
85841
|
});
|
|
85649
85842
|
let out = "";
|
|
@@ -85682,17 +85875,17 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85682
85875
|
}
|
|
85683
85876
|
function docsFingerprintPath(index, storeId, kind) {
|
|
85684
85877
|
const suffix = kind === void 0 ? "docs" : `docs.${kind}`;
|
|
85685
|
-
return
|
|
85878
|
+
return import_node_path52.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.${suffix}.json`);
|
|
85686
85879
|
}
|
|
85687
85880
|
function manifestKey(index, storeId) {
|
|
85688
85881
|
return `${index}@${storeId}`;
|
|
85689
85882
|
}
|
|
85690
85883
|
function manifestPath(index, storeId) {
|
|
85691
|
-
return
|
|
85884
|
+
return import_node_path52.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.json`);
|
|
85692
85885
|
}
|
|
85693
85886
|
async function readDocsFingerprint(index, storeId, kind) {
|
|
85694
85887
|
try {
|
|
85695
|
-
const raw = JSON.parse(await
|
|
85888
|
+
const raw = JSON.parse(await import_promises29.default.readFile(docsFingerprintPath(index, storeId, kind), "utf8"));
|
|
85696
85889
|
return typeof raw.fingerprint === "string" ? raw.fingerprint : void 0;
|
|
85697
85890
|
} catch {
|
|
85698
85891
|
return void 0;
|
|
@@ -85752,10 +85945,10 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85752
85945
|
}
|
|
85753
85946
|
options.report?.("Writing", { done: 0, total: documents.length });
|
|
85754
85947
|
await writer.upsert(index, documents);
|
|
85755
|
-
await
|
|
85948
|
+
await import_promises29.default.mkdir(import_node_path52.default.dirname(docsFingerprintPath(index, search.id, wanted)), {
|
|
85756
85949
|
recursive: true
|
|
85757
85950
|
});
|
|
85758
|
-
await
|
|
85951
|
+
await import_promises29.default.writeFile(docsFingerprintPath(index, search.id, wanted), JSON.stringify({ fingerprint, indexedAt: Date.now(), count: documents.length }), "utf8");
|
|
85759
85952
|
return { indexed: documents.length, index };
|
|
85760
85953
|
} catch (error51) {
|
|
85761
85954
|
return { error: error51 instanceof Error ? error51.message : String(error51) };
|
|
@@ -85926,7 +86119,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85926
86119
|
}
|
|
85927
86120
|
post({ type: "storeSync", running: true, fromLabel: source.label });
|
|
85928
86121
|
const sourcePath = manifestPath(index, fromId);
|
|
85929
|
-
const manifest = await
|
|
86122
|
+
const manifest = await import_promises29.default.readFile(sourcePath, "utf8").then((raw) => JSON.parse(raw)).catch(() => void 0);
|
|
85930
86123
|
const result = await syncVectorStores({
|
|
85931
86124
|
from: createVectorIndexWriter(httpClient, source, await vectorStoreConnectionFor(source, fromId)),
|
|
85932
86125
|
to: createVectorIndexWriter(httpClient, target.store, await vectorStoreConnectionFor(target.store, target.id)),
|
|
@@ -85942,8 +86135,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85942
86135
|
});
|
|
85943
86136
|
if (manifest !== void 0) {
|
|
85944
86137
|
const targetPath = manifestPath(index, target.id);
|
|
85945
|
-
await
|
|
85946
|
-
await
|
|
86138
|
+
await import_promises29.default.mkdir(import_node_path52.default.dirname(targetPath), { recursive: true });
|
|
86139
|
+
await import_promises29.default.writeFile(targetPath, JSON.stringify(manifest), "utf8");
|
|
85947
86140
|
}
|
|
85948
86141
|
post({ type: "storeSync", running: false, copied: result.copied, fromLabel: source.label });
|
|
85949
86142
|
} catch (error51) {
|
|
@@ -85991,7 +86184,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85991
86184
|
type: "project",
|
|
85992
86185
|
hasWorkspace: workspaceRoot !== void 0,
|
|
85993
86186
|
...configured !== void 0 ? { configured } : {},
|
|
85994
|
-
...workspaceRoot !== void 0 ? { folder:
|
|
86187
|
+
...workspaceRoot !== void 0 ? { folder: import_node_path52.default.basename(workspaceRoot) } : {},
|
|
85995
86188
|
...author !== void 0 ? { author } : {},
|
|
85996
86189
|
...index !== void 0 ? { indexName: index } : {},
|
|
85997
86190
|
...ownerConfigured !== void 0 && ownerConfigured.length > 0 ? { ownerConfigured } : {},
|
|
@@ -86131,11 +86324,11 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86131
86324
|
if (workspaceRoot === void 0)
|
|
86132
86325
|
return found2;
|
|
86133
86326
|
const root = workspaceRoot;
|
|
86134
|
-
const relative =
|
|
86135
|
-
if (relative.startsWith("..") ||
|
|
86327
|
+
const relative = import_node_path52.default.relative(root, folder);
|
|
86328
|
+
if (relative.startsWith("..") || import_node_path52.default.isAbsolute(relative))
|
|
86136
86329
|
return found2;
|
|
86137
86330
|
const output = await new Promise((resolve) => {
|
|
86138
|
-
const child = (0,
|
|
86331
|
+
const child = (0, import_node_child_process15.spawn)("git", ["-c", "core.quotePath=false", "log", "--diff-filter=A", "--relative", "--format=@@%an", "--name-only", "--", relative.length > 0 ? relative : "."], {
|
|
86139
86332
|
cwd: root,
|
|
86140
86333
|
windowsHide: true
|
|
86141
86334
|
});
|
|
@@ -86149,7 +86342,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86149
86342
|
if (line.startsWith("@@"))
|
|
86150
86343
|
author = line.slice(2).trim();
|
|
86151
86344
|
else if (line.trim().length > 0 && author !== void 0 && author.length > 0) {
|
|
86152
|
-
found2.set(normalizeForComparison(
|
|
86345
|
+
found2.set(normalizeForComparison(import_node_path52.default.resolve(root, line.trim())), author);
|
|
86153
86346
|
}
|
|
86154
86347
|
}
|
|
86155
86348
|
return found2;
|
|
@@ -86164,14 +86357,14 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86164
86357
|
const toolFolders = ours([folders.toolsDir ?? localTools, localTools]);
|
|
86165
86358
|
const candidates = [];
|
|
86166
86359
|
const consider = async (kind, name, filePath, folder, location) => {
|
|
86167
|
-
const source = await
|
|
86360
|
+
const source = await import_promises29.default.readFile(filePath, "utf8");
|
|
86168
86361
|
const missing = missingAttribution(kind, source);
|
|
86169
86362
|
if (missing.length === 0)
|
|
86170
86363
|
return;
|
|
86171
86364
|
if (kind === "skill" && !/^---\r?\n/.test(source))
|
|
86172
86365
|
return;
|
|
86173
86366
|
const current = readAttribution(kind, source);
|
|
86174
|
-
const modified = (await
|
|
86367
|
+
const modified = (await import_promises29.default.stat(filePath)).mtime;
|
|
86175
86368
|
const automatic = {
|
|
86176
86369
|
...missing.includes("version") ? { version: 1 } : {},
|
|
86177
86370
|
...missing.includes("updated") ? { updated: attributionTimestamp(modified) } : {}
|
|
@@ -86193,7 +86386,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86193
86386
|
},
|
|
86194
86387
|
source,
|
|
86195
86388
|
folder,
|
|
86196
|
-
relative:
|
|
86389
|
+
relative: import_node_path52.default.relative(folder, filePath).split(import_node_path52.default.sep).join("/")
|
|
86197
86390
|
});
|
|
86198
86391
|
};
|
|
86199
86392
|
for (const folder of skillFolders) {
|
|
@@ -86204,14 +86397,14 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86204
86397
|
}
|
|
86205
86398
|
for (const folder of toolFolders) {
|
|
86206
86399
|
const location = samePath(folder, localTools) ? "project" : "bucket";
|
|
86207
|
-
const entries = await
|
|
86400
|
+
const entries = await import_promises29.default.readdir(folder).catch(() => []);
|
|
86208
86401
|
for (const entry of entries) {
|
|
86209
86402
|
if (entry.startsWith(".") || !entry.endsWith(".py"))
|
|
86210
86403
|
continue;
|
|
86211
86404
|
const name = entry.slice(0, -3);
|
|
86212
86405
|
if (!isValidToolName(name))
|
|
86213
86406
|
continue;
|
|
86214
|
-
await consider("tool", name,
|
|
86407
|
+
await consider("tool", name, import_node_path52.default.join(folder, entry), folder, location);
|
|
86215
86408
|
}
|
|
86216
86409
|
}
|
|
86217
86410
|
const readOnly = skills.filter((skill) => skill.sourceDir !== void 0 && !skillFolders.some((folder) => samePath(folder, skill.sourceDir))).length;
|
|
@@ -86243,7 +86436,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86243
86436
|
} catch {
|
|
86244
86437
|
}
|
|
86245
86438
|
}
|
|
86246
|
-
const gitAuthor = gitAuthors.get(normalizeForComparison(
|
|
86439
|
+
const gitAuthor = gitAuthors.get(normalizeForComparison(import_node_path52.default.resolve(candidate.entry.filePath)));
|
|
86247
86440
|
if (gitAuthor !== void 0) {
|
|
86248
86441
|
candidate.entry.suggestion = { author: gitAuthor, source: "git: the commit that added this file" };
|
|
86249
86442
|
}
|
|
@@ -86280,7 +86473,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86280
86473
|
const next = fillAttribution(candidate.entry.kind, candidate.source, values);
|
|
86281
86474
|
if (next === candidate.source)
|
|
86282
86475
|
continue;
|
|
86283
|
-
await
|
|
86476
|
+
await import_promises29.default.writeFile(candidate.entry.filePath, next, "utf8");
|
|
86284
86477
|
written += 1;
|
|
86285
86478
|
if (candidate.entry.kind === "tool" && candidate.entry.approved === true) {
|
|
86286
86479
|
await repinApproval(candidate.folder, candidate.entry.name, candidate.source, next);
|
|
@@ -86352,7 +86545,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86352
86545
|
aliases: plan2.kind === "codebase" ? codebaseAliases(config2) : plan2.kind === "skills" ? skillAliases(config2) : [],
|
|
86353
86546
|
onProgress: (count3) => post({ type: "indexRenames", running: true, plans, store, current: plan2.to, copied: count3 })
|
|
86354
86547
|
});
|
|
86355
|
-
await copyBookkeeping(
|
|
86548
|
+
await copyBookkeeping(import_node_path52.default.join(manifestsRoot, "index-manifests"), plan2.from, plan2.to, search.id);
|
|
86356
86549
|
done.push({ ...plan2, copied });
|
|
86357
86550
|
}
|
|
86358
86551
|
post({ type: "indexRenames", running: false, plans: [], store, done });
|
|
@@ -86365,7 +86558,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86365
86558
|
const legacy = codebaseIndexName(config2, false);
|
|
86366
86559
|
if (current === void 0 || legacy === void 0 || current === legacy)
|
|
86367
86560
|
return;
|
|
86368
|
-
const exists2 = async (file2) =>
|
|
86561
|
+
const exists2 = async (file2) => import_promises29.default.stat(file2).then(() => true, () => false);
|
|
86369
86562
|
if (await exists2(manifestPath(current, search.id)))
|
|
86370
86563
|
return;
|
|
86371
86564
|
if (!await exists2(manifestPath(legacy, search.id)))
|
|
@@ -86382,7 +86575,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86382
86575
|
project: projectName(config2, workspaceRoot),
|
|
86383
86576
|
aliases: codebaseAliases(config2)
|
|
86384
86577
|
});
|
|
86385
|
-
await copyBookkeeping(
|
|
86578
|
+
await copyBookkeeping(import_node_path52.default.join(manifestsRoot, "index-manifests"), legacy, current, search.id);
|
|
86386
86579
|
post({ type: "indexRenames", running: false, plans: [], done: [{ kind: "codebase", from: legacy, to: current, copied }] });
|
|
86387
86580
|
logger.info(`copied ${String(copied)} chunks from ${legacy} to ${current} rather than re-embedding them`);
|
|
86388
86581
|
}
|
|
@@ -86400,7 +86593,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86400
86593
|
const writer = createVectorIndexWriter(httpClient, search.store, await vectorStoreConnectionFor(search.store, search.id));
|
|
86401
86594
|
const paths = await writer.listPaths(index, { signal });
|
|
86402
86595
|
await deleteInBatches(writer, index, paths, (done, total) => reportIndexing("codebase", "Removing", { done, total }), signal);
|
|
86403
|
-
await
|
|
86596
|
+
await import_promises29.default.rm(manifestPath(index, search.id), { force: true });
|
|
86404
86597
|
post({
|
|
86405
86598
|
type: "indexResult",
|
|
86406
86599
|
result: {
|
|
@@ -86439,7 +86632,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86439
86632
|
const existing = kind === void 0 ? all : all.filter((id) => parseDocEntryId(id)?.kind === kind);
|
|
86440
86633
|
if (existing.length > 0)
|
|
86441
86634
|
await writer.deleteByPaths(index, existing);
|
|
86442
|
-
await Promise.all([void 0, ...kind === void 0 ? ["tool", "skill"] : [kind]].map((each) =>
|
|
86635
|
+
await Promise.all([void 0, ...kind === void 0 ? ["tool", "skill"] : [kind]].map((each) => import_promises29.default.rm(docsFingerprintPath(index, search.id, each), { force: true })));
|
|
86443
86636
|
post({ type: "docsIndexed", indexed: 0, index });
|
|
86444
86637
|
logger.info(`cleared ${String(existing.length)} documentation entries from "${index}"`);
|
|
86445
86638
|
} catch (error51) {
|
|
@@ -86548,8 +86741,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86548
86741
|
denylist,
|
|
86549
86742
|
manifest,
|
|
86550
86743
|
saveManifest: async (next) => {
|
|
86551
|
-
await
|
|
86552
|
-
await
|
|
86744
|
+
await import_promises29.default.mkdir(import_node_path52.default.dirname(manifestFile), { recursive: true });
|
|
86745
|
+
await import_promises29.default.writeFile(manifestFile, JSON.stringify(next), "utf8");
|
|
86553
86746
|
},
|
|
86554
86747
|
...isIgnored2 !== void 0 ? { isIgnored: isIgnored2 } : {},
|
|
86555
86748
|
/*
|
|
@@ -86577,7 +86770,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86577
86770
|
}
|
|
86578
86771
|
async function loadIndexManifest(file2, embedder) {
|
|
86579
86772
|
try {
|
|
86580
|
-
return JSON.parse(await
|
|
86773
|
+
return JSON.parse(await import_promises29.default.readFile(file2, "utf8"));
|
|
86581
86774
|
} catch {
|
|
86582
86775
|
return {
|
|
86583
86776
|
model: embedder.model,
|
|
@@ -86595,9 +86788,9 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86595
86788
|
}
|
|
86596
86789
|
const usageLog = new UsageLog(storageDir);
|
|
86597
86790
|
const usageInstance = usageInstanceId(storageDir);
|
|
86598
|
-
const usageProfileFile =
|
|
86599
|
-
const legacyBackfillFile =
|
|
86600
|
-
const usageDir =
|
|
86791
|
+
const usageProfileFile = import_node_path52.default.join(storageDir, "usage-profile.json");
|
|
86792
|
+
const legacyBackfillFile = import_node_path52.default.join(storageDir, "usage-backfill.json");
|
|
86793
|
+
const usageDir = import_node_path52.default.join(storageDir, "usage");
|
|
86601
86794
|
const toolStartedAt = /* @__PURE__ */ new Map();
|
|
86602
86795
|
let usagePushTimer;
|
|
86603
86796
|
let usagePushing;
|
|
@@ -86615,7 +86808,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86615
86808
|
return (request) => runFastFs(exe, request);
|
|
86616
86809
|
}
|
|
86617
86810
|
function skillAtPath(requested2) {
|
|
86618
|
-
const absolute =
|
|
86811
|
+
const absolute = import_node_path52.default.isAbsolute(requested2) ? requested2 : workspaceRoot === void 0 ? void 0 : import_node_path52.default.resolve(workspaceRoot, requested2);
|
|
86619
86812
|
if (absolute === void 0)
|
|
86620
86813
|
return void 0;
|
|
86621
86814
|
return skills.find((skill) => samePath(skill.filePath, absolute));
|
|
@@ -86688,7 +86881,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86688
86881
|
const folder = chosen.path?.trim();
|
|
86689
86882
|
if (folder === void 0 || folder.length === 0)
|
|
86690
86883
|
return { problem: "The shared folder has no path." };
|
|
86691
|
-
if (!
|
|
86884
|
+
if (!import_node_path52.default.isAbsolute(folder))
|
|
86692
86885
|
return { problem: `"${folder}" is not an absolute path. Use the full path of a folder everybody can reach, such as a network share.` };
|
|
86693
86886
|
const helper = usageHelper();
|
|
86694
86887
|
return { store: new FolderShardStore(folder, ...helper !== void 0 ? [helper] : []), target };
|
|
@@ -86717,7 +86910,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86717
86910
|
}
|
|
86718
86911
|
async function readUsageBackfill() {
|
|
86719
86912
|
try {
|
|
86720
|
-
const text2 = await
|
|
86913
|
+
const text2 = await import_promises29.default.readFile(import_node_path52.default.join(usageDir, "backfill.json"), "utf8").catch(() => import_promises29.default.readFile(legacyBackfillFile, "utf8"));
|
|
86721
86914
|
const saved = JSON.parse(text2);
|
|
86722
86915
|
if (typeof saved.at !== "number")
|
|
86723
86916
|
return void 0;
|
|
@@ -86733,7 +86926,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86733
86926
|
legacyDoneFile: legacyBackfillFile,
|
|
86734
86927
|
run: async (before) => {
|
|
86735
86928
|
const status2 = python.status();
|
|
86736
|
-
return backfillFromTasks(
|
|
86929
|
+
return backfillFromTasks(import_node_path52.default.join(storageDir, "tasks"), {
|
|
86737
86930
|
user: cachedAttribution.author ?? "unknown",
|
|
86738
86931
|
project: cachedAttribution.project,
|
|
86739
86932
|
workspaceRoot,
|
|
@@ -86793,7 +86986,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86793
86986
|
}
|
|
86794
86987
|
async function readLocalProfile() {
|
|
86795
86988
|
try {
|
|
86796
|
-
const saved = JSON.parse(await
|
|
86989
|
+
const saved = JSON.parse(await import_promises29.default.readFile(usageProfileFile, "utf8"));
|
|
86797
86990
|
return saved.user === (cachedAttribution.author ?? "unknown") ? cleanProfile(saved.profile) : void 0;
|
|
86798
86991
|
} catch {
|
|
86799
86992
|
return void 0;
|
|
@@ -86829,7 +87022,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86829
87022
|
});
|
|
86830
87023
|
async function contentHash2(file2) {
|
|
86831
87024
|
try {
|
|
86832
|
-
const text2 = (await
|
|
87025
|
+
const text2 = (await import_promises29.default.readFile(file2, "utf8")).replace(/\r\n/g, "\n");
|
|
86833
87026
|
const meaningful = text2.split("\n").filter((line) => !/^(author|project|version|updated)\s*:/i.test(line) && !/^__(author|project|version|updated)__\s*=/.test(line)).join("\n").trim();
|
|
86834
87027
|
return (0, import_node_crypto16.createHash)("sha256").update(meaningful).digest("hex").slice(0, 16);
|
|
86835
87028
|
} catch {
|
|
@@ -86906,18 +87099,18 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86906
87099
|
kind: "tool",
|
|
86907
87100
|
name: issue2.name,
|
|
86908
87101
|
filePath: issue2.filePath,
|
|
86909
|
-
deletable: samePath(
|
|
86910
|
-
location: where(
|
|
87102
|
+
deletable: samePath(import_node_path52.default.dirname(issue2.filePath), status2.toolsDir),
|
|
87103
|
+
location: where(import_node_path52.default.dirname(issue2.filePath), status2.toolsDir),
|
|
86911
87104
|
issue: issue2.kind === "unapproved" ? "waiting for approval" : issue2.kind === "hash-mismatch" ? "changed since approval" : issue2.detail.split("\n")[0] ?? "not loaded"
|
|
86912
87105
|
});
|
|
86913
87106
|
}
|
|
86914
87107
|
return items;
|
|
86915
87108
|
}
|
|
86916
|
-
const usageDirectoryFile =
|
|
87109
|
+
const usageDirectoryFile = import_node_path52.default.join(storageDir, "usage-directory.json");
|
|
86917
87110
|
let directoryRunning;
|
|
86918
87111
|
async function readDirectoryCache() {
|
|
86919
87112
|
try {
|
|
86920
|
-
const saved = JSON.parse(await
|
|
87113
|
+
const saved = JSON.parse(await import_promises29.default.readFile(usageDirectoryFile, "utf8"));
|
|
86921
87114
|
return { ...saved, people: saved.people ?? {} };
|
|
86922
87115
|
} catch {
|
|
86923
87116
|
return { people: {} };
|
|
@@ -87248,7 +87441,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
87248
87441
|
let indexedFiles = 0;
|
|
87249
87442
|
if (index !== void 0) {
|
|
87250
87443
|
try {
|
|
87251
|
-
const manifest = JSON.parse(await
|
|
87444
|
+
const manifest = JSON.parse(await import_promises29.default.readFile(import_node_path52.default.join(manifestsRoot, "index-manifests", `${index}.json`), "utf8"));
|
|
87252
87445
|
indexedFiles = Object.keys(manifest.files ?? {}).length;
|
|
87253
87446
|
} catch {
|
|
87254
87447
|
}
|
|
@@ -87698,7 +87891,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
87698
87891
|
const source = await ui.showOpenDialog({ kind: "file", extensions: ["json"] });
|
|
87699
87892
|
if (source === void 0)
|
|
87700
87893
|
return;
|
|
87701
|
-
const imported = parseConfig(await
|
|
87894
|
+
const imported = parseConfig(await import_promises29.default.readFile(source, "utf8"));
|
|
87702
87895
|
post({
|
|
87703
87896
|
type: "shareSections",
|
|
87704
87897
|
direction: "import",
|
|
@@ -87723,18 +87916,18 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
87723
87916
|
answer({ error: bytes.length === 0 ? "There was nothing to save." : "That file is too large to save from here." });
|
|
87724
87917
|
return;
|
|
87725
87918
|
}
|
|
87726
|
-
const safeName = [...
|
|
87727
|
-
const extension =
|
|
87919
|
+
const safeName = [...import_node_path52.default.basename(name)].map((c2) => c2.charCodeAt(0) < 32 || '<>:"/\\|?*'.includes(c2) ? "-" : c2).join("") || "file";
|
|
87920
|
+
const extension = import_node_path52.default.extname(safeName).slice(1);
|
|
87728
87921
|
try {
|
|
87729
87922
|
const target = await ui.showSaveDialog({
|
|
87730
|
-
defaultName: workspaceRoot !== void 0 ?
|
|
87923
|
+
defaultName: workspaceRoot !== void 0 ? import_node_path52.default.join(workspaceRoot, safeName) : safeName,
|
|
87731
87924
|
...extension.length > 0 ? { extensions: [extension] } : {}
|
|
87732
87925
|
});
|
|
87733
87926
|
if (target === void 0) {
|
|
87734
87927
|
answer({});
|
|
87735
87928
|
return;
|
|
87736
87929
|
}
|
|
87737
|
-
await
|
|
87930
|
+
await import_promises29.default.writeFile(target, bytes);
|
|
87738
87931
|
answer({ path: target });
|
|
87739
87932
|
} catch (error51) {
|
|
87740
87933
|
answer({ error: `Could not save it: ${error51 instanceof Error ? error51.message : String(error51)}` });
|
|
@@ -87745,7 +87938,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
87745
87938
|
if (archive === void 0)
|
|
87746
87939
|
return;
|
|
87747
87940
|
try {
|
|
87748
|
-
await
|
|
87941
|
+
await import_promises29.default.access(archive.path);
|
|
87749
87942
|
} catch {
|
|
87750
87943
|
post({
|
|
87751
87944
|
type: "error",
|
|
@@ -87757,7 +87950,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
87757
87950
|
const target = await ui.showSaveDialog({ defaultName: archive.defaultName, extensions: ["zip"] });
|
|
87758
87951
|
if (target === void 0)
|
|
87759
87952
|
return;
|
|
87760
|
-
await
|
|
87953
|
+
await import_promises29.default.copyFile(archive.path, target);
|
|
87761
87954
|
ui.showInfo(`Saved the Light Code source to ${target}. Extract it, open the folder in VS Code, and follow START_HERE.md \u2014 it builds as it stands.`);
|
|
87762
87955
|
} catch (error51) {
|
|
87763
87956
|
post({ type: "error", message: `Could not save the source: ${error51 instanceof Error ? error51.message : String(error51)}` });
|
|
@@ -87774,7 +87967,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
87774
87967
|
});
|
|
87775
87968
|
if (target === void 0)
|
|
87776
87969
|
return;
|
|
87777
|
-
await
|
|
87970
|
+
await import_promises29.default.writeFile(target, JSON.stringify(exported, null, 2), "utf8");
|
|
87778
87971
|
const written = describeSections(exported).filter((section) => section.present);
|
|
87779
87972
|
const needed = written.flatMap((section) => section.secretRefs);
|
|
87780
87973
|
ui.showInfo(needed.length === 0 ? `Exported ${String(written.length)} section(s) to ${target}.` : `Exported ${String(written.length)} section(s) to ${target}. Whoever imports it will need to enter: ${needed.join(", ")}.`);
|
|
@@ -87787,7 +87980,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
87787
87980
|
const source = request.path ?? await ui.showOpenDialog({ kind: "file", extensions: ["json"] });
|
|
87788
87981
|
if (source === void 0)
|
|
87789
87982
|
return;
|
|
87790
|
-
const raw = await
|
|
87983
|
+
const raw = await import_promises29.default.readFile(source, "utf8");
|
|
87791
87984
|
const imported = parseConfig(raw);
|
|
87792
87985
|
const chosen = request.sections ?? SHARE_SECTIONS.map((section) => section.id);
|
|
87793
87986
|
const { config: existing } = await configManager.load();
|
|
@@ -87841,7 +88034,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
87841
88034
|
if (changeLedger !== void 0) {
|
|
87842
88035
|
const shared = await changeLedger.othersSince(targets, taskCheckpoint.createdAt);
|
|
87843
88036
|
if (shared.size > 0) {
|
|
87844
|
-
const shown2 = (file2) =>
|
|
88037
|
+
const shown2 = (file2) => import_node_path52.default.relative(workspaceRoot ?? "", file2).split(import_node_path52.default.sep).join("/");
|
|
87845
88038
|
const detail = [...shared].map(([file2, chats]) => `${shown2(file2)} (${chats.join(", ")})`).join("; ");
|
|
87846
88039
|
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");
|
|
87847
88040
|
if (!all) {
|
|
@@ -88012,7 +88205,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
88012
88205
|
post({
|
|
88013
88206
|
type: "projectSettings",
|
|
88014
88207
|
workspaceOpen: workspaceRoot !== void 0,
|
|
88015
|
-
overridden: describeOverrides(overridesFor(stored,
|
|
88208
|
+
overridden: describeOverrides(overridesFor(stored, projectRoot))
|
|
88016
88209
|
});
|
|
88017
88210
|
} catch (error51) {
|
|
88018
88211
|
logger.warn(`could not read this project's settings: ${String(error51)}`);
|
|
@@ -88039,7 +88232,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
88039
88232
|
const pathRequest = pendingPathApprovals.get(id);
|
|
88040
88233
|
userGate.resolve(id, "approve");
|
|
88041
88234
|
if (pathRequest !== void 0) {
|
|
88042
|
-
const folder =
|
|
88235
|
+
const folder = import_node_path52.default.dirname(pathRequest);
|
|
88043
88236
|
sessionPathGrants.add(normalizeForComparison(pathRequest));
|
|
88044
88237
|
if (scope === "folder" && !cachedReadRoots.includes(folder)) {
|
|
88045
88238
|
const { config: config2 } = await configManager.load();
|
|
@@ -88240,7 +88433,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
88240
88433
|
async function handleProbePythonEnv(venvDir, script) {
|
|
88241
88434
|
const exists2 = async (candidate) => {
|
|
88242
88435
|
try {
|
|
88243
|
-
return (await
|
|
88436
|
+
return (await import_promises29.default.stat(candidate)).isFile();
|
|
88244
88437
|
} catch {
|
|
88245
88438
|
return false;
|
|
88246
88439
|
}
|
|
@@ -88279,10 +88472,10 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
88279
88472
|
});
|
|
88280
88473
|
return;
|
|
88281
88474
|
}
|
|
88282
|
-
let dir =
|
|
88475
|
+
let dir = import_node_path52.default.dirname(import_node_path52.default.resolve(scriptPath));
|
|
88283
88476
|
for (let depth = 0; depth < 3; depth++) {
|
|
88284
88477
|
for (const name of VENV_DIR_NAMES) {
|
|
88285
|
-
const candidate =
|
|
88478
|
+
const candidate = import_node_path52.default.join(dir, name);
|
|
88286
88479
|
const found2 = await search(candidate);
|
|
88287
88480
|
if (found2 !== void 0) {
|
|
88288
88481
|
post({
|
|
@@ -88294,7 +88487,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
88294
88487
|
return;
|
|
88295
88488
|
}
|
|
88296
88489
|
}
|
|
88297
|
-
const parent =
|
|
88490
|
+
const parent = import_node_path52.default.dirname(dir);
|
|
88298
88491
|
if (parent === dir)
|
|
88299
88492
|
break;
|
|
88300
88493
|
dir = parent;
|
|
@@ -89174,12 +89367,12 @@ Could not be drawn: ${entry.message}`);
|
|
|
89174
89367
|
let lastReportPath;
|
|
89175
89368
|
async function saveReport(title, contents) {
|
|
89176
89369
|
try {
|
|
89177
|
-
const directory =
|
|
89178
|
-
await
|
|
89370
|
+
const directory = import_node_path52.default.join(storageDir, "reports");
|
|
89371
|
+
await import_promises29.default.mkdir(directory, { recursive: true });
|
|
89179
89372
|
const stamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
89180
89373
|
const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
|
|
89181
|
-
const target =
|
|
89182
|
-
await
|
|
89374
|
+
const target = import_node_path52.default.join(directory, `${stamp2}${slug.length > 0 ? `-${slug}` : ""}.md`);
|
|
89375
|
+
await import_promises29.default.writeFile(target, `# ${title}
|
|
89183
89376
|
|
|
89184
89377
|
${contents}
|
|
89185
89378
|
`, "utf8");
|
|
@@ -89192,9 +89385,9 @@ ${contents}
|
|
|
89192
89385
|
}
|
|
89193
89386
|
async function pruneReports(directory) {
|
|
89194
89387
|
const keep = 100;
|
|
89195
|
-
const entries = (await
|
|
89388
|
+
const entries = (await import_promises29.default.readdir(directory)).filter((name) => name.endsWith(".md")).sort();
|
|
89196
89389
|
for (const name of entries.slice(0, Math.max(0, entries.length - keep))) {
|
|
89197
|
-
await
|
|
89390
|
+
await import_promises29.default.rm(import_node_path52.default.join(directory, name), { force: true });
|
|
89198
89391
|
}
|
|
89199
89392
|
}
|
|
89200
89393
|
let scheduleTimer;
|
|
@@ -89307,11 +89500,11 @@ ${contents}
|
|
|
89307
89500
|
}
|
|
89308
89501
|
const CLAIM_STALE_MS = 60 * 60 * 1e3;
|
|
89309
89502
|
async function claimSchedule(id) {
|
|
89310
|
-
const claimPath =
|
|
89503
|
+
const claimPath = import_node_path52.default.join(storageDir, "schedule-claims", `${id}.json`);
|
|
89311
89504
|
const mine = JSON.stringify({ pid: process.pid, at: Date.now() });
|
|
89312
89505
|
try {
|
|
89313
|
-
await
|
|
89314
|
-
await
|
|
89506
|
+
await import_promises29.default.mkdir(import_node_path52.default.dirname(claimPath), { recursive: true });
|
|
89507
|
+
await import_promises29.default.writeFile(claimPath, mine, { encoding: "utf8", flag: "wx" });
|
|
89315
89508
|
return true;
|
|
89316
89509
|
} catch (error51) {
|
|
89317
89510
|
if (error51.code !== "EEXIST") {
|
|
@@ -89320,22 +89513,22 @@ ${contents}
|
|
|
89320
89513
|
}
|
|
89321
89514
|
}
|
|
89322
89515
|
try {
|
|
89323
|
-
const held = JSON.parse(await
|
|
89516
|
+
const held = JSON.parse(await import_promises29.default.readFile(claimPath, "utf8"));
|
|
89324
89517
|
const at = typeof held.at === "number" ? held.at : 0;
|
|
89325
89518
|
if (Date.now() - at < CLAIM_STALE_MS) {
|
|
89326
89519
|
logger.info(`schedule ${id} is already running in another window`);
|
|
89327
89520
|
return false;
|
|
89328
89521
|
}
|
|
89329
89522
|
logger.warn(`taking over a stale claim on schedule ${id}`);
|
|
89330
|
-
await
|
|
89523
|
+
await import_promises29.default.writeFile(claimPath, mine, "utf8");
|
|
89331
89524
|
return true;
|
|
89332
89525
|
} catch {
|
|
89333
|
-
await
|
|
89526
|
+
await import_promises29.default.writeFile(claimPath, mine, "utf8").catch(() => void 0);
|
|
89334
89527
|
return true;
|
|
89335
89528
|
}
|
|
89336
89529
|
}
|
|
89337
89530
|
async function releaseSchedule(id) {
|
|
89338
|
-
await
|
|
89531
|
+
await import_promises29.default.rm(import_node_path52.default.join(storageDir, "schedule-claims", `${id}.json`), { force: true }).catch(() => void 0);
|
|
89339
89532
|
}
|
|
89340
89533
|
async function runSchedule(id, reason) {
|
|
89341
89534
|
if (reason === "due" && !await claimSchedule(id))
|
|
@@ -89590,6 +89783,7 @@ ${contents}
|
|
|
89590
89783
|
if (services.runsSchedules !== false)
|
|
89591
89784
|
startScheduleTimer();
|
|
89592
89785
|
startMirrorSync();
|
|
89786
|
+
void prepareBranchFolder();
|
|
89593
89787
|
startApprovalWatch();
|
|
89594
89788
|
startHubSync();
|
|
89595
89789
|
return {
|
|
@@ -90004,12 +90198,12 @@ function createShowDiagramTool() {
|
|
|
90004
90198
|
}
|
|
90005
90199
|
|
|
90006
90200
|
// ../../packages/core/dist/lsp/manager.js
|
|
90007
|
-
var
|
|
90008
|
-
var
|
|
90201
|
+
var import_promises30 = __toESM(require("node:fs/promises"), 1);
|
|
90202
|
+
var import_node_path54 = __toESM(require("node:path"), 1);
|
|
90009
90203
|
|
|
90010
90204
|
// ../../packages/core/dist/lsp/catalog.js
|
|
90011
|
-
var
|
|
90012
|
-
var
|
|
90205
|
+
var import_node_fs13 = require("node:fs");
|
|
90206
|
+
var import_node_path53 = __toESM(require("node:path"), 1);
|
|
90013
90207
|
var c = (command, ...args) => ({ command, args });
|
|
90014
90208
|
var LSP_LANGUAGES = [
|
|
90015
90209
|
{ id: "python", label: "Python", extensions: ["py", "pyi"], candidates: [c("pyright-langserver", "--stdio"), c("basedpyright-langserver", "--stdio"), c("pylsp"), c("jedi-language-server")] },
|
|
@@ -90057,17 +90251,17 @@ var LSP_LANGUAGES = [
|
|
|
90057
90251
|
{ id: "sql", label: "SQL", extensions: ["sql"], candidates: [c("sql-language-server", "up", "--method", "stdio")] }
|
|
90058
90252
|
];
|
|
90059
90253
|
function languageFor(file2) {
|
|
90060
|
-
const ext =
|
|
90254
|
+
const ext = import_node_path53.default.extname(file2).slice(1).toLowerCase();
|
|
90061
90255
|
return LSP_LANGUAGES.find((l) => l.extensions.includes(ext));
|
|
90062
90256
|
}
|
|
90063
90257
|
function languageIdFor(language, file2) {
|
|
90064
|
-
const ext =
|
|
90258
|
+
const ext = import_node_path53.default.extname(file2).slice(1).toLowerCase();
|
|
90065
90259
|
return language.languageIdFor?.(ext) ?? language.id;
|
|
90066
90260
|
}
|
|
90067
90261
|
var found = /* @__PURE__ */ new Map();
|
|
90068
90262
|
function findOnPath(command, env2 = process.env) {
|
|
90069
|
-
if (
|
|
90070
|
-
return (0,
|
|
90263
|
+
if (import_node_path53.default.isAbsolute(command))
|
|
90264
|
+
return (0, import_node_fs13.existsSync)(command) ? command : void 0;
|
|
90071
90265
|
if (env2 !== process.env)
|
|
90072
90266
|
return searchPath(command, env2);
|
|
90073
90267
|
const hit = found.get(command);
|
|
@@ -90078,12 +90272,12 @@ function findOnPath(command, env2 = process.env) {
|
|
|
90078
90272
|
return value;
|
|
90079
90273
|
}
|
|
90080
90274
|
function searchPath(command, env2) {
|
|
90081
|
-
const dirs = (env2.PATH ?? env2.Path ?? "").split(
|
|
90275
|
+
const dirs = (env2.PATH ?? env2.Path ?? "").split(import_node_path53.default.delimiter).filter((d) => d.length > 0);
|
|
90082
90276
|
const exts = process.platform === "win32" ? ["", ...(env2.PATHEXT ?? ".EXE;.CMD;.BAT").toLowerCase().split(";")] : [""];
|
|
90083
90277
|
for (const dir of dirs) {
|
|
90084
90278
|
for (const ext of exts) {
|
|
90085
|
-
const candidate =
|
|
90086
|
-
if ((0,
|
|
90279
|
+
const candidate = import_node_path53.default.join(dir, command + ext);
|
|
90280
|
+
if ((0, import_node_fs13.existsSync)(candidate) && (process.platform !== "win32" || ext !== "" || /\.(exe|cmd|bat)$/i.test(candidate)))
|
|
90087
90281
|
return candidate;
|
|
90088
90282
|
}
|
|
90089
90283
|
}
|
|
@@ -90091,7 +90285,7 @@ function searchPath(command, env2) {
|
|
|
90091
90285
|
}
|
|
90092
90286
|
|
|
90093
90287
|
// ../../packages/core/dist/lsp/client.js
|
|
90094
|
-
var
|
|
90288
|
+
var import_node_child_process16 = require("node:child_process");
|
|
90095
90289
|
var import_node_url = require("node:url");
|
|
90096
90290
|
function keyFor(uri) {
|
|
90097
90291
|
try {
|
|
@@ -90121,7 +90315,7 @@ var LspClient = class {
|
|
|
90121
90315
|
this.root = root;
|
|
90122
90316
|
this.log = log;
|
|
90123
90317
|
const shim = /\.(cmd|bat)$/i.test(executable);
|
|
90124
|
-
this.child = shim ? (0,
|
|
90318
|
+
this.child = shim ? (0, import_node_child_process16.spawn)(process.env.ComSpec ?? "cmd.exe", ["/d", "/s", "/c", `"${executable}"`, ...args], { cwd: root, windowsHide: true, windowsVerbatimArguments: true }) : (0, import_node_child_process16.spawn)(executable, args, { cwd: root, windowsHide: true });
|
|
90125
90319
|
this.child.stdout?.on("data", (chunk) => this.onData(chunk));
|
|
90126
90320
|
this.child.stderr?.on("data", (chunk) => {
|
|
90127
90321
|
const text2 = chunk.toString("utf8").trim();
|
|
@@ -90314,7 +90508,7 @@ var LspManager = class {
|
|
|
90314
90508
|
return void 0;
|
|
90315
90509
|
const args = [...found2.candidate.args];
|
|
90316
90510
|
if (language.id === "java" && !args.includes("-data"))
|
|
90317
|
-
args.push("-data",
|
|
90511
|
+
args.push("-data", import_node_path54.default.join(this.storageDir, "jdtls-workspace"));
|
|
90318
90512
|
try {
|
|
90319
90513
|
client = new LspClient(found2.executable, args, this.root, this.log);
|
|
90320
90514
|
this.clients.set(language.id, client);
|
|
@@ -90325,7 +90519,7 @@ var LspManager = class {
|
|
|
90325
90519
|
}
|
|
90326
90520
|
let text2;
|
|
90327
90521
|
try {
|
|
90328
|
-
text2 = await
|
|
90522
|
+
text2 = await import_promises30.default.readFile(file2, "utf8");
|
|
90329
90523
|
} catch {
|
|
90330
90524
|
return void 0;
|
|
90331
90525
|
}
|
|
@@ -90335,7 +90529,7 @@ var LspManager = class {
|
|
|
90335
90529
|
this.failed.set(language.id, client.lastError ?? "stopped");
|
|
90336
90530
|
return void 0;
|
|
90337
90531
|
}
|
|
90338
|
-
return { server:
|
|
90532
|
+
return { server: import_node_path54.default.basename(client.executable).replace(/\.(exe|cmd|bat)$/i, ""), diagnostics: diagnostics ?? [] };
|
|
90339
90533
|
} catch (error51) {
|
|
90340
90534
|
this.failed.set(language.id, error51 instanceof Error ? error51.message : String(error51));
|
|
90341
90535
|
client.dispose();
|
|
@@ -91963,6 +92157,66 @@ together.
|
|
|
91963
92157
|
|
|
91964
92158
|
Problems from syncing in the background (the repository, buckets, tools that did not load) show in
|
|
91965
92159
|
**Settings \u2192 Usage \u2192 Needs attention**.
|
|
92160
|
+
`
|
|
92161
|
+
},
|
|
92162
|
+
{
|
|
92163
|
+
id: "branches",
|
|
92164
|
+
title: "Several branches at once, side by side",
|
|
92165
|
+
keywords: [
|
|
92166
|
+
"branch",
|
|
92167
|
+
"branches",
|
|
92168
|
+
"worktree",
|
|
92169
|
+
"git worktree",
|
|
92170
|
+
"different branches",
|
|
92171
|
+
"another branch",
|
|
92172
|
+
"switch branch",
|
|
92173
|
+
"work on two branches",
|
|
92174
|
+
"parallel branches",
|
|
92175
|
+
"branch folder",
|
|
92176
|
+
"new chat on a branch",
|
|
92177
|
+
"open branch",
|
|
92178
|
+
"close branch",
|
|
92179
|
+
"run and debug a branch",
|
|
92180
|
+
"port offset",
|
|
92181
|
+
"setup command",
|
|
92182
|
+
"pnpm install in branch"
|
|
92183
|
+
],
|
|
92184
|
+
body: `
|
|
92185
|
+
Work on several branches of one repository at the same time, each in its own folder - git worktrees, part of
|
|
92186
|
+
git since 2015. You clone once; opening a branch makes a folder for it beside the repository
|
|
92187
|
+
(<repo>.worktrees\\\\<branch>, or under config:branches (folder)), sharing the repository's history. Nothing is
|
|
92188
|
+
downloaded again, your codebase stays on its own branch, and a commit in any branch folder is in the one
|
|
92189
|
+
repository straight away.
|
|
92190
|
+
|
|
92191
|
+
**VS Code**: Light Code: Open Branch in New Window (Command Palette, or the branch button in Source Control)
|
|
92192
|
+
lists local branches, fetched remote branches and those already open, plus New branch\u2026 (made from the branch
|
|
92193
|
+
you choose). The branch opens in a new VS Code window - running, debugging and terminals there use that
|
|
92194
|
+
branch's files and its own launch.json, with its own Light Code. Light Code: Branches lists every branch folder
|
|
92195
|
+
with its state (clean, uncommitted changes, commits not pushed) to open it or close it.
|
|
92196
|
+
|
|
92197
|
+
**Fire Code**: New chat on a branch\u2026 (the tab's or New chat's menu) opens the branch as a chat tab working in
|
|
92198
|
+
its own folder. Each tab shows its chat name with the branch underneath (trimmed when long - a Jira key is kept
|
|
92199
|
+
whole - full name on hover); renaming the chat never changes the branch. Close branch\u2026 (right-click a branch
|
|
92200
|
+
chat's tab) removes its folder and the chat. Fire Code's Commit and push acts on the codebase's own folder; in
|
|
92201
|
+
a branch chat, commit through the agent or git in that folder.
|
|
92202
|
+
|
|
92203
|
+
**Setting a branch up** (once, when its folder is first opened): config:branches (copyFiles) - files git does
|
|
92204
|
+
not track that it needs, such as .env, copied from the main checkout - and config:branches (setupCommand),
|
|
92205
|
+
e.g. pnpm install or uv sync (VS Code runs it in a terminal you can watch). Each branch folder has its own
|
|
92206
|
+
node_modules or .venv, because a shared one breaks as soon as branches differ. Per project; user-scope only
|
|
92207
|
+
(a repository cannot set a command for you), and never exported.
|
|
92208
|
+
|
|
92209
|
+
**Running two at once**: commands and debug sessions in a branch folder get LIGHT_CODE_BRANCH and
|
|
92210
|
+
LIGHT_CODE_PORT_OFFSET (0 in the main checkout, 1, 2... in branch folders), so a dev server can add the
|
|
92211
|
+
offset to its port. Nothing is written into your repository for this.
|
|
92212
|
+
|
|
92213
|
+
**Shared or separate**: codebase instructions, skills, settings and "always allow" approvals are shared by all
|
|
92214
|
+
of a repository's branches; checkpoints and rollback, chat history and running processes are each folder's own.
|
|
92215
|
+
The agent in a branch folder can only change files in that folder.
|
|
92216
|
+
|
|
92217
|
+
**Safe by git's own rules**: one branch can be open in only one folder at a time; closing a folder checks for
|
|
92218
|
+
uncommitted changes and unpushed commits first and never deletes the branch; folders stay until you close them
|
|
92219
|
+
(not temporary). If you delete one by hand, git forgets it (git worktree prune) and committed work is safe.
|
|
91966
92220
|
`
|
|
91967
92221
|
},
|
|
91968
92222
|
{
|
|
@@ -93904,8 +94158,8 @@ function createLightCodeHelpTool() {
|
|
|
93904
94158
|
}
|
|
93905
94159
|
|
|
93906
94160
|
// ../../packages/core/dist/tools/listFiles.js
|
|
93907
|
-
var
|
|
93908
|
-
var
|
|
94161
|
+
var import_node_child_process17 = require("node:child_process");
|
|
94162
|
+
var import_node_path55 = __toESM(require("node:path"), 1);
|
|
93909
94163
|
|
|
93910
94164
|
// ../../packages/core/dist/tools/ripgrepError.js
|
|
93911
94165
|
function ripgrepDidNotStart(error51) {
|
|
@@ -93938,7 +94192,7 @@ function isRipgrepNoMatchError(error51) {
|
|
|
93938
94192
|
}
|
|
93939
94193
|
function runRipgrepFiles(rgPath, dir, signal, includeIgnored) {
|
|
93940
94194
|
return new Promise((resolve, reject2) => {
|
|
93941
|
-
(0,
|
|
94195
|
+
(0, import_node_child_process17.execFile)(rgPath, [
|
|
93942
94196
|
"--files",
|
|
93943
94197
|
"--hidden",
|
|
93944
94198
|
...includeIgnored ? ["--no-ignore-vcs"] : [],
|
|
@@ -93986,7 +94240,7 @@ var listFilesTool = {
|
|
|
93986
94240
|
});
|
|
93987
94241
|
if (files.length === 0)
|
|
93988
94242
|
return noFiles;
|
|
93989
|
-
const listed = files.map((file2) => file2.split("/").join(
|
|
94243
|
+
const listed = files.map((file2) => file2.split("/").join(import_node_path55.default.sep)).join("\n");
|
|
93990
94244
|
return { content: truncated ? `${listed}
|
|
93991
94245
|
(listing cut short \u2014 list a narrower folder)` : listed };
|
|
93992
94246
|
}
|
|
@@ -94054,10 +94308,10 @@ function readSmall(raw, params3) {
|
|
|
94054
94308
|
const end = params3.limit !== void 0 ? start + params3.limit : lines2.length;
|
|
94055
94309
|
return number4(lines2.slice(start, end), start + 1);
|
|
94056
94310
|
}
|
|
94057
|
-
async function readLarge(
|
|
94311
|
+
async function readLarge(fs43, realPath, params3, size) {
|
|
94058
94312
|
const human = formatBytes(size);
|
|
94059
94313
|
if (params3.tail !== void 0) {
|
|
94060
|
-
const part = await readTail(
|
|
94314
|
+
const part = await readTail(fs43, realPath, size, params3.tail);
|
|
94061
94315
|
return [
|
|
94062
94316
|
`${human} file \u2014 last ${String(part.lines.length)} lines.`,
|
|
94063
94317
|
/*
|
|
@@ -94072,7 +94326,7 @@ async function readLarge(fs42, realPath, params3, size) {
|
|
|
94072
94326
|
}
|
|
94073
94327
|
if (params3.offset !== void 0) {
|
|
94074
94328
|
const limit = params3.limit ?? DEFAULT_LARGE_LIMIT;
|
|
94075
|
-
const part = await readLineWindow(
|
|
94329
|
+
const part = await readLineWindow(fs43, realPath, size, params3.offset, limit);
|
|
94076
94330
|
const shown2 = part.lines.length;
|
|
94077
94331
|
return [
|
|
94078
94332
|
`${human} file \u2014 lines ${String(params3.offset)}\u2013${String(params3.offset + shown2 - 1)}${part.hasMoreAfter ? ", more follows" : " (end of file)"}.`,
|
|
@@ -94080,7 +94334,7 @@ async function readLarge(fs42, realPath, params3, size) {
|
|
|
94080
94334
|
number4(part.lines, params3.offset)
|
|
94081
94335
|
].join("\n");
|
|
94082
94336
|
}
|
|
94083
|
-
const total = await countLines(
|
|
94337
|
+
const total = await countLines(fs43, realPath, size);
|
|
94084
94338
|
return [
|
|
94085
94339
|
`${realPathName(realPath)} is ${human} (${total.toLocaleString()} lines) \u2014 too large to read at once.`,
|
|
94086
94340
|
"",
|
|
@@ -94148,7 +94402,7 @@ var readDocumentTool = {
|
|
|
94148
94402
|
};
|
|
94149
94403
|
|
|
94150
94404
|
// ../../packages/core/dist/tools/searchFiles.js
|
|
94151
|
-
var
|
|
94405
|
+
var import_node_child_process18 = require("node:child_process");
|
|
94152
94406
|
var paramsSchema22 = external_exports.object({
|
|
94153
94407
|
path: external_exports.string().min(1).default(".").describe("Directory to search, relative to the workspace root."),
|
|
94154
94408
|
pattern: external_exports.string().min(1).describe("Regular expression to search for."),
|
|
@@ -94167,7 +94421,7 @@ function runRipgrepSearch(rgPath, dir, pattern, filePattern, signal, includeIgno
|
|
|
94167
94421
|
args.push("-g", filePattern);
|
|
94168
94422
|
args.push("--regexp", pattern, ".");
|
|
94169
94423
|
return new Promise((resolve, reject2) => {
|
|
94170
|
-
(0,
|
|
94424
|
+
(0, import_node_child_process18.execFile)(rgPath, args, { cwd: dir, signal, maxBuffer: 10 * 1024 * 1024 }, (error51, stdout) => {
|
|
94171
94425
|
if (error51 && !isRipgrepNoMatchError2(error51)) {
|
|
94172
94426
|
reject2(error51);
|
|
94173
94427
|
return;
|
|
@@ -94215,7 +94469,7 @@ var searchFilesTool = {
|
|
|
94215
94469
|
};
|
|
94216
94470
|
|
|
94217
94471
|
// ../../packages/core/dist/tools/writeToFile.js
|
|
94218
|
-
var
|
|
94472
|
+
var import_node_path56 = __toESM(require("node:path"), 1);
|
|
94219
94473
|
var paramsSchema23 = external_exports.object({
|
|
94220
94474
|
path: external_exports.string().min(1).describe("Path to the file, relative to the workspace root."),
|
|
94221
94475
|
content: external_exports.string().describe("Full file content to write.")
|
|
@@ -94243,7 +94497,7 @@ var writeToFileTool = {
|
|
|
94243
94497
|
return { content: changed, isError: true, path: params3.path };
|
|
94244
94498
|
}
|
|
94245
94499
|
if (!exists2) {
|
|
94246
|
-
await context.fs.mkdir(
|
|
94500
|
+
await context.fs.mkdir(import_node_path56.default.dirname(resolved.realPath));
|
|
94247
94501
|
}
|
|
94248
94502
|
await context.fs.writeFile(resolved.realPath, params3.content);
|
|
94249
94503
|
await recordWrite(context, resolved.realPath);
|
|
@@ -94344,21 +94598,21 @@ function createDefaultToolRegistry() {
|
|
|
94344
94598
|
}
|
|
94345
94599
|
|
|
94346
94600
|
// ../../packages/core/dist/dataset/store.js
|
|
94347
|
-
var
|
|
94348
|
-
var
|
|
94601
|
+
var import_promises31 = __toESM(require("node:fs/promises"), 1);
|
|
94602
|
+
var import_node_path57 = __toESM(require("node:path"), 1);
|
|
94349
94603
|
var DatasetStore = class {
|
|
94350
94604
|
filePath;
|
|
94351
94605
|
statePath;
|
|
94352
94606
|
constructor(storageDir, datasetId) {
|
|
94353
94607
|
const safe = datasetId.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
94354
|
-
this.filePath =
|
|
94355
|
-
this.statePath =
|
|
94608
|
+
this.filePath = import_node_path57.default.join(storageDir, "datasets", `${safe}.jsonl`);
|
|
94609
|
+
this.statePath = import_node_path57.default.join(storageDir, "datasets", `${safe}.state.json`);
|
|
94356
94610
|
}
|
|
94357
94611
|
/** Every record. A malformed line is skipped — one bad line costs one record, not the corpus. */
|
|
94358
94612
|
async load() {
|
|
94359
94613
|
let raw;
|
|
94360
94614
|
try {
|
|
94361
|
-
raw = await
|
|
94615
|
+
raw = await import_promises31.default.readFile(this.filePath, "utf8");
|
|
94362
94616
|
} catch {
|
|
94363
94617
|
return [];
|
|
94364
94618
|
}
|
|
@@ -94380,18 +94634,18 @@ var DatasetStore = class {
|
|
|
94380
94634
|
async append(records) {
|
|
94381
94635
|
if (records.length === 0)
|
|
94382
94636
|
return;
|
|
94383
|
-
await
|
|
94384
|
-
await
|
|
94637
|
+
await import_promises31.default.mkdir(import_node_path57.default.dirname(this.filePath), { recursive: true });
|
|
94638
|
+
await import_promises31.default.writeFile(this.filePath, "", { flag: "a" });
|
|
94385
94639
|
const lines2 = records.map((record2) => JSON.stringify(record2)).join("\n");
|
|
94386
|
-
await
|
|
94640
|
+
await import_promises31.default.appendFile(this.filePath, `${lines2}
|
|
94387
94641
|
`, "utf8");
|
|
94388
94642
|
}
|
|
94389
94643
|
/** Rewrites with exactly these. Temp-and-rename, so an interrupted prune leaves the old file. */
|
|
94390
94644
|
async replace(records) {
|
|
94391
|
-
await
|
|
94645
|
+
await import_promises31.default.mkdir(import_node_path57.default.dirname(this.filePath), { recursive: true });
|
|
94392
94646
|
const temporary = `${this.filePath}.tmp`;
|
|
94393
94647
|
const body = records.map((record2) => JSON.stringify(record2)).join("\n");
|
|
94394
|
-
await
|
|
94648
|
+
await import_promises31.default.writeFile(temporary, records.length === 0 ? "" : `${body}
|
|
94395
94649
|
`, "utf8");
|
|
94396
94650
|
await replaceFile(temporary, this.filePath);
|
|
94397
94651
|
}
|
|
@@ -94405,7 +94659,7 @@ var DatasetStore = class {
|
|
|
94405
94659
|
async compact() {
|
|
94406
94660
|
let before;
|
|
94407
94661
|
try {
|
|
94408
|
-
before = (await
|
|
94662
|
+
before = (await import_promises31.default.readFile(this.filePath, "utf8")).split("\n").filter((line) => line.trim().length > 0).length;
|
|
94409
94663
|
} catch {
|
|
94410
94664
|
return { before: 0, after: 0 };
|
|
94411
94665
|
}
|
|
@@ -94416,12 +94670,12 @@ var DatasetStore = class {
|
|
|
94416
94670
|
return { before, after: records.length };
|
|
94417
94671
|
}
|
|
94418
94672
|
async clear() {
|
|
94419
|
-
await
|
|
94420
|
-
await
|
|
94673
|
+
await import_promises31.default.rm(this.filePath, { force: true });
|
|
94674
|
+
await import_promises31.default.rm(this.statePath, { force: true });
|
|
94421
94675
|
}
|
|
94422
94676
|
async sizeBytes() {
|
|
94423
94677
|
try {
|
|
94424
|
-
return (await
|
|
94678
|
+
return (await import_promises31.default.stat(this.filePath)).size;
|
|
94425
94679
|
} catch {
|
|
94426
94680
|
return 0;
|
|
94427
94681
|
}
|
|
@@ -94435,16 +94689,16 @@ var DatasetStore = class {
|
|
|
94435
94689
|
*/
|
|
94436
94690
|
async lastSyncedAt() {
|
|
94437
94691
|
try {
|
|
94438
|
-
const parsed = JSON.parse(await
|
|
94692
|
+
const parsed = JSON.parse(await import_promises31.default.readFile(this.statePath, "utf8"));
|
|
94439
94693
|
return typeof parsed.lastSyncedAt === "number" ? parsed.lastSyncedAt : void 0;
|
|
94440
94694
|
} catch {
|
|
94441
94695
|
return void 0;
|
|
94442
94696
|
}
|
|
94443
94697
|
}
|
|
94444
94698
|
async recordSync(at) {
|
|
94445
|
-
await
|
|
94699
|
+
await import_promises31.default.mkdir(import_node_path57.default.dirname(this.statePath), { recursive: true });
|
|
94446
94700
|
const temporary = `${this.statePath}.tmp`;
|
|
94447
|
-
await
|
|
94701
|
+
await import_promises31.default.writeFile(temporary, JSON.stringify({ lastSyncedAt: at }), "utf8");
|
|
94448
94702
|
await replaceFile(temporary, this.statePath);
|
|
94449
94703
|
}
|
|
94450
94704
|
};
|
|
@@ -94872,8 +95126,8 @@ var S3Client = class {
|
|
|
94872
95126
|
const host = inPath ? origin.host : `${bucket}.${origin.host}`;
|
|
94873
95127
|
const mount = origin.pathname === "/" ? "" : origin.pathname.replace(/\/+$/, "");
|
|
94874
95128
|
const prefix = inPath ? `${mount}/${bucket}` : mount;
|
|
94875
|
-
const
|
|
94876
|
-
const url2 = new URL(`${origin.protocol}//${host}${prefix}${
|
|
95129
|
+
const path63 = key2 === "" ? "" : `/${key2.split("/").map((part) => encodeURIComponent(part)).join("/")}`;
|
|
95130
|
+
const url2 = new URL(`${origin.protocol}//${host}${prefix}${path63}`);
|
|
94877
95131
|
for (const [name, value] of Object.entries(call.query ?? {}))
|
|
94878
95132
|
url2.searchParams.set(name, value);
|
|
94879
95133
|
return url2.toString();
|
|
@@ -95140,9 +95394,9 @@ async function syncFromS3(options) {
|
|
|
95140
95394
|
return result;
|
|
95141
95395
|
}
|
|
95142
95396
|
var MANIFEST_NAME = ".lightcode-sync.json";
|
|
95143
|
-
async function readManifest(
|
|
95397
|
+
async function readManifest(fs43, manifestPath) {
|
|
95144
95398
|
try {
|
|
95145
|
-
const parsed = JSON.parse((await
|
|
95399
|
+
const parsed = JSON.parse((await fs43.readBytes(manifestPath)).toString("utf8"));
|
|
95146
95400
|
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : {};
|
|
95147
95401
|
} catch {
|
|
95148
95402
|
return {};
|
|
@@ -95160,14 +95414,14 @@ function join(dir, relative) {
|
|
|
95160
95414
|
const left = dir.replace(/[\\/]+$/, "");
|
|
95161
95415
|
return `${left}/${relative}`;
|
|
95162
95416
|
}
|
|
95163
|
-
async function writeWhole3(
|
|
95164
|
-
if (
|
|
95165
|
-
await
|
|
95417
|
+
async function writeWhole3(fs43, target, bytes) {
|
|
95418
|
+
if (fs43.rename === void 0) {
|
|
95419
|
+
await fs43.writeBytes(target, bytes);
|
|
95166
95420
|
return;
|
|
95167
95421
|
}
|
|
95168
95422
|
const temporary = `${target}.${String(process.pid)}.${String(Date.now())}.part`;
|
|
95169
|
-
await
|
|
95170
|
-
await
|
|
95423
|
+
await fs43.writeBytes(temporary, bytes);
|
|
95424
|
+
await fs43.rename(temporary, target);
|
|
95171
95425
|
}
|
|
95172
95426
|
function dirname(filePath) {
|
|
95173
95427
|
const cut = filePath.lastIndexOf("/");
|
|
@@ -95846,8 +96100,8 @@ async function readJsonBody(request, maxBytes = 32 * 1024 * 1024) {
|
|
|
95846
96100
|
}
|
|
95847
96101
|
|
|
95848
96102
|
// src/fileSecretStore.ts
|
|
95849
|
-
var
|
|
95850
|
-
var
|
|
96103
|
+
var import_promises32 = __toESM(require("node:fs/promises"), 1);
|
|
96104
|
+
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
95851
96105
|
|
|
95852
96106
|
// src/vaultCrypto.ts
|
|
95853
96107
|
var import_node_crypto20 = require("node:crypto");
|
|
@@ -95901,7 +96155,7 @@ var FileSecretStore = class {
|
|
|
95901
96155
|
sealedShut = false;
|
|
95902
96156
|
async currentStamp() {
|
|
95903
96157
|
try {
|
|
95904
|
-
const stat = await
|
|
96158
|
+
const stat = await import_promises32.default.stat(this.filePath);
|
|
95905
96159
|
return `${String(stat.mtimeMs)}:${String(stat.size)}`;
|
|
95906
96160
|
} catch {
|
|
95907
96161
|
return void 0;
|
|
@@ -95912,7 +96166,7 @@ var FileSecretStore = class {
|
|
|
95912
96166
|
if (this.cache !== void 0 && stamp2 === this.stamp) return this.cache;
|
|
95913
96167
|
this.stamp = stamp2;
|
|
95914
96168
|
try {
|
|
95915
|
-
const raw = await
|
|
96169
|
+
const raw = await import_promises32.default.readFile(this.filePath, "utf8");
|
|
95916
96170
|
const parsed = JSON.parse(raw.replace(/^\uFEFF/, ""));
|
|
95917
96171
|
this.sealedShut = false;
|
|
95918
96172
|
if (isVaultEnvelope(parsed)) {
|
|
@@ -95945,10 +96199,10 @@ var FileSecretStore = class {
|
|
|
95945
96199
|
);
|
|
95946
96200
|
}
|
|
95947
96201
|
mutate(secrets);
|
|
95948
|
-
await
|
|
96202
|
+
await import_promises32.default.mkdir(import_node_path58.default.dirname(this.filePath), { recursive: true });
|
|
95949
96203
|
const temp = `${this.filePath}.${process.pid}.tmp`;
|
|
95950
96204
|
const body = this.key === void 0 ? secrets : sealSecrets(secrets, this.key);
|
|
95951
|
-
await
|
|
96205
|
+
await import_promises32.default.writeFile(temp, JSON.stringify(body, null, 2), { encoding: "utf8", mode: 384 });
|
|
95952
96206
|
await replaceFile(temp, this.filePath);
|
|
95953
96207
|
this.stamp = await this.currentStamp();
|
|
95954
96208
|
});
|
|
@@ -95981,8 +96235,8 @@ var FileSecretStore = class {
|
|
|
95981
96235
|
|
|
95982
96236
|
// src/reviewQueue.ts
|
|
95983
96237
|
var import_node_crypto21 = __toESM(require("node:crypto"), 1);
|
|
95984
|
-
var
|
|
95985
|
-
var
|
|
96238
|
+
var import_promises33 = __toESM(require("node:fs/promises"), 1);
|
|
96239
|
+
var import_node_path59 = __toESM(require("node:path"), 1);
|
|
95986
96240
|
var ReviewQueue = class {
|
|
95987
96241
|
constructor(filePath) {
|
|
95988
96242
|
this.filePath = filePath;
|
|
@@ -95992,7 +96246,7 @@ var ReviewQueue = class {
|
|
|
95992
96246
|
async load() {
|
|
95993
96247
|
if (this.cache !== void 0) return this.cache;
|
|
95994
96248
|
try {
|
|
95995
|
-
const parsed = JSON.parse(await
|
|
96249
|
+
const parsed = JSON.parse(await import_promises33.default.readFile(this.filePath, "utf8"));
|
|
95996
96250
|
this.cache = Array.isArray(parsed) ? parsed : [];
|
|
95997
96251
|
} catch {
|
|
95998
96252
|
this.cache = [];
|
|
@@ -96001,9 +96255,9 @@ var ReviewQueue = class {
|
|
|
96001
96255
|
}
|
|
96002
96256
|
async persist(items) {
|
|
96003
96257
|
this.cache = items;
|
|
96004
|
-
await
|
|
96258
|
+
await import_promises33.default.mkdir(import_node_path59.default.dirname(this.filePath), { recursive: true });
|
|
96005
96259
|
const temporary = `${this.filePath}.tmp`;
|
|
96006
|
-
await
|
|
96260
|
+
await import_promises33.default.writeFile(temporary, JSON.stringify(items, null, 2), { encoding: "utf8", mode: 384 });
|
|
96007
96261
|
await replaceFile(temporary, this.filePath);
|
|
96008
96262
|
}
|
|
96009
96263
|
async list() {
|
|
@@ -96241,9 +96495,9 @@ var RoutedSecretStore = class {
|
|
|
96241
96495
|
};
|
|
96242
96496
|
|
|
96243
96497
|
// src/userVariables.ts
|
|
96244
|
-
var
|
|
96245
|
-
var
|
|
96246
|
-
var
|
|
96498
|
+
var import_promises34 = __toESM(require("node:fs/promises"), 1);
|
|
96499
|
+
var import_node_fs14 = require("node:fs");
|
|
96500
|
+
var import_node_path60 = __toESM(require("node:path"), 1);
|
|
96247
96501
|
var UserVariableStore = class {
|
|
96248
96502
|
constructor(filePath) {
|
|
96249
96503
|
this.filePath = filePath;
|
|
@@ -96258,9 +96512,9 @@ var UserVariableStore = class {
|
|
|
96258
96512
|
}
|
|
96259
96513
|
async save(variables) {
|
|
96260
96514
|
const parsed = sessionVariablesSchema.parse(variables);
|
|
96261
|
-
await
|
|
96515
|
+
await import_promises34.default.mkdir(import_node_path60.default.dirname(this.filePath), { recursive: true });
|
|
96262
96516
|
const temporary = `${this.filePath}.tmp`;
|
|
96263
|
-
await
|
|
96517
|
+
await import_promises34.default.writeFile(temporary, JSON.stringify({ variables: parsed }, null, 2), {
|
|
96264
96518
|
encoding: "utf8",
|
|
96265
96519
|
mode: 384
|
|
96266
96520
|
});
|
|
@@ -96269,14 +96523,14 @@ var UserVariableStore = class {
|
|
|
96269
96523
|
}
|
|
96270
96524
|
};
|
|
96271
96525
|
function userVariableStoreFor(dataDir, principal) {
|
|
96272
|
-
return new UserVariableStore(userVariablesPath(
|
|
96526
|
+
return new UserVariableStore(userVariablesPath(import_node_path60.default.join(dataDir, "users", storageKeyFor(principal))));
|
|
96273
96527
|
}
|
|
96274
96528
|
function userVariablesPath(userDir) {
|
|
96275
|
-
return
|
|
96529
|
+
return import_node_path60.default.join(userDir, "variables.json");
|
|
96276
96530
|
}
|
|
96277
96531
|
function readVariablesFile(filePath) {
|
|
96278
96532
|
try {
|
|
96279
|
-
const raw = JSON.parse((0,
|
|
96533
|
+
const raw = JSON.parse((0, import_node_fs14.readFileSync)(filePath, "utf8"));
|
|
96280
96534
|
const parsed = sessionVariablesSchema.safeParse(raw["variables"]);
|
|
96281
96535
|
return parsed.success ? parsed.data : [];
|
|
96282
96536
|
} catch {
|
|
@@ -96300,13 +96554,13 @@ function hostedUser(env2 = process.env) {
|
|
|
96300
96554
|
}
|
|
96301
96555
|
|
|
96302
96556
|
// src/session.ts
|
|
96303
|
-
var
|
|
96304
|
-
var
|
|
96305
|
-
var
|
|
96557
|
+
var import_node_fs15 = require("node:fs");
|
|
96558
|
+
var import_promises35 = __toESM(require("node:fs/promises"), 1);
|
|
96559
|
+
var import_node_path62 = __toESM(require("node:path"), 1);
|
|
96306
96560
|
|
|
96307
96561
|
// src/credentialTool.ts
|
|
96308
|
-
var
|
|
96309
|
-
var
|
|
96562
|
+
var import_node_child_process19 = require("node:child_process");
|
|
96563
|
+
var import_node_path61 = __toESM(require("node:path"), 1);
|
|
96310
96564
|
var CREDENTIAL_PREFIX2 = "tool:";
|
|
96311
96565
|
var WRAPPER = [
|
|
96312
96566
|
"import importlib.util, json, sys",
|
|
@@ -96326,7 +96580,7 @@ async function fetchCredential(options, reference) {
|
|
|
96326
96580
|
if (name.length === 0) return { problem: "A credential reference needs a name: tool:<name>." };
|
|
96327
96581
|
const budget = options.timeoutMs ?? 3e4;
|
|
96328
96582
|
const run3 = await new Promise((resolve) => {
|
|
96329
|
-
const child = (0,
|
|
96583
|
+
const child = (0, import_node_child_process19.spawn)(options.interpreter, ["-c", WRAPPER, import_node_path61.default.resolve(options.file), name], {
|
|
96330
96584
|
windowsHide: true,
|
|
96331
96585
|
// The environment this was started in, as with the identity function: the libraries that
|
|
96332
96586
|
// hold credentials are configured through it, and nothing here is model-authored.
|
|
@@ -96511,7 +96765,7 @@ var FileConfigStore = class {
|
|
|
96511
96765
|
const filePath = this.pathFor(scope);
|
|
96512
96766
|
if (filePath === void 0) return void 0;
|
|
96513
96767
|
try {
|
|
96514
|
-
return await
|
|
96768
|
+
return await import_promises35.default.readFile(filePath, "utf8");
|
|
96515
96769
|
} catch (error51) {
|
|
96516
96770
|
if (error51.code === "ENOENT") return void 0;
|
|
96517
96771
|
throw error51;
|
|
@@ -96522,13 +96776,13 @@ var FileConfigStore = class {
|
|
|
96522
96776
|
const filePath = this.pathFor(scope);
|
|
96523
96777
|
if (filePath === void 0)
|
|
96524
96778
|
throw new Error(`Cannot write ${scope} config: no workspace is open`);
|
|
96525
|
-
await
|
|
96779
|
+
await import_promises35.default.mkdir(import_node_path62.default.dirname(filePath), { recursive: true });
|
|
96526
96780
|
const temporary = `${filePath}.${process.pid.toString(36)}.tmp`;
|
|
96527
|
-
await
|
|
96781
|
+
await import_promises35.default.writeFile(temporary, contents, { encoding: "utf8", mode: 384 });
|
|
96528
96782
|
await replaceFile(temporary, filePath);
|
|
96529
96783
|
try {
|
|
96530
96784
|
const backupTemp = `${configBackupPath(filePath)}.tmp`;
|
|
96531
|
-
await
|
|
96785
|
+
await import_promises35.default.writeFile(backupTemp, contents, { encoding: "utf8", mode: 384 });
|
|
96532
96786
|
await replaceFile(backupTemp, configBackupPath(filePath));
|
|
96533
96787
|
} catch {
|
|
96534
96788
|
}
|
|
@@ -96537,7 +96791,7 @@ var FileConfigStore = class {
|
|
|
96537
96791
|
const filePath = this.pathFor(scope);
|
|
96538
96792
|
if (filePath === void 0) return void 0;
|
|
96539
96793
|
try {
|
|
96540
|
-
return await
|
|
96794
|
+
return await import_promises35.default.readFile(configBackupPath(filePath), "utf8");
|
|
96541
96795
|
} catch {
|
|
96542
96796
|
return void 0;
|
|
96543
96797
|
}
|
|
@@ -96547,7 +96801,7 @@ var FileConfigStore = class {
|
|
|
96547
96801
|
if (filePath === void 0) return void 0;
|
|
96548
96802
|
const target = `${filePath}.corrupt-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`;
|
|
96549
96803
|
try {
|
|
96550
|
-
await
|
|
96804
|
+
await import_promises35.default.rename(filePath, target);
|
|
96551
96805
|
return target;
|
|
96552
96806
|
} catch {
|
|
96553
96807
|
return void 0;
|
|
@@ -96559,8 +96813,8 @@ var FileConfigStore = class {
|
|
|
96559
96813
|
};
|
|
96560
96814
|
let watcher;
|
|
96561
96815
|
try {
|
|
96562
|
-
watcher = (0,
|
|
96563
|
-
if (filename ===
|
|
96816
|
+
watcher = (0, import_node_fs15.watch)(import_node_path62.default.dirname(filePath), (_event, filename) => {
|
|
96817
|
+
if (filename === import_node_path62.default.basename(filePath)) onChange();
|
|
96564
96818
|
});
|
|
96565
96819
|
} catch {
|
|
96566
96820
|
}
|
|
@@ -96575,7 +96829,7 @@ var FileWorkspaceState = class {
|
|
|
96575
96829
|
values = {};
|
|
96576
96830
|
async load() {
|
|
96577
96831
|
try {
|
|
96578
|
-
const parsed = JSON.parse(await
|
|
96832
|
+
const parsed = JSON.parse(await import_promises35.default.readFile(this.filePath, "utf8"));
|
|
96579
96833
|
if (typeof parsed === "object" && parsed !== null)
|
|
96580
96834
|
this.values = parsed;
|
|
96581
96835
|
} catch {
|
|
@@ -96588,8 +96842,8 @@ var FileWorkspaceState = class {
|
|
|
96588
96842
|
async set(key2, value) {
|
|
96589
96843
|
if (value === void 0) delete this.values[key2];
|
|
96590
96844
|
else this.values[key2] = value;
|
|
96591
|
-
await
|
|
96592
|
-
await
|
|
96845
|
+
await import_promises35.default.mkdir(import_node_path62.default.dirname(this.filePath), { recursive: true });
|
|
96846
|
+
await import_promises35.default.writeFile(this.filePath, JSON.stringify(this.values, null, 2), {
|
|
96593
96847
|
encoding: "utf8",
|
|
96594
96848
|
mode: 384
|
|
96595
96849
|
});
|
|
@@ -96637,7 +96891,7 @@ function createBrowserUi(workspaceRoot, post, fastFs) {
|
|
|
96637
96891
|
openFile: async (filePath) => {
|
|
96638
96892
|
try {
|
|
96639
96893
|
post(
|
|
96640
|
-
[`[info] ${
|
|
96894
|
+
[`[info] ${import_node_path62.default.basename(filePath)}`, "", await import_promises35.default.readFile(filePath, "utf8")].join("\n")
|
|
96641
96895
|
);
|
|
96642
96896
|
} catch (error51) {
|
|
96643
96897
|
post(`[warning] Could not read ${filePath}: ${String(error51)}`);
|
|
@@ -96672,14 +96926,14 @@ function createBrowserUi(workspaceRoot, post, fastFs) {
|
|
|
96672
96926
|
if (found2.length >= limit || level > 12 || depth !== void 0 && level > depth) return;
|
|
96673
96927
|
let entries;
|
|
96674
96928
|
try {
|
|
96675
|
-
entries = await
|
|
96929
|
+
entries = await import_promises35.default.readdir(dir, { withFileTypes: true });
|
|
96676
96930
|
} catch {
|
|
96677
96931
|
return;
|
|
96678
96932
|
}
|
|
96679
96933
|
for (const entry of entries) {
|
|
96680
96934
|
if (found2.length >= limit) return;
|
|
96681
96935
|
if (entry.name.startsWith(".") && entry.name !== ".env") continue;
|
|
96682
|
-
const full =
|
|
96936
|
+
const full = import_node_path62.default.join(dir, entry.name);
|
|
96683
96937
|
if (entry.isDirectory()) {
|
|
96684
96938
|
if (!skip.has(entry.name)) await walk(full, level + 1);
|
|
96685
96939
|
} else if (depth !== void 0 && level !== depth) {
|
|
@@ -96715,11 +96969,11 @@ var SHARED_COLLECTIONS = [
|
|
|
96715
96969
|
{ key: "mcpServers" }
|
|
96716
96970
|
];
|
|
96717
96971
|
async function createSession(options) {
|
|
96718
|
-
const userDir =
|
|
96719
|
-
await
|
|
96972
|
+
const userDir = import_node_path62.default.join(options.dataDir, "users", storageKeyFor(options.principal));
|
|
96973
|
+
await import_promises35.default.mkdir(userDir, { recursive: true, mode: 448 });
|
|
96720
96974
|
const variableStore = new UserVariableStore(userVariablesPath(userDir));
|
|
96721
96975
|
const userVariables = () => variableStore.read();
|
|
96722
|
-
const workspaceState = new FileWorkspaceState(
|
|
96976
|
+
const workspaceState = new FileWorkspaceState(import_node_path62.default.join(userDir, "workspace-state.json"));
|
|
96723
96977
|
await workspaceState.load();
|
|
96724
96978
|
const services = {
|
|
96725
96979
|
/*
|
|
@@ -96807,16 +97061,16 @@ async function createSession(options) {
|
|
|
96807
97061
|
*/
|
|
96808
97062
|
secrets: new CredentialPointerStore(
|
|
96809
97063
|
withCredentialTool(
|
|
96810
|
-
options.sharedSecrets === void 0 ? new FileSecretStore(options.secretsFile ??
|
|
96811
|
-
new FileSecretStore(options.secretsFile ??
|
|
97064
|
+
options.sharedSecrets === void 0 ? new FileSecretStore(options.secretsFile ?? import_node_path62.default.join(userDir, "secrets.json"), options.secretsKey) : new RoutedSecretStore(
|
|
97065
|
+
new FileSecretStore(options.secretsFile ?? import_node_path62.default.join(userDir, "secrets.json"), options.secretsKey),
|
|
96812
97066
|
options.sharedSecrets
|
|
96813
97067
|
),
|
|
96814
97068
|
options
|
|
96815
97069
|
)
|
|
96816
97070
|
),
|
|
96817
97071
|
configStore: withSharedEntries(
|
|
96818
|
-
options.sharedProfiles === void 0 ? new FileConfigStore(options.configFile ??
|
|
96819
|
-
new FileConfigStore(options.configFile ??
|
|
97072
|
+
options.sharedProfiles === void 0 ? new FileConfigStore(options.configFile ?? import_node_path62.default.join(userDir, "config.json"), options.workspaceRoot) : new SharedProfileConfigStore(
|
|
97073
|
+
new FileConfigStore(options.configFile ?? import_node_path62.default.join(userDir, "config.json"), options.workspaceRoot),
|
|
96820
97074
|
options.sharedProfiles
|
|
96821
97075
|
),
|
|
96822
97076
|
options
|
|
@@ -96934,8 +97188,8 @@ async function startServer(options) {
|
|
|
96934
97188
|
));
|
|
96935
97189
|
const roles = options.roles ?? SINGLE_USER_POLICY;
|
|
96936
97190
|
const sharedStore = options.sharedConfig;
|
|
96937
|
-
const sharedSecretStore = new FileSecretStore(
|
|
96938
|
-
const reviews = new ReviewQueue(
|
|
97191
|
+
const sharedSecretStore = new FileSecretStore(import_node_path63.default.join(options.dataDir, "shared-secrets.json"));
|
|
97192
|
+
const reviews = new ReviewQueue(import_node_path63.default.join(options.dataDir, "reviews.json"));
|
|
96939
97193
|
let sharedCache = {
|
|
96940
97194
|
variables: [],
|
|
96941
97195
|
adminIds: [],
|
|
@@ -97311,14 +97565,14 @@ async function startServer(options) {
|
|
|
97311
97565
|
return "No workspace is open, so there is nowhere to write it.";
|
|
97312
97566
|
try {
|
|
97313
97567
|
if (item.kind === "skill") {
|
|
97314
|
-
const dir2 =
|
|
97315
|
-
await
|
|
97316
|
-
await
|
|
97568
|
+
const dir2 = import_node_path63.default.join(options.workspaceRoot, ".lightcode", "skills");
|
|
97569
|
+
await import_promises36.default.mkdir(dir2, { recursive: true });
|
|
97570
|
+
await import_promises36.default.writeFile(import_node_path63.default.join(dir2, `${item.name}.md`), item.content, "utf8");
|
|
97317
97571
|
return void 0;
|
|
97318
97572
|
}
|
|
97319
|
-
const dir =
|
|
97320
|
-
await
|
|
97321
|
-
await
|
|
97573
|
+
const dir = import_node_path63.default.join(options.workspaceRoot, ".lightcode", "tools");
|
|
97574
|
+
await import_promises36.default.mkdir(dir, { recursive: true });
|
|
97575
|
+
await import_promises36.default.writeFile(import_node_path63.default.join(dir, `${item.name}.py`), item.content, "utf8");
|
|
97322
97576
|
return void 0;
|
|
97323
97577
|
} catch (error51) {
|
|
97324
97578
|
return error51 instanceof Error ? error51.message : String(error51);
|
|
@@ -97341,7 +97595,7 @@ async function startServer(options) {
|
|
|
97341
97595
|
async function readCredentials() {
|
|
97342
97596
|
if (options.credentialsFile === void 0) return [];
|
|
97343
97597
|
try {
|
|
97344
|
-
const parsed = JSON.parse(await
|
|
97598
|
+
const parsed = JSON.parse(await import_promises36.default.readFile(options.credentialsFile, "utf8"));
|
|
97345
97599
|
const list2 = Array.isArray(parsed.credentials) ? parsed.credentials : [];
|
|
97346
97600
|
return list2.flatMap((entry) => {
|
|
97347
97601
|
const c2 = entry;
|
|
@@ -97357,7 +97611,7 @@ async function startServer(options) {
|
|
|
97357
97611
|
connection.transport.post({ type: "credentials", credentials: await readCredentials() });
|
|
97358
97612
|
}
|
|
97359
97613
|
if (options.credentialsFile !== void 0) {
|
|
97360
|
-
(0,
|
|
97614
|
+
(0, import_node_fs16.watchFile)(options.credentialsFile, { interval: 1500 }, () => {
|
|
97361
97615
|
for (const connection of connections.values()) void postCredentials(connection);
|
|
97362
97616
|
});
|
|
97363
97617
|
}
|
|
@@ -97467,7 +97721,7 @@ async function startServer(options) {
|
|
|
97467
97721
|
return;
|
|
97468
97722
|
}
|
|
97469
97723
|
response.writeHead(200, {
|
|
97470
|
-
"Content-Type": CONTENT_TYPES2[
|
|
97724
|
+
"Content-Type": CONTENT_TYPES2[import_node_path63.default.extname(asset)] ?? "application/octet-stream",
|
|
97471
97725
|
...securityHeaders()
|
|
97472
97726
|
});
|
|
97473
97727
|
response.end(body);
|