@chosengeneration/light-code 0.153.0 → 0.155.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.
Files changed (3) hide show
  1. package/dist/cli.cjs +201 -40
  2. package/dist/server.cjs +192 -37
  3. package/package.json +1 -1
package/dist/server.cjs CHANGED
@@ -60152,11 +60152,29 @@ async function listSkillFiles(skillFilePath, fs42) {
60152
60152
  }
60153
60153
 
60154
60154
  // ../../packages/core/dist/skills/tools.js
60155
+ async function folderFor(context, name, audience) {
60156
+ const personal = context.personalSkillsDir;
60157
+ if (audience === "me") {
60158
+ if (personal === void 0)
60159
+ throw new Error("Keeping a skill to yourself is not available here (a shared server has no personal folder).");
60160
+ return { dir: personal, personal: true };
60161
+ }
60162
+ if (audience === "team" || personal === void 0)
60163
+ return { dir: context.skillsDir, personal: false };
60164
+ const there = await exists(import_node_path24.default.join(personal, skillFileName(name))) || await exists(import_node_path24.default.join(personal, name, "SKILL.md"));
60165
+ return there ? { dir: personal, personal: true } : { dir: context.skillsDir, personal: false };
60166
+ }
60167
+ function audienceNote(context, personal) {
60168
+ if (context.personalSkillsDir === void 0)
60169
+ return void 0;
60170
+ return personal ? "For: only you - kept in your personal skills on this computer, used in every project, never uploaded or committed" : `For: the team - ${context.sharedWith?.() ?? "saved in this project"}`;
60171
+ }
60155
60172
  var MAX_SKILL_IMAGES = 12;
60156
60173
  var writeParams = external_exports.object({
60157
60174
  name: external_exports.string().describe('Short kebab-case identifier, e.g. "internal-http-client". Becomes the filename.'),
60158
60175
  description: external_exports.string().describe("One line, and the only part loaded into every future conversation \u2014 so write it as the trigger for reading the skill: what subject it covers, not what it says."),
60159
60176
  body: external_exports.string().describe("The markdown content. Be concrete: package names, import paths, function signatures, a short example. This is read only when relevant, so length costs nothing."),
60177
+ audience: external_exports.enum(["me", "team"]).optional().describe('Who the skill is for. "me": kept only for this user, on this computer, in every project - never shared. "team": saved where the team shares skills. For a NEW skill, if the user has not said, ask them first (ask_user_form, a choice of "Only me" or "The team") - never guess. Omit when updating: the skill stays where it is.'),
60160
60178
  images: external_exports.array(external_exports.object({
60161
60179
  source: external_exports.string().min(1).describe("The picture as it is now, relative to the workspace root."),
60162
60180
  name: external_exports.string().optional().describe("What to call it inside the skill. Defaults to the source file name."),
@@ -60288,11 +60306,14 @@ function createWriteSkillTool(context) {
60288
60306
  description: "Record durable knowledge about this workspace so it survives into future conversations \u2014 internal libraries and how to use them, project conventions, in-house APIs, anything you were told once and would otherwise have to be told again. Creates or replaces the skill of that name; send the whole body, not a patch. Only the description is loaded into future prompts, so the cost of a long body is nothing. The user approves the exact text before it is written.",
60289
60307
  parametersSchema: writeParams,
60290
60308
  async preview(params3) {
60291
- const filePath = await resolveSkillPath(context.skillsDir, params3.name);
60309
+ const target = await folderFor(context, params3.name, params3.audience);
60310
+ const filePath = await resolveSkillPath(target.dir, params3.name);
60292
60311
  const before = await readIfPresent(filePath);
60312
+ const note = audienceNote(context, target.personal);
60293
60313
  return {
60294
60314
  kind: "diff",
60295
60315
  path: filePath,
60316
+ ...note !== void 0 ? { note } : {},
60296
60317
  before,
60297
60318
  // Rendered here, so the diff is exactly the bytes that get written rather than an
60298
60319
  // approximation of them.
@@ -60307,7 +60328,8 @@ function createWriteSkillTool(context) {
60307
60328
  async execute(params3, toolContext) {
60308
60329
  try {
60309
60330
  const wantsFolder = (params3.images ?? []).length > 0 || (params3.files ?? []).length > 0;
60310
- const filePath = await resolveSkillPath(context.skillsDir, params3.name, wantsFolder);
60331
+ const target = await folderFor(context, params3.name, params3.audience);
60332
+ const filePath = await resolveSkillPath(target.dir, params3.name, wantsFolder);
60311
60333
  const before = await readIfPresent(filePath);
60312
60334
  const existed = before.length > 0;
60313
60335
  const stored = wantsFolder && context.submitForReview === void 0 ? await copySkillImages(import_node_path24.default.dirname(filePath), params3.images ?? [], toolContext) : plannedImages(params3);
@@ -60324,15 +60346,15 @@ function createWriteSkillTool(context) {
60324
60346
  }
60325
60347
  await import_promises11.default.writeFile(filePath, rendered, "utf8");
60326
60348
  if (wantsFolder) {
60327
- const flat = import_node_path24.default.join(context.skillsDir, skillFileName(params3.name));
60349
+ const flat = import_node_path24.default.join(target.dir, skillFileName(params3.name));
60328
60350
  if (await exists(flat))
60329
60351
  await import_promises11.default.rm(flat).catch(() => void 0);
60330
60352
  }
60331
60353
  await context.onChanged();
60332
60354
  let publishProblem;
60333
- if (context.onSaved !== void 0) {
60355
+ if (context.onSaved !== void 0 && !target.personal) {
60334
60356
  try {
60335
- await context.onSaved(params3.name, rendered, import_node_path24.default.relative(context.skillsDir, filePath).split(import_node_path24.default.sep).join("/"));
60357
+ await context.onSaved(params3.name, rendered, import_node_path24.default.relative(target.dir, filePath).split(import_node_path24.default.sep).join("/"));
60336
60358
  } catch (error51) {
60337
60359
  publishProblem = error51 instanceof Error ? error51.message : String(error51);
60338
60360
  }
@@ -60425,6 +60447,14 @@ function createUseSkillFileTool(context) {
60425
60447
  }
60426
60448
  };
60427
60449
  }
60450
+ async function deletableFolder(context, name) {
60451
+ const has2 = async (dir) => await exists(import_node_path24.default.join(dir, skillFileName(name))) || await exists(import_node_path24.default.join(dir, name, "SKILL.md"));
60452
+ if (await has2(context.skillsDir))
60453
+ return context.skillsDir;
60454
+ if (context.personalSkillsDir !== void 0 && await has2(context.personalSkillsDir))
60455
+ return context.personalSkillsDir;
60456
+ return context.skillsDir;
60457
+ }
60428
60458
  function createDeleteSkillTool(context) {
60429
60459
  return {
60430
60460
  name: "delete_skill",
@@ -60432,16 +60462,17 @@ function createDeleteSkillTool(context) {
60432
60462
  description: "Remove a recorded skill.",
60433
60463
  parametersSchema: deleteParams,
60434
60464
  async preview(params3) {
60435
- const filePath = await resolveSkillPath(context.skillsDir, params3.name);
60465
+ const filePath = await resolveSkillPath(await deletableFolder(context, params3.name), params3.name);
60436
60466
  return { kind: "diff", path: filePath, before: await readIfPresent(filePath), after: "" };
60437
60467
  },
60438
60468
  async execute(params3) {
60439
60469
  try {
60440
- const filePath = await resolveSkillPath(context.skillsDir, params3.name);
60470
+ const root = await deletableFolder(context, params3.name);
60471
+ const filePath = await resolveSkillPath(root, params3.name);
60441
60472
  const folder = import_node_path24.default.dirname(filePath);
60442
- const isFolderSkill = import_node_path24.default.resolve(folder) !== import_node_path24.default.resolve(context.skillsDir);
60473
+ const isFolderSkill = import_node_path24.default.resolve(folder) !== import_node_path24.default.resolve(root);
60443
60474
  if (isFolderSkill) {
60444
- await import_promises11.default.rm(await confine(folder, context.skillsDir), { recursive: true, force: true });
60475
+ await import_promises11.default.rm(await confine(folder, root), { recursive: true, force: true });
60445
60476
  } else {
60446
60477
  await import_promises11.default.rm(filePath, { force: true });
60447
60478
  }
@@ -61271,12 +61302,34 @@ function isInstallableRequirement(requirement) {
61271
61302
  }
61272
61303
 
61273
61304
  // ../../packages/core/dist/python/tools.js
61305
+ var audienceParam = external_exports.enum(["me", "team"]).optional().describe('Who the tool is for. "me": kept only for this user, on this computer, in every project - never shared. "team": saved where the team shares tools. For a NEW tool, if the user has not said, ask them first (ask_user_form, a choice of "Only me" or "The team") - never guess. Omit when updating: the tool stays where it is.');
61306
+ function toolFolder(context, name, audience) {
61307
+ const personal = context.personalToolsDir;
61308
+ if (audience === "me") {
61309
+ if (personal === void 0)
61310
+ throw new Error("Keeping a tool to yourself is not available here (a shared server has no personal folder).");
61311
+ return { dir: personal, personal: true };
61312
+ }
61313
+ if (audience === void 0 && personal !== void 0) {
61314
+ const existing = context.findTool?.(name);
61315
+ if (existing !== void 0 && import_node_path26.default.resolve(existing.sourceDir) === import_node_path26.default.resolve(personal))
61316
+ return { dir: personal, personal: true };
61317
+ }
61318
+ return { dir: context.toolsDir, personal: false };
61319
+ }
61320
+ function toolAudienceNote(context, personal) {
61321
+ if (context.personalToolsDir === void 0)
61322
+ return void 0;
61323
+ return personal ? "For: only you - kept in your personal tools on this computer, used in every project, never uploaded or committed" : "For: the team - " + (context.sharedWith?.() ?? "saved in this project");
61324
+ }
61274
61325
  var createParams = external_exports.object({
61275
61326
  name: external_exports.string().describe("Tool name: lowercase letters, digits and underscores. Becomes py__<name> and <name>.py."),
61327
+ audience: audienceParam,
61276
61328
  source: external_exports.string().describe("The complete Python file. Must define `run`. Use type hints \u2014 the parameter schema is derived from them. The module docstring becomes the tool description; document parameters in a Google-style Args: block. Declare dependencies in a PEP 723 inline block if you need any. Read a host, account or token from os.environ rather than writing it into the file \u2014 the user sets those once in Settings \u2192 Python and every tool gets them. Say which variable you expect if it is not already set.")
61277
61329
  });
61278
61330
  var specifyParams = external_exports.object({
61279
61331
  name: external_exports.string().describe("Tool name: lowercase letters, digits and underscores. Becomes py__<name> and <name>.py."),
61332
+ audience: audienceParam,
61280
61333
  specification: external_exports.string().describe("What the tool must do, in prose. A model configured for code writes the file from this; you do not write Python here. Say what it takes, what it returns, and any library or endpoint it must use. The user approves the generated source before anything runs.")
61281
61334
  });
61282
61335
  var deleteParams2 = external_exports.object({
@@ -61306,7 +61359,7 @@ function makeWriteTool(context, options) {
61306
61359
  const key2 = `${params3.name}::${params3.specification}`;
61307
61360
  let inFlight = pending.get(key2);
61308
61361
  if (inFlight === void 0) {
61309
- const toolPath = resolveToolPath2(context.toolsDir, params3.name);
61362
+ const toolPath = resolveToolPath2(toolFolder(context, params3.name, params3.audience).dir, params3.name);
61310
61363
  inFlight = (async () => {
61311
61364
  const before = await readIfPresent2(await toolPath);
61312
61365
  const generated = await generator({
@@ -61345,7 +61398,8 @@ function makeWriteTool(context, options) {
61345
61398
  * later hashed, so what was reviewed is what can run.
61346
61399
  */
61347
61400
  async preview(params3) {
61348
- const filePath = await resolveToolPath2(context.toolsDir, params3.name);
61401
+ const target = toolFolder(context, params3.name, params3.audience);
61402
+ const filePath = await resolveToolPath2(target.dir, params3.name);
61349
61403
  const before = await readIfPresent2(filePath);
61350
61404
  const generated = await sourceFor(params3);
61351
61405
  const source = label(params3.name, generated.source, before);
@@ -61354,7 +61408,8 @@ function makeWriteTool(context, options) {
61354
61408
  const notes = [
61355
61409
  ...producedBy !== void 0 ? [`Written by ${producedBy}`] : [],
61356
61410
  ...reads.length > 0 ? [`Reads saved credentials: ${reads.join(", ")}`] : [],
61357
- ...declaresAlwaysAsk(source) ? ["Always asks before every run, for everyone who has this tool (__always_ask__ = True)"] : []
61411
+ ...declaresAlwaysAsk(source) ? ["Always asks before every run, for everyone who has this tool (__always_ask__ = True)"] : [],
61412
+ ...[toolAudienceNote(context, target.personal)].filter((note) => note !== void 0)
61358
61413
  ];
61359
61414
  return {
61360
61415
  kind: "diff",
@@ -61366,7 +61421,8 @@ function makeWriteTool(context, options) {
61366
61421
  },
61367
61422
  async execute(params3) {
61368
61423
  try {
61369
- const filePath = await resolveToolPath2(context.toolsDir, params3.name);
61424
+ const target = toolFolder(context, params3.name, params3.audience);
61425
+ const filePath = await resolveToolPath2(target.dir, params3.name);
61370
61426
  const before = await readIfPresent2(filePath);
61371
61427
  if (options.mustExist && before.length === 0) {
61372
61428
  return {
@@ -61393,7 +61449,7 @@ function makeWriteTool(context, options) {
61393
61449
  })
61394
61450
  };
61395
61451
  }
61396
- await import_promises13.default.mkdir(context.toolsDir, { recursive: true });
61452
+ await import_promises13.default.mkdir(target.dir, { recursive: true });
61397
61453
  await import_promises13.default.writeFile(filePath, source, "utf8");
61398
61454
  const restore = async () => {
61399
61455
  if (before.length > 0)
@@ -61443,10 +61499,10 @@ ${outcome.reject}`, isError: true };
61443
61499
  }
61444
61500
  verifyWarning = outcome?.warn;
61445
61501
  }
61446
- await approveTool(context.toolsDir, params3.name, source, described);
61502
+ await approveTool(target.dir, params3.name, source, described);
61447
61503
  await context.onChanged();
61448
61504
  let publishProblem;
61449
- if (context.onSaved !== void 0) {
61505
+ if (context.onSaved !== void 0 && !target.personal) {
61450
61506
  try {
61451
61507
  await context.onSaved(params3.name, source);
61452
61508
  } catch (error51) {
@@ -61534,6 +61590,13 @@ function createInstallPackagesTool(context) {
61534
61590
  }
61535
61591
  };
61536
61592
  }
61593
+ function deletableToolFolder(context, name) {
61594
+ const existing = context.findTool?.(name);
61595
+ const personal = context.personalToolsDir;
61596
+ if (existing !== void 0 && personal !== void 0 && import_node_path26.default.resolve(existing.sourceDir) === import_node_path26.default.resolve(personal))
61597
+ return personal;
61598
+ return context.toolsDir;
61599
+ }
61537
61600
  function createDeletePythonTool(context) {
61538
61601
  return {
61539
61602
  name: "delete_python_tool",
@@ -61541,21 +61604,22 @@ function createDeletePythonTool(context) {
61541
61604
  description: "Remove a Python tool and its registration.",
61542
61605
  parametersSchema: deleteParams2,
61543
61606
  async preview(params3) {
61544
- const filePath = await resolveToolPath2(context.toolsDir, params3.name);
61607
+ const filePath = await resolveToolPath2(deletableToolFolder(context, params3.name), params3.name);
61545
61608
  return { kind: "diff", path: filePath, before: await readIfPresent2(filePath), after: "" };
61546
61609
  },
61547
61610
  async execute(params3) {
61548
61611
  try {
61549
61612
  const existing = context.findTool?.(params3.name);
61550
- if (existing !== void 0 && import_node_path26.default.resolve(existing.sourceDir) !== import_node_path26.default.resolve(context.toolsDir)) {
61613
+ const own = deletableToolFolder(context, params3.name);
61614
+ if (existing !== void 0 && import_node_path26.default.resolve(existing.sourceDir) !== import_node_path26.default.resolve(own)) {
61551
61615
  return {
61552
61616
  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.`,
61553
61617
  isError: true
61554
61618
  };
61555
61619
  }
61556
- const filePath = await resolveToolPath2(context.toolsDir, params3.name);
61620
+ const filePath = await resolveToolPath2(own, params3.name);
61557
61621
  await import_promises13.default.rm(filePath, { force: true });
61558
- await forgetTool(context.toolsDir, params3.name);
61622
+ await forgetTool(own, params3.name);
61559
61623
  await context.onChanged();
61560
61624
  return { content: `Removed py__${params3.name}.`, path: filePath };
61561
61625
  } catch (error51) {
@@ -62024,6 +62088,8 @@ var PythonManager = class {
62024
62088
  findTool: (name) => this.findTool(name),
62025
62089
  ...this.options.onToolSaved !== void 0 ? { onSaved: this.options.onToolSaved } : {},
62026
62090
  ...this.options.attribution !== void 0 ? { attribution: this.options.attribution } : {},
62091
+ ...this.options.personalToolsDir !== void 0 ? { personalToolsDir: this.options.personalToolsDir } : {},
62092
+ ...this.options.sharedWith !== void 0 ? { sharedWith: this.options.sharedWith } : {},
62027
62093
  /*
62028
62094
  * No installing against an interpreter we do not own.
62029
62095
  *
@@ -63003,7 +63069,7 @@ async function runAgentTurn(provider, conversation, userMessage, toolRegistry, t
63003
63069
  if (streamError !== void 0 && assistantText.length === 0 && toolCall === void 0 && options.autoCompact === false && isContextOverflow(streamError)) {
63004
63070
  events.onError(`${streamError}
63005
63071
 
63006
- The conversation is longer than this model accepts. Press **Compact now** under the token bar to summarise the older part (the saved transcript keeps everything), then send again - or tick "Compact automatically" there to have this done for you. Starting a new chat with + also works.`);
63072
+ The conversation is longer than this model accepts. Press **Compact now** under the token bar to summarise the older part (the saved transcript keeps everything), then send again - or tick "Compact automatically" there to have this done for you. Or press **New chat with a handoff** (beside + at the top): the assistant writes up this chat - goal, decisions, what is done, next steps - and a new chat starts from it, a clean start that keeps the thread.`);
63007
63073
  return;
63008
63074
  }
63009
63075
  if (streamError !== void 0 && assistantText.length === 0 && toolCall === void 0 && !compactedForOverflow && options.compactionEnabled !== false && isContextOverflow(streamError)) {
@@ -63019,7 +63085,7 @@ The conversation is longer than this model accepts. Press **Compact now** under
63019
63085
  }
63020
63086
  events.onError(`${streamError}
63021
63087
 
63022
- The conversation is longer than this model accepts, and it could not be shortened enough (the most recent messages, or one very large tool result, are too big on their own). Start a new chat with +, or choose a model with a larger context window.`);
63088
+ The conversation is longer than this model accepts, and it could not be shortened enough (the most recent messages, or one very large tool result, are too big on their own). Press **New chat with a handoff** (beside + at the top): the assistant writes up this chat and a new chat starts from it, so the work carries on. Or start an empty chat with +, or choose a model with a larger context window.`);
63023
63089
  return;
63024
63090
  }
63025
63091
  if (streamError !== void 0) {
@@ -74660,8 +74726,9 @@ async function readState(file2, mirrorFile) {
74660
74726
  try {
74661
74727
  const parsed = JSON.parse(await import_promises25.default.readFile(file2, "utf8"));
74662
74728
  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 };
74729
+ if (parsed.version === 2) {
74730
+ return { version: 2, files: parsed.files ?? {}, pushed: parsed.pushed ?? {}, ...head, ...parsed.released !== void 0 ? { released: parsed.released } : {} };
74731
+ }
74665
74732
  if (parsed.version === 1) {
74666
74733
  const files = {};
74667
74734
  const pushed = {};
@@ -74847,8 +74914,22 @@ async function syncTeamRepo(options) {
74847
74914
  });
74848
74915
  }
74849
74916
  }
74917
+ const released = new Set(state.released ?? []);
74918
+ for (const repoPath of [...released]) {
74919
+ if (present2.has(repoPath))
74920
+ released.delete(repoPath);
74921
+ else {
74922
+ const known = state.files[repoPath];
74923
+ if (known !== void 0)
74924
+ state.pushed[repoPath] = known.hash;
74925
+ }
74926
+ }
74927
+ if (released.size > 0)
74928
+ state.released = [...released].sort();
74929
+ else
74930
+ delete state.released;
74850
74931
  for (const repoPath of Object.keys(state.pushed)) {
74851
- if (!present2.has(repoPath) && state.files[repoPath] !== void 0)
74932
+ if (!present2.has(repoPath) && !released.has(repoPath) && state.files[repoPath] !== void 0)
74852
74933
  report.deletedHere.push(repoPath);
74853
74934
  }
74854
74935
  }
@@ -74891,8 +74972,7 @@ async function releaseFromRecord(stateFile, repoPaths) {
74891
74972
  } catch {
74892
74973
  return;
74893
74974
  }
74894
- for (const repoPath of repoPaths)
74895
- delete parsed.pushed[repoPath];
74975
+ parsed.released = [.../* @__PURE__ */ new Set([...parsed.released ?? [], ...repoPaths])].sort();
74896
74976
  await writeWhole2(stateFile, JSON.stringify(parsed, null, 1));
74897
74977
  }
74898
74978
 
@@ -79001,6 +79081,8 @@ function wireChatBridge(services) {
79001
79081
  const { transport, secrets, ui, workspaceRoot, storageDir } = services;
79002
79082
  const machineApprovals = services.machineApprovalsFile !== void 0 ? new FileMachineApprovals(services.machineApprovalsFile) : void 0;
79003
79083
  const mirrorRoot = services.mirrorRoot ?? storageDir;
79084
+ const personalSkillsDir = services.personalDir !== void 0 ? import_node_path51.default.join(services.personalDir, "skills") : void 0;
79085
+ const personalToolsDir = services.personalDir !== void 0 ? import_node_path51.default.join(services.personalDir, "tools") : void 0;
79004
79086
  const logger = new Logger({ level: "debug", sink: services.logSink });
79005
79087
  let fastFsOps;
79006
79088
  if (services.fastFs !== void 0) {
@@ -79027,6 +79109,7 @@ function wireChatBridge(services) {
79027
79109
  const python = new PythonManager({
79028
79110
  workspaceRoot,
79029
79111
  storageDir,
79112
+ ...personalToolsDir !== void 0 ? { personalToolsDir, sharedWith: () => sharedWith("tools") } : {},
79030
79113
  ...services.codebaseDir !== void 0 ? { venvRoot: services.codebaseDir } : {},
79031
79114
  logger,
79032
79115
  // Fire Code: one review per tool's code on this machine, however many codebases hold it.
@@ -79248,6 +79331,7 @@ ${preview.text}` } : {}
79248
79331
  ...files.length > 0 ? { files } : {},
79249
79332
  ...skill.sourceDir !== void 0 ? { sourceDir: skill.sourceDir } : {},
79250
79333
  ...placeholders.length > 0 ? { placeholders } : {},
79334
+ ...isPersonalSkill(skill) ? { personal: true } : {},
79251
79335
  ...skill.always === true ? { always: true } : {},
79252
79336
  ...skill.author !== void 0 ? { author: skill.author } : {},
79253
79337
  ...skill.project !== void 0 ? { project: skill.project } : {},
@@ -79263,7 +79347,7 @@ ${preview.text}` } : {}
79263
79347
  issues: skillIssues,
79264
79348
  ...skillsDir !== void 0 ? { skillsDir } : {},
79265
79349
  extraDirs: extraSkillDirs,
79266
- keepPrivate: skillsConfig.teamSkills?.keepPrivate ?? [],
79350
+ keepPrivate: [.../* @__PURE__ */ new Set([...skillsConfig.teamSkills?.keepPrivate ?? [], ...skills.filter(isPersonalSkill).map((skill) => skill.name)])],
79267
79351
  skillDefaults: skillsConfig.skillDefaults ?? {}
79268
79352
  });
79269
79353
  scheduleDocsReindex("skills changed");
@@ -79463,13 +79547,16 @@ ${preview.text}` } : {}
79463
79547
  }
79464
79548
  function pythonFolders(config2) {
79465
79549
  const configured = config2.python?.toolsDir?.trim();
79466
- const publish = configured !== void 0 && configured.length > 0 ? void 0 : publishFolder("tools", config2.s3?.tools ?? []);
79550
+ const chosen = configured !== void 0 && configured.length > 0;
79551
+ const team = chosen ? void 0 : teamRepoPlan(config2);
79552
+ const publish = chosen ? void 0 : publishFolder("tools", config2.s3?.tools ?? []) ?? (team !== void 0 && "own" in team ? team.own.tools : void 0);
79553
+ const personal = personalToolsDir !== void 0 ? [personalToolsDir] : [];
79467
79554
  if (publish === void 0)
79468
- return { extraToolDirs: mirroredToolsDirs };
79555
+ return { extraToolDirs: [...personal, ...mirroredToolsDirs] };
79469
79556
  const local = localToolsDir(config2);
79470
79557
  return {
79471
79558
  toolsDir: publish,
79472
- extraToolDirs: [...local !== void 0 ? [local] : [], ...mirroredToolsDirs.filter((dir) => !samePath(dir, publish))]
79559
+ extraToolDirs: [...personal, ...local !== void 0 ? [local] : [], ...mirroredToolsDirs.filter((dir) => !samePath(dir, publish))]
79473
79560
  };
79474
79561
  }
79475
79562
  function noFolderMessage(kind) {
@@ -79814,10 +79901,12 @@ ${preview.text}` } : {}
79814
79901
  if (!isValidSkillName(name))
79815
79902
  throw new Error(`"${name}" is not a valid skill name.`);
79816
79903
  const existing = skills.find((skill) => skill.name === name);
79817
- if (existing !== void 0 && existing.sourceDir !== void 0 && existing.sourceDir !== skillsDir) {
79904
+ if (existing !== void 0 && existing.sourceDir !== void 0 && existing.sourceDir !== skillsDir && // The user's own skills are theirs to delete.
79905
+ !samePath(existing.sourceDir, personalSkillsDir)) {
79818
79906
  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.`);
79819
79907
  }
79820
- await import_promises28.default.rm(import_node_path51.default.join(skillsDir, skillFileName(name)), { force: true });
79908
+ const from = existing?.sourceDir !== void 0 && samePath(existing.sourceDir, personalSkillsDir) ? existing.sourceDir : skillsDir;
79909
+ await import_promises28.default.rm(import_node_path51.default.join(from, skillFileName(name)), { force: true });
79821
79910
  await postSkills();
79822
79911
  } catch (error51) {
79823
79912
  post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
@@ -80441,10 +80530,17 @@ ${preview.text}` } : {}
80441
80530
  ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}
80442
80531
  }));
80443
80532
  const team = teamRepoPlan(config2);
80533
+ cachedTeamRepoLabel = "dirs" in team ? `${team.settings.project}/${team.settings.repo} (${team.settings.branch})` : void 0;
80444
80534
  if ("dirs" in team) {
80445
80535
  extraSkillDirs.push(team.dirs.skills);
80446
80536
  mirroredToolsDirs.push(team.dirs.tools);
80537
+ if (config2.skills?.dir === void 0 && publishSkills === void 0) {
80538
+ skillsDir = team.own.skills;
80539
+ extraSkillDirs.unshift(...localSkillsDir !== void 0 ? [localSkillsDir] : []);
80540
+ }
80447
80541
  }
80542
+ if (personalSkillsDir !== void 0)
80543
+ extraSkillDirs.unshift(personalSkillsDir);
80448
80544
  return config2;
80449
80545
  }
80450
80546
  function announceConfigRecovery() {
@@ -80757,6 +80853,8 @@ ${preview.text}` } : {}
80757
80853
  skillsDir,
80758
80854
  onChanged: refreshSkills,
80759
80855
  attribution: () => cachedAttribution,
80856
+ // "Only me": the user's own skills, never shared. Absent on a shared server.
80857
+ ...personalSkillsDir !== void 0 ? { personalSkillsDir, sharedWith: () => sharedWith("skills") } : {},
80760
80858
  /*
80761
80859
  * Every loaded skill, so `use_skill_file` can reach a template in a read-only shared
80762
80860
  * folder. A closure over the live array rather than a copy: the folders are watched, and
@@ -81740,6 +81838,15 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
81740
81838
  // read_file must reach them without asking, or the rest of a cut-off file is out of reach.
81741
81839
  readRoots: [
81742
81840
  ...cachedReadRoots,
81841
+ /*
81842
+ * Every folder skills and Python tools load from. A skill's body is read with read_file, and
81843
+ * skills outside the project - S3 bucket folders, the team repository's copy and the folder new
81844
+ * ones are saved in while it is on - were outside every root: VS Code asked to read each one, and
81845
+ * Fire Code refused them as inside its own data folder. Reading only; they are written through
81846
+ * write_skill and the Python tools, which ask with the content shown.
81847
+ */
81848
+ ...skillSearchPath(),
81849
+ ...python.toolDirectories(),
81743
81850
  ...(services.siblings ?? []).map((s) => s.path),
81744
81851
  droppedFilesRoot2,
81745
81852
  mailAttachmentsRoot2,
@@ -84174,7 +84281,13 @@ ${redact(shown2, cachedSecretValues)}` }
84174
84281
  return { reason: "Enter the project key and repository slug." };
84175
84282
  const digest = (0, import_node_crypto16.createHash)("sha256").update(JSON.stringify([bitbucket.baseUrl, settings.project, settings.repo, settings.branch, settings.folder]).toLowerCase()).digest("hex").slice(0, 12);
84176
84283
  const root = import_node_path51.default.join(mirrorRoot, "teamrepo", `${settings.project}-${settings.repo}-${digest}`.toLowerCase());
84177
- return { dirs: { skills: import_node_path51.default.join(root, "skills"), tools: import_node_path51.default.join(root, "tools") }, stateFile: import_node_path51.default.join(root, TEAM_REPO_STATE_FILE), settings };
84284
+ return {
84285
+ dirs: { skills: import_node_path51.default.join(root, "skills"), tools: import_node_path51.default.join(root, "tools") },
84286
+ // Where new skills and tools are saved while the repository is on - see loadSettings and pythonFolders.
84287
+ own: { skills: import_node_path51.default.join(root, "saved-here", "skills"), tools: import_node_path51.default.join(root, "saved-here", "tools") },
84288
+ stateFile: import_node_path51.default.join(root, TEAM_REPO_STATE_FILE),
84289
+ settings
84290
+ };
84178
84291
  }
84179
84292
  let teamRepoStatus;
84180
84293
  let teamRepoSyncing = false;
@@ -84193,9 +84306,28 @@ ${redact(shown2, cachedSecretValues)}` }
84193
84306
  syncing: teamRepoSyncing,
84194
84307
  ...saveError !== void 0 ? { saveError } : {},
84195
84308
  bucketFolders: bucketFolderLabels(config2),
84309
+ // Where new skills and tools land while it is on - outside the project, unless a folder was chosen.
84310
+ ..."dirs" in plan2 ? { savedIn: { ...skillsDir !== void 0 ? { skills: skillsDir } : {}, ...(pythonFolders(config2).toolsDir ?? localToolsDir(config2)) !== void 0 ? { tools: pythonFolders(config2).toolsDir ?? localToolsDir(config2) } : {} } } : {},
84196
84311
  ...teamRepoRetire !== void 0 ? { retire: teamRepoRetire } : {}
84197
84312
  });
84198
84313
  }
84314
+ let cachedTeamRepoLabel;
84315
+ function sharedWith(kind) {
84316
+ const mirrors = kind === "skills" ? cachedSkillMirrors : cachedToolMirrors;
84317
+ const publish = mirrors.find((mirror) => mirror.enabled === true && mirror.publish === true);
84318
+ const bucket = publish !== void 0 ? targetById(cachedS3, publish.connectionId) : void 0;
84319
+ const parts = [
84320
+ ...bucket !== void 0 && bucket.readOnly !== true ? [`uploaded to the S3 bucket ${bucket.label}${publish?.prefix !== void 0 ? ` / ${publish.prefix}` : ""}`] : [],
84321
+ ...cachedTeamRepoLabel !== void 0 ? [`committed to the team repository ${cachedTeamRepoLabel}`] : []
84322
+ ];
84323
+ return parts.length > 0 ? parts.join(", and ") : "saved in this project's folder - no team sharing is set up, so nobody else gets it yet";
84324
+ }
84325
+ function isPersonalSkill(skill) {
84326
+ if (personalSkillsDir === void 0)
84327
+ return false;
84328
+ const norm2 = (value) => process.platform === "win32" ? import_node_path51.default.resolve(value).toLowerCase() : import_node_path51.default.resolve(value);
84329
+ return norm2(skill.filePath).startsWith(norm2(personalSkillsDir) + import_node_path51.default.sep);
84330
+ }
84199
84331
  function bucketFolderLabels(config2) {
84200
84332
  const label = (kind, mirror) => {
84201
84333
  const name = targetById(cachedS3, mirror.connectionId)?.label ?? mirror.connectionId;
@@ -84662,7 +84794,7 @@ ${redact(shown2, cachedSecretValues)}` }
84662
84794
  if (keepPrivateNow !== void 0)
84663
84795
  await saveKeepPrivate(keepPrivateNow);
84664
84796
  const config2 = await loadSettings();
84665
- const keepPrivate = new Set(config2.teamSkills?.keepPrivate ?? []);
84797
+ const keepPrivate = /* @__PURE__ */ new Set([...config2.teamSkills?.keepPrivate ?? [], ...skills.filter(isPersonalSkill).map((skill) => skill.name)]);
84666
84798
  const collection = skillsIndexName(config2);
84667
84799
  const search = await resolveSearch(config2);
84668
84800
  const embedder = await resolveEmbedder(config2);
@@ -84783,7 +84915,7 @@ ${redact(shown2, cachedSecretValues)}` }
84783
84915
  stored.set(document.path, document.text);
84784
84916
  cursor = page.next;
84785
84917
  } while (cursor !== void 0);
84786
- const keepPrivate = new Set(config2.teamSkills?.keepPrivate ?? []);
84918
+ const keepPrivate = /* @__PURE__ */ new Set([...config2.teamSkills?.keepPrivate ?? [], ...skills.filter(isPersonalSkill).map((skill) => skill.name)]);
84787
84919
  const entries = await Promise.all(skills.map(async (skill) => {
84788
84920
  const sent = stored.get(teamSkillPath(skill));
84789
84921
  if (keepPrivate.has(skill.name))
@@ -90335,6 +90467,15 @@ and the assistant copies it into the workspace with \`use_skill_file\` rather th
90335
90467
  bytes into the conversation. Describe each file in one line in the skill body; a file nobody
90336
90468
  described is one the assistant will never know to reach for.
90337
90469
 
90470
+ **Only me, or the team.** When a skill or Python tool is created, the assistant asks who it is for
90471
+ (unless you said). **Only me** keeps it in your personal folder on this computer
90472
+ (%LOCALAPPDATA%\\light-code\\personal) - used in every project, in VS Code, Fire Code and the Node host
90473
+ alike, and never uploaded to a bucket, committed to the team repository or sent to the team skills
90474
+ pool. **The team** saves it where your team shares: committed to the team repository and/or uploaded
90475
+ to the bucket folder marked "Publish" - the approval prompt names the destination before anything is
90476
+ written. Updating one keeps it where it is. Personal skills show **only you** in the Skills tab and can
90477
+ be removed there. Not offered on a shared server, where every user is the same account.
90478
+
90338
90479
  **Moving them.** Changed where skills live, or turned a bucket on after you already had some?
90339
90480
  Settings -> Skills -> "Bring skills in from another folder" copies them in. Nothing is moved and
90340
90481
  nothing is overwritten: the old folder is untouched and a name already present is skipped and
@@ -91133,6 +91274,18 @@ identical content, which is agreement, not a conflict; an edit someone makes in
91133
91274
  by the next sync. The same name in two folders here is one file when identical; when the copies differ,
91134
91275
  the one Light Code uses is committed and the other is listed.
91135
91276
 
91277
+ **Where new ones are saved.** While the repository is on, new skills and Python tools are saved in a
91278
+ folder of its own outside the project (the panel shows the path), so they never land in the project's git.
91279
+ A folder you chose in Settings -> Skills or Settings -> Python, or an S3 bucket folder marked "Publish",
91280
+ still wins. Skills and tools already in the project's .lightcode folders keep loading and are committed
91281
+ too. The agent can read every skill and tool folder, wherever it is, without asking.
91282
+
91283
+ **Starting with the repository alone** needs no S3 bucket: set up Bitbucket, fill in this panel and press
91284
+ Sync now. Everyone's skills and tools come down; yours are committed as you create them.
91285
+
91286
+ **Python tools from the repository** need approving once on each machine, like any shared tool. Tool code
91287
+ approved before (from a bucket, say) with exactly the same content is recognised and not asked again.
91288
+
91136
91289
  **"Newer in the repository"** (grey, not red): a colleague's change reached the repository before your
91137
91290
  bucket sync brought it here. Your copy is unchanged, so nothing clashes; it clears once the bucket syncs.
91138
91291
  **"Not synced - changed both here and in the repository"** (red) means both sides really changed. Compare
@@ -92466,7 +92619,9 @@ is done and decided, the current state, open questions and next steps - and a ne
92466
92619
  its first message. Your own messages are quoted word for word, and the files read and changed and the
92467
92620
  commands run are listed from the actual tool calls, so nothing important rests on the summary alone. A
92468
92621
  progress panel shows each step and how much has been written; Cancel stops it, and a failure leaves the
92469
- chat as it was. The old chat stays in History.
92622
+ chat as it was. The old chat stays in History. When a reply fails because the conversation is too long
92623
+ for the model, the error offers this too - it still works then, because the write-up is made from a
92624
+ shortened transcript.
92470
92625
 
92471
92626
  **History is compacted only when you say so.** **Compact now** under the token bar summarises the
92472
92627
  older part (highlighted near the limit); the stored transcript keeps everything, only what is sent to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chosengeneration/light-code",
3
- "version": "0.153.0",
3
+ "version": "0.155.0",
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",