@chosengeneration/light-code 0.133.0 → 0.136.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 +2 -2
- package/dist/server.cjs +955 -774
- 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 path58 = 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 (path58 && !path58.startsWith("/")) {
|
|
502
|
+
path58 = `/${path58}`;
|
|
503
503
|
}
|
|
504
|
-
url2 = new URL(origin +
|
|
504
|
+
url2 = new URL(origin + path58);
|
|
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(path58) {
|
|
2119
|
+
if (typeof path58 !== "string") {
|
|
2120
2120
|
return "";
|
|
2121
2121
|
}
|
|
2122
|
-
for (var i =
|
|
2123
|
-
switch (
|
|
2122
|
+
for (var i = path58.length - 1; i >= 0; --i) {
|
|
2123
|
+
switch (path58.charCodeAt(i)) {
|
|
2124
2124
|
case 47:
|
|
2125
2125
|
// '/'
|
|
2126
2126
|
case 92:
|
|
2127
|
-
|
|
2128
|
-
return
|
|
2127
|
+
path58 = path58.slice(i + 1);
|
|
2128
|
+
return path58 === ".." || path58 === "." ? "" : path58;
|
|
2129
2129
|
}
|
|
2130
2130
|
}
|
|
2131
|
-
return
|
|
2131
|
+
return path58 === ".." || path58 === "." ? "" : path58;
|
|
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: path58,
|
|
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 path58 !== "string") {
|
|
5176
5176
|
throw new InvalidArgumentError("path must be a string");
|
|
5177
|
-
} else if (
|
|
5177
|
+
} else if (path58[0] !== "/" && !(path58.startsWith("http://") || path58.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(path58) !== 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(path58, query) : path58;
|
|
5243
5243
|
this.origin = origin;
|
|
5244
5244
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
5245
5245
|
this.blocking = blocking == null ? false : blocking;
|
|
@@ -5744,7 +5744,7 @@ var require_connect = __commonJS({
|
|
|
5744
5744
|
const sessionCache = new SessionCache(maxCachedSessions == null ? 100 : maxCachedSessions);
|
|
5745
5745
|
timeout = timeout == null ? 1e4 : timeout;
|
|
5746
5746
|
allowH2 = allowH2 != null ? allowH2 : false;
|
|
5747
|
-
return function
|
|
5747
|
+
return function connect2({ hostname: hostname3, host, protocol, port, servername, localAddress, httpSocket }, callback) {
|
|
5748
5748
|
let socket;
|
|
5749
5749
|
if (protocol === "https:") {
|
|
5750
5750
|
if (!tls2) {
|
|
@@ -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 path58 = 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 = path58;
|
|
6253
6253
|
this.opts.origin = origin;
|
|
6254
6254
|
this.opts.maxRedirections = 0;
|
|
6255
6255
|
this.opts.query = null;
|
|
@@ -6499,7 +6499,7 @@ var require_client = __commonJS({
|
|
|
6499
6499
|
strictContentLength,
|
|
6500
6500
|
maxCachedSessions,
|
|
6501
6501
|
maxRedirections,
|
|
6502
|
-
connect:
|
|
6502
|
+
connect: connect3,
|
|
6503
6503
|
maxRequestsPerClient,
|
|
6504
6504
|
localAddress,
|
|
6505
6505
|
maxResponseSize,
|
|
@@ -6549,7 +6549,7 @@ var require_client = __commonJS({
|
|
|
6549
6549
|
if (bodyTimeout != null && (!Number.isInteger(bodyTimeout) || bodyTimeout < 0)) {
|
|
6550
6550
|
throw new InvalidArgumentError("bodyTimeout must be a positive integer or zero");
|
|
6551
6551
|
}
|
|
6552
|
-
if (
|
|
6552
|
+
if (connect3 != null && typeof connect3 !== "function" && typeof connect3 !== "object") {
|
|
6553
6553
|
throw new InvalidArgumentError("connect must be a function or an object");
|
|
6554
6554
|
}
|
|
6555
6555
|
if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) {
|
|
@@ -6573,20 +6573,20 @@ var require_client = __commonJS({
|
|
|
6573
6573
|
if (maxConcurrentStreams != null && (typeof maxConcurrentStreams !== "number" || maxConcurrentStreams < 1)) {
|
|
6574
6574
|
throw new InvalidArgumentError("maxConcurrentStreams must be a possitive integer, greater than 0");
|
|
6575
6575
|
}
|
|
6576
|
-
if (typeof
|
|
6577
|
-
|
|
6576
|
+
if (typeof connect3 !== "function") {
|
|
6577
|
+
connect3 = buildConnector({
|
|
6578
6578
|
...tls2,
|
|
6579
6579
|
maxCachedSessions,
|
|
6580
6580
|
allowH2,
|
|
6581
6581
|
socketPath,
|
|
6582
6582
|
timeout: connectTimeout,
|
|
6583
6583
|
...util.nodeHasAutoSelectFamily && autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : void 0,
|
|
6584
|
-
...
|
|
6584
|
+
...connect3
|
|
6585
6585
|
});
|
|
6586
6586
|
}
|
|
6587
6587
|
this[kInterceptors] = interceptors && interceptors.Client && Array.isArray(interceptors.Client) ? interceptors.Client : [createRedirectInterceptor({ maxRedirections })];
|
|
6588
6588
|
this[kUrl] = util.parseOrigin(url2);
|
|
6589
|
-
this[kConnector] =
|
|
6589
|
+
this[kConnector] = connect3;
|
|
6590
6590
|
this[kSocket] = null;
|
|
6591
6591
|
this[kPipelining] = pipelining != null ? pipelining : 1;
|
|
6592
6592
|
this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize;
|
|
@@ -6646,7 +6646,7 @@ var require_client = __commonJS({
|
|
|
6646
6646
|
}
|
|
6647
6647
|
/* istanbul ignore: only used for test */
|
|
6648
6648
|
[kConnect](cb) {
|
|
6649
|
-
|
|
6649
|
+
connect2(this);
|
|
6650
6650
|
this.once("connect", cb);
|
|
6651
6651
|
}
|
|
6652
6652
|
[kDispatch](opts, handler) {
|
|
@@ -7240,7 +7240,7 @@ var require_client = __commonJS({
|
|
|
7240
7240
|
client.emit("disconnect", client[kUrl], [client], err);
|
|
7241
7241
|
resume(client);
|
|
7242
7242
|
}
|
|
7243
|
-
async function
|
|
7243
|
+
async function connect2(client) {
|
|
7244
7244
|
assert2(!client[kConnecting]);
|
|
7245
7245
|
assert2(!client[kSocket]);
|
|
7246
7246
|
let { host, hostname: hostname3, protocol, port } = client[kUrl];
|
|
@@ -7459,7 +7459,7 @@ var require_client = __commonJS({
|
|
|
7459
7459
|
return;
|
|
7460
7460
|
}
|
|
7461
7461
|
if (!socket && !client[kHTTP2Session]) {
|
|
7462
|
-
|
|
7462
|
+
connect2(client);
|
|
7463
7463
|
return;
|
|
7464
7464
|
}
|
|
7465
7465
|
if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) {
|
|
@@ -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: path58, 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} ${path58} 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: path58, 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] = path58;
|
|
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") {
|
|
@@ -8340,7 +8340,7 @@ var require_pool = __commonJS({
|
|
|
8340
8340
|
constructor(origin, {
|
|
8341
8341
|
connections,
|
|
8342
8342
|
factory = defaultFactory,
|
|
8343
|
-
connect,
|
|
8343
|
+
connect: connect2,
|
|
8344
8344
|
connectTimeout,
|
|
8345
8345
|
tls: tls2,
|
|
8346
8346
|
maxCachedSessions,
|
|
@@ -8357,24 +8357,24 @@ var require_pool = __commonJS({
|
|
|
8357
8357
|
if (typeof factory !== "function") {
|
|
8358
8358
|
throw new InvalidArgumentError("factory must be a function.");
|
|
8359
8359
|
}
|
|
8360
|
-
if (
|
|
8360
|
+
if (connect2 != null && typeof connect2 !== "function" && typeof connect2 !== "object") {
|
|
8361
8361
|
throw new InvalidArgumentError("connect must be a function or an object");
|
|
8362
8362
|
}
|
|
8363
|
-
if (typeof
|
|
8364
|
-
|
|
8363
|
+
if (typeof connect2 !== "function") {
|
|
8364
|
+
connect2 = buildConnector({
|
|
8365
8365
|
...tls2,
|
|
8366
8366
|
maxCachedSessions,
|
|
8367
8367
|
allowH2,
|
|
8368
8368
|
socketPath,
|
|
8369
8369
|
timeout: connectTimeout,
|
|
8370
8370
|
...util.nodeHasAutoSelectFamily && autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : void 0,
|
|
8371
|
-
...
|
|
8371
|
+
...connect2
|
|
8372
8372
|
});
|
|
8373
8373
|
}
|
|
8374
8374
|
this[kInterceptors] = options.interceptors && options.interceptors.Pool && Array.isArray(options.interceptors.Pool) ? options.interceptors.Pool : [];
|
|
8375
8375
|
this[kConnections] = connections || null;
|
|
8376
8376
|
this[kUrl] = util.parseOrigin(origin);
|
|
8377
|
-
this[kOptions] = { ...util.deepClone(options), connect, allowH2 };
|
|
8377
|
+
this[kOptions] = { ...util.deepClone(options), connect: connect2, allowH2 };
|
|
8378
8378
|
this[kOptions].interceptors = options.interceptors ? { ...options.interceptors } : void 0;
|
|
8379
8379
|
this[kFactory] = factory;
|
|
8380
8380
|
this.on("connectionError", (origin2, targets, error51) => {
|
|
@@ -8603,22 +8603,22 @@ var require_agent = __commonJS({
|
|
|
8603
8603
|
return opts && opts.connections === 1 ? new Client2(origin, opts) : new Pool(origin, opts);
|
|
8604
8604
|
}
|
|
8605
8605
|
var Agent2 = class extends DispatcherBase {
|
|
8606
|
-
constructor({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
|
8606
|
+
constructor({ factory = defaultFactory, maxRedirections = 0, connect: connect2, ...options } = {}) {
|
|
8607
8607
|
super();
|
|
8608
8608
|
if (typeof factory !== "function") {
|
|
8609
8609
|
throw new InvalidArgumentError("factory must be a function.");
|
|
8610
8610
|
}
|
|
8611
|
-
if (
|
|
8611
|
+
if (connect2 != null && typeof connect2 !== "function" && typeof connect2 !== "object") {
|
|
8612
8612
|
throw new InvalidArgumentError("connect must be a function or an object");
|
|
8613
8613
|
}
|
|
8614
8614
|
if (!Number.isInteger(maxRedirections) || maxRedirections < 0) {
|
|
8615
8615
|
throw new InvalidArgumentError("maxRedirections must be a positive number");
|
|
8616
8616
|
}
|
|
8617
|
-
if (
|
|
8618
|
-
|
|
8617
|
+
if (connect2 && typeof connect2 !== "function") {
|
|
8618
|
+
connect2 = { ...connect2 };
|
|
8619
8619
|
}
|
|
8620
8620
|
this[kInterceptors] = options.interceptors && options.interceptors.Agent && Array.isArray(options.interceptors.Agent) ? options.interceptors.Agent : [createRedirectInterceptor({ maxRedirections })];
|
|
8621
|
-
this[kOptions] = { ...util.deepClone(options), connect };
|
|
8621
|
+
this[kOptions] = { ...util.deepClone(options), connect: connect2 };
|
|
8622
8622
|
this[kOptions].interceptors = options.interceptors ? { ...options.interceptors } : void 0;
|
|
8623
8623
|
this[kMaxRedirections] = maxRedirections;
|
|
8624
8624
|
this[kFactory] = factory;
|
|
@@ -9721,10 +9721,10 @@ var require_api_connect = __commonJS({
|
|
|
9721
9721
|
}
|
|
9722
9722
|
}
|
|
9723
9723
|
};
|
|
9724
|
-
function
|
|
9724
|
+
function connect2(opts, callback) {
|
|
9725
9725
|
if (callback === void 0) {
|
|
9726
9726
|
return new Promise((resolve, reject2) => {
|
|
9727
|
-
|
|
9727
|
+
connect2.call(this, opts, (err, data) => {
|
|
9728
9728
|
return err ? reject2(err) : resolve(data);
|
|
9729
9729
|
});
|
|
9730
9730
|
});
|
|
@@ -9740,7 +9740,7 @@ var require_api_connect = __commonJS({
|
|
|
9740
9740
|
queueMicrotask(() => callback(err, { opaque }));
|
|
9741
9741
|
}
|
|
9742
9742
|
}
|
|
9743
|
-
module2.exports =
|
|
9743
|
+
module2.exports = connect2;
|
|
9744
9744
|
}
|
|
9745
9745
|
});
|
|
9746
9746
|
|
|
@@ -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(path58) {
|
|
9889
|
+
if (typeof path58 !== "string") {
|
|
9890
|
+
return path58;
|
|
9891
9891
|
}
|
|
9892
|
-
const pathSegments =
|
|
9892
|
+
const pathSegments = path58.split("?");
|
|
9893
9893
|
if (pathSegments.length !== 2) {
|
|
9894
|
-
return
|
|
9894
|
+
return path58;
|
|
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: path58, method, body, headers }) {
|
|
9901
|
+
const pathMatch = matchValue(mockDispatch2.path, path58);
|
|
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: path58 }) => matchValue(safeUrl(path58), 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: path58, method, body, headers, query } = opts;
|
|
9957
9957
|
return {
|
|
9958
|
-
path:
|
|
9958
|
+
path: path58,
|
|
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: path58, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
10408
10408
|
Method: method,
|
|
10409
10409
|
Origin: origin,
|
|
10410
|
-
Path:
|
|
10410
|
+
Path: path58,
|
|
10411
10411
|
"Status code": statusCode,
|
|
10412
10412
|
Persistent: persist ? "\u2705" : "\u274C",
|
|
10413
10413
|
Invocations: timesInvoked,
|
|
@@ -10625,9 +10625,9 @@ var require_proxy_agent = __commonJS({
|
|
|
10625
10625
|
} else if (username && password) {
|
|
10626
10626
|
this[kProxyHeaders]["proxy-authorization"] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(password)}`).toString("base64")}`;
|
|
10627
10627
|
}
|
|
10628
|
-
const
|
|
10628
|
+
const connect2 = buildConnector({ ...opts.proxyTls });
|
|
10629
10629
|
this[kConnectEndpoint] = buildConnector({ ...opts.requestTls });
|
|
10630
|
-
this[kClient] = clientFactory(resolvedUrl, { connect });
|
|
10630
|
+
this[kClient] = clientFactory(resolvedUrl, { connect: connect2 });
|
|
10631
10631
|
this[kAgent] = new Agent2({
|
|
10632
10632
|
...opts,
|
|
10633
10633
|
connect: async (opts2, callback) => {
|
|
@@ -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(path58) {
|
|
15031
|
+
for (const char of path58) {
|
|
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 path58 = opts.path;
|
|
16712
16712
|
if (!opts.path.startsWith("/")) {
|
|
16713
|
-
|
|
16713
|
+
path58 = `/${path58}`;
|
|
16714
16714
|
}
|
|
16715
|
-
url2 = new URL(util.parseOrigin(url2).origin +
|
|
16715
|
+
url2 = new URL(util.parseOrigin(url2).origin + path58);
|
|
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(path58) {
|
|
19987
|
+
let input = path58;
|
|
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 [path58, query] = wsComponent.resourceName.split("?");
|
|
20240
|
+
wsComponent.path = path58 && path58 !== "/" ? path58 : 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 fs39 = require("fs");
|
|
23658
|
-
function checkPathExt(
|
|
23658
|
+
function checkPathExt(path58, 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 && path58.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, path58, options) {
|
|
23676
23676
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
23677
23677
|
return false;
|
|
23678
23678
|
}
|
|
23679
|
-
return checkPathExt(
|
|
23679
|
+
return checkPathExt(path58, options);
|
|
23680
23680
|
}
|
|
23681
|
-
function isexe(
|
|
23682
|
-
fs39.stat(
|
|
23683
|
-
cb(er, er ? false : checkStat(stat,
|
|
23681
|
+
function isexe(path58, options, cb) {
|
|
23682
|
+
fs39.stat(path58, function(er, stat) {
|
|
23683
|
+
cb(er, er ? false : checkStat(stat, path58, options));
|
|
23684
23684
|
});
|
|
23685
23685
|
}
|
|
23686
|
-
function sync(
|
|
23687
|
-
return checkStat(fs39.statSync(
|
|
23686
|
+
function sync(path58, options) {
|
|
23687
|
+
return checkStat(fs39.statSync(path58), path58, 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 fs39 = require("fs");
|
|
23698
|
-
function isexe(
|
|
23699
|
-
fs39.stat(
|
|
23698
|
+
function isexe(path58, options, cb) {
|
|
23699
|
+
fs39.stat(path58, function(er, stat) {
|
|
23700
23700
|
cb(er, er ? false : checkStat(stat, options));
|
|
23701
23701
|
});
|
|
23702
23702
|
}
|
|
23703
|
-
function sync(
|
|
23704
|
-
return checkStat(fs39.statSync(
|
|
23703
|
+
function sync(path58, options) {
|
|
23704
|
+
return checkStat(fs39.statSync(path58), 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(path58, 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(path58, 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(path58, 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(path58, options) {
|
|
23767
23767
|
try {
|
|
23768
|
-
return core.sync(
|
|
23768
|
+
return core.sync(path58, 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 path58 = 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 = path58.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 = path58.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 path58 = 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 ? path58.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 = path58.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 [path58, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
23979
|
+
const binary = path58.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 path58 = require("path");
|
|
24015
24015
|
var resolveCommand = require_resolveCommand();
|
|
24016
24016
|
var escape3 = 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 = path58.normalize(parsed.command);
|
|
24040
24040
|
parsed.command = escape3.command(parsed.command);
|
|
24041
24041
|
parsed.args = parsed.args.map((arg) => escape3.argument(arg, needsDoubleEscapeMetaChars));
|
|
24042
24042
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -24126,7 +24126,7 @@ var require_cross_spawn = __commonJS({
|
|
|
24126
24126
|
var cp = require("child_process");
|
|
24127
24127
|
var parse3 = require_parse2();
|
|
24128
24128
|
var enoent = require_enoent();
|
|
24129
|
-
function
|
|
24129
|
+
function spawn13(command, args, options) {
|
|
24130
24130
|
const parsed = parse3(command, args, options);
|
|
24131
24131
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
24132
24132
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -24138,8 +24138,8 @@ var require_cross_spawn = __commonJS({
|
|
|
24138
24138
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
24139
24139
|
return result;
|
|
24140
24140
|
}
|
|
24141
|
-
module2.exports =
|
|
24142
|
-
module2.exports.spawn =
|
|
24141
|
+
module2.exports = spawn13;
|
|
24142
|
+
module2.exports.spawn = spawn13;
|
|
24143
24143
|
module2.exports.sync = spawnSync;
|
|
24144
24144
|
module2.exports._parse = parse3;
|
|
24145
24145
|
module2.exports._enoent = enoent;
|
|
@@ -24258,9 +24258,9 @@ __export(server_exports, {
|
|
|
24258
24258
|
});
|
|
24259
24259
|
module.exports = __toCommonJS(server_exports);
|
|
24260
24260
|
var import_promises32 = __toESM(require("node:fs/promises"), 1);
|
|
24261
|
-
var
|
|
24261
|
+
var import_node_fs14 = require("node:fs");
|
|
24262
24262
|
var import_node_http = require("node:http");
|
|
24263
|
-
var
|
|
24263
|
+
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
24264
24264
|
|
|
24265
24265
|
// ../../packages/core/dist/platform/http.js
|
|
24266
24266
|
var import_node_crypto = require("node:crypto");
|
|
@@ -24396,21 +24396,21 @@ function buildCaBundle(configured, env2 = process.env) {
|
|
|
24396
24396
|
return [...import_node_tls.default.rootCertificates, ...extraFromEnv, ...extraFromConfig];
|
|
24397
24397
|
}
|
|
24398
24398
|
function buildConnectOptions(options, env2 = process.env) {
|
|
24399
|
-
const
|
|
24399
|
+
const connect2 = {};
|
|
24400
24400
|
if (options.rejectUnauthorized === false)
|
|
24401
|
-
|
|
24401
|
+
connect2.rejectUnauthorized = false;
|
|
24402
24402
|
if (options.cert !== void 0)
|
|
24403
|
-
|
|
24403
|
+
connect2.cert = options.cert;
|
|
24404
24404
|
if (options.key !== void 0)
|
|
24405
|
-
|
|
24405
|
+
connect2.key = options.key;
|
|
24406
24406
|
if (options.pfx !== void 0)
|
|
24407
|
-
|
|
24407
|
+
connect2.pfx = options.pfx;
|
|
24408
24408
|
if (options.passphrase !== void 0)
|
|
24409
|
-
|
|
24409
|
+
connect2.passphrase = options.passphrase;
|
|
24410
24410
|
const ca = buildCaBundle(options.ca, env2);
|
|
24411
24411
|
if (ca !== void 0)
|
|
24412
|
-
|
|
24413
|
-
return
|
|
24412
|
+
connect2.ca = ca;
|
|
24413
|
+
return connect2;
|
|
24414
24414
|
}
|
|
24415
24415
|
|
|
24416
24416
|
// ../../packages/core/dist/platform/http.js
|
|
@@ -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, path58) {
|
|
25425
|
+
if (!path58)
|
|
25426
25426
|
return obj;
|
|
25427
|
-
return
|
|
25427
|
+
return path58.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(path58, 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(path58);
|
|
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, path58 = []) => {
|
|
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 }, [...path58, ...issue2.path]));
|
|
25991
25991
|
} else if (issue2.code === "invalid_key") {
|
|
25992
|
-
processError({ issues: issue2.issues }, [...
|
|
25992
|
+
processError({ issues: issue2.issues }, [...path58, ...issue2.path]);
|
|
25993
25993
|
} else if (issue2.code === "invalid_element") {
|
|
25994
|
-
processError({ issues: issue2.issues }, [...
|
|
25994
|
+
processError({ issues: issue2.issues }, [...path58, ...issue2.path]);
|
|
25995
25995
|
} else {
|
|
25996
|
-
const fullpath = [...
|
|
25996
|
+
const fullpath = [...path58, ...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, path58 = []) => {
|
|
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 }, [...path58, ...issue2.path]));
|
|
26028
26028
|
} else if (issue2.code === "invalid_key") {
|
|
26029
|
-
processError({ issues: issue2.issues }, [...
|
|
26029
|
+
processError({ issues: issue2.issues }, [...path58, ...issue2.path]);
|
|
26030
26030
|
} else if (issue2.code === "invalid_element") {
|
|
26031
|
-
processError({ issues: issue2.issues }, [...
|
|
26031
|
+
processError({ issues: issue2.issues }, [...path58, ...issue2.path]);
|
|
26032
26032
|
} else {
|
|
26033
|
-
const fullpath = [...
|
|
26033
|
+
const fullpath = [...path58, ...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 path58 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
26066
|
+
for (const seg of path58) {
|
|
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 path58 = ref.slice(1).split("/").filter(Boolean);
|
|
38759
|
+
if (path58.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 (path58[0] === defsKey) {
|
|
38764
|
+
const key2 = path58[1];
|
|
38765
38765
|
if (!key2 || !ctx.defs[key2]) {
|
|
38766
38766
|
throw new Error(`Reference not found: ${ref}`);
|
|
38767
38767
|
}
|
|
@@ -39568,7 +39568,7 @@ function skillsForSchedule(skills, allowed) {
|
|
|
39568
39568
|
}
|
|
39569
39569
|
|
|
39570
39570
|
// ../../packages/core/dist/providers/types.js
|
|
39571
|
-
var wireFormatSchema = external_exports.enum(["openai", "anthropic", "gemini"]);
|
|
39571
|
+
var wireFormatSchema = external_exports.enum(["openai", "anthropic", "gemini", "vscode-lm"]);
|
|
39572
39572
|
var tlsSettingsSchema = external_exports.object({
|
|
39573
39573
|
/** Absolute path, or relative to the user-scope `certDir`. PEM, may hold a chain. */
|
|
39574
39574
|
caFile: external_exports.string().optional(),
|
|
@@ -41966,7 +41966,9 @@ function defaultApiKeyHeader(wireFormat) {
|
|
|
41966
41966
|
return { name: "x-api-key", prefix: "" };
|
|
41967
41967
|
case "gemini":
|
|
41968
41968
|
return { name: "x-goog-api-key", prefix: "" };
|
|
41969
|
+
// A Copilot profile (vscode-lm) has no key of ours; VS Code signs the request. Only a fallback.
|
|
41969
41970
|
case "openai":
|
|
41971
|
+
case "vscode-lm":
|
|
41970
41972
|
return { name: "Authorization", prefix: "Bearer " };
|
|
41971
41973
|
}
|
|
41972
41974
|
}
|
|
@@ -43691,9 +43693,86 @@ async function* parseGeminiStream(body, url2, signal) {
|
|
|
43691
43693
|
}
|
|
43692
43694
|
}
|
|
43693
43695
|
|
|
43696
|
+
// ../../packages/core/dist/providers/hostModels.js
|
|
43697
|
+
var NO_HOST_MODELS = "GitHub Copilot is reached through VS Code, and it cannot be reached from here. In VS Code, use the Light Code extension; in Fire Code or the Light Code host on Windows, keep a VS Code window open with the Light Code extension and Copilot signed in.";
|
|
43698
|
+
var HostModelProvider = class {
|
|
43699
|
+
models;
|
|
43700
|
+
model;
|
|
43701
|
+
constructor(models, model) {
|
|
43702
|
+
this.models = models;
|
|
43703
|
+
this.model = model;
|
|
43704
|
+
}
|
|
43705
|
+
async *streamChat(messages, options = {}) {
|
|
43706
|
+
if (this.models === void 0) {
|
|
43707
|
+
yield { type: "error", error: NO_HOST_MODELS };
|
|
43708
|
+
return;
|
|
43709
|
+
}
|
|
43710
|
+
try {
|
|
43711
|
+
for await (const chunk of this.models.chat({ model: this.model, messages, ...options.tools !== void 0 && options.tools.length > 0 ? { tools: options.tools } : {} }, options.signal)) {
|
|
43712
|
+
if (chunk.type === "done")
|
|
43713
|
+
break;
|
|
43714
|
+
yield chunk;
|
|
43715
|
+
if (chunk.type === "error")
|
|
43716
|
+
return;
|
|
43717
|
+
}
|
|
43718
|
+
yield { type: "done" };
|
|
43719
|
+
} catch (error51) {
|
|
43720
|
+
if (options.signal?.aborted === true)
|
|
43721
|
+
return;
|
|
43722
|
+
yield { type: "error", error: error51 instanceof Error ? error51.message : String(error51) };
|
|
43723
|
+
}
|
|
43724
|
+
}
|
|
43725
|
+
};
|
|
43726
|
+
async function listHostModels(models, signal) {
|
|
43727
|
+
if (models === void 0)
|
|
43728
|
+
return { ids: [], warning: NO_HOST_MODELS };
|
|
43729
|
+
try {
|
|
43730
|
+
const found2 = await models.listModels(signal);
|
|
43731
|
+
if (found2.length === 0) {
|
|
43732
|
+
return {
|
|
43733
|
+
ids: [],
|
|
43734
|
+
warning: `${models.label} offered no language models. Sign in to GitHub Copilot in VS Code (the Copilot icon in the status bar), then refresh.`
|
|
43735
|
+
};
|
|
43736
|
+
}
|
|
43737
|
+
const sorted = [...found2].sort((a, b) => Number(b.vendor === "copilot") - Number(a.vendor === "copilot") || a.name.localeCompare(b.name));
|
|
43738
|
+
const windows = {};
|
|
43739
|
+
for (const model of sorted)
|
|
43740
|
+
if (model.maxInputTokens !== void 0 && model.maxInputTokens > 0)
|
|
43741
|
+
windows[model.id] = model.maxInputTokens;
|
|
43742
|
+
return { ids: [...new Set(sorted.map((model) => model.id))], found: sorted, ...Object.keys(windows).length > 0 ? { windows } : {} };
|
|
43743
|
+
} catch (error51) {
|
|
43744
|
+
return { ids: [], warning: error51 instanceof Error ? error51.message : String(error51) };
|
|
43745
|
+
}
|
|
43746
|
+
}
|
|
43747
|
+
async function testHostModels(models, model, signal) {
|
|
43748
|
+
const steps = [
|
|
43749
|
+
{ step: "certificates", status: "skipped", detail: "GitHub Copilot is reached through VS Code; there are no certificates to load." }
|
|
43750
|
+
];
|
|
43751
|
+
if (models === void 0) {
|
|
43752
|
+
steps.push({ step: "token", status: "failed", detail: NO_HOST_MODELS });
|
|
43753
|
+
steps.push({ step: "models", status: "skipped", detail: "Not attempted." });
|
|
43754
|
+
return { ok: false, steps };
|
|
43755
|
+
}
|
|
43756
|
+
steps.push({ step: "token", status: "ok", detail: `Signed in through ${models.label}; Light Code never sees the token.` });
|
|
43757
|
+
const result = await listHostModels(models, signal);
|
|
43758
|
+
if (result.ids.length === 0) {
|
|
43759
|
+
steps.push({ step: "models", status: "failed", detail: result.warning ?? "No models." });
|
|
43760
|
+
return { ok: false, steps };
|
|
43761
|
+
}
|
|
43762
|
+
const named2 = model.trim().length === 0 || result.ids.includes(model);
|
|
43763
|
+
steps.push({
|
|
43764
|
+
step: "models",
|
|
43765
|
+
status: named2 ? "ok" : "failed",
|
|
43766
|
+
detail: named2 ? `${models.label} offers ${String(result.ids.length)} model(s).` : `${models.label} offers ${String(result.ids.length)} model(s), but not "${model}". Pick one from the list.`
|
|
43767
|
+
});
|
|
43768
|
+
return { ok: named2, steps };
|
|
43769
|
+
}
|
|
43770
|
+
|
|
43694
43771
|
// ../../packages/core/dist/providers/factory.js
|
|
43695
|
-
function createChatProvider(profile, http, auth2, logger) {
|
|
43772
|
+
function createChatProvider(profile, http, auth2, logger, hostModels) {
|
|
43696
43773
|
switch (profile.wireFormat) {
|
|
43774
|
+
case "vscode-lm":
|
|
43775
|
+
return new HostModelProvider(hostModels, profile.model);
|
|
43697
43776
|
case "anthropic":
|
|
43698
43777
|
return new AnthropicProvider(http, profile, auth2, logger);
|
|
43699
43778
|
case "gemini":
|
|
@@ -43703,6 +43782,126 @@ function createChatProvider(profile, http, auth2, logger) {
|
|
|
43703
43782
|
}
|
|
43704
43783
|
}
|
|
43705
43784
|
|
|
43785
|
+
// ../../packages/core/dist/platform/node/lmRelay.js
|
|
43786
|
+
var import_node_fs2 = require("node:fs");
|
|
43787
|
+
var import_node_net = require("node:net");
|
|
43788
|
+
var import_node_os2 = __toESM(require("node:os"), 1);
|
|
43789
|
+
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
43790
|
+
var MAX_REQUEST_BYTES = 64 * 1024 * 1024;
|
|
43791
|
+
function defaultRelayDir(env2 = process.env, platform = process.platform) {
|
|
43792
|
+
if (platform === "win32")
|
|
43793
|
+
return import_node_path8.default.join(env2["LOCALAPPDATA"] ?? import_node_path8.default.join(import_node_os2.default.homedir(), "AppData", "Local"), "light-code", "lm-relay");
|
|
43794
|
+
return import_node_path8.default.join(import_node_os2.default.homedir(), ".light-code", "lm-relay");
|
|
43795
|
+
}
|
|
43796
|
+
function relayEntries(dir) {
|
|
43797
|
+
let names;
|
|
43798
|
+
try {
|
|
43799
|
+
names = (0, import_node_fs2.readdirSync)(dir).filter((name) => name.endsWith(".json"));
|
|
43800
|
+
} catch {
|
|
43801
|
+
return [];
|
|
43802
|
+
}
|
|
43803
|
+
const entries = [];
|
|
43804
|
+
for (const name of names) {
|
|
43805
|
+
const file2 = import_node_path8.default.join(dir, name);
|
|
43806
|
+
try {
|
|
43807
|
+
const entry = JSON.parse((0, import_node_fs2.readFileSync)(file2, "utf8"));
|
|
43808
|
+
if (typeof entry.pipe === "string" && typeof entry.token === "string") {
|
|
43809
|
+
entries.push({ entry, file: file2, at: (0, import_node_fs2.statSync)(file2).mtimeMs });
|
|
43810
|
+
}
|
|
43811
|
+
} catch {
|
|
43812
|
+
}
|
|
43813
|
+
}
|
|
43814
|
+
return entries.sort((a, b) => b.at - a.at);
|
|
43815
|
+
}
|
|
43816
|
+
var NO_VSCODE_WINDOW = "No VS Code window with the Light Code extension is open, so GitHub Copilot cannot be reached. Open VS Code (Copilot signed in, Light Code 0.161.0 or later) and try again - the first request asks there whether Light Code may use Copilot.";
|
|
43817
|
+
async function* exchange(dir, request, signal) {
|
|
43818
|
+
for (const { entry, file: file2 } of relayEntries(dir)) {
|
|
43819
|
+
const socket = await new Promise((resolve) => {
|
|
43820
|
+
const candidate = (0, import_node_net.connect)(entry.pipe);
|
|
43821
|
+
candidate.once("connect", () => resolve(candidate));
|
|
43822
|
+
candidate.once("error", () => resolve(void 0));
|
|
43823
|
+
});
|
|
43824
|
+
if (socket === void 0) {
|
|
43825
|
+
(0, import_node_fs2.rmSync)(file2, { force: true });
|
|
43826
|
+
continue;
|
|
43827
|
+
}
|
|
43828
|
+
const onAbort = () => {
|
|
43829
|
+
socket.destroy();
|
|
43830
|
+
};
|
|
43831
|
+
signal?.addEventListener("abort", onAbort);
|
|
43832
|
+
try {
|
|
43833
|
+
socket.setEncoding("utf8");
|
|
43834
|
+
socket.write(`${JSON.stringify({ ...request, token: entry.token })}
|
|
43835
|
+
`);
|
|
43836
|
+
let buffered = "";
|
|
43837
|
+
let ended = false;
|
|
43838
|
+
const queue = [];
|
|
43839
|
+
let wake;
|
|
43840
|
+
socket.on("data", (chunk) => {
|
|
43841
|
+
buffered += chunk;
|
|
43842
|
+
let newline = buffered.indexOf("\n");
|
|
43843
|
+
while (newline >= 0) {
|
|
43844
|
+
queue.push(buffered.slice(0, newline));
|
|
43845
|
+
buffered = buffered.slice(newline + 1);
|
|
43846
|
+
newline = buffered.indexOf("\n");
|
|
43847
|
+
}
|
|
43848
|
+
wake?.();
|
|
43849
|
+
});
|
|
43850
|
+
const finish = () => {
|
|
43851
|
+
ended = true;
|
|
43852
|
+
wake?.();
|
|
43853
|
+
};
|
|
43854
|
+
socket.on("close", finish);
|
|
43855
|
+
socket.on("error", finish);
|
|
43856
|
+
for (; ; ) {
|
|
43857
|
+
const line = queue.shift();
|
|
43858
|
+
if (line !== void 0) {
|
|
43859
|
+
yield JSON.parse(line);
|
|
43860
|
+
continue;
|
|
43861
|
+
}
|
|
43862
|
+
if (ended)
|
|
43863
|
+
break;
|
|
43864
|
+
await new Promise((resolve) => wake = resolve);
|
|
43865
|
+
wake = void 0;
|
|
43866
|
+
}
|
|
43867
|
+
if (signal?.aborted === true)
|
|
43868
|
+
return;
|
|
43869
|
+
} finally {
|
|
43870
|
+
signal?.removeEventListener("abort", onAbort);
|
|
43871
|
+
socket.destroy();
|
|
43872
|
+
}
|
|
43873
|
+
return;
|
|
43874
|
+
}
|
|
43875
|
+
throw new Error(NO_VSCODE_WINDOW);
|
|
43876
|
+
}
|
|
43877
|
+
function createRelayLanguageModels(options = {}) {
|
|
43878
|
+
const dir = options.dir ?? defaultRelayDir();
|
|
43879
|
+
return {
|
|
43880
|
+
label: "VS Code (relayed)",
|
|
43881
|
+
async listModels(signal) {
|
|
43882
|
+
for await (const line of exchange(dir, { op: "list" }, signal)) {
|
|
43883
|
+
if (typeof line["error"] === "string")
|
|
43884
|
+
throw new Error(line["error"]);
|
|
43885
|
+
if (Array.isArray(line["models"]))
|
|
43886
|
+
return line["models"];
|
|
43887
|
+
}
|
|
43888
|
+
throw new Error("VS Code closed the connection without an answer.");
|
|
43889
|
+
},
|
|
43890
|
+
async *chat(request, signal) {
|
|
43891
|
+
for await (const line of exchange(dir, { op: "chat", request }, signal)) {
|
|
43892
|
+
if (typeof line["error"] === "string")
|
|
43893
|
+
throw new Error(line["error"]);
|
|
43894
|
+
if (line["done"] === true)
|
|
43895
|
+
return;
|
|
43896
|
+
if (line["chunk"] !== void 0)
|
|
43897
|
+
yield line["chunk"];
|
|
43898
|
+
}
|
|
43899
|
+
if (signal?.aborted !== true)
|
|
43900
|
+
throw new Error("VS Code closed the connection before the answer finished - was the window closed?");
|
|
43901
|
+
}
|
|
43902
|
+
};
|
|
43903
|
+
}
|
|
43904
|
+
|
|
43706
43905
|
// ../../packages/core/dist/context/budget.js
|
|
43707
43906
|
function estimateTokens(text) {
|
|
43708
43907
|
if (text.length === 0)
|
|
@@ -43749,8 +43948,8 @@ var SUPERSEDED_MARKER = "[Superseded: this file was read again later in the conv
|
|
|
43749
43948
|
function readFilePath(argumentsJson) {
|
|
43750
43949
|
try {
|
|
43751
43950
|
const parsed = JSON.parse(argumentsJson.length > 0 ? argumentsJson : "{}");
|
|
43752
|
-
const
|
|
43753
|
-
return typeof
|
|
43951
|
+
const path58 = parsed.path;
|
|
43952
|
+
return typeof path58 === "string" && path58.length > 0 ? path58 : void 0;
|
|
43754
43953
|
} catch {
|
|
43755
43954
|
return void 0;
|
|
43756
43955
|
}
|
|
@@ -43763,8 +43962,8 @@ function dropSupersededReads(messages) {
|
|
|
43763
43962
|
for (const toolCall of message4.toolCalls ?? []) {
|
|
43764
43963
|
if (toolCall.name !== "read_file")
|
|
43765
43964
|
continue;
|
|
43766
|
-
const
|
|
43767
|
-
if (
|
|
43965
|
+
const path58 = readFilePath(toolCall.arguments);
|
|
43966
|
+
if (path58 === void 0)
|
|
43768
43967
|
continue;
|
|
43769
43968
|
keyByCallId.set(toolCall.id, toolCall.arguments);
|
|
43770
43969
|
}
|
|
@@ -43849,7 +44048,7 @@ function createForgetDocsTool() {
|
|
|
43849
44048
|
}
|
|
43850
44049
|
|
|
43851
44050
|
// ../../packages/core/dist/context/mentions.js
|
|
43852
|
-
var
|
|
44051
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
43853
44052
|
var MENTION_PATTERN = /@(?:"([^"]+)"|([^\s@]+))/g;
|
|
43854
44053
|
var MAX_DIRECTORY_ENTRIES = 200;
|
|
43855
44054
|
var MAX_FILE_CHARS = 1e5;
|
|
@@ -43876,8 +44075,8 @@ async function resolveOne(raw, context) {
|
|
|
43876
44075
|
const sibling = siblingMention(raw, context.siblings);
|
|
43877
44076
|
const base = sibling?.root ?? context.workspaceRoot;
|
|
43878
44077
|
const inner = sibling?.rest ?? raw;
|
|
43879
|
-
const absolute =
|
|
43880
|
-
const relativePath = (sibling !== void 0 ? `${sibling.name}:` : "") +
|
|
44078
|
+
const absolute = import_node_path9.default.isAbsolute(inner) ? inner : import_node_path9.default.join(base, inner);
|
|
44079
|
+
const relativePath = (sibling !== void 0 ? `${sibling.name}:` : "") + import_node_path9.default.relative(base, absolute).split(import_node_path9.default.sep).join("/");
|
|
43881
44080
|
let confined;
|
|
43882
44081
|
try {
|
|
43883
44082
|
confined = await confine(absolute, base);
|
|
@@ -43932,7 +44131,7 @@ async function bareCodebase(raw, context) {
|
|
|
43932
44131
|
if (sibling === void 0)
|
|
43933
44132
|
return raw;
|
|
43934
44133
|
try {
|
|
43935
|
-
await context.fs.stat(
|
|
44134
|
+
await context.fs.stat(import_node_path9.default.join(context.workspaceRoot, raw));
|
|
43936
44135
|
return raw;
|
|
43937
44136
|
} catch {
|
|
43938
44137
|
return `${sibling.name}:`;
|
|
@@ -44777,8 +44976,8 @@ function buildSystemPrompt(workspaceRoot, options = {}) {
|
|
|
44777
44976
|
|
|
44778
44977
|
// ../../packages/core/dist/expert/claudeCli.js
|
|
44779
44978
|
var import_node_child_process2 = require("node:child_process");
|
|
44780
|
-
var
|
|
44781
|
-
var
|
|
44979
|
+
var import_node_fs3 = require("node:fs");
|
|
44980
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
44782
44981
|
var ALLOWED_TOOLS = ["Read", "Grep", "Glob"];
|
|
44783
44982
|
function spawnArgs(executable, args) {
|
|
44784
44983
|
if (process.platform === "win32" && /\.(cmd|bat)$/i.test(executable)) {
|
|
@@ -44808,23 +45007,23 @@ function run(executable, args, options) {
|
|
|
44808
45007
|
});
|
|
44809
45008
|
}
|
|
44810
45009
|
function fallbackLocations(name) {
|
|
44811
|
-
if (
|
|
45010
|
+
if (import_node_path10.default.isAbsolute(name))
|
|
44812
45011
|
return [];
|
|
44813
45012
|
const candidates = [];
|
|
44814
45013
|
const push2 = (dir) => {
|
|
44815
45014
|
if (dir === void 0 || dir.length === 0)
|
|
44816
45015
|
return;
|
|
44817
45016
|
if (process.platform === "win32")
|
|
44818
|
-
candidates.push(
|
|
44819
|
-
candidates.push(
|
|
45017
|
+
candidates.push(import_node_path10.default.join(dir, `${name}.cmd`));
|
|
45018
|
+
candidates.push(import_node_path10.default.join(dir, name));
|
|
44820
45019
|
};
|
|
44821
45020
|
if (process.platform === "win32") {
|
|
44822
|
-
push2(process.env.APPDATA !== void 0 ?
|
|
45021
|
+
push2(process.env.APPDATA !== void 0 ? import_node_path10.default.join(process.env.APPDATA, "npm") : void 0);
|
|
44823
45022
|
} else {
|
|
44824
45023
|
push2("/usr/local/bin");
|
|
44825
45024
|
push2("/opt/homebrew/bin");
|
|
44826
|
-
push2(process.env.HOME !== void 0 ?
|
|
44827
|
-
push2(process.env.HOME !== void 0 ?
|
|
45025
|
+
push2(process.env.HOME !== void 0 ? import_node_path10.default.join(process.env.HOME, ".npm-global", "bin") : void 0);
|
|
45026
|
+
push2(process.env.HOME !== void 0 ? import_node_path10.default.join(process.env.HOME, ".local", "bin") : void 0);
|
|
44828
45027
|
}
|
|
44829
45028
|
return candidates;
|
|
44830
45029
|
}
|
|
@@ -44862,7 +45061,7 @@ async function detectClaudeCli(executable = "claude", timeoutMs = 1e4) {
|
|
|
44862
45061
|
if (direct !== void 0)
|
|
44863
45062
|
return direct;
|
|
44864
45063
|
for (const candidate of fallbackLocations(executable)) {
|
|
44865
|
-
if (!(0,
|
|
45064
|
+
if (!(0, import_node_fs3.existsSync)(candidate))
|
|
44866
45065
|
continue;
|
|
44867
45066
|
if (Date.now() >= deadline)
|
|
44868
45067
|
break;
|
|
@@ -46605,13 +46804,13 @@ var OpenSearchClient = class {
|
|
|
46605
46804
|
* `_bulk`, `_delete_by_query`, index creation — is refused here rather than merely
|
|
46606
46805
|
* unused, so no future edit or crafted argument can turn a read client into a writer.
|
|
46607
46806
|
*/
|
|
46608
|
-
async request(
|
|
46807
|
+
async request(path58, options = {}) {
|
|
46609
46808
|
const method = options.method ?? "GET";
|
|
46610
|
-
const isSearchPost = method === "POST" && /\/_search(\?|$)/.test(
|
|
46809
|
+
const isSearchPost = method === "POST" && /\/_search(\?|$)/.test(path58);
|
|
46611
46810
|
if (method !== "GET" && !isSearchPost) {
|
|
46612
|
-
throw new OpenSearchError(`Refusing ${method} ${
|
|
46811
|
+
throw new OpenSearchError(`Refusing ${method} ${path58}: this client is read-only. Indexing goes through the indexer, which the user starts from Settings.`);
|
|
46613
46812
|
}
|
|
46614
|
-
const url2 = `${this.base}${
|
|
46813
|
+
const url2 = `${this.base}${path58}`;
|
|
46615
46814
|
const request = {
|
|
46616
46815
|
method,
|
|
46617
46816
|
headers: this.headers()
|
|
@@ -46778,11 +46977,11 @@ function collectFields(properties, prefix, out) {
|
|
|
46778
46977
|
return;
|
|
46779
46978
|
for (const [name, raw] of Object.entries(properties)) {
|
|
46780
46979
|
const field2 = raw;
|
|
46781
|
-
const
|
|
46980
|
+
const path58 = prefix.length > 0 ? `${prefix}.${name}` : name;
|
|
46782
46981
|
if (typeof field2.type === "string")
|
|
46783
|
-
out[
|
|
46982
|
+
out[path58] = field2.type;
|
|
46784
46983
|
if (field2.properties !== void 0)
|
|
46785
|
-
collectFields(field2.properties,
|
|
46984
|
+
collectFields(field2.properties, path58, out);
|
|
46786
46985
|
}
|
|
46787
46986
|
}
|
|
46788
46987
|
function describeStatus(status2, url2, body) {
|
|
@@ -46801,23 +47000,23 @@ function describeStatus(status2, url2, body) {
|
|
|
46801
47000
|
var TEXT_TYPES = /* @__PURE__ */ new Set(["text", "match_only_text", "search_as_you_type", "wildcard"]);
|
|
46802
47001
|
var KEYWORD_TYPES = /* @__PURE__ */ new Set(["keyword", "constant_keyword"]);
|
|
46803
47002
|
var NOISE_FIELDS = /* @__PURE__ */ new Set(["@version", "ecs", "tags", "stream", "input", "agent", "host", "event"]);
|
|
46804
|
-
function leafName(
|
|
46805
|
-
const parts =
|
|
46806
|
-
return parts[parts.length - 1] ??
|
|
47003
|
+
function leafName(path58) {
|
|
47004
|
+
const parts = path58.split(".");
|
|
47005
|
+
return parts[parts.length - 1] ?? path58;
|
|
46807
47006
|
}
|
|
46808
47007
|
function selectQueryFields(mapping, limit = 25) {
|
|
46809
47008
|
const text = [];
|
|
46810
47009
|
const keyword = [];
|
|
46811
|
-
for (const [
|
|
46812
|
-
if (NOISE_FIELDS.has(leafName(
|
|
47010
|
+
for (const [path58, type] of Object.entries(mapping)) {
|
|
47011
|
+
if (NOISE_FIELDS.has(leafName(path58)) || NOISE_FIELDS.has(path58.split(".")[0] ?? ""))
|
|
46813
47012
|
continue;
|
|
46814
47013
|
if (TEXT_TYPES.has(type)) {
|
|
46815
|
-
text.push(
|
|
47014
|
+
text.push(path58);
|
|
46816
47015
|
} else if (KEYWORD_TYPES.has(type)) {
|
|
46817
|
-
const parent =
|
|
46818
|
-
if (
|
|
47016
|
+
const parent = path58.replace(/\.keyword$/, "");
|
|
47017
|
+
if (path58.endsWith(".keyword") && TEXT_TYPES.has(mapping[parent] ?? ""))
|
|
46819
47018
|
continue;
|
|
46820
|
-
keyword.push(
|
|
47019
|
+
keyword.push(path58);
|
|
46821
47020
|
}
|
|
46822
47021
|
}
|
|
46823
47022
|
const byDepth = (a, b) => a.split(".").length - b.split(".").length || a.localeCompare(b);
|
|
@@ -46959,8 +47158,8 @@ var OpenSearchIndexWriter = class {
|
|
|
46959
47158
|
}
|
|
46960
47159
|
return headers;
|
|
46961
47160
|
}
|
|
46962
|
-
async request(
|
|
46963
|
-
const url2 = `${this.connection.url.replace(/\/+$/, "")}${
|
|
47161
|
+
async request(path58, method, body, signal) {
|
|
47162
|
+
const url2 = `${this.connection.url.replace(/\/+$/, "")}${path58}`;
|
|
46964
47163
|
const request = { method, headers: this.headers() };
|
|
46965
47164
|
if (body !== void 0) {
|
|
46966
47165
|
if (typeof body === "string") {
|
|
@@ -47174,13 +47373,13 @@ var OpenSearchIndexWriter = class {
|
|
|
47174
47373
|
for (const hit of hits) {
|
|
47175
47374
|
const source = hit._source ?? {};
|
|
47176
47375
|
const vector = source.vector;
|
|
47177
|
-
const
|
|
47178
|
-
if (typeof
|
|
47376
|
+
const path58 = source.path;
|
|
47377
|
+
if (typeof path58 !== "string" || !Array.isArray(vector))
|
|
47179
47378
|
continue;
|
|
47180
47379
|
documents.push({
|
|
47181
47380
|
id: hit._id ?? "",
|
|
47182
47381
|
text: typeof source.text === "string" ? source.text : "",
|
|
47183
|
-
path:
|
|
47382
|
+
path: path58,
|
|
47184
47383
|
startLine: typeof source.startLine === "number" ? source.startLine : 1,
|
|
47185
47384
|
endLine: typeof source.endLine === "number" ? source.endLine : 1,
|
|
47186
47385
|
vector
|
|
@@ -47254,8 +47453,8 @@ var RestTransport = class {
|
|
|
47254
47453
|
* threw would push every caller into catching and re-inspecting an error to find out
|
|
47255
47454
|
* whether it was really an error. `expectOk` is there for the cases that are.
|
|
47256
47455
|
*/
|
|
47257
|
-
async send(
|
|
47258
|
-
const url2 = `${this.connection.url.replace(/\/+$/, "")}${
|
|
47456
|
+
async send(path58, method, body, signal) {
|
|
47457
|
+
const url2 = `${this.connection.url.replace(/\/+$/, "")}${path58}`;
|
|
47259
47458
|
const request = { method, headers: this.headers() };
|
|
47260
47459
|
if (body !== void 0)
|
|
47261
47460
|
request.body = JSON.stringify(body);
|
|
@@ -47281,11 +47480,11 @@ var RestTransport = class {
|
|
|
47281
47480
|
return { status: response.status, body: parsed };
|
|
47282
47481
|
}
|
|
47283
47482
|
/** Sends, and throws unless the status is 2xx. */
|
|
47284
|
-
async expectOk(
|
|
47285
|
-
const result = await this.send(
|
|
47483
|
+
async expectOk(path58, method, body, signal) {
|
|
47484
|
+
const result = await this.send(path58, method, body, signal);
|
|
47286
47485
|
if (result.status < 200 || result.status >= 300) {
|
|
47287
47486
|
const detail = typeof result.body === "string" ? result.body : JSON.stringify(result.body ?? "");
|
|
47288
|
-
throw new VectorStoreError(`${method} ${
|
|
47487
|
+
throw new VectorStoreError(`${method} ${path58} on ${this.label} returned HTTP ${String(result.status)}. ${detail.slice(0, 300)}`, result.status);
|
|
47289
47488
|
}
|
|
47290
47489
|
return result.body;
|
|
47291
47490
|
}
|
|
@@ -47393,10 +47592,10 @@ var ChromaSearcher = class extends ChromaBase {
|
|
|
47393
47592
|
const matches = [];
|
|
47394
47593
|
for (let index = 0; index < ids.length; index++) {
|
|
47395
47594
|
const metadata = metadatas[index] ?? {};
|
|
47396
|
-
const
|
|
47397
|
-
if (
|
|
47595
|
+
const path58 = typeof metadata.path === "string" ? metadata.path : void 0;
|
|
47596
|
+
if (path58 === void 0)
|
|
47398
47597
|
continue;
|
|
47399
|
-
if (prefix !== void 0 && prefix.length > 0 && !
|
|
47598
|
+
if (prefix !== void 0 && prefix.length > 0 && !path58.startsWith(prefix))
|
|
47400
47599
|
continue;
|
|
47401
47600
|
if (projectHere && typeof metadata.project === "string" && !options.project?.names.includes(metadata.project))
|
|
47402
47601
|
continue;
|
|
@@ -47410,7 +47609,7 @@ var ChromaSearcher = class extends ChromaBase {
|
|
|
47410
47609
|
*/
|
|
47411
47610
|
score: typeof distance === "number" ? 1 / (1 + Math.max(0, distance)) : 0,
|
|
47412
47611
|
text: documents[index] ?? (typeof metadata.text === "string" ? metadata.text : ""),
|
|
47413
|
-
path:
|
|
47612
|
+
path: path58
|
|
47414
47613
|
};
|
|
47415
47614
|
if (typeof metadata.startLine === "number")
|
|
47416
47615
|
match.startLine = metadata.startLine;
|
|
@@ -47521,13 +47720,13 @@ var ChromaIndexWriter = class extends ChromaBase {
|
|
|
47521
47720
|
for (let index = 0; index < ids.length; index++) {
|
|
47522
47721
|
const metadata = result.metadatas?.[index] ?? {};
|
|
47523
47722
|
const vector = result.embeddings?.[index];
|
|
47524
|
-
const
|
|
47525
|
-
if (
|
|
47723
|
+
const path58 = typeof metadata.path === "string" ? metadata.path : void 0;
|
|
47724
|
+
if (path58 === void 0 || !Array.isArray(vector))
|
|
47526
47725
|
continue;
|
|
47527
47726
|
documents.push({
|
|
47528
47727
|
id: ids[index] ?? "",
|
|
47529
47728
|
text: result.documents?.[index] ?? "",
|
|
47530
|
-
path:
|
|
47729
|
+
path: path58,
|
|
47531
47730
|
startLine: typeof metadata.startLine === "number" ? metadata.startLine : 1,
|
|
47532
47731
|
endLine: typeof metadata.endLine === "number" ? metadata.endLine : 1,
|
|
47533
47732
|
vector
|
|
@@ -47544,9 +47743,9 @@ var ChromaIndexWriter = class extends ChromaBase {
|
|
|
47544
47743
|
const result = await this.rest.expectOk(`${this.base}/collections/${found2.id}/get`, "POST", { include: ["metadatas"], limit }, options.signal);
|
|
47545
47744
|
const paths = /* @__PURE__ */ new Set();
|
|
47546
47745
|
for (const metadata of result.metadatas ?? []) {
|
|
47547
|
-
const
|
|
47548
|
-
if (typeof
|
|
47549
|
-
paths.add(
|
|
47746
|
+
const path58 = metadata?.path;
|
|
47747
|
+
if (typeof path58 === "string")
|
|
47748
|
+
paths.add(path58);
|
|
47550
47749
|
}
|
|
47551
47750
|
return [...paths];
|
|
47552
47751
|
}
|
|
@@ -47573,14 +47772,14 @@ var MARKER_ID = "5f6d2a41-0000-5000-8000-6c69676874c0";
|
|
|
47573
47772
|
var MARKER_MARK = "light-code";
|
|
47574
47773
|
function toMatch(point) {
|
|
47575
47774
|
const payload = point.payload ?? {};
|
|
47576
|
-
const
|
|
47577
|
-
if (
|
|
47775
|
+
const path58 = typeof payload.path === "string" ? payload.path : void 0;
|
|
47776
|
+
if (path58 === void 0)
|
|
47578
47777
|
return void 0;
|
|
47579
47778
|
const match = {
|
|
47580
47779
|
id: typeof payload.chunkId === "string" ? payload.chunkId : point.id,
|
|
47581
47780
|
score: typeof point.score === "number" ? point.score : 0,
|
|
47582
47781
|
text: typeof payload.text === "string" ? payload.text : "",
|
|
47583
|
-
path:
|
|
47782
|
+
path: path58
|
|
47584
47783
|
};
|
|
47585
47784
|
if (typeof payload.startLine === "number")
|
|
47586
47785
|
match.startLine = payload.startLine;
|
|
@@ -47774,13 +47973,13 @@ var QdrantIndexWriter = class extends QdrantBase {
|
|
|
47774
47973
|
const documents = [];
|
|
47775
47974
|
for (const point of result.body.result?.points ?? []) {
|
|
47776
47975
|
const payload = point.payload ?? {};
|
|
47777
|
-
const
|
|
47778
|
-
if (
|
|
47976
|
+
const path58 = typeof payload.path === "string" ? payload.path : void 0;
|
|
47977
|
+
if (path58 === void 0 || !Array.isArray(point.vector))
|
|
47779
47978
|
continue;
|
|
47780
47979
|
documents.push({
|
|
47781
47980
|
id: typeof payload.chunkId === "string" ? payload.chunkId : point.id,
|
|
47782
47981
|
text: typeof payload.text === "string" ? payload.text : "",
|
|
47783
|
-
path:
|
|
47982
|
+
path: path58,
|
|
47784
47983
|
startLine: typeof payload.startLine === "number" ? payload.startLine : 1,
|
|
47785
47984
|
endLine: typeof payload.endLine === "number" ? payload.endLine : 1,
|
|
47786
47985
|
vector: point.vector
|
|
@@ -47807,9 +48006,9 @@ var QdrantIndexWriter = class extends QdrantBase {
|
|
|
47807
48006
|
throw new VectorStoreError(`Could not list "${collection}" (HTTP ${String(result.status)}).`, result.status);
|
|
47808
48007
|
}
|
|
47809
48008
|
for (const point of result.body.result?.points ?? []) {
|
|
47810
|
-
const
|
|
47811
|
-
if (typeof
|
|
47812
|
-
paths.add(
|
|
48009
|
+
const path58 = point.payload?.path;
|
|
48010
|
+
if (typeof path58 === "string")
|
|
48011
|
+
paths.add(path58);
|
|
47813
48012
|
}
|
|
47814
48013
|
offset = result.body.result?.next_page_offset;
|
|
47815
48014
|
if (offset === void 0 || offset === null)
|
|
@@ -48079,7 +48278,7 @@ Filters: ${JSON.stringify(params3.filters)}` : ""}`
|
|
|
48079
48278
|
}
|
|
48080
48279
|
|
|
48081
48280
|
// ../../packages/core/dist/tools/searchCodebase.js
|
|
48082
|
-
var
|
|
48281
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
48083
48282
|
|
|
48084
48283
|
// ../../packages/core/dist/rag/aliases.js
|
|
48085
48284
|
function codebaseAliases(config2) {
|
|
@@ -48156,7 +48355,7 @@ var REMOTE_GUIDANCE = [
|
|
|
48156
48355
|
"- If it is relevant, say which project and person it came from so the user can go and look."
|
|
48157
48356
|
];
|
|
48158
48357
|
async function isPresentHere(relativePath, context) {
|
|
48159
|
-
if (
|
|
48358
|
+
if (import_node_path11.default.isAbsolute(relativePath) || relativePath.includes(".."))
|
|
48160
48359
|
return false;
|
|
48161
48360
|
const fileSystem = context?.fs;
|
|
48162
48361
|
const root = context?.workspaceRoot;
|
|
@@ -48164,7 +48363,7 @@ async function isPresentHere(relativePath, context) {
|
|
|
48164
48363
|
return void 0;
|
|
48165
48364
|
}
|
|
48166
48365
|
try {
|
|
48167
|
-
return await fileSystem.exists(
|
|
48366
|
+
return await fileSystem.exists(import_node_path11.default.join(root, relativePath));
|
|
48168
48367
|
} catch {
|
|
48169
48368
|
return void 0;
|
|
48170
48369
|
}
|
|
@@ -48343,8 +48542,8 @@ function teamSkillDocument(skill, body, vector, attribution) {
|
|
|
48343
48542
|
vector
|
|
48344
48543
|
};
|
|
48345
48544
|
}
|
|
48346
|
-
function nameFromPath(
|
|
48347
|
-
return
|
|
48545
|
+
function nameFromPath(path58) {
|
|
48546
|
+
return path58.startsWith("skill:") ? path58.slice("skill:".length) : path58;
|
|
48348
48547
|
}
|
|
48349
48548
|
function toHit(match, self) {
|
|
48350
48549
|
return {
|
|
@@ -48518,12 +48717,12 @@ function createSearchTeamSkillsTool(options) {
|
|
|
48518
48717
|
// ../../packages/core/dist/tools/office.js
|
|
48519
48718
|
var import_node_crypto5 = require("node:crypto");
|
|
48520
48719
|
var import_promises4 = __toESM(require("node:fs/promises"), 1);
|
|
48521
|
-
var
|
|
48720
|
+
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
48522
48721
|
|
|
48523
48722
|
// ../../packages/core/dist/documents/dropped.js
|
|
48524
|
-
var
|
|
48525
|
-
var
|
|
48526
|
-
var
|
|
48723
|
+
var import_node_fs4 = require("node:fs");
|
|
48724
|
+
var import_node_os3 = __toESM(require("node:os"), 1);
|
|
48725
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
48527
48726
|
|
|
48528
48727
|
// ../../packages/core/dist/documents/pdf.js
|
|
48529
48728
|
var import_node_zlib = require("node:zlib");
|
|
@@ -49556,10 +49755,10 @@ function extractDocument(filePath, buffer, options = {}) {
|
|
|
49556
49755
|
|
|
49557
49756
|
// ../../packages/core/dist/documents/dropped.js
|
|
49558
49757
|
function droppedFilesRoot() {
|
|
49559
|
-
return
|
|
49758
|
+
return import_node_path12.default.join(import_node_os3.default.tmpdir(), "light-code-drops");
|
|
49560
49759
|
}
|
|
49561
49760
|
function mailAttachmentsRoot() {
|
|
49562
|
-
return
|
|
49761
|
+
return import_node_path12.default.join(import_node_os3.default.tmpdir(), "light-code-mail");
|
|
49563
49762
|
}
|
|
49564
49763
|
var IMAGE_FILE = /\.(png|jpe?g|gif|webp|bmp|tiff?)$/i;
|
|
49565
49764
|
function safeFileName(name) {
|
|
@@ -49573,14 +49772,14 @@ function formatSize(bytes) {
|
|
|
49573
49772
|
return bytes >= 1024 * 1024 ? `${(bytes / 1024 / 1024).toFixed(1)} MB` : `${String(Math.max(1, Math.round(bytes / 1024)))} KB`;
|
|
49574
49773
|
}
|
|
49575
49774
|
async function saveUnique(dir, name, bytes) {
|
|
49576
|
-
await
|
|
49775
|
+
await import_node_fs4.promises.mkdir(dir, { recursive: true });
|
|
49577
49776
|
const safe = safeFileName(name);
|
|
49578
|
-
const ext =
|
|
49777
|
+
const ext = import_node_path12.default.extname(safe);
|
|
49579
49778
|
const stem2 = safe.slice(0, safe.length - ext.length);
|
|
49580
49779
|
for (let attempt = 0; attempt < 1e3; attempt++) {
|
|
49581
|
-
const candidate =
|
|
49780
|
+
const candidate = import_node_path12.default.join(dir, attempt === 0 ? safe : `${stem2} (${String(attempt + 1)})${ext}`);
|
|
49582
49781
|
try {
|
|
49583
|
-
await
|
|
49782
|
+
await import_node_fs4.promises.writeFile(candidate, bytes, { flag: "wx" });
|
|
49584
49783
|
return candidate;
|
|
49585
49784
|
} catch (error51) {
|
|
49586
49785
|
if (error51.code !== "EEXIST")
|
|
@@ -49631,7 +49830,7 @@ async function stageDroppedFile(dir, name, bytes, options = {}) {
|
|
|
49631
49830
|
}
|
|
49632
49831
|
if (parsed.attachments.length === 0)
|
|
49633
49832
|
return { name: display, path: savedPath, ...head };
|
|
49634
|
-
const folder =
|
|
49833
|
+
const folder = import_node_path12.default.join(import_node_path12.default.dirname(savedPath), `${import_node_path12.default.basename(savedPath, import_node_path12.default.extname(savedPath))} attachments`);
|
|
49635
49834
|
const parts = [head.text];
|
|
49636
49835
|
for (const attachment of parsed.attachments) {
|
|
49637
49836
|
if (attachment.data === void 0) {
|
|
@@ -49826,7 +50025,7 @@ function tidy3(text) {
|
|
|
49826
50025
|
}
|
|
49827
50026
|
|
|
49828
50027
|
// ../../packages/core/dist/tools/paths.js
|
|
49829
|
-
var
|
|
50028
|
+
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
49830
50029
|
|
|
49831
50030
|
// ../../packages/core/dist/fs/reach.js
|
|
49832
50031
|
var norm = (p) => `${p.replace(/\\/g, "/").toLowerCase().replace(/\/+$/, "")}/`;
|
|
@@ -49892,7 +50091,7 @@ function isSystemPath(target) {
|
|
|
49892
50091
|
// ../../packages/core/dist/tools/paths.js
|
|
49893
50092
|
async function resolveToolPath(context, requestedPath, options = {}) {
|
|
49894
50093
|
const requested2 = normalizeWindowsPath(requestedPath);
|
|
49895
|
-
const absolute =
|
|
50094
|
+
const absolute = import_node_path13.default.resolve(context.workspaceRoot, requested2);
|
|
49896
50095
|
const roots = options.write === true ? [context.workspaceRoot] : [context.workspaceRoot, ...context.readRoots ?? []];
|
|
49897
50096
|
let realPath;
|
|
49898
50097
|
try {
|
|
@@ -50759,7 +50958,7 @@ function createOutlookReadTool(options) {
|
|
|
50759
50958
|
async execute(params3) {
|
|
50760
50959
|
try {
|
|
50761
50960
|
const readAttached = params3.attachments !== false;
|
|
50762
|
-
const saveDir = readAttached ?
|
|
50961
|
+
const saveDir = readAttached ? import_node_path14.default.join(mailAttachmentsRoot(), (0, import_node_crypto5.createHash)("sha256").update(params3.entryId).digest("hex").slice(0, 16)) : void 0;
|
|
50763
50962
|
const result = await options.bridge.request({ op: "outlook.read", entryId: params3.entryId, ...saveDir !== void 0 ? { saveDir } : {} });
|
|
50764
50963
|
const attached = readAttached && (result.saved ?? []).length > 0 ? await readAttachments(result.saved ?? []) : void 0;
|
|
50765
50964
|
const annotated = result.html === null || result.html.length === 0 ? void 0 : annotateHtmlBody(result.html);
|
|
@@ -51426,8 +51625,8 @@ function createMailCoverageTool(options) {
|
|
|
51426
51625
|
}
|
|
51427
51626
|
};
|
|
51428
51627
|
}
|
|
51429
|
-
function normaliseFolder(
|
|
51430
|
-
return
|
|
51628
|
+
function normaliseFolder(path58) {
|
|
51629
|
+
return path58.toLowerCase().replace(/[\\/]+/g, "\\");
|
|
51431
51630
|
}
|
|
51432
51631
|
function haystackOf(record2) {
|
|
51433
51632
|
return `${record2.subject}
|
|
@@ -51549,7 +51748,7 @@ var import_promises6 = __toESM(require("node:fs/promises"), 1);
|
|
|
51549
51748
|
|
|
51550
51749
|
// ../../packages/core/dist/platform/node/replaceFile.js
|
|
51551
51750
|
var import_promises5 = __toESM(require("node:fs/promises"), 1);
|
|
51552
|
-
var
|
|
51751
|
+
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
51553
51752
|
var TRANSIENT = /* @__PURE__ */ new Set(["EPERM", "EACCES", "EBUSY"]);
|
|
51554
51753
|
var DELAYS_MS = [20, 40, 80, 120, 200, 300, 400, 600, 800, 1e3];
|
|
51555
51754
|
var FileReplaceError = class extends Error {
|
|
@@ -51576,7 +51775,7 @@ async function replaceFile(from, to, options = {}) {
|
|
|
51576
51775
|
}
|
|
51577
51776
|
await import_promises5.default.rm(from, { force: true }).catch(() => void 0);
|
|
51578
51777
|
if (code !== void 0 && TRANSIENT.has(code)) {
|
|
51579
|
-
throw new FileReplaceError(`Could not save ${
|
|
51778
|
+
throw new FileReplaceError(`Could not save ${import_node_path15.default.basename(to)} (${to}): another program kept it open for several seconds (${code}). Usually another VS Code window, antivirus, or a sync tool such as OneDrive working on that folder. The previous contents are intact; try the save again.`, code);
|
|
51580
51779
|
}
|
|
51581
51780
|
throw error51;
|
|
51582
51781
|
}
|
|
@@ -51584,13 +51783,13 @@ async function replaceFile(from, to, options = {}) {
|
|
|
51584
51783
|
}
|
|
51585
51784
|
|
|
51586
51785
|
// ../../packages/core/dist/office/mailStore.js
|
|
51587
|
-
var
|
|
51786
|
+
var import_node_path16 = __toESM(require("node:path"), 1);
|
|
51588
51787
|
var MailStore = class {
|
|
51589
51788
|
filePath;
|
|
51590
51789
|
progressPath;
|
|
51591
51790
|
constructor(storageDir) {
|
|
51592
|
-
this.filePath =
|
|
51593
|
-
this.progressPath =
|
|
51791
|
+
this.filePath = import_node_path16.default.join(storageDir, "mail-index.jsonl");
|
|
51792
|
+
this.progressPath = import_node_path16.default.join(storageDir, "mail-progress.json");
|
|
51594
51793
|
}
|
|
51595
51794
|
/**
|
|
51596
51795
|
* Every record, newest last.
|
|
@@ -51624,7 +51823,7 @@ var MailStore = class {
|
|
|
51624
51823
|
async append(records) {
|
|
51625
51824
|
if (records.length === 0)
|
|
51626
51825
|
return;
|
|
51627
|
-
await import_promises6.default.mkdir(
|
|
51826
|
+
await import_promises6.default.mkdir(import_node_path16.default.dirname(this.filePath), { recursive: true });
|
|
51628
51827
|
const lines = records.map((record2) => JSON.stringify(record2)).join("\n");
|
|
51629
51828
|
await import_promises6.default.appendFile(this.filePath, `${lines}
|
|
51630
51829
|
`, "utf8");
|
|
@@ -51636,7 +51835,7 @@ var MailStore = class {
|
|
|
51636
51835
|
* rule, applied to the one operation here that is not an append.
|
|
51637
51836
|
*/
|
|
51638
51837
|
async replace(records) {
|
|
51639
|
-
await import_promises6.default.mkdir(
|
|
51838
|
+
await import_promises6.default.mkdir(import_node_path16.default.dirname(this.filePath), { recursive: true });
|
|
51640
51839
|
const temporary = `${this.filePath}.tmp`;
|
|
51641
51840
|
const body = records.map((record2) => JSON.stringify(record2)).join("\n");
|
|
51642
51841
|
await import_promises6.default.writeFile(temporary, records.length === 0 ? "" : `${body}
|
|
@@ -51659,7 +51858,7 @@ var MailStore = class {
|
|
|
51659
51858
|
}
|
|
51660
51859
|
}
|
|
51661
51860
|
async saveBackfillState(state) {
|
|
51662
|
-
await import_promises6.default.mkdir(
|
|
51861
|
+
await import_promises6.default.mkdir(import_node_path16.default.dirname(this.progressPath), { recursive: true });
|
|
51663
51862
|
const temporary = `${this.progressPath}.tmp`;
|
|
51664
51863
|
await import_promises6.default.writeFile(temporary, JSON.stringify(state), "utf8");
|
|
51665
51864
|
await replaceFile(temporary, this.progressPath);
|
|
@@ -51923,7 +52122,7 @@ async function refreshMail(options) {
|
|
|
51923
52122
|
const limit = options.batchLimit ?? 2e3;
|
|
51924
52123
|
const previewChars = options.previewChars ?? 400;
|
|
51925
52124
|
const sinceMs = Date.now() - options.days * 24 * 60 * 60 * 1e3;
|
|
51926
|
-
const harvested = await options.harvest(options.folders.map((
|
|
52125
|
+
const harvested = await options.harvest(options.folders.map((path58) => ({ path: path58, sinceMs })), { limit, previewChars });
|
|
51927
52126
|
const fetched = harvested.messages.map(toRecord);
|
|
51928
52127
|
if (fetched.length === 0) {
|
|
51929
52128
|
return { added: 0, more: false, total: known.length, embedded: 0, backfilled: 0, complete: [] };
|
|
@@ -51964,9 +52163,9 @@ async function syncMail(options) {
|
|
|
51964
52163
|
const backfillDone = await options.store.loadBackfillState();
|
|
51965
52164
|
const limit = options.batchLimit ?? 500;
|
|
51966
52165
|
const previewChars = options.previewChars ?? 400;
|
|
51967
|
-
const forwardRequests = options.folders.map((
|
|
51968
|
-
const mark = marks.get(
|
|
51969
|
-
return mark === void 0 ? { path:
|
|
52166
|
+
const forwardRequests = options.folders.map((path58) => {
|
|
52167
|
+
const mark = marks.get(path58);
|
|
52168
|
+
return mark === void 0 ? { path: path58 } : { path: path58, sinceMs: mark.newest - 1e3 };
|
|
51970
52169
|
});
|
|
51971
52170
|
const forward = await options.harvest(forwardRequests, { limit, previewChars });
|
|
51972
52171
|
let candidates = forward.messages.map(toRecord);
|
|
@@ -51975,15 +52174,15 @@ async function syncMail(options) {
|
|
|
51975
52174
|
let more = forward.truncated;
|
|
51976
52175
|
const remaining = limit - candidates.length;
|
|
51977
52176
|
const floor = options.retentionMonths === void 0 ? void 0 : monthsBefore(options.now ?? Date.now(), options.retentionMonths);
|
|
51978
|
-
const outstanding = options.folders.filter((
|
|
51979
|
-
const atFloor = floor === void 0 ? [] : outstanding.filter((
|
|
51980
|
-
const behind = outstanding.filter((
|
|
52177
|
+
const outstanding = options.folders.filter((path58) => marks.has(path58) && backfillDone[path58] !== true);
|
|
52178
|
+
const atFloor = floor === void 0 ? [] : outstanding.filter((path58) => marks.get(path58).oldest <= floor);
|
|
52179
|
+
const behind = outstanding.filter((path58) => !atFloor.includes(path58));
|
|
51981
52180
|
completed.push(...atFloor);
|
|
51982
52181
|
if (remaining > 0 && behind.length > 0 && options.signal?.aborted !== true) {
|
|
51983
|
-
const backRequests = behind.map((
|
|
51984
|
-
path:
|
|
52182
|
+
const backRequests = behind.map((path58) => ({
|
|
52183
|
+
path: path58,
|
|
51985
52184
|
// Strictly older, so the oldest held message is not fetched again every pass.
|
|
51986
|
-
beforeMs: marks.get(
|
|
52185
|
+
beforeMs: marks.get(path58).oldest,
|
|
51987
52186
|
// And no older than retention wants. The harvest ANDs the two into one window.
|
|
51988
52187
|
...floor === void 0 ? {} : { sinceMs: floor }
|
|
51989
52188
|
}));
|
|
@@ -51991,9 +52190,9 @@ async function syncMail(options) {
|
|
|
51991
52190
|
backfilled = backward.messages.length;
|
|
51992
52191
|
candidates = [...candidates, ...backward.messages.map(toRecord)];
|
|
51993
52192
|
const returnedFor = new Set(backward.messages.map((message4) => message4.folder));
|
|
51994
|
-
for (const
|
|
51995
|
-
if (!returnedFor.has(
|
|
51996
|
-
completed.push(
|
|
52193
|
+
for (const path58 of behind) {
|
|
52194
|
+
if (!returnedFor.has(path58))
|
|
52195
|
+
completed.push(path58);
|
|
51997
52196
|
}
|
|
51998
52197
|
if (backward.truncated || backfilled > 0)
|
|
51999
52198
|
more = true;
|
|
@@ -52001,7 +52200,7 @@ async function syncMail(options) {
|
|
|
52001
52200
|
if (completed.length > 0) {
|
|
52002
52201
|
await options.store.saveBackfillState({
|
|
52003
52202
|
...backfillDone,
|
|
52004
|
-
...Object.fromEntries(completed.map((
|
|
52203
|
+
...Object.fromEntries(completed.map((path58) => [path58, true]))
|
|
52005
52204
|
});
|
|
52006
52205
|
}
|
|
52007
52206
|
const fresh = withoutKnown(candidates, known);
|
|
@@ -52069,7 +52268,7 @@ async function embedRecords(records, options) {
|
|
|
52069
52268
|
}
|
|
52070
52269
|
|
|
52071
52270
|
// ../../packages/core/dist/schedule/runner.js
|
|
52072
|
-
var
|
|
52271
|
+
var import_node_path17 = __toESM(require("node:path"), 1);
|
|
52073
52272
|
|
|
52074
52273
|
// ../../packages/core/dist/tools/registry.js
|
|
52075
52274
|
var ToolRegistry = class {
|
|
@@ -52204,7 +52403,7 @@ function scheduleAppliesHere(schedule, workspaceRoot) {
|
|
|
52204
52403
|
if (workspaceRoot === void 0)
|
|
52205
52404
|
return false;
|
|
52206
52405
|
const normalise2 = (value) => {
|
|
52207
|
-
const resolved =
|
|
52406
|
+
const resolved = import_node_path17.default.resolve(value);
|
|
52208
52407
|
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
52209
52408
|
};
|
|
52210
52409
|
return normalise2(schedule.workspaceRoot) === normalise2(workspaceRoot);
|
|
@@ -52335,14 +52534,14 @@ function formatBytes(size) {
|
|
|
52335
52534
|
return `${(size / (1 << 10)).toFixed(1)}KB`;
|
|
52336
52535
|
return `${String(size)}B`;
|
|
52337
52536
|
}
|
|
52338
|
-
async function readTail(fs39,
|
|
52537
|
+
async function readTail(fs39, path58, size, count3) {
|
|
52339
52538
|
let span = Math.min(size, CHUNK);
|
|
52340
52539
|
let text;
|
|
52341
52540
|
let start;
|
|
52342
52541
|
for (; ; ) {
|
|
52343
52542
|
start = Math.max(0, size - span);
|
|
52344
52543
|
const decoder = new import_node_string_decoder.StringDecoder("utf8");
|
|
52345
|
-
text = decoder.write(await fs39.readBytesSlice(
|
|
52544
|
+
text = decoder.write(await fs39.readBytesSlice(path58, start, size)) + decoder.end();
|
|
52346
52545
|
const enough = text.split("\n").length > count3;
|
|
52347
52546
|
if (enough || start === 0 || span >= size)
|
|
52348
52547
|
break;
|
|
@@ -52360,7 +52559,7 @@ async function readTail(fs39, path57, size, count3) {
|
|
|
52360
52559
|
hasMoreAfter: false
|
|
52361
52560
|
};
|
|
52362
52561
|
}
|
|
52363
|
-
async function readLineWindow(fs39,
|
|
52562
|
+
async function readLineWindow(fs39, path58, size, from, count3) {
|
|
52364
52563
|
const decoder = new import_node_string_decoder.StringDecoder("utf8");
|
|
52365
52564
|
const lines = [];
|
|
52366
52565
|
let pending = "";
|
|
@@ -52375,7 +52574,7 @@ async function readLineWindow(fs39, path57, size, from, count3) {
|
|
|
52375
52574
|
};
|
|
52376
52575
|
scan: while (position < size) {
|
|
52377
52576
|
const end = Math.min(size, position + CHUNK);
|
|
52378
|
-
pending += decoder.write(await fs39.readBytesSlice(
|
|
52577
|
+
pending += decoder.write(await fs39.readBytesSlice(path58, position, end));
|
|
52379
52578
|
position = end;
|
|
52380
52579
|
const parts = pending.split(/\r\n|\r|\n/);
|
|
52381
52580
|
pending = parts.pop() ?? "";
|
|
@@ -52398,13 +52597,13 @@ async function readLineWindow(fs39, path57, size, from, count3) {
|
|
|
52398
52597
|
hasMoreAfter: !reachedEnd || lineNumber > from + lines.length
|
|
52399
52598
|
};
|
|
52400
52599
|
}
|
|
52401
|
-
async function countLines(fs39,
|
|
52600
|
+
async function countLines(fs39, path58, size) {
|
|
52402
52601
|
let newlines = 0;
|
|
52403
52602
|
let position = 0;
|
|
52404
52603
|
let lastByte = -1;
|
|
52405
52604
|
while (position < size) {
|
|
52406
52605
|
const end = Math.min(size, position + CHUNK);
|
|
52407
|
-
const buffer = await fs39.readBytesSlice(
|
|
52606
|
+
const buffer = await fs39.readBytesSlice(path58, position, end);
|
|
52408
52607
|
for (const byte of buffer)
|
|
52409
52608
|
if (byte === 10)
|
|
52410
52609
|
newlines += 1;
|
|
@@ -52479,7 +52678,7 @@ function chunkFile(content, options = {}) {
|
|
|
52479
52678
|
// ../../packages/core/dist/rag/indexer.js
|
|
52480
52679
|
var import_node_crypto6 = __toESM(require("node:crypto"), 1);
|
|
52481
52680
|
var import_promises7 = __toESM(require("node:fs/promises"), 1);
|
|
52482
|
-
var
|
|
52681
|
+
var import_node_path18 = __toESM(require("node:path"), 1);
|
|
52483
52682
|
var ALWAYS_SKIP = /* @__PURE__ */ new Set([
|
|
52484
52683
|
"node_modules",
|
|
52485
52684
|
".git",
|
|
@@ -52631,8 +52830,8 @@ async function indexWorkspace(options) {
|
|
|
52631
52830
|
}
|
|
52632
52831
|
for (const entry of entries) {
|
|
52633
52832
|
throwIfCancelled();
|
|
52634
|
-
const absolute =
|
|
52635
|
-
const relative =
|
|
52833
|
+
const absolute = import_node_path18.default.join(dir, entry.name);
|
|
52834
|
+
const relative = import_node_path18.default.relative(workspaceRoot, absolute).split(import_node_path18.default.sep).join("/");
|
|
52636
52835
|
if (entry.isDirectory()) {
|
|
52637
52836
|
if (ALWAYS_SKIP.has(entry.name) || entry.name.startsWith("."))
|
|
52638
52837
|
continue;
|
|
@@ -52649,7 +52848,7 @@ async function indexWorkspace(options) {
|
|
|
52649
52848
|
note("excluded filename");
|
|
52650
52849
|
continue;
|
|
52651
52850
|
}
|
|
52652
|
-
if (!INDEXABLE_EXTENSIONS.has(
|
|
52851
|
+
if (!INDEXABLE_EXTENSIONS.has(import_node_path18.default.extname(entry.name).toLowerCase())) {
|
|
52653
52852
|
progress.filesSkipped++;
|
|
52654
52853
|
note("not an indexable file type");
|
|
52655
52854
|
continue;
|
|
@@ -52750,7 +52949,7 @@ async function indexWorkspace(options) {
|
|
|
52750
52949
|
// ../../packages/core/dist/checkpoints/shadowGit.js
|
|
52751
52950
|
var import_node_child_process3 = require("node:child_process");
|
|
52752
52951
|
var import_promises8 = __toESM(require("node:fs/promises"), 1);
|
|
52753
|
-
var
|
|
52952
|
+
var import_node_path19 = __toESM(require("node:path"), 1);
|
|
52754
52953
|
function runGit(args, cwd) {
|
|
52755
52954
|
return new Promise((resolve, reject2) => {
|
|
52756
52955
|
(0, import_node_child_process3.execFile)("git", args, { cwd, maxBuffer: 32 * 1024 * 1024 }, (error51, stdout, stderr) => {
|
|
@@ -52778,20 +52977,20 @@ var ShadowGit = class {
|
|
|
52778
52977
|
* shadow repo made by an older version gets it too.
|
|
52779
52978
|
*/
|
|
52780
52979
|
async keepBytes() {
|
|
52781
|
-
const file2 =
|
|
52980
|
+
const file2 = import_node_path19.default.join(this.shadowDir, "info", "attributes");
|
|
52782
52981
|
try {
|
|
52783
52982
|
if ((await import_promises8.default.readFile(file2, "utf8")).includes("* -text"))
|
|
52784
52983
|
return;
|
|
52785
52984
|
} catch {
|
|
52786
52985
|
}
|
|
52787
|
-
await import_promises8.default.mkdir(
|
|
52986
|
+
await import_promises8.default.mkdir(import_node_path19.default.dirname(file2), { recursive: true });
|
|
52788
52987
|
await import_promises8.default.writeFile(file2, "* -text -filter -diff\n");
|
|
52789
52988
|
}
|
|
52790
52989
|
/** Safe to call repeatedly; only the first call does any work. */
|
|
52791
52990
|
async init() {
|
|
52792
52991
|
if (await this.isInitialized())
|
|
52793
52992
|
return;
|
|
52794
|
-
await import_promises8.default.mkdir(
|
|
52993
|
+
await import_promises8.default.mkdir(import_node_path19.default.dirname(this.shadowDir), { recursive: true });
|
|
52795
52994
|
await runGit(["init", "--bare", this.shadowDir], this.workspaceRoot);
|
|
52796
52995
|
await runGit(this.gitArgs(["config", "user.name", "Light Code"]), this.workspaceRoot);
|
|
52797
52996
|
await runGit(this.gitArgs(["config", "user.email", "light-code@localhost"]), this.workspaceRoot);
|
|
@@ -52799,7 +52998,7 @@ var ShadowGit = class {
|
|
|
52799
52998
|
}
|
|
52800
52999
|
async isInitialized() {
|
|
52801
53000
|
try {
|
|
52802
|
-
await import_promises8.default.access(
|
|
53001
|
+
await import_promises8.default.access(import_node_path19.default.join(this.shadowDir, "HEAD"));
|
|
52803
53002
|
return true;
|
|
52804
53003
|
} catch {
|
|
52805
53004
|
return false;
|
|
@@ -52840,10 +53039,10 @@ var ShadowGit = class {
|
|
|
52840
53039
|
const restored = [];
|
|
52841
53040
|
const removed = [];
|
|
52842
53041
|
for (const file2 of files) {
|
|
52843
|
-
const relative =
|
|
52844
|
-
if (relative.startsWith("..") ||
|
|
53042
|
+
const relative = import_node_path19.default.relative(this.workspaceRoot, file2);
|
|
53043
|
+
if (relative.startsWith("..") || import_node_path19.default.isAbsolute(relative))
|
|
52845
53044
|
continue;
|
|
52846
|
-
const spec = relative.split(
|
|
53045
|
+
const spec = relative.split(import_node_path19.default.sep).join("/");
|
|
52847
53046
|
const existed = await runGit(this.gitArgs(["cat-file", "-e", `${checkpoint.commit}:${spec}`]), this.workspaceRoot);
|
|
52848
53047
|
if (existed.code === 0) {
|
|
52849
53048
|
const result = await runGit(this.gitArgs(["restore", "--source", checkpoint.commit, "--worktree", "--", spec]), this.workspaceRoot);
|
|
@@ -58969,7 +59168,7 @@ var VENV_DIR_NAMES = [".venv", "venv", "env", ".env"];
|
|
|
58969
59168
|
// ../../packages/core/dist/python/uv.js
|
|
58970
59169
|
var import_node_child_process4 = require("node:child_process");
|
|
58971
59170
|
var import_promises9 = __toESM(require("node:fs/promises"), 1);
|
|
58972
|
-
var
|
|
59171
|
+
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
58973
59172
|
var UvError = class extends Error {
|
|
58974
59173
|
constructor(message4) {
|
|
58975
59174
|
super(message4);
|
|
@@ -58977,7 +59176,7 @@ var UvError = class extends Error {
|
|
|
58977
59176
|
}
|
|
58978
59177
|
};
|
|
58979
59178
|
function venvPythonPath(venvDir, platform = process.platform) {
|
|
58980
|
-
return platform === "win32" ?
|
|
59179
|
+
return platform === "win32" ? import_node_path20.default.join(venvDir, "Scripts", "python.exe") : import_node_path20.default.join(venvDir, "bin", "python");
|
|
58981
59180
|
}
|
|
58982
59181
|
function run2(command, args, timeoutMs = 1e4) {
|
|
58983
59182
|
return new Promise((resolve, reject2) => {
|
|
@@ -59008,7 +59207,7 @@ async function ensureVenv(options) {
|
|
|
59008
59207
|
return python;
|
|
59009
59208
|
} catch {
|
|
59010
59209
|
}
|
|
59011
|
-
await import_promises9.default.mkdir(
|
|
59210
|
+
await import_promises9.default.mkdir(import_node_path20.default.dirname(options.venvDir), { recursive: true });
|
|
59012
59211
|
await new Promise((resolve, reject2) => {
|
|
59013
59212
|
(0, import_node_child_process4.execFile)(options.uv.path, ["venv", options.venvDir], { timeout: 12e4, windowsHide: true, env: options.env }, (error51, _stdout, stderr) => {
|
|
59014
59213
|
if (error51)
|
|
@@ -59052,7 +59251,7 @@ function minimalPythonEnv(extra = {}) {
|
|
|
59052
59251
|
var WORKSPACE_VENV_NAMES = [".venv", "venv", ".env", "env"];
|
|
59053
59252
|
async function discoverWorkspaceVenv(workspaceRoot) {
|
|
59054
59253
|
for (const name of WORKSPACE_VENV_NAMES) {
|
|
59055
|
-
const candidate =
|
|
59254
|
+
const candidate = import_node_path20.default.join(workspaceRoot, name);
|
|
59056
59255
|
const interpreter = venvPythonPath(candidate);
|
|
59057
59256
|
try {
|
|
59058
59257
|
await import_promises9.default.stat(interpreter);
|
|
@@ -59062,7 +59261,7 @@ async function discoverWorkspaceVenv(workspaceRoot) {
|
|
|
59062
59261
|
let uvManaged = false;
|
|
59063
59262
|
let pythonVersion2;
|
|
59064
59263
|
try {
|
|
59065
|
-
const config2 = await import_promises9.default.readFile(
|
|
59264
|
+
const config2 = await import_promises9.default.readFile(import_node_path20.default.join(candidate, "pyvenv.cfg"), "utf8");
|
|
59066
59265
|
uvManaged = /^\s*uv\s*=/m.test(config2);
|
|
59067
59266
|
pythonVersion2 = /^\s*version(?:_info)?\s*=\s*(.+)$/m.exec(config2)?.[1]?.trim();
|
|
59068
59267
|
} catch {
|
|
@@ -59090,9 +59289,9 @@ async function detectBareInterpreter(configuredPath) {
|
|
|
59090
59289
|
return void 0;
|
|
59091
59290
|
}
|
|
59092
59291
|
async function pythonVersion(program) {
|
|
59093
|
-
const { spawn:
|
|
59292
|
+
const { spawn: spawn13 } = await import("node:child_process");
|
|
59094
59293
|
return new Promise((resolve) => {
|
|
59095
|
-
const child =
|
|
59294
|
+
const child = spawn13(program, ["-c", 'import sys; print("%d.%d.%d" % sys.version_info[:3])'], {
|
|
59096
59295
|
shell: false,
|
|
59097
59296
|
env: minimalPythonEnv()
|
|
59098
59297
|
});
|
|
@@ -59469,7 +59668,7 @@ function missingAttribution(kind, source) {
|
|
|
59469
59668
|
|
|
59470
59669
|
// ../../packages/core/dist/skills/index.js
|
|
59471
59670
|
var import_promises10 = __toESM(require("node:fs/promises"), 1);
|
|
59472
|
-
var
|
|
59671
|
+
var import_node_path21 = __toESM(require("node:path"), 1);
|
|
59473
59672
|
function isValidSkillName(name) {
|
|
59474
59673
|
return /^[a-z0-9][a-z0-9-]{0,63}$/.test(name);
|
|
59475
59674
|
}
|
|
@@ -59509,7 +59708,7 @@ async function skillFileInFolder(folder) {
|
|
|
59509
59708
|
try {
|
|
59510
59709
|
for (const entry of await import_promises10.default.readdir(folder)) {
|
|
59511
59710
|
if (entry.toLowerCase() === "skill.md")
|
|
59512
|
-
return
|
|
59711
|
+
return import_node_path21.default.join(folder, entry);
|
|
59513
59712
|
}
|
|
59514
59713
|
} catch {
|
|
59515
59714
|
}
|
|
@@ -59522,11 +59721,11 @@ async function loadOneDirectory(skillsDir) {
|
|
|
59522
59721
|
try {
|
|
59523
59722
|
for (const entry of await import_promises10.default.readdir(skillsDir, { withFileTypes: true })) {
|
|
59524
59723
|
if (entry.isDirectory()) {
|
|
59525
|
-
const inner = await skillFileInFolder(
|
|
59724
|
+
const inner = await skillFileInFolder(import_node_path21.default.join(skillsDir, entry.name));
|
|
59526
59725
|
if (inner !== void 0)
|
|
59527
59726
|
candidates.push([inner, entry.name]);
|
|
59528
59727
|
} else if (entry.name.endsWith(".md")) {
|
|
59529
|
-
candidates.push([
|
|
59728
|
+
candidates.push([import_node_path21.default.join(skillsDir, entry.name), import_node_path21.default.basename(entry.name, ".md")]);
|
|
59530
59729
|
}
|
|
59531
59730
|
}
|
|
59532
59731
|
} catch {
|
|
@@ -59560,7 +59759,7 @@ async function loadOneDirectory(skillsDir) {
|
|
|
59560
59759
|
return { skills, issues };
|
|
59561
59760
|
}
|
|
59562
59761
|
async function loadSkills(dirs) {
|
|
59563
|
-
const ordered = (typeof dirs === "string" ? [dirs] : dirs).map((dir) =>
|
|
59762
|
+
const ordered = (typeof dirs === "string" ? [dirs] : dirs).map((dir) => import_node_path21.default.resolve(dir));
|
|
59564
59763
|
const unique = ordered.filter((dir, index) => ordered.indexOf(dir) === index);
|
|
59565
59764
|
const skills = [];
|
|
59566
59765
|
const issues = [];
|
|
@@ -59634,10 +59833,10 @@ function renderAlwaysSkills(skills) {
|
|
|
59634
59833
|
|
|
59635
59834
|
// ../../packages/core/dist/skills/tools.js
|
|
59636
59835
|
var import_promises11 = __toESM(require("node:fs/promises"), 1);
|
|
59637
|
-
var
|
|
59836
|
+
var import_node_path24 = __toESM(require("node:path"), 1);
|
|
59638
59837
|
|
|
59639
59838
|
// ../../packages/core/dist/skills/images.js
|
|
59640
|
-
var
|
|
59839
|
+
var import_node_path22 = __toESM(require("node:path"), 1);
|
|
59641
59840
|
var SKILL_IMAGE_TYPES = {
|
|
59642
59841
|
".png": "image/png",
|
|
59643
59842
|
".jpg": "image/jpeg",
|
|
@@ -59649,11 +59848,11 @@ var SKILL_IMAGE_TYPES = {
|
|
|
59649
59848
|
var SKILL_IMAGE_DIR = "images";
|
|
59650
59849
|
var MAX_SKILL_IMAGE_BYTES = 2 * 1024 * 1024;
|
|
59651
59850
|
function skillImageType(fileName) {
|
|
59652
|
-
return SKILL_IMAGE_TYPES[
|
|
59851
|
+
return SKILL_IMAGE_TYPES[import_node_path22.default.extname(fileName).toLowerCase()];
|
|
59653
59852
|
}
|
|
59654
59853
|
function skillImageName(input) {
|
|
59655
|
-
const proposed =
|
|
59656
|
-
const extension = (
|
|
59854
|
+
const proposed = import_node_path22.default.basename(input.name ?? input.source);
|
|
59855
|
+
const extension = (import_node_path22.default.extname(proposed) === "" ? import_node_path22.default.extname(input.source) : import_node_path22.default.extname(proposed)).toLowerCase();
|
|
59657
59856
|
const withoutExtension = proposed.toLowerCase().endsWith(extension) && extension !== "" ? proposed.slice(0, proposed.length - extension.length) : proposed;
|
|
59658
59857
|
const stem2 = withoutExtension.toLowerCase().replace(/[^a-z0-9._-]/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "");
|
|
59659
59858
|
return `${stem2 === "" ? "image" : stem2}${extension}`;
|
|
@@ -59691,13 +59890,13 @@ function skillImageDataUri(name, bytes) {
|
|
|
59691
59890
|
}
|
|
59692
59891
|
|
|
59693
59892
|
// ../../packages/core/dist/skills/files.js
|
|
59694
|
-
var
|
|
59893
|
+
var import_node_path23 = __toESM(require("node:path"), 1);
|
|
59695
59894
|
var SKILL_FILE_DIR = "files";
|
|
59696
59895
|
var MAX_SKILL_FILE_BYTES = 25 * 1024 * 1024;
|
|
59697
59896
|
var MAX_SKILL_FILES = 12;
|
|
59698
59897
|
function skillFileAssetName(input) {
|
|
59699
|
-
const proposed =
|
|
59700
|
-
const extension =
|
|
59898
|
+
const proposed = import_node_path23.default.basename(input.name ?? input.source);
|
|
59899
|
+
const extension = import_node_path23.default.extname(proposed) === "" ? import_node_path23.default.extname(input.source) : import_node_path23.default.extname(proposed);
|
|
59701
59900
|
const withoutExtension = extension !== "" && proposed.toLowerCase().endsWith(extension.toLowerCase()) ? proposed.slice(0, proposed.length - extension.length) : proposed;
|
|
59702
59901
|
const stem2 = withoutExtension.replace(/[^A-Za-z0-9._-]/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "");
|
|
59703
59902
|
return `${stem2 === "" ? "file" : stem2}${extension}`;
|
|
@@ -59763,17 +59962,17 @@ async function resolveSkillPath(skillsDir, name, wantsFolder = false) {
|
|
|
59763
59962
|
throw new Error(`"${name}" is not a valid skill name. Use lowercase letters, digits and hyphens.`);
|
|
59764
59963
|
}
|
|
59765
59964
|
await import_promises11.default.mkdir(skillsDir, { recursive: true });
|
|
59766
|
-
const folder = await exists(
|
|
59965
|
+
const folder = await exists(import_node_path24.default.join(skillsDir, name, "SKILL.md"));
|
|
59767
59966
|
if (wantsFolder || folder) {
|
|
59768
|
-
return confine(
|
|
59967
|
+
return confine(import_node_path24.default.join(skillsDir, name, "SKILL.md"), skillsDir);
|
|
59769
59968
|
}
|
|
59770
|
-
return confine(
|
|
59969
|
+
return confine(import_node_path24.default.join(skillsDir, skillFileName(name)), skillsDir);
|
|
59771
59970
|
}
|
|
59772
59971
|
async function copySkillImages(skillDir, images, context) {
|
|
59773
59972
|
if (images.length === 0)
|
|
59774
59973
|
return [];
|
|
59775
59974
|
await import_promises11.default.mkdir(skillDir, { recursive: true });
|
|
59776
|
-
const target = await confine(
|
|
59975
|
+
const target = await confine(import_node_path24.default.join(skillDir, SKILL_IMAGE_DIR), skillDir);
|
|
59777
59976
|
await import_promises11.default.mkdir(target, { recursive: true });
|
|
59778
59977
|
const stored = [];
|
|
59779
59978
|
for (const image of images) {
|
|
@@ -59789,7 +59988,7 @@ async function copySkillImages(skillDir, images, context) {
|
|
|
59789
59988
|
if (bytes.length > MAX_SKILL_IMAGE_BYTES) {
|
|
59790
59989
|
throw new Error(`"${image.source}" is ${String(Math.round(bytes.length / 1024))} KB. A skill holds illustrations, so the limit is ${String(MAX_SKILL_IMAGE_BYTES / 1024 / 1024)} MB each.`);
|
|
59791
59990
|
}
|
|
59792
|
-
await import_promises11.default.writeFile(await confine(
|
|
59991
|
+
await import_promises11.default.writeFile(await confine(import_node_path24.default.join(target, name), target), bytes);
|
|
59793
59992
|
stored.push({
|
|
59794
59993
|
name,
|
|
59795
59994
|
alt: image.alt,
|
|
@@ -59802,7 +60001,7 @@ async function copySkillFiles(skillDir, files, context) {
|
|
|
59802
60001
|
if (files.length === 0)
|
|
59803
60002
|
return [];
|
|
59804
60003
|
await import_promises11.default.mkdir(skillDir, { recursive: true });
|
|
59805
|
-
const target = await confine(
|
|
60004
|
+
const target = await confine(import_node_path24.default.join(skillDir, SKILL_FILE_DIR), skillDir);
|
|
59806
60005
|
await import_promises11.default.mkdir(target, { recursive: true });
|
|
59807
60006
|
const stored = [];
|
|
59808
60007
|
for (const file2 of files) {
|
|
@@ -59814,7 +60013,7 @@ async function copySkillFiles(skillDir, files, context) {
|
|
|
59814
60013
|
if (bytes.length > MAX_SKILL_FILE_BYTES) {
|
|
59815
60014
|
throw new Error(`"${file2.source}" is ${String(Math.round(bytes.length / 1024 / 1024))} MB. A skill holds working materials, so the limit is ${String(MAX_SKILL_FILE_BYTES / 1024 / 1024)} MB each.`);
|
|
59816
60015
|
}
|
|
59817
|
-
await import_promises11.default.writeFile(await confine(
|
|
60016
|
+
await import_promises11.default.writeFile(await confine(import_node_path24.default.join(target, name), target), bytes);
|
|
59818
60017
|
stored.push({ name, description: file2.description });
|
|
59819
60018
|
}
|
|
59820
60019
|
return stored;
|
|
@@ -59898,8 +60097,8 @@ function createWriteSkillTool(context) {
|
|
|
59898
60097
|
const filePath = await resolveSkillPath(context.skillsDir, params3.name, wantsFolder);
|
|
59899
60098
|
const before = await readIfPresent(filePath);
|
|
59900
60099
|
const existed = before.length > 0;
|
|
59901
|
-
const stored = wantsFolder && context.submitForReview === void 0 ? await copySkillImages(
|
|
59902
|
-
const storedFiles = wantsFolder && context.submitForReview === void 0 ? await copySkillFiles(
|
|
60100
|
+
const stored = wantsFolder && context.submitForReview === void 0 ? await copySkillImages(import_node_path24.default.dirname(filePath), params3.images ?? [], toolContext) : plannedImages(params3);
|
|
60101
|
+
const storedFiles = wantsFolder && context.submitForReview === void 0 ? await copySkillFiles(import_node_path24.default.dirname(filePath), params3.files ?? [], toolContext) : plannedFiles(params3);
|
|
59903
60102
|
const rendered = label(params3.name, renderSkill(params3.name, params3.description, appendSkillFiles(appendSkillImages(params3.body, stored), params3.name, storedFiles)), before);
|
|
59904
60103
|
if (context.submitForReview !== void 0) {
|
|
59905
60104
|
return {
|
|
@@ -59912,7 +60111,7 @@ function createWriteSkillTool(context) {
|
|
|
59912
60111
|
}
|
|
59913
60112
|
await import_promises11.default.writeFile(filePath, rendered, "utf8");
|
|
59914
60113
|
if (wantsFolder) {
|
|
59915
|
-
const flat =
|
|
60114
|
+
const flat = import_node_path24.default.join(context.skillsDir, skillFileName(params3.name));
|
|
59916
60115
|
if (await exists(flat))
|
|
59917
60116
|
await import_promises11.default.rm(flat).catch(() => void 0);
|
|
59918
60117
|
}
|
|
@@ -59920,7 +60119,7 @@ function createWriteSkillTool(context) {
|
|
|
59920
60119
|
let publishProblem;
|
|
59921
60120
|
if (context.onSaved !== void 0) {
|
|
59922
60121
|
try {
|
|
59923
|
-
await context.onSaved(params3.name, rendered,
|
|
60122
|
+
await context.onSaved(params3.name, rendered, import_node_path24.default.relative(context.skillsDir, filePath).split(import_node_path24.default.sep).join("/"));
|
|
59924
60123
|
} catch (error51) {
|
|
59925
60124
|
publishProblem = error51 instanceof Error ? error51.message : String(error51);
|
|
59926
60125
|
}
|
|
@@ -59955,7 +60154,7 @@ function createUseSkillFileTool(context) {
|
|
|
59955
60154
|
if (dir === void 0) {
|
|
59956
60155
|
throw new Error(`The skill "${name}" keeps no reference files. Its text is at ${skillPath}.`);
|
|
59957
60156
|
}
|
|
59958
|
-
const source = await confine(
|
|
60157
|
+
const source = await confine(import_node_path24.default.join(dir, import_node_path24.default.basename(file2)), dir);
|
|
59959
60158
|
if (!await exists(source)) {
|
|
59960
60159
|
const available = await listSkillFiles(skillPath, {
|
|
59961
60160
|
readdir: async (target) => {
|
|
@@ -59973,7 +60172,7 @@ function createUseSkillFileTool(context) {
|
|
|
59973
60172
|
description: 'Copy a reference file kept with a skill - a spreadsheet template, a starting config, a sample document - into the workspace so you can work on it. The skill lists the files it has, under "Reference files". Always copies; the skill keeps its own original. Returns the path of the copy, not its contents.',
|
|
59974
60173
|
parametersSchema: useFileParams,
|
|
59975
60174
|
async preview(params3, toolContext) {
|
|
59976
|
-
const destination = params3.destination ??
|
|
60175
|
+
const destination = params3.destination ?? import_node_path24.default.basename(params3.file);
|
|
59977
60176
|
const lines = [
|
|
59978
60177
|
`Copy "${params3.file}" from the skill "${params3.skill}" into the workspace as ${destination}.`
|
|
59979
60178
|
];
|
|
@@ -59993,11 +60192,11 @@ function createUseSkillFileTool(context) {
|
|
|
59993
60192
|
async execute(params3, toolContext) {
|
|
59994
60193
|
try {
|
|
59995
60194
|
const { source } = await locate(params3.skill, params3.file);
|
|
59996
|
-
const destination = params3.destination ??
|
|
60195
|
+
const destination = params3.destination ?? import_node_path24.default.basename(params3.file);
|
|
59997
60196
|
const target = await resolveToolPath(toolContext, destination, { write: true });
|
|
59998
60197
|
if (!target.ok)
|
|
59999
60198
|
return { content: target.message, isError: true };
|
|
60000
|
-
await import_promises11.default.mkdir(
|
|
60199
|
+
await import_promises11.default.mkdir(import_node_path24.default.dirname(target.realPath), { recursive: true });
|
|
60001
60200
|
const replaced = await exists(target.realPath);
|
|
60002
60201
|
await import_promises11.default.copyFile(source, target.realPath);
|
|
60003
60202
|
return {
|
|
@@ -60026,8 +60225,8 @@ function createDeleteSkillTool(context) {
|
|
|
60026
60225
|
async execute(params3) {
|
|
60027
60226
|
try {
|
|
60028
60227
|
const filePath = await resolveSkillPath(context.skillsDir, params3.name);
|
|
60029
|
-
const folder =
|
|
60030
|
-
const isFolderSkill =
|
|
60228
|
+
const folder = import_node_path24.default.dirname(filePath);
|
|
60229
|
+
const isFolderSkill = import_node_path24.default.resolve(folder) !== import_node_path24.default.resolve(context.skillsDir);
|
|
60031
60230
|
if (isFolderSkill) {
|
|
60032
60231
|
await import_promises11.default.rm(await confine(folder, context.skillsDir), { recursive: true, force: true });
|
|
60033
60232
|
} else {
|
|
@@ -60329,13 +60528,13 @@ function buildExport(config2, selected) {
|
|
|
60329
60528
|
if (has(config2, key2))
|
|
60330
60529
|
exported[key2] = config2[key2];
|
|
60331
60530
|
}
|
|
60332
|
-
for (const
|
|
60333
|
-
stripPath(exported,
|
|
60531
|
+
for (const path58 of section.strip ?? [])
|
|
60532
|
+
stripPath(exported, path58);
|
|
60334
60533
|
}
|
|
60335
60534
|
return exported;
|
|
60336
60535
|
}
|
|
60337
|
-
function stripPath(target,
|
|
60338
|
-
const [head, ...rest] =
|
|
60536
|
+
function stripPath(target, path58) {
|
|
60537
|
+
const [head, ...rest] = path58.split(".");
|
|
60339
60538
|
if (head === void 0)
|
|
60340
60539
|
return;
|
|
60341
60540
|
const value = target[head];
|
|
@@ -60363,14 +60562,14 @@ function applyImport(existing, imported, selected) {
|
|
|
60363
60562
|
else
|
|
60364
60563
|
delete merged[key2];
|
|
60365
60564
|
}
|
|
60366
|
-
for (const
|
|
60367
|
-
carryPath(existing, merged,
|
|
60565
|
+
for (const path58 of section.strip ?? []) {
|
|
60566
|
+
carryPath(existing, merged, path58);
|
|
60368
60567
|
}
|
|
60369
60568
|
}
|
|
60370
60569
|
return merged;
|
|
60371
60570
|
}
|
|
60372
|
-
function carryPath(from, to,
|
|
60373
|
-
const [head, ...rest] =
|
|
60571
|
+
function carryPath(from, to, path58) {
|
|
60572
|
+
const [head, ...rest] = path58.split(".");
|
|
60374
60573
|
if (head === void 0)
|
|
60375
60574
|
return;
|
|
60376
60575
|
const source = from[head];
|
|
@@ -60416,7 +60615,7 @@ Return a list of dicts, each with a stable \`id\` from the source and a \`text\`
|
|
|
60416
60615
|
|
|
60417
60616
|
// ../../packages/core/dist/python/manager.js
|
|
60418
60617
|
var import_promises14 = __toESM(require("node:fs/promises"), 1);
|
|
60419
|
-
var
|
|
60618
|
+
var import_node_path27 = __toESM(require("node:path"), 1);
|
|
60420
60619
|
|
|
60421
60620
|
// ../../packages/core/dist/python/env.js
|
|
60422
60621
|
var VALID_NAME2 = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -60456,7 +60655,7 @@ async function resolvePythonEnv(entries, secrets) {
|
|
|
60456
60655
|
// ../../packages/core/dist/python/registry.js
|
|
60457
60656
|
var import_node_crypto7 = __toESM(require("node:crypto"), 1);
|
|
60458
60657
|
var import_promises12 = __toESM(require("node:fs/promises"), 1);
|
|
60459
|
-
var
|
|
60658
|
+
var import_node_path25 = __toESM(require("node:path"), 1);
|
|
60460
60659
|
var REGISTRY_FILE = ".registry.json";
|
|
60461
60660
|
function hashSource(source) {
|
|
60462
60661
|
return import_node_crypto7.default.createHash("sha256").update(source.replace(/\r\n/g, "\n")).digest("hex");
|
|
@@ -60465,14 +60664,14 @@ function isValidToolName(name) {
|
|
|
60465
60664
|
return /^[a-z][a-z0-9_]{0,63}$/.test(name);
|
|
60466
60665
|
}
|
|
60467
60666
|
function defaultPythonToolsDir(workspaceRoot) {
|
|
60468
|
-
return
|
|
60667
|
+
return import_node_path25.default.join(workspaceRoot, ".lightcode", "tools");
|
|
60469
60668
|
}
|
|
60470
60669
|
function toolFileName(name) {
|
|
60471
60670
|
return `${name}.py`;
|
|
60472
60671
|
}
|
|
60473
60672
|
async function readRegistryFile(toolsDir) {
|
|
60474
60673
|
try {
|
|
60475
|
-
const parsed = JSON.parse(await import_promises12.default.readFile(
|
|
60674
|
+
const parsed = JSON.parse(await import_promises12.default.readFile(import_node_path25.default.join(toolsDir, REGISTRY_FILE), "utf8"));
|
|
60476
60675
|
if (parsed.version === 1 && typeof parsed.tools === "object")
|
|
60477
60676
|
return parsed;
|
|
60478
60677
|
} catch {
|
|
@@ -60481,7 +60680,7 @@ async function readRegistryFile(toolsDir) {
|
|
|
60481
60680
|
}
|
|
60482
60681
|
async function writeRegistryFile(toolsDir, registry2) {
|
|
60483
60682
|
await import_promises12.default.mkdir(toolsDir, { recursive: true });
|
|
60484
|
-
const target =
|
|
60683
|
+
const target = import_node_path25.default.join(toolsDir, REGISTRY_FILE);
|
|
60485
60684
|
const temporary = `${target}.${String(process.pid)}.${String(Date.now())}.tmp`;
|
|
60486
60685
|
await import_promises12.default.writeFile(temporary, JSON.stringify(registry2, null, 2), "utf8");
|
|
60487
60686
|
await replaceFile(temporary, target);
|
|
@@ -60512,8 +60711,8 @@ async function loadRegistry(toolsDir, worker, logger, declined, trusted) {
|
|
|
60512
60711
|
return { tools, issues };
|
|
60513
60712
|
}
|
|
60514
60713
|
for (const file2 of entries) {
|
|
60515
|
-
const name =
|
|
60516
|
-
const filePath =
|
|
60714
|
+
const name = import_node_path25.default.basename(file2, ".py");
|
|
60715
|
+
const filePath = import_node_path25.default.join(toolsDir, file2);
|
|
60517
60716
|
if (!isValidToolName(name)) {
|
|
60518
60717
|
issues.push({ kind: "invalid", name, filePath, detail: "Not a valid tool name." });
|
|
60519
60718
|
continue;
|
|
@@ -60609,7 +60808,7 @@ function describeIssue(issue2) {
|
|
|
60609
60808
|
}
|
|
60610
60809
|
}
|
|
60611
60810
|
async function loadRegistries(dirs, worker, logger, declined, trusted) {
|
|
60612
|
-
const ordered = dirs.map((dir) =>
|
|
60811
|
+
const ordered = dirs.map((dir) => import_node_path25.default.resolve(dir));
|
|
60613
60812
|
const seen = /* @__PURE__ */ new Set();
|
|
60614
60813
|
const unique = ordered.filter((dir) => {
|
|
60615
60814
|
const key2 = normalizeForComparison(dir);
|
|
@@ -60687,7 +60886,7 @@ function declaredCredentials(source) {
|
|
|
60687
60886
|
}
|
|
60688
60887
|
|
|
60689
60888
|
// ../../packages/core/dist/python/tools.js
|
|
60690
|
-
var
|
|
60889
|
+
var import_node_path26 = __toESM(require("node:path"), 1);
|
|
60691
60890
|
|
|
60692
60891
|
// ../../packages/core/dist/python/deps.js
|
|
60693
60892
|
var import_node_child_process6 = require("node:child_process");
|
|
@@ -60868,7 +61067,7 @@ async function resolveToolPath2(toolsDir, name) {
|
|
|
60868
61067
|
throw new Error(`"${name}" is not a valid tool name. Use lowercase letters, digits and underscores, starting with a letter.`);
|
|
60869
61068
|
}
|
|
60870
61069
|
await import_promises13.default.mkdir(toolsDir, { recursive: true });
|
|
60871
|
-
return confine(
|
|
61070
|
+
return confine(import_node_path26.default.join(toolsDir, toolFileName(name)), toolsDir);
|
|
60872
61071
|
}
|
|
60873
61072
|
async function readIfPresent2(filePath) {
|
|
60874
61073
|
try {
|
|
@@ -61127,7 +61326,7 @@ function createDeletePythonTool(context) {
|
|
|
61127
61326
|
async execute(params3) {
|
|
61128
61327
|
try {
|
|
61129
61328
|
const existing = context.findTool?.(params3.name);
|
|
61130
|
-
if (existing !== void 0 &&
|
|
61329
|
+
if (existing !== void 0 && import_node_path26.default.resolve(existing.sourceDir) !== import_node_path26.default.resolve(context.toolsDir)) {
|
|
61131
61330
|
return {
|
|
61132
61331
|
content: `py__${params3.name} lives in ${existing.sourceDir}, which is a read-only tools folder. Delete it where it is published, or remove the folder in Settings.`,
|
|
61133
61332
|
isError: true
|
|
@@ -61346,7 +61545,7 @@ var PythonManager = class {
|
|
|
61346
61545
|
this.venvIsUvManaged = discovered.uvManaged;
|
|
61347
61546
|
interpreter = discovered.interpreter;
|
|
61348
61547
|
} else {
|
|
61349
|
-
this.venvPath =
|
|
61548
|
+
this.venvPath = import_node_path27.default.join(this.options.storageDir, "python-venv");
|
|
61350
61549
|
this.venvSource = "created";
|
|
61351
61550
|
this.venvIsUvManaged = true;
|
|
61352
61551
|
interpreter = await ensureVenv({ uv: this.uv, venvDir: this.venvPath, env: env2 });
|
|
@@ -61391,9 +61590,9 @@ var PythonManager = class {
|
|
|
61391
61590
|
* It lands in per-user storage, outside the workspace — it is ours, not the project's.
|
|
61392
61591
|
*/
|
|
61393
61592
|
async writeWorkerScript() {
|
|
61394
|
-
const dir =
|
|
61593
|
+
const dir = import_node_path27.default.join(this.options.storageDir, "python-worker");
|
|
61395
61594
|
await import_promises14.default.mkdir(dir, { recursive: true });
|
|
61396
|
-
const scriptPath =
|
|
61595
|
+
const scriptPath = import_node_path27.default.join(dir, "main.py");
|
|
61397
61596
|
await import_promises14.default.writeFile(scriptPath, PYTHON_WORKER_SOURCE, "utf8");
|
|
61398
61597
|
return scriptPath;
|
|
61399
61598
|
}
|
|
@@ -62119,7 +62318,7 @@ function repairUnansweredToolCalls(messages) {
|
|
|
62119
62318
|
// ../../packages/core/dist/agent/truncate.js
|
|
62120
62319
|
var import_node_crypto8 = require("node:crypto");
|
|
62121
62320
|
var import_promises15 = __toESM(require("node:fs/promises"), 1);
|
|
62122
|
-
var
|
|
62321
|
+
var import_node_path28 = __toESM(require("node:path"), 1);
|
|
62123
62322
|
var DEFAULT_MAX_CHARS = 8e3;
|
|
62124
62323
|
function isValidHandle(handle) {
|
|
62125
62324
|
return /^[0-9a-f-]{36}$/i.test(handle);
|
|
@@ -62141,14 +62340,14 @@ var DiskTruncationStore = class {
|
|
|
62141
62340
|
async save(content) {
|
|
62142
62341
|
const handle = (0, import_node_crypto8.randomUUID)();
|
|
62143
62342
|
await import_promises15.default.mkdir(this.directory, { recursive: true });
|
|
62144
|
-
await import_promises15.default.writeFile(
|
|
62343
|
+
await import_promises15.default.writeFile(import_node_path28.default.join(this.directory, `${handle}.txt`), redact(content, this.knownSecrets()), "utf8");
|
|
62145
62344
|
return handle;
|
|
62146
62345
|
}
|
|
62147
62346
|
async read(handle, offset, limit) {
|
|
62148
62347
|
if (!isValidHandle(handle))
|
|
62149
62348
|
return void 0;
|
|
62150
62349
|
try {
|
|
62151
|
-
const raw = await import_promises15.default.readFile(
|
|
62350
|
+
const raw = await import_promises15.default.readFile(import_node_path28.default.join(this.directory, `${handle}.txt`), "utf8");
|
|
62152
62351
|
return raw.split("\n").slice(offset, offset + limit).join("\n");
|
|
62153
62352
|
} catch {
|
|
62154
62353
|
return void 0;
|
|
@@ -62158,7 +62357,7 @@ var DiskTruncationStore = class {
|
|
|
62158
62357
|
await Promise.all(handles.filter(isValidHandle).map((handle) => (
|
|
62159
62358
|
// `force` so a handle already gone (deleted twice, or cleaned up manually) is not
|
|
62160
62359
|
// an error — deletion should be idempotent.
|
|
62161
|
-
import_promises15.default.rm(
|
|
62360
|
+
import_promises15.default.rm(import_node_path28.default.join(this.directory, `${handle}.txt`), { force: true })
|
|
62162
62361
|
)));
|
|
62163
62362
|
}
|
|
62164
62363
|
};
|
|
@@ -62788,8 +62987,8 @@ function gatewayFromSettings(input, stored) {
|
|
|
62788
62987
|
}
|
|
62789
62988
|
|
|
62790
62989
|
// ../../packages/core/dist/host/bridge.js
|
|
62791
|
-
var
|
|
62792
|
-
var
|
|
62990
|
+
var import_node_fs10 = require("node:fs");
|
|
62991
|
+
var import_node_child_process14 = require("node:child_process");
|
|
62793
62992
|
var import_promises25 = __toESM(require("node:fs/promises"), 1);
|
|
62794
62993
|
|
|
62795
62994
|
// ../../packages/core/dist/jupyter/spec.js
|
|
@@ -63210,7 +63409,7 @@ function stripAnsi(text) {
|
|
|
63210
63409
|
// ../../packages/core/dist/jupyter/mirror.js
|
|
63211
63410
|
var import_node_crypto10 = require("node:crypto");
|
|
63212
63411
|
var import_promises16 = __toESM(require("node:fs/promises"), 1);
|
|
63213
|
-
var
|
|
63412
|
+
var import_node_path29 = __toESM(require("node:path"), 1);
|
|
63214
63413
|
var MANIFEST = ".lightcode-hub.json";
|
|
63215
63414
|
var SKIPPED_FOLDERS = /* @__PURE__ */ new Set([".ipynb_checkpoints", "__pycache__", ".git", "node_modules", ".venv", "venv", ".mypy_cache", ".pytest_cache"]);
|
|
63216
63415
|
var CONCURRENCY = 8;
|
|
@@ -63238,14 +63437,14 @@ var HubMirror = class {
|
|
|
63238
63437
|
if (this.manifest !== void 0)
|
|
63239
63438
|
return this.manifest;
|
|
63240
63439
|
try {
|
|
63241
|
-
this.manifest = JSON.parse(await import_promises16.default.readFile(
|
|
63440
|
+
this.manifest = JSON.parse(await import_promises16.default.readFile(import_node_path29.default.join(this.root, MANIFEST), "utf8"));
|
|
63242
63441
|
} catch {
|
|
63243
63442
|
this.manifest = {};
|
|
63244
63443
|
}
|
|
63245
63444
|
return this.manifest;
|
|
63246
63445
|
}
|
|
63247
63446
|
async saveManifest() {
|
|
63248
|
-
const target =
|
|
63447
|
+
const target = import_node_path29.default.join(this.root, MANIFEST);
|
|
63249
63448
|
const temporary = `${target}.${String(process.pid)}.tmp`;
|
|
63250
63449
|
await import_promises16.default.mkdir(this.root, { recursive: true });
|
|
63251
63450
|
await import_promises16.default.writeFile(temporary, JSON.stringify(this.manifest ?? {}), "utf8");
|
|
@@ -63253,10 +63452,10 @@ var HubMirror = class {
|
|
|
63253
63452
|
}
|
|
63254
63453
|
/** The hub path for a local file, or undefined when it is not inside one of the hub folders. */
|
|
63255
63454
|
remoteOf(localAbsolute) {
|
|
63256
|
-
const relative =
|
|
63257
|
-
if (relative.startsWith("..") ||
|
|
63455
|
+
const relative = import_node_path29.default.relative(this.root, localAbsolute);
|
|
63456
|
+
if (relative.startsWith("..") || import_node_path29.default.isAbsolute(relative))
|
|
63258
63457
|
return void 0;
|
|
63259
|
-
const parts = relative.split(
|
|
63458
|
+
const parts = relative.split(import_node_path29.default.sep);
|
|
63260
63459
|
const folder = this.folders.find((f) => f.local.toLowerCase() === (parts[0] ?? "").toLowerCase());
|
|
63261
63460
|
if (folder === void 0)
|
|
63262
63461
|
return void 0;
|
|
@@ -63293,7 +63492,7 @@ var HubMirror = class {
|
|
|
63293
63492
|
const inside = folder.remote.length > 0 ? entry.path.slice(folder.remote.length + 1) : entry.path;
|
|
63294
63493
|
const key2 = `${folder.local}/${inside}`;
|
|
63295
63494
|
seen.add(key2);
|
|
63296
|
-
const local =
|
|
63495
|
+
const local = import_node_path29.default.join(this.root, ...key2.split("/"));
|
|
63297
63496
|
const known = manifest[key2];
|
|
63298
63497
|
const localHash = await hashFile(local);
|
|
63299
63498
|
const changedHere = localHash !== void 0 && (known === void 0 || known.hash !== localHash);
|
|
@@ -63326,7 +63525,7 @@ var HubMirror = class {
|
|
|
63326
63525
|
for (const [key2, known] of Object.entries(manifest)) {
|
|
63327
63526
|
if (seen.has(key2))
|
|
63328
63527
|
continue;
|
|
63329
|
-
const local =
|
|
63528
|
+
const local = import_node_path29.default.join(this.root, ...key2.split("/"));
|
|
63330
63529
|
const localHash = await hashFile(local);
|
|
63331
63530
|
if (localHash !== void 0 && localHash !== known.hash) {
|
|
63332
63531
|
result.conflicts.push(key2);
|
|
@@ -63377,7 +63576,7 @@ var HubMirror = class {
|
|
|
63377
63576
|
if (remote === void 0)
|
|
63378
63577
|
return { saved: false, message: "not inside one of the JupyterHub folders, so it stays local" };
|
|
63379
63578
|
const manifest = await this.loadManifest();
|
|
63380
|
-
const key2 =
|
|
63579
|
+
const key2 = import_node_path29.default.relative(this.root, localAbsolute).split(import_node_path29.default.sep).join("/");
|
|
63381
63580
|
let bytes;
|
|
63382
63581
|
try {
|
|
63383
63582
|
bytes = await import_promises16.default.readFile(localAbsolute);
|
|
@@ -63423,7 +63622,7 @@ var HubMirror = class {
|
|
|
63423
63622
|
const manifest = await this.loadManifest();
|
|
63424
63623
|
const file2 = await this.client.read(remote, signal);
|
|
63425
63624
|
await writeWhole(localAbsolute, file2.bytes);
|
|
63426
|
-
manifest[
|
|
63625
|
+
manifest[import_node_path29.default.relative(this.root, localAbsolute).split(import_node_path29.default.sep).join("/")] = { remote, lastModified: file2.lastModified, hash: sha(file2.bytes) };
|
|
63427
63626
|
await this.saveManifest();
|
|
63428
63627
|
return remote;
|
|
63429
63628
|
});
|
|
@@ -63434,8 +63633,8 @@ var HubMirror = class {
|
|
|
63434
63633
|
const changes = [];
|
|
63435
63634
|
const seen = /* @__PURE__ */ new Set();
|
|
63436
63635
|
for (const folder of this.folders) {
|
|
63437
|
-
for (const local of await listLocal(
|
|
63438
|
-
const key2 =
|
|
63636
|
+
for (const local of await listLocal(import_node_path29.default.join(this.root, folder.local))) {
|
|
63637
|
+
const key2 = import_node_path29.default.relative(this.root, local).split(import_node_path29.default.sep).join("/");
|
|
63439
63638
|
seen.add(key2);
|
|
63440
63639
|
const known = manifest[key2];
|
|
63441
63640
|
const remote = this.remoteOf(local) ?? key2;
|
|
@@ -63463,7 +63662,7 @@ function sha(bytes) {
|
|
|
63463
63662
|
return (0, import_node_crypto10.createHash)("sha256").update(bytes).digest("hex");
|
|
63464
63663
|
}
|
|
63465
63664
|
async function writeWhole(target, bytes) {
|
|
63466
|
-
await import_promises16.default.mkdir(
|
|
63665
|
+
await import_promises16.default.mkdir(import_node_path29.default.dirname(target), { recursive: true });
|
|
63467
63666
|
const temporary = `${target}.${String(process.pid)}.part`;
|
|
63468
63667
|
await import_promises16.default.writeFile(temporary, bytes);
|
|
63469
63668
|
await replaceFile(temporary, target);
|
|
@@ -63479,7 +63678,7 @@ async function listLocal(folder) {
|
|
|
63479
63678
|
for (const entry of entries) {
|
|
63480
63679
|
if (entry.name.startsWith(".") || SKIPPED_FOLDERS.has(entry.name))
|
|
63481
63680
|
continue;
|
|
63482
|
-
const full =
|
|
63681
|
+
const full = import_node_path29.default.join(folder, entry.name);
|
|
63483
63682
|
if (entry.isDirectory())
|
|
63484
63683
|
found2.push(...await listLocal(full));
|
|
63485
63684
|
else if (entry.isFile() && !entry.name.endsWith(".part"))
|
|
@@ -63545,7 +63744,7 @@ function withoutMissingImports(provider) {
|
|
|
63545
63744
|
|
|
63546
63745
|
// ../../packages/core/dist/python/machineApprovals.js
|
|
63547
63746
|
var import_promises17 = __toESM(require("node:fs/promises"), 1);
|
|
63548
|
-
var
|
|
63747
|
+
var import_node_path30 = __toESM(require("node:path"), 1);
|
|
63549
63748
|
var FileMachineApprovals = class {
|
|
63550
63749
|
file;
|
|
63551
63750
|
cache;
|
|
@@ -63588,7 +63787,7 @@ var FileMachineApprovals = class {
|
|
|
63588
63787
|
}
|
|
63589
63788
|
if (!changed)
|
|
63590
63789
|
return;
|
|
63591
|
-
await import_promises17.default.mkdir(
|
|
63790
|
+
await import_promises17.default.mkdir(import_node_path30.default.dirname(this.file), { recursive: true });
|
|
63592
63791
|
const temporary = `${this.file}.${String(process.pid)}.${String(Date.now())}.tmp`;
|
|
63593
63792
|
await import_promises17.default.writeFile(temporary, JSON.stringify(ledger, null, 1), "utf8");
|
|
63594
63793
|
await replaceFile(temporary, this.file);
|
|
@@ -63671,7 +63870,7 @@ async function readToolCredential(options) {
|
|
|
63671
63870
|
|
|
63672
63871
|
// ../../packages/core/dist/jupyter/tools.js
|
|
63673
63872
|
var import_promises19 = __toESM(require("node:fs/promises"), 1);
|
|
63674
|
-
var
|
|
63873
|
+
var import_node_path31 = __toESM(require("node:path"), 1);
|
|
63675
63874
|
var RUN_DEFAULT_SECONDS = 300;
|
|
63676
63875
|
var SCRIPT_PREVIEW_CHARS = 6e3;
|
|
63677
63876
|
var runSchema = external_exports.object({
|
|
@@ -63893,7 +64092,7 @@ ${pending.map((p) => `- ${p.local} (${p.kind}${p.kind === "deleted" ? " here; st
|
|
|
63893
64092
|
for (const file2 of pending.files) {
|
|
63894
64093
|
const result = await runtime.mirror.push(file2, context.signal);
|
|
63895
64094
|
failed2 ||= !result.saved;
|
|
63896
|
-
lines.push(`- ${
|
|
64095
|
+
lines.push(`- ${import_node_path31.default.relative(runtime.mirror.root, file2).split(import_node_path31.default.sep).join("/")}: ${result.message}`);
|
|
63897
64096
|
}
|
|
63898
64097
|
return { content: lines.length > 0 ? lines.join("\n") : "Nothing to save.", ...failed2 ? { isError: true } : {} };
|
|
63899
64098
|
}
|
|
@@ -63932,7 +64131,7 @@ async function pendingFor(runtime, context, target) {
|
|
|
63932
64131
|
const pending = (await runtime.mirror.pending()).filter((p) => p.kind !== "deleted");
|
|
63933
64132
|
return {
|
|
63934
64133
|
ok: true,
|
|
63935
|
-
files: pending.map((p) =>
|
|
64134
|
+
files: pending.map((p) => import_node_path31.default.join(runtime.mirror.root, ...p.local.split("/"))),
|
|
63936
64135
|
changes: pending.map((p) => `${p.local} \u2192 ${p.remote} (${p.kind})`)
|
|
63937
64136
|
};
|
|
63938
64137
|
}
|
|
@@ -63982,7 +64181,7 @@ if __SOURCE__:
|
|
|
63982
64181
|
`;
|
|
63983
64182
|
|
|
63984
64183
|
// ../../packages/core/dist/jupyter/hubGit.js
|
|
63985
|
-
var
|
|
64184
|
+
var import_node_path32 = __toESM(require("node:path"), 1);
|
|
63986
64185
|
var MARKER = "__LC_HUBGIT__";
|
|
63987
64186
|
var LISTED = 40;
|
|
63988
64187
|
var py2 = (value) => JSON.stringify(value);
|
|
@@ -64097,7 +64296,7 @@ async function hubGitStatus(runtime, signal) {
|
|
|
64097
64296
|
total.upstream &&= one.upstream;
|
|
64098
64297
|
if (total.branch === void 0 && one.branch !== void 0)
|
|
64099
64298
|
total.branch = one.branch;
|
|
64100
|
-
const prefix = results.length > 1 ? `${
|
|
64299
|
+
const prefix = results.length > 1 ? `${import_node_path32.default.posix.basename(repo.repo)}/` : "";
|
|
64101
64300
|
for (const file2 of one.files)
|
|
64102
64301
|
if (total.files.length < LISTED)
|
|
64103
64302
|
total.files.push(`${file2.slice(0, 2)}${prefix}${file2.slice(2)}`);
|
|
@@ -64110,7 +64309,7 @@ async function hubGitCommitPush(runtime, message4, signal) {
|
|
|
64110
64309
|
return { ok: false, text: "Write a commit message first." };
|
|
64111
64310
|
const pending = await runtime.mirror.pending();
|
|
64112
64311
|
for (const change of pending.filter((p) => p.kind !== "deleted")) {
|
|
64113
|
-
const saved = await runtime.mirror.push(
|
|
64312
|
+
const saved = await runtime.mirror.push(import_node_path32.default.join(runtime.mirror.root, ...change.local.split("/")), signal);
|
|
64114
64313
|
if (!saved.saved)
|
|
64115
64314
|
return { ok: false, text: `Nothing was committed: ${change.local} could not be saved to the hub first (${saved.message}).` };
|
|
64116
64315
|
}
|
|
@@ -64123,7 +64322,7 @@ async function hubGitCommitPush(runtime, message4, signal) {
|
|
|
64123
64322
|
const lines = [];
|
|
64124
64323
|
let ok = true;
|
|
64125
64324
|
for (const repo of results) {
|
|
64126
|
-
const name = results.length > 1 ? `${
|
|
64325
|
+
const name = results.length > 1 ? `${import_node_path32.default.posix.basename(repo.repo)}: ` : "";
|
|
64127
64326
|
const committed = repo.commit?.ok === true;
|
|
64128
64327
|
const nothing = /nothing to commit/.test(`${repo.commit?.out ?? ""}${repo.commit?.err ?? ""}`);
|
|
64129
64328
|
if (repo.add?.ok !== true) {
|
|
@@ -64153,7 +64352,7 @@ async function hubGitPull(runtime, signal) {
|
|
|
64153
64352
|
const lines = [];
|
|
64154
64353
|
let ok = true;
|
|
64155
64354
|
for (const repo of results) {
|
|
64156
|
-
const name = results.length > 1 ? `${
|
|
64355
|
+
const name = results.length > 1 ? `${import_node_path32.default.posix.basename(repo.repo)}: ` : "";
|
|
64157
64356
|
const all = `${repo.pull?.out ?? ""}${repo.pull?.err ?? ""}`;
|
|
64158
64357
|
if (repo.pull?.ok === true)
|
|
64159
64358
|
lines.push(`${name}${/Already up.to.date/i.test(all) ? "Already up to date." : "Pulled on the hub."}`);
|
|
@@ -64334,8 +64533,8 @@ function pick2(hubs, name) {
|
|
|
64334
64533
|
}
|
|
64335
64534
|
|
|
64336
64535
|
// ../../packages/core/dist/host/bridge.js
|
|
64337
|
-
var
|
|
64338
|
-
var
|
|
64536
|
+
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
64537
|
+
var import_node_path47 = __toESM(require("node:path"), 1);
|
|
64339
64538
|
|
|
64340
64539
|
// ../../packages/core/dist/modes/autoGuidance.js
|
|
64341
64540
|
function idiomsFor(environment) {
|
|
@@ -64431,7 +64630,7 @@ function buildAutoGuidance(environment) {
|
|
|
64431
64630
|
|
|
64432
64631
|
// ../../packages/core/dist/migrate/folders.js
|
|
64433
64632
|
var import_promises20 = __toESM(require("node:fs/promises"), 1);
|
|
64434
|
-
var
|
|
64633
|
+
var import_node_path33 = __toESM(require("node:path"), 1);
|
|
64435
64634
|
function nameOf(entry, kind) {
|
|
64436
64635
|
return kind === "skills" ? entry.replace(/\.md$/i, "") : entry.replace(/\.py$/i, "");
|
|
64437
64636
|
}
|
|
@@ -64456,7 +64655,7 @@ async function namesAt(dir, kind) {
|
|
|
64456
64655
|
if (kind === "skills") {
|
|
64457
64656
|
if (entry.toLowerCase().endsWith(".md"))
|
|
64458
64657
|
found2.add(nameOf(entry, kind));
|
|
64459
|
-
else if (await isDirectory(
|
|
64658
|
+
else if (await isDirectory(import_node_path33.default.join(dir, entry)))
|
|
64460
64659
|
found2.add(entry);
|
|
64461
64660
|
} else if (entry.toLowerCase().endsWith(".py")) {
|
|
64462
64661
|
found2.add(nameOf(entry, kind));
|
|
@@ -64468,7 +64667,7 @@ async function planMigration(options) {
|
|
|
64468
64667
|
const { from, to, kind } = options;
|
|
64469
64668
|
const copy = [];
|
|
64470
64669
|
const skip = [];
|
|
64471
|
-
if (
|
|
64670
|
+
if (import_node_path33.default.resolve(from) === import_node_path33.default.resolve(to))
|
|
64472
64671
|
return { copy, skip };
|
|
64473
64672
|
const existing = await namesAt(to, kind);
|
|
64474
64673
|
let entries;
|
|
@@ -64480,14 +64679,14 @@ async function planMigration(options) {
|
|
|
64480
64679
|
for (const entry of entries) {
|
|
64481
64680
|
if (entry.startsWith("."))
|
|
64482
64681
|
continue;
|
|
64483
|
-
const source =
|
|
64682
|
+
const source = import_node_path33.default.join(from, entry);
|
|
64484
64683
|
const directory = await isDirectory(source);
|
|
64485
64684
|
if (kind === "skills") {
|
|
64486
64685
|
if (!directory && !entry.toLowerCase().endsWith(".md"))
|
|
64487
64686
|
continue;
|
|
64488
64687
|
if (directory) {
|
|
64489
64688
|
try {
|
|
64490
|
-
await import_promises20.default.stat(
|
|
64689
|
+
await import_promises20.default.stat(import_node_path33.default.join(source, "SKILL.md"));
|
|
64491
64690
|
} catch {
|
|
64492
64691
|
continue;
|
|
64493
64692
|
}
|
|
@@ -64500,7 +64699,7 @@ async function planMigration(options) {
|
|
|
64500
64699
|
skip.push(name);
|
|
64501
64700
|
continue;
|
|
64502
64701
|
}
|
|
64503
|
-
copy.push({ name, source, destination:
|
|
64702
|
+
copy.push({ name, source, destination: import_node_path33.default.join(to, entry), directory });
|
|
64504
64703
|
}
|
|
64505
64704
|
copy.sort((a, b) => a.name.localeCompare(b.name));
|
|
64506
64705
|
skip.sort();
|
|
@@ -64511,7 +64710,7 @@ async function runMigration(plan2) {
|
|
|
64511
64710
|
const failed2 = [];
|
|
64512
64711
|
for (const item of plan2.copy) {
|
|
64513
64712
|
try {
|
|
64514
|
-
await import_promises20.default.mkdir(
|
|
64713
|
+
await import_promises20.default.mkdir(import_node_path33.default.dirname(item.destination), { recursive: true });
|
|
64515
64714
|
await import_promises20.default.cp(item.source, item.destination, {
|
|
64516
64715
|
recursive: item.directory,
|
|
64517
64716
|
force: false,
|
|
@@ -64537,8 +64736,8 @@ function describeMigration(result, kind) {
|
|
|
64537
64736
|
}
|
|
64538
64737
|
|
|
64539
64738
|
// ../../packages/core/dist/platform/node/shell.js
|
|
64540
|
-
var
|
|
64541
|
-
var
|
|
64739
|
+
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
64740
|
+
var import_node_path34 = __toESM(require("node:path"), 1);
|
|
64542
64741
|
function windowsExtensions(env2) {
|
|
64543
64742
|
const raw = env2["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD";
|
|
64544
64743
|
return raw.split(";").filter((entry) => entry.length > 0);
|
|
@@ -64552,8 +64751,8 @@ function onPath(name, env2 = process.env) {
|
|
|
64552
64751
|
continue;
|
|
64553
64752
|
for (const extension of extensions) {
|
|
64554
64753
|
try {
|
|
64555
|
-
const candidate =
|
|
64556
|
-
if (
|
|
64754
|
+
const candidate = import_node_path34.default.join(directory, name + extension);
|
|
64755
|
+
if (import_node_fs5.default.statSync(candidate).isFile())
|
|
64557
64756
|
return true;
|
|
64558
64757
|
} catch {
|
|
64559
64758
|
continue;
|
|
@@ -64574,7 +64773,7 @@ function resolveShell(configured, env2 = process.env) {
|
|
|
64574
64773
|
return { command: void 0, kind: "posix", label: env2["SHELL"] ?? "/bin/sh" };
|
|
64575
64774
|
}
|
|
64576
64775
|
function kindOf(command) {
|
|
64577
|
-
const base =
|
|
64776
|
+
const base = import_node_path34.default.basename(command).toLowerCase().replace(/\.exe$/, "");
|
|
64578
64777
|
if (base === "pwsh")
|
|
64579
64778
|
return "pwsh";
|
|
64580
64779
|
if (base === "powershell")
|
|
@@ -64584,7 +64783,7 @@ function kindOf(command) {
|
|
|
64584
64783
|
return "posix";
|
|
64585
64784
|
}
|
|
64586
64785
|
function labelFor(command) {
|
|
64587
|
-
const base =
|
|
64786
|
+
const base = import_node_path34.default.basename(command).toLowerCase().replace(/\.exe$/, "");
|
|
64588
64787
|
if (base === "pwsh")
|
|
64589
64788
|
return "PowerShell 7 (pwsh)";
|
|
64590
64789
|
if (base === "powershell")
|
|
@@ -64666,7 +64865,7 @@ function fastFsCapabilities(exe, timeoutMs = 5e3) {
|
|
|
64666
64865
|
var import_node_child_process9 = require("node:child_process");
|
|
64667
64866
|
|
|
64668
64867
|
// ../../packages/core/dist/tools/readStamps.js
|
|
64669
|
-
var
|
|
64868
|
+
var import_node_path35 = __toESM(require("node:path"), 1);
|
|
64670
64869
|
async function stamp(context, realPath) {
|
|
64671
64870
|
try {
|
|
64672
64871
|
const s = await context.fs.stat(realPath);
|
|
@@ -64711,14 +64910,14 @@ async function staleFilesNamedIn(context, command) {
|
|
|
64711
64910
|
};
|
|
64712
64911
|
const stale = [];
|
|
64713
64912
|
for (const [key2, known] of context.readStamps) {
|
|
64714
|
-
const relative =
|
|
64715
|
-
const names = [key2, relative, relative.split(
|
|
64913
|
+
const relative = import_node_path35.default.relative(root, key2);
|
|
64914
|
+
const names = [key2, relative, relative.split(import_node_path35.default.sep).join("/"), import_node_path35.default.basename(key2)].map((n) => n.toLowerCase());
|
|
64716
64915
|
if (!names.some(stands))
|
|
64717
64916
|
continue;
|
|
64718
64917
|
try {
|
|
64719
64918
|
const s = await context.fs.stat(key2);
|
|
64720
64919
|
if (`${String(s.mtimeMs)}:${String(s.size)}` !== known)
|
|
64721
|
-
stale.push(relative.split(
|
|
64920
|
+
stale.push(relative.split(import_node_path35.default.sep).join("/"));
|
|
64722
64921
|
} catch {
|
|
64723
64922
|
}
|
|
64724
64923
|
}
|
|
@@ -66076,8 +66275,8 @@ var ChangeLedger = class {
|
|
|
66076
66275
|
this.chat = chat;
|
|
66077
66276
|
}
|
|
66078
66277
|
/** Best effort: a ledger that cannot be written must never fail an edit that happened. */
|
|
66079
|
-
record(
|
|
66080
|
-
const line = JSON.stringify({ chat: this.chat, path: normalizeForComparison(
|
|
66278
|
+
record(path58) {
|
|
66279
|
+
const line = JSON.stringify({ chat: this.chat, path: normalizeForComparison(path58), at: Date.now() });
|
|
66081
66280
|
void (0, import_promises21.appendFile)(this.file, `${line}
|
|
66082
66281
|
`).catch(() => void 0);
|
|
66083
66282
|
}
|
|
@@ -66125,7 +66324,7 @@ var RecordedChanges = class extends Set {
|
|
|
66125
66324
|
// ../../packages/core/dist/office/bridge.js
|
|
66126
66325
|
var import_node_child_process11 = require("node:child_process");
|
|
66127
66326
|
var import_promises22 = __toESM(require("node:fs/promises"), 1);
|
|
66128
|
-
var
|
|
66327
|
+
var import_node_path36 = __toESM(require("node:path"), 1);
|
|
66129
66328
|
|
|
66130
66329
|
// ../../packages/core/dist/office/workerSource.js
|
|
66131
66330
|
var OFFICE_WORKER_SOURCE = `# Light Code office worker.
|
|
@@ -68859,7 +69058,7 @@ var OfficeBridge = class {
|
|
|
68859
69058
|
return this.starting;
|
|
68860
69059
|
}
|
|
68861
69060
|
async start() {
|
|
68862
|
-
const target =
|
|
69061
|
+
const target = import_node_path36.default.join(this.options.storageDir, "office-worker.ps1");
|
|
68863
69062
|
await import_promises22.default.mkdir(this.options.storageDir, { recursive: true });
|
|
68864
69063
|
const BOM = "\uFEFF";
|
|
68865
69064
|
await import_promises22.default.writeFile(target, `${BOM}${OFFICE_WORKER_SOURCE}`, "utf8");
|
|
@@ -69366,7 +69565,7 @@ function createDeleteRoleTool(access) {
|
|
|
69366
69565
|
|
|
69367
69566
|
// ../../packages/core/dist/rag/indexNaming.js
|
|
69368
69567
|
var import_node_crypto11 = __toESM(require("node:crypto"), 1);
|
|
69369
|
-
var
|
|
69568
|
+
var import_node_path37 = __toESM(require("node:path"), 1);
|
|
69370
69569
|
var DEFAULT_INDEX_PREFIX = "light-code";
|
|
69371
69570
|
var DOMAIN_OR_PATH = /[\\/]/;
|
|
69372
69571
|
function normaliseOwner(owner) {
|
|
@@ -69381,7 +69580,7 @@ function ownerSlug(owner) {
|
|
|
69381
69580
|
function deriveIndexName(input) {
|
|
69382
69581
|
const prefix = input.prefix ?? DEFAULT_INDEX_PREFIX;
|
|
69383
69582
|
const slug = ownerSlug(input.owner);
|
|
69384
|
-
const root =
|
|
69583
|
+
const root = import_node_path37.default.resolve(input.workspaceRoot).toLowerCase();
|
|
69385
69584
|
const identity = input.owner === void 0 ? "" : normaliseOwner(input.owner);
|
|
69386
69585
|
const digest = import_node_crypto11.default.createHash("sha256").update(`${identity}\0${root}`).digest("hex").slice(0, 16);
|
|
69387
69586
|
const base = slug === void 0 ? `${prefix}-${digest}` : `${prefix}-${slug}-${digest}`;
|
|
@@ -69389,7 +69588,7 @@ function deriveIndexName(input) {
|
|
|
69389
69588
|
}
|
|
69390
69589
|
|
|
69391
69590
|
// ../../packages/core/dist/tools/exportConfig.js
|
|
69392
|
-
var
|
|
69591
|
+
var import_node_path38 = __toESM(require("node:path"), 1);
|
|
69393
69592
|
var sectionIds = SHARE_SECTIONS.map((section) => section.id);
|
|
69394
69593
|
var paramsSchema11 = external_exports.object({
|
|
69395
69594
|
path: external_exports.string().min(1).describe('Where to write it in the workspace, e.g. "onboarding/light-code-team.json".'),
|
|
@@ -69429,7 +69628,7 @@ function createExportConfigTool(options) {
|
|
|
69429
69628
|
if (!resolved.ok)
|
|
69430
69629
|
return { content: resolved.message, isError: true };
|
|
69431
69630
|
const { json: json2, notes } = prepare(await options.loadConfig(), params3);
|
|
69432
|
-
await context.fs.mkdir(
|
|
69631
|
+
await context.fs.mkdir(import_node_path38.default.dirname(resolved.realPath));
|
|
69433
69632
|
await context.fs.writeFile(resolved.realPath, json2);
|
|
69434
69633
|
return { content: `Wrote ${params3.path}. ${notes}`, path: resolved.realPath };
|
|
69435
69634
|
}
|
|
@@ -69598,7 +69797,7 @@ function describeAtlassianFailure(product, doing, status2, body) {
|
|
|
69598
69797
|
}
|
|
69599
69798
|
|
|
69600
69799
|
// ../../packages/core/dist/atlassian/uploads.js
|
|
69601
|
-
var
|
|
69800
|
+
var import_node_path39 = __toESM(require("node:path"), 1);
|
|
69602
69801
|
|
|
69603
69802
|
// ../../packages/core/dist/diagrams/layout.js
|
|
69604
69803
|
var NODE_HEIGHT = 52;
|
|
@@ -70240,7 +70439,7 @@ async function prepareUploads(params3, context) {
|
|
|
70240
70439
|
const resolved = await resolveToolPath(context, attachment.path);
|
|
70241
70440
|
if (!resolved.ok)
|
|
70242
70441
|
return { ok: false, message: resolved.message };
|
|
70243
|
-
const name = attachment.name ??
|
|
70442
|
+
const name = attachment.name ?? import_node_path39.default.basename(resolved.realPath);
|
|
70244
70443
|
const problem = claim(name);
|
|
70245
70444
|
if (problem !== void 0)
|
|
70246
70445
|
return { ok: false, message: problem };
|
|
@@ -70424,10 +70623,10 @@ function isSafeSegment(value) {
|
|
|
70424
70623
|
function isSafeTagName(name) {
|
|
70425
70624
|
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("."));
|
|
70426
70625
|
}
|
|
70427
|
-
function encodeRepoPath(
|
|
70428
|
-
const segments =
|
|
70626
|
+
function encodeRepoPath(path58) {
|
|
70627
|
+
const segments = path58.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0);
|
|
70429
70628
|
if (segments.length === 0 || segments.some((segment) => segment === ".." || segment === ".")) {
|
|
70430
|
-
throw new AtlassianError(`"${
|
|
70629
|
+
throw new AtlassianError(`"${path58}" is not a file path inside the repository.`);
|
|
70431
70630
|
}
|
|
70432
70631
|
return segments.map(encodeURIComponent).join("/");
|
|
70433
70632
|
}
|
|
@@ -70512,24 +70711,24 @@ var BitbucketClient = class {
|
|
|
70512
70711
|
* redirect was followed, the login page came back, and the file "could not be read" although
|
|
70513
70712
|
* pull requests on the same repository could. `browse` is REST, so it authenticates like those.
|
|
70514
70713
|
*/
|
|
70515
|
-
async file(repo,
|
|
70516
|
-
const target = encodeRepoPath(
|
|
70714
|
+
async file(repo, path58, ref, signal) {
|
|
70715
|
+
const target = encodeRepoPath(path58);
|
|
70517
70716
|
const lines = [];
|
|
70518
70717
|
let start = 0;
|
|
70519
70718
|
for (let page = 0; page < MAX_FILE_PAGES; page += 1) {
|
|
70520
70719
|
const query = new URLSearchParams({ start: String(start), limit: String(FILE_PAGE_LINES) });
|
|
70521
70720
|
if (ref !== void 0 && ref.length > 0)
|
|
70522
70721
|
query.set("at", ref);
|
|
70523
|
-
const body = await this.rest.json(`reading ${
|
|
70722
|
+
const body = await this.rest.json(`reading ${path58}`, `${this.repoPath(repo)}/browse/${target}?${query.toString()}`, { method: "GET" }, signal);
|
|
70524
70723
|
if (body.children !== void 0) {
|
|
70525
70724
|
const names = (body.children.values ?? []).map((child) => {
|
|
70526
70725
|
const name = child.path?.toString ?? child.path?.name ?? "?";
|
|
70527
70726
|
return child.type === "DIRECTORY" ? `${name}/` : name;
|
|
70528
70727
|
});
|
|
70529
|
-
throw new AtlassianError(`${
|
|
70728
|
+
throw new AtlassianError(`${path58} is a folder, not a file. It holds: ${names.join(", ") || "nothing"}.`);
|
|
70530
70729
|
}
|
|
70531
70730
|
if (body.binary === true)
|
|
70532
|
-
throw new AtlassianError(`${
|
|
70731
|
+
throw new AtlassianError(`${path58} is a binary file, so there is no text to read.`);
|
|
70533
70732
|
for (const line of body.lines ?? [])
|
|
70534
70733
|
lines.push(line.text ?? "");
|
|
70535
70734
|
if (body.isLastPage !== false || body.nextPageStart === void 0 || body.nextPageStart <= start)
|
|
@@ -71107,8 +71306,8 @@ ${text.slice(-2e4)}`);
|
|
|
71107
71306
|
}
|
|
71108
71307
|
/** Queues a build, then follows the queue item briefly to learn its number. */
|
|
71109
71308
|
async startBuild(job, parameters, signal) {
|
|
71110
|
-
const
|
|
71111
|
-
const response = await this.post(`starting ${job}`, parameters !== void 0 && Object.keys(parameters).length > 0 ? `${
|
|
71309
|
+
const path58 = jobPath(job, this.base);
|
|
71310
|
+
const response = await this.post(`starting ${job}`, parameters !== void 0 && Object.keys(parameters).length > 0 ? `${path58}/buildWithParameters` : `${path58}/build`, parameters ?? {}, signal);
|
|
71112
71311
|
const location = response.headers["location"];
|
|
71113
71312
|
const queueId = location === void 0 ? void 0 : /\/queue\/item\/(\d+)/.exec(location)?.[1];
|
|
71114
71313
|
if (queueId === void 0)
|
|
@@ -71434,14 +71633,14 @@ ${client.base}${jobPath(job, client.base)}/${buildRef(params3.build)}/`
|
|
|
71434
71633
|
};
|
|
71435
71634
|
return tool;
|
|
71436
71635
|
}
|
|
71437
|
-
async function readJenkinsfile(
|
|
71438
|
-
const resolved = await resolveToolPath(context,
|
|
71636
|
+
async function readJenkinsfile(path58, context) {
|
|
71637
|
+
const resolved = await resolveToolPath(context, path58);
|
|
71439
71638
|
if (!resolved.ok)
|
|
71440
71639
|
return { ok: false, message: resolved.message };
|
|
71441
71640
|
try {
|
|
71442
71641
|
return { ok: true, text: await context.fs.readFile(resolved.realPath), realPath: resolved.realPath };
|
|
71443
71642
|
} catch (error51) {
|
|
71444
|
-
return { ok: false, message: `Could not read ${
|
|
71643
|
+
return { ok: false, message: `Could not read ${path58}: ${error51 instanceof Error ? error51.message : String(error51)}` };
|
|
71445
71644
|
}
|
|
71446
71645
|
}
|
|
71447
71646
|
var checkSchema = external_exports.object({
|
|
@@ -71710,8 +71909,8 @@ var AutosysClient = class {
|
|
|
71710
71909
|
async runInfo(pattern, signal) {
|
|
71711
71910
|
if (!isAutosysName(pattern, true))
|
|
71712
71911
|
throw new AtlassianError(`"${pattern}" is not a job name or pattern.`);
|
|
71713
|
-
const
|
|
71714
|
-
return asList(await this.rest.json(`reading the status of ${pattern}`,
|
|
71912
|
+
const path58 = pattern.includes("*") ? fill(this.paths.runInfo, { pattern }) : fill(this.paths.jobRunInfo, { job: pattern });
|
|
71913
|
+
return asList(await this.rest.json(`reading the status of ${pattern}`, path58, { method: "GET" }, signal)).map(toRun);
|
|
71715
71914
|
}
|
|
71716
71915
|
/** A job's log, or undefined when this server has no log endpoint (404). */
|
|
71717
71916
|
async log(name, runNum, type, signal) {
|
|
@@ -73070,6 +73269,7 @@ var ATLASSIAN_PRODUCTS = [
|
|
|
73070
73269
|
{
|
|
73071
73270
|
key: "username",
|
|
73072
73271
|
label: "Jenkins user id",
|
|
73272
|
+
signIn: "optional",
|
|
73073
73273
|
placeholder: "e.g. jsmith",
|
|
73074
73274
|
hint: "Sent with the token. Single sign-on users have one too: sign in to Jenkins and click your name \u2014 it is the last part of the address, /user/<id>. Create the token at <your Jenkins>/me/security \u2192 API Token \u2192 Add new Token, and copy it straight away: Jenkins shows it only once. Leave this empty only if your Jenkins takes an SSO access token as a Bearer token instead."
|
|
73075
73275
|
},
|
|
@@ -73093,6 +73293,7 @@ var ATLASSIAN_PRODUCTS = [
|
|
|
73093
73293
|
{
|
|
73094
73294
|
key: "username",
|
|
73095
73295
|
label: "Username",
|
|
73296
|
+
signIn: "required",
|
|
73096
73297
|
placeholder: "e.g. jsmith",
|
|
73097
73298
|
hint: "The AutoSys web services user. Sent with the password as HTTP Basic."
|
|
73098
73299
|
},
|
|
@@ -73425,7 +73626,7 @@ function message2(error51) {
|
|
|
73425
73626
|
}
|
|
73426
73627
|
function filesIn(params3) {
|
|
73427
73628
|
return [
|
|
73428
|
-
...(params3.attachments ?? []).map((
|
|
73629
|
+
...(params3.attachments ?? []).map((path58) => ({ path: path58, inline: false })),
|
|
73429
73630
|
...(params3.inlineImages ?? []).map((image) => ({ path: image.path, inline: true }))
|
|
73430
73631
|
];
|
|
73431
73632
|
}
|
|
@@ -74108,17 +74309,17 @@ var WebviewApprovalGate = class {
|
|
|
74108
74309
|
// ../../packages/core/dist/platform/node/filesystem.js
|
|
74109
74310
|
var import_promises23 = __toESM(require("node:fs/promises"), 1);
|
|
74110
74311
|
var NodeFileSystem = class {
|
|
74111
|
-
async readFile(
|
|
74112
|
-
return import_promises23.default.readFile(
|
|
74312
|
+
async readFile(path58) {
|
|
74313
|
+
return import_promises23.default.readFile(path58, "utf8");
|
|
74113
74314
|
}
|
|
74114
|
-
async readBytes(
|
|
74115
|
-
return import_promises23.default.readFile(
|
|
74315
|
+
async readBytes(path58) {
|
|
74316
|
+
return import_promises23.default.readFile(path58);
|
|
74116
74317
|
}
|
|
74117
|
-
async readBytesSlice(
|
|
74318
|
+
async readBytesSlice(path58, start, end) {
|
|
74118
74319
|
const length = Math.max(0, end - start);
|
|
74119
74320
|
if (length === 0)
|
|
74120
74321
|
return Buffer.alloc(0);
|
|
74121
|
-
const handle = await import_promises23.default.open(
|
|
74322
|
+
const handle = await import_promises23.default.open(path58, "r");
|
|
74122
74323
|
try {
|
|
74123
74324
|
const buffer = Buffer.alloc(length);
|
|
74124
74325
|
const { bytesRead } = await handle.read(buffer, 0, length, start);
|
|
@@ -74127,18 +74328,18 @@ var NodeFileSystem = class {
|
|
|
74127
74328
|
await handle.close();
|
|
74128
74329
|
}
|
|
74129
74330
|
}
|
|
74130
|
-
async writeFile(
|
|
74131
|
-
await import_promises23.default.writeFile(
|
|
74331
|
+
async writeFile(path58, contents) {
|
|
74332
|
+
await import_promises23.default.writeFile(path58, contents, "utf8");
|
|
74132
74333
|
}
|
|
74133
74334
|
/** The counterpart of `readBytes`, and deliberately as bare as `writeFile` beside it. */
|
|
74134
|
-
async writeBytes(
|
|
74135
|
-
await import_promises23.default.writeFile(
|
|
74335
|
+
async writeBytes(path58, contents) {
|
|
74336
|
+
await import_promises23.default.writeFile(path58, contents);
|
|
74136
74337
|
}
|
|
74137
74338
|
async rename(from, to) {
|
|
74138
74339
|
await replaceFile(from, to);
|
|
74139
74340
|
}
|
|
74140
|
-
async stat(
|
|
74141
|
-
const stat = await import_promises23.default.lstat(
|
|
74341
|
+
async stat(path58) {
|
|
74342
|
+
const stat = await import_promises23.default.lstat(path58);
|
|
74142
74343
|
return {
|
|
74143
74344
|
size: stat.size,
|
|
74144
74345
|
mtimeMs: stat.mtimeMs,
|
|
@@ -74147,8 +74348,8 @@ var NodeFileSystem = class {
|
|
|
74147
74348
|
isSymbolicLink: stat.isSymbolicLink()
|
|
74148
74349
|
};
|
|
74149
74350
|
}
|
|
74150
|
-
async readdir(
|
|
74151
|
-
const entries = await import_promises23.default.readdir(
|
|
74351
|
+
async readdir(path58) {
|
|
74352
|
+
const entries = await import_promises23.default.readdir(path58, { withFileTypes: true });
|
|
74152
74353
|
return entries.map((entry) => ({
|
|
74153
74354
|
name: entry.name,
|
|
74154
74355
|
isFile: entry.isFile(),
|
|
@@ -74156,21 +74357,21 @@ var NodeFileSystem = class {
|
|
|
74156
74357
|
isSymbolicLink: entry.isSymbolicLink()
|
|
74157
74358
|
}));
|
|
74158
74359
|
}
|
|
74159
|
-
async exists(
|
|
74360
|
+
async exists(path58) {
|
|
74160
74361
|
try {
|
|
74161
|
-
await import_promises23.default.access(
|
|
74362
|
+
await import_promises23.default.access(path58);
|
|
74162
74363
|
return true;
|
|
74163
74364
|
} catch {
|
|
74164
74365
|
return false;
|
|
74165
74366
|
}
|
|
74166
74367
|
}
|
|
74167
|
-
async mkdir(
|
|
74168
|
-
await import_promises23.default.mkdir(
|
|
74368
|
+
async mkdir(path58) {
|
|
74369
|
+
await import_promises23.default.mkdir(path58, { recursive: true });
|
|
74169
74370
|
}
|
|
74170
74371
|
};
|
|
74171
74372
|
|
|
74172
74373
|
// ../../packages/core/dist/config/project.js
|
|
74173
|
-
var
|
|
74374
|
+
var import_node_path40 = __toESM(require("node:path"), 1);
|
|
74174
74375
|
function configuredProjectName(config2) {
|
|
74175
74376
|
const name = config2?.project?.name?.trim();
|
|
74176
74377
|
return name !== void 0 && name.length > 0 ? name : void 0;
|
|
@@ -74179,7 +74380,7 @@ function projectName(config2, workspaceRoot) {
|
|
|
74179
74380
|
const configured = configuredProjectName(config2);
|
|
74180
74381
|
if (configured !== void 0)
|
|
74181
74382
|
return configured;
|
|
74182
|
-
return workspaceRoot === void 0 ? void 0 :
|
|
74383
|
+
return workspaceRoot === void 0 ? void 0 : import_node_path40.default.basename(import_node_path40.default.resolve(workspaceRoot));
|
|
74183
74384
|
}
|
|
74184
74385
|
function projectSlug(name) {
|
|
74185
74386
|
if (name === void 0)
|
|
@@ -74189,8 +74390,8 @@ function projectSlug(name) {
|
|
|
74189
74390
|
}
|
|
74190
74391
|
|
|
74191
74392
|
// ../../packages/core/dist/rag/renameIndexes.js
|
|
74192
|
-
var
|
|
74193
|
-
var
|
|
74393
|
+
var import_node_path41 = __toESM(require("node:path"), 1);
|
|
74394
|
+
var import_node_fs6 = require("node:fs");
|
|
74194
74395
|
function planIndexRenames(names) {
|
|
74195
74396
|
const plans = [];
|
|
74196
74397
|
for (const kind of ["codebase", "docs", "skills"]) {
|
|
@@ -74242,7 +74443,7 @@ async function copyIndex(options) {
|
|
|
74242
74443
|
async function copyBookkeeping(directory, from, to, storeId) {
|
|
74243
74444
|
let entries;
|
|
74244
74445
|
try {
|
|
74245
|
-
entries = await
|
|
74446
|
+
entries = await import_node_fs6.promises.readdir(directory);
|
|
74246
74447
|
} catch {
|
|
74247
74448
|
return [];
|
|
74248
74449
|
}
|
|
@@ -74253,7 +74454,7 @@ async function copyBookkeeping(directory, from, to, storeId) {
|
|
|
74253
74454
|
continue;
|
|
74254
74455
|
const target = `${to}@${storeId}.${entry.slice(prefix.length)}`;
|
|
74255
74456
|
try {
|
|
74256
|
-
await
|
|
74457
|
+
await import_node_fs6.promises.copyFile(import_node_path41.default.join(directory, entry), import_node_path41.default.join(directory, target), import_node_fs6.constants.COPYFILE_EXCL);
|
|
74257
74458
|
copied.push(target);
|
|
74258
74459
|
} catch {
|
|
74259
74460
|
}
|
|
@@ -74262,8 +74463,8 @@ async function copyBookkeeping(directory, from, to, storeId) {
|
|
|
74262
74463
|
}
|
|
74263
74464
|
|
|
74264
74465
|
// ../../packages/core/dist/tools/nativeSearch.js
|
|
74265
|
-
var
|
|
74266
|
-
var
|
|
74466
|
+
var import_node_os4 = __toESM(require("node:os"), 1);
|
|
74467
|
+
var import_node_path42 = __toESM(require("node:path"), 1);
|
|
74267
74468
|
var ALWAYS_SKIPPED = /* @__PURE__ */ new Set([".git", "node_modules"]);
|
|
74268
74469
|
var DEFAULT_MAX_FILES = 5e4;
|
|
74269
74470
|
var caseFlag = process.platform === "win32" ? "i" : "";
|
|
@@ -74364,8 +74565,8 @@ function isIgnored(rules, relative, isDirectory2) {
|
|
|
74364
74565
|
}
|
|
74365
74566
|
async function repositoryWideRules(fs39, root, globalIgnoreFile) {
|
|
74366
74567
|
const sources = [
|
|
74367
|
-
globalIgnoreFile ??
|
|
74368
|
-
|
|
74568
|
+
globalIgnoreFile ?? import_node_path42.default.join(process.env["XDG_CONFIG_HOME"] ?? import_node_path42.default.join(import_node_os4.default.homedir(), ".config"), "git", "ignore"),
|
|
74569
|
+
import_node_path42.default.join(root, ".git", "info", "exclude")
|
|
74369
74570
|
];
|
|
74370
74571
|
const rules = [];
|
|
74371
74572
|
for (const source of sources) {
|
|
@@ -74385,7 +74586,7 @@ async function walkFiles(fs39, root, options) {
|
|
|
74385
74586
|
if (options.signal?.aborted === true)
|
|
74386
74587
|
break;
|
|
74387
74588
|
const { relative, rules: inherited } = pending.pop();
|
|
74388
|
-
const absolute = relative.length > 0 ?
|
|
74589
|
+
const absolute = relative.length > 0 ? import_node_path42.default.join(root, ...relative.split("/")) : root;
|
|
74389
74590
|
let entries;
|
|
74390
74591
|
try {
|
|
74391
74592
|
entries = await fs39.readdir(absolute);
|
|
@@ -74395,7 +74596,7 @@ async function walkFiles(fs39, root, options) {
|
|
|
74395
74596
|
let rules = inherited;
|
|
74396
74597
|
if (!options.includeIgnored && entries.some((entry) => entry.name === ".gitignore" && !entry.isDirectory)) {
|
|
74397
74598
|
try {
|
|
74398
|
-
const text = await fs39.readFile(
|
|
74599
|
+
const text = await fs39.readFile(import_node_path42.default.join(absolute, ".gitignore"));
|
|
74399
74600
|
rules = [...inherited, ...parseIgnoreFile(text, relative)];
|
|
74400
74601
|
} catch {
|
|
74401
74602
|
}
|
|
@@ -74472,7 +74673,7 @@ async function searchFiles(fs39, root, options) {
|
|
|
74472
74673
|
break;
|
|
74473
74674
|
if (!admits(relative))
|
|
74474
74675
|
continue;
|
|
74475
|
-
const absolute =
|
|
74676
|
+
const absolute = import_node_path42.default.join(root, ...relative.split("/"));
|
|
74476
74677
|
let bytes;
|
|
74477
74678
|
try {
|
|
74478
74679
|
const stat = await fs39.stat(absolute);
|
|
@@ -74597,7 +74798,7 @@ var NodeTerminal = class {
|
|
|
74597
74798
|
|
|
74598
74799
|
// ../../packages/core/dist/platform/node/taskStore.js
|
|
74599
74800
|
var import_promises24 = __toESM(require("node:fs/promises"), 1);
|
|
74600
|
-
var
|
|
74801
|
+
var import_node_path43 = __toESM(require("node:path"), 1);
|
|
74601
74802
|
|
|
74602
74803
|
// ../../packages/core/dist/history/types.js
|
|
74603
74804
|
function taskSummary(task) {
|
|
@@ -74620,7 +74821,7 @@ var JsonTaskStore = class {
|
|
|
74620
74821
|
constructor(globalStoragePath, truncationStore, logger) {
|
|
74621
74822
|
this.truncationStore = truncationStore;
|
|
74622
74823
|
this.logger = logger;
|
|
74623
|
-
this.directory =
|
|
74824
|
+
this.directory = import_node_path43.default.join(globalStoragePath, "tasks");
|
|
74624
74825
|
}
|
|
74625
74826
|
async list(workspaceRoot) {
|
|
74626
74827
|
const index = await this.readIndex();
|
|
@@ -74669,11 +74870,11 @@ var JsonTaskStore = class {
|
|
|
74669
74870
|
await this.writeIndex(index.filter((entry) => entry.id !== id));
|
|
74670
74871
|
}
|
|
74671
74872
|
fileFor(id) {
|
|
74672
|
-
return
|
|
74873
|
+
return import_node_path43.default.join(this.directory, `${id}.json`);
|
|
74673
74874
|
}
|
|
74674
74875
|
async readIndex() {
|
|
74675
74876
|
try {
|
|
74676
|
-
const raw = await import_promises24.default.readFile(
|
|
74877
|
+
const raw = await import_promises24.default.readFile(import_node_path43.default.join(this.directory, INDEX_FILE), "utf8");
|
|
74677
74878
|
const parsed = JSON.parse(raw);
|
|
74678
74879
|
if (Array.isArray(parsed))
|
|
74679
74880
|
return parsed.filter(isIndexEntry);
|
|
@@ -74708,7 +74909,7 @@ var JsonTaskStore = class {
|
|
|
74708
74909
|
}
|
|
74709
74910
|
async writeIndex(entries) {
|
|
74710
74911
|
await import_promises24.default.mkdir(this.directory, { recursive: true });
|
|
74711
|
-
const target =
|
|
74912
|
+
const target = import_node_path43.default.join(this.directory, INDEX_FILE);
|
|
74712
74913
|
const temporary = `${target}.tmp`;
|
|
74713
74914
|
await import_promises24.default.writeFile(temporary, JSON.stringify(entries, null, 2), "utf8");
|
|
74714
74915
|
await replaceFile(temporary, target);
|
|
@@ -74740,9 +74941,9 @@ function parseTask(raw) {
|
|
|
74740
74941
|
|
|
74741
74942
|
// ../../packages/core/dist/usage/events.js
|
|
74742
74943
|
var import_node_crypto12 = require("node:crypto");
|
|
74743
|
-
var
|
|
74744
|
-
var
|
|
74745
|
-
var
|
|
74944
|
+
var import_node_fs7 = require("node:fs");
|
|
74945
|
+
var import_node_os5 = __toESM(require("node:os"), 1);
|
|
74946
|
+
var import_node_path44 = __toESM(require("node:path"), 1);
|
|
74746
74947
|
function isUsageEvent(value) {
|
|
74747
74948
|
if (value === null || typeof value !== "object")
|
|
74748
74949
|
return false;
|
|
@@ -74767,17 +74968,17 @@ function usageDay(t) {
|
|
|
74767
74968
|
return new Date(t).toISOString().slice(0, 10);
|
|
74768
74969
|
}
|
|
74769
74970
|
function usageInstanceId(storageDir) {
|
|
74770
|
-
return (0, import_node_crypto12.createHash)("sha256").update(`${
|
|
74771
|
-
${
|
|
74971
|
+
return (0, import_node_crypto12.createHash)("sha256").update(`${import_node_os5.default.hostname()}
|
|
74972
|
+
${import_node_path44.default.resolve(storageDir).toLowerCase()}`).digest("hex").slice(0, 12);
|
|
74772
74973
|
}
|
|
74773
74974
|
async function writeFileAtomically(target, text) {
|
|
74774
|
-
await
|
|
74975
|
+
await import_node_fs7.promises.mkdir(import_node_path44.default.dirname(target), { recursive: true });
|
|
74775
74976
|
const temporary = `${target}.${(0, import_node_crypto12.randomBytes)(6).toString("hex")}.tmp`;
|
|
74776
|
-
await
|
|
74977
|
+
await import_node_fs7.promises.writeFile(temporary, text, "utf8");
|
|
74777
74978
|
try {
|
|
74778
74979
|
await replaceFile(temporary, target);
|
|
74779
74980
|
} finally {
|
|
74780
|
-
await
|
|
74981
|
+
await import_node_fs7.promises.rm(temporary, { force: true }).catch(() => void 0);
|
|
74781
74982
|
}
|
|
74782
74983
|
}
|
|
74783
74984
|
var QUEUE_FILE = /^(\d{4}-\d{2}-\d{2})__([A-Za-z0-9-]+)\.jsonl$/;
|
|
@@ -74790,15 +74991,15 @@ var UsageLog = class {
|
|
|
74790
74991
|
session;
|
|
74791
74992
|
constructor(storageDir, session) {
|
|
74792
74993
|
this.storageDir = storageDir;
|
|
74793
|
-
this.queueDir =
|
|
74794
|
-
this.manifestFile =
|
|
74795
|
-
this.rolledFile =
|
|
74796
|
-
this.legacyFile =
|
|
74994
|
+
this.queueDir = import_node_path44.default.join(storageDir, "usage", "queue");
|
|
74995
|
+
this.manifestFile = import_node_path44.default.join(storageDir, "usage", "pushed.json");
|
|
74996
|
+
this.rolledFile = import_node_path44.default.join(storageDir, "usage", "rolled.json");
|
|
74997
|
+
this.legacyFile = import_node_path44.default.join(storageDir, "usage-events.jsonl");
|
|
74797
74998
|
this.session = session ?? (0, import_node_crypto12.randomBytes)(6).toString("hex");
|
|
74798
74999
|
}
|
|
74799
75000
|
async append(event) {
|
|
74800
|
-
await
|
|
74801
|
-
await
|
|
75001
|
+
await import_node_fs7.promises.mkdir(this.queueDir, { recursive: true });
|
|
75002
|
+
await import_node_fs7.promises.appendFile(import_node_path44.default.join(this.queueDir, `${usageDay(event.t)}__${this.session}.jsonl`), `${JSON.stringify(event)}
|
|
74802
75003
|
`, "utf8");
|
|
74803
75004
|
}
|
|
74804
75005
|
/**
|
|
@@ -74806,7 +75007,7 @@ var UsageLog = class {
|
|
|
74806
75007
|
* never appended, so two sessions importing at once leave one copy rather than two.
|
|
74807
75008
|
*/
|
|
74808
75009
|
async writeFixed(day, name, events) {
|
|
74809
|
-
await writeFileAtomically(
|
|
75010
|
+
await writeFileAtomically(import_node_path44.default.join(this.queueDir, `${day}__${name}.jsonl`), events.map((event) => JSON.stringify(event)).join("\n") + (events.length > 0 ? "\n" : ""));
|
|
74810
75011
|
}
|
|
74811
75012
|
/**
|
|
74812
75013
|
* Moves a 0.156/0.157 single queue file into the per-day layout, once. Deterministic names, so two
|
|
@@ -74816,7 +75017,7 @@ var UsageLog = class {
|
|
|
74816
75017
|
async migrateLegacy() {
|
|
74817
75018
|
let text;
|
|
74818
75019
|
try {
|
|
74819
|
-
text = await
|
|
75020
|
+
text = await import_node_fs7.promises.readFile(this.legacyFile, "utf8");
|
|
74820
75021
|
} catch {
|
|
74821
75022
|
return;
|
|
74822
75023
|
}
|
|
@@ -74825,15 +75026,15 @@ var UsageLog = class {
|
|
|
74825
75026
|
byDay.set(usageDay(event.t), [...byDay.get(usageDay(event.t)) ?? [], event]);
|
|
74826
75027
|
for (const [day, events] of byDay)
|
|
74827
75028
|
await this.writeFixed(day, "legacy", events);
|
|
74828
|
-
await
|
|
74829
|
-
await
|
|
75029
|
+
await import_node_fs7.promises.rename(this.legacyFile, `${this.legacyFile}.migrated`).catch(() => void 0);
|
|
75030
|
+
await import_node_fs7.promises.rm(import_node_path44.default.join(this.storageDir, "usage-sync.json"), { force: true }).catch(() => void 0);
|
|
74830
75031
|
}
|
|
74831
75032
|
/** Every day with local files, and its signature. */
|
|
74832
75033
|
async days() {
|
|
74833
75034
|
const days = /* @__PURE__ */ new Map();
|
|
74834
75035
|
let names;
|
|
74835
75036
|
try {
|
|
74836
|
-
names = await
|
|
75037
|
+
names = await import_node_fs7.promises.readdir(this.queueDir);
|
|
74837
75038
|
} catch {
|
|
74838
75039
|
return days;
|
|
74839
75040
|
}
|
|
@@ -74841,7 +75042,7 @@ var UsageLog = class {
|
|
|
74841
75042
|
const match = QUEUE_FILE.exec(name);
|
|
74842
75043
|
if (match === null)
|
|
74843
75044
|
continue;
|
|
74844
|
-
const size = await
|
|
75045
|
+
const size = await import_node_fs7.promises.stat(import_node_path44.default.join(this.queueDir, name)).then((stat) => stat.size).catch(() => void 0);
|
|
74845
75046
|
if (size === void 0)
|
|
74846
75047
|
continue;
|
|
74847
75048
|
const entry = days.get(match[1]) ?? { files: [], signature: "" };
|
|
@@ -74863,7 +75064,7 @@ var UsageLog = class {
|
|
|
74863
75064
|
const entry = (await this.days()).get(day);
|
|
74864
75065
|
if (entry === void 0)
|
|
74865
75066
|
return [];
|
|
74866
|
-
const texts = await Promise.all(entry.files.map((file2) =>
|
|
75067
|
+
const texts = await Promise.all(entry.files.map((file2) => import_node_fs7.promises.readFile(import_node_path44.default.join(this.queueDir, file2.name), "utf8").catch(() => "")));
|
|
74867
75068
|
return texts.flatMap(parseUsageLines).sort((a, b) => a.t - b.t);
|
|
74868
75069
|
}
|
|
74869
75070
|
/** Every queued event (the last few weeks), for finding names worth looking up. */
|
|
@@ -74874,7 +75075,7 @@ var UsageLog = class {
|
|
|
74874
75075
|
/** What has been pushed to `target`, by day. A different target has had nothing pushed. */
|
|
74875
75076
|
async pushed(target) {
|
|
74876
75077
|
try {
|
|
74877
|
-
const saved = JSON.parse(await
|
|
75078
|
+
const saved = JSON.parse(await import_node_fs7.promises.readFile(this.manifestFile, "utf8"));
|
|
74878
75079
|
return saved.target === target && saved.days !== null && typeof saved.days === "object" ? saved.days : {};
|
|
74879
75080
|
} catch {
|
|
74880
75081
|
return {};
|
|
@@ -74888,7 +75089,7 @@ var UsageLog = class {
|
|
|
74888
75089
|
/** Months this install has rolled up in `target` (`usage/rollup.ts`): their late days go into the month. */
|
|
74889
75090
|
async rolledMonths(target) {
|
|
74890
75091
|
try {
|
|
74891
|
-
const saved = JSON.parse(await
|
|
75092
|
+
const saved = JSON.parse(await import_node_fs7.promises.readFile(this.rolledFile, "utf8"));
|
|
74892
75093
|
return new Set(saved.target === target && Array.isArray(saved.months) ? saved.months.filter((month) => typeof month === "string") : []);
|
|
74893
75094
|
} catch {
|
|
74894
75095
|
return /* @__PURE__ */ new Set();
|
|
@@ -74910,7 +75111,7 @@ var UsageLog = class {
|
|
|
74910
75111
|
if (day >= cutoff || pushed[day] !== entry.signature)
|
|
74911
75112
|
continue;
|
|
74912
75113
|
for (const file2 of entry.files) {
|
|
74913
|
-
await
|
|
75114
|
+
await import_node_fs7.promises.rm(import_node_path44.default.join(this.queueDir, file2.name), { force: true }).catch(() => void 0);
|
|
74914
75115
|
removed++;
|
|
74915
75116
|
}
|
|
74916
75117
|
}
|
|
@@ -74919,8 +75120,8 @@ var UsageLog = class {
|
|
|
74919
75120
|
};
|
|
74920
75121
|
|
|
74921
75122
|
// ../../packages/core/dist/usage/store.js
|
|
74922
|
-
var
|
|
74923
|
-
var
|
|
75123
|
+
var import_node_fs8 = require("node:fs");
|
|
75124
|
+
var import_node_path45 = __toESM(require("node:path"), 1);
|
|
74924
75125
|
|
|
74925
75126
|
// ../../packages/core/dist/s3/keys.js
|
|
74926
75127
|
function normalisePrefix(prefix) {
|
|
@@ -75053,7 +75254,7 @@ var FolderShardStore = class {
|
|
|
75053
75254
|
await this.ask({ action: "write", user: shardSegment(shard.user), day: shard.day, instance: shard.instance, events });
|
|
75054
75255
|
return;
|
|
75055
75256
|
}
|
|
75056
|
-
await this.writeAtomically(
|
|
75257
|
+
await this.writeAtomically(import_node_path45.default.join(this.root, shardSegment(shard.user), `${shard.day}__${shard.instance}.jsonl`), shardText(events));
|
|
75057
75258
|
}
|
|
75058
75259
|
async read(fromDay, toDay) {
|
|
75059
75260
|
this.lastProblems = [];
|
|
@@ -75073,8 +75274,8 @@ var FolderShardStore = class {
|
|
|
75073
75274
|
}
|
|
75074
75275
|
const files = await this.listFiles();
|
|
75075
75276
|
const wanted = selectShards(files, fromDay, toDay);
|
|
75076
|
-
const texts = await pooled(wanted, 8, (file2) =>
|
|
75077
|
-
this.lastProblems.push(`${
|
|
75277
|
+
const texts = await pooled(wanted, 8, (file2) => import_node_fs8.promises.readFile(import_node_path45.default.join(this.root, file2.user, file2.name), "utf8").catch((error51) => {
|
|
75278
|
+
this.lastProblems.push(`${import_node_path45.default.join(this.root, file2.user, file2.name)}: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
75078
75279
|
return "";
|
|
75079
75280
|
}));
|
|
75080
75281
|
return texts.flatMap(parseUsageLines);
|
|
@@ -75083,7 +75284,7 @@ var FolderShardStore = class {
|
|
|
75083
75284
|
async listFiles() {
|
|
75084
75285
|
let users;
|
|
75085
75286
|
try {
|
|
75086
|
-
users = (await
|
|
75287
|
+
users = (await import_node_fs8.promises.readdir(this.root, { withFileTypes: true })).filter((entry) => entry.isDirectory() && entry.name !== "_profiles").map((entry) => entry.name);
|
|
75087
75288
|
} catch (error51) {
|
|
75088
75289
|
if (error51.code === "ENOENT")
|
|
75089
75290
|
return [];
|
|
@@ -75091,10 +75292,10 @@ var FolderShardStore = class {
|
|
|
75091
75292
|
}
|
|
75092
75293
|
const files = [];
|
|
75093
75294
|
for (const user of users) {
|
|
75094
|
-
const folder =
|
|
75295
|
+
const folder = import_node_path45.default.join(this.root, user);
|
|
75095
75296
|
let names;
|
|
75096
75297
|
try {
|
|
75097
|
-
names = await
|
|
75298
|
+
names = await import_node_fs8.promises.readdir(folder);
|
|
75098
75299
|
} catch (error51) {
|
|
75099
75300
|
names = [];
|
|
75100
75301
|
this.lastProblems.push(`${folder}: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
@@ -75110,7 +75311,7 @@ var FolderShardStore = class {
|
|
|
75110
75311
|
}
|
|
75111
75312
|
async readShard(shard) {
|
|
75112
75313
|
try {
|
|
75113
|
-
return parseUsageLines(await
|
|
75314
|
+
return parseUsageLines(await import_node_fs8.promises.readFile(import_node_path45.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), "utf8"));
|
|
75114
75315
|
} catch (error51) {
|
|
75115
75316
|
if (error51.code === "ENOENT")
|
|
75116
75317
|
return void 0;
|
|
@@ -75118,10 +75319,10 @@ var FolderShardStore = class {
|
|
|
75118
75319
|
}
|
|
75119
75320
|
}
|
|
75120
75321
|
async putMonth(shard, events) {
|
|
75121
|
-
await this.writeAtomically(
|
|
75322
|
+
await this.writeAtomically(import_node_path45.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), shardText(events));
|
|
75122
75323
|
}
|
|
75123
75324
|
async removeShard(shard) {
|
|
75124
|
-
await
|
|
75325
|
+
await import_node_fs8.promises.rm(import_node_path45.default.join(this.root, shardSegment(shard.user), shardFileName(shard)), { force: true });
|
|
75125
75326
|
}
|
|
75126
75327
|
async putProfile(user, profile) {
|
|
75127
75328
|
this.profilesFromRead = void 0;
|
|
@@ -75129,7 +75330,7 @@ var FolderShardStore = class {
|
|
|
75129
75330
|
await this.ask({ action: "writeProfile", user: shardSegment(user), profile: cleanProfile(profile) });
|
|
75130
75331
|
return;
|
|
75131
75332
|
}
|
|
75132
|
-
await this.writeAtomically(
|
|
75333
|
+
await this.writeAtomically(import_node_path45.default.join(this.root, "_profiles", `${shardSegment(user)}.json`), JSON.stringify(cleanProfile(profile)));
|
|
75133
75334
|
}
|
|
75134
75335
|
async readProfiles() {
|
|
75135
75336
|
if (this.profilesFromRead !== void 0)
|
|
@@ -75138,13 +75339,13 @@ var FolderShardStore = class {
|
|
|
75138
75339
|
await this.read("9999-12-31", "9999-12-31");
|
|
75139
75340
|
return this.profilesFromRead ?? {};
|
|
75140
75341
|
}
|
|
75141
|
-
const folder =
|
|
75342
|
+
const folder = import_node_path45.default.join(this.root, "_profiles");
|
|
75142
75343
|
const profiles = {};
|
|
75143
|
-
for (const name of await
|
|
75344
|
+
for (const name of await import_node_fs8.promises.readdir(folder).catch(() => [])) {
|
|
75144
75345
|
if (!name.endsWith(".json"))
|
|
75145
75346
|
continue;
|
|
75146
75347
|
try {
|
|
75147
|
-
profiles[name.slice(0, -5)] = cleanProfile(JSON.parse(await
|
|
75348
|
+
profiles[name.slice(0, -5)] = cleanProfile(JSON.parse(await import_node_fs8.promises.readFile(import_node_path45.default.join(folder, name), "utf8")));
|
|
75148
75349
|
} catch {
|
|
75149
75350
|
}
|
|
75150
75351
|
}
|
|
@@ -75892,8 +76093,8 @@ function usageCollectionOn(config2, choice) {
|
|
|
75892
76093
|
}
|
|
75893
76094
|
|
|
75894
76095
|
// ../../packages/core/dist/usage/backfill.js
|
|
75895
|
-
var
|
|
75896
|
-
var
|
|
76096
|
+
var import_node_fs9 = require("node:fs");
|
|
76097
|
+
var import_node_path46 = __toESM(require("node:path"), 1);
|
|
75897
76098
|
function comparablePath(value) {
|
|
75898
76099
|
return value.replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
|
|
75899
76100
|
}
|
|
@@ -75903,7 +76104,7 @@ function eventsFromTask(task, context) {
|
|
|
75903
76104
|
return [];
|
|
75904
76105
|
const created = typeof task.createdAt === "number" && task.createdAt <= updated ? task.createdAt : updated;
|
|
75905
76106
|
const root = typeof task.workspaceRoot === "string" ? task.workspaceRoot : void 0;
|
|
75906
|
-
const project = root !== void 0 && context.workspaceRoot !== void 0 && comparablePath(root) === comparablePath(context.workspaceRoot) ? context.project : root !== void 0 ?
|
|
76107
|
+
const project = root !== void 0 && context.workspaceRoot !== void 0 && comparablePath(root) === comparablePath(context.workspaceRoot) ? context.project : root !== void 0 ? import_node_path46.default.basename(root.replace(/\\/g, "/")) : void 0;
|
|
75907
76108
|
const skillsByPath = new Map(context.skills.map((skill) => [comparablePath(skill.filePath), skill]));
|
|
75908
76109
|
const skip = new Set(context.skip);
|
|
75909
76110
|
const calls = [];
|
|
@@ -75940,7 +76141,7 @@ function eventsFromTask(task, context) {
|
|
|
75940
76141
|
let skill;
|
|
75941
76142
|
if (call.name === "read_file" && typeof call.args["path"] === "string") {
|
|
75942
76143
|
const requested2 = call.args["path"];
|
|
75943
|
-
const absolute =
|
|
76144
|
+
const absolute = import_node_path46.default.isAbsolute(requested2) || /^[A-Za-z]:[\\/]/.test(requested2) || root === void 0 ? requested2 : import_node_path46.default.join(root, requested2);
|
|
75944
76145
|
skill = skillsByPath.get(comparablePath(absolute));
|
|
75945
76146
|
}
|
|
75946
76147
|
if (call.name === "use_skill_file" && typeof call.args["skill"] === "string") {
|
|
@@ -75977,7 +76178,7 @@ async function backfillFromTasks(tasksDir, context, helper) {
|
|
|
75977
76178
|
}
|
|
75978
76179
|
let names;
|
|
75979
76180
|
try {
|
|
75980
|
-
names = (await
|
|
76181
|
+
names = (await import_node_fs9.promises.readdir(tasksDir)).filter((name) => name.endsWith(".json") && name !== "index.json");
|
|
75981
76182
|
} catch {
|
|
75982
76183
|
return { events: [], tasks: 0, unreadable: 0, via: "node" };
|
|
75983
76184
|
}
|
|
@@ -75985,7 +76186,7 @@ async function backfillFromTasks(tasksDir, context, helper) {
|
|
|
75985
76186
|
let unreadable = 0;
|
|
75986
76187
|
for (const name of names) {
|
|
75987
76188
|
try {
|
|
75988
|
-
events.push(...eventsFromTask(JSON.parse(await
|
|
76189
|
+
events.push(...eventsFromTask(JSON.parse(await import_node_fs9.promises.readFile(import_node_path46.default.join(tasksDir, name), "utf8")), context));
|
|
75989
76190
|
} catch {
|
|
75990
76191
|
unreadable++;
|
|
75991
76192
|
}
|
|
@@ -75993,24 +76194,24 @@ async function backfillFromTasks(tasksDir, context, helper) {
|
|
|
75993
76194
|
return { events, tasks: names.length, unreadable, via: "node" };
|
|
75994
76195
|
}
|
|
75995
76196
|
async function backfillOnce(options) {
|
|
75996
|
-
const doneFile =
|
|
76197
|
+
const doneFile = import_node_path46.default.join(options.usageDir, "backfill.json");
|
|
75997
76198
|
for (const file2 of [doneFile, ...options.legacyDoneFile !== void 0 ? [options.legacyDoneFile] : []]) {
|
|
75998
|
-
if (await
|
|
76199
|
+
if (await import_node_fs9.promises.stat(file2).then(() => true, () => false))
|
|
75999
76200
|
return { ran: false };
|
|
76000
76201
|
}
|
|
76001
|
-
await
|
|
76002
|
-
const startFile =
|
|
76202
|
+
await import_node_fs9.promises.mkdir(options.usageDir, { recursive: true });
|
|
76203
|
+
const startFile = import_node_path46.default.join(options.usageDir, "backfill-start.json");
|
|
76003
76204
|
let before;
|
|
76004
76205
|
try {
|
|
76005
76206
|
before = (options.now ?? Date.now)();
|
|
76006
|
-
await
|
|
76207
|
+
await import_node_fs9.promises.writeFile(startFile, JSON.stringify({ before }), { encoding: "utf8", flag: "wx" });
|
|
76007
76208
|
} catch (error51) {
|
|
76008
76209
|
if (error51.code !== "EEXIST")
|
|
76009
76210
|
throw error51;
|
|
76010
76211
|
let claimed;
|
|
76011
76212
|
for (let attempt = 0; attempt < 40 && claimed === void 0; attempt++) {
|
|
76012
76213
|
try {
|
|
76013
|
-
const parsed = JSON.parse(await
|
|
76214
|
+
const parsed = JSON.parse(await import_node_fs9.promises.readFile(startFile, "utf8"));
|
|
76014
76215
|
if (typeof parsed.before === "number")
|
|
76015
76216
|
claimed = parsed.before;
|
|
76016
76217
|
} catch {
|
|
@@ -76255,7 +76456,6 @@ ${describe5(profile)}` };
|
|
|
76255
76456
|
}
|
|
76256
76457
|
|
|
76257
76458
|
// ../../packages/core/dist/usage/directory.js
|
|
76258
|
-
var import_node_child_process14 = require("node:child_process");
|
|
76259
76459
|
var ATTRIBUTE_MAP = [
|
|
76260
76460
|
["displayName", "displayName"],
|
|
76261
76461
|
["mail", "email"],
|
|
@@ -76265,25 +76465,6 @@ var ATTRIBUTE_MAP = [
|
|
|
76265
76465
|
["company", "company"],
|
|
76266
76466
|
["sAMAccountName", "account"]
|
|
76267
76467
|
];
|
|
76268
|
-
function accountPart(name) {
|
|
76269
|
-
return name.split("\\").pop() ?? name;
|
|
76270
|
-
}
|
|
76271
|
-
function entryMatches(entry, name) {
|
|
76272
|
-
const wanted = name.toLowerCase();
|
|
76273
|
-
const account = accountPart(name).toLowerCase();
|
|
76274
|
-
const field2 = (key2) => entry[key2]?.toLowerCase();
|
|
76275
|
-
const upn = field2("userPrincipalName");
|
|
76276
|
-
return field2("sAMAccountName") === account || upn === wanted || upn !== void 0 && upn.split("@")[0] === account || field2("mail") === wanted || field2("displayName") === wanted;
|
|
76277
|
-
}
|
|
76278
|
-
function personFromEntry(entry) {
|
|
76279
|
-
const person = {};
|
|
76280
|
-
for (const [from, to] of ATTRIBUTE_MAP) {
|
|
76281
|
-
const value = entry[from]?.trim();
|
|
76282
|
-
if (value !== void 0 && value.length > 0)
|
|
76283
|
-
person[to] = value.slice(0, 200);
|
|
76284
|
-
}
|
|
76285
|
-
return person;
|
|
76286
|
-
}
|
|
76287
76468
|
function profileFromPerson(person) {
|
|
76288
76469
|
return {
|
|
76289
76470
|
...person.displayName !== void 0 ? { displayName: person.displayName } : {},
|
|
@@ -76294,107 +76475,29 @@ function profileFromPerson(person) {
|
|
|
76294
76475
|
source: "company directory"
|
|
76295
76476
|
};
|
|
76296
76477
|
}
|
|
76297
|
-
var DIRECTORY_SCRIPT = String.raw`
|
|
76298
|
-
$ErrorActionPreference = 'Stop'
|
|
76299
|
-
$names = @(([Console]::In.ReadToEnd() | ConvertFrom-Json).names)
|
|
76300
|
-
function Esc([string]$s) { return $s.Replace('\', '\5c').Replace('*', '\2a').Replace('(', '\28').Replace(')', '\29').Replace([string][char]0, '\00') }
|
|
76301
|
-
$attrs = @('sAMAccountName', 'userPrincipalName', 'mail', 'displayName', 'department', 'title', 'physicalDeliveryOfficeName', 'company')
|
|
76302
|
-
try {
|
|
76303
|
-
$entries = New-Object System.Collections.ArrayList
|
|
76304
|
-
for ($i = 0; $i -lt $names.Count; $i += 20) {
|
|
76305
|
-
$last = [Math]::Min($i + 19, $names.Count - 1)
|
|
76306
|
-
$clauses = ''
|
|
76307
|
-
foreach ($n in $names[$i..$last]) {
|
|
76308
|
-
$account = Esc (($n -split '\\')[-1])
|
|
76309
|
-
$whole = Esc $n
|
|
76310
|
-
$clauses += "(sAMAccountName=$account)(userPrincipalName=$whole)(mail=$whole)(displayName=$whole)"
|
|
76311
|
-
}
|
|
76312
|
-
$searcher = New-Object System.DirectoryServices.DirectorySearcher
|
|
76313
|
-
$searcher.Filter = "(&(objectCategory=person)(objectClass=user)(|$clauses))"
|
|
76314
|
-
$searcher.SizeLimit = 200
|
|
76315
|
-
$searcher.ClientTimeout = [TimeSpan]::FromSeconds(15)
|
|
76316
|
-
$searcher.ReferralChasing = [System.DirectoryServices.ReferralChasingOption]::None
|
|
76317
|
-
foreach ($a in $attrs) { [void]$searcher.PropertiesToLoad.Add($a) }
|
|
76318
|
-
foreach ($r in $searcher.FindAll()) {
|
|
76319
|
-
$e = @{}
|
|
76320
|
-
foreach ($a in $attrs) {
|
|
76321
|
-
$v = $r.Properties[$a]
|
|
76322
|
-
if ($v -ne $null -and $v.Count -gt 0) { $e[$a] = [string]$v[0] }
|
|
76323
|
-
}
|
|
76324
|
-
[void]$entries.Add($e)
|
|
76325
|
-
}
|
|
76326
|
-
}
|
|
76327
|
-
$out = @{ ok = $true; available = $true; entries = @($entries) }
|
|
76328
|
-
} catch {
|
|
76329
|
-
$out = @{ ok = $true; available = $false; reason = $_.Exception.Message.Trim() }
|
|
76330
|
-
}
|
|
76331
|
-
'LCJSON:' + ($out | ConvertTo-Json -Depth 5 -Compress)
|
|
76332
|
-
`;
|
|
76333
|
-
var runWindowsPowerShell = (script, stdin) => new Promise((resolve, reject2) => {
|
|
76334
|
-
const encoded = Buffer.from(script, "utf16le").toString("base64");
|
|
76335
|
-
const child = (0, import_node_child_process14.spawn)("powershell.exe", ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-EncodedCommand", encoded], { windowsHide: true });
|
|
76336
|
-
let out = "";
|
|
76337
|
-
let err = "";
|
|
76338
|
-
const timer = setTimeout(() => {
|
|
76339
|
-
child.kill();
|
|
76340
|
-
reject2(new Error("The directory lookup took longer than a minute."));
|
|
76341
|
-
}, 6e4);
|
|
76342
|
-
child.stdout.setEncoding("utf8").on("data", (chunk) => out += chunk);
|
|
76343
|
-
child.stderr.setEncoding("utf8").on("data", (chunk) => err += chunk);
|
|
76344
|
-
child.on("error", (error51) => {
|
|
76345
|
-
clearTimeout(timer);
|
|
76346
|
-
reject2(error51);
|
|
76347
|
-
});
|
|
76348
|
-
child.on("close", () => {
|
|
76349
|
-
clearTimeout(timer);
|
|
76350
|
-
resolve(out.length > 0 ? out : err);
|
|
76351
|
-
});
|
|
76352
|
-
child.stdin.end(stdin);
|
|
76353
|
-
});
|
|
76354
|
-
function fromEntries(names, entries) {
|
|
76355
|
-
const people = {};
|
|
76356
|
-
const notFound = [];
|
|
76357
|
-
for (const name of names) {
|
|
76358
|
-
const entry = entries.find((candidate) => entryMatches(candidate, name));
|
|
76359
|
-
if (entry === void 0)
|
|
76360
|
-
notFound.push(name);
|
|
76361
|
-
else
|
|
76362
|
-
people[name] = personFromEntry(entry);
|
|
76363
|
-
}
|
|
76364
|
-
return { people, notFound };
|
|
76365
|
-
}
|
|
76366
76478
|
async function lookupDirectory(names, options = {}) {
|
|
76367
76479
|
const wanted = [...new Set(names.map((name) => name.trim()).filter((name) => name.length > 0 && name.length <= 200))].slice(0, 500);
|
|
76368
76480
|
if ((options.platform ?? process.platform) !== "win32")
|
|
76369
76481
|
return { available: false, reason: "The company directory is read through Windows; this is not Windows.", via: "none" };
|
|
76482
|
+
if (options.helper === void 0) {
|
|
76483
|
+
return { available: false, reason: "The company directory is read through the Rust helper, and none is available here.", via: "none" };
|
|
76484
|
+
}
|
|
76370
76485
|
if (wanted.length === 0)
|
|
76371
|
-
return { available: true, people: {}, notFound: [], via:
|
|
76372
|
-
|
|
76373
|
-
|
|
76374
|
-
|
|
76375
|
-
|
|
76376
|
-
|
|
76377
|
-
|
|
76378
|
-
|
|
76379
|
-
|
|
76380
|
-
|
|
76381
|
-
|
|
76382
|
-
|
|
76383
|
-
|
|
76384
|
-
|
|
76385
|
-
|
|
76386
|
-
}
|
|
76387
|
-
}
|
|
76388
|
-
const run3 = options.runPowerShell ?? runWindowsPowerShell;
|
|
76389
|
-
const output = await run3(DIRECTORY_SCRIPT, JSON.stringify({ names: wanted }));
|
|
76390
|
-
const line = output.split(/\r?\n/).find((each) => each.startsWith("LCJSON:"));
|
|
76391
|
-
if (line === void 0)
|
|
76392
|
-
return { available: false, reason: `The directory lookup gave no answer${output.trim().length > 0 ? `: ${output.trim().slice(0, 200)}` : "."}`, via: "powershell" };
|
|
76393
|
-
const parsed = JSON.parse(line.slice("LCJSON:".length));
|
|
76394
|
-
if (parsed.available !== true)
|
|
76395
|
-
return { available: false, reason: parsed.reason ?? "The directory could not be reached.", via: "powershell" };
|
|
76396
|
-
const entries = Array.isArray(parsed.entries) ? parsed.entries : parsed.entries !== void 0 ? [parsed.entries] : [];
|
|
76397
|
-
return { available: true, ...fromEntries(wanted, entries), via: "powershell" };
|
|
76486
|
+
return { available: true, people: {}, notFound: [], via: "rust" };
|
|
76487
|
+
const answer = await options.helper({ op: "directory", names: wanted });
|
|
76488
|
+
if (answer["ok"] !== true)
|
|
76489
|
+
return { available: false, reason: String(answer["error"] ?? "The Rust helper has no directory lookup."), via: "rust" };
|
|
76490
|
+
if (answer["available"] !== true)
|
|
76491
|
+
return { available: false, reason: String(answer["reason"] ?? "The directory could not be reached."), via: "rust" };
|
|
76492
|
+
const people = {};
|
|
76493
|
+
for (const [name, value] of Object.entries(answer["people"] ?? {})) {
|
|
76494
|
+
const person = {};
|
|
76495
|
+
for (const [, field2] of ATTRIBUTE_MAP)
|
|
76496
|
+
if (typeof value[field2] === "string")
|
|
76497
|
+
person[field2] = value[field2];
|
|
76498
|
+
people[name] = person;
|
|
76499
|
+
}
|
|
76500
|
+
return { available: true, people, notFound: answer["notFound"] ?? [], via: "rust" };
|
|
76398
76501
|
}
|
|
76399
76502
|
|
|
76400
76503
|
// ../../packages/core/dist/host/bridge.js
|
|
@@ -76506,8 +76609,8 @@ function wireChatBridge(services) {
|
|
|
76506
76609
|
let cachedSecretValues = [];
|
|
76507
76610
|
const droppedFilesRoot2 = droppedFilesRoot();
|
|
76508
76611
|
const mailAttachmentsRoot2 = mailAttachmentsRoot();
|
|
76509
|
-
const droppedFilesDir =
|
|
76510
|
-
const truncationStore = new RecordingTruncationStore(new DiskTruncationStore(
|
|
76612
|
+
const droppedFilesDir = import_node_path47.default.join(droppedFilesRoot2, (0, import_node_crypto13.randomUUID)().slice(0, 8));
|
|
76613
|
+
const truncationStore = new RecordingTruncationStore(new DiskTruncationStore(import_node_path47.default.join(storageDir, "tool-results"), () => cachedSecretValues));
|
|
76511
76614
|
const taskStore = new JsonTaskStore(storageDir, truncationStore, logger);
|
|
76512
76615
|
const python = new PythonManager({
|
|
76513
76616
|
workspaceRoot,
|
|
@@ -76632,7 +76735,7 @@ ${preview.text}` } : {}
|
|
|
76632
76735
|
void postDatasetStatus();
|
|
76633
76736
|
}
|
|
76634
76737
|
});
|
|
76635
|
-
const defaultSkillsDir = workspaceRoot !== void 0 ?
|
|
76738
|
+
const defaultSkillsDir = workspaceRoot !== void 0 ? import_node_path47.default.join(workspaceRoot, ".lightcode", "skills") : void 0;
|
|
76636
76739
|
let skillsDir = defaultSkillsDir;
|
|
76637
76740
|
let localSkillsDir = defaultSkillsDir;
|
|
76638
76741
|
let extraSkillDirs = [];
|
|
@@ -76655,9 +76758,9 @@ ${preview.text}` } : {}
|
|
|
76655
76758
|
const trimmed = entry.trim();
|
|
76656
76759
|
if (trimmed.length === 0)
|
|
76657
76760
|
return void 0;
|
|
76658
|
-
if (
|
|
76659
|
-
return
|
|
76660
|
-
return workspaceRoot === void 0 ? void 0 :
|
|
76761
|
+
if (import_node_path47.default.isAbsolute(trimmed))
|
|
76762
|
+
return import_node_path47.default.resolve(trimmed);
|
|
76763
|
+
return workspaceRoot === void 0 ? void 0 : import_node_path47.default.resolve(workspaceRoot, trimmed);
|
|
76661
76764
|
}
|
|
76662
76765
|
function skillSearchPath() {
|
|
76663
76766
|
return [skillsDir, ...extraSkillDirs].filter((dir) => dir !== void 0);
|
|
@@ -76689,12 +76792,12 @@ ${preview.text}` } : {}
|
|
|
76689
76792
|
function watchSkillFolders() {
|
|
76690
76793
|
stopWatchingSkills();
|
|
76691
76794
|
const dirs = skillSearchPath();
|
|
76692
|
-
for (const dir of [...dirs, ...dirs.map((entry) =>
|
|
76795
|
+
for (const dir of [...dirs, ...dirs.map((entry) => import_node_path47.default.dirname(entry))]) {
|
|
76693
76796
|
try {
|
|
76694
76797
|
skillWatchers.push(
|
|
76695
76798
|
// Recursive, because a skill may be a folder with SKILL.md inside — a non-recursive
|
|
76696
76799
|
// watch sees the folder appear and then never hears about the file written into it.
|
|
76697
|
-
(0,
|
|
76800
|
+
(0, import_node_fs10.watch)(dir, { recursive: true }, () => {
|
|
76698
76801
|
if (skillWatchTimer !== void 0)
|
|
76699
76802
|
clearTimeout(skillWatchTimer);
|
|
76700
76803
|
skillWatchTimer = setTimeout(() => {
|
|
@@ -76760,11 +76863,11 @@ ${preview.text}` } : {}
|
|
|
76760
76863
|
// Reports a scheduled run wrote. Confined like everything else here: the path arrives
|
|
76761
76864
|
// from the UI, which only ever sends one it was given, and "the UI would not do that"
|
|
76762
76865
|
// is not a boundary when the result is opening a file in the user's editor.
|
|
76763
|
-
|
|
76866
|
+
import_node_path47.default.join(storageDir, "reports")
|
|
76764
76867
|
];
|
|
76765
76868
|
if (roots.length === 0)
|
|
76766
76869
|
return;
|
|
76767
|
-
const real = await confineToAny(
|
|
76870
|
+
const real = await confineToAny(import_node_path47.default.resolve(filePath), roots);
|
|
76768
76871
|
await ui.openFile(real);
|
|
76769
76872
|
} catch (error51) {
|
|
76770
76873
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
@@ -76780,7 +76883,7 @@ ${preview.text}` } : {}
|
|
|
76780
76883
|
await handleOpenManagedFile(existing.filePath);
|
|
76781
76884
|
return;
|
|
76782
76885
|
}
|
|
76783
|
-
const target =
|
|
76886
|
+
const target = import_node_path47.default.join(skillsDir, "standing-instructions.md");
|
|
76784
76887
|
try {
|
|
76785
76888
|
await import_promises25.default.mkdir(skillsDir, { recursive: true });
|
|
76786
76889
|
await import_promises25.default.writeFile(target, STANDING_SKILL_TEMPLATE, { encoding: "utf8", flag: "wx" });
|
|
@@ -76801,11 +76904,11 @@ ${preview.text}` } : {}
|
|
|
76801
76904
|
return;
|
|
76802
76905
|
if (!isValidToolName(name))
|
|
76803
76906
|
throw new Error(`"${name}" is not a valid tool name.`);
|
|
76804
|
-
const ownCopy =
|
|
76907
|
+
const ownCopy = import_node_path47.default.join(dir, toolFileName(name));
|
|
76805
76908
|
if (filePath !== void 0) {
|
|
76806
|
-
const same2 = (a, b) => normalizeForComparison(
|
|
76909
|
+
const same2 = (a, b) => normalizeForComparison(import_node_path47.default.resolve(a)) === normalizeForComparison(import_node_path47.default.resolve(b));
|
|
76807
76910
|
if (!same2(filePath, ownCopy)) {
|
|
76808
|
-
const fromBucket = mirroredToolsDirs.some((mirror) => same2(
|
|
76911
|
+
const fromBucket = mirroredToolsDirs.some((mirror) => same2(import_node_path47.default.dirname(filePath), mirror));
|
|
76809
76912
|
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.`);
|
|
76810
76913
|
}
|
|
76811
76914
|
}
|
|
@@ -76831,7 +76934,7 @@ ${preview.text}` } : {}
|
|
|
76831
76934
|
let dir;
|
|
76832
76935
|
let filePath = "";
|
|
76833
76936
|
for (const candidate of python.toolDirectories()) {
|
|
76834
|
-
const attempt =
|
|
76937
|
+
const attempt = import_node_path47.default.join(candidate, toolFileName(name));
|
|
76835
76938
|
if (await onDisk(attempt)) {
|
|
76836
76939
|
dir = candidate;
|
|
76837
76940
|
filePath = attempt;
|
|
@@ -76862,7 +76965,7 @@ ${preview.text}` } : {}
|
|
|
76862
76965
|
function samePath(a, b) {
|
|
76863
76966
|
if (a === void 0 || b === void 0)
|
|
76864
76967
|
return false;
|
|
76865
|
-
const norm2 = (value) => process.platform === "win32" ?
|
|
76968
|
+
const norm2 = (value) => process.platform === "win32" ? import_node_path47.default.resolve(value).toLowerCase() : import_node_path47.default.resolve(value);
|
|
76866
76969
|
return norm2(a) === norm2(b);
|
|
76867
76970
|
}
|
|
76868
76971
|
function publishFolder(kind, mirrors) {
|
|
@@ -76967,7 +77070,7 @@ ${preview.text}` } : {}
|
|
|
76967
77070
|
target,
|
|
76968
77071
|
...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {},
|
|
76969
77072
|
relative: entry,
|
|
76970
|
-
contents: await import_promises25.default.readFile(
|
|
77073
|
+
contents: await import_promises25.default.readFile(import_node_path47.default.join(dir, entry))
|
|
76971
77074
|
});
|
|
76972
77075
|
uploaded += 1;
|
|
76973
77076
|
} catch (error51) {
|
|
@@ -76989,7 +77092,7 @@ ${preview.text}` } : {}
|
|
|
76989
77092
|
if (!isValidToolName(name))
|
|
76990
77093
|
throw new Error(`"${name}" is not a valid tool name.`);
|
|
76991
77094
|
for (const candidate of python.toolDirectories()) {
|
|
76992
|
-
const attempt =
|
|
77095
|
+
const attempt = import_node_path47.default.join(candidate, toolFileName(name));
|
|
76993
77096
|
try {
|
|
76994
77097
|
post({ type: "pythonToolSource", name, source: await import_promises25.default.readFile(attempt, "utf8") });
|
|
76995
77098
|
return;
|
|
@@ -77042,7 +77145,7 @@ ${preview.text}` } : {}
|
|
|
77042
77145
|
continue;
|
|
77043
77146
|
for (const candidate of python.toolDirectories()) {
|
|
77044
77147
|
try {
|
|
77045
|
-
const source = await import_promises25.default.readFile(
|
|
77148
|
+
const source = await import_promises25.default.readFile(import_node_path47.default.join(candidate, toolFileName(name)), "utf8");
|
|
77046
77149
|
declined[name] = hashSource(source);
|
|
77047
77150
|
recorded += 1;
|
|
77048
77151
|
break;
|
|
@@ -77100,7 +77203,7 @@ ${preview.text}` } : {}
|
|
|
77100
77203
|
let dir;
|
|
77101
77204
|
let filePath = "";
|
|
77102
77205
|
for (const candidate of python.toolDirectories()) {
|
|
77103
|
-
const attempt =
|
|
77206
|
+
const attempt = import_node_path47.default.join(candidate, toolFileName(name));
|
|
77104
77207
|
if (await onDisk(attempt)) {
|
|
77105
77208
|
dir = candidate;
|
|
77106
77209
|
filePath = attempt;
|
|
@@ -77126,7 +77229,7 @@ ${preview.text}` } : {}
|
|
|
77126
77229
|
function mirrorForDir(sourceDir) {
|
|
77127
77230
|
if (sourceDir === void 0)
|
|
77128
77231
|
return void 0;
|
|
77129
|
-
const wanted =
|
|
77232
|
+
const wanted = import_node_path47.default.resolve(sourceDir).toLowerCase();
|
|
77130
77233
|
for (const mirror of cachedSkillMirrors) {
|
|
77131
77234
|
if (mirror.enabled !== true)
|
|
77132
77235
|
continue;
|
|
@@ -77136,7 +77239,7 @@ ${preview.text}` } : {}
|
|
|
77136
77239
|
kind: "skills",
|
|
77137
77240
|
...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}
|
|
77138
77241
|
});
|
|
77139
|
-
if (
|
|
77242
|
+
if (import_node_path47.default.resolve(localDir).toLowerCase() === wanted)
|
|
77140
77243
|
return { mirror, localDir };
|
|
77141
77244
|
}
|
|
77142
77245
|
return void 0;
|
|
@@ -77201,8 +77304,8 @@ ${preview.text}` } : {}
|
|
|
77201
77304
|
});
|
|
77202
77305
|
let localProblem;
|
|
77203
77306
|
try {
|
|
77204
|
-
await import_promises25.default.rm(
|
|
77205
|
-
await import_promises25.default.rm(
|
|
77307
|
+
await import_promises25.default.rm(import_node_path47.default.join(found2.localDir, `${name}.md`), { force: true });
|
|
77308
|
+
await import_promises25.default.rm(import_node_path47.default.join(found2.localDir, name), { recursive: true, force: true });
|
|
77206
77309
|
} catch (error51) {
|
|
77207
77310
|
localProblem = error51 instanceof Error ? error51.message : String(error51);
|
|
77208
77311
|
}
|
|
@@ -77235,7 +77338,7 @@ ${preview.text}` } : {}
|
|
|
77235
77338
|
if (existing !== void 0 && existing.sourceDir !== void 0 && existing.sourceDir !== skillsDir) {
|
|
77236
77339
|
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.`);
|
|
77237
77340
|
}
|
|
77238
|
-
await import_promises25.default.rm(
|
|
77341
|
+
await import_promises25.default.rm(import_node_path47.default.join(skillsDir, skillFileName(name)), { force: true });
|
|
77239
77342
|
await postSkills();
|
|
77240
77343
|
} catch (error51) {
|
|
77241
77344
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
@@ -77415,7 +77518,7 @@ ${preview.text}` } : {}
|
|
|
77415
77518
|
let scheduleToolAccess;
|
|
77416
77519
|
const approvalsKey = workspaceRoot ?? "__no_workspace__";
|
|
77417
77520
|
function comparableApprovalsKey(key2) {
|
|
77418
|
-
return key2 === "__no_workspace__" ? key2 : normalizeForComparison(
|
|
77521
|
+
return key2 === "__no_workspace__" ? key2 : normalizeForComparison(import_node_path47.default.resolve(key2));
|
|
77419
77522
|
}
|
|
77420
77523
|
function approvalsFrom(stored) {
|
|
77421
77524
|
if (stored === void 0)
|
|
@@ -77626,7 +77729,7 @@ ${preview.text}` } : {}
|
|
|
77626
77729
|
...taskExpertEstimate === void 0 ? {} : { estimate: taskExpertEstimate }
|
|
77627
77730
|
});
|
|
77628
77731
|
}
|
|
77629
|
-
const expertEventsPath =
|
|
77732
|
+
const expertEventsPath = import_node_path47.default.join(storageDir, "expert-events.jsonl");
|
|
77630
77733
|
let expertEvents;
|
|
77631
77734
|
let juniorTurnWithoutExpert = false;
|
|
77632
77735
|
async function loadExpertEvents() {
|
|
@@ -77654,7 +77757,7 @@ ${preview.text}` } : {}
|
|
|
77654
77757
|
try {
|
|
77655
77758
|
const events = await loadExpertEvents();
|
|
77656
77759
|
events.push(event);
|
|
77657
|
-
await import_promises25.default.mkdir(
|
|
77760
|
+
await import_promises25.default.mkdir(import_node_path47.default.dirname(expertEventsPath), { recursive: true });
|
|
77658
77761
|
await import_promises25.default.appendFile(expertEventsPath, `${JSON.stringify(event)}
|
|
77659
77762
|
`, "utf8");
|
|
77660
77763
|
} catch (error51) {
|
|
@@ -77928,11 +78031,13 @@ ${preview.text}` } : {}
|
|
|
77928
78031
|
function contextMentionPath(file2) {
|
|
77929
78032
|
if (workspaceRoot === void 0)
|
|
77930
78033
|
return file2;
|
|
77931
|
-
const relative =
|
|
77932
|
-
return relative.length > 0 && !relative.startsWith("..") && !
|
|
78034
|
+
const relative = import_node_path47.default.relative(workspaceRoot, file2);
|
|
78035
|
+
return relative.length > 0 && !relative.startsWith("..") && !import_node_path47.default.isAbsolute(relative) ? relative.split(import_node_path47.default.sep).join("/") : file2;
|
|
77933
78036
|
}
|
|
77934
78037
|
function hostCapabilities() {
|
|
77935
78038
|
return {
|
|
78039
|
+
// The GitHub Copilot preset, offered only where VS Code's models can be reached.
|
|
78040
|
+
hostModels: services.languageModels !== void 0,
|
|
77936
78041
|
nativeGuide: ui.openWalkthrough !== void 0,
|
|
77937
78042
|
exportsSource: services.sourceArchive !== void 0,
|
|
77938
78043
|
picksFiles: ui.pickContextFiles !== void 0,
|
|
@@ -78428,7 +78533,7 @@ ${preview.text}` } : {}
|
|
|
78428
78533
|
setMcpServersState(servers);
|
|
78429
78534
|
await mcp.configure(servers);
|
|
78430
78535
|
}
|
|
78431
|
-
const shadowGit = workspaceRoot !== void 0 ? new ShadowGit(workspaceRoot,
|
|
78536
|
+
const shadowGit = workspaceRoot !== void 0 ? new ShadowGit(workspaceRoot, import_node_path47.default.join(storageDir, "checkpoints", "shadow.git")) : void 0;
|
|
78432
78537
|
async function postProfiles() {
|
|
78433
78538
|
const { config: config2 } = await configManager.load();
|
|
78434
78539
|
const profiles = await Promise.all((config2.profiles ?? []).map((profile) => toSummary(profile, secrets)));
|
|
@@ -78596,7 +78701,7 @@ ${preview.text}` } : {}
|
|
|
78596
78701
|
await denylist.add(config2.certDir);
|
|
78597
78702
|
await knownSecretValues();
|
|
78598
78703
|
const profile = resolveActiveProfile(config2);
|
|
78599
|
-
const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger);
|
|
78704
|
+
const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
|
|
78600
78705
|
const capabilities = withReportedWindow(resolveModelCapabilities(profile.model, profile.modelCapabilities), await reportedWindowFor(config2, profile), profile.modelCapabilities);
|
|
78601
78706
|
const expertCliInfo = await resolveExpert(config2);
|
|
78602
78707
|
const search = await resolveSearch(config2);
|
|
@@ -79341,7 +79446,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
79341
79446
|
}
|
|
79342
79447
|
const config2 = await loadSettings();
|
|
79343
79448
|
const profile = resolveActiveProfile(config2);
|
|
79344
|
-
const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger);
|
|
79449
|
+
const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
|
|
79345
79450
|
const result = await compactHistory(repairUnansweredToolCalls(conversation.toModelMessages()), provider, { keepRecent: 4 });
|
|
79346
79451
|
const summary = result.compacted ? result.messages.find(isSummaryMessage) : void 0;
|
|
79347
79452
|
if (summary === void 0) {
|
|
@@ -79386,7 +79491,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
79386
79491
|
if (typeof fromHub === "string")
|
|
79387
79492
|
throw new Error(fromHub);
|
|
79388
79493
|
const git = (args) => new Promise((resolve) => {
|
|
79389
|
-
const child = (0,
|
|
79494
|
+
const child = (0, import_node_child_process14.spawn)("git", ["--no-optional-locks", "-C", root, ...args], {
|
|
79390
79495
|
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" },
|
|
79391
79496
|
windowsHide: true
|
|
79392
79497
|
});
|
|
@@ -79415,7 +79520,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
79415
79520
|
... (diff cut here)` : diff.out;
|
|
79416
79521
|
const config2 = await loadSettings();
|
|
79417
79522
|
const profile = resolveActiveProfile(config2);
|
|
79418
|
-
const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger);
|
|
79523
|
+
const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
|
|
79419
79524
|
let text = "";
|
|
79420
79525
|
for await (const chunk of provider.streamChat([
|
|
79421
79526
|
{
|
|
@@ -79818,7 +79923,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
79818
79923
|
level: expert.thinking
|
|
79819
79924
|
}
|
|
79820
79925
|
};
|
|
79821
|
-
const provider = createChatProvider(seatProfile, httpClient, authStrategyFor(config2, profile), logger);
|
|
79926
|
+
const provider = createChatProvider(seatProfile, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
|
|
79822
79927
|
let text = "";
|
|
79823
79928
|
for await (const chunk of provider.streamChat([
|
|
79824
79929
|
{ role: "system", content: expert.prompt },
|
|
@@ -79858,7 +79963,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
79858
79963
|
return;
|
|
79859
79964
|
}
|
|
79860
79965
|
const profile = chosen ?? resolveActiveProfile(config2);
|
|
79861
|
-
const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger);
|
|
79966
|
+
const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
|
|
79862
79967
|
const results = [];
|
|
79863
79968
|
for (const [index, probe2] of ASSESSMENT_PROBES.entries()) {
|
|
79864
79969
|
assessmentStep = `Asking ${profile.label ?? profile.model}: ${probe2.measures} (${String(index + 1)}/${String(ASSESSMENT_PROBES.length)})`;
|
|
@@ -80007,7 +80112,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
80007
80112
|
if (configured !== void 0 && configured.length > 0)
|
|
80008
80113
|
return configured;
|
|
80009
80114
|
try {
|
|
80010
|
-
const name =
|
|
80115
|
+
const name = import_node_os6.default.userInfo().username.trim();
|
|
80011
80116
|
return name.length > 0 ? name : void 0;
|
|
80012
80117
|
} catch {
|
|
80013
80118
|
return void 0;
|
|
@@ -80017,7 +80122,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
80017
80122
|
return { mode: cachedSearchScope, author: cachedAttribution.author };
|
|
80018
80123
|
}
|
|
80019
80124
|
function currentProjectNames() {
|
|
80020
|
-
const names = [cachedAttribution.project, workspaceRoot !== void 0 ?
|
|
80125
|
+
const names = [cachedAttribution.project, workspaceRoot !== void 0 ? import_node_path47.default.basename(workspaceRoot) : void 0];
|
|
80021
80126
|
return names.filter((name) => name !== void 0 && name.length > 0);
|
|
80022
80127
|
}
|
|
80023
80128
|
function indexProject(config2) {
|
|
@@ -80120,8 +80225,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
80120
80225
|
limit: limits.limit,
|
|
80121
80226
|
previewChars: limits.previewChars
|
|
80122
80227
|
});
|
|
80123
|
-
for (const
|
|
80124
|
-
skipped.add(
|
|
80228
|
+
for (const path58 of answer.skipped ?? [])
|
|
80229
|
+
skipped.add(path58);
|
|
80125
80230
|
return { messages: answer.messages, truncated: answer.truncated };
|
|
80126
80231
|
},
|
|
80127
80232
|
...embedder !== void 0 && search !== void 0 && collection !== void 0 ? {
|
|
@@ -80420,9 +80525,9 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
80420
80525
|
});
|
|
80421
80526
|
const all = result.folders.map((entry) => entry.path);
|
|
80422
80527
|
const wanted = new Set(chosen);
|
|
80423
|
-
for (const
|
|
80424
|
-
if (chosen.some((root) =>
|
|
80425
|
-
wanted.add(
|
|
80528
|
+
for (const path58 of all) {
|
|
80529
|
+
if (chosen.some((root) => path58 === root || path58.startsWith(`${root}\\`)))
|
|
80530
|
+
wanted.add(path58);
|
|
80426
80531
|
}
|
|
80427
80532
|
return [...wanted];
|
|
80428
80533
|
} catch {
|
|
@@ -80430,7 +80535,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
80430
80535
|
}
|
|
80431
80536
|
}
|
|
80432
80537
|
async function handleRequestOutlookFolders(depth, force = false) {
|
|
80433
|
-
const cachePath =
|
|
80538
|
+
const cachePath = import_node_path47.default.join(storageDir, "outlook-folders.json");
|
|
80434
80539
|
let served = false;
|
|
80435
80540
|
try {
|
|
80436
80541
|
const cached2 = JSON.parse(await import_promises25.default.readFile(cachePath, "utf8"));
|
|
@@ -80450,7 +80555,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
80450
80555
|
const scannedAt = Date.now();
|
|
80451
80556
|
post({ type: "outlookFolders", folders: result.folders, scannedAt });
|
|
80452
80557
|
try {
|
|
80453
|
-
await import_promises25.default.mkdir(
|
|
80558
|
+
await import_promises25.default.mkdir(import_node_path47.default.dirname(cachePath), { recursive: true });
|
|
80454
80559
|
await import_promises25.default.writeFile(cachePath, JSON.stringify({ scannedAt, folders: result.folders }), "utf8");
|
|
80455
80560
|
} catch {
|
|
80456
80561
|
}
|
|
@@ -81116,7 +81221,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81116
81221
|
approvalStamps.set("machine", stamp2);
|
|
81117
81222
|
}
|
|
81118
81223
|
for (const dir of python.toolDirectories()) {
|
|
81119
|
-
const file2 =
|
|
81224
|
+
const file2 = import_node_path47.default.join(dir, REGISTRY_FILE);
|
|
81120
81225
|
const stamp2 = await import_promises25.default.stat(file2).then((stat) => stat.mtimeMs, () => 0);
|
|
81121
81226
|
if (approvalStamps.has(file2) && approvalStamps.get(file2) !== stamp2)
|
|
81122
81227
|
changed = true;
|
|
@@ -81207,7 +81312,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81207
81312
|
return;
|
|
81208
81313
|
}
|
|
81209
81314
|
const folder = skill.filePath.slice(0, skill.filePath.length - "SKILL.md".length);
|
|
81210
|
-
const bytes = await import_promises25.default.readFile(
|
|
81315
|
+
const bytes = await import_promises25.default.readFile(import_node_path47.default.join(folder, SKILL_IMAGE_DIR, image));
|
|
81211
81316
|
const dataUri = skillImageDataUri(image, bytes);
|
|
81212
81317
|
post({
|
|
81213
81318
|
type: "skillImage",
|
|
@@ -81496,7 +81601,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81496
81601
|
return withoutRipgrep();
|
|
81497
81602
|
try {
|
|
81498
81603
|
const listed = await new Promise((resolve, reject2) => {
|
|
81499
|
-
const child = (0,
|
|
81604
|
+
const child = (0, import_node_child_process14.spawn)(ripgrepPath, ["--files", "--hidden", "--glob", "!.git"], {
|
|
81500
81605
|
cwd: workspaceRoot
|
|
81501
81606
|
});
|
|
81502
81607
|
let out = "";
|
|
@@ -81535,13 +81640,13 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81535
81640
|
}
|
|
81536
81641
|
function docsFingerprintPath(index, storeId, kind) {
|
|
81537
81642
|
const suffix = kind === void 0 ? "docs" : `docs.${kind}`;
|
|
81538
|
-
return
|
|
81643
|
+
return import_node_path47.default.join(storageDir, "index-manifests", `${manifestKey(index, storeId)}.${suffix}.json`);
|
|
81539
81644
|
}
|
|
81540
81645
|
function manifestKey(index, storeId) {
|
|
81541
81646
|
return `${index}@${storeId}`;
|
|
81542
81647
|
}
|
|
81543
81648
|
function manifestPath(index, storeId) {
|
|
81544
|
-
return
|
|
81649
|
+
return import_node_path47.default.join(storageDir, "index-manifests", `${manifestKey(index, storeId)}.json`);
|
|
81545
81650
|
}
|
|
81546
81651
|
async function readDocsFingerprint(index, storeId, kind) {
|
|
81547
81652
|
try {
|
|
@@ -81605,7 +81710,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81605
81710
|
}
|
|
81606
81711
|
options.report?.("Writing", { done: 0, total: documents.length });
|
|
81607
81712
|
await writer.upsert(index, documents);
|
|
81608
|
-
await import_promises25.default.mkdir(
|
|
81713
|
+
await import_promises25.default.mkdir(import_node_path47.default.dirname(docsFingerprintPath(index, search.id, wanted)), {
|
|
81609
81714
|
recursive: true
|
|
81610
81715
|
});
|
|
81611
81716
|
await import_promises25.default.writeFile(docsFingerprintPath(index, search.id, wanted), JSON.stringify({ fingerprint, indexedAt: Date.now(), count: documents.length }), "utf8");
|
|
@@ -81795,7 +81900,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81795
81900
|
});
|
|
81796
81901
|
if (manifest !== void 0) {
|
|
81797
81902
|
const targetPath = manifestPath(index, target.id);
|
|
81798
|
-
await import_promises25.default.mkdir(
|
|
81903
|
+
await import_promises25.default.mkdir(import_node_path47.default.dirname(targetPath), { recursive: true });
|
|
81799
81904
|
await import_promises25.default.writeFile(targetPath, JSON.stringify(manifest), "utf8");
|
|
81800
81905
|
}
|
|
81801
81906
|
post({ type: "storeSync", running: false, copied: result.copied, fromLabel: source.label });
|
|
@@ -81834,7 +81939,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81834
81939
|
const ownerConfigured = config2.identity?.owner?.trim();
|
|
81835
81940
|
let loginName;
|
|
81836
81941
|
try {
|
|
81837
|
-
loginName =
|
|
81942
|
+
loginName = import_node_os6.default.userInfo().username;
|
|
81838
81943
|
} catch {
|
|
81839
81944
|
loginName = void 0;
|
|
81840
81945
|
}
|
|
@@ -81844,7 +81949,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81844
81949
|
type: "project",
|
|
81845
81950
|
hasWorkspace: workspaceRoot !== void 0,
|
|
81846
81951
|
...configured !== void 0 ? { configured } : {},
|
|
81847
|
-
...workspaceRoot !== void 0 ? { folder:
|
|
81952
|
+
...workspaceRoot !== void 0 ? { folder: import_node_path47.default.basename(workspaceRoot) } : {},
|
|
81848
81953
|
...author !== void 0 ? { author } : {},
|
|
81849
81954
|
...index !== void 0 ? { indexName: index } : {},
|
|
81850
81955
|
...ownerConfigured !== void 0 && ownerConfigured.length > 0 ? { ownerConfigured } : {},
|
|
@@ -81984,11 +82089,11 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81984
82089
|
if (workspaceRoot === void 0)
|
|
81985
82090
|
return found2;
|
|
81986
82091
|
const root = workspaceRoot;
|
|
81987
|
-
const relative =
|
|
81988
|
-
if (relative.startsWith("..") ||
|
|
82092
|
+
const relative = import_node_path47.default.relative(root, folder);
|
|
82093
|
+
if (relative.startsWith("..") || import_node_path47.default.isAbsolute(relative))
|
|
81989
82094
|
return found2;
|
|
81990
82095
|
const output = await new Promise((resolve) => {
|
|
81991
|
-
const child = (0,
|
|
82096
|
+
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 : "."], {
|
|
81992
82097
|
cwd: root,
|
|
81993
82098
|
windowsHide: true
|
|
81994
82099
|
});
|
|
@@ -82002,7 +82107,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82002
82107
|
if (line.startsWith("@@"))
|
|
82003
82108
|
author = line.slice(2).trim();
|
|
82004
82109
|
else if (line.trim().length > 0 && author !== void 0 && author.length > 0) {
|
|
82005
|
-
found2.set(normalizeForComparison(
|
|
82110
|
+
found2.set(normalizeForComparison(import_node_path47.default.resolve(root, line.trim())), author);
|
|
82006
82111
|
}
|
|
82007
82112
|
}
|
|
82008
82113
|
return found2;
|
|
@@ -82046,7 +82151,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82046
82151
|
},
|
|
82047
82152
|
source,
|
|
82048
82153
|
folder,
|
|
82049
|
-
relative:
|
|
82154
|
+
relative: import_node_path47.default.relative(folder, filePath).split(import_node_path47.default.sep).join("/")
|
|
82050
82155
|
});
|
|
82051
82156
|
};
|
|
82052
82157
|
for (const folder of skillFolders) {
|
|
@@ -82064,7 +82169,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82064
82169
|
const name = entry.slice(0, -3);
|
|
82065
82170
|
if (!isValidToolName(name))
|
|
82066
82171
|
continue;
|
|
82067
|
-
await consider("tool", name,
|
|
82172
|
+
await consider("tool", name, import_node_path47.default.join(folder, entry), folder, location);
|
|
82068
82173
|
}
|
|
82069
82174
|
}
|
|
82070
82175
|
const readOnly = skills.filter((skill) => skill.sourceDir !== void 0 && !skillFolders.some((folder) => samePath(folder, skill.sourceDir))).length;
|
|
@@ -82096,7 +82201,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82096
82201
|
} catch {
|
|
82097
82202
|
}
|
|
82098
82203
|
}
|
|
82099
|
-
const gitAuthor = gitAuthors.get(normalizeForComparison(
|
|
82204
|
+
const gitAuthor = gitAuthors.get(normalizeForComparison(import_node_path47.default.resolve(candidate.entry.filePath)));
|
|
82100
82205
|
if (gitAuthor !== void 0) {
|
|
82101
82206
|
candidate.entry.suggestion = { author: gitAuthor, source: "git: the commit that added this file" };
|
|
82102
82207
|
}
|
|
@@ -82205,7 +82310,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82205
82310
|
aliases: plan2.kind === "codebase" ? codebaseAliases(config2) : plan2.kind === "skills" ? skillAliases(config2) : [],
|
|
82206
82311
|
onProgress: (count3) => post({ type: "indexRenames", running: true, plans, store, current: plan2.to, copied: count3 })
|
|
82207
82312
|
});
|
|
82208
|
-
await copyBookkeeping(
|
|
82313
|
+
await copyBookkeeping(import_node_path47.default.join(storageDir, "index-manifests"), plan2.from, plan2.to, search.id);
|
|
82209
82314
|
done.push({ ...plan2, copied });
|
|
82210
82315
|
}
|
|
82211
82316
|
post({ type: "indexRenames", running: false, plans: [], store, done });
|
|
@@ -82235,7 +82340,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82235
82340
|
project: projectName(config2, workspaceRoot),
|
|
82236
82341
|
aliases: codebaseAliases(config2)
|
|
82237
82342
|
});
|
|
82238
|
-
await copyBookkeeping(
|
|
82343
|
+
await copyBookkeeping(import_node_path47.default.join(storageDir, "index-manifests"), legacy, current, search.id);
|
|
82239
82344
|
post({ type: "indexRenames", running: false, plans: [], done: [{ kind: "codebase", from: legacy, to: current, copied }] });
|
|
82240
82345
|
logger.info(`copied ${String(copied)} chunks from ${legacy} to ${current} rather than re-embedding them`);
|
|
82241
82346
|
}
|
|
@@ -82401,7 +82506,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82401
82506
|
denylist,
|
|
82402
82507
|
manifest,
|
|
82403
82508
|
saveManifest: async (next) => {
|
|
82404
|
-
await import_promises25.default.mkdir(
|
|
82509
|
+
await import_promises25.default.mkdir(import_node_path47.default.dirname(manifestFile), { recursive: true });
|
|
82405
82510
|
await import_promises25.default.writeFile(manifestFile, JSON.stringify(next), "utf8");
|
|
82406
82511
|
},
|
|
82407
82512
|
...isIgnored2 !== void 0 ? { isIgnored: isIgnored2 } : {},
|
|
@@ -82448,9 +82553,9 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82448
82553
|
}
|
|
82449
82554
|
const usageLog = new UsageLog(storageDir);
|
|
82450
82555
|
const usageInstance = usageInstanceId(storageDir);
|
|
82451
|
-
const usageProfileFile =
|
|
82452
|
-
const legacyBackfillFile =
|
|
82453
|
-
const usageDir =
|
|
82556
|
+
const usageProfileFile = import_node_path47.default.join(storageDir, "usage-profile.json");
|
|
82557
|
+
const legacyBackfillFile = import_node_path47.default.join(storageDir, "usage-backfill.json");
|
|
82558
|
+
const usageDir = import_node_path47.default.join(storageDir, "usage");
|
|
82454
82559
|
const toolStartedAt = /* @__PURE__ */ new Map();
|
|
82455
82560
|
let usagePushTimer;
|
|
82456
82561
|
let usagePushing;
|
|
@@ -82468,7 +82573,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82468
82573
|
return (request) => runFastFs(exe, request);
|
|
82469
82574
|
}
|
|
82470
82575
|
function skillAtPath(requested2) {
|
|
82471
|
-
const absolute =
|
|
82576
|
+
const absolute = import_node_path47.default.isAbsolute(requested2) ? requested2 : workspaceRoot === void 0 ? void 0 : import_node_path47.default.resolve(workspaceRoot, requested2);
|
|
82472
82577
|
if (absolute === void 0)
|
|
82473
82578
|
return void 0;
|
|
82474
82579
|
return skills.find((skill) => samePath(skill.filePath, absolute));
|
|
@@ -82541,7 +82646,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82541
82646
|
const folder = chosen.path?.trim();
|
|
82542
82647
|
if (folder === void 0 || folder.length === 0)
|
|
82543
82648
|
return { problem: "The shared folder has no path." };
|
|
82544
|
-
if (!
|
|
82649
|
+
if (!import_node_path47.default.isAbsolute(folder))
|
|
82545
82650
|
return { problem: `"${folder}" is not an absolute path. Use the full path of a folder everybody can reach, such as a network share.` };
|
|
82546
82651
|
const helper = usageHelper();
|
|
82547
82652
|
return { store: new FolderShardStore(folder, ...helper !== void 0 ? [helper] : []), target };
|
|
@@ -82570,7 +82675,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82570
82675
|
}
|
|
82571
82676
|
async function readUsageBackfill() {
|
|
82572
82677
|
try {
|
|
82573
|
-
const text = await import_promises25.default.readFile(
|
|
82678
|
+
const text = await import_promises25.default.readFile(import_node_path47.default.join(usageDir, "backfill.json"), "utf8").catch(() => import_promises25.default.readFile(legacyBackfillFile, "utf8"));
|
|
82574
82679
|
const saved = JSON.parse(text);
|
|
82575
82680
|
if (typeof saved.at !== "number")
|
|
82576
82681
|
return void 0;
|
|
@@ -82586,7 +82691,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82586
82691
|
legacyDoneFile: legacyBackfillFile,
|
|
82587
82692
|
run: async (before) => {
|
|
82588
82693
|
const status2 = python.status();
|
|
82589
|
-
return backfillFromTasks(
|
|
82694
|
+
return backfillFromTasks(import_node_path47.default.join(storageDir, "tasks"), {
|
|
82590
82695
|
user: cachedAttribution.author ?? "unknown",
|
|
82591
82696
|
project: cachedAttribution.project,
|
|
82592
82697
|
workspaceRoot,
|
|
@@ -82633,7 +82738,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82633
82738
|
logger.info(`usage: rolled up ${String(rolled.months)} month(s), removing ${String(rolled.removed)} day files`);
|
|
82634
82739
|
}
|
|
82635
82740
|
usageLastProblem = void 0;
|
|
82636
|
-
void enrichFromDirectory(
|
|
82741
|
+
void enrichFromDirectory([]);
|
|
82637
82742
|
await usageLog.prune(resolved.target, 14);
|
|
82638
82743
|
} catch (error51) {
|
|
82639
82744
|
usageLastProblem = `Could not write to ${resolved.store.label}: ${error51 instanceof Error ? error51.message : String(error51)}`;
|
|
@@ -82759,14 +82864,14 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82759
82864
|
kind: "tool",
|
|
82760
82865
|
name: issue2.name,
|
|
82761
82866
|
filePath: issue2.filePath,
|
|
82762
|
-
deletable: samePath(
|
|
82763
|
-
location: where(
|
|
82867
|
+
deletable: samePath(import_node_path47.default.dirname(issue2.filePath), status2.toolsDir),
|
|
82868
|
+
location: where(import_node_path47.default.dirname(issue2.filePath), status2.toolsDir),
|
|
82764
82869
|
issue: issue2.kind === "unapproved" ? "waiting for approval" : issue2.kind === "hash-mismatch" ? "changed since approval" : issue2.detail.split("\n")[0] ?? "not loaded"
|
|
82765
82870
|
});
|
|
82766
82871
|
}
|
|
82767
82872
|
return items;
|
|
82768
82873
|
}
|
|
82769
|
-
const usageDirectoryFile =
|
|
82874
|
+
const usageDirectoryFile = import_node_path47.default.join(storageDir, "usage-directory.json");
|
|
82770
82875
|
let directoryRunning;
|
|
82771
82876
|
async function readDirectoryCache() {
|
|
82772
82877
|
try {
|
|
@@ -83098,7 +83203,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83098
83203
|
let indexedFiles = 0;
|
|
83099
83204
|
if (index !== void 0) {
|
|
83100
83205
|
try {
|
|
83101
|
-
const manifest = JSON.parse(await import_promises25.default.readFile(
|
|
83206
|
+
const manifest = JSON.parse(await import_promises25.default.readFile(import_node_path47.default.join(storageDir, "index-manifests", `${index}.json`), "utf8"));
|
|
83102
83207
|
indexedFiles = Object.keys(manifest.files ?? {}).length;
|
|
83103
83208
|
} catch {
|
|
83104
83209
|
}
|
|
@@ -83196,7 +83301,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83196
83301
|
post({ type: "embedderModels", models: [], warning: "That profile no longer exists." });
|
|
83197
83302
|
return;
|
|
83198
83303
|
}
|
|
83199
|
-
const result = await
|
|
83304
|
+
const result = await listModelsFor(config2, profile);
|
|
83200
83305
|
post({
|
|
83201
83306
|
type: "embedderModels",
|
|
83202
83307
|
models: result.ids,
|
|
@@ -83439,6 +83544,11 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83439
83544
|
for (const [id, tokens] of Object.entries(windows ?? {}))
|
|
83440
83545
|
reportedWindows.set(`${baseUrl}|${id}`, tokens);
|
|
83441
83546
|
}
|
|
83547
|
+
async function listModelsFor(config2, profile, signal) {
|
|
83548
|
+
if (profile.wireFormat === "vscode-lm")
|
|
83549
|
+
return listHostModels(services.languageModels, signal);
|
|
83550
|
+
return listModels(httpClient, profile, authStrategyFor(config2, profile), signal);
|
|
83551
|
+
}
|
|
83442
83552
|
async function reportedWindowFor(config2, profile) {
|
|
83443
83553
|
if (profile.modelCapabilities?.contextWindow !== void 0)
|
|
83444
83554
|
return void 0;
|
|
@@ -83448,7 +83558,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83448
83558
|
const controller = new AbortController();
|
|
83449
83559
|
const timer = setTimeout(() => controller.abort(), 1e4);
|
|
83450
83560
|
try {
|
|
83451
|
-
rememberWindows(profile.baseUrl, (await
|
|
83561
|
+
rememberWindows(profile.baseUrl, (await listModelsFor(config2, profile, controller.signal)).windows);
|
|
83452
83562
|
} catch {
|
|
83453
83563
|
} finally {
|
|
83454
83564
|
clearTimeout(timer);
|
|
@@ -83479,8 +83589,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83479
83589
|
if (built === void 0)
|
|
83480
83590
|
return;
|
|
83481
83591
|
const { config: config2 } = await configManager.load();
|
|
83482
|
-
const
|
|
83483
|
-
const result = await listModels(httpClient, built.profile, strategy);
|
|
83592
|
+
const result = await listModelsFor(config2, built.profile);
|
|
83484
83593
|
rememberWindows(built.profile.baseUrl, result.windows);
|
|
83485
83594
|
post({
|
|
83486
83595
|
type: "models",
|
|
@@ -83501,7 +83610,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83501
83610
|
if (built === void 0)
|
|
83502
83611
|
return;
|
|
83503
83612
|
const { config: config2 } = await configManager.load();
|
|
83504
|
-
const result = await testConnection(built.profile, buildAuthContext(config2, built.profile), httpClient);
|
|
83613
|
+
const result = built.profile.wireFormat === "vscode-lm" ? await testHostModels(services.languageModels, built.profile.model) : await testConnection(built.profile, buildAuthContext(config2, built.profile), httpClient);
|
|
83505
83614
|
post({ type: "testConnectionResult", ok: result.ok, steps: result.steps });
|
|
83506
83615
|
} catch (error51) {
|
|
83507
83616
|
post({
|
|
@@ -83662,7 +83771,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83662
83771
|
if (changeLedger !== void 0) {
|
|
83663
83772
|
const shared = await changeLedger.othersSince(targets, taskCheckpoint.createdAt);
|
|
83664
83773
|
if (shared.size > 0) {
|
|
83665
|
-
const shown2 = (file2) =>
|
|
83774
|
+
const shown2 = (file2) => import_node_path47.default.relative(workspaceRoot ?? "", file2).split(import_node_path47.default.sep).join("/");
|
|
83666
83775
|
const detail = [...shared].map(([file2, chats]) => `${shown2(file2)} (${chats.join(", ")})`).join("; ");
|
|
83667
83776
|
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");
|
|
83668
83777
|
if (!all) {
|
|
@@ -83759,7 +83868,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83759
83868
|
...profile,
|
|
83760
83869
|
thinking: { ...profile.thinking ?? { level: agent.thinking }, level: agent.thinking }
|
|
83761
83870
|
};
|
|
83762
|
-
const provider = createChatProvider(seatProfile, httpClient, authStrategyFor(config2, profile), logger);
|
|
83871
|
+
const provider = createChatProvider(seatProfile, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
|
|
83763
83872
|
const extraTools = new Set(agent.role === "librarian" ? ["write_skill"] : []);
|
|
83764
83873
|
if (agent.canWrite) {
|
|
83765
83874
|
extraTools.add("write_to_file");
|
|
@@ -83814,7 +83923,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83814
83923
|
return void 0;
|
|
83815
83924
|
}
|
|
83816
83925
|
return async (request) => {
|
|
83817
|
-
const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger);
|
|
83926
|
+
const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
|
|
83818
83927
|
let text = "";
|
|
83819
83928
|
for await (const chunk of provider.streamChat([{ role: "user", content: buildCodeGenerationPrompt(request) }], {
|
|
83820
83929
|
// No tools offered: it is being asked for a file, and offering tools invites it to use one.
|
|
@@ -83860,7 +83969,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83860
83969
|
const pathRequest = pendingPathApprovals.get(id);
|
|
83861
83970
|
userGate.resolve(id, "approve");
|
|
83862
83971
|
if (pathRequest !== void 0) {
|
|
83863
|
-
const folder =
|
|
83972
|
+
const folder = import_node_path47.default.dirname(pathRequest);
|
|
83864
83973
|
sessionPathGrants.add(normalizeForComparison(pathRequest));
|
|
83865
83974
|
if (scope === "folder" && !cachedReadRoots.includes(folder)) {
|
|
83866
83975
|
const { config: config2 } = await configManager.load();
|
|
@@ -84100,10 +84209,10 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84100
84209
|
});
|
|
84101
84210
|
return;
|
|
84102
84211
|
}
|
|
84103
|
-
let dir =
|
|
84212
|
+
let dir = import_node_path47.default.dirname(import_node_path47.default.resolve(scriptPath));
|
|
84104
84213
|
for (let depth = 0; depth < 3; depth++) {
|
|
84105
84214
|
for (const name of VENV_DIR_NAMES) {
|
|
84106
|
-
const candidate =
|
|
84215
|
+
const candidate = import_node_path47.default.join(dir, name);
|
|
84107
84216
|
const found2 = await search(candidate);
|
|
84108
84217
|
if (found2 !== void 0) {
|
|
84109
84218
|
post({
|
|
@@ -84115,7 +84224,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84115
84224
|
return;
|
|
84116
84225
|
}
|
|
84117
84226
|
}
|
|
84118
|
-
const parent =
|
|
84227
|
+
const parent = import_node_path47.default.dirname(dir);
|
|
84119
84228
|
if (parent === dir)
|
|
84120
84229
|
break;
|
|
84121
84230
|
dir = parent;
|
|
@@ -84605,7 +84714,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84605
84714
|
reportFailure("handleClearAssessment", handleClearAssessment(message4.model, message4.profileLabel));
|
|
84606
84715
|
} else if (message4.type === "restartScheduler") {
|
|
84607
84716
|
restartScheduleTimer();
|
|
84608
|
-
|
|
84717
|
+
if (services.runsSchedules !== false)
|
|
84718
|
+
logger.info("schedule timer restarted by the user");
|
|
84609
84719
|
reportFailure("postSchedules", postSchedules());
|
|
84610
84720
|
} else if (message4.type === "deleteScheduleRun") {
|
|
84611
84721
|
reportFailure("handleDeleteScheduleRun", handleDeleteScheduleRun(message4.id, message4.at));
|
|
@@ -84929,11 +85039,11 @@ Could not be drawn: ${entry.message}`);
|
|
|
84929
85039
|
let lastReportPath;
|
|
84930
85040
|
async function saveReport(title, contents) {
|
|
84931
85041
|
try {
|
|
84932
|
-
const directory =
|
|
85042
|
+
const directory = import_node_path47.default.join(storageDir, "reports");
|
|
84933
85043
|
await import_promises25.default.mkdir(directory, { recursive: true });
|
|
84934
85044
|
const stamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
84935
85045
|
const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
|
|
84936
|
-
const target =
|
|
85046
|
+
const target = import_node_path47.default.join(directory, `${stamp2}${slug.length > 0 ? `-${slug}` : ""}.md`);
|
|
84937
85047
|
await import_promises25.default.writeFile(target, `# ${title}
|
|
84938
85048
|
|
|
84939
85049
|
${contents}
|
|
@@ -84949,7 +85059,7 @@ ${contents}
|
|
|
84949
85059
|
const keep = 100;
|
|
84950
85060
|
const entries = (await import_promises25.default.readdir(directory)).filter((name) => name.endsWith(".md")).sort();
|
|
84951
85061
|
for (const name of entries.slice(0, Math.max(0, entries.length - keep))) {
|
|
84952
|
-
await import_promises25.default.rm(
|
|
85062
|
+
await import_promises25.default.rm(import_node_path47.default.join(directory, name), { force: true });
|
|
84953
85063
|
}
|
|
84954
85064
|
}
|
|
84955
85065
|
let scheduleTimer;
|
|
@@ -85010,7 +85120,8 @@ ${contents}
|
|
|
85010
85120
|
...runningScheduleId !== void 0 ? { runningId: runningScheduleId } : {},
|
|
85011
85121
|
scheduler: {
|
|
85012
85122
|
running: scheduleTimer !== void 0,
|
|
85013
|
-
...lastScheduleTickAt === void 0 ? {} : { lastTickAt: lastScheduleTickAt }
|
|
85123
|
+
...lastScheduleTickAt === void 0 ? {} : { lastTickAt: lastScheduleTickAt },
|
|
85124
|
+
...services.runsSchedules === false ? { elsewhere: true } : {}
|
|
85014
85125
|
}
|
|
85015
85126
|
});
|
|
85016
85127
|
}
|
|
@@ -85061,10 +85172,10 @@ ${contents}
|
|
|
85061
85172
|
}
|
|
85062
85173
|
const CLAIM_STALE_MS = 60 * 60 * 1e3;
|
|
85063
85174
|
async function claimSchedule(id) {
|
|
85064
|
-
const claimPath =
|
|
85175
|
+
const claimPath = import_node_path47.default.join(storageDir, "schedule-claims", `${id}.json`);
|
|
85065
85176
|
const mine = JSON.stringify({ pid: process.pid, at: Date.now() });
|
|
85066
85177
|
try {
|
|
85067
|
-
await import_promises25.default.mkdir(
|
|
85178
|
+
await import_promises25.default.mkdir(import_node_path47.default.dirname(claimPath), { recursive: true });
|
|
85068
85179
|
await import_promises25.default.writeFile(claimPath, mine, { encoding: "utf8", flag: "wx" });
|
|
85069
85180
|
return true;
|
|
85070
85181
|
} catch (error51) {
|
|
@@ -85089,7 +85200,7 @@ ${contents}
|
|
|
85089
85200
|
}
|
|
85090
85201
|
}
|
|
85091
85202
|
async function releaseSchedule(id) {
|
|
85092
|
-
await import_promises25.default.rm(
|
|
85203
|
+
await import_promises25.default.rm(import_node_path47.default.join(storageDir, "schedule-claims", `${id}.json`), { force: true }).catch(() => void 0);
|
|
85093
85204
|
}
|
|
85094
85205
|
async function runSchedule(id, reason) {
|
|
85095
85206
|
if (reason === "due" && !await claimSchedule(id))
|
|
@@ -85290,6 +85401,8 @@ ${contents}
|
|
|
85290
85401
|
return "";
|
|
85291
85402
|
}
|
|
85292
85403
|
function restartScheduleTimer() {
|
|
85404
|
+
if (services.runsSchedules === false)
|
|
85405
|
+
return;
|
|
85293
85406
|
if (scheduleTimer !== void 0) {
|
|
85294
85407
|
clearInterval(scheduleTimer);
|
|
85295
85408
|
scheduleTimer = void 0;
|
|
@@ -85755,11 +85868,11 @@ function createShowDiagramTool() {
|
|
|
85755
85868
|
|
|
85756
85869
|
// ../../packages/core/dist/lsp/manager.js
|
|
85757
85870
|
var import_promises26 = __toESM(require("node:fs/promises"), 1);
|
|
85758
|
-
var
|
|
85871
|
+
var import_node_path49 = __toESM(require("node:path"), 1);
|
|
85759
85872
|
|
|
85760
85873
|
// ../../packages/core/dist/lsp/catalog.js
|
|
85761
|
-
var
|
|
85762
|
-
var
|
|
85874
|
+
var import_node_fs11 = require("node:fs");
|
|
85875
|
+
var import_node_path48 = __toESM(require("node:path"), 1);
|
|
85763
85876
|
var c = (command, ...args) => ({ command, args });
|
|
85764
85877
|
var LSP_LANGUAGES = [
|
|
85765
85878
|
{ id: "python", label: "Python", extensions: ["py", "pyi"], candidates: [c("pyright-langserver", "--stdio"), c("basedpyright-langserver", "--stdio"), c("pylsp"), c("jedi-language-server")] },
|
|
@@ -85807,17 +85920,17 @@ var LSP_LANGUAGES = [
|
|
|
85807
85920
|
{ id: "sql", label: "SQL", extensions: ["sql"], candidates: [c("sql-language-server", "up", "--method", "stdio")] }
|
|
85808
85921
|
];
|
|
85809
85922
|
function languageFor(file2) {
|
|
85810
|
-
const ext =
|
|
85923
|
+
const ext = import_node_path48.default.extname(file2).slice(1).toLowerCase();
|
|
85811
85924
|
return LSP_LANGUAGES.find((l) => l.extensions.includes(ext));
|
|
85812
85925
|
}
|
|
85813
85926
|
function languageIdFor(language, file2) {
|
|
85814
|
-
const ext =
|
|
85927
|
+
const ext = import_node_path48.default.extname(file2).slice(1).toLowerCase();
|
|
85815
85928
|
return language.languageIdFor?.(ext) ?? language.id;
|
|
85816
85929
|
}
|
|
85817
85930
|
var found = /* @__PURE__ */ new Map();
|
|
85818
85931
|
function findOnPath(command, env2 = process.env) {
|
|
85819
|
-
if (
|
|
85820
|
-
return (0,
|
|
85932
|
+
if (import_node_path48.default.isAbsolute(command))
|
|
85933
|
+
return (0, import_node_fs11.existsSync)(command) ? command : void 0;
|
|
85821
85934
|
if (env2 !== process.env)
|
|
85822
85935
|
return searchPath(command, env2);
|
|
85823
85936
|
const hit = found.get(command);
|
|
@@ -85828,12 +85941,12 @@ function findOnPath(command, env2 = process.env) {
|
|
|
85828
85941
|
return value;
|
|
85829
85942
|
}
|
|
85830
85943
|
function searchPath(command, env2) {
|
|
85831
|
-
const dirs = (env2.PATH ?? env2.Path ?? "").split(
|
|
85944
|
+
const dirs = (env2.PATH ?? env2.Path ?? "").split(import_node_path48.default.delimiter).filter((d) => d.length > 0);
|
|
85832
85945
|
const exts = process.platform === "win32" ? ["", ...(env2.PATHEXT ?? ".EXE;.CMD;.BAT").toLowerCase().split(";")] : [""];
|
|
85833
85946
|
for (const dir of dirs) {
|
|
85834
85947
|
for (const ext of exts) {
|
|
85835
|
-
const candidate =
|
|
85836
|
-
if ((0,
|
|
85948
|
+
const candidate = import_node_path48.default.join(dir, command + ext);
|
|
85949
|
+
if ((0, import_node_fs11.existsSync)(candidate) && (process.platform !== "win32" || ext !== "" || /\.(exe|cmd|bat)$/i.test(candidate)))
|
|
85837
85950
|
return candidate;
|
|
85838
85951
|
}
|
|
85839
85952
|
}
|
|
@@ -85841,7 +85954,7 @@ function searchPath(command, env2) {
|
|
|
85841
85954
|
}
|
|
85842
85955
|
|
|
85843
85956
|
// ../../packages/core/dist/lsp/client.js
|
|
85844
|
-
var
|
|
85957
|
+
var import_node_child_process15 = require("node:child_process");
|
|
85845
85958
|
var import_node_url = require("node:url");
|
|
85846
85959
|
function keyFor(uri) {
|
|
85847
85960
|
try {
|
|
@@ -85871,7 +85984,7 @@ var LspClient = class {
|
|
|
85871
85984
|
this.root = root;
|
|
85872
85985
|
this.log = log;
|
|
85873
85986
|
const shim = /\.(cmd|bat)$/i.test(executable);
|
|
85874
|
-
this.child = shim ? (0,
|
|
85987
|
+
this.child = shim ? (0, import_node_child_process15.spawn)(process.env.ComSpec ?? "cmd.exe", ["/d", "/s", "/c", `"${executable}"`, ...args], { cwd: root, windowsHide: true, windowsVerbatimArguments: true }) : (0, import_node_child_process15.spawn)(executable, args, { cwd: root, windowsHide: true });
|
|
85875
85988
|
this.child.stdout?.on("data", (chunk) => this.onData(chunk));
|
|
85876
85989
|
this.child.stderr?.on("data", (chunk) => {
|
|
85877
85990
|
const text = chunk.toString("utf8").trim();
|
|
@@ -86064,7 +86177,7 @@ var LspManager = class {
|
|
|
86064
86177
|
return void 0;
|
|
86065
86178
|
const args = [...found2.candidate.args];
|
|
86066
86179
|
if (language.id === "java" && !args.includes("-data"))
|
|
86067
|
-
args.push("-data",
|
|
86180
|
+
args.push("-data", import_node_path49.default.join(this.storageDir, "jdtls-workspace"));
|
|
86068
86181
|
try {
|
|
86069
86182
|
client = new LspClient(found2.executable, args, this.root, this.log);
|
|
86070
86183
|
this.clients.set(language.id, client);
|
|
@@ -86085,7 +86198,7 @@ var LspManager = class {
|
|
|
86085
86198
|
this.failed.set(language.id, client.lastError ?? "stopped");
|
|
86086
86199
|
return void 0;
|
|
86087
86200
|
}
|
|
86088
|
-
return { server:
|
|
86201
|
+
return { server: import_node_path49.default.basename(client.executable).replace(/\.(exe|cmd|bat)$/i, ""), diagnostics: diagnostics ?? [] };
|
|
86089
86202
|
} catch (error51) {
|
|
86090
86203
|
this.failed.set(language.id, error51 instanceof Error ? error51.message : String(error51));
|
|
86091
86204
|
client.dispose();
|
|
@@ -86727,7 +86840,8 @@ Folders you always want readable go in config:filesystem.readRoots.
|
|
|
86727
86840
|
],
|
|
86728
86841
|
body: `
|
|
86729
86842
|
**Settings \u2192 Providers.** Several named profiles, switchable from the composer. Three wire
|
|
86730
|
-
formats: OpenAI-compatible, Anthropic Messages, and Gemini
|
|
86843
|
+
formats: OpenAI-compatible, Anthropic Messages, and Gemini - plus **GitHub Copilot from VS Code**
|
|
86844
|
+
(see the GitHub Copilot topic). Presets prefill a base URL and wire
|
|
86731
86845
|
format; every field stays editable and no endpoint is hardcoded.
|
|
86732
86846
|
|
|
86733
86847
|
The profile list is config:profiles and the active one config:activeProfileId. Both are user-scope
|
|
@@ -86763,6 +86877,49 @@ diagnosis.
|
|
|
86763
86877
|
|
|
86764
86878
|
**Behind a proxy?** Settings \u2192 Network reports what the environment says. A corporate root CA that
|
|
86765
86879
|
your proxy presents goes in the same place; adding one does not cost you the public roots.
|
|
86880
|
+
`
|
|
86881
|
+
},
|
|
86882
|
+
{
|
|
86883
|
+
id: "github-copilot",
|
|
86884
|
+
title: "GitHub Copilot as the model",
|
|
86885
|
+
keywords: [
|
|
86886
|
+
"copilot",
|
|
86887
|
+
"github copilot",
|
|
86888
|
+
"github",
|
|
86889
|
+
"use copilot",
|
|
86890
|
+
"copilot model",
|
|
86891
|
+
"reuse copilot",
|
|
86892
|
+
"vs code models",
|
|
86893
|
+
"language model api",
|
|
86894
|
+
"copilot in fire code",
|
|
86895
|
+
"copilot subscription",
|
|
86896
|
+
"premium requests"
|
|
86897
|
+
],
|
|
86898
|
+
body: `
|
|
86899
|
+
If GitHub Copilot is signed in to in VS Code, Light Code can use it as its model. **Settings \u2192 Providers
|
|
86900
|
+
\u2192 Add \u2192 Preset: GitHub Copilot (from VS Code)**, then pick a model from the list - the models your
|
|
86901
|
+
Copilot plan offers (GPT, Claude, Gemini and others, as your organisation's Copilot policy allows).
|
|
86902
|
+
There is no key, URL or certificate to enter.
|
|
86903
|
+
|
|
86904
|
+
**How it works:** through VS Code's own Language Model API. VS Code makes every request with Copilot's
|
|
86905
|
+
sign-in; Light Code never sees a GitHub token. The **first request asks in VS Code** whether Light Code
|
|
86906
|
+
may use Copilot - choose Allow. If it was refused, "Manage Language Model Access" in VS Code's Accounts
|
|
86907
|
+
menu changes it. Requests count against your Copilot plan (including premium requests), and Copilot's
|
|
86908
|
+
own limits apply: each model's input limit is read from VS Code, and context is compacted to it.
|
|
86909
|
+
|
|
86910
|
+
**In Fire Code, the Light Code host and the JetBrains plugin** (on the same machine): the same preset,
|
|
86911
|
+
but those apps are not VS Code, so their requests are relayed through a **VS Code window that is open
|
|
86912
|
+
with the Light Code extension** (0.161.0 or later). Close every VS Code window and Copilot profiles there
|
|
86913
|
+
say so. The relay is a local pipe that only your Windows account can use: each window writes a random
|
|
86914
|
+
token into your own profile folder, and every request must carry it. Not on a shared server
|
|
86915
|
+
(\`--server\`).
|
|
86916
|
+
|
|
86917
|
+
**Needs** a VS Code recent enough for tool calling with language models (roughly 1.95 or later); on an
|
|
86918
|
+
older VS Code the preset is not offered. Pictures are passed only where VS Code supports it.
|
|
86919
|
+
|
|
86920
|
+
**Not done, deliberately:** reading Copilot's token and calling GitHub directly. That is an unofficial
|
|
86921
|
+
interface, against GitHub's terms for other clients, and the kind of thing a managed machine raises an
|
|
86922
|
+
alert about.
|
|
86766
86923
|
`
|
|
86767
86924
|
},
|
|
86768
86925
|
{
|
|
@@ -87743,10 +87900,13 @@ Node. It runs once per install.
|
|
|
87743
87900
|
|
|
87744
87901
|
**People instead of login names.** On a Windows machine on a company domain, names come from the
|
|
87745
87902
|
**company directory** first - display name, email, department (shown as the team), title and office -
|
|
87746
|
-
read
|
|
87747
|
-
on a skill or tool
|
|
87748
|
-
|
|
87749
|
-
|
|
87903
|
+
read as you (Windows' own sign-in, nothing to configure). In the background only **you** are looked up;
|
|
87904
|
+
every author named on a skill or tool and every colleague in the numbers are looked up when the dashboard
|
|
87905
|
+
is opened. The Rust helper reads the directory through Windows' own LDAP client - Fire Code's, or the one
|
|
87906
|
+
the Windows VS Code package carries. **PowerShell is never used for it**: that way raised a security alert
|
|
87907
|
+
on a managed machine. With no helper (a plain Node host without Fire Code, or not Windows) the directory
|
|
87908
|
+
is simply not used. Only searches, only those fields, only while usage is collected; answers are kept for
|
|
87909
|
+
30 days. Off a domain, or for someone the directory does not list, the
|
|
87750
87910
|
**second way** is used: if a tool that looks users up is available - an MCP or Python tool named like
|
|
87751
87911
|
\`whoami\`, \`user_info\` or \`employee_lookup\`, the one named in the panel, or failing those a
|
|
87752
87912
|
**skill** named like \`who-am-i\` or \`user-info\` that describes how - the assistant does it once
|
|
@@ -87852,10 +88012,13 @@ delete those from Settings \u2192 Skills or Python.
|
|
|
87852
88012
|
"move files",
|
|
87853
88013
|
"zip",
|
|
87854
88014
|
"vs code rust",
|
|
87855
|
-
"tools in vs code"
|
|
88015
|
+
"tools in vs code",
|
|
88016
|
+
"bundled helper",
|
|
88017
|
+
"without fire code"
|
|
87856
88018
|
],
|
|
87857
88019
|
body: `
|
|
87858
|
-
|
|
88020
|
+
A Rust helper (\`fire-fs.exe\`) runs file and data work on every CPU core. Fire Code ships the full one;
|
|
88021
|
+
the Windows VS Code package carries a slim one with every tool below except \`dataframe\`. Its tools:
|
|
87859
88022
|
|
|
87860
88023
|
- \`find_files\` - find files by name, type, size or date across drives and shares; summarise a folder; find
|
|
87861
88024
|
duplicate files by content.
|
|
@@ -87875,11 +88038,13 @@ Fire Code ships a Rust helper (\`fire-fs.exe\`) that runs file and data work on
|
|
|
87875
88038
|
|
|
87876
88039
|
**Where they are available**
|
|
87877
88040
|
- **Fire Code**: always.
|
|
87878
|
-
- **VS Code
|
|
87879
|
-
extension
|
|
87880
|
-
|
|
87881
|
-
|
|
87882
|
-
|
|
88041
|
+
- **VS Code on Windows**: always - every tool but \`dataframe\`, from the helper bundled with the
|
|
88042
|
+
extension. With Fire Code installed on the same machine, its full helper is used instead and
|
|
88043
|
+
\`dataframe\` is there too. Nothing to configure; reload the VS Code window after installing or
|
|
88044
|
+
updating Fire Code.
|
|
88045
|
+
- **\`light-code\` run on its own (Node host)**: when Fire Code is installed on the same machine.
|
|
88046
|
+
- **Not**: on a shared server (\`--server\`), on a platform other than Windows, or in the Node host
|
|
88047
|
+
without Fire Code. There the built-in tools (read_file, search_files, list_files) do the work.
|
|
87883
88048
|
|
|
87884
88049
|
To see whether they are on right now, look at the tool list in Settings \u2192 Tools, or ask "which tools do
|
|
87885
88050
|
you have?" - the assistant answers from the tools it was actually given.
|
|
@@ -88177,7 +88342,8 @@ with a note saying so - whether the copies come from a bucket, a shared folder o
|
|
|
88177
88342
|
|
|
88178
88343
|
**Several chats per codebase**: the tabs above the chat. + (or Ctrl+T, or right-click \u2192 New chat) opens
|
|
88179
88344
|
another chat on the same codebase \u2014 its own agent, working at the same time, with the same settings and
|
|
88180
|
-
keys.
|
|
88345
|
+
keys. To rename a chat - the first one too - double-click its tab, or right-click it \u2192 Rename chat; the
|
|
88346
|
+
name shows on the tab and in notifications. \xD7 or Ctrl+W closes a chat (its history is kept). Two safeguards make
|
|
88181
88347
|
this safe: an edit is refused when the file changed since that chat read it (another chat, you, or any
|
|
88182
88348
|
program edited it) \u2014 the agent re-reads and edits what is there now; and **Rollback undoes only the files
|
|
88183
88349
|
that chat changed**, never another chat's work. If another chat also changed one of those files since,
|
|
@@ -88825,9 +88991,18 @@ walkthrough, whose steps link straight into the tab each one is about. On the No
|
|
|
88825
88991
|
"other window",
|
|
88826
88992
|
"second window",
|
|
88827
88993
|
"not reflecting",
|
|
88828
|
-
"not showing"
|
|
88994
|
+
"not showing",
|
|
88995
|
+
"greyed out",
|
|
88996
|
+
"grayed out",
|
|
88997
|
+
"disabled",
|
|
88998
|
+
"cannot click",
|
|
88999
|
+
"not clickable"
|
|
88829
89000
|
],
|
|
88830
89001
|
body: `
|
|
89002
|
+
**A button is greyed out.** Hover over it: every control that can be disabled says why in its
|
|
89003
|
+
tooltip - nothing changed since the last save, a field still empty, a reply still running, a
|
|
89004
|
+
feature switched off elsewhere - and usually what to do about it.
|
|
89005
|
+
|
|
88831
89006
|
**"EPERM" (or EBUSY) naming config.json when saving.** On Windows a file cannot be replaced while
|
|
88832
89007
|
another program has it open \u2014 another VS Code window loading the same settings, antivirus checking
|
|
88833
89008
|
the write that just happened, or OneDrive syncing the folder. Saves retry for a few seconds, which
|
|
@@ -89081,8 +89256,8 @@ function createLightCodeHelpTool() {
|
|
|
89081
89256
|
}
|
|
89082
89257
|
|
|
89083
89258
|
// ../../packages/core/dist/tools/listFiles.js
|
|
89084
|
-
var
|
|
89085
|
-
var
|
|
89259
|
+
var import_node_child_process16 = require("node:child_process");
|
|
89260
|
+
var import_node_path50 = __toESM(require("node:path"), 1);
|
|
89086
89261
|
|
|
89087
89262
|
// ../../packages/core/dist/tools/ripgrepError.js
|
|
89088
89263
|
function ripgrepDidNotStart(error51) {
|
|
@@ -89115,7 +89290,7 @@ function isRipgrepNoMatchError(error51) {
|
|
|
89115
89290
|
}
|
|
89116
89291
|
function runRipgrepFiles(rgPath, dir, signal, includeIgnored) {
|
|
89117
89292
|
return new Promise((resolve, reject2) => {
|
|
89118
|
-
(0,
|
|
89293
|
+
(0, import_node_child_process16.execFile)(rgPath, [
|
|
89119
89294
|
"--files",
|
|
89120
89295
|
"--hidden",
|
|
89121
89296
|
...includeIgnored ? ["--no-ignore-vcs"] : [],
|
|
@@ -89163,7 +89338,7 @@ var listFilesTool = {
|
|
|
89163
89338
|
});
|
|
89164
89339
|
if (files.length === 0)
|
|
89165
89340
|
return noFiles;
|
|
89166
|
-
const listed = files.map((file2) => file2.split("/").join(
|
|
89341
|
+
const listed = files.map((file2) => file2.split("/").join(import_node_path50.default.sep)).join("\n");
|
|
89167
89342
|
return { content: truncated ? `${listed}
|
|
89168
89343
|
(listing cut short \u2014 list a narrower folder)` : listed };
|
|
89169
89344
|
}
|
|
@@ -89324,7 +89499,7 @@ var readDocumentTool = {
|
|
|
89324
89499
|
};
|
|
89325
89500
|
|
|
89326
89501
|
// ../../packages/core/dist/tools/searchFiles.js
|
|
89327
|
-
var
|
|
89502
|
+
var import_node_child_process17 = require("node:child_process");
|
|
89328
89503
|
var paramsSchema22 = external_exports.object({
|
|
89329
89504
|
path: external_exports.string().min(1).default(".").describe("Directory to search, relative to the workspace root."),
|
|
89330
89505
|
pattern: external_exports.string().min(1).describe("Regular expression to search for."),
|
|
@@ -89343,7 +89518,7 @@ function runRipgrepSearch(rgPath, dir, pattern, filePattern, signal, includeIgno
|
|
|
89343
89518
|
args.push("-g", filePattern);
|
|
89344
89519
|
args.push("--regexp", pattern, ".");
|
|
89345
89520
|
return new Promise((resolve, reject2) => {
|
|
89346
|
-
(0,
|
|
89521
|
+
(0, import_node_child_process17.execFile)(rgPath, args, { cwd: dir, signal, maxBuffer: 10 * 1024 * 1024 }, (error51, stdout) => {
|
|
89347
89522
|
if (error51 && !isRipgrepNoMatchError2(error51)) {
|
|
89348
89523
|
reject2(error51);
|
|
89349
89524
|
return;
|
|
@@ -89391,7 +89566,7 @@ var searchFilesTool = {
|
|
|
89391
89566
|
};
|
|
89392
89567
|
|
|
89393
89568
|
// ../../packages/core/dist/tools/writeToFile.js
|
|
89394
|
-
var
|
|
89569
|
+
var import_node_path51 = __toESM(require("node:path"), 1);
|
|
89395
89570
|
var paramsSchema23 = external_exports.object({
|
|
89396
89571
|
path: external_exports.string().min(1).describe("Path to the file, relative to the workspace root."),
|
|
89397
89572
|
content: external_exports.string().describe("Full file content to write.")
|
|
@@ -89419,7 +89594,7 @@ var writeToFileTool = {
|
|
|
89419
89594
|
return { content: changed, isError: true, path: params3.path };
|
|
89420
89595
|
}
|
|
89421
89596
|
if (!exists2) {
|
|
89422
|
-
await context.fs.mkdir(
|
|
89597
|
+
await context.fs.mkdir(import_node_path51.default.dirname(resolved.realPath));
|
|
89423
89598
|
}
|
|
89424
89599
|
await context.fs.writeFile(resolved.realPath, params3.content);
|
|
89425
89600
|
await recordWrite(context, resolved.realPath);
|
|
@@ -89521,14 +89696,14 @@ function createDefaultToolRegistry() {
|
|
|
89521
89696
|
|
|
89522
89697
|
// ../../packages/core/dist/dataset/store.js
|
|
89523
89698
|
var import_promises27 = __toESM(require("node:fs/promises"), 1);
|
|
89524
|
-
var
|
|
89699
|
+
var import_node_path52 = __toESM(require("node:path"), 1);
|
|
89525
89700
|
var DatasetStore = class {
|
|
89526
89701
|
filePath;
|
|
89527
89702
|
statePath;
|
|
89528
89703
|
constructor(storageDir, datasetId) {
|
|
89529
89704
|
const safe = datasetId.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
89530
|
-
this.filePath =
|
|
89531
|
-
this.statePath =
|
|
89705
|
+
this.filePath = import_node_path52.default.join(storageDir, "datasets", `${safe}.jsonl`);
|
|
89706
|
+
this.statePath = import_node_path52.default.join(storageDir, "datasets", `${safe}.state.json`);
|
|
89532
89707
|
}
|
|
89533
89708
|
/** Every record. A malformed line is skipped — one bad line costs one record, not the corpus. */
|
|
89534
89709
|
async load() {
|
|
@@ -89556,7 +89731,7 @@ var DatasetStore = class {
|
|
|
89556
89731
|
async append(records) {
|
|
89557
89732
|
if (records.length === 0)
|
|
89558
89733
|
return;
|
|
89559
|
-
await import_promises27.default.mkdir(
|
|
89734
|
+
await import_promises27.default.mkdir(import_node_path52.default.dirname(this.filePath), { recursive: true });
|
|
89560
89735
|
await import_promises27.default.writeFile(this.filePath, "", { flag: "a" });
|
|
89561
89736
|
const lines = records.map((record2) => JSON.stringify(record2)).join("\n");
|
|
89562
89737
|
await import_promises27.default.appendFile(this.filePath, `${lines}
|
|
@@ -89564,7 +89739,7 @@ var DatasetStore = class {
|
|
|
89564
89739
|
}
|
|
89565
89740
|
/** Rewrites with exactly these. Temp-and-rename, so an interrupted prune leaves the old file. */
|
|
89566
89741
|
async replace(records) {
|
|
89567
|
-
await import_promises27.default.mkdir(
|
|
89742
|
+
await import_promises27.default.mkdir(import_node_path52.default.dirname(this.filePath), { recursive: true });
|
|
89568
89743
|
const temporary = `${this.filePath}.tmp`;
|
|
89569
89744
|
const body = records.map((record2) => JSON.stringify(record2)).join("\n");
|
|
89570
89745
|
await import_promises27.default.writeFile(temporary, records.length === 0 ? "" : `${body}
|
|
@@ -89618,7 +89793,7 @@ var DatasetStore = class {
|
|
|
89618
89793
|
}
|
|
89619
89794
|
}
|
|
89620
89795
|
async recordSync(at) {
|
|
89621
|
-
await import_promises27.default.mkdir(
|
|
89796
|
+
await import_promises27.default.mkdir(import_node_path52.default.dirname(this.statePath), { recursive: true });
|
|
89622
89797
|
const temporary = `${this.statePath}.tmp`;
|
|
89623
89798
|
await import_promises27.default.writeFile(temporary, JSON.stringify({ lastSyncedAt: at }), "utf8");
|
|
89624
89799
|
await replaceFile(temporary, this.statePath);
|
|
@@ -90048,8 +90223,8 @@ var S3Client = class {
|
|
|
90048
90223
|
const host = inPath ? origin.host : `${bucket}.${origin.host}`;
|
|
90049
90224
|
const mount = origin.pathname === "/" ? "" : origin.pathname.replace(/\/+$/, "");
|
|
90050
90225
|
const prefix = inPath ? `${mount}/${bucket}` : mount;
|
|
90051
|
-
const
|
|
90052
|
-
const url2 = new URL(`${origin.protocol}//${host}${prefix}${
|
|
90226
|
+
const path58 = key2 === "" ? "" : `/${key2.split("/").map((part) => encodeURIComponent(part)).join("/")}`;
|
|
90227
|
+
const url2 = new URL(`${origin.protocol}//${host}${prefix}${path58}`);
|
|
90053
90228
|
for (const [name, value] of Object.entries(call.query ?? {}))
|
|
90054
90229
|
url2.searchParams.set(name, value);
|
|
90055
90230
|
return url2.toString();
|
|
@@ -90594,7 +90769,7 @@ async function removeSkillFromBucket(options) {
|
|
|
90594
90769
|
}
|
|
90595
90770
|
|
|
90596
90771
|
// src/reachableHosts.ts
|
|
90597
|
-
var
|
|
90772
|
+
var import_node_os7 = __toESM(require("node:os"), 1);
|
|
90598
90773
|
function reachableHosts(bindAddress, port, extra = []) {
|
|
90599
90774
|
const names = /* @__PURE__ */ new Set();
|
|
90600
90775
|
const add = (name) => {
|
|
@@ -90608,8 +90783,8 @@ function reachableHosts(bindAddress, port, extra = []) {
|
|
|
90608
90783
|
if (!wildcard) {
|
|
90609
90784
|
add(bindAddress);
|
|
90610
90785
|
} else {
|
|
90611
|
-
add(
|
|
90612
|
-
for (const entries of Object.values(
|
|
90786
|
+
add(import_node_os7.default.hostname());
|
|
90787
|
+
for (const entries of Object.values(import_node_os7.default.networkInterfaces())) {
|
|
90613
90788
|
for (const entry of entries ?? []) {
|
|
90614
90789
|
if (entry.internal) continue;
|
|
90615
90790
|
add(entry.family === "IPv6" ? `[${entry.address}]` : entry.address);
|
|
@@ -90991,7 +91166,7 @@ async function readJsonBody(request, maxBytes = 32 * 1024 * 1024) {
|
|
|
90991
91166
|
|
|
90992
91167
|
// src/fileSecretStore.ts
|
|
90993
91168
|
var import_promises28 = __toESM(require("node:fs/promises"), 1);
|
|
90994
|
-
var
|
|
91169
|
+
var import_node_path53 = __toESM(require("node:path"), 1);
|
|
90995
91170
|
|
|
90996
91171
|
// src/vaultCrypto.ts
|
|
90997
91172
|
var import_node_crypto17 = require("node:crypto");
|
|
@@ -91089,7 +91264,7 @@ var FileSecretStore = class {
|
|
|
91089
91264
|
);
|
|
91090
91265
|
}
|
|
91091
91266
|
mutate(secrets);
|
|
91092
|
-
await import_promises28.default.mkdir(
|
|
91267
|
+
await import_promises28.default.mkdir(import_node_path53.default.dirname(this.filePath), { recursive: true });
|
|
91093
91268
|
const temp = `${this.filePath}.${process.pid}.tmp`;
|
|
91094
91269
|
const body = this.key === void 0 ? secrets : sealSecrets(secrets, this.key);
|
|
91095
91270
|
await import_promises28.default.writeFile(temp, JSON.stringify(body, null, 2), { encoding: "utf8", mode: 384 });
|
|
@@ -91126,7 +91301,7 @@ var FileSecretStore = class {
|
|
|
91126
91301
|
// src/reviewQueue.ts
|
|
91127
91302
|
var import_node_crypto18 = __toESM(require("node:crypto"), 1);
|
|
91128
91303
|
var import_promises29 = __toESM(require("node:fs/promises"), 1);
|
|
91129
|
-
var
|
|
91304
|
+
var import_node_path54 = __toESM(require("node:path"), 1);
|
|
91130
91305
|
var ReviewQueue = class {
|
|
91131
91306
|
constructor(filePath) {
|
|
91132
91307
|
this.filePath = filePath;
|
|
@@ -91145,7 +91320,7 @@ var ReviewQueue = class {
|
|
|
91145
91320
|
}
|
|
91146
91321
|
async persist(items) {
|
|
91147
91322
|
this.cache = items;
|
|
91148
|
-
await import_promises29.default.mkdir(
|
|
91323
|
+
await import_promises29.default.mkdir(import_node_path54.default.dirname(this.filePath), { recursive: true });
|
|
91149
91324
|
const temporary = `${this.filePath}.tmp`;
|
|
91150
91325
|
await import_promises29.default.writeFile(temporary, JSON.stringify(items, null, 2), { encoding: "utf8", mode: 384 });
|
|
91151
91326
|
await replaceFile(temporary, this.filePath);
|
|
@@ -91386,8 +91561,8 @@ var RoutedSecretStore = class {
|
|
|
91386
91561
|
|
|
91387
91562
|
// src/userVariables.ts
|
|
91388
91563
|
var import_promises30 = __toESM(require("node:fs/promises"), 1);
|
|
91389
|
-
var
|
|
91390
|
-
var
|
|
91564
|
+
var import_node_fs12 = require("node:fs");
|
|
91565
|
+
var import_node_path55 = __toESM(require("node:path"), 1);
|
|
91391
91566
|
var UserVariableStore = class {
|
|
91392
91567
|
constructor(filePath) {
|
|
91393
91568
|
this.filePath = filePath;
|
|
@@ -91402,7 +91577,7 @@ var UserVariableStore = class {
|
|
|
91402
91577
|
}
|
|
91403
91578
|
async save(variables) {
|
|
91404
91579
|
const parsed = sessionVariablesSchema.parse(variables);
|
|
91405
|
-
await import_promises30.default.mkdir(
|
|
91580
|
+
await import_promises30.default.mkdir(import_node_path55.default.dirname(this.filePath), { recursive: true });
|
|
91406
91581
|
const temporary = `${this.filePath}.tmp`;
|
|
91407
91582
|
await import_promises30.default.writeFile(temporary, JSON.stringify({ variables: parsed }, null, 2), {
|
|
91408
91583
|
encoding: "utf8",
|
|
@@ -91413,14 +91588,14 @@ var UserVariableStore = class {
|
|
|
91413
91588
|
}
|
|
91414
91589
|
};
|
|
91415
91590
|
function userVariableStoreFor(dataDir, principal) {
|
|
91416
|
-
return new UserVariableStore(userVariablesPath(
|
|
91591
|
+
return new UserVariableStore(userVariablesPath(import_node_path55.default.join(dataDir, "users", storageKeyFor(principal))));
|
|
91417
91592
|
}
|
|
91418
91593
|
function userVariablesPath(userDir) {
|
|
91419
|
-
return
|
|
91594
|
+
return import_node_path55.default.join(userDir, "variables.json");
|
|
91420
91595
|
}
|
|
91421
91596
|
function readVariablesFile(filePath) {
|
|
91422
91597
|
try {
|
|
91423
|
-
const raw = JSON.parse((0,
|
|
91598
|
+
const raw = JSON.parse((0, import_node_fs12.readFileSync)(filePath, "utf8"));
|
|
91424
91599
|
const parsed = sessionVariablesSchema.safeParse(raw["variables"]);
|
|
91425
91600
|
return parsed.success ? parsed.data : [];
|
|
91426
91601
|
} catch {
|
|
@@ -91444,13 +91619,13 @@ function hostedUser(env2 = process.env) {
|
|
|
91444
91619
|
}
|
|
91445
91620
|
|
|
91446
91621
|
// src/session.ts
|
|
91447
|
-
var
|
|
91622
|
+
var import_node_fs13 = require("node:fs");
|
|
91448
91623
|
var import_promises31 = __toESM(require("node:fs/promises"), 1);
|
|
91449
|
-
var
|
|
91624
|
+
var import_node_path57 = __toESM(require("node:path"), 1);
|
|
91450
91625
|
|
|
91451
91626
|
// src/credentialTool.ts
|
|
91452
|
-
var
|
|
91453
|
-
var
|
|
91627
|
+
var import_node_child_process18 = require("node:child_process");
|
|
91628
|
+
var import_node_path56 = __toESM(require("node:path"), 1);
|
|
91454
91629
|
var CREDENTIAL_PREFIX2 = "tool:";
|
|
91455
91630
|
var WRAPPER = [
|
|
91456
91631
|
"import importlib.util, json, sys",
|
|
@@ -91470,7 +91645,7 @@ async function fetchCredential(options, reference) {
|
|
|
91470
91645
|
if (name.length === 0) return { problem: "A credential reference needs a name: tool:<name>." };
|
|
91471
91646
|
const budget = options.timeoutMs ?? 3e4;
|
|
91472
91647
|
const run3 = await new Promise((resolve) => {
|
|
91473
|
-
const child = (0,
|
|
91648
|
+
const child = (0, import_node_child_process18.spawn)(options.interpreter, ["-c", WRAPPER, import_node_path56.default.resolve(options.file), name], {
|
|
91474
91649
|
windowsHide: true,
|
|
91475
91650
|
// The environment this was started in, as with the identity function: the libraries that
|
|
91476
91651
|
// hold credentials are configured through it, and nothing here is model-authored.
|
|
@@ -91666,7 +91841,7 @@ var FileConfigStore = class {
|
|
|
91666
91841
|
const filePath = this.pathFor(scope);
|
|
91667
91842
|
if (filePath === void 0)
|
|
91668
91843
|
throw new Error(`Cannot write ${scope} config: no workspace is open`);
|
|
91669
|
-
await import_promises31.default.mkdir(
|
|
91844
|
+
await import_promises31.default.mkdir(import_node_path57.default.dirname(filePath), { recursive: true });
|
|
91670
91845
|
const temporary = `${filePath}.${process.pid.toString(36)}.tmp`;
|
|
91671
91846
|
await import_promises31.default.writeFile(temporary, contents, { encoding: "utf8", mode: 384 });
|
|
91672
91847
|
await replaceFile(temporary, filePath);
|
|
@@ -91703,8 +91878,8 @@ var FileConfigStore = class {
|
|
|
91703
91878
|
};
|
|
91704
91879
|
let watcher;
|
|
91705
91880
|
try {
|
|
91706
|
-
watcher = (0,
|
|
91707
|
-
if (filename ===
|
|
91881
|
+
watcher = (0, import_node_fs13.watch)(import_node_path57.default.dirname(filePath), (_event, filename) => {
|
|
91882
|
+
if (filename === import_node_path57.default.basename(filePath)) onChange();
|
|
91708
91883
|
});
|
|
91709
91884
|
} catch {
|
|
91710
91885
|
}
|
|
@@ -91732,7 +91907,7 @@ var FileWorkspaceState = class {
|
|
|
91732
91907
|
async set(key2, value) {
|
|
91733
91908
|
if (value === void 0) delete this.values[key2];
|
|
91734
91909
|
else this.values[key2] = value;
|
|
91735
|
-
await import_promises31.default.mkdir(
|
|
91910
|
+
await import_promises31.default.mkdir(import_node_path57.default.dirname(this.filePath), { recursive: true });
|
|
91736
91911
|
await import_promises31.default.writeFile(this.filePath, JSON.stringify(this.values, null, 2), {
|
|
91737
91912
|
encoding: "utf8",
|
|
91738
91913
|
mode: 384
|
|
@@ -91775,7 +91950,7 @@ function createBrowserUi(workspaceRoot, post, fastFs) {
|
|
|
91775
91950
|
openFile: async (filePath) => {
|
|
91776
91951
|
try {
|
|
91777
91952
|
post(
|
|
91778
|
-
[`[info] ${
|
|
91953
|
+
[`[info] ${import_node_path57.default.basename(filePath)}`, "", await import_promises31.default.readFile(filePath, "utf8")].join("\n")
|
|
91779
91954
|
);
|
|
91780
91955
|
} catch (error51) {
|
|
91781
91956
|
post(`[warning] Could not read ${filePath}: ${String(error51)}`);
|
|
@@ -91817,7 +91992,7 @@ function createBrowserUi(workspaceRoot, post, fastFs) {
|
|
|
91817
91992
|
for (const entry of entries) {
|
|
91818
91993
|
if (found2.length >= limit) return;
|
|
91819
91994
|
if (entry.name.startsWith(".") && entry.name !== ".env") continue;
|
|
91820
|
-
const full =
|
|
91995
|
+
const full = import_node_path57.default.join(dir, entry.name);
|
|
91821
91996
|
if (entry.isDirectory()) {
|
|
91822
91997
|
if (!skip.has(entry.name)) await walk(full, level + 1);
|
|
91823
91998
|
} else if (depth !== void 0 && level !== depth) {
|
|
@@ -91853,11 +92028,11 @@ var SHARED_COLLECTIONS = [
|
|
|
91853
92028
|
{ key: "mcpServers" }
|
|
91854
92029
|
];
|
|
91855
92030
|
async function createSession(options) {
|
|
91856
|
-
const userDir =
|
|
92031
|
+
const userDir = import_node_path57.default.join(options.dataDir, "users", storageKeyFor(options.principal));
|
|
91857
92032
|
await import_promises31.default.mkdir(userDir, { recursive: true, mode: 448 });
|
|
91858
92033
|
const variableStore = new UserVariableStore(userVariablesPath(userDir));
|
|
91859
92034
|
const userVariables = () => variableStore.read();
|
|
91860
|
-
const workspaceState = new FileWorkspaceState(
|
|
92035
|
+
const workspaceState = new FileWorkspaceState(import_node_path57.default.join(userDir, "workspace-state.json"));
|
|
91861
92036
|
await workspaceState.load();
|
|
91862
92037
|
const services = {
|
|
91863
92038
|
/*
|
|
@@ -91905,6 +92080,12 @@ async function createSession(options) {
|
|
|
91905
92080
|
// One person's own machine only: on a shared server the account reaching everywhere is the service's.
|
|
91906
92081
|
...options.reachAnywhere === true && options.shared !== true ? { fileReach: "anywhere" } : {},
|
|
91907
92082
|
...options.fastFs !== void 0 ? { fastFs: options.fastFs } : {},
|
|
92083
|
+
/*
|
|
92084
|
+
* GitHub Copilot through a VS Code window on this machine (platform/node/lmRelay.ts). One person's
|
|
92085
|
+
* own machine only: on a shared server it would be whoever runs VS Code there spending their Copilot
|
|
92086
|
+
* on every user's requests.
|
|
92087
|
+
*/
|
|
92088
|
+
...options.shared !== true ? { languageModels: createRelayLanguageModels() } : {},
|
|
91908
92089
|
...options.sharedWorkspace === true ? { sharedWorkspace: true } : {},
|
|
91909
92090
|
...options.noSchedules === true ? { runsSchedules: false } : {},
|
|
91910
92091
|
...options.siblings !== void 0 && options.siblings.length > 0 ? { siblings: options.siblings } : {},
|
|
@@ -91933,16 +92114,16 @@ async function createSession(options) {
|
|
|
91933
92114
|
*/
|
|
91934
92115
|
secrets: new CredentialPointerStore(
|
|
91935
92116
|
withCredentialTool(
|
|
91936
|
-
options.sharedSecrets === void 0 ? new FileSecretStore(options.secretsFile ??
|
|
91937
|
-
new FileSecretStore(options.secretsFile ??
|
|
92117
|
+
options.sharedSecrets === void 0 ? new FileSecretStore(options.secretsFile ?? import_node_path57.default.join(userDir, "secrets.json"), options.secretsKey) : new RoutedSecretStore(
|
|
92118
|
+
new FileSecretStore(options.secretsFile ?? import_node_path57.default.join(userDir, "secrets.json"), options.secretsKey),
|
|
91938
92119
|
options.sharedSecrets
|
|
91939
92120
|
),
|
|
91940
92121
|
options
|
|
91941
92122
|
)
|
|
91942
92123
|
),
|
|
91943
92124
|
configStore: withSharedEntries(
|
|
91944
|
-
options.sharedProfiles === void 0 ? new FileConfigStore(options.configFile ??
|
|
91945
|
-
new FileConfigStore(options.configFile ??
|
|
92125
|
+
options.sharedProfiles === void 0 ? new FileConfigStore(options.configFile ?? import_node_path57.default.join(userDir, "config.json"), options.workspaceRoot) : new SharedProfileConfigStore(
|
|
92126
|
+
new FileConfigStore(options.configFile ?? import_node_path57.default.join(userDir, "config.json"), options.workspaceRoot),
|
|
91946
92127
|
options.sharedProfiles
|
|
91947
92128
|
),
|
|
91948
92129
|
options
|
|
@@ -92060,8 +92241,8 @@ async function startServer(options) {
|
|
|
92060
92241
|
));
|
|
92061
92242
|
const roles = options.roles ?? SINGLE_USER_POLICY;
|
|
92062
92243
|
const sharedStore = options.sharedConfig;
|
|
92063
|
-
const sharedSecretStore = new FileSecretStore(
|
|
92064
|
-
const reviews = new ReviewQueue(
|
|
92244
|
+
const sharedSecretStore = new FileSecretStore(import_node_path58.default.join(options.dataDir, "shared-secrets.json"));
|
|
92245
|
+
const reviews = new ReviewQueue(import_node_path58.default.join(options.dataDir, "reviews.json"));
|
|
92065
92246
|
let sharedCache = {
|
|
92066
92247
|
variables: [],
|
|
92067
92248
|
adminIds: [],
|
|
@@ -92437,14 +92618,14 @@ async function startServer(options) {
|
|
|
92437
92618
|
return "No workspace is open, so there is nowhere to write it.";
|
|
92438
92619
|
try {
|
|
92439
92620
|
if (item.kind === "skill") {
|
|
92440
|
-
const dir2 =
|
|
92621
|
+
const dir2 = import_node_path58.default.join(options.workspaceRoot, ".lightcode", "skills");
|
|
92441
92622
|
await import_promises32.default.mkdir(dir2, { recursive: true });
|
|
92442
|
-
await import_promises32.default.writeFile(
|
|
92623
|
+
await import_promises32.default.writeFile(import_node_path58.default.join(dir2, `${item.name}.md`), item.content, "utf8");
|
|
92443
92624
|
return void 0;
|
|
92444
92625
|
}
|
|
92445
|
-
const dir =
|
|
92626
|
+
const dir = import_node_path58.default.join(options.workspaceRoot, ".lightcode", "tools");
|
|
92446
92627
|
await import_promises32.default.mkdir(dir, { recursive: true });
|
|
92447
|
-
await import_promises32.default.writeFile(
|
|
92628
|
+
await import_promises32.default.writeFile(import_node_path58.default.join(dir, `${item.name}.py`), item.content, "utf8");
|
|
92448
92629
|
return void 0;
|
|
92449
92630
|
} catch (error51) {
|
|
92450
92631
|
return error51 instanceof Error ? error51.message : String(error51);
|
|
@@ -92483,7 +92664,7 @@ async function startServer(options) {
|
|
|
92483
92664
|
connection.transport.post({ type: "credentials", credentials: await readCredentials() });
|
|
92484
92665
|
}
|
|
92485
92666
|
if (options.credentialsFile !== void 0) {
|
|
92486
|
-
(0,
|
|
92667
|
+
(0, import_node_fs14.watchFile)(options.credentialsFile, { interval: 1500 }, () => {
|
|
92487
92668
|
for (const connection of connections.values()) void postCredentials(connection);
|
|
92488
92669
|
});
|
|
92489
92670
|
}
|
|
@@ -92593,7 +92774,7 @@ async function startServer(options) {
|
|
|
92593
92774
|
return;
|
|
92594
92775
|
}
|
|
92595
92776
|
response.writeHead(200, {
|
|
92596
|
-
"Content-Type": CONTENT_TYPES2[
|
|
92777
|
+
"Content-Type": CONTENT_TYPES2[import_node_path58.default.extname(asset)] ?? "application/octet-stream",
|
|
92597
92778
|
...securityHeaders()
|
|
92598
92779
|
});
|
|
92599
92780
|
response.end(body);
|