@chosengeneration/light-code 0.64.1 → 0.67.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.js +108 -26
- package/dist/server.js +97 -22
- package/package.json +65 -65
package/dist/cli.js
CHANGED
|
@@ -40196,6 +40196,7 @@ function dispatcherEnabled(retrieval) {
|
|
|
40196
40196
|
function skillRetrievalEnabled(retrieval) {
|
|
40197
40197
|
return dispatcherEnabled(retrieval) && retrieval?.skills !== false;
|
|
40198
40198
|
}
|
|
40199
|
+
var aliasNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9._-]{0,48}$/, "Start with a letter or digit, then lowercase letters, digits, dot, dash or underscore");
|
|
40199
40200
|
var embedderConfigSchema = external_exports.object({
|
|
40200
40201
|
profileId: external_exports.string().min(1),
|
|
40201
40202
|
model: external_exports.string().min(1),
|
|
@@ -40247,7 +40248,28 @@ var embedderConfigSchema = external_exports.object({
|
|
|
40247
40248
|
* keeping their code indexes to themselves — skills are prose somebody wrote on purpose,
|
|
40248
40249
|
* source is not.
|
|
40249
40250
|
*/
|
|
40250
|
-
skillsAlias: external_exports.string().regex(/^[a-z0-9][a-z0-9._-]{0,48}$/, "Start with a letter or digit, then lowercase letters, digits, dot, dash or underscore")
|
|
40251
|
+
skillsAlias: external_exports.string().regex(/^[a-z0-9][a-z0-9._-]{0,48}$/, "Start with a letter or digit, then lowercase letters, digits, dot, dash or underscore"),
|
|
40252
|
+
/**
|
|
40253
|
+
* Further names the codebase index answers to, beyond `indexAlias`.
|
|
40254
|
+
*
|
|
40255
|
+
* An index may carry several, and that is what makes *levels* of sharing possible rather than
|
|
40256
|
+
* a single pool: the same index can be reachable as `my-squad`, as `platform-team` and as
|
|
40257
|
+
* `everyone`, and searching one of those reaches exactly the people who attached it. With one
|
|
40258
|
+
* name there is one circle, and you are either in it or out of it.
|
|
40259
|
+
*
|
|
40260
|
+
* Order is meaningful — the first is the default, and is what `scope: "team"` resolves to.
|
|
40261
|
+
* Read through `rag/aliases.ts` together with the singular key, never directly, so the two
|
|
40262
|
+
* spellings cannot drift.
|
|
40263
|
+
*/
|
|
40264
|
+
indexAliases: external_exports.array(aliasNameSchema).max(8).optional(),
|
|
40265
|
+
/**
|
|
40266
|
+
* The same for skills.
|
|
40267
|
+
*
|
|
40268
|
+
* Kept separate from the codebase list rather than derived from it, for the reason
|
|
40269
|
+
* `skillsAlias` already records: pooling your source and pooling what you have *taught* the
|
|
40270
|
+
* assistant are different decisions, and a team routinely wants one without the other.
|
|
40271
|
+
*/
|
|
40272
|
+
skillsAliases: external_exports.array(aliasNameSchema).max(8).optional()
|
|
40251
40273
|
}).partial();
|
|
40252
40274
|
var globalTlsSchema = tlsSettingsSchema;
|
|
40253
40275
|
var identityConfigSchema = external_exports.object({
|
|
@@ -46961,11 +46983,48 @@ Filters: ${JSON.stringify(params.filters)}` : ""}`
|
|
|
46961
46983
|
|
|
46962
46984
|
// ../../packages/core/dist/tools/searchCodebase.js
|
|
46963
46985
|
import path10 from "node:path";
|
|
46986
|
+
|
|
46987
|
+
// ../../packages/core/dist/rag/aliases.js
|
|
46988
|
+
function codebaseAliases(config2) {
|
|
46989
|
+
return merge2(config2?.embedder?.indexAlias, config2?.embedder?.indexAliases);
|
|
46990
|
+
}
|
|
46991
|
+
function skillAliases(config2) {
|
|
46992
|
+
return merge2(config2?.embedder?.skillsAlias, config2?.embedder?.skillsAliases);
|
|
46993
|
+
}
|
|
46994
|
+
function aliasForScope(scope, aliases) {
|
|
46995
|
+
const wanted = scope.trim().toLowerCase();
|
|
46996
|
+
if (wanted.length === 0 || wanted === "mine")
|
|
46997
|
+
return void 0;
|
|
46998
|
+
if (wanted === "team")
|
|
46999
|
+
return aliases[0];
|
|
47000
|
+
return aliases.find((alias) => alias.toLowerCase() === wanted);
|
|
47001
|
+
}
|
|
47002
|
+
function merge2(single, many) {
|
|
47003
|
+
const out = [];
|
|
47004
|
+
for (const value of [single, ...many ?? []]) {
|
|
47005
|
+
const trimmed = value?.trim();
|
|
47006
|
+
if (trimmed === void 0 || trimmed.length === 0)
|
|
47007
|
+
continue;
|
|
47008
|
+
if (!out.some((existing) => existing.toLowerCase() === trimmed.toLowerCase()))
|
|
47009
|
+
out.push(trimmed);
|
|
47010
|
+
}
|
|
47011
|
+
return out;
|
|
47012
|
+
}
|
|
47013
|
+
|
|
47014
|
+
// ../../packages/core/dist/tools/searchCodebase.js
|
|
46964
47015
|
var paramsSchema6 = external_exports.object({
|
|
46965
47016
|
query: external_exports.string().min(1).describe('What you are looking for, described in plain words \u2014 e.g. "where the retry backoff is calculated".'),
|
|
46966
47017
|
size: external_exports.number().int().min(1).max(25).optional().describe("How many results to return. Default 8."),
|
|
46967
47018
|
pathPrefix: external_exports.string().optional().describe('Restrict to a subtree, e.g. "packages/core/src". Omit to search everything indexed.'),
|
|
46968
|
-
|
|
47019
|
+
/*
|
|
47020
|
+
* A free string rather than an enum, because the scopes are whatever the user configured.
|
|
47021
|
+
*
|
|
47022
|
+
* An index may carry several aliases — a squad, a department, everyone — and each is a level of
|
|
47023
|
+
* sharing. The *description* names the ones that exist here, which is §12's carve-out: it varies
|
|
47024
|
+
* with a setting rather than with the turn, so the tool block stays byte-stable for a session
|
|
47025
|
+
* exactly as `ask_expert`'s does.
|
|
47026
|
+
*/
|
|
47027
|
+
scope: external_exports.string().optional().describe('Whose code to search. "mine" (default) is this workspace only. Anything else names a shared scope \u2014 use it for "how did anyone solve X", never for questions about the code in front of you. Shared results are NOT on this machine and cannot be opened or edited.')
|
|
46969
47028
|
});
|
|
46970
47029
|
var DEFAULT_SIZE = 8;
|
|
46971
47030
|
var REMOTE_GUIDANCE = [
|
|
@@ -47009,10 +47068,12 @@ function createSearchCodebaseTool(options) {
|
|
|
47009
47068
|
const startedAt = Date.now();
|
|
47010
47069
|
try {
|
|
47011
47070
|
const size = params.size ?? DEFAULT_SIZE;
|
|
47012
|
-
const
|
|
47013
|
-
const
|
|
47014
|
-
const
|
|
47015
|
-
const
|
|
47071
|
+
const requested = params.scope?.trim() ?? "mine";
|
|
47072
|
+
const wantsTeam = requested.length > 0 && requested.toLowerCase() !== "mine";
|
|
47073
|
+
const alias = aliasForScope(requested, options.teamAliases ?? []);
|
|
47074
|
+
const teamUnavailable = wantsTeam && alias === void 0;
|
|
47075
|
+
const searchingTeam = wantsTeam && alias !== void 0;
|
|
47076
|
+
const collection = searchingTeam ? alias : options.index;
|
|
47016
47077
|
const vector = await options.embedder.embed(params.query);
|
|
47017
47078
|
const hits = await options.searcher.searchByVector(collection, vector, {
|
|
47018
47079
|
size,
|
|
@@ -47058,7 +47119,12 @@ ${hit.text}`;
|
|
|
47058
47119
|
"These are approximate. Read the files before relying on them, and use search_files if you know the exact term.",
|
|
47059
47120
|
...teamUnavailable ? [
|
|
47060
47121
|
"",
|
|
47061
|
-
|
|
47122
|
+
/*
|
|
47123
|
+
* Which it was matters: nothing configured is a different thing to fix from a
|
|
47124
|
+
* scope that was misspelled, and naming the ones that exist turns a dead end
|
|
47125
|
+
* into a retry the model can get right.
|
|
47126
|
+
*/
|
|
47127
|
+
(options.teamAliases ?? []).length === 0 ? "A shared scope was asked for but none is configured, so only this workspace was searched. Do not conclude from this that no colleague has solved it \u2014 their work was not looked at." : `There is no shared scope called "${requested}". The ones configured here are: ${(options.teamAliases ?? []).join(", ")}. Only this workspace was searched, so do not conclude that no colleague has solved it.`
|
|
47062
47128
|
] : [],
|
|
47063
47129
|
...anyRemote ? ["", ...REMOTE_GUIDANCE] : [],
|
|
47064
47130
|
"",
|
|
@@ -47166,8 +47232,10 @@ ${hit.text}`;
|
|
|
47166
47232
|
}
|
|
47167
47233
|
async function indexTeamSkills(options) {
|
|
47168
47234
|
await options.writer.ensureCollection(options.collection, options.embedder.dimensions, options.signal);
|
|
47169
|
-
if (options.
|
|
47170
|
-
|
|
47235
|
+
if (options.writer.ensureAlias !== void 0) {
|
|
47236
|
+
for (const alias of options.aliases ?? []) {
|
|
47237
|
+
await options.writer.ensureAlias(options.collection, alias, options.signal);
|
|
47238
|
+
}
|
|
47171
47239
|
}
|
|
47172
47240
|
if (options.skills.length === 0)
|
|
47173
47241
|
return 0;
|
|
@@ -50318,7 +50386,8 @@ async function indexWorkspace(options) {
|
|
|
50318
50386
|
};
|
|
50319
50387
|
await writer.ensureCollection(index, embedder.dimensions, signal);
|
|
50320
50388
|
if (options.alias !== void 0 && writer.ensureAlias !== void 0) {
|
|
50321
|
-
|
|
50389
|
+
for (const alias of options.alias)
|
|
50390
|
+
await writer.ensureAlias(index, alias, signal);
|
|
50322
50391
|
}
|
|
50323
50392
|
const signature = chunkSignatureFor(options.chunkOptions);
|
|
50324
50393
|
const stale = options.manifest.model !== embedder.model || options.manifest.dimensions !== embedder.dimensions || options.manifest.chunkSignature !== signature;
|
|
@@ -62704,7 +62773,7 @@ ${preview.text}` } : {}
|
|
|
62704
62773
|
...activePlan !== void 0 && activePlan.trim().length > 0 ? { plan: activePlan } : {},
|
|
62705
62774
|
// Only when a pool actually exists: telling the model about a tool it has not been given
|
|
62706
62775
|
// is how it comes to report that it looked somewhere it could not reach.
|
|
62707
|
-
teamSkillsAvailable: config2.
|
|
62776
|
+
teamSkillsAvailable: skillAliases(config2).length > 0,
|
|
62708
62777
|
/*
|
|
62709
62778
|
* Read from config rather than from the registry, because the prompt is built before the
|
|
62710
62779
|
* registry is. Only the *off* case is claimed: "on but uv is missing" leaves the model
|
|
@@ -62841,7 +62910,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
62841
62910
|
* to look and every hit can say whose it is. Both absent on a solo install,
|
|
62842
62911
|
* where team scope is simply unavailable and says so.
|
|
62843
62912
|
*/
|
|
62844
|
-
...config2.
|
|
62913
|
+
...codebaseAliases(config2).length > 0 ? { teamAliases: codebaseAliases(config2) } : {},
|
|
62845
62914
|
...indexOwner(config2) !== void 0 ? { owner: indexOwner(config2) } : {}
|
|
62846
62915
|
} : void 0,
|
|
62847
62916
|
/*
|
|
@@ -62857,10 +62926,11 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
62857
62926
|
* The team's shared skills. Needs an alias, a connection and an embedder — without
|
|
62858
62927
|
* all three there is nothing to search, and the tool is simply not offered.
|
|
62859
62928
|
*/
|
|
62860
|
-
config2.
|
|
62929
|
+
skillAliases(config2).length > 0 && search !== void 0 && embedder !== void 0 ? {
|
|
62861
62930
|
searcher: search.searcher,
|
|
62862
62931
|
embedder,
|
|
62863
|
-
|
|
62932
|
+
// The first is the default circle, exactly as it is for the codebase index.
|
|
62933
|
+
collection: skillAliases(config2)[0],
|
|
62864
62934
|
...indexOwner(config2) !== void 0 ? { owner: indexOwner(config2) } : {}
|
|
62865
62935
|
} : void 0,
|
|
62866
62936
|
/*
|
|
@@ -63834,8 +63904,8 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
63834
63904
|
}
|
|
63835
63905
|
async function handleAttachTeamAlias() {
|
|
63836
63906
|
const config2 = await loadSettings();
|
|
63837
|
-
const
|
|
63838
|
-
if (
|
|
63907
|
+
const aliases = codebaseAliases(config2);
|
|
63908
|
+
if (aliases.length === 0) {
|
|
63839
63909
|
post({
|
|
63840
63910
|
type: "teamAliasAttached",
|
|
63841
63911
|
error: "Set a team index alias in Settings \u2192 Search first \u2014 there is nothing to attach to."
|
|
@@ -63860,7 +63930,8 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
63860
63930
|
});
|
|
63861
63931
|
return;
|
|
63862
63932
|
}
|
|
63863
|
-
|
|
63933
|
+
for (const alias of aliases)
|
|
63934
|
+
await writer.ensureAlias(index, alias);
|
|
63864
63935
|
let attributed = 0;
|
|
63865
63936
|
const owner = indexOwner(config2);
|
|
63866
63937
|
if (owner !== void 0 && writer.attributeUnowned !== void 0) {
|
|
@@ -63870,7 +63941,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
63870
63941
|
...project !== void 0 ? { project } : {}
|
|
63871
63942
|
});
|
|
63872
63943
|
}
|
|
63873
|
-
post({ type: "teamAliasAttached", alias, index, attributed });
|
|
63944
|
+
post({ type: "teamAliasAttached", alias: aliases.join(", "), index, attributed });
|
|
63874
63945
|
} catch (error51) {
|
|
63875
63946
|
post({
|
|
63876
63947
|
type: "teamAliasAttached",
|
|
@@ -64545,7 +64616,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
64545
64616
|
writer: createVectorIndexWriter(httpClient, search.store, await vectorStoreConnectionFor(search.store, search.id)),
|
|
64546
64617
|
embedder,
|
|
64547
64618
|
collection,
|
|
64548
|
-
|
|
64619
|
+
aliases: skillAliases(config2),
|
|
64549
64620
|
skills: withBodies,
|
|
64550
64621
|
signal,
|
|
64551
64622
|
onProgress: (done, total) => reportIndexing("teamSkills", "Embedding and sending", { done, total }),
|
|
@@ -65052,7 +65123,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
65052
65123
|
const manifestFile = manifestPath(index, search.id);
|
|
65053
65124
|
const owner = indexOwner(config2);
|
|
65054
65125
|
const project = indexProject();
|
|
65055
|
-
const
|
|
65126
|
+
const aliases = codebaseAliases(config2);
|
|
65056
65127
|
try {
|
|
65057
65128
|
const manifest = await loadIndexManifest(manifestFile, embedder);
|
|
65058
65129
|
const isIgnored = await ignoredFilesPredicate();
|
|
@@ -65079,7 +65150,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
65079
65150
|
*/
|
|
65080
65151
|
...owner !== void 0 ? { owner } : {},
|
|
65081
65152
|
...project !== void 0 ? { project } : {},
|
|
65082
|
-
|
|
65153
|
+
alias: aliases,
|
|
65083
65154
|
onProgress: (progress) => post({ type: "indexProgress", progress }),
|
|
65084
65155
|
signal: indexingAbort.signal
|
|
65085
65156
|
});
|
|
@@ -69529,7 +69600,11 @@ function reachableHosts(bindAddress, port, extra = []) {
|
|
|
69529
69600
|
}
|
|
69530
69601
|
}
|
|
69531
69602
|
}
|
|
69532
|
-
for (const name of extra)
|
|
69603
|
+
for (const name of extra) {
|
|
69604
|
+
add(name);
|
|
69605
|
+
const trimmed = name.trim().toLowerCase();
|
|
69606
|
+
if (trimmed.length > 0) names.add(trimmed);
|
|
69607
|
+
}
|
|
69533
69608
|
return [...names];
|
|
69534
69609
|
}
|
|
69535
69610
|
function reachableOrigins(hosts, extra = []) {
|
|
@@ -71096,7 +71171,7 @@ function respondJson(response, status, body) {
|
|
|
71096
71171
|
}
|
|
71097
71172
|
|
|
71098
71173
|
// src/cli.ts
|
|
71099
|
-
var VERSION = true ? "0.
|
|
71174
|
+
var VERSION = true ? "0.67.0" : "unknown (not a packaged build)";
|
|
71100
71175
|
var compat = installNodeCompat();
|
|
71101
71176
|
function lastMeaningfulLine(problem) {
|
|
71102
71177
|
const lines = problem.split(String.fromCharCode(10)).map((line) => line.trim()).filter((line) => line.length > 0 && !line.endsWith(":"));
|
|
@@ -71161,6 +71236,7 @@ Did you mean: --admin-id ${strayAdminValue.join(" --admin-id ")}
|
|
|
71161
71236
|
const dataDir = valueOf(args, "--data-dir") ?? envPaths("light-code", { suffix: "" }).data;
|
|
71162
71237
|
const port = Number.parseInt(valueOf(args, "--port") ?? "0", 10);
|
|
71163
71238
|
const noToken = args.includes("--no-token");
|
|
71239
|
+
const printUrl = args.includes("--print-url");
|
|
71164
71240
|
const publicUrl = valueOf(args, "--public-url");
|
|
71165
71241
|
const allowHosts = valuesOf(args, "--allow-host");
|
|
71166
71242
|
const allowOrigins = valuesOf(args, "--allow-origin");
|
|
@@ -71169,7 +71245,7 @@ Did you mean: --admin-id ${strayAdminValue.join(" --admin-id ")}
|
|
|
71169
71245
|
Math.max(1, Number.parseInt(valueOf(args, "--handoff-seconds") ?? "10", 10) || 10)
|
|
71170
71246
|
);
|
|
71171
71247
|
const bindAddress = valueOf(args, "--bind");
|
|
71172
|
-
const noOpen = args.includes("--no-open") || serverMode;
|
|
71248
|
+
const noOpen = args.includes("--no-open") || serverMode || printUrl;
|
|
71173
71249
|
let identity;
|
|
71174
71250
|
let identityProblem;
|
|
71175
71251
|
if (identityTool !== void 0) {
|
|
@@ -71264,6 +71340,8 @@ Light Code ${VERSION}
|
|
|
71264
71340
|
`
|
|
71265
71341
|
);
|
|
71266
71342
|
const reachableUrl = publicAddress === void 0 ? noToken ? server.url : launchUrl : publicLaunchUrl(publicAddress, adminMode, noToken ? "" : server.launchToken ?? "");
|
|
71343
|
+
if (printUrl) process.stdout.write(`light-code-url: ${reachableUrl}
|
|
71344
|
+
`);
|
|
71267
71345
|
if (publicAddress !== void 0) {
|
|
71268
71346
|
process.stdout.write(
|
|
71269
71347
|
` open ${reachableUrl}
|
|
@@ -71346,11 +71424,11 @@ Both go through your proxy. Anyone reaching /admin directly is an administrator.
|
|
|
71346
71424
|
* working the public address out: the useful URL scrolled past above it, and the useless
|
|
71347
71425
|
* one had the last word.
|
|
71348
71426
|
*/
|
|
71349
|
-
noToken ?
|
|
71427
|
+
noToken ? `${noOpen ? "Serving on" : "Opening"} ${server.url}
|
|
71350
71428
|
(If the browser does not open, open this \u2014 there is no time limit:)
|
|
71351
71429
|
${reachableUrl}
|
|
71352
71430
|
|
|
71353
|
-
` :
|
|
71431
|
+
` : `${noOpen ? "Serving on" : "Opening"} ${server.url}
|
|
71354
71432
|
(If the browser does not open, paste this within ${String(handoffSeconds)} seconds:)
|
|
71355
71433
|
${reachableUrl}
|
|
71356
71434
|
|
|
@@ -71377,6 +71455,7 @@ var KNOWN_FLAGS = /* @__PURE__ */ new Set([
|
|
|
71377
71455
|
"--no-open",
|
|
71378
71456
|
"--no-token",
|
|
71379
71457
|
"--public-url",
|
|
71458
|
+
"--print-url",
|
|
71380
71459
|
"--allow-host",
|
|
71381
71460
|
"--allow-origin",
|
|
71382
71461
|
"--server",
|
|
@@ -71465,6 +71544,9 @@ Usage: light-code [options]
|
|
|
71465
71544
|
--bind <address> Interface to listen on (default: 127.0.0.1). Use 0.0.0.0 to
|
|
71466
71545
|
reach it from another machine; it then answers to this
|
|
71467
71546
|
machine's own hostname and addresses as well as localhost
|
|
71547
|
+
--print-url Print the launch URL on its own line, prefixed light-code-url:,
|
|
71548
|
+
then serve. For a program starting this and needing to know
|
|
71549
|
+
where it went \u2014 an IDE plugin, a script. Implies --no-open.
|
|
71468
71550
|
--public-url <u> The address this is reachable at from a browser, when that is not
|
|
71469
71551
|
the one it binds. Printed as the link to open, and trusted as a
|
|
71470
71552
|
host and origin.
|
package/dist/server.js
CHANGED
|
@@ -40047,6 +40047,7 @@ function dispatcherEnabled(retrieval) {
|
|
|
40047
40047
|
function skillRetrievalEnabled(retrieval) {
|
|
40048
40048
|
return dispatcherEnabled(retrieval) && retrieval?.skills !== false;
|
|
40049
40049
|
}
|
|
40050
|
+
var aliasNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9._-]{0,48}$/, "Start with a letter or digit, then lowercase letters, digits, dot, dash or underscore");
|
|
40050
40051
|
var embedderConfigSchema = external_exports.object({
|
|
40051
40052
|
profileId: external_exports.string().min(1),
|
|
40052
40053
|
model: external_exports.string().min(1),
|
|
@@ -40098,7 +40099,28 @@ var embedderConfigSchema = external_exports.object({
|
|
|
40098
40099
|
* keeping their code indexes to themselves — skills are prose somebody wrote on purpose,
|
|
40099
40100
|
* source is not.
|
|
40100
40101
|
*/
|
|
40101
|
-
skillsAlias: external_exports.string().regex(/^[a-z0-9][a-z0-9._-]{0,48}$/, "Start with a letter or digit, then lowercase letters, digits, dot, dash or underscore")
|
|
40102
|
+
skillsAlias: external_exports.string().regex(/^[a-z0-9][a-z0-9._-]{0,48}$/, "Start with a letter or digit, then lowercase letters, digits, dot, dash or underscore"),
|
|
40103
|
+
/**
|
|
40104
|
+
* Further names the codebase index answers to, beyond `indexAlias`.
|
|
40105
|
+
*
|
|
40106
|
+
* An index may carry several, and that is what makes *levels* of sharing possible rather than
|
|
40107
|
+
* a single pool: the same index can be reachable as `my-squad`, as `platform-team` and as
|
|
40108
|
+
* `everyone`, and searching one of those reaches exactly the people who attached it. With one
|
|
40109
|
+
* name there is one circle, and you are either in it or out of it.
|
|
40110
|
+
*
|
|
40111
|
+
* Order is meaningful — the first is the default, and is what `scope: "team"` resolves to.
|
|
40112
|
+
* Read through `rag/aliases.ts` together with the singular key, never directly, so the two
|
|
40113
|
+
* spellings cannot drift.
|
|
40114
|
+
*/
|
|
40115
|
+
indexAliases: external_exports.array(aliasNameSchema).max(8).optional(),
|
|
40116
|
+
/**
|
|
40117
|
+
* The same for skills.
|
|
40118
|
+
*
|
|
40119
|
+
* Kept separate from the codebase list rather than derived from it, for the reason
|
|
40120
|
+
* `skillsAlias` already records: pooling your source and pooling what you have *taught* the
|
|
40121
|
+
* assistant are different decisions, and a team routinely wants one without the other.
|
|
40122
|
+
*/
|
|
40123
|
+
skillsAliases: external_exports.array(aliasNameSchema).max(8).optional()
|
|
40102
40124
|
}).partial();
|
|
40103
40125
|
var globalTlsSchema = tlsSettingsSchema;
|
|
40104
40126
|
var identityConfigSchema = external_exports.object({
|
|
@@ -46819,11 +46841,48 @@ Filters: ${JSON.stringify(params.filters)}` : ""}`
|
|
|
46819
46841
|
|
|
46820
46842
|
// ../../packages/core/dist/tools/searchCodebase.js
|
|
46821
46843
|
import path9 from "node:path";
|
|
46844
|
+
|
|
46845
|
+
// ../../packages/core/dist/rag/aliases.js
|
|
46846
|
+
function codebaseAliases(config2) {
|
|
46847
|
+
return merge2(config2?.embedder?.indexAlias, config2?.embedder?.indexAliases);
|
|
46848
|
+
}
|
|
46849
|
+
function skillAliases(config2) {
|
|
46850
|
+
return merge2(config2?.embedder?.skillsAlias, config2?.embedder?.skillsAliases);
|
|
46851
|
+
}
|
|
46852
|
+
function aliasForScope(scope, aliases) {
|
|
46853
|
+
const wanted = scope.trim().toLowerCase();
|
|
46854
|
+
if (wanted.length === 0 || wanted === "mine")
|
|
46855
|
+
return void 0;
|
|
46856
|
+
if (wanted === "team")
|
|
46857
|
+
return aliases[0];
|
|
46858
|
+
return aliases.find((alias) => alias.toLowerCase() === wanted);
|
|
46859
|
+
}
|
|
46860
|
+
function merge2(single, many) {
|
|
46861
|
+
const out = [];
|
|
46862
|
+
for (const value of [single, ...many ?? []]) {
|
|
46863
|
+
const trimmed = value?.trim();
|
|
46864
|
+
if (trimmed === void 0 || trimmed.length === 0)
|
|
46865
|
+
continue;
|
|
46866
|
+
if (!out.some((existing) => existing.toLowerCase() === trimmed.toLowerCase()))
|
|
46867
|
+
out.push(trimmed);
|
|
46868
|
+
}
|
|
46869
|
+
return out;
|
|
46870
|
+
}
|
|
46871
|
+
|
|
46872
|
+
// ../../packages/core/dist/tools/searchCodebase.js
|
|
46822
46873
|
var paramsSchema6 = external_exports.object({
|
|
46823
46874
|
query: external_exports.string().min(1).describe('What you are looking for, described in plain words \u2014 e.g. "where the retry backoff is calculated".'),
|
|
46824
46875
|
size: external_exports.number().int().min(1).max(25).optional().describe("How many results to return. Default 8."),
|
|
46825
46876
|
pathPrefix: external_exports.string().optional().describe('Restrict to a subtree, e.g. "packages/core/src". Omit to search everything indexed.'),
|
|
46826
|
-
|
|
46877
|
+
/*
|
|
46878
|
+
* A free string rather than an enum, because the scopes are whatever the user configured.
|
|
46879
|
+
*
|
|
46880
|
+
* An index may carry several aliases — a squad, a department, everyone — and each is a level of
|
|
46881
|
+
* sharing. The *description* names the ones that exist here, which is §12's carve-out: it varies
|
|
46882
|
+
* with a setting rather than with the turn, so the tool block stays byte-stable for a session
|
|
46883
|
+
* exactly as `ask_expert`'s does.
|
|
46884
|
+
*/
|
|
46885
|
+
scope: external_exports.string().optional().describe('Whose code to search. "mine" (default) is this workspace only. Anything else names a shared scope \u2014 use it for "how did anyone solve X", never for questions about the code in front of you. Shared results are NOT on this machine and cannot be opened or edited.')
|
|
46827
46886
|
});
|
|
46828
46887
|
var DEFAULT_SIZE = 8;
|
|
46829
46888
|
var REMOTE_GUIDANCE = [
|
|
@@ -46867,10 +46926,12 @@ function createSearchCodebaseTool(options) {
|
|
|
46867
46926
|
const startedAt = Date.now();
|
|
46868
46927
|
try {
|
|
46869
46928
|
const size = params.size ?? DEFAULT_SIZE;
|
|
46870
|
-
const
|
|
46871
|
-
const
|
|
46872
|
-
const
|
|
46873
|
-
const
|
|
46929
|
+
const requested = params.scope?.trim() ?? "mine";
|
|
46930
|
+
const wantsTeam = requested.length > 0 && requested.toLowerCase() !== "mine";
|
|
46931
|
+
const alias = aliasForScope(requested, options.teamAliases ?? []);
|
|
46932
|
+
const teamUnavailable = wantsTeam && alias === void 0;
|
|
46933
|
+
const searchingTeam = wantsTeam && alias !== void 0;
|
|
46934
|
+
const collection = searchingTeam ? alias : options.index;
|
|
46874
46935
|
const vector = await options.embedder.embed(params.query);
|
|
46875
46936
|
const hits = await options.searcher.searchByVector(collection, vector, {
|
|
46876
46937
|
size,
|
|
@@ -46916,7 +46977,12 @@ ${hit.text}`;
|
|
|
46916
46977
|
"These are approximate. Read the files before relying on them, and use search_files if you know the exact term.",
|
|
46917
46978
|
...teamUnavailable ? [
|
|
46918
46979
|
"",
|
|
46919
|
-
|
|
46980
|
+
/*
|
|
46981
|
+
* Which it was matters: nothing configured is a different thing to fix from a
|
|
46982
|
+
* scope that was misspelled, and naming the ones that exist turns a dead end
|
|
46983
|
+
* into a retry the model can get right.
|
|
46984
|
+
*/
|
|
46985
|
+
(options.teamAliases ?? []).length === 0 ? "A shared scope was asked for but none is configured, so only this workspace was searched. Do not conclude from this that no colleague has solved it \u2014 their work was not looked at." : `There is no shared scope called "${requested}". The ones configured here are: ${(options.teamAliases ?? []).join(", ")}. Only this workspace was searched, so do not conclude that no colleague has solved it.`
|
|
46920
46986
|
] : [],
|
|
46921
46987
|
...anyRemote ? ["", ...REMOTE_GUIDANCE] : [],
|
|
46922
46988
|
"",
|
|
@@ -47024,8 +47090,10 @@ ${hit.text}`;
|
|
|
47024
47090
|
}
|
|
47025
47091
|
async function indexTeamSkills(options) {
|
|
47026
47092
|
await options.writer.ensureCollection(options.collection, options.embedder.dimensions, options.signal);
|
|
47027
|
-
if (options.
|
|
47028
|
-
|
|
47093
|
+
if (options.writer.ensureAlias !== void 0) {
|
|
47094
|
+
for (const alias of options.aliases ?? []) {
|
|
47095
|
+
await options.writer.ensureAlias(options.collection, alias, options.signal);
|
|
47096
|
+
}
|
|
47029
47097
|
}
|
|
47030
47098
|
if (options.skills.length === 0)
|
|
47031
47099
|
return 0;
|
|
@@ -50176,7 +50244,8 @@ async function indexWorkspace(options) {
|
|
|
50176
50244
|
};
|
|
50177
50245
|
await writer.ensureCollection(index, embedder.dimensions, signal);
|
|
50178
50246
|
if (options.alias !== void 0 && writer.ensureAlias !== void 0) {
|
|
50179
|
-
|
|
50247
|
+
for (const alias of options.alias)
|
|
50248
|
+
await writer.ensureAlias(index, alias, signal);
|
|
50180
50249
|
}
|
|
50181
50250
|
const signature = chunkSignatureFor(options.chunkOptions);
|
|
50182
50251
|
const stale = options.manifest.model !== embedder.model || options.manifest.dimensions !== embedder.dimensions || options.manifest.chunkSignature !== signature;
|
|
@@ -62562,7 +62631,7 @@ ${preview.text}` } : {}
|
|
|
62562
62631
|
...activePlan !== void 0 && activePlan.trim().length > 0 ? { plan: activePlan } : {},
|
|
62563
62632
|
// Only when a pool actually exists: telling the model about a tool it has not been given
|
|
62564
62633
|
// is how it comes to report that it looked somewhere it could not reach.
|
|
62565
|
-
teamSkillsAvailable: config2.
|
|
62634
|
+
teamSkillsAvailable: skillAliases(config2).length > 0,
|
|
62566
62635
|
/*
|
|
62567
62636
|
* Read from config rather than from the registry, because the prompt is built before the
|
|
62568
62637
|
* registry is. Only the *off* case is claimed: "on but uv is missing" leaves the model
|
|
@@ -62699,7 +62768,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
62699
62768
|
* to look and every hit can say whose it is. Both absent on a solo install,
|
|
62700
62769
|
* where team scope is simply unavailable and says so.
|
|
62701
62770
|
*/
|
|
62702
|
-
...config2.
|
|
62771
|
+
...codebaseAliases(config2).length > 0 ? { teamAliases: codebaseAliases(config2) } : {},
|
|
62703
62772
|
...indexOwner(config2) !== void 0 ? { owner: indexOwner(config2) } : {}
|
|
62704
62773
|
} : void 0,
|
|
62705
62774
|
/*
|
|
@@ -62715,10 +62784,11 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
62715
62784
|
* The team's shared skills. Needs an alias, a connection and an embedder — without
|
|
62716
62785
|
* all three there is nothing to search, and the tool is simply not offered.
|
|
62717
62786
|
*/
|
|
62718
|
-
config2.
|
|
62787
|
+
skillAliases(config2).length > 0 && search !== void 0 && embedder !== void 0 ? {
|
|
62719
62788
|
searcher: search.searcher,
|
|
62720
62789
|
embedder,
|
|
62721
|
-
|
|
62790
|
+
// The first is the default circle, exactly as it is for the codebase index.
|
|
62791
|
+
collection: skillAliases(config2)[0],
|
|
62722
62792
|
...indexOwner(config2) !== void 0 ? { owner: indexOwner(config2) } : {}
|
|
62723
62793
|
} : void 0,
|
|
62724
62794
|
/*
|
|
@@ -63692,8 +63762,8 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
63692
63762
|
}
|
|
63693
63763
|
async function handleAttachTeamAlias() {
|
|
63694
63764
|
const config2 = await loadSettings();
|
|
63695
|
-
const
|
|
63696
|
-
if (
|
|
63765
|
+
const aliases = codebaseAliases(config2);
|
|
63766
|
+
if (aliases.length === 0) {
|
|
63697
63767
|
post({
|
|
63698
63768
|
type: "teamAliasAttached",
|
|
63699
63769
|
error: "Set a team index alias in Settings \u2192 Search first \u2014 there is nothing to attach to."
|
|
@@ -63718,7 +63788,8 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
63718
63788
|
});
|
|
63719
63789
|
return;
|
|
63720
63790
|
}
|
|
63721
|
-
|
|
63791
|
+
for (const alias of aliases)
|
|
63792
|
+
await writer.ensureAlias(index, alias);
|
|
63722
63793
|
let attributed = 0;
|
|
63723
63794
|
const owner = indexOwner(config2);
|
|
63724
63795
|
if (owner !== void 0 && writer.attributeUnowned !== void 0) {
|
|
@@ -63728,7 +63799,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
63728
63799
|
...project !== void 0 ? { project } : {}
|
|
63729
63800
|
});
|
|
63730
63801
|
}
|
|
63731
|
-
post({ type: "teamAliasAttached", alias, index, attributed });
|
|
63802
|
+
post({ type: "teamAliasAttached", alias: aliases.join(", "), index, attributed });
|
|
63732
63803
|
} catch (error51) {
|
|
63733
63804
|
post({
|
|
63734
63805
|
type: "teamAliasAttached",
|
|
@@ -64403,7 +64474,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
64403
64474
|
writer: createVectorIndexWriter(httpClient, search.store, await vectorStoreConnectionFor(search.store, search.id)),
|
|
64404
64475
|
embedder,
|
|
64405
64476
|
collection,
|
|
64406
|
-
|
|
64477
|
+
aliases: skillAliases(config2),
|
|
64407
64478
|
skills: withBodies,
|
|
64408
64479
|
signal,
|
|
64409
64480
|
onProgress: (done, total) => reportIndexing("teamSkills", "Embedding and sending", { done, total }),
|
|
@@ -64910,7 +64981,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
64910
64981
|
const manifestFile = manifestPath(index, search.id);
|
|
64911
64982
|
const owner = indexOwner(config2);
|
|
64912
64983
|
const project = indexProject();
|
|
64913
|
-
const
|
|
64984
|
+
const aliases = codebaseAliases(config2);
|
|
64914
64985
|
try {
|
|
64915
64986
|
const manifest = await loadIndexManifest(manifestFile, embedder);
|
|
64916
64987
|
const isIgnored = await ignoredFilesPredicate();
|
|
@@ -64937,7 +65008,7 @@ ${direction}` : attachMentions(text, mentions);
|
|
|
64937
65008
|
*/
|
|
64938
65009
|
...owner !== void 0 ? { owner } : {},
|
|
64939
65010
|
...project !== void 0 ? { project } : {},
|
|
64940
|
-
|
|
65011
|
+
alias: aliases,
|
|
64941
65012
|
onProgress: (progress) => post({ type: "indexProgress", progress }),
|
|
64942
65013
|
signal: indexingAbort.signal
|
|
64943
65014
|
});
|
|
@@ -68840,7 +68911,11 @@ function reachableHosts(bindAddress, port, extra = []) {
|
|
|
68840
68911
|
}
|
|
68841
68912
|
}
|
|
68842
68913
|
}
|
|
68843
|
-
for (const name of extra)
|
|
68914
|
+
for (const name of extra) {
|
|
68915
|
+
add(name);
|
|
68916
|
+
const trimmed = name.trim().toLowerCase();
|
|
68917
|
+
if (trimmed.length > 0) names.add(trimmed);
|
|
68918
|
+
}
|
|
68844
68919
|
return [...names];
|
|
68845
68920
|
}
|
|
68846
68921
|
function reachableOrigins(hosts, extra = []) {
|
package/package.json
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@chosengeneration/light-code",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A minimal agentic coding assistant, served to your browser from a local Node server",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"bin": {
|
|
8
|
-
"light-code": "dist/cli.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"dist/**/*.js",
|
|
12
|
-
"dist/**/*.html",
|
|
13
|
-
"dist/**/*.css",
|
|
14
|
-
"dist/**/*.svg",
|
|
15
|
-
"README.md",
|
|
16
|
-
"LICENSE"
|
|
17
|
-
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "node ../../scripts/generate-operator-guide.mjs && node esbuild.mjs",
|
|
20
|
-
"typecheck": "tsc -b tsconfig.json",
|
|
21
|
-
"start": "node ./dist/cli.js",
|
|
22
|
-
"generate:guide": "node ../../scripts/generate-operator-guide.mjs"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@light-code/core": "workspace:*",
|
|
26
|
-
"@light-code/ui": "workspace:*",
|
|
27
|
-
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
28
|
-
"@types/react": "^19.2.18",
|
|
29
|
-
"@types/react-dom": "^19.2.4",
|
|
30
|
-
"env-paths": "^3.0.0",
|
|
31
|
-
"esbuild": "^0.27.2",
|
|
32
|
-
"react": "^19.2.8",
|
|
33
|
-
"react-dom": "^19.2.8",
|
|
34
|
-
"undici": "^5.29.0",
|
|
35
|
-
"zod": "^4.4.3"
|
|
36
|
-
},
|
|
37
|
-
"keywords": [
|
|
38
|
-
"ai",
|
|
39
|
-
"agent",
|
|
40
|
-
"coding-assistant",
|
|
41
|
-
"llm",
|
|
42
|
-
"mcp",
|
|
43
|
-
"openai",
|
|
44
|
-
"anthropic",
|
|
45
|
-
"cli"
|
|
46
|
-
],
|
|
47
|
-
"homepage": "https://github.com/chosengenerationdev/light-code#readme",
|
|
48
|
-
"repository": {
|
|
49
|
-
"type": "git",
|
|
50
|
-
"url": "git+https://github.com/chosengenerationdev/light-code.git",
|
|
51
|
-
"directory": "apps/host"
|
|
52
|
-
},
|
|
53
|
-
"bugs": {
|
|
54
|
-
"url": "https://github.com/chosengenerationdev/light-code/issues"
|
|
55
|
-
},
|
|
56
|
-
"engines": {
|
|
57
|
-
"node": ">=17.0.0"
|
|
58
|
-
},
|
|
59
|
-
"publishConfig": {
|
|
60
|
-
"access": "public"
|
|
61
|
-
},
|
|
62
|
-
"optionalDependencies": {
|
|
63
|
-
"@vscode/ripgrep": "^1.18.0"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@chosengeneration/light-code",
|
|
3
|
+
"version": "0.67.0",
|
|
4
|
+
"description": "A minimal agentic coding assistant, served to your browser from a local Node server",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"light-code": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/**/*.js",
|
|
12
|
+
"dist/**/*.html",
|
|
13
|
+
"dist/**/*.css",
|
|
14
|
+
"dist/**/*.svg",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "node ../../scripts/generate-operator-guide.mjs && node esbuild.mjs",
|
|
20
|
+
"typecheck": "tsc -b tsconfig.json",
|
|
21
|
+
"start": "node ./dist/cli.js",
|
|
22
|
+
"generate:guide": "node ../../scripts/generate-operator-guide.mjs"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@light-code/core": "workspace:*",
|
|
26
|
+
"@light-code/ui": "workspace:*",
|
|
27
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
28
|
+
"@types/react": "^19.2.18",
|
|
29
|
+
"@types/react-dom": "^19.2.4",
|
|
30
|
+
"env-paths": "^3.0.0",
|
|
31
|
+
"esbuild": "^0.27.2",
|
|
32
|
+
"react": "^19.2.8",
|
|
33
|
+
"react-dom": "^19.2.8",
|
|
34
|
+
"undici": "^5.29.0",
|
|
35
|
+
"zod": "^4.4.3"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"ai",
|
|
39
|
+
"agent",
|
|
40
|
+
"coding-assistant",
|
|
41
|
+
"llm",
|
|
42
|
+
"mcp",
|
|
43
|
+
"openai",
|
|
44
|
+
"anthropic",
|
|
45
|
+
"cli"
|
|
46
|
+
],
|
|
47
|
+
"homepage": "https://github.com/chosengenerationdev/light-code#readme",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/chosengenerationdev/light-code.git",
|
|
51
|
+
"directory": "apps/host"
|
|
52
|
+
},
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/chosengenerationdev/light-code/issues"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=17.0.0"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
},
|
|
62
|
+
"optionalDependencies": {
|
|
63
|
+
"@vscode/ripgrep": "^1.18.0"
|
|
64
|
+
}
|
|
65
|
+
}
|