@chosengeneration/light-code 0.142.0 → 0.143.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 +931 -509
- package/dist/server.cjs +899 -477
- 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 path61 = 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 (path61 && !path61.startsWith("/")) {
|
|
502
|
+
path61 = `/${path61}`;
|
|
503
503
|
}
|
|
504
|
-
url2 = new URL(origin +
|
|
504
|
+
url2 = new URL(origin + path61);
|
|
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(path61) {
|
|
2119
|
+
if (typeof path61 !== "string") {
|
|
2120
2120
|
return "";
|
|
2121
2121
|
}
|
|
2122
|
-
for (var i =
|
|
2123
|
-
switch (
|
|
2122
|
+
for (var i = path61.length - 1; i >= 0; --i) {
|
|
2123
|
+
switch (path61.charCodeAt(i)) {
|
|
2124
2124
|
case 47:
|
|
2125
2125
|
// '/'
|
|
2126
2126
|
case 92:
|
|
2127
|
-
|
|
2128
|
-
return
|
|
2127
|
+
path61 = path61.slice(i + 1);
|
|
2128
|
+
return path61 === ".." || path61 === "." ? "" : path61;
|
|
2129
2129
|
}
|
|
2130
2130
|
}
|
|
2131
|
-
return
|
|
2131
|
+
return path61 === ".." || path61 === "." ? "" : path61;
|
|
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: path61,
|
|
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 path61 !== "string") {
|
|
5176
5176
|
throw new InvalidArgumentError("path must be a string");
|
|
5177
|
-
} else if (
|
|
5177
|
+
} else if (path61[0] !== "/" && !(path61.startsWith("http://") || path61.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(path61) !== 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(path61, query) : path61;
|
|
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 path61 = 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 = path61;
|
|
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: path61, 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} ${path61} 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: path61, 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] = path61;
|
|
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(path61) {
|
|
9889
|
+
if (typeof path61 !== "string") {
|
|
9890
|
+
return path61;
|
|
9891
9891
|
}
|
|
9892
|
-
const pathSegments =
|
|
9892
|
+
const pathSegments = path61.split("?");
|
|
9893
9893
|
if (pathSegments.length !== 2) {
|
|
9894
|
-
return
|
|
9894
|
+
return path61;
|
|
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: path61, method, body, headers }) {
|
|
9901
|
+
const pathMatch = matchValue(mockDispatch2.path, path61);
|
|
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: path61 }) => matchValue(safeUrl(path61), 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: path61, method, body, headers, query } = opts;
|
|
9957
9957
|
return {
|
|
9958
|
-
path:
|
|
9958
|
+
path: path61,
|
|
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: path61, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
10408
10408
|
Method: method,
|
|
10409
10409
|
Origin: origin,
|
|
10410
|
-
Path:
|
|
10410
|
+
Path: path61,
|
|
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(path61) {
|
|
15031
|
+
for (const char of path61) {
|
|
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 path61 = opts.path;
|
|
16712
16712
|
if (!opts.path.startsWith("/")) {
|
|
16713
|
-
|
|
16713
|
+
path61 = `/${path61}`;
|
|
16714
16714
|
}
|
|
16715
|
-
url2 = new URL(util.parseOrigin(url2).origin +
|
|
16715
|
+
url2 = new URL(util.parseOrigin(url2).origin + path61);
|
|
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(path61) {
|
|
19987
|
+
let input = path61;
|
|
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 [path61, query] = wsComponent.resourceName.split("?");
|
|
20240
|
+
wsComponent.path = path61 && path61 !== "/" ? path61 : void 0;
|
|
20241
20241
|
wsComponent.query = query;
|
|
20242
20242
|
wsComponent.resourceName = void 0;
|
|
20243
20243
|
}
|
|
@@ -23655,7 +23655,7 @@ var require_windows = __commonJS({
|
|
|
23655
23655
|
module2.exports = isexe;
|
|
23656
23656
|
isexe.sync = sync;
|
|
23657
23657
|
var fs41 = require("fs");
|
|
23658
|
-
function checkPathExt(
|
|
23658
|
+
function checkPathExt(path61, 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 && path61.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, path61, options) {
|
|
23676
23676
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
23677
23677
|
return false;
|
|
23678
23678
|
}
|
|
23679
|
-
return checkPathExt(
|
|
23679
|
+
return checkPathExt(path61, options);
|
|
23680
23680
|
}
|
|
23681
|
-
function isexe(
|
|
23682
|
-
fs41.stat(
|
|
23683
|
-
cb(er, er ? false : checkStat(stat,
|
|
23681
|
+
function isexe(path61, options, cb) {
|
|
23682
|
+
fs41.stat(path61, function(er, stat) {
|
|
23683
|
+
cb(er, er ? false : checkStat(stat, path61, options));
|
|
23684
23684
|
});
|
|
23685
23685
|
}
|
|
23686
|
-
function sync(
|
|
23687
|
-
return checkStat(fs41.statSync(
|
|
23686
|
+
function sync(path61, options) {
|
|
23687
|
+
return checkStat(fs41.statSync(path61), path61, options);
|
|
23688
23688
|
}
|
|
23689
23689
|
}
|
|
23690
23690
|
});
|
|
@@ -23695,13 +23695,13 @@ var require_mode = __commonJS({
|
|
|
23695
23695
|
module2.exports = isexe;
|
|
23696
23696
|
isexe.sync = sync;
|
|
23697
23697
|
var fs41 = require("fs");
|
|
23698
|
-
function isexe(
|
|
23699
|
-
fs41.stat(
|
|
23698
|
+
function isexe(path61, options, cb) {
|
|
23699
|
+
fs41.stat(path61, function(er, stat) {
|
|
23700
23700
|
cb(er, er ? false : checkStat(stat, options));
|
|
23701
23701
|
});
|
|
23702
23702
|
}
|
|
23703
|
-
function sync(
|
|
23704
|
-
return checkStat(fs41.statSync(
|
|
23703
|
+
function sync(path61, options) {
|
|
23704
|
+
return checkStat(fs41.statSync(path61), options);
|
|
23705
23705
|
}
|
|
23706
23706
|
function checkStat(stat, options) {
|
|
23707
23707
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -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(path61, 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(path61, 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(path61, 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(path61, options) {
|
|
23767
23767
|
try {
|
|
23768
|
-
return core.sync(
|
|
23768
|
+
return core.sync(path61, 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 path61 = 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 = path61.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 = path61.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 path61 = 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 ? path61.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 = path61.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 [path61, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
23979
|
+
const binary = path61.split("/").pop();
|
|
23980
23980
|
if (binary === "env") {
|
|
23981
23981
|
return argument;
|
|
23982
23982
|
}
|
|
@@ -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 path61 = 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 = path61.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(" ");
|
|
@@ -24260,7 +24260,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
24260
24260
|
var import_promises34 = __toESM(require("node:fs/promises"), 1);
|
|
24261
24261
|
var import_node_fs14 = require("node:fs");
|
|
24262
24262
|
var import_node_http = require("node:http");
|
|
24263
|
-
var
|
|
24263
|
+
var import_node_path61 = __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, path61) {
|
|
25425
|
+
if (!path61)
|
|
25426
25426
|
return obj;
|
|
25427
|
-
return
|
|
25427
|
+
return path61.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(path61, 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(path61);
|
|
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, path61 = []) => {
|
|
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 }, [...path61, ...issue2.path]));
|
|
25991
25991
|
} else if (issue2.code === "invalid_key") {
|
|
25992
|
-
processError({ issues: issue2.issues }, [...
|
|
25992
|
+
processError({ issues: issue2.issues }, [...path61, ...issue2.path]);
|
|
25993
25993
|
} else if (issue2.code === "invalid_element") {
|
|
25994
|
-
processError({ issues: issue2.issues }, [...
|
|
25994
|
+
processError({ issues: issue2.issues }, [...path61, ...issue2.path]);
|
|
25995
25995
|
} else {
|
|
25996
|
-
const fullpath = [...
|
|
25996
|
+
const fullpath = [...path61, ...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, path61 = []) => {
|
|
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 }, [...path61, ...issue2.path]));
|
|
26028
26028
|
} else if (issue2.code === "invalid_key") {
|
|
26029
|
-
processError({ issues: issue2.issues }, [...
|
|
26029
|
+
processError({ issues: issue2.issues }, [...path61, ...issue2.path]);
|
|
26030
26030
|
} else if (issue2.code === "invalid_element") {
|
|
26031
|
-
processError({ issues: issue2.issues }, [...
|
|
26031
|
+
processError({ issues: issue2.issues }, [...path61, ...issue2.path]);
|
|
26032
26032
|
} else {
|
|
26033
|
-
const fullpath = [...
|
|
26033
|
+
const fullpath = [...path61, ...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 path61 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
26066
|
+
for (const seg of path61) {
|
|
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 path61 = ref.slice(1).split("/").filter(Boolean);
|
|
38759
|
+
if (path61.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 (path61[0] === defsKey) {
|
|
38764
|
+
const key2 = path61[1];
|
|
38765
38765
|
if (!key2 || !ctx.defs[key2]) {
|
|
38766
38766
|
throw new Error(`Reference not found: ${ref}`);
|
|
38767
38767
|
}
|
|
@@ -40546,7 +40546,15 @@ var configSchema = external_exports.object({
|
|
|
40546
40546
|
* able to add a folder could offer its own add-on under a familiar name.
|
|
40547
40547
|
*/
|
|
40548
40548
|
addons: external_exports.object({
|
|
40549
|
-
folders: external_exports.array(external_exports.string().min(1)).max(50)
|
|
40549
|
+
folders: external_exports.array(external_exports.string().min(1)).max(50),
|
|
40550
|
+
/**
|
|
40551
|
+
* What the user entered on each add-on's own tab (`addons/page.ts`), by package name. Never
|
|
40552
|
+
* a secret: those are in secret storage under `addon:<package>:<record>:<field>`.
|
|
40553
|
+
*/
|
|
40554
|
+
settings: external_exports.record(external_exports.string(), external_exports.object({
|
|
40555
|
+
values: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
40556
|
+
records: external_exports.array(external_exports.object({ id: external_exports.string().min(1).max(40), values: external_exports.record(external_exports.string(), external_exports.unknown()) })).max(500).optional()
|
|
40557
|
+
}))
|
|
40550
40558
|
}).partial(),
|
|
40551
40559
|
lsp: external_exports.object({
|
|
40552
40560
|
enabled: external_exports.boolean(),
|
|
@@ -44014,8 +44022,8 @@ var SUPERSEDED_MARKER = "[Superseded: this file was read again later in the conv
|
|
|
44014
44022
|
function readFilePath(argumentsJson) {
|
|
44015
44023
|
try {
|
|
44016
44024
|
const parsed = JSON.parse(argumentsJson.length > 0 ? argumentsJson : "{}");
|
|
44017
|
-
const
|
|
44018
|
-
return typeof
|
|
44025
|
+
const path61 = parsed.path;
|
|
44026
|
+
return typeof path61 === "string" && path61.length > 0 ? path61 : void 0;
|
|
44019
44027
|
} catch {
|
|
44020
44028
|
return void 0;
|
|
44021
44029
|
}
|
|
@@ -44028,8 +44036,8 @@ function dropSupersededReads(messages) {
|
|
|
44028
44036
|
for (const toolCall of message4.toolCalls ?? []) {
|
|
44029
44037
|
if (toolCall.name !== "read_file")
|
|
44030
44038
|
continue;
|
|
44031
|
-
const
|
|
44032
|
-
if (
|
|
44039
|
+
const path61 = readFilePath(toolCall.arguments);
|
|
44040
|
+
if (path61 === void 0)
|
|
44033
44041
|
continue;
|
|
44034
44042
|
keyByCallId.set(toolCall.id, toolCall.arguments);
|
|
44035
44043
|
}
|
|
@@ -46873,13 +46881,13 @@ var OpenSearchClient = class {
|
|
|
46873
46881
|
* `_bulk`, `_delete_by_query`, index creation — is refused here rather than merely
|
|
46874
46882
|
* unused, so no future edit or crafted argument can turn a read client into a writer.
|
|
46875
46883
|
*/
|
|
46876
|
-
async request(
|
|
46884
|
+
async request(path61, options = {}) {
|
|
46877
46885
|
const method = options.method ?? "GET";
|
|
46878
|
-
const isSearchPost = method === "POST" && /\/_search(\?|$)/.test(
|
|
46886
|
+
const isSearchPost = method === "POST" && /\/_search(\?|$)/.test(path61);
|
|
46879
46887
|
if (method !== "GET" && !isSearchPost) {
|
|
46880
|
-
throw new OpenSearchError(`Refusing ${method} ${
|
|
46888
|
+
throw new OpenSearchError(`Refusing ${method} ${path61}: this client is read-only. Indexing goes through the indexer, which the user starts from Settings.`);
|
|
46881
46889
|
}
|
|
46882
|
-
const url2 = `${this.base}${
|
|
46890
|
+
const url2 = `${this.base}${path61}`;
|
|
46883
46891
|
const request = {
|
|
46884
46892
|
method,
|
|
46885
46893
|
headers: this.headers()
|
|
@@ -47046,11 +47054,11 @@ function collectFields(properties, prefix, out) {
|
|
|
47046
47054
|
return;
|
|
47047
47055
|
for (const [name, raw] of Object.entries(properties)) {
|
|
47048
47056
|
const field2 = raw;
|
|
47049
|
-
const
|
|
47057
|
+
const path61 = prefix.length > 0 ? `${prefix}.${name}` : name;
|
|
47050
47058
|
if (typeof field2.type === "string")
|
|
47051
|
-
out[
|
|
47059
|
+
out[path61] = field2.type;
|
|
47052
47060
|
if (field2.properties !== void 0)
|
|
47053
|
-
collectFields(field2.properties,
|
|
47061
|
+
collectFields(field2.properties, path61, out);
|
|
47054
47062
|
}
|
|
47055
47063
|
}
|
|
47056
47064
|
function describeStatus(status2, url2, body) {
|
|
@@ -47069,23 +47077,23 @@ function describeStatus(status2, url2, body) {
|
|
|
47069
47077
|
var TEXT_TYPES = /* @__PURE__ */ new Set(["text", "match_only_text", "search_as_you_type", "wildcard"]);
|
|
47070
47078
|
var KEYWORD_TYPES = /* @__PURE__ */ new Set(["keyword", "constant_keyword"]);
|
|
47071
47079
|
var NOISE_FIELDS = /* @__PURE__ */ new Set(["@version", "ecs", "tags", "stream", "input", "agent", "host", "event"]);
|
|
47072
|
-
function leafName(
|
|
47073
|
-
const parts =
|
|
47074
|
-
return parts[parts.length - 1] ??
|
|
47080
|
+
function leafName(path61) {
|
|
47081
|
+
const parts = path61.split(".");
|
|
47082
|
+
return parts[parts.length - 1] ?? path61;
|
|
47075
47083
|
}
|
|
47076
47084
|
function selectQueryFields(mapping, limit = 25) {
|
|
47077
47085
|
const text = [];
|
|
47078
47086
|
const keyword = [];
|
|
47079
|
-
for (const [
|
|
47080
|
-
if (NOISE_FIELDS.has(leafName(
|
|
47087
|
+
for (const [path61, type] of Object.entries(mapping)) {
|
|
47088
|
+
if (NOISE_FIELDS.has(leafName(path61)) || NOISE_FIELDS.has(path61.split(".")[0] ?? ""))
|
|
47081
47089
|
continue;
|
|
47082
47090
|
if (TEXT_TYPES.has(type)) {
|
|
47083
|
-
text.push(
|
|
47091
|
+
text.push(path61);
|
|
47084
47092
|
} else if (KEYWORD_TYPES.has(type)) {
|
|
47085
|
-
const parent =
|
|
47086
|
-
if (
|
|
47093
|
+
const parent = path61.replace(/\.keyword$/, "");
|
|
47094
|
+
if (path61.endsWith(".keyword") && TEXT_TYPES.has(mapping[parent] ?? ""))
|
|
47087
47095
|
continue;
|
|
47088
|
-
keyword.push(
|
|
47096
|
+
keyword.push(path61);
|
|
47089
47097
|
}
|
|
47090
47098
|
}
|
|
47091
47099
|
const byDepth = (a, b) => a.split(".").length - b.split(".").length || a.localeCompare(b);
|
|
@@ -47227,8 +47235,8 @@ var OpenSearchIndexWriter = class {
|
|
|
47227
47235
|
}
|
|
47228
47236
|
return headers;
|
|
47229
47237
|
}
|
|
47230
|
-
async request(
|
|
47231
|
-
const url2 = `${this.connection.url.replace(/\/+$/, "")}${
|
|
47238
|
+
async request(path61, method, body, signal) {
|
|
47239
|
+
const url2 = `${this.connection.url.replace(/\/+$/, "")}${path61}`;
|
|
47232
47240
|
const request = { method, headers: this.headers() };
|
|
47233
47241
|
if (body !== void 0) {
|
|
47234
47242
|
if (typeof body === "string") {
|
|
@@ -47442,13 +47450,13 @@ var OpenSearchIndexWriter = class {
|
|
|
47442
47450
|
for (const hit of hits) {
|
|
47443
47451
|
const source = hit._source ?? {};
|
|
47444
47452
|
const vector = source.vector;
|
|
47445
|
-
const
|
|
47446
|
-
if (typeof
|
|
47453
|
+
const path61 = source.path;
|
|
47454
|
+
if (typeof path61 !== "string" || !Array.isArray(vector))
|
|
47447
47455
|
continue;
|
|
47448
47456
|
documents.push({
|
|
47449
47457
|
id: hit._id ?? "",
|
|
47450
47458
|
text: typeof source.text === "string" ? source.text : "",
|
|
47451
|
-
path:
|
|
47459
|
+
path: path61,
|
|
47452
47460
|
startLine: typeof source.startLine === "number" ? source.startLine : 1,
|
|
47453
47461
|
endLine: typeof source.endLine === "number" ? source.endLine : 1,
|
|
47454
47462
|
vector
|
|
@@ -47522,8 +47530,8 @@ var RestTransport = class {
|
|
|
47522
47530
|
* threw would push every caller into catching and re-inspecting an error to find out
|
|
47523
47531
|
* whether it was really an error. `expectOk` is there for the cases that are.
|
|
47524
47532
|
*/
|
|
47525
|
-
async send(
|
|
47526
|
-
const url2 = `${this.connection.url.replace(/\/+$/, "")}${
|
|
47533
|
+
async send(path61, method, body, signal) {
|
|
47534
|
+
const url2 = `${this.connection.url.replace(/\/+$/, "")}${path61}`;
|
|
47527
47535
|
const request = { method, headers: this.headers() };
|
|
47528
47536
|
if (body !== void 0)
|
|
47529
47537
|
request.body = JSON.stringify(body);
|
|
@@ -47549,11 +47557,11 @@ var RestTransport = class {
|
|
|
47549
47557
|
return { status: response.status, body: parsed };
|
|
47550
47558
|
}
|
|
47551
47559
|
/** Sends, and throws unless the status is 2xx. */
|
|
47552
|
-
async expectOk(
|
|
47553
|
-
const result = await this.send(
|
|
47560
|
+
async expectOk(path61, method, body, signal) {
|
|
47561
|
+
const result = await this.send(path61, method, body, signal);
|
|
47554
47562
|
if (result.status < 200 || result.status >= 300) {
|
|
47555
47563
|
const detail = typeof result.body === "string" ? result.body : JSON.stringify(result.body ?? "");
|
|
47556
|
-
throw new VectorStoreError(`${method} ${
|
|
47564
|
+
throw new VectorStoreError(`${method} ${path61} on ${this.label} returned HTTP ${String(result.status)}. ${detail.slice(0, 300)}`, result.status);
|
|
47557
47565
|
}
|
|
47558
47566
|
return result.body;
|
|
47559
47567
|
}
|
|
@@ -47661,10 +47669,10 @@ var ChromaSearcher = class extends ChromaBase {
|
|
|
47661
47669
|
const matches = [];
|
|
47662
47670
|
for (let index = 0; index < ids.length; index++) {
|
|
47663
47671
|
const metadata = metadatas[index] ?? {};
|
|
47664
|
-
const
|
|
47665
|
-
if (
|
|
47672
|
+
const path61 = typeof metadata.path === "string" ? metadata.path : void 0;
|
|
47673
|
+
if (path61 === void 0)
|
|
47666
47674
|
continue;
|
|
47667
|
-
if (prefix !== void 0 && prefix.length > 0 && !
|
|
47675
|
+
if (prefix !== void 0 && prefix.length > 0 && !path61.startsWith(prefix))
|
|
47668
47676
|
continue;
|
|
47669
47677
|
if (projectHere && typeof metadata.project === "string" && !options.project?.names.includes(metadata.project))
|
|
47670
47678
|
continue;
|
|
@@ -47678,7 +47686,7 @@ var ChromaSearcher = class extends ChromaBase {
|
|
|
47678
47686
|
*/
|
|
47679
47687
|
score: typeof distance === "number" ? 1 / (1 + Math.max(0, distance)) : 0,
|
|
47680
47688
|
text: documents[index] ?? (typeof metadata.text === "string" ? metadata.text : ""),
|
|
47681
|
-
path:
|
|
47689
|
+
path: path61
|
|
47682
47690
|
};
|
|
47683
47691
|
if (typeof metadata.startLine === "number")
|
|
47684
47692
|
match.startLine = metadata.startLine;
|
|
@@ -47789,13 +47797,13 @@ var ChromaIndexWriter = class extends ChromaBase {
|
|
|
47789
47797
|
for (let index = 0; index < ids.length; index++) {
|
|
47790
47798
|
const metadata = result.metadatas?.[index] ?? {};
|
|
47791
47799
|
const vector = result.embeddings?.[index];
|
|
47792
|
-
const
|
|
47793
|
-
if (
|
|
47800
|
+
const path61 = typeof metadata.path === "string" ? metadata.path : void 0;
|
|
47801
|
+
if (path61 === void 0 || !Array.isArray(vector))
|
|
47794
47802
|
continue;
|
|
47795
47803
|
documents.push({
|
|
47796
47804
|
id: ids[index] ?? "",
|
|
47797
47805
|
text: result.documents?.[index] ?? "",
|
|
47798
|
-
path:
|
|
47806
|
+
path: path61,
|
|
47799
47807
|
startLine: typeof metadata.startLine === "number" ? metadata.startLine : 1,
|
|
47800
47808
|
endLine: typeof metadata.endLine === "number" ? metadata.endLine : 1,
|
|
47801
47809
|
vector
|
|
@@ -47812,9 +47820,9 @@ var ChromaIndexWriter = class extends ChromaBase {
|
|
|
47812
47820
|
const result = await this.rest.expectOk(`${this.base}/collections/${found2.id}/get`, "POST", { include: ["metadatas"], limit }, options.signal);
|
|
47813
47821
|
const paths = /* @__PURE__ */ new Set();
|
|
47814
47822
|
for (const metadata of result.metadatas ?? []) {
|
|
47815
|
-
const
|
|
47816
|
-
if (typeof
|
|
47817
|
-
paths.add(
|
|
47823
|
+
const path61 = metadata?.path;
|
|
47824
|
+
if (typeof path61 === "string")
|
|
47825
|
+
paths.add(path61);
|
|
47818
47826
|
}
|
|
47819
47827
|
return [...paths];
|
|
47820
47828
|
}
|
|
@@ -47841,14 +47849,14 @@ var MARKER_ID = "5f6d2a41-0000-5000-8000-6c69676874c0";
|
|
|
47841
47849
|
var MARKER_MARK = "light-code";
|
|
47842
47850
|
function toMatch(point) {
|
|
47843
47851
|
const payload = point.payload ?? {};
|
|
47844
|
-
const
|
|
47845
|
-
if (
|
|
47852
|
+
const path61 = typeof payload.path === "string" ? payload.path : void 0;
|
|
47853
|
+
if (path61 === void 0)
|
|
47846
47854
|
return void 0;
|
|
47847
47855
|
const match = {
|
|
47848
47856
|
id: typeof payload.chunkId === "string" ? payload.chunkId : point.id,
|
|
47849
47857
|
score: typeof point.score === "number" ? point.score : 0,
|
|
47850
47858
|
text: typeof payload.text === "string" ? payload.text : "",
|
|
47851
|
-
path:
|
|
47859
|
+
path: path61
|
|
47852
47860
|
};
|
|
47853
47861
|
if (typeof payload.startLine === "number")
|
|
47854
47862
|
match.startLine = payload.startLine;
|
|
@@ -48042,13 +48050,13 @@ var QdrantIndexWriter = class extends QdrantBase {
|
|
|
48042
48050
|
const documents = [];
|
|
48043
48051
|
for (const point of result.body.result?.points ?? []) {
|
|
48044
48052
|
const payload = point.payload ?? {};
|
|
48045
|
-
const
|
|
48046
|
-
if (
|
|
48053
|
+
const path61 = typeof payload.path === "string" ? payload.path : void 0;
|
|
48054
|
+
if (path61 === void 0 || !Array.isArray(point.vector))
|
|
48047
48055
|
continue;
|
|
48048
48056
|
documents.push({
|
|
48049
48057
|
id: typeof payload.chunkId === "string" ? payload.chunkId : point.id,
|
|
48050
48058
|
text: typeof payload.text === "string" ? payload.text : "",
|
|
48051
|
-
path:
|
|
48059
|
+
path: path61,
|
|
48052
48060
|
startLine: typeof payload.startLine === "number" ? payload.startLine : 1,
|
|
48053
48061
|
endLine: typeof payload.endLine === "number" ? payload.endLine : 1,
|
|
48054
48062
|
vector: point.vector
|
|
@@ -48075,9 +48083,9 @@ var QdrantIndexWriter = class extends QdrantBase {
|
|
|
48075
48083
|
throw new VectorStoreError(`Could not list "${collection}" (HTTP ${String(result.status)}).`, result.status);
|
|
48076
48084
|
}
|
|
48077
48085
|
for (const point of result.body.result?.points ?? []) {
|
|
48078
|
-
const
|
|
48079
|
-
if (typeof
|
|
48080
|
-
paths.add(
|
|
48086
|
+
const path61 = point.payload?.path;
|
|
48087
|
+
if (typeof path61 === "string")
|
|
48088
|
+
paths.add(path61);
|
|
48081
48089
|
}
|
|
48082
48090
|
offset = result.body.result?.next_page_offset;
|
|
48083
48091
|
if (offset === void 0 || offset === null)
|
|
@@ -48611,8 +48619,8 @@ function teamSkillDocument(skill, body, vector, attribution) {
|
|
|
48611
48619
|
vector
|
|
48612
48620
|
};
|
|
48613
48621
|
}
|
|
48614
|
-
function nameFromPath(
|
|
48615
|
-
return
|
|
48622
|
+
function nameFromPath(path61) {
|
|
48623
|
+
return path61.startsWith("skill:") ? path61.slice("skill:".length) : path61;
|
|
48616
48624
|
}
|
|
48617
48625
|
function toHit(match, self) {
|
|
48618
48626
|
return {
|
|
@@ -51694,8 +51702,8 @@ function createMailCoverageTool(options) {
|
|
|
51694
51702
|
}
|
|
51695
51703
|
};
|
|
51696
51704
|
}
|
|
51697
|
-
function normaliseFolder(
|
|
51698
|
-
return
|
|
51705
|
+
function normaliseFolder(path61) {
|
|
51706
|
+
return path61.toLowerCase().replace(/[\\/]+/g, "\\");
|
|
51699
51707
|
}
|
|
51700
51708
|
function haystackOf(record2) {
|
|
51701
51709
|
return `${record2.subject}
|
|
@@ -52191,7 +52199,7 @@ async function refreshMail(options) {
|
|
|
52191
52199
|
const limit = options.batchLimit ?? 2e3;
|
|
52192
52200
|
const previewChars = options.previewChars ?? 400;
|
|
52193
52201
|
const sinceMs = Date.now() - options.days * 24 * 60 * 60 * 1e3;
|
|
52194
|
-
const harvested = await options.harvest(options.folders.map((
|
|
52202
|
+
const harvested = await options.harvest(options.folders.map((path61) => ({ path: path61, sinceMs })), { limit, previewChars });
|
|
52195
52203
|
const fetched = harvested.messages.map(toRecord);
|
|
52196
52204
|
if (fetched.length === 0) {
|
|
52197
52205
|
return { added: 0, more: false, total: known.length, embedded: 0, backfilled: 0, complete: [] };
|
|
@@ -52232,9 +52240,9 @@ async function syncMail(options) {
|
|
|
52232
52240
|
const backfillDone = await options.store.loadBackfillState();
|
|
52233
52241
|
const limit = options.batchLimit ?? 500;
|
|
52234
52242
|
const previewChars = options.previewChars ?? 400;
|
|
52235
|
-
const forwardRequests = options.folders.map((
|
|
52236
|
-
const mark = marks.get(
|
|
52237
|
-
return mark === void 0 ? { path:
|
|
52243
|
+
const forwardRequests = options.folders.map((path61) => {
|
|
52244
|
+
const mark = marks.get(path61);
|
|
52245
|
+
return mark === void 0 ? { path: path61 } : { path: path61, sinceMs: mark.newest - 1e3 };
|
|
52238
52246
|
});
|
|
52239
52247
|
const forward = await options.harvest(forwardRequests, { limit, previewChars });
|
|
52240
52248
|
let candidates = forward.messages.map(toRecord);
|
|
@@ -52243,15 +52251,15 @@ async function syncMail(options) {
|
|
|
52243
52251
|
let more = forward.truncated;
|
|
52244
52252
|
const remaining = limit - candidates.length;
|
|
52245
52253
|
const floor = options.retentionMonths === void 0 ? void 0 : monthsBefore(options.now ?? Date.now(), options.retentionMonths);
|
|
52246
|
-
const outstanding = options.folders.filter((
|
|
52247
|
-
const atFloor = floor === void 0 ? [] : outstanding.filter((
|
|
52248
|
-
const behind = outstanding.filter((
|
|
52254
|
+
const outstanding = options.folders.filter((path61) => marks.has(path61) && backfillDone[path61] !== true);
|
|
52255
|
+
const atFloor = floor === void 0 ? [] : outstanding.filter((path61) => marks.get(path61).oldest <= floor);
|
|
52256
|
+
const behind = outstanding.filter((path61) => !atFloor.includes(path61));
|
|
52249
52257
|
completed.push(...atFloor);
|
|
52250
52258
|
if (remaining > 0 && behind.length > 0 && options.signal?.aborted !== true) {
|
|
52251
|
-
const backRequests = behind.map((
|
|
52252
|
-
path:
|
|
52259
|
+
const backRequests = behind.map((path61) => ({
|
|
52260
|
+
path: path61,
|
|
52253
52261
|
// Strictly older, so the oldest held message is not fetched again every pass.
|
|
52254
|
-
beforeMs: marks.get(
|
|
52262
|
+
beforeMs: marks.get(path61).oldest,
|
|
52255
52263
|
// And no older than retention wants. The harvest ANDs the two into one window.
|
|
52256
52264
|
...floor === void 0 ? {} : { sinceMs: floor }
|
|
52257
52265
|
}));
|
|
@@ -52259,9 +52267,9 @@ async function syncMail(options) {
|
|
|
52259
52267
|
backfilled = backward.messages.length;
|
|
52260
52268
|
candidates = [...candidates, ...backward.messages.map(toRecord)];
|
|
52261
52269
|
const returnedFor = new Set(backward.messages.map((message4) => message4.folder));
|
|
52262
|
-
for (const
|
|
52263
|
-
if (!returnedFor.has(
|
|
52264
|
-
completed.push(
|
|
52270
|
+
for (const path61 of behind) {
|
|
52271
|
+
if (!returnedFor.has(path61))
|
|
52272
|
+
completed.push(path61);
|
|
52265
52273
|
}
|
|
52266
52274
|
if (backward.truncated || backfilled > 0)
|
|
52267
52275
|
more = true;
|
|
@@ -52269,7 +52277,7 @@ async function syncMail(options) {
|
|
|
52269
52277
|
if (completed.length > 0) {
|
|
52270
52278
|
await options.store.saveBackfillState({
|
|
52271
52279
|
...backfillDone,
|
|
52272
|
-
...Object.fromEntries(completed.map((
|
|
52280
|
+
...Object.fromEntries(completed.map((path61) => [path61, true]))
|
|
52273
52281
|
});
|
|
52274
52282
|
}
|
|
52275
52283
|
const fresh = withoutKnown(candidates, known);
|
|
@@ -52603,14 +52611,14 @@ function formatBytes(size) {
|
|
|
52603
52611
|
return `${(size / (1 << 10)).toFixed(1)}KB`;
|
|
52604
52612
|
return `${String(size)}B`;
|
|
52605
52613
|
}
|
|
52606
|
-
async function readTail(fs41,
|
|
52614
|
+
async function readTail(fs41, path61, size, count3) {
|
|
52607
52615
|
let span = Math.min(size, CHUNK);
|
|
52608
52616
|
let text;
|
|
52609
52617
|
let start;
|
|
52610
52618
|
for (; ; ) {
|
|
52611
52619
|
start = Math.max(0, size - span);
|
|
52612
52620
|
const decoder = new import_node_string_decoder.StringDecoder("utf8");
|
|
52613
|
-
text = decoder.write(await fs41.readBytesSlice(
|
|
52621
|
+
text = decoder.write(await fs41.readBytesSlice(path61, start, size)) + decoder.end();
|
|
52614
52622
|
const enough = text.split("\n").length > count3;
|
|
52615
52623
|
if (enough || start === 0 || span >= size)
|
|
52616
52624
|
break;
|
|
@@ -52628,7 +52636,7 @@ async function readTail(fs41, path60, size, count3) {
|
|
|
52628
52636
|
hasMoreAfter: false
|
|
52629
52637
|
};
|
|
52630
52638
|
}
|
|
52631
|
-
async function readLineWindow(fs41,
|
|
52639
|
+
async function readLineWindow(fs41, path61, size, from, count3) {
|
|
52632
52640
|
const decoder = new import_node_string_decoder.StringDecoder("utf8");
|
|
52633
52641
|
const lines = [];
|
|
52634
52642
|
let pending = "";
|
|
@@ -52643,7 +52651,7 @@ async function readLineWindow(fs41, path60, size, from, count3) {
|
|
|
52643
52651
|
};
|
|
52644
52652
|
scan: while (position < size) {
|
|
52645
52653
|
const end = Math.min(size, position + CHUNK);
|
|
52646
|
-
pending += decoder.write(await fs41.readBytesSlice(
|
|
52654
|
+
pending += decoder.write(await fs41.readBytesSlice(path61, position, end));
|
|
52647
52655
|
position = end;
|
|
52648
52656
|
const parts = pending.split(/\r\n|\r|\n/);
|
|
52649
52657
|
pending = parts.pop() ?? "";
|
|
@@ -52666,13 +52674,13 @@ async function readLineWindow(fs41, path60, size, from, count3) {
|
|
|
52666
52674
|
hasMoreAfter: !reachedEnd || lineNumber > from + lines.length
|
|
52667
52675
|
};
|
|
52668
52676
|
}
|
|
52669
|
-
async function countLines(fs41,
|
|
52677
|
+
async function countLines(fs41, path61, size) {
|
|
52670
52678
|
let newlines = 0;
|
|
52671
52679
|
let position = 0;
|
|
52672
52680
|
let lastByte = -1;
|
|
52673
52681
|
while (position < size) {
|
|
52674
52682
|
const end = Math.min(size, position + CHUNK);
|
|
52675
|
-
const buffer = await fs41.readBytesSlice(
|
|
52683
|
+
const buffer = await fs41.readBytesSlice(path61, position, end);
|
|
52676
52684
|
for (const byte of buffer)
|
|
52677
52685
|
if (byte === 10)
|
|
52678
52686
|
newlines += 1;
|
|
@@ -57276,8 +57284,8 @@ async function random(size) {
|
|
|
57276
57284
|
const evenDistCutoff = Math.pow(2, 8) - Math.pow(2, 8) % mask.length;
|
|
57277
57285
|
let result = "";
|
|
57278
57286
|
while (result.length < size) {
|
|
57279
|
-
const
|
|
57280
|
-
for (const randomByte of
|
|
57287
|
+
const randomBytes4 = await getRandomValues(size - result.length);
|
|
57288
|
+
for (const randomByte of randomBytes4) {
|
|
57281
57289
|
if (randomByte < evenDistCutoff) {
|
|
57282
57290
|
result += mask[randomByte % mask.length];
|
|
57283
57291
|
}
|
|
@@ -60618,13 +60626,13 @@ function buildExport(config2, selected) {
|
|
|
60618
60626
|
if (has(config2, key2))
|
|
60619
60627
|
exported[key2] = config2[key2];
|
|
60620
60628
|
}
|
|
60621
|
-
for (const
|
|
60622
|
-
stripPath(exported,
|
|
60629
|
+
for (const path61 of section.strip ?? [])
|
|
60630
|
+
stripPath(exported, path61);
|
|
60623
60631
|
}
|
|
60624
60632
|
return exported;
|
|
60625
60633
|
}
|
|
60626
|
-
function stripPath(target,
|
|
60627
|
-
const [head, ...rest] =
|
|
60634
|
+
function stripPath(target, path61) {
|
|
60635
|
+
const [head, ...rest] = path61.split(".");
|
|
60628
60636
|
if (head === void 0)
|
|
60629
60637
|
return;
|
|
60630
60638
|
const value = target[head];
|
|
@@ -60652,14 +60660,14 @@ function applyImport(existing, imported, selected) {
|
|
|
60652
60660
|
else
|
|
60653
60661
|
delete merged[key2];
|
|
60654
60662
|
}
|
|
60655
|
-
for (const
|
|
60656
|
-
carryPath(existing, merged,
|
|
60663
|
+
for (const path61 of section.strip ?? []) {
|
|
60664
|
+
carryPath(existing, merged, path61);
|
|
60657
60665
|
}
|
|
60658
60666
|
}
|
|
60659
60667
|
return merged;
|
|
60660
60668
|
}
|
|
60661
|
-
function carryPath(from, to,
|
|
60662
|
-
const [head, ...rest] =
|
|
60669
|
+
function carryPath(from, to, path61) {
|
|
60670
|
+
const [head, ...rest] = path61.split(".");
|
|
60663
60671
|
if (head === void 0)
|
|
60664
60672
|
return;
|
|
60665
60673
|
const source = from[head];
|
|
@@ -62958,7 +62966,7 @@ The conversation is longer than this model accepts, and it could not be shortene
|
|
|
62958
62966
|
}
|
|
62959
62967
|
|
|
62960
62968
|
// ../../packages/core/dist/host/bridge.js
|
|
62961
|
-
var
|
|
62969
|
+
var import_node_crypto15 = require("node:crypto");
|
|
62962
62970
|
|
|
62963
62971
|
// ../../packages/core/dist/atlassian/autosysGateway.js
|
|
62964
62972
|
function withBasicCredentials(auth2, headerName, username, password) {
|
|
@@ -64243,6 +64251,109 @@ var FileMachineApprovals = class {
|
|
|
64243
64251
|
// ../../packages/core/dist/addons/discover.js
|
|
64244
64252
|
var import_promises18 = __toESM(require("node:fs/promises"), 1);
|
|
64245
64253
|
var import_node_path32 = __toESM(require("node:path"), 1);
|
|
64254
|
+
|
|
64255
|
+
// ../../packages/core/dist/addons/page.js
|
|
64256
|
+
var KEY = /^[a-zA-Z][a-zA-Z0-9_]{0,40}$/;
|
|
64257
|
+
var addonFieldSchema = external_exports.object({
|
|
64258
|
+
key: external_exports.string().regex(KEY),
|
|
64259
|
+
label: external_exports.string().min(1).max(80),
|
|
64260
|
+
type: external_exports.enum(["string", "number", "boolean", "choice", "secret", "path", "text"]),
|
|
64261
|
+
required: external_exports.boolean().optional(),
|
|
64262
|
+
default: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).optional(),
|
|
64263
|
+
options: external_exports.array(external_exports.object({ value: external_exports.string(), label: external_exports.string() })).max(30).optional(),
|
|
64264
|
+
placeholder: external_exports.string().max(200).optional(),
|
|
64265
|
+
help: external_exports.string().max(500).optional(),
|
|
64266
|
+
/** A pattern the value must match, with the sentence shown when it does not. */
|
|
64267
|
+
pattern: external_exports.string().max(200).optional(),
|
|
64268
|
+
patternMessage: external_exports.string().max(200).optional(),
|
|
64269
|
+
/** Shown only while another field of the same form has this value - auth fields by auth method. */
|
|
64270
|
+
showWhen: external_exports.object({ field: external_exports.string().regex(KEY), equals: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]) }).optional()
|
|
64271
|
+
});
|
|
64272
|
+
var addonPageSchema = external_exports.object({
|
|
64273
|
+
title: external_exports.string().min(1).max(40),
|
|
64274
|
+
description: external_exports.string().max(1e3).optional(),
|
|
64275
|
+
/** Settings of the add-on as a whole. */
|
|
64276
|
+
fields: external_exports.array(addonFieldSchema).max(30).optional(),
|
|
64277
|
+
/** A list of things the user adds - machines, sites, accounts. */
|
|
64278
|
+
records: external_exports.object({
|
|
64279
|
+
/** What one is called: "machine". */
|
|
64280
|
+
noun: external_exports.string().min(1).max(30),
|
|
64281
|
+
title: external_exports.string().min(1).max(40),
|
|
64282
|
+
description: external_exports.string().max(1e3).optional(),
|
|
64283
|
+
/** The field that names a record, unique among them: what the user and the agent call it. */
|
|
64284
|
+
keyField: external_exports.string().regex(KEY),
|
|
64285
|
+
/** One line under the name, e.g. "{username}@{host}:{port}". */
|
|
64286
|
+
summary: external_exports.string().max(200).optional(),
|
|
64287
|
+
fields: external_exports.array(addonFieldSchema).min(1).max(30),
|
|
64288
|
+
/**
|
|
64289
|
+
* Buttons on each record, each calling one of the add-on's own tools with `{ [keyField]: name }`
|
|
64290
|
+
* - "Test connection". Pressed by the user, about a record they are looking at, so it is not an
|
|
64291
|
+
* agent's tool call and asks no approval.
|
|
64292
|
+
*/
|
|
64293
|
+
actions: external_exports.array(external_exports.object({ label: external_exports.string().min(1).max(40), tool: external_exports.string().regex(/^[a-zA-Z0-9_-]{1,64}$/) })).max(5).optional(),
|
|
64294
|
+
max: external_exports.number().int().positive().max(500).optional()
|
|
64295
|
+
}).optional()
|
|
64296
|
+
});
|
|
64297
|
+
function addonSecretRef(pkg, recordId, field2) {
|
|
64298
|
+
return `addon:${pkg}:${recordId ?? "_"}:${field2}`;
|
|
64299
|
+
}
|
|
64300
|
+
function cleanAddonValues(fields, values) {
|
|
64301
|
+
const out = {};
|
|
64302
|
+
const effective = { ...values };
|
|
64303
|
+
for (const field2 of fields) {
|
|
64304
|
+
const given = values[field2.key];
|
|
64305
|
+
if ((given === void 0 || given === "" || given === null) && field2.default !== void 0)
|
|
64306
|
+
effective[field2.key] = field2.default;
|
|
64307
|
+
}
|
|
64308
|
+
for (const field2 of fields) {
|
|
64309
|
+
if (field2.type === "secret")
|
|
64310
|
+
continue;
|
|
64311
|
+
const value = effective[field2.key];
|
|
64312
|
+
if (!isShown(field2, effective))
|
|
64313
|
+
continue;
|
|
64314
|
+
if (value === void 0 || value === "") {
|
|
64315
|
+
if (field2.required === true)
|
|
64316
|
+
return { ok: false, message: `${field2.label} is required.` };
|
|
64317
|
+
continue;
|
|
64318
|
+
}
|
|
64319
|
+
switch (field2.type) {
|
|
64320
|
+
case "number": {
|
|
64321
|
+
const n = typeof value === "number" ? value : Number(String(value).trim());
|
|
64322
|
+
if (!Number.isFinite(n))
|
|
64323
|
+
return { ok: false, message: `${field2.label} must be a number.` };
|
|
64324
|
+
out[field2.key] = n;
|
|
64325
|
+
break;
|
|
64326
|
+
}
|
|
64327
|
+
case "boolean":
|
|
64328
|
+
out[field2.key] = value === true || value === "true";
|
|
64329
|
+
break;
|
|
64330
|
+
case "choice": {
|
|
64331
|
+
const text = String(value);
|
|
64332
|
+
if (!(field2.options ?? []).some((option) => option.value === text))
|
|
64333
|
+
return { ok: false, message: `${field2.label}: choose one of the options.` };
|
|
64334
|
+
out[field2.key] = text;
|
|
64335
|
+
break;
|
|
64336
|
+
}
|
|
64337
|
+
default: {
|
|
64338
|
+
const text = String(value).trim();
|
|
64339
|
+
if (field2.pattern !== void 0 && !new RegExp(field2.pattern).test(text)) {
|
|
64340
|
+
return { ok: false, message: field2.patternMessage ?? `${field2.label} is not in the expected form.` };
|
|
64341
|
+
}
|
|
64342
|
+
out[field2.key] = text;
|
|
64343
|
+
}
|
|
64344
|
+
}
|
|
64345
|
+
}
|
|
64346
|
+
return { ok: true, values: out };
|
|
64347
|
+
}
|
|
64348
|
+
function isShown(field2, values) {
|
|
64349
|
+
if (field2.showWhen === void 0)
|
|
64350
|
+
return true;
|
|
64351
|
+
const current = String(values[field2.showWhen.field] ?? "");
|
|
64352
|
+
const wanted = field2.showWhen.equals;
|
|
64353
|
+
return Array.isArray(wanted) ? wanted.includes(current) : current === wanted;
|
|
64354
|
+
}
|
|
64355
|
+
|
|
64356
|
+
// ../../packages/core/dist/addons/discover.js
|
|
64246
64357
|
function defaultAddonFolders(env2, execPath, platform) {
|
|
64247
64358
|
const folders = [];
|
|
64248
64359
|
const prefix = env2["npm_config_prefix"] ?? env2["NPM_CONFIG_PREFIX"];
|
|
@@ -64296,6 +64407,7 @@ async function readAddon(dir) {
|
|
|
64296
64407
|
const args = Array.isArray(fields["args"]) ? fields["args"].filter((arg) => typeof arg === "string") : [];
|
|
64297
64408
|
const displayName = typeof fields["displayName"] === "string" && fields["displayName"].trim().length > 0 ? fields["displayName"].trim() : pkg;
|
|
64298
64409
|
const description = typeof fields["description"] === "string" ? fields["description"] : typeof manifest["description"] === "string" ? manifest["description"] : void 0;
|
|
64410
|
+
const extras = await readPageAndIcon(dir, fields);
|
|
64299
64411
|
return {
|
|
64300
64412
|
package: pkg,
|
|
64301
64413
|
version: version2,
|
|
@@ -64304,9 +64416,64 @@ async function readAddon(dir) {
|
|
|
64304
64416
|
dir,
|
|
64305
64417
|
main,
|
|
64306
64418
|
args,
|
|
64307
|
-
server: addonServerName(pkg)
|
|
64419
|
+
server: addonServerName(pkg),
|
|
64420
|
+
...extras
|
|
64308
64421
|
};
|
|
64309
64422
|
}
|
|
64423
|
+
var ICON_MAX_BYTES = 64 * 1024;
|
|
64424
|
+
async function readPageAndIcon(dir, fields) {
|
|
64425
|
+
const out = {};
|
|
64426
|
+
const inside = (relative) => {
|
|
64427
|
+
const full = import_node_path32.default.resolve(dir, relative);
|
|
64428
|
+
const rel = import_node_path32.default.relative(dir, full);
|
|
64429
|
+
return rel.startsWith("..") || import_node_path32.default.isAbsolute(rel) ? void 0 : full;
|
|
64430
|
+
};
|
|
64431
|
+
const problems = [];
|
|
64432
|
+
if (typeof fields["icon"] === "string") {
|
|
64433
|
+
const file2 = inside(fields["icon"]);
|
|
64434
|
+
try {
|
|
64435
|
+
if (file2 === void 0)
|
|
64436
|
+
throw new Error("is outside the package folder");
|
|
64437
|
+
const bytes = await import_promises18.default.readFile(file2);
|
|
64438
|
+
const text = bytes.toString("utf8");
|
|
64439
|
+
if (bytes.length > ICON_MAX_BYTES)
|
|
64440
|
+
throw new Error("is larger than 64 KB");
|
|
64441
|
+
if (!/^\s*(<\?xml[^>]*>\s*)?(<!--[\s\S]*?-->\s*)*<svg[\s>]/i.test(text))
|
|
64442
|
+
throw new Error("is not an SVG file");
|
|
64443
|
+
out.icon = `data:image/svg+xml;base64,${bytes.toString("base64")}`;
|
|
64444
|
+
} catch (error51) {
|
|
64445
|
+
problems.push(`icon ${String(fields["icon"])} ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
64446
|
+
}
|
|
64447
|
+
}
|
|
64448
|
+
let declared = fields["settings"];
|
|
64449
|
+
if (typeof declared === "string") {
|
|
64450
|
+
const file2 = inside(declared);
|
|
64451
|
+
try {
|
|
64452
|
+
if (file2 === void 0)
|
|
64453
|
+
throw new Error("is outside the package folder");
|
|
64454
|
+
declared = JSON.parse((await import_promises18.default.readFile(file2, "utf8")).replace(/^\uFEFF/, ""));
|
|
64455
|
+
} catch (error51) {
|
|
64456
|
+
problems.push(`settings ${String(fields["settings"])} ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
64457
|
+
declared = void 0;
|
|
64458
|
+
}
|
|
64459
|
+
}
|
|
64460
|
+
if (declared !== void 0) {
|
|
64461
|
+
const parsed = addonPageSchema.safeParse(declared);
|
|
64462
|
+
if (parsed.success) {
|
|
64463
|
+
const page = parsed.data;
|
|
64464
|
+
const keys = page.records?.fields.map((field2) => field2.key) ?? [];
|
|
64465
|
+
if (page.records !== void 0 && !keys.includes(page.records.keyField))
|
|
64466
|
+
problems.push(`settings: keyField "${page.records.keyField}" is not one of its fields`);
|
|
64467
|
+
else
|
|
64468
|
+
out.page = page;
|
|
64469
|
+
} else {
|
|
64470
|
+
problems.push(`settings: ${parsed.error.issues.map((issue2) => `${issue2.path.join(".")} ${issue2.message}`).join("; ")}`);
|
|
64471
|
+
}
|
|
64472
|
+
}
|
|
64473
|
+
if (problems.length > 0)
|
|
64474
|
+
out.pageProblem = problems.join(". ");
|
|
64475
|
+
return out;
|
|
64476
|
+
}
|
|
64310
64477
|
async function discoverAddons(folders) {
|
|
64311
64478
|
const addons = [];
|
|
64312
64479
|
const problems = [];
|
|
@@ -64388,7 +64555,7 @@ function tagOf(entry) {
|
|
|
64388
64555
|
const tag = entry?.addon;
|
|
64389
64556
|
return typeof tag?.package === "string" && typeof tag.version === "string" ? { package: tag.package, version: tag.version } : void 0;
|
|
64390
64557
|
}
|
|
64391
|
-
function runnableServers(servers, addons, runtime, repositoryServers = []) {
|
|
64558
|
+
function runnableServers(servers, addons, runtime, repositoryServers = [], extraEnv = () => ({})) {
|
|
64392
64559
|
const out = {};
|
|
64393
64560
|
for (const [name, entry] of Object.entries(servers)) {
|
|
64394
64561
|
const tag = tagOf(entry);
|
|
@@ -64401,27 +64568,81 @@ function runnableServers(servers, addons, runtime, repositoryServers = []) {
|
|
|
64401
64568
|
out[name] = { ...entry, disabled: true };
|
|
64402
64569
|
continue;
|
|
64403
64570
|
}
|
|
64571
|
+
const env2 = { ...entry.env ?? {}, ...extraEnv(installed), ...runtime.electron ? { ELECTRON_RUN_AS_NODE: "1" } : {} };
|
|
64404
64572
|
out[name] = {
|
|
64405
64573
|
...entry,
|
|
64406
64574
|
command: runtime.execPath,
|
|
64407
64575
|
args: [installed.main, ...installed.args],
|
|
64408
64576
|
cwd: installed.dir,
|
|
64409
|
-
...
|
|
64577
|
+
...Object.keys(env2).length > 0 ? { env: env2 } : {}
|
|
64410
64578
|
};
|
|
64411
64579
|
}
|
|
64412
64580
|
return out;
|
|
64413
64581
|
}
|
|
64414
64582
|
|
|
64583
|
+
// ../../packages/core/dist/addons/delivery.js
|
|
64584
|
+
var import_node_crypto11 = require("node:crypto");
|
|
64585
|
+
var import_node_path33 = __toESM(require("node:path"), 1);
|
|
64586
|
+
var SETTINGS_ENV = "LIGHT_CODE_ADDON_SETTINGS";
|
|
64587
|
+
var DATA_ENV = "LIGHT_CODE_ADDON_DATA";
|
|
64588
|
+
var DOWNLOADS_ENV = "LIGHT_CODE_ADDON_DOWNLOADS";
|
|
64589
|
+
function addonDataDir(storageDir, addon) {
|
|
64590
|
+
return import_node_path33.default.join(storageDir, "addons", addon.server);
|
|
64591
|
+
}
|
|
64592
|
+
function addonDownloadsDir(storageDir, addon) {
|
|
64593
|
+
return import_node_path33.default.join(addonDataDir(storageDir, addon), "downloads");
|
|
64594
|
+
}
|
|
64595
|
+
function secretEnvName(ref) {
|
|
64596
|
+
return `LC_SECRET_${(0, import_node_crypto11.createHash)("sha256").update(ref).digest("hex").slice(0, 16).toUpperCase()}`;
|
|
64597
|
+
}
|
|
64598
|
+
function deliveryFor(storageDir, addon, settings, stored) {
|
|
64599
|
+
const dir = addonDataDir(storageDir, addon);
|
|
64600
|
+
const file2 = import_node_path33.default.join(dir, "settings.json");
|
|
64601
|
+
const env2 = {
|
|
64602
|
+
[SETTINGS_ENV]: file2,
|
|
64603
|
+
[DATA_ENV]: dir,
|
|
64604
|
+
[DOWNLOADS_ENV]: addonDownloadsDir(storageDir, addon)
|
|
64605
|
+
};
|
|
64606
|
+
const secrets = {};
|
|
64607
|
+
const secretFields = (owner) => ((owner === "record" ? addon.page?.records?.fields : addon.page?.fields) ?? []).filter((field2) => field2.type === "secret").map((field2) => field2.key);
|
|
64608
|
+
const give = (recordId, field2) => {
|
|
64609
|
+
const ref = addonSecretRef(addon.package, recordId, field2);
|
|
64610
|
+
if (!stored.has(ref))
|
|
64611
|
+
return;
|
|
64612
|
+
const name = secretEnvName(ref);
|
|
64613
|
+
env2[name] = `\${secret:${ref}}`;
|
|
64614
|
+
(secrets[recordId ?? "_"] ??= {})[field2] = name;
|
|
64615
|
+
};
|
|
64616
|
+
for (const field2 of secretFields("page"))
|
|
64617
|
+
give(void 0, field2);
|
|
64618
|
+
for (const record2 of settings?.records ?? [])
|
|
64619
|
+
for (const field2 of secretFields("record"))
|
|
64620
|
+
give(record2.id, field2);
|
|
64621
|
+
return { file: file2, contents: { values: settings?.values ?? {}, records: settings?.records ?? [], secrets }, env: env2 };
|
|
64622
|
+
}
|
|
64623
|
+
function possibleSecretRefs(addon, settings) {
|
|
64624
|
+
const refs = [];
|
|
64625
|
+
for (const field2 of addon.page?.fields ?? [])
|
|
64626
|
+
if (field2.type === "secret")
|
|
64627
|
+
refs.push(addonSecretRef(addon.package, void 0, field2.key));
|
|
64628
|
+
for (const record2 of settings?.records ?? []) {
|
|
64629
|
+
for (const field2 of addon.page?.records?.fields ?? [])
|
|
64630
|
+
if (field2.type === "secret")
|
|
64631
|
+
refs.push(addonSecretRef(addon.package, record2.id, field2.key));
|
|
64632
|
+
}
|
|
64633
|
+
return refs;
|
|
64634
|
+
}
|
|
64635
|
+
|
|
64415
64636
|
// ../../packages/core/dist/agent/codebaseInstructions.js
|
|
64416
|
-
var
|
|
64637
|
+
var import_node_crypto13 = require("node:crypto");
|
|
64417
64638
|
var import_promises19 = __toESM(require("node:fs/promises"), 1);
|
|
64418
|
-
var
|
|
64639
|
+
var import_node_path35 = __toESM(require("node:path"), 1);
|
|
64419
64640
|
|
|
64420
64641
|
// ../../packages/core/dist/usage/events.js
|
|
64421
|
-
var
|
|
64642
|
+
var import_node_crypto12 = require("node:crypto");
|
|
64422
64643
|
var import_node_fs5 = require("node:fs");
|
|
64423
64644
|
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
64424
|
-
var
|
|
64645
|
+
var import_node_path34 = __toESM(require("node:path"), 1);
|
|
64425
64646
|
function isUsageEvent(value) {
|
|
64426
64647
|
if (value === null || typeof value !== "object")
|
|
64427
64648
|
return false;
|
|
@@ -64446,12 +64667,12 @@ function usageDay(t) {
|
|
|
64446
64667
|
return new Date(t).toISOString().slice(0, 10);
|
|
64447
64668
|
}
|
|
64448
64669
|
function usageInstanceId(storageDir) {
|
|
64449
|
-
return (0,
|
|
64450
|
-
${
|
|
64670
|
+
return (0, import_node_crypto12.createHash)("sha256").update(`${import_node_os5.default.hostname()}
|
|
64671
|
+
${import_node_path34.default.resolve(storageDir).toLowerCase()}`).digest("hex").slice(0, 12);
|
|
64451
64672
|
}
|
|
64452
64673
|
async function writeFileAtomically(target, text) {
|
|
64453
|
-
await import_node_fs5.promises.mkdir(
|
|
64454
|
-
const temporary = `${target}.${(0,
|
|
64674
|
+
await import_node_fs5.promises.mkdir(import_node_path34.default.dirname(target), { recursive: true });
|
|
64675
|
+
const temporary = `${target}.${(0, import_node_crypto12.randomBytes)(6).toString("hex")}.tmp`;
|
|
64455
64676
|
await import_node_fs5.promises.writeFile(temporary, text, "utf8");
|
|
64456
64677
|
try {
|
|
64457
64678
|
await replaceFile(temporary, target);
|
|
@@ -64469,15 +64690,15 @@ var UsageLog = class {
|
|
|
64469
64690
|
session;
|
|
64470
64691
|
constructor(storageDir, session) {
|
|
64471
64692
|
this.storageDir = storageDir;
|
|
64472
|
-
this.queueDir =
|
|
64473
|
-
this.manifestFile =
|
|
64474
|
-
this.rolledFile =
|
|
64475
|
-
this.legacyFile =
|
|
64476
|
-
this.session = session ?? (0,
|
|
64693
|
+
this.queueDir = import_node_path34.default.join(storageDir, "usage", "queue");
|
|
64694
|
+
this.manifestFile = import_node_path34.default.join(storageDir, "usage", "pushed.json");
|
|
64695
|
+
this.rolledFile = import_node_path34.default.join(storageDir, "usage", "rolled.json");
|
|
64696
|
+
this.legacyFile = import_node_path34.default.join(storageDir, "usage-events.jsonl");
|
|
64697
|
+
this.session = session ?? (0, import_node_crypto12.randomBytes)(6).toString("hex");
|
|
64477
64698
|
}
|
|
64478
64699
|
async append(event) {
|
|
64479
64700
|
await import_node_fs5.promises.mkdir(this.queueDir, { recursive: true });
|
|
64480
|
-
await import_node_fs5.promises.appendFile(
|
|
64701
|
+
await import_node_fs5.promises.appendFile(import_node_path34.default.join(this.queueDir, `${usageDay(event.t)}__${this.session}.jsonl`), `${JSON.stringify(event)}
|
|
64481
64702
|
`, "utf8");
|
|
64482
64703
|
}
|
|
64483
64704
|
/**
|
|
@@ -64485,7 +64706,7 @@ var UsageLog = class {
|
|
|
64485
64706
|
* never appended, so two sessions importing at once leave one copy rather than two.
|
|
64486
64707
|
*/
|
|
64487
64708
|
async writeFixed(day, name, events) {
|
|
64488
|
-
await writeFileAtomically(
|
|
64709
|
+
await writeFileAtomically(import_node_path34.default.join(this.queueDir, `${day}__${name}.jsonl`), events.map((event) => JSON.stringify(event)).join("\n") + (events.length > 0 ? "\n" : ""));
|
|
64489
64710
|
}
|
|
64490
64711
|
/**
|
|
64491
64712
|
* Moves a 0.156/0.157 single queue file into the per-day layout, once. Deterministic names, so two
|
|
@@ -64505,7 +64726,7 @@ var UsageLog = class {
|
|
|
64505
64726
|
for (const [day, events] of byDay)
|
|
64506
64727
|
await this.writeFixed(day, "legacy", events);
|
|
64507
64728
|
await import_node_fs5.promises.rename(this.legacyFile, `${this.legacyFile}.migrated`).catch(() => void 0);
|
|
64508
|
-
await import_node_fs5.promises.rm(
|
|
64729
|
+
await import_node_fs5.promises.rm(import_node_path34.default.join(this.storageDir, "usage-sync.json"), { force: true }).catch(() => void 0);
|
|
64509
64730
|
}
|
|
64510
64731
|
/** Every day with local files, and its signature. */
|
|
64511
64732
|
async days() {
|
|
@@ -64520,7 +64741,7 @@ var UsageLog = class {
|
|
|
64520
64741
|
const match = QUEUE_FILE.exec(name);
|
|
64521
64742
|
if (match === null)
|
|
64522
64743
|
continue;
|
|
64523
|
-
const size = await import_node_fs5.promises.stat(
|
|
64744
|
+
const size = await import_node_fs5.promises.stat(import_node_path34.default.join(this.queueDir, name)).then((stat) => stat.size).catch(() => void 0);
|
|
64524
64745
|
if (size === void 0)
|
|
64525
64746
|
continue;
|
|
64526
64747
|
const entry = days.get(match[1]) ?? { files: [], signature: "" };
|
|
@@ -64542,7 +64763,7 @@ var UsageLog = class {
|
|
|
64542
64763
|
const entry = (await this.days()).get(day);
|
|
64543
64764
|
if (entry === void 0)
|
|
64544
64765
|
return [];
|
|
64545
|
-
const texts = await Promise.all(entry.files.map((file2) => import_node_fs5.promises.readFile(
|
|
64766
|
+
const texts = await Promise.all(entry.files.map((file2) => import_node_fs5.promises.readFile(import_node_path34.default.join(this.queueDir, file2.name), "utf8").catch(() => "")));
|
|
64546
64767
|
return texts.flatMap(parseUsageLines).sort((a, b) => a.t - b.t);
|
|
64547
64768
|
}
|
|
64548
64769
|
/** Every queued event (the last few weeks), for finding names worth looking up. */
|
|
@@ -64589,7 +64810,7 @@ var UsageLog = class {
|
|
|
64589
64810
|
if (day >= cutoff || pushed[day] !== entry.signature)
|
|
64590
64811
|
continue;
|
|
64591
64812
|
for (const file2 of entry.files) {
|
|
64592
|
-
await import_node_fs5.promises.rm(
|
|
64813
|
+
await import_node_fs5.promises.rm(import_node_path34.default.join(this.queueDir, file2.name), { force: true }).catch(() => void 0);
|
|
64593
64814
|
removed++;
|
|
64594
64815
|
}
|
|
64595
64816
|
}
|
|
@@ -64602,14 +64823,14 @@ var CODEBASE_INSTRUCTIONS_FILE = "codebase-instructions.md";
|
|
|
64602
64823
|
var CODEBASE_INSTRUCTIONS_LIMIT = 2e4;
|
|
64603
64824
|
function codebaseInstructionsPath(options) {
|
|
64604
64825
|
if (options.codebaseDir !== void 0)
|
|
64605
|
-
return
|
|
64826
|
+
return import_node_path35.default.join(options.codebaseDir, "instructions", CODEBASE_INSTRUCTIONS_FILE);
|
|
64606
64827
|
if (options.workspaceRoot === void 0)
|
|
64607
64828
|
return void 0;
|
|
64608
|
-
const resolved =
|
|
64829
|
+
const resolved = import_node_path35.default.resolve(options.workspaceRoot);
|
|
64609
64830
|
const key2 = process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
64610
|
-
const digest = (0,
|
|
64611
|
-
const slug =
|
|
64612
|
-
return
|
|
64831
|
+
const digest = (0, import_node_crypto13.createHash)("sha256").update(key2).digest("hex").slice(0, 12);
|
|
64832
|
+
const slug = import_node_path35.default.basename(resolved).toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "workspace";
|
|
64833
|
+
return import_node_path35.default.join(options.storageDir, "codebases", `${slug}-${digest}`, CODEBASE_INSTRUCTIONS_FILE);
|
|
64613
64834
|
}
|
|
64614
64835
|
async function readCodebaseInstructions(file2) {
|
|
64615
64836
|
if (file2 === void 0)
|
|
@@ -64709,7 +64930,7 @@ async function readToolCredential(options) {
|
|
|
64709
64930
|
|
|
64710
64931
|
// ../../packages/core/dist/jupyter/tools.js
|
|
64711
64932
|
var import_promises21 = __toESM(require("node:fs/promises"), 1);
|
|
64712
|
-
var
|
|
64933
|
+
var import_node_path36 = __toESM(require("node:path"), 1);
|
|
64713
64934
|
var RUN_DEFAULT_SECONDS = 300;
|
|
64714
64935
|
var SCRIPT_PREVIEW_CHARS = 6e3;
|
|
64715
64936
|
var runSchema = external_exports.object({
|
|
@@ -64933,7 +65154,7 @@ ${pending.map((p) => `- ${p.local} (${p.kind}${p.kind === "deleted" ? " here; st
|
|
|
64933
65154
|
for (const file2 of pending.files) {
|
|
64934
65155
|
const result = await runtime.mirror.push(file2, context.signal);
|
|
64935
65156
|
failed2 ||= !result.saved && result.ignored !== true;
|
|
64936
|
-
lines.push(`- ${
|
|
65157
|
+
lines.push(`- ${import_node_path36.default.relative(runtime.mirror.root, file2).split(import_node_path36.default.sep).join("/")}: ${result.message}`);
|
|
64937
65158
|
}
|
|
64938
65159
|
return { content: lines.length > 0 ? lines.join("\n") : "Nothing to save.", ...failed2 ? { isError: true } : {} };
|
|
64939
65160
|
}
|
|
@@ -64972,7 +65193,7 @@ async function pendingFor(runtime, context, target) {
|
|
|
64972
65193
|
const pending = (await runtime.mirror.pending()).filter((p) => p.kind !== "deleted");
|
|
64973
65194
|
return {
|
|
64974
65195
|
ok: true,
|
|
64975
|
-
files: pending.map((p) =>
|
|
65196
|
+
files: pending.map((p) => import_node_path36.default.join(runtime.mirror.root, ...p.local.split("/"))),
|
|
64976
65197
|
changes: pending.map((p) => `${p.local} \u2192 ${p.remote} (${p.kind})`)
|
|
64977
65198
|
};
|
|
64978
65199
|
}
|
|
@@ -65022,7 +65243,7 @@ if __SOURCE__:
|
|
|
65022
65243
|
`;
|
|
65023
65244
|
|
|
65024
65245
|
// ../../packages/core/dist/jupyter/hubGit.js
|
|
65025
|
-
var
|
|
65246
|
+
var import_node_path37 = __toESM(require("node:path"), 1);
|
|
65026
65247
|
var MARKER = "__LC_HUBGIT__";
|
|
65027
65248
|
var LISTED = 40;
|
|
65028
65249
|
var py2 = (value) => JSON.stringify(value);
|
|
@@ -65137,7 +65358,7 @@ async function hubGitStatus(runtime, signal) {
|
|
|
65137
65358
|
total.upstream &&= one.upstream;
|
|
65138
65359
|
if (total.branch === void 0 && one.branch !== void 0)
|
|
65139
65360
|
total.branch = one.branch;
|
|
65140
|
-
const prefix = results.length > 1 ? `${
|
|
65361
|
+
const prefix = results.length > 1 ? `${import_node_path37.default.posix.basename(repo.repo)}/` : "";
|
|
65141
65362
|
for (const file2 of one.files)
|
|
65142
65363
|
if (total.files.length < LISTED)
|
|
65143
65364
|
total.files.push(`${file2.slice(0, 2)}${prefix}${file2.slice(2)}`);
|
|
@@ -65150,7 +65371,7 @@ async function hubGitCommitPush(runtime, message4, signal) {
|
|
|
65150
65371
|
return { ok: false, text: "Write a commit message first." };
|
|
65151
65372
|
const pending = await runtime.mirror.pending();
|
|
65152
65373
|
for (const change of pending.filter((p) => p.kind !== "deleted")) {
|
|
65153
|
-
const saved = await runtime.mirror.push(
|
|
65374
|
+
const saved = await runtime.mirror.push(import_node_path37.default.join(runtime.mirror.root, ...change.local.split("/")), signal);
|
|
65154
65375
|
if (!saved.saved)
|
|
65155
65376
|
return { ok: false, text: `Nothing was committed: ${change.local} could not be saved to the hub first (${saved.message}).` };
|
|
65156
65377
|
}
|
|
@@ -65163,7 +65384,7 @@ async function hubGitCommitPush(runtime, message4, signal) {
|
|
|
65163
65384
|
const lines = [];
|
|
65164
65385
|
let ok = true;
|
|
65165
65386
|
for (const repo of results) {
|
|
65166
|
-
const name = results.length > 1 ? `${
|
|
65387
|
+
const name = results.length > 1 ? `${import_node_path37.default.posix.basename(repo.repo)}: ` : "";
|
|
65167
65388
|
const committed = repo.commit?.ok === true;
|
|
65168
65389
|
const nothing = /nothing to commit/.test(`${repo.commit?.out ?? ""}${repo.commit?.err ?? ""}`);
|
|
65169
65390
|
if (repo.add?.ok !== true) {
|
|
@@ -65193,7 +65414,7 @@ async function hubGitPull(runtime, signal) {
|
|
|
65193
65414
|
const lines = [];
|
|
65194
65415
|
let ok = true;
|
|
65195
65416
|
for (const repo of results) {
|
|
65196
|
-
const name = results.length > 1 ? `${
|
|
65417
|
+
const name = results.length > 1 ? `${import_node_path37.default.posix.basename(repo.repo)}: ` : "";
|
|
65197
65418
|
const all = `${repo.pull?.out ?? ""}${repo.pull?.err ?? ""}`;
|
|
65198
65419
|
if (repo.pull?.ok === true)
|
|
65199
65420
|
lines.push(`${name}${/Already up.to.date/i.test(all) ? "Already up to date." : "Pulled on the hub."}`);
|
|
@@ -65375,7 +65596,7 @@ function pick2(hubs, name) {
|
|
|
65375
65596
|
|
|
65376
65597
|
// ../../packages/core/dist/host/bridge.js
|
|
65377
65598
|
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
65378
|
-
var
|
|
65599
|
+
var import_node_path50 = __toESM(require("node:path"), 1);
|
|
65379
65600
|
|
|
65380
65601
|
// ../../packages/core/dist/modes/autoGuidance.js
|
|
65381
65602
|
function idiomsFor(environment) {
|
|
@@ -65471,7 +65692,7 @@ function buildAutoGuidance(environment) {
|
|
|
65471
65692
|
|
|
65472
65693
|
// ../../packages/core/dist/migrate/folders.js
|
|
65473
65694
|
var import_promises22 = __toESM(require("node:fs/promises"), 1);
|
|
65474
|
-
var
|
|
65695
|
+
var import_node_path38 = __toESM(require("node:path"), 1);
|
|
65475
65696
|
function nameOf(entry, kind) {
|
|
65476
65697
|
return kind === "skills" ? entry.replace(/\.md$/i, "") : entry.replace(/\.py$/i, "");
|
|
65477
65698
|
}
|
|
@@ -65496,7 +65717,7 @@ async function namesAt(dir, kind) {
|
|
|
65496
65717
|
if (kind === "skills") {
|
|
65497
65718
|
if (entry.toLowerCase().endsWith(".md"))
|
|
65498
65719
|
found2.add(nameOf(entry, kind));
|
|
65499
|
-
else if (await isDirectory(
|
|
65720
|
+
else if (await isDirectory(import_node_path38.default.join(dir, entry)))
|
|
65500
65721
|
found2.add(entry);
|
|
65501
65722
|
} else if (entry.toLowerCase().endsWith(".py")) {
|
|
65502
65723
|
found2.add(nameOf(entry, kind));
|
|
@@ -65508,7 +65729,7 @@ async function planMigration(options) {
|
|
|
65508
65729
|
const { from, to, kind } = options;
|
|
65509
65730
|
const copy = [];
|
|
65510
65731
|
const skip = [];
|
|
65511
|
-
if (
|
|
65732
|
+
if (import_node_path38.default.resolve(from) === import_node_path38.default.resolve(to))
|
|
65512
65733
|
return { copy, skip };
|
|
65513
65734
|
const existing = await namesAt(to, kind);
|
|
65514
65735
|
let entries;
|
|
@@ -65520,14 +65741,14 @@ async function planMigration(options) {
|
|
|
65520
65741
|
for (const entry of entries) {
|
|
65521
65742
|
if (entry.startsWith("."))
|
|
65522
65743
|
continue;
|
|
65523
|
-
const source =
|
|
65744
|
+
const source = import_node_path38.default.join(from, entry);
|
|
65524
65745
|
const directory = await isDirectory(source);
|
|
65525
65746
|
if (kind === "skills") {
|
|
65526
65747
|
if (!directory && !entry.toLowerCase().endsWith(".md"))
|
|
65527
65748
|
continue;
|
|
65528
65749
|
if (directory) {
|
|
65529
65750
|
try {
|
|
65530
|
-
await import_promises22.default.stat(
|
|
65751
|
+
await import_promises22.default.stat(import_node_path38.default.join(source, "SKILL.md"));
|
|
65531
65752
|
} catch {
|
|
65532
65753
|
continue;
|
|
65533
65754
|
}
|
|
@@ -65540,7 +65761,7 @@ async function planMigration(options) {
|
|
|
65540
65761
|
skip.push(name);
|
|
65541
65762
|
continue;
|
|
65542
65763
|
}
|
|
65543
|
-
copy.push({ name, source, destination:
|
|
65764
|
+
copy.push({ name, source, destination: import_node_path38.default.join(to, entry), directory });
|
|
65544
65765
|
}
|
|
65545
65766
|
copy.sort((a, b) => a.name.localeCompare(b.name));
|
|
65546
65767
|
skip.sort();
|
|
@@ -65551,7 +65772,7 @@ async function runMigration(plan2) {
|
|
|
65551
65772
|
const failed2 = [];
|
|
65552
65773
|
for (const item of plan2.copy) {
|
|
65553
65774
|
try {
|
|
65554
|
-
await import_promises22.default.mkdir(
|
|
65775
|
+
await import_promises22.default.mkdir(import_node_path38.default.dirname(item.destination), { recursive: true });
|
|
65555
65776
|
await import_promises22.default.cp(item.source, item.destination, {
|
|
65556
65777
|
recursive: item.directory,
|
|
65557
65778
|
force: false,
|
|
@@ -65578,7 +65799,7 @@ function describeMigration(result, kind) {
|
|
|
65578
65799
|
|
|
65579
65800
|
// ../../packages/core/dist/platform/node/shell.js
|
|
65580
65801
|
var import_node_fs6 = __toESM(require("node:fs"), 1);
|
|
65581
|
-
var
|
|
65802
|
+
var import_node_path39 = __toESM(require("node:path"), 1);
|
|
65582
65803
|
function windowsExtensions(env2) {
|
|
65583
65804
|
const raw = env2["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD";
|
|
65584
65805
|
return raw.split(";").filter((entry) => entry.length > 0);
|
|
@@ -65592,7 +65813,7 @@ function onPath(name, env2 = process.env) {
|
|
|
65592
65813
|
continue;
|
|
65593
65814
|
for (const extension of extensions) {
|
|
65594
65815
|
try {
|
|
65595
|
-
const candidate =
|
|
65816
|
+
const candidate = import_node_path39.default.join(directory, name + extension);
|
|
65596
65817
|
if (import_node_fs6.default.statSync(candidate).isFile())
|
|
65597
65818
|
return true;
|
|
65598
65819
|
} catch {
|
|
@@ -65614,7 +65835,7 @@ function resolveShell(configured, env2 = process.env) {
|
|
|
65614
65835
|
return { command: void 0, kind: "posix", label: env2["SHELL"] ?? "/bin/sh" };
|
|
65615
65836
|
}
|
|
65616
65837
|
function kindOf(command) {
|
|
65617
|
-
const base =
|
|
65838
|
+
const base = import_node_path39.default.basename(command).toLowerCase().replace(/\.exe$/, "");
|
|
65618
65839
|
if (base === "pwsh")
|
|
65619
65840
|
return "pwsh";
|
|
65620
65841
|
if (base === "powershell")
|
|
@@ -65624,7 +65845,7 @@ function kindOf(command) {
|
|
|
65624
65845
|
return "posix";
|
|
65625
65846
|
}
|
|
65626
65847
|
function labelFor(command) {
|
|
65627
|
-
const base =
|
|
65848
|
+
const base = import_node_path39.default.basename(command).toLowerCase().replace(/\.exe$/, "");
|
|
65628
65849
|
if (base === "pwsh")
|
|
65629
65850
|
return "PowerShell 7 (pwsh)";
|
|
65630
65851
|
if (base === "powershell")
|
|
@@ -65706,7 +65927,7 @@ function fastFsCapabilities(exe, timeoutMs = 5e3) {
|
|
|
65706
65927
|
var import_node_child_process9 = require("node:child_process");
|
|
65707
65928
|
|
|
65708
65929
|
// ../../packages/core/dist/tools/readStamps.js
|
|
65709
|
-
var
|
|
65930
|
+
var import_node_path40 = __toESM(require("node:path"), 1);
|
|
65710
65931
|
async function stamp(context, realPath) {
|
|
65711
65932
|
try {
|
|
65712
65933
|
const s = await context.fs.stat(realPath);
|
|
@@ -65751,14 +65972,14 @@ async function staleFilesNamedIn(context, command) {
|
|
|
65751
65972
|
};
|
|
65752
65973
|
const stale = [];
|
|
65753
65974
|
for (const [key2, known] of context.readStamps) {
|
|
65754
|
-
const relative =
|
|
65755
|
-
const names = [key2, relative, relative.split(
|
|
65975
|
+
const relative = import_node_path40.default.relative(root, key2);
|
|
65976
|
+
const names = [key2, relative, relative.split(import_node_path40.default.sep).join("/"), import_node_path40.default.basename(key2)].map((n) => n.toLowerCase());
|
|
65756
65977
|
if (!names.some(stands))
|
|
65757
65978
|
continue;
|
|
65758
65979
|
try {
|
|
65759
65980
|
const s = await context.fs.stat(key2);
|
|
65760
65981
|
if (`${String(s.mtimeMs)}:${String(s.size)}` !== known)
|
|
65761
|
-
stale.push(relative.split(
|
|
65982
|
+
stale.push(relative.split(import_node_path40.default.sep).join("/"));
|
|
65762
65983
|
} catch {
|
|
65763
65984
|
}
|
|
65764
65985
|
}
|
|
@@ -67239,8 +67460,8 @@ var ChangeLedger = class {
|
|
|
67239
67460
|
this.chat = chat;
|
|
67240
67461
|
}
|
|
67241
67462
|
/** Best effort: a ledger that cannot be written must never fail an edit that happened. */
|
|
67242
|
-
record(
|
|
67243
|
-
const line = JSON.stringify({ chat: this.chat, path: normalizeForComparison(
|
|
67463
|
+
record(path61) {
|
|
67464
|
+
const line = JSON.stringify({ chat: this.chat, path: normalizeForComparison(path61), at: Date.now() });
|
|
67244
67465
|
void (0, import_promises23.appendFile)(this.file, `${line}
|
|
67245
67466
|
`).catch(() => void 0);
|
|
67246
67467
|
}
|
|
@@ -67288,7 +67509,7 @@ var RecordedChanges = class extends Set {
|
|
|
67288
67509
|
// ../../packages/core/dist/office/bridge.js
|
|
67289
67510
|
var import_node_child_process11 = require("node:child_process");
|
|
67290
67511
|
var import_promises24 = __toESM(require("node:fs/promises"), 1);
|
|
67291
|
-
var
|
|
67512
|
+
var import_node_path41 = __toESM(require("node:path"), 1);
|
|
67292
67513
|
|
|
67293
67514
|
// ../../packages/core/dist/office/workerSource.js
|
|
67294
67515
|
var OFFICE_WORKER_SOURCE = `# Light Code office worker.
|
|
@@ -70022,7 +70243,7 @@ var OfficeBridge = class {
|
|
|
70022
70243
|
return this.starting;
|
|
70023
70244
|
}
|
|
70024
70245
|
async start() {
|
|
70025
|
-
const target =
|
|
70246
|
+
const target = import_node_path41.default.join(this.options.storageDir, "office-worker.ps1");
|
|
70026
70247
|
await import_promises24.default.mkdir(this.options.storageDir, { recursive: true });
|
|
70027
70248
|
const BOM = "\uFEFF";
|
|
70028
70249
|
await import_promises24.default.writeFile(target, `${BOM}${OFFICE_WORKER_SOURCE}`, "utf8");
|
|
@@ -70528,8 +70749,8 @@ function createDeleteRoleTool(access) {
|
|
|
70528
70749
|
}
|
|
70529
70750
|
|
|
70530
70751
|
// ../../packages/core/dist/rag/indexNaming.js
|
|
70531
|
-
var
|
|
70532
|
-
var
|
|
70752
|
+
var import_node_crypto14 = __toESM(require("node:crypto"), 1);
|
|
70753
|
+
var import_node_path42 = __toESM(require("node:path"), 1);
|
|
70533
70754
|
var DEFAULT_INDEX_PREFIX = "light-code";
|
|
70534
70755
|
var DOMAIN_OR_PATH = /[\\/]/;
|
|
70535
70756
|
function normaliseOwner(owner) {
|
|
@@ -70544,15 +70765,15 @@ function ownerSlug(owner) {
|
|
|
70544
70765
|
function deriveIndexName(input) {
|
|
70545
70766
|
const prefix = input.prefix ?? DEFAULT_INDEX_PREFIX;
|
|
70546
70767
|
const slug = ownerSlug(input.owner);
|
|
70547
|
-
const root =
|
|
70768
|
+
const root = import_node_path42.default.resolve(input.workspaceRoot).toLowerCase();
|
|
70548
70769
|
const identity = input.owner === void 0 ? "" : normaliseOwner(input.owner);
|
|
70549
|
-
const digest =
|
|
70770
|
+
const digest = import_node_crypto14.default.createHash("sha256").update(`${identity}\0${root}`).digest("hex").slice(0, 16);
|
|
70550
70771
|
const base = slug === void 0 ? `${prefix}-${digest}` : `${prefix}-${slug}-${digest}`;
|
|
70551
70772
|
return input.project === void 0 ? base : `${input.project}-${base}`;
|
|
70552
70773
|
}
|
|
70553
70774
|
|
|
70554
70775
|
// ../../packages/core/dist/tools/exportConfig.js
|
|
70555
|
-
var
|
|
70776
|
+
var import_node_path43 = __toESM(require("node:path"), 1);
|
|
70556
70777
|
var sectionIds = SHARE_SECTIONS.map((section) => section.id);
|
|
70557
70778
|
var paramsSchema11 = external_exports.object({
|
|
70558
70779
|
path: external_exports.string().min(1).describe('Where to write it in the workspace, e.g. "onboarding/light-code-team.json".'),
|
|
@@ -70592,7 +70813,7 @@ function createExportConfigTool(options) {
|
|
|
70592
70813
|
if (!resolved.ok)
|
|
70593
70814
|
return { content: resolved.message, isError: true };
|
|
70594
70815
|
const { json: json2, notes } = prepare(await options.loadConfig(), params3);
|
|
70595
|
-
await context.fs.mkdir(
|
|
70816
|
+
await context.fs.mkdir(import_node_path43.default.dirname(resolved.realPath));
|
|
70596
70817
|
await context.fs.writeFile(resolved.realPath, json2);
|
|
70597
70818
|
return { content: `Wrote ${params3.path}. ${notes}`, path: resolved.realPath };
|
|
70598
70819
|
}
|
|
@@ -70761,7 +70982,7 @@ function describeAtlassianFailure(product, doing, status2, body) {
|
|
|
70761
70982
|
}
|
|
70762
70983
|
|
|
70763
70984
|
// ../../packages/core/dist/atlassian/uploads.js
|
|
70764
|
-
var
|
|
70985
|
+
var import_node_path44 = __toESM(require("node:path"), 1);
|
|
70765
70986
|
|
|
70766
70987
|
// ../../packages/core/dist/diagrams/layout.js
|
|
70767
70988
|
var NODE_HEIGHT = 52;
|
|
@@ -71403,7 +71624,7 @@ async function prepareUploads(params3, context) {
|
|
|
71403
71624
|
const resolved = await resolveToolPath(context, attachment.path);
|
|
71404
71625
|
if (!resolved.ok)
|
|
71405
71626
|
return { ok: false, message: resolved.message };
|
|
71406
|
-
const name = attachment.name ??
|
|
71627
|
+
const name = attachment.name ?? import_node_path44.default.basename(resolved.realPath);
|
|
71407
71628
|
const problem = claim(name);
|
|
71408
71629
|
if (problem !== void 0)
|
|
71409
71630
|
return { ok: false, message: problem };
|
|
@@ -71587,10 +71808,10 @@ function isSafeSegment(value) {
|
|
|
71587
71808
|
function isSafeTagName(name) {
|
|
71588
71809
|
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("."));
|
|
71589
71810
|
}
|
|
71590
|
-
function encodeRepoPath(
|
|
71591
|
-
const segments =
|
|
71811
|
+
function encodeRepoPath(path61) {
|
|
71812
|
+
const segments = path61.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0);
|
|
71592
71813
|
if (segments.length === 0 || segments.some((segment) => segment === ".." || segment === ".")) {
|
|
71593
|
-
throw new AtlassianError(`"${
|
|
71814
|
+
throw new AtlassianError(`"${path61}" is not a file path inside the repository.`);
|
|
71594
71815
|
}
|
|
71595
71816
|
return segments.map(encodeURIComponent).join("/");
|
|
71596
71817
|
}
|
|
@@ -71675,24 +71896,24 @@ var BitbucketClient = class {
|
|
|
71675
71896
|
* redirect was followed, the login page came back, and the file "could not be read" although
|
|
71676
71897
|
* pull requests on the same repository could. `browse` is REST, so it authenticates like those.
|
|
71677
71898
|
*/
|
|
71678
|
-
async file(repo,
|
|
71679
|
-
const target = encodeRepoPath(
|
|
71899
|
+
async file(repo, path61, ref, signal) {
|
|
71900
|
+
const target = encodeRepoPath(path61);
|
|
71680
71901
|
const lines = [];
|
|
71681
71902
|
let start = 0;
|
|
71682
71903
|
for (let page = 0; page < MAX_FILE_PAGES; page += 1) {
|
|
71683
71904
|
const query = new URLSearchParams({ start: String(start), limit: String(FILE_PAGE_LINES) });
|
|
71684
71905
|
if (ref !== void 0 && ref.length > 0)
|
|
71685
71906
|
query.set("at", ref);
|
|
71686
|
-
const body = await this.rest.json(`reading ${
|
|
71907
|
+
const body = await this.rest.json(`reading ${path61}`, `${this.repoPath(repo)}/browse/${target}?${query.toString()}`, { method: "GET" }, signal);
|
|
71687
71908
|
if (body.children !== void 0) {
|
|
71688
71909
|
const names = (body.children.values ?? []).map((child) => {
|
|
71689
71910
|
const name = child.path?.toString ?? child.path?.name ?? "?";
|
|
71690
71911
|
return child.type === "DIRECTORY" ? `${name}/` : name;
|
|
71691
71912
|
});
|
|
71692
|
-
throw new AtlassianError(`${
|
|
71913
|
+
throw new AtlassianError(`${path61} is a folder, not a file. It holds: ${names.join(", ") || "nothing"}.`);
|
|
71693
71914
|
}
|
|
71694
71915
|
if (body.binary === true)
|
|
71695
|
-
throw new AtlassianError(`${
|
|
71916
|
+
throw new AtlassianError(`${path61} is a binary file, so there is no text to read.`);
|
|
71696
71917
|
for (const line of body.lines ?? [])
|
|
71697
71918
|
lines.push(line.text ?? "");
|
|
71698
71919
|
if (body.isLastPage !== false || body.nextPageStart === void 0 || body.nextPageStart <= start)
|
|
@@ -72270,8 +72491,8 @@ ${text.slice(-2e4)}`);
|
|
|
72270
72491
|
}
|
|
72271
72492
|
/** Queues a build, then follows the queue item briefly to learn its number. */
|
|
72272
72493
|
async startBuild(job, parameters, signal) {
|
|
72273
|
-
const
|
|
72274
|
-
const response = await this.post(`starting ${job}`, parameters !== void 0 && Object.keys(parameters).length > 0 ? `${
|
|
72494
|
+
const path61 = jobPath(job, this.base);
|
|
72495
|
+
const response = await this.post(`starting ${job}`, parameters !== void 0 && Object.keys(parameters).length > 0 ? `${path61}/buildWithParameters` : `${path61}/build`, parameters ?? {}, signal);
|
|
72275
72496
|
const location = response.headers["location"];
|
|
72276
72497
|
const queueId = location === void 0 ? void 0 : /\/queue\/item\/(\d+)/.exec(location)?.[1];
|
|
72277
72498
|
if (queueId === void 0)
|
|
@@ -72597,14 +72818,14 @@ ${client.base}${jobPath(job, client.base)}/${buildRef(params3.build)}/`
|
|
|
72597
72818
|
};
|
|
72598
72819
|
return tool;
|
|
72599
72820
|
}
|
|
72600
|
-
async function readJenkinsfile(
|
|
72601
|
-
const resolved = await resolveToolPath(context,
|
|
72821
|
+
async function readJenkinsfile(path61, context) {
|
|
72822
|
+
const resolved = await resolveToolPath(context, path61);
|
|
72602
72823
|
if (!resolved.ok)
|
|
72603
72824
|
return { ok: false, message: resolved.message };
|
|
72604
72825
|
try {
|
|
72605
72826
|
return { ok: true, text: await context.fs.readFile(resolved.realPath), realPath: resolved.realPath };
|
|
72606
72827
|
} catch (error51) {
|
|
72607
|
-
return { ok: false, message: `Could not read ${
|
|
72828
|
+
return { ok: false, message: `Could not read ${path61}: ${error51 instanceof Error ? error51.message : String(error51)}` };
|
|
72608
72829
|
}
|
|
72609
72830
|
}
|
|
72610
72831
|
var checkSchema = external_exports.object({
|
|
@@ -72873,8 +73094,8 @@ var AutosysClient = class {
|
|
|
72873
73094
|
async runInfo(pattern, signal) {
|
|
72874
73095
|
if (!isAutosysName(pattern, true))
|
|
72875
73096
|
throw new AtlassianError(`"${pattern}" is not a job name or pattern.`);
|
|
72876
|
-
const
|
|
72877
|
-
return asList(await this.rest.json(`reading the status of ${pattern}`,
|
|
73097
|
+
const path61 = pattern.includes("*") ? fill(this.paths.runInfo, { pattern }) : fill(this.paths.jobRunInfo, { job: pattern });
|
|
73098
|
+
return asList(await this.rest.json(`reading the status of ${pattern}`, path61, { method: "GET" }, signal)).map(toRun);
|
|
72878
73099
|
}
|
|
72879
73100
|
/** A job's log, or undefined when this server has no log endpoint (404). */
|
|
72880
73101
|
async log(name, runNum, type, signal) {
|
|
@@ -74875,7 +75096,7 @@ function message2(error51) {
|
|
|
74875
75096
|
}
|
|
74876
75097
|
function filesIn(params3) {
|
|
74877
75098
|
return [
|
|
74878
|
-
...(params3.attachments ?? []).map((
|
|
75099
|
+
...(params3.attachments ?? []).map((path61) => ({ path: path61, inline: false })),
|
|
74879
75100
|
...(params3.inlineImages ?? []).map((image) => ({ path: image.path, inline: true }))
|
|
74880
75101
|
];
|
|
74881
75102
|
}
|
|
@@ -75558,17 +75779,17 @@ var WebviewApprovalGate = class {
|
|
|
75558
75779
|
// ../../packages/core/dist/platform/node/filesystem.js
|
|
75559
75780
|
var import_promises25 = __toESM(require("node:fs/promises"), 1);
|
|
75560
75781
|
var NodeFileSystem = class {
|
|
75561
|
-
async readFile(
|
|
75562
|
-
return import_promises25.default.readFile(
|
|
75782
|
+
async readFile(path61) {
|
|
75783
|
+
return import_promises25.default.readFile(path61, "utf8");
|
|
75563
75784
|
}
|
|
75564
|
-
async readBytes(
|
|
75565
|
-
return import_promises25.default.readFile(
|
|
75785
|
+
async readBytes(path61) {
|
|
75786
|
+
return import_promises25.default.readFile(path61);
|
|
75566
75787
|
}
|
|
75567
|
-
async readBytesSlice(
|
|
75788
|
+
async readBytesSlice(path61, start, end) {
|
|
75568
75789
|
const length = Math.max(0, end - start);
|
|
75569
75790
|
if (length === 0)
|
|
75570
75791
|
return Buffer.alloc(0);
|
|
75571
|
-
const handle = await import_promises25.default.open(
|
|
75792
|
+
const handle = await import_promises25.default.open(path61, "r");
|
|
75572
75793
|
try {
|
|
75573
75794
|
const buffer = Buffer.alloc(length);
|
|
75574
75795
|
const { bytesRead } = await handle.read(buffer, 0, length, start);
|
|
@@ -75577,18 +75798,18 @@ var NodeFileSystem = class {
|
|
|
75577
75798
|
await handle.close();
|
|
75578
75799
|
}
|
|
75579
75800
|
}
|
|
75580
|
-
async writeFile(
|
|
75581
|
-
await import_promises25.default.writeFile(
|
|
75801
|
+
async writeFile(path61, contents) {
|
|
75802
|
+
await import_promises25.default.writeFile(path61, contents, "utf8");
|
|
75582
75803
|
}
|
|
75583
75804
|
/** The counterpart of `readBytes`, and deliberately as bare as `writeFile` beside it. */
|
|
75584
|
-
async writeBytes(
|
|
75585
|
-
await import_promises25.default.writeFile(
|
|
75805
|
+
async writeBytes(path61, contents) {
|
|
75806
|
+
await import_promises25.default.writeFile(path61, contents);
|
|
75586
75807
|
}
|
|
75587
75808
|
async rename(from, to) {
|
|
75588
75809
|
await replaceFile(from, to);
|
|
75589
75810
|
}
|
|
75590
|
-
async stat(
|
|
75591
|
-
const stat = await import_promises25.default.lstat(
|
|
75811
|
+
async stat(path61) {
|
|
75812
|
+
const stat = await import_promises25.default.lstat(path61);
|
|
75592
75813
|
return {
|
|
75593
75814
|
size: stat.size,
|
|
75594
75815
|
mtimeMs: stat.mtimeMs,
|
|
@@ -75597,8 +75818,8 @@ var NodeFileSystem = class {
|
|
|
75597
75818
|
isSymbolicLink: stat.isSymbolicLink()
|
|
75598
75819
|
};
|
|
75599
75820
|
}
|
|
75600
|
-
async readdir(
|
|
75601
|
-
const entries = await import_promises25.default.readdir(
|
|
75821
|
+
async readdir(path61) {
|
|
75822
|
+
const entries = await import_promises25.default.readdir(path61, { withFileTypes: true });
|
|
75602
75823
|
return entries.map((entry) => ({
|
|
75603
75824
|
name: entry.name,
|
|
75604
75825
|
isFile: entry.isFile(),
|
|
@@ -75606,21 +75827,21 @@ var NodeFileSystem = class {
|
|
|
75606
75827
|
isSymbolicLink: entry.isSymbolicLink()
|
|
75607
75828
|
}));
|
|
75608
75829
|
}
|
|
75609
|
-
async exists(
|
|
75830
|
+
async exists(path61) {
|
|
75610
75831
|
try {
|
|
75611
|
-
await import_promises25.default.access(
|
|
75832
|
+
await import_promises25.default.access(path61);
|
|
75612
75833
|
return true;
|
|
75613
75834
|
} catch {
|
|
75614
75835
|
return false;
|
|
75615
75836
|
}
|
|
75616
75837
|
}
|
|
75617
|
-
async mkdir(
|
|
75618
|
-
await import_promises25.default.mkdir(
|
|
75838
|
+
async mkdir(path61) {
|
|
75839
|
+
await import_promises25.default.mkdir(path61, { recursive: true });
|
|
75619
75840
|
}
|
|
75620
75841
|
};
|
|
75621
75842
|
|
|
75622
75843
|
// ../../packages/core/dist/config/project.js
|
|
75623
|
-
var
|
|
75844
|
+
var import_node_path45 = __toESM(require("node:path"), 1);
|
|
75624
75845
|
function configuredProjectName(config2) {
|
|
75625
75846
|
const name = config2?.project?.name?.trim();
|
|
75626
75847
|
return name !== void 0 && name.length > 0 ? name : void 0;
|
|
@@ -75629,7 +75850,7 @@ function projectName(config2, workspaceRoot) {
|
|
|
75629
75850
|
const configured = configuredProjectName(config2);
|
|
75630
75851
|
if (configured !== void 0)
|
|
75631
75852
|
return configured;
|
|
75632
|
-
return workspaceRoot === void 0 ? void 0 :
|
|
75853
|
+
return workspaceRoot === void 0 ? void 0 : import_node_path45.default.basename(import_node_path45.default.resolve(workspaceRoot));
|
|
75633
75854
|
}
|
|
75634
75855
|
function projectSlug(name) {
|
|
75635
75856
|
if (name === void 0)
|
|
@@ -75639,7 +75860,7 @@ function projectSlug(name) {
|
|
|
75639
75860
|
}
|
|
75640
75861
|
|
|
75641
75862
|
// ../../packages/core/dist/rag/renameIndexes.js
|
|
75642
|
-
var
|
|
75863
|
+
var import_node_path46 = __toESM(require("node:path"), 1);
|
|
75643
75864
|
var import_node_fs7 = require("node:fs");
|
|
75644
75865
|
function planIndexRenames(names) {
|
|
75645
75866
|
const plans = [];
|
|
@@ -75703,7 +75924,7 @@ async function copyBookkeeping(directory, from, to, storeId) {
|
|
|
75703
75924
|
continue;
|
|
75704
75925
|
const target = `${to}@${storeId}.${entry.slice(prefix.length)}`;
|
|
75705
75926
|
try {
|
|
75706
|
-
await import_node_fs7.promises.copyFile(
|
|
75927
|
+
await import_node_fs7.promises.copyFile(import_node_path46.default.join(directory, entry), import_node_path46.default.join(directory, target), import_node_fs7.constants.COPYFILE_EXCL);
|
|
75707
75928
|
copied.push(target);
|
|
75708
75929
|
} catch {
|
|
75709
75930
|
}
|
|
@@ -75790,7 +76011,7 @@ var NodeTerminal = class {
|
|
|
75790
76011
|
|
|
75791
76012
|
// ../../packages/core/dist/platform/node/taskStore.js
|
|
75792
76013
|
var import_promises26 = __toESM(require("node:fs/promises"), 1);
|
|
75793
|
-
var
|
|
76014
|
+
var import_node_path47 = __toESM(require("node:path"), 1);
|
|
75794
76015
|
|
|
75795
76016
|
// ../../packages/core/dist/history/types.js
|
|
75796
76017
|
function taskSummary(task) {
|
|
@@ -75813,7 +76034,7 @@ var JsonTaskStore = class {
|
|
|
75813
76034
|
constructor(globalStoragePath, truncationStore, logger) {
|
|
75814
76035
|
this.truncationStore = truncationStore;
|
|
75815
76036
|
this.logger = logger;
|
|
75816
|
-
this.directory =
|
|
76037
|
+
this.directory = import_node_path47.default.join(globalStoragePath, "tasks");
|
|
75817
76038
|
}
|
|
75818
76039
|
async list(workspaceRoot) {
|
|
75819
76040
|
const index = await this.readIndex();
|
|
@@ -75862,11 +76083,11 @@ var JsonTaskStore = class {
|
|
|
75862
76083
|
await this.writeIndex(index.filter((entry) => entry.id !== id));
|
|
75863
76084
|
}
|
|
75864
76085
|
fileFor(id) {
|
|
75865
|
-
return
|
|
76086
|
+
return import_node_path47.default.join(this.directory, `${id}.json`);
|
|
75866
76087
|
}
|
|
75867
76088
|
async readIndex() {
|
|
75868
76089
|
try {
|
|
75869
|
-
const raw = await import_promises26.default.readFile(
|
|
76090
|
+
const raw = await import_promises26.default.readFile(import_node_path47.default.join(this.directory, INDEX_FILE), "utf8");
|
|
75870
76091
|
const parsed = JSON.parse(raw);
|
|
75871
76092
|
if (Array.isArray(parsed))
|
|
75872
76093
|
return parsed.filter(isIndexEntry);
|
|
@@ -75901,7 +76122,7 @@ var JsonTaskStore = class {
|
|
|
75901
76122
|
}
|
|
75902
76123
|
async writeIndex(entries) {
|
|
75903
76124
|
await import_promises26.default.mkdir(this.directory, { recursive: true });
|
|
75904
|
-
const target =
|
|
76125
|
+
const target = import_node_path47.default.join(this.directory, INDEX_FILE);
|
|
75905
76126
|
const temporary = `${target}.tmp`;
|
|
75906
76127
|
await import_promises26.default.writeFile(temporary, JSON.stringify(entries, null, 2), "utf8");
|
|
75907
76128
|
await replaceFile(temporary, target);
|
|
@@ -75933,7 +76154,7 @@ function parseTask(raw) {
|
|
|
75933
76154
|
|
|
75934
76155
|
// ../../packages/core/dist/usage/store.js
|
|
75935
76156
|
var import_node_fs8 = require("node:fs");
|
|
75936
|
-
var
|
|
76157
|
+
var import_node_path48 = __toESM(require("node:path"), 1);
|
|
75937
76158
|
|
|
75938
76159
|
// ../../packages/core/dist/s3/keys.js
|
|
75939
76160
|
function normalisePrefix(prefix) {
|
|
@@ -76066,7 +76287,7 @@ var FolderShardStore = class {
|
|
|
76066
76287
|
await this.ask({ action: "write", user: shardSegment(shard.user), day: shard.day, instance: shard.instance, events });
|
|
76067
76288
|
return;
|
|
76068
76289
|
}
|
|
76069
|
-
await this.writeAtomically(
|
|
76290
|
+
await this.writeAtomically(import_node_path48.default.join(this.root, shardSegment(shard.user), `${shard.day}__${shard.instance}.jsonl`), shardText(events));
|
|
76070
76291
|
}
|
|
76071
76292
|
async read(fromDay, toDay) {
|
|
76072
76293
|
this.lastProblems = [];
|
|
@@ -76086,8 +76307,8 @@ var FolderShardStore = class {
|
|
|
76086
76307
|
}
|
|
76087
76308
|
const files = await this.listFiles();
|
|
76088
76309
|
const wanted = selectShards(files, fromDay, toDay);
|
|
76089
|
-
const texts = await pooled(wanted, 8, (file2) => import_node_fs8.promises.readFile(
|
|
76090
|
-
this.lastProblems.push(`${
|
|
76310
|
+
const texts = await pooled(wanted, 8, (file2) => import_node_fs8.promises.readFile(import_node_path48.default.join(this.root, file2.user, file2.name), "utf8").catch((error51) => {
|
|
76311
|
+
this.lastProblems.push(`${import_node_path48.default.join(this.root, file2.user, file2.name)}: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
76091
76312
|
return "";
|
|
76092
76313
|
}));
|
|
76093
76314
|
return texts.flatMap(parseUsageLines);
|
|
@@ -76104,7 +76325,7 @@ var FolderShardStore = class {
|
|
|
76104
76325
|
}
|
|
76105
76326
|
const files = [];
|
|
76106
76327
|
for (const user of users) {
|
|
76107
|
-
const folder =
|
|
76328
|
+
const folder = import_node_path48.default.join(this.root, user);
|
|
76108
76329
|
let names;
|
|
76109
76330
|
try {
|
|
76110
76331
|
names = await import_node_fs8.promises.readdir(folder);
|
|
@@ -76123,7 +76344,7 @@ var FolderShardStore = class {
|
|
|
76123
76344
|
}
|
|
76124
76345
|
async readShard(shard) {
|
|
76125
76346
|
try {
|
|
76126
|
-
return parseUsageLines(await import_node_fs8.promises.readFile(
|
|
76347
|
+
return parseUsageLines(await import_node_fs8.promises.readFile(import_node_path48.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), "utf8"));
|
|
76127
76348
|
} catch (error51) {
|
|
76128
76349
|
if (error51.code === "ENOENT")
|
|
76129
76350
|
return void 0;
|
|
@@ -76131,10 +76352,10 @@ var FolderShardStore = class {
|
|
|
76131
76352
|
}
|
|
76132
76353
|
}
|
|
76133
76354
|
async putMonth(shard, events) {
|
|
76134
|
-
await this.writeAtomically(
|
|
76355
|
+
await this.writeAtomically(import_node_path48.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), shardText(events));
|
|
76135
76356
|
}
|
|
76136
76357
|
async removeShard(shard) {
|
|
76137
|
-
await import_node_fs8.promises.rm(
|
|
76358
|
+
await import_node_fs8.promises.rm(import_node_path48.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), { force: true });
|
|
76138
76359
|
}
|
|
76139
76360
|
async putProfile(user, profile) {
|
|
76140
76361
|
this.profilesFromRead = void 0;
|
|
@@ -76142,7 +76363,7 @@ var FolderShardStore = class {
|
|
|
76142
76363
|
await this.ask({ action: "writeProfile", user: shardSegment(user), profile: cleanProfile(profile) });
|
|
76143
76364
|
return;
|
|
76144
76365
|
}
|
|
76145
|
-
await this.writeAtomically(
|
|
76366
|
+
await this.writeAtomically(import_node_path48.default.join(this.root, "_profiles", `${shardSegment(user)}.json`), JSON.stringify(cleanProfile(profile)));
|
|
76146
76367
|
}
|
|
76147
76368
|
async readProfiles() {
|
|
76148
76369
|
if (this.profilesFromRead !== void 0)
|
|
@@ -76151,13 +76372,13 @@ var FolderShardStore = class {
|
|
|
76151
76372
|
await this.read("9999-12-31", "9999-12-31");
|
|
76152
76373
|
return this.profilesFromRead ?? {};
|
|
76153
76374
|
}
|
|
76154
|
-
const folder =
|
|
76375
|
+
const folder = import_node_path48.default.join(this.root, "_profiles");
|
|
76155
76376
|
const profiles = {};
|
|
76156
76377
|
for (const name of await import_node_fs8.promises.readdir(folder).catch(() => [])) {
|
|
76157
76378
|
if (!name.endsWith(".json"))
|
|
76158
76379
|
continue;
|
|
76159
76380
|
try {
|
|
76160
|
-
profiles[name.slice(0, -5)] = cleanProfile(JSON.parse(await import_node_fs8.promises.readFile(
|
|
76381
|
+
profiles[name.slice(0, -5)] = cleanProfile(JSON.parse(await import_node_fs8.promises.readFile(import_node_path48.default.join(folder, name), "utf8")));
|
|
76161
76382
|
} catch {
|
|
76162
76383
|
}
|
|
76163
76384
|
}
|
|
@@ -76906,7 +77127,7 @@ function usageCollectionOn(config2, choice) {
|
|
|
76906
77127
|
|
|
76907
77128
|
// ../../packages/core/dist/usage/backfill.js
|
|
76908
77129
|
var import_node_fs9 = require("node:fs");
|
|
76909
|
-
var
|
|
77130
|
+
var import_node_path49 = __toESM(require("node:path"), 1);
|
|
76910
77131
|
function comparablePath(value) {
|
|
76911
77132
|
return value.replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
|
|
76912
77133
|
}
|
|
@@ -76916,7 +77137,7 @@ function eventsFromTask(task, context) {
|
|
|
76916
77137
|
return [];
|
|
76917
77138
|
const created = typeof task.createdAt === "number" && task.createdAt <= updated ? task.createdAt : updated;
|
|
76918
77139
|
const root = typeof task.workspaceRoot === "string" ? task.workspaceRoot : void 0;
|
|
76919
|
-
const project = root !== void 0 && context.workspaceRoot !== void 0 && comparablePath(root) === comparablePath(context.workspaceRoot) ? context.project : root !== void 0 ?
|
|
77140
|
+
const project = root !== void 0 && context.workspaceRoot !== void 0 && comparablePath(root) === comparablePath(context.workspaceRoot) ? context.project : root !== void 0 ? import_node_path49.default.basename(root.replace(/\\/g, "/")) : void 0;
|
|
76920
77141
|
const skillsByPath = new Map(context.skills.map((skill) => [comparablePath(skill.filePath), skill]));
|
|
76921
77142
|
const skip = new Set(context.skip);
|
|
76922
77143
|
const calls = [];
|
|
@@ -76953,7 +77174,7 @@ function eventsFromTask(task, context) {
|
|
|
76953
77174
|
let skill;
|
|
76954
77175
|
if (call.name === "read_file" && typeof call.args["path"] === "string") {
|
|
76955
77176
|
const requested2 = call.args["path"];
|
|
76956
|
-
const absolute =
|
|
77177
|
+
const absolute = import_node_path49.default.isAbsolute(requested2) || /^[A-Za-z]:[\\/]/.test(requested2) || root === void 0 ? requested2 : import_node_path49.default.join(root, requested2);
|
|
76957
77178
|
skill = skillsByPath.get(comparablePath(absolute));
|
|
76958
77179
|
}
|
|
76959
77180
|
if (call.name === "use_skill_file" && typeof call.args["skill"] === "string") {
|
|
@@ -76998,7 +77219,7 @@ async function backfillFromTasks(tasksDir, context, helper) {
|
|
|
76998
77219
|
let unreadable = 0;
|
|
76999
77220
|
for (const name of names) {
|
|
77000
77221
|
try {
|
|
77001
|
-
events.push(...eventsFromTask(JSON.parse(await import_node_fs9.promises.readFile(
|
|
77222
|
+
events.push(...eventsFromTask(JSON.parse(await import_node_fs9.promises.readFile(import_node_path49.default.join(tasksDir, name), "utf8")), context));
|
|
77002
77223
|
} catch {
|
|
77003
77224
|
unreadable++;
|
|
77004
77225
|
}
|
|
@@ -77006,13 +77227,13 @@ async function backfillFromTasks(tasksDir, context, helper) {
|
|
|
77006
77227
|
return { events, tasks: names.length, unreadable, via: "node" };
|
|
77007
77228
|
}
|
|
77008
77229
|
async function backfillOnce(options) {
|
|
77009
|
-
const doneFile =
|
|
77230
|
+
const doneFile = import_node_path49.default.join(options.usageDir, "backfill.json");
|
|
77010
77231
|
for (const file2 of [doneFile, ...options.legacyDoneFile !== void 0 ? [options.legacyDoneFile] : []]) {
|
|
77011
77232
|
if (await import_node_fs9.promises.stat(file2).then(() => true, () => false))
|
|
77012
77233
|
return { ran: false };
|
|
77013
77234
|
}
|
|
77014
77235
|
await import_node_fs9.promises.mkdir(options.usageDir, { recursive: true });
|
|
77015
|
-
const startFile =
|
|
77236
|
+
const startFile = import_node_path49.default.join(options.usageDir, "backfill-start.json");
|
|
77016
77237
|
let before;
|
|
77017
77238
|
try {
|
|
77018
77239
|
before = (options.now ?? Date.now)();
|
|
@@ -77421,14 +77642,14 @@ function wireChatBridge(services) {
|
|
|
77421
77642
|
let cachedSecretValues = [];
|
|
77422
77643
|
const droppedFilesRoot2 = droppedFilesRoot();
|
|
77423
77644
|
const mailAttachmentsRoot2 = mailAttachmentsRoot();
|
|
77424
|
-
const droppedFilesDir =
|
|
77425
|
-
const truncationStore = new RecordingTruncationStore(new DiskTruncationStore(
|
|
77645
|
+
const droppedFilesDir = import_node_path50.default.join(droppedFilesRoot2, (0, import_node_crypto15.randomUUID)().slice(0, 8));
|
|
77646
|
+
const truncationStore = new RecordingTruncationStore(new DiskTruncationStore(import_node_path50.default.join(storageDir, "tool-results"), () => cachedSecretValues));
|
|
77426
77647
|
const taskStore = new JsonTaskStore(storageDir, truncationStore, logger);
|
|
77427
77648
|
const manifestsRoot = services.codebaseDir ?? storageDir;
|
|
77428
77649
|
const codebaseInstructionsFile = codebaseInstructionsPath({ codebaseDir: services.codebaseDir, storageDir, workspaceRoot });
|
|
77429
77650
|
if (services.codebaseDir !== void 0) {
|
|
77430
|
-
const shared =
|
|
77431
|
-
void import_promises27.default.access(shared).catch(() => import_promises27.default.cp(
|
|
77651
|
+
const shared = import_node_path50.default.join(services.codebaseDir, "index-manifests");
|
|
77652
|
+
void import_promises27.default.access(shared).catch(() => import_promises27.default.cp(import_node_path50.default.join(storageDir, "index-manifests"), shared, { recursive: true, errorOnExist: false, force: false })).catch(() => void 0);
|
|
77432
77653
|
}
|
|
77433
77654
|
const python = new PythonManager({
|
|
77434
77655
|
workspaceRoot,
|
|
@@ -77554,7 +77775,7 @@ ${preview.text}` } : {}
|
|
|
77554
77775
|
void postDatasetStatus();
|
|
77555
77776
|
}
|
|
77556
77777
|
});
|
|
77557
|
-
const defaultSkillsDir = workspaceRoot !== void 0 ?
|
|
77778
|
+
const defaultSkillsDir = workspaceRoot !== void 0 ? import_node_path50.default.join(workspaceRoot, ".lightcode", "skills") : void 0;
|
|
77558
77779
|
let skillsDir = defaultSkillsDir;
|
|
77559
77780
|
let localSkillsDir = defaultSkillsDir;
|
|
77560
77781
|
let extraSkillDirs = [];
|
|
@@ -77577,9 +77798,9 @@ ${preview.text}` } : {}
|
|
|
77577
77798
|
const trimmed = entry.trim();
|
|
77578
77799
|
if (trimmed.length === 0)
|
|
77579
77800
|
return void 0;
|
|
77580
|
-
if (
|
|
77581
|
-
return
|
|
77582
|
-
return workspaceRoot === void 0 ? void 0 :
|
|
77801
|
+
if (import_node_path50.default.isAbsolute(trimmed))
|
|
77802
|
+
return import_node_path50.default.resolve(trimmed);
|
|
77803
|
+
return workspaceRoot === void 0 ? void 0 : import_node_path50.default.resolve(workspaceRoot, trimmed);
|
|
77583
77804
|
}
|
|
77584
77805
|
function skillSearchPath() {
|
|
77585
77806
|
return [skillsDir, ...extraSkillDirs].filter((dir) => dir !== void 0);
|
|
@@ -77611,7 +77832,7 @@ ${preview.text}` } : {}
|
|
|
77611
77832
|
function watchSkillFolders() {
|
|
77612
77833
|
stopWatchingSkills();
|
|
77613
77834
|
const dirs = skillSearchPath();
|
|
77614
|
-
for (const dir of [...dirs, ...dirs.map((entry) =>
|
|
77835
|
+
for (const dir of [...dirs, ...dirs.map((entry) => import_node_path50.default.dirname(entry))]) {
|
|
77615
77836
|
try {
|
|
77616
77837
|
skillWatchers.push(
|
|
77617
77838
|
// Recursive, because a skill may be a folder with SKILL.md inside — a non-recursive
|
|
@@ -77682,7 +77903,7 @@ ${preview.text}` } : {}
|
|
|
77682
77903
|
await openInPanelEditor(filePath);
|
|
77683
77904
|
return;
|
|
77684
77905
|
}
|
|
77685
|
-
const real = await confineToAny(
|
|
77906
|
+
const real = await confineToAny(import_node_path50.default.resolve(filePath), roots);
|
|
77686
77907
|
await ui.openFile?.(real);
|
|
77687
77908
|
} catch (error51) {
|
|
77688
77909
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
@@ -77693,9 +77914,9 @@ ${preview.text}` } : {}
|
|
|
77693
77914
|
python.toolsDirectory(),
|
|
77694
77915
|
...skillsDir === void 0 ? [] : [skillsDir],
|
|
77695
77916
|
...extraSkillDirs.filter((dir) => dir !== void 0),
|
|
77696
|
-
|
|
77917
|
+
import_node_path50.default.join(storageDir, "reports"),
|
|
77697
77918
|
// Its own folder: nothing else lives there.
|
|
77698
|
-
...codebaseInstructionsFile === void 0 ? [] : [
|
|
77919
|
+
...codebaseInstructionsFile === void 0 ? [] : [import_node_path50.default.dirname(codebaseInstructionsFile)]
|
|
77699
77920
|
].filter((dir) => dir.length > 0);
|
|
77700
77921
|
}
|
|
77701
77922
|
function mostlyCrlf(text) {
|
|
@@ -77704,17 +77925,17 @@ ${preview.text}` } : {}
|
|
|
77704
77925
|
}
|
|
77705
77926
|
const EDITOR_MAX_BYTES = 2 * 1024 * 1024;
|
|
77706
77927
|
async function openInPanelEditor(filePath) {
|
|
77707
|
-
const real = await confineToAny(
|
|
77928
|
+
const real = await confineToAny(import_node_path50.default.resolve(filePath), managedRoots());
|
|
77708
77929
|
const stat = await import_promises27.default.stat(real);
|
|
77709
77930
|
if (stat.size > EDITOR_MAX_BYTES)
|
|
77710
|
-
throw new Error(`${
|
|
77931
|
+
throw new Error(`${import_node_path50.default.basename(real)} is too large to edit here (${String(Math.round(stat.size / 1024))} KB).`);
|
|
77711
77932
|
const raw = await import_promises27.default.readFile(real, "utf8");
|
|
77712
77933
|
const crlf = mostlyCrlf(raw);
|
|
77713
|
-
post({ type: "editorFile", path: real, name:
|
|
77934
|
+
post({ type: "editorFile", path: real, name: import_node_path50.default.basename(real), content: raw.split("\r\n").join("\n"), mtimeMs: stat.mtimeMs, eol: crlf ? "crlf" : "lf" });
|
|
77714
77935
|
}
|
|
77715
77936
|
async function handleSaveEditorFile(filePath, content, mtimeMs) {
|
|
77716
77937
|
try {
|
|
77717
|
-
const real = await confineToAny(
|
|
77938
|
+
const real = await confineToAny(import_node_path50.default.resolve(filePath), managedRoots());
|
|
77718
77939
|
const current = await import_promises27.default.stat(real).catch(() => void 0);
|
|
77719
77940
|
if (current !== void 0 && Math.abs(current.mtimeMs - mtimeMs) > 1) {
|
|
77720
77941
|
post({
|
|
@@ -77722,7 +77943,7 @@ ${preview.text}` } : {}
|
|
|
77722
77943
|
path: real,
|
|
77723
77944
|
ok: false,
|
|
77724
77945
|
conflict: true,
|
|
77725
|
-
message: `${
|
|
77946
|
+
message: `${import_node_path50.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.`
|
|
77726
77947
|
});
|
|
77727
77948
|
return;
|
|
77728
77949
|
}
|
|
@@ -77746,7 +77967,7 @@ ${preview.text}` } : {}
|
|
|
77746
77967
|
await handleOpenManagedFile(existing.filePath);
|
|
77747
77968
|
return;
|
|
77748
77969
|
}
|
|
77749
|
-
const target =
|
|
77970
|
+
const target = import_node_path50.default.join(skillsDir, "standing-instructions.md");
|
|
77750
77971
|
try {
|
|
77751
77972
|
await import_promises27.default.mkdir(skillsDir, { recursive: true });
|
|
77752
77973
|
await import_promises27.default.writeFile(target, STANDING_SKILL_TEMPLATE, { encoding: "utf8", flag: "wx" });
|
|
@@ -77766,7 +77987,7 @@ ${preview.text}` } : {}
|
|
|
77766
77987
|
return;
|
|
77767
77988
|
}
|
|
77768
77989
|
try {
|
|
77769
|
-
await import_promises27.default.mkdir(
|
|
77990
|
+
await import_promises27.default.mkdir(import_node_path50.default.dirname(codebaseInstructionsFile), { recursive: true });
|
|
77770
77991
|
await import_promises27.default.writeFile(codebaseInstructionsFile, "", { encoding: "utf8", flag: "wx" });
|
|
77771
77992
|
} catch (error51) {
|
|
77772
77993
|
if (error51.code !== "EEXIST") {
|
|
@@ -77783,11 +78004,11 @@ ${preview.text}` } : {}
|
|
|
77783
78004
|
return;
|
|
77784
78005
|
if (!isValidToolName(name))
|
|
77785
78006
|
throw new Error(`"${name}" is not a valid tool name.`);
|
|
77786
|
-
const ownCopy =
|
|
78007
|
+
const ownCopy = import_node_path50.default.join(dir, toolFileName(name));
|
|
77787
78008
|
if (filePath !== void 0) {
|
|
77788
|
-
const same2 = (a, b) => normalizeForComparison(
|
|
78009
|
+
const same2 = (a, b) => normalizeForComparison(import_node_path50.default.resolve(a)) === normalizeForComparison(import_node_path50.default.resolve(b));
|
|
77789
78010
|
if (!same2(filePath, ownCopy)) {
|
|
77790
|
-
const fromBucket = mirroredToolsDirs.some((mirror) => same2(
|
|
78011
|
+
const fromBucket = mirroredToolsDirs.some((mirror) => same2(import_node_path50.default.dirname(filePath), mirror));
|
|
77791
78012
|
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.`);
|
|
77792
78013
|
}
|
|
77793
78014
|
}
|
|
@@ -77813,7 +78034,7 @@ ${preview.text}` } : {}
|
|
|
77813
78034
|
let dir;
|
|
77814
78035
|
let filePath = "";
|
|
77815
78036
|
for (const candidate of python.toolDirectories()) {
|
|
77816
|
-
const attempt =
|
|
78037
|
+
const attempt = import_node_path50.default.join(candidate, toolFileName(name));
|
|
77817
78038
|
if (await onDisk(attempt)) {
|
|
77818
78039
|
dir = candidate;
|
|
77819
78040
|
filePath = attempt;
|
|
@@ -77844,7 +78065,7 @@ ${preview.text}` } : {}
|
|
|
77844
78065
|
function samePath(a, b) {
|
|
77845
78066
|
if (a === void 0 || b === void 0)
|
|
77846
78067
|
return false;
|
|
77847
|
-
const norm2 = (value) => process.platform === "win32" ?
|
|
78068
|
+
const norm2 = (value) => process.platform === "win32" ? import_node_path50.default.resolve(value).toLowerCase() : import_node_path50.default.resolve(value);
|
|
77848
78069
|
return norm2(a) === norm2(b);
|
|
77849
78070
|
}
|
|
77850
78071
|
function publishFolder(kind, mirrors) {
|
|
@@ -77949,7 +78170,7 @@ ${preview.text}` } : {}
|
|
|
77949
78170
|
target,
|
|
77950
78171
|
...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {},
|
|
77951
78172
|
relative: entry,
|
|
77952
|
-
contents: await import_promises27.default.readFile(
|
|
78173
|
+
contents: await import_promises27.default.readFile(import_node_path50.default.join(dir, entry))
|
|
77953
78174
|
});
|
|
77954
78175
|
uploaded += 1;
|
|
77955
78176
|
} catch (error51) {
|
|
@@ -77971,7 +78192,7 @@ ${preview.text}` } : {}
|
|
|
77971
78192
|
if (!isValidToolName(name))
|
|
77972
78193
|
throw new Error(`"${name}" is not a valid tool name.`);
|
|
77973
78194
|
for (const candidate of python.toolDirectories()) {
|
|
77974
|
-
const attempt =
|
|
78195
|
+
const attempt = import_node_path50.default.join(candidate, toolFileName(name));
|
|
77975
78196
|
try {
|
|
77976
78197
|
post({ type: "pythonToolSource", name, source: await import_promises27.default.readFile(attempt, "utf8") });
|
|
77977
78198
|
return;
|
|
@@ -78024,7 +78245,7 @@ ${preview.text}` } : {}
|
|
|
78024
78245
|
continue;
|
|
78025
78246
|
for (const candidate of python.toolDirectories()) {
|
|
78026
78247
|
try {
|
|
78027
|
-
const source = await import_promises27.default.readFile(
|
|
78248
|
+
const source = await import_promises27.default.readFile(import_node_path50.default.join(candidate, toolFileName(name)), "utf8");
|
|
78028
78249
|
declined[name] = hashSource(source);
|
|
78029
78250
|
recorded += 1;
|
|
78030
78251
|
break;
|
|
@@ -78082,7 +78303,7 @@ ${preview.text}` } : {}
|
|
|
78082
78303
|
let dir;
|
|
78083
78304
|
let filePath = "";
|
|
78084
78305
|
for (const candidate of python.toolDirectories()) {
|
|
78085
|
-
const attempt =
|
|
78306
|
+
const attempt = import_node_path50.default.join(candidate, toolFileName(name));
|
|
78086
78307
|
if (await onDisk(attempt)) {
|
|
78087
78308
|
dir = candidate;
|
|
78088
78309
|
filePath = attempt;
|
|
@@ -78108,7 +78329,7 @@ ${preview.text}` } : {}
|
|
|
78108
78329
|
function mirrorForDir(sourceDir) {
|
|
78109
78330
|
if (sourceDir === void 0)
|
|
78110
78331
|
return void 0;
|
|
78111
|
-
const wanted =
|
|
78332
|
+
const wanted = import_node_path50.default.resolve(sourceDir).toLowerCase();
|
|
78112
78333
|
for (const mirror of cachedSkillMirrors) {
|
|
78113
78334
|
if (mirror.enabled !== true)
|
|
78114
78335
|
continue;
|
|
@@ -78118,7 +78339,7 @@ ${preview.text}` } : {}
|
|
|
78118
78339
|
kind: "skills",
|
|
78119
78340
|
...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}
|
|
78120
78341
|
});
|
|
78121
|
-
if (
|
|
78342
|
+
if (import_node_path50.default.resolve(localDir).toLowerCase() === wanted)
|
|
78122
78343
|
return { mirror, localDir };
|
|
78123
78344
|
}
|
|
78124
78345
|
return void 0;
|
|
@@ -78183,8 +78404,8 @@ ${preview.text}` } : {}
|
|
|
78183
78404
|
});
|
|
78184
78405
|
let localProblem;
|
|
78185
78406
|
try {
|
|
78186
|
-
await import_promises27.default.rm(
|
|
78187
|
-
await import_promises27.default.rm(
|
|
78407
|
+
await import_promises27.default.rm(import_node_path50.default.join(found2.localDir, `${name}.md`), { force: true });
|
|
78408
|
+
await import_promises27.default.rm(import_node_path50.default.join(found2.localDir, name), { recursive: true, force: true });
|
|
78188
78409
|
} catch (error51) {
|
|
78189
78410
|
localProblem = error51 instanceof Error ? error51.message : String(error51);
|
|
78190
78411
|
}
|
|
@@ -78217,7 +78438,7 @@ ${preview.text}` } : {}
|
|
|
78217
78438
|
if (existing !== void 0 && existing.sourceDir !== void 0 && existing.sourceDir !== skillsDir) {
|
|
78218
78439
|
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.`);
|
|
78219
78440
|
}
|
|
78220
|
-
await import_promises27.default.rm(
|
|
78441
|
+
await import_promises27.default.rm(import_node_path50.default.join(skillsDir, skillFileName(name)), { force: true });
|
|
78221
78442
|
await postSkills();
|
|
78222
78443
|
} catch (error51) {
|
|
78223
78444
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
@@ -78397,7 +78618,7 @@ ${preview.text}` } : {}
|
|
|
78397
78618
|
let scheduleToolAccess;
|
|
78398
78619
|
const approvalsKey = workspaceRoot ?? "__no_workspace__";
|
|
78399
78620
|
function comparableApprovalsKey(key2) {
|
|
78400
|
-
return key2 === "__no_workspace__" ? key2 : normalizeForComparison(
|
|
78621
|
+
return key2 === "__no_workspace__" ? key2 : normalizeForComparison(import_node_path50.default.resolve(key2));
|
|
78401
78622
|
}
|
|
78402
78623
|
function approvalsFrom(stored) {
|
|
78403
78624
|
if (stored === void 0)
|
|
@@ -78608,7 +78829,7 @@ ${preview.text}` } : {}
|
|
|
78608
78829
|
...taskExpertEstimate === void 0 ? {} : { estimate: taskExpertEstimate }
|
|
78609
78830
|
});
|
|
78610
78831
|
}
|
|
78611
|
-
const expertEventsPath =
|
|
78832
|
+
const expertEventsPath = import_node_path50.default.join(storageDir, "expert-events.jsonl");
|
|
78612
78833
|
let expertEvents;
|
|
78613
78834
|
let juniorTurnWithoutExpert = false;
|
|
78614
78835
|
async function loadExpertEvents() {
|
|
@@ -78636,7 +78857,7 @@ ${preview.text}` } : {}
|
|
|
78636
78857
|
try {
|
|
78637
78858
|
const events = await loadExpertEvents();
|
|
78638
78859
|
events.push(event);
|
|
78639
|
-
await import_promises27.default.mkdir(
|
|
78860
|
+
await import_promises27.default.mkdir(import_node_path50.default.dirname(expertEventsPath), { recursive: true });
|
|
78640
78861
|
await import_promises27.default.appendFile(expertEventsPath, `${JSON.stringify(event)}
|
|
78641
78862
|
`, "utf8");
|
|
78642
78863
|
} catch (error51) {
|
|
@@ -78910,8 +79131,8 @@ ${preview.text}` } : {}
|
|
|
78910
79131
|
function contextMentionPath(file2) {
|
|
78911
79132
|
if (workspaceRoot === void 0)
|
|
78912
79133
|
return file2;
|
|
78913
|
-
const relative =
|
|
78914
|
-
return relative.length > 0 && !relative.startsWith("..") && !
|
|
79134
|
+
const relative = import_node_path50.default.relative(workspaceRoot, file2);
|
|
79135
|
+
return relative.length > 0 && !relative.startsWith("..") && !import_node_path50.default.isAbsolute(relative) ? relative.split(import_node_path50.default.sep).join("/") : file2;
|
|
78915
79136
|
}
|
|
78916
79137
|
function hostCapabilities() {
|
|
78917
79138
|
return {
|
|
@@ -79409,9 +79630,10 @@ ${preview.text}` } : {}
|
|
|
79409
79630
|
}
|
|
79410
79631
|
let installedAddons = [];
|
|
79411
79632
|
let addonProblems = [];
|
|
79633
|
+
const addonRoot = services.codebaseDir ?? storageDir;
|
|
79412
79634
|
function addonFolders(config2) {
|
|
79413
79635
|
return {
|
|
79414
|
-
configured: (config2.addons?.folders ?? []).map((folder) =>
|
|
79636
|
+
configured: (config2.addons?.folders ?? []).map((folder) => import_node_path50.default.resolve(folder)),
|
|
79415
79637
|
defaults: defaultAddonFolders(process.env, process.execPath, process.platform)
|
|
79416
79638
|
};
|
|
79417
79639
|
}
|
|
@@ -79422,8 +79644,159 @@ ${preview.text}` } : {}
|
|
|
79422
79644
|
addonProblems = found2.problems;
|
|
79423
79645
|
}
|
|
79424
79646
|
async function configureMcp(servers) {
|
|
79425
|
-
const { workspaceMcpServers } = await configManager.load();
|
|
79426
|
-
|
|
79647
|
+
const { config: config2, workspaceMcpServers } = await configManager.load();
|
|
79648
|
+
const delivered = /* @__PURE__ */ new Map();
|
|
79649
|
+
for (const addon of installedAddons) {
|
|
79650
|
+
if (addon.page === void 0)
|
|
79651
|
+
continue;
|
|
79652
|
+
const settings = config2.addons?.settings?.[addon.package];
|
|
79653
|
+
const stored = /* @__PURE__ */ new Set();
|
|
79654
|
+
for (const ref of possibleSecretRefs(addon, settings))
|
|
79655
|
+
if (await secrets.get(ref) !== void 0)
|
|
79656
|
+
stored.add(ref);
|
|
79657
|
+
const delivery = deliveryFor(addonRoot, addon, settings, stored);
|
|
79658
|
+
try {
|
|
79659
|
+
await writeFileAtomically(delivery.file, JSON.stringify(delivery.contents, null, 2));
|
|
79660
|
+
await import_promises27.default.mkdir(addonDownloadsDir(addonRoot, addon), { recursive: true });
|
|
79661
|
+
delivered.set(addon.package, delivery.env);
|
|
79662
|
+
} catch (error51) {
|
|
79663
|
+
logger.warn(`Could not write the settings for add-on ${addon.package}: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
79664
|
+
}
|
|
79665
|
+
}
|
|
79666
|
+
await mcp.configure(runnableServers(servers, installedAddons, { execPath: process.execPath, electron: process.versions["electron"] !== void 0 }, workspaceMcpServers, (addon) => delivered.get(addon.package) ?? {}));
|
|
79667
|
+
}
|
|
79668
|
+
async function postAddonPage(pkg, extra = {}) {
|
|
79669
|
+
const { config: config2 } = await configManager.load();
|
|
79670
|
+
const addon = installedAddons.find((candidate) => candidate.package === pkg);
|
|
79671
|
+
if (addon?.page === void 0) {
|
|
79672
|
+
post({ type: "addonPage", package: pkg, error: `${pkg} is not installed, or has no settings of its own.` });
|
|
79673
|
+
return;
|
|
79674
|
+
}
|
|
79675
|
+
const settings = config2.addons?.settings?.[pkg];
|
|
79676
|
+
const isSet = async (recordId, fields) => {
|
|
79677
|
+
const set2 = [];
|
|
79678
|
+
for (const field2 of fields) {
|
|
79679
|
+
if (field2.type === "secret" && await secrets.get(addonSecretRef(pkg, recordId, field2.key)) !== void 0)
|
|
79680
|
+
set2.push(field2.key);
|
|
79681
|
+
}
|
|
79682
|
+
return set2;
|
|
79683
|
+
};
|
|
79684
|
+
post({
|
|
79685
|
+
type: "addonPage",
|
|
79686
|
+
package: pkg,
|
|
79687
|
+
...extra,
|
|
79688
|
+
view: {
|
|
79689
|
+
package: pkg,
|
|
79690
|
+
displayName: addon.displayName,
|
|
79691
|
+
...addon.icon !== void 0 ? { icon: addon.icon } : {},
|
|
79692
|
+
page: addon.page,
|
|
79693
|
+
state: addonState(addon, config2.mcpServers ?? {}),
|
|
79694
|
+
values: settings?.values ?? {},
|
|
79695
|
+
secretsSet: await isSet(void 0, addon.page.fields ?? []),
|
|
79696
|
+
records: await Promise.all((settings?.records ?? []).map(async (record2) => ({ ...record2, secretsSet: await isSet(record2.id, addon.page?.records?.fields ?? []) })))
|
|
79697
|
+
}
|
|
79698
|
+
});
|
|
79699
|
+
}
|
|
79700
|
+
async function storeAddonSettings(addon, next) {
|
|
79701
|
+
const { config: config2 } = await configManager.load();
|
|
79702
|
+
const all = { ...config2.addons?.settings ?? {}, [addon.package]: next };
|
|
79703
|
+
await configManager.save("user", { addons: { ...config2.addons ?? {}, settings: all } });
|
|
79704
|
+
const reloaded = (await configManager.load()).config;
|
|
79705
|
+
await configureMcp(reloaded.mcpServers ?? {});
|
|
79706
|
+
if (mcp.states_().some((server) => server.name === addon.server && server.status === "ready")) {
|
|
79707
|
+
await mcp.restart(addon.server).catch(() => void 0);
|
|
79708
|
+
}
|
|
79709
|
+
}
|
|
79710
|
+
async function writeAddonSecrets(pkg, recordId, fields, given, clear = []) {
|
|
79711
|
+
for (const field2 of fields) {
|
|
79712
|
+
if (field2.type !== "secret")
|
|
79713
|
+
continue;
|
|
79714
|
+
const ref = addonSecretRef(pkg, recordId, field2.key);
|
|
79715
|
+
const value = given[field2.key];
|
|
79716
|
+
if (typeof value === "string" && value.length > 0)
|
|
79717
|
+
await secrets.set(ref, value);
|
|
79718
|
+
else if (clear.includes(field2.key))
|
|
79719
|
+
await secrets.delete(ref);
|
|
79720
|
+
}
|
|
79721
|
+
}
|
|
79722
|
+
async function handleSaveAddonRecord(message4) {
|
|
79723
|
+
const addon = installedAddons.find((candidate) => candidate.package === message4.package);
|
|
79724
|
+
const spec = addon?.page?.records;
|
|
79725
|
+
if (addon === void 0 || spec === void 0)
|
|
79726
|
+
return postAddonPage(message4.package, { error: "This add-on keeps no list." });
|
|
79727
|
+
const cleaned = cleanAddonValues(spec.fields, message4.values);
|
|
79728
|
+
if (!cleaned.ok)
|
|
79729
|
+
return postAddonPage(message4.package, { error: cleaned.message });
|
|
79730
|
+
const { config: config2 } = await configManager.load();
|
|
79731
|
+
const current = config2.addons?.settings?.[addon.package] ?? {};
|
|
79732
|
+
const records = [...current.records ?? []];
|
|
79733
|
+
const name = String(cleaned.values[spec.keyField] ?? "");
|
|
79734
|
+
const clash = records.find((record2) => record2.id !== message4.id && String(record2.values[spec.keyField] ?? "").toLowerCase() === name.toLowerCase());
|
|
79735
|
+
if (clash !== void 0)
|
|
79736
|
+
return postAddonPage(message4.package, { error: `There is already a ${spec.noun} called "${name}".` });
|
|
79737
|
+
let id = message4.id;
|
|
79738
|
+
if (id === void 0) {
|
|
79739
|
+
if (records.length >= (spec.max ?? 500))
|
|
79740
|
+
return postAddonPage(message4.package, { error: `No more than ${String(spec.max ?? 500)} ${spec.noun}s.` });
|
|
79741
|
+
id = (0, import_node_crypto15.randomBytes)(6).toString("hex");
|
|
79742
|
+
records.push({ id, values: cleaned.values });
|
|
79743
|
+
} else {
|
|
79744
|
+
const at = records.findIndex((record2) => record2.id === id);
|
|
79745
|
+
if (at < 0)
|
|
79746
|
+
return postAddonPage(message4.package, { error: `That ${spec.noun} no longer exists.` });
|
|
79747
|
+
records[at] = { id, values: cleaned.values };
|
|
79748
|
+
}
|
|
79749
|
+
await writeAddonSecrets(addon.package, id, spec.fields, message4.secrets, message4.clearSecrets);
|
|
79750
|
+
await storeAddonSettings(addon, { ...current, records });
|
|
79751
|
+
await postAddonPage(message4.package, { saved: true });
|
|
79752
|
+
}
|
|
79753
|
+
async function handleDeleteAddonRecord(pkg, id) {
|
|
79754
|
+
const addon = installedAddons.find((candidate) => candidate.package === pkg);
|
|
79755
|
+
const spec = addon?.page?.records;
|
|
79756
|
+
if (addon === void 0 || spec === void 0)
|
|
79757
|
+
return postAddonPage(pkg);
|
|
79758
|
+
const { config: config2 } = await configManager.load();
|
|
79759
|
+
const current = config2.addons?.settings?.[pkg] ?? {};
|
|
79760
|
+
await writeAddonSecrets(pkg, id, spec.fields, {}, spec.fields.map((field2) => field2.key));
|
|
79761
|
+
await storeAddonSettings(addon, { ...current, records: (current.records ?? []).filter((record2) => record2.id !== id) });
|
|
79762
|
+
await postAddonPage(pkg, { saved: true });
|
|
79763
|
+
}
|
|
79764
|
+
async function handleSaveAddonValues(message4) {
|
|
79765
|
+
const addon = installedAddons.find((candidate) => candidate.package === message4.package);
|
|
79766
|
+
const fields = addon?.page?.fields;
|
|
79767
|
+
if (addon === void 0 || fields === void 0)
|
|
79768
|
+
return postAddonPage(message4.package);
|
|
79769
|
+
const cleaned = cleanAddonValues(fields, message4.values);
|
|
79770
|
+
if (!cleaned.ok)
|
|
79771
|
+
return postAddonPage(message4.package, { error: cleaned.message });
|
|
79772
|
+
const { config: config2 } = await configManager.load();
|
|
79773
|
+
await writeAddonSecrets(addon.package, void 0, fields, message4.secrets, message4.clearSecrets);
|
|
79774
|
+
await storeAddonSettings(addon, { ...config2.addons?.settings?.[addon.package] ?? {}, values: cleaned.values });
|
|
79775
|
+
await postAddonPage(message4.package, { saved: true });
|
|
79776
|
+
}
|
|
79777
|
+
async function handleRunAddonAction(pkg, id, tool) {
|
|
79778
|
+
const reply = (ok, text) => post({ type: "addonActionResult", package: pkg, id, tool, ok, text });
|
|
79779
|
+
const addon = installedAddons.find((candidate) => candidate.package === pkg);
|
|
79780
|
+
const spec = addon?.page?.records;
|
|
79781
|
+
if (addon === void 0 || spec === void 0 || !(spec.actions ?? []).some((action) => action.tool === tool))
|
|
79782
|
+
return reply(false, "That button is not one this add-on declares.");
|
|
79783
|
+
const { config: config2 } = await configManager.load();
|
|
79784
|
+
if (addonState(addon, config2.mcpServers ?? {}) !== "enabled")
|
|
79785
|
+
return reply(false, `Enable ${addon.displayName} first (Settings \u2192 MCP \u2192 Add-ons).`);
|
|
79786
|
+
const record2 = (config2.addons?.settings?.[pkg]?.records ?? []).find((candidate) => candidate.id === id);
|
|
79787
|
+
if (record2 === void 0)
|
|
79788
|
+
return reply(false, `That ${spec.noun} no longer exists.`);
|
|
79789
|
+
await mcp.ensureConnected();
|
|
79790
|
+
const target = mcp.enabledTools().find((candidate) => candidate.name === `${addon.server}__${tool}`);
|
|
79791
|
+
if (target === void 0)
|
|
79792
|
+
return reply(false, `${addon.displayName} is not running, or offers no "${tool}". See its log in Settings \u2192 MCP.`);
|
|
79793
|
+
try {
|
|
79794
|
+
const result = await target.execute({ [spec.keyField]: record2.values[spec.keyField] }, { workspaceRoot, readFiles: /* @__PURE__ */ new Set() });
|
|
79795
|
+
const text = typeof result === "string" ? result : "content" in result ? String(result.content) : JSON.stringify(result);
|
|
79796
|
+
reply(!(typeof result === "object" && "isError" in result && result.isError === true), text.slice(0, 4e3));
|
|
79797
|
+
} catch (error51) {
|
|
79798
|
+
reply(false, error51 instanceof Error ? error51.message : String(error51));
|
|
79799
|
+
}
|
|
79427
79800
|
}
|
|
79428
79801
|
async function syncMcpFromConfig(config2) {
|
|
79429
79802
|
const servers = config2.mcpServers ?? {};
|
|
@@ -79448,7 +79821,10 @@ ${preview.text}` } : {}
|
|
|
79448
79821
|
main: addon.main,
|
|
79449
79822
|
server: addon.server,
|
|
79450
79823
|
state,
|
|
79451
|
-
...state === "updated" && enabled !== void 0 ? { enabledVersion: enabled } : {}
|
|
79824
|
+
...state === "updated" && enabled !== void 0 ? { enabledVersion: enabled } : {},
|
|
79825
|
+
...addon.page !== void 0 ? { pageTitle: addon.page.title } : {},
|
|
79826
|
+
...addon.icon !== void 0 ? { icon: addon.icon } : {},
|
|
79827
|
+
...addon.pageProblem !== void 0 ? { pageProblem: addon.pageProblem } : {}
|
|
79452
79828
|
};
|
|
79453
79829
|
});
|
|
79454
79830
|
post({
|
|
@@ -79504,7 +79880,7 @@ ${preview.text}` } : {}
|
|
|
79504
79880
|
}
|
|
79505
79881
|
async function handleSaveAddonFolders(folders) {
|
|
79506
79882
|
const cleaned = [...new Set(folders.map((folder) => folder.trim()).filter((folder) => folder.length > 0))];
|
|
79507
|
-
const relative = cleaned.find((folder) => !
|
|
79883
|
+
const relative = cleaned.find((folder) => !import_node_path50.default.isAbsolute(folder));
|
|
79508
79884
|
if (relative !== void 0) {
|
|
79509
79885
|
await postAddons(`"${relative}" is not a full path. Add-on folders are full paths, such as C:\\addons.`);
|
|
79510
79886
|
return;
|
|
@@ -79515,7 +79891,7 @@ ${preview.text}` } : {}
|
|
|
79515
79891
|
postMcp();
|
|
79516
79892
|
await postAddons();
|
|
79517
79893
|
}
|
|
79518
|
-
const shadowGit = workspaceRoot !== void 0 ? new ShadowGit(workspaceRoot,
|
|
79894
|
+
const shadowGit = workspaceRoot !== void 0 ? new ShadowGit(workspaceRoot, import_node_path50.default.join(storageDir, "checkpoints", "shadow.git"), services.codebaseDir !== void 0 ? import_node_path50.default.join(services.codebaseDir, "checkpoint-objects") : void 0) : void 0;
|
|
79519
79895
|
async function postProfiles() {
|
|
79520
79896
|
const { config: config2 } = await configManager.load();
|
|
79521
79897
|
const profiles = await Promise.all((config2.profiles ?? []).map((profile) => toSummary(profile, secrets)));
|
|
@@ -79572,7 +79948,7 @@ ${preview.text}` } : {}
|
|
|
79572
79948
|
if (workspaceRoot === void 0 || conversation.isEmpty())
|
|
79573
79949
|
return;
|
|
79574
79950
|
if (activeTaskId === void 0) {
|
|
79575
|
-
await setActiveTaskId((0,
|
|
79951
|
+
await setActiveTaskId((0, import_node_crypto15.randomUUID)());
|
|
79576
79952
|
activeTaskCreatedAt = Date.now();
|
|
79577
79953
|
truncationStore.startTask();
|
|
79578
79954
|
}
|
|
@@ -79917,7 +80293,9 @@ ${preview.text}` } : {}
|
|
|
79917
80293
|
...cachedReadRoots,
|
|
79918
80294
|
...(services.siblings ?? []).map((s) => s.path),
|
|
79919
80295
|
droppedFilesRoot2,
|
|
79920
|
-
mailAttachmentsRoot2
|
|
80296
|
+
mailAttachmentsRoot2,
|
|
80297
|
+
// What an add-on fetched for investigation (a file from a Linux machine, say) is read without asking.
|
|
80298
|
+
...installedAddons.map((addon) => addonDownloadsDir(addonRoot, addon))
|
|
79921
80299
|
],
|
|
79922
80300
|
...services.fileReach === "anywhere" ? { reach: "anywhere" } : {},
|
|
79923
80301
|
// Resolved per turn by the host, so an edit applies to the next command rather than
|
|
@@ -80330,7 +80708,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
80330
80708
|
try {
|
|
80331
80709
|
const { config: config2 } = await configManager.load();
|
|
80332
80710
|
const profiles = config2.profiles ?? [];
|
|
80333
|
-
const id = input.id ?? (0,
|
|
80711
|
+
const id = input.id ?? (0, import_node_crypto15.randomUUID)();
|
|
80334
80712
|
const existing = profiles.find((p) => p.id === id);
|
|
80335
80713
|
const auth2 = await buildAuthFromInput(input, id);
|
|
80336
80714
|
const saved = {
|
|
@@ -80368,7 +80746,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
80368
80746
|
post({ type: "error", message: `Profile "${id}" no longer exists.` });
|
|
80369
80747
|
return;
|
|
80370
80748
|
}
|
|
80371
|
-
const newId = (0,
|
|
80749
|
+
const newId = (0, import_node_crypto15.randomUUID)();
|
|
80372
80750
|
async function copySecret(fromRef, toRef) {
|
|
80373
80751
|
if (fromRef === void 0)
|
|
80374
80752
|
return false;
|
|
@@ -81185,7 +81563,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81185
81563
|
return { mode: cachedSearchScope, author: cachedAttribution.author };
|
|
81186
81564
|
}
|
|
81187
81565
|
function currentProjectNames() {
|
|
81188
|
-
const names = [cachedAttribution.project, workspaceRoot !== void 0 ?
|
|
81566
|
+
const names = [cachedAttribution.project, workspaceRoot !== void 0 ? import_node_path50.default.basename(workspaceRoot) : void 0];
|
|
81189
81567
|
return names.filter((name) => name !== void 0 && name.length > 0);
|
|
81190
81568
|
}
|
|
81191
81569
|
function indexProject(config2) {
|
|
@@ -81288,8 +81666,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81288
81666
|
limit: limits.limit,
|
|
81289
81667
|
previewChars: limits.previewChars
|
|
81290
81668
|
});
|
|
81291
|
-
for (const
|
|
81292
|
-
skipped.add(
|
|
81669
|
+
for (const path61 of answer.skipped ?? [])
|
|
81670
|
+
skipped.add(path61);
|
|
81293
81671
|
return { messages: answer.messages, truncated: answer.truncated };
|
|
81294
81672
|
},
|
|
81295
81673
|
...embedder !== void 0 && search !== void 0 && collection !== void 0 ? {
|
|
@@ -81588,9 +81966,9 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81588
81966
|
});
|
|
81589
81967
|
const all = result.folders.map((entry) => entry.path);
|
|
81590
81968
|
const wanted = new Set(chosen);
|
|
81591
|
-
for (const
|
|
81592
|
-
if (chosen.some((root) =>
|
|
81593
|
-
wanted.add(
|
|
81969
|
+
for (const path61 of all) {
|
|
81970
|
+
if (chosen.some((root) => path61 === root || path61.startsWith(`${root}\\`)))
|
|
81971
|
+
wanted.add(path61);
|
|
81594
81972
|
}
|
|
81595
81973
|
return [...wanted];
|
|
81596
81974
|
} catch {
|
|
@@ -81598,7 +81976,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81598
81976
|
}
|
|
81599
81977
|
}
|
|
81600
81978
|
async function handleRequestOutlookFolders(depth, force = false) {
|
|
81601
|
-
const cachePath =
|
|
81979
|
+
const cachePath = import_node_path50.default.join(storageDir, "outlook-folders.json");
|
|
81602
81980
|
let served = false;
|
|
81603
81981
|
try {
|
|
81604
81982
|
const cached2 = JSON.parse(await import_promises27.default.readFile(cachePath, "utf8"));
|
|
@@ -81618,7 +81996,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81618
81996
|
const scannedAt = Date.now();
|
|
81619
81997
|
post({ type: "outlookFolders", folders: result.folders, scannedAt });
|
|
81620
81998
|
try {
|
|
81621
|
-
await import_promises27.default.mkdir(
|
|
81999
|
+
await import_promises27.default.mkdir(import_node_path50.default.dirname(cachePath), { recursive: true });
|
|
81622
82000
|
await import_promises27.default.writeFile(cachePath, JSON.stringify({ scannedAt, folders: result.folders }), "utf8");
|
|
81623
82001
|
} catch {
|
|
81624
82002
|
}
|
|
@@ -81863,7 +82241,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81863
82241
|
if (auth2.clientId === void 0 || auth2.clientSecretRef === void 0) {
|
|
81864
82242
|
throw new AtlassianError("AutoSys uses the API gateway but the client id or secret is missing. Settings \u2192 DevOps \u2192 AutoSys \u2192 API gateway: enter both and save.");
|
|
81865
82243
|
}
|
|
81866
|
-
const key2 = JSON.stringify({ auth: auth2, baseUrl: config2.autosys?.baseUrl, tls: tls2 === void 0 ? 0 : (0,
|
|
82244
|
+
const key2 = JSON.stringify({ auth: auth2, baseUrl: config2.autosys?.baseUrl, tls: tls2 === void 0 ? 0 : (0, import_node_crypto15.createHash)("sha256").update(JSON.stringify(tls2)).digest("hex") });
|
|
81867
82245
|
if (autosysGateway?.key === key2)
|
|
81868
82246
|
return autosysGateway.strategy;
|
|
81869
82247
|
const secretRef = auth2.clientSecretRef;
|
|
@@ -82284,7 +82662,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82284
82662
|
approvalStamps.set("machine", stamp2);
|
|
82285
82663
|
}
|
|
82286
82664
|
for (const dir of python.toolDirectories()) {
|
|
82287
|
-
const file2 =
|
|
82665
|
+
const file2 = import_node_path50.default.join(dir, REGISTRY_FILE);
|
|
82288
82666
|
const stamp2 = await import_promises27.default.stat(file2).then((stat) => stat.mtimeMs, () => 0);
|
|
82289
82667
|
if (approvalStamps.has(file2) && approvalStamps.get(file2) !== stamp2)
|
|
82290
82668
|
changed = true;
|
|
@@ -82375,7 +82753,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82375
82753
|
return;
|
|
82376
82754
|
}
|
|
82377
82755
|
const folder = skill.filePath.slice(0, skill.filePath.length - "SKILL.md".length);
|
|
82378
|
-
const bytes = await import_promises27.default.readFile(
|
|
82756
|
+
const bytes = await import_promises27.default.readFile(import_node_path50.default.join(folder, SKILL_IMAGE_DIR, image));
|
|
82379
82757
|
const dataUri = skillImageDataUri(image, bytes);
|
|
82380
82758
|
post({
|
|
82381
82759
|
type: "skillImage",
|
|
@@ -82703,13 +83081,13 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82703
83081
|
}
|
|
82704
83082
|
function docsFingerprintPath(index, storeId, kind) {
|
|
82705
83083
|
const suffix = kind === void 0 ? "docs" : `docs.${kind}`;
|
|
82706
|
-
return
|
|
83084
|
+
return import_node_path50.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.${suffix}.json`);
|
|
82707
83085
|
}
|
|
82708
83086
|
function manifestKey(index, storeId) {
|
|
82709
83087
|
return `${index}@${storeId}`;
|
|
82710
83088
|
}
|
|
82711
83089
|
function manifestPath(index, storeId) {
|
|
82712
|
-
return
|
|
83090
|
+
return import_node_path50.default.join(manifestsRoot, "index-manifests", `${manifestKey(index, storeId)}.json`);
|
|
82713
83091
|
}
|
|
82714
83092
|
async function readDocsFingerprint(index, storeId, kind) {
|
|
82715
83093
|
try {
|
|
@@ -82739,7 +83117,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82739
83117
|
});
|
|
82740
83118
|
const wanted = options.kind;
|
|
82741
83119
|
const entries = wanted === void 0 ? all : all.filter((entry) => entry.kind === wanted);
|
|
82742
|
-
const fingerprint = (0,
|
|
83120
|
+
const fingerprint = (0, import_node_crypto15.createHash)("sha256").update(`${wanted ?? "all"}:${embedder.model}:${String(embedder.dimensions)}`).update(entries.map((entry) => `${entry.id}\0${entry.text}`).join("")).digest("hex");
|
|
82743
83121
|
if (!options.force && fingerprint === await readDocsFingerprint(index, search.id, wanted)) {
|
|
82744
83122
|
return { unchanged: true, index, indexed: entries.length };
|
|
82745
83123
|
}
|
|
@@ -82773,7 +83151,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82773
83151
|
}
|
|
82774
83152
|
options.report?.("Writing", { done: 0, total: documents.length });
|
|
82775
83153
|
await writer.upsert(index, documents);
|
|
82776
|
-
await import_promises27.default.mkdir(
|
|
83154
|
+
await import_promises27.default.mkdir(import_node_path50.default.dirname(docsFingerprintPath(index, search.id, wanted)), {
|
|
82777
83155
|
recursive: true
|
|
82778
83156
|
});
|
|
82779
83157
|
await import_promises27.default.writeFile(docsFingerprintPath(index, search.id, wanted), JSON.stringify({ fingerprint, indexedAt: Date.now(), count: documents.length }), "utf8");
|
|
@@ -82963,7 +83341,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82963
83341
|
});
|
|
82964
83342
|
if (manifest !== void 0) {
|
|
82965
83343
|
const targetPath = manifestPath(index, target.id);
|
|
82966
|
-
await import_promises27.default.mkdir(
|
|
83344
|
+
await import_promises27.default.mkdir(import_node_path50.default.dirname(targetPath), { recursive: true });
|
|
82967
83345
|
await import_promises27.default.writeFile(targetPath, JSON.stringify(manifest), "utf8");
|
|
82968
83346
|
}
|
|
82969
83347
|
post({ type: "storeSync", running: false, copied: result.copied, fromLabel: source.label });
|
|
@@ -83012,7 +83390,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83012
83390
|
type: "project",
|
|
83013
83391
|
hasWorkspace: workspaceRoot !== void 0,
|
|
83014
83392
|
...configured !== void 0 ? { configured } : {},
|
|
83015
|
-
...workspaceRoot !== void 0 ? { folder:
|
|
83393
|
+
...workspaceRoot !== void 0 ? { folder: import_node_path50.default.basename(workspaceRoot) } : {},
|
|
83016
83394
|
...author !== void 0 ? { author } : {},
|
|
83017
83395
|
...index !== void 0 ? { indexName: index } : {},
|
|
83018
83396
|
...ownerConfigured !== void 0 && ownerConfigured.length > 0 ? { ownerConfigured } : {},
|
|
@@ -83152,8 +83530,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83152
83530
|
if (workspaceRoot === void 0)
|
|
83153
83531
|
return found2;
|
|
83154
83532
|
const root = workspaceRoot;
|
|
83155
|
-
const relative =
|
|
83156
|
-
if (relative.startsWith("..") ||
|
|
83533
|
+
const relative = import_node_path50.default.relative(root, folder);
|
|
83534
|
+
if (relative.startsWith("..") || import_node_path50.default.isAbsolute(relative))
|
|
83157
83535
|
return found2;
|
|
83158
83536
|
const output = await new Promise((resolve) => {
|
|
83159
83537
|
const child = (0, import_node_child_process14.spawn)("git", ["-c", "core.quotePath=false", "log", "--diff-filter=A", "--relative", "--format=@@%an", "--name-only", "--", relative.length > 0 ? relative : "."], {
|
|
@@ -83170,7 +83548,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83170
83548
|
if (line.startsWith("@@"))
|
|
83171
83549
|
author = line.slice(2).trim();
|
|
83172
83550
|
else if (line.trim().length > 0 && author !== void 0 && author.length > 0) {
|
|
83173
|
-
found2.set(normalizeForComparison(
|
|
83551
|
+
found2.set(normalizeForComparison(import_node_path50.default.resolve(root, line.trim())), author);
|
|
83174
83552
|
}
|
|
83175
83553
|
}
|
|
83176
83554
|
return found2;
|
|
@@ -83214,7 +83592,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83214
83592
|
},
|
|
83215
83593
|
source,
|
|
83216
83594
|
folder,
|
|
83217
|
-
relative:
|
|
83595
|
+
relative: import_node_path50.default.relative(folder, filePath).split(import_node_path50.default.sep).join("/")
|
|
83218
83596
|
});
|
|
83219
83597
|
};
|
|
83220
83598
|
for (const folder of skillFolders) {
|
|
@@ -83232,7 +83610,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83232
83610
|
const name = entry.slice(0, -3);
|
|
83233
83611
|
if (!isValidToolName(name))
|
|
83234
83612
|
continue;
|
|
83235
|
-
await consider("tool", name,
|
|
83613
|
+
await consider("tool", name, import_node_path50.default.join(folder, entry), folder, location);
|
|
83236
83614
|
}
|
|
83237
83615
|
}
|
|
83238
83616
|
const readOnly = skills.filter((skill) => skill.sourceDir !== void 0 && !skillFolders.some((folder) => samePath(folder, skill.sourceDir))).length;
|
|
@@ -83264,7 +83642,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83264
83642
|
} catch {
|
|
83265
83643
|
}
|
|
83266
83644
|
}
|
|
83267
|
-
const gitAuthor = gitAuthors.get(normalizeForComparison(
|
|
83645
|
+
const gitAuthor = gitAuthors.get(normalizeForComparison(import_node_path50.default.resolve(candidate.entry.filePath)));
|
|
83268
83646
|
if (gitAuthor !== void 0) {
|
|
83269
83647
|
candidate.entry.suggestion = { author: gitAuthor, source: "git: the commit that added this file" };
|
|
83270
83648
|
}
|
|
@@ -83373,7 +83751,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83373
83751
|
aliases: plan2.kind === "codebase" ? codebaseAliases(config2) : plan2.kind === "skills" ? skillAliases(config2) : [],
|
|
83374
83752
|
onProgress: (count3) => post({ type: "indexRenames", running: true, plans, store, current: plan2.to, copied: count3 })
|
|
83375
83753
|
});
|
|
83376
|
-
await copyBookkeeping(
|
|
83754
|
+
await copyBookkeeping(import_node_path50.default.join(manifestsRoot, "index-manifests"), plan2.from, plan2.to, search.id);
|
|
83377
83755
|
done.push({ ...plan2, copied });
|
|
83378
83756
|
}
|
|
83379
83757
|
post({ type: "indexRenames", running: false, plans: [], store, done });
|
|
@@ -83403,7 +83781,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83403
83781
|
project: projectName(config2, workspaceRoot),
|
|
83404
83782
|
aliases: codebaseAliases(config2)
|
|
83405
83783
|
});
|
|
83406
|
-
await copyBookkeeping(
|
|
83784
|
+
await copyBookkeeping(import_node_path50.default.join(manifestsRoot, "index-manifests"), legacy, current, search.id);
|
|
83407
83785
|
post({ type: "indexRenames", running: false, plans: [], done: [{ kind: "codebase", from: legacy, to: current, copied }] });
|
|
83408
83786
|
logger.info(`copied ${String(copied)} chunks from ${legacy} to ${current} rather than re-embedding them`);
|
|
83409
83787
|
}
|
|
@@ -83569,7 +83947,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83569
83947
|
denylist,
|
|
83570
83948
|
manifest,
|
|
83571
83949
|
saveManifest: async (next) => {
|
|
83572
|
-
await import_promises27.default.mkdir(
|
|
83950
|
+
await import_promises27.default.mkdir(import_node_path50.default.dirname(manifestFile), { recursive: true });
|
|
83573
83951
|
await import_promises27.default.writeFile(manifestFile, JSON.stringify(next), "utf8");
|
|
83574
83952
|
},
|
|
83575
83953
|
...isIgnored2 !== void 0 ? { isIgnored: isIgnored2 } : {},
|
|
@@ -83616,9 +83994,9 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83616
83994
|
}
|
|
83617
83995
|
const usageLog = new UsageLog(storageDir);
|
|
83618
83996
|
const usageInstance = usageInstanceId(storageDir);
|
|
83619
|
-
const usageProfileFile =
|
|
83620
|
-
const legacyBackfillFile =
|
|
83621
|
-
const usageDir =
|
|
83997
|
+
const usageProfileFile = import_node_path50.default.join(storageDir, "usage-profile.json");
|
|
83998
|
+
const legacyBackfillFile = import_node_path50.default.join(storageDir, "usage-backfill.json");
|
|
83999
|
+
const usageDir = import_node_path50.default.join(storageDir, "usage");
|
|
83622
84000
|
const toolStartedAt = /* @__PURE__ */ new Map();
|
|
83623
84001
|
let usagePushTimer;
|
|
83624
84002
|
let usagePushing;
|
|
@@ -83636,7 +84014,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83636
84014
|
return (request) => runFastFs(exe, request);
|
|
83637
84015
|
}
|
|
83638
84016
|
function skillAtPath(requested2) {
|
|
83639
|
-
const absolute =
|
|
84017
|
+
const absolute = import_node_path50.default.isAbsolute(requested2) ? requested2 : workspaceRoot === void 0 ? void 0 : import_node_path50.default.resolve(workspaceRoot, requested2);
|
|
83640
84018
|
if (absolute === void 0)
|
|
83641
84019
|
return void 0;
|
|
83642
84020
|
return skills.find((skill) => samePath(skill.filePath, absolute));
|
|
@@ -83709,7 +84087,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83709
84087
|
const folder = chosen.path?.trim();
|
|
83710
84088
|
if (folder === void 0 || folder.length === 0)
|
|
83711
84089
|
return { problem: "The shared folder has no path." };
|
|
83712
|
-
if (!
|
|
84090
|
+
if (!import_node_path50.default.isAbsolute(folder))
|
|
83713
84091
|
return { problem: `"${folder}" is not an absolute path. Use the full path of a folder everybody can reach, such as a network share.` };
|
|
83714
84092
|
const helper = usageHelper();
|
|
83715
84093
|
return { store: new FolderShardStore(folder, ...helper !== void 0 ? [helper] : []), target };
|
|
@@ -83738,7 +84116,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83738
84116
|
}
|
|
83739
84117
|
async function readUsageBackfill() {
|
|
83740
84118
|
try {
|
|
83741
|
-
const text = await import_promises27.default.readFile(
|
|
84119
|
+
const text = await import_promises27.default.readFile(import_node_path50.default.join(usageDir, "backfill.json"), "utf8").catch(() => import_promises27.default.readFile(legacyBackfillFile, "utf8"));
|
|
83742
84120
|
const saved = JSON.parse(text);
|
|
83743
84121
|
if (typeof saved.at !== "number")
|
|
83744
84122
|
return void 0;
|
|
@@ -83754,7 +84132,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83754
84132
|
legacyDoneFile: legacyBackfillFile,
|
|
83755
84133
|
run: async (before) => {
|
|
83756
84134
|
const status2 = python.status();
|
|
83757
|
-
return backfillFromTasks(
|
|
84135
|
+
return backfillFromTasks(import_node_path50.default.join(storageDir, "tasks"), {
|
|
83758
84136
|
user: cachedAttribution.author ?? "unknown",
|
|
83759
84137
|
project: cachedAttribution.project,
|
|
83760
84138
|
workspaceRoot,
|
|
@@ -83852,7 +84230,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83852
84230
|
try {
|
|
83853
84231
|
const text = (await import_promises27.default.readFile(file2, "utf8")).replace(/\r\n/g, "\n");
|
|
83854
84232
|
const meaningful = text.split("\n").filter((line) => !/^(author|project|version|updated)\s*:/i.test(line) && !/^__(author|project|version|updated)__\s*=/.test(line)).join("\n").trim();
|
|
83855
|
-
return (0,
|
|
84233
|
+
return (0, import_node_crypto15.createHash)("sha256").update(meaningful).digest("hex").slice(0, 16);
|
|
83856
84234
|
} catch {
|
|
83857
84235
|
return void 0;
|
|
83858
84236
|
}
|
|
@@ -83927,14 +84305,14 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83927
84305
|
kind: "tool",
|
|
83928
84306
|
name: issue2.name,
|
|
83929
84307
|
filePath: issue2.filePath,
|
|
83930
|
-
deletable: samePath(
|
|
83931
|
-
location: where(
|
|
84308
|
+
deletable: samePath(import_node_path50.default.dirname(issue2.filePath), status2.toolsDir),
|
|
84309
|
+
location: where(import_node_path50.default.dirname(issue2.filePath), status2.toolsDir),
|
|
83932
84310
|
issue: issue2.kind === "unapproved" ? "waiting for approval" : issue2.kind === "hash-mismatch" ? "changed since approval" : issue2.detail.split("\n")[0] ?? "not loaded"
|
|
83933
84311
|
});
|
|
83934
84312
|
}
|
|
83935
84313
|
return items;
|
|
83936
84314
|
}
|
|
83937
|
-
const usageDirectoryFile =
|
|
84315
|
+
const usageDirectoryFile = import_node_path50.default.join(storageDir, "usage-directory.json");
|
|
83938
84316
|
let directoryRunning;
|
|
83939
84317
|
async function readDirectoryCache() {
|
|
83940
84318
|
try {
|
|
@@ -84266,7 +84644,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84266
84644
|
let indexedFiles = 0;
|
|
84267
84645
|
if (index !== void 0) {
|
|
84268
84646
|
try {
|
|
84269
|
-
const manifest = JSON.parse(await import_promises27.default.readFile(
|
|
84647
|
+
const manifest = JSON.parse(await import_promises27.default.readFile(import_node_path50.default.join(manifestsRoot, "index-manifests", `${index}.json`), "utf8"));
|
|
84270
84648
|
indexedFiles = Object.keys(manifest.files ?? {}).length;
|
|
84271
84649
|
} catch {
|
|
84272
84650
|
}
|
|
@@ -84538,7 +84916,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84538
84916
|
return;
|
|
84539
84917
|
}
|
|
84540
84918
|
const { config: config2 } = await configManager.load();
|
|
84541
|
-
const id = input.id ?? (0,
|
|
84919
|
+
const id = input.id ?? (0, import_node_crypto15.randomUUID)();
|
|
84542
84920
|
if (input.username !== void 0 && input.username.length > 0)
|
|
84543
84921
|
await secrets.set(searchUserRefFor(id), input.username);
|
|
84544
84922
|
if (input.password !== void 0 && input.password.length > 0)
|
|
@@ -84834,7 +85212,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84834
85212
|
if (changeLedger !== void 0) {
|
|
84835
85213
|
const shared = await changeLedger.othersSince(targets, taskCheckpoint.createdAt);
|
|
84836
85214
|
if (shared.size > 0) {
|
|
84837
|
-
const shown2 = (file2) =>
|
|
85215
|
+
const shown2 = (file2) => import_node_path50.default.relative(workspaceRoot ?? "", file2).split(import_node_path50.default.sep).join("/");
|
|
84838
85216
|
const detail = [...shared].map(([file2, chats]) => `${shown2(file2)} (${chats.join(", ")})`).join("; ");
|
|
84839
85217
|
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");
|
|
84840
85218
|
if (!all) {
|
|
@@ -85032,7 +85410,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85032
85410
|
const pathRequest = pendingPathApprovals.get(id);
|
|
85033
85411
|
userGate.resolve(id, "approve");
|
|
85034
85412
|
if (pathRequest !== void 0) {
|
|
85035
|
-
const folder =
|
|
85413
|
+
const folder = import_node_path50.default.dirname(pathRequest);
|
|
85036
85414
|
sessionPathGrants.add(normalizeForComparison(pathRequest));
|
|
85037
85415
|
if (scope === "folder" && !cachedReadRoots.includes(folder)) {
|
|
85038
85416
|
const { config: config2 } = await configManager.load();
|
|
@@ -85272,10 +85650,10 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85272
85650
|
});
|
|
85273
85651
|
return;
|
|
85274
85652
|
}
|
|
85275
|
-
let dir =
|
|
85653
|
+
let dir = import_node_path50.default.dirname(import_node_path50.default.resolve(scriptPath));
|
|
85276
85654
|
for (let depth = 0; depth < 3; depth++) {
|
|
85277
85655
|
for (const name of VENV_DIR_NAMES) {
|
|
85278
|
-
const candidate =
|
|
85656
|
+
const candidate = import_node_path50.default.join(dir, name);
|
|
85279
85657
|
const found2 = await search(candidate);
|
|
85280
85658
|
if (found2 !== void 0) {
|
|
85281
85659
|
post({
|
|
@@ -85287,7 +85665,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85287
85665
|
return;
|
|
85288
85666
|
}
|
|
85289
85667
|
}
|
|
85290
|
-
const parent =
|
|
85668
|
+
const parent = import_node_path50.default.dirname(dir);
|
|
85291
85669
|
if (parent === dir)
|
|
85292
85670
|
break;
|
|
85293
85671
|
dir = parent;
|
|
@@ -85605,6 +85983,16 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85605
85983
|
reportFailure("handleClearCodebaseIndex", handleClearCodebaseIndex());
|
|
85606
85984
|
} else if (message4.type === "openStandingSkill") {
|
|
85607
85985
|
reportFailure("handleOpenStandingSkill", handleOpenStandingSkill());
|
|
85986
|
+
} else if (message4.type === "requestAddonPage") {
|
|
85987
|
+
reportFailure("postAddonPage", postAddonPage(message4.package));
|
|
85988
|
+
} else if (message4.type === "saveAddonRecord") {
|
|
85989
|
+
reportFailure("handleSaveAddonRecord", handleSaveAddonRecord(message4));
|
|
85990
|
+
} else if (message4.type === "deleteAddonRecord") {
|
|
85991
|
+
reportFailure("handleDeleteAddonRecord", handleDeleteAddonRecord(message4.package, message4.id));
|
|
85992
|
+
} else if (message4.type === "saveAddonValues") {
|
|
85993
|
+
reportFailure("handleSaveAddonValues", handleSaveAddonValues(message4));
|
|
85994
|
+
} else if (message4.type === "runAddonAction") {
|
|
85995
|
+
reportFailure("handleRunAddonAction", handleRunAddonAction(message4.package, message4.id, message4.tool));
|
|
85608
85996
|
} else if (message4.type === "requestAddons") {
|
|
85609
85997
|
reportFailure("postAddons", postAddons());
|
|
85610
85998
|
} else if (message4.type === "enableAddon") {
|
|
@@ -86118,11 +86506,11 @@ Could not be drawn: ${entry.message}`);
|
|
|
86118
86506
|
let lastReportPath;
|
|
86119
86507
|
async function saveReport(title, contents) {
|
|
86120
86508
|
try {
|
|
86121
|
-
const directory =
|
|
86509
|
+
const directory = import_node_path50.default.join(storageDir, "reports");
|
|
86122
86510
|
await import_promises27.default.mkdir(directory, { recursive: true });
|
|
86123
86511
|
const stamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
86124
86512
|
const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
|
|
86125
|
-
const target =
|
|
86513
|
+
const target = import_node_path50.default.join(directory, `${stamp2}${slug.length > 0 ? `-${slug}` : ""}.md`);
|
|
86126
86514
|
await import_promises27.default.writeFile(target, `# ${title}
|
|
86127
86515
|
|
|
86128
86516
|
${contents}
|
|
@@ -86138,7 +86526,7 @@ ${contents}
|
|
|
86138
86526
|
const keep = 100;
|
|
86139
86527
|
const entries = (await import_promises27.default.readdir(directory)).filter((name) => name.endsWith(".md")).sort();
|
|
86140
86528
|
for (const name of entries.slice(0, Math.max(0, entries.length - keep))) {
|
|
86141
|
-
await import_promises27.default.rm(
|
|
86529
|
+
await import_promises27.default.rm(import_node_path50.default.join(directory, name), { force: true });
|
|
86142
86530
|
}
|
|
86143
86531
|
}
|
|
86144
86532
|
let scheduleTimer;
|
|
@@ -86211,7 +86599,7 @@ ${contents}
|
|
|
86211
86599
|
async function handleSaveSchedule(schedule) {
|
|
86212
86600
|
try {
|
|
86213
86601
|
const schedules = await loadSchedules();
|
|
86214
|
-
const id = schedule.id.length > 0 ? schedule.id : (0,
|
|
86602
|
+
const id = schedule.id.length > 0 ? schedule.id : (0, import_node_crypto15.createHash)("sha256").update(`${schedule.name}:${String(Date.now())}`).digest("hex").slice(0, 12);
|
|
86215
86603
|
const armed = { ...schedule, id, nextRunAt: nextFireTime(schedule, Date.now()) };
|
|
86216
86604
|
await saveSchedules({ ...schedules, [id]: armed });
|
|
86217
86605
|
} catch (error51) {
|
|
@@ -86220,7 +86608,7 @@ ${contents}
|
|
|
86220
86608
|
}
|
|
86221
86609
|
async function createScheduleFromProposal(proposal) {
|
|
86222
86610
|
const schedules = await loadSchedules();
|
|
86223
|
-
const id = (0,
|
|
86611
|
+
const id = (0, import_node_crypto15.createHash)("sha256").update(`${proposal.name}:${String(Date.now())}`).digest("hex").slice(0, 12);
|
|
86224
86612
|
const schedule = {
|
|
86225
86613
|
id,
|
|
86226
86614
|
name: proposal.name,
|
|
@@ -86251,10 +86639,10 @@ ${contents}
|
|
|
86251
86639
|
}
|
|
86252
86640
|
const CLAIM_STALE_MS = 60 * 60 * 1e3;
|
|
86253
86641
|
async function claimSchedule(id) {
|
|
86254
|
-
const claimPath =
|
|
86642
|
+
const claimPath = import_node_path50.default.join(storageDir, "schedule-claims", `${id}.json`);
|
|
86255
86643
|
const mine = JSON.stringify({ pid: process.pid, at: Date.now() });
|
|
86256
86644
|
try {
|
|
86257
|
-
await import_promises27.default.mkdir(
|
|
86645
|
+
await import_promises27.default.mkdir(import_node_path50.default.dirname(claimPath), { recursive: true });
|
|
86258
86646
|
await import_promises27.default.writeFile(claimPath, mine, { encoding: "utf8", flag: "wx" });
|
|
86259
86647
|
return true;
|
|
86260
86648
|
} catch (error51) {
|
|
@@ -86279,7 +86667,7 @@ ${contents}
|
|
|
86279
86667
|
}
|
|
86280
86668
|
}
|
|
86281
86669
|
async function releaseSchedule(id) {
|
|
86282
|
-
await import_promises27.default.rm(
|
|
86670
|
+
await import_promises27.default.rm(import_node_path50.default.join(storageDir, "schedule-claims", `${id}.json`), { force: true }).catch(() => void 0);
|
|
86283
86671
|
}
|
|
86284
86672
|
async function runSchedule(id, reason) {
|
|
86285
86673
|
if (reason === "due" && !await claimSchedule(id))
|
|
@@ -86947,11 +87335,11 @@ function createShowDiagramTool() {
|
|
|
86947
87335
|
|
|
86948
87336
|
// ../../packages/core/dist/lsp/manager.js
|
|
86949
87337
|
var import_promises28 = __toESM(require("node:fs/promises"), 1);
|
|
86950
|
-
var
|
|
87338
|
+
var import_node_path52 = __toESM(require("node:path"), 1);
|
|
86951
87339
|
|
|
86952
87340
|
// ../../packages/core/dist/lsp/catalog.js
|
|
86953
87341
|
var import_node_fs11 = require("node:fs");
|
|
86954
|
-
var
|
|
87342
|
+
var import_node_path51 = __toESM(require("node:path"), 1);
|
|
86955
87343
|
var c = (command, ...args) => ({ command, args });
|
|
86956
87344
|
var LSP_LANGUAGES = [
|
|
86957
87345
|
{ id: "python", label: "Python", extensions: ["py", "pyi"], candidates: [c("pyright-langserver", "--stdio"), c("basedpyright-langserver", "--stdio"), c("pylsp"), c("jedi-language-server")] },
|
|
@@ -86999,16 +87387,16 @@ var LSP_LANGUAGES = [
|
|
|
86999
87387
|
{ id: "sql", label: "SQL", extensions: ["sql"], candidates: [c("sql-language-server", "up", "--method", "stdio")] }
|
|
87000
87388
|
];
|
|
87001
87389
|
function languageFor(file2) {
|
|
87002
|
-
const ext =
|
|
87390
|
+
const ext = import_node_path51.default.extname(file2).slice(1).toLowerCase();
|
|
87003
87391
|
return LSP_LANGUAGES.find((l) => l.extensions.includes(ext));
|
|
87004
87392
|
}
|
|
87005
87393
|
function languageIdFor(language, file2) {
|
|
87006
|
-
const ext =
|
|
87394
|
+
const ext = import_node_path51.default.extname(file2).slice(1).toLowerCase();
|
|
87007
87395
|
return language.languageIdFor?.(ext) ?? language.id;
|
|
87008
87396
|
}
|
|
87009
87397
|
var found = /* @__PURE__ */ new Map();
|
|
87010
87398
|
function findOnPath(command, env2 = process.env) {
|
|
87011
|
-
if (
|
|
87399
|
+
if (import_node_path51.default.isAbsolute(command))
|
|
87012
87400
|
return (0, import_node_fs11.existsSync)(command) ? command : void 0;
|
|
87013
87401
|
if (env2 !== process.env)
|
|
87014
87402
|
return searchPath(command, env2);
|
|
@@ -87020,11 +87408,11 @@ function findOnPath(command, env2 = process.env) {
|
|
|
87020
87408
|
return value;
|
|
87021
87409
|
}
|
|
87022
87410
|
function searchPath(command, env2) {
|
|
87023
|
-
const dirs = (env2.PATH ?? env2.Path ?? "").split(
|
|
87411
|
+
const dirs = (env2.PATH ?? env2.Path ?? "").split(import_node_path51.default.delimiter).filter((d) => d.length > 0);
|
|
87024
87412
|
const exts = process.platform === "win32" ? ["", ...(env2.PATHEXT ?? ".EXE;.CMD;.BAT").toLowerCase().split(";")] : [""];
|
|
87025
87413
|
for (const dir of dirs) {
|
|
87026
87414
|
for (const ext of exts) {
|
|
87027
|
-
const candidate =
|
|
87415
|
+
const candidate = import_node_path51.default.join(dir, command + ext);
|
|
87028
87416
|
if ((0, import_node_fs11.existsSync)(candidate) && (process.platform !== "win32" || ext !== "" || /\.(exe|cmd|bat)$/i.test(candidate)))
|
|
87029
87417
|
return candidate;
|
|
87030
87418
|
}
|
|
@@ -87256,7 +87644,7 @@ var LspManager = class {
|
|
|
87256
87644
|
return void 0;
|
|
87257
87645
|
const args = [...found2.candidate.args];
|
|
87258
87646
|
if (language.id === "java" && !args.includes("-data"))
|
|
87259
|
-
args.push("-data",
|
|
87647
|
+
args.push("-data", import_node_path52.default.join(this.storageDir, "jdtls-workspace"));
|
|
87260
87648
|
try {
|
|
87261
87649
|
client = new LspClient(found2.executable, args, this.root, this.log);
|
|
87262
87650
|
this.clients.set(language.id, client);
|
|
@@ -87277,7 +87665,7 @@ var LspManager = class {
|
|
|
87277
87665
|
this.failed.set(language.id, client.lastError ?? "stopped");
|
|
87278
87666
|
return void 0;
|
|
87279
87667
|
}
|
|
87280
|
-
return { server:
|
|
87668
|
+
return { server: import_node_path52.default.basename(client.executable).replace(/\.(exe|cmd|bat)$/i, ""), diagnostics: diagnostics ?? [] };
|
|
87281
87669
|
} catch (error51) {
|
|
87282
87670
|
this.failed.set(language.id, error51 instanceof Error ? error51.message : String(error51));
|
|
87283
87671
|
client.dispose();
|
|
@@ -89610,7 +89998,23 @@ Settings \u2192 Export source code saves the whole repository as a zip that buil
|
|
|
89610
89998
|
"fire code addon",
|
|
89611
89999
|
"addon for light code",
|
|
89612
90000
|
"light code addon",
|
|
89613
|
-
"addon tools"
|
|
90001
|
+
"addon tools",
|
|
90002
|
+
"linux",
|
|
90003
|
+
"linux machine",
|
|
90004
|
+
"linux server",
|
|
90005
|
+
"ssh",
|
|
90006
|
+
"putty",
|
|
90007
|
+
"plink",
|
|
90008
|
+
"pageant",
|
|
90009
|
+
"remote server",
|
|
90010
|
+
"connect to a server",
|
|
90011
|
+
"run a command on a server",
|
|
90012
|
+
"download a log",
|
|
90013
|
+
"jump host",
|
|
90014
|
+
"bastion",
|
|
90015
|
+
"host key",
|
|
90016
|
+
"addon tab",
|
|
90017
|
+
"linux tab"
|
|
89614
90018
|
],
|
|
89615
90019
|
body: `
|
|
89616
90020
|
**An add-on is an npm package that runs an MCP server**, labelled in its \`package.json\`:
|
|
@@ -89641,6 +90045,24 @@ can never switch an add-on on. \`addons.folders\` is user-scope only.
|
|
|
89641
90045
|
|
|
89642
90046
|
**Add-ons run as you and can do anything you can.** Only install ones you trust. They run with the
|
|
89643
90047
|
editor's own Node inside VS Code, so no Node install is needed there; Fire Code uses its Node.
|
|
90048
|
+
|
|
90049
|
+
**An add-on can bring its own settings tab**, with its own icon - it appears in Settings only while
|
|
90050
|
+
the add-on is installed. The add-on describes the fields in \`package.json\`
|
|
90051
|
+
(\`lightCode.addon.settings\`: a title, its own fields, and a list such as "machines" with buttons like
|
|
90052
|
+
Test connection); Light Code draws the form. What you enter is kept in your settings, passwords in
|
|
90053
|
+
secret storage, and the add-on receives them when it starts - saving the tab restarts it.
|
|
90054
|
+
|
|
90055
|
+
**The Linux add-on** (\`npm i -g @chosengeneration/light-code-addon-linux\`): enable it in Settings \u2192
|
|
90056
|
+
MCP \u2192 Add-ons, then add machines on its **Linux** tab, each with a short label (\`prod-web-1\`), host, user
|
|
90057
|
+
and sign-in (Pageant - the default - the Windows OpenSSH agent, a key file, or a password), and press
|
|
90058
|
+
Test connection. The assistant can then list the machines, **run read-only commands** (\`df -h\`, \`tail\`,
|
|
90059
|
+
\`grep\`, \`ps\`, \`journalctl\`, \`systemctl status\`, \`docker ps\`... joined with \`|\`; nothing that writes,
|
|
90060
|
+
chains or never ends is sent) and **download a file** to read here. SSH runs inside Node - no plink, no
|
|
90061
|
+
ssh.exe, no new program - with one sign-in per machine reused, and a refused sign-in never retried, so
|
|
90062
|
+
it does not set off security monitoring or lock an account. Host keys are trusted the first time and
|
|
90063
|
+
checked after; a changed key is refused until you press Forget host key. A machine behind a bastion:
|
|
90064
|
+
add the bastion too and put its label in *Connect through*. Newer PuTTY keys (.ppk version 3): load
|
|
90065
|
+
them into Pageant, or export an OpenSSH key from PuTTYgen.
|
|
89644
90066
|
`
|
|
89645
90067
|
},
|
|
89646
90068
|
{
|
|
@@ -90517,7 +90939,7 @@ function createLightCodeHelpTool() {
|
|
|
90517
90939
|
|
|
90518
90940
|
// ../../packages/core/dist/tools/listFiles.js
|
|
90519
90941
|
var import_node_child_process16 = require("node:child_process");
|
|
90520
|
-
var
|
|
90942
|
+
var import_node_path53 = __toESM(require("node:path"), 1);
|
|
90521
90943
|
|
|
90522
90944
|
// ../../packages/core/dist/tools/ripgrepError.js
|
|
90523
90945
|
function ripgrepDidNotStart(error51) {
|
|
@@ -90598,7 +91020,7 @@ var listFilesTool = {
|
|
|
90598
91020
|
});
|
|
90599
91021
|
if (files.length === 0)
|
|
90600
91022
|
return noFiles;
|
|
90601
|
-
const listed = files.map((file2) => file2.split("/").join(
|
|
91023
|
+
const listed = files.map((file2) => file2.split("/").join(import_node_path53.default.sep)).join("\n");
|
|
90602
91024
|
return { content: truncated ? `${listed}
|
|
90603
91025
|
(listing cut short \u2014 list a narrower folder)` : listed };
|
|
90604
91026
|
}
|
|
@@ -90826,7 +91248,7 @@ var searchFilesTool = {
|
|
|
90826
91248
|
};
|
|
90827
91249
|
|
|
90828
91250
|
// ../../packages/core/dist/tools/writeToFile.js
|
|
90829
|
-
var
|
|
91251
|
+
var import_node_path54 = __toESM(require("node:path"), 1);
|
|
90830
91252
|
var paramsSchema23 = external_exports.object({
|
|
90831
91253
|
path: external_exports.string().min(1).describe("Path to the file, relative to the workspace root."),
|
|
90832
91254
|
content: external_exports.string().describe("Full file content to write.")
|
|
@@ -90854,7 +91276,7 @@ var writeToFileTool = {
|
|
|
90854
91276
|
return { content: changed, isError: true, path: params3.path };
|
|
90855
91277
|
}
|
|
90856
91278
|
if (!exists2) {
|
|
90857
|
-
await context.fs.mkdir(
|
|
91279
|
+
await context.fs.mkdir(import_node_path54.default.dirname(resolved.realPath));
|
|
90858
91280
|
}
|
|
90859
91281
|
await context.fs.writeFile(resolved.realPath, params3.content);
|
|
90860
91282
|
await recordWrite(context, resolved.realPath);
|
|
@@ -90956,14 +91378,14 @@ function createDefaultToolRegistry() {
|
|
|
90956
91378
|
|
|
90957
91379
|
// ../../packages/core/dist/dataset/store.js
|
|
90958
91380
|
var import_promises29 = __toESM(require("node:fs/promises"), 1);
|
|
90959
|
-
var
|
|
91381
|
+
var import_node_path55 = __toESM(require("node:path"), 1);
|
|
90960
91382
|
var DatasetStore = class {
|
|
90961
91383
|
filePath;
|
|
90962
91384
|
statePath;
|
|
90963
91385
|
constructor(storageDir, datasetId) {
|
|
90964
91386
|
const safe = datasetId.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
90965
|
-
this.filePath =
|
|
90966
|
-
this.statePath =
|
|
91387
|
+
this.filePath = import_node_path55.default.join(storageDir, "datasets", `${safe}.jsonl`);
|
|
91388
|
+
this.statePath = import_node_path55.default.join(storageDir, "datasets", `${safe}.state.json`);
|
|
90967
91389
|
}
|
|
90968
91390
|
/** Every record. A malformed line is skipped — one bad line costs one record, not the corpus. */
|
|
90969
91391
|
async load() {
|
|
@@ -90991,7 +91413,7 @@ var DatasetStore = class {
|
|
|
90991
91413
|
async append(records) {
|
|
90992
91414
|
if (records.length === 0)
|
|
90993
91415
|
return;
|
|
90994
|
-
await import_promises29.default.mkdir(
|
|
91416
|
+
await import_promises29.default.mkdir(import_node_path55.default.dirname(this.filePath), { recursive: true });
|
|
90995
91417
|
await import_promises29.default.writeFile(this.filePath, "", { flag: "a" });
|
|
90996
91418
|
const lines = records.map((record2) => JSON.stringify(record2)).join("\n");
|
|
90997
91419
|
await import_promises29.default.appendFile(this.filePath, `${lines}
|
|
@@ -90999,7 +91421,7 @@ var DatasetStore = class {
|
|
|
90999
91421
|
}
|
|
91000
91422
|
/** Rewrites with exactly these. Temp-and-rename, so an interrupted prune leaves the old file. */
|
|
91001
91423
|
async replace(records) {
|
|
91002
|
-
await import_promises29.default.mkdir(
|
|
91424
|
+
await import_promises29.default.mkdir(import_node_path55.default.dirname(this.filePath), { recursive: true });
|
|
91003
91425
|
const temporary = `${this.filePath}.tmp`;
|
|
91004
91426
|
const body = records.map((record2) => JSON.stringify(record2)).join("\n");
|
|
91005
91427
|
await import_promises29.default.writeFile(temporary, records.length === 0 ? "" : `${body}
|
|
@@ -91053,7 +91475,7 @@ var DatasetStore = class {
|
|
|
91053
91475
|
}
|
|
91054
91476
|
}
|
|
91055
91477
|
async recordSync(at) {
|
|
91056
|
-
await import_promises29.default.mkdir(
|
|
91478
|
+
await import_promises29.default.mkdir(import_node_path55.default.dirname(this.statePath), { recursive: true });
|
|
91057
91479
|
const temporary = `${this.statePath}.tmp`;
|
|
91058
91480
|
await import_promises29.default.writeFile(temporary, JSON.stringify({ lastSyncedAt: at }), "utf8");
|
|
91059
91481
|
await replaceFile(temporary, this.statePath);
|
|
@@ -91390,8 +91812,8 @@ That is a fault in the tool itself, or the source is unreachable from here. Fix
|
|
|
91390
91812
|
}
|
|
91391
91813
|
|
|
91392
91814
|
// ../../packages/core/dist/s3/sigv4.js
|
|
91393
|
-
var
|
|
91394
|
-
var EMPTY_PAYLOAD_SHA256 = (0,
|
|
91815
|
+
var import_node_crypto16 = require("node:crypto");
|
|
91816
|
+
var EMPTY_PAYLOAD_SHA256 = (0, import_node_crypto16.createHash)("sha256").update("").digest("hex");
|
|
91395
91817
|
function encodeSegment(segment) {
|
|
91396
91818
|
return encodeURIComponent(segment).replace(/[!'()*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
91397
91819
|
}
|
|
@@ -91415,10 +91837,10 @@ function amzDate(now) {
|
|
|
91415
91837
|
return `${now.toISOString().replace(/[-:]/g, "").slice(0, 15)}Z`;
|
|
91416
91838
|
}
|
|
91417
91839
|
function signingKey(secretAccessKey, date5, region, service) {
|
|
91418
|
-
const dateKey = (0,
|
|
91419
|
-
const regionKey = (0,
|
|
91420
|
-
const serviceKey = (0,
|
|
91421
|
-
return (0,
|
|
91840
|
+
const dateKey = (0, import_node_crypto16.createHmac)("sha256", `AWS4${secretAccessKey}`).update(date5).digest();
|
|
91841
|
+
const regionKey = (0, import_node_crypto16.createHmac)("sha256", dateKey).update(region).digest();
|
|
91842
|
+
const serviceKey = (0, import_node_crypto16.createHmac)("sha256", regionKey).update(service).digest();
|
|
91843
|
+
return (0, import_node_crypto16.createHmac)("sha256", serviceKey).update("aws4_request").digest();
|
|
91422
91844
|
}
|
|
91423
91845
|
function signRequest(input) {
|
|
91424
91846
|
const service = input.service ?? "s3";
|
|
@@ -91427,7 +91849,7 @@ function signRequest(input) {
|
|
|
91427
91849
|
const date5 = timestamp.slice(0, 8);
|
|
91428
91850
|
const url2 = new URL(input.url);
|
|
91429
91851
|
const body = input.body ?? Buffer.alloc(0);
|
|
91430
|
-
const payloadHash = (0,
|
|
91852
|
+
const payloadHash = (0, import_node_crypto16.createHash)("sha256").update(body).digest("hex");
|
|
91431
91853
|
const headers = {
|
|
91432
91854
|
...input.headers,
|
|
91433
91855
|
host: url2.host,
|
|
@@ -91451,9 +91873,9 @@ function signRequest(input) {
|
|
|
91451
91873
|
"AWS4-HMAC-SHA256",
|
|
91452
91874
|
timestamp,
|
|
91453
91875
|
scope,
|
|
91454
|
-
(0,
|
|
91876
|
+
(0, import_node_crypto16.createHash)("sha256").update(canonicalRequest).digest("hex")
|
|
91455
91877
|
].join("\n");
|
|
91456
|
-
const signature = (0,
|
|
91878
|
+
const signature = (0, import_node_crypto16.createHmac)("sha256", signingKey(input.secretAccessKey, date5, input.region, service)).update(stringToSign).digest("hex");
|
|
91457
91879
|
return {
|
|
91458
91880
|
headers: {
|
|
91459
91881
|
...headers,
|
|
@@ -91483,8 +91905,8 @@ var S3Client = class {
|
|
|
91483
91905
|
const host = inPath ? origin.host : `${bucket}.${origin.host}`;
|
|
91484
91906
|
const mount = origin.pathname === "/" ? "" : origin.pathname.replace(/\/+$/, "");
|
|
91485
91907
|
const prefix = inPath ? `${mount}/${bucket}` : mount;
|
|
91486
|
-
const
|
|
91487
|
-
const url2 = new URL(`${origin.protocol}//${host}${prefix}${
|
|
91908
|
+
const path61 = key2 === "" ? "" : `/${key2.split("/").map((part) => encodeURIComponent(part)).join("/")}`;
|
|
91909
|
+
const url2 = new URL(`${origin.protocol}//${host}${prefix}${path61}`);
|
|
91488
91910
|
for (const [name, value] of Object.entries(call.query ?? {}))
|
|
91489
91911
|
url2.searchParams.set(name, value);
|
|
91490
91912
|
return url2.toString();
|
|
@@ -91974,15 +92396,15 @@ function createS3Tools(targets) {
|
|
|
91974
92396
|
}
|
|
91975
92397
|
|
|
91976
92398
|
// ../../packages/core/dist/s3/localFolder.js
|
|
91977
|
-
var
|
|
92399
|
+
var import_node_crypto17 = require("node:crypto");
|
|
91978
92400
|
function mirrorFolder(options) {
|
|
91979
92401
|
const connection = safeSegment(options.connectionId);
|
|
91980
|
-
const digest = (0,
|
|
92402
|
+
const digest = (0, import_node_crypto17.createHash)("sha256").update((options.prefix ?? "").trim().toLowerCase()).digest("hex").slice(0, 8);
|
|
91981
92403
|
return join2(options.storageDir, "s3", connection, `${options.kind}-${digest}`);
|
|
91982
92404
|
}
|
|
91983
92405
|
function safeSegment(id) {
|
|
91984
92406
|
const cleaned = id.replace(/[^a-zA-Z0-9._-]/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "").slice(0, 40);
|
|
91985
|
-
const suffix = (0,
|
|
92407
|
+
const suffix = (0, import_node_crypto17.createHash)("sha256").update(id).digest("hex").slice(0, 6);
|
|
91986
92408
|
return `${cleaned === "" ? "connection" : cleaned}-${suffix}`;
|
|
91987
92409
|
}
|
|
91988
92410
|
function join2(...parts) {
|
|
@@ -92069,13 +92491,13 @@ function reachableOrigins(hosts, extra = []) {
|
|
|
92069
92491
|
}
|
|
92070
92492
|
|
|
92071
92493
|
// src/identity.ts
|
|
92072
|
-
var
|
|
92494
|
+
var import_node_crypto18 = __toESM(require("node:crypto"), 1);
|
|
92073
92495
|
var SingleUserIdentity = class _SingleUserIdentity {
|
|
92074
92496
|
describe;
|
|
92075
92497
|
static PRINCIPAL = { id: "local", displayName: "Local user" };
|
|
92076
92498
|
principal;
|
|
92077
92499
|
/** Long-lived, minted per server run, only ever sent in an `Authorization` header. */
|
|
92078
|
-
sessionToken =
|
|
92500
|
+
sessionToken = import_node_crypto18.default.randomBytes(32).toString("base64url");
|
|
92079
92501
|
/**
|
|
92080
92502
|
* Single-use and short-lived, because it travels in the launch URL's fragment where it
|
|
92081
92503
|
* can end up in shell history or a terminal scrollback (§14).
|
|
@@ -92085,7 +92507,7 @@ var SingleUserIdentity = class _SingleUserIdentity {
|
|
|
92085
92507
|
* raises it, and what that costs is stated where it is set: a longer window is a longer time in
|
|
92086
92508
|
* which somebody reading that scrollback can use it before you do.
|
|
92087
92509
|
*/
|
|
92088
|
-
handoffToken =
|
|
92510
|
+
handoffToken = import_node_crypto18.default.randomBytes(32).toString("base64url");
|
|
92089
92511
|
handoffExpiresAt;
|
|
92090
92512
|
handoffSeconds;
|
|
92091
92513
|
/**
|
|
@@ -92115,7 +92537,7 @@ var SingleUserIdentity = class _SingleUserIdentity {
|
|
|
92115
92537
|
* which is the same person it was printed to in the first place.
|
|
92116
92538
|
*/
|
|
92117
92539
|
remintHandoff() {
|
|
92118
|
-
this.handoffToken =
|
|
92540
|
+
this.handoffToken = import_node_crypto18.default.randomBytes(32).toString("base64url");
|
|
92119
92541
|
this.handoffExpiresAt = Date.now() + this.handoffSeconds * 1e3;
|
|
92120
92542
|
return this.handoffToken;
|
|
92121
92543
|
}
|
|
@@ -92154,10 +92576,10 @@ function timingSafeEquals(a, b) {
|
|
|
92154
92576
|
const left = Buffer.from(a);
|
|
92155
92577
|
const right = Buffer.from(b);
|
|
92156
92578
|
if (left.length !== right.length) return false;
|
|
92157
|
-
return
|
|
92579
|
+
return import_node_crypto18.default.timingSafeEqual(left, right);
|
|
92158
92580
|
}
|
|
92159
92581
|
function storageKeyFor(principal) {
|
|
92160
|
-
return
|
|
92582
|
+
return import_node_crypto18.default.createHash("sha256").update(principal.id).digest("hex").slice(0, 32);
|
|
92161
92583
|
}
|
|
92162
92584
|
var OpenIdentity = class _OpenIdentity {
|
|
92163
92585
|
describe = "single user, no token (--no-token)";
|
|
@@ -92426,22 +92848,22 @@ async function readJsonBody(request, maxBytes = 32 * 1024 * 1024) {
|
|
|
92426
92848
|
|
|
92427
92849
|
// src/fileSecretStore.ts
|
|
92428
92850
|
var import_promises30 = __toESM(require("node:fs/promises"), 1);
|
|
92429
|
-
var
|
|
92851
|
+
var import_node_path56 = __toESM(require("node:path"), 1);
|
|
92430
92852
|
|
|
92431
92853
|
// src/vaultCrypto.ts
|
|
92432
|
-
var
|
|
92854
|
+
var import_node_crypto19 = require("node:crypto");
|
|
92433
92855
|
function isVaultEnvelope(value) {
|
|
92434
92856
|
const v = value;
|
|
92435
92857
|
return typeof v === "object" && v !== null && v.sunVault === 1 && typeof v.iv === "string" && typeof v.tag === "string" && typeof v.data === "string";
|
|
92436
92858
|
}
|
|
92437
92859
|
function sealSecrets(secrets, key2) {
|
|
92438
|
-
const iv = (0,
|
|
92439
|
-
const cipher = (0,
|
|
92860
|
+
const iv = (0, import_node_crypto19.randomBytes)(12);
|
|
92861
|
+
const cipher = (0, import_node_crypto19.createCipheriv)("aes-256-gcm", key2, iv);
|
|
92440
92862
|
const data = Buffer.concat([cipher.update(JSON.stringify(secrets), "utf8"), cipher.final()]);
|
|
92441
92863
|
return { sunVault: 1, iv: iv.toString("base64"), tag: cipher.getAuthTag().toString("base64"), data: data.toString("base64") };
|
|
92442
92864
|
}
|
|
92443
92865
|
function openSecrets(envelope, key2) {
|
|
92444
|
-
const decipher = (0,
|
|
92866
|
+
const decipher = (0, import_node_crypto19.createDecipheriv)("aes-256-gcm", key2, Buffer.from(envelope.iv, "base64"));
|
|
92445
92867
|
decipher.setAuthTag(Buffer.from(envelope.tag, "base64"));
|
|
92446
92868
|
const plain = Buffer.concat([decipher.update(Buffer.from(envelope.data, "base64")), decipher.final()]);
|
|
92447
92869
|
const parsed = JSON.parse(plain.toString("utf8"));
|
|
@@ -92524,7 +92946,7 @@ var FileSecretStore = class {
|
|
|
92524
92946
|
);
|
|
92525
92947
|
}
|
|
92526
92948
|
mutate(secrets);
|
|
92527
|
-
await import_promises30.default.mkdir(
|
|
92949
|
+
await import_promises30.default.mkdir(import_node_path56.default.dirname(this.filePath), { recursive: true });
|
|
92528
92950
|
const temp = `${this.filePath}.${process.pid}.tmp`;
|
|
92529
92951
|
const body = this.key === void 0 ? secrets : sealSecrets(secrets, this.key);
|
|
92530
92952
|
await import_promises30.default.writeFile(temp, JSON.stringify(body, null, 2), { encoding: "utf8", mode: 384 });
|
|
@@ -92559,9 +92981,9 @@ var FileSecretStore = class {
|
|
|
92559
92981
|
};
|
|
92560
92982
|
|
|
92561
92983
|
// src/reviewQueue.ts
|
|
92562
|
-
var
|
|
92984
|
+
var import_node_crypto20 = __toESM(require("node:crypto"), 1);
|
|
92563
92985
|
var import_promises31 = __toESM(require("node:fs/promises"), 1);
|
|
92564
|
-
var
|
|
92986
|
+
var import_node_path57 = __toESM(require("node:path"), 1);
|
|
92565
92987
|
var ReviewQueue = class {
|
|
92566
92988
|
constructor(filePath) {
|
|
92567
92989
|
this.filePath = filePath;
|
|
@@ -92580,7 +93002,7 @@ var ReviewQueue = class {
|
|
|
92580
93002
|
}
|
|
92581
93003
|
async persist(items) {
|
|
92582
93004
|
this.cache = items;
|
|
92583
|
-
await import_promises31.default.mkdir(
|
|
93005
|
+
await import_promises31.default.mkdir(import_node_path57.default.dirname(this.filePath), { recursive: true });
|
|
92584
93006
|
const temporary = `${this.filePath}.tmp`;
|
|
92585
93007
|
await import_promises31.default.writeFile(temporary, JSON.stringify(items, null, 2), { encoding: "utf8", mode: 384 });
|
|
92586
93008
|
await replaceFile(temporary, this.filePath);
|
|
@@ -92598,7 +93020,7 @@ var ReviewQueue = class {
|
|
|
92598
93020
|
);
|
|
92599
93021
|
const queued = {
|
|
92600
93022
|
...request,
|
|
92601
|
-
id:
|
|
93023
|
+
id: import_node_crypto20.default.randomUUID(),
|
|
92602
93024
|
submittedAt: Date.now(),
|
|
92603
93025
|
status: "pending"
|
|
92604
93026
|
};
|
|
@@ -92822,7 +93244,7 @@ var RoutedSecretStore = class {
|
|
|
92822
93244
|
// src/userVariables.ts
|
|
92823
93245
|
var import_promises32 = __toESM(require("node:fs/promises"), 1);
|
|
92824
93246
|
var import_node_fs12 = require("node:fs");
|
|
92825
|
-
var
|
|
93247
|
+
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
92826
93248
|
var UserVariableStore = class {
|
|
92827
93249
|
constructor(filePath) {
|
|
92828
93250
|
this.filePath = filePath;
|
|
@@ -92837,7 +93259,7 @@ var UserVariableStore = class {
|
|
|
92837
93259
|
}
|
|
92838
93260
|
async save(variables) {
|
|
92839
93261
|
const parsed = sessionVariablesSchema.parse(variables);
|
|
92840
|
-
await import_promises32.default.mkdir(
|
|
93262
|
+
await import_promises32.default.mkdir(import_node_path58.default.dirname(this.filePath), { recursive: true });
|
|
92841
93263
|
const temporary = `${this.filePath}.tmp`;
|
|
92842
93264
|
await import_promises32.default.writeFile(temporary, JSON.stringify({ variables: parsed }, null, 2), {
|
|
92843
93265
|
encoding: "utf8",
|
|
@@ -92848,10 +93270,10 @@ var UserVariableStore = class {
|
|
|
92848
93270
|
}
|
|
92849
93271
|
};
|
|
92850
93272
|
function userVariableStoreFor(dataDir, principal) {
|
|
92851
|
-
return new UserVariableStore(userVariablesPath(
|
|
93273
|
+
return new UserVariableStore(userVariablesPath(import_node_path58.default.join(dataDir, "users", storageKeyFor(principal))));
|
|
92852
93274
|
}
|
|
92853
93275
|
function userVariablesPath(userDir) {
|
|
92854
|
-
return
|
|
93276
|
+
return import_node_path58.default.join(userDir, "variables.json");
|
|
92855
93277
|
}
|
|
92856
93278
|
function readVariablesFile(filePath) {
|
|
92857
93279
|
try {
|
|
@@ -92881,11 +93303,11 @@ function hostedUser(env2 = process.env) {
|
|
|
92881
93303
|
// src/session.ts
|
|
92882
93304
|
var import_node_fs13 = require("node:fs");
|
|
92883
93305
|
var import_promises33 = __toESM(require("node:fs/promises"), 1);
|
|
92884
|
-
var
|
|
93306
|
+
var import_node_path60 = __toESM(require("node:path"), 1);
|
|
92885
93307
|
|
|
92886
93308
|
// src/credentialTool.ts
|
|
92887
93309
|
var import_node_child_process18 = require("node:child_process");
|
|
92888
|
-
var
|
|
93310
|
+
var import_node_path59 = __toESM(require("node:path"), 1);
|
|
92889
93311
|
var CREDENTIAL_PREFIX2 = "tool:";
|
|
92890
93312
|
var WRAPPER = [
|
|
92891
93313
|
"import importlib.util, json, sys",
|
|
@@ -92905,7 +93327,7 @@ async function fetchCredential(options, reference) {
|
|
|
92905
93327
|
if (name.length === 0) return { problem: "A credential reference needs a name: tool:<name>." };
|
|
92906
93328
|
const budget = options.timeoutMs ?? 3e4;
|
|
92907
93329
|
const run3 = await new Promise((resolve) => {
|
|
92908
|
-
const child = (0, import_node_child_process18.spawn)(options.interpreter, ["-c", WRAPPER,
|
|
93330
|
+
const child = (0, import_node_child_process18.spawn)(options.interpreter, ["-c", WRAPPER, import_node_path59.default.resolve(options.file), name], {
|
|
92909
93331
|
windowsHide: true,
|
|
92910
93332
|
// The environment this was started in, as with the identity function: the libraries that
|
|
92911
93333
|
// hold credentials are configured through it, and nothing here is model-authored.
|
|
@@ -93101,7 +93523,7 @@ var FileConfigStore = class {
|
|
|
93101
93523
|
const filePath = this.pathFor(scope);
|
|
93102
93524
|
if (filePath === void 0)
|
|
93103
93525
|
throw new Error(`Cannot write ${scope} config: no workspace is open`);
|
|
93104
|
-
await import_promises33.default.mkdir(
|
|
93526
|
+
await import_promises33.default.mkdir(import_node_path60.default.dirname(filePath), { recursive: true });
|
|
93105
93527
|
const temporary = `${filePath}.${process.pid.toString(36)}.tmp`;
|
|
93106
93528
|
await import_promises33.default.writeFile(temporary, contents, { encoding: "utf8", mode: 384 });
|
|
93107
93529
|
await replaceFile(temporary, filePath);
|
|
@@ -93138,8 +93560,8 @@ var FileConfigStore = class {
|
|
|
93138
93560
|
};
|
|
93139
93561
|
let watcher;
|
|
93140
93562
|
try {
|
|
93141
|
-
watcher = (0, import_node_fs13.watch)(
|
|
93142
|
-
if (filename ===
|
|
93563
|
+
watcher = (0, import_node_fs13.watch)(import_node_path60.default.dirname(filePath), (_event, filename) => {
|
|
93564
|
+
if (filename === import_node_path60.default.basename(filePath)) onChange();
|
|
93143
93565
|
});
|
|
93144
93566
|
} catch {
|
|
93145
93567
|
}
|
|
@@ -93167,7 +93589,7 @@ var FileWorkspaceState = class {
|
|
|
93167
93589
|
async set(key2, value) {
|
|
93168
93590
|
if (value === void 0) delete this.values[key2];
|
|
93169
93591
|
else this.values[key2] = value;
|
|
93170
|
-
await import_promises33.default.mkdir(
|
|
93592
|
+
await import_promises33.default.mkdir(import_node_path60.default.dirname(this.filePath), { recursive: true });
|
|
93171
93593
|
await import_promises33.default.writeFile(this.filePath, JSON.stringify(this.values, null, 2), {
|
|
93172
93594
|
encoding: "utf8",
|
|
93173
93595
|
mode: 384
|
|
@@ -93216,7 +93638,7 @@ function createBrowserUi(workspaceRoot, post, fastFs) {
|
|
|
93216
93638
|
openFile: async (filePath) => {
|
|
93217
93639
|
try {
|
|
93218
93640
|
post(
|
|
93219
|
-
[`[info] ${
|
|
93641
|
+
[`[info] ${import_node_path60.default.basename(filePath)}`, "", await import_promises33.default.readFile(filePath, "utf8")].join("\n")
|
|
93220
93642
|
);
|
|
93221
93643
|
} catch (error51) {
|
|
93222
93644
|
post(`[warning] Could not read ${filePath}: ${String(error51)}`);
|
|
@@ -93258,7 +93680,7 @@ function createBrowserUi(workspaceRoot, post, fastFs) {
|
|
|
93258
93680
|
for (const entry of entries) {
|
|
93259
93681
|
if (found2.length >= limit) return;
|
|
93260
93682
|
if (entry.name.startsWith(".") && entry.name !== ".env") continue;
|
|
93261
|
-
const full =
|
|
93683
|
+
const full = import_node_path60.default.join(dir, entry.name);
|
|
93262
93684
|
if (entry.isDirectory()) {
|
|
93263
93685
|
if (!skip.has(entry.name)) await walk(full, level + 1);
|
|
93264
93686
|
} else if (depth !== void 0 && level !== depth) {
|
|
@@ -93294,11 +93716,11 @@ var SHARED_COLLECTIONS = [
|
|
|
93294
93716
|
{ key: "mcpServers" }
|
|
93295
93717
|
];
|
|
93296
93718
|
async function createSession(options) {
|
|
93297
|
-
const userDir =
|
|
93719
|
+
const userDir = import_node_path60.default.join(options.dataDir, "users", storageKeyFor(options.principal));
|
|
93298
93720
|
await import_promises33.default.mkdir(userDir, { recursive: true, mode: 448 });
|
|
93299
93721
|
const variableStore = new UserVariableStore(userVariablesPath(userDir));
|
|
93300
93722
|
const userVariables = () => variableStore.read();
|
|
93301
|
-
const workspaceState = new FileWorkspaceState(
|
|
93723
|
+
const workspaceState = new FileWorkspaceState(import_node_path60.default.join(userDir, "workspace-state.json"));
|
|
93302
93724
|
await workspaceState.load();
|
|
93303
93725
|
const services = {
|
|
93304
93726
|
/*
|
|
@@ -93386,16 +93808,16 @@ async function createSession(options) {
|
|
|
93386
93808
|
*/
|
|
93387
93809
|
secrets: new CredentialPointerStore(
|
|
93388
93810
|
withCredentialTool(
|
|
93389
|
-
options.sharedSecrets === void 0 ? new FileSecretStore(options.secretsFile ??
|
|
93390
|
-
new FileSecretStore(options.secretsFile ??
|
|
93811
|
+
options.sharedSecrets === void 0 ? new FileSecretStore(options.secretsFile ?? import_node_path60.default.join(userDir, "secrets.json"), options.secretsKey) : new RoutedSecretStore(
|
|
93812
|
+
new FileSecretStore(options.secretsFile ?? import_node_path60.default.join(userDir, "secrets.json"), options.secretsKey),
|
|
93391
93813
|
options.sharedSecrets
|
|
93392
93814
|
),
|
|
93393
93815
|
options
|
|
93394
93816
|
)
|
|
93395
93817
|
),
|
|
93396
93818
|
configStore: withSharedEntries(
|
|
93397
|
-
options.sharedProfiles === void 0 ? new FileConfigStore(options.configFile ??
|
|
93398
|
-
new FileConfigStore(options.configFile ??
|
|
93819
|
+
options.sharedProfiles === void 0 ? new FileConfigStore(options.configFile ?? import_node_path60.default.join(userDir, "config.json"), options.workspaceRoot) : new SharedProfileConfigStore(
|
|
93820
|
+
new FileConfigStore(options.configFile ?? import_node_path60.default.join(userDir, "config.json"), options.workspaceRoot),
|
|
93399
93821
|
options.sharedProfiles
|
|
93400
93822
|
),
|
|
93401
93823
|
options
|
|
@@ -93513,8 +93935,8 @@ async function startServer(options) {
|
|
|
93513
93935
|
));
|
|
93514
93936
|
const roles = options.roles ?? SINGLE_USER_POLICY;
|
|
93515
93937
|
const sharedStore = options.sharedConfig;
|
|
93516
|
-
const sharedSecretStore = new FileSecretStore(
|
|
93517
|
-
const reviews = new ReviewQueue(
|
|
93938
|
+
const sharedSecretStore = new FileSecretStore(import_node_path61.default.join(options.dataDir, "shared-secrets.json"));
|
|
93939
|
+
const reviews = new ReviewQueue(import_node_path61.default.join(options.dataDir, "reviews.json"));
|
|
93518
93940
|
let sharedCache = {
|
|
93519
93941
|
variables: [],
|
|
93520
93942
|
adminIds: [],
|
|
@@ -93890,14 +94312,14 @@ async function startServer(options) {
|
|
|
93890
94312
|
return "No workspace is open, so there is nowhere to write it.";
|
|
93891
94313
|
try {
|
|
93892
94314
|
if (item.kind === "skill") {
|
|
93893
|
-
const dir2 =
|
|
94315
|
+
const dir2 = import_node_path61.default.join(options.workspaceRoot, ".lightcode", "skills");
|
|
93894
94316
|
await import_promises34.default.mkdir(dir2, { recursive: true });
|
|
93895
|
-
await import_promises34.default.writeFile(
|
|
94317
|
+
await import_promises34.default.writeFile(import_node_path61.default.join(dir2, `${item.name}.md`), item.content, "utf8");
|
|
93896
94318
|
return void 0;
|
|
93897
94319
|
}
|
|
93898
|
-
const dir =
|
|
94320
|
+
const dir = import_node_path61.default.join(options.workspaceRoot, ".lightcode", "tools");
|
|
93899
94321
|
await import_promises34.default.mkdir(dir, { recursive: true });
|
|
93900
|
-
await import_promises34.default.writeFile(
|
|
94322
|
+
await import_promises34.default.writeFile(import_node_path61.default.join(dir, `${item.name}.py`), item.content, "utf8");
|
|
93901
94323
|
return void 0;
|
|
93902
94324
|
} catch (error51) {
|
|
93903
94325
|
return error51 instanceof Error ? error51.message : String(error51);
|
|
@@ -94046,7 +94468,7 @@ async function startServer(options) {
|
|
|
94046
94468
|
return;
|
|
94047
94469
|
}
|
|
94048
94470
|
response.writeHead(200, {
|
|
94049
|
-
"Content-Type": CONTENT_TYPES2[
|
|
94471
|
+
"Content-Type": CONTENT_TYPES2[import_node_path61.default.extname(asset)] ?? "application/octet-stream",
|
|
94050
94472
|
...securityHeaders()
|
|
94051
94473
|
});
|
|
94052
94474
|
response.end(body);
|