@sjawhar/claude-envoy 2.1.0 → 2.2.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/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/dist/dispatch.js +370 -56
- package/dist/envoy-channel.js +371 -57
- package/dist/session-hook.js +370 -56
- package/dist/session-title-hook.js +10 -1
- package/legion/skills/legion-architect/SKILL.md +5 -5
- package/legion/skills/legion-architect/references/acceptance.md +5 -5
- package/legion/skills/legion-architect/references/design-gate.md +8 -3
- package/legion/skills/legion-architect/references/wake-routing.md +1 -1
- package/legion/skills/legion-retro/SKILL.md +4 -4
- package/legion/skills/legion-worker/SKILL.md +1 -1
- package/legion/skills/legion-worker/references/merge-gate.md +6 -5
- package/legion/skills/legion-worker/references/pr-body.md +18 -18
- package/package.json +1 -1
package/dist/envoy-channel.js
CHANGED
|
@@ -36763,8 +36763,14 @@ function brokenParts(parts) {
|
|
|
36763
36763
|
var CONTENT_IS_MARKDOWN = "content is stored as a Markdown document, which rewrites other text (a JSONL file's lines come back joined into one paragraph)";
|
|
36764
36764
|
var PATH_KEEPS_BYTES = "path (--path <file>), which stores a file whose path does not end in .md or .markdown as its bytes, unchanged";
|
|
36765
36765
|
var ARTIFACT_CONTENT_NAME_RULE = `${CONTENT_IS_MARKDOWN}, so with content the name ends in .md or .markdown or has no extension; upload any other file (.jsonl, .tsv, .json, .txt) with ${PATH_KEEPS_BYTES}.`;
|
|
36766
|
+
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. Send the upload again with force (--force) to write the next version.";
|
|
36767
|
+
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}.`;
|
|
36766
36768
|
var NAME_EXTENSION = /\.([^\s.]+)$/u;
|
|
36767
36769
|
var MARKDOWN_EXTENSION = /^(md|markdown)$/i;
|
|
36770
|
+
function pathKeepsBytesOf(name) {
|
|
36771
|
+
const extension = NAME_EXTENSION.exec(name.trim())?.[1];
|
|
36772
|
+
return extension === undefined || !MARKDOWN_EXTENSION.test(extension);
|
|
36773
|
+
}
|
|
36768
36774
|
var artifactOwner = documentOwnerValidation(false);
|
|
36769
36775
|
function artifactProblem(value) {
|
|
36770
36776
|
const input = value;
|
|
@@ -36906,6 +36912,42 @@ var handoffValidation = {
|
|
|
36906
36912
|
message: HANDOFF_RULE,
|
|
36907
36913
|
refusal: (value) => handoffProblem(value) ?? HANDOFF_RULE
|
|
36908
36914
|
};
|
|
36915
|
+
var RESULT_REQUIRED_FIELDS = ["issue", "check", "role", "verdict", "commit"];
|
|
36916
|
+
var RESULT_RECORD_FIELDS = [
|
|
36917
|
+
...RESULT_REQUIRED_FIELDS,
|
|
36918
|
+
"surface",
|
|
36919
|
+
"run",
|
|
36920
|
+
"observed",
|
|
36921
|
+
"negative_control",
|
|
36922
|
+
"failed",
|
|
36923
|
+
"skipped",
|
|
36924
|
+
"excluded",
|
|
36925
|
+
"screenshots"
|
|
36926
|
+
];
|
|
36927
|
+
var RESULT_RETRACT_RULE = "Pass retract with the id of a result recorded before, and reason with why that result is " + "wrong, to retract it.";
|
|
36928
|
+
var RESULT_SHAPE_RULE = `${RESULT_RETRACT_RULE} A call with retract takes reason and no other argument. A call ` + "without retract records a result, and it takes issue, check, role, verdict and commit.";
|
|
36929
|
+
function resultProblem(value) {
|
|
36930
|
+
const input = value;
|
|
36931
|
+
const carried = RESULT_RECORD_FIELDS.filter((field) => input[field] !== undefined);
|
|
36932
|
+
if (typeof input["retract"] === "string") {
|
|
36933
|
+
const reason = input["reason"];
|
|
36934
|
+
if (typeof reason !== "string" || reason.trim() === "") {
|
|
36935
|
+
return "retract needs reason, the words that say why the result is wrong.";
|
|
36936
|
+
}
|
|
36937
|
+
if (carried.length > 0) {
|
|
36938
|
+
return `retract takes reason alone, and this call also carries ${carried.join(", ")}. Retract the result, then record a new one with a call of its own.`;
|
|
36939
|
+
}
|
|
36940
|
+
return;
|
|
36941
|
+
}
|
|
36942
|
+
if (input["reason"] !== undefined) {
|
|
36943
|
+
return "reason goes with retract, and this call carries no retract. Name the result to retract, or drop reason.";
|
|
36944
|
+
}
|
|
36945
|
+
const missing = RESULT_REQUIRED_FIELDS.filter((field) => input[field] === undefined);
|
|
36946
|
+
if (missing.length > 0) {
|
|
36947
|
+
return `recording a result needs ${missing.join(", ")}. ${RESULT_RETRACT_RULE}`;
|
|
36948
|
+
}
|
|
36949
|
+
return;
|
|
36950
|
+
}
|
|
36909
36951
|
var SEARCH_QUERY_MAX = 1000;
|
|
36910
36952
|
var SEARCH_QUERY_HINT = "search with a short phrase of a few words, not a passage";
|
|
36911
36953
|
var SEARCH_KIND_DEPTH = 100;
|
|
@@ -37259,13 +37301,13 @@ var dispatchToolSpecs = [
|
|
|
37259
37301
|
verdict: "pass",
|
|
37260
37302
|
commit: "1111111111111111111111111111111111111111"
|
|
37261
37303
|
},
|
|
37262
|
-
description: "Record one result of one check of an issue's Verification document,
|
|
37304
|
+
description: "Record one result of one check of an issue's Verification document, or retract a result " + "recorded before. A record prints the pull-request body line it implies. Write that line " + "into the pull-request body unchanged: it is the one grammar every writer uses, and it " + "carries no link to Dispatch. " + "Name the check by its block id. Where two Verification documents in reach hold that id, " + "name it by its canonical reference (dispatch://KEY/artifact/verification-md#b-<id>). " + "409 CHECK_AMBIGUOUS names both documents. An id no Verification document of the issue " + "or of an issue above it holds is 400 UNKNOWN_CHECK. " + "A pass that counts a failed, a skipped or an excluded case contradicts itself, and is " + "400 RESULT_CONTRADICTS. " + "Dispatch asks GitHub whether the repository of the check's issue holds the commit. A " + "commit that repository does not hold is 400 RESULT_COMMIT_UNKNOWN, which names the " + "commit and that owner/repo. Record the result after the commit is pushed. A repository " + "Dispatch cannot read records the result as before. " + "The result is recorded against the check's own issue, so a child's run of a parent's " + "check appears under that check. A closed issue takes a result only for a check whose " + "when is after_merge or default_branch, the production check after the merge. It refuses " + "every other record with 409 ISSUE_CLOSED, as it refuses every other write. " + RESULT_RETRACT_RULE + " The retraction keeps both records: the result stays readable, and it proves nothing " + "from then on. Record a new result where the check still needs one. A retraction is " + "taken on a closed issue and for a check of any when. Three callers may retract: the " + "session that recorded the result, a session that holds the Dispatch claim of the issue " + "the result was recorded on, and a caller whose credential carries a person. Every other " + "caller is 403 RETRACTION_FORBIDDEN. A result retracted already is 409 RESULT_RETRACTED. " + ISSUE_REFERENCE,
|
|
37263
37305
|
arguments: (z) => ({
|
|
37264
|
-
issue: z.string().describe(ISSUE_REFERENCE),
|
|
37265
|
-
check: z.string().describe("The check block's id, or its canonical reference dispatch://KEY/artifact/verification-md#b-<id> when the id is not unique among the issue's Verification document and those of the issues above it."),
|
|
37266
|
-
role: z.string({ max: 32 }).describe("Who ran it: implementer, tester, reviewer. At most 32 characters of a-z and -, printed in the pull-request line."),
|
|
37267
|
-
verdict: z.enum(["pass", "fail"]).describe("Whether the check passed."),
|
|
37268
|
-
commit: z.string().describe("The 40-character lowercase hex commit the check ran at."),
|
|
37306
|
+
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
37307
|
+
check: z.string().describe("The check block's id, or its canonical reference dispatch://KEY/artifact/verification-md#b-<id> when the id is not unique among the issue's Verification document and those of the issues above it.").optional(),
|
|
37308
|
+
role: z.string({ max: 32 }).describe("Who ran it: implementer, tester, reviewer. At most 32 characters of a-z and -, printed in the pull-request line.").optional(),
|
|
37309
|
+
verdict: z.enum(["pass", "fail"]).describe("Whether the check passed.").optional(),
|
|
37310
|
+
commit: z.string().describe("The 40-character lowercase hex commit the check ran at.").optional(),
|
|
37269
37311
|
surface: z.string().describe("Where a person reaches the change.").optional(),
|
|
37270
37312
|
run: z.string().describe("The command that proved it.").optional(),
|
|
37271
37313
|
observed: z.string().describe("What the command printed.").optional(),
|
|
@@ -37273,28 +37315,38 @@ var dispatchToolSpecs = [
|
|
|
37273
37315
|
failed: z.number({ int: true, min: 0 }).describe("Cases the run failed; 0 by default.").optional(),
|
|
37274
37316
|
skipped: z.number({ int: true, min: 0 }).describe("Cases the run skipped; 0 by default.").optional(),
|
|
37275
37317
|
excluded: z.number({ int: true, min: 0 }).describe("Cases the run excluded; 0 by default.").optional(),
|
|
37276
|
-
screenshots: z.array(z.string()).describe("dispatch:// references to image documents of this issue or of the check's issue.").optional()
|
|
37277
|
-
|
|
37318
|
+
screenshots: z.array(z.string()).describe("dispatch:// references to image documents of this issue or of the check's issue.").optional(),
|
|
37319
|
+
retract: z.string().describe("The id of a result recorded before. It records that the result is wrong, and it takes reason alone beside it.").optional(),
|
|
37320
|
+
reason: z.string().describe("Why the retracted result is wrong. It goes with retract and with nothing else.").optional()
|
|
37321
|
+
}),
|
|
37322
|
+
validation: {
|
|
37323
|
+
check: (value) => resultProblem(value) === undefined,
|
|
37324
|
+
message: RESULT_SHAPE_RULE,
|
|
37325
|
+
refusal: (value) => resultProblem(value) ?? RESULT_SHAPE_RULE
|
|
37326
|
+
}
|
|
37278
37327
|
},
|
|
37279
37328
|
{
|
|
37280
37329
|
name: "dispatch_results",
|
|
37281
37330
|
example: { issue: "DSP-1" },
|
|
37282
|
-
description: "Print each check of an issue's Verification document with
|
|
37331
|
+
description: "Print each check of an issue's Verification document with every result recorded against " + "it, newest first. " + "Each check prints what Dispatch compared its results with. A before_merge check is " + "compared with the head of each pull request Dispatch holds for the check's issue, open " + "or merged. An after_merge check is compared with the branch that issue's pull request " + "merged into and with the repository's default branch, and with the default branch alone " + "where Dispatch holds no merge of the issue. A default_branch check is compared with the " + "repository's default branch alone, whatever branch the pull request merged into. Where " + "a check compared with nothing, it says which of three things happened: the issue has no " + "pull request and no branch to compare with, Dispatch cannot read the repository, or a " + "read Dispatch made did not answer. " + "Each check then prints one line that answers the gate: whether a pass of it stands, and " + "from which roles. A pass stands when its commit is one of the commits the check " + "compared with, the check's words did not move after the result was recorded, and no " + "retraction stands against it. " + "The check's own words print once, under the check. Each result then prints its verdict, " + "its role, its whole 40-character commit, where that commit stands, whether the check's " + "words moved after it was recorded, the time, its id, and the reading the role recorded. " + "A result nobody gave a reading says so. A retracted result prints as retracted, with " + "the reason and the caller that retracted it. A check with no result says so. " + "A push that moves a pull request's head leaves a result at the commit before it, with " + "no write of anyone's: record the check again at the new head. " + ISSUE_REFERENCE,
|
|
37283
37332
|
arguments: (z) => ({
|
|
37284
|
-
issue: z.string().describe(ISSUE_REFERENCE)
|
|
37333
|
+
issue: z.string().describe(ISSUE_REFERENCE),
|
|
37334
|
+
at: z.string().describe("One commit of 40 lowercase hex characters. It becomes the only thing every check is compared with, and Dispatch reads GitHub for none of it.").optional(),
|
|
37335
|
+
brief: z.boolean().describe("Cut each reading whose result stands at none of the compared commits to its first 200 characters. Every other reading prints whole.").optional()
|
|
37285
37336
|
})
|
|
37286
37337
|
},
|
|
37287
37338
|
{
|
|
37288
37339
|
name: "dispatch_artifact",
|
|
37289
37340
|
example: { issue: "DSP-1", name: "design.md", content: `# Design
|
|
37290
37341
|
` },
|
|
37291
|
-
description: "Attach a local file or inline text as an issue artifact or project document. 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.
|
|
37342
|
+
description: "Attach a local file or inline text as an issue artifact or project document. 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. Exactly one of path or content is required; a markdown document is at most 1 MiB and any other file at most 25 MiB. " + `${ARTIFACT_NAME_EXISTS_RULE} ` + `${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. " + `${OWNER_REFERENCE}`,
|
|
37292
37343
|
arguments: (z) => ({
|
|
37293
37344
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
37294
37345
|
project: z.string().describe("Project key for an unlinked document.").optional(),
|
|
37295
37346
|
name: z.string().describe("Artifact filename shown in Dispatch."),
|
|
37296
37347
|
path: z.string().describe("Local path to the file to upload.").optional(),
|
|
37297
|
-
content: z.string().describe("Inline text to store as a Markdown document, under a name ending in .md or .markdown or with no extension
|
|
37348
|
+
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(),
|
|
37349
|
+
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(),
|
|
37298
37350
|
summary: z.string().describe("Optional version summary.").optional()
|
|
37299
37351
|
}),
|
|
37300
37352
|
validation: {
|
|
@@ -41703,8 +41755,17 @@ function askAnswerText(answer) {
|
|
|
41703
41755
|
}
|
|
41704
41756
|
|
|
41705
41757
|
// ../envoy-client/src/errors.ts
|
|
41758
|
+
function dispatchCode(error) {
|
|
41759
|
+
if (!("fromDispatch" in error) || !("code" in error))
|
|
41760
|
+
return;
|
|
41761
|
+
const code = error.code;
|
|
41762
|
+
return typeof code === "string" && code !== "" ? code : undefined;
|
|
41763
|
+
}
|
|
41706
41764
|
function messageFor(error) {
|
|
41707
|
-
|
|
41765
|
+
if (!(error instanceof Error))
|
|
41766
|
+
return String(error);
|
|
41767
|
+
const code = dispatchCode(error);
|
|
41768
|
+
return code === undefined || error.message.startsWith(code) ? error.message : `${code}: ${error.message}`;
|
|
41708
41769
|
}
|
|
41709
41770
|
function hasErrnoCode(error, code) {
|
|
41710
41771
|
return error instanceof Error && "code" in error && error.code === code;
|
|
@@ -42559,6 +42620,13 @@ class DispatchClient {
|
|
|
42559
42620
|
return answer;
|
|
42560
42621
|
throw new Error(`GET ${this.#url(path, query)} asked for the unpaged listing and got ${whyNotAnArray(answer)}.`);
|
|
42561
42622
|
}
|
|
42623
|
+
async listIssueArtifacts(issue) {
|
|
42624
|
+
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "artifacts"]);
|
|
42625
|
+
}
|
|
42626
|
+
async markdownRoundTrip(markdown) {
|
|
42627
|
+
const answer = await this.#json("POST", ["api", "v1", "markdown", "round-trip"], { markdown });
|
|
42628
|
+
return answer.markdown;
|
|
42629
|
+
}
|
|
42562
42630
|
async listProjectArtifacts(project, unlinked = false) {
|
|
42563
42631
|
return this.#json("GET", ["api", "v1", "projects", project, "artifacts"], undefined, unlinked ? { unlinked: "true" } : undefined);
|
|
42564
42632
|
}
|
|
@@ -42746,8 +42814,11 @@ class DispatchClient {
|
|
|
42746
42814
|
async recordResult(issue, input) {
|
|
42747
42815
|
return this.#json("POST", ["api", "v1", "issues", await this.#resolveIssue(issue), "results"], input);
|
|
42748
42816
|
}
|
|
42749
|
-
async issueResults(issue) {
|
|
42750
|
-
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "results"]);
|
|
42817
|
+
async issueResults(issue, at) {
|
|
42818
|
+
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "results"], undefined, at === undefined ? undefined : { at });
|
|
42819
|
+
}
|
|
42820
|
+
async retractResult(resultID, input) {
|
|
42821
|
+
return this.#json("POST", ["api", "v1", "results", resultID, "retract"], input);
|
|
42751
42822
|
}
|
|
42752
42823
|
async editAsk(id, input) {
|
|
42753
42824
|
return this.#json("PATCH", ["api", "v1", "asks", id], input);
|
|
@@ -42822,6 +42893,9 @@ class DispatchClient {
|
|
|
42822
42893
|
async docRead(id, version) {
|
|
42823
42894
|
return version === undefined ? this.#json("GET", ["api", "v1", "artifacts", id, "text"]) : this.#json("GET", ["api", "v1", "artifacts", id, "versions", String(version)]);
|
|
42824
42895
|
}
|
|
42896
|
+
async docReadWithBlocks(id) {
|
|
42897
|
+
return this.#json("GET", ["api", "v1", "artifacts", id, "text"], undefined, { blocks: true });
|
|
42898
|
+
}
|
|
42825
42899
|
async fileVersion(id, version) {
|
|
42826
42900
|
const url = this.#url(["api", "v1", "artifacts", id, "versions", String(version)]);
|
|
42827
42901
|
const response = await this.#send("GET", url, undefined, "*/*");
|
|
@@ -47918,11 +47992,11 @@ async function sessionAnswersSettled(session) {
|
|
|
47918
47992
|
class ToolInputError extends Error {
|
|
47919
47993
|
tool;
|
|
47920
47994
|
problems;
|
|
47921
|
-
constructor(tool, problems) {
|
|
47995
|
+
constructor(tool, problems, options) {
|
|
47922
47996
|
const count = problems.length;
|
|
47923
47997
|
const cli = isDispatchTool(tool);
|
|
47924
47998
|
const help = cli ? [
|
|
47925
|
-
`Allowed flags: ${commandFlags(tool).join(", ")}
|
|
47999
|
+
...options?.aboutAFlag === false ? [] : [`Allowed flags: ${commandFlags(tool).join(", ")}`],
|
|
47926
48000
|
`Example: ${commandLine(tool, exampleFor(tool))}`
|
|
47927
48001
|
] : [];
|
|
47928
48002
|
super([
|
|
@@ -48416,7 +48490,7 @@ async function refuseItemOffRef(tool, kind, ref, refText, item, documentId) {
|
|
|
48416
48490
|
`${refText} names ${kind} ${item.id} on ${refOwnerName(ref)}, but it is on ${where}`
|
|
48417
48491
|
]);
|
|
48418
48492
|
}
|
|
48419
|
-
async function resolveIdPrefix(tool, kind, id, ownerName, list) {
|
|
48493
|
+
async function resolveIdPrefix(tool, kind, id, ownerName, list, candidates) {
|
|
48420
48494
|
const fullID = normalizeUUID(id);
|
|
48421
48495
|
if (fullID !== undefined)
|
|
48422
48496
|
return fullID;
|
|
@@ -48426,9 +48500,13 @@ async function resolveIdPrefix(tool, kind, id, ownerName, list) {
|
|
|
48426
48500
|
]);
|
|
48427
48501
|
}
|
|
48428
48502
|
const prefix = id.toLowerCase();
|
|
48429
|
-
const
|
|
48503
|
+
const all = await list();
|
|
48504
|
+
const matches = all.filter((item) => item.id.toLowerCase().startsWith(prefix));
|
|
48430
48505
|
if (matches.length === 1 && matches[0] !== undefined)
|
|
48431
48506
|
return matches[0].id;
|
|
48507
|
+
if (candidates !== undefined) {
|
|
48508
|
+
throw new ToolInputError(tool, [candidates.refusal(matches, all)], { aboutAFlag: false });
|
|
48509
|
+
}
|
|
48432
48510
|
throw new ToolInputError(tool, [
|
|
48433
48511
|
matches.length === 0 ? `${kind} id ${id} matches none of the ${kind}s on ${ownerName}; use the full id` : `${kind} id ${id} matches ${matches.length} ${kind}s on ${ownerName}; use the full id`
|
|
48434
48512
|
]);
|
|
@@ -48879,6 +48957,9 @@ async function resolveOwnerArguments(tool, input, cwd, env, exec, dashboardUrls,
|
|
|
48879
48957
|
if (tool === "dispatch_read" && typeof args.message === "string") {
|
|
48880
48958
|
return { args, ref, owner: null };
|
|
48881
48959
|
}
|
|
48960
|
+
if (tool === "dispatch_result" && typeof args["retract"] === "string") {
|
|
48961
|
+
return { args, ref, owner: null };
|
|
48962
|
+
}
|
|
48882
48963
|
const legionIssue = env.LEGION_ISSUE;
|
|
48883
48964
|
if (!legionIssue) {
|
|
48884
48965
|
problems.push(ownerRequiredProblem);
|
|
@@ -49037,9 +49118,14 @@ function boundedEditDistance(a, b, limit) {
|
|
|
49037
49118
|
return Math.min(previous[b.length], limit + 1);
|
|
49038
49119
|
}
|
|
49039
49120
|
var askHintLimit = 8;
|
|
49040
|
-
function
|
|
49121
|
+
function openAskChoices(asks, owner) {
|
|
49122
|
+
if (asks.length === 0)
|
|
49123
|
+
return `${owner} holds no open ask.`;
|
|
49041
49124
|
const hints = asks.slice(0, askHintLimit).map((ask) => `${ask.id.slice(0, 8)}\u2026 ${textHead(ask.question)}`);
|
|
49042
|
-
return `
|
|
49125
|
+
return `The open asks of ${owner} are: ${hints.join(", ")}.`;
|
|
49126
|
+
}
|
|
49127
|
+
function askIDInputProblem(asks, owner) {
|
|
49128
|
+
return `ask ids are uuids. Write the whole id, or at least its first 8 characters. ${openAskChoices(asks, owner)}`;
|
|
49043
49129
|
}
|
|
49044
49130
|
async function movedApprovalLine(client, askID) {
|
|
49045
49131
|
const ask = (await client.getAsk(askID).catch(() => {
|
|
@@ -49053,14 +49139,29 @@ async function movedApprovalLine(client, askID) {
|
|
|
49053
49139
|
const owner = ask.issue_key === null ? `--project ${ask.approval_artifact?.project ?? "<project>"} --artifact ${approval.artifact_id}` : ask.approval_artifact?.primary === true ? `--issue ${ask.issue_key}` : `--issue ${ask.issue_key} --artifact ${approval.artifact_id}`;
|
|
49054
49140
|
return `The reply did not hand the ask to the human: it is the approval request for ${approval.name} ` + `at version ${approval.requested_version}, and ${approval.name} is now version ${approval.version}. ` + "No reply hands a moved approval request back. Once the human has agreed to every point in " + `version ${approval.version}, run: dispatch request-approval ${owner} --summary ` + `'<what changed since version ${approval.requested_version}>'`;
|
|
49055
49141
|
}
|
|
49056
|
-
async function
|
|
49142
|
+
async function replyToAskCandidates(client, owner, resolved) {
|
|
49057
49143
|
if (owner.kind === "issue") {
|
|
49058
49144
|
const issue = resolved?.issue ?? await client.getIssue(owner.issue);
|
|
49059
|
-
return
|
|
49145
|
+
return { asks: issue.open_asks ?? [], owner: "this issue" };
|
|
49060
49146
|
}
|
|
49061
49147
|
if (resolved === undefined)
|
|
49062
49148
|
throw new Error("project document is missing its resolved artifact");
|
|
49063
|
-
return
|
|
49149
|
+
return {
|
|
49150
|
+
asks: await client.getArtifactAsks(resolved.artifact.id, "open"),
|
|
49151
|
+
owner: "this document"
|
|
49152
|
+
};
|
|
49153
|
+
}
|
|
49154
|
+
async function resolveReplyToAsk(tool, client, target, resolved, id) {
|
|
49155
|
+
const whole = normalizeUUID(id);
|
|
49156
|
+
if (whole !== undefined)
|
|
49157
|
+
return whole;
|
|
49158
|
+
const { asks, owner } = await replyToAskCandidates(client, target, resolved);
|
|
49159
|
+
if (!isIdPrefix(id)) {
|
|
49160
|
+
throw new ToolInputError(tool, [askIDInputProblem(asks, owner)], { aboutAFlag: false });
|
|
49161
|
+
}
|
|
49162
|
+
return resolveIdPrefix(tool, "ask", id, owner, async () => asks, {
|
|
49163
|
+
refusal: (found, all) => found.length === 0 ? `reply_to_ask ${id} names no open ask of ${owner}. ${openAskChoices(all, owner)}` : `reply_to_ask ${id} names ${found.length} open asks of ${owner}. Write more of the id. ${openAskChoices(all, owner)}`
|
|
49164
|
+
});
|
|
49064
49165
|
}
|
|
49065
49166
|
function anchor(artifact, args) {
|
|
49066
49167
|
const quote = optionalString(args, "quote");
|
|
@@ -49100,6 +49201,89 @@ function approvalLine(artifact) {
|
|
|
49100
49201
|
return `Approval: ${approval.state} on v${approval.version}${content}`;
|
|
49101
49202
|
}
|
|
49102
49203
|
}
|
|
49204
|
+
function artifactUnderName(artifacts, name) {
|
|
49205
|
+
const written = name.trim();
|
|
49206
|
+
return artifacts.find((held) => held.slug === written) ?? artifacts.find((held) => held.name === written);
|
|
49207
|
+
}
|
|
49208
|
+
function artifactNameExistsProblem(held, owner) {
|
|
49209
|
+
const versions = held.versions ?? [];
|
|
49210
|
+
const newest = versions[versions.length - 1];
|
|
49211
|
+
if (newest === undefined) {
|
|
49212
|
+
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}`;
|
|
49213
|
+
}
|
|
49214
|
+
const authors = (newest.authors ?? []).map(actorText);
|
|
49215
|
+
const wroteIt = authors.length === 0 ? actorText(held.created_by) : authors.join(" and ");
|
|
49216
|
+
return `${owner} already holds ${held.name} (slug ${held.slug}, kind ${held.kind}) at version ${newest.number}, which ${wroteIt} wrote. ${ARTIFACT_NAME_EXISTS_RULE}`;
|
|
49217
|
+
}
|
|
49218
|
+
var STORED_LINE_QUOTED = 200;
|
|
49219
|
+
function quotedStoredLine(line) {
|
|
49220
|
+
if (line.length <= STORED_LINE_QUOTED)
|
|
49221
|
+
return JSON.stringify(line);
|
|
49222
|
+
const head = JSON.stringify(line.slice(0, STORED_LINE_QUOTED));
|
|
49223
|
+
return `${head} (cut after ${STORED_LINE_QUOTED} of its ${line.length} characters)`;
|
|
49224
|
+
}
|
|
49225
|
+
function firstStoredDifference(given, stored) {
|
|
49226
|
+
const written = given.split(`
|
|
49227
|
+
`);
|
|
49228
|
+
const holds = stored.split(`
|
|
49229
|
+
`);
|
|
49230
|
+
for (let line = 0;line < Math.max(written.length, holds.length); line += 1) {
|
|
49231
|
+
const wrote = written[line];
|
|
49232
|
+
const held = holds[line];
|
|
49233
|
+
if (wrote === held)
|
|
49234
|
+
continue;
|
|
49235
|
+
if (wrote === undefined && held !== undefined) {
|
|
49236
|
+
return `the store writes a line ${line + 1}, ${quotedStoredLine(held)}`;
|
|
49237
|
+
}
|
|
49238
|
+
if (held === undefined && wrote !== undefined) {
|
|
49239
|
+
return `the store drops line ${line + 1}, ${quotedStoredLine(wrote)}`;
|
|
49240
|
+
}
|
|
49241
|
+
if (wrote !== undefined && held !== undefined) {
|
|
49242
|
+
return `line ${line + 1} reads ${quotedStoredLine(wrote)} and is stored as ${quotedStoredLine(held)}`;
|
|
49243
|
+
}
|
|
49244
|
+
}
|
|
49245
|
+
return "the stored text differs from the text given";
|
|
49246
|
+
}
|
|
49247
|
+
var STORED_TEXT_PRINTED = 2000;
|
|
49248
|
+
function storedTextPrinted(stored) {
|
|
49249
|
+
if (stored.length <= STORED_TEXT_PRINTED)
|
|
49250
|
+
return { text: stored, cut: "" };
|
|
49251
|
+
const head = stored.slice(0, STORED_TEXT_PRINTED);
|
|
49252
|
+
const lastLineFeed = head.lastIndexOf(`
|
|
49253
|
+
`);
|
|
49254
|
+
const text = lastLineFeed === -1 ? head : head.slice(0, lastLineFeed + 1);
|
|
49255
|
+
return {
|
|
49256
|
+
text,
|
|
49257
|
+
cut: ` The text below is cut after ${text.length} of its ${stored.length} characters: change the line named above and send the text again.`
|
|
49258
|
+
};
|
|
49259
|
+
}
|
|
49260
|
+
function storedTextProblem(given, stored, name) {
|
|
49261
|
+
const asBytes = pathKeepsBytesOf(name) ? ` To keep the text as you wrote it, send it as a file with ${PATH_KEEPS_BYTES}.` : "";
|
|
49262
|
+
const printed = storedTextPrinted(stored);
|
|
49263
|
+
return [
|
|
49264
|
+
`Dispatch stores this text under another spelling: ${firstStoredDifference(given, stored)}.`,
|
|
49265
|
+
` Send the text Dispatch stores, which is between the two marker lines below.${asBytes}`,
|
|
49266
|
+
`${printed.cut}
|
|
49267
|
+
--- the text Dispatch stores ---
|
|
49268
|
+
${printed.text}`,
|
|
49269
|
+
"--- end of the text Dispatch stores ---"
|
|
49270
|
+
].join("");
|
|
49271
|
+
}
|
|
49272
|
+
function storedTextCheckFailed(error, name) {
|
|
49273
|
+
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)}.`;
|
|
49274
|
+
if (!dispatchAnswered(error, 413)) {
|
|
49275
|
+
return `${failure} Send the upload again once that call is answered.`;
|
|
49276
|
+
}
|
|
49277
|
+
const asBytes = pathKeepsBytesOf(name) ? ` Send it as a file with ${PATH_KEEPS_BYTES}, which asks this check nothing.` : "";
|
|
49278
|
+
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}`;
|
|
49279
|
+
}
|
|
49280
|
+
function roundTripRouteAbsent(error) {
|
|
49281
|
+
return dispatchAnswered(error, 404) || dispatchAnswered(error, 405);
|
|
49282
|
+
}
|
|
49283
|
+
function withoutFinalLineFeed(text) {
|
|
49284
|
+
return text.endsWith(`
|
|
49285
|
+
`) ? text.slice(0, -1) : text;
|
|
49286
|
+
}
|
|
49103
49287
|
function componentsLine(components) {
|
|
49104
49288
|
const ids = components.ids ?? [];
|
|
49105
49289
|
const unknown = components.unknown ?? [];
|
|
@@ -49193,7 +49377,96 @@ function progressText(progress, sep) {
|
|
|
49193
49377
|
}
|
|
49194
49378
|
return parts.join(sep);
|
|
49195
49379
|
}
|
|
49196
|
-
|
|
49380
|
+
var BRIEF_READING_CHARACTERS = 200;
|
|
49381
|
+
var COMPARISON_REASONS = {
|
|
49382
|
+
no_pull_request_or_branch: "the issue has no pull request and no branch to compare with",
|
|
49383
|
+
repository_unreadable: "Dispatch cannot read the repository",
|
|
49384
|
+
read_failed: "a read Dispatch made did not answer"
|
|
49385
|
+
};
|
|
49386
|
+
function learnedText(learned) {
|
|
49387
|
+
if (learned.kind === "read_at")
|
|
49388
|
+
return `Dispatch read it ${learned.at}`;
|
|
49389
|
+
return `GitHub updated it ${learned.at}`;
|
|
49390
|
+
}
|
|
49391
|
+
function basisText(basis) {
|
|
49392
|
+
const learned = basis.learned_at === undefined ? "" : ` (${learnedText(basis.learned_at)})`;
|
|
49393
|
+
if (basis.kind === "pull_request") {
|
|
49394
|
+
const number = basis.pull_request === undefined ? "" : `#${basis.pull_request} `;
|
|
49395
|
+
return `the head of pull request ${number}at ${basis.commit ?? "an unnamed commit"}${learned}`;
|
|
49396
|
+
}
|
|
49397
|
+
if (basis.kind === "branch")
|
|
49398
|
+
return `branch ${basis.branch ?? "unnamed"}${learned}`;
|
|
49399
|
+
return `the commit you named, ${basis.commit ?? ""}${learned}`;
|
|
49400
|
+
}
|
|
49401
|
+
function basisPlace(basis) {
|
|
49402
|
+
if (basis.kind === "pull_request") {
|
|
49403
|
+
return basis.pull_request === undefined ? "the head of a pull request" : `the head of pull request #${basis.pull_request}`;
|
|
49404
|
+
}
|
|
49405
|
+
if (basis.kind === "branch")
|
|
49406
|
+
return `on branch ${basis.branch ?? "unnamed"}`;
|
|
49407
|
+
return "the commit you named";
|
|
49408
|
+
}
|
|
49409
|
+
function commitStandsText(stands) {
|
|
49410
|
+
if (stands === undefined) {
|
|
49411
|
+
return "Where that commit stands is not known: this Dispatch server does not say";
|
|
49412
|
+
}
|
|
49413
|
+
if (stands.answer === "at_basis") {
|
|
49414
|
+
return stands.basis === undefined ? "That commit is one of the compared commits" : `That commit is ${basisPlace(stands.basis)}`;
|
|
49415
|
+
}
|
|
49416
|
+
if (stands.answer === "other_commit")
|
|
49417
|
+
return "That commit is none of the compared commits";
|
|
49418
|
+
return stands.reason === undefined ? "Where that commit stands is not known" : `Where that commit stands is not known: ${COMPARISON_REASONS[stands.reason]}`;
|
|
49419
|
+
}
|
|
49420
|
+
function checkWordsText(check, result) {
|
|
49421
|
+
const versions = `result version ${result.check_version}, check version ${check.version}`;
|
|
49422
|
+
if (result.check_words_moved === undefined) {
|
|
49423
|
+
return `Whether the check's words moved is not known (${versions})`;
|
|
49424
|
+
}
|
|
49425
|
+
return result.check_words_moved ? `The check's words moved after this result (${versions})` : `The check's words did not move after this result (${versions})`;
|
|
49426
|
+
}
|
|
49427
|
+
function passStandsText(pass) {
|
|
49428
|
+
if (pass === undefined)
|
|
49429
|
+
return "Whether a pass stands is not known: this Dispatch server does not say";
|
|
49430
|
+
if (pass.answer === "yes") {
|
|
49431
|
+
const roles = pass.roles ?? [];
|
|
49432
|
+
return roles.length === 0 ? "A pass stands: yes" : `A pass stands: yes, from ${roles.join(", ")}`;
|
|
49433
|
+
}
|
|
49434
|
+
if (pass.answer === "no")
|
|
49435
|
+
return "A pass stands: no";
|
|
49436
|
+
return "A pass stands: not known";
|
|
49437
|
+
}
|
|
49438
|
+
function readingLines(result, brief) {
|
|
49439
|
+
const observed = result.observed;
|
|
49440
|
+
if (observed === "")
|
|
49441
|
+
return [" The role recorded no reading."];
|
|
49442
|
+
const cut = brief && result.commit_stands?.answer !== "at_basis";
|
|
49443
|
+
if (cut && observed.length > BRIEF_READING_CHARACTERS) {
|
|
49444
|
+
return [` Reading: ${observed.slice(0, BRIEF_READING_CHARACTERS)}\u2026 (result ${result.id})`];
|
|
49445
|
+
}
|
|
49446
|
+
return [` Reading: ${observed}`];
|
|
49447
|
+
}
|
|
49448
|
+
function resultLines(check, result, brief) {
|
|
49449
|
+
const lines = [
|
|
49450
|
+
` - ${result.verdict} by ${result.role} at ${result.commit_sha}. ${commitStandsText(result.commit_stands)}. ${checkWordsText(check, result)}. Recorded ${result.created_at}. Result ${result.id}.`
|
|
49451
|
+
];
|
|
49452
|
+
const retracted = result.retracted;
|
|
49453
|
+
if (retracted !== undefined) {
|
|
49454
|
+
lines.push(` Retracted by ${actorText(retracted.actor)} at ${retracted.created_at}. The reason: ${retracted.reason}`);
|
|
49455
|
+
}
|
|
49456
|
+
return [...lines, ...readingLines(result, brief)];
|
|
49457
|
+
}
|
|
49458
|
+
function checkLines(check, brief) {
|
|
49459
|
+
const bases = check.compared_with ?? [];
|
|
49460
|
+
const reason = check.compared_nothing;
|
|
49461
|
+
const compared = bases.length > 0 ? `Compared with ${bases.map(basisText).join(", ")}` : reason === undefined ? "Compared with nothing, and this Dispatch server does not say why" : `Compared with nothing: ${COMPARISON_REASONS[reason]}`;
|
|
49462
|
+
const results = check.results ?? [];
|
|
49463
|
+
return [
|
|
49464
|
+
`- ${check.block_id} (${check.when}). ${compared}. ${passStandsText(check.pass_stands)}.`,
|
|
49465
|
+
` The check's words: ${check.text}`,
|
|
49466
|
+
...results.length === 0 ? [" No result is recorded for this check."] : results.flatMap((result) => resultLines(check, result, brief))
|
|
49467
|
+
];
|
|
49468
|
+
}
|
|
49469
|
+
function formatCheckResults(results, brief = false) {
|
|
49197
49470
|
if (results.verification_artifact_id === "") {
|
|
49198
49471
|
return `${results.issue} has no Verification document, so it has no checks. Write one (verification.md) with a check block per thing that must be proved.`;
|
|
49199
49472
|
}
|
|
@@ -49201,15 +49474,10 @@ function formatCheckResults(results) {
|
|
|
49201
49474
|
if (checks.length === 0) {
|
|
49202
49475
|
return `${results.issue}'s Verification document holds no check blocks.`;
|
|
49203
49476
|
}
|
|
49204
|
-
const
|
|
49205
|
-
|
|
49206
|
-
|
|
49207
|
-
|
|
49208
|
-
return `${head}no result yet. ${check.text}`;
|
|
49209
|
-
}
|
|
49210
|
-
return `${head}${latest.verdict} at ${latest.commit_sha} by ${latest.role}, ${latest.currency ?? "unknown"}. ${check.text}`;
|
|
49211
|
-
});
|
|
49212
|
-
return [`Checks of ${results.issue}:`, ...lines].join(`
|
|
49477
|
+
const blocks = checks.map((check) => checkLines(check, brief).join(`
|
|
49478
|
+
`));
|
|
49479
|
+
return [`Checks of ${results.issue}:`, ...blocks].join(`
|
|
49480
|
+
|
|
49213
49481
|
`);
|
|
49214
49482
|
}
|
|
49215
49483
|
function repositoryLine(issue) {
|
|
@@ -49876,9 +50144,6 @@ ${text}`,
|
|
|
49876
50144
|
var BLOCK_OPENING_CHARS = 60;
|
|
49877
50145
|
async function listDocumentBlocks(client, artifact) {
|
|
49878
50146
|
const live = await liveBlocks(client, artifact);
|
|
49879
|
-
if (live === undefined) {
|
|
49880
|
-
throw new Error(`${artifact.name} changed while dispatch doc-read --blocks read it, so the opening words could name the wrong text; nothing is listed. Run it again.`);
|
|
49881
|
-
}
|
|
49882
50147
|
const { bytes, blocks } = live;
|
|
49883
50148
|
const decoder = new TextDecoder;
|
|
49884
50149
|
const lines = [
|
|
@@ -49915,15 +50180,19 @@ async function listDocumentBlocks(client, artifact) {
|
|
|
49915
50180
|
holders.push(block);
|
|
49916
50181
|
}
|
|
49917
50182
|
return { text: lines.join(`
|
|
49918
|
-
`), token: live.token };
|
|
50183
|
+
`), token: live.token, version: live.version };
|
|
49919
50184
|
}
|
|
49920
50185
|
async function liveBlocks(client, artifact) {
|
|
49921
|
-
const
|
|
49922
|
-
|
|
49923
|
-
|
|
49924
|
-
|
|
49925
|
-
|
|
49926
|
-
|
|
50186
|
+
const read = await client.docReadWithBlocks(artifact.id);
|
|
50187
|
+
if (read.blocks === undefined) {
|
|
50188
|
+
throw new Error(`${artifact.name} was read from a Dispatch older than this command: it serves a document's blocks only on their own route, not beside the text they index, so nothing was listed.`);
|
|
50189
|
+
}
|
|
50190
|
+
return {
|
|
50191
|
+
bytes: new TextEncoder().encode(read.markdown),
|
|
50192
|
+
token: read.token,
|
|
50193
|
+
version: read.version ?? null,
|
|
50194
|
+
blocks: read.blocks
|
|
50195
|
+
};
|
|
49927
50196
|
}
|
|
49928
50197
|
async function refuseOpenDecisionBlocks(client, tool, resolved) {
|
|
49929
50198
|
const artifact = resolved.artifact;
|
|
@@ -50706,12 +50975,7 @@ async function executeDispatchTool(input) {
|
|
|
50706
50975
|
const anchored = resolved ? anchor(resolved.artifact, args) : undefined;
|
|
50707
50976
|
const replyTo = itemReplyTo(args, "reply_to");
|
|
50708
50977
|
const replyToAskTarget = itemReplyTo(args, "reply_to_ask");
|
|
50709
|
-
const replyToAsk = replyToAskTarget === undefined ? undefined :
|
|
50710
|
-
if (replyToAskTarget !== undefined && replyToAsk === undefined) {
|
|
50711
|
-
throw new ToolInputError(input.tool, [
|
|
50712
|
-
await invalidReplyToAskProblem(client, owner, resolved)
|
|
50713
|
-
]);
|
|
50714
|
-
}
|
|
50978
|
+
const replyToAsk = replyToAskTarget === undefined ? undefined : await resolveReplyToAsk(input.tool, client, owner, resolved, replyToAskTarget.id);
|
|
50715
50979
|
const replyToBlock = replyTo?.block ?? replyToAskTarget?.block;
|
|
50716
50980
|
const requestedTurn = optionalString(args, "turn");
|
|
50717
50981
|
const body = await writePictures(resolved, stringArg(args, "body"));
|
|
@@ -50932,10 +51196,15 @@ async function executeDispatchTool(input) {
|
|
|
50932
51196
|
throw new Error(`${resolved.artifact.name} is an uploaded ${resolved.artifact.kind}, not a document, so it has no blocks. Read it with dispatch doc-read without --blocks.`);
|
|
50933
51197
|
}
|
|
50934
51198
|
const listed = await listDocumentBlocks(client, resolved.artifact);
|
|
51199
|
+
const trailer = [
|
|
51200
|
+
...listed.token === undefined ? [] : [`Document token: ${listed.token}`],
|
|
51201
|
+
`Document version: ${listed.version === null ? "none yet" : listed.version}`
|
|
51202
|
+
];
|
|
50935
51203
|
return {
|
|
50936
|
-
text:
|
|
51204
|
+
text: `${listed.text}
|
|
50937
51205
|
|
|
50938
|
-
|
|
51206
|
+
${trailer.join(`
|
|
51207
|
+
`)}`,
|
|
50939
51208
|
details: resolved.owner.kind === "project" ? {
|
|
50940
51209
|
project: resolved.artifact.project,
|
|
50941
51210
|
document: documentLabel(resolved.artifact.project, resolved.artifact.slug)
|
|
@@ -51036,6 +51305,23 @@ Document token: ${listed.token}`,
|
|
|
51036
51305
|
};
|
|
51037
51306
|
}
|
|
51038
51307
|
case "dispatch_result": {
|
|
51308
|
+
const retract = optionalString(args, "retract");
|
|
51309
|
+
if (retract !== undefined) {
|
|
51310
|
+
const retraction = await client.retractResult(retract, {
|
|
51311
|
+
actor,
|
|
51312
|
+
reason: stringArg(args, "reason")
|
|
51313
|
+
});
|
|
51314
|
+
return {
|
|
51315
|
+
text: `Retracted result ${retraction.result_id}. ${actorText(retraction.actor)} retracted it at ${retraction.created_at}. The reason: ${retraction.reason}
|
|
51316
|
+
|
|
51317
|
+
The result stays readable, and it proves nothing from now on. Record a new result where the check still needs one.`,
|
|
51318
|
+
details: {
|
|
51319
|
+
result: retraction.result_id,
|
|
51320
|
+
reason: retraction.reason,
|
|
51321
|
+
created_at: retraction.created_at
|
|
51322
|
+
}
|
|
51323
|
+
};
|
|
51324
|
+
}
|
|
51039
51325
|
const issue = stringArg(args, "issue");
|
|
51040
51326
|
const optional = {
|
|
51041
51327
|
...defined("surface", optionalString(args, "surface")),
|
|
@@ -51071,16 +51357,45 @@ ${recorded.line}`,
|
|
|
51071
51357
|
}
|
|
51072
51358
|
case "dispatch_results": {
|
|
51073
51359
|
const issue = stringArg(args, "issue");
|
|
51074
|
-
const
|
|
51360
|
+
const at = optionalString(args, "at");
|
|
51361
|
+
const brief = optionalBoolean(args, "brief") === true;
|
|
51362
|
+
const results = await client.issueResults(issue, at);
|
|
51363
|
+
const checks = results.checks ?? [];
|
|
51075
51364
|
return {
|
|
51076
|
-
text: formatCheckResults(results),
|
|
51077
|
-
details: {
|
|
51365
|
+
text: formatCheckResults(results, brief),
|
|
51366
|
+
details: {
|
|
51367
|
+
issue,
|
|
51368
|
+
checks: checks.length,
|
|
51369
|
+
results: checks.reduce((total, check) => total + (check.results ?? []).length, 0)
|
|
51370
|
+
}
|
|
51078
51371
|
};
|
|
51079
51372
|
}
|
|
51080
51373
|
case "dispatch_artifact": {
|
|
51081
51374
|
const summary = optionalString(args, "summary");
|
|
51082
51375
|
const name = stringArg(args, "name");
|
|
51083
51376
|
const content = optionalString(args, "content");
|
|
51377
|
+
const artifactOwner = documentOwner();
|
|
51378
|
+
if (optionalBoolean(args, "force") !== true) {
|
|
51379
|
+
const held = artifactUnderName(artifactOwner.kind === "project" ? await client.listProjectArtifacts(artifactOwner.project, true) : await client.listIssueArtifacts(issue()), name);
|
|
51380
|
+
if (held !== undefined) {
|
|
51381
|
+
throw new ToolInputError(input.tool, [
|
|
51382
|
+
artifactNameExistsProblem(held, artifactOwner.kind === "project" ? `project ${artifactOwner.project}` : `issue ${issue()}`)
|
|
51383
|
+
]);
|
|
51384
|
+
}
|
|
51385
|
+
}
|
|
51386
|
+
if (content !== undefined) {
|
|
51387
|
+
let stored;
|
|
51388
|
+
try {
|
|
51389
|
+
stored = await client.markdownRoundTrip(content);
|
|
51390
|
+
} catch (error) {
|
|
51391
|
+
if (!roundTripRouteAbsent(error)) {
|
|
51392
|
+
throw new Error(storedTextCheckFailed(error, name), { cause: error });
|
|
51393
|
+
}
|
|
51394
|
+
}
|
|
51395
|
+
if (stored !== undefined && withoutFinalLineFeed(stored) !== withoutFinalLineFeed(content)) {
|
|
51396
|
+
throw new ToolInputError(input.tool, [storedTextProblem(content, stored, name)]);
|
|
51397
|
+
}
|
|
51398
|
+
}
|
|
51084
51399
|
const artifactInput = content === undefined ? {
|
|
51085
51400
|
name,
|
|
51086
51401
|
file: input.uploadBytes === undefined ? Bun.file(resolvePath2(input.cwd, stringArg(args, "path"))) : new Blob([new Uint8Array(input.uploadBytes)], {
|
|
@@ -51094,7 +51409,6 @@ ${recorded.line}`,
|
|
|
51094
51409
|
...summary === undefined ? {} : { summary },
|
|
51095
51410
|
actor
|
|
51096
51411
|
};
|
|
51097
|
-
const artifactOwner = documentOwner();
|
|
51098
51412
|
const result = artifactOwner.kind === "project" ? await client.projectArtifact(artifactOwner.project, artifactInput) : await client.artifact(issue(), artifactInput);
|
|
51099
51413
|
const artifactRef = dispatchDocumentRef(artifactOwner.kind === "project" ? artifactOwner.project : issue(), result.artifact.slug);
|
|
51100
51414
|
const uploadOwner = artifactOwner.kind === "project" ? documentTopic(result.artifact) : issueTopic(issue());
|
|
@@ -55499,7 +55813,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
55499
55813
|
|
|
55500
55814
|
// package.json
|
|
55501
55815
|
var name = "@sjawhar/claude-envoy";
|
|
55502
|
-
var version2 = "2.
|
|
55816
|
+
var version2 = "2.2.0";
|
|
55503
55817
|
var legion = {
|
|
55504
55818
|
daemonApiVersion: 73
|
|
55505
55819
|
};
|