@sjawhar/claude-envoy 4.14.5 → 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/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: `${commentOwner.message} ${COMMENT_TURN_RULE}`,
15438
- refusal: (value) => commentProblem(value) ?? `${commentOwner.message} ${COMMENT_TURN_RULE}`
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 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. " + "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,
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(),
@@ -18011,6 +18036,7 @@ var EnvelopeSchema = object({
18011
18036
  expires_at: number2().int().optional(),
18012
18037
  kept_at: number2().int().optional(),
18013
18038
  mention_dedupe_keys: record(string2(), string2()).optional(),
18039
+ role: string2().min(1).optional(),
18014
18040
  payload_summary: string2().min(1),
18015
18041
  payload: string2().optional(),
18016
18042
  payload_ref: string2().optional(),
@@ -24728,6 +24754,153 @@ function childrenSummary(issue) {
24728
24754
  `);
24729
24755
  }
24730
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
+
24731
24904
  // ../envoy-client/src/dispatch-subscribe.ts
24732
24905
  function followedAsk(details) {
24733
24906
  if (typeof details !== "object" || details === null)
@@ -25253,132 +25426,6 @@ async function issuesCommand(context) {
25253
25426
  details: { issues: rows, total, offset, limit }
25254
25427
  };
25255
25428
  }
25256
- var BRIEF_READING_CHARACTERS = 200;
25257
- var COMPARISON_REASONS = {
25258
- no_pull_request_or_branch: "the issue has no pull request and no branch to compare with",
25259
- repository_unreadable: "Dispatch cannot read the repository",
25260
- read_failed: "a read Dispatch made did not answer"
25261
- };
25262
- function learnedText(learned) {
25263
- if (learned.kind === "read_at")
25264
- return `Dispatch read it ${learned.at}`;
25265
- return `GitHub updated it ${learned.at}`;
25266
- }
25267
- function basisText(basis) {
25268
- const learned = basis.learned_at === undefined ? "" : ` (${learnedText(basis.learned_at)})`;
25269
- if (basis.kind === "pull_request") {
25270
- const number = basis.pull_request === undefined ? "" : `#${basis.pull_request} `;
25271
- return `the head of pull request ${number}at ${basis.commit ?? "an unnamed commit"}${learned}`;
25272
- }
25273
- if (basis.kind === "branch")
25274
- return `branch ${basis.branch ?? "unnamed"}${learned}`;
25275
- return `the commit you named, ${basis.commit ?? ""}${learned}`;
25276
- }
25277
- function basisPlace(basis) {
25278
- if (basis.kind === "pull_request") {
25279
- return basis.pull_request === undefined ? "the head of a pull request" : `the head of pull request #${basis.pull_request}`;
25280
- }
25281
- if (basis.kind === "branch")
25282
- return `on branch ${basis.branch ?? "unnamed"}`;
25283
- return "the commit you named";
25284
- }
25285
- function commitStandsText(stands) {
25286
- if (stands === undefined) {
25287
- return "Where that commit stands is not known: this Dispatch server does not say";
25288
- }
25289
- if (stands.answer === "at_basis") {
25290
- return stands.basis === undefined ? "That commit is one of the compared commits" : `That commit is ${basisPlace(stands.basis)}`;
25291
- }
25292
- if (stands.answer === "other_commit")
25293
- return "That commit is none of the compared commits";
25294
- return stands.reason === undefined ? "Where that commit stands is not known" : `Where that commit stands is not known: ${COMPARISON_REASONS[stands.reason]}`;
25295
- }
25296
- function checkWordsText(check, result) {
25297
- const versions = `result version ${result.check_version}, check version ${check.version}`;
25298
- if (result.check_words_moved === undefined) {
25299
- return `Whether the check's words moved is not known (${versions})`;
25300
- }
25301
- 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})`;
25302
- }
25303
- function passStandsText(pass) {
25304
- if (pass === undefined)
25305
- return "Whether a pass stands is not known: this Dispatch server does not say";
25306
- if (pass.answer === "yes") {
25307
- const roles = pass.roles ?? [];
25308
- return roles.length === 0 ? "A pass stands: yes" : `A pass stands: yes, from ${roles.join(", ")}`;
25309
- }
25310
- if (pass.answer === "no")
25311
- return "A pass stands: no";
25312
- return "A pass stands: not known";
25313
- }
25314
- function readingLines(result, brief, indent = " ") {
25315
- const observed = result.observed;
25316
- if (observed === "")
25317
- return [`${indent}The role recorded no reading.`];
25318
- const cut = brief && result.commit_stands?.answer !== "at_basis";
25319
- if (cut && observed.length > BRIEF_READING_CHARACTERS) {
25320
- return [
25321
- `${indent}Reading: ${observed.slice(0, BRIEF_READING_CHARACTERS)}\u2026 (result ${result.id})`
25322
- ];
25323
- }
25324
- return [`${indent}Reading: ${observed}`];
25325
- }
25326
- function resultLines(check, result, brief) {
25327
- const lines = [
25328
- ` - ${result.verdict} by ${result.role} at ${result.commit_sha}. ${commitStandsText(result.commit_stands)}. ${checkWordsText(check, result)}. Recorded ${result.created_at}. Result ${result.id}.`
25329
- ];
25330
- const retracted = result.retracted;
25331
- if (retracted !== undefined) {
25332
- lines.push(` Retracted by ${actorText(retracted.actor)} at ${retracted.created_at}. The reason: ${retracted.reason}`);
25333
- }
25334
- return [...lines, ...readingLines(result, brief)];
25335
- }
25336
- function ciCheckLines(check, ci, brief) {
25337
- const passStandsLine = ` ${passStandsText(check.pass_stands)}.`;
25338
- const pullRequestLine = ` Pull request line: ${ci.line}`;
25339
- const derived = check.results?.[0];
25340
- if (derived === undefined) {
25341
- return [
25342
- `- ${check.block_id} (${check.when}): no result: ${ci.detail} ${check.text}`,
25343
- passStandsLine,
25344
- pullRequestLine
25345
- ];
25346
- }
25347
- const stands = commitStandsText(derived.commit_stands);
25348
- return [
25349
- `- ${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}`,
25350
- passStandsLine,
25351
- pullRequestLine,
25352
- ...readingLines(derived, brief, " ")
25353
- ];
25354
- }
25355
- function checkLines(check, brief) {
25356
- if (check.ci !== undefined)
25357
- return ciCheckLines(check, check.ci, brief);
25358
- const bases = check.compared_with ?? [];
25359
- const reason = check.compared_nothing;
25360
- 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]}`;
25361
- const results = check.results ?? [];
25362
- return [
25363
- `- ${check.block_id} (${check.when}). ${compared}. ${passStandsText(check.pass_stands)}.`,
25364
- ` The check's words: ${check.text}`,
25365
- ...results.length === 0 ? [" No result is recorded for this check."] : results.flatMap((result) => resultLines(check, result, brief))
25366
- ];
25367
- }
25368
- function formatCheckResults(results, brief = false) {
25369
- if (results.verification_artifact_id === "") {
25370
- 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.`;
25371
- }
25372
- const checks = results.checks ?? [];
25373
- if (checks.length === 0) {
25374
- return `${results.issue}'s Verification document holds no check blocks.`;
25375
- }
25376
- const blocks = checks.map((check) => checkLines(check, brief).join(`
25377
- `));
25378
- return [`Checks of ${results.issue}:`, ...blocks].join(`
25379
-
25380
- `);
25381
- }
25382
25429
  function dryRunAsksDispatch(tool, args) {
25383
25430
  return tool === "dispatch_result" && args["retract"] === undefined;
25384
25431
  }
@@ -26130,6 +26177,7 @@ async function commentCommand(context) {
26130
26177
  const replyToAsk = replyToAskTarget === undefined ? undefined : await resolveReplyToAsk(input.tool, client, owner, resolved, replyToAskTarget.id);
26131
26178
  const replyToBlock = replyTo?.block ?? replyToAskTarget?.block;
26132
26179
  const requestedTurn = optionalString(args, "turn");
26180
+ const mentions = optionalStringArray(args, "mentions");
26133
26181
  const body = await writePictures(resolved, stringArg(args, "body"));
26134
26182
  const commentInput = {
26135
26183
  body,
@@ -26138,6 +26186,7 @@ async function commentCommand(context) {
26138
26186
  ...replyToBlock === undefined ? {} : { reply_to_block: replyToBlock },
26139
26187
  ...replyToAsk === undefined ? {} : { ask_id: replyToAsk },
26140
26188
  ...requestedTurn === undefined ? {} : { turn: requestedTurn },
26189
+ ...mentions === undefined ? {} : { mentions: mentions.map((target) => ({ target })) },
26141
26190
  actor
26142
26191
  };
26143
26192
  const comment = resolved?.owner.kind === "project" ? await client.artifactComment(resolved.artifact.id, commentInput) : await client.comment(issue(), commentInput);