@sjawhar/claude-envoy 6.11.1 → 6.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/dist/codex-hook.js +201 -21
- package/dist/dispatch.js +201 -21
- package/dist/envoy-channel.js +203 -23
- package/dist/session-hook.js +201 -21
- package/legion/skills/legion-architect/SKILL.md +2 -2
- package/legion/skills/legion-architect/references/acceptance.md +1 -1
- package/legion/skills/legion-architect/references/decomposition.md +2 -2
- package/legion/skills/legion-architect/references/operations.md +1 -1
- package/legion/skills/legion-controller/SKILL.md +5 -5
- package/legion/skills/legion-controller/references/backlog-stewardship.md +3 -3
- package/legion/skills/legion-controller/references/consolidation.md +1 -1
- package/legion/skills/legion-controller/references/daily-report.md +6 -17
- package/legion/skills/legion-controller/references/escalation.md +1 -1
- package/legion/skills/legion-controller/references/finding-asks-steps.md +4 -4
- package/legion/skills/legion-controller/references/finding-asks.md +16 -15
- package/legion/skills/legion-controller/references/operations-steps.md +2 -2
- package/legion/skills/legion-controller/references/operations.md +5 -5
- package/legion/skills/legion-controller/references/park-asks.md +2 -2
- package/legion/skills/legion-controller/references/triage.md +1 -1
- package/legion/skills/legion-oracle/SKILL.md +1 -1
- package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +0 -2
- package/legion/skills/legion-worker/references/findings-steps.md +5 -5
- package/legion/skills/legion-worker/references/findings.md +13 -22
- package/legion/skills/legion-worker/references/results.md +15 -2
- package/package.json +1 -1
- package/skills/dispatch/SKILL.md +7 -3
- package/skills/dispatch-first/SKILL.md +1 -1
- package/skills/dispatch-writing-specs/SKILL.md +1 -1
package/dist/dispatch.js
CHANGED
|
@@ -14716,8 +14716,8 @@ function dispatchToolSchema(spec, z, opts) {
|
|
|
14716
14716
|
var ISSUE_REFERENCE = "An issue is a native KEY or external owner/repo#n reference. An external reference addresses an existing Dispatch issue, including one linked to that GitHub pull request; only dispatch issue with --external creates a native issue.";
|
|
14717
14717
|
var BOARD_NEIGHBOUR_REFUSAL = "The server refuses a key that does not exist, one in another project, this issue itself, an empty value, and a pair the board does not hold in that order.";
|
|
14718
14718
|
var OWNER_REFERENCE = "Exactly one of issue and project is required. An issue is a native KEY or external owner/repo#n reference; a project is a project key such as CORE and addresses an unlinked project document named by artifact.";
|
|
14719
|
-
var ASK_QUESTION_CONTRACT = "The question names the concrete case first: which machines, files, sessions or people, and the " + "numbers. It asks the choice in those terms, saying what happens to whom under each option " + '("Ship Friday and risk signing out 1,240 users, or hold to Monday?"), never "How should we ' + 'proceed?" or "Which option?", because a reader cannot work back from a general question to ' + "the case. It carries every fact the reader needs to decide and nothing " + "that does not change the decision. Generalize only after the specifics, if at all.
|
|
14720
|
-
var ASK_OPTIONS_CONTRACT = "Options carry the
|
|
14719
|
+
var ASK_QUESTION_CONTRACT = "The question names the concrete case first: which machines, files, sessions or people, and the " + "numbers. It asks the choice in those terms, saying what happens to whom under each option " + '("Ship Friday and risk signing out 1,240 users, or hold to Monday?"), never "How should we ' + 'proceed?" or "Which option?", because a reader cannot work back from a general question to ' + "the case. It carries every fact the reader needs to decide and nothing " + "that does not change the decision. Generalize only after the specifics, if at all. A question " + "between two or more real choices gives one recommendation and its reason. A request for one " + "act only the person can do (an approval, a credential, a grant, a setting of their own " + "account) says what the act is, what it changes and how to do it, and gives no recommendation.";
|
|
14720
|
+
var ASK_OPTIONS_CONTRACT = "Options carry only the real choices: each is within your rules, and a person could choose " + "it. Add no option that breaks your rules or that no one would choose. Each option has a " + "label, and its description says what that approach costs. A request for one act only the " + "person can do has the two options Done and Can't.";
|
|
14721
14721
|
var ASK_IS_FOR_A_PERSON = "An ask is a question for a person, never a request to another agent. Ask an agent by envoy_send or a comment on the issue.";
|
|
14722
14722
|
var ASK_WAITS_ON_THE_ASSIGNEE = "An ask waits on its asked-of person, else the issue's assignee, else the project's default assignee; no agent hands one on.";
|
|
14723
14723
|
var HUMAN_AGREED_TO_DOCUMENT = "the human has agreed to every point in the document";
|
|
@@ -15088,6 +15088,39 @@ var RESULT_RECORD_FIELDS = [
|
|
|
15088
15088
|
];
|
|
15089
15089
|
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.";
|
|
15090
15090
|
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.";
|
|
15091
|
+
var DEPLOY_REPO = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
|
|
15092
|
+
var DEPLOY_PROGRAM = /^[a-z0-9-]{1,64}$/;
|
|
15093
|
+
var DEPLOY_COMMIT = /^[0-9a-f]{40}$/;
|
|
15094
|
+
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)$/;
|
|
15095
|
+
function deployRepoProblem(value) {
|
|
15096
|
+
const input = value;
|
|
15097
|
+
return typeof input["repo"] !== "string" || !DEPLOY_REPO.test(input["repo"]) ? "repo must be owner/repo" : undefined;
|
|
15098
|
+
}
|
|
15099
|
+
function deployProblem(value) {
|
|
15100
|
+
const input = value;
|
|
15101
|
+
const repo = deployRepoProblem(input);
|
|
15102
|
+
if (repo !== undefined)
|
|
15103
|
+
return repo;
|
|
15104
|
+
if (typeof input["program"] !== "string" || !DEPLOY_PROGRAM.test(input["program"]))
|
|
15105
|
+
return "program must be 1 to 64 lowercase letters, digits or hyphens";
|
|
15106
|
+
if (typeof input["commit"] !== "string" || !DEPLOY_COMMIT.test(input["commit"]))
|
|
15107
|
+
return "commit must be 40 lowercase hexadecimal characters";
|
|
15108
|
+
if (input["deployed_at"] !== undefined) {
|
|
15109
|
+
const value = input["deployed_at"];
|
|
15110
|
+
if (typeof value !== "string")
|
|
15111
|
+
return "deployed_at must be RFC3339";
|
|
15112
|
+
const parts = DEPLOY_TIME.exec(value);
|
|
15113
|
+
const timestamp = Date.parse(value);
|
|
15114
|
+
if (parts === null || !Number.isFinite(timestamp))
|
|
15115
|
+
return "deployed_at must be RFC3339";
|
|
15116
|
+
const calendar = new Date(`${parts[1]}-${parts[2]}-${parts[3]}T00:00:00Z`);
|
|
15117
|
+
if (calendar.toISOString().slice(0, 10) !== value.slice(0, 10))
|
|
15118
|
+
return "deployed_at must be a valid calendar date";
|
|
15119
|
+
if (timestamp > Date.now() + 5 * 60 * 1000)
|
|
15120
|
+
return "deployed_at must not be more than five minutes in the future";
|
|
15121
|
+
}
|
|
15122
|
+
return;
|
|
15123
|
+
}
|
|
15091
15124
|
function resultProblem(value) {
|
|
15092
15125
|
const input = value;
|
|
15093
15126
|
const carried = RESULT_RECORD_FIELDS.filter((field) => input[field] !== undefined);
|
|
@@ -15269,7 +15302,7 @@ var dispatchToolSpecs = [
|
|
|
15269
15302
|
}
|
|
15270
15303
|
]
|
|
15271
15304
|
},
|
|
15272
|
-
description: `${ASK_IS_FOR_A_PERSON} ${ASK_WAITS_ON_THE_ASSIGNEE} ` + "Open a to-do or permission only a human can give, or a decision that has no document to " + "live in. A question about the design an issue's document records is not this tool: write " + "it into that document as a decision block (dispatch doc-edit inserting an ask block at the " + "end of the section it concerns), at every phase, approved spec or not; the block reaches " + "the Inbox and its answer lands next to its context. Never give an ask an Approve option: a " + "document is approved through dispatch request-approval. Do not use this tool for a status " + "update or discussion; use dispatch message instead. Never create an issue to park a " + "question: the question is an ask on the issue it concerns. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " For an action only a human can perform, state what it changes and risks as constraints. " + "Anything that requires a human to do, including a credential or grant renewal, is an ask, " + "never a message. Measure what you can first, and put the measurement and the size of the " + "population it covers in the question; drop an option that cannot fix most of that " + "population, never offer it cut down
|
|
15305
|
+
description: `${ASK_IS_FOR_A_PERSON} ${ASK_WAITS_ON_THE_ASSIGNEE} ` + "Open a to-do or permission only a human can give, or a decision that has no document to " + "live in. Ask for a decision only when two or more choices are real. Where only one is " + "real, make it, and tell the person what you did and why. A question about the design an " + "issue's document records is not this tool: write " + "it into that document as a decision block (dispatch doc-edit inserting an ask block at the " + "end of the section it concerns), at every phase, approved spec or not; the block reaches " + "the Inbox and its answer lands next to its context. Never give an ask an Approve option: a " + "document is approved through dispatch request-approval. Do not use this tool for a status " + "update or discussion; use dispatch message instead. Never create an issue to park a " + "question: the question is an ask on the issue it concerns. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " For an action only a human can perform, state what it changes and risks as constraints, " + "and a safer alternative as a fact, never as an option. " + "Anything that requires a human to do, including a credential or grant renewal, is an ask, " + "never a message. Measure what you can first, and put the measurement and the size of the " + "population it covers in the question; drop an option that cannot fix most of that " + "population, and never offer it cut down. Offer an option not to act (Hold) only where not " + "acting is a real choice and the question names its cost. Set urgency high " + "when your work halts on the answer, and keep working on everything else. " + "Anchor a to-do about a document passage, thread reply_to/reply_to_ask, or cite a dispatch:// " + `reference \u2014 it must be answerable from its own text and anchor alone, never "see above". ` + `A quote anchor is pinned to its block. ${ASK_BOUND_RULE} The lines images appends count ` + `toward that bound, and an ask has at most 8 options. ${RELATED_CHECK_RESULT} ` + `An ask among the related items says whether it is answered, by whom and with which options. ${OWNER_REFERENCE}`,
|
|
15273
15306
|
arguments: (z) => ({
|
|
15274
15307
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
15275
15308
|
project: z.string().describe("Project key owning the document.").optional(),
|
|
@@ -15589,14 +15622,51 @@ var dispatchToolSpecs = [
|
|
|
15589
15622
|
refusal: (value) => resultProblem(value) ?? RESULT_SHAPE_RULE
|
|
15590
15623
|
}
|
|
15591
15624
|
},
|
|
15625
|
+
{
|
|
15626
|
+
name: "dispatch_deploy",
|
|
15627
|
+
example: {
|
|
15628
|
+
repo: "acme/widgets",
|
|
15629
|
+
program: "worker",
|
|
15630
|
+
commit: "1111111111111111111111111111111111111111"
|
|
15631
|
+
},
|
|
15632
|
+
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.",
|
|
15633
|
+
arguments: (z) => ({
|
|
15634
|
+
repo: z.string().describe("The deployed repository, owner/repo."),
|
|
15635
|
+
program: z.string().describe("The deployed program, 1 to 64 lowercase letters, digits or hyphens."),
|
|
15636
|
+
commit: z.string().describe("The deployed build, 40 lowercase hexadecimal characters."),
|
|
15637
|
+
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(),
|
|
15638
|
+
url: z.string().describe("The deployment's URL, if it has one.").optional(),
|
|
15639
|
+
json: z.boolean().describe("Print the complete wire answer as JSON.").optional()
|
|
15640
|
+
}),
|
|
15641
|
+
validation: {
|
|
15642
|
+
check: (value) => deployProblem(value) === undefined,
|
|
15643
|
+
message: "Name repo, program and commit.",
|
|
15644
|
+
refusal: (value) => deployProblem(value) ?? "Name repo, program and commit."
|
|
15645
|
+
}
|
|
15646
|
+
},
|
|
15647
|
+
{
|
|
15648
|
+
name: "dispatch_deploys",
|
|
15649
|
+
example: { repo: "acme/widgets" },
|
|
15650
|
+
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.",
|
|
15651
|
+
arguments: (z) => ({
|
|
15652
|
+
repo: z.string().describe("The deployed repository, owner/repo."),
|
|
15653
|
+
json: z.boolean().describe("Print the complete wire answer as JSON.").optional()
|
|
15654
|
+
}),
|
|
15655
|
+
validation: {
|
|
15656
|
+
check: (value) => deployRepoProblem(value) === undefined,
|
|
15657
|
+
message: "repo must be owner/repo",
|
|
15658
|
+
refusal: (value) => deployRepoProblem(value) ?? "repo must be owner/repo"
|
|
15659
|
+
}
|
|
15660
|
+
},
|
|
15592
15661
|
{
|
|
15593
15662
|
name: "dispatch_results",
|
|
15594
15663
|
example: { issue: "DSP-1" },
|
|
15595
|
-
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
|
|
15664
|
+
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,
|
|
15596
15665
|
arguments: (z) => ({
|
|
15597
15666
|
issue: z.string().describe(ISSUE_REFERENCE),
|
|
15598
|
-
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
|
|
15599
|
-
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()
|
|
15667
|
+
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(),
|
|
15668
|
+
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(),
|
|
15669
|
+
json: z.boolean().describe("Print the complete results wire answer as JSON.").optional()
|
|
15600
15670
|
})
|
|
15601
15671
|
},
|
|
15602
15672
|
{
|
|
@@ -15938,6 +16008,13 @@ var IssueDeployedEventPayloadSchema = strictObject({
|
|
|
15938
16008
|
run_id: number2().int().positive(),
|
|
15939
16009
|
completed_at: exports_iso.datetime()
|
|
15940
16010
|
});
|
|
16011
|
+
var DeployRecordedEventPayloadSchema = strictObject({
|
|
16012
|
+
repo: string2(),
|
|
16013
|
+
program: string2(),
|
|
16014
|
+
commit: string2(),
|
|
16015
|
+
deployed_at: string2(),
|
|
16016
|
+
source: _enum2(["delivery_run", "route"])
|
|
16017
|
+
});
|
|
15941
16018
|
var childStatusEventPayloadFields = {
|
|
15942
16019
|
child_key: string2(),
|
|
15943
16020
|
from: string2(),
|
|
@@ -16324,6 +16401,7 @@ var EVENT_TYPE_MEMBERS = {
|
|
|
16324
16401
|
"comment.reopened": true,
|
|
16325
16402
|
"comment.resolved": true,
|
|
16326
16403
|
"decision.kept": true,
|
|
16404
|
+
"deploy.recorded": true,
|
|
16327
16405
|
"handoff.recorded": true,
|
|
16328
16406
|
"issue.claimed": true,
|
|
16329
16407
|
"issue.closed": true,
|
|
@@ -25326,6 +25404,12 @@ class DispatchClient {
|
|
|
25326
25404
|
async issueResults(issue, at) {
|
|
25327
25405
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "results"], undefined, at === undefined ? undefined : { at });
|
|
25328
25406
|
}
|
|
25407
|
+
async recordDeploy(input) {
|
|
25408
|
+
return this.#json("POST", ["api", "v1", "deploys"], input);
|
|
25409
|
+
}
|
|
25410
|
+
async deploys(repo) {
|
|
25411
|
+
return this.#json("GET", ["api", "v1", "deploys"], undefined, { repo });
|
|
25412
|
+
}
|
|
25329
25413
|
async retractResult(resultID, input) {
|
|
25330
25414
|
return this.#json("POST", ["api", "v1", "results", resultID, "retract"], input);
|
|
25331
25415
|
}
|
|
@@ -26231,6 +26315,7 @@ var WRITE_ROUTES = [
|
|
|
26231
26315
|
{ method: "POST", pattern: "/api/v1/issues/{key}/results", commands: ["result"] },
|
|
26232
26316
|
{ method: "POST", pattern: "/api/v1/issues/{key}/results/dry-run", commands: ["result"] },
|
|
26233
26317
|
{ method: "POST", pattern: "/api/v1/results/{id}/retract", commands: ["result"] },
|
|
26318
|
+
{ method: "POST", pattern: "/api/v1/deploys", commands: ["deploy"] },
|
|
26234
26319
|
{ method: "POST", pattern: "/api/v1/issues/{key}/handoffs/{phase}", commands: ["handoff-write"] },
|
|
26235
26320
|
{ method: "POST", pattern: "/api/v1/issues/{key}/artifacts", commands: ["artifact"] },
|
|
26236
26321
|
{ method: "POST", pattern: "/api/v1/projects/{key}/artifacts", commands: ["artifact"] },
|
|
@@ -28901,20 +28986,18 @@ function tradeProjects(env) {
|
|
|
28901
28986
|
}
|
|
28902
28987
|
return sorted;
|
|
28903
28988
|
}
|
|
28989
|
+
var ROLE_KEY_NAMED = `this role's agent-secrets key in the directory ${KEY_DIR_VAR} names`;
|
|
28904
28990
|
async function machineKey(env) {
|
|
28905
28991
|
const dir = value(env, KEY_DIR_VAR);
|
|
28906
28992
|
if (value(env, IDENTITY_VAR) !== IDENTITY_KUBERNETES || dir === "")
|
|
28907
28993
|
return await newDpopKey();
|
|
28908
|
-
const path = join7(dir, ROLE_KEY_FILE);
|
|
28909
28994
|
let pem;
|
|
28910
28995
|
try {
|
|
28911
|
-
pem = await readFile6(
|
|
28996
|
+
pem = await readFile6(join7(dir, ROLE_KEY_FILE), "utf8");
|
|
28912
28997
|
} catch (error) {
|
|
28913
|
-
throw new Error(`read
|
|
28914
|
-
cause: error
|
|
28915
|
-
});
|
|
28998
|
+
throw new Error(`read ${ROLE_KEY_NAMED}: ${readErrorCode(error)}`);
|
|
28916
28999
|
}
|
|
28917
|
-
return await importDpopKey(pem,
|
|
29000
|
+
return await importDpopKey(pem, ROLE_KEY_NAMED);
|
|
28918
29001
|
}
|
|
28919
29002
|
async function brokerTokenClient(env, own = "", read) {
|
|
28920
29003
|
const brokerUrl = value(env, BROKER_URL_VAR);
|
|
@@ -34110,6 +34193,8 @@ var issueFreeTools = {
|
|
|
34110
34193
|
dispatch_limits: true,
|
|
34111
34194
|
dispatch_api: true,
|
|
34112
34195
|
dispatch_inbox: true,
|
|
34196
|
+
dispatch_deploy: true,
|
|
34197
|
+
dispatch_deploys: true,
|
|
34113
34198
|
dispatch_send_to_agent: true,
|
|
34114
34199
|
dispatch_architecture_sync: true
|
|
34115
34200
|
};
|
|
@@ -35102,7 +35187,8 @@ var BRIEF_READING_CHARACTERS = 200;
|
|
|
35102
35187
|
var COMPARISON_REASONS = {
|
|
35103
35188
|
no_pull_request_or_branch: () => "the issue has no pull request and no branch to compare with",
|
|
35104
35189
|
repository_unreadable: (repo = "the repository") => `Dispatch cannot read ${repo}`,
|
|
35105
|
-
read_failed: (repo) => repo === undefined ? "a read Dispatch made did not answer" : `a read Dispatch made of ${repo} did not answer
|
|
35190
|
+
read_failed: (repo) => repo === undefined ? "a read Dispatch made did not answer" : `a read Dispatch made of ${repo} did not answer`,
|
|
35191
|
+
not_merged: () => "the work has no merge that Dispatch knows"
|
|
35106
35192
|
};
|
|
35107
35193
|
function isComparisonReason(reason) {
|
|
35108
35194
|
return Object.hasOwn(COMPARISON_REASONS, reason);
|
|
@@ -35130,8 +35216,13 @@ function basisText(basis) {
|
|
|
35130
35216
|
const pullRequest = basis.pull_request === undefined ? "pull request " : `${pullRequestName(basis, basis.pull_request)} `;
|
|
35131
35217
|
return `the head of ${pullRequest}at ${basis.commit ?? "an unnamed commit"}${learned}`;
|
|
35132
35218
|
}
|
|
35133
|
-
if (basis.kind === "branch")
|
|
35134
|
-
|
|
35219
|
+
if (basis.kind === "branch") {
|
|
35220
|
+
if (basis.merge_commit === undefined)
|
|
35221
|
+
return `branch ${branchName(basis)}${learned}`;
|
|
35222
|
+
const repository = basis.repo === undefined ? "" : `in ${basis.repo} `;
|
|
35223
|
+
const merged = basis.merge_commit === undefined ? "" : `, merged at ${basis.merge_commit}`;
|
|
35224
|
+
return `${repository}branch ${basis.branch ?? "unnamed"}${merged}${learned}`;
|
|
35225
|
+
}
|
|
35135
35226
|
return `the commit you named, ${basis.commit ?? ""}${learned}`;
|
|
35136
35227
|
}
|
|
35137
35228
|
function basisPlace(basis) {
|
|
@@ -35164,9 +35255,53 @@ function checkWordsText(check, result) {
|
|
|
35164
35255
|
}
|
|
35165
35256
|
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})`;
|
|
35166
35257
|
}
|
|
35167
|
-
function passStandsText(pass) {
|
|
35258
|
+
function passStandsText(pass, check, repository) {
|
|
35168
35259
|
if (pass === undefined)
|
|
35169
35260
|
return "Whether a pass stands is not known: this Dispatch server does not say";
|
|
35261
|
+
const branch = check !== undefined && (check.when === "after_merge" || check.when === "default_branch") && !(check.compared_with ?? []).some((basis) => basis.kind === "named");
|
|
35262
|
+
if (branch && check !== undefined) {
|
|
35263
|
+
const results = check.results ?? [];
|
|
35264
|
+
const deciding = pass.results ?? [];
|
|
35265
|
+
const passed = results.find((result) => result.verdict === "pass" && deciding.includes(result.id));
|
|
35266
|
+
const failed = results.find((result) => result.verdict === "fail" && deciding.includes(result.id));
|
|
35267
|
+
const result = results.find((result) => deciding.includes(result.id));
|
|
35268
|
+
const repo = repository ?? check.compared_with?.[0]?.repo ?? "the repository";
|
|
35269
|
+
const deploy = pass.deploy;
|
|
35270
|
+
const program = deploy?.program ?? check.program ?? "the program";
|
|
35271
|
+
const roles = (pass.roles ?? []).join(", ");
|
|
35272
|
+
if (pass.answer === "yes" && passed !== undefined)
|
|
35273
|
+
return `A pass stands: yes, from ${roles}, as the newest result is pass ${passed.id} at ${pass.commit ?? passed.commit_sha}`;
|
|
35274
|
+
switch (pass.reason) {
|
|
35275
|
+
case "fail":
|
|
35276
|
+
if (failed !== undefined)
|
|
35277
|
+
return `A pass stands: no, as the newest result is fail ${failed.id} at ${pass.commit ?? failed.commit_sha}`;
|
|
35278
|
+
break;
|
|
35279
|
+
case "no_result":
|
|
35280
|
+
return "A pass stands: no, as no result counts at a commit that holds the merge";
|
|
35281
|
+
case "pass_and_fail":
|
|
35282
|
+
if (passed !== undefined && failed !== undefined)
|
|
35283
|
+
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`;
|
|
35284
|
+
break;
|
|
35285
|
+
case "not_placed":
|
|
35286
|
+
if (result !== undefined)
|
|
35287
|
+
return `A pass stands: not known, as Dispatch could not place ${result.verdict} ${result.id} at ${pass.commit ?? result.commit_sha}`;
|
|
35288
|
+
break;
|
|
35289
|
+
case "read_failed":
|
|
35290
|
+
return "A pass stands: not known, as a read Dispatch made did not answer";
|
|
35291
|
+
case "program_not_named":
|
|
35292
|
+
return `A pass stands: not known, as ${repo} runs more than one program and this check names none`;
|
|
35293
|
+
case "no_deploy":
|
|
35294
|
+
return `A pass stands: not known, as Dispatch holds no deploy of ${program} in ${repo}`;
|
|
35295
|
+
case "deploy_not_merged":
|
|
35296
|
+
if (deploy !== undefined)
|
|
35297
|
+
return `A pass stands: not known, as ${program} runs ${deploy.commit} since ${deploy.deployed_at}, which does not hold the merge`;
|
|
35298
|
+
break;
|
|
35299
|
+
case "no_result_from_deploy":
|
|
35300
|
+
if (deploy !== undefined)
|
|
35301
|
+
return `A pass stands: not known, as no result counts for ${program} at ${deploy.commit}, deployed ${deploy.deployed_at}`;
|
|
35302
|
+
break;
|
|
35303
|
+
}
|
|
35304
|
+
}
|
|
35170
35305
|
if (pass.answer === "yes") {
|
|
35171
35306
|
const roles = pass.roles ?? [];
|
|
35172
35307
|
return roles.length === 0 ? "A pass stands: yes" : `A pass stands: yes, from ${roles.join(", ")}`;
|
|
@@ -35195,6 +35330,8 @@ function resultLines(check, result, brief) {
|
|
|
35195
35330
|
if (retracted !== undefined) {
|
|
35196
35331
|
lines.push(` Retracted by ${actorText(retracted.actor)} at ${retracted.created_at}. The reason: ${retracted.reason}`);
|
|
35197
35332
|
}
|
|
35333
|
+
if (result.not_counted !== undefined && result.not_counted !== "")
|
|
35334
|
+
lines.push(` It counts for nothing: ${result.not_counted}.`);
|
|
35198
35335
|
return [...lines, ...readingLines(result, brief)];
|
|
35199
35336
|
}
|
|
35200
35337
|
function ciCheckLines(check, ci, brief) {
|
|
@@ -35216,7 +35353,7 @@ function ciCheckLines(check, ci, brief) {
|
|
|
35216
35353
|
...readingLines(derived, brief, " ")
|
|
35217
35354
|
];
|
|
35218
35355
|
}
|
|
35219
|
-
function checkLines(check, brief) {
|
|
35356
|
+
function checkLines(check, brief, repository) {
|
|
35220
35357
|
if (check.ci !== undefined)
|
|
35221
35358
|
return ciCheckLines(check, check.ci, brief);
|
|
35222
35359
|
const bases = check.compared_with ?? [];
|
|
@@ -35224,12 +35361,15 @@ function checkLines(check, brief) {
|
|
|
35224
35361
|
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)}`;
|
|
35225
35362
|
const results = check.results ?? [];
|
|
35226
35363
|
return [
|
|
35227
|
-
`- ${check.block_id} (${check.when}). ${compared}. ${passStandsText(check.pass_stands)}.`,
|
|
35364
|
+
`- ${check.block_id} (${check.when}). ${compared}. ${passStandsText(check.pass_stands, check, repository)}.`,
|
|
35365
|
+
...check.pass_stands?.deploy === undefined ? [] : [
|
|
35366
|
+
` 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.`
|
|
35367
|
+
],
|
|
35228
35368
|
` The check's words: ${check.text}`,
|
|
35229
35369
|
...results.length === 0 ? [" No result is recorded for this check."] : results.flatMap((result) => resultLines(check, result, brief))
|
|
35230
35370
|
];
|
|
35231
35371
|
}
|
|
35232
|
-
function formatCheckResults(results, brief = false) {
|
|
35372
|
+
function formatCheckResults(results, brief = false, repositories) {
|
|
35233
35373
|
if (results.verification_artifact_id === "") {
|
|
35234
35374
|
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.`;
|
|
35235
35375
|
}
|
|
@@ -35237,7 +35377,7 @@ function formatCheckResults(results, brief = false) {
|
|
|
35237
35377
|
if (checks.length === 0) {
|
|
35238
35378
|
return `${results.issue}'s Verification document holds no check blocks.`;
|
|
35239
35379
|
}
|
|
35240
|
-
const blocks = checks.map((check) => checkLines(check, brief).join(`
|
|
35380
|
+
const blocks = checks.map((check) => checkLines(check, brief, repositories?.[check.issue_key]).join(`
|
|
35241
35381
|
`));
|
|
35242
35382
|
return [`Checks of ${results.issue}:`, ...blocks].join(`
|
|
35243
35383
|
|
|
@@ -35973,8 +36113,15 @@ async function resultsCommand(context) {
|
|
|
35973
36113
|
const brief = optionalBoolean(args, "brief") === true;
|
|
35974
36114
|
const results = await client.issueResults(issue, at);
|
|
35975
36115
|
const checks = results.checks ?? [];
|
|
36116
|
+
const repositories = {};
|
|
36117
|
+
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));
|
|
36118
|
+
await Promise.all([...owners].map(async (owner) => {
|
|
36119
|
+
const issue = await client.getIssue(owner);
|
|
36120
|
+
if (issue.resolved_repo != null)
|
|
36121
|
+
repositories[owner] = issue.resolved_repo;
|
|
36122
|
+
}));
|
|
35976
36123
|
return {
|
|
35977
|
-
text: formatCheckResults(results, brief),
|
|
36124
|
+
text: formatCheckResults(results, brief, repositories),
|
|
35978
36125
|
details: {
|
|
35979
36126
|
issue,
|
|
35980
36127
|
checks: checks.length,
|
|
@@ -37269,6 +37416,37 @@ async function sendToAgentCommand(context) {
|
|
|
37269
37416
|
};
|
|
37270
37417
|
}
|
|
37271
37418
|
|
|
37419
|
+
// ../envoy-client/src/dispatch-commands/deploy.ts
|
|
37420
|
+
function deployText(deploy) {
|
|
37421
|
+
const link = deploy.url === "" ? "" : ` ${deploy.url}`;
|
|
37422
|
+
return `${deploy.program}: ${deploy.commit} since ${deploy.deployed_at} (source: ${deploy.source}, recorded by ${actorText(deploy.recorded_by)}).${link}`;
|
|
37423
|
+
}
|
|
37424
|
+
async function deployCommand(context) {
|
|
37425
|
+
const { args, client } = context;
|
|
37426
|
+
const input = {
|
|
37427
|
+
repo: stringArg(args, "repo"),
|
|
37428
|
+
program: stringArg(args, "program"),
|
|
37429
|
+
commit: stringArg(args, "commit"),
|
|
37430
|
+
...defined("deployed_at", optionalString(args, "deployed_at")),
|
|
37431
|
+
...defined("url", optionalString(args, "url"))
|
|
37432
|
+
};
|
|
37433
|
+
const result = await client.recordDeploy(input);
|
|
37434
|
+
return {
|
|
37435
|
+
text: optionalBoolean(args, "json") === true ? JSON.stringify(result, null, 2) : deployText(result.deploy),
|
|
37436
|
+
details: { repo: input.repo, deploy: result.deploy }
|
|
37437
|
+
};
|
|
37438
|
+
}
|
|
37439
|
+
async function deploysCommand(context) {
|
|
37440
|
+
const { args, client } = context;
|
|
37441
|
+
const result = await client.deploys(stringArg(args, "repo"));
|
|
37442
|
+
const deploys = result.deploys ?? [];
|
|
37443
|
+
return {
|
|
37444
|
+
text: optionalBoolean(args, "json") === true ? JSON.stringify(result, null, 2) : deploys.length === 0 ? `Dispatch holds no deploys for ${result.repo}.` : deploys.map(deployText).join(`
|
|
37445
|
+
`),
|
|
37446
|
+
details: { repo: result.repo, deploys }
|
|
37447
|
+
};
|
|
37448
|
+
}
|
|
37449
|
+
|
|
37272
37450
|
// ../envoy-client/src/dispatch-commands/documents.ts
|
|
37273
37451
|
import { resolve as resolvePath3 } from "path";
|
|
37274
37452
|
|
|
@@ -38969,6 +39147,8 @@ var dispatchCommands = {
|
|
|
38969
39147
|
dispatch_review: acting(reviewCommand),
|
|
38970
39148
|
dispatch_result: acting(resultCommand),
|
|
38971
39149
|
dispatch_results: acting(resultsCommand),
|
|
39150
|
+
dispatch_deploy: acting(deployCommand),
|
|
39151
|
+
dispatch_deploys: acting(deploysCommand),
|
|
38972
39152
|
dispatch_artifact: {
|
|
38973
39153
|
...acting(artifactCommand),
|
|
38974
39154
|
dryRun: artifactDryRun,
|