@sjawhar/claude-envoy 6.11.1 → 6.12.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.
@@ -18092,6 +18092,39 @@ var RESULT_RECORD_FIELDS = [
18092
18092
  ];
18093
18093
  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.";
18094
18094
  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.";
18095
+ var DEPLOY_REPO = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
18096
+ var DEPLOY_PROGRAM = /^[a-z0-9-]{1,64}$/;
18097
+ var DEPLOY_COMMIT = /^[0-9a-f]{40}$/;
18098
+ var DEPLOY_TIME = /^(\d{4})-(\d{2})-(\d{2})T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;
18099
+ function deployRepoProblem(value) {
18100
+ const input = value;
18101
+ return typeof input["repo"] !== "string" || !DEPLOY_REPO.test(input["repo"]) ? "repo must be owner/repo" : undefined;
18102
+ }
18103
+ function deployProblem(value) {
18104
+ const input = value;
18105
+ const repo = deployRepoProblem(input);
18106
+ if (repo !== undefined)
18107
+ return repo;
18108
+ if (typeof input["program"] !== "string" || !DEPLOY_PROGRAM.test(input["program"]))
18109
+ return "program must be 1 to 64 lowercase letters, digits or hyphens";
18110
+ if (typeof input["commit"] !== "string" || !DEPLOY_COMMIT.test(input["commit"]))
18111
+ return "commit must be 40 lowercase hexadecimal characters";
18112
+ if (input["deployed_at"] !== undefined) {
18113
+ const value = input["deployed_at"];
18114
+ if (typeof value !== "string")
18115
+ return "deployed_at must be RFC3339";
18116
+ const parts = DEPLOY_TIME.exec(value);
18117
+ const timestamp = Date.parse(value);
18118
+ if (parts === null || !Number.isFinite(timestamp))
18119
+ return "deployed_at must be RFC3339";
18120
+ const calendar = new Date(`${parts[1]}-${parts[2]}-${parts[3]}T00:00:00Z`);
18121
+ if (calendar.toISOString().slice(0, 10) !== value.slice(0, 10))
18122
+ return "deployed_at must be a valid calendar date";
18123
+ if (timestamp > Date.now() + 5 * 60 * 1000)
18124
+ return "deployed_at must not be more than five minutes in the future";
18125
+ }
18126
+ return;
18127
+ }
18095
18128
  function resultProblem(value) {
18096
18129
  const input = value;
18097
18130
  const carried = RESULT_RECORD_FIELDS.filter((field) => input[field] !== undefined);
@@ -18593,14 +18626,51 @@ var dispatchToolSpecs = [
18593
18626
  refusal: (value) => resultProblem(value) ?? RESULT_SHAPE_RULE
18594
18627
  }
18595
18628
  },
18629
+ {
18630
+ name: "dispatch_deploy",
18631
+ example: {
18632
+ repo: "acme/widgets",
18633
+ program: "worker",
18634
+ commit: "1111111111111111111111111111111111111111"
18635
+ },
18636
+ description: "Record a deployed program's build. Dispatch records the credential's writer; the body cannot choose one. A repeat of the current commit changes nothing, including its time. An older time at another commit is DEPLOY_NOT_NEWEST and names the current build. The repository must hold the commit. A project-scoped credential cannot write a deployment-wide fact. --dry-run checks the arguments and sends nothing; --json prints the complete wire answer.",
18637
+ arguments: (z) => ({
18638
+ repo: z.string().describe("The deployed repository, owner/repo."),
18639
+ program: z.string().describe("The deployed program, 1 to 64 lowercase letters, digits or hyphens."),
18640
+ commit: z.string().describe("The deployed build, 40 lowercase hexadecimal characters."),
18641
+ deployed_at: z.string().describe("The deployment time in RFC3339. Omit it for the server's clock; a time over five minutes ahead is refused.").optional(),
18642
+ url: z.string().describe("The deployment's URL, if it has one.").optional(),
18643
+ json: z.boolean().describe("Print the complete wire answer as JSON.").optional()
18644
+ }),
18645
+ validation: {
18646
+ check: (value) => deployProblem(value) === undefined,
18647
+ message: "Name repo, program and commit.",
18648
+ refusal: (value) => deployProblem(value) ?? "Name repo, program and commit."
18649
+ }
18650
+ },
18651
+ {
18652
+ name: "dispatch_deploys",
18653
+ example: { repo: "acme/widgets" },
18654
+ description: "Read the current deploy of each program in a repository, in program order, with its commit, deployment time, source and URL. --json prints the complete wire answer, including the writer and a known workflow attempt or null for an unknown attempt.",
18655
+ arguments: (z) => ({
18656
+ repo: z.string().describe("The deployed repository, owner/repo."),
18657
+ json: z.boolean().describe("Print the complete wire answer as JSON.").optional()
18658
+ }),
18659
+ validation: {
18660
+ check: (value) => deployRepoProblem(value) === undefined,
18661
+ message: "repo must be owner/repo",
18662
+ refusal: (value) => deployRepoProblem(value) ?? "repo must be owner/repo"
18663
+ }
18664
+ },
18596
18665
  {
18597
18666
  name: "dispatch_results",
18598
18667
  example: { issue: "DSP-1" },
18599
- 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. " + `${CHECK_PROVED_BY_CI}: ` + "no role records its result, and Dispatch reads it from GitHub at the head of the " + "issue's open pull request of the highest number, else at the head of its merged one of " + "the highest number. Its one result prints as `- <id> (before_merge): <verdict> at " + "<commit> by ci (CI run <name>, <conclusion>), <where that commit stands>. <the check's " + "words>`, then the `A pass stands:` line a recorded check prints, then `Pull request line:` " + "and the line to write into the pull-request body unchanged, then the reading: the " + "conclusion, the run's output title and summary, and its URL. A run that proves nothing " + "prints `- <id> (before_merge): no result:`, the sentence that names why, and the check's " + "words, then the `A pass stands:` line, then `Pull request line:` and `- Check <id> " + "(before_merge): CI run <name> has no result (<case>)`. That is a run that has not " + "concluded, one that concluded neutral, skipped or cancelled, one absent at the head, an " + "issue with no pull request head, or GitHub not read, with what GitHub answered. " + "A pull-request line writes `CI run <name>` only when it keeps every word of the name, " + "and `the CI run the check names` in its place where it drops one: a word the line drops, " + "such as an issue key or a word holding `_`. " + "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. A check CI proves is read " + "again at the new head by itself. " + ISSUE_REFERENCE,
18668
+ 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 every open pull request head, or the final head of the last to merge when " + "none is open. An after_merge result counts only at a commit that holds the work's merge " + "on the compared branch. A default_branch check names the default branch alone. " + "With no known merge, an after_merge check compares with nothing and says so. " + "A read that failed is not known, never a pass or a fail. The newest branch result decides " + "and names its id and commit. A pass and fail at that commit are not known until retraction. " + "Production and graph checks count only results recorded for the current deploy of the " + "program they read. The output names that deploy and says why an excluded result counts " + "for nothing. The check's words must be unchanged and the result unretracted. " + "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. " + `${CHECK_PROVED_BY_CI}: ` + "no role records its result. Dispatch reads GitHub at every open head, or the final head " + "of the last pull request to merge when none is open. Its result prints as `- <id> (before_merge): <verdict> at " + "<commit> by ci (CI run <name>, <conclusion>), <where that commit stands>. <the check's " + "words>`, then the `A pass stands:` line a recorded check prints, then `Pull request line:` " + "and the line to write into the pull-request body unchanged, then the reading: the " + "conclusion, the run's output title and summary, and its URL. A run that proves nothing " + "prints `- <id> (before_merge): no result:`, the sentence that names why, and the check's " + "words, then the `A pass stands:` line, then `Pull request line:` and `- Check <id> " + "(before_merge): CI run <name> has no result (<case>)`. That is a run that has not " + "concluded, one that concluded neutral, skipped or cancelled, one absent at the head, an " + "issue with no pull request head, or GitHub not read, with what GitHub answered. " + "A pull-request line writes `CI run <name>` only when it keeps every word of the name, " + "and `the CI run the check names` in its place where it drops one: a word the line drops, " + "such as an issue key or a word holding `_`. " + "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. A check CI proves is read " + "again at the new head by itself. " + ISSUE_REFERENCE,
18600
18669
  arguments: (z) => ({
18601
18670
  issue: z.string().describe(ISSUE_REFERENCE),
18602
- at: z.string().describe("One commit of 40 lowercase hex characters. It becomes the only thing every check is compared with. Dispatch reads GitHub for none of it, except the check runs of a check CI proves, which it reads at the issue's newest pull request head as on every read, so that check's result stands at this commit only where it is that head.").optional(),
18603
- 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()
18671
+ at: z.string().describe("One commit of 40 lowercase hex characters. It becomes the only thing every check is compared with. Dispatch reads GitHub for none of it, except the check runs of a check CI proves, which it reads at each open pull request head, or with none open the final head of the newest merged one, as on every read, so that check's result stands at this commit only where it is the head it was read at.").optional(),
18672
+ 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(),
18673
+ json: z.boolean().describe("Print the complete results wire answer as JSON.").optional()
18604
18674
  })
18605
18675
  },
18606
18676
  {
@@ -18942,6 +19012,13 @@ var IssueDeployedEventPayloadSchema = strictObject({
18942
19012
  run_id: number2().int().positive(),
18943
19013
  completed_at: exports_iso.datetime()
18944
19014
  });
19015
+ var DeployRecordedEventPayloadSchema = strictObject({
19016
+ repo: string2(),
19017
+ program: string2(),
19018
+ commit: string2(),
19019
+ deployed_at: string2(),
19020
+ source: _enum2(["delivery_run", "route"])
19021
+ });
18945
19022
  var childStatusEventPayloadFields = {
18946
19023
  child_key: string2(),
18947
19024
  from: string2(),
@@ -19328,6 +19405,7 @@ var EVENT_TYPE_MEMBERS = {
19328
19405
  "comment.reopened": true,
19329
19406
  "comment.resolved": true,
19330
19407
  "decision.kept": true,
19408
+ "deploy.recorded": true,
19331
19409
  "handoff.recorded": true,
19332
19410
  "issue.claimed": true,
19333
19411
  "issue.closed": true,
@@ -27275,6 +27353,12 @@ class DispatchClient {
27275
27353
  async issueResults(issue, at) {
27276
27354
  return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "results"], undefined, at === undefined ? undefined : { at });
27277
27355
  }
27356
+ async recordDeploy(input) {
27357
+ return this.#json("POST", ["api", "v1", "deploys"], input);
27358
+ }
27359
+ async deploys(repo) {
27360
+ return this.#json("GET", ["api", "v1", "deploys"], undefined, { repo });
27361
+ }
27278
27362
  async retractResult(resultID, input) {
27279
27363
  return this.#json("POST", ["api", "v1", "results", resultID, "retract"], input);
27280
27364
  }
@@ -29784,6 +29868,8 @@ var issueFreeTools = {
29784
29868
  dispatch_limits: true,
29785
29869
  dispatch_api: true,
29786
29870
  dispatch_inbox: true,
29871
+ dispatch_deploy: true,
29872
+ dispatch_deploys: true,
29787
29873
  dispatch_send_to_agent: true,
29788
29874
  dispatch_architecture_sync: true
29789
29875
  };
@@ -31327,7 +31413,8 @@ var BRIEF_READING_CHARACTERS = 200;
31327
31413
  var COMPARISON_REASONS = {
31328
31414
  no_pull_request_or_branch: () => "the issue has no pull request and no branch to compare with",
31329
31415
  repository_unreadable: (repo = "the repository") => `Dispatch cannot read ${repo}`,
31330
- read_failed: (repo) => repo === undefined ? "a read Dispatch made did not answer" : `a read Dispatch made of ${repo} did not answer`
31416
+ read_failed: (repo) => repo === undefined ? "a read Dispatch made did not answer" : `a read Dispatch made of ${repo} did not answer`,
31417
+ not_merged: () => "the work has no merge that Dispatch knows"
31331
31418
  };
31332
31419
  function isComparisonReason(reason) {
31333
31420
  return Object.hasOwn(COMPARISON_REASONS, reason);
@@ -31355,8 +31442,13 @@ function basisText(basis) {
31355
31442
  const pullRequest = basis.pull_request === undefined ? "pull request " : `${pullRequestName(basis, basis.pull_request)} `;
31356
31443
  return `the head of ${pullRequest}at ${basis.commit ?? "an unnamed commit"}${learned}`;
31357
31444
  }
31358
- if (basis.kind === "branch")
31359
- return `branch ${branchName(basis)}${learned}`;
31445
+ if (basis.kind === "branch") {
31446
+ if (basis.merge_commit === undefined)
31447
+ return `branch ${branchName(basis)}${learned}`;
31448
+ const repository = basis.repo === undefined ? "" : `in ${basis.repo} `;
31449
+ const merged = basis.merge_commit === undefined ? "" : `, merged at ${basis.merge_commit}`;
31450
+ return `${repository}branch ${basis.branch ?? "unnamed"}${merged}${learned}`;
31451
+ }
31360
31452
  return `the commit you named, ${basis.commit ?? ""}${learned}`;
31361
31453
  }
31362
31454
  function basisPlace(basis) {
@@ -31389,9 +31481,53 @@ function checkWordsText(check, result) {
31389
31481
  }
31390
31482
  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})`;
31391
31483
  }
31392
- function passStandsText(pass) {
31484
+ function passStandsText(pass, check, repository) {
31393
31485
  if (pass === undefined)
31394
31486
  return "Whether a pass stands is not known: this Dispatch server does not say";
31487
+ const branch = check !== undefined && (check.when === "after_merge" || check.when === "default_branch") && !(check.compared_with ?? []).some((basis) => basis.kind === "named");
31488
+ if (branch && check !== undefined) {
31489
+ const results = check.results ?? [];
31490
+ const deciding = pass.results ?? [];
31491
+ const passed = results.find((result) => result.verdict === "pass" && deciding.includes(result.id));
31492
+ const failed = results.find((result) => result.verdict === "fail" && deciding.includes(result.id));
31493
+ const result = results.find((result) => deciding.includes(result.id));
31494
+ const repo = repository ?? check.compared_with?.[0]?.repo ?? "the repository";
31495
+ const deploy = pass.deploy;
31496
+ const program = deploy?.program ?? check.program ?? "the program";
31497
+ const roles = (pass.roles ?? []).join(", ");
31498
+ if (pass.answer === "yes" && passed !== undefined)
31499
+ return `A pass stands: yes, from ${roles}, as the newest result is pass ${passed.id} at ${pass.commit ?? passed.commit_sha}`;
31500
+ switch (pass.reason) {
31501
+ case "fail":
31502
+ if (failed !== undefined)
31503
+ return `A pass stands: no, as the newest result is fail ${failed.id} at ${pass.commit ?? failed.commit_sha}`;
31504
+ break;
31505
+ case "no_result":
31506
+ return "A pass stands: no, as no result counts at a commit that holds the merge";
31507
+ case "pass_and_fail":
31508
+ if (passed !== undefined && failed !== undefined)
31509
+ return `A pass stands: not known, as pass ${passed.id} and fail ${failed.id} both count at ${pass.commit ?? passed.commit_sha}. A retraction of the wrong one ends it`;
31510
+ break;
31511
+ case "not_placed":
31512
+ if (result !== undefined)
31513
+ return `A pass stands: not known, as Dispatch could not place ${result.verdict} ${result.id} at ${pass.commit ?? result.commit_sha}`;
31514
+ break;
31515
+ case "read_failed":
31516
+ return "A pass stands: not known, as a read Dispatch made did not answer";
31517
+ case "program_not_named":
31518
+ return `A pass stands: not known, as ${repo} runs more than one program and this check names none`;
31519
+ case "no_deploy":
31520
+ return `A pass stands: not known, as Dispatch holds no deploy of ${program} in ${repo}`;
31521
+ case "deploy_not_merged":
31522
+ if (deploy !== undefined)
31523
+ return `A pass stands: not known, as ${program} runs ${deploy.commit} since ${deploy.deployed_at}, which does not hold the merge`;
31524
+ break;
31525
+ case "no_result_from_deploy":
31526
+ if (deploy !== undefined)
31527
+ return `A pass stands: not known, as no result counts for ${program} at ${deploy.commit}, deployed ${deploy.deployed_at}`;
31528
+ break;
31529
+ }
31530
+ }
31395
31531
  if (pass.answer === "yes") {
31396
31532
  const roles = pass.roles ?? [];
31397
31533
  return roles.length === 0 ? "A pass stands: yes" : `A pass stands: yes, from ${roles.join(", ")}`;
@@ -31420,6 +31556,8 @@ function resultLines(check, result, brief) {
31420
31556
  if (retracted !== undefined) {
31421
31557
  lines.push(` Retracted by ${actorText(retracted.actor)} at ${retracted.created_at}. The reason: ${retracted.reason}`);
31422
31558
  }
31559
+ if (result.not_counted !== undefined && result.not_counted !== "")
31560
+ lines.push(` It counts for nothing: ${result.not_counted}.`);
31423
31561
  return [...lines, ...readingLines(result, brief)];
31424
31562
  }
31425
31563
  function ciCheckLines(check, ci, brief) {
@@ -31441,7 +31579,7 @@ function ciCheckLines(check, ci, brief) {
31441
31579
  ...readingLines(derived, brief, " ")
31442
31580
  ];
31443
31581
  }
31444
- function checkLines(check, brief) {
31582
+ function checkLines(check, brief, repository) {
31445
31583
  if (check.ci !== undefined)
31446
31584
  return ciCheckLines(check, check.ci, brief);
31447
31585
  const bases = check.compared_with ?? [];
@@ -31449,12 +31587,15 @@ function checkLines(check, brief) {
31449
31587
  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)}`;
31450
31588
  const results = check.results ?? [];
31451
31589
  return [
31452
- `- ${check.block_id} (${check.when}). ${compared}. ${passStandsText(check.pass_stands)}.`,
31590
+ `- ${check.block_id} (${check.when}). ${compared}. ${passStandsText(check.pass_stands, check, repository)}.`,
31591
+ ...check.pass_stands?.deploy === undefined ? [] : [
31592
+ ` Program ${check.pass_stands.deploy.program} runs ${check.pass_stands.deploy.commit} since ${check.pass_stands.deploy.deployed_at}; a pass of this check must come from this deploy.`
31593
+ ],
31453
31594
  ` The check's words: ${check.text}`,
31454
31595
  ...results.length === 0 ? [" No result is recorded for this check."] : results.flatMap((result) => resultLines(check, result, brief))
31455
31596
  ];
31456
31597
  }
31457
- function formatCheckResults(results, brief = false) {
31598
+ function formatCheckResults(results, brief = false, repositories) {
31458
31599
  if (results.verification_artifact_id === "") {
31459
31600
  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.`;
31460
31601
  }
@@ -31462,7 +31603,7 @@ function formatCheckResults(results, brief = false) {
31462
31603
  if (checks.length === 0) {
31463
31604
  return `${results.issue}'s Verification document holds no check blocks.`;
31464
31605
  }
31465
- const blocks = checks.map((check) => checkLines(check, brief).join(`
31606
+ const blocks = checks.map((check) => checkLines(check, brief, repositories?.[check.issue_key]).join(`
31466
31607
  `));
31467
31608
  return [`Checks of ${results.issue}:`, ...blocks].join(`
31468
31609
 
@@ -32198,8 +32339,15 @@ async function resultsCommand(context) {
32198
32339
  const brief = optionalBoolean(args, "brief") === true;
32199
32340
  const results = await client.issueResults(issue, at);
32200
32341
  const checks = results.checks ?? [];
32342
+ const repositories = {};
32343
+ const owners = new Set(checks.filter((check) => check.pass_stands?.reason === "program_not_named" || check.pass_stands?.reason === "no_deploy").map((check) => check.issue_key));
32344
+ await Promise.all([...owners].map(async (owner) => {
32345
+ const issue = await client.getIssue(owner);
32346
+ if (issue.resolved_repo != null)
32347
+ repositories[owner] = issue.resolved_repo;
32348
+ }));
32201
32349
  return {
32202
- text: formatCheckResults(results, brief),
32350
+ text: formatCheckResults(results, brief, repositories),
32203
32351
  details: {
32204
32352
  issue,
32205
32353
  checks: checks.length,
@@ -32624,6 +32772,7 @@ var WRITE_ROUTES = [
32624
32772
  { method: "POST", pattern: "/api/v1/issues/{key}/results", commands: ["result"] },
32625
32773
  { method: "POST", pattern: "/api/v1/issues/{key}/results/dry-run", commands: ["result"] },
32626
32774
  { method: "POST", pattern: "/api/v1/results/{id}/retract", commands: ["result"] },
32775
+ { method: "POST", pattern: "/api/v1/deploys", commands: ["deploy"] },
32627
32776
  { method: "POST", pattern: "/api/v1/issues/{key}/handoffs/{phase}", commands: ["handoff-write"] },
32628
32777
  { method: "POST", pattern: "/api/v1/issues/{key}/artifacts", commands: ["artifact"] },
32629
32778
  { method: "POST", pattern: "/api/v1/projects/{key}/artifacts", commands: ["artifact"] },
@@ -33569,6 +33718,37 @@ async function sendToAgentCommand(context) {
33569
33718
  };
33570
33719
  }
33571
33720
 
33721
+ // ../envoy-client/src/dispatch-commands/deploy.ts
33722
+ function deployText(deploy) {
33723
+ const link = deploy.url === "" ? "" : ` ${deploy.url}`;
33724
+ return `${deploy.program}: ${deploy.commit} since ${deploy.deployed_at} (source: ${deploy.source}, recorded by ${actorText(deploy.recorded_by)}).${link}`;
33725
+ }
33726
+ async function deployCommand(context) {
33727
+ const { args, client } = context;
33728
+ const input = {
33729
+ repo: stringArg(args, "repo"),
33730
+ program: stringArg(args, "program"),
33731
+ commit: stringArg(args, "commit"),
33732
+ ...defined("deployed_at", optionalString(args, "deployed_at")),
33733
+ ...defined("url", optionalString(args, "url"))
33734
+ };
33735
+ const result = await client.recordDeploy(input);
33736
+ return {
33737
+ text: optionalBoolean(args, "json") === true ? JSON.stringify(result, null, 2) : deployText(result.deploy),
33738
+ details: { repo: input.repo, deploy: result.deploy }
33739
+ };
33740
+ }
33741
+ async function deploysCommand(context) {
33742
+ const { args, client } = context;
33743
+ const result = await client.deploys(stringArg(args, "repo"));
33744
+ const deploys = result.deploys ?? [];
33745
+ return {
33746
+ text: optionalBoolean(args, "json") === true ? JSON.stringify(result, null, 2) : deploys.length === 0 ? `Dispatch holds no deploys for ${result.repo}.` : deploys.map(deployText).join(`
33747
+ `),
33748
+ details: { repo: result.repo, deploys }
33749
+ };
33750
+ }
33751
+
33572
33752
  // ../envoy-client/src/dispatch-commands/documents.ts
33573
33753
  import { resolve as resolvePath3 } from "path";
33574
33754
 
@@ -35777,6 +35957,8 @@ var dispatchCommands = {
35777
35957
  dispatch_review: acting(reviewCommand),
35778
35958
  dispatch_result: acting(resultCommand),
35779
35959
  dispatch_results: acting(resultsCommand),
35960
+ dispatch_deploy: acting(deployCommand),
35961
+ dispatch_deploys: acting(deploysCommand),
35780
35962
  dispatch_artifact: {
35781
35963
  ...acting(artifactCommand),
35782
35964
  dryRun: artifactDryRun,
@@ -37068,20 +37250,18 @@ function tradeProjects(env) {
37068
37250
  }
37069
37251
  return sorted;
37070
37252
  }
37253
+ var ROLE_KEY_NAMED = `this role's agent-secrets key in the directory ${KEY_DIR_VAR} names`;
37071
37254
  async function machineKey(env) {
37072
37255
  const dir = value(env, KEY_DIR_VAR);
37073
37256
  if (value(env, IDENTITY_VAR) !== IDENTITY_KUBERNETES || dir === "")
37074
37257
  return await newDpopKey();
37075
- const path = join9(dir, ROLE_KEY_FILE);
37076
37258
  let pem;
37077
37259
  try {
37078
- pem = await readFile6(path, "utf8");
37260
+ pem = await readFile6(join9(dir, ROLE_KEY_FILE), "utf8");
37079
37261
  } catch (error) {
37080
- throw new Error(`read this role's agent-secrets key ${path}: ${messageOf(error)}`, {
37081
- cause: error
37082
- });
37262
+ throw new Error(`read ${ROLE_KEY_NAMED}: ${readErrorCode(error)}`);
37083
37263
  }
37084
- return await importDpopKey(pem, `this role's agent-secrets key ${path}`);
37264
+ return await importDpopKey(pem, ROLE_KEY_NAMED);
37085
37265
  }
37086
37266
  async function brokerTokenClient(env, own = "", read) {
37087
37267
  const brokerUrl = value(env, BROKER_URL_VAR);
@@ -23,10 +23,23 @@ The pull request body's `Checks` lines are in `skill://legion-worker/references/
23
23
  The negative control shows it failing on a deliberately wrong input.
24
24
  A documented procedure counts only when it ran: reading it is not a run.
25
25
 
26
- - A `before_merge` result stands while its commit is the head of an open pull request Dispatch attributes to the check's issue (`packages/envoy/internal/dispatch/delivery/attribution.go`), or the final head of a merged one, and while no part of the check's block has changed.
27
- So after a push, record each `before_merge` check with no `ci_check` again.
26
+ - A `before_merge` result stands at a compared open or merged head in that result's repository.
27
+ The check needs a standing pass at every open head, across all its repositories.
28
+ When none is open, only the final head of the last pull request to merge is required.
29
+ An unordered merged set leaves the check not known.
30
+ A result stands while no part of the check's block has changed.
31
+ A pass and a fail at one required head read not known until one of them is retracted.
32
+ Results at a head that is not required do not decide the check.
33
+ After a push, record each `before_merge` check with no `ci_check` again at the new head.
28
34
  Run it again only when the change since its pass can affect what it drives; otherwise record its earlier pass at the new head with `--observed 'carried from <old sha>: <why the change cannot affect it>'`.
29
35
 
36
+ - An `after_merge` result counts only at a commit on the branch the issue's pull request merged into, or on the default branch.
37
+ That commit must also be the merge of the work on that branch, or have it in its history.
38
+ The merge of the work is the commit that brought the issue's pull request that merged last into that branch.
39
+ Where work merged into an integration branch, the default branch uses that branch's newest recorded landing whose final head holds the work's merge.
40
+ The newest counting result chooses the commit whose verdicts decide the check.
41
+ A pass and a fail at that commit leave the check not known until one is retracted.
42
+
30
43
  ## The rules every phase's evidence follows
31
44
 
32
45
  - The tester tries to break the changed surface (wrong and boundary inputs, the second and the concurrent run, the party it must refuse) and writes a failing test for each way it breaks that no existing test catches.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "6.11.1",
3
+ "version": "6.12.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",