@chosengeneration/light-code 0.151.0 → 0.153.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 +221 -36
- package/dist/server.cjs +218 -33
- package/package.json +1 -1
package/dist/server.cjs
CHANGED
|
@@ -13963,11 +13963,11 @@ var require_util4 = __commonJS({
|
|
|
13963
13963
|
dataURL += serializeAMimeType(parsed);
|
|
13964
13964
|
}
|
|
13965
13965
|
dataURL += ";base64,";
|
|
13966
|
-
const
|
|
13966
|
+
const decoder2 = new StringDecoder2("latin1");
|
|
13967
13967
|
for (const chunk of bytes) {
|
|
13968
|
-
dataURL += btoa2(
|
|
13968
|
+
dataURL += btoa2(decoder2.write(chunk));
|
|
13969
13969
|
}
|
|
13970
|
-
dataURL += btoa2(
|
|
13970
|
+
dataURL += btoa2(decoder2.end());
|
|
13971
13971
|
return dataURL;
|
|
13972
13972
|
}
|
|
13973
13973
|
case "Text": {
|
|
@@ -13992,11 +13992,11 @@ var require_util4 = __commonJS({
|
|
|
13992
13992
|
}
|
|
13993
13993
|
case "BinaryString": {
|
|
13994
13994
|
let binaryString = "";
|
|
13995
|
-
const
|
|
13995
|
+
const decoder2 = new StringDecoder2("latin1");
|
|
13996
13996
|
for (const chunk of bytes) {
|
|
13997
|
-
binaryString +=
|
|
13997
|
+
binaryString += decoder2.write(chunk);
|
|
13998
13998
|
}
|
|
13999
|
-
binaryString +=
|
|
13999
|
+
binaryString += decoder2.end();
|
|
14000
14000
|
return binaryString;
|
|
14001
14001
|
}
|
|
14002
14002
|
}
|
|
@@ -43275,7 +43275,7 @@ function* completedToolCalls(accumulators) {
|
|
|
43275
43275
|
}
|
|
43276
43276
|
async function* parseSseStream(body, url2, signal, logger) {
|
|
43277
43277
|
const reader = body.getReader();
|
|
43278
|
-
const
|
|
43278
|
+
const decoder2 = new TextDecoder();
|
|
43279
43279
|
let buffer = "";
|
|
43280
43280
|
const thinking = new ThinkTagSplitter();
|
|
43281
43281
|
const toolCallAccumulators = /* @__PURE__ */ new Map();
|
|
@@ -43284,7 +43284,7 @@ async function* parseSseStream(body, url2, signal, logger) {
|
|
|
43284
43284
|
const { done, value } = await reader.read();
|
|
43285
43285
|
if (done)
|
|
43286
43286
|
break;
|
|
43287
|
-
buffer +=
|
|
43287
|
+
buffer += decoder2.decode(value, { stream: true });
|
|
43288
43288
|
const lines2 = buffer.split("\n");
|
|
43289
43289
|
buffer = lines2.pop() ?? "";
|
|
43290
43290
|
for (const line of lines2) {
|
|
@@ -43483,7 +43483,7 @@ function safeParseArguments(raw) {
|
|
|
43483
43483
|
}
|
|
43484
43484
|
async function* parseAnthropicStream(body, url2, signal, logger) {
|
|
43485
43485
|
const reader = body.getReader();
|
|
43486
|
-
const
|
|
43486
|
+
const decoder2 = new TextDecoder();
|
|
43487
43487
|
let buffer = "";
|
|
43488
43488
|
const toolUses = /* @__PURE__ */ new Map();
|
|
43489
43489
|
const completed = [];
|
|
@@ -43492,7 +43492,7 @@ async function* parseAnthropicStream(body, url2, signal, logger) {
|
|
|
43492
43492
|
const { done, value } = await reader.read();
|
|
43493
43493
|
if (done)
|
|
43494
43494
|
break;
|
|
43495
|
-
buffer +=
|
|
43495
|
+
buffer += decoder2.decode(value, { stream: true });
|
|
43496
43496
|
const lines2 = buffer.split("\n");
|
|
43497
43497
|
buffer = lines2.pop() ?? "";
|
|
43498
43498
|
for (const line of lines2) {
|
|
@@ -43722,7 +43722,7 @@ function safeParseArguments2(raw) {
|
|
|
43722
43722
|
}
|
|
43723
43723
|
async function* parseGeminiStream(body, url2, signal) {
|
|
43724
43724
|
const reader = body.getReader();
|
|
43725
|
-
const
|
|
43725
|
+
const decoder2 = new TextDecoder();
|
|
43726
43726
|
let buffer = "";
|
|
43727
43727
|
const toolCalls = [];
|
|
43728
43728
|
try {
|
|
@@ -43730,7 +43730,7 @@ async function* parseGeminiStream(body, url2, signal) {
|
|
|
43730
43730
|
const { done, value } = await reader.read();
|
|
43731
43731
|
if (done)
|
|
43732
43732
|
break;
|
|
43733
|
-
buffer +=
|
|
43733
|
+
buffer += decoder2.decode(value, { stream: true });
|
|
43734
43734
|
const lines2 = buffer.split("\n");
|
|
43735
43735
|
buffer = lines2.pop() ?? "";
|
|
43736
43736
|
for (const line of lines2) {
|
|
@@ -52689,8 +52689,8 @@ async function readTail(fs42, path62, size, count3) {
|
|
|
52689
52689
|
let start;
|
|
52690
52690
|
for (; ; ) {
|
|
52691
52691
|
start = Math.max(0, size - span);
|
|
52692
|
-
const
|
|
52693
|
-
text2 =
|
|
52692
|
+
const decoder2 = new import_node_string_decoder.StringDecoder("utf8");
|
|
52693
|
+
text2 = decoder2.write(await fs42.readBytesSlice(path62, start, size)) + decoder2.end();
|
|
52694
52694
|
const enough = text2.split("\n").length > count3;
|
|
52695
52695
|
if (enough || start === 0 || span >= size)
|
|
52696
52696
|
break;
|
|
@@ -52709,7 +52709,7 @@ async function readTail(fs42, path62, size, count3) {
|
|
|
52709
52709
|
};
|
|
52710
52710
|
}
|
|
52711
52711
|
async function readLineWindow(fs42, path62, size, from, count3) {
|
|
52712
|
-
const
|
|
52712
|
+
const decoder2 = new import_node_string_decoder.StringDecoder("utf8");
|
|
52713
52713
|
const lines2 = [];
|
|
52714
52714
|
let pending = "";
|
|
52715
52715
|
let lineNumber = 1;
|
|
@@ -52723,7 +52723,7 @@ async function readLineWindow(fs42, path62, size, from, count3) {
|
|
|
52723
52723
|
};
|
|
52724
52724
|
scan: while (position < size) {
|
|
52725
52725
|
const end = Math.min(size, position + CHUNK);
|
|
52726
|
-
pending +=
|
|
52726
|
+
pending += decoder2.write(await fs42.readBytesSlice(path62, position, end));
|
|
52727
52727
|
position = end;
|
|
52728
52728
|
const parts = pending.split(/\r\n|\r|\n/);
|
|
52729
52729
|
pending = parts.pop() ?? "";
|
|
@@ -52735,7 +52735,7 @@ async function readLineWindow(fs42, path62, size, from, count3) {
|
|
|
52735
52735
|
}
|
|
52736
52736
|
}
|
|
52737
52737
|
if (reachedEnd) {
|
|
52738
|
-
pending +=
|
|
52738
|
+
pending += decoder2.end();
|
|
52739
52739
|
if (pending.length > 0)
|
|
52740
52740
|
take(pending);
|
|
52741
52741
|
}
|
|
@@ -57137,11 +57137,11 @@ var EventSource = class extends EventTarget {
|
|
|
57137
57137
|
__privateMethod(this, _EventSource_instances, failConnection_fn).call(this, "Invalid response body, expected a web ReadableStream", status2), this.close();
|
|
57138
57138
|
return;
|
|
57139
57139
|
}
|
|
57140
|
-
const
|
|
57140
|
+
const decoder2 = new TextDecoder(), reader = body.getReader();
|
|
57141
57141
|
let open = true;
|
|
57142
57142
|
do {
|
|
57143
57143
|
const { done, value } = await reader.read();
|
|
57144
|
-
value && __privateGet(this, _parser).feed(
|
|
57144
|
+
value && __privateGet(this, _parser).feed(decoder2.decode(value, { stream: !done })), done && (open = false, __privateGet(this, _parser).reset(), __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this));
|
|
57145
57145
|
} while (open);
|
|
57146
57146
|
}), __privateAdd(this, _onFetchError, (err) => {
|
|
57147
57147
|
__privateSet(this, _controller, void 0), !(err.name === "AbortError" || err.type === "aborted") && __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this, flattenError2(err));
|
|
@@ -72708,7 +72708,7 @@ ${text2.slice(-2e4)}`);
|
|
|
72708
72708
|
const text2 = await response.text();
|
|
72709
72709
|
return { text: text2.slice(-options.tailBytes), totalBytes: text2.length, truncated: text2.length > options.tailBytes };
|
|
72710
72710
|
}
|
|
72711
|
-
const
|
|
72711
|
+
const decoder2 = new TextDecoder();
|
|
72712
72712
|
let totalBytes = 0;
|
|
72713
72713
|
let tail = "";
|
|
72714
72714
|
let partial2 = "";
|
|
@@ -72748,7 +72748,7 @@ ${text2.slice(-2e4)}`);
|
|
|
72748
72748
|
if (done)
|
|
72749
72749
|
break;
|
|
72750
72750
|
totalBytes += value.byteLength;
|
|
72751
|
-
const chunk =
|
|
72751
|
+
const chunk = decoder2.decode(value, { stream: true });
|
|
72752
72752
|
if (options.pattern === void 0) {
|
|
72753
72753
|
tail = (tail + chunk).slice(-options.tailBytes);
|
|
72754
72754
|
} else {
|
|
@@ -74620,7 +74620,23 @@ var import_node_crypto15 = require("node:crypto");
|
|
|
74620
74620
|
var import_promises25 = __toESM(require("node:fs/promises"), 1);
|
|
74621
74621
|
var import_node_path45 = __toESM(require("node:path"), 1);
|
|
74622
74622
|
var TEAM_REPO_STATE_FILE = ".lightcode-teamrepo.json";
|
|
74623
|
-
var
|
|
74623
|
+
var decoder = new TextDecoder("utf-8", { fatal: true });
|
|
74624
|
+
function contentHash(bytes) {
|
|
74625
|
+
let text2;
|
|
74626
|
+
if (!bytes.includes(0)) {
|
|
74627
|
+
try {
|
|
74628
|
+
text2 = decoder.decode(bytes);
|
|
74629
|
+
} catch {
|
|
74630
|
+
text2 = void 0;
|
|
74631
|
+
}
|
|
74632
|
+
}
|
|
74633
|
+
const digest = (0, import_node_crypto15.createHash)("sha256");
|
|
74634
|
+
if (text2 === void 0)
|
|
74635
|
+
return digest.update(bytes).digest("hex");
|
|
74636
|
+
return digest.update(text2.replace(/^\uFEFF/, "").replace(/\r\n?/g, "\n").replace(/\s+$/, "")).digest("hex");
|
|
74637
|
+
}
|
|
74638
|
+
var hash2 = contentHash;
|
|
74639
|
+
var rawHash = (bytes) => (0, import_node_crypto15.createHash)("sha256").update(bytes).digest("hex");
|
|
74624
74640
|
function repoPathFor(folder, kind, relative) {
|
|
74625
74641
|
const base = folder.replace(/\\/g, "/").replace(/^\/+|\/+$/g, "");
|
|
74626
74642
|
return [base, kind, relative.replace(/\\/g, "/")].filter((part) => part.length > 0).join("/");
|
|
@@ -74640,14 +74656,31 @@ function classifyRepoPath(folder, repoPath) {
|
|
|
74640
74656
|
}
|
|
74641
74657
|
return void 0;
|
|
74642
74658
|
}
|
|
74643
|
-
async function readState(file2) {
|
|
74659
|
+
async function readState(file2, mirrorFile) {
|
|
74644
74660
|
try {
|
|
74645
74661
|
const parsed = JSON.parse(await import_promises25.default.readFile(file2, "utf8"));
|
|
74646
|
-
|
|
74647
|
-
|
|
74662
|
+
const head = parsed.head !== void 0 ? { head: parsed.head } : {};
|
|
74663
|
+
if (parsed.version === 2)
|
|
74664
|
+
return { version: 2, files: parsed.files ?? {}, pushed: parsed.pushed ?? {}, ...head };
|
|
74665
|
+
if (parsed.version === 1) {
|
|
74666
|
+
const files = {};
|
|
74667
|
+
const pushed = {};
|
|
74668
|
+
for (const [repoPath, entry] of Object.entries(parsed.files ?? {})) {
|
|
74669
|
+
const local = mirrorFile(repoPath);
|
|
74670
|
+
if (local === void 0)
|
|
74671
|
+
continue;
|
|
74672
|
+
const bytes = await import_promises25.default.readFile(local).catch(() => void 0);
|
|
74673
|
+
if (bytes === void 0 || rawHash(bytes) !== entry.hash)
|
|
74674
|
+
continue;
|
|
74675
|
+
files[repoPath] = { commit: entry.commit, hash: contentHash(bytes) };
|
|
74676
|
+
if (parsed.pushed?.[repoPath] === entry.hash)
|
|
74677
|
+
pushed[repoPath] = contentHash(bytes);
|
|
74678
|
+
}
|
|
74679
|
+
return { version: 2, files, pushed, ...head };
|
|
74680
|
+
}
|
|
74648
74681
|
} catch {
|
|
74649
74682
|
}
|
|
74650
|
-
return { version:
|
|
74683
|
+
return { version: 2, files: {}, pushed: {} };
|
|
74651
74684
|
}
|
|
74652
74685
|
async function writeWhole2(file2, bytes) {
|
|
74653
74686
|
await import_promises25.default.mkdir(import_node_path45.default.dirname(file2), { recursive: true });
|
|
@@ -74683,9 +74716,12 @@ async function localFiles(dir, kind) {
|
|
|
74683
74716
|
}
|
|
74684
74717
|
async function syncTeamRepo(options) {
|
|
74685
74718
|
const { api, branch, folder } = options;
|
|
74686
|
-
const state = await readState(options.stateFile);
|
|
74687
|
-
const report = { branch, pulled: [], removed: [], pushed: [], conflicts: [], deletedHere: [] };
|
|
74688
74719
|
const mirrorFile = (kind, relative) => import_node_path45.default.join(options.mirror[kind], ...relative.split("/"));
|
|
74720
|
+
const state = await readState(options.stateFile, (repoPath) => {
|
|
74721
|
+
const target = classifyRepoPath(folder, repoPath);
|
|
74722
|
+
return target === void 0 ? void 0 : mirrorFile(target.kind, target.relative);
|
|
74723
|
+
});
|
|
74724
|
+
const report = { branch, pulled: [], removed: [], pushed: [], conflicts: [], behind: [], deletedHere: [] };
|
|
74689
74725
|
let head = await api.branchHead(branch);
|
|
74690
74726
|
if (head !== void 0 && head !== state.head) {
|
|
74691
74727
|
const changed = state.head !== void 0 ? await api.changes(state.head, head) : (await api.listFiles(folder.replace(/^\/+|\/+$/g, ""), head)).map((relative) => ({
|
|
@@ -74772,6 +74808,9 @@ async function syncTeamRepo(options) {
|
|
|
74772
74808
|
}
|
|
74773
74809
|
} else if (known.hash === state.pushed[repoPath]) {
|
|
74774
74810
|
sourceCommitId = known.commit;
|
|
74811
|
+
} else if (mine === state.pushed[repoPath]) {
|
|
74812
|
+
report.behind.push(repoPath);
|
|
74813
|
+
continue;
|
|
74775
74814
|
} else {
|
|
74776
74815
|
report.conflicts.push({
|
|
74777
74816
|
path: repoPath,
|
|
@@ -74817,6 +74856,45 @@ async function syncTeamRepo(options) {
|
|
|
74817
74856
|
await writeWhole2(options.stateFile, JSON.stringify(state, null, 1));
|
|
74818
74857
|
return report;
|
|
74819
74858
|
}
|
|
74859
|
+
async function checkCoverage(options) {
|
|
74860
|
+
const { folder } = options;
|
|
74861
|
+
const state = await readState(options.stateFile, (repoPath) => {
|
|
74862
|
+
const target = classifyRepoPath(folder, repoPath);
|
|
74863
|
+
return target === void 0 ? void 0 : import_node_path45.default.join(options.mirror[target.kind], ...target.relative.split("/"));
|
|
74864
|
+
});
|
|
74865
|
+
const covered = { skills: 0, tools: 0 };
|
|
74866
|
+
const problems = [];
|
|
74867
|
+
const repoPaths = [];
|
|
74868
|
+
for (const kind of ["skills", "tools"]) {
|
|
74869
|
+
for (const dir of new Set(options.dirs[kind].map((entry) => import_node_path45.default.resolve(entry)))) {
|
|
74870
|
+
for (const entry of await localFiles(dir, kind)) {
|
|
74871
|
+
const repoPath = repoPathFor(folder, kind, entry.relative);
|
|
74872
|
+
const mine = hash2(new Uint8Array(await import_promises25.default.readFile(entry.file)));
|
|
74873
|
+
const known = state.files[repoPath];
|
|
74874
|
+
if (known === void 0)
|
|
74875
|
+
problems.push(`${entry.file} - not in the repository yet`);
|
|
74876
|
+
else if (known.hash !== mine && state.pushed[repoPath] !== mine)
|
|
74877
|
+
problems.push(`${entry.file} - differs from the repository's copy`);
|
|
74878
|
+
else {
|
|
74879
|
+
covered[kind] += 1;
|
|
74880
|
+
repoPaths.push(repoPath);
|
|
74881
|
+
}
|
|
74882
|
+
}
|
|
74883
|
+
}
|
|
74884
|
+
}
|
|
74885
|
+
return { covered, problems, repoPaths: [...new Set(repoPaths)] };
|
|
74886
|
+
}
|
|
74887
|
+
async function releaseFromRecord(stateFile, repoPaths) {
|
|
74888
|
+
let parsed;
|
|
74889
|
+
try {
|
|
74890
|
+
parsed = JSON.parse(await import_promises25.default.readFile(stateFile, "utf8"));
|
|
74891
|
+
} catch {
|
|
74892
|
+
return;
|
|
74893
|
+
}
|
|
74894
|
+
for (const repoPath of repoPaths)
|
|
74895
|
+
delete parsed.pushed[repoPath];
|
|
74896
|
+
await writeWhole2(stateFile, JSON.stringify(parsed, null, 1));
|
|
74897
|
+
}
|
|
74820
74898
|
|
|
74821
74899
|
// ../../packages/core/dist/platform/httpTrace.js
|
|
74822
74900
|
var SECRET_NAME = /secret|password|passwd|token|api[-_]?key|assertion|credential|session|signature|cookie/i;
|
|
@@ -84113,9 +84191,95 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84113
84191
|
..."reason" in plan2 ? { reason: plan2.reason } : {},
|
|
84114
84192
|
...teamRepoStatus !== void 0 ? { status: teamRepoStatus } : {},
|
|
84115
84193
|
syncing: teamRepoSyncing,
|
|
84116
|
-
...saveError !== void 0 ? { saveError } : {}
|
|
84194
|
+
...saveError !== void 0 ? { saveError } : {},
|
|
84195
|
+
bucketFolders: bucketFolderLabels(config2),
|
|
84196
|
+
...teamRepoRetire !== void 0 ? { retire: teamRepoRetire } : {}
|
|
84117
84197
|
});
|
|
84118
84198
|
}
|
|
84199
|
+
function bucketFolderLabels(config2) {
|
|
84200
|
+
const label = (kind, mirror) => {
|
|
84201
|
+
const name = targetById(cachedS3, mirror.connectionId)?.label ?? mirror.connectionId;
|
|
84202
|
+
return `${kind}: ${name}${mirror.prefix !== void 0 ? ` / ${mirror.prefix}` : ""}`;
|
|
84203
|
+
};
|
|
84204
|
+
return [
|
|
84205
|
+
...(config2.s3?.skills ?? []).filter((mirror) => mirror.enabled === true).map((mirror) => label("Skills", mirror)),
|
|
84206
|
+
...(config2.s3?.tools ?? []).filter((mirror) => mirror.enabled === true).map((mirror) => label("Tools", mirror))
|
|
84207
|
+
];
|
|
84208
|
+
}
|
|
84209
|
+
let teamRepoRetire;
|
|
84210
|
+
async function handleRetireS3Buckets(confirm) {
|
|
84211
|
+
const config2 = await loadSettings();
|
|
84212
|
+
const plan2 = teamRepoPlan(config2);
|
|
84213
|
+
const folders = bucketFolderLabels(config2);
|
|
84214
|
+
const refuse = async (problems) => {
|
|
84215
|
+
teamRepoRetire = { ready: false, folders, covered: { skills: 0, tools: 0 }, problems };
|
|
84216
|
+
await postTeamRepo();
|
|
84217
|
+
};
|
|
84218
|
+
if ("reason" in plan2)
|
|
84219
|
+
return refuse([`The team repository is not set up: ${plan2.reason}`]);
|
|
84220
|
+
if (folders.length === 0)
|
|
84221
|
+
return refuse(["No S3 bucket folders are switched on for skills or tools."]);
|
|
84222
|
+
teamRepoRetire = { ready: false, folders, covered: { skills: 0, tools: 0 }, problems: [], checking: true };
|
|
84223
|
+
await postTeamRepo();
|
|
84224
|
+
await Promise.all([handleSyncS3("skills"), handleSyncS3("tools")]).catch(() => void 0);
|
|
84225
|
+
await handleTeamRepoSync(confirm ? "switching bucket folders off" : "checking before switching bucket folders off");
|
|
84226
|
+
const status2 = teamRepoStatus;
|
|
84227
|
+
if (status2?.error !== void 0)
|
|
84228
|
+
return refuse([`The sync failed: ${status2.error}`]);
|
|
84229
|
+
if (status2 !== void 0 && status2.conflicts.length > 0) {
|
|
84230
|
+
return refuse(status2.conflicts.map((conflict) => `${conflict.path} - ${conflict.reason}`));
|
|
84231
|
+
}
|
|
84232
|
+
const bucketDirs = {
|
|
84233
|
+
skills: mirroredSkillsDirs.filter((dir) => !samePath(dir, plan2.dirs.skills)),
|
|
84234
|
+
tools: mirroredToolsDirs.filter((dir) => !samePath(dir, plan2.dirs.tools))
|
|
84235
|
+
};
|
|
84236
|
+
const coverage = await checkCoverage({ folder: plan2.settings.folder, stateFile: plan2.stateFile, mirror: plan2.dirs, dirs: bucketDirs });
|
|
84237
|
+
if (coverage.problems.length > 0) {
|
|
84238
|
+
teamRepoRetire = { ready: false, folders, covered: coverage.covered, problems: coverage.problems };
|
|
84239
|
+
await postTeamRepo();
|
|
84240
|
+
return;
|
|
84241
|
+
}
|
|
84242
|
+
if (!confirm) {
|
|
84243
|
+
teamRepoRetire = { ready: true, folders, covered: coverage.covered, problems: [] };
|
|
84244
|
+
await postTeamRepo();
|
|
84245
|
+
return;
|
|
84246
|
+
}
|
|
84247
|
+
const off = (mirrors) => mirrors?.map((mirror) => {
|
|
84248
|
+
const rest = { ...mirror };
|
|
84249
|
+
delete rest.enabled;
|
|
84250
|
+
return rest;
|
|
84251
|
+
});
|
|
84252
|
+
const s3 = { ...config2.s3 ?? {} };
|
|
84253
|
+
const skillMirrors = off(s3.skills);
|
|
84254
|
+
const toolMirrors = off(s3.tools);
|
|
84255
|
+
if (skillMirrors !== void 0)
|
|
84256
|
+
s3.skills = skillMirrors;
|
|
84257
|
+
if (toolMirrors !== void 0)
|
|
84258
|
+
s3.tools = toolMirrors;
|
|
84259
|
+
await configManager.save("user", { s3 });
|
|
84260
|
+
const stillHere = await checkCoverage({
|
|
84261
|
+
folder: plan2.settings.folder,
|
|
84262
|
+
stateFile: plan2.stateFile,
|
|
84263
|
+
mirror: plan2.dirs,
|
|
84264
|
+
dirs: { skills: [localSkillsDir].filter((dir) => dir !== void 0), tools: [localToolsDir(config2)].filter((dir) => dir !== void 0) }
|
|
84265
|
+
});
|
|
84266
|
+
await releaseFromRecord(plan2.stateFile, coverage.repoPaths.filter((repoPath) => !stillHere.repoPaths.includes(repoPath)));
|
|
84267
|
+
await loadSettings();
|
|
84268
|
+
await configurePythonFromSettings();
|
|
84269
|
+
await refreshSkills();
|
|
84270
|
+
void postSkills();
|
|
84271
|
+
await postPython();
|
|
84272
|
+
await postS3();
|
|
84273
|
+
teamRepoRetire = {
|
|
84274
|
+
ready: false,
|
|
84275
|
+
folders,
|
|
84276
|
+
covered: coverage.covered,
|
|
84277
|
+
problems: [],
|
|
84278
|
+
done: `Switched off: ${folders.join("; ")}. ${String(coverage.covered.skills)} skill file(s) and ${String(coverage.covered.tools)} tool(s) now load from the team repository. Nothing was deleted - tick the folders in Settings -> S3 to switch them back on.`
|
|
84279
|
+
};
|
|
84280
|
+
logger.info(`team repository: S3 bucket folders switched off (${folders.join("; ")})`);
|
|
84281
|
+
await handleTeamRepoSync("bucket folders switched off");
|
|
84282
|
+
}
|
|
84119
84283
|
async function handleSaveTeamRepo(input) {
|
|
84120
84284
|
const project = input.project.trim();
|
|
84121
84285
|
const repo = input.repo.trim().toLowerCase();
|
|
@@ -84198,6 +84362,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84198
84362
|
pulled: report.pulled,
|
|
84199
84363
|
removed: report.removed,
|
|
84200
84364
|
conflicts: report.conflicts,
|
|
84365
|
+
behind: report.behind,
|
|
84201
84366
|
deletedHere: report.deletedHere
|
|
84202
84367
|
};
|
|
84203
84368
|
logger.info(`team repository sync (${reason}): ${String(report.pushed.length)} pushed, ${String(report.pulled.length)} pulled, ${String(report.conflicts.length)} conflict(s)`);
|
|
@@ -85907,7 +86072,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85907
86072
|
},
|
|
85908
86073
|
save: saveUsageProfile
|
|
85909
86074
|
});
|
|
85910
|
-
async function
|
|
86075
|
+
async function contentHash2(file2) {
|
|
85911
86076
|
try {
|
|
85912
86077
|
const text2 = (await import_promises28.default.readFile(file2, "utf8")).replace(/\r\n/g, "\n");
|
|
85913
86078
|
const meaningful = text2.split("\n").filter((line) => !/^(author|project|version|updated)\s*:/i.test(line) && !/^__(author|project|version|updated)__\s*=/.test(line)).join("\n").trim();
|
|
@@ -85926,7 +86091,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85926
86091
|
return bucket !== void 0 ? `bucket ${bucket.label}` : "shared folder";
|
|
85927
86092
|
};
|
|
85928
86093
|
for (const skill of skills) {
|
|
85929
|
-
const hash3 = await
|
|
86094
|
+
const hash3 = await contentHash2(skill.filePath);
|
|
85930
86095
|
items.push({
|
|
85931
86096
|
kind: "skill",
|
|
85932
86097
|
name: skill.name,
|
|
@@ -85946,7 +86111,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85946
86111
|
for (const skill of loaded.skills) {
|
|
85947
86112
|
if (items.some((item) => item.kind === "skill" && samePath(item.filePath, skill.filePath)))
|
|
85948
86113
|
continue;
|
|
85949
|
-
const hash3 = await
|
|
86114
|
+
const hash3 = await contentHash2(skill.filePath);
|
|
85950
86115
|
items.push({
|
|
85951
86116
|
kind: "skill",
|
|
85952
86117
|
name: skill.name,
|
|
@@ -85962,7 +86127,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85962
86127
|
}
|
|
85963
86128
|
const status2 = python.status();
|
|
85964
86129
|
for (const tool of status2.tools) {
|
|
85965
|
-
const hash3 = await
|
|
86130
|
+
const hash3 = await contentHash2(tool.filePath);
|
|
85966
86131
|
items.push({
|
|
85967
86132
|
kind: "tool",
|
|
85968
86133
|
name: tool.name,
|
|
@@ -87787,6 +87952,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
87787
87952
|
reportFailure("handleSaveTeamRepo", handleSaveTeamRepo(message4.settings));
|
|
87788
87953
|
} else if (message4.type === "syncTeamRepo") {
|
|
87789
87954
|
reportFailure("handleTeamRepoSync", handleTeamRepoSync("asked"));
|
|
87955
|
+
} else if (message4.type === "retireS3Buckets") {
|
|
87956
|
+
reportFailure("handleRetireS3Buckets", handleRetireS3Buckets(message4.confirm));
|
|
87790
87957
|
} else if (message4.type === "saveTeamSkillSelection") {
|
|
87791
87958
|
reportFailure("saveTeamSkillSelection", saveKeepPrivate(message4.keepPrivate).then(postSkills));
|
|
87792
87959
|
} else if (message4.type === "saveSkillDefaults") {
|
|
@@ -90966,6 +91133,24 @@ identical content, which is agreement, not a conflict; an edit someone makes in
|
|
|
90966
91133
|
by the next sync. The same name in two folders here is one file when identical; when the copies differ,
|
|
90967
91134
|
the one Light Code uses is committed and the other is listed.
|
|
90968
91135
|
|
|
91136
|
+
**"Newer in the repository"** (grey, not red): a colleague's change reached the repository before your
|
|
91137
|
+
bucket sync brought it here. Your copy is unchanged, so nothing clashes; it clears once the bucket syncs.
|
|
91138
|
+
**"Not synced - changed both here and in the repository"** (red) means both sides really changed. Compare
|
|
91139
|
+
your copy with the team copy, keep one, and the next sync agrees. Line-ending differences (Windows CRLF
|
|
91140
|
+
against LF) are not counted as changes.
|
|
91141
|
+
|
|
91142
|
+
**Do I still need the S3 bucket?** Either is enough to share: the bucket delivers files to everyone's
|
|
91143
|
+
machine, and the repository does too while keeping history and diffs. With both on, the same file in both
|
|
91144
|
+
is one file. A team can switch the bucket folders off and use the repository alone: **Use the repository
|
|
91145
|
+
instead of the S3 bucket**, in the same panel. **Check** syncs the bucket and the repository, then makes sure
|
|
91146
|
+
every skill and tool in the bucket folders is in the repository with the same content, listing anything that
|
|
91147
|
+
is not. Only after a clean check can **Switch bucket folders off** be pressed, and it checks once more first.
|
|
91148
|
+
It switches the skills and tools bucket folders off together and only unticks them - nothing is deleted in the bucket or on this computer, and ticking them again in
|
|
91149
|
+
Settings -> S3 undoes it. Afterwards new skills and tools are saved in the project's folders and committed to
|
|
91150
|
+
the repository, and what came from the bucket loads from the team copy (tools approved before stay approved
|
|
91151
|
+
when their content is the same). Colleagues still using only the bucket stop receiving yours, so switch over
|
|
91152
|
+
together.
|
|
91153
|
+
|
|
90969
91154
|
Problems from syncing in the background (the repository, buckets, tools that did not load) show in
|
|
90970
91155
|
**Settings \u2192 Usage \u2192 Needs attention**.
|
|
90971
91156
|
`
|