@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/session-hook.js
CHANGED
|
@@ -14270,10 +14270,24 @@ var CONTENT_IS_MARKDOWN = "content is stored as a Markdown document, which rewri
|
|
|
14270
14270
|
var DOCUMENT_IS_MARKDOWN = "a document holds Markdown, which rewrites other text (a JSONL file's lines come back joined into one paragraph)";
|
|
14271
14271
|
var PATH_KEEPS_BYTES = "path (--path <file>), which stores a file whose path does not end in .md or .markdown as its bytes, unchanged";
|
|
14272
14272
|
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}.`;
|
|
14273
|
-
var ARTIFACT_NAME_EXISTS_RULE =
|
|
14273
|
+
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).`;
|
|
14274
14274
|
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}.`;
|
|
14275
14275
|
var NAME_EXTENSION = /\.([^\s.]+)$/u;
|
|
14276
14276
|
var MARKDOWN_EXTENSION = /^(md|markdown)$/i;
|
|
14277
|
+
function preconditionArgument(z) {
|
|
14278
|
+
return z.object({
|
|
14279
|
+
document: z.string({ min: 1 }).describe("Token for the exact canonical document returned by dispatch doc-read.").optional(),
|
|
14280
|
+
blocks: z.array(z.object({
|
|
14281
|
+
id: z.string({ min: 1 }).describe("Stable block id dispatch doc-read --blocks lists."),
|
|
14282
|
+
token: z.string({ min: 1 }).describe("That block's full-state token, including inline marks.")
|
|
14283
|
+
}), { min: 1 }).describe("Every content block this batch changes, each with the token dispatch doc-read --blocks lists.").optional()
|
|
14284
|
+
}).describe("Optional optimistic-concurrency guard; select exactly one of document or blocks.").optional();
|
|
14285
|
+
}
|
|
14286
|
+
function uploadPreconditionArgument(z) {
|
|
14287
|
+
return z.object({
|
|
14288
|
+
document: z.string({ min: 1 }).describe("Token for the exact canonical document returned by dispatch doc-read.")
|
|
14289
|
+
}).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();
|
|
14290
|
+
}
|
|
14277
14291
|
function pathKeepsBytesOf(name) {
|
|
14278
14292
|
const extension = NAME_EXTENSION.exec(name.trim())?.[1];
|
|
14279
14293
|
return extension === undefined || !MARKDOWN_EXTENSION.test(extension);
|
|
@@ -14768,13 +14782,7 @@ var dispatchToolSpecs = [
|
|
|
14768
14782
|
type: z.string().describe("Typed block name for retype.").optional(),
|
|
14769
14783
|
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()
|
|
14770
14784
|
}, { 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."),
|
|
14771
|
-
precondition: z
|
|
14772
|
-
document: z.string({ min: 1 }).describe("Token for the exact canonical document returned by dispatch doc-read.").optional(),
|
|
14773
|
-
blocks: z.array(z.object({
|
|
14774
|
-
id: z.string({ min: 1 }).describe("Stable block id dispatch doc-read --blocks lists."),
|
|
14775
|
-
token: z.string({ min: 1 }).describe("That block's full-state token, including inline marks.")
|
|
14776
|
-
}), { min: 1 }).describe("Every content block this batch changes, each with the token dispatch doc-read --blocks lists.").optional()
|
|
14777
|
-
}).describe("Optional optimistic-concurrency guard; select exactly one of document or blocks.").optional(),
|
|
14785
|
+
precondition: preconditionArgument(z),
|
|
14778
14786
|
summary: z.string().describe("Optional named-version summary.").optional()
|
|
14779
14787
|
}),
|
|
14780
14788
|
validation: documentEditValidation
|
|
@@ -14877,7 +14885,7 @@ var dispatchToolSpecs = [
|
|
|
14877
14885
|
name: "dispatch_artifact",
|
|
14878
14886
|
example: { issue: "DSP-1", name: "design.md", content: `# Design
|
|
14879
14887
|
` },
|
|
14880
|
-
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}`,
|
|
14888
|
+
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}`,
|
|
14881
14889
|
arguments: (z) => ({
|
|
14882
14890
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
14883
14891
|
project: z.string().describe("Project key for an unlinked document.").optional(),
|
|
@@ -14885,6 +14893,7 @@ var dispatchToolSpecs = [
|
|
|
14885
14893
|
path: z.string().describe("Local path to the file to upload.").optional(),
|
|
14886
14894
|
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(),
|
|
14887
14895
|
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(),
|
|
14896
|
+
precondition: uploadPreconditionArgument(z),
|
|
14888
14897
|
summary: z.string().describe("Optional version summary.").optional()
|
|
14889
14898
|
}),
|
|
14890
14899
|
validation: {
|
|
@@ -20409,6 +20418,8 @@ class DispatchClient {
|
|
|
20409
20418
|
form.set("name", input.name);
|
|
20410
20419
|
if (input.summary !== undefined)
|
|
20411
20420
|
form.set("summary", input.summary);
|
|
20421
|
+
if (input.precondition !== undefined)
|
|
20422
|
+
form.set("precondition", JSON.stringify(input.precondition));
|
|
20412
20423
|
if (input.actor !== undefined)
|
|
20413
20424
|
form.set("actor", JSON.stringify(input.actor));
|
|
20414
20425
|
form.set("file", input.file, input.name);
|
|
@@ -22193,6 +22204,10 @@ function optionalNumber(args, name) {
|
|
|
22193
22204
|
const value = args[name];
|
|
22194
22205
|
return typeof value === "number" ? value : undefined;
|
|
22195
22206
|
}
|
|
22207
|
+
function optionalPrecondition(args) {
|
|
22208
|
+
const { precondition } = args;
|
|
22209
|
+
return precondition;
|
|
22210
|
+
}
|
|
22196
22211
|
function defined(name, value) {
|
|
22197
22212
|
return value === undefined ? {} : { [name]: value };
|
|
22198
22213
|
}
|
|
@@ -23327,6 +23342,25 @@ function movedApprovalClauses(documents) {
|
|
|
23327
23342
|
function movedApprovalDocuments(documents) {
|
|
23328
23343
|
return documents.filter((document) => document.requested_version < document.version);
|
|
23329
23344
|
}
|
|
23345
|
+
function standingReviewLines(advice) {
|
|
23346
|
+
const review = advice?.standing_review;
|
|
23347
|
+
if (review === undefined)
|
|
23348
|
+
return [];
|
|
23349
|
+
const carriedFrom = review.carried_from_version;
|
|
23350
|
+
if (carriedFrom !== undefined) {
|
|
23351
|
+
return [
|
|
23352
|
+
`${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}.`,
|
|
23353
|
+
"Say what changed since that review in a reply on this ask."
|
|
23354
|
+
];
|
|
23355
|
+
}
|
|
23356
|
+
const verb = review.state === "approved" ? "approved" : "asked for changes on";
|
|
23357
|
+
const opening = `${review.by} ${verb} this issue's spec at version ${review.version} on ${review.at}`;
|
|
23358
|
+
const reason = review.reason ?? "";
|
|
23359
|
+
return [
|
|
23360
|
+
reason === "" ? `${opening}, and gave no reason.` : `${opening}: ${JSON.stringify(reason)}`,
|
|
23361
|
+
"Say what changed since that review in a reply on this ask."
|
|
23362
|
+
];
|
|
23363
|
+
}
|
|
23330
23364
|
function renderAdvice(tool, key, advice, opts) {
|
|
23331
23365
|
if (advice === undefined)
|
|
23332
23366
|
return [];
|
|
@@ -24956,6 +24990,7 @@ async function askCommand(context) {
|
|
|
24956
24990
|
text: stringArg(args, "question"),
|
|
24957
24991
|
linkBase
|
|
24958
24992
|
});
|
|
24993
|
+
const reviewLines = await otherAdviceLines(() => standingReviewLines(ask.advice));
|
|
24959
24994
|
const declinedLines = ask.issue_key === null ? [] : declinedAskLines(ask.advice, ask.issue_key, linkBase);
|
|
24960
24995
|
const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, askOwner.label, ask.advice, {}));
|
|
24961
24996
|
const asked = waitsOnPerson(ask);
|
|
@@ -24963,6 +24998,7 @@ async function askCommand(context) {
|
|
|
24963
24998
|
text: [
|
|
24964
24999
|
`Asked ${ask.id} on ${askOwner.label} (urgency ${ask.urgency})${asked === undefined ? "" : `, waiting on ${asked}`}: ${ask.question}`,
|
|
24965
25000
|
...checkLines,
|
|
25001
|
+
...reviewLines,
|
|
24966
25002
|
...declinedLines,
|
|
24967
25003
|
await followsAsk(askOwner, input.subscriptions),
|
|
24968
25004
|
...adviceLines
|
|
@@ -25237,6 +25273,91 @@ import { resolve as resolvePath2 } from "path";
|
|
|
25237
25273
|
// ../contracts/src/go-blank.ts
|
|
25238
25274
|
var goBlankPattern = /^[\t\n\v\f\r \u0085\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]*$/u;
|
|
25239
25275
|
|
|
25276
|
+
// ../envoy-client/src/dispatch-commands/upload-checks.ts
|
|
25277
|
+
function artifactUnderName(artifacts, name) {
|
|
25278
|
+
const written = name.trim();
|
|
25279
|
+
return artifacts.find((held) => held.slug === written) ?? artifacts.find((held) => held.name === written);
|
|
25280
|
+
}
|
|
25281
|
+
function artifactNameExistsProblem(held, owner) {
|
|
25282
|
+
const versions = held.versions ?? [];
|
|
25283
|
+
const newest = versions[versions.length - 1];
|
|
25284
|
+
if (newest === undefined) {
|
|
25285
|
+
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}`;
|
|
25286
|
+
}
|
|
25287
|
+
const authors = (newest.authors ?? []).map(actorText);
|
|
25288
|
+
const wroteIt = authors.length === 0 ? actorText(held.created_by) : authors.join(" and ");
|
|
25289
|
+
return `${owner} already holds ${held.name} (slug ${held.slug}, kind ${held.kind}) at version ${newest.number}, which ${wroteIt} wrote. ${ARTIFACT_NAME_EXISTS_RULE}`;
|
|
25290
|
+
}
|
|
25291
|
+
var STORED_LINE_QUOTED = 200;
|
|
25292
|
+
function quotedStoredLine(line) {
|
|
25293
|
+
if (line.length <= STORED_LINE_QUOTED)
|
|
25294
|
+
return JSON.stringify(line);
|
|
25295
|
+
const head = JSON.stringify(line.slice(0, STORED_LINE_QUOTED));
|
|
25296
|
+
return `${head} (cut after ${STORED_LINE_QUOTED} of its ${line.length} characters)`;
|
|
25297
|
+
}
|
|
25298
|
+
function firstStoredDifference(given, stored) {
|
|
25299
|
+
const written = given.split(`
|
|
25300
|
+
`);
|
|
25301
|
+
const holds = stored.split(`
|
|
25302
|
+
`);
|
|
25303
|
+
for (let line = 0;line < Math.max(written.length, holds.length); line += 1) {
|
|
25304
|
+
const wrote = written[line];
|
|
25305
|
+
const held = holds[line];
|
|
25306
|
+
if (wrote === held)
|
|
25307
|
+
continue;
|
|
25308
|
+
if (wrote === undefined && held !== undefined) {
|
|
25309
|
+
return `the store writes a line ${line + 1}, ${quotedStoredLine(held)}`;
|
|
25310
|
+
}
|
|
25311
|
+
if (held === undefined && wrote !== undefined) {
|
|
25312
|
+
return `the store drops line ${line + 1}, ${quotedStoredLine(wrote)}`;
|
|
25313
|
+
}
|
|
25314
|
+
if (wrote !== undefined && held !== undefined) {
|
|
25315
|
+
return `line ${line + 1} reads ${quotedStoredLine(wrote)} and is stored as ${quotedStoredLine(held)}`;
|
|
25316
|
+
}
|
|
25317
|
+
}
|
|
25318
|
+
return "the stored text differs from the text given";
|
|
25319
|
+
}
|
|
25320
|
+
var STORED_TEXT_PRINTED = 2000;
|
|
25321
|
+
function storedTextPrinted(stored) {
|
|
25322
|
+
if (stored.length <= STORED_TEXT_PRINTED)
|
|
25323
|
+
return { text: stored, cut: "" };
|
|
25324
|
+
const head = stored.slice(0, STORED_TEXT_PRINTED);
|
|
25325
|
+
const lastLineFeed = head.lastIndexOf(`
|
|
25326
|
+
`);
|
|
25327
|
+
const text = lastLineFeed === -1 ? head : head.slice(0, lastLineFeed + 1);
|
|
25328
|
+
return {
|
|
25329
|
+
text,
|
|
25330
|
+
cut: ` The text below is cut after ${text.length} of its ${stored.length} characters: change the line named above and send the text again.`
|
|
25331
|
+
};
|
|
25332
|
+
}
|
|
25333
|
+
function storedTextProblem(given, stored, name) {
|
|
25334
|
+
const asBytes = pathKeepsBytesOf(name) ? ` To keep the text as you wrote it, send it as a file with ${PATH_KEEPS_BYTES}.` : "";
|
|
25335
|
+
const printed = storedTextPrinted(stored);
|
|
25336
|
+
return [
|
|
25337
|
+
`Dispatch stores this text under another spelling: ${firstStoredDifference(given, stored)}.`,
|
|
25338
|
+
` Send the text Dispatch stores, which is between the two marker lines below.${asBytes}`,
|
|
25339
|
+
`${printed.cut}
|
|
25340
|
+
--- the text Dispatch stores ---
|
|
25341
|
+
${printed.text}`,
|
|
25342
|
+
"--- end of the text Dispatch stores ---"
|
|
25343
|
+
].join("");
|
|
25344
|
+
}
|
|
25345
|
+
function storedTextCheckFailed(error, name) {
|
|
25346
|
+
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)}.`;
|
|
25347
|
+
if (!dispatchAnswered(error, 413)) {
|
|
25348
|
+
return `${failure} Send the upload again once that call is answered.`;
|
|
25349
|
+
}
|
|
25350
|
+
const asBytes = pathKeepsBytesOf(name) ? ` Send it as a file with ${PATH_KEEPS_BYTES}, which asks this check nothing.` : "";
|
|
25351
|
+
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}`;
|
|
25352
|
+
}
|
|
25353
|
+
function roundTripRouteAbsent(error) {
|
|
25354
|
+
return dispatchAnswered(error, 404) || dispatchAnswered(error, 405);
|
|
25355
|
+
}
|
|
25356
|
+
function withoutFinalLineFeed(text) {
|
|
25357
|
+
return text.endsWith(`
|
|
25358
|
+
`) ? text.slice(0, -1) : text;
|
|
25359
|
+
}
|
|
25360
|
+
|
|
25240
25361
|
// ../envoy-client/src/dispatch-commands/documents.ts
|
|
25241
25362
|
async function blockAsks(client, resolved, state) {
|
|
25242
25363
|
const asks = await (resolved.issue === undefined ? client.getArtifactAsks(resolved.artifact.id, state) : client.listIssueAsks(resolved.issue.key, state));
|
|
@@ -25416,8 +25537,7 @@ async function docEditCommand(context) {
|
|
|
25416
25537
|
const resolved = await resolveDocument(documentOwner(), optionalString(args, "artifact"));
|
|
25417
25538
|
const ops = args.ops;
|
|
25418
25539
|
const summary = optionalString(args, "summary");
|
|
25419
|
-
const
|
|
25420
|
-
const precondition = rawPrecondition;
|
|
25540
|
+
const precondition = optionalPrecondition(args);
|
|
25421
25541
|
await refuseRemovingOpenDecisionBlocks(client, input.tool, resolved, ops);
|
|
25422
25542
|
const edited = await client.docEdit(resolved.artifact.id, {
|
|
25423
25543
|
ops,
|
|
@@ -25597,96 +25717,19 @@ async function planApproveCommand(context) {
|
|
|
25597
25717
|
}
|
|
25598
25718
|
};
|
|
25599
25719
|
}
|
|
25600
|
-
function artifactUnderName(artifacts, name) {
|
|
25601
|
-
const written = name.trim();
|
|
25602
|
-
return artifacts.find((held) => held.slug === written) ?? artifacts.find((held) => held.name === written);
|
|
25603
|
-
}
|
|
25604
|
-
function artifactNameExistsProblem(held, owner) {
|
|
25605
|
-
const versions = held.versions ?? [];
|
|
25606
|
-
const newest = versions[versions.length - 1];
|
|
25607
|
-
if (newest === undefined) {
|
|
25608
|
-
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}`;
|
|
25609
|
-
}
|
|
25610
|
-
const authors = (newest.authors ?? []).map(actorText);
|
|
25611
|
-
const wroteIt = authors.length === 0 ? actorText(held.created_by) : authors.join(" and ");
|
|
25612
|
-
return `${owner} already holds ${held.name} (slug ${held.slug}, kind ${held.kind}) at version ${newest.number}, which ${wroteIt} wrote. ${ARTIFACT_NAME_EXISTS_RULE}`;
|
|
25613
|
-
}
|
|
25614
|
-
var STORED_LINE_QUOTED = 200;
|
|
25615
|
-
function quotedStoredLine(line) {
|
|
25616
|
-
if (line.length <= STORED_LINE_QUOTED)
|
|
25617
|
-
return JSON.stringify(line);
|
|
25618
|
-
const head = JSON.stringify(line.slice(0, STORED_LINE_QUOTED));
|
|
25619
|
-
return `${head} (cut after ${STORED_LINE_QUOTED} of its ${line.length} characters)`;
|
|
25620
|
-
}
|
|
25621
|
-
function firstStoredDifference(given, stored) {
|
|
25622
|
-
const written = given.split(`
|
|
25623
|
-
`);
|
|
25624
|
-
const holds = stored.split(`
|
|
25625
|
-
`);
|
|
25626
|
-
for (let line = 0;line < Math.max(written.length, holds.length); line += 1) {
|
|
25627
|
-
const wrote = written[line];
|
|
25628
|
-
const held = holds[line];
|
|
25629
|
-
if (wrote === held)
|
|
25630
|
-
continue;
|
|
25631
|
-
if (wrote === undefined && held !== undefined) {
|
|
25632
|
-
return `the store writes a line ${line + 1}, ${quotedStoredLine(held)}`;
|
|
25633
|
-
}
|
|
25634
|
-
if (held === undefined && wrote !== undefined) {
|
|
25635
|
-
return `the store drops line ${line + 1}, ${quotedStoredLine(wrote)}`;
|
|
25636
|
-
}
|
|
25637
|
-
if (wrote !== undefined && held !== undefined) {
|
|
25638
|
-
return `line ${line + 1} reads ${quotedStoredLine(wrote)} and is stored as ${quotedStoredLine(held)}`;
|
|
25639
|
-
}
|
|
25640
|
-
}
|
|
25641
|
-
return "the stored text differs from the text given";
|
|
25642
|
-
}
|
|
25643
|
-
var STORED_TEXT_PRINTED = 2000;
|
|
25644
|
-
function storedTextPrinted(stored) {
|
|
25645
|
-
if (stored.length <= STORED_TEXT_PRINTED)
|
|
25646
|
-
return { text: stored, cut: "" };
|
|
25647
|
-
const head = stored.slice(0, STORED_TEXT_PRINTED);
|
|
25648
|
-
const lastLineFeed = head.lastIndexOf(`
|
|
25649
|
-
`);
|
|
25650
|
-
const text = lastLineFeed === -1 ? head : head.slice(0, lastLineFeed + 1);
|
|
25651
|
-
return {
|
|
25652
|
-
text,
|
|
25653
|
-
cut: ` The text below is cut after ${text.length} of its ${stored.length} characters: change the line named above and send the text again.`
|
|
25654
|
-
};
|
|
25655
|
-
}
|
|
25656
|
-
function storedTextProblem(given, stored, name) {
|
|
25657
|
-
const asBytes = pathKeepsBytesOf(name) ? ` To keep the text as you wrote it, send it as a file with ${PATH_KEEPS_BYTES}.` : "";
|
|
25658
|
-
const printed = storedTextPrinted(stored);
|
|
25659
|
-
return [
|
|
25660
|
-
`Dispatch stores this text under another spelling: ${firstStoredDifference(given, stored)}.`,
|
|
25661
|
-
` Send the text Dispatch stores, which is between the two marker lines below.${asBytes}`,
|
|
25662
|
-
`${printed.cut}
|
|
25663
|
-
--- the text Dispatch stores ---
|
|
25664
|
-
${printed.text}`,
|
|
25665
|
-
"--- end of the text Dispatch stores ---"
|
|
25666
|
-
].join("");
|
|
25667
|
-
}
|
|
25668
|
-
function storedTextCheckFailed(error, name) {
|
|
25669
|
-
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)}.`;
|
|
25670
|
-
if (!dispatchAnswered(error, 413)) {
|
|
25671
|
-
return `${failure} Send the upload again once that call is answered.`;
|
|
25672
|
-
}
|
|
25673
|
-
const asBytes = pathKeepsBytesOf(name) ? ` Send it as a file with ${PATH_KEEPS_BYTES}, which asks this check nothing.` : "";
|
|
25674
|
-
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}`;
|
|
25675
|
-
}
|
|
25676
|
-
function roundTripRouteAbsent(error) {
|
|
25677
|
-
return dispatchAnswered(error, 404) || dispatchAnswered(error, 405);
|
|
25678
|
-
}
|
|
25679
|
-
function withoutFinalLineFeed(text) {
|
|
25680
|
-
return text.endsWith(`
|
|
25681
|
-
`) ? text.slice(0, -1) : text;
|
|
25682
|
-
}
|
|
25683
25720
|
async function artifactCommand(context) {
|
|
25684
25721
|
const { args, client, actor, input, documentOwner, issue } = context;
|
|
25685
25722
|
const summary = optionalString(args, "summary");
|
|
25686
25723
|
const name = stringArg(args, "name");
|
|
25687
25724
|
const content = optionalString(args, "content");
|
|
25688
25725
|
const path = optionalString(args, "path");
|
|
25689
|
-
const
|
|
25726
|
+
const precondition = optionalPrecondition(args);
|
|
25727
|
+
const options = {
|
|
25728
|
+
name,
|
|
25729
|
+
...summary === undefined ? {} : { summary },
|
|
25730
|
+
...precondition === undefined ? {} : { precondition },
|
|
25731
|
+
actor
|
|
25732
|
+
};
|
|
25690
25733
|
const artifactOwner = documentOwner();
|
|
25691
25734
|
const blank = content === undefined || goBlankPattern.test(content);
|
|
25692
25735
|
if ((path !== undefined || !blank) && optionalBoolean(args, "force") !== true) {
|
|
@@ -70,7 +70,6 @@ Each step records one document of the root issue:
|
|
|
70
70
|
|
|
71
71
|
| Step | Document |
|
|
72
72
|
| --- | --- |
|
|
73
|
-
| `decisions` | the decisions document (`decisions.md`) |
|
|
74
73
|
| `criteria` | the Verification document (`verification.md`) |
|
|
75
74
|
| `spec` | the primary document |
|
|
76
75
|
|
|
@@ -87,8 +86,7 @@ For each gated step, once every child is filed:
|
|
|
87
86
|
told it is a spec, for each factual claim. `wait` for each, resolve every finding, and check
|
|
88
87
|
each unverified claim with a command or take it out.
|
|
89
88
|
4. Request approval only once the person has agreed to every point; a new point gets its own
|
|
90
|
-
decision block first. `--include-verification` covers `spec` and `criteria` in one request
|
|
91
|
-
`decisions` takes its own (`--artifact decisions.md`):
|
|
89
|
+
decision block first. `--include-verification` covers `spec` and `criteria` in one request:
|
|
92
90
|
|
|
93
91
|
```bash
|
|
94
92
|
dispatch request-approval --issue <root> --include-verification --summary '<what they approve> Reviews: <gap result>, <claim result>; <what they do not show>.'
|
|
@@ -31,8 +31,9 @@ exist. Each `task` runs as a job of its own: `wait` for each result and answer f
|
|
|
31
31
|
|
|
32
32
|
Before you rely on a step 1 hit, `grep` `docs/solutions/` for its path. If another file lists that
|
|
33
33
|
path under its front-matter `supersedes:` key, use that file instead; if one has a line
|
|
34
|
-
`Extends docs/solutions/<hit path>`, read both. For a hit
|
|
35
|
-
|
|
34
|
+
`Extends docs/solutions/<hit path>`, read both. For a hit that tells a worker to check the GitHub
|
|
35
|
+
App of a commit's author or committer, follow the trailer rule of
|
|
36
|
+
`skill://legion-worker/references/default-branch-check.md` instead.
|
|
36
37
|
|
|
37
38
|
## Output
|
|
38
39
|
|
|
@@ -70,11 +70,11 @@ with a WAITING line naming the defect and the answer you wait on.
|
|
|
70
70
|
**Production check:** <the command or user action that will show the change working in production>
|
|
71
71
|
**Carried by:** <the deploy or restart that carries the merge there>
|
|
72
72
|
**Run by:** <the agent or role your system prompt's deployment instructions name; when none, the person to ask>
|
|
73
|
-
|
|
74
|
-
<!-- legion: {"session":"<session-id>","phase":"retro"} -->
|
|
75
73
|
EOF
|
|
76
74
|
```
|
|
77
75
|
|
|
76
|
+
A Dispatch comment or message never carries the `<!-- legion: … -->` footer. Dispatch records the session that wrote it, and only a pull-request comment or review needs the footer.
|
|
77
|
+
|
|
78
78
|
6. **Complete** with the `legion` tool's `handoff_complete`, its summary two sentences for the
|
|
79
79
|
architect. In the same call, rate the plan the issue ran (its steps and the role that worked
|
|
80
80
|
each, not the planner's `plan.md`): send both `plan_rating`, a whole number from 1 (the plan
|
|
@@ -42,7 +42,5 @@ dispatch comment --issue '<KEY>' --body-file - <<'EOF'
|
|
|
42
42
|
Evidence: <file and symbol, or text quoted from it, of this pull request, and what went wrong>.
|
|
43
43
|
Belongs in: <the skill, prompt or guide>.
|
|
44
44
|
Replaces: <the instruction and its path>, or nothing.
|
|
45
|
-
|
|
46
|
-
<!-- legion: {"session":"<session-id>","phase":"retro"} -->
|
|
47
45
|
EOF
|
|
48
46
|
```
|
|
@@ -46,6 +46,7 @@ Your role prompt gives the workspace, the push, the handoff, `handoff_complete`,
|
|
|
46
46
|
- No deferrals. A finding that changes behaviour, hides an error, or breaks a gate is fixed in this pull request. So is a wording nit or any clear fix in a file it touches: a later round costs a CI pass and a review. `Fast-follow:` reads `none` or names cleanup in files the pull request does not touch.
|
|
47
47
|
- The merge gate, in order: the tester's evidence green → the reviewer's approval of the head → the architect's acceptance → retro, which commits nothing → the merger's merge of the head it read, which closes the issue → the production check after the close, the tester's unless the project's `production_check` is `off`. Only the merger runs `gh pr merge`; nobody turns auto-merge on.
|
|
48
48
|
- End every pull-request comment you post with `<!-- legion: {"session":"<session-id>","phase":"<phase>"} -->`.
|
|
49
|
+
- A Dispatch comment or message never carries the `<!-- legion: … -->` footer. Dispatch records the session that wrote it, and only a pull-request comment or review needs the footer.
|
|
49
50
|
- Never run `gh config set` or `gh alias set`, and leave `GH_TOKEN`, `GITHUB_TOKEN` and `GH_HOST` unset: a set variable outranks the gh directory the daemon refreshes.
|
|
50
51
|
- Before you report a resource unreachable, or read a GitHub `404` as no access, try the call through `skill://agent-secrets` and read the profiles in `AWS_CONFIG_FILE`. Request a secret only for your issue's work.
|
|
51
52
|
|
package/package.json
CHANGED
|
@@ -26,7 +26,7 @@ Part | Content
|
|
|
26
26
|
`Requirements` | a `:::requirement` block each, `**R1.**` on, its source (`From:`)
|
|
27
27
|
`Verification` | the issue's `verification.md`, a `:::check` block each: `serves`, `surface`, `run` (where it names tests, specific ones), `when`, `negative_control`. For a whole test suite, name its CI job in `ci_check`: a check carrying `ci_check` is CI's and takes no `run`
|
|
28
28
|
`Design` | How it meets them; a value and its reason for each limit, size and time
|
|
29
|
-
`Decisions` |
|
|
29
|
+
`Decisions` | The choices the spec rests on (Decisions below)
|
|
30
30
|
|
|
31
31
|
`serves` and `needs` name a block of this issue or an ancestor. Another agent can build and check the work from these alone. A small change gets a few sentences per part, no matrix; split a large design into children.
|
|
32
32
|
|
|
@@ -61,12 +61,7 @@ For each spec, ask, comment and message:
|
|
|
61
61
|
|
|
62
62
|
## Decisions
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
- The heading names the choice; the text gives the reason and options weighed.
|
|
67
|
-
- Link each spec block it shaped, `dispatch://KEY/spec#b-<id>`, and a person's decision its ask, `dispatch://KEY/ask/<id>`.
|
|
68
|
-
- An unsure section adds an `Unsure:` paragraph: what would change your mind.
|
|
69
|
-
- A replaced section moves under a final `## Replaced` as a `###`.
|
|
64
|
+
A choice earns an entry in the spec's `## Decisions` part only if a disagreeing reader would act differently; keep others to one spec line each. Write it in the spec, never in a separate document: the choice first, then the reason and the options weighed, as a `:::decision` block once the server's block types include `decision`. A person's answered ask is their decision: it stays in the spec where it was asked.
|
|
70
65
|
|
|
71
66
|
## Old specs
|
|
72
67
|
|