@sjawhar/claude-envoy 4.13.0 → 4.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/AGENTS.md +1 -1
- package/dist/codex-hook.js +138 -95
- package/dist/dispatch.js +138 -95
- package/dist/envoy-channel.js +139 -96
- package/dist/session-hook.js +138 -95
- package/legion/skills/legion-architect/references/design-gate.md +1 -3
- package/legion/skills/legion-oracle/SKILL.md +3 -2
- package/legion/skills/legion-retro/SKILL.md +2 -2
- package/legion/skills/legion-retro/references/learnings.md +0 -2
- package/legion/skills/legion-worker/SKILL.md +1 -0
- package/package.json +1 -1
- package/skills/dispatch-writing-specs/SKILL.md +2 -7
package/dist/envoy-channel.js
CHANGED
|
@@ -36845,10 +36845,24 @@ var CONTENT_IS_MARKDOWN = "content is stored as a Markdown document, which rewri
|
|
|
36845
36845
|
var DOCUMENT_IS_MARKDOWN = "a document holds Markdown, which rewrites other text (a JSONL file's lines come back joined into one paragraph)";
|
|
36846
36846
|
var PATH_KEEPS_BYTES = "path (--path <file>), which stores a file whose path does not end in .md or .markdown as its bytes, unchanged";
|
|
36847
36847
|
var ARTIFACT_CONTENT_NAME_RULE = `${CONTENT_IS_MARKDOWN}, so a document's name ends in .md or .markdown or has no extension, under content and under neither flag alike; upload any other file (.jsonl, .tsv, .json, .txt) with ${PATH_KEEPS_BYTES}.`;
|
|
36848
|
-
var ARTIFACT_NAME_EXISTS_RULE =
|
|
36848
|
+
var ARTIFACT_NAME_EXISTS_RULE = `An upload under the name of a document the owner already holds is refused: it writes that document's next version, over the text it holds. Change a document with dispatch doc-edit. To write the next version, send the upload again with force (--force) and the token of the version it replaces (--precondition-json '{"document":"sha256:\u2026"}', the token dispatch doc-read prints).`;
|
|
36849
36849
|
var ARTIFACT_STORED_TEXT_RULE = `content and content-file hold text Dispatch stores as Markdown, and a text the store would write under another spelling is refused. The refusal prints the text Dispatch stores: send that text. A name that does not end in .md or .markdown has a second way out, which keeps the text as it was written: send it as a file with ${PATH_KEEPS_BYTES}.`;
|
|
36850
36850
|
var NAME_EXTENSION = /\.([^\s.]+)$/u;
|
|
36851
36851
|
var MARKDOWN_EXTENSION = /^(md|markdown)$/i;
|
|
36852
|
+
function preconditionArgument(z) {
|
|
36853
|
+
return z.object({
|
|
36854
|
+
document: z.string({ min: 1 }).describe("Token for the exact canonical document returned by dispatch doc-read.").optional(),
|
|
36855
|
+
blocks: z.array(z.object({
|
|
36856
|
+
id: z.string({ min: 1 }).describe("Stable block id dispatch doc-read --blocks lists."),
|
|
36857
|
+
token: z.string({ min: 1 }).describe("That block's full-state token, including inline marks.")
|
|
36858
|
+
}), { min: 1 }).describe("Every content block this batch changes, each with the token dispatch doc-read --blocks lists.").optional()
|
|
36859
|
+
}).describe("Optional optimistic-concurrency guard; select exactly one of document or blocks.").optional();
|
|
36860
|
+
}
|
|
36861
|
+
function uploadPreconditionArgument(z) {
|
|
36862
|
+
return z.object({
|
|
36863
|
+
document: z.string({ min: 1 }).describe("Token for the exact canonical document returned by dispatch doc-read.")
|
|
36864
|
+
}).describe("The token of the version this upload replaces, which an upload over a document the owner already holds must name; a first upload under a name replaces nothing and names none.").optional();
|
|
36865
|
+
}
|
|
36852
36866
|
function pathKeepsBytesOf(name) {
|
|
36853
36867
|
const extension = NAME_EXTENSION.exec(name.trim())?.[1];
|
|
36854
36868
|
return extension === undefined || !MARKDOWN_EXTENSION.test(extension);
|
|
@@ -37343,13 +37357,7 @@ var dispatchToolSpecs = [
|
|
|
37343
37357
|
type: z.string().describe("Typed block name for retype.").optional(),
|
|
37344
37358
|
attributes: z.unknown().describe("Typed block attributes for retype; a CR LF or a lone carriage return in a string value is written as a line feed.").optional()
|
|
37345
37359
|
}, { strict: true })).describe("Flat tagged edits; an operation takes only the keys below, a misspelled one is refused rather than ignored, and the server validates the fields its op requires."),
|
|
37346
|
-
precondition: z
|
|
37347
|
-
document: z.string({ min: 1 }).describe("Token for the exact canonical document returned by dispatch doc-read.").optional(),
|
|
37348
|
-
blocks: z.array(z.object({
|
|
37349
|
-
id: z.string({ min: 1 }).describe("Stable block id dispatch doc-read --blocks lists."),
|
|
37350
|
-
token: z.string({ min: 1 }).describe("That block's full-state token, including inline marks.")
|
|
37351
|
-
}), { min: 1 }).describe("Every content block this batch changes, each with the token dispatch doc-read --blocks lists.").optional()
|
|
37352
|
-
}).describe("Optional optimistic-concurrency guard; select exactly one of document or blocks.").optional(),
|
|
37360
|
+
precondition: preconditionArgument(z),
|
|
37353
37361
|
summary: z.string().describe("Optional named-version summary.").optional()
|
|
37354
37362
|
}),
|
|
37355
37363
|
validation: documentEditValidation
|
|
@@ -37452,7 +37460,7 @@ var dispatchToolSpecs = [
|
|
|
37452
37460
|
name: "dispatch_artifact",
|
|
37453
37461
|
example: { issue: "DSP-1", name: "design.md", content: `# Design
|
|
37454
37462
|
` },
|
|
37455
|
-
description: "Attach a local file or inline text as an issue artifact or project document, or make an empty document from its name alone. Do not use it to edit a live document; use " + "dispatch doc-edit instead. Never upload a document's own name to change it (spec.md replaces the spec whole); edit it with dispatch doc-edit. " + `${ARTIFACT_SOURCE_RULE} ` + `${ARTIFACT_NAME_EXISTS_RULE} A call that stores nothing - no path, and content absent or blank - is refused under a held name even with force, so a title typed twice never empties the document that holds it. ` + "A markdown document is at most 1 MiB and any other file at most 25 MiB. " + `${ARTIFACT_CONTENT_NAME_RULE} ${ARTIFACT_STORED_TEXT_RULE} ` + "Markdown is also refused with 413 CAP_EXCEEDED when it makes more than 65,536 elements (a block weighs 3, and an empty list item, quote, footnote definition or typed block 3 more for the empty paragraph it holds; a table cell 4, a hard line break 3, an image 3, a piece of inline HTML 2, an autolink 2, a footnote reference 2; inline syntax, marks, lines of text and backslash escapes or character references 1 each), or when a new version would leave the document's stored markdown (what its text reads back as) longer than 1 MiB or making more than 65,536 elements, and longer or heavier than before; shorten it or split it across documents. " + "In a table row, write every | in a cell as \\|, in code too: a | after two backslashes ends the cell, and a row with more cells than its table is refused. " + "Markdown holding an ask block whose body breaks its content rule (one or more question paragraphs, then at most one bullet list of options, last) is refused with 400 INVALID_ASK_BLOCK; a new version of a document is held to it only for the asks it writes or changes. " + `${CI_CHECK_RULE} ` + `${OWNER_REFERENCE}`,
|
|
37463
|
+
description: "Attach a local file or inline text as an issue artifact or project document, or make an empty document from its name alone. Do not use it to edit a live document; use " + "dispatch doc-edit instead. Never upload a document's own name to change it (spec.md replaces the spec whole); edit it with dispatch doc-edit. " + `${ARTIFACT_SOURCE_RULE} ` + `${ARTIFACT_NAME_EXISTS_RULE} A call that stores nothing - no path, and content absent or blank - is refused under a held name even with force and a token, so a title typed twice never empties the document that holds it; that refusal names no token, since no token makes such a call one Dispatch takes. ` + "A markdown document is at most 1 MiB and any other file at most 25 MiB. " + "An upload that replaces a document the owner already holds under that name says which version it replaces: precondition.document takes the document token dispatch doc-read prints as `Document token: sha256:\u2026`, and an upload that names none is refused with 400 PRECONDITION_REQUIRED. A token behind the live document is refused with 409 PRECONDITION_FAILED. The refusal tells you to read the document again with dispatch doc-read, which prints the token the document carries now, and to upload again naming that token. A first upload under a name replaces no version, and a file that is not a document holds no token, so neither names one. " + `${ARTIFACT_CONTENT_NAME_RULE} ${ARTIFACT_STORED_TEXT_RULE} ` + "Markdown is also refused with 413 CAP_EXCEEDED when it makes more than 65,536 elements (a block weighs 3, and an empty list item, quote, footnote definition or typed block 3 more for the empty paragraph it holds; a table cell 4, a hard line break 3, an image 3, a piece of inline HTML 2, an autolink 2, a footnote reference 2; inline syntax, marks, lines of text and backslash escapes or character references 1 each), or when a new version would leave the document's stored markdown (what its text reads back as) longer than 1 MiB or making more than 65,536 elements, and longer or heavier than before; shorten it or split it across documents. " + "In a table row, write every | in a cell as \\|, in code too: a | after two backslashes ends the cell, and a row with more cells than its table is refused. " + "Markdown holding an ask block whose body breaks its content rule (one or more question paragraphs, then at most one bullet list of options, last) is refused with 400 INVALID_ASK_BLOCK; a new version of a document is held to it only for the asks it writes or changes. " + `${CI_CHECK_RULE} ` + `${OWNER_REFERENCE}`,
|
|
37456
37464
|
arguments: (z) => ({
|
|
37457
37465
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
37458
37466
|
project: z.string().describe("Project key for an unlinked document.").optional(),
|
|
@@ -37460,6 +37468,7 @@ var dispatchToolSpecs = [
|
|
|
37460
37468
|
path: z.string().describe("Local path to the file to upload.").optional(),
|
|
37461
37469
|
content: z.string().describe("Inline text to store as a Markdown document, under a name ending in .md or .markdown or with no extension. The command refuses a text the store would write under another spelling, a CR LF or a lone carriage return among them, which Dispatch stores as a line feed. A missing line feed at the end is not such a text: Dispatch adds one, and the upload goes on. The refusal prints the text Dispatch stores, which is the text to send.").optional(),
|
|
37462
37470
|
force: z.boolean().describe("Write the next version of a document the owner already holds under this name; without it the upload of a name that exists is refused.").optional(),
|
|
37471
|
+
precondition: uploadPreconditionArgument(z),
|
|
37463
37472
|
summary: z.string().describe("Optional version summary.").optional()
|
|
37464
37473
|
}),
|
|
37465
37474
|
validation: {
|
|
@@ -44247,6 +44256,8 @@ class DispatchClient {
|
|
|
44247
44256
|
form.set("name", input.name);
|
|
44248
44257
|
if (input.summary !== undefined)
|
|
44249
44258
|
form.set("summary", input.summary);
|
|
44259
|
+
if (input.precondition !== undefined)
|
|
44260
|
+
form.set("precondition", JSON.stringify(input.precondition));
|
|
44250
44261
|
if (input.actor !== undefined)
|
|
44251
44262
|
form.set("actor", JSON.stringify(input.actor));
|
|
44252
44263
|
form.set("file", input.file, input.name);
|
|
@@ -47681,6 +47692,10 @@ function optionalNumber(args, name) {
|
|
|
47681
47692
|
const value = args[name];
|
|
47682
47693
|
return typeof value === "number" ? value : undefined;
|
|
47683
47694
|
}
|
|
47695
|
+
function optionalPrecondition(args) {
|
|
47696
|
+
const { precondition } = args;
|
|
47697
|
+
return precondition;
|
|
47698
|
+
}
|
|
47684
47699
|
function defined(name, value) {
|
|
47685
47700
|
return value === undefined ? {} : { [name]: value };
|
|
47686
47701
|
}
|
|
@@ -48815,6 +48830,25 @@ function movedApprovalClauses(documents) {
|
|
|
48815
48830
|
function movedApprovalDocuments(documents) {
|
|
48816
48831
|
return documents.filter((document) => document.requested_version < document.version);
|
|
48817
48832
|
}
|
|
48833
|
+
function standingReviewLines(advice) {
|
|
48834
|
+
const review = advice?.standing_review;
|
|
48835
|
+
if (review === undefined)
|
|
48836
|
+
return [];
|
|
48837
|
+
const carriedFrom = review.carried_from_version;
|
|
48838
|
+
if (carriedFrom !== undefined) {
|
|
48839
|
+
return [
|
|
48840
|
+
`${review.by}'s approval of this issue's spec was carried forward from the approval of version ${carriedFrom}, and Dispatch recorded that carry on ${review.at}.`,
|
|
48841
|
+
"Say what changed since that review in a reply on this ask."
|
|
48842
|
+
];
|
|
48843
|
+
}
|
|
48844
|
+
const verb = review.state === "approved" ? "approved" : "asked for changes on";
|
|
48845
|
+
const opening = `${review.by} ${verb} this issue's spec at version ${review.version} on ${review.at}`;
|
|
48846
|
+
const reason = review.reason ?? "";
|
|
48847
|
+
return [
|
|
48848
|
+
reason === "" ? `${opening}, and gave no reason.` : `${opening}: ${JSON.stringify(reason)}`,
|
|
48849
|
+
"Say what changed since that review in a reply on this ask."
|
|
48850
|
+
];
|
|
48851
|
+
}
|
|
48818
48852
|
function renderAdvice(tool, key, advice, opts) {
|
|
48819
48853
|
if (advice === undefined)
|
|
48820
48854
|
return [];
|
|
@@ -50444,6 +50478,7 @@ async function askCommand(context) {
|
|
|
50444
50478
|
text: stringArg(args, "question"),
|
|
50445
50479
|
linkBase
|
|
50446
50480
|
});
|
|
50481
|
+
const reviewLines = await otherAdviceLines(() => standingReviewLines(ask.advice));
|
|
50447
50482
|
const declinedLines = ask.issue_key === null ? [] : declinedAskLines(ask.advice, ask.issue_key, linkBase);
|
|
50448
50483
|
const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, askOwner.label, ask.advice, {}));
|
|
50449
50484
|
const asked = waitsOnPerson(ask);
|
|
@@ -50451,6 +50486,7 @@ async function askCommand(context) {
|
|
|
50451
50486
|
text: [
|
|
50452
50487
|
`Asked ${ask.id} on ${askOwner.label} (urgency ${ask.urgency})${asked === undefined ? "" : `, waiting on ${asked}`}: ${ask.question}`,
|
|
50453
50488
|
...checkLines,
|
|
50489
|
+
...reviewLines,
|
|
50454
50490
|
...declinedLines,
|
|
50455
50491
|
await followsAsk(askOwner, input.subscriptions),
|
|
50456
50492
|
...adviceLines
|
|
@@ -50725,6 +50761,91 @@ import { resolve as resolvePath2 } from "path";
|
|
|
50725
50761
|
// ../contracts/src/go-blank.ts
|
|
50726
50762
|
var goBlankPattern = /^[\t\n\v\f\r \u0085\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*$/u;
|
|
50727
50763
|
|
|
50764
|
+
// ../envoy-client/src/dispatch-commands/upload-checks.ts
|
|
50765
|
+
function artifactUnderName(artifacts, name) {
|
|
50766
|
+
const written = name.trim();
|
|
50767
|
+
return artifacts.find((held) => held.slug === written) ?? artifacts.find((held) => held.name === written);
|
|
50768
|
+
}
|
|
50769
|
+
function artifactNameExistsProblem(held, owner) {
|
|
50770
|
+
const versions = held.versions ?? [];
|
|
50771
|
+
const newest = versions[versions.length - 1];
|
|
50772
|
+
if (newest === undefined) {
|
|
50773
|
+
return `${owner} already holds ${held.name} (slug ${held.slug}, kind ${held.kind}), which has no version yet and which ${actorText(held.created_by)} created. ${ARTIFACT_NAME_EXISTS_RULE}`;
|
|
50774
|
+
}
|
|
50775
|
+
const authors = (newest.authors ?? []).map(actorText);
|
|
50776
|
+
const wroteIt = authors.length === 0 ? actorText(held.created_by) : authors.join(" and ");
|
|
50777
|
+
return `${owner} already holds ${held.name} (slug ${held.slug}, kind ${held.kind}) at version ${newest.number}, which ${wroteIt} wrote. ${ARTIFACT_NAME_EXISTS_RULE}`;
|
|
50778
|
+
}
|
|
50779
|
+
var STORED_LINE_QUOTED = 200;
|
|
50780
|
+
function quotedStoredLine(line) {
|
|
50781
|
+
if (line.length <= STORED_LINE_QUOTED)
|
|
50782
|
+
return JSON.stringify(line);
|
|
50783
|
+
const head = JSON.stringify(line.slice(0, STORED_LINE_QUOTED));
|
|
50784
|
+
return `${head} (cut after ${STORED_LINE_QUOTED} of its ${line.length} characters)`;
|
|
50785
|
+
}
|
|
50786
|
+
function firstStoredDifference(given, stored) {
|
|
50787
|
+
const written = given.split(`
|
|
50788
|
+
`);
|
|
50789
|
+
const holds = stored.split(`
|
|
50790
|
+
`);
|
|
50791
|
+
for (let line = 0;line < Math.max(written.length, holds.length); line += 1) {
|
|
50792
|
+
const wrote = written[line];
|
|
50793
|
+
const held = holds[line];
|
|
50794
|
+
if (wrote === held)
|
|
50795
|
+
continue;
|
|
50796
|
+
if (wrote === undefined && held !== undefined) {
|
|
50797
|
+
return `the store writes a line ${line + 1}, ${quotedStoredLine(held)}`;
|
|
50798
|
+
}
|
|
50799
|
+
if (held === undefined && wrote !== undefined) {
|
|
50800
|
+
return `the store drops line ${line + 1}, ${quotedStoredLine(wrote)}`;
|
|
50801
|
+
}
|
|
50802
|
+
if (wrote !== undefined && held !== undefined) {
|
|
50803
|
+
return `line ${line + 1} reads ${quotedStoredLine(wrote)} and is stored as ${quotedStoredLine(held)}`;
|
|
50804
|
+
}
|
|
50805
|
+
}
|
|
50806
|
+
return "the stored text differs from the text given";
|
|
50807
|
+
}
|
|
50808
|
+
var STORED_TEXT_PRINTED = 2000;
|
|
50809
|
+
function storedTextPrinted(stored) {
|
|
50810
|
+
if (stored.length <= STORED_TEXT_PRINTED)
|
|
50811
|
+
return { text: stored, cut: "" };
|
|
50812
|
+
const head = stored.slice(0, STORED_TEXT_PRINTED);
|
|
50813
|
+
const lastLineFeed = head.lastIndexOf(`
|
|
50814
|
+
`);
|
|
50815
|
+
const text = lastLineFeed === -1 ? head : head.slice(0, lastLineFeed + 1);
|
|
50816
|
+
return {
|
|
50817
|
+
text,
|
|
50818
|
+
cut: ` The text below is cut after ${text.length} of its ${stored.length} characters: change the line named above and send the text again.`
|
|
50819
|
+
};
|
|
50820
|
+
}
|
|
50821
|
+
function storedTextProblem(given, stored, name) {
|
|
50822
|
+
const asBytes = pathKeepsBytesOf(name) ? ` To keep the text as you wrote it, send it as a file with ${PATH_KEEPS_BYTES}.` : "";
|
|
50823
|
+
const printed = storedTextPrinted(stored);
|
|
50824
|
+
return [
|
|
50825
|
+
`Dispatch stores this text under another spelling: ${firstStoredDifference(given, stored)}.`,
|
|
50826
|
+
` Send the text Dispatch stores, which is between the two marker lines below.${asBytes}`,
|
|
50827
|
+
`${printed.cut}
|
|
50828
|
+
--- the text Dispatch stores ---
|
|
50829
|
+
${printed.text}`,
|
|
50830
|
+
"--- end of the text Dispatch stores ---"
|
|
50831
|
+
].join("");
|
|
50832
|
+
}
|
|
50833
|
+
function storedTextCheckFailed(error, name) {
|
|
50834
|
+
const failure = `Dispatch could not say how it would store this text, so nothing was uploaded: POST /api/v1/markdown/round-trip failed with ${messageFor(error)}.`;
|
|
50835
|
+
if (!dispatchAnswered(error, 413)) {
|
|
50836
|
+
return `${failure} Send the upload again once that call is answered.`;
|
|
50837
|
+
}
|
|
50838
|
+
const asBytes = pathKeepsBytesOf(name) ? ` Send it as a file with ${PATH_KEEPS_BYTES}, which asks this check nothing.` : "";
|
|
50839
|
+
return `${failure} This text is longer than the check reads, and sending the upload again does not change that: a markdown document is at most 1 MiB, so shorten it or split it across documents of at most that.${asBytes}`;
|
|
50840
|
+
}
|
|
50841
|
+
function roundTripRouteAbsent(error) {
|
|
50842
|
+
return dispatchAnswered(error, 404) || dispatchAnswered(error, 405);
|
|
50843
|
+
}
|
|
50844
|
+
function withoutFinalLineFeed(text) {
|
|
50845
|
+
return text.endsWith(`
|
|
50846
|
+
`) ? text.slice(0, -1) : text;
|
|
50847
|
+
}
|
|
50848
|
+
|
|
50728
50849
|
// ../envoy-client/src/dispatch-commands/documents.ts
|
|
50729
50850
|
async function blockAsks(client, resolved, state) {
|
|
50730
50851
|
const asks = await (resolved.issue === undefined ? client.getArtifactAsks(resolved.artifact.id, state) : client.listIssueAsks(resolved.issue.key, state));
|
|
@@ -50904,8 +51025,7 @@ async function docEditCommand(context) {
|
|
|
50904
51025
|
const resolved = await resolveDocument(documentOwner(), optionalString(args, "artifact"));
|
|
50905
51026
|
const ops = args.ops;
|
|
50906
51027
|
const summary = optionalString(args, "summary");
|
|
50907
|
-
const
|
|
50908
|
-
const precondition = rawPrecondition;
|
|
51028
|
+
const precondition = optionalPrecondition(args);
|
|
50909
51029
|
await refuseRemovingOpenDecisionBlocks(client, input.tool, resolved, ops);
|
|
50910
51030
|
const edited = await client.docEdit(resolved.artifact.id, {
|
|
50911
51031
|
ops,
|
|
@@ -51085,96 +51205,19 @@ async function planApproveCommand(context) {
|
|
|
51085
51205
|
}
|
|
51086
51206
|
};
|
|
51087
51207
|
}
|
|
51088
|
-
function artifactUnderName(artifacts, name) {
|
|
51089
|
-
const written = name.trim();
|
|
51090
|
-
return artifacts.find((held) => held.slug === written) ?? artifacts.find((held) => held.name === written);
|
|
51091
|
-
}
|
|
51092
|
-
function artifactNameExistsProblem(held, owner) {
|
|
51093
|
-
const versions = held.versions ?? [];
|
|
51094
|
-
const newest = versions[versions.length - 1];
|
|
51095
|
-
if (newest === undefined) {
|
|
51096
|
-
return `${owner} already holds ${held.name} (slug ${held.slug}, kind ${held.kind}), which has no version yet and which ${actorText(held.created_by)} created. ${ARTIFACT_NAME_EXISTS_RULE}`;
|
|
51097
|
-
}
|
|
51098
|
-
const authors = (newest.authors ?? []).map(actorText);
|
|
51099
|
-
const wroteIt = authors.length === 0 ? actorText(held.created_by) : authors.join(" and ");
|
|
51100
|
-
return `${owner} already holds ${held.name} (slug ${held.slug}, kind ${held.kind}) at version ${newest.number}, which ${wroteIt} wrote. ${ARTIFACT_NAME_EXISTS_RULE}`;
|
|
51101
|
-
}
|
|
51102
|
-
var STORED_LINE_QUOTED = 200;
|
|
51103
|
-
function quotedStoredLine(line) {
|
|
51104
|
-
if (line.length <= STORED_LINE_QUOTED)
|
|
51105
|
-
return JSON.stringify(line);
|
|
51106
|
-
const head = JSON.stringify(line.slice(0, STORED_LINE_QUOTED));
|
|
51107
|
-
return `${head} (cut after ${STORED_LINE_QUOTED} of its ${line.length} characters)`;
|
|
51108
|
-
}
|
|
51109
|
-
function firstStoredDifference(given, stored) {
|
|
51110
|
-
const written = given.split(`
|
|
51111
|
-
`);
|
|
51112
|
-
const holds = stored.split(`
|
|
51113
|
-
`);
|
|
51114
|
-
for (let line = 0;line < Math.max(written.length, holds.length); line += 1) {
|
|
51115
|
-
const wrote = written[line];
|
|
51116
|
-
const held = holds[line];
|
|
51117
|
-
if (wrote === held)
|
|
51118
|
-
continue;
|
|
51119
|
-
if (wrote === undefined && held !== undefined) {
|
|
51120
|
-
return `the store writes a line ${line + 1}, ${quotedStoredLine(held)}`;
|
|
51121
|
-
}
|
|
51122
|
-
if (held === undefined && wrote !== undefined) {
|
|
51123
|
-
return `the store drops line ${line + 1}, ${quotedStoredLine(wrote)}`;
|
|
51124
|
-
}
|
|
51125
|
-
if (wrote !== undefined && held !== undefined) {
|
|
51126
|
-
return `line ${line + 1} reads ${quotedStoredLine(wrote)} and is stored as ${quotedStoredLine(held)}`;
|
|
51127
|
-
}
|
|
51128
|
-
}
|
|
51129
|
-
return "the stored text differs from the text given";
|
|
51130
|
-
}
|
|
51131
|
-
var STORED_TEXT_PRINTED = 2000;
|
|
51132
|
-
function storedTextPrinted(stored) {
|
|
51133
|
-
if (stored.length <= STORED_TEXT_PRINTED)
|
|
51134
|
-
return { text: stored, cut: "" };
|
|
51135
|
-
const head = stored.slice(0, STORED_TEXT_PRINTED);
|
|
51136
|
-
const lastLineFeed = head.lastIndexOf(`
|
|
51137
|
-
`);
|
|
51138
|
-
const text = lastLineFeed === -1 ? head : head.slice(0, lastLineFeed + 1);
|
|
51139
|
-
return {
|
|
51140
|
-
text,
|
|
51141
|
-
cut: ` The text below is cut after ${text.length} of its ${stored.length} characters: change the line named above and send the text again.`
|
|
51142
|
-
};
|
|
51143
|
-
}
|
|
51144
|
-
function storedTextProblem(given, stored, name) {
|
|
51145
|
-
const asBytes = pathKeepsBytesOf(name) ? ` To keep the text as you wrote it, send it as a file with ${PATH_KEEPS_BYTES}.` : "";
|
|
51146
|
-
const printed = storedTextPrinted(stored);
|
|
51147
|
-
return [
|
|
51148
|
-
`Dispatch stores this text under another spelling: ${firstStoredDifference(given, stored)}.`,
|
|
51149
|
-
` Send the text Dispatch stores, which is between the two marker lines below.${asBytes}`,
|
|
51150
|
-
`${printed.cut}
|
|
51151
|
-
--- the text Dispatch stores ---
|
|
51152
|
-
${printed.text}`,
|
|
51153
|
-
"--- end of the text Dispatch stores ---"
|
|
51154
|
-
].join("");
|
|
51155
|
-
}
|
|
51156
|
-
function storedTextCheckFailed(error, name) {
|
|
51157
|
-
const failure = `Dispatch could not say how it would store this text, so nothing was uploaded: POST /api/v1/markdown/round-trip failed with ${messageFor(error)}.`;
|
|
51158
|
-
if (!dispatchAnswered(error, 413)) {
|
|
51159
|
-
return `${failure} Send the upload again once that call is answered.`;
|
|
51160
|
-
}
|
|
51161
|
-
const asBytes = pathKeepsBytesOf(name) ? ` Send it as a file with ${PATH_KEEPS_BYTES}, which asks this check nothing.` : "";
|
|
51162
|
-
return `${failure} This text is longer than the check reads, and sending the upload again does not change that: a markdown document is at most 1 MiB, so shorten it or split it across documents of at most that.${asBytes}`;
|
|
51163
|
-
}
|
|
51164
|
-
function roundTripRouteAbsent(error) {
|
|
51165
|
-
return dispatchAnswered(error, 404) || dispatchAnswered(error, 405);
|
|
51166
|
-
}
|
|
51167
|
-
function withoutFinalLineFeed(text) {
|
|
51168
|
-
return text.endsWith(`
|
|
51169
|
-
`) ? text.slice(0, -1) : text;
|
|
51170
|
-
}
|
|
51171
51208
|
async function artifactCommand(context) {
|
|
51172
51209
|
const { args, client, actor, input, documentOwner, issue } = context;
|
|
51173
51210
|
const summary = optionalString(args, "summary");
|
|
51174
51211
|
const name = stringArg(args, "name");
|
|
51175
51212
|
const content = optionalString(args, "content");
|
|
51176
51213
|
const path = optionalString(args, "path");
|
|
51177
|
-
const
|
|
51214
|
+
const precondition = optionalPrecondition(args);
|
|
51215
|
+
const options = {
|
|
51216
|
+
name,
|
|
51217
|
+
...summary === undefined ? {} : { summary },
|
|
51218
|
+
...precondition === undefined ? {} : { precondition },
|
|
51219
|
+
actor
|
|
51220
|
+
};
|
|
51178
51221
|
const artifactOwner = documentOwner();
|
|
51179
51222
|
const blank = content === undefined || goBlankPattern.test(content);
|
|
51180
51223
|
if ((path !== undefined || !blank) && optionalBoolean(args, "force") !== true) {
|
|
@@ -58487,7 +58530,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
58487
58530
|
|
|
58488
58531
|
// package.json
|
|
58489
58532
|
var name2 = "@sjawhar/claude-envoy";
|
|
58490
|
-
var version2 = "4.
|
|
58533
|
+
var version2 = "4.14.1";
|
|
58491
58534
|
var legion = {
|
|
58492
58535
|
daemonApiVersion: 178
|
|
58493
58536
|
};
|