- translator/index.js: replace require() with static side-effect imports (ESM-safe), lazy-init registry maps to survive circular import order - openai-responses->openai: map max_output_tokens -> max_tokens (avoid leaking field upstream) - gemini/antigravity -> openai: derive deterministic tool_call id from name so functionCall/functionResponse pair correctly (fixes provider tool-pairing 400s) - add offline unit tests (finish-reason, usage, session-manager, ollama malformed args, const guard) - add real-creds integration tests (provider-cases + all-formats matrix: 6 inbound formats x 4 scenarios) Includes co-located provider registry refactor (pricing/capabilities/media providers) and sessionManager updates. Co-authored-by: Cursor <cursoragent@cursor.com>
49 lines
1.7 KiB
JavaScript
49 lines
1.7 KiB
JavaScript
// A5 (cases #7/#9/#10): lock hardcode->config no-op values.
|
|
import { describe, it, expect } from "vitest";
|
|
import {
|
|
OPENAI_COMPAT_BASE,
|
|
ANTHROPIC_COMPAT_BASE,
|
|
ANTHROPIC_API_VERSION,
|
|
} from "../../open-sse/providers/shared.js";
|
|
import { DEFAULT_MAX_TOKENS, DEFAULT_MIN_TOKENS } from "../../open-sse/config/runtimeConfig.js";
|
|
import mimoFree from "../../open-sse/providers/registry/mimo-free.js";
|
|
import opencode from "../../open-sse/providers/registry/opencode.js";
|
|
import antigravity from "../../open-sse/providers/registry/antigravity.js";
|
|
|
|
describe("compat base URLs / version", () => {
|
|
it("OPENAI_COMPAT_BASE", () => {
|
|
expect(OPENAI_COMPAT_BASE).toBe("https://api.openai.com/v1");
|
|
});
|
|
it("ANTHROPIC_COMPAT_BASE", () => {
|
|
expect(ANTHROPIC_COMPAT_BASE).toBe("https://api.anthropic.com/v1");
|
|
});
|
|
it("ANTHROPIC_API_VERSION", () => {
|
|
expect(ANTHROPIC_API_VERSION).toBe("2023-06-01");
|
|
});
|
|
});
|
|
|
|
describe("default token limits", () => {
|
|
it("max/min", () => {
|
|
expect(DEFAULT_MAX_TOKENS).toBe(64000);
|
|
expect(DEFAULT_MIN_TOKENS).toBe(32000);
|
|
});
|
|
});
|
|
|
|
describe("provider baseUrl const (full path, no trailing slash)", () => {
|
|
it("mimo-free full path", () => {
|
|
expect(mimoFree.transport.baseUrl).toBe("https://api.xiaomimimo.com/api/free-ai/openai/chat");
|
|
});
|
|
it("opencode no trailing slash", () => {
|
|
expect(opencode.transport.baseUrl).toBe("https://opencode.ai");
|
|
});
|
|
});
|
|
|
|
describe("antigravity retry (intentional change: 429=6, 503=3)", () => {
|
|
it("429 attempts = 6", () => {
|
|
expect(antigravity.transport.retry["429"].attempts).toBe(6);
|
|
});
|
|
it("503 attempts = 3", () => {
|
|
expect(antigravity.transport.retry["503"].attempts).toBe(3);
|
|
});
|
|
});
|