@chosengeneration/light-code 0.136.0 → 0.139.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 +2 -2
- package/dist/server.cjs +739 -92
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/cli.cjs
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 49728488 bytes
|
|
4
|
+
sha256: 39d30164800a47167e0c6e60f48dbeb49081a6140a9a0d3d54cccd5f92493503
|
package/dist/server.cjs
CHANGED
|
@@ -4824,7 +4824,7 @@ var require_body = __commonJS({
|
|
|
4824
4824
|
const boundary = `----formdata-undici-0${`${random2(1e11)}`.padStart(11, "0")}`;
|
|
4825
4825
|
const prefix = `--${boundary}\r
|
|
4826
4826
|
Content-Disposition: form-data`;
|
|
4827
|
-
const
|
|
4827
|
+
const escape4 = (str) => str.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22");
|
|
4828
4828
|
const normalizeLinefeeds = (value) => value.replace(/\r?\n|\r/g, "\r\n");
|
|
4829
4829
|
const blobParts = [];
|
|
4830
4830
|
const rn = new Uint8Array([13, 10]);
|
|
@@ -4832,14 +4832,14 @@ Content-Disposition: form-data`;
|
|
|
4832
4832
|
let hasUnknownSizeValue = false;
|
|
4833
4833
|
for (const [name, value] of object3) {
|
|
4834
4834
|
if (typeof value === "string") {
|
|
4835
|
-
const chunk2 = textEncoder.encode(prefix + `; name="${
|
|
4835
|
+
const chunk2 = textEncoder.encode(prefix + `; name="${escape4(normalizeLinefeeds(name))}"\r
|
|
4836
4836
|
\r
|
|
4837
4837
|
${normalizeLinefeeds(value)}\r
|
|
4838
4838
|
`);
|
|
4839
4839
|
blobParts.push(chunk2);
|
|
4840
4840
|
length += chunk2.byteLength;
|
|
4841
4841
|
} else {
|
|
4842
|
-
const chunk2 = textEncoder.encode(`${prefix}; name="${
|
|
4842
|
+
const chunk2 = textEncoder.encode(`${prefix}; name="${escape4(normalizeLinefeeds(name))}"` + (value.name ? `; filename="${escape4(value.name)}"` : "") + `\r
|
|
4843
4843
|
Content-Type: ${value.type || "application/octet-stream"}\r
|
|
4844
4844
|
\r
|
|
4845
4845
|
`);
|
|
@@ -22168,7 +22168,7 @@ var require_contains = __commonJS({
|
|
|
22168
22168
|
const count3 = gen.let("count", 0);
|
|
22169
22169
|
validateItems(schValid, () => gen.if(schValid, () => checkLimits(count3)));
|
|
22170
22170
|
}
|
|
22171
|
-
function validateItems(_valid,
|
|
22171
|
+
function validateItems(_valid, block2) {
|
|
22172
22172
|
gen.forRange("i", 0, len, (i) => {
|
|
22173
22173
|
cxt.subschema({
|
|
22174
22174
|
keyword: "contains",
|
|
@@ -22176,7 +22176,7 @@ var require_contains = __commonJS({
|
|
|
22176
22176
|
dataPropType: util_1.Type.Num,
|
|
22177
22177
|
compositeRule: true
|
|
22178
22178
|
}, _valid);
|
|
22179
|
-
|
|
22179
|
+
block2();
|
|
22180
22180
|
});
|
|
22181
22181
|
}
|
|
22182
22182
|
function checkLimits(count3) {
|
|
@@ -24013,7 +24013,7 @@ var require_parse2 = __commonJS({
|
|
|
24013
24013
|
"use strict";
|
|
24014
24014
|
var path58 = require("path");
|
|
24015
24015
|
var resolveCommand = require_resolveCommand();
|
|
24016
|
-
var
|
|
24016
|
+
var escape4 = require_escape();
|
|
24017
24017
|
var readShebang = require_readShebang();
|
|
24018
24018
|
var isWin = process.platform === "win32";
|
|
24019
24019
|
var isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
@@ -24037,8 +24037,8 @@ var require_parse2 = __commonJS({
|
|
|
24037
24037
|
if (parsed.options.forceShell || needsShell) {
|
|
24038
24038
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
24039
24039
|
parsed.command = path58.normalize(parsed.command);
|
|
24040
|
-
parsed.command =
|
|
24041
|
-
parsed.args = parsed.args.map((arg) =>
|
|
24040
|
+
parsed.command = escape4.command(parsed.command);
|
|
24041
|
+
parsed.args = parsed.args.map((arg) => escape4.argument(arg, needsDoubleEscapeMetaChars));
|
|
24042
24042
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
24043
24043
|
parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
|
|
24044
24044
|
parsed.command = process.env.comspec || "cmd.exe";
|
|
@@ -43336,13 +43336,13 @@ function toAnthropicMessages(messages) {
|
|
|
43336
43336
|
if (message4.role === "system")
|
|
43337
43337
|
continue;
|
|
43338
43338
|
if (message4.role === "tool") {
|
|
43339
|
-
const
|
|
43339
|
+
const block2 = { type: "tool_result", tool_use_id: message4.toolCallId, content: message4.content };
|
|
43340
43340
|
const previous = wireMessages[wireMessages.length - 1];
|
|
43341
43341
|
if (previous?.role === "user" && Array.isArray(previous.content) && isToolResultBlocks(previous.content)) {
|
|
43342
43342
|
;
|
|
43343
|
-
previous.content.push(
|
|
43343
|
+
previous.content.push(block2);
|
|
43344
43344
|
} else {
|
|
43345
|
-
wireMessages.push({ role: "user", content: [
|
|
43345
|
+
wireMessages.push({ role: "user", content: [block2] });
|
|
43346
43346
|
}
|
|
43347
43347
|
continue;
|
|
43348
43348
|
}
|
|
@@ -43383,7 +43383,7 @@ function toAnthropicMessages(messages) {
|
|
|
43383
43383
|
return { system, wireMessages };
|
|
43384
43384
|
}
|
|
43385
43385
|
function isToolResultBlocks(content) {
|
|
43386
|
-
return content.length > 0 && content.every((
|
|
43386
|
+
return content.length > 0 && content.every((block2) => block2.type === "tool_result");
|
|
43387
43387
|
}
|
|
43388
43388
|
function safeParseArguments(raw) {
|
|
43389
43389
|
try {
|
|
@@ -43422,9 +43422,9 @@ async function* parseAnthropicStream(body, url2, signal, logger) {
|
|
|
43422
43422
|
const eventType = parsed.type;
|
|
43423
43423
|
if (eventType === "content_block_start") {
|
|
43424
43424
|
const index = typeof parsed.index === "number" ? parsed.index : 0;
|
|
43425
|
-
const
|
|
43426
|
-
if (
|
|
43427
|
-
toolUses.set(index, { id:
|
|
43425
|
+
const block2 = parsed.content_block;
|
|
43426
|
+
if (block2?.type === "tool_use" && typeof block2.id === "string" && typeof block2.name === "string") {
|
|
43427
|
+
toolUses.set(index, { id: block2.id, name: block2.name, json: "" });
|
|
43428
43428
|
}
|
|
43429
43429
|
} else if (eventType === "content_block_delta") {
|
|
43430
43430
|
const index = typeof parsed.index === "number" ? parsed.index : 0;
|
|
@@ -43901,6 +43901,54 @@ function createRelayLanguageModels(options = {}) {
|
|
|
43901
43901
|
}
|
|
43902
43902
|
};
|
|
43903
43903
|
}
|
|
43904
|
+
var NO_VSCODE_DEBUG = "No VS Code window with the Light Code extension is open, so its debugger cannot be read. Start the program in the VS Code debugger (Light Code 0.166.0 or later installed there), pause it at a breakpoint, and ask again.";
|
|
43905
|
+
function askWindow(entry, file2, request, timeoutMs) {
|
|
43906
|
+
return new Promise((resolve) => {
|
|
43907
|
+
let settled = false;
|
|
43908
|
+
let buffered = "";
|
|
43909
|
+
const finish = (value) => {
|
|
43910
|
+
if (settled)
|
|
43911
|
+
return;
|
|
43912
|
+
settled = true;
|
|
43913
|
+
clearTimeout(timer);
|
|
43914
|
+
socket.destroy();
|
|
43915
|
+
resolve(value);
|
|
43916
|
+
};
|
|
43917
|
+
const socket = (0, import_node_net.connect)(entry.pipe);
|
|
43918
|
+
const timer = setTimeout(() => finish(void 0), timeoutMs);
|
|
43919
|
+
socket.setEncoding("utf8");
|
|
43920
|
+
socket.once("connect", () => socket.write(`${JSON.stringify({ ...request, token: entry.token })}
|
|
43921
|
+
`));
|
|
43922
|
+
socket.on("data", (chunk) => {
|
|
43923
|
+
buffered += chunk;
|
|
43924
|
+
const newline = buffered.indexOf("\n");
|
|
43925
|
+
if (newline < 0)
|
|
43926
|
+
return;
|
|
43927
|
+
try {
|
|
43928
|
+
finish(JSON.parse(buffered.slice(0, newline)));
|
|
43929
|
+
} catch {
|
|
43930
|
+
finish(void 0);
|
|
43931
|
+
}
|
|
43932
|
+
});
|
|
43933
|
+
socket.once("error", (error51) => {
|
|
43934
|
+
if (error51.code === "ENOENT" || error51.code === "ECONNREFUSED")
|
|
43935
|
+
(0, import_node_fs2.rmSync)(file2, { force: true });
|
|
43936
|
+
finish(void 0);
|
|
43937
|
+
});
|
|
43938
|
+
socket.once("close", () => finish(void 0));
|
|
43939
|
+
});
|
|
43940
|
+
}
|
|
43941
|
+
function createRelayDebugReader(options = {}) {
|
|
43942
|
+
const dir = options.dir ?? defaultRelayDir();
|
|
43943
|
+
return async () => {
|
|
43944
|
+
const entries = relayEntries(dir);
|
|
43945
|
+
const answers = await Promise.all(entries.map(({ entry, file: file2 }) => askWindow(entry, file2, { op: "debug" }, 8e3)));
|
|
43946
|
+
if (!answers.some((answer) => answer !== void 0))
|
|
43947
|
+
throw new Error(NO_VSCODE_DEBUG);
|
|
43948
|
+
const sessions = answers.map((answer) => answer?.["debug"]).filter((debug) => debug !== null && debug !== void 0 && typeof debug === "object");
|
|
43949
|
+
return sessions.find((session) => session.stopped !== void 0) ?? sessions[0];
|
|
43950
|
+
};
|
|
43951
|
+
}
|
|
43904
43952
|
|
|
43905
43953
|
// ../../packages/core/dist/context/budget.js
|
|
43906
43954
|
function estimateTokens(text) {
|
|
@@ -48782,13 +48830,13 @@ function utf16beToString(hex3) {
|
|
|
48782
48830
|
}
|
|
48783
48831
|
function parseToUnicode(cmap) {
|
|
48784
48832
|
const mapping = /* @__PURE__ */ new Map();
|
|
48785
|
-
for (const
|
|
48786
|
-
for (const pair of (
|
|
48833
|
+
for (const block2 of cmap.matchAll(/beginbfchar([\s\S]*?)endbfchar/g)) {
|
|
48834
|
+
for (const pair of (block2[1] ?? "").matchAll(/<([0-9a-fA-F]+)>\s*<([0-9a-fA-F]+)>/g)) {
|
|
48787
48835
|
mapping.set(parseInt(pair[1], 16), utf16beToString(pair[2]));
|
|
48788
48836
|
}
|
|
48789
48837
|
}
|
|
48790
|
-
for (const
|
|
48791
|
-
const body =
|
|
48838
|
+
for (const block2 of cmap.matchAll(/beginbfrange([\s\S]*?)endbfrange/g)) {
|
|
48839
|
+
const body = block2[1] ?? "";
|
|
48792
48840
|
for (const entry of body.matchAll(/<([0-9a-fA-F]+)>\s*<([0-9a-fA-F]+)>\s*\[([\s\S]*?)\]/g)) {
|
|
48793
48841
|
const low = parseInt(entry[1], 16);
|
|
48794
48842
|
const targets = [...(entry[3] ?? "").matchAll(/<([0-9a-fA-F]+)>/g)];
|
|
@@ -48846,8 +48894,8 @@ function resourcesFor(objects, pageDict) {
|
|
|
48846
48894
|
const indirect = referencedObject(pageDict, "Resources");
|
|
48847
48895
|
if (indirect !== void 0)
|
|
48848
48896
|
return objects.get(indirect)?.dict ?? "";
|
|
48849
|
-
const
|
|
48850
|
-
return
|
|
48897
|
+
const inline2 = /\/Resources\s*<<([\s\S]*)/.exec(pageDict);
|
|
48898
|
+
return inline2?.[0] ?? "";
|
|
48851
48899
|
}
|
|
48852
48900
|
function contentObjectsFor(pageDict) {
|
|
48853
48901
|
const single = referencedObject(pageDict, "Contents");
|
|
@@ -58814,8 +58862,8 @@ function renderToolResult(result) {
|
|
|
58814
58862
|
const content = result.content;
|
|
58815
58863
|
if (!Array.isArray(content))
|
|
58816
58864
|
return JSON.stringify(result);
|
|
58817
|
-
const parts = content.map((
|
|
58818
|
-
const typed =
|
|
58865
|
+
const parts = content.map((block2) => {
|
|
58866
|
+
const typed = block2;
|
|
58819
58867
|
if (typed.type === "text" && typeof typed.text === "string")
|
|
58820
58868
|
return typed.text;
|
|
58821
58869
|
return `[${typed.type ?? "unknown"} content omitted]`;
|
|
@@ -59541,11 +59589,11 @@ function toAttribution(read) {
|
|
|
59541
59589
|
}
|
|
59542
59590
|
var FRONTMATTER = /^---\r?\n([\s\S]*?)\r?\n---(\r?\n|$)/;
|
|
59543
59591
|
function readSkillAttribution(source) {
|
|
59544
|
-
const
|
|
59545
|
-
if (
|
|
59592
|
+
const block2 = FRONTMATTER.exec(source)?.[1];
|
|
59593
|
+
if (block2 === void 0)
|
|
59546
59594
|
return {};
|
|
59547
59595
|
return toAttribution((key2) => {
|
|
59548
|
-
const match = new RegExp(`^${key2}\\s*:\\s*(.*)$`, "m").exec(
|
|
59596
|
+
const match = new RegExp(`^${key2}\\s*:\\s*(.*)$`, "m").exec(block2);
|
|
59549
59597
|
const value = match?.[1]?.trim().replace(/^["']|["']$/g, "");
|
|
59550
59598
|
return value !== void 0 && value.length > 0 ? value : void 0;
|
|
59551
59599
|
});
|
|
@@ -59556,22 +59604,22 @@ function writeSkillFields(source, values, replace) {
|
|
|
59556
59604
|
return source;
|
|
59557
59605
|
const eol = source.includes("\r\n") ? "\r\n" : "\n";
|
|
59558
59606
|
const blockStart = source.indexOf(match[1] ?? "", match.index);
|
|
59559
|
-
let
|
|
59560
|
-
const blockEnd = blockStart +
|
|
59607
|
+
let block2 = match[1] ?? "";
|
|
59608
|
+
const blockEnd = blockStart + block2.length;
|
|
59561
59609
|
const existing = readSkillAttribution(source);
|
|
59562
59610
|
for (const field2 of FIELDS) {
|
|
59563
59611
|
const value = cleanAttributionValue(values[field2]);
|
|
59564
59612
|
if (value === void 0)
|
|
59565
59613
|
continue;
|
|
59566
59614
|
const line = new RegExp(`^${field2}\\s*:.*$`, "m");
|
|
59567
|
-
if (line.test(
|
|
59615
|
+
if (line.test(block2)) {
|
|
59568
59616
|
if (replace.has(field2))
|
|
59569
|
-
|
|
59617
|
+
block2 = block2.replace(line, `${field2}: ${value}`);
|
|
59570
59618
|
} else if (existing[field2] === void 0) {
|
|
59571
|
-
|
|
59619
|
+
block2 = `${block2}${eol}${field2}: ${value}`;
|
|
59572
59620
|
}
|
|
59573
59621
|
}
|
|
59574
|
-
return `${source.slice(0, blockStart)}${
|
|
59622
|
+
return `${source.slice(0, blockStart)}${block2}${source.slice(blockEnd)}`;
|
|
59575
59623
|
}
|
|
59576
59624
|
function dunderValue(source, name) {
|
|
59577
59625
|
const match = new RegExp(`^__${name}__\\s*=\\s*["']([^"'\\\\\\r\\n]*)["']\\s*$`, "m").exec(source);
|
|
@@ -59632,12 +59680,12 @@ function writeToolFields(source, values, replace) {
|
|
|
59632
59680
|
const before = lines.slice(0, at);
|
|
59633
59681
|
const after = lines.slice(at);
|
|
59634
59682
|
const existingBlock = /^__(author|project|version|updated)__\s*=/.test(after[0] ?? "");
|
|
59635
|
-
const
|
|
59683
|
+
const block2 = [
|
|
59636
59684
|
...before.length > 0 && (before[before.length - 1] ?? "").trim() !== "" ? [""] : [],
|
|
59637
59685
|
...additions,
|
|
59638
59686
|
...after.length > 0 && (after[0] ?? "").trim() !== "" && !existingBlock ? [""] : []
|
|
59639
59687
|
];
|
|
59640
|
-
return [...before, ...
|
|
59688
|
+
return [...before, ...block2, ...after].join(eol);
|
|
59641
59689
|
}
|
|
59642
59690
|
function readAttribution(kind, source) {
|
|
59643
59691
|
return kind === "skill" ? readSkillAttribution(source) : readToolAttribution(source);
|
|
@@ -60891,10 +60939,10 @@ var import_node_path26 = __toESM(require("node:path"), 1);
|
|
|
60891
60939
|
// ../../packages/core/dist/python/deps.js
|
|
60892
60940
|
var import_node_child_process6 = require("node:child_process");
|
|
60893
60941
|
function parseInlineDependencies(source) {
|
|
60894
|
-
const
|
|
60895
|
-
if (
|
|
60942
|
+
const block2 = /^#\s*\/\/\/\s*script\s*$([\s\S]*?)^#\s*\/\/\/\s*$/m.exec(source);
|
|
60943
|
+
if (block2 === null)
|
|
60896
60944
|
return [];
|
|
60897
|
-
const body = (
|
|
60945
|
+
const body = (block2[1] ?? "").split("\n").map((line) => line.replace(/^#\s?/, "")).join("\n");
|
|
60898
60946
|
const array2 = /dependencies\s*=\s*\[([\s\S]*?)\]/.exec(body);
|
|
60899
60947
|
if (array2 === null)
|
|
60900
60948
|
return [];
|
|
@@ -66265,6 +66313,129 @@ function negotiateRequest(request, signal) {
|
|
|
66265
66313
|
});
|
|
66266
66314
|
}
|
|
66267
66315
|
|
|
66316
|
+
// ../../packages/core/dist/agent/handoff.js
|
|
66317
|
+
var READ_TOOLS = /* @__PURE__ */ new Set(["read_file", "read_many_files", "big_file"]);
|
|
66318
|
+
var WRITE_TOOLS = /* @__PURE__ */ new Set(["write_to_file", "apply_diff", "use_skill_file"]);
|
|
66319
|
+
var COMMAND_TOOLS = /* @__PURE__ */ new Set(["execute_command"]);
|
|
66320
|
+
function argumentsOf(json2) {
|
|
66321
|
+
try {
|
|
66322
|
+
const parsed = JSON.parse(json2);
|
|
66323
|
+
return parsed !== null && typeof parsed === "object" ? parsed : {};
|
|
66324
|
+
} catch {
|
|
66325
|
+
return {};
|
|
66326
|
+
}
|
|
66327
|
+
}
|
|
66328
|
+
function unwrap(name, args) {
|
|
66329
|
+
if (name !== "call_tool" || typeof args["name"] !== "string")
|
|
66330
|
+
return { name, args };
|
|
66331
|
+
const inner = args["arguments"];
|
|
66332
|
+
return { name: args["name"], args: inner !== null && typeof inner === "object" ? inner : {} };
|
|
66333
|
+
}
|
|
66334
|
+
function handoffFacts(messages) {
|
|
66335
|
+
const facts = { userMessages: [], filesRead: [], filesChanged: [], commands: [] };
|
|
66336
|
+
const add = (list, value) => {
|
|
66337
|
+
if (typeof value === "string" && value.trim().length > 0 && !list.includes(value.trim()))
|
|
66338
|
+
list.push(value.trim());
|
|
66339
|
+
};
|
|
66340
|
+
for (const message4 of messages) {
|
|
66341
|
+
if (message4.role === "user") {
|
|
66342
|
+
if (message4.content.trim() !== CONTINUE_PROMPT.trim() && message4.content.trim().length > 0)
|
|
66343
|
+
facts.userMessages.push(message4.content.trim());
|
|
66344
|
+
continue;
|
|
66345
|
+
}
|
|
66346
|
+
if (message4.role !== "assistant")
|
|
66347
|
+
continue;
|
|
66348
|
+
for (const call of message4.toolCalls ?? []) {
|
|
66349
|
+
const { name, args } = unwrap(call.name, argumentsOf(call.arguments));
|
|
66350
|
+
if (READ_TOOLS.has(name)) {
|
|
66351
|
+
add(facts.filesRead, args["path"]);
|
|
66352
|
+
if (Array.isArray(args["files"]))
|
|
66353
|
+
for (const f of args["files"])
|
|
66354
|
+
add(facts.filesRead, f?.path);
|
|
66355
|
+
} else if (WRITE_TOOLS.has(name)) {
|
|
66356
|
+
add(facts.filesChanged, args["path"] ?? args["destination"]);
|
|
66357
|
+
} else if (COMMAND_TOOLS.has(name)) {
|
|
66358
|
+
add(facts.commands, args["command"]);
|
|
66359
|
+
}
|
|
66360
|
+
}
|
|
66361
|
+
}
|
|
66362
|
+
return facts;
|
|
66363
|
+
}
|
|
66364
|
+
var RESULT_CHARS = 1500;
|
|
66365
|
+
function handoffTranscript(messages, maxChars) {
|
|
66366
|
+
const parts = [];
|
|
66367
|
+
for (const message4 of messages) {
|
|
66368
|
+
if (message4.role === "system")
|
|
66369
|
+
continue;
|
|
66370
|
+
if (message4.role === "user")
|
|
66371
|
+
parts.push(`USER:
|
|
66372
|
+
${message4.content}`);
|
|
66373
|
+
else if (message4.role === "assistant") {
|
|
66374
|
+
const calls = (message4.toolCalls ?? []).map((call) => `[tool ${call.name} ${call.arguments.length > 400 ? `${call.arguments.slice(0, 400)}\u2026` : call.arguments}]`);
|
|
66375
|
+
parts.push(`ASSISTANT:
|
|
66376
|
+
${[message4.content, ...calls].filter((part) => part.trim().length > 0).join("\n")}`);
|
|
66377
|
+
} else {
|
|
66378
|
+
const content = message4.content.length > RESULT_CHARS ? `${message4.content.slice(0, RESULT_CHARS)}
|
|
66379
|
+
\u2026 (${String(message4.content.length - RESULT_CHARS)} more characters)` : message4.content;
|
|
66380
|
+
parts.push(`TOOL RESULT:
|
|
66381
|
+
${content}`);
|
|
66382
|
+
}
|
|
66383
|
+
}
|
|
66384
|
+
const whole = parts.join("\n\n");
|
|
66385
|
+
if (whole.length <= maxChars)
|
|
66386
|
+
return whole;
|
|
66387
|
+
const head = Math.floor(maxChars * 0.25);
|
|
66388
|
+
const tail = maxChars - head;
|
|
66389
|
+
return `${whole.slice(0, head)}
|
|
66390
|
+
|
|
66391
|
+
\u2026 [the middle of the conversation is cut here to fit] \u2026
|
|
66392
|
+
|
|
66393
|
+
${whole.slice(whole.length - tail)}`;
|
|
66394
|
+
}
|
|
66395
|
+
var HANDOFF_PROMPT = [
|
|
66396
|
+
"You are handing this work over to a fresh chat, which will start with only what you write now.",
|
|
66397
|
+
"Write a handoff note in Markdown that lets someone continue without the conversation. Use these sections:",
|
|
66398
|
+
"## Goal - what the user is trying to achieve, in their terms.",
|
|
66399
|
+
"## Done so far - what has been completed, and how it was verified.",
|
|
66400
|
+
"## Decisions and constraints - choices made and why, rules the user set, approaches ruled out.",
|
|
66401
|
+
"## Current state - where things stand right now: what works, what is broken, what is half-done.",
|
|
66402
|
+
"## Open questions - anything unresolved or waiting on the user.",
|
|
66403
|
+
"## Next steps - the concrete next actions, in order.",
|
|
66404
|
+
"Name files, functions, commands, settings and error messages exactly. Keep it dense - no pleasantries,",
|
|
66405
|
+
"no restating these instructions. The user's own messages and the files and commands are attached",
|
|
66406
|
+
"separately, verbatim, so do not copy them out; refer to them where it helps."
|
|
66407
|
+
].join("\n");
|
|
66408
|
+
var MAX_QUOTED_MESSAGE = 4e3;
|
|
66409
|
+
var MAX_QUOTED_TOTAL = 24e3;
|
|
66410
|
+
function composeHandoff(note, facts, previousTitle) {
|
|
66411
|
+
const lines = [`# Handoff${previousTitle !== void 0 ? `: ${previousTitle}` : ""}`, "", "This chat continues an earlier one. Pick up from here.", "", note.trim()];
|
|
66412
|
+
if (facts.userMessages.length > 0) {
|
|
66413
|
+
lines.push("", "## What the user asked for, in their words");
|
|
66414
|
+
const kept = [];
|
|
66415
|
+
let total = 0;
|
|
66416
|
+
for (const text of [...facts.userMessages].reverse()) {
|
|
66417
|
+
const clipped = text.length > MAX_QUOTED_MESSAGE ? `${text.slice(0, MAX_QUOTED_MESSAGE)}\u2026` : text;
|
|
66418
|
+
if (total + clipped.length > MAX_QUOTED_TOTAL)
|
|
66419
|
+
break;
|
|
66420
|
+
kept.unshift(clipped);
|
|
66421
|
+
total += clipped.length;
|
|
66422
|
+
}
|
|
66423
|
+
if (kept.length < facts.userMessages.length)
|
|
66424
|
+
lines.push(`(${String(facts.userMessages.length - kept.length)} earlier messages left out to keep this short.)`);
|
|
66425
|
+
for (const text of kept)
|
|
66426
|
+
lines.push("", ...text.split("\n").map((line) => `> ${line}`));
|
|
66427
|
+
}
|
|
66428
|
+
const list = (title, items, code) => {
|
|
66429
|
+
if (items.length === 0)
|
|
66430
|
+
return;
|
|
66431
|
+
lines.push("", `## ${title}`, ...items.map((item) => `- ${code ? `\`${item.replace(/`/g, "'")}\`` : item}`));
|
|
66432
|
+
};
|
|
66433
|
+
list("Files changed", facts.filesChanged, true);
|
|
66434
|
+
list("Files read", facts.filesRead, true);
|
|
66435
|
+
list("Commands run", facts.commands, true);
|
|
66436
|
+
return lines.join("\n");
|
|
66437
|
+
}
|
|
66438
|
+
|
|
66268
66439
|
// ../../packages/core/dist/checkpoints/changeLedger.js
|
|
66269
66440
|
var import_promises21 = require("node:fs/promises");
|
|
66270
66441
|
var ChangeLedger = class {
|
|
@@ -73361,6 +73532,280 @@ function composeUserText(text, extras = {}) {
|
|
|
73361
73532
|
return parts.join("\n\n");
|
|
73362
73533
|
}
|
|
73363
73534
|
|
|
73535
|
+
// ../../packages/core/dist/markdown/parse.js
|
|
73536
|
+
var SAFE_SCHEME = /^(https?:|mailto:)/i;
|
|
73537
|
+
function isSafeHref(href) {
|
|
73538
|
+
const trimmed = href.trim();
|
|
73539
|
+
if (!/^[a-z][a-z0-9+.-]*:/i.test(trimmed))
|
|
73540
|
+
return true;
|
|
73541
|
+
return SAFE_SCHEME.test(trimmed);
|
|
73542
|
+
}
|
|
73543
|
+
var FENCE = /^ {0,3}(`{3,}|~{3,})\s*(\S+)?\s*$/;
|
|
73544
|
+
var HEADING = /^ {0,3}(#{1,6})\s+(.*)$/;
|
|
73545
|
+
var RULE = /^ {0,3}([-*_])(\s*\1){2,}\s*$/;
|
|
73546
|
+
var UNORDERED = /^ {0,3}[-*+]\s+(.*)$/;
|
|
73547
|
+
var ORDERED = /^ {0,3}\d+[.)]\s+(.*)$/;
|
|
73548
|
+
var QUOTE = /^ {0,3}>\s?(.*)$/;
|
|
73549
|
+
var TABLE_ROW = /^ {0,3}\|?(.*\|.*?)\|?\s*$/;
|
|
73550
|
+
var TABLE_DELIMITER = /^ {0,3}\|?\s*:?-{1,}:?\s*(\|\s*:?-{1,}:?\s*)*\|?\s*$/;
|
|
73551
|
+
function parseMarkdown(source) {
|
|
73552
|
+
const lines = source.replace(/\r\n/g, "\n").split("\n");
|
|
73553
|
+
const blocks = [];
|
|
73554
|
+
let index = 0;
|
|
73555
|
+
while (index < lines.length) {
|
|
73556
|
+
const line = lines[index] ?? "";
|
|
73557
|
+
const fence = FENCE.exec(line);
|
|
73558
|
+
if (fence !== null) {
|
|
73559
|
+
const marker = fence[1] ?? "```";
|
|
73560
|
+
const body = [];
|
|
73561
|
+
index += 1;
|
|
73562
|
+
while (index < lines.length) {
|
|
73563
|
+
const candidate = lines[index] ?? "";
|
|
73564
|
+
const closing = FENCE.exec(candidate);
|
|
73565
|
+
if (closing !== null && (closing[1] ?? "").length >= marker.length && (closing[2] ?? "") === "")
|
|
73566
|
+
break;
|
|
73567
|
+
body.push(candidate);
|
|
73568
|
+
index += 1;
|
|
73569
|
+
}
|
|
73570
|
+
index += 1;
|
|
73571
|
+
blocks.push({
|
|
73572
|
+
kind: "code",
|
|
73573
|
+
text: body.join("\n"),
|
|
73574
|
+
...fence[2] !== void 0 ? { language: fence[2] } : {}
|
|
73575
|
+
});
|
|
73576
|
+
continue;
|
|
73577
|
+
}
|
|
73578
|
+
if (line.trim().length === 0) {
|
|
73579
|
+
index += 1;
|
|
73580
|
+
continue;
|
|
73581
|
+
}
|
|
73582
|
+
if (RULE.test(line)) {
|
|
73583
|
+
blocks.push({ kind: "rule" });
|
|
73584
|
+
index += 1;
|
|
73585
|
+
continue;
|
|
73586
|
+
}
|
|
73587
|
+
const heading = HEADING.exec(line);
|
|
73588
|
+
if (heading !== null) {
|
|
73589
|
+
blocks.push({ kind: "heading", level: (heading[1] ?? "#").length, content: parseInline(heading[2] ?? "") });
|
|
73590
|
+
index += 1;
|
|
73591
|
+
continue;
|
|
73592
|
+
}
|
|
73593
|
+
const delimiter = lines[index + 1];
|
|
73594
|
+
if (TABLE_ROW.test(line) && delimiter !== void 0 && TABLE_DELIMITER.test(delimiter)) {
|
|
73595
|
+
const cells = (row) => row.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map((cell) => cell.trim());
|
|
73596
|
+
const head = cells(line).map((cell) => parseInline(cell));
|
|
73597
|
+
const align = cells(delimiter).map((spec) => {
|
|
73598
|
+
const left = spec.startsWith(":");
|
|
73599
|
+
const right = spec.endsWith(":");
|
|
73600
|
+
if (left && right)
|
|
73601
|
+
return "center";
|
|
73602
|
+
if (right)
|
|
73603
|
+
return "right";
|
|
73604
|
+
if (left)
|
|
73605
|
+
return "left";
|
|
73606
|
+
return void 0;
|
|
73607
|
+
});
|
|
73608
|
+
index += 2;
|
|
73609
|
+
const rows = [];
|
|
73610
|
+
while (index < lines.length) {
|
|
73611
|
+
const candidate = lines[index] ?? "";
|
|
73612
|
+
if (candidate.trim().length === 0 || !TABLE_ROW.test(candidate))
|
|
73613
|
+
break;
|
|
73614
|
+
rows.push(cells(candidate).map((cell) => parseInline(cell)));
|
|
73615
|
+
index += 1;
|
|
73616
|
+
}
|
|
73617
|
+
blocks.push({ kind: "table", head, rows, align });
|
|
73618
|
+
continue;
|
|
73619
|
+
}
|
|
73620
|
+
if (QUOTE.test(line)) {
|
|
73621
|
+
const quoted = [];
|
|
73622
|
+
while (index < lines.length) {
|
|
73623
|
+
const match = QUOTE.exec(lines[index] ?? "");
|
|
73624
|
+
if (match === null)
|
|
73625
|
+
break;
|
|
73626
|
+
quoted.push(match[1] ?? "");
|
|
73627
|
+
index += 1;
|
|
73628
|
+
}
|
|
73629
|
+
blocks.push({ kind: "quote", content: parseInline(quoted.join("\n")) });
|
|
73630
|
+
continue;
|
|
73631
|
+
}
|
|
73632
|
+
const isOrdered = ORDERED.test(line);
|
|
73633
|
+
if (isOrdered || UNORDERED.test(line)) {
|
|
73634
|
+
const items = [];
|
|
73635
|
+
while (index < lines.length) {
|
|
73636
|
+
const current = lines[index] ?? "";
|
|
73637
|
+
const match = (isOrdered ? ORDERED : UNORDERED).exec(current);
|
|
73638
|
+
if (match === null)
|
|
73639
|
+
break;
|
|
73640
|
+
items.push(parseInline(match[1] ?? ""));
|
|
73641
|
+
index += 1;
|
|
73642
|
+
}
|
|
73643
|
+
blocks.push({ kind: "list", ordered: isOrdered, items });
|
|
73644
|
+
continue;
|
|
73645
|
+
}
|
|
73646
|
+
const paragraph = [];
|
|
73647
|
+
while (index < lines.length) {
|
|
73648
|
+
const current = lines[index] ?? "";
|
|
73649
|
+
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
|
|
73650
|
+
// ends the paragraph — the same test the table branch uses to recognise one.
|
|
73651
|
+
TABLE_ROW.test(current) && TABLE_DELIMITER.test(lines[index + 1] ?? "")) {
|
|
73652
|
+
break;
|
|
73653
|
+
}
|
|
73654
|
+
paragraph.push(current);
|
|
73655
|
+
index += 1;
|
|
73656
|
+
}
|
|
73657
|
+
blocks.push({ kind: "paragraph", content: parseInline(paragraph.join("\n")) });
|
|
73658
|
+
}
|
|
73659
|
+
return blocks;
|
|
73660
|
+
}
|
|
73661
|
+
var EMPHASIS = String.raw`\S(?:[\s\S]*?\S)?`;
|
|
73662
|
+
var HREF = String.raw`[^()\s]*(?:\([^()\s]*\)[^()\s]*)*`;
|
|
73663
|
+
var INLINE = new RegExp([
|
|
73664
|
+
String.raw`(` + "`" + String.raw`+)([\s\S]*?)\1`,
|
|
73665
|
+
String.raw`\[([^\]]*)\]\((` + HREF + String.raw`)\)`,
|
|
73666
|
+
String.raw`(\*\*|__)(` + EMPHASIS + String.raw`)\5`,
|
|
73667
|
+
String.raw`(~~)(` + EMPHASIS + String.raw`)\7`,
|
|
73668
|
+
String.raw`(\*|_)(` + EMPHASIS + String.raw`)\9`
|
|
73669
|
+
].join("|"));
|
|
73670
|
+
function parseInline(source) {
|
|
73671
|
+
const out = [];
|
|
73672
|
+
let rest = source;
|
|
73673
|
+
while (rest.length > 0) {
|
|
73674
|
+
const match = INLINE.exec(rest);
|
|
73675
|
+
if (match === null || match.index === void 0)
|
|
73676
|
+
break;
|
|
73677
|
+
if (match.index > 0)
|
|
73678
|
+
out.push({ kind: "text", text: rest.slice(0, match.index) });
|
|
73679
|
+
if (match[1] !== void 0) {
|
|
73680
|
+
out.push({ kind: "code", text: (match[2] ?? "").replace(/^ (.*) $/, "$1") });
|
|
73681
|
+
} else if (match[4] !== void 0) {
|
|
73682
|
+
const href = match[4];
|
|
73683
|
+
const children = parseInline(match[3] ?? "");
|
|
73684
|
+
out.push(isSafeHref(href) ? { kind: "link", href, children } : { kind: "text", text: match[0] });
|
|
73685
|
+
} else if (match[5] !== void 0) {
|
|
73686
|
+
out.push({ kind: "strong", children: parseInline(match[6] ?? "") });
|
|
73687
|
+
} else if (match[7] !== void 0) {
|
|
73688
|
+
out.push({ kind: "strike", children: parseInline(match[8] ?? "") });
|
|
73689
|
+
} else if (match[9] !== void 0) {
|
|
73690
|
+
out.push({ kind: "em", children: parseInline(match[10] ?? "") });
|
|
73691
|
+
}
|
|
73692
|
+
rest = rest.slice(match.index + match[0].length);
|
|
73693
|
+
}
|
|
73694
|
+
if (rest.length > 0)
|
|
73695
|
+
out.push({ kind: "text", text: rest });
|
|
73696
|
+
return out;
|
|
73697
|
+
}
|
|
73698
|
+
|
|
73699
|
+
// ../../packages/core/dist/markdown/confluence.js
|
|
73700
|
+
function escape3(text) {
|
|
73701
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
73702
|
+
}
|
|
73703
|
+
function escapeAttribute(text) {
|
|
73704
|
+
return escape3(text).replace(/"/g, """);
|
|
73705
|
+
}
|
|
73706
|
+
var LANGUAGES = {
|
|
73707
|
+
py: "py",
|
|
73708
|
+
python: "py",
|
|
73709
|
+
js: "javascript",
|
|
73710
|
+
javascript: "javascript",
|
|
73711
|
+
jsx: "javascript",
|
|
73712
|
+
ts: "javascript",
|
|
73713
|
+
typescript: "javascript",
|
|
73714
|
+
tsx: "javascript",
|
|
73715
|
+
json: "javascript",
|
|
73716
|
+
sh: "bash",
|
|
73717
|
+
bash: "bash",
|
|
73718
|
+
shell: "bash",
|
|
73719
|
+
zsh: "bash",
|
|
73720
|
+
console: "bash",
|
|
73721
|
+
ps1: "powershell",
|
|
73722
|
+
powershell: "powershell",
|
|
73723
|
+
pwsh: "powershell",
|
|
73724
|
+
sql: "sql",
|
|
73725
|
+
java: "java",
|
|
73726
|
+
kotlin: "java",
|
|
73727
|
+
groovy: "groovy",
|
|
73728
|
+
scala: "scala",
|
|
73729
|
+
xml: "xml",
|
|
73730
|
+
html: "xml",
|
|
73731
|
+
xhtml: "xml",
|
|
73732
|
+
svg: "xml",
|
|
73733
|
+
yaml: "yml",
|
|
73734
|
+
yml: "yml",
|
|
73735
|
+
cs: "c#",
|
|
73736
|
+
csharp: "c#",
|
|
73737
|
+
"c#": "c#",
|
|
73738
|
+
c: "cpp",
|
|
73739
|
+
cpp: "cpp",
|
|
73740
|
+
"c++": "cpp",
|
|
73741
|
+
h: "cpp",
|
|
73742
|
+
css: "css",
|
|
73743
|
+
diff: "diff",
|
|
73744
|
+
patch: "diff",
|
|
73745
|
+
ruby: "ruby",
|
|
73746
|
+
rb: "ruby",
|
|
73747
|
+
perl: "perl",
|
|
73748
|
+
php: "php",
|
|
73749
|
+
vb: "vb",
|
|
73750
|
+
erlang: "erl"
|
|
73751
|
+
};
|
|
73752
|
+
function inline(nodes) {
|
|
73753
|
+
return nodes.map((node) => {
|
|
73754
|
+
switch (node.kind) {
|
|
73755
|
+
case "text":
|
|
73756
|
+
return escape3(node.text).replace(/\n/g, "<br />");
|
|
73757
|
+
case "code":
|
|
73758
|
+
return `<code>${escape3(node.text)}</code>`;
|
|
73759
|
+
case "strong":
|
|
73760
|
+
return `<strong>${inline(node.children)}</strong>`;
|
|
73761
|
+
case "em":
|
|
73762
|
+
return `<em>${inline(node.children)}</em>`;
|
|
73763
|
+
case "strike":
|
|
73764
|
+
return `<span style="text-decoration: line-through;">${inline(node.children)}</span>`;
|
|
73765
|
+
case "link":
|
|
73766
|
+
return isSafeHref(node.href) ? `<a href="${escapeAttribute(node.href)}">${inline(node.children)}</a>` : inline(node.children);
|
|
73767
|
+
}
|
|
73768
|
+
}).join("");
|
|
73769
|
+
}
|
|
73770
|
+
function cdata(text) {
|
|
73771
|
+
return `<![CDATA[${text.replace(/]]>/g, "]]]]><![CDATA[>")}]]>`;
|
|
73772
|
+
}
|
|
73773
|
+
function block(node) {
|
|
73774
|
+
switch (node.kind) {
|
|
73775
|
+
case "heading": {
|
|
73776
|
+
const level = Math.min(Math.max(node.level, 1), 6);
|
|
73777
|
+
return `<h${String(level)}>${inline(node.content)}</h${String(level)}>`;
|
|
73778
|
+
}
|
|
73779
|
+
case "paragraph":
|
|
73780
|
+
return `<p>${inline(node.content)}</p>`;
|
|
73781
|
+
case "list": {
|
|
73782
|
+
const tag = node.ordered ? "ol" : "ul";
|
|
73783
|
+
return `<${tag}>${node.items.map((item) => `<li>${inline(item)}</li>`).join("")}</${tag}>`;
|
|
73784
|
+
}
|
|
73785
|
+
case "quote":
|
|
73786
|
+
return `<blockquote><p>${inline(node.content)}</p></blockquote>`;
|
|
73787
|
+
case "rule":
|
|
73788
|
+
return "<hr />";
|
|
73789
|
+
case "code": {
|
|
73790
|
+
const language = node.language === void 0 ? void 0 : LANGUAGES[node.language.toLowerCase()];
|
|
73791
|
+
return '<ac:structured-macro ac:name="code">' + (language !== void 0 ? `<ac:parameter ac:name="language">${escape3(language)}</ac:parameter>` : "") + `<ac:plain-text-body>${cdata(node.text)}</ac:plain-text-body></ac:structured-macro>`;
|
|
73792
|
+
}
|
|
73793
|
+
case "table": {
|
|
73794
|
+
const cell = (tag, content, index) => {
|
|
73795
|
+
const align = node.align[index];
|
|
73796
|
+
const paragraph = align === void 0 || align === "left" ? `<p>${inline(content)}</p>` : `<p style="text-align: ${align};">${inline(content)}</p>`;
|
|
73797
|
+
return `<${tag}>${paragraph}</${tag}>`;
|
|
73798
|
+
};
|
|
73799
|
+
const head = `<tr>${node.head.map((content, index) => cell("th", content, index)).join("")}</tr>`;
|
|
73800
|
+
const rows = node.rows.map((row) => `<tr>${row.map((content, index) => cell("td", content, index)).join("")}</tr>`).join("");
|
|
73801
|
+
return `<table><tbody>${head}${rows}</tbody></table>`;
|
|
73802
|
+
}
|
|
73803
|
+
}
|
|
73804
|
+
}
|
|
73805
|
+
function markdownToStorage(markdown) {
|
|
73806
|
+
return parseMarkdown(markdown).map(block).join("");
|
|
73807
|
+
}
|
|
73808
|
+
|
|
73364
73809
|
// ../../packages/core/dist/confluence/tools.js
|
|
73365
73810
|
var MAX_IMAGES2 = 6;
|
|
73366
73811
|
var MAX_IMAGE_BYTES2 = 35e5;
|
|
@@ -73493,10 +73938,19 @@ var writeSchema3 = external_exports.object({
|
|
|
73493
73938
|
space: external_exports.string().optional().describe("Space key for a new page. Defaults to the configured space."),
|
|
73494
73939
|
title: external_exports.string().min(1).max(255).optional().describe("Required for a new page. Omit to keep the current title."),
|
|
73495
73940
|
parentId: external_exports.string().optional().describe("Create the new page under this page id."),
|
|
73496
|
-
body: external_exports.string().min(1).optional().describe(`The complete page body \u2014 required for a new page. Omit when updating to change only attachments, e.g. to replace an image by attaching one with the same name. ${STORAGE_GUIDE}`),
|
|
73941
|
+
body: external_exports.string().min(1).optional().describe(`The complete page body in storage format \u2014 or give \`markdown\` instead; one of the two is required for a new page. Omit both when updating to change only attachments, e.g. to replace an image by attaching one with the same name. ${STORAGE_GUIDE}`),
|
|
73942
|
+
markdown: external_exports.string().min(1).optional().describe("The page body as Markdown - the same Markdown you write in the chat - instead of `body`. Prefer it: headings, lists, links, **bold**, `code`, ``` fenced code ``` (shown in the Confluence code macro), > quotes and | tables | with a header row all come out as they look in the chat. Use `body` instead only for what Markdown cannot say - info/note panels, expand blocks, images on the page, a table of contents. Give one of the two, not both."),
|
|
73497
73943
|
attachments: attachmentsSchema("page", "Refer to them in the body by name."),
|
|
73498
73944
|
diagrams: diagramsSchema
|
|
73499
73945
|
});
|
|
73946
|
+
function withStorageBody(input) {
|
|
73947
|
+
if (input.markdown === void 0)
|
|
73948
|
+
return input;
|
|
73949
|
+
if (input.body !== void 0)
|
|
73950
|
+
throw new Error("Give the page as markdown or as body, not both.");
|
|
73951
|
+
const { markdown, ...rest } = input;
|
|
73952
|
+
return { ...rest, body: markdownToStorage(markdown) };
|
|
73953
|
+
}
|
|
73500
73954
|
var REPLACES_ON_PAGE = "REPLACES the attachment of this name on the page";
|
|
73501
73955
|
function describeFiles(files, existingNames) {
|
|
73502
73956
|
return describeUploads(files, existingNames, REPLACES_ON_PAGE);
|
|
@@ -73505,14 +73959,15 @@ function createConfluenceWritePageTool(options) {
|
|
|
73505
73959
|
return {
|
|
73506
73960
|
name: "confluence_write_page",
|
|
73507
73961
|
group: "edit",
|
|
73508
|
-
description: "Create a Confluence page, or update one when given its pageId, with optional attached files and drawn diagrams. A body replaces the whole page, so read an existing page first and edit from its current body. To replace an image, give the pageId and attach a file or diagram with exactly the same name as the existing attachment \u2014 the body can then be left out. Make pages easy to scan: a short summary first, headings, tables for settings, info/note panels for warnings, code blocks for anything to copy, and a diagram where a picture explains the structure faster than prose. Always shown to the user before anything is published." + /*
|
|
73962
|
+
description: "Create a Confluence page, or update one when given its pageId, with optional attached files and drawn diagrams. A body replaces the whole page, so read an existing page first and edit from its current body. To replace an image, give the pageId and attach a file or diagram with exactly the same name as the existing attachment \u2014 the body can then be left out. Write the page as `markdown`, just as you would in the chat, so it looks the same on the page. Make pages easy to scan: a short summary first, headings, tables for settings, info/note panels for warnings (those need `body`), code blocks for anything to copy, and a diagram where a picture explains the structure faster than prose. Always shown to the user before anything is published." + /*
|
|
73509
73963
|
* The default space is stated, not only applied. A model that does not know one is set asks
|
|
73510
73964
|
* the user which space to use — a question the user already answered in Settings. Fixed for
|
|
73511
73965
|
* the session like every description (§12): it changes only when the setting does.
|
|
73512
73966
|
*/
|
|
73513
73967
|
(options.defaultSpace !== void 0 ? ` New pages go to space ${options.defaultSpace} unless the user asks for another \u2014 leave space out for that.` : " No default space is configured, so a new page needs a space key; ask the user if they have not given one."),
|
|
73514
73968
|
parametersSchema: writeSchema3,
|
|
73515
|
-
async preview(
|
|
73969
|
+
async preview(input, context) {
|
|
73970
|
+
const params3 = withStorageBody(input);
|
|
73516
73971
|
const prepared = await prepareUploads(params3, context);
|
|
73517
73972
|
if (params3.pageId !== void 0) {
|
|
73518
73973
|
const client = await options.client();
|
|
@@ -73548,8 +74003,9 @@ ${files2}`
|
|
|
73548
74003
|
note: files
|
|
73549
74004
|
};
|
|
73550
74005
|
},
|
|
73551
|
-
async execute(
|
|
74006
|
+
async execute(input, context) {
|
|
73552
74007
|
try {
|
|
74008
|
+
const params3 = withStorageBody(input);
|
|
73553
74009
|
const prepared = await prepareUploads(params3, context);
|
|
73554
74010
|
if (!prepared.ok)
|
|
73555
74011
|
return { content: prepared.message, isError: true };
|
|
@@ -74627,14 +75083,14 @@ var DEFAULT_MAX_OUTPUT = 2 * 1024 * 1024;
|
|
|
74627
75083
|
function compilePattern(pattern) {
|
|
74628
75084
|
let source = pattern;
|
|
74629
75085
|
let flags = "";
|
|
74630
|
-
const
|
|
74631
|
-
if (
|
|
74632
|
-
source = source.slice(
|
|
74633
|
-
if (
|
|
75086
|
+
const inline2 = /^\(\?([a-z]+)\)/.exec(source);
|
|
75087
|
+
if (inline2 !== null) {
|
|
75088
|
+
source = source.slice(inline2[0].length);
|
|
75089
|
+
if (inline2[1].includes("i"))
|
|
74634
75090
|
flags += "i";
|
|
74635
|
-
if (
|
|
75091
|
+
if (inline2[1].includes("s"))
|
|
74636
75092
|
flags += "s";
|
|
74637
|
-
if (
|
|
75093
|
+
if (inline2[1].includes("m"))
|
|
74638
75094
|
flags += "m";
|
|
74639
75095
|
}
|
|
74640
75096
|
try {
|
|
@@ -76852,27 +77308,69 @@ ${preview.text}` } : {}
|
|
|
76852
77308
|
}
|
|
76853
77309
|
async function handleOpenManagedFile(filePath) {
|
|
76854
77310
|
try {
|
|
76855
|
-
if (ui.openFile === void 0) {
|
|
77311
|
+
if (ui.openFile === void 0 && ui.editsInPanel !== true) {
|
|
76856
77312
|
ui.showWarning("This host cannot open files. The path is shown beside each entry.");
|
|
76857
77313
|
return;
|
|
76858
77314
|
}
|
|
76859
|
-
const roots =
|
|
76860
|
-
python.toolsDirectory(),
|
|
76861
|
-
...skillsDir === void 0 ? [] : [skillsDir],
|
|
76862
|
-
...extraSkillDirs.filter((dir) => dir !== void 0),
|
|
76863
|
-
// Reports a scheduled run wrote. Confined like everything else here: the path arrives
|
|
76864
|
-
// from the UI, which only ever sends one it was given, and "the UI would not do that"
|
|
76865
|
-
// is not a boundary when the result is opening a file in the user's editor.
|
|
76866
|
-
import_node_path47.default.join(storageDir, "reports")
|
|
76867
|
-
];
|
|
77315
|
+
const roots = managedRoots();
|
|
76868
77316
|
if (roots.length === 0)
|
|
76869
77317
|
return;
|
|
77318
|
+
if (ui.editsInPanel === true) {
|
|
77319
|
+
await openInPanelEditor(filePath);
|
|
77320
|
+
return;
|
|
77321
|
+
}
|
|
76870
77322
|
const real = await confineToAny(import_node_path47.default.resolve(filePath), roots);
|
|
76871
|
-
await ui.openFile(real);
|
|
77323
|
+
await ui.openFile?.(real);
|
|
76872
77324
|
} catch (error51) {
|
|
76873
77325
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
76874
77326
|
}
|
|
76875
77327
|
}
|
|
77328
|
+
function managedRoots() {
|
|
77329
|
+
return [
|
|
77330
|
+
python.toolsDirectory(),
|
|
77331
|
+
...skillsDir === void 0 ? [] : [skillsDir],
|
|
77332
|
+
...extraSkillDirs.filter((dir) => dir !== void 0),
|
|
77333
|
+
import_node_path47.default.join(storageDir, "reports")
|
|
77334
|
+
].filter((dir) => dir.length > 0);
|
|
77335
|
+
}
|
|
77336
|
+
function mostlyCrlf(text) {
|
|
77337
|
+
const crlf = text.split("\r\n").length - 1;
|
|
77338
|
+
return crlf > text.split("\n").length - 1 - crlf;
|
|
77339
|
+
}
|
|
77340
|
+
const EDITOR_MAX_BYTES = 2 * 1024 * 1024;
|
|
77341
|
+
async function openInPanelEditor(filePath) {
|
|
77342
|
+
const real = await confineToAny(import_node_path47.default.resolve(filePath), managedRoots());
|
|
77343
|
+
const stat = await import_promises25.default.stat(real);
|
|
77344
|
+
if (stat.size > EDITOR_MAX_BYTES)
|
|
77345
|
+
throw new Error(`${import_node_path47.default.basename(real)} is too large to edit here (${String(Math.round(stat.size / 1024))} KB).`);
|
|
77346
|
+
const raw = await import_promises25.default.readFile(real, "utf8");
|
|
77347
|
+
const crlf = mostlyCrlf(raw);
|
|
77348
|
+
post({ type: "editorFile", path: real, name: import_node_path47.default.basename(real), content: raw.split("\r\n").join("\n"), mtimeMs: stat.mtimeMs, eol: crlf ? "crlf" : "lf" });
|
|
77349
|
+
}
|
|
77350
|
+
async function handleSaveEditorFile(filePath, content, mtimeMs) {
|
|
77351
|
+
try {
|
|
77352
|
+
const real = await confineToAny(import_node_path47.default.resolve(filePath), managedRoots());
|
|
77353
|
+
const current = await import_promises25.default.stat(real).catch(() => void 0);
|
|
77354
|
+
if (current !== void 0 && Math.abs(current.mtimeMs - mtimeMs) > 1) {
|
|
77355
|
+
post({
|
|
77356
|
+
type: "editorSaved",
|
|
77357
|
+
path: real,
|
|
77358
|
+
ok: false,
|
|
77359
|
+
conflict: true,
|
|
77360
|
+
message: `${import_node_path47.default.basename(real)} was changed on disk after you opened it. Copy your text, close the editor, and open it again to see the new version.`
|
|
77361
|
+
});
|
|
77362
|
+
return;
|
|
77363
|
+
}
|
|
77364
|
+
const before = current === void 0 ? "" : await import_promises25.default.readFile(real, "utf8");
|
|
77365
|
+
const crlf = mostlyCrlf(before);
|
|
77366
|
+
await writeFileAtomically(real, crlf ? content.split("\r\n").join("\n").split("\n").join("\r\n") : content);
|
|
77367
|
+
const saved = await import_promises25.default.stat(real);
|
|
77368
|
+
post({ type: "editorSaved", path: real, ok: true, mtimeMs: saved.mtimeMs });
|
|
77369
|
+
await postSkills().catch(() => void 0);
|
|
77370
|
+
} catch (error51) {
|
|
77371
|
+
post({ type: "editorSaved", path: filePath, ok: false, message: error51 instanceof Error ? error51.message : String(error51) });
|
|
77372
|
+
}
|
|
77373
|
+
}
|
|
76876
77374
|
async function handleOpenStandingSkill() {
|
|
76877
77375
|
if (skillsDir === void 0) {
|
|
76878
77376
|
ui.showWarning("Open a folder first \u2014 skills live in the workspace.");
|
|
@@ -78663,6 +79161,83 @@ ${preview.text}` } : {}
|
|
|
78663
79161
|
postPlanProgress();
|
|
78664
79162
|
await postTasks();
|
|
78665
79163
|
}
|
|
79164
|
+
let handoffAbort;
|
|
79165
|
+
async function handleHandoff() {
|
|
79166
|
+
if (handoffAbort !== void 0)
|
|
79167
|
+
return;
|
|
79168
|
+
const progress = (phase, extra = {}) => post({ type: "handoffProgress", phase, ...extra });
|
|
79169
|
+
if (userTurnRunning || scheduledRunInFlight !== void 0) {
|
|
79170
|
+
progress("failed", { message: "A reply is still running. Wait for it to finish, or press Stop, then try again." });
|
|
79171
|
+
return;
|
|
79172
|
+
}
|
|
79173
|
+
const messages = conversation.toArray();
|
|
79174
|
+
if (!messages.some((message4) => message4.role === "user")) {
|
|
79175
|
+
progress("failed", { message: "There is nothing in this chat to hand over yet." });
|
|
79176
|
+
return;
|
|
79177
|
+
}
|
|
79178
|
+
const abort = new AbortController();
|
|
79179
|
+
handoffAbort = abort;
|
|
79180
|
+
try {
|
|
79181
|
+
progress("gathering");
|
|
79182
|
+
await persistActiveTask();
|
|
79183
|
+
const previousTitle = deriveTitle(messages);
|
|
79184
|
+
const facts = handoffFacts(messages);
|
|
79185
|
+
const config2 = await loadSettings();
|
|
79186
|
+
const profile = resolveActiveProfile(config2);
|
|
79187
|
+
const capabilities = withReportedWindow(resolveModelCapabilities(profile.model, profile.modelCapabilities), await reportedWindowFor(config2, profile), profile.modelCapabilities);
|
|
79188
|
+
const provider = createChatProvider(profile, httpClient, authStrategyFor(config2, profile), logger, services.languageModels);
|
|
79189
|
+
let maxChars = Math.max(2e4, Math.floor(capabilities.contextWindow * 0.5 * 3.5));
|
|
79190
|
+
let note = "";
|
|
79191
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
79192
|
+
note = "";
|
|
79193
|
+
let lastPost = 0;
|
|
79194
|
+
progress("writing", { written: 0 });
|
|
79195
|
+
let refused;
|
|
79196
|
+
for await (const chunk of provider.streamChat([
|
|
79197
|
+
{ role: "system", content: HANDOFF_PROMPT },
|
|
79198
|
+
{ role: "user", content: redact(handoffTranscript(messages, maxChars), cachedSecretValues) }
|
|
79199
|
+
], { signal: abort.signal })) {
|
|
79200
|
+
if (chunk.type === "text") {
|
|
79201
|
+
note += chunk.text;
|
|
79202
|
+
if (Date.now() - lastPost > 200) {
|
|
79203
|
+
lastPost = Date.now();
|
|
79204
|
+
progress("writing", { written: note.length });
|
|
79205
|
+
}
|
|
79206
|
+
} else if (chunk.type === "error") {
|
|
79207
|
+
refused = chunk.error;
|
|
79208
|
+
break;
|
|
79209
|
+
}
|
|
79210
|
+
}
|
|
79211
|
+
if (abort.signal.aborted) {
|
|
79212
|
+
progress("cancelled");
|
|
79213
|
+
return;
|
|
79214
|
+
}
|
|
79215
|
+
if (refused !== void 0 && attempt === 0 && isContextOverflow(refused)) {
|
|
79216
|
+
maxChars = Math.floor(maxChars / 2);
|
|
79217
|
+
continue;
|
|
79218
|
+
}
|
|
79219
|
+
if (refused !== void 0)
|
|
79220
|
+
throw new Error(refused);
|
|
79221
|
+
break;
|
|
79222
|
+
}
|
|
79223
|
+
if (note.trim().length === 0)
|
|
79224
|
+
throw new Error("The model replied with nothing, so there is no handoff to start from.");
|
|
79225
|
+
progress("starting");
|
|
79226
|
+
await startNewTask();
|
|
79227
|
+
conversation.addUserMessage(composeHandoff(note, facts, previousTitle));
|
|
79228
|
+
await persistActiveTask();
|
|
79229
|
+
post({ type: "taskRestored", taskId: activeTaskId, entries: toTranscript(conversation.toArray()) });
|
|
79230
|
+
await postTasks();
|
|
79231
|
+
progress("done");
|
|
79232
|
+
} catch (error51) {
|
|
79233
|
+
if (abort.signal.aborted)
|
|
79234
|
+
progress("cancelled");
|
|
79235
|
+
else
|
|
79236
|
+
progress("failed", { message: `The handoff could not be written: ${error51 instanceof Error ? error51.message : String(error51)}. This chat is unchanged.` });
|
|
79237
|
+
} finally {
|
|
79238
|
+
handoffAbort = void 0;
|
|
79239
|
+
}
|
|
79240
|
+
}
|
|
78666
79241
|
async function deleteTask(id) {
|
|
78667
79242
|
await taskStore.delete(id);
|
|
78668
79243
|
if (id === activeTaskId)
|
|
@@ -81055,9 +81630,9 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
81055
81630
|
async function handleClearAtlassianToken(product) {
|
|
81056
81631
|
await secrets.delete(atlassianProduct(product).tokenRef);
|
|
81057
81632
|
const { config: config2 } = await configManager.load();
|
|
81058
|
-
const
|
|
81059
|
-
if (
|
|
81060
|
-
const { tokenRef: _dropped, ...rest } =
|
|
81633
|
+
const block2 = config2[product];
|
|
81634
|
+
if (block2 !== void 0) {
|
|
81635
|
+
const { tokenRef: _dropped, ...rest } = block2;
|
|
81061
81636
|
void _dropped;
|
|
81062
81637
|
await configManager.save("user", { [product]: rest });
|
|
81063
81638
|
}
|
|
@@ -84391,6 +84966,10 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84391
84966
|
reportFailure("deleteTask", deleteTask(message4.id));
|
|
84392
84967
|
} else if (message4.type === "newTask") {
|
|
84393
84968
|
reportFailure("startNewTask", startNewTask());
|
|
84969
|
+
} else if (message4.type === "startHandoff") {
|
|
84970
|
+
reportFailure("handleHandoff", handleHandoff());
|
|
84971
|
+
} else if (message4.type === "cancelHandoff") {
|
|
84972
|
+
handoffAbort?.abort();
|
|
84394
84973
|
} else if (message4.type === "setMode") {
|
|
84395
84974
|
reportFailure("handleSetMode", handleSetMode(message4.modeId));
|
|
84396
84975
|
} else if (message4.type === "setConnectionRetry") {
|
|
@@ -84736,6 +85315,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84736
85315
|
}).then(() => postSkills()).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
84737
85316
|
} else if (message4.type === "openManagedFile") {
|
|
84738
85317
|
reportFailure("handleOpenManagedFile", handleOpenManagedFile(message4.path));
|
|
85318
|
+
} else if (message4.type === "saveEditorFile") {
|
|
85319
|
+
reportFailure("handleSaveEditorFile", handleSaveEditorFile(message4.path, message4.content, message4.mtimeMs));
|
|
84739
85320
|
} else if (message4.type === "deletePythonTool") {
|
|
84740
85321
|
reportFailure("handleDeletePythonTool", handleDeletePythonTool(message4.name, message4.filePath));
|
|
84741
85322
|
} else if (message4.type === "approvePythonTool") {
|
|
@@ -86316,14 +86897,14 @@ function restoreEol(text, eol) {
|
|
|
86316
86897
|
}
|
|
86317
86898
|
|
|
86318
86899
|
// ../../packages/core/dist/tools/applyDiff/match.js
|
|
86319
|
-
function findMatch(fileLines,
|
|
86320
|
-
const searchLines =
|
|
86900
|
+
function findMatch(fileLines, block2) {
|
|
86901
|
+
const searchLines = block2.search.split("\n");
|
|
86321
86902
|
if (searchLines.length === 1 && searchLines[0] === "") {
|
|
86322
86903
|
return { ok: false, reason: "empty-search", message: "SEARCH block is empty." };
|
|
86323
86904
|
}
|
|
86324
|
-
const exact = disambiguateByHint(findRuns(fileLines, searchLines, linesEqual),
|
|
86905
|
+
const exact = disambiguateByHint(findRuns(fileLines, searchLines, linesEqual), block2.startLine);
|
|
86325
86906
|
if (exact.length === 1)
|
|
86326
|
-
return buildMatch(fileLines, searchLines,
|
|
86907
|
+
return buildMatch(fileLines, searchLines, block2.replace, exact[0]);
|
|
86327
86908
|
if (exact.length > 1) {
|
|
86328
86909
|
return {
|
|
86329
86910
|
ok: false,
|
|
@@ -86331,9 +86912,9 @@ function findMatch(fileLines, block) {
|
|
|
86331
86912
|
message: `SEARCH block matches ${exact.length} locations; add more surrounding context to make it unique.`
|
|
86332
86913
|
};
|
|
86333
86914
|
}
|
|
86334
|
-
const ws = disambiguateByHint(findRuns(fileLines, searchLines, whitespaceInsensitiveEqual),
|
|
86915
|
+
const ws = disambiguateByHint(findRuns(fileLines, searchLines, whitespaceInsensitiveEqual), block2.startLine);
|
|
86335
86916
|
if (ws.length === 1)
|
|
86336
|
-
return buildMatch(fileLines, searchLines,
|
|
86917
|
+
return buildMatch(fileLines, searchLines, block2.replace, ws[0]);
|
|
86337
86918
|
if (ws.length > 1) {
|
|
86338
86919
|
return {
|
|
86339
86920
|
ok: false,
|
|
@@ -86342,9 +86923,9 @@ function findMatch(fileLines, block) {
|
|
|
86342
86923
|
};
|
|
86343
86924
|
}
|
|
86344
86925
|
if (searchLines.length >= 5) {
|
|
86345
|
-
const anchors = disambiguateByHint(findAnchorRuns(fileLines, searchLines),
|
|
86926
|
+
const anchors = disambiguateByHint(findAnchorRuns(fileLines, searchLines), block2.startLine);
|
|
86346
86927
|
if (anchors.length === 1)
|
|
86347
|
-
return buildMatch(fileLines, searchLines,
|
|
86928
|
+
return buildMatch(fileLines, searchLines, block2.replace, anchors[0]);
|
|
86348
86929
|
if (anchors.length > 1) {
|
|
86349
86930
|
return {
|
|
86350
86931
|
ok: false,
|
|
@@ -86353,7 +86934,7 @@ function findMatch(fileLines, block) {
|
|
|
86353
86934
|
};
|
|
86354
86935
|
}
|
|
86355
86936
|
}
|
|
86356
|
-
return { ok: false, reason: "not-found", message: `SEARCH block was not found in the file.${contextSnippet(fileLines,
|
|
86937
|
+
return { ok: false, reason: "not-found", message: `SEARCH block was not found in the file.${contextSnippet(fileLines, block2.startLine, searchLines.length)}` };
|
|
86357
86938
|
}
|
|
86358
86939
|
function buildMatch(fileLines, searchLines, replace, start) {
|
|
86359
86940
|
const end = start + searchLines.length - 1;
|
|
@@ -86510,8 +87091,8 @@ function applyDiff(originalContent, diffText) {
|
|
|
86510
87091
|
const eol = detectEol(originalContent);
|
|
86511
87092
|
const lines = normalizeToLf(originalContent).split("\n");
|
|
86512
87093
|
const resolved = [];
|
|
86513
|
-
for (const
|
|
86514
|
-
const match = findMatch(lines,
|
|
87094
|
+
for (const block2 of parsed.blocks) {
|
|
87095
|
+
const match = findMatch(lines, block2);
|
|
86515
87096
|
if (!match.ok) {
|
|
86516
87097
|
return { ok: false, content: originalContent, message: match.message };
|
|
86517
87098
|
}
|
|
@@ -86519,9 +87100,9 @@ function applyDiff(originalContent, diffText) {
|
|
|
86519
87100
|
}
|
|
86520
87101
|
const bottomUp = [...resolved].sort((a, b) => b.startLine - a.startLine);
|
|
86521
87102
|
const nextLines = [...lines];
|
|
86522
|
-
for (const
|
|
86523
|
-
const replaceLines =
|
|
86524
|
-
nextLines.splice(
|
|
87103
|
+
for (const block2 of bottomUp) {
|
|
87104
|
+
const replaceLines = block2.replace.length > 0 ? block2.replace.split("\n") : [""];
|
|
87105
|
+
nextLines.splice(block2.startLine, block2.endLine - block2.startLine + 1, ...replaceLines);
|
|
86525
87106
|
}
|
|
86526
87107
|
return {
|
|
86527
87108
|
ok: true,
|
|
@@ -86925,7 +87506,7 @@ alert about.
|
|
|
86925
87506
|
{
|
|
86926
87507
|
id: "skills",
|
|
86927
87508
|
title: "Skills: teaching it things it cannot work out",
|
|
86928
|
-
keywords: ["skill", "teach", "instructions", "standing", "always", "master skill", "markdown"],
|
|
87509
|
+
keywords: ["skill", "teach", "instructions", "standing", "always", "master skill", "markdown", "edit skill", "editor", "edit standing instructions", "standing instructions", "edit a skill"],
|
|
86929
87510
|
body: `
|
|
86930
87511
|
A skill is markdown with frontmatter (\`name\`, \`description\`), kept in the workspace so it lands
|
|
86931
87512
|
in git and gets reviewed. **Settings \u2192 Skills.**
|
|
@@ -86941,6 +87522,13 @@ standing instructions \u2014 house style, the name of the internal library, how
|
|
|
86941
87522
|
commits. It is paid for on every request, so keep it short. The Skills tab names the skill that
|
|
86942
87523
|
carries this flag, or offers to create one.
|
|
86943
87524
|
|
|
87525
|
+
**Editing a skill, a tool or the standing instructions.** *Open* (Skills tab, Python tab, Usage) opens
|
|
87526
|
+
the file for editing: in VS Code in its own editor; in Fire Code, the browser and JetBrains in Light
|
|
87527
|
+
Code's editor, a full-panel text box with Save (Ctrl+S), Close (Esc) and a Preview for Markdown. A save
|
|
87528
|
+
is refused if the file changed on disk after you opened it - another chat, the agent or a sync wrote
|
|
87529
|
+
it - rather than overwriting that; open it again to see the new version. Editing a Python tool changes
|
|
87530
|
+
its code, so it waits for approval again before it runs. On a shared server only an admin can save.
|
|
87531
|
+
|
|
86944
87532
|
**Folders**: config:skills.dir is the one written to, and config:skills.paths are read-only extras
|
|
86945
87533
|
searched after it. Earlier folders win a name collision and a shadowed skill is reported rather
|
|
86946
87534
|
than dropped.
|
|
@@ -87477,7 +88065,9 @@ There is no tool that changes a job's configuration.
|
|
|
87477
88065
|
"token url",
|
|
87478
88066
|
"client id",
|
|
87479
88067
|
"client secret",
|
|
87480
|
-
"oauth"
|
|
88068
|
+
"oauth",
|
|
88069
|
+
"consumer key",
|
|
88070
|
+
"consumer secret"
|
|
87481
88071
|
],
|
|
87482
88072
|
body: `
|
|
87483
88073
|
**Settings \u2192 DevOps \u2192 AutoSys**: the web services address (for example
|
|
@@ -87490,16 +88080,18 @@ signs in without listing any jobs.
|
|
|
87490
88080
|
token URL ticks "Sign in through the gateway" \u2014 and press the panel's one **Save**, which stores the
|
|
87491
88081
|
site address and the gateway together. Test connection runs against what is saved and says on the
|
|
87492
88082
|
page what it is still waiting for; a refused save is explained there too. Enter the **token URL** (where the token is issued \u2014 usually a
|
|
87493
|
-
different address from the AutoSys API), the **
|
|
87494
|
-
|
|
87495
|
-
|
|
87496
|
-
|
|
88083
|
+
different address from the AutoSys API), the **consumer key** and **consumer secret** (Apigee's names
|
|
88084
|
+
for the client id and secret; the secret is kept in secure storage), and a scope if the gateway asks
|
|
88085
|
+
for one. The token is fetched with those **alone** \u2014 your AutoSys username and password are never sent
|
|
88086
|
+
to the token URL \u2014 kept in memory only, renewed before it expires, and sent with every call to the site
|
|
88087
|
+
address. The **client certificate** comes from Settings \u2192 Network unless you
|
|
87497
88088
|
name one under *Client certificate* (certificate and key, or a PFX, plus a passphrase); the same
|
|
87498
88089
|
certificate is presented to the token URL and to the API. If the token request is refused with 401
|
|
87499
|
-
and the secret is right, switch *How the
|
|
87500
|
-
and a Basic header \u2014 gateways differ. **Gateway token and AutoSys username and password together
|
|
87501
|
-
|
|
87502
|
-
|
|
88090
|
+
and the secret is right, switch *How the consumer key and secret are sent* between the request body
|
|
88091
|
+
and a Basic header \u2014 gateways differ. **Gateway token and AutoSys username and password together** (an AutoSys that wants both, plus the
|
|
88092
|
+
certificate, for job status, details and actions): tick *Also send the AutoSys username and password
|
|
88093
|
+
with each job call (HTTP Basic)* \u2014 it sends the username and password entered above as Basic on every
|
|
88094
|
+
AutoSys call, alongside the gateway's token, and never on the token request. One header holds one value, so the two must go in different headers:
|
|
87503
88095
|
usually the token in a gateway header (Advanced \u2192 *Header the token is sent in*, such as
|
|
87504
88096
|
x-apigee-token) and the Basic sign-in in Authorization, or the other way round with *Header for the
|
|
87505
88097
|
username and password*. The panel warns before saving if both would land in the same one. *Advanced* covers the grant type, where the token and its
|
|
@@ -88082,6 +88674,12 @@ and with \`images\` the pictures on the page \u2014 shown to the model when it c
|
|
|
88082
88674
|
diagrams read as their source), and \`confluence_write_page\`, which creates a page or updates one
|
|
88083
88675
|
given its id, with attached files and drawn diagrams.
|
|
88084
88676
|
|
|
88677
|
+
**Pages look like the chat.** The assistant writes a page as Markdown - the same Markdown a reply
|
|
88678
|
+
uses - and it is converted to Confluence's own format: real headings, tables with a shaded header row,
|
|
88679
|
+
code in Confluence's code macro with highlighting, quotes, lists and links. Raw storage format is still
|
|
88680
|
+
there for what Markdown cannot say (info and note panels, expand blocks, images on the page). The
|
|
88681
|
+
approval shows the converted page, so what you approve is what is published.
|
|
88682
|
+
|
|
88085
88683
|
**Every write asks first.** An update shows a diff against the page as it is now; a new page shows
|
|
88086
88684
|
its whole body; every attachment is listed, and one that **replaces** an existing attachment of the
|
|
88087
88685
|
same name is marked so. Pages are published as you.
|
|
@@ -88309,6 +88907,11 @@ edits made outside the agent (in VS Code, say) are saved with \`hub_sync\` "push
|
|
|
88309
88907
|
"review python tools once"
|
|
88310
88908
|
],
|
|
88311
88909
|
body: `
|
|
88910
|
+
**Editing skills, tools and the standing instructions in Fire Code.** Fire Code has no code editor, so
|
|
88911
|
+
*Open* on a skill or tool (and the standing-instructions button in the Skills tab) opens Light Code's own
|
|
88912
|
+
editor: a full-panel text box with Save (Ctrl+S), Close (Esc) and a Markdown preview. A save is refused if
|
|
88913
|
+
the file changed on disk after it was opened, rather than overwriting that change.
|
|
88914
|
+
|
|
88312
88915
|
**Fire Code** (called Sun Code until 0.6.0, and Sun Light Code before that) is a Windows app holding every codebase you work on,
|
|
88313
88916
|
each with its own Light Code agent. Install with \`npm i -g @chosengeneration/fire-code\` and run
|
|
88314
88917
|
\`fire-code\`. Its data moves across from the old name by itself on first start. The
|
|
@@ -88444,7 +89047,12 @@ flagged as possibly inconsistent); a WAL database with recent changes is read as
|
|
|
88444
89047
|
never blocks a writer. Parallel ranges pay off on heavy work - grouping by several columns, text across
|
|
88445
89048
|
every column - by two to three times on 8 cores; a light filtered count is limited by reading the file.
|
|
88446
89049
|
|
|
88447
|
-
**
|
|
89050
|
+
**Reading a program paused in VS Code's debugger** works from Fire Code too: with a VS Code window open
|
|
89051
|
+
(Light Code 0.166.0 or later installed there), \`read_debug_session\` asks every open VS Code window and
|
|
89052
|
+
reads the one stopped at a breakpoint - call stack, variables, recent output - through the same private
|
|
89053
|
+
link Copilot uses. Read-only: it cannot step or continue. IntelliJ and PyCharm are not supported yet.
|
|
89054
|
+
|
|
89055
|
+
**Not in Fire Code**: editor file pickers \u2014 paths are typed. Fire Code's
|
|
88448
89056
|
Settings \u2192 Export source code saves the whole repository as a zip that builds offline.
|
|
88449
89057
|
`
|
|
88450
89058
|
},
|
|
@@ -88630,7 +89238,14 @@ called at all.
|
|
|
88630
89238
|
"add file to chat",
|
|
88631
89239
|
"copilot",
|
|
88632
89240
|
"select files",
|
|
88633
|
-
"current file"
|
|
89241
|
+
"current file",
|
|
89242
|
+
"handoff",
|
|
89243
|
+
"hand over",
|
|
89244
|
+
"new chat with handoff",
|
|
89245
|
+
"new chat with a handoff",
|
|
89246
|
+
"a handoff",
|
|
89247
|
+
"start fresh",
|
|
89248
|
+
"clean handover"
|
|
88634
89249
|
],
|
|
88635
89250
|
body: `
|
|
88636
89251
|
The token bar under the composer shows where the window is going \u2014 system prompt, tool
|
|
@@ -88645,6 +89260,14 @@ lost; it is just not all in the window at once.
|
|
|
88645
89260
|
**Superseded reads are dropped** \u2014 if a file was read three times, only the latest matters. Repeated
|
|
88646
89261
|
*commands* are not dropped, because running the tests twice gives two real answers.
|
|
88647
89262
|
|
|
89263
|
+
**A new chat with a handoff** (the button beside +, a page with an arrow): when a long chat is near the
|
|
89264
|
+
limit and compacting would blur it, start clean instead. The assistant writes a handoff - the goal, what
|
|
89265
|
+
is done and decided, the current state, open questions and next steps - and a new chat opens with it as
|
|
89266
|
+
its first message. Your own messages are quoted word for word, and the files read and changed and the
|
|
89267
|
+
commands run are listed from the actual tool calls, so nothing important rests on the summary alone. A
|
|
89268
|
+
progress panel shows each step and how much has been written; Cancel stops it, and a failure leaves the
|
|
89269
|
+
chat as it was. The old chat stays in History.
|
|
89270
|
+
|
|
88648
89271
|
**History is compacted only when you say so.** **Compact now** under the token bar summarises the
|
|
88649
89272
|
older part (highlighted near the limit); the stored transcript keeps everything, only what is sent to
|
|
88650
89273
|
the model is shortened, and never in the middle of a tool call. Your own messages are kept **word for
|
|
@@ -88910,9 +89533,22 @@ transcript was written.
|
|
|
88910
89533
|
"dark mode",
|
|
88911
89534
|
"light mode",
|
|
88912
89535
|
"change the colour",
|
|
88913
|
-
"change the color"
|
|
89536
|
+
"change the color",
|
|
89537
|
+
"copy",
|
|
89538
|
+
"paste",
|
|
89539
|
+
"word",
|
|
89540
|
+
"onenote",
|
|
89541
|
+
"copy table",
|
|
89542
|
+
"paste into word",
|
|
89543
|
+
"formatting"
|
|
88914
89544
|
],
|
|
88915
89545
|
body: `
|
|
89546
|
+
**Copying a reply keeps its formatting.** Select part of a reply and press Ctrl+C, or press a reply's
|
|
89547
|
+
**Copy** button for the whole of it: tables (with borders and a header row), headings, lists, quotes
|
|
89548
|
+
and code paste into Word, OneNote, a wiki or an email as they look in the chat - in dark text on a
|
|
89549
|
+
white page, whatever theme the editor uses. The plain-text version is the reply's Markdown, for wikis
|
|
89550
|
+
and Markdown editors.
|
|
89551
|
+
|
|
88916
89552
|
**Settings \u2192 Appearance.**
|
|
88917
89553
|
|
|
88918
89554
|
**Accent colour** (config:ui.accentColor) and **expert colour** (config:ui.expertColor), both hex.
|
|
@@ -90349,14 +90985,14 @@ function matchTag(xml, tag) {
|
|
|
90349
90985
|
}
|
|
90350
90986
|
function parseListing(xml) {
|
|
90351
90987
|
const objects = [];
|
|
90352
|
-
for (const
|
|
90353
|
-
const key2 = matchTag(
|
|
90988
|
+
for (const block2 of xml.split("<Contents>").slice(1)) {
|
|
90989
|
+
const key2 = matchTag(block2, "Key");
|
|
90354
90990
|
if (key2 === void 0)
|
|
90355
90991
|
continue;
|
|
90356
90992
|
objects.push({
|
|
90357
90993
|
key: decodeEntities3(key2),
|
|
90358
|
-
size: Number(matchTag(
|
|
90359
|
-
lastModified: matchTag(
|
|
90994
|
+
size: Number(matchTag(block2, "Size") ?? "0"),
|
|
90995
|
+
lastModified: matchTag(block2, "LastModified") ?? ""
|
|
90360
90996
|
});
|
|
90361
90997
|
}
|
|
90362
90998
|
return objects;
|
|
@@ -91941,6 +92577,12 @@ function createBrowserUi(workspaceRoot, post, fastFs) {
|
|
|
91941
92577
|
* invisible is the same as absent, and the browser can display text perfectly well.
|
|
91942
92578
|
*/
|
|
91943
92579
|
openDocument: async ({ title, content }) => post([`[info] ${title}`, "", content].join("\n")),
|
|
92580
|
+
/*
|
|
92581
|
+
* No editor here: skills, tools and the standing instructions open in the panel's own editor
|
|
92582
|
+
* (Fire Code, the browser, JetBrains). Asked for: "i am not able to edit things like standing
|
|
92583
|
+
* instruction with in fire code".
|
|
92584
|
+
*/
|
|
92585
|
+
editsInPanel: true,
|
|
91944
92586
|
/**
|
|
91945
92587
|
* Reads the file and shows it, since the browser has no editor either.
|
|
91946
92588
|
*
|
|
@@ -92086,6 +92728,11 @@ async function createSession(options) {
|
|
|
92086
92728
|
* on every user's requests.
|
|
92087
92729
|
*/
|
|
92088
92730
|
...options.shared !== true ? { languageModels: createRelayLanguageModels() } : {},
|
|
92731
|
+
/*
|
|
92732
|
+
* A program paused in VS Code's debugger, read through the same relay - asked for so Fire Code can
|
|
92733
|
+
* investigate it. Every open VS Code window is asked. IntelliJ and PyCharm are not yet (deferred).
|
|
92734
|
+
*/
|
|
92735
|
+
...options.shared !== true ? { readDebugSession: createRelayDebugReader() } : {},
|
|
92089
92736
|
...options.sharedWorkspace === true ? { sharedWorkspace: true } : {},
|
|
92090
92737
|
...options.noSchedules === true ? { runsSchedules: false } : {},
|
|
92091
92738
|
...options.siblings !== void 0 && options.siblings.length > 0 ? { siblings: options.siblings } : {},
|