@sjawhar/claude-envoy 6.19.0 → 6.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/dist/codex-hook.js +813 -172
- package/dist/dispatch.js +1866 -1132
- package/dist/envoy-channel.js +822 -172
- package/dist/session-hook.js +813 -172
- package/legion/skills/legion-architect/references/plan-changes.md +9 -0
- package/legion/skills/legion-architect/references/plan.md +3 -2
- package/legion/skills/legion-worker/SKILL.md +3 -6
- package/legion/skills/legion-worker/references/gh-and-credentials.md +9 -0
- package/package.json +2 -2
package/dist/envoy-channel.js
CHANGED
|
@@ -36690,6 +36690,12 @@ var IDEMPOTENCY_KEY_REUSED = "KEY_REUSED";
|
|
|
36690
36690
|
var IDEMPOTENCY_KEY_IN_FLIGHT = "KEY_IN_FLIGHT";
|
|
36691
36691
|
var IDEMPOTENCY_KEY_COMMITTED = "KEY_COMMITTED";
|
|
36692
36692
|
var IDEMPOTENCY_ANSWER_NOT_KEPT = "ANSWER_NOT_KEPT";
|
|
36693
|
+
var SPEC_CHECK_OBSERVED_MAX = 2000;
|
|
36694
|
+
var SPEC_CHECK_OBSERVED_CUT_NOTE = `
|
|
36695
|
+
[The middle of the text is cut here. A result keeps ${SPEC_CHECK_OBSERVED_MAX} characters of what the job observed: its start and its end.]
|
|
36696
|
+
`;
|
|
36697
|
+
var SPEC_CHECK_OBSERVED_START = 500;
|
|
36698
|
+
var SPEC_CHECK_OBSERVED_END = SPEC_CHECK_OBSERVED_MAX - SPEC_CHECK_OBSERVED_START - [...SPEC_CHECK_OBSERVED_CUT_NOTE].length;
|
|
36693
36699
|
function retriesUnderKey(status, code) {
|
|
36694
36700
|
return outage(status) || status === 409 && code === IDEMPOTENCY_KEY_IN_FLIGHT;
|
|
36695
36701
|
}
|
|
@@ -37291,8 +37297,16 @@ var RESULT_RECORD_FIELDS = [
|
|
|
37291
37297
|
"excluded",
|
|
37292
37298
|
"screenshots"
|
|
37293
37299
|
];
|
|
37300
|
+
var RESULT_PROJECT_FIELDS = ["check", "verdict", "commit", "observed"];
|
|
37301
|
+
var RESULT_PROJECT_REQUIRED = ["check", "verdict", "commit"];
|
|
37294
37302
|
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.";
|
|
37295
|
-
var
|
|
37303
|
+
var RESULT_PROJECT_RULE = "With project, the call records a CI job's result of a check of the spec files. It takes " + "project, check, verdict, commit and observed, and no other argument.";
|
|
37304
|
+
var RESULT_NOT_PROJECT_FIELDS = [
|
|
37305
|
+
...RESULT_RECORD_FIELDS.filter((field) => !RESULT_PROJECT_FIELDS.includes(field)),
|
|
37306
|
+
"retract",
|
|
37307
|
+
"reason"
|
|
37308
|
+
];
|
|
37309
|
+
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. " + RESULT_PROJECT_RULE;
|
|
37296
37310
|
var DEPLOY_REPO = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
|
|
37297
37311
|
var DEPLOY_PROGRAM = /^[a-z0-9-]{1,64}$/;
|
|
37298
37312
|
var DEPLOY_COMMIT = /^[0-9a-f]{40}$/;
|
|
@@ -37328,6 +37342,20 @@ function deployProblem(value) {
|
|
|
37328
37342
|
}
|
|
37329
37343
|
function resultProblem(value) {
|
|
37330
37344
|
const input = value;
|
|
37345
|
+
if (input["project"] !== undefined) {
|
|
37346
|
+
const others = RESULT_NOT_PROJECT_FIELDS.filter((field) => input[field] !== undefined);
|
|
37347
|
+
if (others.length > 0) {
|
|
37348
|
+
return `${RESULT_PROJECT_RULE} This call also carries ${others.join(", ")}.`;
|
|
37349
|
+
}
|
|
37350
|
+
const missing = RESULT_PROJECT_REQUIRED.filter((field) => input[field] === undefined);
|
|
37351
|
+
if (missing.length > 0) {
|
|
37352
|
+
return `a CI job's result needs ${missing.join(", ")}. ${RESULT_PROJECT_RULE}`;
|
|
37353
|
+
}
|
|
37354
|
+
return;
|
|
37355
|
+
}
|
|
37356
|
+
if (input["verdict"] === "could_not_run") {
|
|
37357
|
+
return "verdict could_not_run goes with project alone: a role's result of a check of a Verification document is pass or fail.";
|
|
37358
|
+
}
|
|
37331
37359
|
const carried = RESULT_RECORD_FIELDS.filter((field) => input[field] !== undefined);
|
|
37332
37360
|
if (typeof input.retract === "string") {
|
|
37333
37361
|
const reason = input.reason;
|
|
@@ -37348,6 +37376,25 @@ function resultProblem(value) {
|
|
|
37348
37376
|
}
|
|
37349
37377
|
return;
|
|
37350
37378
|
}
|
|
37379
|
+
var RESULTS_OWNER_RULE = "Exactly one of issue and project is required. With issue, the read prints the checks of the " + "issue's Verification document. With project, it prints the results that CI jobs stored for " + "checks of the spec files at commit.";
|
|
37380
|
+
function resultsProblem(value) {
|
|
37381
|
+
const input = value;
|
|
37382
|
+
if (input["issue"] === undefined === (input["project"] === undefined)) {
|
|
37383
|
+
return RESULTS_OWNER_RULE;
|
|
37384
|
+
}
|
|
37385
|
+
if (input["project"] !== undefined) {
|
|
37386
|
+
const issueOnly = ["at", "brief"].filter((field) => input[field] !== undefined);
|
|
37387
|
+
if (issueOnly.length > 0) {
|
|
37388
|
+
return `With project, the read takes commit, check and json alone, and this call also carries ${issueOnly.join(", ")}.`;
|
|
37389
|
+
}
|
|
37390
|
+
if (input["commit"] === undefined) {
|
|
37391
|
+
return "With project, the read needs commit, the 40-character lowercase hex commit whose results it prints.";
|
|
37392
|
+
}
|
|
37393
|
+
return;
|
|
37394
|
+
}
|
|
37395
|
+
const projectOnly = ["commit", "check", "json"].filter((field) => input[field] !== undefined);
|
|
37396
|
+
return projectOnly.length === 0 ? undefined : `With issue, the read takes at and brief alone, and this call also carries ${projectOnly.join(", ")}.`;
|
|
37397
|
+
}
|
|
37351
37398
|
var SEARCH_QUERY_MAX = 1000;
|
|
37352
37399
|
var SEARCH_QUERY_HINT = "search with a short phrase of a few words, not a passage";
|
|
37353
37400
|
var SEARCH_KIND_DEPTH = 100;
|
|
@@ -37803,12 +37850,13 @@ var dispatchToolSpecs = [
|
|
|
37803
37850
|
verdict: "pass",
|
|
37804
37851
|
commit: "1111111111111111111111111111111111111111"
|
|
37805
37852
|
},
|
|
37806
|
-
description: "Record one result of one check of an issue's Verification document, or retract a result " + "recorded before. A record prints the pull-request body line it implies. Write that line " + "into the pull-request body unchanged: it is the one grammar every writer uses, and it " + "carries no link to Dispatch, no private host and no issue key: Dispatch keeps only words " + "of letters, digits and plain punctuation, and of those leaves out every word that holds " + "`://`, a private or Dispatch host, or an issue key of one of its projects; the record keeps " + "the whole reading. --dry-run prints the line the record would print, and records nothing. " + "Name the check by its block id. Where two Verification documents in reach hold that id, " + "name it by its canonical reference (dispatch://KEY/artifact/verification-md#b-<id>). " + "409 CHECK_AMBIGUOUS names both documents. An id no Verification document of the issue " + "or of an issue above it holds is 400 UNKNOWN_CHECK. " + `${CHECK_PROVED_BY_CI}. ` + "Dispatch reads its result from that run, so a record for it is 409 " + "CHECK_PROVED_BY_CI from every role, which names the check and the run. " + "A pass that counts a failed, a skipped or an excluded case contradicts itself, and is " + "400 RESULT_CONTRADICTS. " + "Dispatch asks GitHub whether the repository of the check's issue holds the commit. If " + "GitHub does not say that it does, Dispatch reads the external links of the check's issue: " + "a link to a GitHub pull request (https://github.com/<owner>/<repo>/pull/<n>) that is open " + "or merged, in a repository that Dispatch's GitHub App is installed on and can read, adds " + "the repository of that pull request. One record reads at most 10 linked pull requests. A " + "commit that none of these repositories holds is 400 RESULT_COMMIT_UNKNOWN, which names the " + "commit and each owner/repo that Dispatch asked. It also names, with its reason " + "(owner/repo#n (repository_unreadable)), each linked pull request that Dispatch could not " + "read, at most 10 and a count of the rest, and every linked pull request in whose " + "repository it could not read the commit, since each of those spent one of the record's 10 " + "reads, and says to grant Dispatch's GitHub App that repository or to link a readable pull " + "request. It says how many linked pull requests it left unread past that bound. Record the " + "result after the commit is pushed. A linked repository that the App is not installed on " + "or cannot read does " + "not count. Where a read of " + "a linked pull request or of a linked repository does not answer, and no repository is shown " + "to hold the commit, the record is 502 GITHUB_UNREADABLE and nothing is recorded: record the " + "result again, after the wait the refusal names for a rate limit. Where the issue has no " + "repository, the result is recorded as before. Where Dispatch cannot read the repository " + "of the check's issue, the result is recorded as before only when every linked read " + "answers and no linked repository holds the commit: a linked read that does not answer " + "is 502 GITHUB_UNREADABLE and nothing is recorded. " + "The result is recorded against the check's own issue, so a child's run of a parent's " + "check appears under that check. A closed issue takes a result only for a check whose " + "when is after_merge or default_branch, the production check after the merge. It refuses " + "every other record with 409 ISSUE_CLOSED. " + "A check a document version rewords while the result is being written is 409 " + "CHECK_CONTENDED, with nothing recorded: run the same command again. " + RESULT_RETRACT_RULE + " The retraction keeps both records: the result stays readable, and it proves nothing " + "from then on. Record a new result where the check still needs one. A retraction is " + "taken on a closed issue and for a check of any when. Three callers may retract: the " + "session that recorded the result, a session that holds the Dispatch claim of the issue " + "the result was recorded on, and a caller whose credential carries a person. Every other " + "caller is 403 RETRACTION_FORBIDDEN. A result retracted already is 409 RESULT_RETRACTED. " + ISSUE_REFERENCE,
|
|
37853
|
+
description: "Record one result of one check of an issue's Verification document, or retract a result " + "recorded before. A record prints the pull-request body line it implies. Write that line " + "into the pull-request body unchanged: it is the one grammar every writer uses, and it " + "carries no link to Dispatch, no private host and no issue key: Dispatch keeps only words " + "of letters, digits and plain punctuation, and of those leaves out every word that holds " + "`://`, a private or Dispatch host, or an issue key of one of its projects; the record keeps " + "the whole reading. --dry-run prints the line the record would print, and records nothing. " + "Name the check by its block id. Where two Verification documents in reach hold that id, " + "name it by its canonical reference (dispatch://KEY/artifact/verification-md#b-<id>). " + "409 CHECK_AMBIGUOUS names both documents. An id no Verification document of the issue " + "or of an issue above it holds is 400 UNKNOWN_CHECK. " + `${CHECK_PROVED_BY_CI}. ` + "Dispatch reads its result from that run, so a record for it is 409 " + "CHECK_PROVED_BY_CI from every role, which names the check and the run. " + "A pass that counts a failed, a skipped or an excluded case contradicts itself, and is " + "400 RESULT_CONTRADICTS. " + "Dispatch asks GitHub whether the repository of the check's issue holds the commit. If " + "GitHub does not say that it does, Dispatch reads the external links of the check's issue: " + "a link to a GitHub pull request (https://github.com/<owner>/<repo>/pull/<n>) that is open " + "or merged, in a repository that Dispatch's GitHub App is installed on and can read, adds " + "the repository of that pull request. One record reads at most 10 linked pull requests. A " + "commit that none of these repositories holds is 400 RESULT_COMMIT_UNKNOWN, which names the " + "commit and each owner/repo that Dispatch asked. It also names, with its reason " + "(owner/repo#n (repository_unreadable)), each linked pull request that Dispatch could not " + "read, at most 10 and a count of the rest, and every linked pull request in whose " + "repository it could not read the commit, since each of those spent one of the record's 10 " + "reads, and says to grant Dispatch's GitHub App that repository or to link a readable pull " + "request. It says how many linked pull requests it left unread past that bound. Record the " + "result after the commit is pushed. A linked repository that the App is not installed on " + "or cannot read does " + "not count. Where a read of " + "a linked pull request or of a linked repository does not answer, and no repository is shown " + "to hold the commit, the record is 502 GITHUB_UNREADABLE and nothing is recorded: record the " + "result again, after the wait the refusal names for a rate limit. Where the issue has no " + "repository, the result is recorded as before. Where Dispatch cannot read the repository " + "of the check's issue, the result is recorded as before only when every linked read " + "answers and no linked repository holds the commit: a linked read that does not answer " + "is 502 GITHUB_UNREADABLE and nothing is recorded. " + "The result is recorded against the check's own issue, so a child's run of a parent's " + "check appears under that check. A closed issue takes a result only for a check whose " + "when is after_merge or default_branch, the production check after the merge. It refuses " + "every other record with 409 ISSUE_CLOSED. " + "A check a document version rewords while the result is being written is 409 " + "CHECK_CONTENDED, with nothing recorded: run the same command again. " + RESULT_RETRACT_RULE + " The retraction keeps both records: the result stays readable, and it proves nothing " + "from then on. Record a new result where the check still needs one. A retraction is " + "taken on a closed issue and for a check of any when. Three callers may retract: the " + "session that recorded the result, a session that holds the Dispatch claim of the issue " + "the result was recorded on, and a caller whose credential carries a person. Every other " + "caller is 403 RETRACTION_FORBIDDEN. A result retracted already is 409 RESULT_RETRACTED. " + "With project, a CI job records its own result of one check of the spec files " + "(.dispatch/spec) at the commit it tested. The job runs the command under agent-secrets " + "result-grant, which gives it the secrets broker's proxy placeholder of its run as " + "DISPATCH_RESULTS_TOKEN; the command presents that placeholder alone and trades nothing, " + "and the airlock proxy puts the run's results token in its place. Dispatch refuses this form " + "from every other credential. The call sends commit, check, verdict and " + "observed. Dispatch takes the job, the procedure and the recorder from the token, from " + "GitHub and from the spec files at the commit. The recorder is the run, and no person. " + "Spec files that the graph logic refuses hold no check: 409 SPEC_FILES_REFUSED names the " + `first problem. A result keeps ${SPEC_CHECK_OBSERVED_MAX} characters of observed. The ` + "command sends a longer text as its start and its end, with a line between them that says " + "the middle was cut, and it sends a NUL as U+FFFD. verdict could_not_run is a test that did " + "not finish. The command prints the stored result as JSON, an in-toto statement of the " + "run. A write that reached Dispatch with no answer that says whether it stored the result " + 'prints {"write_outcome_unknown":"<code>"} and exits 1: the result may be stored, and a ' + "second run is safe, because Dispatch keeps each result. A tunnel the airlock proxy refuses " + "prints AIRLOCK_TUNNEL_REFUSED with its status, and an answer the proxy gives itself before " + "the write left it (Cipher-Proxy-Forwarded: false) prints its code and its words; each " + "says nothing reached Dispatch and exits 1, and a 5xx of either is asked again. An answer the " + "proxy gives itself after the write may have left it (Cipher-Proxy-Forwarded: unknown) is " + "asked again under the same key and, if no answer settles it, prints " + `{"write_outcome_unknown":"<code>"} and exits 1. A call that Dispatch's check of the ` + "run's token (429 " + "BROKER_TOKEN_RATE_LIMITED, 503 BROKER_UNAVAILABLE) turns away before anything " + "is stored is asked again after the answer's Retry-After, or a second. The whole call has " + "one bound, 60 s from its start, which every write runs under, and no round starts in its " + "last 7 s; a call turned away until then ends with the last answer, its code named, and " + "exits 1. It reads DISPATCH_URL and DISPATCH_RESULTS_TOKEN, and no broker variable. " + ISSUE_REFERENCE,
|
|
37807
37854
|
arguments: (z) => ({
|
|
37808
37855
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
37809
|
-
|
|
37856
|
+
project: z.string().describe("A project key such as ACME. With project, the call records a CI job's result of a check of the spec files.").optional(),
|
|
37857
|
+
check: z.string().describe("The check block's id, or its canonical reference dispatch://KEY/artifact/verification-md#b-<id> when the id is not unique among the issue's Verification document and those of the issues above it. With project, the check's id as the spec files hold it.").optional(),
|
|
37810
37858
|
role: z.string({ max: 32 }).describe("Who ran it: implementer, tester, reviewer. At most 32 characters of a-z and -, printed in the pull-request line.").optional(),
|
|
37811
|
-
verdict: z.enum(["pass", "fail"]).describe("Whether the check passed.").optional(),
|
|
37859
|
+
verdict: z.enum(["pass", "fail", "could_not_run"]).describe("Whether the check passed. could_not_run goes with project alone: the test did not finish.").optional(),
|
|
37812
37860
|
commit: z.string().describe("The 40-character lowercase hex commit the check ran at.").optional(),
|
|
37813
37861
|
surface: z.string().describe("Where a person reaches the change.").optional(),
|
|
37814
37862
|
run: z.string().describe("The command that proved it.").optional(),
|
|
@@ -37866,13 +37914,21 @@ var dispatchToolSpecs = [
|
|
|
37866
37914
|
{
|
|
37867
37915
|
name: "dispatch_results",
|
|
37868
37916
|
example: { issue: "DSP-1" },
|
|
37869
|
-
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,
|
|
37917
|
+
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. " + "With project and commit, the read prints each result that CI jobs stored for checks of " + "the project's spec files at that commit, newest first in Dispatch's record order, one " + "line each: its record number, the check, the verdict, the job, the leg of the matrix, " + "the run and its attempt, and the commit. check limits the read to one check, and json " + "prints the stored results as JSON. " + ISSUE_REFERENCE,
|
|
37870
37918
|
arguments: (z) => ({
|
|
37871
|
-
issue: z.string().describe(ISSUE_REFERENCE),
|
|
37919
|
+
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
37920
|
+
project: z.string().describe("A project key such as ACME. With commit, the read prints the results that CI jobs stored for checks of the project's spec files.").optional(),
|
|
37921
|
+
commit: z.string().describe("With project: the 40-character lowercase hex commit whose results the read prints.").optional(),
|
|
37922
|
+
check: z.string().describe("With project: the id of one check of the spec files, whose results alone the read prints.").optional(),
|
|
37872
37923
|
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(),
|
|
37873
37924
|
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(),
|
|
37874
|
-
json: z.boolean().describe("Print the complete results wire answer as JSON.").optional()
|
|
37875
|
-
})
|
|
37925
|
+
json: z.boolean().describe("Print the complete results wire answer as JSON; with project, the stored results, one in-toto statement each.").optional()
|
|
37926
|
+
}),
|
|
37927
|
+
validation: {
|
|
37928
|
+
check: (value) => resultsProblem(value) === undefined,
|
|
37929
|
+
message: RESULTS_OWNER_RULE,
|
|
37930
|
+
refusal: (value) => resultsProblem(value) ?? RESULTS_OWNER_RULE
|
|
37931
|
+
}
|
|
37876
37932
|
},
|
|
37877
37933
|
{
|
|
37878
37934
|
name: "dispatch_artifact",
|
|
@@ -44436,7 +44492,7 @@ var POLICY_REFUSAL_PATTERNS = [
|
|
|
44436
44492
|
policy("sessionFixed", "%s's tokens all name the session %s, which every pod of it may use, so its pods are registered for no name", K8S_ACCOUNT, FIXED_SESSION),
|
|
44437
44493
|
policy("sessionInvalid", "the registration of %s names a session of %d bytes; %s", K8S_ACCOUNT, NUMBER, SESSION_RULE),
|
|
44438
44494
|
policy("noEntry", "%s ran %s, whose job is written in %s; an entry lists the workflow a job runs in", REPOSITORY, WORKFLOW_REF, WORKFLOW_REF),
|
|
44439
|
-
policy("claimMissing", "the subject token's workflow_ref is not
|
|
44495
|
+
policy("claimMissing", "the subject token's workflow_ref %s is not %s/<path>@%s: its repository, the path of its workflow file and its ref", WORKFLOW_REF, REPOSITORY, GIT_REF),
|
|
44440
44496
|
policy("noEntry", "no entry lists the workflow %s of %s on %s", WORKFLOW_PATH, REPOSITORY, GIT_REF),
|
|
44441
44497
|
policy("claimMissing", "the subject token carries no email claim, so it names no account (ask for it with format=full)"),
|
|
44442
44498
|
policy("noEntry", "no entry lists the Google account %s", EMAIL),
|
|
@@ -47034,6 +47090,16 @@ async function brokerTokenClient(env, own = "", read) {
|
|
|
47034
47090
|
return { client, signIn: { person: record.person, thumbprint: record.thumbprint } };
|
|
47035
47091
|
}
|
|
47036
47092
|
|
|
47093
|
+
// ../envoy-client/src/airlock-credential.ts
|
|
47094
|
+
var AIRLOCK_RESULTS_VAR = "DISPATCH_RESULTS_TOKEN";
|
|
47095
|
+
function airlockCredential(placeholder) {
|
|
47096
|
+
return {
|
|
47097
|
+
scheme: "DPoP",
|
|
47098
|
+
headers: () => ({ Authorization: `DPoP ${placeholder}` }),
|
|
47099
|
+
secret: () => placeholder
|
|
47100
|
+
};
|
|
47101
|
+
}
|
|
47102
|
+
|
|
47037
47103
|
// ../envoy-client/src/envoy-config.ts
|
|
47038
47104
|
import {
|
|
47039
47105
|
access as access2,
|
|
@@ -47969,6 +48035,26 @@ async function dispatchUrl(env, config) {
|
|
|
47969
48035
|
const target = await dispatchTarget(env, config);
|
|
47970
48036
|
return target.enabled ? target.url : undefined;
|
|
47971
48037
|
}
|
|
48038
|
+
function ownIdentityDispatch(env) {
|
|
48039
|
+
const url = nonEmpty(env.DISPATCH_URL);
|
|
48040
|
+
if (url === undefined) {
|
|
48041
|
+
return offWithError("DISPATCH_URL is not set: a CI job's write reads Dispatch's server from it alone");
|
|
48042
|
+
}
|
|
48043
|
+
if (httpUrl2(url) === undefined)
|
|
48044
|
+
return offWithError("DISPATCH_URL must be an http or https URL");
|
|
48045
|
+
const placeholder = nonEmpty(env[AIRLOCK_RESULTS_VAR]);
|
|
48046
|
+
if (placeholder === undefined) {
|
|
48047
|
+
return offWithError(`dispatch result --project runs under \`agent-secrets result-grant -- \u2026\`, which gives it ${AIRLOCK_RESULTS_VAR}; this environment holds none, so nothing was sent`);
|
|
48048
|
+
}
|
|
48049
|
+
if (!sendable(placeholder)) {
|
|
48050
|
+
return offWithError(`${AIRLOCK_RESULTS_VAR} holds white space or a control character, so it is no placeholder \`agent-secrets result-grant\` gives, and nothing was sent`);
|
|
48051
|
+
}
|
|
48052
|
+
return {
|
|
48053
|
+
enabled: true,
|
|
48054
|
+
url: withoutTrailingSlashes(url),
|
|
48055
|
+
credential: airlockCredential(placeholder)
|
|
48056
|
+
};
|
|
48057
|
+
}
|
|
47972
48058
|
var BESIDE_TOKEN_FILES = [
|
|
47973
48059
|
"DISPATCH_TOKEN_BROKER",
|
|
47974
48060
|
"DISPATCH_TOKEN_BROKER_READ",
|
|
@@ -48149,6 +48235,275 @@ function activeDispatchSettings(resolution) {
|
|
|
48149
48235
|
return null;
|
|
48150
48236
|
}
|
|
48151
48237
|
|
|
48238
|
+
// ../envoy-client/src/dispatch-write-rows.ts
|
|
48239
|
+
var components = looseObject({
|
|
48240
|
+
mode: string2(),
|
|
48241
|
+
ids: array(string2()).nullish(),
|
|
48242
|
+
reason: string2().nullish()
|
|
48243
|
+
});
|
|
48244
|
+
var advice = looseObject({
|
|
48245
|
+
decision_blocks: number2().int().optional(),
|
|
48246
|
+
issue_status: string2().optional(),
|
|
48247
|
+
legion_managed_status: boolean2().optional(),
|
|
48248
|
+
session_writes_since_human: number2().int().optional(),
|
|
48249
|
+
your_open_asks: array(looseObject({ id: string2(), question: string2() })).nullable().optional(),
|
|
48250
|
+
unparsed_openers: looseObject({ count: number2().int(), examples: array(string2()).nullable() }).optional(),
|
|
48251
|
+
moved_approval_request: looseObject({
|
|
48252
|
+
ask_id: string2(),
|
|
48253
|
+
issue: string2().optional(),
|
|
48254
|
+
project: string2().optional(),
|
|
48255
|
+
documents: array(looseObject({
|
|
48256
|
+
artifact_id: string2(),
|
|
48257
|
+
name: string2(),
|
|
48258
|
+
primary: boolean2(),
|
|
48259
|
+
role: string2().optional(),
|
|
48260
|
+
requested_version: number2().int(),
|
|
48261
|
+
version: number2().int()
|
|
48262
|
+
})).nullable()
|
|
48263
|
+
}).optional(),
|
|
48264
|
+
superseded_approval: looseObject({
|
|
48265
|
+
version: number2().int(),
|
|
48266
|
+
approved_version: number2().int(),
|
|
48267
|
+
approved_by: string2(),
|
|
48268
|
+
design_gates: array(looseObject({ issue: string2(), step: string2() })).optional()
|
|
48269
|
+
}).optional()
|
|
48270
|
+
}).optional();
|
|
48271
|
+
var caughtAdvice = unknown().optional();
|
|
48272
|
+
var ask = {
|
|
48273
|
+
id: askFields.id,
|
|
48274
|
+
issue_key: askFields.issue_key,
|
|
48275
|
+
artifact_id: askFields.artifact_id
|
|
48276
|
+
};
|
|
48277
|
+
var askWrite = looseObject({
|
|
48278
|
+
...ask,
|
|
48279
|
+
question: askFields.question,
|
|
48280
|
+
urgency: string2(),
|
|
48281
|
+
waiting_on_person: string2().optional(),
|
|
48282
|
+
advice: caughtAdvice
|
|
48283
|
+
});
|
|
48284
|
+
var documentComment = {
|
|
48285
|
+
id: commentFields.id,
|
|
48286
|
+
ask_waiting_on: string2().optional(),
|
|
48287
|
+
advice
|
|
48288
|
+
};
|
|
48289
|
+
var suggestion = looseObject({ id: commentFields.id });
|
|
48290
|
+
var {
|
|
48291
|
+
repo: repo2,
|
|
48292
|
+
branch,
|
|
48293
|
+
last_error,
|
|
48294
|
+
last_commit,
|
|
48295
|
+
last_sync_at,
|
|
48296
|
+
components: sourceComponents
|
|
48297
|
+
} = ArchitectureSourceSchema.unwrap().shape;
|
|
48298
|
+
var architectureSource = looseObject({
|
|
48299
|
+
repo: repo2,
|
|
48300
|
+
branch,
|
|
48301
|
+
last_error,
|
|
48302
|
+
last_commit,
|
|
48303
|
+
last_sync_at,
|
|
48304
|
+
components: sourceComponents
|
|
48305
|
+
});
|
|
48306
|
+
var pictureUpload = {
|
|
48307
|
+
artifact: looseObject({ slug: artifactFields.slug }),
|
|
48308
|
+
version: looseObject({ number: versionFields.number })
|
|
48309
|
+
};
|
|
48310
|
+
var uploadedDocument = {
|
|
48311
|
+
id: artifactFields.id,
|
|
48312
|
+
slug: artifactFields.slug,
|
|
48313
|
+
name: artifactFields.name,
|
|
48314
|
+
primary: artifactFields.primary.optional(),
|
|
48315
|
+
role: string2().optional(),
|
|
48316
|
+
issue_key: artifactFields.issue_key.optional()
|
|
48317
|
+
};
|
|
48318
|
+
var actor = InboundActorSchema;
|
|
48319
|
+
var STORE_NOTHING = new WeakSet;
|
|
48320
|
+
function storesNothing(row) {
|
|
48321
|
+
STORE_NOTHING.add(row);
|
|
48322
|
+
return row;
|
|
48323
|
+
}
|
|
48324
|
+
function rowStores(row) {
|
|
48325
|
+
return !STORE_NOTHING.has(row);
|
|
48326
|
+
}
|
|
48327
|
+
var advance = looseObject(issueFields.advances.unwrap().unwrap().element.unwrap().shape);
|
|
48328
|
+
var externalLink = looseObject(ExternalLinkSchema.unwrap().shape);
|
|
48329
|
+
var updatedIssue = looseObject({
|
|
48330
|
+
key: issueFields.key,
|
|
48331
|
+
status: issueFields.status,
|
|
48332
|
+
title: issueFields.title.optional(),
|
|
48333
|
+
priority: issueFields.priority.optional(),
|
|
48334
|
+
assignee: issueFields.assignee.optional(),
|
|
48335
|
+
route: issueFields.route.optional(),
|
|
48336
|
+
parent: issueFields.parent.optional(),
|
|
48337
|
+
components: components.optional(),
|
|
48338
|
+
repo: issueFields.repo.optional(),
|
|
48339
|
+
resolved_repo: issueFields.resolved_repo.optional(),
|
|
48340
|
+
labels: issueFields.labels.nullish(),
|
|
48341
|
+
blocked_by: issueFields.blocked_by.nullish(),
|
|
48342
|
+
advances: array(advance).nullable().optional(),
|
|
48343
|
+
external_links: array(externalLink).nullish(),
|
|
48344
|
+
advice
|
|
48345
|
+
});
|
|
48346
|
+
var WRITE_ROWS = {
|
|
48347
|
+
issue: looseObject({
|
|
48348
|
+
key: issueFields.key,
|
|
48349
|
+
title: issueFields.title,
|
|
48350
|
+
project: issueFields.project,
|
|
48351
|
+
assignee: issueFields.assignee.optional(),
|
|
48352
|
+
repo: issueFields.repo.optional(),
|
|
48353
|
+
advice: caughtAdvice
|
|
48354
|
+
}),
|
|
48355
|
+
markdownRoundTrip: storesNothing(looseObject({ markdown: string2() })),
|
|
48356
|
+
fileRoundTrip: storesNothing(looseObject({ markdown: string2() })),
|
|
48357
|
+
related: storesNothing(looseObject({ outcome: string2() })),
|
|
48358
|
+
updateIssue: updatedIssue,
|
|
48359
|
+
updateIssueComponents: updatedIssue.extend({ components }),
|
|
48360
|
+
claimIssue: looseObject({
|
|
48361
|
+
status: issueFields.status,
|
|
48362
|
+
claim: looseObject({ at: string2() }).nullable(),
|
|
48363
|
+
legion_managed_status: boolean2().optional()
|
|
48364
|
+
}),
|
|
48365
|
+
changeIssueStatus: looseObject({
|
|
48366
|
+
changed: array(looseObject({
|
|
48367
|
+
key: issueFields.key,
|
|
48368
|
+
status: issueFields.status,
|
|
48369
|
+
parent: string2().nullable()
|
|
48370
|
+
})).nullable(),
|
|
48371
|
+
issue: looseObject({
|
|
48372
|
+
status: issueFields.status,
|
|
48373
|
+
external_links: array(externalLink).nullish()
|
|
48374
|
+
})
|
|
48375
|
+
}),
|
|
48376
|
+
ask: askWrite,
|
|
48377
|
+
artifactAsk: askWrite,
|
|
48378
|
+
editAsk: looseObject({ ...ask, question: askFields.question }),
|
|
48379
|
+
resolveAsk: looseObject({
|
|
48380
|
+
...ask,
|
|
48381
|
+
resolution: looseObject({ reason: string2() }).optional()
|
|
48382
|
+
}),
|
|
48383
|
+
createProject: looseObject({
|
|
48384
|
+
key: string2(),
|
|
48385
|
+
name: string2(),
|
|
48386
|
+
created_at: string2(),
|
|
48387
|
+
default_assignee: string2().optional()
|
|
48388
|
+
}),
|
|
48389
|
+
syncArchitectureSources: array(architectureSource),
|
|
48390
|
+
syncArchitectureSource: architectureSource,
|
|
48391
|
+
requestApproval: looseObject({
|
|
48392
|
+
version: number2().int(),
|
|
48393
|
+
coverage: array(string2()).nullish(),
|
|
48394
|
+
coverage_unread: boolean2().optional(),
|
|
48395
|
+
ask: looseObject({
|
|
48396
|
+
...ask,
|
|
48397
|
+
question: askFields.question,
|
|
48398
|
+
waiting_on_person: string2().optional()
|
|
48399
|
+
}).nullable(),
|
|
48400
|
+
approval: looseObject({ by: looseObject({ id: string2() }).nullish() })
|
|
48401
|
+
}),
|
|
48402
|
+
planApprove: looseObject({ version: number2().int() }),
|
|
48403
|
+
recordDeploy: looseObject({
|
|
48404
|
+
deploy: looseObject({
|
|
48405
|
+
program: string2(),
|
|
48406
|
+
commit: string2(),
|
|
48407
|
+
deployed_at: string2(),
|
|
48408
|
+
source: string2(),
|
|
48409
|
+
url: string2(),
|
|
48410
|
+
recorded_by: actor
|
|
48411
|
+
})
|
|
48412
|
+
}),
|
|
48413
|
+
reviewArtifact: looseObject({
|
|
48414
|
+
version: number2().int(),
|
|
48415
|
+
state: string2(),
|
|
48416
|
+
ask_id: string2().nullable(),
|
|
48417
|
+
reason: string2().nullable(),
|
|
48418
|
+
actor
|
|
48419
|
+
}),
|
|
48420
|
+
recordResult: looseObject({
|
|
48421
|
+
line: string2(),
|
|
48422
|
+
result: looseObject({
|
|
48423
|
+
id: string2(),
|
|
48424
|
+
verdict: string2(),
|
|
48425
|
+
role: string2(),
|
|
48426
|
+
check_block_id: string2(),
|
|
48427
|
+
check_issue_key: string2(),
|
|
48428
|
+
commit_sha: string2()
|
|
48429
|
+
})
|
|
48430
|
+
}),
|
|
48431
|
+
dryRunResult: storesNothing(looseObject({ line: string2(), result: unknown() })),
|
|
48432
|
+
retractResult: looseObject({
|
|
48433
|
+
result_id: string2(),
|
|
48434
|
+
reason: string2(),
|
|
48435
|
+
created_at: string2(),
|
|
48436
|
+
actor
|
|
48437
|
+
}),
|
|
48438
|
+
recordSpecCheckResult: looseObject({
|
|
48439
|
+
id: string2(),
|
|
48440
|
+
seq: number2().int(),
|
|
48441
|
+
attestation: looseObject({
|
|
48442
|
+
predicate: looseObject({ check: string2(), verdict: string2() })
|
|
48443
|
+
})
|
|
48444
|
+
}),
|
|
48445
|
+
comment: looseObject({ ...documentComment, issue_key: commentFields.issue_key }),
|
|
48446
|
+
artifactComment: looseObject(documentComment),
|
|
48447
|
+
suggest: suggestion,
|
|
48448
|
+
artifactSuggest: suggestion,
|
|
48449
|
+
resolveComment: looseObject({
|
|
48450
|
+
id: commentFields.id,
|
|
48451
|
+
issue_key: commentFields.issue_key,
|
|
48452
|
+
artifact_id: commentFields.artifact_id
|
|
48453
|
+
}),
|
|
48454
|
+
editComment: looseObject({
|
|
48455
|
+
id: commentFields.id,
|
|
48456
|
+
issue_key: commentFields.issue_key,
|
|
48457
|
+
artifact_id: commentFields.artifact_id
|
|
48458
|
+
}),
|
|
48459
|
+
message: looseObject({ id: messageFields.id, advice }),
|
|
48460
|
+
editMessage: looseObject({ id: messageFields.id, issue_key: messageFields.issue_key }),
|
|
48461
|
+
agentMessage: looseObject({
|
|
48462
|
+
id: messageFields.id,
|
|
48463
|
+
deliveries: array(looseObject({ state: string2(), error: string2().nullish(), delivery: string2() })).nullish()
|
|
48464
|
+
}),
|
|
48465
|
+
messageReply: looseObject({
|
|
48466
|
+
id: messageFields.id,
|
|
48467
|
+
body: messageFields.body,
|
|
48468
|
+
in_reply_to: messageFields.in_reply_to.optional(),
|
|
48469
|
+
duplicate: boolean2().optional()
|
|
48470
|
+
}),
|
|
48471
|
+
deliveryReply: looseObject({}),
|
|
48472
|
+
acceptMessageDelivery: looseObject({
|
|
48473
|
+
message_id: string2(),
|
|
48474
|
+
body: string2(),
|
|
48475
|
+
delivery: string2()
|
|
48476
|
+
}),
|
|
48477
|
+
docEdit: looseObject({
|
|
48478
|
+
applied: number2().int(),
|
|
48479
|
+
version: looseObject({ number: versionFields.number }).nullable(),
|
|
48480
|
+
changed: boolean2().optional(),
|
|
48481
|
+
unchanged_ops: array(number2().int()).nullish(),
|
|
48482
|
+
lost_ops: array(number2().int()).nullish(),
|
|
48483
|
+
written: string2().optional(),
|
|
48484
|
+
token: string2().optional(),
|
|
48485
|
+
advice: caughtAdvice
|
|
48486
|
+
}),
|
|
48487
|
+
nameArtifactVersion: looseObject({}),
|
|
48488
|
+
writeHandoff: looseObject({
|
|
48489
|
+
id: string2(),
|
|
48490
|
+
issue_key: string2(),
|
|
48491
|
+
phase: string2(),
|
|
48492
|
+
version: number2().int()
|
|
48493
|
+
}),
|
|
48494
|
+
projectArtifact: looseObject({
|
|
48495
|
+
artifact: looseObject({ ...uploadedDocument, project: artifactFields.project }),
|
|
48496
|
+
version: pictureUpload.version,
|
|
48497
|
+
advice
|
|
48498
|
+
}),
|
|
48499
|
+
agentArtifact: looseObject(pictureUpload),
|
|
48500
|
+
artifact: looseObject({
|
|
48501
|
+
artifact: looseObject(uploadedDocument),
|
|
48502
|
+
version: pictureUpload.version,
|
|
48503
|
+
advice
|
|
48504
|
+
})
|
|
48505
|
+
};
|
|
48506
|
+
|
|
48152
48507
|
// ../envoy-client/src/ask-answer.ts
|
|
48153
48508
|
var HEAD_LENGTH = 120;
|
|
48154
48509
|
function textHead(text, length = HEAD_LENGTH) {
|
|
@@ -48266,10 +48621,23 @@ class SentTokens {
|
|
|
48266
48621
|
}
|
|
48267
48622
|
}
|
|
48268
48623
|
|
|
48624
|
+
// ../envoy-client/src/go-space.ts
|
|
48625
|
+
var GO_SPACE = goSpaceClass();
|
|
48626
|
+
function goSpaceClass() {
|
|
48627
|
+
const set = /^\^\[(.+)\]\*\$$/u.exec(goBlankPattern.source)?.[1];
|
|
48628
|
+
if (set === undefined) {
|
|
48629
|
+
throw new Error(`goBlankPattern (@legion/contracts/go-blank) is no longer one character class: ${goBlankPattern.source}`);
|
|
48630
|
+
}
|
|
48631
|
+
return set;
|
|
48632
|
+
}
|
|
48633
|
+
var goSpaceAtEnds = new RegExp(`^[${GO_SPACE}]+|[${GO_SPACE}]+$`, "gu");
|
|
48634
|
+
var pathNamesNothingPattern = new RegExp(`^[${GO_SPACE}]*[./]*[${GO_SPACE}]*$`, "u");
|
|
48635
|
+
|
|
48269
48636
|
// ../envoy-client/src/write-outcome.ts
|
|
48270
48637
|
var landed = (action) => ({ state: "may-have-landed", action });
|
|
48271
48638
|
var nothing = (action) => ({ state: "nothing-sent", action });
|
|
48272
48639
|
var WRITE_TRANSITIONS = {
|
|
48640
|
+
"uncommitted-401": { "nothing-sent": landed("end"), "may-have-landed": landed("end") },
|
|
48273
48641
|
applied: { "nothing-sent": nothing("settle"), "may-have-landed": landed("settle") },
|
|
48274
48642
|
judged: { "nothing-sent": nothing("settle"), "may-have-landed": landed("settle") },
|
|
48275
48643
|
unjudged: { "nothing-sent": nothing("end"), "may-have-landed": landed("end") },
|
|
@@ -48310,6 +48678,7 @@ var DISPATCH_URL_SETTING = "the configured Dispatch URL";
|
|
|
48310
48678
|
class DispatchServiceError extends Error {
|
|
48311
48679
|
code;
|
|
48312
48680
|
status;
|
|
48681
|
+
retryAfterMs;
|
|
48313
48682
|
name = "DispatchServiceError";
|
|
48314
48683
|
fromDispatch = true;
|
|
48315
48684
|
candidates;
|
|
@@ -48319,10 +48688,11 @@ class DispatchServiceError extends Error {
|
|
|
48319
48688
|
changed;
|
|
48320
48689
|
textRefusal;
|
|
48321
48690
|
hint;
|
|
48322
|
-
constructor(code, status, message, details = {}) {
|
|
48691
|
+
constructor(code, status, message, details = {}, retryAfterMs = null) {
|
|
48323
48692
|
super(message);
|
|
48324
48693
|
this.code = code;
|
|
48325
48694
|
this.status = status;
|
|
48695
|
+
this.retryAfterMs = retryAfterMs;
|
|
48326
48696
|
this.candidates = details.candidates;
|
|
48327
48697
|
this.current = details.current;
|
|
48328
48698
|
this.mismatches = details.mismatches;
|
|
@@ -48354,24 +48724,17 @@ class DispatchProxyRefusalError extends DispatchServiceError {
|
|
|
48354
48724
|
fromDispatch = false;
|
|
48355
48725
|
}
|
|
48356
48726
|
var PROXY_CODE_FORM = /^[A-Z][A-Z0-9_]{0,63}$/;
|
|
48357
|
-
function
|
|
48358
|
-
|
|
48359
|
-
|
|
48360
|
-
|
|
48361
|
-
if (code !== "ERR_PROXY_TUNNEL" || typeof status !== "number" || !(headers instanceof Headers)) {
|
|
48727
|
+
function proxyOwnAnswer(response) {
|
|
48728
|
+
const forwarded = response.headers.get(PROXY_FORWARDED_HEADER)?.trim().toLowerCase();
|
|
48729
|
+
const named = response.headers.get(PROXY_CODE_HEADER)?.trim() ?? "";
|
|
48730
|
+
if (forwarded !== "false" && forwarded !== "unknown" && named === "")
|
|
48362
48731
|
return;
|
|
48363
|
-
}
|
|
48364
|
-
|
|
48365
|
-
|
|
48366
|
-
|
|
48367
|
-
|
|
48368
|
-
return
|
|
48369
|
-
status,
|
|
48370
|
-
headers: {
|
|
48371
|
-
[PROXY_CODE_HEADER]: proxyCode,
|
|
48372
|
-
...forwarded === null ? {} : { [PROXY_FORWARDED_HEADER]: forwarded }
|
|
48373
|
-
}
|
|
48374
|
-
});
|
|
48732
|
+
return { code: named === "" ? `HTTP_${response.status}` : named, left: forwarded !== "false" };
|
|
48733
|
+
}
|
|
48734
|
+
function proxyEvent(status, left) {
|
|
48735
|
+
if (left)
|
|
48736
|
+
return "proxy-unsettled";
|
|
48737
|
+
return outage(status) ? "proxy-failed" : "proxy-refused";
|
|
48375
48738
|
}
|
|
48376
48739
|
var CREDENTIAL_ECHOED = "CREDENTIAL_ECHOED";
|
|
48377
48740
|
|
|
@@ -48392,6 +48755,8 @@ class DispatchWriteUnsettledError extends Error {
|
|
|
48392
48755
|
let why = last instanceof DispatchServiceError && mayHaveReachedServer(last.status) || last instanceof DispatchProxyRefusalError ? "an attempt of the write may have reached Dispatch" : "an earlier attempt of the write may have reached Dispatch";
|
|
48393
48756
|
if (last instanceof DispatchGatewayError) {
|
|
48394
48757
|
answer = last.answer;
|
|
48758
|
+
if (last.status < 300)
|
|
48759
|
+
why = "the write may have reached Dispatch behind what answered it";
|
|
48395
48760
|
} else if (last instanceof DispatchServiceError && last.code === IDEMPOTENCY_KEY_IN_FLIGHT) {
|
|
48396
48761
|
answer = last.code;
|
|
48397
48762
|
why = "Dispatch was still running an earlier attempt of the write";
|
|
@@ -48413,10 +48778,10 @@ class DispatchWriteLandedError extends Error {
|
|
|
48413
48778
|
code;
|
|
48414
48779
|
status;
|
|
48415
48780
|
name = "DispatchWriteLandedError";
|
|
48416
|
-
constructor(code, status, method, shownUrl) {
|
|
48781
|
+
constructor(code, status, method, shownUrl, options) {
|
|
48417
48782
|
const lost = code === IDEMPOTENCY_ANSWER_NOT_KEPT ? "Dispatch gives no copy of its answer, which was too large to keep or holds a comment " + "or a message that was deleted, or a document version name a delete replaced" : "its answer was lost on the way back";
|
|
48418
48783
|
const request = `${method} ${shownUrl}`;
|
|
48419
|
-
super(`${request} was made, but ${lost} (${code}), so this command cannot print what it ` + "made: read it back with `dispatch read`, or with the matching list for something it created.");
|
|
48784
|
+
super(`${request} was made, but ${lost} (${code}), so this command cannot print what it ` + "made: read it back with `dispatch read`, or with the matching list for something it created.", options);
|
|
48420
48785
|
this.code = code;
|
|
48421
48786
|
this.status = status;
|
|
48422
48787
|
}
|
|
@@ -48480,10 +48845,12 @@ class DispatchNoRouteError extends DispatchServiceError {
|
|
|
48480
48845
|
class DispatchUnreachableError extends Error {
|
|
48481
48846
|
reachedNothing;
|
|
48482
48847
|
failure;
|
|
48848
|
+
code;
|
|
48483
48849
|
constructor(message, reachedNothing, failure) {
|
|
48484
48850
|
super(message);
|
|
48485
48851
|
this.reachedNothing = reachedNothing;
|
|
48486
48852
|
this.failure = failure;
|
|
48853
|
+
this.code = /^[A-Z][A-Z0-9_]*$/.test(failure) ? failure : undefined;
|
|
48487
48854
|
}
|
|
48488
48855
|
}
|
|
48489
48856
|
function reviewNoRouteRefusal(baseUrl, route, version) {
|
|
@@ -48527,6 +48894,9 @@ function pauseFor(ms, signal) {
|
|
|
48527
48894
|
signal.addEventListener("abort", stop, { once: true });
|
|
48528
48895
|
return promise;
|
|
48529
48896
|
}
|
|
48897
|
+
function keyEchoed(response, key) {
|
|
48898
|
+
return key !== "" && keyNamedBack(response) === key;
|
|
48899
|
+
}
|
|
48530
48900
|
var STREAMED_BODY_MIN = 1 << 20;
|
|
48531
48901
|
var STREAMED_BODY_CHUNK = 64 << 10;
|
|
48532
48902
|
function attemptBody(body, headers, progress) {
|
|
@@ -48584,7 +48954,7 @@ function refusalIn(json) {
|
|
|
48584
48954
|
};
|
|
48585
48955
|
}
|
|
48586
48956
|
var NULL_BODY_STATUSES = new Set([101, 204, 205, 304]);
|
|
48587
|
-
async function writeAnswer(response) {
|
|
48957
|
+
async function writeAnswer(response, echoed) {
|
|
48588
48958
|
if (NULL_BODY_STATUSES.has(response.status)) {
|
|
48589
48959
|
return {
|
|
48590
48960
|
response,
|
|
@@ -48595,7 +48965,8 @@ async function writeAnswer(response) {
|
|
|
48595
48965
|
code: undefined,
|
|
48596
48966
|
error: undefined,
|
|
48597
48967
|
replayed: response.headers.get(IDEMPOTENCY_REPLAYED_HEADER)?.trim() === "?1",
|
|
48598
|
-
|
|
48968
|
+
echoed,
|
|
48969
|
+
proxy: proxyOwnAnswer(response)
|
|
48599
48970
|
};
|
|
48600
48971
|
}
|
|
48601
48972
|
const text = await response.text();
|
|
@@ -48611,25 +48982,23 @@ async function writeAnswer(response) {
|
|
|
48611
48982
|
code: refusal?.code,
|
|
48612
48983
|
error: refusal?.error,
|
|
48613
48984
|
replayed: response.headers.get(IDEMPOTENCY_REPLAYED_HEADER)?.trim() === "?1",
|
|
48614
|
-
|
|
48985
|
+
echoed,
|
|
48986
|
+
proxy: proxyOwnAnswer(response)
|
|
48615
48987
|
};
|
|
48616
48988
|
}
|
|
48617
48989
|
function isStoredKeyStatus(status) {
|
|
48618
48990
|
return status >= 400 && status < 500 && status !== 401 && !outage(status);
|
|
48619
48991
|
}
|
|
48620
|
-
function answerEvent(answer,
|
|
48992
|
+
function answerEvent(answer, canTellDeadToken) {
|
|
48621
48993
|
const { status } = answer.response;
|
|
48622
|
-
if (
|
|
48623
|
-
|
|
48624
|
-
return "proxy-unsettled";
|
|
48625
|
-
return outage(status) ? "proxy-failed" : "proxy-refused";
|
|
48626
|
-
}
|
|
48994
|
+
if (answer.proxy !== undefined)
|
|
48995
|
+
return proxyEvent(status, answer.proxy.left);
|
|
48627
48996
|
if (status >= 200 && status < 300) {
|
|
48628
48997
|
if (answer.notJson)
|
|
48629
48998
|
return "foreign-2xx";
|
|
48630
48999
|
if (answer.malformed)
|
|
48631
49000
|
return "body-malformed";
|
|
48632
|
-
return
|
|
49001
|
+
return answer.echoed ? "applied" : "foreign-2xx";
|
|
48633
49002
|
}
|
|
48634
49003
|
if (status >= 300 && status < 400)
|
|
48635
49004
|
return "redirect";
|
|
@@ -48639,15 +49008,21 @@ function answerEvent(answer, requestKey, keyEchoed, canTellDeadToken, proxied) {
|
|
|
48639
49008
|
if (status === 404 && answer.code === "NOT_FOUND" && answer.error?.startsWith(NO_ROUTE_MESSAGE_PREFIX) === true) {
|
|
48640
49009
|
return "no-route";
|
|
48641
49010
|
}
|
|
49011
|
+
if (status === 401 && answer.echoed)
|
|
49012
|
+
return "uncommitted-401";
|
|
49013
|
+
if (tokenNotCheckedAnswer(status, answer.code))
|
|
49014
|
+
return "try-later";
|
|
48642
49015
|
const textRefusal = answer.error !== undefined && answer.response.headers.has(TEXT_REFUSAL_HEADER);
|
|
48643
49016
|
if (!textRefusal && retriesUnderKey(status, answer.code)) {
|
|
48644
49017
|
if (status === 409)
|
|
48645
49018
|
return "in-flight";
|
|
48646
49019
|
return mayHaveReachedServer(status) ? "may-have-run" : "try-later";
|
|
48647
49020
|
}
|
|
49021
|
+
if (!answer.echoed)
|
|
49022
|
+
return "unjudged";
|
|
48648
49023
|
if (answer.replayed || answer.code === IDEMPOTENCY_KEY_COMMITTED)
|
|
48649
49024
|
return "judged";
|
|
48650
|
-
if (
|
|
49025
|
+
if (!isStoredKeyStatus(status))
|
|
48651
49026
|
return "unjudged";
|
|
48652
49027
|
if (answer.code === IDEMPOTENCY_KEY_REUSED)
|
|
48653
49028
|
return "judged";
|
|
@@ -48714,6 +49089,103 @@ function gatewayAdvice(method, status) {
|
|
|
48714
49089
|
function gatewayClears(status) {
|
|
48715
49090
|
return outage(status) || status >= 200 && status < 300;
|
|
48716
49091
|
}
|
|
49092
|
+
var DISPATCH_ANSWER_LOST = "ANSWER_LOST";
|
|
49093
|
+
|
|
49094
|
+
class DispatchAnswerMissingError extends Error {
|
|
49095
|
+
status;
|
|
49096
|
+
name = "DispatchAnswerMissingError";
|
|
49097
|
+
code = DISPATCH_ANSWER_LOST;
|
|
49098
|
+
constructor(status, method, url, options) {
|
|
49099
|
+
super(`${method} ${url} answered ${status} without the answer it asks for ` + `(${DISPATCH_ANSWER_LOST}); it stores nothing, so nothing was made, and asking again is safe.`, options);
|
|
49100
|
+
this.status = status;
|
|
49101
|
+
}
|
|
49102
|
+
}
|
|
49103
|
+
|
|
49104
|
+
class DispatchEmptyPathError extends Error {
|
|
49105
|
+
name = "DispatchEmptyPathError";
|
|
49106
|
+
constructor(path) {
|
|
49107
|
+
const route = path.map((segment) => segment === "" ? "{empty}" : pathNamesNothingPattern.test(segment) ? `{${JSON.stringify(segment)}}` : segment).join("/");
|
|
49108
|
+
super(`/${route} holds a value that names nothing where the call names what it is about (empty, only white space, or only dots and slashes, which name no step of a path), so nothing was sent: a variable that gives it may be empty or unset`);
|
|
49109
|
+
}
|
|
49110
|
+
}
|
|
49111
|
+
var PROXY_TUNNEL_REFUSED = /: (\d{3}) ?(.*)$/;
|
|
49112
|
+
|
|
49113
|
+
class AirlockTunnelRefusedError extends Error {
|
|
49114
|
+
status;
|
|
49115
|
+
reason;
|
|
49116
|
+
proxyCode;
|
|
49117
|
+
name = "AirlockTunnelRefusedError";
|
|
49118
|
+
code = "AIRLOCK_TUNNEL_REFUSED";
|
|
49119
|
+
constructor(status, reason, proxyCode, options) {
|
|
49120
|
+
const said = status === 0 ? reason : `${status}${reason === "" ? "" : ` ${reason}`}`;
|
|
49121
|
+
super(`the airlock proxy refused the connection (${said}); nothing was sent to Dispatch`, options);
|
|
49122
|
+
this.status = status;
|
|
49123
|
+
this.reason = reason;
|
|
49124
|
+
this.proxyCode = proxyCode;
|
|
49125
|
+
}
|
|
49126
|
+
}
|
|
49127
|
+
function tunnelRefusal(error) {
|
|
49128
|
+
if (!(error instanceof Error) || Reflect.get(error, "code") !== "ERR_PROXY_TUNNEL") {
|
|
49129
|
+
return;
|
|
49130
|
+
}
|
|
49131
|
+
const headers = Reflect.get(error, "headers");
|
|
49132
|
+
const named = headers instanceof Headers ? headers.get(PROXY_CODE_HEADER)?.trim() ?? "" : "";
|
|
49133
|
+
const proxyCode = PROXY_CODE_FORM.test(named) ? named : undefined;
|
|
49134
|
+
const said = PROXY_TUNNEL_REFUSED.exec(error.message);
|
|
49135
|
+
return said === null ? new AirlockTunnelRefusedError(0, error.message, proxyCode, { cause: error }) : new AirlockTunnelRefusedError(Number(said[1]), said[2]?.trim() ?? "", proxyCode, {
|
|
49136
|
+
cause: error
|
|
49137
|
+
});
|
|
49138
|
+
}
|
|
49139
|
+
|
|
49140
|
+
class AirlockRefusedError extends Error {
|
|
49141
|
+
status;
|
|
49142
|
+
code;
|
|
49143
|
+
body;
|
|
49144
|
+
name = "AirlockRefusedError";
|
|
49145
|
+
constructor(status, code, body) {
|
|
49146
|
+
super(`the airlock proxy answered ${status} ${code} itself, and sent nothing on: ${body}`);
|
|
49147
|
+
this.status = status;
|
|
49148
|
+
this.code = code;
|
|
49149
|
+
this.body = body;
|
|
49150
|
+
}
|
|
49151
|
+
}
|
|
49152
|
+
|
|
49153
|
+
class AirlockOutcomeUnknownError extends Error {
|
|
49154
|
+
status;
|
|
49155
|
+
code;
|
|
49156
|
+
body;
|
|
49157
|
+
name = "AirlockOutcomeUnknownError";
|
|
49158
|
+
constructor(status, code, body) {
|
|
49159
|
+
super(`the airlock proxy answered ${status} ${code} itself after the write may have reached Dispatch: ${body}`);
|
|
49160
|
+
this.status = status;
|
|
49161
|
+
this.code = code;
|
|
49162
|
+
this.body = body;
|
|
49163
|
+
}
|
|
49164
|
+
}
|
|
49165
|
+
var TOKEN_NOT_CHECKED = {
|
|
49166
|
+
BROKER_TOKEN_RATE_LIMITED: 429,
|
|
49167
|
+
BROKER_UNAVAILABLE: 503
|
|
49168
|
+
};
|
|
49169
|
+
function tokenNotCheckedAnswer(status, code) {
|
|
49170
|
+
return code !== undefined && TOKEN_NOT_CHECKED[code] === status;
|
|
49171
|
+
}
|
|
49172
|
+
function tokenNotChecked(error) {
|
|
49173
|
+
return error instanceof DispatchServiceError && error.fromDispatch && tokenNotCheckedAnswer(error.status, error.code);
|
|
49174
|
+
}
|
|
49175
|
+
function writeOutcomeUnknown(error) {
|
|
49176
|
+
if (error instanceof DispatchWriteUnsettledError)
|
|
49177
|
+
return true;
|
|
49178
|
+
if (error instanceof DispatchGatewayError)
|
|
49179
|
+
return error.mayHaveReachedDispatch;
|
|
49180
|
+
if (error instanceof DispatchProxyRefusalError)
|
|
49181
|
+
return false;
|
|
49182
|
+
if (error instanceof DispatchServiceError)
|
|
49183
|
+
return error.status >= 500 && !tokenNotChecked(error);
|
|
49184
|
+
return false;
|
|
49185
|
+
}
|
|
49186
|
+
function keyNamedBack(response) {
|
|
49187
|
+
return (response.headers.get(IDEMPOTENCY_KEY_HEADER)?.trim() ?? "").replace(/^"(.*)"$/, "$1");
|
|
49188
|
+
}
|
|
48717
49189
|
|
|
48718
49190
|
class DispatchClient {
|
|
48719
49191
|
fetchImpl;
|
|
@@ -48737,6 +49209,9 @@ class DispatchClient {
|
|
|
48737
49209
|
try {
|
|
48738
49210
|
return await fetchImpl(input, { ...init, redirect: "manual" });
|
|
48739
49211
|
} catch (error) {
|
|
49212
|
+
const tunnel = tunnelRefusal(error);
|
|
49213
|
+
if (tunnel !== undefined)
|
|
49214
|
+
throw tunnel;
|
|
48740
49215
|
if (error instanceof TypeError) {
|
|
48741
49216
|
throw new DispatchUnreachableError(`Dispatch at ${shown} is unreachable: ${errorClass(error)}. If the Dispatch URL changed, restart this agent process so it picks up the new configuration.`, reachedNothing(error), errorClass(error));
|
|
48742
49217
|
}
|
|
@@ -48755,7 +49230,7 @@ class DispatchClient {
|
|
|
48755
49230
|
return this.#credential.secret();
|
|
48756
49231
|
}
|
|
48757
49232
|
async issue(input) {
|
|
48758
|
-
const answer = await this.#
|
|
49233
|
+
const answer = await this.#writeAnswer("POST", ["api", "v1", "issues"], WRITE_ROWS.issue, input);
|
|
48759
49234
|
return { ...answer.payload, created: answer.status === 201 };
|
|
48760
49235
|
}
|
|
48761
49236
|
async resolveIssue(issueReference) {
|
|
@@ -48783,28 +49258,28 @@ class DispatchClient {
|
|
|
48783
49258
|
async listIssueArtifacts(issue) {
|
|
48784
49259
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "artifacts"]);
|
|
48785
49260
|
}
|
|
48786
|
-
async markdownRoundTrip(markdown, newDocument) {
|
|
48787
|
-
return this.#roundTrip(["api", "v1", "markdown", "round-trip"], { markdown }, newDocument);
|
|
49261
|
+
async markdownRoundTrip(markdown, newDocument = false) {
|
|
49262
|
+
return this.#roundTrip(["api", "v1", "markdown", "round-trip"], WRITE_ROWS.markdownRoundTrip, { markdown }, newDocument);
|
|
48788
49263
|
}
|
|
48789
|
-
async fileRoundTrip(bytes, newDocument) {
|
|
49264
|
+
async fileRoundTrip(bytes, newDocument = false) {
|
|
48790
49265
|
const file = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString("base64");
|
|
48791
|
-
return this.#roundTrip(["api", "v1", "markdown", "file-round-trip"], { file }, newDocument);
|
|
49266
|
+
return this.#roundTrip(["api", "v1", "markdown", "file-round-trip"], WRITE_ROWS.fileRoundTrip, { file }, newDocument);
|
|
48792
49267
|
}
|
|
48793
|
-
async#roundTrip(path, body, newDocument) {
|
|
48794
|
-
const answer = await this.#writingNothing(path, newDocument ? { ...body, new_document: true } : body
|
|
49268
|
+
async#roundTrip(path, row, body, newDocument) {
|
|
49269
|
+
const answer = await this.#writingNothing(path, row, newDocument ? { ...body, new_document: true } : body);
|
|
48795
49270
|
return answer.markdown;
|
|
48796
49271
|
}
|
|
48797
49272
|
async listProjectArtifacts(project, unlinked = false) {
|
|
48798
49273
|
return this.#json("GET", ["api", "v1", "projects", project, "artifacts"], undefined, unlinked ? { unlinked: "true" } : undefined);
|
|
48799
49274
|
}
|
|
48800
49275
|
async projectArtifact(project, input, key) {
|
|
48801
|
-
return this.#upload(["api", "v1", "projects", project, "artifacts"], input, key);
|
|
49276
|
+
return this.#upload(["api", "v1", "projects", project, "artifacts"], input, WRITE_ROWS.projectArtifact, key);
|
|
48802
49277
|
}
|
|
48803
49278
|
async getProjectArtifact(project, slug) {
|
|
48804
49279
|
return this.#json("GET", ["api", "v1", "projects", project, "artifacts", slug]);
|
|
48805
49280
|
}
|
|
48806
49281
|
async agentArtifact(sessionId, input) {
|
|
48807
|
-
return this.#upload(["api", "v1", "agents", sessionId, "artifacts"], input);
|
|
49282
|
+
return this.#upload(["api", "v1", "agents", sessionId, "artifacts"], input, WRITE_ROWS.agentArtifact);
|
|
48808
49283
|
}
|
|
48809
49284
|
async getAgentArtifact(sessionId, slug) {
|
|
48810
49285
|
return this.#json("GET", ["api", "v1", "agents", sessionId, "artifacts", slug]);
|
|
@@ -48825,24 +49300,24 @@ class DispatchClient {
|
|
|
48825
49300
|
return this.#json("GET", path, undefined, request);
|
|
48826
49301
|
}
|
|
48827
49302
|
async related(project, input) {
|
|
48828
|
-
return this.#writingNothing(["api", "v1", "projects", project, "related"], input);
|
|
49303
|
+
return this.#writingNothing(["api", "v1", "projects", project, "related"], WRITE_ROWS.related, input);
|
|
48829
49304
|
}
|
|
48830
49305
|
async getIssue(issue) {
|
|
48831
49306
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue)]);
|
|
48832
49307
|
}
|
|
48833
49308
|
async updateIssue(issue, input) {
|
|
48834
|
-
return this.#
|
|
49309
|
+
return this.#write("PATCH", ["api", "v1", "issues", await this.#resolveIssue(issue)], input.components === undefined ? WRITE_ROWS.updateIssue : WRITE_ROWS.updateIssueComponents, input);
|
|
48835
49310
|
}
|
|
48836
49311
|
async changeIssueStatus(issue, input) {
|
|
48837
49312
|
const path = ["api", "v1", "issues", await this.#resolveIssue(issue), "status-change"];
|
|
48838
49313
|
try {
|
|
48839
|
-
return await this.#
|
|
49314
|
+
return await this.#write("POST", path, WRITE_ROWS.changeIssueStatus, input);
|
|
48840
49315
|
} catch (error) {
|
|
48841
49316
|
throw this.#refusalOfNoRoute(error, path, (route) => statusChangeNoRouteRefusal(this.#baseUrl, route));
|
|
48842
49317
|
}
|
|
48843
49318
|
}
|
|
48844
49319
|
async claimIssue(issue, input = {}) {
|
|
48845
|
-
return this.#
|
|
49320
|
+
return this.#write("POST", ["api", "v1", "issues", await this.#resolveIssue(issue), "claim"], WRITE_ROWS.claimIssue, input);
|
|
48846
49321
|
}
|
|
48847
49322
|
async releaseIssueClaim(issue, input = {}) {
|
|
48848
49323
|
return this.#json("DELETE", ["api", "v1", "issues", await this.#resolveIssue(issue), "claim"], input);
|
|
@@ -48872,7 +49347,7 @@ class DispatchClient {
|
|
|
48872
49347
|
return { issue, events };
|
|
48873
49348
|
}
|
|
48874
49349
|
async ask(issue, input) {
|
|
48875
|
-
return this.#
|
|
49350
|
+
return this.#write("POST", ["api", "v1", "issues", await this.#resolveIssue(issue), "asks"], WRITE_ROWS.ask, input);
|
|
48876
49351
|
}
|
|
48877
49352
|
async openAsks(sessionID, since) {
|
|
48878
49353
|
return this.#json("GET", ["api", "v1", "asks", "open"], undefined, {
|
|
@@ -48917,7 +49392,7 @@ class DispatchClient {
|
|
|
48917
49392
|
return this.#json("GET", ["api", "v1", "credential-requests"], undefined, { approver: "me" });
|
|
48918
49393
|
}
|
|
48919
49394
|
async createProject(input) {
|
|
48920
|
-
return this.#
|
|
49395
|
+
return this.#write("POST", ["api", "v1", "projects"], WRITE_ROWS.createProject, input);
|
|
48921
49396
|
}
|
|
48922
49397
|
async listProjects() {
|
|
48923
49398
|
return this.#json("GET", ["api", "v1", "projects"]);
|
|
@@ -48953,26 +49428,12 @@ class DispatchClient {
|
|
|
48953
49428
|
}
|
|
48954
49429
|
async syncArchitectureSources(project) {
|
|
48955
49430
|
try {
|
|
48956
|
-
return await this.#
|
|
48957
|
-
"api",
|
|
48958
|
-
"v1",
|
|
48959
|
-
"projects",
|
|
48960
|
-
project,
|
|
48961
|
-
"architecture-sources",
|
|
48962
|
-
"sync"
|
|
48963
|
-
]);
|
|
49431
|
+
return await this.#write("POST", ["api", "v1", "projects", project, "architecture-sources", "sync"], WRITE_ROWS.syncArchitectureSources);
|
|
48964
49432
|
} catch (error) {
|
|
48965
49433
|
if (!(error instanceof DispatchNoRouteError))
|
|
48966
49434
|
throw error;
|
|
48967
49435
|
}
|
|
48968
|
-
const source = await this.#
|
|
48969
|
-
"api",
|
|
48970
|
-
"v1",
|
|
48971
|
-
"projects",
|
|
48972
|
-
project,
|
|
48973
|
-
"architecture-source",
|
|
48974
|
-
"sync"
|
|
48975
|
-
]);
|
|
49436
|
+
const source = await this.#write("POST", ["api", "v1", "projects", project, "architecture-source", "sync"], WRITE_ROWS.syncArchitectureSource);
|
|
48976
49437
|
return [source];
|
|
48977
49438
|
}
|
|
48978
49439
|
async syncArchitectureSource(project, repo) {
|
|
@@ -48980,37 +49441,25 @@ class DispatchClient {
|
|
|
48980
49441
|
if (!owner || !name || rest.length > 0) {
|
|
48981
49442
|
throw new Error(`repository must be owner/name, got ${JSON.stringify(repo)}`);
|
|
48982
49443
|
}
|
|
48983
|
-
return this.#
|
|
48984
|
-
"api",
|
|
48985
|
-
"v1",
|
|
48986
|
-
"projects",
|
|
48987
|
-
project,
|
|
48988
|
-
"architecture-sources",
|
|
48989
|
-
owner,
|
|
48990
|
-
name,
|
|
48991
|
-
"sync"
|
|
48992
|
-
]);
|
|
49444
|
+
return this.#write("POST", ["api", "v1", "projects", project, "architecture-sources", owner, name, "sync"], WRITE_ROWS.syncArchitectureSource);
|
|
48993
49445
|
}
|
|
48994
49446
|
async resolveAsk(id, input) {
|
|
48995
|
-
return this.#
|
|
49447
|
+
return this.#write("POST", ["api", "v1", "asks", id, "resolve"], WRITE_ROWS.resolveAsk, input);
|
|
48996
49448
|
}
|
|
48997
49449
|
async requestApproval(artifactID, input) {
|
|
48998
|
-
const answer = await this.#
|
|
49450
|
+
const answer = await this.#writeAnswer("POST", ["api", "v1", "artifacts", artifactID, "approval-requests"], WRITE_ROWS.requestApproval, input);
|
|
48999
49451
|
return { ...answer.payload, recorded: answer.status === 201 };
|
|
49000
49452
|
}
|
|
49001
49453
|
async planApprove(artifactID, input) {
|
|
49002
|
-
return this.#
|
|
49454
|
+
return this.#write("POST", ["api", "v1", "artifacts", artifactID, "plan-reviews"], WRITE_ROWS.planApprove, input);
|
|
49003
49455
|
}
|
|
49004
49456
|
async reviewArtifact(artifactID, version, input) {
|
|
49005
49457
|
const path = ["api", "v1", "artifacts", artifactID, "versions", String(version), "reviews"];
|
|
49006
49458
|
const body = { state: input.state, reason: input.reason };
|
|
49007
49459
|
try {
|
|
49008
49460
|
const route = await this.#credential.approveRoute?.(this.#credentialSignal(this.#signal));
|
|
49009
|
-
|
|
49010
|
-
|
|
49011
|
-
return (await this.#jsonAnswer("POST", path, body, { via })).payload;
|
|
49012
|
-
}
|
|
49013
|
-
return await this.#json("POST", path, body);
|
|
49461
|
+
const via = route === undefined ? undefined : this.#throughProxy(route, this.#url(path));
|
|
49462
|
+
return await this.#write("POST", path, WRITE_ROWS.reviewArtifact, body, { via });
|
|
49014
49463
|
} catch (error) {
|
|
49015
49464
|
throw this.#refusalOfNoRoute(error, path, (route) => reviewNoRouteRefusal(this.#baseUrl, route, version));
|
|
49016
49465
|
}
|
|
@@ -49031,12 +49480,12 @@ class DispatchClient {
|
|
|
49031
49480
|
return { credential, init: { proxy: proxy.toString(), tls: { ca: route.caCertificate } } };
|
|
49032
49481
|
}
|
|
49033
49482
|
async recordResult(issue, input) {
|
|
49034
|
-
return this.#
|
|
49483
|
+
return this.#write("POST", ["api", "v1", "issues", await this.#resolveIssue(issue), "results"], WRITE_ROWS.recordResult, input);
|
|
49035
49484
|
}
|
|
49036
49485
|
async dryRunResult(issue, input) {
|
|
49037
49486
|
const path = ["api", "v1", "issues", await this.#resolveIssue(issue), "results", "dry-run"];
|
|
49038
49487
|
try {
|
|
49039
|
-
return await this.#writingNothing(path,
|
|
49488
|
+
return await this.#writingNothing(path, WRITE_ROWS.dryRunResult, input);
|
|
49040
49489
|
} catch (error) {
|
|
49041
49490
|
throw this.#refusalOfNoRoute(error, path, (route) => resultDryRunNoRouteRefusal(this.#baseUrl, route));
|
|
49042
49491
|
}
|
|
@@ -49045,19 +49494,19 @@ class DispatchClient {
|
|
|
49045
49494
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "results"], undefined, at === undefined ? undefined : { at });
|
|
49046
49495
|
}
|
|
49047
49496
|
async recordDeploy(input) {
|
|
49048
|
-
return this.#
|
|
49497
|
+
return this.#write("POST", ["api", "v1", "deploys"], WRITE_ROWS.recordDeploy, input);
|
|
49049
49498
|
}
|
|
49050
49499
|
async deploys(repo) {
|
|
49051
49500
|
return this.#json("GET", ["api", "v1", "deploys"], undefined, { repo });
|
|
49052
49501
|
}
|
|
49053
49502
|
async retractResult(resultID, input) {
|
|
49054
|
-
return this.#
|
|
49503
|
+
return this.#write("POST", ["api", "v1", "results", resultID, "retract"], WRITE_ROWS.retractResult, input);
|
|
49055
49504
|
}
|
|
49056
49505
|
async editAsk(id, input) {
|
|
49057
|
-
return this.#
|
|
49506
|
+
return this.#write("PATCH", ["api", "v1", "asks", id], WRITE_ROWS.editAsk, input);
|
|
49058
49507
|
}
|
|
49059
49508
|
async comment(issue, input) {
|
|
49060
|
-
return this.#
|
|
49509
|
+
return this.#write("POST", ["api", "v1", "issues", await this.#resolveIssue(issue), "comments"], WRITE_ROWS.comment, input);
|
|
49061
49510
|
}
|
|
49062
49511
|
async listIssueAsks(issue, state) {
|
|
49063
49512
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "asks"], undefined, state === undefined ? undefined : { state });
|
|
@@ -49066,11 +49515,11 @@ class DispatchClient {
|
|
|
49066
49515
|
return this.#json("GET", ["api", "v1", "artifacts", id, "asks"], undefined, state === undefined ? undefined : { state });
|
|
49067
49516
|
}
|
|
49068
49517
|
async artifactAsk(id, input) {
|
|
49069
|
-
return this.#
|
|
49518
|
+
return this.#write("POST", ["api", "v1", "artifacts", id, "asks"], WRITE_ROWS.artifactAsk, input);
|
|
49070
49519
|
}
|
|
49071
49520
|
async suggest(issue, input) {
|
|
49072
49521
|
const { replace_with, ...comment } = input;
|
|
49073
|
-
return this.#
|
|
49522
|
+
return this.#write("POST", ["api", "v1", "issues", await this.#resolveIssue(issue), "comments"], WRITE_ROWS.suggest, {
|
|
49074
49523
|
...comment,
|
|
49075
49524
|
suggestion: { replace_with }
|
|
49076
49525
|
});
|
|
@@ -49079,27 +49528,27 @@ class DispatchClient {
|
|
|
49079
49528
|
return this.#json("GET", ["api", "v1", "artifacts", id, "comments"]);
|
|
49080
49529
|
}
|
|
49081
49530
|
async artifactComment(id, input) {
|
|
49082
|
-
return this.#
|
|
49531
|
+
return this.#write("POST", ["api", "v1", "artifacts", id, "comments"], WRITE_ROWS.artifactComment, input);
|
|
49083
49532
|
}
|
|
49084
49533
|
async artifactSuggest(id, input) {
|
|
49085
49534
|
const { replace_with, ...comment } = input;
|
|
49086
|
-
return this.#
|
|
49535
|
+
return this.#write("POST", ["api", "v1", "artifacts", id, "comments"], WRITE_ROWS.artifactSuggest, {
|
|
49087
49536
|
...comment,
|
|
49088
49537
|
suggestion: { replace_with }
|
|
49089
49538
|
});
|
|
49090
49539
|
}
|
|
49091
49540
|
async message(issue, input) {
|
|
49092
|
-
return this.#
|
|
49541
|
+
return this.#write("POST", ["api", "v1", "issues", await this.#resolveIssue(issue), "messages"], WRITE_ROWS.message, input);
|
|
49093
49542
|
}
|
|
49094
49543
|
async agentMessage(sessionId, input) {
|
|
49095
|
-
return this.#
|
|
49544
|
+
return this.#write("POST", ["api", "v1", "agents", sessionId, "messages"], WRITE_ROWS.agentMessage, input);
|
|
49096
49545
|
}
|
|
49097
49546
|
async messageReply(id, input, options = {}) {
|
|
49098
|
-
return this.#
|
|
49547
|
+
return this.#write("POST", ["api", "v1", "messages", id, "reply"], WRITE_ROWS.messageReply, input, { query: options.followUp === true ? { follow_up: "true" } : undefined });
|
|
49099
49548
|
}
|
|
49100
49549
|
async deliveryReply(resource, id, input, options = {}) {
|
|
49101
49550
|
const collection = resource === "message" ? "messages" : "comments";
|
|
49102
|
-
await this.#
|
|
49551
|
+
await this.#write("POST", ["api", "v1", collection, id, "reply"], WRITE_ROWS.deliveryReply, input, { query: options.followUp === true ? { follow_up: "true" } : undefined });
|
|
49103
49552
|
}
|
|
49104
49553
|
async getMessage(issue, id) {
|
|
49105
49554
|
return this.#json("GET", [
|
|
@@ -49115,7 +49564,7 @@ class DispatchClient {
|
|
|
49115
49564
|
return this.#json("GET", ["api", "v1", "messages", id], undefined, session === undefined ? undefined : { session });
|
|
49116
49565
|
}
|
|
49117
49566
|
async editMessage(id, input) {
|
|
49118
|
-
return this.#
|
|
49567
|
+
return this.#write("PATCH", ["api", "v1", "messages", id], WRITE_ROWS.editMessage, input);
|
|
49119
49568
|
}
|
|
49120
49569
|
async deleteMessage(id, actor) {
|
|
49121
49570
|
return this.#json("DELETE", ["api", "v1", "messages", id], { actor });
|
|
@@ -49127,10 +49576,10 @@ class DispatchClient {
|
|
|
49127
49576
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "messages"]);
|
|
49128
49577
|
}
|
|
49129
49578
|
async acceptMessageDelivery(id, attempt, input) {
|
|
49130
|
-
return this.#
|
|
49579
|
+
return this.#write("POST", ["api", "v1", "messages", id, "deliveries", String(attempt), "accept"], WRITE_ROWS.acceptMessageDelivery, input);
|
|
49131
49580
|
}
|
|
49132
49581
|
async artifact(issue, input) {
|
|
49133
|
-
return this.#upload(["api", "v1", "issues", await this.#resolveIssue(issue), "artifacts"], input);
|
|
49582
|
+
return this.#upload(["api", "v1", "issues", await this.#resolveIssue(issue), "artifacts"], input, WRITE_ROWS.artifact);
|
|
49134
49583
|
}
|
|
49135
49584
|
async getArtifact(id) {
|
|
49136
49585
|
return this.#json("GET", ["api", "v1", "artifacts", id]);
|
|
@@ -49172,10 +49621,12 @@ class DispatchClient {
|
|
|
49172
49621
|
return this.#json("GET", ["api", "v1", "messages", id, "blocks"], undefined, session === undefined ? undefined : { session });
|
|
49173
49622
|
}
|
|
49174
49623
|
async docEdit(id, input, key) {
|
|
49175
|
-
return this.#
|
|
49624
|
+
return this.#write("POST", ["api", "v1", "artifacts", id, "edits"], WRITE_ROWS.docEdit, input, {
|
|
49625
|
+
key
|
|
49626
|
+
});
|
|
49176
49627
|
}
|
|
49177
49628
|
async nameArtifactVersion(id, input) {
|
|
49178
|
-
return this.#
|
|
49629
|
+
return this.#write("POST", ["api", "v1", "artifacts", id, "versions"], WRITE_ROWS.nameArtifactVersion, input);
|
|
49179
49630
|
}
|
|
49180
49631
|
async getArtifactEvents(id, after = 0, limit = 200) {
|
|
49181
49632
|
return this.#json("GET", ["api", "v1", "artifacts", id, "events"], undefined, { after, limit });
|
|
@@ -49196,10 +49647,12 @@ class DispatchClient {
|
|
|
49196
49647
|
return this.#json("GET", ["api", "v1", "comments", id]);
|
|
49197
49648
|
}
|
|
49198
49649
|
async resolveComment(id, actor) {
|
|
49199
|
-
return this.#
|
|
49650
|
+
return this.#write("POST", ["api", "v1", "comments", id, "resolve"], WRITE_ROWS.resolveComment, {
|
|
49651
|
+
actor
|
|
49652
|
+
});
|
|
49200
49653
|
}
|
|
49201
49654
|
async editComment(id, input) {
|
|
49202
|
-
return this.#
|
|
49655
|
+
return this.#write("PATCH", ["api", "v1", "comments", id], WRITE_ROWS.editComment, input);
|
|
49203
49656
|
}
|
|
49204
49657
|
async deleteComment(id, actor) {
|
|
49205
49658
|
return this.#json("DELETE", ["api", "v1", "comments", id], { actor });
|
|
@@ -49211,7 +49664,7 @@ class DispatchClient {
|
|
|
49211
49664
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "comments"]);
|
|
49212
49665
|
}
|
|
49213
49666
|
async writeHandoff(issue, phase, input) {
|
|
49214
|
-
return this.#
|
|
49667
|
+
return this.#write("POST", ["api", "v1", "issues", await this.#resolveIssue(issue), "handoffs", phase], WRITE_ROWS.writeHandoff, input);
|
|
49215
49668
|
}
|
|
49216
49669
|
async listHandoffs(issue) {
|
|
49217
49670
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "handoffs"]);
|
|
@@ -49246,6 +49699,60 @@ class DispatchClient {
|
|
|
49246
49699
|
...query.since === undefined ? {} : { since: query.since }
|
|
49247
49700
|
});
|
|
49248
49701
|
}
|
|
49702
|
+
#writePayload(method, url, answer, write) {
|
|
49703
|
+
const stores = rowStores(write.row);
|
|
49704
|
+
if (!answer.response.ok) {
|
|
49705
|
+
if (!stores && answer.echoed && answer.code === IDEMPOTENCY_KEY_COMMITTED)
|
|
49706
|
+
throw this.#missingWriteAnswer(method, url, answer.response, write, answer.text);
|
|
49707
|
+
return this.#payloadOf(method, url, answer);
|
|
49708
|
+
}
|
|
49709
|
+
if (NULL_BODY_STATUSES.has(answer.response.status) && !stores)
|
|
49710
|
+
return this.#payloadOf(method, url, answer);
|
|
49711
|
+
const value = answer.json?.value;
|
|
49712
|
+
const replayed = answer.response.headers.get(IDEMPOTENCY_REPLAYED_HEADER)?.trim() === "?1";
|
|
49713
|
+
if (answerNotKept(answer.response.status, replayed, value)) {
|
|
49714
|
+
throw this.#missingWriteAnswer(method, url, answer.response, write, answer.text, undefined, IDEMPOTENCY_ANSWER_NOT_KEPT);
|
|
49715
|
+
}
|
|
49716
|
+
const parsed = write.row.safeParse(value);
|
|
49717
|
+
if (!parsed.success)
|
|
49718
|
+
throw this.#missingWriteAnswer(method, url, answer.response, write, answer.text, parsed.error);
|
|
49719
|
+
return value;
|
|
49720
|
+
}
|
|
49721
|
+
#missingWriteAnswer(method, url, response, write, text, cause, code = DISPATCH_ANSWER_LOST) {
|
|
49722
|
+
const shown = requestForText(this.#baseUrl, url, DISPATCH_URL_SETTING);
|
|
49723
|
+
if (!rowStores(write.row))
|
|
49724
|
+
return code === IDEMPOTENCY_ANSWER_NOT_KEPT && keyEchoed(response, write.key) ? new DispatchAnswerNotKeptError(response.status, method, shown) : new DispatchAnswerMissingError(response.status, method, shown, { cause });
|
|
49725
|
+
if (keyEchoed(response, write.key))
|
|
49726
|
+
return new DispatchWriteLandedError(code, response.status, method, shown, { cause });
|
|
49727
|
+
const names = keyNamedBack(response) === "" ? "naming no key back" : "naming another request's key back";
|
|
49728
|
+
return new DispatchWriteUnsettledError(this.#gatewayError(method, url, response, text, "the write's answer", {
|
|
49729
|
+
advice: "the write may have reached Dispatch behind what answered it",
|
|
49730
|
+
also: `${names}, `
|
|
49731
|
+
}), write.progress.sent, write.key);
|
|
49732
|
+
}
|
|
49733
|
+
async#writeAnswer(method, path, row, body, options = {}) {
|
|
49734
|
+
const url = this.#url(path, options.query);
|
|
49735
|
+
const write = this.#writeCall(method, url, row, options.key);
|
|
49736
|
+
const answer = await this.#sendWrite(method, url, body === undefined ? undefined : { content: JSON.stringify(body), type: "application/json" }, "application/json", undefined, write, options.via);
|
|
49737
|
+
return {
|
|
49738
|
+
status: answer.response.status,
|
|
49739
|
+
payload: this.#writePayload(method, url, answer, write)
|
|
49740
|
+
};
|
|
49741
|
+
}
|
|
49742
|
+
async#write(method, path, row, body, options = {}) {
|
|
49743
|
+
return (await this.#writeAnswer(method, path, row, body, options)).payload;
|
|
49744
|
+
}
|
|
49745
|
+
async specCheckResults(project, commit, check) {
|
|
49746
|
+
return this.#json("GET", ["api", "v1", "projects", project, "results"], undefined, {
|
|
49747
|
+
commit,
|
|
49748
|
+
check
|
|
49749
|
+
});
|
|
49750
|
+
}
|
|
49751
|
+
async recordSpecCheckResult(project, input) {
|
|
49752
|
+
const { commit, check, verdict, observed } = input;
|
|
49753
|
+
const body = { commit, check, verdict, observed };
|
|
49754
|
+
return this.#write("POST", ["api", "v1", "projects", project, "results"], WRITE_ROWS.recordSpecCheckResult, body);
|
|
49755
|
+
}
|
|
49249
49756
|
async#resolveIssue(issueReference) {
|
|
49250
49757
|
if (!issueReference.includes("#"))
|
|
49251
49758
|
return issueReference;
|
|
@@ -49263,21 +49770,12 @@ class DispatchClient {
|
|
|
49263
49770
|
throw error;
|
|
49264
49771
|
}
|
|
49265
49772
|
}
|
|
49266
|
-
async#json(method, path, body, query, signal
|
|
49267
|
-
return (await this.#jsonAnswer(method, path, body, { query, signal, key })).payload;
|
|
49268
|
-
}
|
|
49269
|
-
async#jsonAnswer(method, path, body, options = {}) {
|
|
49270
|
-
const { query, signal, key, writes = true, via } = options;
|
|
49773
|
+
async#json(method, path, body, query, signal) {
|
|
49271
49774
|
const url = this.#url(path, query);
|
|
49272
49775
|
const encoded = body === undefined ? undefined : { content: JSON.stringify(body), type: "application/json" };
|
|
49273
|
-
const write = this.#writeCall(method, url, key, writes);
|
|
49274
|
-
if (write !== undefined) {
|
|
49275
|
-
const answer = await this.#write(method, url, encoded, "application/json", signal, write, via);
|
|
49276
|
-
return { status: answer.response.status, payload: this.#payloadOf(method, url, answer) };
|
|
49277
|
-
}
|
|
49278
49776
|
return this.#noRoute(async () => {
|
|
49279
49777
|
const { answer: response } = await this.#send(method, url, encoded, undefined, signal);
|
|
49280
|
-
return
|
|
49778
|
+
return this.#response(method, url, response);
|
|
49281
49779
|
}, signal);
|
|
49282
49780
|
}
|
|
49283
49781
|
async#noRoute(attempt, signal) {
|
|
@@ -49294,19 +49792,17 @@ class DispatchClient {
|
|
|
49294
49792
|
return error;
|
|
49295
49793
|
return refuse(`POST /${path.map((segment) => encodeURIComponent(segment)).join("/")}`);
|
|
49296
49794
|
}
|
|
49297
|
-
#writeCall(method, url,
|
|
49298
|
-
if (method !== "POST" && method !== "PATCH")
|
|
49299
|
-
return;
|
|
49795
|
+
#writeCall(method, url, row, key) {
|
|
49300
49796
|
return {
|
|
49301
49797
|
key: key ?? crypto.randomUUID(),
|
|
49302
49798
|
request: `${method} ${requestForText(this.#baseUrl, url, DISPATCH_URL_SETTING)}`,
|
|
49303
|
-
|
|
49304
|
-
progress: { sent: 0, running: false
|
|
49799
|
+
row,
|
|
49800
|
+
progress: { sent: 0, running: false }
|
|
49305
49801
|
};
|
|
49306
49802
|
}
|
|
49307
|
-
async#upload(path, input, key) {
|
|
49803
|
+
async#upload(path, input, row, key) {
|
|
49308
49804
|
if (input.file === undefined) {
|
|
49309
|
-
return this.#
|
|
49805
|
+
return this.#write("POST", path, row, input, { key });
|
|
49310
49806
|
}
|
|
49311
49807
|
const form = new FormData;
|
|
49312
49808
|
form.set("name", input.name);
|
|
@@ -49317,31 +49813,24 @@ class DispatchClient {
|
|
|
49317
49813
|
if (input.actor !== undefined)
|
|
49318
49814
|
form.set("actor", JSON.stringify(input.actor));
|
|
49319
49815
|
form.set("file", input.file, input.name);
|
|
49320
|
-
return this.#form(
|
|
49816
|
+
return this.#form(path, form, row, key);
|
|
49321
49817
|
}
|
|
49322
|
-
async#form(
|
|
49818
|
+
async#form(path, form, row, key) {
|
|
49323
49819
|
const url = this.#url(path);
|
|
49324
49820
|
const encoded = new Response(form);
|
|
49325
49821
|
const type = encoded.headers.get("Content-Type") ?? "multipart/form-data";
|
|
49326
49822
|
const body = { content: new Uint8Array(await encoded.arrayBuffer()), type };
|
|
49327
|
-
const write = this.#writeCall(
|
|
49328
|
-
|
|
49329
|
-
|
|
49330
|
-
return this.#payloadOf(method, url, answer);
|
|
49331
|
-
}
|
|
49332
|
-
return this.#noRoute(async () => this.#response(method, url, (await this.#send(method, url, body)).answer));
|
|
49823
|
+
const write = this.#writeCall("POST", url, row, key);
|
|
49824
|
+
const answer = await this.#sendWrite("POST", url, body, "application/json", undefined, write);
|
|
49825
|
+
return this.#writePayload("POST", url, answer, write);
|
|
49333
49826
|
}
|
|
49334
|
-
async#writingNothing(path,
|
|
49827
|
+
async#writingNothing(path, row, body) {
|
|
49335
49828
|
for (let keys = 1;; keys++) {
|
|
49336
49829
|
try {
|
|
49337
|
-
return
|
|
49830
|
+
return await this.#write("POST", path, row, body);
|
|
49338
49831
|
} catch (error) {
|
|
49339
|
-
if (!(error instanceof
|
|
49832
|
+
if (!(error instanceof DispatchAnswerNotKeptError) || keys === 2)
|
|
49340
49833
|
throw error;
|
|
49341
|
-
}
|
|
49342
|
-
if (keys === 2) {
|
|
49343
|
-
throw new DispatchAnswerNotKeptError(error.status, "POST", requestForText(this.#baseUrl, this.#url(path), DISPATCH_URL_SETTING));
|
|
49344
|
-
}
|
|
49345
49834
|
}
|
|
49346
49835
|
}
|
|
49347
49836
|
}
|
|
@@ -49413,9 +49902,10 @@ class DispatchClient {
|
|
|
49413
49902
|
});
|
|
49414
49903
|
return { answer, presented };
|
|
49415
49904
|
}
|
|
49416
|
-
async#
|
|
49905
|
+
async#sendWrite(method, url, body, accept, signal, write, via) {
|
|
49417
49906
|
const limit = signal === undefined ? this.#signal : AbortSignal.any([this.#signal, signal]);
|
|
49418
49907
|
const { key, progress } = write;
|
|
49908
|
+
const stores = rowStores(write.row);
|
|
49419
49909
|
const credential = via?.credential ?? this.#credential;
|
|
49420
49910
|
const headers = { Accept: accept, [IDEMPOTENCY_KEY_HEADER]: key };
|
|
49421
49911
|
if (body !== undefined)
|
|
@@ -49462,18 +49952,17 @@ class DispatchClient {
|
|
|
49462
49952
|
response = await this.#attempt(url, method, { ...headers, ...presented }, body, silenceMs, limit, via?.init);
|
|
49463
49953
|
} catch (error) {
|
|
49464
49954
|
return {
|
|
49465
|
-
event: stoppedEvent(limit, true, error) ?? (error instanceof WriteAttemptSilent ? "silence" : error instanceof DispatchUnreachableError && error.reachedNothing ? "unreached" : "reset"),
|
|
49955
|
+
event: stoppedEvent(limit, true, error) ?? (error instanceof AirlockTunnelRefusedError ? proxyEvent(error.status, false) : error instanceof WriteAttemptSilent ? "silence" : error instanceof DispatchUnreachableError && error.reachedNothing ? "unreached" : "reset"),
|
|
49466
49956
|
failure: error,
|
|
49467
49957
|
presented,
|
|
49468
49958
|
sent
|
|
49469
49959
|
};
|
|
49470
49960
|
}
|
|
49961
|
+
const echoed = keyEchoed(response, key);
|
|
49471
49962
|
const heard = { retryAfterMs: retryAfterMs(response.headers) };
|
|
49472
|
-
if (response.headers.get(IDEMPOTENCY_KEY_HEADER) === key)
|
|
49473
|
-
progress.keyEchoed = true;
|
|
49474
49963
|
let answer;
|
|
49475
49964
|
try {
|
|
49476
|
-
answer = await writeAnswer(response);
|
|
49965
|
+
answer = await writeAnswer(response, echoed);
|
|
49477
49966
|
} catch (error) {
|
|
49478
49967
|
const stop = stoppedEvent(limit, true, error);
|
|
49479
49968
|
return {
|
|
@@ -49485,7 +49974,7 @@ class DispatchClient {
|
|
|
49485
49974
|
};
|
|
49486
49975
|
}
|
|
49487
49976
|
return {
|
|
49488
|
-
event: answerEvent(answer,
|
|
49977
|
+
event: answerEvent(answer, credential.stale !== undefined && !deadTokenTold),
|
|
49489
49978
|
answer,
|
|
49490
49979
|
presented,
|
|
49491
49980
|
sent,
|
|
@@ -49503,13 +49992,14 @@ class DispatchClient {
|
|
|
49503
49992
|
return result;
|
|
49504
49993
|
};
|
|
49505
49994
|
const waitStopped = (error) => ({
|
|
49995
|
+
...state === "nothing-sent" && error instanceof Error && error.name === "TimeoutError" ? last : {},
|
|
49506
49996
|
event: stoppedEvent(limit, false, error) ?? "cancelled",
|
|
49507
49997
|
failure: error
|
|
49508
49998
|
});
|
|
49509
49999
|
let last = await next();
|
|
49510
50000
|
let event = last.event;
|
|
49511
50001
|
for (;; ) {
|
|
49512
|
-
const step = writeStep(state, event,
|
|
50002
|
+
const step = writeStep(state, event, stores);
|
|
49513
50003
|
state = step.state;
|
|
49514
50004
|
if ((event === "silence" || event === "in-flight") && !upload)
|
|
49515
50005
|
progress.running = true;
|
|
@@ -49601,9 +50091,6 @@ class DispatchClient {
|
|
|
49601
50091
|
} catch (error) {
|
|
49602
50092
|
if (cut.signal.aborted && !limit.aborted)
|
|
49603
50093
|
throw cut.signal.reason;
|
|
49604
|
-
const refused = transport === undefined ? undefined : proxyTunnelAnswer(error);
|
|
49605
|
-
if (refused !== undefined)
|
|
49606
|
-
return refused;
|
|
49607
50094
|
throw error;
|
|
49608
50095
|
} finally {
|
|
49609
50096
|
answered = true;
|
|
@@ -49612,15 +50099,22 @@ class DispatchClient {
|
|
|
49612
50099
|
}
|
|
49613
50100
|
async#endWrite(method, url, state, event, answer, failure, write, routeSpent, via) {
|
|
49614
50101
|
const { request, progress } = write;
|
|
50102
|
+
if (answer?.response.status === 409 && answer.code === IDEMPOTENCY_KEY_COMMITTED && !answer.echoed) {
|
|
50103
|
+
return this.#missingWriteAnswer(method, url, answer.response, write, answer.text);
|
|
50104
|
+
}
|
|
49615
50105
|
let own = failure;
|
|
49616
|
-
|
|
49617
|
-
|
|
49618
|
-
|
|
50106
|
+
if (answer?.proxy !== undefined) {
|
|
50107
|
+
own = via === undefined ? this.#airlockAnswer(answer, answer.proxy) : this.#proxyRefusal(request, via, answer.response.status, answer.proxy.code, answer.text, state, event);
|
|
50108
|
+
} else if (via !== undefined && failure instanceof AirlockTunnelRefusedError) {
|
|
50109
|
+
own = this.#proxyRefusal(request, via, failure.status, failure.proxyCode ?? failure.code, "", state, event);
|
|
49619
50110
|
} else if (via !== undefined && failure instanceof DispatchUnreachableError) {
|
|
49620
50111
|
own = this.#proxyUnreachable(via, failure, state);
|
|
49621
50112
|
} else if (answer?.response.ok === true) {
|
|
50113
|
+
if (!answer.echoed || !rowStores(write.row)) {
|
|
50114
|
+
return this.#missingWriteAnswer(method, url, answer.response, write, answer.text);
|
|
50115
|
+
}
|
|
49622
50116
|
const { status } = answer.response;
|
|
49623
|
-
own = new Error(answer.notJson ? `${request} answered ${status} with ${bodyForText(answer.text, this.#sent.with(this.token), "JSON")}, though every Dispatch write answers JSON, so something in Dispatch's place answered` :
|
|
50117
|
+
own = new Error(answer.notJson ? `${request} answered ${status} with ${bodyForText(answer.text, this.#sent.with(this.token), "JSON")}, though every Dispatch write answers JSON, so something in Dispatch's place answered` : `${request} answered ${status} with a body that is not the JSON its Content-Type says`);
|
|
49624
50118
|
} else if (answer !== undefined) {
|
|
49625
50119
|
own = event === "no-route" && routeSpent ? new DispatchNoRouteError : this.#payloadOrError(method, url, answer);
|
|
49626
50120
|
}
|
|
@@ -49628,7 +50122,7 @@ class DispatchClient {
|
|
|
49628
50122
|
return own;
|
|
49629
50123
|
const last = own instanceof Error ? own : new Error(String(own));
|
|
49630
50124
|
let unanswered;
|
|
49631
|
-
if (answer === undefined) {
|
|
50125
|
+
if (answer === undefined || answer.proxy !== undefined) {
|
|
49632
50126
|
switch (event) {
|
|
49633
50127
|
case "silence":
|
|
49634
50128
|
unanswered = `${request} ${last.message}`;
|
|
@@ -49658,14 +50152,21 @@ class DispatchClient {
|
|
|
49658
50152
|
const again = state === "nothing-sent" ? " The review can be sent again once the broker answers." : "";
|
|
49659
50153
|
return new DispatchUnreachableError(`Dispatch at ${urlForText(this.#baseUrl, DISPATCH_URL_SETTING)}, through Cipher's proxy at ${originOf(via.init.proxy)}, is unreachable: ${failure.failure}. The proxy is the secrets broker's.${again}`, failure.reachedNothing, failure.failure);
|
|
49660
50154
|
}
|
|
49661
|
-
#proxyRefusal(request, via,
|
|
49662
|
-
const
|
|
49663
|
-
const said = excerpt(answer.text, this.#sent.with(this.token));
|
|
50155
|
+
#proxyRefusal(request, via, status, code, text, state, event) {
|
|
50156
|
+
const said = excerpt(text, this.#sent.with(this.token));
|
|
49664
50157
|
const by = `${request} was answered ${status} ${code} by Cipher's proxy at ${originOf(via.init.proxy)}${said === "" ? "" : ` (${JSON.stringify(said)})`}`;
|
|
49665
50158
|
const message = state !== "nothing-sent" ? event === "proxy-unsettled" ? `${by}, after this attempt may have reached Dispatch` : `${by} before this attempt left the proxy, after an earlier attempt of the review may have reached Dispatch` : event === "proxy-failed" ? `${by} before any of it left the proxy, so nothing reached Dispatch. The proxy is the secrets broker's, and a new \`dispatch review\` trades a new grant once the broker answers.` : `${by} before any of it left the proxy, so nothing reached Dispatch, and a new \`dispatch review\` trades a new grant.`;
|
|
49666
50159
|
return new DispatchProxyRefusalError(code, status, message);
|
|
49667
50160
|
}
|
|
50161
|
+
#airlockAnswer(answer, proxy) {
|
|
50162
|
+
const body = excerpt(answer.text, this.#sent.with(this.token));
|
|
50163
|
+
const { status } = answer.response;
|
|
50164
|
+
return proxy.left ? new AirlockOutcomeUnknownError(status, proxy.code, body) : new AirlockRefusedError(status, proxy.code, body);
|
|
50165
|
+
}
|
|
49668
50166
|
#url(path, query) {
|
|
50167
|
+
if (path.some((segment) => pathNamesNothingPattern.test(segment))) {
|
|
50168
|
+
throw new DispatchEmptyPathError(path);
|
|
50169
|
+
}
|
|
49669
50170
|
const url = new URL(`${path.map((segment) => encodeURIComponent(segment)).join("/")}`, `${this.#baseUrl}/`);
|
|
49670
50171
|
if (query) {
|
|
49671
50172
|
for (const [name, value] of Object.entries(query)) {
|
|
@@ -49695,7 +50196,7 @@ class DispatchClient {
|
|
|
49695
50196
|
throw new DispatchServiceError(refusal.code ?? `HTTP_${response.status}`, response.status, refusal.error, {
|
|
49696
50197
|
...refusal,
|
|
49697
50198
|
textRefusal: response.headers.has(TEXT_REFUSAL_HEADER)
|
|
49698
|
-
});
|
|
50199
|
+
}, retryAfterMs(response.headers) || null);
|
|
49699
50200
|
}
|
|
49700
50201
|
throw this.#gatewayError(method, url, response, text, "Dispatch's error JSON");
|
|
49701
50202
|
}
|
|
@@ -49715,7 +50216,7 @@ class DispatchClient {
|
|
|
49715
50216
|
return error;
|
|
49716
50217
|
}
|
|
49717
50218
|
}
|
|
49718
|
-
#gatewayError(method, url, response, text, notWhat) {
|
|
50219
|
+
#gatewayError(method, url, response, text, notWhat, caller = {}) {
|
|
49719
50220
|
const tokens = this.#sent.with(this.token);
|
|
49720
50221
|
const body = bodyForText(text, tokens, notWhat);
|
|
49721
50222
|
const reasonPhrase = excerpt(response.statusText, tokens);
|
|
@@ -49723,7 +50224,7 @@ class DispatchClient {
|
|
|
49723
50224
|
const target = redirectOrigin(response, url, tokens);
|
|
49724
50225
|
const redirected = target === undefined ? "" : ` (a redirect to ${target}, which this client does not follow)`;
|
|
49725
50226
|
const request = `${method} ${requestForText(this.#baseUrl, url, DISPATCH_URL_SETTING)}`;
|
|
49726
|
-
return new DispatchGatewayError(response.status, `${request} answered ${response.status}${reason}${redirected} with ${body}, ${GATEWAY_PAGE}`, gatewayAdvice(method, response.status));
|
|
50227
|
+
return new DispatchGatewayError(response.status, `${request} answered ${response.status}${reason}${redirected} with ${body}, ${caller.also ?? ""}${GATEWAY_PAGE}`, caller.advice ?? gatewayAdvice(method, response.status));
|
|
49727
50228
|
}
|
|
49728
50229
|
}
|
|
49729
50230
|
|
|
@@ -50837,6 +51338,28 @@ function parseCommand(argv, io) {
|
|
|
50837
51338
|
}
|
|
50838
51339
|
}
|
|
50839
51340
|
}
|
|
51341
|
+
for (const { field, noun, tools, path } of IDENTIFIER_FIELDS) {
|
|
51342
|
+
const given = args[field];
|
|
51343
|
+
if (tools !== undefined && !tools.includes(tool))
|
|
51344
|
+
continue;
|
|
51345
|
+
const flag = setBy.get(field);
|
|
51346
|
+
for (const value of Array.isArray(given) ? given : [given]) {
|
|
51347
|
+
if (typeof value !== "string")
|
|
51348
|
+
continue;
|
|
51349
|
+
let problem;
|
|
51350
|
+
if (value === "") {
|
|
51351
|
+
problem = `${flag} is empty, so the call names no ${noun}: a variable that gives it may be empty or unset`;
|
|
51352
|
+
} else if (goBlankPattern.test(value)) {
|
|
51353
|
+
problem = `${flag} is only white space, so the call names no ${noun}`;
|
|
51354
|
+
} else if (path === true && pathNamesNothingPattern.test(value)) {
|
|
51355
|
+
problem = `${flag} is "${value.replace(goSpaceAtEnds, "")}", only dots and slashes, so the call names no ${noun}`;
|
|
51356
|
+
}
|
|
51357
|
+
if (problem === undefined)
|
|
51358
|
+
continue;
|
|
51359
|
+
problems.push(problem);
|
|
51360
|
+
break;
|
|
51361
|
+
}
|
|
51362
|
+
}
|
|
50840
51363
|
if (help)
|
|
50841
51364
|
return { kind: "help", tool };
|
|
50842
51365
|
if (problems.length > 0) {
|
|
@@ -50861,6 +51384,18 @@ function appendedItem(kind, flag, value, number) {
|
|
|
50861
51384
|
return parsed === undefined ? undefined : { value: parsed };
|
|
50862
51385
|
}
|
|
50863
51386
|
var ISSUE_KEY2 = /^[A-Z][A-Z0-9]*-\d+$/;
|
|
51387
|
+
var IDENTIFIER_FIELDS = [
|
|
51388
|
+
{ field: "issue", noun: "issue", path: true },
|
|
51389
|
+
{ field: "project", noun: "project", path: true },
|
|
51390
|
+
{ field: "artifact", noun: "document", path: true },
|
|
51391
|
+
{ field: "check", noun: "check" },
|
|
51392
|
+
{ field: "commit", noun: "commit" },
|
|
51393
|
+
{ field: "at", noun: "commit" },
|
|
51394
|
+
{ field: "retract", noun: "result", path: true },
|
|
51395
|
+
{ field: "comment", noun: "comment", path: true },
|
|
51396
|
+
{ field: "session", noun: "session", path: true },
|
|
51397
|
+
{ field: "parent", noun: "parent", tools: ["dispatch_issues", "dispatch_issue"] }
|
|
51398
|
+
];
|
|
50864
51399
|
function quoteWord(value) {
|
|
50865
51400
|
return BARE_WORD.test(value) ? value : `'${value.replaceAll("'", "'\\''")}'`;
|
|
50866
51401
|
}
|
|
@@ -55812,6 +56347,40 @@ function notMadeLine(reason, context, searchQuery) {
|
|
|
55812
56347
|
return `No related-item check was made: ${reason}. Search before you rely on this being new: dispatch search --project ${context.project}${query}`;
|
|
55813
56348
|
}
|
|
55814
56349
|
|
|
56350
|
+
// ../envoy-client/src/runner-log.ts
|
|
56351
|
+
var ESCAPED = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}\p{Cs}]/gu;
|
|
56352
|
+
var JSON_ESCAPED = /[\u007f-\u009f\p{Cf}\p{Zl}\p{Zp}]/gu;
|
|
56353
|
+
var SHORT_ESCAPES = {
|
|
56354
|
+
"\x07": "\\a",
|
|
56355
|
+
"\b": "\\b",
|
|
56356
|
+
"\f": "\\f",
|
|
56357
|
+
"\n": "\\n",
|
|
56358
|
+
"\r": "\\r",
|
|
56359
|
+
"\t": "\\t",
|
|
56360
|
+
"\v": "\\v"
|
|
56361
|
+
};
|
|
56362
|
+
function hex3(value, digits) {
|
|
56363
|
+
return value.toString(16).padStart(digits, "0");
|
|
56364
|
+
}
|
|
56365
|
+
function goEscape(character) {
|
|
56366
|
+
const short = SHORT_ESCAPES[character];
|
|
56367
|
+
if (short !== undefined)
|
|
56368
|
+
return short;
|
|
56369
|
+
const point = character.codePointAt(0) ?? 0;
|
|
56370
|
+
if (point < 32 || point === 127)
|
|
56371
|
+
return `\\x${hex3(point, 2)}`;
|
|
56372
|
+
return point > 65535 ? `\\U${hex3(point, 8)}` : `\\u${hex3(point, 4)}`;
|
|
56373
|
+
}
|
|
56374
|
+
function printable2(text) {
|
|
56375
|
+
return text.replace(ESCAPED, goEscape).replaceAll("##[", "##\\x5b");
|
|
56376
|
+
}
|
|
56377
|
+
function printableLine(text) {
|
|
56378
|
+
return printable2(text).replace(/^(\s*):(?=:)/u, "$1\\x3a");
|
|
56379
|
+
}
|
|
56380
|
+
function printableJson(json) {
|
|
56381
|
+
return json.replace(JSON_ESCAPED, (character) => Array.from({ length: character.length }, (_, unit) => `\\u${hex3(character.charCodeAt(unit), 4)}`).join("")).replaceAll("##[", "##\\u005b");
|
|
56382
|
+
}
|
|
56383
|
+
|
|
55815
56384
|
// ../envoy-client/src/dispatch-commands/advice.ts
|
|
55816
56385
|
var triageAdviceShown = new Set;
|
|
55817
56386
|
function adviceMemory() {
|
|
@@ -55922,6 +56491,31 @@ async function otherAdviceLines(render) {
|
|
|
55922
56491
|
}
|
|
55923
56492
|
}
|
|
55924
56493
|
|
|
56494
|
+
// ../envoy-client/src/dispatch-commands/observed-text.ts
|
|
56495
|
+
function lengthOfFirst(text, count) {
|
|
56496
|
+
let at = 0;
|
|
56497
|
+
for (let seen = 0;seen < count && at < text.length; seen += 1) {
|
|
56498
|
+
at += (text.codePointAt(at) ?? 0) > 65535 ? 2 : 1;
|
|
56499
|
+
}
|
|
56500
|
+
return at < text.length ? at : undefined;
|
|
56501
|
+
}
|
|
56502
|
+
function startOfLast(text, count) {
|
|
56503
|
+
let at = text.length;
|
|
56504
|
+
for (let seen = 0;seen < count && at > 0; seen += 1) {
|
|
56505
|
+
const low = text.charCodeAt(at - 1);
|
|
56506
|
+
const high = at > 1 ? text.charCodeAt(at - 2) : 0;
|
|
56507
|
+
at -= low >= 56320 && low <= 57343 && high >= 55296 && high <= 56319 ? 2 : 1;
|
|
56508
|
+
}
|
|
56509
|
+
return at;
|
|
56510
|
+
}
|
|
56511
|
+
function observedAsKept(observed) {
|
|
56512
|
+
const text = observed.replaceAll("\x00", "\uFFFD");
|
|
56513
|
+
if (lengthOfFirst(text, SPEC_CHECK_OBSERVED_MAX) === undefined)
|
|
56514
|
+
return text;
|
|
56515
|
+
const start = text.slice(0, lengthOfFirst(text, SPEC_CHECK_OBSERVED_START));
|
|
56516
|
+
return `${start}${SPEC_CHECK_OBSERVED_CUT_NOTE}${text.slice(startOfLast(text, SPEC_CHECK_OBSERVED_END))}`;
|
|
56517
|
+
}
|
|
56518
|
+
|
|
55925
56519
|
// ../envoy-client/src/dispatch-commands/render-graph.ts
|
|
55926
56520
|
function referenceLines(read) {
|
|
55927
56521
|
if (typeof read === "string")
|
|
@@ -57197,11 +57791,54 @@ async function issuesCommand(context) {
|
|
|
57197
57791
|
};
|
|
57198
57792
|
}
|
|
57199
57793
|
function dryRunAsksDispatch(tool, args) {
|
|
57200
|
-
const { retract } = args;
|
|
57201
|
-
return tool === "dispatch_result" && retract === undefined;
|
|
57794
|
+
const { retract, project } = args;
|
|
57795
|
+
return tool === "dispatch_result" && retract === undefined && project === undefined;
|
|
57796
|
+
}
|
|
57797
|
+
async function specCheckResultCommand(client, args) {
|
|
57798
|
+
const project = stringArg(args, "project");
|
|
57799
|
+
const observed = optionalString(args, "observed");
|
|
57800
|
+
const stored = await client.recordSpecCheckResult(project, {
|
|
57801
|
+
commit: stringArg(args, "commit"),
|
|
57802
|
+
check: stringArg(args, "check"),
|
|
57803
|
+
verdict: stringArg(args, "verdict"),
|
|
57804
|
+
...observed === undefined ? {} : { observed: observedAsKept(observed) }
|
|
57805
|
+
});
|
|
57806
|
+
const { predicate } = stored.attestation;
|
|
57807
|
+
return {
|
|
57808
|
+
text: JSON.stringify(stored, null, 2),
|
|
57809
|
+
details: {
|
|
57810
|
+
project,
|
|
57811
|
+
result: stored.id,
|
|
57812
|
+
seq: stored.seq,
|
|
57813
|
+
check: predicate.check,
|
|
57814
|
+
verdict: predicate.verdict
|
|
57815
|
+
}
|
|
57816
|
+
};
|
|
57817
|
+
}
|
|
57818
|
+
function specCheckResultLine(result) {
|
|
57819
|
+
const { predicate, subject } = result.attestation;
|
|
57820
|
+
const leg = predicate.leg === "" ? "no leg" : `leg ${printable2(predicate.leg)}`;
|
|
57821
|
+
const commit = subject?.[0]?.digest?.["gitCommit"] ?? "an unnamed commit";
|
|
57822
|
+
return `- #${result.seq} ${printable2(predicate.check)}: ${printable2(predicate.verdict)}. Job ${printable2(predicate.job)}, ${leg}, run ${printable2(predicate.run.run_id)} attempt ${predicate.run.attempt}, commit ${printable2(commit)}.`;
|
|
57823
|
+
}
|
|
57824
|
+
async function specCheckResultsCommand(client, args) {
|
|
57825
|
+
const project = stringArg(args, "project");
|
|
57826
|
+
const commit = stringArg(args, "commit");
|
|
57827
|
+
const check = optionalString(args, "check");
|
|
57828
|
+
const results = (await client.specCheckResults(project, commit, check)).results ?? [];
|
|
57829
|
+
const what = check === undefined ? project : `check ${printable2(check)} of ${project}`;
|
|
57830
|
+
const text = optionalBoolean(args, "json") === true ? printableJson(JSON.stringify(results, null, 2)) : results.length === 0 ? `No result of ${what} is stored at ${printable2(commit)}.` : [
|
|
57831
|
+
`Results of ${what} at ${printable2(commit)}, newest first:`,
|
|
57832
|
+
...results.map(specCheckResultLine)
|
|
57833
|
+
].join(`
|
|
57834
|
+
`);
|
|
57835
|
+
return { text, details: { project, commit, results: results.length } };
|
|
57202
57836
|
}
|
|
57203
57837
|
async function resultCommand(context) {
|
|
57204
57838
|
const { args, client, actor } = context;
|
|
57839
|
+
if (optionalString(args, "project") !== undefined) {
|
|
57840
|
+
return await specCheckResultCommand(client, args);
|
|
57841
|
+
}
|
|
57205
57842
|
const retract = optionalString(args, "retract");
|
|
57206
57843
|
if (retract !== undefined) {
|
|
57207
57844
|
const retraction = await client.retractResult(retract, {
|
|
@@ -57273,6 +57910,9 @@ ${recorded.line}`,
|
|
|
57273
57910
|
}
|
|
57274
57911
|
async function resultsCommand(context) {
|
|
57275
57912
|
const { args, client } = context;
|
|
57913
|
+
if (optionalString(args, "project") !== undefined) {
|
|
57914
|
+
return await specCheckResultsCommand(client, args);
|
|
57915
|
+
}
|
|
57276
57916
|
const issue = stringArg(args, "issue");
|
|
57277
57917
|
const at = optionalString(args, "at");
|
|
57278
57918
|
const brief = optionalBoolean(args, "brief") === true;
|
|
@@ -57340,6 +57980,7 @@ var WRITE_ROUTES = [
|
|
|
57340
57980
|
{ method: "POST", pattern: "/api/v1/issues/{key}/results", commands: ["result"] },
|
|
57341
57981
|
{ method: "POST", pattern: "/api/v1/issues/{key}/results/dry-run", commands: ["result"] },
|
|
57342
57982
|
{ method: "POST", pattern: "/api/v1/results/{id}/retract", commands: ["result"] },
|
|
57983
|
+
{ method: "POST", pattern: "/api/v1/projects/{key}/results", commands: ["result"] },
|
|
57343
57984
|
{ method: "POST", pattern: "/api/v1/deploys", commands: ["deploy"] },
|
|
57344
57985
|
{ method: "POST", pattern: "/api/v1/issues/{key}/handoffs/{phase}", commands: ["handoff-write"] },
|
|
57345
57986
|
{ method: "POST", pattern: "/api/v1/issues/{key}/artifacts", commands: ["artifact"] },
|
|
@@ -58866,7 +59507,7 @@ async function askRoundTrip(client, route, ask) {
|
|
|
58866
59507
|
}
|
|
58867
59508
|
return {
|
|
58868
59509
|
kind: "unanswered",
|
|
58869
|
-
failure: error instanceof DispatchAnswerNotKeptError ? `${route} wrote nothing, and Dispatch kept no copy of its answer (${error.code})` : `${route} failed with ${messageFor(error)}`,
|
|
59510
|
+
failure: error instanceof DispatchAnswerNotKeptError ? `${route} wrote nothing, and Dispatch kept no copy of its answer (${error.code})` : error instanceof DispatchAnswerMissingError ? `${route} answered without the text it would store (${error.code})` : `${route} failed with ${messageFor(error).replace(/\.$/, "")}`,
|
|
58870
59511
|
error,
|
|
58871
59512
|
routeAbsent
|
|
58872
59513
|
};
|
|
@@ -67111,7 +67752,7 @@ var import_nats5 = __toESM(require_mod4(), 1);
|
|
|
67111
67752
|
|
|
67112
67753
|
// package.json
|
|
67113
67754
|
var name2 = "@sjawhar/claude-envoy";
|
|
67114
|
-
var version2 = "6.
|
|
67755
|
+
var version2 = "6.20.0";
|
|
67115
67756
|
var package_default = {
|
|
67116
67757
|
name: name2,
|
|
67117
67758
|
version: version2,
|
|
@@ -67122,7 +67763,7 @@ var package_default = {
|
|
|
67122
67763
|
repository: { type: "git", url: "https://github.com/cybermonklabs/legion" },
|
|
67123
67764
|
scripts: { channel: "bun bin/envoy-channel.ts", "verify-build": "bash scripts/verify-build.sh", prepack: "bash scripts/pack-skills.sh", postpack: "bash scripts/pack-skills.sh --restore", typecheck: "bun ../contracts/scripts/gen-api.ts && bunx tsc --noEmit", test: "bun test --timeout=60000", lint: "bunx biome check src/ hooks/ scripts/" },
|
|
67124
67765
|
devDependencies: { "@biomejs/biome": "2.5.15", "@legion/cipher-client": "workspace:*", "@legion/contracts": "workspace:*", "@legion/envoy-client": "workspace:*", "@legion/pi-shared": "workspace:*", "@legion/test-fixtures": "workspace:*", "@modelcontextprotocol/sdk": "^1.30.0", "bun-types": "latest", nats: "^2.29.2", typescript: "^5.3.0", zod: "4.3.6" },
|
|
67125
|
-
legion: { daemonApiVersion:
|
|
67766
|
+
legion: { daemonApiVersion: 290 }
|
|
67126
67767
|
};
|
|
67127
67768
|
|
|
67128
67769
|
// ../pi-shared/src/agent-stream.ts
|
|
@@ -69537,7 +70178,8 @@ var LegionAgentActionResponse = object({
|
|
|
69537
70178
|
state: _enum2(LEGION_CLAIM_STATES).optional(),
|
|
69538
70179
|
suspendedBy: legionSuspendedBy.optional(),
|
|
69539
70180
|
suspensionHeld: literal(true).optional(),
|
|
69540
|
-
suspensionHeldBy: legionSuspendedBy.optional()
|
|
70181
|
+
suspensionHeldBy: legionSuspendedBy.optional(),
|
|
70182
|
+
phaseNotRestarted: string2().optional()
|
|
69541
70183
|
});
|
|
69542
70184
|
var LegionPodUpdateRequest = strictObject({
|
|
69543
70185
|
grantId: nonEmptyString2,
|
|
@@ -69622,7 +70264,15 @@ var legionAnsweredPause = object({
|
|
|
69622
70264
|
var LegionPlanRegisterResponse = object({
|
|
69623
70265
|
plan: object({
|
|
69624
70266
|
version: number2().int().positive().optional(),
|
|
69625
|
-
tasks: array(object({
|
|
70267
|
+
tasks: array(object({
|
|
70268
|
+
id: nonEmptyString2.optional(),
|
|
70269
|
+
steps: array(nonEmptyString2).optional(),
|
|
70270
|
+
running: array(object({
|
|
70271
|
+
kind: nonEmptyString2.optional(),
|
|
70272
|
+
place: number2().int().nonnegative().optional(),
|
|
70273
|
+
role: nonEmptyString2.optional()
|
|
70274
|
+
})).optional()
|
|
70275
|
+
})).optional()
|
|
69626
70276
|
}).optional()
|
|
69627
70277
|
});
|
|
69628
70278
|
var LegionProjectPauseResponse = object({
|