@sjawhar/claude-envoy 6.11.0 → 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.
@@ -2,5 +2,5 @@
2
2
  "name": "claude-envoy",
3
3
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
4
4
  "mcpServers": "./.mcp.json",
5
- "version": "6.11.0"
5
+ "version": "6.12.0"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "6.11.0",
3
+ "version": "6.12.0",
4
4
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
5
5
  "mcpServers": {}
6
6
  }
@@ -14488,6 +14488,39 @@ var RESULT_RECORD_FIELDS = [
14488
14488
  ];
14489
14489
  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.";
14490
14490
  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.";
14491
+ var DEPLOY_REPO = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
14492
+ var DEPLOY_PROGRAM = /^[a-z0-9-]{1,64}$/;
14493
+ var DEPLOY_COMMIT = /^[0-9a-f]{40}$/;
14494
+ 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)$/;
14495
+ function deployRepoProblem(value) {
14496
+ const input = value;
14497
+ return typeof input["repo"] !== "string" || !DEPLOY_REPO.test(input["repo"]) ? "repo must be owner/repo" : undefined;
14498
+ }
14499
+ function deployProblem(value) {
14500
+ const input = value;
14501
+ const repo = deployRepoProblem(input);
14502
+ if (repo !== undefined)
14503
+ return repo;
14504
+ if (typeof input["program"] !== "string" || !DEPLOY_PROGRAM.test(input["program"]))
14505
+ return "program must be 1 to 64 lowercase letters, digits or hyphens";
14506
+ if (typeof input["commit"] !== "string" || !DEPLOY_COMMIT.test(input["commit"]))
14507
+ return "commit must be 40 lowercase hexadecimal characters";
14508
+ if (input["deployed_at"] !== undefined) {
14509
+ const value = input["deployed_at"];
14510
+ if (typeof value !== "string")
14511
+ return "deployed_at must be RFC3339";
14512
+ const parts = DEPLOY_TIME.exec(value);
14513
+ const timestamp = Date.parse(value);
14514
+ if (parts === null || !Number.isFinite(timestamp))
14515
+ return "deployed_at must be RFC3339";
14516
+ const calendar = new Date(`${parts[1]}-${parts[2]}-${parts[3]}T00:00:00Z`);
14517
+ if (calendar.toISOString().slice(0, 10) !== value.slice(0, 10))
14518
+ return "deployed_at must be a valid calendar date";
14519
+ if (timestamp > Date.now() + 5 * 60 * 1000)
14520
+ return "deployed_at must not be more than five minutes in the future";
14521
+ }
14522
+ return;
14523
+ }
14491
14524
  function resultProblem(value) {
14492
14525
  const input = value;
14493
14526
  const carried = RESULT_RECORD_FIELDS.filter((field) => input[field] !== undefined);
@@ -14989,14 +15022,51 @@ var dispatchToolSpecs = [
14989
15022
  refusal: (value) => resultProblem(value) ?? RESULT_SHAPE_RULE
14990
15023
  }
14991
15024
  },
15025
+ {
15026
+ name: "dispatch_deploy",
15027
+ example: {
15028
+ repo: "acme/widgets",
15029
+ program: "worker",
15030
+ commit: "1111111111111111111111111111111111111111"
15031
+ },
15032
+ 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.",
15033
+ arguments: (z) => ({
15034
+ repo: z.string().describe("The deployed repository, owner/repo."),
15035
+ program: z.string().describe("The deployed program, 1 to 64 lowercase letters, digits or hyphens."),
15036
+ commit: z.string().describe("The deployed build, 40 lowercase hexadecimal characters."),
15037
+ 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(),
15038
+ url: z.string().describe("The deployment's URL, if it has one.").optional(),
15039
+ json: z.boolean().describe("Print the complete wire answer as JSON.").optional()
15040
+ }),
15041
+ validation: {
15042
+ check: (value) => deployProblem(value) === undefined,
15043
+ message: "Name repo, program and commit.",
15044
+ refusal: (value) => deployProblem(value) ?? "Name repo, program and commit."
15045
+ }
15046
+ },
15047
+ {
15048
+ name: "dispatch_deploys",
15049
+ example: { repo: "acme/widgets" },
15050
+ 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.",
15051
+ arguments: (z) => ({
15052
+ repo: z.string().describe("The deployed repository, owner/repo."),
15053
+ json: z.boolean().describe("Print the complete wire answer as JSON.").optional()
15054
+ }),
15055
+ validation: {
15056
+ check: (value) => deployRepoProblem(value) === undefined,
15057
+ message: "repo must be owner/repo",
15058
+ refusal: (value) => deployRepoProblem(value) ?? "repo must be owner/repo"
15059
+ }
15060
+ },
14992
15061
  {
14993
15062
  name: "dispatch_results",
14994
15063
  example: { issue: "DSP-1" },
14995
- 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,
15064
+ 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,
14996
15065
  arguments: (z) => ({
14997
15066
  issue: z.string().describe(ISSUE_REFERENCE),
14998
- 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(),
14999
- 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()
15067
+ 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(),
15068
+ 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(),
15069
+ json: z.boolean().describe("Print the complete results wire answer as JSON.").optional()
15000
15070
  })
15001
15071
  },
15002
15072
  {
@@ -15338,6 +15408,13 @@ var IssueDeployedEventPayloadSchema = strictObject({
15338
15408
  run_id: number2().int().positive(),
15339
15409
  completed_at: exports_iso.datetime()
15340
15410
  });
15411
+ var DeployRecordedEventPayloadSchema = strictObject({
15412
+ repo: string2(),
15413
+ program: string2(),
15414
+ commit: string2(),
15415
+ deployed_at: string2(),
15416
+ source: _enum2(["delivery_run", "route"])
15417
+ });
15341
15418
  var childStatusEventPayloadFields = {
15342
15419
  child_key: string2(),
15343
15420
  from: string2(),
@@ -15724,6 +15801,7 @@ var EVENT_TYPE_MEMBERS = {
15724
15801
  "comment.reopened": true,
15725
15802
  "comment.resolved": true,
15726
15803
  "decision.kept": true,
15804
+ "deploy.recorded": true,
15727
15805
  "handoff.recorded": true,
15728
15806
  "issue.claimed": true,
15729
15807
  "issue.closed": true,
@@ -26060,6 +26138,12 @@ class DispatchClient {
26060
26138
  async issueResults(issue, at) {
26061
26139
  return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "results"], undefined, at === undefined ? undefined : { at });
26062
26140
  }
26141
+ async recordDeploy(input) {
26142
+ return this.#json("POST", ["api", "v1", "deploys"], input);
26143
+ }
26144
+ async deploys(repo) {
26145
+ return this.#json("GET", ["api", "v1", "deploys"], undefined, { repo });
26146
+ }
26063
26147
  async retractResult(resultID, input) {
26064
26148
  return this.#json("POST", ["api", "v1", "results", resultID, "retract"], input);
26065
26149
  }
@@ -28569,6 +28653,8 @@ var issueFreeTools = {
28569
28653
  dispatch_limits: true,
28570
28654
  dispatch_api: true,
28571
28655
  dispatch_inbox: true,
28656
+ dispatch_deploy: true,
28657
+ dispatch_deploys: true,
28572
28658
  dispatch_send_to_agent: true,
28573
28659
  dispatch_architecture_sync: true
28574
28660
  };
@@ -30112,7 +30198,8 @@ var BRIEF_READING_CHARACTERS = 200;
30112
30198
  var COMPARISON_REASONS = {
30113
30199
  no_pull_request_or_branch: () => "the issue has no pull request and no branch to compare with",
30114
30200
  repository_unreadable: (repo = "the repository") => `Dispatch cannot read ${repo}`,
30115
- read_failed: (repo) => repo === undefined ? "a read Dispatch made did not answer" : `a read Dispatch made of ${repo} did not answer`
30201
+ read_failed: (repo) => repo === undefined ? "a read Dispatch made did not answer" : `a read Dispatch made of ${repo} did not answer`,
30202
+ not_merged: () => "the work has no merge that Dispatch knows"
30116
30203
  };
30117
30204
  function isComparisonReason(reason) {
30118
30205
  return Object.hasOwn(COMPARISON_REASONS, reason);
@@ -30140,8 +30227,13 @@ function basisText(basis) {
30140
30227
  const pullRequest = basis.pull_request === undefined ? "pull request " : `${pullRequestName(basis, basis.pull_request)} `;
30141
30228
  return `the head of ${pullRequest}at ${basis.commit ?? "an unnamed commit"}${learned}`;
30142
30229
  }
30143
- if (basis.kind === "branch")
30144
- return `branch ${branchName(basis)}${learned}`;
30230
+ if (basis.kind === "branch") {
30231
+ if (basis.merge_commit === undefined)
30232
+ return `branch ${branchName(basis)}${learned}`;
30233
+ const repository = basis.repo === undefined ? "" : `in ${basis.repo} `;
30234
+ const merged = basis.merge_commit === undefined ? "" : `, merged at ${basis.merge_commit}`;
30235
+ return `${repository}branch ${basis.branch ?? "unnamed"}${merged}${learned}`;
30236
+ }
30145
30237
  return `the commit you named, ${basis.commit ?? ""}${learned}`;
30146
30238
  }
30147
30239
  function basisPlace(basis) {
@@ -30174,9 +30266,53 @@ function checkWordsText(check, result) {
30174
30266
  }
30175
30267
  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})`;
30176
30268
  }
30177
- function passStandsText(pass) {
30269
+ function passStandsText(pass, check, repository) {
30178
30270
  if (pass === undefined)
30179
30271
  return "Whether a pass stands is not known: this Dispatch server does not say";
30272
+ const branch = check !== undefined && (check.when === "after_merge" || check.when === "default_branch") && !(check.compared_with ?? []).some((basis) => basis.kind === "named");
30273
+ if (branch && check !== undefined) {
30274
+ const results = check.results ?? [];
30275
+ const deciding = pass.results ?? [];
30276
+ const passed = results.find((result) => result.verdict === "pass" && deciding.includes(result.id));
30277
+ const failed = results.find((result) => result.verdict === "fail" && deciding.includes(result.id));
30278
+ const result = results.find((result) => deciding.includes(result.id));
30279
+ const repo = repository ?? check.compared_with?.[0]?.repo ?? "the repository";
30280
+ const deploy = pass.deploy;
30281
+ const program = deploy?.program ?? check.program ?? "the program";
30282
+ const roles = (pass.roles ?? []).join(", ");
30283
+ if (pass.answer === "yes" && passed !== undefined)
30284
+ return `A pass stands: yes, from ${roles}, as the newest result is pass ${passed.id} at ${pass.commit ?? passed.commit_sha}`;
30285
+ switch (pass.reason) {
30286
+ case "fail":
30287
+ if (failed !== undefined)
30288
+ return `A pass stands: no, as the newest result is fail ${failed.id} at ${pass.commit ?? failed.commit_sha}`;
30289
+ break;
30290
+ case "no_result":
30291
+ return "A pass stands: no, as no result counts at a commit that holds the merge";
30292
+ case "pass_and_fail":
30293
+ if (passed !== undefined && failed !== undefined)
30294
+ 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`;
30295
+ break;
30296
+ case "not_placed":
30297
+ if (result !== undefined)
30298
+ return `A pass stands: not known, as Dispatch could not place ${result.verdict} ${result.id} at ${pass.commit ?? result.commit_sha}`;
30299
+ break;
30300
+ case "read_failed":
30301
+ return "A pass stands: not known, as a read Dispatch made did not answer";
30302
+ case "program_not_named":
30303
+ return `A pass stands: not known, as ${repo} runs more than one program and this check names none`;
30304
+ case "no_deploy":
30305
+ return `A pass stands: not known, as Dispatch holds no deploy of ${program} in ${repo}`;
30306
+ case "deploy_not_merged":
30307
+ if (deploy !== undefined)
30308
+ return `A pass stands: not known, as ${program} runs ${deploy.commit} since ${deploy.deployed_at}, which does not hold the merge`;
30309
+ break;
30310
+ case "no_result_from_deploy":
30311
+ if (deploy !== undefined)
30312
+ return `A pass stands: not known, as no result counts for ${program} at ${deploy.commit}, deployed ${deploy.deployed_at}`;
30313
+ break;
30314
+ }
30315
+ }
30180
30316
  if (pass.answer === "yes") {
30181
30317
  const roles = pass.roles ?? [];
30182
30318
  return roles.length === 0 ? "A pass stands: yes" : `A pass stands: yes, from ${roles.join(", ")}`;
@@ -30205,6 +30341,8 @@ function resultLines(check, result, brief) {
30205
30341
  if (retracted !== undefined) {
30206
30342
  lines.push(` Retracted by ${actorText(retracted.actor)} at ${retracted.created_at}. The reason: ${retracted.reason}`);
30207
30343
  }
30344
+ if (result.not_counted !== undefined && result.not_counted !== "")
30345
+ lines.push(` It counts for nothing: ${result.not_counted}.`);
30208
30346
  return [...lines, ...readingLines(result, brief)];
30209
30347
  }
30210
30348
  function ciCheckLines(check, ci, brief) {
@@ -30226,7 +30364,7 @@ function ciCheckLines(check, ci, brief) {
30226
30364
  ...readingLines(derived, brief, " ")
30227
30365
  ];
30228
30366
  }
30229
- function checkLines(check, brief) {
30367
+ function checkLines(check, brief, repository) {
30230
30368
  if (check.ci !== undefined)
30231
30369
  return ciCheckLines(check, check.ci, brief);
30232
30370
  const bases = check.compared_with ?? [];
@@ -30234,12 +30372,15 @@ function checkLines(check, brief) {
30234
30372
  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)}`;
30235
30373
  const results = check.results ?? [];
30236
30374
  return [
30237
- `- ${check.block_id} (${check.when}). ${compared}. ${passStandsText(check.pass_stands)}.`,
30375
+ `- ${check.block_id} (${check.when}). ${compared}. ${passStandsText(check.pass_stands, check, repository)}.`,
30376
+ ...check.pass_stands?.deploy === undefined ? [] : [
30377
+ ` 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.`
30378
+ ],
30238
30379
  ` The check's words: ${check.text}`,
30239
30380
  ...results.length === 0 ? [" No result is recorded for this check."] : results.flatMap((result) => resultLines(check, result, brief))
30240
30381
  ];
30241
30382
  }
30242
- function formatCheckResults(results, brief = false) {
30383
+ function formatCheckResults(results, brief = false, repositories) {
30243
30384
  if (results.verification_artifact_id === "") {
30244
30385
  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.`;
30245
30386
  }
@@ -30247,7 +30388,7 @@ function formatCheckResults(results, brief = false) {
30247
30388
  if (checks.length === 0) {
30248
30389
  return `${results.issue}'s Verification document holds no check blocks.`;
30249
30390
  }
30250
- const blocks = checks.map((check) => checkLines(check, brief).join(`
30391
+ const blocks = checks.map((check) => checkLines(check, brief, repositories?.[check.issue_key]).join(`
30251
30392
  `));
30252
30393
  return [`Checks of ${results.issue}:`, ...blocks].join(`
30253
30394
 
@@ -30983,8 +31124,15 @@ async function resultsCommand(context) {
30983
31124
  const brief = optionalBoolean(args, "brief") === true;
30984
31125
  const results = await client.issueResults(issue, at);
30985
31126
  const checks = results.checks ?? [];
31127
+ const repositories = {};
31128
+ 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));
31129
+ await Promise.all([...owners].map(async (owner) => {
31130
+ const issue = await client.getIssue(owner);
31131
+ if (issue.resolved_repo != null)
31132
+ repositories[owner] = issue.resolved_repo;
31133
+ }));
30986
31134
  return {
30987
- text: formatCheckResults(results, brief),
31135
+ text: formatCheckResults(results, brief, repositories),
30988
31136
  details: {
30989
31137
  issue,
30990
31138
  checks: checks.length,
@@ -31409,6 +31557,7 @@ var WRITE_ROUTES = [
31409
31557
  { method: "POST", pattern: "/api/v1/issues/{key}/results", commands: ["result"] },
31410
31558
  { method: "POST", pattern: "/api/v1/issues/{key}/results/dry-run", commands: ["result"] },
31411
31559
  { method: "POST", pattern: "/api/v1/results/{id}/retract", commands: ["result"] },
31560
+ { method: "POST", pattern: "/api/v1/deploys", commands: ["deploy"] },
31412
31561
  { method: "POST", pattern: "/api/v1/issues/{key}/handoffs/{phase}", commands: ["handoff-write"] },
31413
31562
  { method: "POST", pattern: "/api/v1/issues/{key}/artifacts", commands: ["artifact"] },
31414
31563
  { method: "POST", pattern: "/api/v1/projects/{key}/artifacts", commands: ["artifact"] },
@@ -32354,6 +32503,37 @@ async function sendToAgentCommand(context) {
32354
32503
  };
32355
32504
  }
32356
32505
 
32506
+ // ../envoy-client/src/dispatch-commands/deploy.ts
32507
+ function deployText(deploy) {
32508
+ const link = deploy.url === "" ? "" : ` ${deploy.url}`;
32509
+ return `${deploy.program}: ${deploy.commit} since ${deploy.deployed_at} (source: ${deploy.source}, recorded by ${actorText(deploy.recorded_by)}).${link}`;
32510
+ }
32511
+ async function deployCommand(context) {
32512
+ const { args, client } = context;
32513
+ const input = {
32514
+ repo: stringArg(args, "repo"),
32515
+ program: stringArg(args, "program"),
32516
+ commit: stringArg(args, "commit"),
32517
+ ...defined("deployed_at", optionalString(args, "deployed_at")),
32518
+ ...defined("url", optionalString(args, "url"))
32519
+ };
32520
+ const result = await client.recordDeploy(input);
32521
+ return {
32522
+ text: optionalBoolean(args, "json") === true ? JSON.stringify(result, null, 2) : deployText(result.deploy),
32523
+ details: { repo: input.repo, deploy: result.deploy }
32524
+ };
32525
+ }
32526
+ async function deploysCommand(context) {
32527
+ const { args, client } = context;
32528
+ const result = await client.deploys(stringArg(args, "repo"));
32529
+ const deploys = result.deploys ?? [];
32530
+ return {
32531
+ text: optionalBoolean(args, "json") === true ? JSON.stringify(result, null, 2) : deploys.length === 0 ? `Dispatch holds no deploys for ${result.repo}.` : deploys.map(deployText).join(`
32532
+ `),
32533
+ details: { repo: result.repo, deploys }
32534
+ };
32535
+ }
32536
+
32357
32537
  // ../envoy-client/src/dispatch-commands/documents.ts
32358
32538
  import { resolve as resolvePath3 } from "path";
32359
32539
 
@@ -34562,6 +34742,8 @@ var dispatchCommands = {
34562
34742
  dispatch_review: acting(reviewCommand),
34563
34743
  dispatch_result: acting(resultCommand),
34564
34744
  dispatch_results: acting(resultsCommand),
34745
+ dispatch_deploy: acting(deployCommand),
34746
+ dispatch_deploys: acting(deploysCommand),
34565
34747
  dispatch_artifact: {
34566
34748
  ...acting(artifactCommand),
34567
34749
  dryRun: artifactDryRun,
@@ -37044,20 +37226,18 @@ function tradeProjects(env) {
37044
37226
  }
37045
37227
  return sorted;
37046
37228
  }
37229
+ var ROLE_KEY_NAMED = `this role's agent-secrets key in the directory ${KEY_DIR_VAR} names`;
37047
37230
  async function machineKey(env) {
37048
37231
  const dir = value(env, KEY_DIR_VAR);
37049
37232
  if (value(env, IDENTITY_VAR) !== IDENTITY_KUBERNETES || dir === "")
37050
37233
  return await newDpopKey();
37051
- const path = join8(dir, ROLE_KEY_FILE);
37052
37234
  let pem;
37053
37235
  try {
37054
- pem = await readFile6(path, "utf8");
37236
+ pem = await readFile6(join8(dir, ROLE_KEY_FILE), "utf8");
37055
37237
  } catch (error) {
37056
- throw new Error(`read this role's agent-secrets key ${path}: ${messageOf(error)}`, {
37057
- cause: error
37058
- });
37238
+ throw new Error(`read ${ROLE_KEY_NAMED}: ${readErrorCode(error)}`);
37059
37239
  }
37060
- return await importDpopKey(pem, `this role's agent-secrets key ${path}`);
37240
+ return await importDpopKey(pem, ROLE_KEY_NAMED);
37061
37241
  }
37062
37242
  async function brokerTokenClient(env, own = "", read) {
37063
37243
  const brokerUrl = value(env, BROKER_URL_VAR);