@sjawhar/opencode-legion-envoy 1.20.1 → 1.20.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 +13 -2
- package/package.json +1 -1
package/dist/src/server.js
CHANGED
|
@@ -15422,12 +15422,23 @@ async function executeDispatchTool(input) {
|
|
|
15422
15422
|
if (!input.config.enabled || !configUrl || !configToken) {
|
|
15423
15423
|
throw new Error("Dispatch is disabled; resolve both DISPATCH_URL and DISPATCH_TOKEN");
|
|
15424
15424
|
}
|
|
15425
|
+
const baseFetch = input.fetchImpl ?? fetch;
|
|
15426
|
+
const fetchImpl = Object.assign(async (...args) => {
|
|
15427
|
+
try {
|
|
15428
|
+
return await baseFetch(...args);
|
|
15429
|
+
} catch (error) {
|
|
15430
|
+
if (error instanceof TypeError) {
|
|
15431
|
+
throw new Error(`Dispatch at ${configUrl} is unreachable: ${error.message}. If the Dispatch URL changed, restart this agent process so it picks up the new configuration.`);
|
|
15432
|
+
}
|
|
15433
|
+
throw error;
|
|
15434
|
+
}
|
|
15435
|
+
}, { preconnect: baseFetch.preconnect });
|
|
15425
15436
|
if (input.tool === "dispatch_open_asks") {
|
|
15426
15437
|
const sessionId = input.sessionId?.trim();
|
|
15427
15438
|
if (!sessionId)
|
|
15428
15439
|
throw new Error("host session id is required for dispatch_open_asks");
|
|
15429
15440
|
toolSchema(input.tool).parse(input.args);
|
|
15430
|
-
const client = new DispatchClient(configUrl, configToken,
|
|
15441
|
+
const client = new DispatchClient(configUrl, configToken, fetchImpl, input.signal);
|
|
15431
15442
|
const response = await client.openAsks(sessionId);
|
|
15432
15443
|
return { text: formatOpenAsksSummary(response, configUrl), details: { ...response } };
|
|
15433
15444
|
}
|
|
@@ -15436,7 +15447,7 @@ async function executeDispatchTool(input) {
|
|
|
15436
15447
|
const ownerArguments = await resolveOwnerArguments(input.tool, input.args, input.cwd, env, exec);
|
|
15437
15448
|
const args = toolSchema(input.tool).parse(ownerArguments.args);
|
|
15438
15449
|
const actor = toolActor(await resolveOrigin(env, exec, input.cwd), input);
|
|
15439
|
-
const client = new DispatchClient(configUrl, configToken,
|
|
15450
|
+
const client = new DispatchClient(configUrl, configToken, fetchImpl, input.signal);
|
|
15440
15451
|
const owner = ownerArguments.owner?.kind === "issue" ? {
|
|
15441
15452
|
kind: "issue",
|
|
15442
15453
|
issue: await ensureIssue(client, ownerArguments.owner.issue, actor)
|