@sjawhar/claude-envoy 2.30.2 → 2.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/dist/dispatch.js +35 -14
- package/dist/envoy-channel.js +36 -15
- package/dist/session-hook.js +35 -13
- package/dist/session-title-hook.js +14 -0
- package/hooks/session-hook.ts +6 -2
- package/package.json +1 -1
- package/skills/agent-secrets/SKILL.md +20 -3
package/.omp-plugin/plugin.json
CHANGED
package/dist/dispatch.js
CHANGED
|
@@ -1020,6 +1020,20 @@ function messageFor(error) {
|
|
|
1020
1020
|
function hasErrnoCode(error, code) {
|
|
1021
1021
|
return error instanceof Error && "code" in error && error.code === code;
|
|
1022
1022
|
}
|
|
1023
|
+
function withoutUserinfo(url) {
|
|
1024
|
+
let parsed;
|
|
1025
|
+
try {
|
|
1026
|
+
parsed = new URL(url);
|
|
1027
|
+
} catch {
|
|
1028
|
+
return url.slice(url.lastIndexOf("@") + 1);
|
|
1029
|
+
}
|
|
1030
|
+
if (parsed.username === "" && parsed.password === "")
|
|
1031
|
+
return url;
|
|
1032
|
+
parsed.username = "";
|
|
1033
|
+
parsed.password = "";
|
|
1034
|
+
const shown = parsed.toString();
|
|
1035
|
+
return shown.endsWith("/") && !url.endsWith("/") ? shown.slice(0, -1) : shown;
|
|
1036
|
+
}
|
|
1023
1037
|
|
|
1024
1038
|
// ../envoy-client/src/askgate-marker.ts
|
|
1025
1039
|
var ASKGATE_RECORD = "askgate";
|
|
@@ -18484,7 +18498,8 @@ class DispatchWriteLandedError extends Error {
|
|
|
18484
18498
|
name = "DispatchWriteLandedError";
|
|
18485
18499
|
constructor(code, status, method, url) {
|
|
18486
18500
|
const lost = code === IDEMPOTENCY_ANSWER_NOT_KEPT ? "Dispatch kept no copy of its answer, which was too large" : "its answer was lost on the way back";
|
|
18487
|
-
|
|
18501
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
18502
|
+
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.");
|
|
18488
18503
|
this.code = code;
|
|
18489
18504
|
this.status = status;
|
|
18490
18505
|
}
|
|
@@ -18505,7 +18520,8 @@ class DispatchNoRouteError extends DispatchServiceError {
|
|
|
18505
18520
|
}
|
|
18506
18521
|
}
|
|
18507
18522
|
function reviewNoRouteRefusal(baseUrl, route, version) {
|
|
18508
|
-
|
|
18523
|
+
const shown = withoutUserinfo(baseUrl);
|
|
18524
|
+
return new DispatchServiceError("NOT_FOUND", 404, `Dispatch at ${shown} answered no route for ${route} each time the review was sent, and an ` + "answer of no route records no review. This build is older than that route. No other review " + "route was asked: the review route an older build serves takes no version, and it " + `would record the review at a version that build chooses, which may not be version ${version}. ` + `The no-route answer does not name the build; GET ${shown}/healthz names the commit of the ` + "build that answers it, when that build was stamped with one.");
|
|
18509
18525
|
}
|
|
18510
18526
|
var ISSUE_EVENTS_PAGE_MAX = 200;
|
|
18511
18527
|
var DISPATCH_TOOL_DEADLINE_MS = 60000;
|
|
@@ -18767,7 +18783,8 @@ class DispatchClient {
|
|
|
18767
18783
|
const refusal = whyNotAPage(answer);
|
|
18768
18784
|
if (refusal === undefined)
|
|
18769
18785
|
return answer;
|
|
18770
|
-
|
|
18786
|
+
const url = withoutUserinfo(this.#url(path, query));
|
|
18787
|
+
throw new Error(`GET ${url} asked for a page ({issues, total, limit, offset}) and got ${refusal}`);
|
|
18771
18788
|
}
|
|
18772
18789
|
async listAllIssues(options) {
|
|
18773
18790
|
const path = ["api", "v1", "issues"];
|
|
@@ -18775,7 +18792,8 @@ class DispatchClient {
|
|
|
18775
18792
|
const answer = await this.#json("GET", path, undefined, query);
|
|
18776
18793
|
if (Array.isArray(answer))
|
|
18777
18794
|
return answer;
|
|
18778
|
-
|
|
18795
|
+
const url = withoutUserinfo(this.#url(path, query));
|
|
18796
|
+
throw new Error(`GET ${url} asked for the unpaged listing and got ${whyNotAnArray(answer)}.`);
|
|
18779
18797
|
}
|
|
18780
18798
|
async listIssueArtifacts(issue) {
|
|
18781
18799
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "artifacts"]);
|
|
@@ -19242,7 +19260,7 @@ class DispatchClient {
|
|
|
19242
19260
|
headers[IDEMPOTENCY_KEY_HEADER] = key;
|
|
19243
19261
|
const { pausesMs, withinMs, silenceMs, inFlightPauseMs, inFlightWithinMs } = this.writeRetry;
|
|
19244
19262
|
const pause = this.writeRetry.pause ?? pauseFor;
|
|
19245
|
-
const request = `${method} ${url}`;
|
|
19263
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
19246
19264
|
const started = this.#now();
|
|
19247
19265
|
const bodyBytes = body === undefined ? 0 : typeof body.content === "string" ? Buffer.byteLength(body.content) : body.content.byteLength;
|
|
19248
19266
|
const upload = bodyBytes >= STREAMED_BODY_MIN;
|
|
@@ -19425,7 +19443,8 @@ class DispatchClient {
|
|
|
19425
19443
|
}
|
|
19426
19444
|
const reasonPhrase = excerpt(response.statusText, this.token);
|
|
19427
19445
|
const reason = reasonPhrase === "" ? "" : ` ${reasonPhrase}`;
|
|
19428
|
-
|
|
19446
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
19447
|
+
throw new DispatchGatewayError(response.status, `${request} answered ${response.status}${reason} with ${body}, ${GATEWAY_PAGE}`, gatewayAdvice(method, response.status));
|
|
19429
19448
|
}
|
|
19430
19449
|
const replayed = response.headers.get(IDEMPOTENCY_REPLAYED_HEADER)?.trim() === "?1";
|
|
19431
19450
|
if (answerNotKept(response.status, replayed, payload)) {
|
|
@@ -19498,7 +19517,8 @@ function asObject(value) {
|
|
|
19498
19517
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
19499
19518
|
}
|
|
19500
19519
|
function sessionContext(input, checked) {
|
|
19501
|
-
const { url
|
|
19520
|
+
const { url, credential } = input.config;
|
|
19521
|
+
const configUrl = withoutUserinfo(url);
|
|
19502
19522
|
const baseFetch = input.fetchImpl ?? fetch;
|
|
19503
19523
|
const fetchImpl = Object.assign(async (...args) => {
|
|
19504
19524
|
try {
|
|
@@ -19516,9 +19536,9 @@ function sessionContext(input, checked) {
|
|
|
19516
19536
|
ownerArguments: checked.owner,
|
|
19517
19537
|
pictures: checked.pictures,
|
|
19518
19538
|
configUrl,
|
|
19519
|
-
linkBase: input.config.publicUrl ??
|
|
19539
|
+
linkBase: withoutUserinfo(input.config.publicUrl ?? url),
|
|
19520
19540
|
hostSession: input.sessionId?.trim(),
|
|
19521
|
-
newClient: () => new DispatchClient(
|
|
19541
|
+
newClient: () => new DispatchClient(url, credential, fetchImpl, {
|
|
19522
19542
|
signal: input.signal,
|
|
19523
19543
|
writeRetry: input.writeRetry,
|
|
19524
19544
|
sleep: input.sleep
|
|
@@ -22965,6 +22985,7 @@ function openAskLine(ask, baseUrl) {
|
|
|
22965
22985
|
return `- ${openAskAge(ask.age_seconds)} \xB7 ${priority}${ownerTitle(ask.owner)} \xB7 asked of ${waitsOnPerson(ask) ?? "nobody"} \xB7 ${ask.question} \xB7 ${new URL(ask.ref, baseUrl).toString()}`;
|
|
22966
22986
|
}
|
|
22967
22987
|
function formatOpenAsksSummary(response, baseUrl) {
|
|
22988
|
+
const linkBase = withoutUserinfo(baseUrl);
|
|
22968
22989
|
const scope = "active open asks you authored on open issues and project documents";
|
|
22969
22990
|
if (response.count === 0) {
|
|
22970
22991
|
return ["There are no unanswered asks for this session.", `Scope: ${scope}.`].join(`
|
|
@@ -22976,10 +22997,10 @@ function formatOpenAsksSummary(response, baseUrl) {
|
|
|
22976
22997
|
`${response.count} unanswered ${response.count === 1 ? "ask" : "asks"} you authored on active issues and project documents.`,
|
|
22977
22998
|
"",
|
|
22978
22999
|
`Waiting on human (${waitingOnHuman.length}):`,
|
|
22979
|
-
...waitingOnHuman.map((ask) => openAskLine(ask,
|
|
23000
|
+
...waitingOnHuman.map((ask) => openAskLine(ask, linkBase)),
|
|
22980
23001
|
"",
|
|
22981
23002
|
`Waiting on agent (${waitingOnAgent.length}):`,
|
|
22982
|
-
...waitingOnAgent.map((ask) => openAskLine(ask,
|
|
23003
|
+
...waitingOnAgent.map((ask) => openAskLine(ask, linkBase))
|
|
22983
23004
|
].join(`
|
|
22984
23005
|
`);
|
|
22985
23006
|
}
|
|
@@ -25748,7 +25769,7 @@ async function readSessionAnswers(options) {
|
|
|
25748
25769
|
current.noRouteReported = true;
|
|
25749
25770
|
return {
|
|
25750
25771
|
...read,
|
|
25751
|
-
notice: `Dispatch at ${url} has no answers route (its build is older than the route), so people's answers cannot be read from it`
|
|
25772
|
+
notice: `Dispatch at ${withoutUserinfo(url)} has no answers route (its build is older than the route), so people's answers cannot be read from it`
|
|
25752
25773
|
};
|
|
25753
25774
|
};
|
|
25754
25775
|
if ((state.noRouteUntil.get(url) ?? 0) > now())
|
|
@@ -30578,7 +30599,7 @@ function createEnvoyClient(config) {
|
|
|
30578
30599
|
}
|
|
30579
30600
|
if (unminted !== undefined && (response.status === 401 || response.status === 403)) {
|
|
30580
30601
|
return {
|
|
30581
|
-
unanswered: new Error(`${init.method ?? "GET"} ${url} answered ${response.status}, and this machine's Envoy credential could not be minted: ${messageFor(unminted)}`, { cause: unminted })
|
|
30602
|
+
unanswered: new Error(`${init.method ?? "GET"} ${withoutUserinfo(url)} answered ${response.status}, and this machine's Envoy credential could not be minted: ${messageFor(unminted)}`, { cause: unminted })
|
|
30582
30603
|
};
|
|
30583
30604
|
}
|
|
30584
30605
|
try {
|
|
@@ -30608,7 +30629,7 @@ function createEnvoyClient(config) {
|
|
|
30608
30629
|
return body;
|
|
30609
30630
|
const error = new EnvoyApiError({
|
|
30610
30631
|
method: init.method ?? "GET",
|
|
30611
|
-
url,
|
|
30632
|
+
url: withoutUserinfo(url),
|
|
30612
30633
|
status: response.status,
|
|
30613
30634
|
responseBody: body
|
|
30614
30635
|
});
|
package/dist/envoy-channel.js
CHANGED
|
@@ -43213,6 +43213,20 @@ function messageFor(error) {
|
|
|
43213
43213
|
function hasErrnoCode(error, code) {
|
|
43214
43214
|
return error instanceof Error && "code" in error && error.code === code;
|
|
43215
43215
|
}
|
|
43216
|
+
function withoutUserinfo(url) {
|
|
43217
|
+
let parsed;
|
|
43218
|
+
try {
|
|
43219
|
+
parsed = new URL(url);
|
|
43220
|
+
} catch {
|
|
43221
|
+
return url.slice(url.lastIndexOf("@") + 1);
|
|
43222
|
+
}
|
|
43223
|
+
if (parsed.username === "" && parsed.password === "")
|
|
43224
|
+
return url;
|
|
43225
|
+
parsed.username = "";
|
|
43226
|
+
parsed.password = "";
|
|
43227
|
+
const shown = parsed.toString();
|
|
43228
|
+
return shown.endsWith("/") && !url.endsWith("/") ? shown.slice(0, -1) : shown;
|
|
43229
|
+
}
|
|
43216
43230
|
|
|
43217
43231
|
// ../envoy-client/src/dispatch-command.ts
|
|
43218
43232
|
var STDIN = "-";
|
|
@@ -43799,7 +43813,8 @@ class DispatchWriteLandedError extends Error {
|
|
|
43799
43813
|
name = "DispatchWriteLandedError";
|
|
43800
43814
|
constructor(code, status, method, url) {
|
|
43801
43815
|
const lost = code === IDEMPOTENCY_ANSWER_NOT_KEPT ? "Dispatch kept no copy of its answer, which was too large" : "its answer was lost on the way back";
|
|
43802
|
-
|
|
43816
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
43817
|
+
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.");
|
|
43803
43818
|
this.code = code;
|
|
43804
43819
|
this.status = status;
|
|
43805
43820
|
}
|
|
@@ -43820,7 +43835,8 @@ class DispatchNoRouteError extends DispatchServiceError {
|
|
|
43820
43835
|
}
|
|
43821
43836
|
}
|
|
43822
43837
|
function reviewNoRouteRefusal(baseUrl, route, version) {
|
|
43823
|
-
|
|
43838
|
+
const shown = withoutUserinfo(baseUrl);
|
|
43839
|
+
return new DispatchServiceError("NOT_FOUND", 404, `Dispatch at ${shown} answered no route for ${route} each time the review was sent, and an ` + "answer of no route records no review. This build is older than that route. No other review " + "route was asked: the review route an older build serves takes no version, and it " + `would record the review at a version that build chooses, which may not be version ${version}. ` + `The no-route answer does not name the build; GET ${shown}/healthz names the commit of the ` + "build that answers it, when that build was stamped with one.");
|
|
43824
43840
|
}
|
|
43825
43841
|
var ISSUE_EVENTS_PAGE_MAX = 200;
|
|
43826
43842
|
var DISPATCH_TOOL_DEADLINE_MS = 60000;
|
|
@@ -44082,7 +44098,8 @@ class DispatchClient {
|
|
|
44082
44098
|
const refusal = whyNotAPage(answer);
|
|
44083
44099
|
if (refusal === undefined)
|
|
44084
44100
|
return answer;
|
|
44085
|
-
|
|
44101
|
+
const url = withoutUserinfo(this.#url(path, query));
|
|
44102
|
+
throw new Error(`GET ${url} asked for a page ({issues, total, limit, offset}) and got ${refusal}`);
|
|
44086
44103
|
}
|
|
44087
44104
|
async listAllIssues(options) {
|
|
44088
44105
|
const path = ["api", "v1", "issues"];
|
|
@@ -44090,7 +44107,8 @@ class DispatchClient {
|
|
|
44090
44107
|
const answer = await this.#json("GET", path, undefined, query);
|
|
44091
44108
|
if (Array.isArray(answer))
|
|
44092
44109
|
return answer;
|
|
44093
|
-
|
|
44110
|
+
const url = withoutUserinfo(this.#url(path, query));
|
|
44111
|
+
throw new Error(`GET ${url} asked for the unpaged listing and got ${whyNotAnArray(answer)}.`);
|
|
44094
44112
|
}
|
|
44095
44113
|
async listIssueArtifacts(issue) {
|
|
44096
44114
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "artifacts"]);
|
|
@@ -44557,7 +44575,7 @@ class DispatchClient {
|
|
|
44557
44575
|
headers[IDEMPOTENCY_KEY_HEADER] = key;
|
|
44558
44576
|
const { pausesMs, withinMs, silenceMs, inFlightPauseMs, inFlightWithinMs } = this.writeRetry;
|
|
44559
44577
|
const pause = this.writeRetry.pause ?? pauseFor;
|
|
44560
|
-
const request = `${method} ${url}`;
|
|
44578
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
44561
44579
|
const started = this.#now();
|
|
44562
44580
|
const bodyBytes = body === undefined ? 0 : typeof body.content === "string" ? Buffer.byteLength(body.content) : body.content.byteLength;
|
|
44563
44581
|
const upload = bodyBytes >= STREAMED_BODY_MIN;
|
|
@@ -44740,7 +44758,8 @@ class DispatchClient {
|
|
|
44740
44758
|
}
|
|
44741
44759
|
const reasonPhrase = excerpt(response.statusText, this.token);
|
|
44742
44760
|
const reason = reasonPhrase === "" ? "" : ` ${reasonPhrase}`;
|
|
44743
|
-
|
|
44761
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
44762
|
+
throw new DispatchGatewayError(response.status, `${request} answered ${response.status}${reason} with ${body}, ${GATEWAY_PAGE}`, gatewayAdvice(method, response.status));
|
|
44744
44763
|
}
|
|
44745
44764
|
const replayed = response.headers.get(IDEMPOTENCY_REPLAYED_HEADER)?.trim() === "?1";
|
|
44746
44765
|
if (answerNotKept(response.status, replayed, payload)) {
|
|
@@ -46371,7 +46390,7 @@ function createEnvoyClient(config) {
|
|
|
46371
46390
|
}
|
|
46372
46391
|
if (unminted !== undefined && (response.status === 401 || response.status === 403)) {
|
|
46373
46392
|
return {
|
|
46374
|
-
unanswered: new Error(`${init.method ?? "GET"} ${url} answered ${response.status}, and this machine's Envoy credential could not be minted: ${messageFor(unminted)}`, { cause: unminted })
|
|
46393
|
+
unanswered: new Error(`${init.method ?? "GET"} ${withoutUserinfo(url)} answered ${response.status}, and this machine's Envoy credential could not be minted: ${messageFor(unminted)}`, { cause: unminted })
|
|
46375
46394
|
};
|
|
46376
46395
|
}
|
|
46377
46396
|
try {
|
|
@@ -46401,7 +46420,7 @@ function createEnvoyClient(config) {
|
|
|
46401
46420
|
return body;
|
|
46402
46421
|
const error = new EnvoyApiError({
|
|
46403
46422
|
method: init.method ?? "GET",
|
|
46404
|
-
url,
|
|
46423
|
+
url: withoutUserinfo(url),
|
|
46405
46424
|
status: response.status,
|
|
46406
46425
|
responseBody: body
|
|
46407
46426
|
});
|
|
@@ -48616,7 +48635,8 @@ function asObject(value) {
|
|
|
48616
48635
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
48617
48636
|
}
|
|
48618
48637
|
function sessionContext(input, checked) {
|
|
48619
|
-
const { url
|
|
48638
|
+
const { url, credential } = input.config;
|
|
48639
|
+
const configUrl = withoutUserinfo(url);
|
|
48620
48640
|
const baseFetch = input.fetchImpl ?? fetch;
|
|
48621
48641
|
const fetchImpl = Object.assign(async (...args) => {
|
|
48622
48642
|
try {
|
|
@@ -48634,9 +48654,9 @@ function sessionContext(input, checked) {
|
|
|
48634
48654
|
ownerArguments: checked.owner,
|
|
48635
48655
|
pictures: checked.pictures,
|
|
48636
48656
|
configUrl,
|
|
48637
|
-
linkBase: input.config.publicUrl ??
|
|
48657
|
+
linkBase: withoutUserinfo(input.config.publicUrl ?? url),
|
|
48638
48658
|
hostSession: input.sessionId?.trim(),
|
|
48639
|
-
newClient: () => new DispatchClient(
|
|
48659
|
+
newClient: () => new DispatchClient(url, credential, fetchImpl, {
|
|
48640
48660
|
signal: input.signal,
|
|
48641
48661
|
writeRetry: input.writeRetry,
|
|
48642
48662
|
sleep: input.sleep
|
|
@@ -50094,6 +50114,7 @@ function openAskLine(ask, baseUrl) {
|
|
|
50094
50114
|
return `- ${openAskAge(ask.age_seconds)} \xB7 ${priority}${ownerTitle(ask.owner)} \xB7 asked of ${waitsOnPerson(ask) ?? "nobody"} \xB7 ${ask.question} \xB7 ${new URL(ask.ref, baseUrl).toString()}`;
|
|
50095
50115
|
}
|
|
50096
50116
|
function formatOpenAsksSummary(response, baseUrl) {
|
|
50117
|
+
const linkBase = withoutUserinfo(baseUrl);
|
|
50097
50118
|
const scope = "active open asks you authored on open issues and project documents";
|
|
50098
50119
|
if (response.count === 0) {
|
|
50099
50120
|
return ["There are no unanswered asks for this session.", `Scope: ${scope}.`].join(`
|
|
@@ -50105,10 +50126,10 @@ function formatOpenAsksSummary(response, baseUrl) {
|
|
|
50105
50126
|
`${response.count} unanswered ${response.count === 1 ? "ask" : "asks"} you authored on active issues and project documents.`,
|
|
50106
50127
|
"",
|
|
50107
50128
|
`Waiting on human (${waitingOnHuman.length}):`,
|
|
50108
|
-
...waitingOnHuman.map((ask) => openAskLine(ask,
|
|
50129
|
+
...waitingOnHuman.map((ask) => openAskLine(ask, linkBase)),
|
|
50109
50130
|
"",
|
|
50110
50131
|
`Waiting on agent (${waitingOnAgent.length}):`,
|
|
50111
|
-
...waitingOnAgent.map((ask) => openAskLine(ask,
|
|
50132
|
+
...waitingOnAgent.map((ask) => openAskLine(ask, linkBase))
|
|
50112
50133
|
].join(`
|
|
50113
50134
|
`);
|
|
50114
50135
|
}
|
|
@@ -52780,7 +52801,7 @@ async function readSessionAnswers(options) {
|
|
|
52780
52801
|
current.noRouteReported = true;
|
|
52781
52802
|
return {
|
|
52782
52803
|
...read,
|
|
52783
|
-
notice: `Dispatch at ${url} has no answers route (its build is older than the route), so people's answers cannot be read from it`
|
|
52804
|
+
notice: `Dispatch at ${withoutUserinfo(url)} has no answers route (its build is older than the route), so people's answers cannot be read from it`
|
|
52784
52805
|
};
|
|
52785
52806
|
};
|
|
52786
52807
|
if ((state.noRouteUntil.get(url) ?? 0) > now())
|
|
@@ -57425,7 +57446,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
57425
57446
|
|
|
57426
57447
|
// package.json
|
|
57427
57448
|
var name = "@sjawhar/claude-envoy";
|
|
57428
|
-
var version2 = "2.
|
|
57449
|
+
var version2 = "2.31.1";
|
|
57429
57450
|
var legion = {
|
|
57430
57451
|
daemonApiVersion: 144
|
|
57431
57452
|
};
|
package/dist/session-hook.js
CHANGED
|
@@ -16833,6 +16833,20 @@ function messageFor(error) {
|
|
|
16833
16833
|
function hasErrnoCode(error, code) {
|
|
16834
16834
|
return error instanceof Error && "code" in error && error.code === code;
|
|
16835
16835
|
}
|
|
16836
|
+
function withoutUserinfo(url) {
|
|
16837
|
+
let parsed;
|
|
16838
|
+
try {
|
|
16839
|
+
parsed = new URL(url);
|
|
16840
|
+
} catch {
|
|
16841
|
+
return url.slice(url.lastIndexOf("@") + 1);
|
|
16842
|
+
}
|
|
16843
|
+
if (parsed.username === "" && parsed.password === "")
|
|
16844
|
+
return url;
|
|
16845
|
+
parsed.username = "";
|
|
16846
|
+
parsed.password = "";
|
|
16847
|
+
const shown = parsed.toString();
|
|
16848
|
+
return shown.endsWith("/") && !url.endsWith("/") ? shown.slice(0, -1) : shown;
|
|
16849
|
+
}
|
|
16836
16850
|
|
|
16837
16851
|
// ../envoy-client/src/dispatch-command.ts
|
|
16838
16852
|
var STDIN = "-";
|
|
@@ -18207,7 +18221,8 @@ class DispatchWriteLandedError extends Error {
|
|
|
18207
18221
|
name = "DispatchWriteLandedError";
|
|
18208
18222
|
constructor(code, status, method, url) {
|
|
18209
18223
|
const lost = code === IDEMPOTENCY_ANSWER_NOT_KEPT ? "Dispatch kept no copy of its answer, which was too large" : "its answer was lost on the way back";
|
|
18210
|
-
|
|
18224
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
18225
|
+
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.");
|
|
18211
18226
|
this.code = code;
|
|
18212
18227
|
this.status = status;
|
|
18213
18228
|
}
|
|
@@ -18228,7 +18243,8 @@ class DispatchNoRouteError extends DispatchServiceError {
|
|
|
18228
18243
|
}
|
|
18229
18244
|
}
|
|
18230
18245
|
function reviewNoRouteRefusal(baseUrl, route, version) {
|
|
18231
|
-
|
|
18246
|
+
const shown = withoutUserinfo(baseUrl);
|
|
18247
|
+
return new DispatchServiceError("NOT_FOUND", 404, `Dispatch at ${shown} answered no route for ${route} each time the review was sent, and an ` + "answer of no route records no review. This build is older than that route. No other review " + "route was asked: the review route an older build serves takes no version, and it " + `would record the review at a version that build chooses, which may not be version ${version}. ` + `The no-route answer does not name the build; GET ${shown}/healthz names the commit of the ` + "build that answers it, when that build was stamped with one.");
|
|
18232
18248
|
}
|
|
18233
18249
|
var ISSUE_EVENTS_PAGE_MAX = 200;
|
|
18234
18250
|
var DISPATCH_TOOL_DEADLINE_MS = 60000;
|
|
@@ -18490,7 +18506,8 @@ class DispatchClient {
|
|
|
18490
18506
|
const refusal = whyNotAPage(answer);
|
|
18491
18507
|
if (refusal === undefined)
|
|
18492
18508
|
return answer;
|
|
18493
|
-
|
|
18509
|
+
const url = withoutUserinfo(this.#url(path, query));
|
|
18510
|
+
throw new Error(`GET ${url} asked for a page ({issues, total, limit, offset}) and got ${refusal}`);
|
|
18494
18511
|
}
|
|
18495
18512
|
async listAllIssues(options) {
|
|
18496
18513
|
const path = ["api", "v1", "issues"];
|
|
@@ -18498,7 +18515,8 @@ class DispatchClient {
|
|
|
18498
18515
|
const answer = await this.#json("GET", path, undefined, query);
|
|
18499
18516
|
if (Array.isArray(answer))
|
|
18500
18517
|
return answer;
|
|
18501
|
-
|
|
18518
|
+
const url = withoutUserinfo(this.#url(path, query));
|
|
18519
|
+
throw new Error(`GET ${url} asked for the unpaged listing and got ${whyNotAnArray(answer)}.`);
|
|
18502
18520
|
}
|
|
18503
18521
|
async listIssueArtifacts(issue) {
|
|
18504
18522
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "artifacts"]);
|
|
@@ -18965,7 +18983,7 @@ class DispatchClient {
|
|
|
18965
18983
|
headers[IDEMPOTENCY_KEY_HEADER] = key;
|
|
18966
18984
|
const { pausesMs, withinMs, silenceMs, inFlightPauseMs, inFlightWithinMs } = this.writeRetry;
|
|
18967
18985
|
const pause = this.writeRetry.pause ?? pauseFor;
|
|
18968
|
-
const request = `${method} ${url}`;
|
|
18986
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
18969
18987
|
const started = this.#now();
|
|
18970
18988
|
const bodyBytes = body === undefined ? 0 : typeof body.content === "string" ? Buffer.byteLength(body.content) : body.content.byteLength;
|
|
18971
18989
|
const upload = bodyBytes >= STREAMED_BODY_MIN;
|
|
@@ -19148,7 +19166,8 @@ class DispatchClient {
|
|
|
19148
19166
|
}
|
|
19149
19167
|
const reasonPhrase = excerpt(response.statusText, this.token);
|
|
19150
19168
|
const reason = reasonPhrase === "" ? "" : ` ${reasonPhrase}`;
|
|
19151
|
-
|
|
19169
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
19170
|
+
throw new DispatchGatewayError(response.status, `${request} answered ${response.status}${reason} with ${body}, ${GATEWAY_PAGE}`, gatewayAdvice(method, response.status));
|
|
19152
19171
|
}
|
|
19153
19172
|
const replayed = response.headers.get(IDEMPOTENCY_REPLAYED_HEADER)?.trim() === "?1";
|
|
19154
19173
|
if (answerNotKept(response.status, replayed, payload)) {
|
|
@@ -20455,7 +20474,8 @@ function asObject(value) {
|
|
|
20455
20474
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
20456
20475
|
}
|
|
20457
20476
|
function sessionContext(input, checked) {
|
|
20458
|
-
const { url
|
|
20477
|
+
const { url, credential } = input.config;
|
|
20478
|
+
const configUrl = withoutUserinfo(url);
|
|
20459
20479
|
const baseFetch = input.fetchImpl ?? fetch;
|
|
20460
20480
|
const fetchImpl = Object.assign(async (...args) => {
|
|
20461
20481
|
try {
|
|
@@ -20473,9 +20493,9 @@ function sessionContext(input, checked) {
|
|
|
20473
20493
|
ownerArguments: checked.owner,
|
|
20474
20494
|
pictures: checked.pictures,
|
|
20475
20495
|
configUrl,
|
|
20476
|
-
linkBase: input.config.publicUrl ??
|
|
20496
|
+
linkBase: withoutUserinfo(input.config.publicUrl ?? url),
|
|
20477
20497
|
hostSession: input.sessionId?.trim(),
|
|
20478
|
-
newClient: () => new DispatchClient(
|
|
20498
|
+
newClient: () => new DispatchClient(url, credential, fetchImpl, {
|
|
20479
20499
|
signal: input.signal,
|
|
20480
20500
|
writeRetry: input.writeRetry,
|
|
20481
20501
|
sleep: input.sleep
|
|
@@ -21933,6 +21953,7 @@ function openAskLine(ask, baseUrl) {
|
|
|
21933
21953
|
return `- ${openAskAge(ask.age_seconds)} \xB7 ${priority}${ownerTitle(ask.owner)} \xB7 asked of ${waitsOnPerson(ask) ?? "nobody"} \xB7 ${ask.question} \xB7 ${new URL(ask.ref, baseUrl).toString()}`;
|
|
21934
21954
|
}
|
|
21935
21955
|
function formatOpenAsksSummary(response, baseUrl) {
|
|
21956
|
+
const linkBase = withoutUserinfo(baseUrl);
|
|
21936
21957
|
const scope = "active open asks you authored on open issues and project documents";
|
|
21937
21958
|
if (response.count === 0) {
|
|
21938
21959
|
return ["There are no unanswered asks for this session.", `Scope: ${scope}.`].join(`
|
|
@@ -21944,10 +21965,10 @@ function formatOpenAsksSummary(response, baseUrl) {
|
|
|
21944
21965
|
`${response.count} unanswered ${response.count === 1 ? "ask" : "asks"} you authored on active issues and project documents.`,
|
|
21945
21966
|
"",
|
|
21946
21967
|
`Waiting on human (${waitingOnHuman.length}):`,
|
|
21947
|
-
...waitingOnHuman.map((ask) => openAskLine(ask,
|
|
21968
|
+
...waitingOnHuman.map((ask) => openAskLine(ask, linkBase)),
|
|
21948
21969
|
"",
|
|
21949
21970
|
`Waiting on agent (${waitingOnAgent.length}):`,
|
|
21950
|
-
...waitingOnAgent.map((ask) => openAskLine(ask,
|
|
21971
|
+
...waitingOnAgent.map((ask) => openAskLine(ask, linkBase))
|
|
21951
21972
|
].join(`
|
|
21952
21973
|
`);
|
|
21953
21974
|
}
|
|
@@ -24716,7 +24737,7 @@ async function readSessionAnswers(options) {
|
|
|
24716
24737
|
current.noRouteReported = true;
|
|
24717
24738
|
return {
|
|
24718
24739
|
...read,
|
|
24719
|
-
notice: `Dispatch at ${url} has no answers route (its build is older than the route), so people's answers cannot be read from it`
|
|
24740
|
+
notice: `Dispatch at ${withoutUserinfo(url)} has no answers route (its build is older than the route), so people's answers cannot be read from it`
|
|
24720
24741
|
};
|
|
24721
24742
|
};
|
|
24722
24743
|
if ((state.noRouteUntil.get(url) ?? 0) > now())
|
|
@@ -29668,8 +29689,9 @@ async function refreshedAnswers(session, cwd, dispatchUrl, startedAt, by) {
|
|
|
29668
29689
|
if (outcome.dispatch_url === dispatchUrl) {
|
|
29669
29690
|
return { text: outcome.text ?? undefined, notice: outcome.notice ?? undefined };
|
|
29670
29691
|
}
|
|
29692
|
+
const read = outcome.dispatch_url === null ? "no Dispatch" : withoutUserinfo(outcome.dispatch_url);
|
|
29671
29693
|
return {
|
|
29672
|
-
reason: `the refresher read ${
|
|
29694
|
+
reason: `the refresher read ${read}, not the Dispatch envoy.json names now`
|
|
29673
29695
|
};
|
|
29674
29696
|
}
|
|
29675
29697
|
const left = remainingUntil(by);
|
|
@@ -15,6 +15,20 @@ function messageFor(error) {
|
|
|
15
15
|
function hasErrnoCode(error, code) {
|
|
16
16
|
return error instanceof Error && "code" in error && error.code === code;
|
|
17
17
|
}
|
|
18
|
+
function withoutUserinfo(url) {
|
|
19
|
+
let parsed;
|
|
20
|
+
try {
|
|
21
|
+
parsed = new URL(url);
|
|
22
|
+
} catch {
|
|
23
|
+
return url.slice(url.lastIndexOf("@") + 1);
|
|
24
|
+
}
|
|
25
|
+
if (parsed.username === "" && parsed.password === "")
|
|
26
|
+
return url;
|
|
27
|
+
parsed.username = "";
|
|
28
|
+
parsed.password = "";
|
|
29
|
+
const shown = parsed.toString();
|
|
30
|
+
return shown.endsWith("/") && !url.endsWith("/") ? shown.slice(0, -1) : shown;
|
|
31
|
+
}
|
|
18
32
|
|
|
19
33
|
// src/session-state.ts
|
|
20
34
|
import { readFileSync } from "fs";
|
package/hooks/session-hook.ts
CHANGED
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
import { DispatchClient } from "@legion/envoy-client/dispatch-http"
|
|
97
97
|
import { sessionDirectory, writeAtomically } from "@legion/envoy-client/dispatch-session-directory"
|
|
98
98
|
import { offWithError } from "@legion/envoy-client/envoy-config"
|
|
99
|
-
import { hasErrnoCode, messageFor } from "@legion/envoy-client/errors"
|
|
99
|
+
import { hasErrnoCode, messageFor, withoutUserinfo } from "@legion/envoy-client/errors"
|
|
100
100
|
import {
|
|
101
101
|
readSessionAnswers,
|
|
102
102
|
SESSION_ANSWERS_DEADLINE_MS,
|
|
@@ -451,8 +451,12 @@ async function refreshedAnswers(
|
|
|
451
451
|
if (outcome.dispatch_url === dispatchUrl) {
|
|
452
452
|
return { text: outcome.text ?? undefined, notice: outcome.notice ?? undefined }
|
|
453
453
|
}
|
|
454
|
+
// Compared whole above; the reason reaches the session's context, so it names the URL
|
|
455
|
+
// without the user and password it may carry.
|
|
456
|
+
const read =
|
|
457
|
+
outcome.dispatch_url === null ? "no Dispatch" : withoutUserinfo(outcome.dispatch_url)
|
|
454
458
|
return {
|
|
455
|
-
reason: `the refresher read ${
|
|
459
|
+
reason: `the refresher read ${read}, not the Dispatch envoy.json names now`,
|
|
456
460
|
}
|
|
457
461
|
}
|
|
458
462
|
const left = remainingUntil(by)
|
package/package.json
CHANGED
|
@@ -29,10 +29,27 @@ agent-secrets NAME... [--reason TEXT] [--wait DURATION] [--ttl DURATION] -- <com
|
|
|
29
29
|
`--github-token`, the secret's name holds that one account's token, the string an
|
|
30
30
|
`Authorization` header carries. Without `--github-token` the name holds the JSON object of
|
|
31
31
|
installations, and a command that sends that object to GitHub reads `401`.
|
|
32
|
+
- The broker checks a narrowing before the approval request, so a narrowing it cannot serve costs
|
|
33
|
+
nobody an approval. It refuses the request, nothing runs, and the status is 1, in five cases:
|
|
34
|
+
|
|
35
|
+
- an account the secret's `github-owners` tag does not list,
|
|
36
|
+
- a run that names no GitHub App secret,
|
|
37
|
+
- a name behind the airlock (the bullet below),
|
|
38
|
+
- a narrowing GitHub itself refuses, such as a repository the App's installation does not
|
|
39
|
+
reach, or read access the App does not hold,
|
|
40
|
+
- an account the App is not installed on, which the message says in the words `has no
|
|
41
|
+
installation on`. Install the App on that account, or narrow to an account it is on.
|
|
42
|
+
|
|
43
|
+
The message says which of the five it is. Two cases keep the older behaviour, where the
|
|
44
|
+
refusal comes when the grant is read instead: a request every name of which is granted at
|
|
45
|
+
once, which no person decides, and a request on which the broker reaches no verdict, for
|
|
46
|
+
example because GitHub is out of reach or refuses the App itself, or because the check passes
|
|
47
|
+
its own time bounds.
|
|
32
48
|
- A narrowing and the airlock do not go together. Ask for a narrowing in a run whose grant holds
|
|
33
|
-
a secret behind the airlock (below) and
|
|
34
|
-
|
|
35
|
-
|
|
49
|
+
a secret behind the airlock (below) and nothing runs: where a person decides the request,
|
|
50
|
+
the broker refuses the request, naming that secret, and where the policy grants every name
|
|
51
|
+
at once, the same refusal comes when the grant is read. Ask for the GitHub App secret in a
|
|
52
|
+
run of its own, with no airlocked name beside it.
|
|
36
53
|
|
|
37
54
|
## The command reads the value, your shell does not
|
|
38
55
|
|