@chosengeneration/light-code 0.145.0 → 0.147.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 +723 -482
  2. package/dist/server.cjs +703 -462
  3. package/package.json +1 -1
package/dist/server.cjs CHANGED
@@ -1134,24 +1134,24 @@ var require_HeaderParser = __commonJS({
1134
1134
  if (this.npairs === this.maxHeaderPairs) {
1135
1135
  return;
1136
1136
  }
1137
- const lines = this.buffer.split(RE_CRLF);
1138
- const len = lines.length;
1137
+ const lines2 = this.buffer.split(RE_CRLF);
1138
+ const len = lines2.length;
1139
1139
  let m, h;
1140
1140
  for (var i = 0; i < len; ++i) {
1141
- if (lines[i].length === 0) {
1141
+ if (lines2[i].length === 0) {
1142
1142
  continue;
1143
1143
  }
1144
- if (lines[i][0] === " " || lines[i][0] === " ") {
1144
+ if (lines2[i][0] === " " || lines2[i][0] === " ") {
1145
1145
  if (h) {
1146
- this.header[h][this.header[h].length - 1] += lines[i];
1146
+ this.header[h][this.header[h].length - 1] += lines2[i];
1147
1147
  continue;
1148
1148
  }
1149
1149
  }
1150
- const posColon = lines[i].indexOf(":");
1150
+ const posColon = lines2[i].indexOf(":");
1151
1151
  if (posColon === -1 || posColon === 0) {
1152
1152
  return;
1153
1153
  }
1154
- m = RE_HDR.exec(lines[i]);
1154
+ m = RE_HDR.exec(lines2[i]);
1155
1155
  h = m[1].toLowerCase();
1156
1156
  this.header[h] = this.header[h] || [];
1157
1157
  this.header[h].push(m[2] || "");
@@ -19651,9 +19651,9 @@ var require_compile = __commonJS({
19651
19651
  if (_sch)
19652
19652
  return _sch;
19653
19653
  const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId);
19654
- const { es5, lines } = this.opts.code;
19654
+ const { es5, lines: lines2 } = this.opts.code;
19655
19655
  const { ownProperties } = this.opts;
19656
- const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties });
19656
+ const gen = new codegen_1.CodeGen(this.scope, { es5, lines: lines2, ownProperties });
19657
19657
  let _ValidationError;
19658
19658
  if (sch.$async) {
19659
19659
  _ValidationError = gen.scopeValue("Error", {
@@ -20800,8 +20800,8 @@ var require_core = __commonJS({
20800
20800
  this._loading = {};
20801
20801
  this._cache = /* @__PURE__ */ new Map();
20802
20802
  opts = this.opts = { ...opts, ...requiredOptions(opts) };
20803
- const { es5, lines } = this.opts.code;
20804
- this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines });
20803
+ const { es5, lines: lines2 } = this.opts.code;
20804
+ this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines: lines2 });
20805
20805
  this.logger = getLogger(opts.logger);
20806
20806
  const formatOpt = opts.validateFormats;
20807
20807
  opts.validateFormats = false;
@@ -26079,14 +26079,14 @@ function toDotPath(_path) {
26079
26079
  return segs.join("");
26080
26080
  }
26081
26081
  function prettifyError(error51) {
26082
- const lines = [];
26082
+ const lines2 = [];
26083
26083
  const issues = [...error51.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
26084
26084
  for (const issue2 of issues) {
26085
- lines.push(`\u2716 ${issue2.message}`);
26085
+ lines2.push(`\u2716 ${issue2.message}`);
26086
26086
  if (issue2.path?.length)
26087
- lines.push(` \u2192 at ${toDotPath(issue2.path)}`);
26087
+ lines2.push(` \u2192 at ${toDotPath(issue2.path)}`);
26088
26088
  }
26089
- return lines.join("\n");
26089
+ return lines2.join("\n");
26090
26090
  }
26091
26091
 
26092
26092
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
@@ -26904,9 +26904,9 @@ var Doc = class {
26904
26904
  return;
26905
26905
  }
26906
26906
  const content = arg;
26907
- const lines = content.split("\n").filter((x) => x);
26908
- const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
26909
- const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
26907
+ const lines2 = content.split("\n").filter((x) => x);
26908
+ const minIndent = Math.min(...lines2.map((x) => x.length - x.trimStart().length));
26909
+ const dedented = lines2.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
26910
26910
  for (const line of dedented) {
26911
26911
  this.content.push(line);
26912
26912
  }
@@ -26915,8 +26915,8 @@ var Doc = class {
26915
26915
  const F = Function;
26916
26916
  const args = this?.args;
26917
26917
  const content = this?.content ?? [``];
26918
- const lines = [...content.map((x) => ` ${x}`)];
26919
- return new F(...args, lines.join("\n"));
26918
+ const lines2 = [...content.map((x) => ` ${x}`)];
26919
+ return new F(...args, lines2.join("\n"));
26920
26920
  }
26921
26921
  };
26922
26922
 
@@ -40430,6 +40430,11 @@ var autosysAuthSchema = external_exports.object({
40430
40430
  */
40431
40431
  sendBasic: external_exports.boolean(),
40432
40432
  basicHeaderName: external_exports.string().min(1),
40433
+ /**
40434
+ * The whole value for `basicHeaderName`, as the user made it (e.g. `Basic dXNlcjpwYXNz`), in
40435
+ * secret storage. When set it is sent verbatim and the username and password are not needed.
40436
+ */
40437
+ basicHeaderValueRef: external_exports.string().min(1),
40433
40438
  /** Client certificate for the gateway. Absent uses Settings → Network's, as every connection does. */
40434
40439
  certFile: external_exports.string().min(1),
40435
40440
  keyFile: external_exports.string().min(1),
@@ -40504,6 +40509,17 @@ var configSchema = external_exports.object({
40504
40509
  embedder: embedderConfigSchema,
40505
40510
  retrieval: retrievalConfigSchema,
40506
40511
  skills: skillsConfigSchema,
40512
+ /**
40513
+ * Sending skills to the team pool. `keepPrivate` names skills this user keeps to themselves:
40514
+ * "Send my skills to the team" skips them and takes back any copy sent before. A top-level key
40515
+ * of its own, so a window saving `skills` (its folders) cannot drop it (§12u, 0.122.1).
40516
+ */
40517
+ teamSkills: external_exports.object({ keepPrivate: external_exports.array(external_exports.string().min(1)) }).partial(),
40518
+ /**
40519
+ * What this user answers by default to a skill's placeholders, by skill name then placeholder
40520
+ * name - so the assistant uses them instead of stopping to ask. See `skills/defaults.ts`.
40521
+ */
40522
+ skillDefaults: external_exports.record(external_exports.string(), external_exports.record(external_exports.string(), external_exports.string())),
40507
40523
  /**
40508
40524
  * Where tools may read outside the workspace.
40509
40525
  *
@@ -40895,7 +40911,7 @@ function toEnvironment(variables) {
40895
40911
 
40896
40912
  // ../../packages/core/dist/python/codeGenerator.js
40897
40913
  function buildCodeGenerationPrompt(request) {
40898
- const lines = [
40914
+ const lines2 = [
40899
40915
  "Write one complete Python file implementing the tool described below.",
40900
40916
  "",
40901
40917
  "Requirements, all load-bearing:",
@@ -40916,9 +40932,9 @@ function buildCodeGenerationPrompt(request) {
40916
40932
  request.specification
40917
40933
  ];
40918
40934
  if (request.existingSource !== void 0 && request.existingSource.length > 0) {
40919
- lines.push("", "This tool already exists. Change what the requirement asks for and leave the rest alone \u2014", "return the whole file, including the parts you did not touch.", "", "Current file:", request.existingSource);
40935
+ lines2.push("", "This tool already exists. Change what the requirement asks for and leave the rest alone \u2014", "return the whole file, including the parts you did not touch.", "", "Current file:", request.existingSource);
40920
40936
  }
40921
- return lines.join("\n");
40937
+ return lines2.join("\n");
40922
40938
  }
40923
40939
  function unwrapFencedSource(text) {
40924
40940
  const trimmed = text.trim();
@@ -41421,6 +41437,12 @@ var USER_SCOPE_ONLY_KEYS = [
41421
41437
  // where that happens is the user's call. `.lightcode/skills/` is always read regardless, so
41422
41438
  // a project loses nothing.
41423
41439
  "skills",
41440
+ // Which skills go to the team pool: a repository able to set it could publish skills the user
41441
+ // chose to keep to themselves.
41442
+ "teamSkills",
41443
+ // Answers given to skills on the user's behalf. A repository able to set them would choose what
41444
+ // the assistant fills in - an environment, a recipient - without anybody being asked.
41445
+ "skillDefaults",
41424
41446
  // A schedule runs tools with nobody watching. A repository able to add one would execute
41425
41447
  // code of its choosing the moment the panel opened.
41426
41448
  "schedules",
@@ -43222,9 +43244,9 @@ async function* parseSseStream(body, url2, signal, logger) {
43222
43244
  if (done)
43223
43245
  break;
43224
43246
  buffer += decoder.decode(value, { stream: true });
43225
- const lines = buffer.split("\n");
43226
- buffer = lines.pop() ?? "";
43227
- for (const line of lines) {
43247
+ const lines2 = buffer.split("\n");
43248
+ buffer = lines2.pop() ?? "";
43249
+ for (const line of lines2) {
43228
43250
  const trimmed = line.trim();
43229
43251
  if (trimmed.length > 0)
43230
43252
  logger?.debug("sse line", trimmed);
@@ -43430,9 +43452,9 @@ async function* parseAnthropicStream(body, url2, signal, logger) {
43430
43452
  if (done)
43431
43453
  break;
43432
43454
  buffer += decoder.decode(value, { stream: true });
43433
- const lines = buffer.split("\n");
43434
- buffer = lines.pop() ?? "";
43435
- for (const line of lines) {
43455
+ const lines2 = buffer.split("\n");
43456
+ buffer = lines2.pop() ?? "";
43457
+ for (const line of lines2) {
43436
43458
  const trimmed = line.trim();
43437
43459
  if (!trimmed.startsWith("data:"))
43438
43460
  continue;
@@ -43668,9 +43690,9 @@ async function* parseGeminiStream(body, url2, signal) {
43668
43690
  if (done)
43669
43691
  break;
43670
43692
  buffer += decoder.decode(value, { stream: true });
43671
- const lines = buffer.split("\n");
43672
- buffer = lines.pop() ?? "";
43673
- for (const line of lines) {
43693
+ const lines2 = buffer.split("\n");
43694
+ buffer = lines2.pop() ?? "";
43695
+ for (const line of lines2) {
43674
43696
  const trimmed = line.trim();
43675
43697
  if (!trimmed.startsWith("data:"))
43676
43698
  continue;
@@ -44757,19 +44779,19 @@ function defaultPromptFor(role, custom2 = []) {
44757
44779
  return roleInfo(role, custom2).prompt;
44758
44780
  }
44759
44781
  function buildAgentPrompt(options) {
44760
- const lines = [
44782
+ const lines2 = [
44761
44783
  options.prompt.trim(),
44762
44784
  "",
44763
44785
  specialistPreamble(options.usesTools, options.canWrite === true)
44764
44786
  ];
44765
44787
  if (options.briefing !== void 0 && options.briefing.trim().length > 0) {
44766
- lines.push("", options.briefing);
44788
+ lines2.push("", options.briefing);
44767
44789
  }
44768
- lines.push("", "---", "", options.question);
44790
+ lines2.push("", "---", "", options.question);
44769
44791
  if (options.files !== void 0 && options.files.length > 0) {
44770
- lines.push("", options.usesTools ? "The assistant named these files as relevant. Start there \u2014 you can open them yourself:" : "The assistant named these files as relevant. You cannot open them \u2014 they are listed so you know what it is looking at:", ...options.files.map((file2) => `- ${file2}`));
44792
+ lines2.push("", options.usesTools ? "The assistant named these files as relevant. Start there \u2014 you can open them yourself:" : "The assistant named these files as relevant. You cannot open them \u2014 they are listed so you know what it is looking at:", ...options.files.map((file2) => `- ${file2}`));
44771
44793
  }
44772
- return lines.join("\n");
44794
+ return lines2.join("\n");
44773
44795
  }
44774
44796
 
44775
44797
  // ../../packages/core/dist/agent/checkpoints.js
@@ -44787,9 +44809,9 @@ function normalise(text) {
44787
44809
  return text.trim().toLowerCase().replace(/\s+/g, " ").replace(/[.;,:]+$/, "");
44788
44810
  }
44789
44811
  function parseCheckpoints(plan2) {
44790
- const lines = (plan2 ?? "").split(/\r?\n/);
44812
+ const lines2 = (plan2 ?? "").split(/\r?\n/);
44791
44813
  const items = [];
44792
- lines.forEach((line, index) => {
44814
+ lines2.forEach((line, index) => {
44793
44815
  const match = LIST_ITEM.exec(line);
44794
44816
  if (match === null)
44795
44817
  return;
@@ -44810,7 +44832,7 @@ function parseCheckpoints(plan2) {
44810
44832
  const texts = steps.length > 0 ? steps : (
44811
44833
  // No list at all: plenty of people write a plan as bare lines, and a progress view that
44812
44834
  // only worked for bullet-point authors would read as broken.
44813
- lines.map((line, index) => ({ indent: 0, ordered: false, text: line.trim(), line: index })).filter((item) => item.text.length > 0)
44835
+ lines2.map((line, index) => ({ indent: 0, ordered: false, text: line.trim(), line: index })).filter((item) => item.text.length > 0)
44814
44836
  );
44815
44837
  const chosen = texts.slice(0, MAX_CHECKPOINTS);
44816
44838
  const seen = /* @__PURE__ */ new Map();
@@ -44818,7 +44840,7 @@ function parseCheckpoints(plan2) {
44818
44840
  const key2 = normalise(item.text);
44819
44841
  const occurrence = (seen.get(key2) ?? 0) + 1;
44820
44842
  seen.set(key2, occurrence);
44821
- const until = chosen[position + 1]?.line ?? lines.length;
44843
+ const until = chosen[position + 1]?.line ?? lines2.length;
44822
44844
  return {
44823
44845
  id: occurrence === 1 ? idFor(key2) : `${idFor(key2)}-${String(occurrence)}`,
44824
44846
  index: position + 1,
@@ -44828,7 +44850,7 @@ function parseCheckpoints(plan2) {
44828
44850
  * which is where the allocation actually lives, since a specialist is usually named on a
44829
44851
  * continuation line ("Owner: reviewer") or inside a sub-point rather than in the heading.
44830
44852
  */
44831
- plannedRoles: rolesMentionedIn(lines.slice(item.line, until).join(" "))
44853
+ plannedRoles: rolesMentionedIn(lines2.slice(item.line, until).join(" "))
44832
44854
  };
44833
44855
  });
44834
44856
  }
@@ -44946,15 +44968,19 @@ function buildPlanGuidance(plan2) {
44946
44968
 
44947
44969
  // ../../packages/core/dist/agent/systemPrompt.js
44948
44970
  function buildSystemPrompt(workspaceRoot, options = {}) {
44949
- const lines = [
44971
+ const lines2 = [
44950
44972
  "You are Light Code, a coding assistant working inside a user's VS Code workspace.",
44951
44973
  "",
44952
44974
  `Workspace root: ${workspaceRoot}`
44953
44975
  ];
44976
+ const codebaseInstructions = options.codebaseInstructions ?? "";
44977
+ if (codebaseInstructions.length > 0) {
44978
+ lines2.push("", 'The user has written instructions for this codebase. They are under "## Codebase instructions" at the', "end of this prompt, and they override the general guidance in between. Follow them in every reply.");
44979
+ }
44954
44980
  if (options.model !== void 0 && options.model.length > 0) {
44955
- lines.push("", "About you:", `- You are running as the model "${options.model}"${options.providerLabel !== void 0 && options.providerLabel.length > 0 ? `, through the provider profile "${options.providerLabel}"` : ""}.`, "- If the user asks which model or provider they are talking to, answer with exactly", " that. Do not guess from your training data; the user may have configured a model", " or a gateway alias you have never heard of, and that configured name is the truth.");
44981
+ lines2.push("", "About you:", `- You are running as the model "${options.model}"${options.providerLabel !== void 0 && options.providerLabel.length > 0 ? `, through the provider profile "${options.providerLabel}"` : ""}.`, "- If the user asks which model or provider they are talking to, answer with exactly", " that. Do not guess from your training data; the user may have configured a model", " or a gateway alias you have never heard of, and that configured name is the truth.");
44956
44982
  }
44957
- lines.push(
44983
+ lines2.push(
44958
44984
  "",
44959
44985
  "Guidelines:",
44960
44986
  "- Use the provided tools to inspect and modify the workspace. Do not guess file contents.",
@@ -44990,14 +45016,11 @@ function buildSystemPrompt(workspaceRoot, options = {}) {
44990
45016
  "- Before asking, check what is here: the imports and existing calls in this workspace are",
44991
45017
  " evidence about the version actually installed, and a skill may already describe it."
44992
45018
  );
44993
- if (options.codebaseInstructions !== void 0 && options.codebaseInstructions.length > 0) {
44994
- lines.push("", options.codebaseInstructions);
44995
- }
44996
45019
  if (options.skills !== void 0 && options.skills.length > 0) {
44997
- lines.push("", options.skills);
45020
+ lines2.push("", options.skills);
44998
45021
  }
44999
45022
  if (options.pythonToolsDisabled === true) {
45000
- lines.push(
45023
+ lines2.push(
45001
45024
  "",
45002
45025
  "Python tools:",
45003
45026
  "- You cannot create runnable tools right now \u2014 the feature is switched off in Settings",
@@ -45008,11 +45031,11 @@ function buildSystemPrompt(workspaceRoot, options = {}) {
45008
45031
  " Settings \u2192 Python, or have you write an ordinary script instead."
45009
45032
  );
45010
45033
  } else if (options.pythonToolsAvailable === true) {
45011
- lines.push("", "Python tools:", "- `create_python_tool` makes a real, registered, callable tool. Use it whenever the user", ' asks for a "tool", even if writing a script would be easier.', "- Writing a .py file with `write_to_file` does NOT create a tool. It is just a file, and", " nothing can call it. Never describe that as having created a tool.", "- `update_python_tool` edits one, `delete_python_tool` removes one.");
45034
+ lines2.push("", "Python tools:", "- `create_python_tool` makes a real, registered, callable tool. Use it whenever the user", ' asks for a "tool", even if writing a script would be easier.', "- Writing a .py file with `write_to_file` does NOT create a tool. It is just a file, and", " nothing can call it. Never describe that as having created a tool.", "- `update_python_tool` edits one, `delete_python_tool` removes one.");
45012
45035
  }
45013
- lines.push("", "Specialist roles:", "- The team of specialists is configurable, and you can change it. `read_role_prompt` shows", " what a role is told it is (no argument lists them all); `update_role` changes that, or a", " custom role's name, summary and workspace access.", "- `create_role` invents one \u2014 a security reviewer, say \u2014 and `delete_role` removes a custom", " one. The user approves each of these, seeing the whole role or a diff of it.", '- So "make the reviewer stricter" or "add a role that reviews SQL" is something to do, not', " something to explain how to do by hand.");
45036
+ lines2.push("", "Specialist roles:", "- The team of specialists is configurable, and you can change it. `read_role_prompt` shows", " what a role is told it is (no argument lists them all); `update_role` changes that, or a", " custom role's name, summary and workspace access.", "- `create_role` invents one \u2014 a security reviewer, say \u2014 and `delete_role` removes a custom", " one. The user approves each of these, seeing the whole role or a diff of it.", '- So "make the reviewer stricter" or "add a role that reviews SQL" is something to do, not', " something to explain how to do by hand.");
45014
45037
  if (options.skills !== void 0 || options.skillsSearchable === true) {
45015
- lines.push("", "Skills, before anything else:", "- Check the skills for this workspace before you plan or answer. They record how *this*", " project works, and they exist because someone was tired of explaining it.", "- A skill that applies overrides your general knowledge. Do not restate a convention it", " contradicts.", ...options.teamSkillsAvailable === true ? [
45038
+ lines2.push("", "Skills, before anything else:", "- Check the skills for this workspace before you plan or answer. They record how *this*", " project works, and they exist because someone was tired of explaining it.", "- A skill that applies overrides your general knowledge. Do not restate a convention it", " contradicts.", ...options.teamSkillsAvailable === true ? [
45016
45039
  "- `search_team_skills` searches what OTHER people have taught their assistants. Use it",
45017
45040
  " only when the user asks, or when this workspace plainly has nothing on the subject",
45018
45041
  " and the question is about another team's system.",
@@ -45021,14 +45044,14 @@ function buildSystemPrompt(workspaceRoot, options = {}) {
45021
45044
  ] : []);
45022
45045
  }
45023
45046
  if (options.canWriteSkills === true) {
45024
- lines.push("", "Recording what you learn:", "- When the user explains something durable about their environment \u2014 an internal", " library and how to use it, a house convention, the shape of an in-house API, a", " gotcha specific to this codebase \u2014 offer to record it with write_skill. Ask first;", " do not write one unprompted.", '- "Durable" means it would be true again next week and useful to a future', " conversation. A one-off instruction for the current task is not a skill.", options.skillsSearchable === true ? "- Before writing a new skill, search for one with search_docs: if a note already covers the subject, read it and update that instead of creating a near-duplicate." : "- Before writing a new skill, check the list above: if one already covers the subject, read it and update that instead of creating a near-duplicate.", "- When you learn something *corrects* an existing skill, say so and offer to update", " it. A stale skill is worse than a missing one, because it is trusted.", "- Write for a reader who has none of this conversation: name the package, the import", ' path, the function, and show a short example. Avoid "as discussed" and "the usual".', options.skillsSearchable === true ? "- The description line is what search matches on, so make it say what subject the skill covers in the words someone would search for \u2014 it is a trigger, not a summary." : "- The description line is the only part always in context, so make it say what subject the skill covers \u2014 it is a trigger for reading, not a summary.");
45047
+ lines2.push("", "Recording what you learn:", "- When the user explains something durable about their environment \u2014 an internal", " library and how to use it, a house convention, the shape of an in-house API, a", " gotcha specific to this codebase \u2014 offer to record it with write_skill. Ask first;", " do not write one unprompted.", '- "Durable" means it would be true again next week and useful to a future', " conversation. A one-off instruction for the current task is not a skill.", options.skillsSearchable === true ? "- Before writing a new skill, search for one with search_docs: if a note already covers the subject, read it and update that instead of creating a near-duplicate." : "- Before writing a new skill, check the list above: if one already covers the subject, read it and update that instead of creating a near-duplicate.", "- When you learn something *corrects* an existing skill, say so and offer to update", " it. A stale skill is worse than a missing one, because it is trusted.", "- Write for a reader who has none of this conversation: name the package, the import", ' path, the function, and show a short example. Avoid "as discussed" and "the usual".', options.skillsSearchable === true ? "- The description line is what search matches on, so make it say what subject the skill covers in the words someone would search for \u2014 it is a trigger, not a summary." : "- The description line is the only part always in context, so make it say what subject the skill covers \u2014 it is a trigger for reading, not a summary.");
45025
45048
  }
45026
- lines.push("", "Charts:", "- **Draw one whenever numbers are easier seen than read** \u2014 a count per folder or per day, a", " value trending over time, a breakdown of a total. Use show_chart; do not print a table of", " figures where a chart would answer the question faster.", "- **Always fill in `detail`** when the numbers count things that can be named \u2014 the subjects,", ' the files, the ids. A bar reading 14 is only useful if "which fourteen?" has an answer, and', " the detail is what lets the user open the bar instead of asking you to search again.", "- Say in `note` where the numbers came from and what they exclude. A chart is believed", " without being checked, so its limits have to travel with it.", "- Series must have exactly one value per category. A mismatch is refused rather than padded,", " because a chart drawn from misaligned data looks correct and is not.", "- After drawing, describe what it shows. Do not recite the numbers again \u2014 they are on screen.", "- **A Python tool can produce the data.** Have it return JSON shaped", ' `{"categories": [...], "series": [{"name": ..., "values": [...], "detail": [[...], ...]}]}`', " and pass that straight to show_chart. That is the intended way to chart anything you have", " analysed in Python \u2014 the tool does the arithmetic, show_chart draws it, and the numbers are", " never retyped by you in between.");
45049
+ lines2.push("", "Charts:", "- **Draw one whenever numbers are easier seen than read** \u2014 a count per folder or per day, a", " value trending over time, a breakdown of a total. Use show_chart; do not print a table of", " figures where a chart would answer the question faster.", "- **Always fill in `detail`** when the numbers count things that can be named \u2014 the subjects,", ' the files, the ids. A bar reading 14 is only useful if "which fourteen?" has an answer, and', " the detail is what lets the user open the bar instead of asking you to search again.", "- Say in `note` where the numbers came from and what they exclude. A chart is believed", " without being checked, so its limits have to travel with it.", "- Series must have exactly one value per category. A mismatch is refused rather than padded,", " because a chart drawn from misaligned data looks correct and is not.", "- After drawing, describe what it shows. Do not recite the numbers again \u2014 they are on screen.", "- **A Python tool can produce the data.** Have it return JSON shaped", ' `{"categories": [...], "series": [{"name": ..., "values": [...], "detail": [[...], ...]}]}`', " and pass that straight to show_chart. That is the intended way to chart anything you have", " analysed in Python \u2014 the tool does the arithmetic, show_chart draws it, and the numbers are", " never retyped by you in between.");
45027
45050
  if (options.canWriteCollectors === true && (options.datasets ?? []).length === 0) {
45028
- lines.push("", "Custom datasets:", "- None are configured yet. The user sets one up in Settings, Custom data, by pointing at a", " tool that returns records \u2014 and can ask you to write that tool. If they do, it is an", " ordinary Python tool and the contract is below. Follow it exactly: a collector returning", " the wrong shape is refused when it runs, not when it is written.", "", COLLECTOR_TOOL_GUIDANCE);
45051
+ lines2.push("", "Custom datasets:", "- None are configured yet. The user sets one up in Settings, Custom data, by pointing at a", " tool that returns records \u2014 and can ask you to write that tool. If they do, it is an", " ordinary Python tool and the contract is below. Follow it exactly: a collector returning", " the wrong shape is refused when it runs, not when it is written.", "", COLLECTOR_TOOL_GUIDANCE);
45029
45052
  }
45030
45053
  if (options.datasets !== void 0 && options.datasets.length > 0) {
45031
- lines.push("", "Custom datasets:", `- The user collects these themselves: ${options.datasets.map((dataset) => `${dataset.name} (${String(dataset.records)} records)`).join(", ")}.`, "- **Use search_data for anything about data the organisation collects itself** \u2014 tickets,", " wiki pages, rows from an internal system. It is the only way to reach these; they are not", " in the codebase and not in the mail index.", "- It searches what has been **synced**, not the live source. If the answer turns on", " something very recent, say when the dataset was last synced rather than implying it is", " current. Do not offer to refresh it yourself \u2014 syncing is triggered by the user.", ...options.canWriteCollectors === true ? [
45054
+ lines2.push("", "Custom datasets:", `- The user collects these themselves: ${options.datasets.map((dataset) => `${dataset.name} (${String(dataset.records)} records)`).join(", ")}.`, "- **Use search_data for anything about data the organisation collects itself** \u2014 tickets,", " wiki pages, rows from an internal system. It is the only way to reach these; they are not", " in the codebase and not in the mail index.", "- It searches what has been **synced**, not the live source. If the answer turns on", " something very recent, say when the dataset was last synced rather than implying it is", " current. Do not offer to refresh it yourself \u2014 syncing is triggered by the user.", ...options.canWriteCollectors === true ? [
45032
45055
  "- If they want a dataset you cannot find, you can write the collector: it is an",
45033
45056
  " ordinary Python tool returning records. Offer, do not assume \u2014 then they configure",
45034
45057
  " it in Settings, Custom data. The contract is below.",
@@ -45037,18 +45060,20 @@ function buildSystemPrompt(workspaceRoot, options = {}) {
45037
45060
  ] : []);
45038
45061
  }
45039
45062
  if (options.mailIndexed === true) {
45040
- lines.push("", "Email:", "- **Always answer questions about email from the index, using search_mail and", " mail_patterns.** That is what it is for. It is fast, it answers questions about time", " and recurrence that a live search cannot, and it does not disturb the running Outlook.", '- **Only search Outlook itself when the user asks you to.** "Check Outlook", "look at my', ' actual mailbox", "is it there now" and anything similar are the instruction to use', " outlook_search. Do not reach for it on your own initiative.", "- If the index has nothing, say so plainly and say when it was last synced. Do not", " quietly fall back to scanning Outlook - a slow live scan that nobody asked for reads", " as the assistant having hung.", "- One exception worth naming: if the user is asking about something that arrived in the", " last few minutes, the index may not have it yet. Say that, and offer to check Outlook", " rather than doing it unasked.", "- **The index holds plain text.** Colours, highlighting and images are not in it. When", " those could carry meaning \u2014 a red line marking a failure, a highlighted cell \u2014 use", " outlook_read_email on the id, which reads the live message and reports the colours.", " Never conclude a message looks fine from indexed text alone.", "- mail_coverage says which folders are indexed and how far back. Check it before saying", " something is not in the mail: an empty search over an unindexed folder looks exactly", " like an empty search over an indexed one.", "- **Use mail_stats for any question with a number in the answer** \u2014 how many alerts per", " folder, per day, per hour, which senders, whether a figure inside the alerts is climbing.", " It counts everything the filters matched. Never count search results by eye: search", " returns a page, so counting what you were shown reports a sample as if it were the total.", "- mail_stats already returns categories, values and detail in the shape show_chart wants.", " Pass it through rather than retyping the numbers, and keep the detail.");
45063
+ lines2.push("", "Email:", "- **Always answer questions about email from the index, using search_mail and", " mail_patterns.** That is what it is for. It is fast, it answers questions about time", " and recurrence that a live search cannot, and it does not disturb the running Outlook.", '- **Only search Outlook itself when the user asks you to.** "Check Outlook", "look at my', ' actual mailbox", "is it there now" and anything similar are the instruction to use', " outlook_search. Do not reach for it on your own initiative.", "- If the index has nothing, say so plainly and say when it was last synced. Do not", " quietly fall back to scanning Outlook - a slow live scan that nobody asked for reads", " as the assistant having hung.", "- One exception worth naming: if the user is asking about something that arrived in the", " last few minutes, the index may not have it yet. Say that, and offer to check Outlook", " rather than doing it unasked.", "- **The index holds plain text.** Colours, highlighting and images are not in it. When", " those could carry meaning \u2014 a red line marking a failure, a highlighted cell \u2014 use", " outlook_read_email on the id, which reads the live message and reports the colours.", " Never conclude a message looks fine from indexed text alone.", "- mail_coverage says which folders are indexed and how far back. Check it before saying", " something is not in the mail: an empty search over an unindexed folder looks exactly", " like an empty search over an indexed one.", "- **Use mail_stats for any question with a number in the answer** \u2014 how many alerts per", " folder, per day, per hour, which senders, whether a figure inside the alerts is climbing.", " It counts everything the filters matched. Never count search results by eye: search", " returns a page, so counting what you were shown reports a sample as if it were the total.", "- mail_stats already returns categories, values and detail in the shape show_chart wants.", " Pass it through rather than retyping the numbers, and keep the detail.");
45041
45064
  }
45042
45065
  if (options.expertAvailable === true) {
45043
- lines.push("", "Expert consultation:", "- A stronger model, Claude, is available through the ask_claude tool. You CAN talk to", " it. Never tell the user you have no way to reach another model \u2014 you do.", '- **If the user asks you to consult it, do so.** "Ask Claude", "check with the', ' expert", "what does Claude think" and anything similar are direct instructions.', " It is their money and their decision; do not talk them out of it or decide the", " question is too simple to be worth asking.", "- Otherwise, judge it yourself. It costs real money per call, so on your own", " initiative use it for: planning a change spanning several files, diagnosing a bug", " you have already failed to fix once, choosing between designs with long-lived", " consequences, or reviewing something subtle before committing to it.", "- On your own initiative, do not use it for anything you could answer by reading a", " file, for routine edits, or for restating something already established here.", "- If you decide against consulting it, say that you chose not to and why. Do not say", " you are unable to.", "- The expert can read and search this workspace but cannot edit or run anything. It", " cannot see this conversation, so put the context it needs in your question.", "- You remain responsible for the work. Treat its answer as advice from a colleague:", " verify it against the actual code, and say so if you disagree.");
45066
+ lines2.push("", "Expert consultation:", "- A stronger model, Claude, is available through the ask_claude tool. You CAN talk to", " it. Never tell the user you have no way to reach another model \u2014 you do.", '- **If the user asks you to consult it, do so.** "Ask Claude", "check with the', ' expert", "what does Claude think" and anything similar are direct instructions.', " It is their money and their decision; do not talk them out of it or decide the", " question is too simple to be worth asking.", "- Otherwise, judge it yourself. It costs real money per call, so on your own", " initiative use it for: planning a change spanning several files, diagnosing a bug", " you have already failed to fix once, choosing between designs with long-lived", " consequences, or reviewing something subtle before committing to it.", "- On your own initiative, do not use it for anything you could answer by reading a", " file, for routine edits, or for restating something already established here.", "- If you decide against consulting it, say that you chose not to and why. Do not say", " you are unable to.", "- The expert can read and search this workspace but cannot edit or run anything. It", " cannot see this conversation, so put the context it needs in your question.", "- You remain responsible for the work. Treat its answer as advice from a colleague:", " verify it against the actual code, and say so if you disagree.");
45044
45067
  }
45045
45068
  if (options.modeGuidance !== void 0 && options.modeGuidance.length > 0) {
45046
- lines.push("", options.modeGuidance);
45069
+ lines2.push("", options.modeGuidance);
45047
45070
  }
45071
+ if (codebaseInstructions.length > 0)
45072
+ lines2.push("", codebaseInstructions);
45048
45073
  const plan2 = buildPlanGuidance(options.plan);
45049
45074
  if (plan2.length > 0)
45050
- lines.push("", plan2);
45051
- return lines.join("\n");
45075
+ lines2.push("", plan2);
45076
+ return lines2.join("\n");
45052
45077
  }
45053
45078
 
45054
45079
  // ../../packages/core/dist/expert/claudeCli.js
@@ -45492,20 +45517,20 @@ function describeTeam(team) {
45492
45517
  return usable.length === 0 ? "None are assigned on this machine." : `Assigned here: ${usable.join(", ")}.`;
45493
45518
  }
45494
45519
  function trailerFor(agent, team) {
45495
- const lines = [
45520
+ const lines2 = [
45496
45521
  `That is the ${agent.role}'s advice, from ${agent.label}. ` + (agent.usesTools ? "It could read this workspace but cannot change anything in it." : "It has not seen your workspace \u2014 it answered from what you pasted.") + " Check it against the actual code before acting on it, and say so if it turns out to be wrong."
45497
45522
  ];
45498
45523
  const programmer = team.find((candidate) => candidate.role === "programmer" && candidate.available);
45499
45524
  if (agent.role === "reviewer" && programmer !== void 0) {
45500
- lines.push("", "If the programmer wrote this code, take the findings back to it rather than fixing them yourself: paste the code as it stands, the findings in full, and anything you have already checked. It may disagree, and a disagreement is an answer \u2014 you have the real file and neither of them does, so you settle it and say which way you went. Re-review only if the fix was substantial enough that this review no longer describes the code.");
45525
+ lines2.push("", "If the programmer wrote this code, take the findings back to it rather than fixing them yourself: paste the code as it stands, the findings in full, and anything you have already checked. It may disagree, and a disagreement is an answer \u2014 you have the real file and neither of them does, so you settle it and say which way you went. Re-review only if the fix was substantial enough that this review no longer describes the code.");
45501
45526
  }
45502
45527
  if (agent.role === "librarian") {
45503
- lines.push("", "It can record a skill itself, and the user will have approved the text before it was written \u2014 so if it says it wrote one, that is done and not something to repeat. If it said something already written down is wrong or out of date, act on that: a stale skill is worse than a missing one, because it is believed.");
45528
+ lines2.push("", "It can record a skill itself, and the user will have approved the text before it was written \u2014 so if it says it wrote one, that is done and not something to repeat. If it said something already written down is wrong or out of date, act on that: a stale skill is worse than a missing one, because it is believed.");
45504
45529
  }
45505
45530
  if (agent.role === "programmer") {
45506
- lines.push("", "Check this against the real file before applying it \u2014 it was written from what you pasted, so it can miss a convention or a caller it was never shown.");
45531
+ lines2.push("", "Check this against the real file before applying it \u2014 it was written from what you pasted, so it can miss a convention or a caller it was never shown.");
45507
45532
  }
45508
- return lines.join("\n");
45533
+ return lines2.join("\n");
45509
45534
  }
45510
45535
 
45511
45536
  // ../../packages/core/dist/agents/team.js
@@ -47401,10 +47426,10 @@ var OpenSearchIndexWriter = class {
47401
47426
  if (documents.length === 0)
47402
47427
  return;
47403
47428
  await this.assertOwned(index, signal);
47404
- const lines = [];
47429
+ const lines2 = [];
47405
47430
  for (const document of documents) {
47406
- lines.push(JSON.stringify({ index: { _index: index, _id: document.id } }));
47407
- lines.push(JSON.stringify({
47431
+ lines2.push(JSON.stringify({ index: { _index: index, _id: document.id } }));
47432
+ lines2.push(JSON.stringify({
47408
47433
  text: document.text,
47409
47434
  path: document.path,
47410
47435
  startLine: document.startLine,
@@ -47416,7 +47441,7 @@ var OpenSearchIndexWriter = class {
47416
47441
  vector: document.vector
47417
47442
  }));
47418
47443
  }
47419
- const result = await this.request("/_bulk", "POST", `${lines.join("\n")}
47444
+ const result = await this.request("/_bulk", "POST", `${lines2.join("\n")}
47420
47445
  `, signal);
47421
47446
  if (result.errors === true) {
47422
47447
  const firstError = (result.items ?? []).map((item) => item.index?.error?.reason).find((reason) => typeof reason === "string");
@@ -49523,27 +49548,27 @@ function parseMsg(buffer) {
49523
49548
  };
49524
49549
  }
49525
49550
  function renderMsg(parsed) {
49526
- const lines = [];
49551
+ const lines2 = [];
49527
49552
  if (parsed.subject !== void 0)
49528
- lines.push(`Subject: ${parsed.subject}`);
49553
+ lines2.push(`Subject: ${parsed.subject}`);
49529
49554
  if (parsed.from !== void 0)
49530
- lines.push(`From: ${parsed.from}`);
49555
+ lines2.push(`From: ${parsed.from}`);
49531
49556
  if (parsed.to !== void 0)
49532
- lines.push(`To: ${parsed.to}`);
49557
+ lines2.push(`To: ${parsed.to}`);
49533
49558
  if (parsed.cc !== void 0)
49534
- lines.push(`Cc: ${parsed.cc}`);
49559
+ lines2.push(`Cc: ${parsed.cc}`);
49535
49560
  if (parsed.bcc !== void 0)
49536
- lines.push(`Bcc: ${parsed.bcc}`);
49561
+ lines2.push(`Bcc: ${parsed.bcc}`);
49537
49562
  if (parsed.sent !== void 0)
49538
- lines.push(`Sent: ${parsed.sent.toISOString()}`);
49563
+ lines2.push(`Sent: ${parsed.sent.toISOString()}`);
49539
49564
  if (parsed.attachments.length > 0) {
49540
- lines.push(`Attachments: ${parsed.attachments.map((each) => each.name).join(", ")}`);
49565
+ lines2.push(`Attachments: ${parsed.attachments.map((each) => each.name).join(", ")}`);
49541
49566
  }
49542
49567
  if (parsed.bodyFromHtml) {
49543
- lines.push("(no plain-text body in this message; the text below came from its HTML copy)");
49568
+ lines2.push("(no plain-text body in this message; the text below came from its HTML copy)");
49544
49569
  }
49545
- lines.push("", parsed.body);
49546
- return lines.join("\n");
49570
+ lines2.push("", parsed.body);
49571
+ return lines2.join("\n");
49547
49572
  }
49548
49573
 
49549
49574
  // ../../packages/core/dist/documents/zip.js
@@ -50295,7 +50320,7 @@ function createExcelDiagnoseTool(options) {
50295
50320
  async execute() {
50296
50321
  try {
50297
50322
  const report = await options.bridge.request({ op: "excel.diagnose" });
50298
- const lines = [
50323
+ const lines2 = [
50299
50324
  `Excel processes running: ${String(report.excelProcesses)}`,
50300
50325
  `Instances this can reach: ${String(report.instancesReached)}`,
50301
50326
  `Direct attach: ${report.getActiveObject}`,
@@ -50304,15 +50329,15 @@ function createExcelDiagnoseTool(options) {
50304
50329
  ""
50305
50330
  ];
50306
50331
  for (const instance of report.instances) {
50307
- lines.push(`Instance ${String(instance.instance)}${instance.version === void 0 ? "" : ` (Excel ${instance.version})`}:`);
50308
- lines.push(` accepting calls: ${instance.acceptingCalls === true ? "yes" : `no${instance.rejectionCode === void 0 ? "" : ` (${instance.rejectionCode})`}`}`);
50309
- lines.push(` workbooks: ${instance.workbooksUnreadable === true ? "unreadable \u2014 likely Protected View" : (instance.workbooks ?? []).join(", ") || "none"}`);
50332
+ lines2.push(`Instance ${String(instance.instance)}${instance.version === void 0 ? "" : ` (Excel ${instance.version})`}:`);
50333
+ lines2.push(` accepting calls: ${instance.acceptingCalls === true ? "yes" : `no${instance.rejectionCode === void 0 ? "" : ` (${instance.rejectionCode})`}`}`);
50334
+ lines2.push(` workbooks: ${instance.workbooksUnreadable === true ? "unreadable \u2014 likely Protected View" : (instance.workbooks ?? []).join(", ") || "none"}`);
50310
50335
  if (instance.vbaAccessible !== void 0) {
50311
- lines.push(` VBA project reachable: ${instance.vbaAccessible ? "yes" : "no"}`);
50336
+ lines2.push(` VBA project reachable: ${instance.vbaAccessible ? "yes" : "no"}`);
50312
50337
  }
50313
50338
  }
50314
50339
  return {
50315
- content: [...lines, "", "What this means:", ...report.advice.map((entry) => `- ${entry}`)].join("\n")
50340
+ content: [...lines2, "", "What this means:", ...report.advice.map((entry) => `- ${entry}`)].join("\n")
50316
50341
  };
50317
50342
  } catch (error51) {
50318
50343
  return {
@@ -50407,7 +50432,7 @@ function createExcelTraceTool(options) {
50407
50432
  if (result.nodes.length === 0) {
50408
50433
  return { content: `Nothing found at ${result.start} \u2014 the cell may be empty.` };
50409
50434
  }
50410
- const lines = result.nodes.map((node) => {
50435
+ const lines2 = result.nodes.map((node) => {
50411
50436
  const indent = " ".repeat(Number(node.depth ?? 0));
50412
50437
  const feeds = Array.isArray(node.feeds) && node.feeds.length > 0 ? ` <- ${node.feeds.join(", ")}` : "";
50413
50438
  return `${indent}${renderCell(node)}${feeds}`;
@@ -50416,7 +50441,7 @@ function createExcelTraceTool(options) {
50416
50441
  content: [
50417
50442
  `Tracing ${result.start} in ${result.workbook}, from the cell back to its sources:`,
50418
50443
  "",
50419
- ...lines,
50444
+ ...lines2,
50420
50445
  "",
50421
50446
  "Indentation is distance from the starting cell. A cell with no formula is raw input,",
50422
50447
  "so an unexpected value there is a data problem rather than a formula problem.",
@@ -50630,22 +50655,22 @@ function createExcelSheetsTool(options) {
50630
50655
  if (params3.action === "list") {
50631
50656
  return { kind: "text", text: `List the sheets of ${which}. Changes nothing.` };
50632
50657
  }
50633
- const lines = [];
50658
+ const lines2 = [];
50634
50659
  switch (params3.action) {
50635
50660
  case "add":
50636
- lines.push(`Add a sheet called "${params3.sheet ?? ""}" to ${which}.`);
50661
+ lines2.push(`Add a sheet called "${params3.sheet ?? ""}" to ${which}.`);
50637
50662
  break;
50638
50663
  case "rename":
50639
- lines.push(`Rename "${params3.sheet ?? ""}" to "${params3.newName ?? ""}" in ${which}.`);
50664
+ lines2.push(`Rename "${params3.sheet ?? ""}" to "${params3.newName ?? ""}" in ${which}.`);
50640
50665
  break;
50641
50666
  case "copy":
50642
- lines.push(`Copy "${params3.sheet ?? ""}" in ${which}${params3.newName === void 0 ? "" : ` as "${params3.newName}"`}.`);
50667
+ lines2.push(`Copy "${params3.sheet ?? ""}" in ${which}${params3.newName === void 0 ? "" : ` as "${params3.newName}"`}.`);
50643
50668
  break;
50644
50669
  case "move":
50645
- lines.push(`Move "${params3.sheet ?? ""}" to position ${String(params3.position ?? 1)} in ${which}.`);
50670
+ lines2.push(`Move "${params3.sheet ?? ""}" to position ${String(params3.position ?? 1)} in ${which}.`);
50646
50671
  break;
50647
50672
  case "delete":
50648
- lines.push(`DELETE the sheet "${params3.sheet ?? ""}" from ${which}.`);
50673
+ lines2.push(`DELETE the sheet "${params3.sheet ?? ""}" from ${which}.`);
50649
50674
  break;
50650
50675
  }
50651
50676
  if (params3.action === "delete") {
@@ -50657,15 +50682,15 @@ function createExcelSheetsTool(options) {
50657
50682
  range: "A1:H12"
50658
50683
  });
50659
50684
  const filled = used.cells.filter((cell) => cell.value !== null && cell.value !== void 0 && String(cell.value) !== "");
50660
- lines.push("", filled.length === 0 ? "The top-left of that sheet is empty." : `--- what is on it (top-left corner) ---
50685
+ lines2.push("", filled.length === 0 ? "The top-left of that sheet is empty." : `--- what is on it (top-left corner) ---
50661
50686
  ${filled.slice(0, 40).map((cell) => `${cell.address}: ${String(cell.text ?? cell.value)}`).join("\n")}`);
50662
50687
  } catch {
50663
- lines.push("", "Could not read what is on that sheet.");
50688
+ lines2.push("", "Could not read what is on that sheet.");
50664
50689
  }
50665
- lines.push("", "Formulas elsewhere that reference this sheet will become #REF! and cannot be undone", "by renaming it back.");
50690
+ lines2.push("", "Formulas elsewhere that reference this sheet will become #REF! and cannot be undone", "by renaming it back.");
50666
50691
  }
50667
- lines.push("", "The workbook is left unsaved, so nothing reaches disk until it is saved.");
50668
- return { kind: "text", text: lines.join("\n") };
50692
+ lines2.push("", "The workbook is left unsaved, so nothing reaches disk until it is saved.");
50693
+ return { kind: "text", text: lines2.join("\n") };
50669
50694
  },
50670
50695
  async execute(params3) {
50671
50696
  try {
@@ -51077,27 +51102,27 @@ function renderVariable(variable) {
51077
51102
  }
51078
51103
  function renderFrame(frame) {
51079
51104
  const where = frame.file !== void 0 ? `${frame.file}${frame.line !== void 0 ? `:${String(frame.line)}` : ""}` : void 0;
51080
- const lines = [` - ${frame.name}${where !== void 0 ? ` (${where})` : ""}`];
51105
+ const lines2 = [` - ${frame.name}${where !== void 0 ? ` (${where})` : ""}`];
51081
51106
  for (const scope of frame.scopes) {
51082
51107
  if (scope.variables.length === 0)
51083
51108
  continue;
51084
- lines.push(` ${scope.name}:`);
51085
- lines.push(...scope.variables.map(renderVariable));
51109
+ lines2.push(` ${scope.name}:`);
51110
+ lines2.push(...scope.variables.map(renderVariable));
51086
51111
  }
51087
- return lines.join("\n");
51112
+ return lines2.join("\n");
51088
51113
  }
51089
51114
  function renderDebugSnapshot(snapshot) {
51090
- const lines = [
51115
+ const lines2 = [
51091
51116
  `Session: ${snapshot.sessionName} (${snapshot.sessionType})`,
51092
51117
  ...snapshot.program !== void 0 ? [`Program: ${snapshot.program}`] : []
51093
51118
  ];
51094
51119
  if (snapshot.stopped !== void 0) {
51095
- lines.push("", `Paused: ${snapshot.stopped.reason}${snapshot.stopped.description !== void 0 ? ` \u2014 ${snapshot.stopped.description}` : ""}`, "", "Call stack (most recent call first):", ...snapshot.stopped.frames.length === 0 ? [" (could not be read \u2014 the session may have moved on while this was running)"] : snapshot.stopped.frames.map(renderFrame));
51120
+ lines2.push("", `Paused: ${snapshot.stopped.reason}${snapshot.stopped.description !== void 0 ? ` \u2014 ${snapshot.stopped.description}` : ""}`, "", "Call stack (most recent call first):", ...snapshot.stopped.frames.length === 0 ? [" (could not be read \u2014 the session may have moved on while this was running)"] : snapshot.stopped.frames.map(renderFrame));
51096
51121
  } else {
51097
- lines.push("", "Running \u2014 not currently paused. Set a breakpoint to inspect state at a point in time.");
51122
+ lines2.push("", "Running \u2014 not currently paused. Set a breakpoint to inspect state at a point in time.");
51098
51123
  }
51099
- lines.push("", snapshot.recentOutput.length === 0 ? "No console output captured yet." : "Recent console output:", ...snapshot.recentOutput);
51100
- return lines.join("\n");
51124
+ lines2.push("", snapshot.recentOutput.length === 0 ? "No console output captured yet." : "Recent console output:", ...snapshot.recentOutput);
51125
+ return lines2.join("\n");
51101
51126
  }
51102
51127
  function createReadDebugSessionTool(options) {
51103
51128
  return {
@@ -51567,7 +51592,7 @@ function createMailPatternsTool(options) {
51567
51592
  content: `Nothing repeats in the last ${String(lookback)} day(s)${params3.subject === void 0 ? "" : " matching that subject"}. Either it is a one-off, or it arrived before the index starts.`
51568
51593
  };
51569
51594
  }
51570
- const lines = patterns.slice(0, 12).map((pattern) => {
51595
+ const lines2 = patterns.slice(0, 12).map((pattern) => {
51571
51596
  const consistency = pattern.spreadMinutes <= 15 ? "consistently" : pattern.spreadMinutes <= 60 ? "roughly" : "at no consistent time";
51572
51597
  return `${pattern.example}
51573
51598
  ${String(pattern.occurrences)} times across ${String(pattern.days)} day(s), ${consistency} around ${pattern.typicalTime} (spread ${String(pattern.spreadMinutes)} min)
@@ -51577,7 +51602,7 @@ function createMailPatternsTool(options) {
51577
51602
  content: [
51578
51603
  `Repeating messages in the last ${String(lookback)} day(s):`,
51579
51604
  "",
51580
- ...lines,
51605
+ ...lines2,
51581
51606
  ...anniversaries.length > 0 ? [
51582
51607
  "",
51583
51608
  `The same message arrived on the same weekday at a similar time ${String(anniversaries.length)} time(s) before:`,
@@ -51901,8 +51926,8 @@ var MailStore = class {
51901
51926
  if (records.length === 0)
51902
51927
  return;
51903
51928
  await import_promises6.default.mkdir(import_node_path16.default.dirname(this.filePath), { recursive: true });
51904
- const lines = records.map((record2) => JSON.stringify(record2)).join("\n");
51905
- await import_promises6.default.appendFile(this.filePath, `${lines}
51929
+ const lines2 = records.map((record2) => JSON.stringify(record2)).join("\n");
51930
+ await import_promises6.default.appendFile(this.filePath, `${lines2}
51906
51931
  `, "utf8");
51907
51932
  }
51908
51933
  /**
@@ -52629,25 +52654,25 @@ async function readTail(fs41, path61, size, count3) {
52629
52654
  all.shift();
52630
52655
  if (all.length > 0 && all[all.length - 1] === "")
52631
52656
  all.pop();
52632
- const lines = all.slice(-count3);
52657
+ const lines2 = all.slice(-count3);
52633
52658
  return {
52634
- lines,
52635
- hasMoreBefore: start > 0 || all.length > lines.length,
52659
+ lines: lines2,
52660
+ hasMoreBefore: start > 0 || all.length > lines2.length,
52636
52661
  hasMoreAfter: false
52637
52662
  };
52638
52663
  }
52639
52664
  async function readLineWindow(fs41, path61, size, from, count3) {
52640
52665
  const decoder = new import_node_string_decoder.StringDecoder("utf8");
52641
- const lines = [];
52666
+ const lines2 = [];
52642
52667
  let pending = "";
52643
52668
  let lineNumber = 1;
52644
52669
  let position = 0;
52645
52670
  let reachedEnd = true;
52646
52671
  const take = (line) => {
52647
- if (lineNumber >= from && lines.length < count3)
52648
- lines.push(line);
52672
+ if (lineNumber >= from && lines2.length < count3)
52673
+ lines2.push(line);
52649
52674
  lineNumber += 1;
52650
- return lines.length >= count3 && lineNumber > from;
52675
+ return lines2.length >= count3 && lineNumber > from;
52651
52676
  };
52652
52677
  scan: while (position < size) {
52653
52678
  const end = Math.min(size, position + CHUNK);
@@ -52668,10 +52693,10 @@ async function readLineWindow(fs41, path61, size, from, count3) {
52668
52693
  take(pending);
52669
52694
  }
52670
52695
  return {
52671
- lines,
52696
+ lines: lines2,
52672
52697
  firstLineNumber: from,
52673
52698
  hasMoreBefore: from > 1,
52674
- hasMoreAfter: !reachedEnd || lineNumber > from + lines.length
52699
+ hasMoreAfter: !reachedEnd || lineNumber > from + lines2.length
52675
52700
  };
52676
52701
  }
52677
52702
  async function countLines(fs41, path61, size) {
@@ -52729,10 +52754,10 @@ function chunkFile(content, options = {}) {
52729
52754
  const overlapLines = Math.min(options.overlapLines ?? DEFAULT_CHUNK_OPTIONS.overlapLines, windowLines - 1);
52730
52755
  const maxChars = options.maxChars ?? DEFAULT_CHUNK_OPTIONS.maxChars;
52731
52756
  const step = Math.max(1, windowLines - overlapLines);
52732
- const lines = content.replace(/\r\n/g, "\n").split("\n");
52757
+ const lines2 = content.replace(/\r\n/g, "\n").split("\n");
52733
52758
  const chunks = [];
52734
- for (let start = 0; start < lines.length; start += step) {
52735
- const window = lines.slice(start, start + windowLines);
52759
+ for (let start = 0; start < lines2.length; start += step) {
52760
+ const window = lines2.slice(start, start + windowLines);
52736
52761
  const text = window.join("\n");
52737
52762
  if (text.trim().length === 0)
52738
52763
  continue;
@@ -52746,7 +52771,7 @@ function chunkFile(content, options = {}) {
52746
52771
  chunks.push({ text: piece, startLine: start + 1, endLine: start + window.length });
52747
52772
  }
52748
52773
  }
52749
- if (start + windowLines >= lines.length)
52774
+ if (start + windowLines >= lines2.length)
52750
52775
  break;
52751
52776
  }
52752
52777
  return chunks;
@@ -58871,9 +58896,9 @@ var McpConnection = class {
58871
58896
  let buffered = "";
58872
58897
  stream.on("data", (chunk) => {
58873
58898
  buffered += chunk.toString();
58874
- const lines = buffered.split(/\r?\n/);
58875
- buffered = lines.pop() ?? "";
58876
- for (const line of lines) {
58899
+ const lines2 = buffered.split(/\r?\n/);
58900
+ buffered = lines2.pop() ?? "";
58901
+ for (const line of lines2) {
58877
58902
  if (line.trim().length > 0)
58878
58903
  this.onLog(line);
58879
58904
  }
@@ -58957,22 +58982,22 @@ function unauthorizedHint(config2) {
58957
58982
  if (isStdioServer(config2))
58958
58983
  return "The server refused the request (401).";
58959
58984
  const headers = Object.entries(config2.headers ?? {});
58960
- const lines = ["The server answered 401 (not authorised). Worth checking, in order:"];
58985
+ const lines2 = ["The server answered 401 (not authorised). Worth checking, in order:"];
58961
58986
  if (headers.length === 0) {
58962
- lines.push("- No headers are configured, so nothing identified you. Add the one the server expects, usually Authorization: Bearer <token>.");
58987
+ lines2.push("- No headers are configured, so nothing identified you. Add the one the server expects, usually Authorization: Bearer <token>.");
58963
58988
  } else {
58964
58989
  const auth2 = headers.find(([name]) => name.trim().toLowerCase() === "authorization");
58965
58990
  const value = auth2?.[1].trim();
58966
58991
  if (value !== void 0 && /^bearer\s+bearer\s/i.test(value)) {
58967
- lines.push('- Authorization reads "Bearer Bearer \u2026" \u2014 the token itself probably already starts with Bearer.');
58992
+ lines2.push('- Authorization reads "Bearer Bearer \u2026" \u2014 the token itself probably already starts with Bearer.');
58968
58993
  } else if (value !== void 0 && !/^\S+\s+\S/.test(value) && !value.startsWith("${")) {
58969
- lines.push('- Authorization holds a bare token with no scheme. Most servers want "Bearer <token>"; compare with the value the other client sends.');
58994
+ lines2.push('- Authorization holds a bare token with no scheme. Most servers want "Bearer <token>"; compare with the value the other client sends.');
58970
58995
  }
58971
- lines.push(`- Sending ${headers.map(([name]) => name).join(", ")}. Is that the header name the server reads (Authorization, X-API-Key, \u2026)?`);
58996
+ lines2.push(`- Sending ${headers.map(([name]) => name).join(", ")}. Is that the header name the server reads (Authorization, X-API-Key, \u2026)?`);
58972
58997
  }
58973
- lines.push("- Does the server sign in through a browser (OAuth) in the other client? Light Code sends configured headers only, so it needs a token supplied as a header.");
58974
- lines.push("- Is it the same, unexpired token the other client uses?");
58975
- return lines.join("\n");
58998
+ lines2.push("- Does the server sign in through a browser (OAuth) in the other client? Light Code sends configured headers only, so it needs a token supplied as a header.");
58999
+ lines2.push("- Is it the same, unexpired token the other client uses?");
59000
+ return lines2.join("\n");
58976
59001
  }
58977
59002
 
58978
59003
  // ../../packages/core/dist/mcp/deny.js
@@ -59712,32 +59737,32 @@ function dunderValue(source, name) {
59712
59737
  function readToolAttribution(source) {
59713
59738
  return toAttribution((field2) => dunderValue(source, field2));
59714
59739
  }
59715
- function insertionLine(lines) {
59740
+ function insertionLine(lines2) {
59716
59741
  let index = 0;
59717
59742
  const skipBlankAndComments = () => {
59718
- while (index < lines.length && /^\s*(#.*)?$/.test(lines[index] ?? ""))
59743
+ while (index < lines2.length && /^\s*(#.*)?$/.test(lines2[index] ?? ""))
59719
59744
  index += 1;
59720
59745
  };
59721
59746
  skipBlankAndComments();
59722
- const docstring = /^[rRuU]?("""|''')/.exec(lines[index] ?? "");
59747
+ const docstring = /^[rRuU]?("""|''')/.exec(lines2[index] ?? "");
59723
59748
  if (docstring !== null) {
59724
59749
  const quote = docstring[1];
59725
- const opening = lines[index] ?? "";
59750
+ const opening = lines2[index] ?? "";
59726
59751
  const rest = opening.slice(opening.indexOf(quote) + 3);
59727
59752
  index += 1;
59728
59753
  if (!rest.includes(quote)) {
59729
- while (index < lines.length && !(lines[index] ?? "").includes(quote))
59754
+ while (index < lines2.length && !(lines2[index] ?? "").includes(quote))
59730
59755
  index += 1;
59731
59756
  index += 1;
59732
59757
  }
59733
59758
  const afterDocstring = index;
59734
59759
  skipBlankAndComments();
59735
- if (!/^from\s+__future__\s+import\b/.test(lines[index] ?? ""))
59760
+ if (!/^from\s+__future__\s+import\b/.test(lines2[index] ?? ""))
59736
59761
  index = afterDocstring;
59737
59762
  }
59738
- while (/^from\s+__future__\s+import\b/.test(lines[index] ?? ""))
59763
+ while (/^from\s+__future__\s+import\b/.test(lines2[index] ?? ""))
59739
59764
  index += 1;
59740
- return Math.min(index, lines.length);
59765
+ return Math.min(index, lines2.length);
59741
59766
  }
59742
59767
  function writeToolFields(source, values, replace) {
59743
59768
  const eol = source.includes("\r\n") ? "\r\n" : "\n";
@@ -59758,10 +59783,10 @@ function writeToolFields(source, values, replace) {
59758
59783
  }
59759
59784
  if (additions.length === 0)
59760
59785
  return text;
59761
- const lines = text.split(/\r?\n/);
59762
- const at = insertionLine(lines);
59763
- const before = lines.slice(0, at);
59764
- const after = lines.slice(at);
59786
+ const lines2 = text.split(/\r?\n/);
59787
+ const at = insertionLine(lines2);
59788
+ const before = lines2.slice(0, at);
59789
+ const after = lines2.slice(at);
59765
59790
  const existingBlock = /^__(author|project|version|updated)__\s*=/.test(after[0] ?? "");
59766
59791
  const block2 = [
59767
59792
  ...before.length > 0 && (before[before.length - 1] ?? "").trim() !== "" ? [""] : [],
@@ -60304,21 +60329,21 @@ function createUseSkillFileTool(context) {
60304
60329
  parametersSchema: useFileParams,
60305
60330
  async preview(params3, toolContext) {
60306
60331
  const destination = params3.destination ?? import_node_path24.default.basename(params3.file);
60307
- const lines = [
60332
+ const lines2 = [
60308
60333
  `Copy "${params3.file}" from the skill "${params3.skill}" into the workspace as ${destination}.`
60309
60334
  ];
60310
60335
  try {
60311
60336
  const { source } = await locate(params3.skill, params3.file);
60312
60337
  const stat = await import_promises11.default.stat(source);
60313
- lines.push("", `From: ${source}`, `Size: ${String(Math.max(1, Math.round(stat.size / 1024)))} KB`);
60338
+ lines2.push("", `From: ${source}`, `Size: ${String(Math.max(1, Math.round(stat.size / 1024)))} KB`);
60314
60339
  const target = await resolveToolPath(toolContext, destination, { write: true });
60315
60340
  if (target.ok && await exists(target.realPath)) {
60316
- lines.push("", `WARNING: ${target.realPath} already exists and will be replaced.`);
60341
+ lines2.push("", `WARNING: ${target.realPath} already exists and will be replaced.`);
60317
60342
  }
60318
60343
  } catch (error51) {
60319
- lines.push("", `Could not inspect the source: ${error51 instanceof Error ? error51.message : String(error51)}`);
60344
+ lines2.push("", `Could not inspect the source: ${error51 instanceof Error ? error51.message : String(error51)}`);
60320
60345
  }
60321
- return { kind: "text", text: lines.join("\n") };
60346
+ return { kind: "text", text: lines2.join("\n") };
60322
60347
  },
60323
60348
  async execute(params3, toolContext) {
60324
60349
  try {
@@ -60615,6 +60640,10 @@ function secretRefsFor(section, config2) {
60615
60640
  refs.push("AutoSys: gateway client secret");
60616
60641
  if (config2.autosys.auth.passphraseRef !== void 0)
60617
60642
  refs.push("AutoSys: client certificate passphrase");
60643
+ if (config2.autosys.auth.basicHeaderValueRef !== void 0)
60644
+ refs.push("AutoSys: sign-in header value");
60645
+ else if (config2.autosys.auth.sendBasic === true && config2.autosys.tokenRef !== void 0)
60646
+ refs.push("AutoSys: username and password");
60618
60647
  } else if (config2.autosys?.tokenRef !== void 0)
60619
60648
  refs.push("AutoSys: username and password");
60620
60649
  break;
@@ -62543,9 +62572,9 @@ function jsonRecords(content) {
62543
62572
  try {
62544
62573
  return fromValue(JSON.parse(body));
62545
62574
  } catch {
62546
- const lines = body.split(/\r?\n/).filter((line) => line.trim().length > 0);
62575
+ const lines2 = body.split(/\r?\n/).filter((line) => line.trim().length > 0);
62547
62576
  try {
62548
- const parsed = lines.map((line) => JSON.parse(line));
62577
+ const parsed = lines2.map((line) => JSON.parse(line));
62549
62578
  return isRecordList(parsed) ? parsed : void 0;
62550
62579
  } catch {
62551
62580
  return void 0;
@@ -63004,17 +63033,21 @@ var import_node_crypto15 = require("node:crypto");
63004
63033
  // ../../packages/core/dist/atlassian/autosysGateway.js
63005
63034
  function withBasicCredentials(auth2, headerName, username, password) {
63006
63035
  const basic = `Basic ${Buffer.from(`${username}:${password}`, "utf8").toString("base64")}`;
63036
+ return withHeader(auth2, headerName, basic);
63037
+ }
63038
+ function withHeader(auth2, headerName, value) {
63007
63039
  return {
63008
- resolveHeaders: async () => ({ ...await auth2.resolveHeaders(), [headerName]: basic }),
63040
+ resolveHeaders: async () => ({ ...await auth2.resolveHeaders(), [headerName]: value }),
63009
63041
  onUnauthorized: () => auth2.onUnauthorized()
63010
63042
  };
63011
63043
  }
63012
63044
  var AUTOSYS_CLIENT_SECRET_REF = "autosys:clientSecret";
63013
63045
  var AUTOSYS_PASSPHRASE_REF = "autosys:certPassphrase";
63046
+ var AUTOSYS_BASIC_VALUE_REF = "autosys:basicHeaderValue";
63014
63047
  function linesFrom(map2, separator) {
63015
63048
  return Object.entries(map2 ?? {}).map(([key2, value]) => `${key2}${separator}${value}`).join("\n");
63016
63049
  }
63017
- function gatewayView(auth2, hasClientSecret, hasPassphrase) {
63050
+ function gatewayView(auth2, hasClientSecret, hasPassphrase, hasBasicValue = false) {
63018
63051
  return {
63019
63052
  enabled: auth2?.type === "apigee",
63020
63053
  tokenUrl: auth2?.tokenUrl ?? "",
@@ -63035,7 +63068,8 @@ function gatewayView(auth2, hasClientSecret, hasPassphrase) {
63035
63068
  pfxFile: auth2?.pfxFile ?? "",
63036
63069
  useGlobalClientCertificate: auth2?.useGlobalClientCertificate !== false,
63037
63070
  hasClientSecret,
63038
- hasPassphrase
63071
+ hasPassphrase,
63072
+ hasBasicValue
63039
63073
  };
63040
63074
  }
63041
63075
  function parseLines(text, separator, what) {
@@ -63075,7 +63109,7 @@ function gatewayFromSettings(input, stored) {
63075
63109
  const basicHeader = (text(input.basicHeaderName) ?? "Authorization").toLowerCase();
63076
63110
  if (input.sendBasic && tokenHeader === basicHeader) {
63077
63111
  return {
63078
- error: `The gateway token and the AutoSys username and password would both go in the ${text(input.basicHeaderName) ?? "Authorization"} header, and one header holds one value. Set the header the gateway reads its token from (Advanced \u2192 "Header the token is sent in", for example x-apigee-token), or the header AutoSys reads the username and password from \u2014 your gateway team knows which.`
63112
+ error: `The gateway token and the AutoSys sign-in would both go in the ${text(input.basicHeaderName) ?? "Authorization"} header, and one header holds one value. Set the header the gateway reads its token from (Advanced \u2192 "Header the token is sent in", for example x-apigee-token), or the header AutoSys reads the username and password from \u2014 your gateway team knows which.`
63079
63113
  };
63080
63114
  }
63081
63115
  if (text(input.pfxFile) !== void 0 && text(input.certFile) !== void 0) {
@@ -63107,6 +63141,7 @@ function gatewayFromSettings(input, stored) {
63107
63141
  ...Object.keys(params3).length > 0 ? { extraTokenParams: params3 } : {},
63108
63142
  ...input.sendBasic ? { sendBasic: true } : {},
63109
63143
  ...optional2("basicHeaderName", text(input.basicHeaderName)),
63144
+ ...stored.basicValue === true ? { basicHeaderValueRef: AUTOSYS_BASIC_VALUE_REF } : {},
63110
63145
  ...optional2("certFile", text(input.certFile)),
63111
63146
  ...optional2("keyFile", text(input.keyFile)),
63112
63147
  ...optional2("pfxFile", text(input.pfxFile)),
@@ -63768,11 +63803,11 @@ async function searchFiles(fs41, root, options) {
63768
63803
  }
63769
63804
  if (bytes.subarray(0, 8e3).includes(0))
63770
63805
  continue;
63771
- const lines = bytes.toString("utf8").split("\n").map((line) => line.endsWith("\r") ? line.slice(0, -1) : line);
63806
+ const lines2 = bytes.toString("utf8").split("\n").map((line) => line.endsWith("\r") ? line.slice(0, -1) : line);
63772
63807
  const matched = [];
63773
- for (let index = 0; index < lines.length; index += 1) {
63808
+ for (let index = 0; index < lines2.length; index += 1) {
63774
63809
  regex.lastIndex = 0;
63775
- if (regex.test(lines[index]))
63810
+ if (regex.test(lines2[index]))
63776
63811
  matched.push(index);
63777
63812
  }
63778
63813
  if (matched.length === 0)
@@ -63782,14 +63817,14 @@ async function searchFiles(fs41, root, options) {
63782
63817
  let lastPrinted = -2;
63783
63818
  for (const hit of matched) {
63784
63819
  const from = Math.max(0, hit - context, lastPrinted + 1);
63785
- const to = Math.min(lines.length - 1, hit + context);
63820
+ const to = Math.min(lines2.length - 1, hit + context);
63786
63821
  if (from > lastPrinted + 1 && !firstGroup)
63787
63822
  chunks.push("--");
63788
63823
  firstGroup = false;
63789
63824
  for (let index = from; index <= to; index += 1) {
63790
- if (index === lines.length - 1 && lines[index] === "" && !matchSet.has(index))
63825
+ if (index === lines2.length - 1 && lines2[index] === "" && !matchSet.has(index))
63791
63826
  continue;
63792
- const line = `${shown2}${matchSet.has(index) ? ":" : "-"}${index + 1}${matchSet.has(index) ? ":" : "-"}${lines[index]}`;
63827
+ const line = `${shown2}${matchSet.has(index) ? ":" : "-"}${index + 1}${matchSet.has(index) ? ":" : "-"}${lines2[index]}`;
63793
63828
  chunks.push(line);
63794
63829
  size += line.length + 1;
63795
63830
  }
@@ -64901,9 +64936,10 @@ function renderCodebaseInstructions(text) {
64901
64936
  return [
64902
64937
  "## Codebase instructions",
64903
64938
  "",
64904
- "The user wrote these for this codebase, and every chat on it receives them. They come before",
64905
- "the standing instructions below: where the two disagree, follow these. What the user says in",
64906
- "this conversation overrides both.",
64939
+ "The user wrote these for this codebase, and every chat on it receives them. Follow them in every",
64940
+ "reply. They outrank the standing instructions and every general guideline above: where the two",
64941
+ "disagree, follow these. Only what the user says in this conversation, or a plan they set for",
64942
+ "it, overrides them.",
64907
64943
  "",
64908
64944
  cut ? trimmed.slice(0, CODEBASE_INSTRUCTIONS_LIMIT) : trimmed,
64909
64945
  ...cut ? ["", `(Cut at ${String(CODEBASE_INSTRUCTIONS_LIMIT)} characters. Tell the user these instructions are too long to send in full.)`] : []
@@ -64980,6 +65016,58 @@ async function readToolCredential(options) {
64980
65016
  return read("value");
64981
65017
  }
64982
65018
 
65019
+ // ../../packages/core/dist/skills/defaults.js
65020
+ var NAME = "[A-Za-z_][A-Za-z0-9_.-]{0,63}";
65021
+ function findPlaceholders(text) {
65022
+ const found2 = [];
65023
+ const add = (name) => {
65024
+ if (!found2.includes(name))
65025
+ found2.push(name);
65026
+ };
65027
+ const pattern = new RegExp(`\\{\\{\\s*(${NAME})\\s*\\}\\}|<([A-Z][A-Z0-9_]{1,63})>`, "g");
65028
+ for (const match of text.matchAll(pattern))
65029
+ add(match[1] ?? match[2] ?? "");
65030
+ return found2.filter((name) => name.length > 0).slice(0, 50);
65031
+ }
65032
+ function cleanSkillDefaults(input) {
65033
+ const out = {};
65034
+ for (const [key2, value] of Object.entries(input)) {
65035
+ const name = key2.trim();
65036
+ if (name.length === 0 || value.trim().length === 0)
65037
+ continue;
65038
+ out[name] = value.trim();
65039
+ }
65040
+ return out;
65041
+ }
65042
+ function lines(values) {
65043
+ return Object.entries(values).map(([name, value]) => ` - ${name} = ${value}`);
65044
+ }
65045
+ function renderSkillDefaults(defaults, skillNames) {
65046
+ const entries = Object.entries(defaults ?? {}).filter(([name, values]) => skillNames.includes(name) && Object.keys(values).length > 0).sort(([a], [b]) => a.localeCompare(b));
65047
+ if (entries.length === 0)
65048
+ return "";
65049
+ return [
65050
+ "## Skill defaults",
65051
+ "",
65052
+ "The user has answered some skills' placeholders in advance. When you follow one of these skills,",
65053
+ "use these values wherever the skill asks for that input - do not stop to ask the user for them.",
65054
+ "Say briefly which defaults you used. Ask only for inputs that have no default here, or when the",
65055
+ "user's request in this conversation gives a different value (theirs wins).",
65056
+ "",
65057
+ ...entries.flatMap(([name, values]) => [`- ${name}:`, ...lines(values)])
65058
+ ].join("\n");
65059
+ }
65060
+ function skillDefaultsReadNote(skillName, values) {
65061
+ if (values === void 0 || Object.keys(values).length === 0)
65062
+ return void 0;
65063
+ return [
65064
+ "",
65065
+ `[Defaults the user set for the "${skillName}" skill - use them instead of asking for these inputs:`,
65066
+ ...lines(values),
65067
+ " Ask only for inputs not listed, or if the user gave a different value in this conversation.]"
65068
+ ].join("\n");
65069
+ }
65070
+
64983
65071
  // ../../packages/core/dist/jupyter/tools.js
64984
65072
  var import_promises21 = __toESM(require("node:fs/promises"), 1);
64985
65073
  var import_node_path36 = __toESM(require("node:path"), 1);
@@ -65083,22 +65171,22 @@ ${output.error.traceback}`.trim());
65083
65171
  ${parts.join("\n\n")}`;
65084
65172
  }
65085
65173
  function describePull(result) {
65086
- const lines = [];
65174
+ const lines2 = [];
65087
65175
  if (result.fetched.length > 0)
65088
- lines.push(`Fetched ${String(result.fetched.length)} changed file(s) from the hub: ${result.fetched.slice(0, 20).join(", ")}${result.fetched.length > 20 ? ", \u2026" : ""}`);
65176
+ lines2.push(`Fetched ${String(result.fetched.length)} changed file(s) from the hub: ${result.fetched.slice(0, 20).join(", ")}${result.fetched.length > 20 ? ", \u2026" : ""}`);
65089
65177
  if (result.removed.length > 0)
65090
- lines.push(`Removed ${String(result.removed.length)} file(s) deleted on the hub: ${result.removed.slice(0, 20).join(", ")}`);
65178
+ lines2.push(`Removed ${String(result.removed.length)} file(s) deleted on the hub: ${result.removed.slice(0, 20).join(", ")}`);
65091
65179
  if (result.conflicts.length > 0)
65092
- lines.push(`Changed both here and on the hub - kept as they are here, NOT replaced: ${result.conflicts.join(", ")}. Compare with hub_sync "hub_version".`);
65180
+ lines2.push(`Changed both here and on the hub - kept as they are here, NOT replaced: ${result.conflicts.join(", ")}. Compare with hub_sync "hub_version".`);
65093
65181
  if (result.skipped.length > 0)
65094
- lines.push(`Too large to copy: ${result.skipped.join(", ")}`);
65182
+ lines2.push(`Too large to copy: ${result.skipped.join(", ")}`);
65095
65183
  if (result.ignored.length > 0)
65096
- lines.push(`Now listed in .hubignore, so no longer synced (left as they are here and on the hub): ${result.ignored.slice(0, 20).join(", ")}${result.ignored.length > 20 ? ", \u2026" : ""}`);
65184
+ lines2.push(`Now listed in .hubignore, so no longer synced (left as they are here and on the hub): ${result.ignored.slice(0, 20).join(", ")}${result.ignored.length > 20 ? ", \u2026" : ""}`);
65097
65185
  for (const failure of result.failed)
65098
- lines.push(`Could not fetch ${failure.path}: ${failure.problem}`);
65099
- if (lines.length === 0)
65100
- lines.push(`Up to date (${String(result.unchanged)} file(s) unchanged).`);
65101
- return lines.join("\n");
65186
+ lines2.push(`Could not fetch ${failure.path}: ${failure.problem}`);
65187
+ if (lines2.length === 0)
65188
+ lines2.push(`Up to date (${String(result.unchanged)} file(s) unchanged).`);
65189
+ return lines2.join("\n");
65102
65190
  }
65103
65191
  function createHubTools(runtime) {
65104
65192
  const runTool = {
@@ -65201,14 +65289,14 @@ ${pending.map((p) => `- ${p.local} (${p.kind}${p.kind === "deleted" ? " here; st
65201
65289
  const pending = await pendingFor(runtime, context, params3.path);
65202
65290
  if (!pending.ok)
65203
65291
  return { content: pending.message, isError: true };
65204
- const lines = [];
65292
+ const lines2 = [];
65205
65293
  let failed2 = false;
65206
65294
  for (const file2 of pending.files) {
65207
65295
  const result = await runtime.mirror.push(file2, context.signal);
65208
65296
  failed2 ||= !result.saved && result.ignored !== true;
65209
- lines.push(`- ${import_node_path36.default.relative(runtime.mirror.root, file2).split(import_node_path36.default.sep).join("/")}: ${result.message}`);
65297
+ lines2.push(`- ${import_node_path36.default.relative(runtime.mirror.root, file2).split(import_node_path36.default.sep).join("/")}: ${result.message}`);
65210
65298
  }
65211
- return { content: lines.length > 0 ? lines.join("\n") : "Nothing to save.", ...failed2 ? { isError: true } : {} };
65299
+ return { content: lines2.length > 0 ? lines2.join("\n") : "Nothing to save.", ...failed2 ? { isError: true } : {} };
65212
65300
  }
65213
65301
  case "hub_version":
65214
65302
  case "use_hub_version": {
@@ -65433,7 +65521,7 @@ async function hubGitCommitPush(runtime, message4, signal) {
65433
65521
  return { ok: false, text: results };
65434
65522
  if (results.length === 0)
65435
65523
  return { ok: false, text: NOT_A_REPO };
65436
- const lines = [];
65524
+ const lines2 = [];
65437
65525
  let ok = true;
65438
65526
  for (const repo of results) {
65439
65527
  const name = results.length > 1 ? `${import_node_path37.default.posix.basename(repo.repo)}: ` : "";
@@ -65441,21 +65529,21 @@ async function hubGitCommitPush(runtime, message4, signal) {
65441
65529
  const nothing = /nothing to commit/.test(`${repo.commit?.out ?? ""}${repo.commit?.err ?? ""}`);
65442
65530
  if (repo.add?.ok !== true) {
65443
65531
  ok = false;
65444
- lines.push(`${name}git add failed on the hub: ${gist(repo.add)}`);
65532
+ lines2.push(`${name}git add failed on the hub: ${gist(repo.add)}`);
65445
65533
  } else if (!committed && !nothing) {
65446
65534
  ok = false;
65447
- lines.push(`${name}git commit failed on the hub: ${gist(repo.commit)}`);
65535
+ lines2.push(`${name}git commit failed on the hub: ${gist(repo.commit)}`);
65448
65536
  } else if (repo.push?.ok !== true) {
65449
65537
  ok = false;
65450
- lines.push(`${name}${committed ? "Committed on the hub, but the push failed" : "Nothing new to commit, and the push failed"}: ${gist(repo.push)}`);
65538
+ lines2.push(`${name}${committed ? "Committed on the hub, but the push failed" : "Nothing new to commit, and the push failed"}: ${gist(repo.push)}`);
65451
65539
  } else {
65452
- lines.push(`${name}${committed ? "Committed and pushed from the hub." : "Nothing new to commit; pushed the waiting commits."}`);
65540
+ lines2.push(`${name}${committed ? "Committed and pushed from the hub." : "Nothing new to commit; pushed the waiting commits."}`);
65453
65541
  }
65454
65542
  }
65455
65543
  if (deletedHere > 0) {
65456
- lines.push(`${String(deletedHere)} file(s) deleted here are still on the hub, so they were not part of the commit.`);
65544
+ lines2.push(`${String(deletedHere)} file(s) deleted here are still on the hub, so they were not part of the commit.`);
65457
65545
  }
65458
- return { ok, text: lines.join(" ") };
65546
+ return { ok, text: lines2.join(" ") };
65459
65547
  }
65460
65548
  async function hubGitPull(runtime, signal) {
65461
65549
  const results = await runOnHub(runtime, hubGitCode("pull", runtime.mirror.folders.map((f) => f.remote)), signal);
@@ -65463,26 +65551,26 @@ async function hubGitPull(runtime, signal) {
65463
65551
  return { ok: false, text: results };
65464
65552
  if (results.length === 0)
65465
65553
  return { ok: false, text: NOT_A_REPO };
65466
- const lines = [];
65554
+ const lines2 = [];
65467
65555
  let ok = true;
65468
65556
  for (const repo of results) {
65469
65557
  const name = results.length > 1 ? `${import_node_path37.default.posix.basename(repo.repo)}: ` : "";
65470
65558
  const all = `${repo.pull?.out ?? ""}${repo.pull?.err ?? ""}`;
65471
65559
  if (repo.pull?.ok === true)
65472
- lines.push(`${name}${/Already up.to.date/i.test(all) ? "Already up to date." : "Pulled on the hub."}`);
65560
+ lines2.push(`${name}${/Already up.to.date/i.test(all) ? "Already up to date." : "Pulled on the hub."}`);
65473
65561
  else {
65474
65562
  ok = false;
65475
- lines.push(/Not possible to fast-forward|diverged/.test(all) ? `${name}The hub's branch and the remote have both changed, so nothing was pulled. Merge or rebase there (hub_run shell).` : /would be overwritten/.test(all) ? `${name}Uncommitted changes on the hub to files the remote also changed - commit them first. Nothing was pulled.` : `${name}git pull failed on the hub: ${gist(repo.pull)}`);
65563
+ lines2.push(/Not possible to fast-forward|diverged/.test(all) ? `${name}The hub's branch and the remote have both changed, so nothing was pulled. Merge or rebase there (hub_run shell).` : /would be overwritten/.test(all) ? `${name}Uncommitted changes on the hub to files the remote also changed - commit them first. Nothing was pulled.` : `${name}git pull failed on the hub: ${gist(repo.pull)}`);
65476
65564
  }
65477
65565
  }
65478
65566
  const fetched = await runtime.mirror.pull(signal).catch(() => void 0);
65479
65567
  if (fetched !== void 0 && fetched.fetched.length + fetched.removed.length > 0) {
65480
- lines.push(`Copied ${String(fetched.fetched.length + fetched.removed.length)} changed file(s) here.`);
65568
+ lines2.push(`Copied ${String(fetched.fetched.length + fetched.removed.length)} changed file(s) here.`);
65481
65569
  }
65482
65570
  if (fetched !== void 0 && fetched.conflicts.length > 0) {
65483
- lines.push(`Kept as they are here (changed on both sides): ${fetched.conflicts.slice(0, 10).join(", ")}.`);
65571
+ lines2.push(`Kept as they are here (changed on both sides): ${fetched.conflicts.slice(0, 10).join(", ")}.`);
65484
65572
  }
65485
- return { ok, text: lines.join(" ") };
65573
+ return { ok, text: lines2.join(" ") };
65486
65574
  }
65487
65575
  async function hubGitDiff(runtime, signal) {
65488
65576
  const folders = runtime.mirror.folders.map((f) => f.remote);
@@ -65572,11 +65660,11 @@ function createHubBrowseTool(hubs) {
65572
65660
  return { content: `${shown2} is a file: ${describeEntry(entries[0])}. Use "read" to see it.` };
65573
65661
  }
65574
65662
  const sorted = [...entries].sort((a, b) => (a.type === "directory" ? 0 : 1) - (b.type === "directory" ? 0 : 1) || a.name.localeCompare(b.name));
65575
- const lines2 = sorted.slice(0, MAX_LISTED).map(describeEntry);
65663
+ const lines3 = sorted.slice(0, MAX_LISTED).map(describeEntry);
65576
65664
  const more = sorted.length > MAX_LISTED ? `
65577
65665
  \u2026 and ${String(sorted.length - MAX_LISTED)} more` : "";
65578
65666
  return { content: `${shown2} on ${hub.label} (${String(entries.length)} entries):
65579
- ${lines2.join("\n")}${more}` };
65667
+ ${lines3.join("\n")}${more}` };
65580
65668
  }
65581
65669
  if (p.action === "find") {
65582
65670
  if (p.name === void 0 || p.name.trim().length === 0)
@@ -65620,19 +65708,19 @@ ${found2.join("\n")}${cut}` };
65620
65708
  const all = bytes.toString("utf8").slice(0, 2e7).split(/\r?\n/);
65621
65709
  const start = (p.offset ?? 1) - 1;
65622
65710
  let used = 0;
65623
- const lines = [];
65624
- for (let index = start; index < all.length && lines.length < (p.limit ?? READ_LINES); index++) {
65711
+ const lines2 = [];
65712
+ for (let index = start; index < all.length && lines2.length < (p.limit ?? READ_LINES); index++) {
65625
65713
  const line = `${String(index + 1).padStart(6)} ${all[index] ?? ""}`;
65626
65714
  if (used + line.length > READ_CHARS)
65627
65715
  break;
65628
65716
  used += line.length + 1;
65629
- lines.push(line);
65717
+ lines2.push(line);
65630
65718
  }
65631
- const last = start + lines.length;
65719
+ const last = start + lines2.length;
65632
65720
  const rest = last < all.length ? `
65633
65721
  (Lines ${String(start + 1)}-${String(last)} of ${String(all.length)}; continue with offset ${String(last + 1)}.)` : "";
65634
65722
  return { content: `${where} on ${hub.label}:
65635
- ${lines.join("\n")}${rest}` };
65723
+ ${lines2.join("\n")}${rest}` };
65636
65724
  } catch (error51) {
65637
65725
  return { content: error51 instanceof Error ? error51.message : String(error51), isError: true };
65638
65726
  }
@@ -65711,7 +65799,7 @@ function buildAutoGuidance(environment) {
65711
65799
  const idioms = idiomsFor(environment);
65712
65800
  const missing = environment.tools.missing;
65713
65801
  const present2 = environment.tools.present;
65714
- const lines = [
65802
+ const lines2 = [
65715
65803
  "## Working through the terminal",
65716
65804
  "",
65717
65805
  `Commands run in **${shellName(environment.shell.label)}**, from the workspace root. Use`,
@@ -65728,19 +65816,19 @@ function buildAutoGuidance(environment) {
65728
65816
  ""
65729
65817
  ];
65730
65818
  if (idioms.notes.length > 0) {
65731
- lines.push("### The shell you are in", "");
65819
+ lines2.push("### The shell you are in", "");
65732
65820
  for (const note of idioms.notes)
65733
- lines.push(`- ${note}`);
65734
- lines.push("");
65821
+ lines2.push(`- ${note}`);
65822
+ lines2.push("");
65735
65823
  }
65736
65824
  if (present2.length > 0) {
65737
- lines.push(`**Available here:** ${present2.map((name) => `\`${name}\``).join(", ")}.`, ...missing.length > 0 ? [
65825
+ lines2.push(`**Available here:** ${present2.map((name) => `\`${name}\``).join(", ")}.`, ...missing.length > 0 ? [
65738
65826
  `**Not on this machine:** ${missing.map((name) => `\`${name}\``).join(", ")} \u2014 do not`,
65739
65827
  " reach for these; use read_file and search_files instead of guessing at a substitute."
65740
65828
  ] : [], "");
65741
65829
  }
65742
- lines.push("### What stays on the dedicated tools", "", "- **Edits to code a person would want to read before approving.** Use apply_diff or", " write_to_file for those. The approval prompt renders a real diff for them and can only", " show the command line for a shell edit, so the user is judging a substitution rather than", " a change. Mechanical is fine in the shell; consequential is not.", "- **read_file before any apply_diff or write_to_file on an existing file.** Reading it in the", " terminal does not count, and the edit will be refused. That is deliberate, not a bug.", "", "### How to keep this cheap, which is the opposite of what you may expect", "", "- **Read-only commands run without asking in this mode. Chained ones never do.** Anything", ` containing ${idioms.chain}, \`|\`, \`&\`, \`;\`, a redirect, a backtick or \`$\` is treated as`, " possibly-two-commands and always stops for approval, however harmless it looks. So do", " **not** combine steps to save approvals: three separate reads cost you nothing, and the", " same three joined together cost the user a decision.", `- **Invoke programs by bare name** \u2014 ${present2.slice(0, 3).map((name) => `\`${name}\``).join(", ")} \u2014 rather than by full path. A path`, " under `Program Files (x86)` contains brackets, which fall into the same rule and turn a", " free command into a prompt.", "- **Some commands always stop and ask**, whatever is auto-approved: destructive and", " history-rewriting ones, and anything the user has marked risky. Do not rephrase a command", " to get around a prompt \u2014 say what you want to do and why, and let them decide.", "- If a read-only command you expect to be free keeps asking, it is simply not on the list.", " Say so: the user can add it in Settings \u2192 Approvals, where the whole list is shown.", "", "Your edits through the shell are covered by the task checkpoint exactly like any other edit,", "so the user can still roll the workspace back.");
65743
- return lines.join("\n");
65830
+ lines2.push("### What stays on the dedicated tools", "", "- **Edits to code a person would want to read before approving.** Use apply_diff or", " write_to_file for those. The approval prompt renders a real diff for them and can only", " show the command line for a shell edit, so the user is judging a substitution rather than", " a change. Mechanical is fine in the shell; consequential is not.", "- **read_file before any apply_diff or write_to_file on an existing file.** Reading it in the", " terminal does not count, and the edit will be refused. That is deliberate, not a bug.", "", "### How to keep this cheap, which is the opposite of what you may expect", "", "- **Read-only commands run without asking in this mode. Chained ones never do.** Anything", ` containing ${idioms.chain}, \`|\`, \`&\`, \`;\`, a redirect, a backtick or \`$\` is treated as`, " possibly-two-commands and always stops for approval, however harmless it looks. So do", " **not** combine steps to save approvals: three separate reads cost you nothing, and the", " same three joined together cost the user a decision.", `- **Invoke programs by bare name** \u2014 ${present2.slice(0, 3).map((name) => `\`${name}\``).join(", ")} \u2014 rather than by full path. A path`, " under `Program Files (x86)` contains brackets, which fall into the same rule and turn a", " free command into a prompt.", "- **Some commands always stop and ask**, whatever is auto-approved: destructive and", " history-rewriting ones, and anything the user has marked risky. Do not rephrase a command", " to get around a prompt \u2014 say what you want to do and why, and let them decide.", "- If a read-only command you expect to be free keeps asking, it is simply not on the list.", " Say so: the user can add it in Settings \u2192 Approvals, where the whole list is shown.", "", "Your edits through the shell are covered by the task checkpoint exactly like any other edit,", "so the user can still roll the workspace back.");
65831
+ return lines2.join("\n");
65744
65832
  }
65745
65833
 
65746
65834
  // ../../packages/core/dist/migrate/folders.js
@@ -66235,26 +66323,26 @@ function describePlan(params3, plan2, outside) {
66235
66323
  const files = plan2.reduce((n, p) => n + p.files, 0);
66236
66324
  const bytes = plan2.reduce((n, p) => n + p.bytes, 0);
66237
66325
  const replacing = plan2.reduce((n, p) => n + p.replaceCount, 0);
66238
- const lines = [`${verb} ${String(plan2.length)} item${plan2.length === 1 ? "" : "s"}: ${files.toLocaleString("en")} file${files === 1 ? "" : "s"}, ${formatBytes(bytes)}`, ""];
66326
+ const lines2 = [`${verb} ${String(plan2.length)} item${plan2.length === 1 ? "" : "s"}: ${files.toLocaleString("en")} file${files === 1 ? "" : "s"}, ${formatBytes(bytes)}`, ""];
66239
66327
  for (const p of plan2) {
66240
- lines.push(` ${p.from} (${p.folder ? `folder, ${p.files.toLocaleString("en")} files` : "file"}, ${formatBytes(p.bytes)})`);
66241
- lines.push(` \u2192 ${p.to}${params3.action === "move" && p.rename ? " [rename: same drive, instant]" : ""}`);
66328
+ lines2.push(` ${p.from} (${p.folder ? `folder, ${p.files.toLocaleString("en")} files` : "file"}, ${formatBytes(p.bytes)})`);
66329
+ lines2.push(` \u2192 ${p.to}${params3.action === "move" && p.rename ? " [rename: same drive, instant]" : ""}`);
66242
66330
  if (p.replaceCount > 0) {
66243
- lines.push(` ${params3.overwrite === true ? "REPLACES" : "already exists, so nothing will be changed"}: ${String(p.replaceCount)} file(s)`);
66331
+ lines2.push(` ${params3.overwrite === true ? "REPLACES" : "already exists, so nothing will be changed"}: ${String(p.replaceCount)} file(s)`);
66244
66332
  for (const r of p.replaces)
66245
- lines.push(` ${r}`);
66333
+ lines2.push(` ${r}`);
66246
66334
  if (p.replaceCount > p.replaces.length)
66247
- lines.push(` \u2026 and ${String(p.replaceCount - p.replaces.length)} more`);
66335
+ lines2.push(` \u2026 and ${String(p.replaceCount - p.replaces.length)} more`);
66248
66336
  }
66249
66337
  }
66250
- lines.push("");
66338
+ lines2.push("");
66251
66339
  if (replacing > 0 && params3.overwrite !== true)
66252
- lines.push("Some destinations exist and overwrite was not asked for: approving changes nothing and says which.");
66340
+ lines2.push("Some destinations exist and overwrite was not asked for: approving changes nothing and says which.");
66253
66341
  if (params3.action === "move")
66254
- lines.push("A move across drives copies everything, checks it, and only then removes the source.");
66342
+ lines2.push("A move across drives copies everything, checks it, and only then removes the source.");
66255
66343
  if (outside)
66256
- lines.push("Outside the codebase: Rollback cannot undo this part.");
66257
- return lines.join("\n");
66344
+ lines2.push("Outside the codebase: Rollback cannot undo this part.");
66345
+ return lines2.join("\n");
66258
66346
  }
66259
66347
  var archiveSchema = external_exports.object({
66260
66348
  action: external_exports.enum(["create", "extract", "list"]).describe("create a .zip from files and folders; extract one into a folder; list what one holds."),
@@ -66409,8 +66497,8 @@ ${(answer.unreadablePaths ?? []).map((u) => ` ${u}`).join("\n")}` : ".");
66409
66497
  if (params3.action === "find") {
66410
66498
  const matches = answer.matches ?? [];
66411
66499
  const keep = await allowedResults(context, matches.map((m) => m.path));
66412
- const lines = matches.filter((m) => keep.has(m.path)).map((m) => `${m.path} ${m.directory ? "folder" : formatBytes(m.size)} ${when(m.modified)}`);
66413
- return { content: `${lines.length === 0 ? "Nothing matched." : lines.join("\n")}
66500
+ const lines2 = matches.filter((m) => keep.has(m.path)).map((m) => `${m.path} ${m.directory ? "folder" : formatBytes(m.size)} ${when(m.modified)}`);
66501
+ return { content: `${lines2.length === 0 ? "Nothing matched." : lines2.join("\n")}
66414
66502
 
66415
66503
  ${scanned}${answer.limitReached === true ? " The limit was reached; more match." : ""}` };
66416
66504
  }
@@ -66499,16 +66587,16 @@ ${refused.join("\n")}`] : []].join("\n\n") };
66499
66587
  if (params3.action === "inspect") {
66500
66588
  const table = answer.table;
66501
66589
  const sheets = answer.sheets;
66502
- const lines2 = [
66590
+ const lines3 = [
66503
66591
  `${params3.path}: ${formatBytes(answer.size)}, modified ${when(answer.modified)}${answer.kind === "text" ? `, ${String(answer.lines)} lines` : ""} (${String(answer.kind)}).`
66504
66592
  ];
66505
66593
  if (Array.isArray(answer.firstLines))
66506
- lines2.push("", "First lines:", ...answer.firstLines.map((l) => ` ${l}`));
66594
+ lines3.push("", "First lines:", ...answer.firstLines.map((l) => ` ${l}`));
66507
66595
  if (table !== void 0)
66508
- lines2.push("", `Table (delimiter "${table.delimiter}"): ${table.columns.map((c2, i) => `${c2} [${table.types[i] ?? "?"}]`).join(", ")}`, "Query it with query_table.");
66596
+ lines3.push("", `Table (delimiter "${table.delimiter}"): ${table.columns.map((c2, i) => `${c2} [${table.types[i] ?? "?"}]`).join(", ")}`, "Query it with query_table.");
66509
66597
  if (sheets !== void 0)
66510
- lines2.push("", ...sheets.map((s) => `Sheet "${s.sheet}": ${String(s.rows)} rows \xD7 ${String(s.columns)} columns; header: ${s.header.join(", ")}`), "Query a sheet with query_table.");
66511
- return { content: lines2.join("\n"), path: params3.path };
66598
+ lines3.push("", ...sheets.map((s) => `Sheet "${s.sheet}": ${String(s.rows)} rows \xD7 ${String(s.columns)} columns; header: ${s.header.join(", ")}`), "Query a sheet with query_table.");
66599
+ return { content: lines3.join("\n"), path: params3.path };
66512
66600
  }
66513
66601
  if (params3.action === "search") {
66514
66602
  const matches = answer.matches ?? [];
@@ -66517,13 +66605,13 @@ ${refused.join("\n")}`] : []].join("\n\n") };
66517
66605
 
66518
66606
  ${answer.limitReached === true ? `At least ${String(answer.matchCount)} matches` : `${String(answer.matchCount)} matches`} in ${String(answer.lines)} lines.`, path: params3.path };
66519
66607
  }
66520
- const lines = answer.lines ?? [];
66608
+ const lines2 = answer.lines ?? [];
66521
66609
  if (params3.action === "tail")
66522
- return { content: lines.join("\n"), path: params3.path };
66610
+ return { content: lines2.join("\n"), path: params3.path };
66523
66611
  const start = answer.startLine ?? 1;
66524
66612
  return {
66525
- content: `${lines.map((l, n) => `${String(start + n).padStart(8)} ${l}`).join("\n")}${answer.more === true ? `
66526
- \u2026 continue with fromLine ${String(start + lines.length)}.` : ""}`,
66613
+ content: `${lines2.map((l, n) => `${String(start + n).padStart(8)} ${l}`).join("\n")}${answer.more === true ? `
66614
+ \u2026 continue with fromLine ${String(start + lines2.length)}.` : ""}`,
66527
66615
  path: params3.path
66528
66616
  };
66529
66617
  }
@@ -66718,7 +66806,7 @@ ${errors.map((e) => `- ${e}`).join("\n")}` : ""),
66718
66806
  const plan2 = await runHelper(exe, { ...paths.request, plan: true });
66719
66807
  if (plan2.ok !== true)
66720
66808
  return { kind: "text", text: `Could not plan this: ${plan2.error ?? "unknown error"}` };
66721
- const lines = params3.action === "create" ? [
66809
+ const lines2 = params3.action === "create" ? [
66722
66810
  `Create ${String(paths.request.archive)}${plan2.exists === true ? params3.overwrite === true ? " (REPLACES the existing file)" : " (already exists, so nothing will be changed)" : ""}`,
66723
66811
  ` from ${paths.request.sources.join(", ")}`,
66724
66812
  ` ${Number(plan2.files).toLocaleString("en")} file(s), ${formatBytes(Number(plan2.bytes))} before compression`,
@@ -66733,8 +66821,8 @@ ${errors.map((e) => `- ${e}`).join("\n")}` : ""),
66733
66821
  ] : []
66734
66822
  ];
66735
66823
  if (paths.outside)
66736
- lines.push("", "Outside the codebase: Rollback cannot undo this part.");
66737
- return { kind: "text", text: lines.join("\n") };
66824
+ lines2.push("", "Outside the codebase: Rollback cannot undo this part.");
66825
+ return { kind: "text", text: lines2.join("\n") };
66738
66826
  },
66739
66827
  async execute(params3, context) {
66740
66828
  const paths = await archivePaths(context, params3);
@@ -66817,21 +66905,21 @@ function createPythonLibraryTool(options) {
66817
66905
  parametersSchema: schema2,
66818
66906
  async preview(params3) {
66819
66907
  const launch = await options.launch(params3.python);
66820
- const lines = [
66908
+ const lines2 = [
66821
66909
  params3.action === "call" ? `RUN ${params3.module}.${params3.function ?? "?"} ${params3.calls !== void 0 ? `${String(params3.calls.length)} times, in parallel worker processes` : "once"}` : `${params3.action === "list" ? "List" : "Describe"} ${params3.module}${params3.function !== void 0 ? `.${params3.function}` : ""} (importing it runs its start-up code)`,
66822
66910
  `Python: ${"problem" in launch ? `(none found: ${launch.problem})` : launch.interpreter}`,
66823
66911
  `Folders: ${foldersFor(params3).length > 0 ? `${foldersFor(params3).join("; ")}${named2(params3) ? "" : " (saved in Settings \u2192 Python)"}` : "(none - the library must be installed in that Python)"}`
66824
66912
  ];
66825
66913
  if (params3.action === "call") {
66826
66914
  const calls = params3.calls ?? [{ args: params3.args, kwargs: params3.kwargs }];
66827
- lines.push("", "Arguments:");
66915
+ lines2.push("", "Arguments:");
66828
66916
  calls.slice(0, 25).forEach((call, index) => {
66829
- lines.push(` ${String(index + 1)}. ${shown(call.args ?? [])}${call.kwargs !== void 0 && Object.keys(call.kwargs).length > 0 ? ` ${shown(call.kwargs)}` : ""}`);
66917
+ lines2.push(` ${String(index + 1)}. ${shown(call.args ?? [])}${call.kwargs !== void 0 && Object.keys(call.kwargs).length > 0 ? ` ${shown(call.kwargs)}` : ""}`);
66830
66918
  });
66831
66919
  if (calls.length > 25)
66832
- lines.push(` ... and ${String(calls.length - 25)} more`);
66920
+ lines2.push(` ... and ${String(calls.length - 25)} more`);
66833
66921
  }
66834
- return { kind: "text", text: lines.join("\n") };
66922
+ return { kind: "text", text: lines2.join("\n") };
66835
66923
  },
66836
66924
  async execute(params3, context) {
66837
66925
  const launch = await options.launch(params3.python);
@@ -66973,13 +67061,13 @@ function isOffloadable(name) {
66973
67061
  }
66974
67062
  function offloadedCatalogue(hidden, otherHidden = 0) {
66975
67063
  const names = hidden.map((tool) => typeof tool === "string" ? tool : tool.name);
66976
- const lines = [];
67064
+ const lines2 = [];
66977
67065
  for (const family of OFFLOAD_FAMILIES) {
66978
67066
  const members = names.filter((name) => family.matches(name)).sort();
66979
67067
  if (members.length > 0)
66980
- lines.push(`- **${family.label}** (${family.about}): ${members.join(", ")}`);
67068
+ lines2.push(`- **${family.label}** (${family.about}): ${members.join(", ")}`);
66981
67069
  }
66982
- if (lines.length === 0 && otherHidden === 0)
67070
+ if (lines2.length === 0 && otherHidden === 0)
66983
67071
  return void 0;
66984
67072
  return [
66985
67073
  "## More tools you have (documented in the search index)",
@@ -66988,7 +67076,7 @@ function offloadedCatalogue(hidden, otherHidden = 0) {
66988
67076
  'call `search_docs` describing what you need to do** (for example "create a Jira issue with an attachment").',
66989
67077
  "It returns the relevant steps and each tool\u2019s exact parameters. Then call the tool with",
66990
67078
  "`call_tool(name, arguments)`. Never guess parameters for a tool you have not looked up.",
66991
- ...lines,
67079
+ ...lines2,
66992
67080
  ...otherHidden > 0 ? [`- **Also**: ${String(otherHidden)} more tool(s) from MCP servers and your own Python tools, found the same way with \`search_docs\`.`] : []
66993
67081
  ].join("\n");
66994
67082
  }
@@ -67123,28 +67211,28 @@ function header(headers, name) {
67123
67211
  function describeResponse(response, url2, trail) {
67124
67212
  const type = header(response.headers, "content-type") ?? "";
67125
67213
  const keep = ["content-type", "content-length", "location", "retry-after", "www-authenticate", "x-request-id", "etag", "last-modified"];
67126
- const lines = [`HTTP ${String(response.status)} from ${url2}`];
67214
+ const lines2 = [`HTTP ${String(response.status)} from ${url2}`];
67127
67215
  if (trail.length > 0)
67128
- lines.push(...trail);
67216
+ lines2.push(...trail);
67129
67217
  for (const [name, value] of Object.entries(response.headers))
67130
67218
  if (keep.includes(name.toLowerCase()))
67131
- lines.push(`${name}: ${value}`);
67132
- lines.push("");
67219
+ lines2.push(`${name}: ${value}`);
67220
+ lines2.push("");
67133
67221
  const textual = /json|text|xml|html|csv|javascript|yaml|x-www-form-urlencoded/i.test(type) || type === "";
67134
67222
  if (!textual) {
67135
- lines.push(`(${String(response.body.length)} bytes of ${type}; not shown as text)`);
67136
- return lines.join("\n");
67223
+ lines2.push(`(${String(response.body.length)} bytes of ${type}; not shown as text)`);
67224
+ return lines2.join("\n");
67137
67225
  }
67138
67226
  const text = new TextDecoder("utf-8", { fatal: false }).decode(response.body);
67139
67227
  if (/json/i.test(type)) {
67140
67228
  try {
67141
- lines.push(JSON.stringify(JSON.parse(text), null, 2));
67142
- return lines.join("\n");
67229
+ lines2.push(JSON.stringify(JSON.parse(text), null, 2));
67230
+ return lines2.join("\n");
67143
67231
  } catch {
67144
67232
  }
67145
67233
  }
67146
- lines.push(text.length > 0 ? text : "(empty body)");
67147
- return lines.join("\n");
67234
+ lines2.push(text.length > 0 ? text : "(empty body)");
67235
+ return lines2.join("\n");
67148
67236
  }
67149
67237
  function createHttpTool(options) {
67150
67238
  return {
@@ -67164,23 +67252,23 @@ function createHttpTool(options) {
67164
67252
  }
67165
67253
  const { body, contentType: contentType2 } = bodyOf(params3);
67166
67254
  const headers = { ...contentType2 !== void 0 ? { "Content-Type": contentType2 } : {}, ...params3.headers ?? {} };
67167
- const lines = [
67255
+ const lines2 = [
67168
67256
  `${params3.method} ${url2?.toString() ?? params3.url}`,
67169
67257
  ...shownHeaders(headers),
67170
67258
  `Auth: ${params3.auth?.type === "negotiate" ? "Kerberos/NTLM as you (Windows)" : params3.auth?.type === "profile" ? `provider profile "${params3.auth.profile ?? "?"}"` : "none beyond the headers"}`
67171
67259
  ];
67172
67260
  if (params3.tls !== void 0)
67173
- lines.push(`Certificates: ${Object.entries(params3.tls).filter(([k]) => k !== "passphraseSecret").map(([k, v]) => `${k}=${String(v)}`).join(", ")}`);
67261
+ lines2.push(`Certificates: ${Object.entries(params3.tls).filter(([k]) => k !== "passphraseSecret").map(([k, v]) => `${k}=${String(v)}`).join(", ")}`);
67174
67262
  const via = url2 !== void 0 ? proxyFor(url2, await options.proxy?.()) : void 0;
67175
- lines.push(`Proxy: ${via === void 0 ? "none (direct)" : `${via.user !== void 0 ? `${via.user}@` : ""}${via.url.replace(/^https?:\/\//, "")}${via.password !== void 0 ? " (password stored)" : ""}`}`);
67263
+ lines2.push(`Proxy: ${via === void 0 ? "none (direct)" : `${via.user !== void 0 ? `${via.user}@` : ""}${via.url.replace(/^https?:\/\//, "")}${via.password !== void 0 ? " (password stored)" : ""}`}`);
67176
67264
  if (params3.retry202 !== false)
67177
- lines.push(`On 202 Accepted: keep polling for up to ${String(params3.maxWaitSec ?? 120)}s.`);
67265
+ lines2.push(`On 202 Accepted: keep polling for up to ${String(params3.maxWaitSec ?? 120)}s.`);
67178
67266
  if (body !== void 0)
67179
- lines.push("", "Body:", body.length > 4e3 ? `${body.slice(0, 4e3)}
67267
+ lines2.push("", "Body:", body.length > 4e3 ? `${body.slice(0, 4e3)}
67180
67268
  ... (${String(body.length)} characters)` : body);
67181
67269
  if (problem !== void 0)
67182
- lines.push("", `WILL BE REFUSED: ${problem}`);
67183
- return { kind: "text", text: lines.join("\n") };
67270
+ lines2.push("", `WILL BE REFUSED: ${problem}`);
67271
+ return { kind: "text", text: lines2.join("\n") };
67184
67272
  },
67185
67273
  async execute(params3, context) {
67186
67274
  try {
@@ -67475,9 +67563,9 @@ var HANDOFF_PROMPT = [
67475
67563
  var MAX_QUOTED_MESSAGE = 4e3;
67476
67564
  var MAX_QUOTED_TOTAL = 24e3;
67477
67565
  function composeHandoff(note, facts, previousTitle) {
67478
- const lines = [`# Handoff${previousTitle !== void 0 ? `: ${previousTitle}` : ""}`, "", "This chat continues an earlier one. Pick up from here.", "", note.trim()];
67566
+ const lines2 = [`# Handoff${previousTitle !== void 0 ? `: ${previousTitle}` : ""}`, "", "This chat continues an earlier one. Pick up from here.", "", note.trim()];
67479
67567
  if (facts.userMessages.length > 0) {
67480
- lines.push("", "## What the user asked for, in their words");
67568
+ lines2.push("", "## What the user asked for, in their words");
67481
67569
  const kept = [];
67482
67570
  let total = 0;
67483
67571
  for (const text of [...facts.userMessages].reverse()) {
@@ -67488,19 +67576,19 @@ function composeHandoff(note, facts, previousTitle) {
67488
67576
  total += clipped.length;
67489
67577
  }
67490
67578
  if (kept.length < facts.userMessages.length)
67491
- lines.push(`(${String(facts.userMessages.length - kept.length)} earlier messages left out to keep this short.)`);
67579
+ lines2.push(`(${String(facts.userMessages.length - kept.length)} earlier messages left out to keep this short.)`);
67492
67580
  for (const text of kept)
67493
- lines.push("", ...text.split("\n").map((line) => `> ${line}`));
67581
+ lines2.push("", ...text.split("\n").map((line) => `> ${line}`));
67494
67582
  }
67495
67583
  const list = (title, items, code) => {
67496
67584
  if (items.length === 0)
67497
67585
  return;
67498
- lines.push("", `## ${title}`, ...items.map((item) => `- ${code ? `\`${item.replace(/`/g, "'")}\`` : item}`));
67586
+ lines2.push("", `## ${title}`, ...items.map((item) => `- ${code ? `\`${item.replace(/`/g, "'")}\`` : item}`));
67499
67587
  };
67500
67588
  list("Files changed", facts.filesChanged, true);
67501
67589
  list("Files read", facts.filesRead, true);
67502
67590
  list("Commands run", facts.commands, true);
67503
- return lines.join("\n");
67591
+ return lines2.join("\n");
67504
67592
  }
67505
67593
 
67506
67594
  // ../../packages/core/dist/checkpoints/changeLedger.js
@@ -70553,16 +70641,16 @@ function findDirectedRoles(text, team) {
70553
70641
  return { addressed, unknown: unknown2 };
70554
70642
  }
70555
70643
  function describeDirectedRoles(directed, team) {
70556
- const lines = [];
70644
+ const lines2 = [];
70557
70645
  if (directed.addressed.length > 0) {
70558
70646
  const names = directed.addressed.map((role) => `\`${role}\``).join(", ");
70559
- lines.push(`The user addressed ${names} directly with #. Consult ${directed.addressed.length > 1 ? "each of them" : "it"} with \`ask_agent\` before you answer \u2014 this is not a judgement call about whether a consultation is worth it, they asked. Put the code, error or output they are referring to in the question, and say plainly in your reply what came back and whether you agree.`);
70647
+ lines2.push(`The user addressed ${names} directly with #. Consult ${directed.addressed.length > 1 ? "each of them" : "it"} with \`ask_agent\` before you answer \u2014 this is not a judgement call about whether a consultation is worth it, they asked. Put the code, error or output they are referring to in the question, and say plainly in your reply what came back and whether you agree.`);
70560
70648
  }
70561
70649
  if (directed.unknown.length > 0) {
70562
70650
  const usable = team.filter((agent) => agent.available).map((agent) => agent.role);
70563
- lines.push(`The user wrote ${directed.unknown.map((role) => `#${role}`).join(", ")}, which ${directed.unknown.length > 1 ? "are not roles" : "is not a role"} that can answer here. ${usable.length > 0 ? `Available: ${usable.join(", ")}. Say so and carry on with the request.` : "No specialists are assigned. Say so, mention Settings \u2192 Agents, and carry on."}`);
70651
+ lines2.push(`The user wrote ${directed.unknown.map((role) => `#${role}`).join(", ")}, which ${directed.unknown.length > 1 ? "are not roles" : "is not a role"} that can answer here. ${usable.length > 0 ? `Available: ${usable.join(", ")}. Say so and carry on with the request.` : "No specialists are assigned. Say so, mention Settings \u2192 Agents, and carry on."}`);
70564
70652
  }
70565
- return lines.join("\n\n");
70653
+ return lines2.join("\n\n");
70566
70654
  }
70567
70655
 
70568
70656
  // ../../packages/core/dist/tools/roleTools.js
@@ -71067,7 +71155,7 @@ var LEGEND_ROW_HEIGHT = 24;
71067
71155
  var LEGEND_TOP_GAP = 18;
71068
71156
  function wrapText(text, perLine) {
71069
71157
  const limit = Math.max(4, perLine);
71070
- const lines = [];
71158
+ const lines2 = [];
71071
71159
  let current = "";
71072
71160
  for (const word of text.split(/\s+/).filter((part) => part.length > 0)) {
71073
71161
  if (current.length === 0) {
@@ -71075,17 +71163,17 @@ function wrapText(text, perLine) {
71075
71163
  } else if (current.length + 1 + word.length <= limit) {
71076
71164
  current = `${current} ${word}`;
71077
71165
  } else {
71078
- lines.push(current);
71166
+ lines2.push(current);
71079
71167
  current = word;
71080
71168
  }
71081
71169
  while (current.length > limit) {
71082
- lines.push(current.slice(0, limit));
71170
+ lines2.push(current.slice(0, limit));
71083
71171
  current = current.slice(limit);
71084
71172
  }
71085
71173
  }
71086
71174
  if (current.length > 0)
71087
- lines.push(current);
71088
- return lines.length > 0 ? lines : [""];
71175
+ lines2.push(current);
71176
+ return lines2.length > 0 ? lines2 : [""];
71089
71177
  }
71090
71178
  function boxFor(label, note, face = "regular", size = "normal") {
71091
71179
  const scale = SIZE_SCALE[size];
@@ -71097,13 +71185,13 @@ function boxFor(label, note, face = "regular", size = "normal") {
71097
71185
  const maxWidth = MAX_WIDTH * scale;
71098
71186
  const width = Math.min(maxWidth, Math.max(MIN_WIDTH, ideal + PADDING_X * 2));
71099
71187
  const usable = width - PADDING_X * 2;
71100
- const lines = wrapText(label, Math.floor(usable / charWidth));
71188
+ const lines2 = wrapText(label, Math.floor(usable / charWidth));
71101
71189
  const noteLines = note === void 0 ? [] : wrapText(note, Math.floor(usable / noteCharWidth));
71102
- const textHeight = lines.length * lineHeight + noteLines.length * noteLineHeight;
71190
+ const textHeight = lines2.length * lineHeight + noteLines.length * noteLineHeight;
71103
71191
  return {
71104
71192
  width,
71105
71193
  height: Math.max(NODE_HEIGHT * scale, textHeight + PADDING_Y * 2),
71106
- lines,
71194
+ lines: lines2,
71107
71195
  noteLines,
71108
71196
  fontSize: LABEL_FONT_SIZE * scale,
71109
71197
  noteFontSize: NOTE_FONT_SIZE * scale,
@@ -71951,7 +72039,7 @@ var BitbucketClient = class {
71951
72039
  */
71952
72040
  async file(repo, path61, ref, signal) {
71953
72041
  const target = encodeRepoPath(path61);
71954
- const lines = [];
72042
+ const lines2 = [];
71955
72043
  let start = 0;
71956
72044
  for (let page = 0; page < MAX_FILE_PAGES; page += 1) {
71957
72045
  const query = new URLSearchParams({ start: String(start), limit: String(FILE_PAGE_LINES) });
@@ -71968,13 +72056,13 @@ var BitbucketClient = class {
71968
72056
  if (body.binary === true)
71969
72057
  throw new AtlassianError(`${path61} is a binary file, so there is no text to read.`);
71970
72058
  for (const line of body.lines ?? [])
71971
- lines.push(line.text ?? "");
72059
+ lines2.push(line.text ?? "");
71972
72060
  if (body.isLastPage !== false || body.nextPageStart === void 0 || body.nextPageStart <= start)
71973
- return lines.join("\n");
72061
+ return lines2.join("\n");
71974
72062
  start = body.nextPageStart;
71975
72063
  }
71976
- return `${lines.join("\n")}
71977
- [... stopped after ${String(lines.length)} lines; the file is longer]`;
72064
+ return `${lines2.join("\n")}
72065
+ [... stopped after ${String(lines2.length)} lines; the file is longer]`;
71978
72066
  }
71979
72067
  async createPullRequest(repo, pr, signal) {
71980
72068
  const ref = (branch) => ({
@@ -72495,9 +72583,9 @@ ${text.slice(-2e4)}`);
72495
72583
  if (options.pattern === void 0) {
72496
72584
  tail = (tail + chunk).slice(-options.tailBytes);
72497
72585
  } else {
72498
- const lines = (partial2 + chunk).split("\n");
72499
- partial2 = lines.pop() ?? "";
72500
- for (const line of lines)
72586
+ const lines2 = (partial2 + chunk).split("\n");
72587
+ partial2 = lines2.pop() ?? "";
72588
+ for (const line of lines2)
72501
72589
  consume(line.replace(/\r$/, ""));
72502
72590
  }
72503
72591
  }
@@ -73065,17 +73153,17 @@ function field(record2, ...names) {
73065
73153
  return void 0;
73066
73154
  }
73067
73155
  function renderDefinition(record2, indent = "") {
73068
- const lines = [];
73156
+ const lines2 = [];
73069
73157
  for (const [key2, value] of Object.entries(record2)) {
73070
73158
  if (value === null || value === void 0 || value === "")
73071
73159
  continue;
73072
73160
  if (typeof value === "object" && !Array.isArray(value)) {
73073
- lines.push(`${indent}${key2}:`, ...renderDefinition(value, `${indent} `));
73161
+ lines2.push(`${indent}${key2}:`, ...renderDefinition(value, `${indent} `));
73074
73162
  } else {
73075
- lines.push(`${indent}${key2}: ${Array.isArray(value) ? value.map(String).join(", ") : String(value)}`);
73163
+ lines2.push(`${indent}${key2}: ${Array.isArray(value) ? value.map(String).join(", ") : String(value)}`);
73076
73164
  }
73077
73165
  }
73078
- return lines;
73166
+ return lines2;
73079
73167
  }
73080
73168
  function toRun(record2) {
73081
73169
  return {
@@ -73331,10 +73419,10 @@ function createAutosysJobTool(options) {
73331
73419
  const run3 = statuses.get(name);
73332
73420
  const status2 = run3 !== void 0 ? describeRun2(run3) : `${name}: status not available`;
73333
73421
  if (full || fields !== void 0) {
73334
- const lines = renderDefinition(pick4(definition)).map((line) => ` ${line}`);
73422
+ const lines2 = renderDefinition(pick4(definition)).map((line) => ` ${line}`);
73335
73423
  sections.push([
73336
73424
  shownNames.length === 1 ? `Definition of ${name}:` : `${name}:`,
73337
- ...lines.length > 0 ? lines : [" (none of the requested attributes are set)"],
73425
+ ...lines2.length > 0 ? lines2 : [" (none of the requested attributes are set)"],
73338
73426
  ` Status: ${run3 !== void 0 ? status2.slice(name.length + 2) : "not available"}`
73339
73427
  ].join("\n"));
73340
73428
  } else {
@@ -73457,7 +73545,7 @@ function createAutosysLogTool(options) {
73457
73545
  isError: true
73458
73546
  };
73459
73547
  }
73460
- const lines = log.split(/\r?\n/);
73548
+ const lines2 = log.split(/\r?\n/);
73461
73549
  if (params3.search !== void 0) {
73462
73550
  let pattern;
73463
73551
  try {
@@ -73466,19 +73554,19 @@ function createAutosysLogTool(options) {
73466
73554
  return { content: `Not a valid pattern: ${error51 instanceof Error ? error51.message : String(error51)}`, isError: true };
73467
73555
  }
73468
73556
  const kept = /* @__PURE__ */ new Set();
73469
- lines.forEach((line, index) => {
73557
+ lines2.forEach((line, index) => {
73470
73558
  if (pattern.test(line))
73471
- for (let at = Math.max(0, index - 3); at <= Math.min(lines.length - 1, index + 3); at += 1)
73559
+ for (let at = Math.max(0, index - 3); at <= Math.min(lines2.length - 1, index + 3); at += 1)
73472
73560
  kept.add(at);
73473
73561
  });
73474
73562
  if (kept.size === 0)
73475
73563
  return { content: `No lines match /${params3.search}/ in the ${type} log of ${params3.job}.` };
73476
73564
  return {
73477
- content: [...kept].sort((a, b) => a - b).slice(0, 400).map((index) => `${String(index + 1)}: ${lines[index] ?? ""}`).join("\n")
73565
+ content: [...kept].sort((a, b) => a - b).slice(0, 400).map((index) => `${String(index + 1)}: ${lines2[index] ?? ""}`).join("\n")
73478
73566
  };
73479
73567
  }
73480
- const tail = lines.slice(-(params3.tailLines ?? 200));
73481
- return { content: `${type} of ${params3.job}${params3.runNum !== void 0 ? ` run ${params3.runNum}` : ""} (${String(lines.length)} lines${lines.length > tail.length ? `, last ${String(tail.length)} shown` : ""}):
73568
+ const tail = lines2.slice(-(params3.tailLines ?? 200));
73569
+ return { content: `${type} of ${params3.job}${params3.runNum !== void 0 ? ` run ${params3.runNum}` : ""} (${String(lines2.length)} lines${lines2.length > tail.length ? `, last ${String(tail.length)} shown` : ""}):
73482
73570
  ${tail.join("\n")}` };
73483
73571
  } catch (error51) {
73484
73572
  return errorResult3(error51);
@@ -73649,9 +73737,9 @@ function createAutosysDependenciesTool(options) {
73649
73737
  try {
73650
73738
  const client = await options.client();
73651
73739
  const direction = params3.direction ?? "both";
73652
- const lines = [];
73740
+ const lines2 = [];
73653
73741
  if (direction !== "downstream") {
73654
- lines.push(`Upstream of ${params3.job}:`);
73742
+ lines2.push(`Upstream of ${params3.job}:`);
73655
73743
  const statuses = /* @__PURE__ */ new Map();
73656
73744
  const statusOf = async (name) => {
73657
73745
  const known = statuses.get(name);
@@ -73665,33 +73753,33 @@ function createAutosysDependenciesTool(options) {
73665
73753
  const visited = /* @__PURE__ */ new Set();
73666
73754
  const walk = async (name, level, indent) => {
73667
73755
  if (visited.has(name)) {
73668
- lines.push(`${indent}(${name} already shown above)`);
73756
+ lines2.push(`${indent}(${name} already shown above)`);
73669
73757
  return;
73670
73758
  }
73671
73759
  visited.add(name);
73672
73760
  const definition = await client.job(name).catch(() => void 0);
73673
73761
  if (definition === void 0) {
73674
- lines.push(`${indent}(${name}: definition not readable)`);
73762
+ lines2.push(`${indent}(${name}: definition not readable)`);
73675
73763
  return;
73676
73764
  }
73677
73765
  const condition = field(definition, "condition");
73678
73766
  const box = field(definition, "boxName", "box_name");
73679
73767
  if (box !== void 0)
73680
- lines.push(`${indent}- in box ${box} [${await statusOf(box)}] \u2014 runs only while its box is running`);
73768
+ lines2.push(`${indent}- in box ${box} [${await statusOf(box)}] \u2014 runs only while its box is running`);
73681
73769
  if (condition === void 0) {
73682
73770
  if (box === void 0)
73683
- lines.push(`${indent}- no starting condition: it runs on its own schedule${field(definition, "startTimes", "start_times") !== void 0 ? ` (${field(definition, "startTimes", "start_times") ?? ""})` : ""}`);
73771
+ lines2.push(`${indent}- no starting condition: it runs on its own schedule${field(definition, "startTimes", "start_times") !== void 0 ? ` (${field(definition, "startTimes", "start_times") ?? ""})` : ""}`);
73684
73772
  return;
73685
73773
  }
73686
- lines.push(`${indent}condition: ${condition}`);
73774
+ lines2.push(`${indent}condition: ${condition}`);
73687
73775
  for (const reference of parseConditions(condition)) {
73688
73776
  if (reference.instance !== void 0) {
73689
- lines.push(`${indent}- ${KIND_WORDS[reference.kind]} ${reference.job} on instance ${reference.instance} (another instance: status not checked)`);
73777
+ lines2.push(`${indent}- ${KIND_WORDS[reference.kind]} ${reference.job} on instance ${reference.instance} (another instance: status not checked)`);
73690
73778
  continue;
73691
73779
  }
73692
73780
  const status2 = await statusOf(reference.job);
73693
73781
  const met = conditionMet(reference.kind, status2);
73694
- lines.push(`${indent}- ${KIND_WORDS[reference.kind]} ${reference.job}${reference.comparison !== void 0 ? ` ${reference.comparison}` : ""}: ${status2} \u2014 ${met === void 0 ? "check the exit code" : met ? "met" : "NOT met"}`);
73782
+ lines2.push(`${indent}- ${KIND_WORDS[reference.kind]} ${reference.job}${reference.comparison !== void 0 ? ` ${reference.comparison}` : ""}: ${status2} \u2014 ${met === void 0 ? "check the exit code" : met ? "met" : "NOT met"}`);
73695
73783
  if (met === false && level < (params3.depth ?? 3))
73696
73784
  await walk(reference.job, level + 1, `${indent} `);
73697
73785
  }
@@ -73699,23 +73787,23 @@ function createAutosysDependenciesTool(options) {
73699
73787
  await walk(params3.job, 1, " ");
73700
73788
  }
73701
73789
  if (direction !== "upstream") {
73702
- if (lines.length > 0)
73703
- lines.push("");
73704
- lines.push(`Downstream of ${params3.job}:`);
73790
+ if (lines2.length > 0)
73791
+ lines2.push("");
73792
+ lines2.push(`Downstream of ${params3.job}:`);
73705
73793
  const definition = await client.job(params3.job).catch(() => void 0);
73706
73794
  const type = definition === void 0 ? "" : (field(definition, "jobType", "job_type", "type") ?? "").toUpperCase();
73707
73795
  if (type === "BOX" || type === "B") {
73708
73796
  const members = await client.boxMembers(params3.job).catch(() => []);
73709
- lines.push(` box members: ${members.map((member) => field(member, "name", "jobName") ?? "?").join(", ") || "none"}`);
73797
+ lines2.push(` box members: ${members.map((member) => field(member, "name", "jobName") ?? "?").join(", ") || "none"}`);
73710
73798
  }
73711
73799
  const scope = params3.searchPattern ?? options.defaultPattern ?? "*";
73712
73800
  const candidates = await client.findJobs(scope);
73713
73801
  const listed = candidates.some((candidate) => "condition" in candidate);
73714
73802
  const definitions = listed ? candidates : await Promise.all(candidates.slice(0, 300).map((candidate) => client.job(field(candidate, "name", "jobName") ?? "").catch(() => ({}))));
73715
73803
  const dependents = definitions.filter((candidate) => parseConditions(field(candidate, "condition") ?? "").some((reference) => reference.job.toLowerCase() === params3.job.toLowerCase() && reference.instance === void 0));
73716
- lines.push(dependents.length === 0 ? ` no job matching ${scope} has a condition naming it${!listed && candidates.length > 300 ? " (only the first 300 were read \u2014 narrow searchPattern)" : ""}` : ` ${String(dependents.length)} job(s) wait on it:`, ...dependents.map((candidate) => ` - ${field(candidate, "name", "jobName") ?? "?"}: ${field(candidate, "condition") ?? ""}`));
73804
+ lines2.push(dependents.length === 0 ? ` no job matching ${scope} has a condition naming it${!listed && candidates.length > 300 ? " (only the first 300 were read \u2014 narrow searchPattern)" : ""}` : ` ${String(dependents.length)} job(s) wait on it:`, ...dependents.map((candidate) => ` - ${field(candidate, "name", "jobName") ?? "?"}: ${field(candidate, "condition") ?? ""}`));
73717
73805
  }
73718
- return { content: lines.join("\n") };
73806
+ return { content: lines2.join("\n") };
73719
73807
  } catch (error51) {
73720
73808
  return errorResult3(error51);
73721
73809
  }
@@ -74177,7 +74265,7 @@ function createJiraProjectTool(options) {
74177
74265
  return { content: "Name a project: none was given and no default project is configured.", isError: true };
74178
74266
  }
74179
74267
  const project = await client.project(projectKey);
74180
- const lines = [
74268
+ const lines2 = [
74181
74269
  `${project.key}: ${project.name}`,
74182
74270
  `Issue types: ${project.issueTypes.map((type) => type.subtask ? `${type.name} (sub-task)` : type.name).join(", ") || "none"}`,
74183
74271
  `Components: ${project.components.join(", ") || "none"}`,
@@ -74187,13 +74275,13 @@ function createJiraProjectTool(options) {
74187
74275
  const wanted = params3.issueType.trim().toLowerCase();
74188
74276
  const type = project.issueTypes.find((entry) => entry.name.toLowerCase() === wanted || entry.id === params3.issueType);
74189
74277
  if (type === void 0) {
74190
- lines.push("", `There is no issue type "${params3.issueType}" in ${project.key}.`);
74278
+ lines2.push("", `There is no issue type "${params3.issueType}" in ${project.key}.`);
74191
74279
  } else {
74192
- lines.push("", `Fields for a new ${type.name}:`, ...describeFields(await client.createFields(project.key, type)));
74193
- lines.push("", "Named parameters of jira_write_issue cover summary, description, priority, labels, assignee, components, versions, due date and parent; pass anything else in `fields` by its id.");
74280
+ lines2.push("", `Fields for a new ${type.name}:`, ...describeFields(await client.createFields(project.key, type)));
74281
+ lines2.push("", "Named parameters of jira_write_issue cover summary, description, priority, labels, assignee, components, versions, due date and parent; pass anything else in `fields` by its id.");
74194
74282
  }
74195
74283
  }
74196
- return { content: lines.join("\n") };
74284
+ return { content: lines2.join("\n") };
74197
74285
  } catch (error51) {
74198
74286
  return errorResult4(error51);
74199
74287
  }
@@ -74579,12 +74667,12 @@ function describeReply(quote) {
74579
74667
  ${blockQuote(quote.excerpt)}`;
74580
74668
  }
74581
74669
  function describeReactions(reactions) {
74582
- const lines = reactions.map((item) => {
74670
+ const lines2 = reactions.map((item) => {
74583
74671
  const excerpt = clipQuote(item.quote.excerpt, MAX_REACTION_QUOTE_CHARS).replace(/\s+/g, " ");
74584
74672
  return `- ${REACTION_LABELS[item.reaction]}: "${excerpt}"${sourceNote(item.quote)}`;
74585
74673
  });
74586
74674
  return `[My reactions to what you wrote \u2014 weigh them in what you do next]
74587
- ${lines.join("\n")}`;
74675
+ ${lines2.join("\n")}`;
74588
74676
  }
74589
74677
  function composeUserText(text, extras = {}) {
74590
74678
  const parts = [];
@@ -74616,18 +74704,18 @@ var QUOTE = /^ {0,3}>\s?(.*)$/;
74616
74704
  var TABLE_ROW = /^ {0,3}\|?(.*\|.*?)\|?\s*$/;
74617
74705
  var TABLE_DELIMITER = /^ {0,3}\|?\s*:?-{1,}:?\s*(\|\s*:?-{1,}:?\s*)*\|?\s*$/;
74618
74706
  function parseMarkdown(source) {
74619
- const lines = source.replace(/\r\n/g, "\n").split("\n");
74707
+ const lines2 = source.replace(/\r\n/g, "\n").split("\n");
74620
74708
  const blocks = [];
74621
74709
  let index = 0;
74622
- while (index < lines.length) {
74623
- const line = lines[index] ?? "";
74710
+ while (index < lines2.length) {
74711
+ const line = lines2[index] ?? "";
74624
74712
  const fence = FENCE.exec(line);
74625
74713
  if (fence !== null) {
74626
74714
  const marker = fence[1] ?? "```";
74627
74715
  const body = [];
74628
74716
  index += 1;
74629
- while (index < lines.length) {
74630
- const candidate = lines[index] ?? "";
74717
+ while (index < lines2.length) {
74718
+ const candidate = lines2[index] ?? "";
74631
74719
  const closing = FENCE.exec(candidate);
74632
74720
  if (closing !== null && (closing[1] ?? "").length >= marker.length && (closing[2] ?? "") === "")
74633
74721
  break;
@@ -74657,7 +74745,7 @@ function parseMarkdown(source) {
74657
74745
  index += 1;
74658
74746
  continue;
74659
74747
  }
74660
- const delimiter = lines[index + 1];
74748
+ const delimiter = lines2[index + 1];
74661
74749
  if (TABLE_ROW.test(line) && delimiter !== void 0 && TABLE_DELIMITER.test(delimiter)) {
74662
74750
  const cells = (row) => row.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((cell) => cell.trim());
74663
74751
  const head = cells(line).map((cell) => parseInline(cell));
@@ -74674,8 +74762,8 @@ function parseMarkdown(source) {
74674
74762
  });
74675
74763
  index += 2;
74676
74764
  const rows = [];
74677
- while (index < lines.length) {
74678
- const candidate = lines[index] ?? "";
74765
+ while (index < lines2.length) {
74766
+ const candidate = lines2[index] ?? "";
74679
74767
  if (candidate.trim().length === 0 || !TABLE_ROW.test(candidate))
74680
74768
  break;
74681
74769
  rows.push(cells(candidate).map((cell) => parseInline(cell)));
@@ -74686,8 +74774,8 @@ function parseMarkdown(source) {
74686
74774
  }
74687
74775
  if (QUOTE.test(line)) {
74688
74776
  const quoted = [];
74689
- while (index < lines.length) {
74690
- const match = QUOTE.exec(lines[index] ?? "");
74777
+ while (index < lines2.length) {
74778
+ const match = QUOTE.exec(lines2[index] ?? "");
74691
74779
  if (match === null)
74692
74780
  break;
74693
74781
  quoted.push(match[1] ?? "");
@@ -74699,8 +74787,8 @@ function parseMarkdown(source) {
74699
74787
  const isOrdered = ORDERED.test(line);
74700
74788
  if (isOrdered || UNORDERED.test(line)) {
74701
74789
  const items = [];
74702
- while (index < lines.length) {
74703
- const current = lines[index] ?? "";
74790
+ while (index < lines2.length) {
74791
+ const current = lines2[index] ?? "";
74704
74792
  const match = (isOrdered ? ORDERED : UNORDERED).exec(current);
74705
74793
  if (match === null)
74706
74794
  break;
@@ -74711,11 +74799,11 @@ function parseMarkdown(source) {
74711
74799
  continue;
74712
74800
  }
74713
74801
  const paragraph = [];
74714
- while (index < lines.length) {
74715
- const current = lines[index] ?? "";
74802
+ while (index < lines2.length) {
74803
+ const current = lines2[index] ?? "";
74716
74804
  if (current.trim().length === 0 || FENCE.test(current) || HEADING.test(current) || RULE.test(current) || QUOTE.test(current) || UNORDERED.test(current) || ORDERED.test(current) || // A table's own header line looks like prose, so the delimiter beneath it is what
74717
74805
  // ends the paragraph — the same test the table branch uses to recognise one.
74718
- TABLE_ROW.test(current) && TABLE_DELIMITER.test(lines[index + 1] ?? "")) {
74806
+ TABLE_ROW.test(current) && TABLE_DELIMITER.test(lines2[index + 1] ?? "")) {
74719
74807
  break;
74720
74808
  }
74721
74809
  paragraph.push(current);
@@ -75168,7 +75256,7 @@ function createOutlookDraftTool(options) {
75168
75256
  * asked to approve putting *this text* in front of a colleague.
75169
75257
  */
75170
75258
  async preview(params3) {
75171
- const lines = ["Compose a message in Outlook and show it to you. Nothing is sent.", ""];
75259
+ const lines2 = ["Compose a message in Outlook and show it to you. Nothing is sent.", ""];
75172
75260
  const recipients = [
75173
75261
  ["To", params3.to],
75174
75262
  ["Cc", params3.cc],
@@ -75176,26 +75264,26 @@ function createOutlookDraftTool(options) {
75176
75264
  ];
75177
75265
  for (const [label, list] of recipients) {
75178
75266
  if (list !== void 0 && list.length > 0)
75179
- lines.push(`${label}: ${list.join(", ")}`);
75267
+ lines2.push(`${label}: ${list.join(", ")}`);
75180
75268
  }
75181
75269
  if (params3.to === void 0 || params3.to.length === 0) {
75182
- lines.push("To: (nobody \u2014 you will fill this in)");
75270
+ lines2.push("To: (nobody \u2014 you will fill this in)");
75183
75271
  }
75184
- lines.push(`Subject: ${params3.subject ?? "(none)"}`);
75272
+ lines2.push(`Subject: ${params3.subject ?? "(none)"}`);
75185
75273
  const files = filesIn(params3);
75186
75274
  if (files.length > 0) {
75187
- lines.push("");
75188
- lines.push("Files from this machine, put into the message:");
75275
+ lines2.push("");
75276
+ lines2.push("Files from this machine, put into the message:");
75189
75277
  for (const file2 of files) {
75190
- lines.push(` ${file2.path}${file2.inline ? " (shown inside the message)" : ""}`);
75278
+ lines2.push(` ${file2.path}${file2.inline ? " (shown inside the message)" : ""}`);
75191
75279
  }
75192
75280
  }
75193
75281
  const body = params3.body ?? "";
75194
- lines.push("");
75195
- lines.push(params3.html === true ? "Body (HTML):" : "Body:");
75196
- lines.push(body.length > 4e3 ? `${body.slice(0, 4e3)}
75282
+ lines2.push("");
75283
+ lines2.push(params3.html === true ? "Body (HTML):" : "Body:");
75284
+ lines2.push(body.length > 4e3 ? `${body.slice(0, 4e3)}
75197
75285
  \u2026(${String(body.length - 4e3)} more characters)` : body);
75198
- return { kind: "text", text: lines.join("\n") };
75286
+ return { kind: "text", text: lines2.join("\n") };
75199
75287
  },
75200
75288
  async execute(params3, context) {
75201
75289
  const attachments = [];
@@ -75230,21 +75318,21 @@ function createOutlookDraftTool(options) {
75230
75318
  ...attachments.length > 0 ? { attachments } : {},
75231
75319
  ...inlineImages.length > 0 ? { inlineImages } : {}
75232
75320
  });
75233
- const lines = [
75321
+ const lines2 = [
75234
75322
  `The draft is open in Outlook: "${result.subject.length > 0 ? result.subject : "(no subject)"}".`,
75235
75323
  "It has NOT been sent. The user sends it, or edits it first, or closes it."
75236
75324
  ];
75237
75325
  if (result.attached.length > 0)
75238
- lines.push(`Attached: ${result.attached.join(", ")}.`);
75326
+ lines2.push(`Attached: ${result.attached.join(", ")}.`);
75239
75327
  if (result.inline.length > 0)
75240
- lines.push(`Embedded in the body: ${result.inline.join(", ")}.`);
75328
+ lines2.push(`Embedded in the body: ${result.inline.join(", ")}.`);
75241
75329
  if (result.missing.length > 0) {
75242
- lines.push(`Could not be found, so they are NOT in the message: ${result.missing.join(", ")}. Tell the user, since the draft is already open.`);
75330
+ lines2.push(`Could not be found, so they are NOT in the message: ${result.missing.join(", ")}. Tell the user, since the draft is already open.`);
75243
75331
  }
75244
75332
  if (result.unresolved.length > 0) {
75245
- lines.push(`Outlook could not resolve these recipients: ${result.unresolved.join(", ")}. They are still on the message. Check the spelling with the user, or they may simply be external addresses your address book has no entry for.`);
75333
+ lines2.push(`Outlook could not resolve these recipients: ${result.unresolved.join(", ")}. They are still on the message. Check the spelling with the user, or they may simply be external addresses your address book has no entry for.`);
75246
75334
  }
75247
- return { content: lines.join("\n") };
75335
+ return { content: lines2.join("\n") };
75248
75336
  } catch (error51) {
75249
75337
  return { content: message2(error51), isError: true };
75250
75338
  }
@@ -75290,8 +75378,8 @@ var BLOCK_CLOSERS = [
75290
75378
  function checkVba(input) {
75291
75379
  const findings = [];
75292
75380
  const split = input.code.split(/\r?\n/).map(splitLine);
75293
- const lines = split.map((entry) => entry.bare);
75294
- if (!lines.some((line) => /^\s*option\s+explicit\b/i.test(line))) {
75381
+ const lines2 = split.map((entry) => entry.bare);
75382
+ if (!lines2.some((line) => /^\s*option\s+explicit\b/i.test(line))) {
75295
75383
  findings.push({
75296
75384
  line: 1,
75297
75385
  severity: "warning",
@@ -75300,7 +75388,7 @@ function checkVba(input) {
75300
75388
  }
75301
75389
  const stack = [];
75302
75390
  const ifStack = [];
75303
- lines.forEach((line, index) => {
75391
+ lines2.forEach((line, index) => {
75304
75392
  const number5 = index + 1;
75305
75393
  for (const [pattern, kind] of BLOCK_OPENERS) {
75306
75394
  if (pattern.test(line) && !/^\s*(?:public\s+|private\s+)?declare\b/i.test(line)) {
@@ -75331,7 +75419,7 @@ function checkVba(input) {
75331
75419
  }
75332
75420
  }
75333
75421
  if (/\bon\s+error\s+resume\s+next\b/i.test(line)) {
75334
- const restored = lines.slice(index + 1).some((later) => /\bon\s+error\s+goto\s+/i.test(later));
75422
+ const restored = lines2.slice(index + 1).some((later) => /\bon\s+error\s+goto\s+/i.test(later));
75335
75423
  findings.push({
75336
75424
  line: number5,
75337
75425
  severity: restored ? "warning" : "error",
@@ -75340,7 +75428,7 @@ function checkVba(input) {
75340
75428
  }
75341
75429
  if (/\bgoto\s+0\b/i.test(line) === false && /^\s*on\s+error\s+goto\s+(\w+)/i.test(line)) {
75342
75430
  const label = /^\s*on\s+error\s+goto\s+(\w+)/i.exec(line)?.[1];
75343
- if (label !== void 0 && !lines.some((other) => new RegExp(`^\\s*${label}\\s*:`, "i").test(other))) {
75431
+ if (label !== void 0 && !lines2.some((other) => new RegExp(`^\\s*${label}\\s*:`, "i").test(other))) {
75344
75432
  findings.push({ line: number5, severity: "error", message: `Error handler jumps to \`${label}\`, which is not defined.` });
75345
75433
  }
75346
75434
  }
@@ -75421,19 +75509,19 @@ function createExcelRunMacroTool(options) {
75421
75509
  async execute(params3) {
75422
75510
  try {
75423
75511
  const result = await options.bridge.request({ op: "excel.runMacro", ...params3 });
75424
- const lines = [
75512
+ const lines2 = [
75425
75513
  result.failed ? `${result.macro} raised an error: ${result.error ?? "(no message)"}` : `${result.macro} completed${result.returned === null ? "" : `, returning: ${result.returned}`}`
75426
75514
  ];
75427
75515
  if (params3.watchRange !== void 0) {
75428
75516
  const changes = describeChanges(result.before, result.after);
75429
- lines.push("");
75430
- lines.push(changes.length > 0 ? `Cells that changed in ${params3.watchRange}:` : `Nothing changed in ${params3.watchRange}.`);
75431
- lines.push(...changes);
75517
+ lines2.push("");
75518
+ lines2.push(changes.length > 0 ? `Cells that changed in ${params3.watchRange}:` : `Nothing changed in ${params3.watchRange}.`);
75519
+ lines2.push(...changes);
75432
75520
  }
75433
75521
  if (result.failed) {
75434
- lines.push("", "VBA reports only the first failure and gives no line number over COM. excel_check_macro reads the source for the usual causes and reports all of them, without running anything.");
75522
+ lines2.push("", "VBA reports only the first failure and gives no line number over COM. excel_check_macro reads the source for the usual causes and reports all of them, without running anything.");
75435
75523
  }
75436
- return { content: lines.join("\n"), ...result.failed ? { isError: true } : {} };
75524
+ return { content: lines2.join("\n"), ...result.failed ? { isError: true } : {} };
75437
75525
  } catch (error51) {
75438
75526
  return { content: message3(error51), isError: true };
75439
75527
  }
@@ -75491,16 +75579,16 @@ function createExcelCalculateTool(options) {
75491
75579
  async execute(params3) {
75492
75580
  try {
75493
75581
  const result = await options.bridge.request({ op: "excel.calculate", ...params3 });
75494
- const lines = [
75582
+ const lines2 = [
75495
75583
  `Recalculated (${result.scope}) on ${result.sheet}${result.range !== null ? `, ${result.range}` : ""}.`,
75496
75584
  `Calculation mode: ${result.mode}${result.mode === "manual" ? " - formulas only update when recalculated like this, or when the user presses F9." : "."}`
75497
75585
  ];
75498
75586
  if (result.pending)
75499
- lines.push("Excel is still calculating; values may change for a moment yet.");
75587
+ lines2.push("Excel is still calculating; values may change for a moment yet.");
75500
75588
  if (result.cells.length > 0) {
75501
- lines.push("", "Cells now show:", ...result.cells.map((cell) => `${cell.address}: ${cell.text.length > 0 ? cell.text : "(empty)"}`));
75589
+ lines2.push("", "Cells now show:", ...result.cells.map((cell) => `${cell.address}: ${cell.text.length > 0 ? cell.text : "(empty)"}`));
75502
75590
  }
75503
- return { content: lines.join("\n") };
75591
+ return { content: lines2.join("\n") };
75504
75592
  } catch (error51) {
75505
75593
  return { content: message3(error51), isError: true };
75506
75594
  }
@@ -75530,10 +75618,10 @@ function createExcelCheckMacroTool(options) {
75530
75618
  });
75531
75619
  const sheets = sessions.workbooks.find((entry) => entry.name === module2.workbook)?.sheets ?? [];
75532
75620
  const findings = checkVba({ code: module2.code, sheets });
75533
- const lines = module2.code.split(/\r?\n/);
75621
+ const lines2 = module2.code.split(/\r?\n/);
75534
75622
  const quoted = params3.aroundLine === void 0 ? [] : [
75535
75623
  `Line ${String(params3.aroundLine)} reads:`,
75536
- ` ${lines[params3.aroundLine - 1] ?? "(past the end of this module \u2014 is the failure in another one?)"}`,
75624
+ ` ${lines2[params3.aroundLine - 1] ?? "(past the end of this module \u2014 is the failure in another one?)"}`,
75537
75625
  ""
75538
75626
  ];
75539
75627
  if (findings.length === 0) {
@@ -77359,7 +77447,7 @@ var pct = (value, previous) => {
77359
77447
  };
77360
77448
  function renderSummary(d, storeLabel) {
77361
77449
  const name = (user, display) => display !== void 0 ? `${display} (${user})` : user;
77362
- const lines = [
77450
+ const lines2 = [
77363
77451
  `# Usage ${d.scope === "me" ? `for ${d.me}` : "for the team"}, ${new Date(d.from).toISOString().slice(0, 10)} to ${new Date(d.to).toISOString().slice(0, 10)}`,
77364
77452
  `From ${storeLabel}. ${String(d.eventsInStore)} events in range.`,
77365
77453
  "",
@@ -77372,7 +77460,7 @@ function renderSummary(d, storeLabel) {
77372
77460
  const table = (title, header2, rows) => {
77373
77461
  if (rows.length === 0)
77374
77462
  return;
77375
- lines.push("", `## ${title}`, header2, `|${header2.split("|").slice(1, -1).map(() => "---").join("|")}|`, ...rows);
77463
+ lines2.push("", `## ${title}`, header2, `|${header2.split("|").slice(1, -1).map(() => "---").join("|")}|`, ...rows);
77376
77464
  };
77377
77465
  table("Most used skills", "| Skill | Uses | Previous | People | Author |", d.topSkills.slice(0, 15).map((item) => `| ${item.label} | ${String(item.uses)} | ${String(item.previous)} | ${String(item.users)} | ${item.author ?? ""} |`));
77378
77466
  table("Most used tools", "| Tool | Calls | Failed | People | Avg ms |", d.topTools.slice(0, 15).map((item) => `| ${item.label} | ${String(item.uses)} | ${String(item.failures)} | ${String(item.users)} | ${item.averageMs !== void 0 ? String(item.averageMs) : ""} |`));
@@ -77382,15 +77470,15 @@ function renderSummary(d, storeLabel) {
77382
77470
  table("Teams", "| Team | People | Uses | Skill uses | Top skill |", d.teams.map((t) => `| ${t.team} | ${String(t.people)} | ${String(t.uses)} | ${String(t.skillUses)} | ${t.topSkill ?? ""} |`));
77383
77471
  }
77384
77472
  if (d.problems.length > 0) {
77385
- lines.push("", "## Needs attention");
77473
+ lines2.push("", "## Needs attention");
77386
77474
  for (const problem of d.problems)
77387
- lines.push(`- **${problem.severity}**: ${problem.title} - ${problem.items.slice(0, 8).map((item) => item.name).join(", ")}${problem.items.length > 8 ? ", ..." : ""}`);
77475
+ lines2.push(`- **${problem.severity}**: ${problem.title} - ${problem.items.slice(0, 8).map((item) => item.name).join(", ")}${problem.items.length > 8 ? ", ..." : ""}`);
77388
77476
  }
77389
77477
  if (d.unused.length > 0) {
77390
- lines.push("", `## Unused by anybody in range (${String(d.unused.length)})`);
77391
- lines.push(d.unused.slice(0, 30).map((item) => `${item.kind} ${item.name}${item.stale ? " (stale)" : ""}`).join(", ") + (d.unused.length > 30 ? ", ..." : ""));
77478
+ lines2.push("", `## Unused by anybody in range (${String(d.unused.length)})`);
77479
+ lines2.push(d.unused.slice(0, 30).map((item) => `${item.kind} ${item.name}${item.stale ? " (stale)" : ""}`).join(", ") + (d.unused.length > 30 ? ", ..." : ""));
77392
77480
  }
77393
- return lines.join("\n");
77481
+ return lines2.join("\n");
77394
77482
  }
77395
77483
  function createUsageStatsTool(deps) {
77396
77484
  return {
@@ -77903,7 +77991,7 @@ ${preview.text}` } : {}
77903
77991
  }
77904
77992
  }
77905
77993
  async function postSkills() {
77906
- await loadSettings();
77994
+ const skillsConfig = await loadSettings();
77907
77995
  await refreshSkills();
77908
77996
  post({
77909
77997
  type: "skills",
@@ -77917,6 +78005,7 @@ ${preview.text}` } : {}
77917
78005
  };
77918
78006
  const images = await listSkillImages(skill.filePath, { readdir });
77919
78007
  const files = await listSkillFiles(skill.filePath, { readdir });
78008
+ const placeholders = findPlaceholders(await import_promises27.default.readFile(skill.filePath, "utf8").catch(() => ""));
77920
78009
  return {
77921
78010
  name: skill.name,
77922
78011
  description: skill.description,
@@ -77924,6 +78013,7 @@ ${preview.text}` } : {}
77924
78013
  ...images.length > 0 ? { images } : {},
77925
78014
  ...files.length > 0 ? { files } : {},
77926
78015
  ...skill.sourceDir !== void 0 ? { sourceDir: skill.sourceDir } : {},
78016
+ ...placeholders.length > 0 ? { placeholders } : {},
77927
78017
  ...skill.always === true ? { always: true } : {},
77928
78018
  ...skill.author !== void 0 ? { author: skill.author } : {},
77929
78019
  ...skill.project !== void 0 ? { project: skill.project } : {},
@@ -77938,7 +78028,9 @@ ${preview.text}` } : {}
77938
78028
  })),
77939
78029
  issues: skillIssues,
77940
78030
  ...skillsDir !== void 0 ? { skillsDir } : {},
77941
- extraDirs: extraSkillDirs
78031
+ extraDirs: extraSkillDirs,
78032
+ keepPrivate: skillsConfig.teamSkills?.keepPrivate ?? [],
78033
+ skillDefaults: skillsConfig.skillDefaults ?? {}
77942
78034
  });
77943
78035
  scheduleDocsReindex("skills changed");
77944
78036
  watchSkillFolders();
@@ -79196,6 +79288,7 @@ ${preview.text}` } : {}
79196
79288
  nativeGuide: ui.openWalkthrough !== void 0,
79197
79289
  exportsSource: services.sourceArchive !== void 0,
79198
79290
  picksFiles: ui.pickContextFiles !== void 0,
79291
+ savesFiles: ui.savesFiles === true,
79199
79292
  /*
79200
79293
  * Whether this host has a theme of its own to follow.
79201
79294
  *
@@ -80282,10 +80375,14 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
80282
80375
  * the *other* skills are listed or searched for; it does not get to withhold a standing
80283
80376
  * instruction, which by definition has to be present before the model decides anything.
80284
80377
  */
80285
- skills: skillsSearchable ? [
80286
- renderAlwaysSkills(turnSkills),
80287
- renderSkillsHintForPrompt(skills.filter((skill) => skill.always !== true).length)
80288
- ].filter((section) => section.length > 0).join("\n\n") : renderSkillsForPrompt(turnSkills),
80378
+ skills: [
80379
+ skillsSearchable ? [
80380
+ renderAlwaysSkills(turnSkills),
80381
+ renderSkillsHintForPrompt(skills.filter((skill) => skill.always !== true).length)
80382
+ ].filter((section) => section.length > 0).join("\n\n") : renderSkillsForPrompt(turnSkills),
80383
+ // The user's answers to skills' placeholders, so a skill does not stop to ask (`skills/defaults.ts`).
80384
+ renderSkillDefaults(config2.skillDefaults, turnSkills.map((skill) => skill.name))
80385
+ ].filter((section) => section.length > 0).join("\n\n"),
80289
80386
  skillsSearchable,
80290
80387
  canWriteSkills: skillsDir !== void 0,
80291
80388
  codebaseInstructions,
@@ -80419,6 +80516,12 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
80419
80516
  // Also withheld from a scheduled run: nobody is there to fill a form in, and a job
80420
80517
  // that stops to wait for one would never finish.
80421
80518
  ...schedule === void 0 ? { requestForm } : {},
80519
+ // A skill read with the user's defaults for its placeholders carries them (`skills/defaults.ts`).
80520
+ annotateRead: (realPath) => {
80521
+ const fold = (value) => process.platform === "win32" ? import_node_path50.default.resolve(value).toLowerCase() : import_node_path50.default.resolve(value);
80522
+ const skill = skills.find((each) => fold(each.filePath) === fold(realPath));
80523
+ return skill === void 0 ? void 0 : skillDefaultsReadNote(skill.name, config2.skillDefaults?.[skill.name]);
80524
+ },
80422
80525
  // So `wait` ends the moment the user types or reacts, rather than after its full time.
80423
80526
  hasNewUserInput: () => queuedMessages.length > 0 || pendingReactions.size > 0,
80424
80527
  // What the user has said, for `http_request`'s host rule. Not the images a tool returned (labelled
@@ -82419,6 +82522,13 @@ ${redact(shown2, cachedSecretValues)}` }
82419
82522
  const gatewayAuth = await autosysGatewayAuth(config2, tls3);
82420
82523
  if (auth2.sendBasic !== true)
82421
82524
  return gatewayAuth;
82525
+ if (auth2.basicHeaderValueRef !== void 0) {
82526
+ const value = (await secrets.get(auth2.basicHeaderValueRef))?.trim() ?? "";
82527
+ if (value.length === 0) {
82528
+ throw new AtlassianError("AutoSys is set to send a saved header value through the gateway, but none is stored. Settings \u2192 DevOps \u2192 AutoSys \u2192 API gateway: paste it and save.");
82529
+ }
82530
+ return withHeader(gatewayAuth, auth2.basicHeaderName ?? "Authorization", value);
82531
+ }
82422
82532
  const username2 = config2.autosys?.username?.trim() ?? "";
82423
82533
  const password = config2.autosys?.tokenRef !== void 0 ? await secrets.get(config2.autosys.tokenRef) : void 0;
82424
82534
  if (username2.length === 0 || password === void 0 || password.length === 0) {
@@ -82497,7 +82607,7 @@ ${redact(shown2, cachedSecretValues)}` }
82497
82607
  },
82498
82608
  hasToken,
82499
82609
  ...info.id === "autosys" ? {
82500
- gateway: gatewayView(config2.autosys?.auth, (await secrets.get(AUTOSYS_CLIENT_SECRET_REF) ?? "").length > 0, (await secrets.get(AUTOSYS_PASSPHRASE_REF) ?? "").length > 0)
82610
+ gateway: gatewayView(config2.autosys?.auth, (await secrets.get(AUTOSYS_CLIENT_SECRET_REF) ?? "").length > 0, (await secrets.get(AUTOSYS_PASSPHRASE_REF) ?? "").length > 0, (await secrets.get(AUTOSYS_BASIC_VALUE_REF) ?? "").length > 0)
82501
82611
  } : {}
82502
82612
  };
82503
82613
  }
@@ -82548,7 +82658,7 @@ ${redact(shown2, cachedSecretValues)}` }
82548
82658
  }
82549
82659
  });
82550
82660
  if (product === "autosys" && gateway !== void 0) {
82551
- const problem = await saveAutosysGateway(gateway.settings, gateway.clientSecret, gateway.passphrase);
82661
+ const problem = await saveAutosysGateway(gateway.settings, gateway.clientSecret, gateway.passphrase, gateway.basicValue);
82552
82662
  if (problem !== void 0) {
82553
82663
  await loadSettings();
82554
82664
  await postAtlassian();
@@ -82563,14 +82673,17 @@ ${redact(shown2, cachedSecretValues)}` }
82563
82673
  refuse(error51 instanceof Error ? error51.message : String(error51));
82564
82674
  }
82565
82675
  }
82566
- async function saveAutosysGateway(input, clientSecret, passphrase) {
82676
+ async function saveAutosysGateway(input, clientSecret, passphrase, basicValue) {
82567
82677
  if (clientSecret !== void 0 && clientSecret.trim().length > 0)
82568
82678
  await secrets.set(AUTOSYS_CLIENT_SECRET_REF, clientSecret.trim());
82569
82679
  if (passphrase !== void 0 && passphrase.length > 0)
82570
82680
  await secrets.set(AUTOSYS_PASSPHRASE_REF, passphrase);
82681
+ if (basicValue !== void 0 && basicValue.trim().length > 0)
82682
+ await secrets.set(AUTOSYS_BASIC_VALUE_REF, basicValue.trim());
82571
82683
  const result = gatewayFromSettings(input, {
82572
82684
  clientSecret: (await secrets.get(AUTOSYS_CLIENT_SECRET_REF) ?? "").length > 0,
82573
- passphrase: (await secrets.get(AUTOSYS_PASSPHRASE_REF) ?? "").length > 0
82685
+ passphrase: (await secrets.get(AUTOSYS_PASSPHRASE_REF) ?? "").length > 0,
82686
+ basicValue: (await secrets.get(AUTOSYS_BASIC_VALUE_REF) ?? "").length > 0
82574
82687
  });
82575
82688
  if ("error" in result)
82576
82689
  return result.error;
@@ -82579,9 +82692,9 @@ ${redact(shown2, cachedSecretValues)}` }
82579
82692
  autosysGateway = void 0;
82580
82693
  return void 0;
82581
82694
  }
82582
- async function handleSaveAutosysGateway(input, clientSecret, passphrase) {
82695
+ async function handleSaveAutosysGateway(input, clientSecret, passphrase, basicValue) {
82583
82696
  try {
82584
- const problem = await saveAutosysGateway(input, clientSecret, passphrase);
82697
+ const problem = await saveAutosysGateway(input, clientSecret, passphrase, basicValue);
82585
82698
  await loadSettings();
82586
82699
  await postAtlassian();
82587
82700
  if (problem !== void 0)
@@ -82593,11 +82706,11 @@ ${redact(shown2, cachedSecretValues)}` }
82593
82706
  }
82594
82707
  }
82595
82708
  async function handleClearAutosysGatewaySecret(which) {
82596
- await secrets.delete(which === "clientSecret" ? AUTOSYS_CLIENT_SECRET_REF : AUTOSYS_PASSPHRASE_REF);
82709
+ await secrets.delete(which === "clientSecret" ? AUTOSYS_CLIENT_SECRET_REF : which === "passphrase" ? AUTOSYS_PASSPHRASE_REF : AUTOSYS_BASIC_VALUE_REF);
82597
82710
  const { config: config2 } = await configManager.load();
82598
82711
  const auth2 = config2.autosys?.auth;
82599
82712
  if (auth2 !== void 0) {
82600
- const { [which === "clientSecret" ? "clientSecretRef" : "passphraseRef"]: _dropped, ...rest } = auth2;
82713
+ const { [which === "clientSecret" ? "clientSecretRef" : which === "passphrase" ? "passphraseRef" : "basicHeaderValueRef"]: _dropped, ...rest } = auth2;
82601
82714
  void _dropped;
82602
82715
  const next = which === "clientSecret" ? { ...rest, type: "basic" } : rest;
82603
82716
  await configManager.save("user", { autosys: { ...config2.autosys ?? {}, auth: next } });
@@ -82799,12 +82912,12 @@ ${redact(shown2, cachedSecretValues)}` }
82799
82912
  await postS3();
82800
82913
  return;
82801
82914
  }
82802
- const lines = [];
82915
+ const lines2 = [];
82803
82916
  for (const mirror of mirrors) {
82804
82917
  const target = targetById(cachedS3, mirror.connectionId);
82805
82918
  const where = `${mirror.connectionId}/${mirror.prefix ?? ""}`;
82806
82919
  if (target === void 0) {
82807
- lines.push(`${where}: connection unusable - check its key above`);
82920
+ lines2.push(`${where}: connection unusable - check its key above`);
82808
82921
  continue;
82809
82922
  }
82810
82923
  const localDir = mirrorFolder({
@@ -82829,15 +82942,15 @@ ${redact(shown2, cachedSecretValues)}` }
82829
82942
  parts.push(`${String(result.failed.length)} failed`);
82830
82943
  if (result.truncated)
82831
82944
  parts.push("more than the per-sync limit exist \u2014 not all were brought down");
82832
- lines.push(`${target.label}${mirror.prefix === void 0 ? "" : `/${mirror.prefix}`}: ${parts.join(", ")}`);
82945
+ lines2.push(`${target.label}${mirror.prefix === void 0 ? "" : `/${mirror.prefix}`}: ${parts.join(", ")}`);
82833
82946
  for (const failure of result.failed) {
82834
82947
  logger.warn(`s3 ${kind}: ${failure.key}`, failure.problem);
82835
82948
  }
82836
82949
  } catch (error51) {
82837
- lines.push(`${target.label}: ${error51 instanceof Error ? error51.message : String(error51)}`);
82950
+ lines2.push(`${target.label}: ${error51 instanceof Error ? error51.message : String(error51)}`);
82838
82951
  }
82839
82952
  }
82840
- lastSync = { ...lastSync, [kind]: `${(/* @__PURE__ */ new Date()).toLocaleTimeString()} - ${lines.join("; ")}` };
82953
+ lastSync = { ...lastSync, [kind]: `${(/* @__PURE__ */ new Date()).toLocaleTimeString()} - ${lines2.join("; ")}` };
82841
82954
  if (kind === "skills") {
82842
82955
  await refreshSkills();
82843
82956
  postSkills();
@@ -82942,8 +83055,32 @@ ${redact(shown2, cachedSecretValues)}` }
82942
83055
  }
82943
83056
  return "Could not build the embedding model. Check the embedder settings in Settings \u2192 Search.";
82944
83057
  }
82945
- async function handlePublishTeamSkills() {
83058
+ function cleanSkillNames(names) {
83059
+ return [...new Set(names.map((name) => name.trim()).filter((name) => name.length > 0))].sort();
83060
+ }
83061
+ async function saveKeepPrivate(names) {
83062
+ const { config: config2 } = await configManager.load();
83063
+ await configManager.save("user", { teamSkills: { ...config2.teamSkills ?? {}, keepPrivate: cleanSkillNames(names) } });
83064
+ }
83065
+ async function handleSaveSkillDefaults(skill, values) {
83066
+ const name = skill.trim();
83067
+ if (name.length === 0)
83068
+ return;
83069
+ const { config: config2 } = await configManager.load();
83070
+ const next = { ...config2.skillDefaults ?? {} };
83071
+ const cleaned = cleanSkillDefaults(values);
83072
+ if (Object.keys(cleaned).length === 0)
83073
+ delete next[name];
83074
+ else
83075
+ next[name] = cleaned;
83076
+ await configManager.save("user", { skillDefaults: next });
83077
+ await postSkills();
83078
+ }
83079
+ async function handlePublishTeamSkills(keepPrivateNow) {
83080
+ if (keepPrivateNow !== void 0)
83081
+ await saveKeepPrivate(keepPrivateNow);
82946
83082
  const config2 = await loadSettings();
83083
+ const keepPrivate = new Set(config2.teamSkills?.keepPrivate ?? []);
82947
83084
  const collection = skillsIndexName(config2);
82948
83085
  const search = await resolveSearch(config2);
82949
83086
  const embedder = await resolveEmbedder(config2);
@@ -82955,10 +83092,11 @@ ${redact(shown2, cachedSecretValues)}` }
82955
83092
  return;
82956
83093
  }
82957
83094
  const signal = beginIndexing("teamSkills");
82958
- reportIndexing("teamSkills", "Reading skills", { detail: `${String(skills.length)} skill(s)` });
83095
+ const sending = skills.filter((skill) => !keepPrivate.has(skill.name));
83096
+ reportIndexing("teamSkills", "Reading skills", { detail: `${String(sending.length)} skill(s)` });
82959
83097
  try {
82960
83098
  const withBodies = [];
82961
- for (const skill of skills) {
83099
+ for (const skill of sending) {
82962
83100
  let body = "";
82963
83101
  try {
82964
83102
  body = await import_promises27.default.readFile(skill.filePath, "utf8");
@@ -82969,8 +83107,9 @@ ${redact(shown2, cachedSecretValues)}` }
82969
83107
  }
82970
83108
  const owner = indexOwner(config2);
82971
83109
  const project = indexProject(config2);
83110
+ const writer = createVectorIndexWriter(httpClient, search.store, await vectorStoreConnectionFor(search.store, search.id));
82972
83111
  const count3 = await indexTeamSkills({
82973
- writer: createVectorIndexWriter(httpClient, search.store, await vectorStoreConnectionFor(search.store, search.id)),
83112
+ writer,
82974
83113
  embedder,
82975
83114
  collection,
82976
83115
  aliases: skillAliases(config2),
@@ -82982,9 +83121,18 @@ ${redact(shown2, cachedSecretValues)}` }
82982
83121
  ...project !== void 0 ? { project } : {}
82983
83122
  }
82984
83123
  });
82985
- post({ type: "teamSkillsPublished", count: count3, collection });
83124
+ let withdrawn = 0;
83125
+ if (keepPrivate.size > 0) {
83126
+ const present2 = new Set(await writer.listPaths(collection, { signal }));
83127
+ const paths = [...keepPrivate].map((name) => teamSkillPath({ name })).filter((each) => present2.has(each));
83128
+ if (paths.length > 0) {
83129
+ await deleteInBatches(writer, collection, paths, (done, total) => reportIndexing("teamSkills", "Taking back private skills", { done, total }), signal);
83130
+ withdrawn = paths.length;
83131
+ }
83132
+ }
83133
+ post({ type: "teamSkillsPublished", count: count3, collection, ...withdrawn > 0 ? { withdrawn } : {} });
82986
83134
  reportIndexing("teamSkills", "Finished", {
82987
- detail: `Sent ${String(count3)} skill(s).`,
83135
+ detail: `Sent ${String(count3)} skill(s)${withdrawn > 0 ? `, took back ${String(withdrawn)} kept private` : ""}.`,
82988
83136
  running: false
82989
83137
  });
82990
83138
  } catch (error51) {
@@ -83053,8 +83201,11 @@ ${redact(shown2, cachedSecretValues)}` }
83053
83201
  stored.set(document.path, document.text);
83054
83202
  cursor = page.next;
83055
83203
  } while (cursor !== void 0);
83204
+ const keepPrivate = new Set(config2.teamSkills?.keepPrivate ?? []);
83056
83205
  const entries = await Promise.all(skills.map(async (skill) => {
83057
83206
  const sent = stored.get(teamSkillPath(skill));
83207
+ if (keepPrivate.has(skill.name))
83208
+ return { name: skill.name, state: sent === void 0 ? "private" : "withdraw" };
83058
83209
  if (sent === void 0)
83059
83210
  return { name: skill.name, state: "missing" };
83060
83211
  let body;
@@ -83325,20 +83476,20 @@ ${redact(shown2, cachedSecretValues)}` }
83325
83476
  return;
83326
83477
  }
83327
83478
  const { options } = resolved;
83328
- const lines = [
83479
+ const lines2 = [
83329
83480
  `This machine searches ${options.collections.join(" \u2192 ")}` + (options.owner !== void 0 ? `, as ${options.owner}.` : ".")
83330
83481
  ];
83331
83482
  for (const alias of options.collections) {
83332
83483
  try {
83333
83484
  const found2 = await searchTeamSkills({ ...options, collections: [alias] }, query, 10);
83334
83485
  if (found2.hits.length === 0) {
83335
- lines.push(`- ${alias}: answers, but nobody has published under this name yet.`);
83486
+ lines2.push(`- ${alias}: answers, but nobody has published under this name yet.`);
83336
83487
  continue;
83337
83488
  }
83338
83489
  const owners = [...new Set(found2.hits.map((hit) => hit.isMine ? "you" : hit.owner ?? "unknown owner"))];
83339
- lines.push(`- ${alias}: ${String(found2.hits.length)} nearest skill(s), from ${owners.join(", ")}.`);
83490
+ lines2.push(`- ${alias}: ${String(found2.hits.length)} nearest skill(s), from ${owners.join(", ")}.`);
83340
83491
  } catch (error51) {
83341
- lines.push(`- ${alias}: ${error51 instanceof Error ? error51.message : String(error51)}`);
83492
+ lines2.push(`- ${alias}: ${error51 instanceof Error ? error51.message : String(error51)}`);
83342
83493
  }
83343
83494
  }
83344
83495
  const tool2 = createSearchTeamSkillsTool({ ...options, observer: searchLog });
@@ -83347,7 +83498,7 @@ ${redact(shown2, cachedSecretValues)}` }
83347
83498
  type: "searchProbe",
83348
83499
  target,
83349
83500
  query,
83350
- text: [...lines, "", "What the assistant gets:", "", result2.content].join("\n"),
83501
+ text: [...lines2, "", "What the assistant gets:", "", result2.content].join("\n"),
83351
83502
  ...result2.isError === true ? { error: "The search failed." } : {}
83352
83503
  });
83353
83504
  return;
@@ -85224,6 +85375,31 @@ ${redact(shown2, cachedSecretValues)}` }
85224
85375
  fail(error51 instanceof Error ? error51.message : String(error51));
85225
85376
  }
85226
85377
  }
85378
+ const SAVE_FILE_LIMIT = 20 * 1024 * 1024;
85379
+ async function handleSaveFile(requestId, name, base643) {
85380
+ const answer = (result) => post({ type: "fileSaved", requestId, ...result });
85381
+ const bytes = Buffer.from(base643, "base64");
85382
+ if (bytes.length === 0 || bytes.length > SAVE_FILE_LIMIT) {
85383
+ answer({ error: bytes.length === 0 ? "There was nothing to save." : "That file is too large to save from here." });
85384
+ return;
85385
+ }
85386
+ const safeName = [...import_node_path50.default.basename(name)].map((c2) => c2.charCodeAt(0) < 32 || '<>:"/\\|?*'.includes(c2) ? "-" : c2).join("") || "file";
85387
+ const extension = import_node_path50.default.extname(safeName).slice(1);
85388
+ try {
85389
+ const target = await ui.showSaveDialog({
85390
+ defaultName: workspaceRoot !== void 0 ? import_node_path50.default.join(workspaceRoot, safeName) : safeName,
85391
+ ...extension.length > 0 ? { extensions: [extension] } : {}
85392
+ });
85393
+ if (target === void 0) {
85394
+ answer({});
85395
+ return;
85396
+ }
85397
+ await import_promises27.default.writeFile(target, bytes);
85398
+ answer({ path: target });
85399
+ } catch (error51) {
85400
+ answer({ error: `Could not save it: ${error51 instanceof Error ? error51.message : String(error51)}` });
85401
+ }
85402
+ }
85227
85403
  async function handleExportSource() {
85228
85404
  const archive = services.sourceArchive;
85229
85405
  if (archive === void 0)
@@ -86049,6 +86225,8 @@ ${redact(shown2, cachedSecretValues)}` }
86049
86225
  reportFailure("handleDuplicateMcpServer", handleDuplicateMcpServer(message4.name));
86050
86226
  } else if (message4.type === "deleteMcpServer") {
86051
86227
  reportFailure("handleDeleteMcpServer", handleDeleteMcpServer(message4.name));
86228
+ } else if (message4.type === "saveFile") {
86229
+ reportFailure("handleSaveFile", handleSaveFile(message4.requestId, message4.name, message4.base64));
86052
86230
  } else if (message4.type === "browseForPath") {
86053
86231
  reportFailure("handleBrowseForPath", handleBrowseForPath(message4.purpose, message4.kind, message4.extensions));
86054
86232
  } else if (message4.type === "probePythonEnv") {
@@ -86139,7 +86317,7 @@ ${redact(shown2, cachedSecretValues)}` }
86139
86317
  } else if (message4.type === "saveAtlassian") {
86140
86318
  reportFailure("handleSaveAtlassian", handleSaveAtlassian(message4.product, message4.settings, message4.token, message4.gateway));
86141
86319
  } else if (message4.type === "saveAutosysGateway") {
86142
- reportFailure("handleSaveAutosysGateway", handleSaveAutosysGateway(message4.gateway, message4.clientSecret, message4.passphrase));
86320
+ reportFailure("handleSaveAutosysGateway", handleSaveAutosysGateway(message4.gateway, message4.clientSecret, message4.passphrase, message4.basicValue));
86143
86321
  } else if (message4.type === "clearAutosysGatewaySecret") {
86144
86322
  reportFailure("handleClearAutosysGatewaySecret", handleClearAutosysGatewaySecret(message4.which));
86145
86323
  } else if (message4.type === "clearAtlassianToken") {
@@ -86182,7 +86360,11 @@ ${redact(shown2, cachedSecretValues)}` }
86182
86360
  } else if (message4.type === "attachTeamAlias") {
86183
86361
  reportFailure("handleAttachTeamAlias", handleAttachTeamAlias());
86184
86362
  } else if (message4.type === "publishTeamSkills") {
86185
- reportFailure("handlePublishTeamSkills", handlePublishTeamSkills());
86363
+ reportFailure("handlePublishTeamSkills", handlePublishTeamSkills(message4.keepPrivate));
86364
+ } else if (message4.type === "saveTeamSkillSelection") {
86365
+ reportFailure("saveTeamSkillSelection", saveKeepPrivate(message4.keepPrivate).then(postSkills));
86366
+ } else if (message4.type === "saveSkillDefaults") {
86367
+ reportFailure("handleSaveSkillDefaults", handleSaveSkillDefaults(message4.skill, message4.values));
86186
86368
  } else if (message4.type === "syncMail") {
86187
86369
  reportFailure("runMailSync", runMailSync("requested"));
86188
86370
  } else if (message4.type === "pruneMail") {
@@ -86575,22 +86757,22 @@ ${redact(shown2, cachedSecretValues)}` }
86575
86757
  ui.showWarning("That run's transcript is no longer stored \u2014 task history may have been cleared.");
86576
86758
  return;
86577
86759
  }
86578
- const lines = [];
86760
+ const lines2 = [];
86579
86761
  for (const entry of toTranscript(task.messages)) {
86580
86762
  if (entry.kind === "text") {
86581
- lines.push(entry.role === "user" ? `## Prompt
86763
+ lines2.push(entry.role === "user" ? `## Prompt
86582
86764
 
86583
86765
  ${entry.content}` : `## Reply
86584
86766
 
86585
86767
  ${entry.content}`);
86586
86768
  } else if (entry.kind === "reasoning") {
86587
- lines.push(`## Thinking
86769
+ lines2.push(`## Thinking
86588
86770
 
86589
86771
  ${entry.content}`);
86590
86772
  } else if (entry.kind === "chart") {
86591
86773
  const chart = entry.chart;
86592
86774
  const header2 = ["", ...chart.series.map((series) => series.name)];
86593
- lines.push([
86775
+ lines2.push([
86594
86776
  `## ${chart.title ?? "Chart"}`,
86595
86777
  "",
86596
86778
  `| ${header2.join(" | ")} |`,
@@ -86599,17 +86781,17 @@ ${entry.content}`);
86599
86781
  ...chart.note === void 0 ? [] : ["", chart.note]
86600
86782
  ].join("\n"));
86601
86783
  } else if (entry.kind === "chartError") {
86602
- lines.push(`## Chart
86784
+ lines2.push(`## Chart
86603
86785
 
86604
86786
  Could not be drawn: ${entry.message}`);
86605
86787
  } else if (entry.kind === "diagramError") {
86606
- lines.push(`## Diagram
86788
+ lines2.push(`## Diagram
86607
86789
 
86608
86790
  Could not be drawn: ${entry.message}`);
86609
86791
  } else if (entry.kind === "diagram") {
86610
86792
  const diagram = entry.diagram;
86611
86793
  const labels = new Map(diagram.nodes.map((node) => [node.id, node.label]));
86612
- lines.push([
86794
+ lines2.push([
86613
86795
  `## ${diagram.title ?? "Diagram"}`,
86614
86796
  "",
86615
86797
  ...diagram.edges.map((edge) => {
@@ -86620,7 +86802,7 @@ Could not be drawn: ${entry.message}`);
86620
86802
  ].join("\n"));
86621
86803
  } else {
86622
86804
  const call = entry.toolCall;
86623
- lines.push([
86805
+ lines2.push([
86624
86806
  `## Tool: ${call.name}${call.isError === true ? " (failed)" : ""}`,
86625
86807
  "",
86626
86808
  "### Arguments",
@@ -86633,7 +86815,7 @@ Could not be drawn: ${entry.message}`);
86633
86815
  }
86634
86816
  await ui.openDocument({
86635
86817
  title,
86636
- content: lines.length > 0 ? lines.join("\n\n") : "_This run produced no messages._"
86818
+ content: lines2.length > 0 ? lines2.join("\n\n") : "_This run produced no messages._"
86637
86819
  });
86638
86820
  }
86639
86821
  let runningScheduleId;
@@ -87842,9 +88024,9 @@ function describeDiagnostics(shown2, result, cap2 = 20) {
87842
88024
  return `${result.server}: no errors or warnings in ${shown2}.`;
87843
88025
  const sorted = [...relevant].sort((a, b) => a.severity === b.severity ? a.line - b.line : a.severity === "error" ? -1 : 1);
87844
88026
  const errors = relevant.filter((d) => d.severity === "error").length;
87845
- const lines = sorted.slice(0, cap2).map((d) => ` ${shown2}:${String(d.line)}:${String(d.column)} ${d.severity}: ${d.message.split("\n")[0] ?? ""}${d.code !== void 0 ? ` [${d.code}]` : ""}`);
88027
+ const lines2 = sorted.slice(0, cap2).map((d) => ` ${shown2}:${String(d.line)}:${String(d.column)} ${d.severity}: ${d.message.split("\n")[0] ?? ""}${d.code !== void 0 ? ` [${d.code}]` : ""}`);
87846
88028
  return `${result.server}: ${String(errors)} error(s), ${String(relevant.length - errors)} warning(s) in ${shown2}:
87847
- ${lines.join("\n")}${relevant.length > cap2 ? `
88029
+ ${lines2.join("\n")}${relevant.length > cap2 ? `
87848
88030
  \u2026 ${String(relevant.length - cap2)} more` : ""}`;
87849
88031
  }
87850
88032
 
@@ -88042,51 +88224,51 @@ var REPLACE_MARKER = ">>>>>>> REPLACE";
88042
88224
  var DASH_SEPARATOR = "-------";
88043
88225
  var START_LINE_PATTERN = /^:start_line:(\d+)$/;
88044
88226
  function parseDiff(diffText) {
88045
- const lines = diffText.split("\n");
88227
+ const lines2 = diffText.split("\n");
88046
88228
  const blocks = [];
88047
88229
  let i = 0;
88048
- while (i < lines.length) {
88049
- if ((lines[i] ?? "").trim() === "") {
88230
+ while (i < lines2.length) {
88231
+ if ((lines2[i] ?? "").trim() === "") {
88050
88232
  i++;
88051
88233
  continue;
88052
88234
  }
88053
- if (lines[i] !== SEARCH_MARKER) {
88054
- return { ok: false, error: `Expected "${SEARCH_MARKER}" at line ${i + 1}, got: "${lines[i]}"` };
88235
+ if (lines2[i] !== SEARCH_MARKER) {
88236
+ return { ok: false, error: `Expected "${SEARCH_MARKER}" at line ${i + 1}, got: "${lines2[i]}"` };
88055
88237
  }
88056
88238
  i++;
88057
88239
  let startLine;
88058
- const startLineMatch = START_LINE_PATTERN.exec(lines[i] ?? "");
88240
+ const startLineMatch = START_LINE_PATTERN.exec(lines2[i] ?? "");
88059
88241
  if (startLineMatch !== null) {
88060
88242
  startLine = Number(startLineMatch[1]);
88061
88243
  i++;
88062
- if (lines[i] !== DASH_SEPARATOR) {
88244
+ if (lines2[i] !== DASH_SEPARATOR) {
88063
88245
  return { ok: false, error: `Expected "${DASH_SEPARATOR}" after ":start_line:" at line ${i + 1}.` };
88064
88246
  }
88065
88247
  i++;
88066
88248
  }
88067
88249
  const searchLines = [];
88068
- while (i < lines.length && lines[i] !== SEPARATOR) {
88069
- const line = lines[i] ?? "";
88250
+ while (i < lines2.length && lines2[i] !== SEPARATOR) {
88251
+ const line = lines2[i] ?? "";
88070
88252
  if (line === SEARCH_MARKER || line === REPLACE_MARKER || START_LINE_PATTERN.test(line)) {
88071
88253
  return { ok: false, error: `Unexpected marker inside the SEARCH block at line ${i + 1}: "${line}"` };
88072
88254
  }
88073
88255
  searchLines.push(line);
88074
88256
  i++;
88075
88257
  }
88076
- if (i >= lines.length) {
88258
+ if (i >= lines2.length) {
88077
88259
  return { ok: false, error: `Missing "${SEPARATOR}" to end the SEARCH block.` };
88078
88260
  }
88079
88261
  i++;
88080
88262
  const replaceLines = [];
88081
- while (i < lines.length && lines[i] !== REPLACE_MARKER) {
88082
- const line = lines[i] ?? "";
88263
+ while (i < lines2.length && lines2[i] !== REPLACE_MARKER) {
88264
+ const line = lines2[i] ?? "";
88083
88265
  if (line === SEARCH_MARKER || line === SEPARATOR || START_LINE_PATTERN.test(line)) {
88084
88266
  return { ok: false, error: `Unexpected marker inside the REPLACE block at line ${i + 1}: "${line}"` };
88085
88267
  }
88086
88268
  replaceLines.push(line);
88087
88269
  i++;
88088
88270
  }
88089
- if (i >= lines.length) {
88271
+ if (i >= lines2.length) {
88090
88272
  return { ok: false, error: `Missing "${REPLACE_MARKER}" to end the block.` };
88091
88273
  }
88092
88274
  i++;
@@ -88109,17 +88291,17 @@ function applyDiff(originalContent, diffText) {
88109
88291
  return { ok: false, content: originalContent, message: parsed.error };
88110
88292
  }
88111
88293
  const eol = detectEol(originalContent);
88112
- const lines = normalizeToLf(originalContent).split("\n");
88294
+ const lines2 = normalizeToLf(originalContent).split("\n");
88113
88295
  const resolved = [];
88114
88296
  for (const block2 of parsed.blocks) {
88115
- const match = findMatch(lines, block2);
88297
+ const match = findMatch(lines2, block2);
88116
88298
  if (!match.ok) {
88117
88299
  return { ok: false, content: originalContent, message: match.message };
88118
88300
  }
88119
88301
  resolved.push(match);
88120
88302
  }
88121
88303
  const bottomUp = [...resolved].sort((a, b) => b.startLine - a.startLine);
88122
- const nextLines = [...lines];
88304
+ const nextLines = [...lines2];
88123
88305
  for (const block2 of bottomUp) {
88124
88306
  const replaceLines = block2.replace.length > 0 ? block2.replace.split("\n") : [""];
88125
88307
  nextLines.splice(block2.startLine, block2.endLine - block2.startLine + 1, ...replaceLines);
@@ -88526,7 +88708,7 @@ alert about.
88526
88708
  {
88527
88709
  id: "skills",
88528
88710
  title: "Skills: teaching it things it cannot work out",
88529
- keywords: ["skill", "teach", "instructions", "standing", "always", "master skill", "markdown", "edit skill", "editor", "edit standing instructions", "standing instructions", "edit a skill"],
88711
+ keywords: ["skill", "teach", "instructions", "standing", "always", "master skill", "markdown", "edit skill", "editor", "edit standing instructions", "standing instructions", "edit a skill", "placeholder", "placeholders", "skill defaults", "default values", "skill inputs", "stop asking", "keep skill private", "which skills to send", "keep to myself"],
88530
88712
  body: `
88531
88713
  A skill is markdown with frontmatter (\`name\`, \`description\`), kept in the workspace so it lands
88532
88714
  in git and gets reviewed. **Settings \u2192 Skills.**
@@ -88581,6 +88763,20 @@ so one person re-indexing never disturbs anybody else. The team skills aliases,
88581
88763
  team search test are in **Settings -> Project -> Team skills**. Searches return this project's
88582
88764
  skills by default; say "all projects", another project's name, or a person to widen or change that.
88583
88765
 
88766
+ **Choosing which skills go to the team.** Settings -> Project -> Team skills -> *Choose which skills to
88767
+ send*: untick a skill to keep it to yourself. The choice is remembered (config:teamSkills), the Send
88768
+ button counts what goes, and a skill unticked after it was sent is taken back from the pool by the
88769
+ next Send - only your own copy; colleagues' collections are never touched. Check status marks it
88770
+ "kept to yourself".
88771
+
88772
+ **Defaults for a skill's inputs.** A skill that needs answers - an environment, a team, a user name -
88773
+ can be answered in advance, so the assistant fills them in instead of stopping to ask. Settings ->
88774
+ Skills -> a skill -> *Defaults for its inputs*: placeholders written \`{{name}}\` or \`<NAME>\` in the
88775
+ skill are offered as boxes, and any other input can be added by name. They are yours, kept in your own
88776
+ settings (config:skillDefaults), never in the skill, so a shared skill stays the same for everyone.
88777
+ The assistant is told them up front and again when it reads the skill, says which it used, and still
88778
+ asks for anything without a default; a different value you give in the chat wins.
88779
+
88584
88780
  A skill is **prose nobody code-reviews that steers every conversation that finds it**. That is why
88585
88781
  writing one always asks for approval, whatever else is auto-approved, and why plain markdown in
88586
88782
  git is the main defence.
@@ -89111,10 +89307,15 @@ and the secret is right, switch *How the consumer key and secret are sent* betwe
89111
89307
  and a Basic header \u2014 gateways differ. **Gateway token and AutoSys username and password together** (an AutoSys that wants both, plus the
89112
89308
  certificate, for job status, details and actions): tick *Also send the AutoSys username and password
89113
89309
  with each job call (HTTP Basic)* \u2014 it sends the username and password entered above as Basic on every
89114
- AutoSys call, alongside the gateway's token, and never on the token request. One header holds one value, so the two must go in different headers:
89310
+ AutoSys call, alongside the gateway's token, and never on the token request. **Or paste the whole header
89311
+ value yourself** in *Header value* (for example \`Basic \` followed by the base64 of username:password -
89312
+ in Python \`"Basic " + base64.b64encode(b"user:pass").decode()\`): it is sent exactly as stored, kept in
89313
+ secure storage, and the username and password are then not needed. *Header name for the sign-in* takes
89314
+ whatever your gateway expects (for example x-api-authorization-header-for-service-provider), and is
89315
+ editable if it was mistyped. One header holds one value, so the two must go in different headers:
89115
89316
  usually the token in a gateway header (Advanced \u2192 *Header the token is sent in*, such as
89116
- x-apigee-token) and the Basic sign-in in Authorization, or the other way round with *Header for the
89117
- username and password*. The panel warns before saving if both would land in the same one. *Advanced* covers the grant type, where the token and its
89317
+ x-apigee-token) and the Basic sign-in in Authorization, or the token in Authorization (Bearer) and the
89318
+ sign-in in a header of its own. The panel warns before saving if both would land in the same one. *Advanced* covers the grant type, where the token and its
89118
89319
  expiry sit in the response, the header and prefix it is sent with, extra headers (an API key, say)
89119
89320
  and extra token parameters (config:autosys).
89120
89321
 
@@ -89910,6 +90111,12 @@ edits made outside the agent (in VS Code, say) are saved with \`hub_sync\` "push
89910
90111
  "parallel agents",
89911
90112
  "chat tabs",
89912
90113
  "new chat tab",
90114
+ "archive chat",
90115
+ "archived chat",
90116
+ "close chat",
90117
+ "blank chat",
90118
+ "new chat shows old",
90119
+ "reopen chat",
89913
90120
  "two agents same codebase",
89914
90121
  "same codebase at once",
89915
90122
  "same codebase",
@@ -89986,7 +90193,11 @@ with a note saying so - whether the copies come from a bucket, a shared folder o
89986
90193
  **Several chats per codebase**: the tabs above the chat. + (or Ctrl+T, or right-click \u2192 New chat) opens
89987
90194
  another chat on the same codebase \u2014 its own agent, working at the same time, with the same settings and
89988
90195
  keys. To rename a chat - the first one too - double-click its tab, or right-click it \u2192 Rename chat; the
89989
- name shows on the tab and in notifications. \xD7 or Ctrl+W closes a chat (its history is kept). Two safeguards make
90196
+ name shows on the tab and in notifications. \xD7 or Ctrl+W asks how to close a chat: **Archive** keeps its
90197
+ conversation and takes the tab away; **Close and delete** removes its conversations, reports and log
90198
+ (files it changed in the codebase stay). **New chat** is always blank - a closed chat's number is never
90199
+ reused - and when chats are archived, + offers *New blank chat* or any archived chat, which opens exactly
90200
+ where it was left (each archived row also has a delete). Ctrl+T is always blank. Two safeguards make
89990
90201
  this safe: an edit is refused when the file changed since that chat read it (another chat, you, or any
89991
90202
  program edited it) \u2014 the agent re-reads and edits what is there now; and **Rollback undoes only the files
89992
90203
  that chat changed**, never another chat's work. If another chat also changed one of those files since,
@@ -90248,7 +90459,9 @@ the agent's log too (right-click the codebase \u2192 View agent log); VS Code to
90248
90459
  body: `
90249
90460
  **Three levels**, most specific first: what you say **in the chat**, then **codebase instructions**,
90250
90461
  then **standing instructions**. Every chat on a codebase gets the codebase instructions with every
90251
- message, ahead of the standing instructions; where they disagree the codebase instructions win.
90462
+ message; where they disagree with the standing instructions the codebase instructions win. They are
90463
+ placed at the end of what the agent is told (before only a plan you set for the chat), and named at the
90464
+ very start, because instructions in the middle of a long prompt are the ones a model follows least.
90252
90465
 
90253
90466
  **Codebase instructions** are about one codebase and are kept on this machine, not in the repository,
90254
90467
  so a cloned repository cannot write them. Edit them in **Settings \u2192 Skills \u2192 Codebase instructions**,
@@ -90259,6 +90472,33 @@ sent; keep them short, they are paid for on every request.
90259
90472
  **Standing instructions** are a skill with \`always: true\` (Settings \u2192 Skills \u2192 Standing
90260
90473
  instructions). They can live in the repository or a shared bucket, so they can apply to many
90261
90474
  codebases and a whole team. Fire Code's dialog has a button that opens them too.
90475
+ `
90476
+ },
90477
+ {
90478
+ id: "diagrams",
90479
+ title: "Diagrams in the chat: SVG and PNG",
90480
+ keywords: [
90481
+ "diagram",
90482
+ "flowchart",
90483
+ "flow chart",
90484
+ "architecture diagram",
90485
+ "draw",
90486
+ "save svg",
90487
+ "save png",
90488
+ "save diagram",
90489
+ "export diagram",
90490
+ "download diagram",
90491
+ "diagram as image",
90492
+ "show_diagram"
90493
+ ],
90494
+ body: `
90495
+ Ask for a diagram ("draw the request flow", "show the architecture") and the assistant draws one in the
90496
+ chat with \`show_diagram\`. It follows your theme and accent.
90497
+
90498
+ Under each diagram: **Copy SVG** copies the markup to paste into a document or editor; **Save SVG** and
90499
+ **Save PNG** open a Save dialog - VS Code's own, or a Windows one in Fire Code starting in Downloads - and
90500
+ say where the file went. A PNG is drawn at twice the size so it stays sharp in a slide. In a plain browser
90501
+ the file downloads instead. If a save fails, the reason is shown under the buttons.
90262
90502
  `
90263
90503
  },
90264
90504
  {
@@ -91185,8 +91425,8 @@ var listFilesTool = {
91185
91425
  }
91186
91426
  const entries = await context.fs.readdir(resolved.realPath);
91187
91427
  const visible = entries.filter((entry) => entry.name !== ".git" && entry.name !== "node_modules");
91188
- const lines = visible.map((entry) => entry.isDirectory ? `${entry.name}/` : entry.name);
91189
- return { content: lines.length > 0 ? lines.join("\n") : "(empty directory)" };
91428
+ const lines2 = visible.map((entry) => entry.isDirectory ? `${entry.name}/` : entry.name);
91429
+ return { content: lines2.length > 0 ? lines2.join("\n") : "(empty directory)" };
91190
91430
  }
91191
91431
  };
91192
91432
 
@@ -91220,10 +91460,11 @@ var readFileTool = {
91220
91460
  }
91221
91461
  await recordRead(context, resolved.realPath);
91222
91462
  try {
91463
+ const note = context.annotateRead?.(resolved.realPath) ?? "";
91223
91464
  if (size <= REQUIRE_WINDOW_BYTES) {
91224
- return { content: readSmall(await context.fs.readFile(resolved.realPath), params3), path: params3.path };
91465
+ return { content: readSmall(await context.fs.readFile(resolved.realPath), params3) + note, path: params3.path };
91225
91466
  }
91226
- return { content: await readLarge(context.fs, resolved.realPath, params3, size), path: params3.path };
91467
+ return { content: await readLarge(context.fs, resolved.realPath, params3, size) + note, path: params3.path };
91227
91468
  } catch (error51) {
91228
91469
  return {
91229
91470
  content: `Could not read "${params3.path}": ${error51 instanceof Error ? error51.message : String(error51)}`,
@@ -91233,18 +91474,18 @@ var readFileTool = {
91233
91474
  }
91234
91475
  }
91235
91476
  };
91236
- function number4(lines, firstLineNumber) {
91237
- return lines.map((line, index) => `${firstLineNumber + index} ${line}`).join("\n");
91477
+ function number4(lines2, firstLineNumber) {
91478
+ return lines2.map((line, index) => `${firstLineNumber + index} ${line}`).join("\n");
91238
91479
  }
91239
91480
  function readSmall(raw, params3) {
91240
- const lines = raw.split(/\r\n|\r|\n/);
91481
+ const lines2 = raw.split(/\r\n|\r|\n/);
91241
91482
  if (params3.tail !== void 0) {
91242
- const start2 = Math.max(0, lines.length - params3.tail);
91243
- return number4(lines.slice(start2), start2 + 1);
91483
+ const start2 = Math.max(0, lines2.length - params3.tail);
91484
+ return number4(lines2.slice(start2), start2 + 1);
91244
91485
  }
91245
91486
  const start = params3.offset !== void 0 ? params3.offset - 1 : 0;
91246
- const end = params3.limit !== void 0 ? start + params3.limit : lines.length;
91247
- return number4(lines.slice(start, end), start + 1);
91487
+ const end = params3.limit !== void 0 ? start + params3.limit : lines2.length;
91488
+ return number4(lines2.slice(start, end), start + 1);
91248
91489
  }
91249
91490
  async function readLarge(fs41, realPath, params3, size) {
91250
91491
  const human = formatBytes(size);
@@ -91325,15 +91566,15 @@ var readDocumentTool = {
91325
91566
  path: params3.path
91326
91567
  };
91327
91568
  }
91328
- const lines = extracted.text.split("\n");
91569
+ const lines2 = extracted.text.split("\n");
91329
91570
  const start = params3.offset !== void 0 ? params3.offset - 1 : 0;
91330
- const end = params3.limit !== void 0 ? start + params3.limit : lines.length;
91331
- const slice = lines.slice(start, end);
91571
+ const end = params3.limit !== void 0 ? start + params3.limit : lines2.length;
91572
+ const slice = lines2.slice(start, end);
91332
91573
  const header2 = [
91333
- `${params3.path} (${kind}, ${String(lines.length)} lines of text)`,
91574
+ `${params3.path} (${kind}, ${String(lines2.length)} lines of text)`,
91334
91575
  ...extracted.sections !== void 0 && extracted.sections.length > 1 ? [`Sheets: ${extracted.sections.join(", ")}`] : [],
91335
91576
  ...extracted.note !== void 0 ? [extracted.note] : [],
91336
- ...end < lines.length || start > 0 ? [`Showing lines ${String(start + 1)}\u2013${String(Math.min(end, lines.length))}. Use offset/limit for more.`] : []
91577
+ ...end < lines2.length || start > 0 ? [`Showing lines ${String(start + 1)}\u2013${String(Math.min(end, lines2.length))}. Use offset/limit for more.`] : []
91337
91578
  ];
91338
91579
  return { content: [...header2, "", ...slice].join("\n"), path: params3.path };
91339
91580
  }
@@ -91574,8 +91815,8 @@ var DatasetStore = class {
91574
91815
  return;
91575
91816
  await import_promises29.default.mkdir(import_node_path55.default.dirname(this.filePath), { recursive: true });
91576
91817
  await import_promises29.default.writeFile(this.filePath, "", { flag: "a" });
91577
- const lines = records.map((record2) => JSON.stringify(record2)).join("\n");
91578
- await import_promises29.default.appendFile(this.filePath, `${lines}
91818
+ const lines2 = records.map((record2) => JSON.stringify(record2)).join("\n");
91819
+ await import_promises29.default.appendFile(this.filePath, `${lines2}
91579
91820
  `, "utf8");
91580
91821
  }
91581
91822
  /** Rewrites with exactly these. Temp-and-rename, so an interrupted prune leaves the old file. */
@@ -92417,8 +92658,8 @@ function createS3ListTool(targets) {
92417
92658
  const found2 = await target.client.list(where, params3.limit ?? 100, context.signal);
92418
92659
  if (found2.length === 0)
92419
92660
  return { content: `No files under "${where === "" ? "/" : where}".` };
92420
- const lines = found2.map((object3) => `${displayKey(object3.key, target.prefix)} ${describeSize(object3.size)} ${object3.lastModified}`);
92421
- return { content: [`${String(found2.length)} file(s) in ${target.bucket}:`, ...lines].join("\n") };
92661
+ const lines2 = found2.map((object3) => `${displayKey(object3.key, target.prefix)} ${describeSize(object3.size)} ${object3.lastModified}`);
92662
+ return { content: [`${String(found2.length)} file(s) in ${target.bucket}:`, ...lines2].join("\n") };
92422
92663
  } catch (error51) {
92423
92664
  return failed(error51);
92424
92665
  }