@sjawhar/claude-envoy 4.14.6 → 4.15.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/dist/codex-hook.js +178 -130
- package/dist/dispatch.js +178 -130
- package/dist/envoy-channel.js +180 -132
- package/dist/session-hook.js +178 -130
- package/package.json +2 -2
package/dist/dispatch.js
CHANGED
|
@@ -15425,17 +15425,41 @@ var documentEditValidation = {
|
|
|
15425
15425
|
};
|
|
15426
15426
|
var commentOwner = documentOwnerValidation(true);
|
|
15427
15427
|
var COMMENT_TURN_RULE = "turn requires reply_to_ask: turn says who holds an open ask's thread after the reply. Pass reply_to_ask with the open ask's id, or drop turn.";
|
|
15428
|
+
var MAX_COMMENT_MENTIONS = 10;
|
|
15429
|
+
var COMMENT_MENTION_LIMIT_RULE = `mentions allow at most ${MAX_COMMENT_MENTIONS} targets`;
|
|
15430
|
+
var MENTION_TARGET_PATTERNS = [/^role:[a-z0-9-]+$/, /^session:[A-Za-z0-9_-]+$/];
|
|
15431
|
+
var COMMENT_MENTION_TARGET_RULE = "mention target must be role:<name> or session:<id>";
|
|
15432
|
+
var COMMENT_MENTION_REPEAT_RULE = "mentions must not repeat a target";
|
|
15433
|
+
function mentionProblem(mentions) {
|
|
15434
|
+
if (!Array.isArray(mentions))
|
|
15435
|
+
return;
|
|
15436
|
+
if (mentions.length > MAX_COMMENT_MENTIONS)
|
|
15437
|
+
return COMMENT_MENTION_LIMIT_RULE;
|
|
15438
|
+
const seen = new Set;
|
|
15439
|
+
for (const target of mentions) {
|
|
15440
|
+
if (typeof target !== "string" || !MENTION_TARGET_PATTERNS.some((pattern) => pattern.test(target))) {
|
|
15441
|
+
return COMMENT_MENTION_TARGET_RULE;
|
|
15442
|
+
}
|
|
15443
|
+
if (seen.has(target))
|
|
15444
|
+
return COMMENT_MENTION_REPEAT_RULE;
|
|
15445
|
+
seen.add(target);
|
|
15446
|
+
}
|
|
15447
|
+
return;
|
|
15448
|
+
}
|
|
15428
15449
|
function commentProblem(value) {
|
|
15429
15450
|
const input = value;
|
|
15451
|
+
const mention = mentionProblem(input.mentions);
|
|
15430
15452
|
return brokenParts([
|
|
15431
15453
|
[commentOwner.check(value), commentOwner.message],
|
|
15432
|
-
[input.turn === undefined || typeof input.reply_to_ask === "string", COMMENT_TURN_RULE]
|
|
15454
|
+
[input.turn === undefined || typeof input.reply_to_ask === "string", COMMENT_TURN_RULE],
|
|
15455
|
+
[mention === undefined, mention ?? ""]
|
|
15433
15456
|
]);
|
|
15434
15457
|
}
|
|
15458
|
+
var COMMENT_RULE = `${commentOwner.message} ${COMMENT_TURN_RULE} ${COMMENT_MENTION_LIMIT_RULE}, each ${COMMENT_MENTION_TARGET_RULE}, and ${COMMENT_MENTION_REPEAT_RULE}.`;
|
|
15435
15459
|
var commentValidation = {
|
|
15436
15460
|
check: (value) => commentProblem(value) === undefined,
|
|
15437
|
-
message:
|
|
15438
|
-
refusal: (value) => commentProblem(value) ??
|
|
15461
|
+
message: COMMENT_RULE,
|
|
15462
|
+
refusal: (value) => commentProblem(value) ?? COMMENT_RULE
|
|
15439
15463
|
};
|
|
15440
15464
|
var ISSUE_UPDATE_FIELDS_RULE = "Issue update requires at least one field besides issue: status, title, labels, priority, assignee, external_links, route, parent, blocked_by, advances, components, repo, before, or after.";
|
|
15441
15465
|
var ISSUE_UPDATE_DONE_RULE = "status done requires reason, a non-empty note saying why the issue is closing, posted on the issue before it closes so the close carries its note";
|
|
@@ -15795,6 +15819,7 @@ var dispatchToolSpecs = [
|
|
|
15795
15819
|
reply_to: z.string().describe("A comment id (uuid); replying to any comment in a thread continues that thread (an " + "ask's clarification thread included). A block reference to one block of the comment " + "(dispatch://KEY/comment/<id>#b-<block id>) replies to that comment and names the " + "passage the reply answers. To reply to an ask, use reply_to_ask with the ask id, or " + "with a reference to one of its parts, instead.").optional(),
|
|
15796
15820
|
reply_to_ask: z.string().describe("Optional ask id to reply to, threading this comment under that question. A block " + "reference to one part of the ask (dispatch://KEY/ask/<id>#b-<part id>, the id an " + "option or the answer carries) threads under that ask and names the part the reply " + "answers. Mutually exclusive with reply_to.").optional(),
|
|
15797
15821
|
turn: z.enum(["agent", "human"]).describe("Only with reply_to_ask: who holds the turn after this reply. agent: a progress note - " + "you keep the turn and the ask stays 'Waiting on agents' for the human; human (default): " + "you need the human to act - the ask returns to 'Waiting on you'. human does not " + "apply to an approval request a newer version moved: it stays with you until dispatch " + "request-approval hands it back at the current version.").optional(),
|
|
15822
|
+
mentions: z.array(z.string()).describe("Optional targets the comment mentions: role:<name> (lowercase letters, digits and -), " + "which reaches the session holding that role, or session:<id> (letters, digits, _ " + "and -); at most 10, none named twice. Dispatch delivers the comment to each target, " + "retries a send that does not go through, and records every attempt on the comment.").optional(),
|
|
15798
15823
|
images: imagesArgument(z, "the issue (or the project document's project)")
|
|
15799
15824
|
}),
|
|
15800
15825
|
validation: commentValidation
|
|
@@ -15940,7 +15965,7 @@ var dispatchToolSpecs = [
|
|
|
15940
15965
|
verdict: "pass",
|
|
15941
15966
|
commit: "1111111111111111111111111111111111111111"
|
|
15942
15967
|
},
|
|
15943
|
-
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, no private host and no issue key: Dispatch keeps only words " + "of letters, digits and plain punctuation, and of those leaves out every word that holds " + "`://`, a private or Dispatch host, or an issue key of one of its projects; the record keeps " + "the whole reading. --dry-run prints the line the record would print, and records nothing. " + "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. " + `${CHECK_PROVED_BY_CI}. ` + "Dispatch reads its result from that run, so a record for it is 409 " + "CHECK_PROVED_BY_CI from every role, which names the check and the run. " + "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
|
|
15968
|
+
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, no private host and no issue key: Dispatch keeps only words " + "of letters, digits and plain punctuation, and of those leaves out every word that holds " + "`://`, a private or Dispatch host, or an issue key of one of its projects; the record keeps " + "the whole reading. --dry-run prints the line the record would print, and records nothing. " + "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. " + `${CHECK_PROVED_BY_CI}. ` + "Dispatch reads its result from that run, so a record for it is 409 " + "CHECK_PROVED_BY_CI from every role, which names the check and the run. " + "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. If " + "GitHub does not say that it does, Dispatch reads the external links of the check's issue: " + "a link to a GitHub pull request (https://github.com/<owner>/<repo>/pull/<n>) that is open " + "or merged, in a repository that Dispatch's GitHub App is installed on and can read, adds " + "the repository of that pull request. One record reads at most 10 linked pull requests. A " + "commit that none of these repositories holds is 400 RESULT_COMMIT_UNKNOWN, which names the " + "commit and each owner/repo that Dispatch asked. It also names, with its reason " + "(owner/repo#n (repository_unreadable)), each linked pull request that Dispatch could not " + "read, at most 10 and a count of the rest, and every linked pull request in whose " + "repository it could not read the commit, since each of those spent one of the record's 10 " + "reads, and says to grant Dispatch's GitHub App that repository or to link a readable pull " + "request. It says how many linked pull requests it left unread past that bound. Record the " + "result after the commit is pushed. A linked repository that the App is not installed on " + "or cannot read does " + "not count. Where a read of " + "a linked pull request or of a linked repository does not answer, and no repository is shown " + "to hold the commit, the record is 502 GITHUB_UNREADABLE and nothing is recorded: record the " + "result again, after the wait the refusal names for a rate limit. Where the issue has no " + "repository, the result is recorded as before. Where Dispatch cannot read the repository " + "of the check's issue, the result is recorded as before only when every linked read " + "answers and no linked repository holds the commit: a linked read that does not answer " + "is 502 GITHUB_UNREADABLE and nothing is recorded. " + "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. " + "A check a document version rewords while the result is being written is 409 " + "CHECK_CONTENDED, with nothing recorded: run the same command again. " + 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,
|
|
15944
15969
|
arguments: (z) => ({
|
|
15945
15970
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
15946
15971
|
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(),
|
|
@@ -24729,6 +24754,153 @@ function childrenSummary(issue) {
|
|
|
24729
24754
|
`);
|
|
24730
24755
|
}
|
|
24731
24756
|
|
|
24757
|
+
// ../envoy-client/src/dispatch-commands/render-results.ts
|
|
24758
|
+
var BRIEF_READING_CHARACTERS = 200;
|
|
24759
|
+
var COMPARISON_REASONS = {
|
|
24760
|
+
no_pull_request_or_branch: () => "the issue has no pull request and no branch to compare with",
|
|
24761
|
+
repository_unreadable: (repo = "the repository") => `Dispatch cannot read ${repo}`,
|
|
24762
|
+
read_failed: (repo) => repo === undefined ? "a read Dispatch made did not answer" : `a read Dispatch made of ${repo} did not answer`
|
|
24763
|
+
};
|
|
24764
|
+
function isComparisonReason(reason) {
|
|
24765
|
+
return Object.hasOwn(COMPARISON_REASONS, reason);
|
|
24766
|
+
}
|
|
24767
|
+
function reasonText(reason, repo) {
|
|
24768
|
+
if (isComparisonReason(reason))
|
|
24769
|
+
return COMPARISON_REASONS[reason](repo);
|
|
24770
|
+
return repo === undefined ? reason : `${reason} (${repo})`;
|
|
24771
|
+
}
|
|
24772
|
+
function learnedText(learned) {
|
|
24773
|
+
if (learned.kind === "read_at")
|
|
24774
|
+
return `Dispatch read it ${learned.at}`;
|
|
24775
|
+
return `GitHub updated it ${learned.at}`;
|
|
24776
|
+
}
|
|
24777
|
+
function pullRequestName(basis, number) {
|
|
24778
|
+
return basis.repo === undefined ? `pull request #${number}` : `${basis.repo}#${number}`;
|
|
24779
|
+
}
|
|
24780
|
+
function branchName(basis) {
|
|
24781
|
+
const branch = basis.branch ?? "unnamed";
|
|
24782
|
+
return basis.repo === undefined ? branch : `${branch} of ${basis.repo}`;
|
|
24783
|
+
}
|
|
24784
|
+
function basisText(basis) {
|
|
24785
|
+
const learned = basis.learned_at === undefined ? "" : ` (${learnedText(basis.learned_at)})`;
|
|
24786
|
+
if (basis.kind === "pull_request") {
|
|
24787
|
+
const pullRequest = basis.pull_request === undefined ? "pull request " : `${pullRequestName(basis, basis.pull_request)} `;
|
|
24788
|
+
return `the head of ${pullRequest}at ${basis.commit ?? "an unnamed commit"}${learned}`;
|
|
24789
|
+
}
|
|
24790
|
+
if (basis.kind === "branch")
|
|
24791
|
+
return `branch ${branchName(basis)}${learned}`;
|
|
24792
|
+
return `the commit you named, ${basis.commit ?? ""}${learned}`;
|
|
24793
|
+
}
|
|
24794
|
+
function basisPlace(basis) {
|
|
24795
|
+
if (basis.kind === "pull_request") {
|
|
24796
|
+
return basis.pull_request === undefined ? "the head of a pull request" : `the head of ${pullRequestName(basis, basis.pull_request)}`;
|
|
24797
|
+
}
|
|
24798
|
+
if (basis.kind === "branch")
|
|
24799
|
+
return `on branch ${branchName(basis)}`;
|
|
24800
|
+
return "the commit you named";
|
|
24801
|
+
}
|
|
24802
|
+
function commitStandsText(stands) {
|
|
24803
|
+
if (stands === undefined) {
|
|
24804
|
+
return "Where that commit stands is not known: this Dispatch server does not say";
|
|
24805
|
+
}
|
|
24806
|
+
if (stands.answer === "at_basis") {
|
|
24807
|
+
return stands.basis === undefined ? "That commit is one of the compared commits" : `That commit is ${basisPlace(stands.basis)}`;
|
|
24808
|
+
}
|
|
24809
|
+
if (stands.answer === "other_commit") {
|
|
24810
|
+
return stands.repo === undefined ? "That commit is none of the compared commits" : `That commit, of ${stands.repo}, is none of the compared commits`;
|
|
24811
|
+
}
|
|
24812
|
+
if (stands.reason === undefined) {
|
|
24813
|
+
return stands.repo === undefined ? "Where that commit stands is not known" : `Where that commit of ${stands.repo} stands is not known`;
|
|
24814
|
+
}
|
|
24815
|
+
return `Where that commit stands is not known: ${reasonText(stands.reason, stands.repo)}`;
|
|
24816
|
+
}
|
|
24817
|
+
function checkWordsText(check, result) {
|
|
24818
|
+
const versions = `result version ${result.check_version}, check version ${check.version}`;
|
|
24819
|
+
if (result.check_words_moved === undefined) {
|
|
24820
|
+
return `Whether the check's words moved is not known (${versions})`;
|
|
24821
|
+
}
|
|
24822
|
+
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})`;
|
|
24823
|
+
}
|
|
24824
|
+
function passStandsText(pass) {
|
|
24825
|
+
if (pass === undefined)
|
|
24826
|
+
return "Whether a pass stands is not known: this Dispatch server does not say";
|
|
24827
|
+
if (pass.answer === "yes") {
|
|
24828
|
+
const roles = pass.roles ?? [];
|
|
24829
|
+
return roles.length === 0 ? "A pass stands: yes" : `A pass stands: yes, from ${roles.join(", ")}`;
|
|
24830
|
+
}
|
|
24831
|
+
if (pass.answer === "no")
|
|
24832
|
+
return "A pass stands: no";
|
|
24833
|
+
return "A pass stands: not known";
|
|
24834
|
+
}
|
|
24835
|
+
function readingLines(result, brief, indent = " ") {
|
|
24836
|
+
const observed = result.observed;
|
|
24837
|
+
if (observed === "")
|
|
24838
|
+
return [`${indent}The role recorded no reading.`];
|
|
24839
|
+
const cut = brief && result.commit_stands?.answer !== "at_basis";
|
|
24840
|
+
if (cut && observed.length > BRIEF_READING_CHARACTERS) {
|
|
24841
|
+
return [
|
|
24842
|
+
`${indent}Reading: ${observed.slice(0, BRIEF_READING_CHARACTERS)}\u2026 (result ${result.id})`
|
|
24843
|
+
];
|
|
24844
|
+
}
|
|
24845
|
+
return [`${indent}Reading: ${observed}`];
|
|
24846
|
+
}
|
|
24847
|
+
function resultLines(check, result, brief) {
|
|
24848
|
+
const lines = [
|
|
24849
|
+
` - ${result.verdict} by ${result.role} at ${result.commit_sha}. ${commitStandsText(result.commit_stands)}. ${checkWordsText(check, result)}. Recorded ${result.created_at}. Result ${result.id}.`
|
|
24850
|
+
];
|
|
24851
|
+
const retracted = result.retracted;
|
|
24852
|
+
if (retracted !== undefined) {
|
|
24853
|
+
lines.push(` Retracted by ${actorText(retracted.actor)} at ${retracted.created_at}. The reason: ${retracted.reason}`);
|
|
24854
|
+
}
|
|
24855
|
+
return [...lines, ...readingLines(result, brief)];
|
|
24856
|
+
}
|
|
24857
|
+
function ciCheckLines(check, ci, brief) {
|
|
24858
|
+
const passStandsLine = ` ${passStandsText(check.pass_stands)}.`;
|
|
24859
|
+
const pullRequestLine = ` Pull request line: ${ci.line}`;
|
|
24860
|
+
const derived = check.results?.[0];
|
|
24861
|
+
if (derived === undefined) {
|
|
24862
|
+
return [
|
|
24863
|
+
`- ${check.block_id} (${check.when}): no result: ${ci.detail} ${check.text}`,
|
|
24864
|
+
passStandsLine,
|
|
24865
|
+
pullRequestLine
|
|
24866
|
+
];
|
|
24867
|
+
}
|
|
24868
|
+
const stands = commitStandsText(derived.commit_stands);
|
|
24869
|
+
return [
|
|
24870
|
+
`- ${check.block_id} (${check.when}): ${derived.verdict} at ${derived.commit_sha} by ${derived.role} (CI run ${ci.run}, ${ci.case}), ${stands.charAt(0).toLowerCase()}${stands.slice(1)}. ${check.text}`,
|
|
24871
|
+
passStandsLine,
|
|
24872
|
+
pullRequestLine,
|
|
24873
|
+
...readingLines(derived, brief, " ")
|
|
24874
|
+
];
|
|
24875
|
+
}
|
|
24876
|
+
function checkLines(check, brief) {
|
|
24877
|
+
if (check.ci !== undefined)
|
|
24878
|
+
return ciCheckLines(check, check.ci, brief);
|
|
24879
|
+
const bases = check.compared_with ?? [];
|
|
24880
|
+
const reason = check.compared_nothing;
|
|
24881
|
+
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: ${reasonText(reason)}`;
|
|
24882
|
+
const results = check.results ?? [];
|
|
24883
|
+
return [
|
|
24884
|
+
`- ${check.block_id} (${check.when}). ${compared}. ${passStandsText(check.pass_stands)}.`,
|
|
24885
|
+
` The check's words: ${check.text}`,
|
|
24886
|
+
...results.length === 0 ? [" No result is recorded for this check."] : results.flatMap((result) => resultLines(check, result, brief))
|
|
24887
|
+
];
|
|
24888
|
+
}
|
|
24889
|
+
function formatCheckResults(results, brief = false) {
|
|
24890
|
+
if (results.verification_artifact_id === "") {
|
|
24891
|
+
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.`;
|
|
24892
|
+
}
|
|
24893
|
+
const checks = results.checks ?? [];
|
|
24894
|
+
if (checks.length === 0) {
|
|
24895
|
+
return `${results.issue}'s Verification document holds no check blocks.`;
|
|
24896
|
+
}
|
|
24897
|
+
const blocks = checks.map((check) => checkLines(check, brief).join(`
|
|
24898
|
+
`));
|
|
24899
|
+
return [`Checks of ${results.issue}:`, ...blocks].join(`
|
|
24900
|
+
|
|
24901
|
+
`);
|
|
24902
|
+
}
|
|
24903
|
+
|
|
24732
24904
|
// ../envoy-client/src/dispatch-subscribe.ts
|
|
24733
24905
|
function followedAsk(details) {
|
|
24734
24906
|
if (typeof details !== "object" || details === null)
|
|
@@ -25254,132 +25426,6 @@ async function issuesCommand(context) {
|
|
|
25254
25426
|
details: { issues: rows, total, offset, limit }
|
|
25255
25427
|
};
|
|
25256
25428
|
}
|
|
25257
|
-
var BRIEF_READING_CHARACTERS = 200;
|
|
25258
|
-
var COMPARISON_REASONS = {
|
|
25259
|
-
no_pull_request_or_branch: "the issue has no pull request and no branch to compare with",
|
|
25260
|
-
repository_unreadable: "Dispatch cannot read the repository",
|
|
25261
|
-
read_failed: "a read Dispatch made did not answer"
|
|
25262
|
-
};
|
|
25263
|
-
function learnedText(learned) {
|
|
25264
|
-
if (learned.kind === "read_at")
|
|
25265
|
-
return `Dispatch read it ${learned.at}`;
|
|
25266
|
-
return `GitHub updated it ${learned.at}`;
|
|
25267
|
-
}
|
|
25268
|
-
function basisText(basis) {
|
|
25269
|
-
const learned = basis.learned_at === undefined ? "" : ` (${learnedText(basis.learned_at)})`;
|
|
25270
|
-
if (basis.kind === "pull_request") {
|
|
25271
|
-
const number = basis.pull_request === undefined ? "" : `#${basis.pull_request} `;
|
|
25272
|
-
return `the head of pull request ${number}at ${basis.commit ?? "an unnamed commit"}${learned}`;
|
|
25273
|
-
}
|
|
25274
|
-
if (basis.kind === "branch")
|
|
25275
|
-
return `branch ${basis.branch ?? "unnamed"}${learned}`;
|
|
25276
|
-
return `the commit you named, ${basis.commit ?? ""}${learned}`;
|
|
25277
|
-
}
|
|
25278
|
-
function basisPlace(basis) {
|
|
25279
|
-
if (basis.kind === "pull_request") {
|
|
25280
|
-
return basis.pull_request === undefined ? "the head of a pull request" : `the head of pull request #${basis.pull_request}`;
|
|
25281
|
-
}
|
|
25282
|
-
if (basis.kind === "branch")
|
|
25283
|
-
return `on branch ${basis.branch ?? "unnamed"}`;
|
|
25284
|
-
return "the commit you named";
|
|
25285
|
-
}
|
|
25286
|
-
function commitStandsText(stands) {
|
|
25287
|
-
if (stands === undefined) {
|
|
25288
|
-
return "Where that commit stands is not known: this Dispatch server does not say";
|
|
25289
|
-
}
|
|
25290
|
-
if (stands.answer === "at_basis") {
|
|
25291
|
-
return stands.basis === undefined ? "That commit is one of the compared commits" : `That commit is ${basisPlace(stands.basis)}`;
|
|
25292
|
-
}
|
|
25293
|
-
if (stands.answer === "other_commit")
|
|
25294
|
-
return "That commit is none of the compared commits";
|
|
25295
|
-
return stands.reason === undefined ? "Where that commit stands is not known" : `Where that commit stands is not known: ${COMPARISON_REASONS[stands.reason]}`;
|
|
25296
|
-
}
|
|
25297
|
-
function checkWordsText(check, result) {
|
|
25298
|
-
const versions = `result version ${result.check_version}, check version ${check.version}`;
|
|
25299
|
-
if (result.check_words_moved === undefined) {
|
|
25300
|
-
return `Whether the check's words moved is not known (${versions})`;
|
|
25301
|
-
}
|
|
25302
|
-
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})`;
|
|
25303
|
-
}
|
|
25304
|
-
function passStandsText(pass) {
|
|
25305
|
-
if (pass === undefined)
|
|
25306
|
-
return "Whether a pass stands is not known: this Dispatch server does not say";
|
|
25307
|
-
if (pass.answer === "yes") {
|
|
25308
|
-
const roles = pass.roles ?? [];
|
|
25309
|
-
return roles.length === 0 ? "A pass stands: yes" : `A pass stands: yes, from ${roles.join(", ")}`;
|
|
25310
|
-
}
|
|
25311
|
-
if (pass.answer === "no")
|
|
25312
|
-
return "A pass stands: no";
|
|
25313
|
-
return "A pass stands: not known";
|
|
25314
|
-
}
|
|
25315
|
-
function readingLines(result, brief, indent = " ") {
|
|
25316
|
-
const observed = result.observed;
|
|
25317
|
-
if (observed === "")
|
|
25318
|
-
return [`${indent}The role recorded no reading.`];
|
|
25319
|
-
const cut = brief && result.commit_stands?.answer !== "at_basis";
|
|
25320
|
-
if (cut && observed.length > BRIEF_READING_CHARACTERS) {
|
|
25321
|
-
return [
|
|
25322
|
-
`${indent}Reading: ${observed.slice(0, BRIEF_READING_CHARACTERS)}\u2026 (result ${result.id})`
|
|
25323
|
-
];
|
|
25324
|
-
}
|
|
25325
|
-
return [`${indent}Reading: ${observed}`];
|
|
25326
|
-
}
|
|
25327
|
-
function resultLines(check, result, brief) {
|
|
25328
|
-
const lines = [
|
|
25329
|
-
` - ${result.verdict} by ${result.role} at ${result.commit_sha}. ${commitStandsText(result.commit_stands)}. ${checkWordsText(check, result)}. Recorded ${result.created_at}. Result ${result.id}.`
|
|
25330
|
-
];
|
|
25331
|
-
const retracted = result.retracted;
|
|
25332
|
-
if (retracted !== undefined) {
|
|
25333
|
-
lines.push(` Retracted by ${actorText(retracted.actor)} at ${retracted.created_at}. The reason: ${retracted.reason}`);
|
|
25334
|
-
}
|
|
25335
|
-
return [...lines, ...readingLines(result, brief)];
|
|
25336
|
-
}
|
|
25337
|
-
function ciCheckLines(check, ci, brief) {
|
|
25338
|
-
const passStandsLine = ` ${passStandsText(check.pass_stands)}.`;
|
|
25339
|
-
const pullRequestLine = ` Pull request line: ${ci.line}`;
|
|
25340
|
-
const derived = check.results?.[0];
|
|
25341
|
-
if (derived === undefined) {
|
|
25342
|
-
return [
|
|
25343
|
-
`- ${check.block_id} (${check.when}): no result: ${ci.detail} ${check.text}`,
|
|
25344
|
-
passStandsLine,
|
|
25345
|
-
pullRequestLine
|
|
25346
|
-
];
|
|
25347
|
-
}
|
|
25348
|
-
const stands = commitStandsText(derived.commit_stands);
|
|
25349
|
-
return [
|
|
25350
|
-
`- ${check.block_id} (${check.when}): ${derived.verdict} at ${derived.commit_sha} by ${derived.role} (CI run ${ci.run}, ${ci.case}), ${stands.charAt(0).toLowerCase()}${stands.slice(1)}. ${check.text}`,
|
|
25351
|
-
passStandsLine,
|
|
25352
|
-
pullRequestLine,
|
|
25353
|
-
...readingLines(derived, brief, " ")
|
|
25354
|
-
];
|
|
25355
|
-
}
|
|
25356
|
-
function checkLines(check, brief) {
|
|
25357
|
-
if (check.ci !== undefined)
|
|
25358
|
-
return ciCheckLines(check, check.ci, brief);
|
|
25359
|
-
const bases = check.compared_with ?? [];
|
|
25360
|
-
const reason = check.compared_nothing;
|
|
25361
|
-
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]}`;
|
|
25362
|
-
const results = check.results ?? [];
|
|
25363
|
-
return [
|
|
25364
|
-
`- ${check.block_id} (${check.when}). ${compared}. ${passStandsText(check.pass_stands)}.`,
|
|
25365
|
-
` The check's words: ${check.text}`,
|
|
25366
|
-
...results.length === 0 ? [" No result is recorded for this check."] : results.flatMap((result) => resultLines(check, result, brief))
|
|
25367
|
-
];
|
|
25368
|
-
}
|
|
25369
|
-
function formatCheckResults(results, brief = false) {
|
|
25370
|
-
if (results.verification_artifact_id === "") {
|
|
25371
|
-
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.`;
|
|
25372
|
-
}
|
|
25373
|
-
const checks = results.checks ?? [];
|
|
25374
|
-
if (checks.length === 0) {
|
|
25375
|
-
return `${results.issue}'s Verification document holds no check blocks.`;
|
|
25376
|
-
}
|
|
25377
|
-
const blocks = checks.map((check) => checkLines(check, brief).join(`
|
|
25378
|
-
`));
|
|
25379
|
-
return [`Checks of ${results.issue}:`, ...blocks].join(`
|
|
25380
|
-
|
|
25381
|
-
`);
|
|
25382
|
-
}
|
|
25383
25429
|
function dryRunAsksDispatch(tool, args) {
|
|
25384
25430
|
return tool === "dispatch_result" && args["retract"] === undefined;
|
|
25385
25431
|
}
|
|
@@ -26131,6 +26177,7 @@ async function commentCommand(context) {
|
|
|
26131
26177
|
const replyToAsk = replyToAskTarget === undefined ? undefined : await resolveReplyToAsk(input.tool, client, owner, resolved, replyToAskTarget.id);
|
|
26132
26178
|
const replyToBlock = replyTo?.block ?? replyToAskTarget?.block;
|
|
26133
26179
|
const requestedTurn = optionalString(args, "turn");
|
|
26180
|
+
const mentions = optionalStringArray(args, "mentions");
|
|
26134
26181
|
const body = await writePictures(resolved, stringArg(args, "body"));
|
|
26135
26182
|
const commentInput = {
|
|
26136
26183
|
body,
|
|
@@ -26139,6 +26186,7 @@ async function commentCommand(context) {
|
|
|
26139
26186
|
...replyToBlock === undefined ? {} : { reply_to_block: replyToBlock },
|
|
26140
26187
|
...replyToAsk === undefined ? {} : { ask_id: replyToAsk },
|
|
26141
26188
|
...requestedTurn === undefined ? {} : { turn: requestedTurn },
|
|
26189
|
+
...mentions === undefined ? {} : { mentions: mentions.map((target) => ({ target })) },
|
|
26142
26190
|
actor
|
|
26143
26191
|
};
|
|
26144
26192
|
const comment = resolved?.owner.kind === "project" ? await client.artifactComment(resolved.artifact.id, commentInput) : await client.comment(issue(), commentInput);
|