From ff7a9069f08b4b2784dc9a6bf8893bb1e1bf414d Mon Sep 17 00:00:00 2001 From: ReqX Date: Sat, 30 May 2026 21:54:54 +0000 Subject: [PATCH] fix(routing): add agy to executor map so it uses AntigravityExecutor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The agy provider was registered in providerRegistry.ts with executor: "antigravity" but the executor map in executors/index.ts only had an "antigravity" entry. getExecutor("agy") fell through to DefaultExecutor, which returned undefined for baseUrl (agy only has baseUrls), causing fetch(undefined) → TypeError: Cannot read properties of undefined (reading 'toString'). Closes diegosouzapw/OmniRoute#2932 --- open-sse/executors/index.ts | 1 + tests/unit/executor-agy.test.ts | 39 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/unit/executor-agy.test.ts diff --git a/open-sse/executors/index.ts b/open-sse/executors/index.ts index d5428950ac..245e772328 100644 --- a/open-sse/executors/index.ts +++ b/open-sse/executors/index.ts @@ -48,6 +48,7 @@ import { DoubaoWebExecutor } from "./doubao-web.ts"; const executors = { antigravity: new AntigravityExecutor(), + agy: new AntigravityExecutor(), "gemini-cli": new GeminiCLIExecutor(), github: new GithubExecutor(), qoder: new QoderExecutor(), diff --git a/tests/unit/executor-agy.test.ts b/tests/unit/executor-agy.test.ts new file mode 100644 index 0000000000..07975cb18d --- /dev/null +++ b/tests/unit/executor-agy.test.ts @@ -0,0 +1,39 @@ +import test from "node:test"; +import assert from "node:assert/strict"; + +import { getExecutor, AntigravityExecutor } from "../../open-sse/executors/index.ts"; + +test("getExecutor('agy') returns AntigravityExecutor (not DefaultExecutor)", () => { + const executor = getExecutor("agy"); + assert.ok(executor instanceof AntigravityExecutor, "agy provider should use AntigravityExecutor"); +}); + +test("getExecutor('antigravity') returns AntigravityExecutor", () => { + const executor = getExecutor("antigravity"); + assert.ok(executor instanceof AntigravityExecutor, "antigravity provider should use AntigravityExecutor"); +}); + +test("getExecutor('agy') builds valid streaming URL", () => { + const executor = getExecutor("agy"); + const url = executor.buildUrl("gemini-3-flash", true); + assert.ok( + url.includes("streamGenerateContent?alt=sse"), + `expected streaming endpoint URL, got: ${url}` + ); +}); + +test("getExecutor('agy') builds valid non-streaming URL", () => { + const executor = getExecutor("agy"); + const url = executor.buildUrl("gemini-3-flash", false); + // Antigravity executor always uses streaming endpoint (buildUrl ignores stream flag) + assert.ok( + url.includes("streamGenerateContent?alt=sse"), + `expected streaming endpoint URL (always), got: ${url}` + ); +}); + +test("getExecutor('agy') buildHeaders returns Bearer auth", () => { + const executor = getExecutor("agy"); + const headers = executor.buildHeaders({ accessToken: "test-token" }); + assert.equal(headers.Authorization, "Bearer test-token"); +});