@chosengeneration/light-code 0.124.0 → 0.125.1

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 CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/cli.cjs
3
- size: 49320768 bytes
4
- sha256: 600f19e999022e8c0b46b91a15b9ed12f4affaad3af308710faed797d9adfbf1
3
+ size: 49333133 bytes
4
+ sha256: 6e3db9287a87b670774d6f2aee3d52230f80d13e5ad08650787c803c9d0728be
package/dist/server.cjs CHANGED
@@ -46675,8 +46675,8 @@ var OpenSearchClient = class {
46675
46675
  if (options.owner !== void 0)
46676
46676
  clauses.push({ term: { owner: options.owner } });
46677
46677
  if (options.project !== void 0) {
46678
- const named = { terms: { project: [...options.project.names] } };
46679
- clauses.push(options.project.includeUnlabelled ? { bool: { should: [named, { bool: { must_not: [{ exists: { field: "project" } }] } }], minimum_should_match: 1 } } : named);
46678
+ const named2 = { terms: { project: [...options.project.names] } };
46679
+ clauses.push(options.project.includeUnlabelled ? { bool: { should: [named2, { bool: { must_not: [{ exists: { field: "project" } }] } }], minimum_should_match: 1 } } : named2);
46680
46680
  }
46681
46681
  const body = {
46682
46682
  /*
@@ -47605,11 +47605,11 @@ function qdrantFilter(options) {
47605
47605
  if (options.owner !== void 0)
47606
47606
  must.push({ key: "owner", match: { value: options.owner } });
47607
47607
  if (options.project !== void 0) {
47608
- const named = { key: "project", match: { any: [...options.project.names] } };
47608
+ const named2 = { key: "project", match: { any: [...options.project.names] } };
47609
47609
  if (options.project.includeUnlabelled)
47610
- should.push(named, { is_empty: { key: "project" } });
47610
+ should.push(named2, { is_empty: { key: "project" } });
47611
47611
  else
47612
- must.push(named);
47612
+ must.push(named2);
47613
47613
  }
47614
47614
  if (must.length === 0 && should.length === 0)
47615
47615
  return void 0;
@@ -49640,9 +49640,9 @@ var CSS_NAMES = {
49640
49640
  };
49641
49641
  function parseColour(raw) {
49642
49642
  const value = raw.trim().toLowerCase();
49643
- const named = CSS_NAMES[value];
49644
- if (named !== void 0)
49645
- return named;
49643
+ const named2 = CSS_NAMES[value];
49644
+ if (named2 !== void 0)
49645
+ return named2;
49646
49646
  const hex3 = /^#([0-9a-f]{3}|[0-9a-f]{6})$/.exec(value);
49647
49647
  if (hex3 !== null) {
49648
49648
  const digits = hex3[1];
@@ -52159,7 +52159,7 @@ function scheduleAppliesHere(schedule, workspaceRoot) {
52159
52159
  return normalise2(schedule.workspaceRoot) === normalise2(workspaceRoot);
52160
52160
  }
52161
52161
  function filterToolsForSchedule(all, schedule) {
52162
- const named = new Set(schedule.allowedTools);
52162
+ const named2 = new Set(schedule.allowedTools);
52163
52163
  const always = new Set(ALWAYS_AVAILABLE_TO_SCHEDULES);
52164
52164
  const never2 = new Set(NEVER_AVAILABLE_TO_SCHEDULES);
52165
52165
  return all.filter((tool) => {
@@ -52169,7 +52169,7 @@ function filterToolsForSchedule(all, schedule) {
52169
52169
  return false;
52170
52170
  if (always.has(tool.name))
52171
52171
  return true;
52172
- return named.has(tool.name);
52172
+ return named2.has(tool.name);
52173
52173
  });
52174
52174
  }
52175
52175
  function registryForSchedule(all, schedule) {
@@ -65306,8 +65306,8 @@ var shown = (value) => {
65306
65306
  return text === void 0 ? "undefined" : text.length > 300 ? `${text.slice(0, 300)}...` : text;
65307
65307
  };
65308
65308
  function createPythonLibraryTool(options) {
65309
- const named = (params) => params.folders !== void 0 && params.folders.length > 0;
65310
- const foldersFor = (params) => named(params) ? params.folders ?? [] : options.savedFolders?.() ?? [];
65309
+ const named2 = (params) => params.folders !== void 0 && params.folders.length > 0;
65310
+ const foldersFor = (params) => named2(params) ? params.folders ?? [] : options.savedFolders?.() ?? [];
65311
65311
  return {
65312
65312
  name: "python_library",
65313
65313
  group: "command",
@@ -65318,7 +65318,7 @@ function createPythonLibraryTool(options) {
65318
65318
  const lines = [
65319
65319
  params.action === "call" ? `RUN ${params.module}.${params.function ?? "?"} ${params.calls !== void 0 ? `${String(params.calls.length)} times, in parallel worker processes` : "once"}` : `${params.action === "list" ? "List" : "Describe"} ${params.module}${params.function !== void 0 ? `.${params.function}` : ""} (importing it runs its start-up code)`,
65320
65320
  `Python: ${"problem" in launch ? `(none found: ${launch.problem})` : launch.interpreter}`,
65321
- `Folders: ${foldersFor(params).length > 0 ? `${foldersFor(params).join("; ")}${named(params) ? "" : " (saved in Settings \u2192 Python)"}` : "(none - the library must be installed in that Python)"}`
65321
+ `Folders: ${foldersFor(params).length > 0 ? `${foldersFor(params).join("; ")}${named2(params) ? "" : " (saved in Settings \u2192 Python)"}` : "(none - the library must be installed in that Python)"}`
65322
65322
  ];
65323
65323
  if (params.action === "call") {
65324
65324
  const calls = params.calls ?? [{ args: params.args, kwargs: params.kwargs }];
@@ -65420,6 +65420,72 @@ Results in call order:
65420
65420
  ${body}`;
65421
65421
  }
65422
65422
 
65423
+ // ../../packages/core/dist/tools/offload.js
65424
+ var named = (...names) => (name) => names.includes(name);
65425
+ var OFFLOAD_FAMILIES = [
65426
+ { label: "Excel", about: "open, read, trace, recalculate, write and save workbooks; read, check, write and run VBA", matches: (n) => n.startsWith("excel_") },
65427
+ {
65428
+ label: "Outlook and mail",
65429
+ about: "search and read mail, draft messages, open a message; the indexed mailbox and its patterns",
65430
+ matches: (n) => n.startsWith("outlook_") || n.startsWith("mail_") || n === "open_email" || n === "search_mail"
65431
+ },
65432
+ { label: "Confluence", about: "search, read and write pages, with attachments and diagrams", matches: (n) => n.startsWith("confluence_") },
65433
+ { label: "Jira", about: "search, read, create and update issues; project fields", matches: (n) => n.startsWith("jira_") },
65434
+ { label: "Bitbucket", about: "pull requests, files at a branch, comments, merge and tag", matches: (n) => n.startsWith("bitbucket_") },
65435
+ { label: "Jenkins", about: "jobs, builds, logs, queue, start, stop and replay a Jenkinsfile", matches: (n) => n.startsWith("jenkins_") },
65436
+ { label: "AutoSys", about: "job status, definitions, logs, dependencies, events and JIL", matches: (n) => n.startsWith("autosys_") },
65437
+ { label: "JupyterHub", about: "run code and inspect libraries on the hub, sync files, browse it", matches: (n) => n.startsWith("hub_") },
65438
+ { label: "S3 buckets", about: "list, read, download and upload files", matches: (n) => n.startsWith("s3_") },
65439
+ { label: "APIs and messaging", about: "call a REST API; open or send a Teams message", matches: named("http_request", "teams_open_chat") },
65440
+ {
65441
+ label: "Data and files",
65442
+ about: "SQL, grouping and pivots over CSV/Excel/clipboard; SQLite; filter a table; copy, move and zip files",
65443
+ matches: named("dataframe", "query_sqlite", "query_table", "transfer_files", "archive_files")
65444
+ },
65445
+ {
65446
+ label: "Python",
65447
+ about: "call a Python library many times in parallel; create, update, delete tools; install packages",
65448
+ matches: named("python_library", "create_python_tool", "update_python_tool", "delete_python_tool", "install_python_packages")
65449
+ },
65450
+ {
65451
+ label: "Search indexes and collectors",
65452
+ about: "query an OpenSearch index directly, collected data, colleagues\u2019 skills; data collectors",
65453
+ matches: named("search_opensearch", "search_data", "search_team_skills", "create_collector_tool", "check_collector")
65454
+ },
65455
+ {
65456
+ label: "Skills and schedules",
65457
+ about: "copy a skill\u2019s template file, delete a skill, schedule a prompt, export the configuration",
65458
+ matches: named("use_skill_file", "delete_skill", "schedule_prompt", "light_code_export_config")
65459
+ }
65460
+ ];
65461
+ function offloadFamilyOf(name) {
65462
+ return OFFLOAD_FAMILIES.find((family) => family.matches(name));
65463
+ }
65464
+ function isOffloadable(name) {
65465
+ return offloadFamilyOf(name) !== void 0;
65466
+ }
65467
+ function offloadedCatalogue(hidden, otherHidden = 0) {
65468
+ const names = hidden.map((tool) => typeof tool === "string" ? tool : tool.name);
65469
+ const lines = [];
65470
+ for (const family of OFFLOAD_FAMILIES) {
65471
+ const members = names.filter((name) => family.matches(name)).sort();
65472
+ if (members.length > 0)
65473
+ lines.push(`- **${family.label}** (${family.about}): ${members.join(", ")}`);
65474
+ }
65475
+ if (lines.length === 0 && otherHidden === 0)
65476
+ return void 0;
65477
+ return [
65478
+ "## More tools you have (documented in the search index)",
65479
+ "These tools are available to you but their full instructions are kept in the documentation index, not in",
65480
+ "this prompt. **Before using any of them - and before planning a multi-step job in one of these areas -",
65481
+ 'call `search_docs` describing what you need to do** (for example "create a Jira issue with an attachment").',
65482
+ "It returns the relevant steps and each tool\u2019s exact parameters. Then call the tool with",
65483
+ "`call_tool(name, arguments)`. Never guess parameters for a tool you have not looked up.",
65484
+ ...lines,
65485
+ ...otherHidden > 0 ? [`- **Also**: ${String(otherHidden)} more tool(s) from MCP servers and your own Python tools, found the same way with \`search_docs\`.`] : []
65486
+ ].join("\n");
65487
+ }
65488
+
65423
65489
  // ../../packages/core/dist/tools/http.js
65424
65490
  var schema3 = external_exports.object({
65425
65491
  method: external_exports.enum(["GET", "POST"]).default("GET"),
@@ -72093,8 +72159,8 @@ function renderValue2(value) {
72093
72159
  return parts.length > 0 ? parts.join(", ") : void 0;
72094
72160
  }
72095
72161
  if (typeof value === "object") {
72096
- const named = value;
72097
- const label = named?.displayName ?? named?.name ?? named?.value ?? named?.key;
72162
+ const named2 = value;
72163
+ const label = named2?.displayName ?? named2?.name ?? named2?.value ?? named2?.key;
72098
72164
  if (typeof label === "string")
72099
72165
  return label;
72100
72166
  const json2 = JSON.stringify(value);
@@ -76404,6 +76470,11 @@ ${preview.text}` } : {}
76404
76470
  combined.register(createBitbucketMergePullRequestTool(bitbucketOptions));
76405
76471
  }
76406
76472
  combined.register(createExportConfigTool({ loadConfig: async () => (await configManager.load()).config }), { dispatchOnly: dispatcher });
76473
+ if (dispatcher && docs !== void 0) {
76474
+ for (const tool of combined.list())
76475
+ if (isOffloadable(tool.name))
76476
+ combined.register(tool, { dispatchOnly: true });
76477
+ }
76407
76478
  const hasHiddenTools = dispatcher && combined.dispatchOnlyList().length > 0;
76408
76479
  const hasHiddenSkills = hideSkills && skills.length > 0;
76409
76480
  if (hasHiddenTools) {
@@ -76528,8 +76599,8 @@ ${preview.text}` } : {}
76528
76599
  try {
76529
76600
  const { config: config2 } = await configManager.load();
76530
76601
  const refs = (config2.profiles ?? []).flatMap((profile) => SECRET_REFS_PER_PROFILE.map((refFor) => refFor(profile.id)));
76531
- const named = (config2.profiles ?? []).map((profile) => profile.auth.type === "apiKey" ? profile.auth.apiKeyRef : void 0).filter((ref) => ref !== void 0);
76532
- const values = await Promise.all([.../* @__PURE__ */ new Set([...refs, ...named])].map((ref) => resolveSecretRef(ref, { secrets })));
76602
+ const named2 = (config2.profiles ?? []).map((profile) => profile.auth.type === "apiKey" ? profile.auth.apiKeyRef : void 0).filter((ref) => ref !== void 0);
76603
+ const values = await Promise.all([.../* @__PURE__ */ new Set([...refs, ...named2])].map((ref) => resolveSecretRef(ref, { secrets })));
76533
76604
  cachedSecretValues = values.filter((value) => value !== void 0 && value.length > 0);
76534
76605
  return [...cachedSecretValues];
76535
76606
  } catch (error51) {
@@ -76746,6 +76817,15 @@ ${preview.text}` } : {}
76746
76817
  parts.push(hubGuidance(hub));
76747
76818
  if (services.fastFs !== void 0)
76748
76819
  parts.push(fastFsGuidance(fastFsOps));
76820
+ if (schedule === void 0 && dispatcherEnabled(config2.retrieval) && search !== void 0 && embedder !== void 0 && docsIndex !== void 0) {
76821
+ const everything = currentToolRegistry(void 0, void 0, void 0, void 0, true);
76822
+ const offloaded = everything.list().filter((tool) => isOffloadable(tool.name));
76823
+ const otherHidden = everything.dispatchOnlyList().filter((tool) => !isOffloadable(tool.name)).length;
76824
+ const catalogue = offloadedCatalogue(offloaded, otherHidden);
76825
+ if (catalogue !== void 0)
76826
+ parts.push(catalogue);
76827
+ scheduleDocsReindex("keeping the tool documentation current");
76828
+ }
76749
76829
  const others = services.siblings ?? [];
76750
76830
  if (others.length > 0) {
76751
76831
  parts.push([
@@ -79603,7 +79683,10 @@ ${redact(shown2, cachedSecretValues)}` }
79603
79683
  try {
79604
79684
  options.report?.("Reading the catalogue");
79605
79685
  const registry2 = currentToolRegistry(void 0, void 0, void 0, void 0, true);
79606
- const all = buildDocCorpus({ dispatchOnlyTools: registry2.dispatchOnlyList(), skills });
79686
+ const all = buildDocCorpus({
79687
+ dispatchOnlyTools: registry2.list().filter((tool) => registry2.isDispatchOnly(tool.name) || isOffloadable(tool.name)),
79688
+ skills
79689
+ });
79607
79690
  const wanted = options.kind;
79608
79691
  const entries = wanted === void 0 ? all : all.filter((entry) => entry.kind === wanted);
79609
79692
  const fingerprint = (0, import_node_crypto12.createHash)("sha256").update(`${wanted ?? "all"}:${embedder.model}:${String(embedder.dimensions)}`).update(entries.map((entry) => `${entry.id}\0${entry.text}`).join("")).digest("hex");
@@ -81557,21 +81640,21 @@ ${redact(shown2, cachedSecretValues)}` }
81557
81640
  return void 0;
81558
81641
  };
81559
81642
  try {
81560
- const named = venvDir.trim();
81561
- if (named.length > 0) {
81562
- const found2 = await search(named);
81643
+ const named2 = venvDir.trim();
81644
+ if (named2.length > 0) {
81645
+ const found2 = await search(named2);
81563
81646
  if (found2 !== void 0) {
81564
81647
  post({
81565
81648
  type: "pythonEnvProbe",
81566
81649
  interpreter: found2,
81567
- venvDir: named,
81650
+ venvDir: named2,
81568
81651
  detail: `Found ${found2}`
81569
81652
  });
81570
81653
  return;
81571
81654
  }
81572
81655
  post({
81573
81656
  type: "pythonEnvProbe",
81574
- detail: `No Python interpreter under "${named}". Check the path, or set the interpreter directly below.`
81657
+ detail: `No Python interpreter under "${named2}". Check the path, or set the interpreter directly below.`
81575
81658
  });
81576
81659
  return;
81577
81660
  }
@@ -83213,7 +83296,9 @@ function createShowDiagramTool() {
83213
83296
  return {
83214
83297
  name: "show_diagram",
83215
83298
  group: "always",
83216
- description: 'Draw a technical diagram for the user: a flow chart, an architecture sketch, a sequence of steps, a state machine. Give `nodes` (each with an `id` and a `label`) and `edges` between those ids \u2014 the layout is worked out for you, so do not attempt coordinates. Use it when a structure is easier seen than described: how a request travels, what calls what, where a decision branches, what happens on failure. Shapes carry the usual meanings \u2014 `round` for a start or end, `diamond` for a decision, `cylinder` for a store, and the default box for a step. Put the condition on the edge (`label: "yes"`, `label: "on timeout"`) rather than inventing a node for it, and use `style: "dashed"` for anything conditional, asynchronous or secondary. Tone colours a box by meaning \u2014 success, danger, warning, info, accent, muted \u2014 and `icon` puts a glyph in its corner. `emphasis: "bold"` for the box the diagram is really about, `font: "mono"` where the label *is* an identifier (a path, a function, a table). `textSize` is small, normal, large or xlarge, on a node for one box or on the diagram for all of them \u2014 use it when the user asks for bigger or smaller text, which they may well do; the box grows with the text so nothing is cut off. A `legend` explains what a colour or a shape stands for *in this diagram*, which is worth giving whenever the meaning is not obvious from the labels. `direction: "right"` suits a pipeline; the default runs downwards and suits most flows. Loops are fine \u2014 an edge pointing back is drawn round the outside. Keep it to the boxes that earn their place: a diagram of forty is a wall, not an explanation, and the limit is a refusal rather than a truncation.',
83299
+ // Short on purpose: advertised in every request, and the field descriptions carry the details
83300
+ // (tones, icons, text size, legend, direction). It was ~1,600 tokens with the schema.
83301
+ description: 'Draw a technical diagram: a flow, an architecture, a sequence of steps, a state machine. Give `nodes` (`id`, `label`) and `edges` between ids; layout is automatic, never give coordinates. Shapes: `round` start/end, `diamond` decision, `cylinder` store, box for a step. Put conditions on edges (`label: "on timeout"`), `style: "dashed"` for conditional or async. Keep to the boxes that matter - forty is a wall, and the limit refuses rather than truncates.',
83217
83302
  parametersSchema: diagramSpecSchema,
83218
83303
  async execute(params) {
83219
83304
  const layout = layoutDiagram(params);
@@ -84479,7 +84564,12 @@ configured per workspace when credentials may not.
84479
84564
  "rag",
84480
84565
  "codebase",
84481
84566
  "team",
84482
- "dispatcher"
84567
+ "dispatcher",
84568
+ "tool definitions",
84569
+ "context window",
84570
+ "prompt size",
84571
+ "not listed",
84572
+ "offload"
84483
84573
  ],
84484
84574
  body: `
84485
84575
  **Settings \u2192 Search.** Opt-in and **off by default**, and it is the largest egress in the product:
@@ -84517,6 +84607,21 @@ them with \`search_docs\` \u2014 so the prompt does not grow with the size of yo
84517
84607
  is a prompt-size control and **not** a security control: a hidden tool is still callable. Use
84518
84608
  modes and the approval gate to withhold a capability.
84519
84609
 
84610
+ **With a search index, the built-in integrations move there too.** When the dispatcher is on and a
84611
+ documentation index is configured (a vector store and an embedding model), the Excel, Outlook,
84612
+ Confluence, Jira, Bitbucket, Jenkins, AutoSys, JupyterHub, S3, API, data and Python tools leave the
84613
+ prompt: their full instructions live in the index, and the prompt keeps a short list naming every one
84614
+ of them, telling the assistant to call \`search_docs\` before using one or planning a job in that area.
84615
+ With everything switched on that is roughly 38,000 tokens of tool definitions down to about 11,000 on
84616
+ every request. **Without an index nothing changes** - every tool stays listed in full, because finding
84617
+ a tool by name alone is not reliable enough to hide it. The file, edit, command and Rust file tools are
84618
+ always listed, because nearly every conversation uses them.
84619
+
84620
+ **Switching over is automatic.** The message after you configure an index already uses the lighter
84621
+ prompt, and the tool documentation is indexed in the background within seconds - so that first message
84622
+ finds tools by name, and later ones by meaning. Switching on another integration later (Jira, Excel, ...)
84623
+ is picked up the same way. Nothing to press; the Search tab's Index button forces a full rebuild.
84624
+
84520
84625
  **If a switch here breaks nothing when it fails, that is deliberate.** With the backend down,
84521
84626
  \`search_docs\` falls back to matching names, the search tools are simply not offered, and chat,
84522
84627
  editing, commands and MCP never touch it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chosengeneration/light-code",
3
- "version": "0.124.0",
3
+ "version": "0.125.1",
4
4
  "description": "A minimal agentic coding assistant, served to your browser from a local Node server",
5
5
  "license": "MIT",
6
6
  "type": "module",