@chosengeneration/light-code 0.144.0 → 0.146.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +740 -501
- package/dist/server.cjs +720 -481
- 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
|
|
1138
|
-
const len =
|
|
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 (
|
|
1141
|
+
if (lines2[i].length === 0) {
|
|
1142
1142
|
continue;
|
|
1143
1143
|
}
|
|
1144
|
-
if (
|
|
1144
|
+
if (lines2[i][0] === " " || lines2[i][0] === " ") {
|
|
1145
1145
|
if (h) {
|
|
1146
|
-
this.header[h][this.header[h].length - 1] +=
|
|
1146
|
+
this.header[h][this.header[h].length - 1] += lines2[i];
|
|
1147
1147
|
continue;
|
|
1148
1148
|
}
|
|
1149
1149
|
}
|
|
1150
|
-
const posColon =
|
|
1150
|
+
const posColon = lines2[i].indexOf(":");
|
|
1151
1151
|
if (posColon === -1 || posColon === 0) {
|
|
1152
1152
|
return;
|
|
1153
1153
|
}
|
|
1154
|
-
m = RE_HDR.exec(
|
|
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
|
|
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
|
-
|
|
26085
|
+
lines2.push(`\u2716 ${issue2.message}`);
|
|
26086
26086
|
if (issue2.path?.length)
|
|
26087
|
-
|
|
26087
|
+
lines2.push(` \u2192 at ${toDotPath(issue2.path)}`);
|
|
26088
26088
|
}
|
|
26089
|
-
return
|
|
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
|
|
26908
|
-
const minIndent = Math.min(...
|
|
26909
|
-
const dedented =
|
|
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
|
|
26919
|
-
return new F(...args,
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
43226
|
-
buffer =
|
|
43227
|
-
for (const line of
|
|
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
|
|
43434
|
-
buffer =
|
|
43435
|
-
for (const line of
|
|
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
|
|
43672
|
-
buffer =
|
|
43673
|
-
for (const line of
|
|
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
|
|
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
|
-
|
|
44788
|
+
lines2.push("", options.briefing);
|
|
44767
44789
|
}
|
|
44768
|
-
|
|
44790
|
+
lines2.push("", "---", "", options.question);
|
|
44769
44791
|
if (options.files !== void 0 && options.files.length > 0) {
|
|
44770
|
-
|
|
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
|
|
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
|
|
44812
|
+
const lines2 = (plan2 ?? "").split(/\r?\n/);
|
|
44791
44813
|
const items = [];
|
|
44792
|
-
|
|
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
|
-
|
|
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 ??
|
|
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(
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
45020
|
+
lines2.push("", options.skills);
|
|
44998
45021
|
}
|
|
44999
45022
|
if (options.pythonToolsDisabled === true) {
|
|
45000
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
45051
|
-
return
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
47429
|
+
const lines2 = [];
|
|
47405
47430
|
for (const document of documents) {
|
|
47406
|
-
|
|
47407
|
-
|
|
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", `${
|
|
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
|
|
49551
|
+
const lines2 = [];
|
|
49527
49552
|
if (parsed.subject !== void 0)
|
|
49528
|
-
|
|
49553
|
+
lines2.push(`Subject: ${parsed.subject}`);
|
|
49529
49554
|
if (parsed.from !== void 0)
|
|
49530
|
-
|
|
49555
|
+
lines2.push(`From: ${parsed.from}`);
|
|
49531
49556
|
if (parsed.to !== void 0)
|
|
49532
|
-
|
|
49557
|
+
lines2.push(`To: ${parsed.to}`);
|
|
49533
49558
|
if (parsed.cc !== void 0)
|
|
49534
|
-
|
|
49559
|
+
lines2.push(`Cc: ${parsed.cc}`);
|
|
49535
49560
|
if (parsed.bcc !== void 0)
|
|
49536
|
-
|
|
49561
|
+
lines2.push(`Bcc: ${parsed.bcc}`);
|
|
49537
49562
|
if (parsed.sent !== void 0)
|
|
49538
|
-
|
|
49563
|
+
lines2.push(`Sent: ${parsed.sent.toISOString()}`);
|
|
49539
49564
|
if (parsed.attachments.length > 0) {
|
|
49540
|
-
|
|
49565
|
+
lines2.push(`Attachments: ${parsed.attachments.map((each) => each.name).join(", ")}`);
|
|
49541
49566
|
}
|
|
49542
49567
|
if (parsed.bodyFromHtml) {
|
|
49543
|
-
|
|
49568
|
+
lines2.push("(no plain-text body in this message; the text below came from its HTML copy)");
|
|
49544
49569
|
}
|
|
49545
|
-
|
|
49546
|
-
return
|
|
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
|
|
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
|
-
|
|
50308
|
-
|
|
50309
|
-
|
|
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
|
-
|
|
50336
|
+
lines2.push(` VBA project reachable: ${instance.vbaAccessible ? "yes" : "no"}`);
|
|
50312
50337
|
}
|
|
50313
50338
|
}
|
|
50314
50339
|
return {
|
|
50315
|
-
content: [...
|
|
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
|
|
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
|
-
...
|
|
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
|
|
50658
|
+
const lines2 = [];
|
|
50634
50659
|
switch (params3.action) {
|
|
50635
50660
|
case "add":
|
|
50636
|
-
|
|
50661
|
+
lines2.push(`Add a sheet called "${params3.sheet ?? ""}" to ${which}.`);
|
|
50637
50662
|
break;
|
|
50638
50663
|
case "rename":
|
|
50639
|
-
|
|
50664
|
+
lines2.push(`Rename "${params3.sheet ?? ""}" to "${params3.newName ?? ""}" in ${which}.`);
|
|
50640
50665
|
break;
|
|
50641
50666
|
case "copy":
|
|
50642
|
-
|
|
50667
|
+
lines2.push(`Copy "${params3.sheet ?? ""}" in ${which}${params3.newName === void 0 ? "" : ` as "${params3.newName}"`}.`);
|
|
50643
50668
|
break;
|
|
50644
50669
|
case "move":
|
|
50645
|
-
|
|
50670
|
+
lines2.push(`Move "${params3.sheet ?? ""}" to position ${String(params3.position ?? 1)} in ${which}.`);
|
|
50646
50671
|
break;
|
|
50647
50672
|
case "delete":
|
|
50648
|
-
|
|
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
|
-
|
|
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
|
-
|
|
50688
|
+
lines2.push("", "Could not read what is on that sheet.");
|
|
50664
50689
|
}
|
|
50665
|
-
|
|
50690
|
+
lines2.push("", "Formulas elsewhere that reference this sheet will become #REF! and cannot be undone", "by renaming it back.");
|
|
50666
50691
|
}
|
|
50667
|
-
|
|
50668
|
-
return { kind: "text", text:
|
|
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
|
|
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
|
-
|
|
51085
|
-
|
|
51109
|
+
lines2.push(` ${scope.name}:`);
|
|
51110
|
+
lines2.push(...scope.variables.map(renderVariable));
|
|
51086
51111
|
}
|
|
51087
|
-
return
|
|
51112
|
+
return lines2.join("\n");
|
|
51088
51113
|
}
|
|
51089
51114
|
function renderDebugSnapshot(snapshot) {
|
|
51090
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
51122
|
+
lines2.push("", "Running \u2014 not currently paused. Set a breakpoint to inspect state at a point in time.");
|
|
51098
51123
|
}
|
|
51099
|
-
|
|
51100
|
-
return
|
|
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
|
|
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
|
-
...
|
|
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
|
|
51905
|
-
await import_promises6.default.appendFile(this.filePath, `${
|
|
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
|
|
52657
|
+
const lines2 = all.slice(-count3);
|
|
52633
52658
|
return {
|
|
52634
|
-
lines,
|
|
52635
|
-
hasMoreBefore: start > 0 || all.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
|
|
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 &&
|
|
52648
|
-
|
|
52672
|
+
if (lineNumber >= from && lines2.length < count3)
|
|
52673
|
+
lines2.push(line);
|
|
52649
52674
|
lineNumber += 1;
|
|
52650
|
-
return
|
|
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 +
|
|
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
|
|
52757
|
+
const lines2 = content.replace(/\r\n/g, "\n").split("\n");
|
|
52733
52758
|
const chunks = [];
|
|
52734
|
-
for (let start = 0; start <
|
|
52735
|
-
const window =
|
|
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 >=
|
|
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
|
|
58875
|
-
buffered =
|
|
58876
|
-
for (const line of
|
|
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
|
|
58985
|
+
const lines2 = ["The server answered 401 (not authorised). Worth checking, in order:"];
|
|
58961
58986
|
if (headers.length === 0) {
|
|
58962
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
58974
|
-
|
|
58975
|
-
return
|
|
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(
|
|
59740
|
+
function insertionLine(lines2) {
|
|
59716
59741
|
let index = 0;
|
|
59717
59742
|
const skipBlankAndComments = () => {
|
|
59718
|
-
while (index <
|
|
59743
|
+
while (index < lines2.length && /^\s*(#.*)?$/.test(lines2[index] ?? ""))
|
|
59719
59744
|
index += 1;
|
|
59720
59745
|
};
|
|
59721
59746
|
skipBlankAndComments();
|
|
59722
|
-
const docstring = /^[rRuU]?("""|''')/.exec(
|
|
59747
|
+
const docstring = /^[rRuU]?("""|''')/.exec(lines2[index] ?? "");
|
|
59723
59748
|
if (docstring !== null) {
|
|
59724
59749
|
const quote = docstring[1];
|
|
59725
|
-
const opening =
|
|
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 <
|
|
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(
|
|
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(
|
|
59763
|
+
while (/^from\s+__future__\s+import\b/.test(lines2[index] ?? ""))
|
|
59739
59764
|
index += 1;
|
|
59740
|
-
return Math.min(index,
|
|
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
|
|
59762
|
-
const at = insertionLine(
|
|
59763
|
-
const before =
|
|
59764
|
-
const after =
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
60341
|
+
lines2.push("", `WARNING: ${target.realPath} already exists and will be replaced.`);
|
|
60317
60342
|
}
|
|
60318
60343
|
} catch (error51) {
|
|
60319
|
-
|
|
60344
|
+
lines2.push("", `Could not inspect the source: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
60320
60345
|
}
|
|
60321
|
-
return { kind: "text", text:
|
|
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
|
|
62575
|
+
const lines2 = body.split(/\r?\n/).filter((line) => line.trim().length > 0);
|
|
62547
62576
|
try {
|
|
62548
|
-
const parsed =
|
|
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]:
|
|
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
|
|
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
|
|
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 <
|
|
63808
|
+
for (let index = 0; index < lines2.length; index += 1) {
|
|
63774
63809
|
regex.lastIndex = 0;
|
|
63775
|
-
if (regex.test(
|
|
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(
|
|
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 ===
|
|
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) ? ":" : "-"}${
|
|
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.
|
|
64905
|
-
"the standing instructions
|
|
64906
|
-
"this conversation
|
|
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
|
|
65174
|
+
const lines2 = [];
|
|
65087
65175
|
if (result.fetched.length > 0)
|
|
65088
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
65182
|
+
lines2.push(`Too large to copy: ${result.skipped.join(", ")}`);
|
|
65095
65183
|
if (result.ignored.length > 0)
|
|
65096
|
-
|
|
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
|
-
|
|
65099
|
-
if (
|
|
65100
|
-
|
|
65101
|
-
return
|
|
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
|
|
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
|
-
|
|
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:
|
|
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
|
|
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
|
-
|
|
65532
|
+
lines2.push(`${name}git add failed on the hub: ${gist(repo.add)}`);
|
|
65445
65533
|
} else if (!committed && !nothing) {
|
|
65446
65534
|
ok = false;
|
|
65447
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
65571
|
+
lines2.push(`Kept as they are here (changed on both sides): ${fetched.conflicts.slice(0, 10).join(", ")}.`);
|
|
65484
65572
|
}
|
|
65485
|
-
return { ok, text:
|
|
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
|
|
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
|
-
${
|
|
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
|
|
65624
|
-
for (let index = start; index < all.length &&
|
|
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
|
-
|
|
65717
|
+
lines2.push(line);
|
|
65630
65718
|
}
|
|
65631
|
-
const last = start +
|
|
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
|
-
${
|
|
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
|
|
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
|
-
|
|
65819
|
+
lines2.push("### The shell you are in", "");
|
|
65732
65820
|
for (const note of idioms.notes)
|
|
65733
|
-
|
|
65734
|
-
|
|
65821
|
+
lines2.push(`- ${note}`);
|
|
65822
|
+
lines2.push("");
|
|
65735
65823
|
}
|
|
65736
65824
|
if (present2.length > 0) {
|
|
65737
|
-
|
|
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
|
-
|
|
65743
|
-
return
|
|
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
|
|
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
|
-
|
|
66241
|
-
|
|
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
|
-
|
|
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
|
-
|
|
66333
|
+
lines2.push(` ${r}`);
|
|
66246
66334
|
if (p.replaceCount > p.replaces.length)
|
|
66247
|
-
|
|
66335
|
+
lines2.push(` \u2026 and ${String(p.replaceCount - p.replaces.length)} more`);
|
|
66248
66336
|
}
|
|
66249
66337
|
}
|
|
66250
|
-
|
|
66338
|
+
lines2.push("");
|
|
66251
66339
|
if (replacing > 0 && params3.overwrite !== true)
|
|
66252
|
-
|
|
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
|
-
|
|
66342
|
+
lines2.push("A move across drives copies everything, checks it, and only then removes the source.");
|
|
66255
66343
|
if (outside)
|
|
66256
|
-
|
|
66257
|
-
return
|
|
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
|
|
66413
|
-
return { content: `${
|
|
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
|
|
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
|
-
|
|
66594
|
+
lines3.push("", "First lines:", ...answer.firstLines.map((l) => ` ${l}`));
|
|
66507
66595
|
if (table !== void 0)
|
|
66508
|
-
|
|
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
|
-
|
|
66511
|
-
return { content:
|
|
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
|
|
66608
|
+
const lines2 = answer.lines ?? [];
|
|
66521
66609
|
if (params3.action === "tail")
|
|
66522
|
-
return { content:
|
|
66610
|
+
return { content: lines2.join("\n"), path: params3.path };
|
|
66523
66611
|
const start = answer.startLine ?? 1;
|
|
66524
66612
|
return {
|
|
66525
|
-
content: `${
|
|
66526
|
-
\u2026 continue with fromLine ${String(start +
|
|
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
|
|
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
|
-
|
|
66737
|
-
return { kind: "text", text:
|
|
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
|
|
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
|
-
|
|
66915
|
+
lines2.push("", "Arguments:");
|
|
66828
66916
|
calls.slice(0, 25).forEach((call, index) => {
|
|
66829
|
-
|
|
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
|
-
|
|
66920
|
+
lines2.push(` ... and ${String(calls.length - 25)} more`);
|
|
66833
66921
|
}
|
|
66834
|
-
return { kind: "text", text:
|
|
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
|
|
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
|
-
|
|
67068
|
+
lines2.push(`- **${family.label}** (${family.about}): ${members.join(", ")}`);
|
|
66981
67069
|
}
|
|
66982
|
-
if (
|
|
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
|
-
...
|
|
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
|
|
67214
|
+
const lines2 = [`HTTP ${String(response.status)} from ${url2}`];
|
|
67127
67215
|
if (trail.length > 0)
|
|
67128
|
-
|
|
67216
|
+
lines2.push(...trail);
|
|
67129
67217
|
for (const [name, value] of Object.entries(response.headers))
|
|
67130
67218
|
if (keep.includes(name.toLowerCase()))
|
|
67131
|
-
|
|
67132
|
-
|
|
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
|
-
|
|
67136
|
-
return
|
|
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
|
-
|
|
67142
|
-
return
|
|
67229
|
+
lines2.push(JSON.stringify(JSON.parse(text), null, 2));
|
|
67230
|
+
return lines2.join("\n");
|
|
67143
67231
|
} catch {
|
|
67144
67232
|
}
|
|
67145
67233
|
}
|
|
67146
|
-
|
|
67147
|
-
return
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
67265
|
+
lines2.push(`On 202 Accepted: keep polling for up to ${String(params3.maxWaitSec ?? 120)}s.`);
|
|
67178
67266
|
if (body !== void 0)
|
|
67179
|
-
|
|
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
|
-
|
|
67183
|
-
return { kind: "text", text:
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
70644
|
+
const lines2 = [];
|
|
70557
70645
|
if (directed.addressed.length > 0) {
|
|
70558
70646
|
const names = directed.addressed.map((role) => `\`${role}\``).join(", ");
|
|
70559
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
71166
|
+
lines2.push(current);
|
|
71079
71167
|
current = word;
|
|
71080
71168
|
}
|
|
71081
71169
|
while (current.length > limit) {
|
|
71082
|
-
|
|
71170
|
+
lines2.push(current.slice(0, limit));
|
|
71083
71171
|
current = current.slice(limit);
|
|
71084
71172
|
}
|
|
71085
71173
|
}
|
|
71086
71174
|
if (current.length > 0)
|
|
71087
|
-
|
|
71088
|
-
return
|
|
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
|
|
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 =
|
|
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
|
|
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
|
-
|
|
72059
|
+
lines2.push(line.text ?? "");
|
|
71972
72060
|
if (body.isLastPage !== false || body.nextPageStart === void 0 || body.nextPageStart <= start)
|
|
71973
|
-
return
|
|
72061
|
+
return lines2.join("\n");
|
|
71974
72062
|
start = body.nextPageStart;
|
|
71975
72063
|
}
|
|
71976
|
-
return `${
|
|
71977
|
-
[... stopped after ${String(
|
|
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
|
|
72499
|
-
partial2 =
|
|
72500
|
-
for (const line of
|
|
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
|
|
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
|
-
|
|
73161
|
+
lines2.push(`${indent}${key2}:`, ...renderDefinition(value, `${indent} `));
|
|
73074
73162
|
} else {
|
|
73075
|
-
|
|
73163
|
+
lines2.push(`${indent}${key2}: ${Array.isArray(value) ? value.map(String).join(", ") : String(value)}`);
|
|
73076
73164
|
}
|
|
73077
73165
|
}
|
|
73078
|
-
return
|
|
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
|
|
73422
|
+
const lines2 = renderDefinition(pick4(definition)).map((line) => ` ${line}`);
|
|
73335
73423
|
sections.push([
|
|
73336
73424
|
shownNames.length === 1 ? `Definition of ${name}:` : `${name}:`,
|
|
73337
|
-
...
|
|
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
|
|
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
|
-
|
|
73557
|
+
lines2.forEach((line, index) => {
|
|
73470
73558
|
if (pattern.test(line))
|
|
73471
|
-
for (let at = Math.max(0, index - 3); at <= Math.min(
|
|
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)}: ${
|
|
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 =
|
|
73481
|
-
return { content: `${type} of ${params3.job}${params3.runNum !== void 0 ? ` run ${params3.runNum}` : ""} (${String(
|
|
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
|
|
73740
|
+
const lines2 = [];
|
|
73653
73741
|
if (direction !== "downstream") {
|
|
73654
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
73774
|
+
lines2.push(`${indent}condition: ${condition}`);
|
|
73687
73775
|
for (const reference of parseConditions(condition)) {
|
|
73688
73776
|
if (reference.instance !== void 0) {
|
|
73689
|
-
|
|
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
|
-
|
|
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 (
|
|
73703
|
-
|
|
73704
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
|
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
|
-
|
|
74278
|
+
lines2.push("", `There is no issue type "${params3.issueType}" in ${project.key}.`);
|
|
74191
74279
|
} else {
|
|
74192
|
-
|
|
74193
|
-
|
|
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:
|
|
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
|
|
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
|
-
${
|
|
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
|
|
74707
|
+
const lines2 = source.replace(/\r\n/g, "\n").split("\n");
|
|
74620
74708
|
const blocks = [];
|
|
74621
74709
|
let index = 0;
|
|
74622
|
-
while (index <
|
|
74623
|
-
const line =
|
|
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 <
|
|
74630
|
-
const candidate =
|
|
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 =
|
|
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 <
|
|
74678
|
-
const candidate =
|
|
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 <
|
|
74690
|
-
const match = QUOTE.exec(
|
|
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 <
|
|
74703
|
-
const current =
|
|
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 <
|
|
74715
|
-
const current =
|
|
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(
|
|
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
|
|
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
|
-
|
|
75267
|
+
lines2.push(`${label}: ${list.join(", ")}`);
|
|
75180
75268
|
}
|
|
75181
75269
|
if (params3.to === void 0 || params3.to.length === 0) {
|
|
75182
|
-
|
|
75270
|
+
lines2.push("To: (nobody \u2014 you will fill this in)");
|
|
75183
75271
|
}
|
|
75184
|
-
|
|
75272
|
+
lines2.push(`Subject: ${params3.subject ?? "(none)"}`);
|
|
75185
75273
|
const files = filesIn(params3);
|
|
75186
75274
|
if (files.length > 0) {
|
|
75187
|
-
|
|
75188
|
-
|
|
75275
|
+
lines2.push("");
|
|
75276
|
+
lines2.push("Files from this machine, put into the message:");
|
|
75189
75277
|
for (const file2 of files) {
|
|
75190
|
-
|
|
75278
|
+
lines2.push(` ${file2.path}${file2.inline ? " (shown inside the message)" : ""}`);
|
|
75191
75279
|
}
|
|
75192
75280
|
}
|
|
75193
75281
|
const body = params3.body ?? "";
|
|
75194
|
-
|
|
75195
|
-
|
|
75196
|
-
|
|
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:
|
|
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
|
|
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
|
-
|
|
75326
|
+
lines2.push(`Attached: ${result.attached.join(", ")}.`);
|
|
75239
75327
|
if (result.inline.length > 0)
|
|
75240
|
-
|
|
75328
|
+
lines2.push(`Embedded in the body: ${result.inline.join(", ")}.`);
|
|
75241
75329
|
if (result.missing.length > 0) {
|
|
75242
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
|
75294
|
-
if (!
|
|
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
|
-
|
|
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 =
|
|
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 && !
|
|
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
|
|
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
|
-
|
|
75430
|
-
|
|
75431
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
|
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
|
-
|
|
75587
|
+
lines2.push("Excel is still calculating; values may change for a moment yet.");
|
|
75500
75588
|
if (result.cells.length > 0) {
|
|
75501
|
-
|
|
75589
|
+
lines2.push("", "Cells now show:", ...result.cells.map((cell) => `${cell.address}: ${cell.text.length > 0 ? cell.text : "(empty)"}`));
|
|
75502
75590
|
}
|
|
75503
|
-
return { content:
|
|
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
|
|
75621
|
+
const lines2 = module2.code.split(/\r?\n/);
|
|
75534
75622
|
const quoted = params3.aroundLine === void 0 ? [] : [
|
|
75535
75623
|
`Line ${String(params3.aroundLine)} reads:`,
|
|
75536
|
-
` ${
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
77473
|
+
lines2.push("", "## Needs attention");
|
|
77386
77474
|
for (const problem of d.problems)
|
|
77387
|
-
|
|
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
|
-
|
|
77391
|
-
|
|
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
|
|
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();
|
|
@@ -79686,6 +79778,17 @@ ${preview.text}` } : {}
|
|
|
79686
79778
|
let installedAddons = [];
|
|
79687
79779
|
let addonProblems = [];
|
|
79688
79780
|
const addonRoot = services.codebaseDir ?? storageDir;
|
|
79781
|
+
let mcpStartProblem;
|
|
79782
|
+
function describeFailure2(error51, stack = false) {
|
|
79783
|
+
if (!(error51 instanceof Error))
|
|
79784
|
+
return String(error51);
|
|
79785
|
+
const code = error51.code;
|
|
79786
|
+
const head = `${error51.message}${typeof code === "string" && !error51.message.includes(code) ? ` (${code})` : ""}`;
|
|
79787
|
+
if (!stack || error51.stack === void 0)
|
|
79788
|
+
return head;
|
|
79789
|
+
return `${head}
|
|
79790
|
+
${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
79791
|
+
}
|
|
79689
79792
|
function readUserNpmrc() {
|
|
79690
79793
|
try {
|
|
79691
79794
|
return (0, import_node_fs11.readFileSync)(process.env["NPM_CONFIG_USERCONFIG"] ?? import_node_path50.default.join(import_node_os6.default.homedir(), ".npmrc"), "utf8");
|
|
@@ -79712,17 +79815,17 @@ ${preview.text}` } : {}
|
|
|
79712
79815
|
if (addon.page === void 0)
|
|
79713
79816
|
continue;
|
|
79714
79817
|
const settings = config2.addons?.settings?.[addon.package];
|
|
79715
|
-
const stored = /* @__PURE__ */ new Set();
|
|
79716
|
-
for (const ref of possibleSecretRefs(addon, settings))
|
|
79717
|
-
if (await secrets.get(ref) !== void 0)
|
|
79718
|
-
stored.add(ref);
|
|
79719
|
-
const delivery = deliveryFor(addonRoot, addon, settings, stored);
|
|
79720
79818
|
try {
|
|
79819
|
+
const stored = /* @__PURE__ */ new Set();
|
|
79820
|
+
for (const ref of possibleSecretRefs(addon, settings))
|
|
79821
|
+
if (await secrets.get(ref) !== void 0)
|
|
79822
|
+
stored.add(ref);
|
|
79823
|
+
const delivery = deliveryFor(addonRoot, addon, settings, stored);
|
|
79721
79824
|
await writeFileAtomically(delivery.file, JSON.stringify(delivery.contents, null, 2));
|
|
79722
79825
|
await import_promises27.default.mkdir(addonDownloadsDir(addonRoot, addon), { recursive: true });
|
|
79723
79826
|
delivered.set(addon.package, delivery.env);
|
|
79724
79827
|
} catch (error51) {
|
|
79725
|
-
logger.warn(`Could not
|
|
79828
|
+
logger.warn(`Could not prepare the settings for add-on ${addon.package}: ${describeFailure2(error51)}`);
|
|
79726
79829
|
}
|
|
79727
79830
|
}
|
|
79728
79831
|
await mcp.configure(runnableServers(servers, installedAddons, { execPath: process.execPath, electron: process.versions["electron"] !== void 0 }, workspaceMcpServers, (addon) => delivered.get(addon.package) ?? {}));
|
|
@@ -79918,7 +80021,10 @@ ${preview.text}` } : {}
|
|
|
79918
80021
|
})),
|
|
79919
80022
|
folders: folders.configured,
|
|
79920
80023
|
defaultFolders: folders.defaults,
|
|
79921
|
-
|
|
80024
|
+
.../* @__PURE__ */ (() => {
|
|
80025
|
+
const shown2 = error51 ?? mcpStartProblem;
|
|
80026
|
+
return shown2 !== void 0 ? { error: shown2 } : {};
|
|
80027
|
+
})()
|
|
79922
80028
|
});
|
|
79923
80029
|
}
|
|
79924
80030
|
async function handleEnableAddon(pkg) {
|
|
@@ -79939,10 +80045,23 @@ ${preview.text}` } : {}
|
|
|
79939
80045
|
const next = { ...servers, [addon.server]: addonServerEntry(addon, existing) };
|
|
79940
80046
|
await configManager.save("user", { mcpServers: next });
|
|
79941
80047
|
setMcpServersState(next);
|
|
79942
|
-
|
|
79943
|
-
|
|
79944
|
-
|
|
79945
|
-
|
|
80048
|
+
mcpStartProblem = void 0;
|
|
80049
|
+
try {
|
|
80050
|
+
await configureMcp(next);
|
|
80051
|
+
postMcp();
|
|
80052
|
+
await postAddons();
|
|
80053
|
+
await mcp.ensureConnected();
|
|
80054
|
+
} catch (error51) {
|
|
80055
|
+
logger.warn(`Starting add-on ${addon.package} failed: ${describeFailure2(error51, true)}`);
|
|
80056
|
+
postMcp();
|
|
80057
|
+
await postAddons(`${addon.displayName} is enabled, but starting it failed: ${describeFailure2(error51)}. To retry, press Disable and then Enable.`);
|
|
80058
|
+
return;
|
|
80059
|
+
}
|
|
80060
|
+
const started = mcp.states_().find((server) => server.name === addon.server);
|
|
80061
|
+
if (started?.status === "failed") {
|
|
80062
|
+
const said = started.logs.filter((line) => !/^(Starting |Failed: )/.test(line)).slice(-3).join(" | ");
|
|
80063
|
+
await postAddons(`${addon.displayName} was enabled but could not start: ${started.error ?? "no reason given"}${said.length > 0 ? ` - it said: ${said}` : ""}. Its full log is under Log on its row below.`);
|
|
80064
|
+
}
|
|
79946
80065
|
}
|
|
79947
80066
|
async function handleRemoveAddon(server) {
|
|
79948
80067
|
const { config: config2 } = await configManager.load();
|
|
@@ -80255,10 +80374,14 @@ ${preview.text}` } : {}
|
|
|
80255
80374
|
* the *other* skills are listed or searched for; it does not get to withhold a standing
|
|
80256
80375
|
* instruction, which by definition has to be present before the model decides anything.
|
|
80257
80376
|
*/
|
|
80258
|
-
skills:
|
|
80259
|
-
|
|
80260
|
-
|
|
80261
|
-
|
|
80377
|
+
skills: [
|
|
80378
|
+
skillsSearchable ? [
|
|
80379
|
+
renderAlwaysSkills(turnSkills),
|
|
80380
|
+
renderSkillsHintForPrompt(skills.filter((skill) => skill.always !== true).length)
|
|
80381
|
+
].filter((section) => section.length > 0).join("\n\n") : renderSkillsForPrompt(turnSkills),
|
|
80382
|
+
// The user's answers to skills' placeholders, so a skill does not stop to ask (`skills/defaults.ts`).
|
|
80383
|
+
renderSkillDefaults(config2.skillDefaults, turnSkills.map((skill) => skill.name))
|
|
80384
|
+
].filter((section) => section.length > 0).join("\n\n"),
|
|
80262
80385
|
skillsSearchable,
|
|
80263
80386
|
canWriteSkills: skillsDir !== void 0,
|
|
80264
80387
|
codebaseInstructions,
|
|
@@ -80392,6 +80515,12 @@ ${preview.text}` } : {}
|
|
|
80392
80515
|
// Also withheld from a scheduled run: nobody is there to fill a form in, and a job
|
|
80393
80516
|
// that stops to wait for one would never finish.
|
|
80394
80517
|
...schedule === void 0 ? { requestForm } : {},
|
|
80518
|
+
// A skill read with the user's defaults for its placeholders carries them (`skills/defaults.ts`).
|
|
80519
|
+
annotateRead: (realPath) => {
|
|
80520
|
+
const fold = (value) => process.platform === "win32" ? import_node_path50.default.resolve(value).toLowerCase() : import_node_path50.default.resolve(value);
|
|
80521
|
+
const skill = skills.find((each) => fold(each.filePath) === fold(realPath));
|
|
80522
|
+
return skill === void 0 ? void 0 : skillDefaultsReadNote(skill.name, config2.skillDefaults?.[skill.name]);
|
|
80523
|
+
},
|
|
80395
80524
|
// So `wait` ends the moment the user types or reacts, rather than after its full time.
|
|
80396
80525
|
hasNewUserInput: () => queuedMessages.length > 0 || pendingReactions.size > 0,
|
|
80397
80526
|
// What the user has said, for `http_request`'s host rule. Not the images a tool returned (labelled
|
|
@@ -82392,6 +82521,13 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82392
82521
|
const gatewayAuth = await autosysGatewayAuth(config2, tls3);
|
|
82393
82522
|
if (auth2.sendBasic !== true)
|
|
82394
82523
|
return gatewayAuth;
|
|
82524
|
+
if (auth2.basicHeaderValueRef !== void 0) {
|
|
82525
|
+
const value = (await secrets.get(auth2.basicHeaderValueRef))?.trim() ?? "";
|
|
82526
|
+
if (value.length === 0) {
|
|
82527
|
+
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.");
|
|
82528
|
+
}
|
|
82529
|
+
return withHeader(gatewayAuth, auth2.basicHeaderName ?? "Authorization", value);
|
|
82530
|
+
}
|
|
82395
82531
|
const username2 = config2.autosys?.username?.trim() ?? "";
|
|
82396
82532
|
const password = config2.autosys?.tokenRef !== void 0 ? await secrets.get(config2.autosys.tokenRef) : void 0;
|
|
82397
82533
|
if (username2.length === 0 || password === void 0 || password.length === 0) {
|
|
@@ -82470,7 +82606,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82470
82606
|
},
|
|
82471
82607
|
hasToken,
|
|
82472
82608
|
...info.id === "autosys" ? {
|
|
82473
|
-
gateway: gatewayView(config2.autosys?.auth, (await secrets.get(AUTOSYS_CLIENT_SECRET_REF) ?? "").length > 0, (await secrets.get(AUTOSYS_PASSPHRASE_REF) ?? "").length > 0)
|
|
82609
|
+
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)
|
|
82474
82610
|
} : {}
|
|
82475
82611
|
};
|
|
82476
82612
|
}
|
|
@@ -82521,7 +82657,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82521
82657
|
}
|
|
82522
82658
|
});
|
|
82523
82659
|
if (product === "autosys" && gateway !== void 0) {
|
|
82524
|
-
const problem = await saveAutosysGateway(gateway.settings, gateway.clientSecret, gateway.passphrase);
|
|
82660
|
+
const problem = await saveAutosysGateway(gateway.settings, gateway.clientSecret, gateway.passphrase, gateway.basicValue);
|
|
82525
82661
|
if (problem !== void 0) {
|
|
82526
82662
|
await loadSettings();
|
|
82527
82663
|
await postAtlassian();
|
|
@@ -82536,14 +82672,17 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82536
82672
|
refuse(error51 instanceof Error ? error51.message : String(error51));
|
|
82537
82673
|
}
|
|
82538
82674
|
}
|
|
82539
|
-
async function saveAutosysGateway(input, clientSecret, passphrase) {
|
|
82675
|
+
async function saveAutosysGateway(input, clientSecret, passphrase, basicValue) {
|
|
82540
82676
|
if (clientSecret !== void 0 && clientSecret.trim().length > 0)
|
|
82541
82677
|
await secrets.set(AUTOSYS_CLIENT_SECRET_REF, clientSecret.trim());
|
|
82542
82678
|
if (passphrase !== void 0 && passphrase.length > 0)
|
|
82543
82679
|
await secrets.set(AUTOSYS_PASSPHRASE_REF, passphrase);
|
|
82680
|
+
if (basicValue !== void 0 && basicValue.trim().length > 0)
|
|
82681
|
+
await secrets.set(AUTOSYS_BASIC_VALUE_REF, basicValue.trim());
|
|
82544
82682
|
const result = gatewayFromSettings(input, {
|
|
82545
82683
|
clientSecret: (await secrets.get(AUTOSYS_CLIENT_SECRET_REF) ?? "").length > 0,
|
|
82546
|
-
passphrase: (await secrets.get(AUTOSYS_PASSPHRASE_REF) ?? "").length > 0
|
|
82684
|
+
passphrase: (await secrets.get(AUTOSYS_PASSPHRASE_REF) ?? "").length > 0,
|
|
82685
|
+
basicValue: (await secrets.get(AUTOSYS_BASIC_VALUE_REF) ?? "").length > 0
|
|
82547
82686
|
});
|
|
82548
82687
|
if ("error" in result)
|
|
82549
82688
|
return result.error;
|
|
@@ -82552,9 +82691,9 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82552
82691
|
autosysGateway = void 0;
|
|
82553
82692
|
return void 0;
|
|
82554
82693
|
}
|
|
82555
|
-
async function handleSaveAutosysGateway(input, clientSecret, passphrase) {
|
|
82694
|
+
async function handleSaveAutosysGateway(input, clientSecret, passphrase, basicValue) {
|
|
82556
82695
|
try {
|
|
82557
|
-
const problem = await saveAutosysGateway(input, clientSecret, passphrase);
|
|
82696
|
+
const problem = await saveAutosysGateway(input, clientSecret, passphrase, basicValue);
|
|
82558
82697
|
await loadSettings();
|
|
82559
82698
|
await postAtlassian();
|
|
82560
82699
|
if (problem !== void 0)
|
|
@@ -82566,11 +82705,11 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82566
82705
|
}
|
|
82567
82706
|
}
|
|
82568
82707
|
async function handleClearAutosysGatewaySecret(which) {
|
|
82569
|
-
await secrets.delete(which === "clientSecret" ? AUTOSYS_CLIENT_SECRET_REF : AUTOSYS_PASSPHRASE_REF);
|
|
82708
|
+
await secrets.delete(which === "clientSecret" ? AUTOSYS_CLIENT_SECRET_REF : which === "passphrase" ? AUTOSYS_PASSPHRASE_REF : AUTOSYS_BASIC_VALUE_REF);
|
|
82570
82709
|
const { config: config2 } = await configManager.load();
|
|
82571
82710
|
const auth2 = config2.autosys?.auth;
|
|
82572
82711
|
if (auth2 !== void 0) {
|
|
82573
|
-
const { [which === "clientSecret" ? "clientSecretRef" : "passphraseRef"]: _dropped, ...rest } = auth2;
|
|
82712
|
+
const { [which === "clientSecret" ? "clientSecretRef" : which === "passphrase" ? "passphraseRef" : "basicHeaderValueRef"]: _dropped, ...rest } = auth2;
|
|
82574
82713
|
void _dropped;
|
|
82575
82714
|
const next = which === "clientSecret" ? { ...rest, type: "basic" } : rest;
|
|
82576
82715
|
await configManager.save("user", { autosys: { ...config2.autosys ?? {}, auth: next } });
|
|
@@ -82772,12 +82911,12 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82772
82911
|
await postS3();
|
|
82773
82912
|
return;
|
|
82774
82913
|
}
|
|
82775
|
-
const
|
|
82914
|
+
const lines2 = [];
|
|
82776
82915
|
for (const mirror of mirrors) {
|
|
82777
82916
|
const target = targetById(cachedS3, mirror.connectionId);
|
|
82778
82917
|
const where = `${mirror.connectionId}/${mirror.prefix ?? ""}`;
|
|
82779
82918
|
if (target === void 0) {
|
|
82780
|
-
|
|
82919
|
+
lines2.push(`${where}: connection unusable - check its key above`);
|
|
82781
82920
|
continue;
|
|
82782
82921
|
}
|
|
82783
82922
|
const localDir = mirrorFolder({
|
|
@@ -82802,15 +82941,15 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82802
82941
|
parts.push(`${String(result.failed.length)} failed`);
|
|
82803
82942
|
if (result.truncated)
|
|
82804
82943
|
parts.push("more than the per-sync limit exist \u2014 not all were brought down");
|
|
82805
|
-
|
|
82944
|
+
lines2.push(`${target.label}${mirror.prefix === void 0 ? "" : `/${mirror.prefix}`}: ${parts.join(", ")}`);
|
|
82806
82945
|
for (const failure of result.failed) {
|
|
82807
82946
|
logger.warn(`s3 ${kind}: ${failure.key}`, failure.problem);
|
|
82808
82947
|
}
|
|
82809
82948
|
} catch (error51) {
|
|
82810
|
-
|
|
82949
|
+
lines2.push(`${target.label}: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
82811
82950
|
}
|
|
82812
82951
|
}
|
|
82813
|
-
lastSync = { ...lastSync, [kind]: `${(/* @__PURE__ */ new Date()).toLocaleTimeString()} - ${
|
|
82952
|
+
lastSync = { ...lastSync, [kind]: `${(/* @__PURE__ */ new Date()).toLocaleTimeString()} - ${lines2.join("; ")}` };
|
|
82814
82953
|
if (kind === "skills") {
|
|
82815
82954
|
await refreshSkills();
|
|
82816
82955
|
postSkills();
|
|
@@ -82915,8 +83054,32 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82915
83054
|
}
|
|
82916
83055
|
return "Could not build the embedding model. Check the embedder settings in Settings \u2192 Search.";
|
|
82917
83056
|
}
|
|
82918
|
-
|
|
83057
|
+
function cleanSkillNames(names) {
|
|
83058
|
+
return [...new Set(names.map((name) => name.trim()).filter((name) => name.length > 0))].sort();
|
|
83059
|
+
}
|
|
83060
|
+
async function saveKeepPrivate(names) {
|
|
83061
|
+
const { config: config2 } = await configManager.load();
|
|
83062
|
+
await configManager.save("user", { teamSkills: { ...config2.teamSkills ?? {}, keepPrivate: cleanSkillNames(names) } });
|
|
83063
|
+
}
|
|
83064
|
+
async function handleSaveSkillDefaults(skill, values) {
|
|
83065
|
+
const name = skill.trim();
|
|
83066
|
+
if (name.length === 0)
|
|
83067
|
+
return;
|
|
83068
|
+
const { config: config2 } = await configManager.load();
|
|
83069
|
+
const next = { ...config2.skillDefaults ?? {} };
|
|
83070
|
+
const cleaned = cleanSkillDefaults(values);
|
|
83071
|
+
if (Object.keys(cleaned).length === 0)
|
|
83072
|
+
delete next[name];
|
|
83073
|
+
else
|
|
83074
|
+
next[name] = cleaned;
|
|
83075
|
+
await configManager.save("user", { skillDefaults: next });
|
|
83076
|
+
await postSkills();
|
|
83077
|
+
}
|
|
83078
|
+
async function handlePublishTeamSkills(keepPrivateNow) {
|
|
83079
|
+
if (keepPrivateNow !== void 0)
|
|
83080
|
+
await saveKeepPrivate(keepPrivateNow);
|
|
82919
83081
|
const config2 = await loadSettings();
|
|
83082
|
+
const keepPrivate = new Set(config2.teamSkills?.keepPrivate ?? []);
|
|
82920
83083
|
const collection = skillsIndexName(config2);
|
|
82921
83084
|
const search = await resolveSearch(config2);
|
|
82922
83085
|
const embedder = await resolveEmbedder(config2);
|
|
@@ -82928,10 +83091,11 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82928
83091
|
return;
|
|
82929
83092
|
}
|
|
82930
83093
|
const signal = beginIndexing("teamSkills");
|
|
82931
|
-
|
|
83094
|
+
const sending = skills.filter((skill) => !keepPrivate.has(skill.name));
|
|
83095
|
+
reportIndexing("teamSkills", "Reading skills", { detail: `${String(sending.length)} skill(s)` });
|
|
82932
83096
|
try {
|
|
82933
83097
|
const withBodies = [];
|
|
82934
|
-
for (const skill of
|
|
83098
|
+
for (const skill of sending) {
|
|
82935
83099
|
let body = "";
|
|
82936
83100
|
try {
|
|
82937
83101
|
body = await import_promises27.default.readFile(skill.filePath, "utf8");
|
|
@@ -82942,8 +83106,9 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82942
83106
|
}
|
|
82943
83107
|
const owner = indexOwner(config2);
|
|
82944
83108
|
const project = indexProject(config2);
|
|
83109
|
+
const writer = createVectorIndexWriter(httpClient, search.store, await vectorStoreConnectionFor(search.store, search.id));
|
|
82945
83110
|
const count3 = await indexTeamSkills({
|
|
82946
|
-
writer
|
|
83111
|
+
writer,
|
|
82947
83112
|
embedder,
|
|
82948
83113
|
collection,
|
|
82949
83114
|
aliases: skillAliases(config2),
|
|
@@ -82955,9 +83120,18 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
82955
83120
|
...project !== void 0 ? { project } : {}
|
|
82956
83121
|
}
|
|
82957
83122
|
});
|
|
82958
|
-
|
|
83123
|
+
let withdrawn = 0;
|
|
83124
|
+
if (keepPrivate.size > 0) {
|
|
83125
|
+
const present2 = new Set(await writer.listPaths(collection, { signal }));
|
|
83126
|
+
const paths = [...keepPrivate].map((name) => teamSkillPath({ name })).filter((each) => present2.has(each));
|
|
83127
|
+
if (paths.length > 0) {
|
|
83128
|
+
await deleteInBatches(writer, collection, paths, (done, total) => reportIndexing("teamSkills", "Taking back private skills", { done, total }), signal);
|
|
83129
|
+
withdrawn = paths.length;
|
|
83130
|
+
}
|
|
83131
|
+
}
|
|
83132
|
+
post({ type: "teamSkillsPublished", count: count3, collection, ...withdrawn > 0 ? { withdrawn } : {} });
|
|
82959
83133
|
reportIndexing("teamSkills", "Finished", {
|
|
82960
|
-
detail: `Sent ${String(count3)} skill(s).`,
|
|
83134
|
+
detail: `Sent ${String(count3)} skill(s)${withdrawn > 0 ? `, took back ${String(withdrawn)} kept private` : ""}.`,
|
|
82961
83135
|
running: false
|
|
82962
83136
|
});
|
|
82963
83137
|
} catch (error51) {
|
|
@@ -83026,8 +83200,11 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83026
83200
|
stored.set(document.path, document.text);
|
|
83027
83201
|
cursor = page.next;
|
|
83028
83202
|
} while (cursor !== void 0);
|
|
83203
|
+
const keepPrivate = new Set(config2.teamSkills?.keepPrivate ?? []);
|
|
83029
83204
|
const entries = await Promise.all(skills.map(async (skill) => {
|
|
83030
83205
|
const sent = stored.get(teamSkillPath(skill));
|
|
83206
|
+
if (keepPrivate.has(skill.name))
|
|
83207
|
+
return { name: skill.name, state: sent === void 0 ? "private" : "withdraw" };
|
|
83031
83208
|
if (sent === void 0)
|
|
83032
83209
|
return { name: skill.name, state: "missing" };
|
|
83033
83210
|
let body;
|
|
@@ -83298,20 +83475,20 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83298
83475
|
return;
|
|
83299
83476
|
}
|
|
83300
83477
|
const { options } = resolved;
|
|
83301
|
-
const
|
|
83478
|
+
const lines2 = [
|
|
83302
83479
|
`This machine searches ${options.collections.join(" \u2192 ")}` + (options.owner !== void 0 ? `, as ${options.owner}.` : ".")
|
|
83303
83480
|
];
|
|
83304
83481
|
for (const alias of options.collections) {
|
|
83305
83482
|
try {
|
|
83306
83483
|
const found2 = await searchTeamSkills({ ...options, collections: [alias] }, query, 10);
|
|
83307
83484
|
if (found2.hits.length === 0) {
|
|
83308
|
-
|
|
83485
|
+
lines2.push(`- ${alias}: answers, but nobody has published under this name yet.`);
|
|
83309
83486
|
continue;
|
|
83310
83487
|
}
|
|
83311
83488
|
const owners = [...new Set(found2.hits.map((hit) => hit.isMine ? "you" : hit.owner ?? "unknown owner"))];
|
|
83312
|
-
|
|
83489
|
+
lines2.push(`- ${alias}: ${String(found2.hits.length)} nearest skill(s), from ${owners.join(", ")}.`);
|
|
83313
83490
|
} catch (error51) {
|
|
83314
|
-
|
|
83491
|
+
lines2.push(`- ${alias}: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
83315
83492
|
}
|
|
83316
83493
|
}
|
|
83317
83494
|
const tool2 = createSearchTeamSkillsTool({ ...options, observer: searchLog });
|
|
@@ -83320,7 +83497,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83320
83497
|
type: "searchProbe",
|
|
83321
83498
|
target,
|
|
83322
83499
|
query,
|
|
83323
|
-
text: [...
|
|
83500
|
+
text: [...lines2, "", "What the assistant gets:", "", result2.content].join("\n"),
|
|
83324
83501
|
...result2.isError === true ? { error: "The search failed." } : {}
|
|
83325
83502
|
});
|
|
83326
83503
|
return;
|
|
@@ -85821,6 +85998,20 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85821
85998
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
85822
85999
|
}
|
|
85823
86000
|
}
|
|
86001
|
+
function reportAddonFailure(operation, work, pkg) {
|
|
86002
|
+
work.catch(async (error51) => {
|
|
86003
|
+
logger.warn(`${operation} failed: ${describeFailure2(error51, true)}`);
|
|
86004
|
+
const said = `${operation} failed: ${describeFailure2(error51)}`;
|
|
86005
|
+
try {
|
|
86006
|
+
if (pkg !== void 0)
|
|
86007
|
+
await postAddonPage(pkg, { error: said });
|
|
86008
|
+
else
|
|
86009
|
+
await postAddons(said);
|
|
86010
|
+
} catch {
|
|
86011
|
+
post({ type: "error", message: said });
|
|
86012
|
+
}
|
|
86013
|
+
});
|
|
86014
|
+
}
|
|
85824
86015
|
function reportFailure(operation, work) {
|
|
85825
86016
|
work.catch((error51) => {
|
|
85826
86017
|
const reason = error51 instanceof Error ? error51.message : String(error51);
|
|
@@ -86076,21 +86267,21 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86076
86267
|
} else if (message4.type === "requestAddonPage") {
|
|
86077
86268
|
reportFailure("postAddonPage", postAddonPage(message4.package));
|
|
86078
86269
|
} else if (message4.type === "saveAddonRecord") {
|
|
86079
|
-
|
|
86270
|
+
reportAddonFailure("Saving", handleSaveAddonRecord(message4), message4.package);
|
|
86080
86271
|
} else if (message4.type === "deleteAddonRecord") {
|
|
86081
|
-
|
|
86272
|
+
reportAddonFailure("Removing", handleDeleteAddonRecord(message4.package, message4.id), message4.package);
|
|
86082
86273
|
} else if (message4.type === "saveAddonValues") {
|
|
86083
|
-
|
|
86274
|
+
reportAddonFailure("Saving", handleSaveAddonValues(message4), message4.package);
|
|
86084
86275
|
} else if (message4.type === "runAddonAction") {
|
|
86085
|
-
|
|
86276
|
+
reportAddonFailure(message4.tool, handleRunAddonAction(message4.package, message4.id, message4.tool), message4.package);
|
|
86086
86277
|
} else if (message4.type === "requestAddons") {
|
|
86087
86278
|
reportFailure("postAddons", postAddons());
|
|
86088
86279
|
} else if (message4.type === "enableAddon") {
|
|
86089
|
-
|
|
86280
|
+
reportAddonFailure("Enabling", handleEnableAddon(message4.package));
|
|
86090
86281
|
} else if (message4.type === "removeAddon") {
|
|
86091
|
-
|
|
86282
|
+
reportAddonFailure("Disabling", handleRemoveAddon(message4.server));
|
|
86092
86283
|
} else if (message4.type === "saveAddonFolders") {
|
|
86093
|
-
|
|
86284
|
+
reportAddonFailure("Saving the folders", handleSaveAddonFolders(message4.folders));
|
|
86094
86285
|
} else if (message4.type === "openCodebaseInstructions") {
|
|
86095
86286
|
reportFailure("handleOpenCodebaseInstructions", handleOpenCodebaseInstructions());
|
|
86096
86287
|
} else if (message4.type === "requestAtlassian") {
|
|
@@ -86098,7 +86289,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86098
86289
|
} else if (message4.type === "saveAtlassian") {
|
|
86099
86290
|
reportFailure("handleSaveAtlassian", handleSaveAtlassian(message4.product, message4.settings, message4.token, message4.gateway));
|
|
86100
86291
|
} else if (message4.type === "saveAutosysGateway") {
|
|
86101
|
-
reportFailure("handleSaveAutosysGateway", handleSaveAutosysGateway(message4.gateway, message4.clientSecret, message4.passphrase));
|
|
86292
|
+
reportFailure("handleSaveAutosysGateway", handleSaveAutosysGateway(message4.gateway, message4.clientSecret, message4.passphrase, message4.basicValue));
|
|
86102
86293
|
} else if (message4.type === "clearAutosysGatewaySecret") {
|
|
86103
86294
|
reportFailure("handleClearAutosysGatewaySecret", handleClearAutosysGatewaySecret(message4.which));
|
|
86104
86295
|
} else if (message4.type === "clearAtlassianToken") {
|
|
@@ -86141,7 +86332,11 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86141
86332
|
} else if (message4.type === "attachTeamAlias") {
|
|
86142
86333
|
reportFailure("handleAttachTeamAlias", handleAttachTeamAlias());
|
|
86143
86334
|
} else if (message4.type === "publishTeamSkills") {
|
|
86144
|
-
reportFailure("handlePublishTeamSkills", handlePublishTeamSkills());
|
|
86335
|
+
reportFailure("handlePublishTeamSkills", handlePublishTeamSkills(message4.keepPrivate));
|
|
86336
|
+
} else if (message4.type === "saveTeamSkillSelection") {
|
|
86337
|
+
reportFailure("saveTeamSkillSelection", saveKeepPrivate(message4.keepPrivate).then(postSkills));
|
|
86338
|
+
} else if (message4.type === "saveSkillDefaults") {
|
|
86339
|
+
reportFailure("handleSaveSkillDefaults", handleSaveSkillDefaults(message4.skill, message4.values));
|
|
86145
86340
|
} else if (message4.type === "syncMail") {
|
|
86146
86341
|
reportFailure("runMailSync", runMailSync("requested"));
|
|
86147
86342
|
} else if (message4.type === "pruneMail") {
|
|
@@ -86505,8 +86700,11 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86505
86700
|
const { config: config2 } = await configManager.load();
|
|
86506
86701
|
await syncMcpFromConfig(config2);
|
|
86507
86702
|
await mcp.ensureConnected();
|
|
86703
|
+
mcpStartProblem = void 0;
|
|
86508
86704
|
} catch (error51) {
|
|
86509
|
-
logger.warn(`Could not start MCP servers: ${error51
|
|
86705
|
+
logger.warn(`Could not start MCP servers: ${describeFailure2(error51, true)}`);
|
|
86706
|
+
mcpStartProblem = `Starting MCP servers and add-ons failed when Light Code opened: ${describeFailure2(error51)}`;
|
|
86707
|
+
await postAddons().catch(() => void 0);
|
|
86510
86708
|
}
|
|
86511
86709
|
})();
|
|
86512
86710
|
void (async () => {
|
|
@@ -86531,22 +86729,22 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
86531
86729
|
ui.showWarning("That run's transcript is no longer stored \u2014 task history may have been cleared.");
|
|
86532
86730
|
return;
|
|
86533
86731
|
}
|
|
86534
|
-
const
|
|
86732
|
+
const lines2 = [];
|
|
86535
86733
|
for (const entry of toTranscript(task.messages)) {
|
|
86536
86734
|
if (entry.kind === "text") {
|
|
86537
|
-
|
|
86735
|
+
lines2.push(entry.role === "user" ? `## Prompt
|
|
86538
86736
|
|
|
86539
86737
|
${entry.content}` : `## Reply
|
|
86540
86738
|
|
|
86541
86739
|
${entry.content}`);
|
|
86542
86740
|
} else if (entry.kind === "reasoning") {
|
|
86543
|
-
|
|
86741
|
+
lines2.push(`## Thinking
|
|
86544
86742
|
|
|
86545
86743
|
${entry.content}`);
|
|
86546
86744
|
} else if (entry.kind === "chart") {
|
|
86547
86745
|
const chart = entry.chart;
|
|
86548
86746
|
const header2 = ["", ...chart.series.map((series) => series.name)];
|
|
86549
|
-
|
|
86747
|
+
lines2.push([
|
|
86550
86748
|
`## ${chart.title ?? "Chart"}`,
|
|
86551
86749
|
"",
|
|
86552
86750
|
`| ${header2.join(" | ")} |`,
|
|
@@ -86555,17 +86753,17 @@ ${entry.content}`);
|
|
|
86555
86753
|
...chart.note === void 0 ? [] : ["", chart.note]
|
|
86556
86754
|
].join("\n"));
|
|
86557
86755
|
} else if (entry.kind === "chartError") {
|
|
86558
|
-
|
|
86756
|
+
lines2.push(`## Chart
|
|
86559
86757
|
|
|
86560
86758
|
Could not be drawn: ${entry.message}`);
|
|
86561
86759
|
} else if (entry.kind === "diagramError") {
|
|
86562
|
-
|
|
86760
|
+
lines2.push(`## Diagram
|
|
86563
86761
|
|
|
86564
86762
|
Could not be drawn: ${entry.message}`);
|
|
86565
86763
|
} else if (entry.kind === "diagram") {
|
|
86566
86764
|
const diagram = entry.diagram;
|
|
86567
86765
|
const labels = new Map(diagram.nodes.map((node) => [node.id, node.label]));
|
|
86568
|
-
|
|
86766
|
+
lines2.push([
|
|
86569
86767
|
`## ${diagram.title ?? "Diagram"}`,
|
|
86570
86768
|
"",
|
|
86571
86769
|
...diagram.edges.map((edge) => {
|
|
@@ -86576,7 +86774,7 @@ Could not be drawn: ${entry.message}`);
|
|
|
86576
86774
|
].join("\n"));
|
|
86577
86775
|
} else {
|
|
86578
86776
|
const call = entry.toolCall;
|
|
86579
|
-
|
|
86777
|
+
lines2.push([
|
|
86580
86778
|
`## Tool: ${call.name}${call.isError === true ? " (failed)" : ""}`,
|
|
86581
86779
|
"",
|
|
86582
86780
|
"### Arguments",
|
|
@@ -86589,7 +86787,7 @@ Could not be drawn: ${entry.message}`);
|
|
|
86589
86787
|
}
|
|
86590
86788
|
await ui.openDocument({
|
|
86591
86789
|
title,
|
|
86592
|
-
content:
|
|
86790
|
+
content: lines2.length > 0 ? lines2.join("\n\n") : "_This run produced no messages._"
|
|
86593
86791
|
});
|
|
86594
86792
|
}
|
|
86595
86793
|
let runningScheduleId;
|
|
@@ -87798,9 +87996,9 @@ function describeDiagnostics(shown2, result, cap2 = 20) {
|
|
|
87798
87996
|
return `${result.server}: no errors or warnings in ${shown2}.`;
|
|
87799
87997
|
const sorted = [...relevant].sort((a, b) => a.severity === b.severity ? a.line - b.line : a.severity === "error" ? -1 : 1);
|
|
87800
87998
|
const errors = relevant.filter((d) => d.severity === "error").length;
|
|
87801
|
-
const
|
|
87999
|
+
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}]` : ""}`);
|
|
87802
88000
|
return `${result.server}: ${String(errors)} error(s), ${String(relevant.length - errors)} warning(s) in ${shown2}:
|
|
87803
|
-
${
|
|
88001
|
+
${lines2.join("\n")}${relevant.length > cap2 ? `
|
|
87804
88002
|
\u2026 ${String(relevant.length - cap2)} more` : ""}`;
|
|
87805
88003
|
}
|
|
87806
88004
|
|
|
@@ -87998,51 +88196,51 @@ var REPLACE_MARKER = ">>>>>>> REPLACE";
|
|
|
87998
88196
|
var DASH_SEPARATOR = "-------";
|
|
87999
88197
|
var START_LINE_PATTERN = /^:start_line:(\d+)$/;
|
|
88000
88198
|
function parseDiff(diffText) {
|
|
88001
|
-
const
|
|
88199
|
+
const lines2 = diffText.split("\n");
|
|
88002
88200
|
const blocks = [];
|
|
88003
88201
|
let i = 0;
|
|
88004
|
-
while (i <
|
|
88005
|
-
if ((
|
|
88202
|
+
while (i < lines2.length) {
|
|
88203
|
+
if ((lines2[i] ?? "").trim() === "") {
|
|
88006
88204
|
i++;
|
|
88007
88205
|
continue;
|
|
88008
88206
|
}
|
|
88009
|
-
if (
|
|
88010
|
-
return { ok: false, error: `Expected "${SEARCH_MARKER}" at line ${i + 1}, got: "${
|
|
88207
|
+
if (lines2[i] !== SEARCH_MARKER) {
|
|
88208
|
+
return { ok: false, error: `Expected "${SEARCH_MARKER}" at line ${i + 1}, got: "${lines2[i]}"` };
|
|
88011
88209
|
}
|
|
88012
88210
|
i++;
|
|
88013
88211
|
let startLine;
|
|
88014
|
-
const startLineMatch = START_LINE_PATTERN.exec(
|
|
88212
|
+
const startLineMatch = START_LINE_PATTERN.exec(lines2[i] ?? "");
|
|
88015
88213
|
if (startLineMatch !== null) {
|
|
88016
88214
|
startLine = Number(startLineMatch[1]);
|
|
88017
88215
|
i++;
|
|
88018
|
-
if (
|
|
88216
|
+
if (lines2[i] !== DASH_SEPARATOR) {
|
|
88019
88217
|
return { ok: false, error: `Expected "${DASH_SEPARATOR}" after ":start_line:" at line ${i + 1}.` };
|
|
88020
88218
|
}
|
|
88021
88219
|
i++;
|
|
88022
88220
|
}
|
|
88023
88221
|
const searchLines = [];
|
|
88024
|
-
while (i <
|
|
88025
|
-
const line =
|
|
88222
|
+
while (i < lines2.length && lines2[i] !== SEPARATOR) {
|
|
88223
|
+
const line = lines2[i] ?? "";
|
|
88026
88224
|
if (line === SEARCH_MARKER || line === REPLACE_MARKER || START_LINE_PATTERN.test(line)) {
|
|
88027
88225
|
return { ok: false, error: `Unexpected marker inside the SEARCH block at line ${i + 1}: "${line}"` };
|
|
88028
88226
|
}
|
|
88029
88227
|
searchLines.push(line);
|
|
88030
88228
|
i++;
|
|
88031
88229
|
}
|
|
88032
|
-
if (i >=
|
|
88230
|
+
if (i >= lines2.length) {
|
|
88033
88231
|
return { ok: false, error: `Missing "${SEPARATOR}" to end the SEARCH block.` };
|
|
88034
88232
|
}
|
|
88035
88233
|
i++;
|
|
88036
88234
|
const replaceLines = [];
|
|
88037
|
-
while (i <
|
|
88038
|
-
const line =
|
|
88235
|
+
while (i < lines2.length && lines2[i] !== REPLACE_MARKER) {
|
|
88236
|
+
const line = lines2[i] ?? "";
|
|
88039
88237
|
if (line === SEARCH_MARKER || line === SEPARATOR || START_LINE_PATTERN.test(line)) {
|
|
88040
88238
|
return { ok: false, error: `Unexpected marker inside the REPLACE block at line ${i + 1}: "${line}"` };
|
|
88041
88239
|
}
|
|
88042
88240
|
replaceLines.push(line);
|
|
88043
88241
|
i++;
|
|
88044
88242
|
}
|
|
88045
|
-
if (i >=
|
|
88243
|
+
if (i >= lines2.length) {
|
|
88046
88244
|
return { ok: false, error: `Missing "${REPLACE_MARKER}" to end the block.` };
|
|
88047
88245
|
}
|
|
88048
88246
|
i++;
|
|
@@ -88065,17 +88263,17 @@ function applyDiff(originalContent, diffText) {
|
|
|
88065
88263
|
return { ok: false, content: originalContent, message: parsed.error };
|
|
88066
88264
|
}
|
|
88067
88265
|
const eol = detectEol(originalContent);
|
|
88068
|
-
const
|
|
88266
|
+
const lines2 = normalizeToLf(originalContent).split("\n");
|
|
88069
88267
|
const resolved = [];
|
|
88070
88268
|
for (const block2 of parsed.blocks) {
|
|
88071
|
-
const match = findMatch(
|
|
88269
|
+
const match = findMatch(lines2, block2);
|
|
88072
88270
|
if (!match.ok) {
|
|
88073
88271
|
return { ok: false, content: originalContent, message: match.message };
|
|
88074
88272
|
}
|
|
88075
88273
|
resolved.push(match);
|
|
88076
88274
|
}
|
|
88077
88275
|
const bottomUp = [...resolved].sort((a, b) => b.startLine - a.startLine);
|
|
88078
|
-
const nextLines = [...
|
|
88276
|
+
const nextLines = [...lines2];
|
|
88079
88277
|
for (const block2 of bottomUp) {
|
|
88080
88278
|
const replaceLines = block2.replace.length > 0 ? block2.replace.split("\n") : [""];
|
|
88081
88279
|
nextLines.splice(block2.startLine, block2.endLine - block2.startLine + 1, ...replaceLines);
|
|
@@ -88482,7 +88680,7 @@ alert about.
|
|
|
88482
88680
|
{
|
|
88483
88681
|
id: "skills",
|
|
88484
88682
|
title: "Skills: teaching it things it cannot work out",
|
|
88485
|
-
keywords: ["skill", "teach", "instructions", "standing", "always", "master skill", "markdown", "edit skill", "editor", "edit standing instructions", "standing instructions", "edit a skill"],
|
|
88683
|
+
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"],
|
|
88486
88684
|
body: `
|
|
88487
88685
|
A skill is markdown with frontmatter (\`name\`, \`description\`), kept in the workspace so it lands
|
|
88488
88686
|
in git and gets reviewed. **Settings \u2192 Skills.**
|
|
@@ -88537,6 +88735,20 @@ so one person re-indexing never disturbs anybody else. The team skills aliases,
|
|
|
88537
88735
|
team search test are in **Settings -> Project -> Team skills**. Searches return this project's
|
|
88538
88736
|
skills by default; say "all projects", another project's name, or a person to widen or change that.
|
|
88539
88737
|
|
|
88738
|
+
**Choosing which skills go to the team.** Settings -> Project -> Team skills -> *Choose which skills to
|
|
88739
|
+
send*: untick a skill to keep it to yourself. The choice is remembered (config:teamSkills), the Send
|
|
88740
|
+
button counts what goes, and a skill unticked after it was sent is taken back from the pool by the
|
|
88741
|
+
next Send - only your own copy; colleagues' collections are never touched. Check status marks it
|
|
88742
|
+
"kept to yourself".
|
|
88743
|
+
|
|
88744
|
+
**Defaults for a skill's inputs.** A skill that needs answers - an environment, a team, a user name -
|
|
88745
|
+
can be answered in advance, so the assistant fills them in instead of stopping to ask. Settings ->
|
|
88746
|
+
Skills -> a skill -> *Defaults for its inputs*: placeholders written \`{{name}}\` or \`<NAME>\` in the
|
|
88747
|
+
skill are offered as boxes, and any other input can be added by name. They are yours, kept in your own
|
|
88748
|
+
settings (config:skillDefaults), never in the skill, so a shared skill stays the same for everyone.
|
|
88749
|
+
The assistant is told them up front and again when it reads the skill, says which it used, and still
|
|
88750
|
+
asks for anything without a default; a different value you give in the chat wins.
|
|
88751
|
+
|
|
88540
88752
|
A skill is **prose nobody code-reviews that steers every conversation that finds it**. That is why
|
|
88541
88753
|
writing one always asks for approval, whatever else is auto-approved, and why plain markdown in
|
|
88542
88754
|
git is the main defence.
|
|
@@ -89067,10 +89279,15 @@ and the secret is right, switch *How the consumer key and secret are sent* betwe
|
|
|
89067
89279
|
and a Basic header \u2014 gateways differ. **Gateway token and AutoSys username and password together** (an AutoSys that wants both, plus the
|
|
89068
89280
|
certificate, for job status, details and actions): tick *Also send the AutoSys username and password
|
|
89069
89281
|
with each job call (HTTP Basic)* \u2014 it sends the username and password entered above as Basic on every
|
|
89070
|
-
AutoSys call, alongside the gateway's token, and never on the token request.
|
|
89282
|
+
AutoSys call, alongside the gateway's token, and never on the token request. **Or paste the whole header
|
|
89283
|
+
value yourself** in *Header value* (for example \`Basic \` followed by the base64 of username:password -
|
|
89284
|
+
in Python \`"Basic " + base64.b64encode(b"user:pass").decode()\`): it is sent exactly as stored, kept in
|
|
89285
|
+
secure storage, and the username and password are then not needed. *Header name for the sign-in* takes
|
|
89286
|
+
whatever your gateway expects (for example x-api-authorization-header-for-service-provider), and is
|
|
89287
|
+
editable if it was mistyped. One header holds one value, so the two must go in different headers:
|
|
89071
89288
|
usually the token in a gateway header (Advanced \u2192 *Header the token is sent in*, such as
|
|
89072
|
-
x-apigee-token) and the Basic sign-in in Authorization, or the
|
|
89073
|
-
|
|
89289
|
+
x-apigee-token) and the Basic sign-in in Authorization, or the token in Authorization (Bearer) and the
|
|
89290
|
+
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
|
|
89074
89291
|
expiry sit in the response, the header and prefix it is sent with, extra headers (an API key, say)
|
|
89075
89292
|
and extra token parameters (config:autosys).
|
|
89076
89293
|
|
|
@@ -89866,6 +90083,12 @@ edits made outside the agent (in VS Code, say) are saved with \`hub_sync\` "push
|
|
|
89866
90083
|
"parallel agents",
|
|
89867
90084
|
"chat tabs",
|
|
89868
90085
|
"new chat tab",
|
|
90086
|
+
"archive chat",
|
|
90087
|
+
"archived chat",
|
|
90088
|
+
"close chat",
|
|
90089
|
+
"blank chat",
|
|
90090
|
+
"new chat shows old",
|
|
90091
|
+
"reopen chat",
|
|
89869
90092
|
"two agents same codebase",
|
|
89870
90093
|
"same codebase at once",
|
|
89871
90094
|
"same codebase",
|
|
@@ -89942,7 +90165,11 @@ with a note saying so - whether the copies come from a bucket, a shared folder o
|
|
|
89942
90165
|
**Several chats per codebase**: the tabs above the chat. + (or Ctrl+T, or right-click \u2192 New chat) opens
|
|
89943
90166
|
another chat on the same codebase \u2014 its own agent, working at the same time, with the same settings and
|
|
89944
90167
|
keys. To rename a chat - the first one too - double-click its tab, or right-click it \u2192 Rename chat; the
|
|
89945
|
-
name shows on the tab and in notifications. \xD7 or Ctrl+W
|
|
90168
|
+
name shows on the tab and in notifications. \xD7 or Ctrl+W asks how to close a chat: **Archive** keeps its
|
|
90169
|
+
conversation and takes the tab away; **Close and delete** removes its conversations, reports and log
|
|
90170
|
+
(files it changed in the codebase stay). **New chat** is always blank - a closed chat's number is never
|
|
90171
|
+
reused - and when chats are archived, + offers *New blank chat* or any archived chat, which opens exactly
|
|
90172
|
+
where it was left (each archived row also has a delete). Ctrl+T is always blank. Two safeguards make
|
|
89946
90173
|
this safe: an edit is refused when the file changed since that chat read it (another chat, you, or any
|
|
89947
90174
|
program edited it) \u2014 the agent re-reads and edits what is there now; and **Rollback undoes only the files
|
|
89948
90175
|
that chat changed**, never another chat's work. If another chat also changed one of those files since,
|
|
@@ -90109,6 +90336,9 @@ Settings \u2192 Export source code saves the whole repository as a zip that buil
|
|
|
90109
90336
|
"enable addon",
|
|
90110
90337
|
"disable addon",
|
|
90111
90338
|
"linux tab missing",
|
|
90339
|
+
"addon could not start",
|
|
90340
|
+
"addon failed",
|
|
90341
|
+
"start again",
|
|
90112
90342
|
"ssh key",
|
|
90113
90343
|
"set up ssh key",
|
|
90114
90344
|
"key setup",
|
|
@@ -90169,6 +90399,12 @@ public half to the server's authorized_keys with the stored password, proves the
|
|
|
90169
90399
|
the machine to it. It is a button only - the assistant cannot call it - and the tab lists the tools the
|
|
90170
90400
|
assistant does get. A globally installed add-on is found by itself (npm's folder, your .npmrc prefix,
|
|
90171
90401
|
or beside node.exe); the folder box is only for somewhere else.
|
|
90402
|
+
|
|
90403
|
+
**The Linux tab is missing, or Enable seemed to do nothing?** Look at the add-on's row on the **Add-ons**
|
|
90404
|
+
tab: once enabled it says Running, or *Could not start* with the reason, a **Log** with what the add-on
|
|
90405
|
+
printed, and **Start again**. An add-on that cannot start is still enabled, so its tab is there. Any
|
|
90406
|
+
other failure is shown at the top of the Add-ons tab (not in the chat). Fire Code writes the full error to
|
|
90407
|
+
the agent's log too (right-click the codebase \u2192 View agent log); VS Code to View \u2192 Output \u2192 Light Code.
|
|
90172
90408
|
`
|
|
90173
90409
|
},
|
|
90174
90410
|
{
|
|
@@ -90195,7 +90431,9 @@ or beside node.exe); the folder box is only for somewhere else.
|
|
|
90195
90431
|
body: `
|
|
90196
90432
|
**Three levels**, most specific first: what you say **in the chat**, then **codebase instructions**,
|
|
90197
90433
|
then **standing instructions**. Every chat on a codebase gets the codebase instructions with every
|
|
90198
|
-
message
|
|
90434
|
+
message; where they disagree with the standing instructions the codebase instructions win. They are
|
|
90435
|
+
placed at the end of what the agent is told (before only a plan you set for the chat), and named at the
|
|
90436
|
+
very start, because instructions in the middle of a long prompt are the ones a model follows least.
|
|
90199
90437
|
|
|
90200
90438
|
**Codebase instructions** are about one codebase and are kept on this machine, not in the repository,
|
|
90201
90439
|
so a cloned repository cannot write them. Edit them in **Settings \u2192 Skills \u2192 Codebase instructions**,
|
|
@@ -91132,8 +91370,8 @@ var listFilesTool = {
|
|
|
91132
91370
|
}
|
|
91133
91371
|
const entries = await context.fs.readdir(resolved.realPath);
|
|
91134
91372
|
const visible = entries.filter((entry) => entry.name !== ".git" && entry.name !== "node_modules");
|
|
91135
|
-
const
|
|
91136
|
-
return { content:
|
|
91373
|
+
const lines2 = visible.map((entry) => entry.isDirectory ? `${entry.name}/` : entry.name);
|
|
91374
|
+
return { content: lines2.length > 0 ? lines2.join("\n") : "(empty directory)" };
|
|
91137
91375
|
}
|
|
91138
91376
|
};
|
|
91139
91377
|
|
|
@@ -91167,10 +91405,11 @@ var readFileTool = {
|
|
|
91167
91405
|
}
|
|
91168
91406
|
await recordRead(context, resolved.realPath);
|
|
91169
91407
|
try {
|
|
91408
|
+
const note = context.annotateRead?.(resolved.realPath) ?? "";
|
|
91170
91409
|
if (size <= REQUIRE_WINDOW_BYTES) {
|
|
91171
|
-
return { content: readSmall(await context.fs.readFile(resolved.realPath), params3), path: params3.path };
|
|
91410
|
+
return { content: readSmall(await context.fs.readFile(resolved.realPath), params3) + note, path: params3.path };
|
|
91172
91411
|
}
|
|
91173
|
-
return { content: await readLarge(context.fs, resolved.realPath, params3, size), path: params3.path };
|
|
91412
|
+
return { content: await readLarge(context.fs, resolved.realPath, params3, size) + note, path: params3.path };
|
|
91174
91413
|
} catch (error51) {
|
|
91175
91414
|
return {
|
|
91176
91415
|
content: `Could not read "${params3.path}": ${error51 instanceof Error ? error51.message : String(error51)}`,
|
|
@@ -91180,18 +91419,18 @@ var readFileTool = {
|
|
|
91180
91419
|
}
|
|
91181
91420
|
}
|
|
91182
91421
|
};
|
|
91183
|
-
function number4(
|
|
91184
|
-
return
|
|
91422
|
+
function number4(lines2, firstLineNumber) {
|
|
91423
|
+
return lines2.map((line, index) => `${firstLineNumber + index} ${line}`).join("\n");
|
|
91185
91424
|
}
|
|
91186
91425
|
function readSmall(raw, params3) {
|
|
91187
|
-
const
|
|
91426
|
+
const lines2 = raw.split(/\r\n|\r|\n/);
|
|
91188
91427
|
if (params3.tail !== void 0) {
|
|
91189
|
-
const start2 = Math.max(0,
|
|
91190
|
-
return number4(
|
|
91428
|
+
const start2 = Math.max(0, lines2.length - params3.tail);
|
|
91429
|
+
return number4(lines2.slice(start2), start2 + 1);
|
|
91191
91430
|
}
|
|
91192
91431
|
const start = params3.offset !== void 0 ? params3.offset - 1 : 0;
|
|
91193
|
-
const end = params3.limit !== void 0 ? start + params3.limit :
|
|
91194
|
-
return number4(
|
|
91432
|
+
const end = params3.limit !== void 0 ? start + params3.limit : lines2.length;
|
|
91433
|
+
return number4(lines2.slice(start, end), start + 1);
|
|
91195
91434
|
}
|
|
91196
91435
|
async function readLarge(fs41, realPath, params3, size) {
|
|
91197
91436
|
const human = formatBytes(size);
|
|
@@ -91272,15 +91511,15 @@ var readDocumentTool = {
|
|
|
91272
91511
|
path: params3.path
|
|
91273
91512
|
};
|
|
91274
91513
|
}
|
|
91275
|
-
const
|
|
91514
|
+
const lines2 = extracted.text.split("\n");
|
|
91276
91515
|
const start = params3.offset !== void 0 ? params3.offset - 1 : 0;
|
|
91277
|
-
const end = params3.limit !== void 0 ? start + params3.limit :
|
|
91278
|
-
const slice =
|
|
91516
|
+
const end = params3.limit !== void 0 ? start + params3.limit : lines2.length;
|
|
91517
|
+
const slice = lines2.slice(start, end);
|
|
91279
91518
|
const header2 = [
|
|
91280
|
-
`${params3.path} (${kind}, ${String(
|
|
91519
|
+
`${params3.path} (${kind}, ${String(lines2.length)} lines of text)`,
|
|
91281
91520
|
...extracted.sections !== void 0 && extracted.sections.length > 1 ? [`Sheets: ${extracted.sections.join(", ")}`] : [],
|
|
91282
91521
|
...extracted.note !== void 0 ? [extracted.note] : [],
|
|
91283
|
-
...end <
|
|
91522
|
+
...end < lines2.length || start > 0 ? [`Showing lines ${String(start + 1)}\u2013${String(Math.min(end, lines2.length))}. Use offset/limit for more.`] : []
|
|
91284
91523
|
];
|
|
91285
91524
|
return { content: [...header2, "", ...slice].join("\n"), path: params3.path };
|
|
91286
91525
|
}
|
|
@@ -91521,8 +91760,8 @@ var DatasetStore = class {
|
|
|
91521
91760
|
return;
|
|
91522
91761
|
await import_promises29.default.mkdir(import_node_path55.default.dirname(this.filePath), { recursive: true });
|
|
91523
91762
|
await import_promises29.default.writeFile(this.filePath, "", { flag: "a" });
|
|
91524
|
-
const
|
|
91525
|
-
await import_promises29.default.appendFile(this.filePath, `${
|
|
91763
|
+
const lines2 = records.map((record2) => JSON.stringify(record2)).join("\n");
|
|
91764
|
+
await import_promises29.default.appendFile(this.filePath, `${lines2}
|
|
91526
91765
|
`, "utf8");
|
|
91527
91766
|
}
|
|
91528
91767
|
/** Rewrites with exactly these. Temp-and-rename, so an interrupted prune leaves the old file. */
|
|
@@ -92364,8 +92603,8 @@ function createS3ListTool(targets) {
|
|
|
92364
92603
|
const found2 = await target.client.list(where, params3.limit ?? 100, context.signal);
|
|
92365
92604
|
if (found2.length === 0)
|
|
92366
92605
|
return { content: `No files under "${where === "" ? "/" : where}".` };
|
|
92367
|
-
const
|
|
92368
|
-
return { content: [`${String(found2.length)} file(s) in ${target.bucket}:`, ...
|
|
92606
|
+
const lines2 = found2.map((object3) => `${displayKey(object3.key, target.prefix)} ${describeSize(object3.size)} ${object3.lastModified}`);
|
|
92607
|
+
return { content: [`${String(found2.length)} file(s) in ${target.bucket}:`, ...lines2].join("\n") };
|
|
92369
92608
|
} catch (error51) {
|
|
92370
92609
|
return failed(error51);
|
|
92371
92610
|
}
|