@sjawhar/pi-envoy 17.29.2 → 17.30.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/dist/dispatch.js +34 -13
- package/dist/envoy.js +32 -12
- package/dist/skills/agent-secrets/SKILL.md +20 -3
- package/package.json +1 -1
package/dist/dispatch.js
CHANGED
|
@@ -987,6 +987,20 @@ function messageFor(error) {
|
|
|
987
987
|
function hasErrnoCode(error, code) {
|
|
988
988
|
return error instanceof Error && "code" in error && error.code === code;
|
|
989
989
|
}
|
|
990
|
+
function withoutUserinfo(url) {
|
|
991
|
+
let parsed;
|
|
992
|
+
try {
|
|
993
|
+
parsed = new URL(url);
|
|
994
|
+
} catch {
|
|
995
|
+
return url.slice(url.lastIndexOf("@") + 1);
|
|
996
|
+
}
|
|
997
|
+
if (parsed.username === "" && parsed.password === "")
|
|
998
|
+
return url;
|
|
999
|
+
parsed.username = "";
|
|
1000
|
+
parsed.password = "";
|
|
1001
|
+
const shown = parsed.toString();
|
|
1002
|
+
return shown.endsWith("/") && !url.endsWith("/") ? shown.slice(0, -1) : shown;
|
|
1003
|
+
}
|
|
990
1004
|
|
|
991
1005
|
// ../envoy-client/src/askgate-marker.ts
|
|
992
1006
|
var ASKGATE_RECORD = "askgate";
|
|
@@ -18351,7 +18365,8 @@ class DispatchWriteLandedError extends Error {
|
|
|
18351
18365
|
name = "DispatchWriteLandedError";
|
|
18352
18366
|
constructor(code, status, method, url) {
|
|
18353
18367
|
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";
|
|
18354
|
-
|
|
18368
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
18369
|
+
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.");
|
|
18355
18370
|
this.code = code;
|
|
18356
18371
|
this.status = status;
|
|
18357
18372
|
}
|
|
@@ -18372,7 +18387,8 @@ class DispatchNoRouteError extends DispatchServiceError {
|
|
|
18372
18387
|
}
|
|
18373
18388
|
}
|
|
18374
18389
|
function reviewNoRouteRefusal(baseUrl, route, version) {
|
|
18375
|
-
|
|
18390
|
+
const shown = withoutUserinfo(baseUrl);
|
|
18391
|
+
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.");
|
|
18376
18392
|
}
|
|
18377
18393
|
var ISSUE_EVENTS_PAGE_MAX = 200;
|
|
18378
18394
|
var DISPATCH_TOOL_DEADLINE_MS = 60000;
|
|
@@ -18634,7 +18650,8 @@ class DispatchClient {
|
|
|
18634
18650
|
const refusal = whyNotAPage(answer);
|
|
18635
18651
|
if (refusal === undefined)
|
|
18636
18652
|
return answer;
|
|
18637
|
-
|
|
18653
|
+
const url = withoutUserinfo(this.#url(path, query));
|
|
18654
|
+
throw new Error(`GET ${url} asked for a page ({issues, total, limit, offset}) and got ${refusal}`);
|
|
18638
18655
|
}
|
|
18639
18656
|
async listAllIssues(options) {
|
|
18640
18657
|
const path = ["api", "v1", "issues"];
|
|
@@ -18642,7 +18659,8 @@ class DispatchClient {
|
|
|
18642
18659
|
const answer = await this.#json("GET", path, undefined, query);
|
|
18643
18660
|
if (Array.isArray(answer))
|
|
18644
18661
|
return answer;
|
|
18645
|
-
|
|
18662
|
+
const url = withoutUserinfo(this.#url(path, query));
|
|
18663
|
+
throw new Error(`GET ${url} asked for the unpaged listing and got ${whyNotAnArray(answer)}.`);
|
|
18646
18664
|
}
|
|
18647
18665
|
async listIssueArtifacts(issue) {
|
|
18648
18666
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "artifacts"]);
|
|
@@ -19109,7 +19127,7 @@ class DispatchClient {
|
|
|
19109
19127
|
headers[IDEMPOTENCY_KEY_HEADER] = key;
|
|
19110
19128
|
const { pausesMs, withinMs, silenceMs, inFlightPauseMs, inFlightWithinMs } = this.writeRetry;
|
|
19111
19129
|
const pause = this.writeRetry.pause ?? pauseFor;
|
|
19112
|
-
const request = `${method} ${url}`;
|
|
19130
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
19113
19131
|
const started = this.#now();
|
|
19114
19132
|
const bodyBytes = body === undefined ? 0 : typeof body.content === "string" ? Buffer.byteLength(body.content) : body.content.byteLength;
|
|
19115
19133
|
const upload = bodyBytes >= STREAMED_BODY_MIN;
|
|
@@ -19292,7 +19310,8 @@ class DispatchClient {
|
|
|
19292
19310
|
}
|
|
19293
19311
|
const reasonPhrase = excerpt(response.statusText, this.token);
|
|
19294
19312
|
const reason = reasonPhrase === "" ? "" : ` ${reasonPhrase}`;
|
|
19295
|
-
|
|
19313
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
19314
|
+
throw new DispatchGatewayError(response.status, `${request} answered ${response.status}${reason} with ${body}, ${GATEWAY_PAGE}`, gatewayAdvice(method, response.status));
|
|
19296
19315
|
}
|
|
19297
19316
|
const replayed = response.headers.get(IDEMPOTENCY_REPLAYED_HEADER)?.trim() === "?1";
|
|
19298
19317
|
if (answerNotKept(response.status, replayed, payload)) {
|
|
@@ -19365,7 +19384,8 @@ function asObject(value) {
|
|
|
19365
19384
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
19366
19385
|
}
|
|
19367
19386
|
function sessionContext(input, checked) {
|
|
19368
|
-
const { url
|
|
19387
|
+
const { url, credential } = input.config;
|
|
19388
|
+
const configUrl = withoutUserinfo(url);
|
|
19369
19389
|
const baseFetch = input.fetchImpl ?? fetch;
|
|
19370
19390
|
const fetchImpl = Object.assign(async (...args) => {
|
|
19371
19391
|
try {
|
|
@@ -19383,9 +19403,9 @@ function sessionContext(input, checked) {
|
|
|
19383
19403
|
ownerArguments: checked.owner,
|
|
19384
19404
|
pictures: checked.pictures,
|
|
19385
19405
|
configUrl,
|
|
19386
|
-
linkBase: input.config.publicUrl ??
|
|
19406
|
+
linkBase: withoutUserinfo(input.config.publicUrl ?? url),
|
|
19387
19407
|
hostSession: input.sessionId?.trim(),
|
|
19388
|
-
newClient: () => new DispatchClient(
|
|
19408
|
+
newClient: () => new DispatchClient(url, credential, fetchImpl, {
|
|
19389
19409
|
signal: input.signal,
|
|
19390
19410
|
writeRetry: input.writeRetry,
|
|
19391
19411
|
sleep: input.sleep
|
|
@@ -21622,6 +21642,7 @@ function openAskLine(ask, baseUrl) {
|
|
|
21622
21642
|
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()}`;
|
|
21623
21643
|
}
|
|
21624
21644
|
function formatOpenAsksSummary(response, baseUrl) {
|
|
21645
|
+
const linkBase = withoutUserinfo(baseUrl);
|
|
21625
21646
|
const scope = "active open asks you authored on open issues and project documents";
|
|
21626
21647
|
if (response.count === 0) {
|
|
21627
21648
|
return ["There are no unanswered asks for this session.", `Scope: ${scope}.`].join(`
|
|
@@ -21633,10 +21654,10 @@ function formatOpenAsksSummary(response, baseUrl) {
|
|
|
21633
21654
|
`${response.count} unanswered ${response.count === 1 ? "ask" : "asks"} you authored on active issues and project documents.`,
|
|
21634
21655
|
"",
|
|
21635
21656
|
`Waiting on human (${waitingOnHuman.length}):`,
|
|
21636
|
-
...waitingOnHuman.map((ask) => openAskLine(ask,
|
|
21657
|
+
...waitingOnHuman.map((ask) => openAskLine(ask, linkBase)),
|
|
21637
21658
|
"",
|
|
21638
21659
|
`Waiting on agent (${waitingOnAgent.length}):`,
|
|
21639
|
-
...waitingOnAgent.map((ask) => openAskLine(ask,
|
|
21660
|
+
...waitingOnAgent.map((ask) => openAskLine(ask, linkBase))
|
|
21640
21661
|
].join(`
|
|
21641
21662
|
`);
|
|
21642
21663
|
}
|
|
@@ -28809,7 +28830,7 @@ function createEnvoyClient(config) {
|
|
|
28809
28830
|
}
|
|
28810
28831
|
if (unminted !== undefined && (response.status === 401 || response.status === 403)) {
|
|
28811
28832
|
return {
|
|
28812
|
-
unanswered: new Error(`${init.method ?? "GET"} ${url} answered ${response.status}, and this machine's Envoy credential could not be minted: ${messageFor(unminted)}`, { cause: unminted })
|
|
28833
|
+
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 })
|
|
28813
28834
|
};
|
|
28814
28835
|
}
|
|
28815
28836
|
try {
|
|
@@ -28839,7 +28860,7 @@ function createEnvoyClient(config) {
|
|
|
28839
28860
|
return body;
|
|
28840
28861
|
const error = new EnvoyApiError({
|
|
28841
28862
|
method: init.method ?? "GET",
|
|
28842
|
-
url,
|
|
28863
|
+
url: withoutUserinfo(url),
|
|
28843
28864
|
status: response.status,
|
|
28844
28865
|
responseBody: body
|
|
28845
28866
|
});
|
package/dist/envoy.js
CHANGED
|
@@ -32871,6 +32871,20 @@ function messageFor(error) {
|
|
|
32871
32871
|
function hasErrnoCode(error, code) {
|
|
32872
32872
|
return error instanceof Error && "code" in error && error.code === code;
|
|
32873
32873
|
}
|
|
32874
|
+
function withoutUserinfo(url) {
|
|
32875
|
+
let parsed;
|
|
32876
|
+
try {
|
|
32877
|
+
parsed = new URL(url);
|
|
32878
|
+
} catch {
|
|
32879
|
+
return url.slice(url.lastIndexOf("@") + 1);
|
|
32880
|
+
}
|
|
32881
|
+
if (parsed.username === "" && parsed.password === "")
|
|
32882
|
+
return url;
|
|
32883
|
+
parsed.username = "";
|
|
32884
|
+
parsed.password = "";
|
|
32885
|
+
const shown = parsed.toString();
|
|
32886
|
+
return shown.endsWith("/") && !url.endsWith("/") ? shown.slice(0, -1) : shown;
|
|
32887
|
+
}
|
|
32874
32888
|
|
|
32875
32889
|
// ../envoy-client/src/askgate-marker.ts
|
|
32876
32890
|
var ASKGATE_RECORD = "askgate";
|
|
@@ -37189,7 +37203,8 @@ class DispatchWriteLandedError extends Error {
|
|
|
37189
37203
|
name = "DispatchWriteLandedError";
|
|
37190
37204
|
constructor(code, status, method, url) {
|
|
37191
37205
|
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";
|
|
37192
|
-
|
|
37206
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
37207
|
+
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.");
|
|
37193
37208
|
this.code = code;
|
|
37194
37209
|
this.status = status;
|
|
37195
37210
|
}
|
|
@@ -37210,7 +37225,8 @@ class DispatchNoRouteError extends DispatchServiceError {
|
|
|
37210
37225
|
}
|
|
37211
37226
|
}
|
|
37212
37227
|
function reviewNoRouteRefusal(baseUrl, route, version) {
|
|
37213
|
-
|
|
37228
|
+
const shown = withoutUserinfo(baseUrl);
|
|
37229
|
+
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.");
|
|
37214
37230
|
}
|
|
37215
37231
|
var ISSUE_EVENTS_PAGE_MAX = 200;
|
|
37216
37232
|
var DISPATCH_TOOL_DEADLINE_MS = 60000;
|
|
@@ -37443,7 +37459,8 @@ class DispatchClient {
|
|
|
37443
37459
|
const refusal = whyNotAPage(answer);
|
|
37444
37460
|
if (refusal === undefined)
|
|
37445
37461
|
return answer;
|
|
37446
|
-
|
|
37462
|
+
const url = withoutUserinfo(this.#url(path, query));
|
|
37463
|
+
throw new Error(`GET ${url} asked for a page ({issues, total, limit, offset}) and got ${refusal}`);
|
|
37447
37464
|
}
|
|
37448
37465
|
async listAllIssues(options) {
|
|
37449
37466
|
const path = ["api", "v1", "issues"];
|
|
@@ -37451,7 +37468,8 @@ class DispatchClient {
|
|
|
37451
37468
|
const answer = await this.#json("GET", path, undefined, query);
|
|
37452
37469
|
if (Array.isArray(answer))
|
|
37453
37470
|
return answer;
|
|
37454
|
-
|
|
37471
|
+
const url = withoutUserinfo(this.#url(path, query));
|
|
37472
|
+
throw new Error(`GET ${url} asked for the unpaged listing and got ${whyNotAnArray(answer)}.`);
|
|
37455
37473
|
}
|
|
37456
37474
|
async listIssueArtifacts(issue) {
|
|
37457
37475
|
return this.#json("GET", ["api", "v1", "issues", await this.#resolveIssue(issue), "artifacts"]);
|
|
@@ -37918,7 +37936,7 @@ class DispatchClient {
|
|
|
37918
37936
|
headers[IDEMPOTENCY_KEY_HEADER] = key;
|
|
37919
37937
|
const { pausesMs, withinMs, silenceMs, inFlightPauseMs, inFlightWithinMs } = this.writeRetry;
|
|
37920
37938
|
const pause = this.writeRetry.pause ?? pauseFor;
|
|
37921
|
-
const request = `${method} ${url}`;
|
|
37939
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
37922
37940
|
const started = this.#now();
|
|
37923
37941
|
const bodyBytes = body === undefined ? 0 : typeof body.content === "string" ? Buffer.byteLength(body.content) : body.content.byteLength;
|
|
37924
37942
|
const upload = bodyBytes >= STREAMED_BODY_MIN;
|
|
@@ -38101,7 +38119,8 @@ class DispatchClient {
|
|
|
38101
38119
|
}
|
|
38102
38120
|
const reasonPhrase = excerpt(response.statusText, this.token);
|
|
38103
38121
|
const reason = reasonPhrase === "" ? "" : ` ${reasonPhrase}`;
|
|
38104
|
-
|
|
38122
|
+
const request = `${method} ${withoutUserinfo(url)}`;
|
|
38123
|
+
throw new DispatchGatewayError(response.status, `${request} answered ${response.status}${reason} with ${body}, ${GATEWAY_PAGE}`, gatewayAdvice(method, response.status));
|
|
38105
38124
|
}
|
|
38106
38125
|
const replayed = response.headers.get(IDEMPOTENCY_REPLAYED_HEADER)?.trim() === "?1";
|
|
38107
38126
|
if (answerNotKept(response.status, replayed, payload)) {
|
|
@@ -39701,7 +39720,7 @@ function createEnvoyClient(config) {
|
|
|
39701
39720
|
}
|
|
39702
39721
|
if (unminted !== undefined && (response.status === 401 || response.status === 403)) {
|
|
39703
39722
|
return {
|
|
39704
|
-
unanswered: new Error(`${init.method ?? "GET"} ${url} answered ${response.status}, and this machine's Envoy credential could not be minted: ${messageFor(unminted)}`, { cause: unminted })
|
|
39723
|
+
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 })
|
|
39705
39724
|
};
|
|
39706
39725
|
}
|
|
39707
39726
|
try {
|
|
@@ -39731,7 +39750,7 @@ function createEnvoyClient(config) {
|
|
|
39731
39750
|
return body;
|
|
39732
39751
|
const error = new EnvoyApiError({
|
|
39733
39752
|
method: init.method ?? "GET",
|
|
39734
|
-
url,
|
|
39753
|
+
url: withoutUserinfo(url),
|
|
39735
39754
|
status: response.status,
|
|
39736
39755
|
responseBody: body
|
|
39737
39756
|
});
|
|
@@ -42852,6 +42871,7 @@ function openAskLine(ask, baseUrl) {
|
|
|
42852
42871
|
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()}`;
|
|
42853
42872
|
}
|
|
42854
42873
|
function formatOpenAsksSummary(response, baseUrl) {
|
|
42874
|
+
const linkBase = withoutUserinfo(baseUrl);
|
|
42855
42875
|
const scope = "active open asks you authored on open issues and project documents";
|
|
42856
42876
|
if (response.count === 0) {
|
|
42857
42877
|
return ["There are no unanswered asks for this session.", `Scope: ${scope}.`].join(`
|
|
@@ -42863,10 +42883,10 @@ function formatOpenAsksSummary(response, baseUrl) {
|
|
|
42863
42883
|
`${response.count} unanswered ${response.count === 1 ? "ask" : "asks"} you authored on active issues and project documents.`,
|
|
42864
42884
|
"",
|
|
42865
42885
|
`Waiting on human (${waitingOnHuman.length}):`,
|
|
42866
|
-
...waitingOnHuman.map((ask) => openAskLine(ask,
|
|
42886
|
+
...waitingOnHuman.map((ask) => openAskLine(ask, linkBase)),
|
|
42867
42887
|
"",
|
|
42868
42888
|
`Waiting on agent (${waitingOnAgent.length}):`,
|
|
42869
|
-
...waitingOnAgent.map((ask) => openAskLine(ask,
|
|
42889
|
+
...waitingOnAgent.map((ask) => openAskLine(ask, linkBase))
|
|
42870
42890
|
].join(`
|
|
42871
42891
|
`);
|
|
42872
42892
|
}
|
|
@@ -45541,7 +45561,7 @@ async function readSessionAnswers(options) {
|
|
|
45541
45561
|
current.noRouteReported = true;
|
|
45542
45562
|
return {
|
|
45543
45563
|
...read,
|
|
45544
|
-
notice: `Dispatch at ${url} has no answers route (its build is older than the route), so people's answers cannot be read from it`
|
|
45564
|
+
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`
|
|
45545
45565
|
};
|
|
45546
45566
|
};
|
|
45547
45567
|
if ((state.noRouteUntil.get(url) ?? 0) > now())
|
|
@@ -47651,7 +47671,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
47651
47671
|
|
|
47652
47672
|
// package.json
|
|
47653
47673
|
var name = "@sjawhar/pi-envoy";
|
|
47654
|
-
var version2 = "17.
|
|
47674
|
+
var version2 = "17.30.1";
|
|
47655
47675
|
var package_default = {
|
|
47656
47676
|
name,
|
|
47657
47677
|
version: version2,
|
|
@@ -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
|
|