@sjawhar/claude-envoy 4.14.6 → 4.15.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/codex-hook.js +178 -130
- package/dist/dispatch.js +178 -130
- package/dist/envoy-channel.js +179 -131
- package/dist/session-hook.js +178 -130
- package/package.json +1 -1
package/dist/session-hook.js
CHANGED
|
@@ -14332,17 +14332,41 @@ var documentEditValidation = {
|
|
|
14332
14332
|
};
|
|
14333
14333
|
var commentOwner = documentOwnerValidation(true);
|
|
14334
14334
|
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.";
|
|
14335
|
+
var MAX_COMMENT_MENTIONS = 10;
|
|
14336
|
+
var COMMENT_MENTION_LIMIT_RULE = `mentions allow at most ${MAX_COMMENT_MENTIONS} targets`;
|
|
14337
|
+
var MENTION_TARGET_PATTERNS = [/^role:[a-z0-9-]+$/, /^session:[A-Za-z0-9_-]+$/];
|
|
14338
|
+
var COMMENT_MENTION_TARGET_RULE = "mention target must be role:<name> or session:<id>";
|
|
14339
|
+
var COMMENT_MENTION_REPEAT_RULE = "mentions must not repeat a target";
|
|
14340
|
+
function mentionProblem(mentions) {
|
|
14341
|
+
if (!Array.isArray(mentions))
|
|
14342
|
+
return;
|
|
14343
|
+
if (mentions.length > MAX_COMMENT_MENTIONS)
|
|
14344
|
+
return COMMENT_MENTION_LIMIT_RULE;
|
|
14345
|
+
const seen = new Set;
|
|
14346
|
+
for (const target of mentions) {
|
|
14347
|
+
if (typeof target !== "string" || !MENTION_TARGET_PATTERNS.some((pattern) => pattern.test(target))) {
|
|
14348
|
+
return COMMENT_MENTION_TARGET_RULE;
|
|
14349
|
+
}
|
|
14350
|
+
if (seen.has(target))
|
|
14351
|
+
return COMMENT_MENTION_REPEAT_RULE;
|
|
14352
|
+
seen.add(target);
|
|
14353
|
+
}
|
|
14354
|
+
return;
|
|
14355
|
+
}
|
|
14335
14356
|
function commentProblem(value) {
|
|
14336
14357
|
const input = value;
|
|
14358
|
+
const mention = mentionProblem(input.mentions);
|
|
14337
14359
|
return brokenParts([
|
|
14338
14360
|
[commentOwner.check(value), commentOwner.message],
|
|
14339
|
-
[input.turn === undefined || typeof input.reply_to_ask === "string", COMMENT_TURN_RULE]
|
|
14361
|
+
[input.turn === undefined || typeof input.reply_to_ask === "string", COMMENT_TURN_RULE],
|
|
14362
|
+
[mention === undefined, mention ?? ""]
|
|
14340
14363
|
]);
|
|
14341
14364
|
}
|
|
14365
|
+
var COMMENT_RULE = `${commentOwner.message} ${COMMENT_TURN_RULE} ${COMMENT_MENTION_LIMIT_RULE}, each ${COMMENT_MENTION_TARGET_RULE}, and ${COMMENT_MENTION_REPEAT_RULE}.`;
|
|
14342
14366
|
var commentValidation = {
|
|
14343
14367
|
check: (value) => commentProblem(value) === undefined,
|
|
14344
|
-
message:
|
|
14345
|
-
refusal: (value) => commentProblem(value) ??
|
|
14368
|
+
message: COMMENT_RULE,
|
|
14369
|
+
refusal: (value) => commentProblem(value) ?? COMMENT_RULE
|
|
14346
14370
|
};
|
|
14347
14371
|
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.";
|
|
14348
14372
|
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";
|
|
@@ -14702,6 +14726,7 @@ var dispatchToolSpecs = [
|
|
|
14702
14726
|
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(),
|
|
14703
14727
|
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(),
|
|
14704
14728
|
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(),
|
|
14729
|
+
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(),
|
|
14705
14730
|
images: imagesArgument(z, "the issue (or the project document's project)")
|
|
14706
14731
|
}),
|
|
14707
14732
|
validation: commentValidation
|
|
@@ -14847,7 +14872,7 @@ var dispatchToolSpecs = [
|
|
|
14847
14872
|
verdict: "pass",
|
|
14848
14873
|
commit: "1111111111111111111111111111111111111111"
|
|
14849
14874
|
},
|
|
14850
|
-
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
|
|
14875
|
+
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,
|
|
14851
14876
|
arguments: (z) => ({
|
|
14852
14877
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
14853
14878
|
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(),
|
|
@@ -23697,6 +23722,153 @@ function childrenSummary(issue) {
|
|
|
23697
23722
|
`);
|
|
23698
23723
|
}
|
|
23699
23724
|
|
|
23725
|
+
// ../envoy-client/src/dispatch-commands/render-results.ts
|
|
23726
|
+
var BRIEF_READING_CHARACTERS = 200;
|
|
23727
|
+
var COMPARISON_REASONS = {
|
|
23728
|
+
no_pull_request_or_branch: () => "the issue has no pull request and no branch to compare with",
|
|
23729
|
+
repository_unreadable: (repo = "the repository") => `Dispatch cannot read ${repo}`,
|
|
23730
|
+
read_failed: (repo) => repo === undefined ? "a read Dispatch made did not answer" : `a read Dispatch made of ${repo} did not answer`
|
|
23731
|
+
};
|
|
23732
|
+
function isComparisonReason(reason) {
|
|
23733
|
+
return Object.hasOwn(COMPARISON_REASONS, reason);
|
|
23734
|
+
}
|
|
23735
|
+
function reasonText(reason, repo) {
|
|
23736
|
+
if (isComparisonReason(reason))
|
|
23737
|
+
return COMPARISON_REASONS[reason](repo);
|
|
23738
|
+
return repo === undefined ? reason : `${reason} (${repo})`;
|
|
23739
|
+
}
|
|
23740
|
+
function learnedText(learned) {
|
|
23741
|
+
if (learned.kind === "read_at")
|
|
23742
|
+
return `Dispatch read it ${learned.at}`;
|
|
23743
|
+
return `GitHub updated it ${learned.at}`;
|
|
23744
|
+
}
|
|
23745
|
+
function pullRequestName(basis, number) {
|
|
23746
|
+
return basis.repo === undefined ? `pull request #${number}` : `${basis.repo}#${number}`;
|
|
23747
|
+
}
|
|
23748
|
+
function branchName(basis) {
|
|
23749
|
+
const branch = basis.branch ?? "unnamed";
|
|
23750
|
+
return basis.repo === undefined ? branch : `${branch} of ${basis.repo}`;
|
|
23751
|
+
}
|
|
23752
|
+
function basisText(basis) {
|
|
23753
|
+
const learned = basis.learned_at === undefined ? "" : ` (${learnedText(basis.learned_at)})`;
|
|
23754
|
+
if (basis.kind === "pull_request") {
|
|
23755
|
+
const pullRequest = basis.pull_request === undefined ? "pull request " : `${pullRequestName(basis, basis.pull_request)} `;
|
|
23756
|
+
return `the head of ${pullRequest}at ${basis.commit ?? "an unnamed commit"}${learned}`;
|
|
23757
|
+
}
|
|
23758
|
+
if (basis.kind === "branch")
|
|
23759
|
+
return `branch ${branchName(basis)}${learned}`;
|
|
23760
|
+
return `the commit you named, ${basis.commit ?? ""}${learned}`;
|
|
23761
|
+
}
|
|
23762
|
+
function basisPlace(basis) {
|
|
23763
|
+
if (basis.kind === "pull_request") {
|
|
23764
|
+
return basis.pull_request === undefined ? "the head of a pull request" : `the head of ${pullRequestName(basis, basis.pull_request)}`;
|
|
23765
|
+
}
|
|
23766
|
+
if (basis.kind === "branch")
|
|
23767
|
+
return `on branch ${branchName(basis)}`;
|
|
23768
|
+
return "the commit you named";
|
|
23769
|
+
}
|
|
23770
|
+
function commitStandsText(stands) {
|
|
23771
|
+
if (stands === undefined) {
|
|
23772
|
+
return "Where that commit stands is not known: this Dispatch server does not say";
|
|
23773
|
+
}
|
|
23774
|
+
if (stands.answer === "at_basis") {
|
|
23775
|
+
return stands.basis === undefined ? "That commit is one of the compared commits" : `That commit is ${basisPlace(stands.basis)}`;
|
|
23776
|
+
}
|
|
23777
|
+
if (stands.answer === "other_commit") {
|
|
23778
|
+
return stands.repo === undefined ? "That commit is none of the compared commits" : `That commit, of ${stands.repo}, is none of the compared commits`;
|
|
23779
|
+
}
|
|
23780
|
+
if (stands.reason === undefined) {
|
|
23781
|
+
return stands.repo === undefined ? "Where that commit stands is not known" : `Where that commit of ${stands.repo} stands is not known`;
|
|
23782
|
+
}
|
|
23783
|
+
return `Where that commit stands is not known: ${reasonText(stands.reason, stands.repo)}`;
|
|
23784
|
+
}
|
|
23785
|
+
function checkWordsText(check, result) {
|
|
23786
|
+
const versions = `result version ${result.check_version}, check version ${check.version}`;
|
|
23787
|
+
if (result.check_words_moved === undefined) {
|
|
23788
|
+
return `Whether the check's words moved is not known (${versions})`;
|
|
23789
|
+
}
|
|
23790
|
+
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})`;
|
|
23791
|
+
}
|
|
23792
|
+
function passStandsText(pass) {
|
|
23793
|
+
if (pass === undefined)
|
|
23794
|
+
return "Whether a pass stands is not known: this Dispatch server does not say";
|
|
23795
|
+
if (pass.answer === "yes") {
|
|
23796
|
+
const roles = pass.roles ?? [];
|
|
23797
|
+
return roles.length === 0 ? "A pass stands: yes" : `A pass stands: yes, from ${roles.join(", ")}`;
|
|
23798
|
+
}
|
|
23799
|
+
if (pass.answer === "no")
|
|
23800
|
+
return "A pass stands: no";
|
|
23801
|
+
return "A pass stands: not known";
|
|
23802
|
+
}
|
|
23803
|
+
function readingLines(result, brief, indent = " ") {
|
|
23804
|
+
const observed = result.observed;
|
|
23805
|
+
if (observed === "")
|
|
23806
|
+
return [`${indent}The role recorded no reading.`];
|
|
23807
|
+
const cut = brief && result.commit_stands?.answer !== "at_basis";
|
|
23808
|
+
if (cut && observed.length > BRIEF_READING_CHARACTERS) {
|
|
23809
|
+
return [
|
|
23810
|
+
`${indent}Reading: ${observed.slice(0, BRIEF_READING_CHARACTERS)}\u2026 (result ${result.id})`
|
|
23811
|
+
];
|
|
23812
|
+
}
|
|
23813
|
+
return [`${indent}Reading: ${observed}`];
|
|
23814
|
+
}
|
|
23815
|
+
function resultLines(check, result, brief) {
|
|
23816
|
+
const lines = [
|
|
23817
|
+
` - ${result.verdict} by ${result.role} at ${result.commit_sha}. ${commitStandsText(result.commit_stands)}. ${checkWordsText(check, result)}. Recorded ${result.created_at}. Result ${result.id}.`
|
|
23818
|
+
];
|
|
23819
|
+
const retracted = result.retracted;
|
|
23820
|
+
if (retracted !== undefined) {
|
|
23821
|
+
lines.push(` Retracted by ${actorText(retracted.actor)} at ${retracted.created_at}. The reason: ${retracted.reason}`);
|
|
23822
|
+
}
|
|
23823
|
+
return [...lines, ...readingLines(result, brief)];
|
|
23824
|
+
}
|
|
23825
|
+
function ciCheckLines(check, ci, brief) {
|
|
23826
|
+
const passStandsLine = ` ${passStandsText(check.pass_stands)}.`;
|
|
23827
|
+
const pullRequestLine = ` Pull request line: ${ci.line}`;
|
|
23828
|
+
const derived = check.results?.[0];
|
|
23829
|
+
if (derived === undefined) {
|
|
23830
|
+
return [
|
|
23831
|
+
`- ${check.block_id} (${check.when}): no result: ${ci.detail} ${check.text}`,
|
|
23832
|
+
passStandsLine,
|
|
23833
|
+
pullRequestLine
|
|
23834
|
+
];
|
|
23835
|
+
}
|
|
23836
|
+
const stands = commitStandsText(derived.commit_stands);
|
|
23837
|
+
return [
|
|
23838
|
+
`- ${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}`,
|
|
23839
|
+
passStandsLine,
|
|
23840
|
+
pullRequestLine,
|
|
23841
|
+
...readingLines(derived, brief, " ")
|
|
23842
|
+
];
|
|
23843
|
+
}
|
|
23844
|
+
function checkLines(check, brief) {
|
|
23845
|
+
if (check.ci !== undefined)
|
|
23846
|
+
return ciCheckLines(check, check.ci, brief);
|
|
23847
|
+
const bases = check.compared_with ?? [];
|
|
23848
|
+
const reason = check.compared_nothing;
|
|
23849
|
+
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)}`;
|
|
23850
|
+
const results = check.results ?? [];
|
|
23851
|
+
return [
|
|
23852
|
+
`- ${check.block_id} (${check.when}). ${compared}. ${passStandsText(check.pass_stands)}.`,
|
|
23853
|
+
` The check's words: ${check.text}`,
|
|
23854
|
+
...results.length === 0 ? [" No result is recorded for this check."] : results.flatMap((result) => resultLines(check, result, brief))
|
|
23855
|
+
];
|
|
23856
|
+
}
|
|
23857
|
+
function formatCheckResults(results, brief = false) {
|
|
23858
|
+
if (results.verification_artifact_id === "") {
|
|
23859
|
+
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.`;
|
|
23860
|
+
}
|
|
23861
|
+
const checks = results.checks ?? [];
|
|
23862
|
+
if (checks.length === 0) {
|
|
23863
|
+
return `${results.issue}'s Verification document holds no check blocks.`;
|
|
23864
|
+
}
|
|
23865
|
+
const blocks = checks.map((check) => checkLines(check, brief).join(`
|
|
23866
|
+
`));
|
|
23867
|
+
return [`Checks of ${results.issue}:`, ...blocks].join(`
|
|
23868
|
+
|
|
23869
|
+
`);
|
|
23870
|
+
}
|
|
23871
|
+
|
|
23700
23872
|
// ../envoy-client/src/dispatch-subscribe.ts
|
|
23701
23873
|
function followedAsk(details) {
|
|
23702
23874
|
if (typeof details !== "object" || details === null)
|
|
@@ -24222,132 +24394,6 @@ async function issuesCommand(context) {
|
|
|
24222
24394
|
details: { issues: rows, total, offset, limit }
|
|
24223
24395
|
};
|
|
24224
24396
|
}
|
|
24225
|
-
var BRIEF_READING_CHARACTERS = 200;
|
|
24226
|
-
var COMPARISON_REASONS = {
|
|
24227
|
-
no_pull_request_or_branch: "the issue has no pull request and no branch to compare with",
|
|
24228
|
-
repository_unreadable: "Dispatch cannot read the repository",
|
|
24229
|
-
read_failed: "a read Dispatch made did not answer"
|
|
24230
|
-
};
|
|
24231
|
-
function learnedText(learned) {
|
|
24232
|
-
if (learned.kind === "read_at")
|
|
24233
|
-
return `Dispatch read it ${learned.at}`;
|
|
24234
|
-
return `GitHub updated it ${learned.at}`;
|
|
24235
|
-
}
|
|
24236
|
-
function basisText(basis) {
|
|
24237
|
-
const learned = basis.learned_at === undefined ? "" : ` (${learnedText(basis.learned_at)})`;
|
|
24238
|
-
if (basis.kind === "pull_request") {
|
|
24239
|
-
const number = basis.pull_request === undefined ? "" : `#${basis.pull_request} `;
|
|
24240
|
-
return `the head of pull request ${number}at ${basis.commit ?? "an unnamed commit"}${learned}`;
|
|
24241
|
-
}
|
|
24242
|
-
if (basis.kind === "branch")
|
|
24243
|
-
return `branch ${basis.branch ?? "unnamed"}${learned}`;
|
|
24244
|
-
return `the commit you named, ${basis.commit ?? ""}${learned}`;
|
|
24245
|
-
}
|
|
24246
|
-
function basisPlace(basis) {
|
|
24247
|
-
if (basis.kind === "pull_request") {
|
|
24248
|
-
return basis.pull_request === undefined ? "the head of a pull request" : `the head of pull request #${basis.pull_request}`;
|
|
24249
|
-
}
|
|
24250
|
-
if (basis.kind === "branch")
|
|
24251
|
-
return `on branch ${basis.branch ?? "unnamed"}`;
|
|
24252
|
-
return "the commit you named";
|
|
24253
|
-
}
|
|
24254
|
-
function commitStandsText(stands) {
|
|
24255
|
-
if (stands === undefined) {
|
|
24256
|
-
return "Where that commit stands is not known: this Dispatch server does not say";
|
|
24257
|
-
}
|
|
24258
|
-
if (stands.answer === "at_basis") {
|
|
24259
|
-
return stands.basis === undefined ? "That commit is one of the compared commits" : `That commit is ${basisPlace(stands.basis)}`;
|
|
24260
|
-
}
|
|
24261
|
-
if (stands.answer === "other_commit")
|
|
24262
|
-
return "That commit is none of the compared commits";
|
|
24263
|
-
return stands.reason === undefined ? "Where that commit stands is not known" : `Where that commit stands is not known: ${COMPARISON_REASONS[stands.reason]}`;
|
|
24264
|
-
}
|
|
24265
|
-
function checkWordsText(check, result) {
|
|
24266
|
-
const versions = `result version ${result.check_version}, check version ${check.version}`;
|
|
24267
|
-
if (result.check_words_moved === undefined) {
|
|
24268
|
-
return `Whether the check's words moved is not known (${versions})`;
|
|
24269
|
-
}
|
|
24270
|
-
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})`;
|
|
24271
|
-
}
|
|
24272
|
-
function passStandsText(pass) {
|
|
24273
|
-
if (pass === undefined)
|
|
24274
|
-
return "Whether a pass stands is not known: this Dispatch server does not say";
|
|
24275
|
-
if (pass.answer === "yes") {
|
|
24276
|
-
const roles = pass.roles ?? [];
|
|
24277
|
-
return roles.length === 0 ? "A pass stands: yes" : `A pass stands: yes, from ${roles.join(", ")}`;
|
|
24278
|
-
}
|
|
24279
|
-
if (pass.answer === "no")
|
|
24280
|
-
return "A pass stands: no";
|
|
24281
|
-
return "A pass stands: not known";
|
|
24282
|
-
}
|
|
24283
|
-
function readingLines(result, brief, indent = " ") {
|
|
24284
|
-
const observed = result.observed;
|
|
24285
|
-
if (observed === "")
|
|
24286
|
-
return [`${indent}The role recorded no reading.`];
|
|
24287
|
-
const cut = brief && result.commit_stands?.answer !== "at_basis";
|
|
24288
|
-
if (cut && observed.length > BRIEF_READING_CHARACTERS) {
|
|
24289
|
-
return [
|
|
24290
|
-
`${indent}Reading: ${observed.slice(0, BRIEF_READING_CHARACTERS)}\u2026 (result ${result.id})`
|
|
24291
|
-
];
|
|
24292
|
-
}
|
|
24293
|
-
return [`${indent}Reading: ${observed}`];
|
|
24294
|
-
}
|
|
24295
|
-
function resultLines(check, result, brief) {
|
|
24296
|
-
const lines = [
|
|
24297
|
-
` - ${result.verdict} by ${result.role} at ${result.commit_sha}. ${commitStandsText(result.commit_stands)}. ${checkWordsText(check, result)}. Recorded ${result.created_at}. Result ${result.id}.`
|
|
24298
|
-
];
|
|
24299
|
-
const retracted = result.retracted;
|
|
24300
|
-
if (retracted !== undefined) {
|
|
24301
|
-
lines.push(` Retracted by ${actorText(retracted.actor)} at ${retracted.created_at}. The reason: ${retracted.reason}`);
|
|
24302
|
-
}
|
|
24303
|
-
return [...lines, ...readingLines(result, brief)];
|
|
24304
|
-
}
|
|
24305
|
-
function ciCheckLines(check, ci, brief) {
|
|
24306
|
-
const passStandsLine = ` ${passStandsText(check.pass_stands)}.`;
|
|
24307
|
-
const pullRequestLine = ` Pull request line: ${ci.line}`;
|
|
24308
|
-
const derived = check.results?.[0];
|
|
24309
|
-
if (derived === undefined) {
|
|
24310
|
-
return [
|
|
24311
|
-
`- ${check.block_id} (${check.when}): no result: ${ci.detail} ${check.text}`,
|
|
24312
|
-
passStandsLine,
|
|
24313
|
-
pullRequestLine
|
|
24314
|
-
];
|
|
24315
|
-
}
|
|
24316
|
-
const stands = commitStandsText(derived.commit_stands);
|
|
24317
|
-
return [
|
|
24318
|
-
`- ${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}`,
|
|
24319
|
-
passStandsLine,
|
|
24320
|
-
pullRequestLine,
|
|
24321
|
-
...readingLines(derived, brief, " ")
|
|
24322
|
-
];
|
|
24323
|
-
}
|
|
24324
|
-
function checkLines(check, brief) {
|
|
24325
|
-
if (check.ci !== undefined)
|
|
24326
|
-
return ciCheckLines(check, check.ci, brief);
|
|
24327
|
-
const bases = check.compared_with ?? [];
|
|
24328
|
-
const reason = check.compared_nothing;
|
|
24329
|
-
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]}`;
|
|
24330
|
-
const results = check.results ?? [];
|
|
24331
|
-
return [
|
|
24332
|
-
`- ${check.block_id} (${check.when}). ${compared}. ${passStandsText(check.pass_stands)}.`,
|
|
24333
|
-
` The check's words: ${check.text}`,
|
|
24334
|
-
...results.length === 0 ? [" No result is recorded for this check."] : results.flatMap((result) => resultLines(check, result, brief))
|
|
24335
|
-
];
|
|
24336
|
-
}
|
|
24337
|
-
function formatCheckResults(results, brief = false) {
|
|
24338
|
-
if (results.verification_artifact_id === "") {
|
|
24339
|
-
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.`;
|
|
24340
|
-
}
|
|
24341
|
-
const checks = results.checks ?? [];
|
|
24342
|
-
if (checks.length === 0) {
|
|
24343
|
-
return `${results.issue}'s Verification document holds no check blocks.`;
|
|
24344
|
-
}
|
|
24345
|
-
const blocks = checks.map((check) => checkLines(check, brief).join(`
|
|
24346
|
-
`));
|
|
24347
|
-
return [`Checks of ${results.issue}:`, ...blocks].join(`
|
|
24348
|
-
|
|
24349
|
-
`);
|
|
24350
|
-
}
|
|
24351
24397
|
function dryRunAsksDispatch(tool, args) {
|
|
24352
24398
|
return tool === "dispatch_result" && args["retract"] === undefined;
|
|
24353
24399
|
}
|
|
@@ -25099,6 +25145,7 @@ async function commentCommand(context) {
|
|
|
25099
25145
|
const replyToAsk = replyToAskTarget === undefined ? undefined : await resolveReplyToAsk(input.tool, client, owner, resolved, replyToAskTarget.id);
|
|
25100
25146
|
const replyToBlock = replyTo?.block ?? replyToAskTarget?.block;
|
|
25101
25147
|
const requestedTurn = optionalString(args, "turn");
|
|
25148
|
+
const mentions = optionalStringArray(args, "mentions");
|
|
25102
25149
|
const body = await writePictures(resolved, stringArg(args, "body"));
|
|
25103
25150
|
const commentInput = {
|
|
25104
25151
|
body,
|
|
@@ -25107,6 +25154,7 @@ async function commentCommand(context) {
|
|
|
25107
25154
|
...replyToBlock === undefined ? {} : { reply_to_block: replyToBlock },
|
|
25108
25155
|
...replyToAsk === undefined ? {} : { ask_id: replyToAsk },
|
|
25109
25156
|
...requestedTurn === undefined ? {} : { turn: requestedTurn },
|
|
25157
|
+
...mentions === undefined ? {} : { mentions: mentions.map((target) => ({ target })) },
|
|
25110
25158
|
actor
|
|
25111
25159
|
};
|
|
25112
25160
|
const comment = resolved?.owner.kind === "project" ? await client.artifactComment(resolved.artifact.id, commentInput) : await client.comment(issue(), commentInput);
|