@sjawhar/opencode-legion-envoy 3.19.1 → 3.19.3
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 +30 -19
- package/package.json +1 -1
package/dist/src/server.js
CHANGED
|
@@ -14361,6 +14361,8 @@ var EnvelopeSchema = exports_external.object({
|
|
|
14361
14361
|
urgency: exports_external.enum(["low", "med", "high", "blocking"]).optional(),
|
|
14362
14362
|
expects_reply: exports_external.enum(["none", "optional", "required"]).optional()
|
|
14363
14363
|
});
|
|
14364
|
+
var MINTED_DEDUPE_KEY_PATTERN = "^(?:envoy\\.role\\.forward\\.)?(?:publish|agent\\.[^.]+)\\.(?:[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$";
|
|
14365
|
+
var mintedDedupeKey = new RegExp(MINTED_DEDUPE_KEY_PATTERN);
|
|
14364
14366
|
// ../contracts/src/handoff-schema.ts
|
|
14365
14367
|
var HANDOFF_SCHEMA_VERSION = 1;
|
|
14366
14368
|
var HANDOFF_PHASES = ["architect", "plan", "implement", "test", "review"];
|
|
@@ -15162,6 +15164,27 @@ function requestSignal(signal) {
|
|
|
15162
15164
|
const deadline = AbortSignal.timeout(DISPATCH_TOOL_DEADLINE_MS);
|
|
15163
15165
|
return signal === undefined ? deadline : AbortSignal.any([signal, deadline]);
|
|
15164
15166
|
}
|
|
15167
|
+
function whyNotAPage(answer) {
|
|
15168
|
+
if (typeof answer === "string") {
|
|
15169
|
+
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.";
|
|
15170
|
+
}
|
|
15171
|
+
let what;
|
|
15172
|
+
if (Array.isArray(answer)) {
|
|
15173
|
+
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";
|
|
15174
|
+
} else if (answer === null || typeof answer !== "object") {
|
|
15175
|
+
what = answer === null ? "null" : `a ${typeof answer}`;
|
|
15176
|
+
} else {
|
|
15177
|
+
const fields = answer;
|
|
15178
|
+
const lacking = [
|
|
15179
|
+
...Array.isArray(fields.issues) ? [] : ["an issues array"],
|
|
15180
|
+
...["total", "limit", "offset"].filter((name) => typeof fields[name] !== "number").map((name) => `a numeric ${name}`)
|
|
15181
|
+
];
|
|
15182
|
+
if (lacking.length === 0)
|
|
15183
|
+
return;
|
|
15184
|
+
what = `an object without ${lacking.join(" or ")}`;
|
|
15185
|
+
}
|
|
15186
|
+
return `${what}. Retrying will not help: the same request gets the same answer until that ` + "Dispatch is upgraded or fixed.";
|
|
15187
|
+
}
|
|
15165
15188
|
|
|
15166
15189
|
class DispatchClient {
|
|
15167
15190
|
token;
|
|
@@ -15182,25 +15205,13 @@ class DispatchClient {
|
|
|
15182
15205
|
return this.#resolveIssue(issueReference);
|
|
15183
15206
|
}
|
|
15184
15207
|
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;
|
|
15208
|
+
const path2 = ["api", "v1", "issues"];
|
|
15209
|
+
const query = { ...options, limit: page.limit, offset: page.offset };
|
|
15210
|
+
const answer = await this.#json("GET", path2, undefined, query);
|
|
15211
|
+
const refusal = whyNotAPage(answer);
|
|
15212
|
+
if (refusal === undefined)
|
|
15213
|
+
return answer;
|
|
15214
|
+
throw new Error(`GET ${this.#url(path2, query)} asked for a page ({issues, total, limit, offset}) and got ` + refusal);
|
|
15204
15215
|
}
|
|
15205
15216
|
async listProjectArtifacts(project, unlinked = false) {
|
|
15206
15217
|
return this.#json("GET", ["api", "v1", "projects", project, "artifacts"], undefined, unlinked ? { unlinked: "true" } : undefined);
|