@sjawhar/opencode-legion-envoy 3.19.0 → 3.19.2
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/src/server.js +28 -19
- package/package.json +1 -1
package/dist/src/server.js
CHANGED
|
@@ -15162,6 +15162,27 @@ function requestSignal(signal) {
|
|
|
15162
15162
|
const deadline = AbortSignal.timeout(DISPATCH_TOOL_DEADLINE_MS);
|
|
15163
15163
|
return signal === undefined ? deadline : AbortSignal.any([signal, deadline]);
|
|
15164
15164
|
}
|
|
15165
|
+
function whyNotAPage(answer) {
|
|
15166
|
+
if (typeof answer === "string") {
|
|
15167
|
+
return "text that is not a JSON page, which looks like a proxy or gateway page rather than " + "Dispatch's own answer, so a retry may succeed.";
|
|
15168
|
+
}
|
|
15169
|
+
let what;
|
|
15170
|
+
if (Array.isArray(answer)) {
|
|
15171
|
+
what = `a bare array of ${answer.length} entries, the unpaged listing, which means that Dispatch ` + "is older than sjawhar/legion#1612 or that change has regressed";
|
|
15172
|
+
} else if (answer === null || typeof answer !== "object") {
|
|
15173
|
+
what = answer === null ? "null" : `a ${typeof answer}`;
|
|
15174
|
+
} else {
|
|
15175
|
+
const fields = answer;
|
|
15176
|
+
const lacking = [
|
|
15177
|
+
...Array.isArray(fields.issues) ? [] : ["an issues array"],
|
|
15178
|
+
...["total", "limit", "offset"].filter((name) => typeof fields[name] !== "number").map((name) => `a numeric ${name}`)
|
|
15179
|
+
];
|
|
15180
|
+
if (lacking.length === 0)
|
|
15181
|
+
return;
|
|
15182
|
+
what = `an object without ${lacking.join(" or ")}`;
|
|
15183
|
+
}
|
|
15184
|
+
return `${what}. Retrying will not help: the same request gets the same answer until that ` + "Dispatch is upgraded or fixed.";
|
|
15185
|
+
}
|
|
15165
15186
|
|
|
15166
15187
|
class DispatchClient {
|
|
15167
15188
|
token;
|
|
@@ -15182,25 +15203,13 @@ class DispatchClient {
|
|
|
15182
15203
|
return this.#resolveIssue(issueReference);
|
|
15183
15204
|
}
|
|
15184
15205
|
async listIssuePage(options, page) {
|
|
15185
|
-
const
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
return {
|
|
15193
|
-
issues: issues.slice(page.offset, page.offset + page.limit),
|
|
15194
|
-
total: issues.length,
|
|
15195
|
-
limit: page.limit,
|
|
15196
|
-
offset: page.offset
|
|
15197
|
-
};
|
|
15198
|
-
}
|
|
15199
|
-
const served = answer;
|
|
15200
|
-
if (typeof served !== "object" || served === null || !Array.isArray(served.issues) || typeof served.total !== "number" || typeof served.limit !== "number" || typeof served.offset !== "number") {
|
|
15201
|
-
throw new Error("GET /api/v1/issues answered neither a page ({issues, total, limit, offset}) nor an array of issues");
|
|
15202
|
-
}
|
|
15203
|
-
return served;
|
|
15206
|
+
const path2 = ["api", "v1", "issues"];
|
|
15207
|
+
const query = { ...options, limit: page.limit, offset: page.offset };
|
|
15208
|
+
const answer = await this.#json("GET", path2, undefined, query);
|
|
15209
|
+
const refusal = whyNotAPage(answer);
|
|
15210
|
+
if (refusal === undefined)
|
|
15211
|
+
return answer;
|
|
15212
|
+
throw new Error(`GET ${this.#url(path2, query)} asked for a page ({issues, total, limit, offset}) and got ` + refusal);
|
|
15204
15213
|
}
|
|
15205
15214
|
async listProjectArtifacts(project, unlinked = false) {
|
|
15206
15215
|
return this.#json("GET", ["api", "v1", "projects", project, "artifacts"], undefined, unlinked ? { unlinked: "true" } : undefined);
|