refactor(open-sse): registry consolidation + DRY media/oauth/adhoc cleanup
- Single-source registry: oauth clientId/tokenUrl, usage URLs, image/embed configs, search defaultModel, codex fixedPort, google token url derive. - Remove 29 unused OmniRoute providers (registry 100→71); media intact. - De-adhoc: codex literals → registry format/oauth flags; reasoningInject, image/embed openrouter headers + xai bodyFields config-driven. - Add REGISTRY_TEMPLATE.js + expand PROVIDER_DEFAULTS/schema JSDoc. - Baselines updated; PROVIDERS 62 + alias 90 byte-for-byte, golden snapshots. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -31,8 +31,7 @@ describe("antigravity oauth client (deduped)", () => {
|
||||
expect(gc.transport.clientSecret).toBe(GOOGLE.clientSecret);
|
||||
});
|
||||
|
||||
// Vitest can't resolve the `@/` alias used inside oauth.js (pre-existing infra gap),
|
||||
// so guard the refactor textually: it must spread the shared client + keep other fields.
|
||||
// Guard: oauth.js must spread shared clients + derive from registry (PROVIDER_OAUTH).
|
||||
it("src oauth.js imports shared client + keeps full shape", async () => {
|
||||
const { readFileSync } = await import("node:fs");
|
||||
const { fileURLToPath } = await import("node:url");
|
||||
@@ -42,7 +41,9 @@ describe("antigravity oauth client (deduped)", () => {
|
||||
expect(src).toContain('import { ANTIGRAVITY_OAUTH_CLIENT, GOOGLE_OAUTH_CLIENT } from "open-sse/providers/shared.js"');
|
||||
expect(src).toContain("...ANTIGRAVITY_OAUTH_CLIENT");
|
||||
expect(src).toContain("...GOOGLE_OAUTH_CLIENT");
|
||||
expect(src).toContain('authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth"');
|
||||
// authorizeUrl now lives in registry; oauth.js derives via PROVIDER_OAUTH spread
|
||||
expect(src).toContain('PROVIDER_OAUTH["antigravity"]');
|
||||
expect(src).toContain('PROVIDER_OAUTH["gemini-cli"]');
|
||||
expect(src).not.toContain(EXPECTED.clientSecret); // antigravity secret no longer hardcoded here
|
||||
expect(src).not.toContain(GOOGLE.clientSecret); // gemini secret no longer hardcoded here
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user