mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-05-05 17:56:56 +00:00
- introduce open-sse/translator/helpers/schemaCoercion.ts to coerce numeric JSON Schema fields encoded as strings - wire coerceToolSchemas and sanitizeToolDescriptions into translator pipeline; ensure tool descriptions are sanitized - inject empty reasoning content for tool calls when target is OpenAI format - update qwen base URL to DashScope-compatible endpoint - extend antigravity static catalog with Gemini 3.1 pro preview models and update Gemini model specs with preview aliases - implement call log max cap caching with TTL; expose invalidateCallLogsMaxCache and invalidate on settings PATCH - add tests: call-log-cap.test.mjs and tool-request-sanitization.test.mjs; extend tests for Windsurf integration and gemini previews - update CLI runtime and tools to include Windsurf as a guide-only tool - add maxCallLogs to validation schemas (settings and updateSettings) - add Czech README (README.cs.md) to repository
82 lines
2.9 KiB
JavaScript
82 lines
2.9 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import path from "node:path";
|
|
|
|
const { CLI_TOOLS } = await import("../../src/shared/constants/cliTools.ts");
|
|
const { resolveOpencodeConfigPath } = await import("../../src/shared/services/cliRuntime.ts");
|
|
const { buildOpenCodeProviderConfig, mergeOpenCodeConfig } =
|
|
await import("../../src/shared/services/opencodeConfig.ts");
|
|
|
|
test("T40: OpenCode card documents config paths and --variant usage", () => {
|
|
const opencode = CLI_TOOLS.opencode;
|
|
assert.ok(opencode, "OpenCode tool card must exist");
|
|
|
|
const notesText = (opencode.notes || [])
|
|
.map((note) => note?.text || "")
|
|
.join(" ")
|
|
.toLowerCase();
|
|
|
|
assert.match(notesText, /\.config\/opencode\/opencode\.json/);
|
|
assert.match(notesText, /%appdata%/);
|
|
assert.match(notesText, /--variant/);
|
|
});
|
|
|
|
test("T40: OpenCode config path resolves per-platform", () => {
|
|
const linuxWithXdg = resolveOpencodeConfigPath(
|
|
"linux",
|
|
{ XDG_CONFIG_HOME: "/tmp/xdg-config-home" },
|
|
"/home/dev"
|
|
);
|
|
assert.equal(linuxWithXdg, path.join("/tmp/xdg-config-home", "opencode", "opencode.json"));
|
|
|
|
const linuxDefault = resolveOpencodeConfigPath("linux", {}, "/home/dev");
|
|
assert.equal(linuxDefault, path.join("/home/dev", ".config", "opencode", "opencode.json"));
|
|
|
|
const windowsPath = resolveOpencodeConfigPath(
|
|
"win32",
|
|
{ APPDATA: "C:\\Users\\dev\\AppData\\Roaming" },
|
|
"C:\\Users\\dev"
|
|
);
|
|
assert.equal(
|
|
windowsPath,
|
|
path.join("C:\\Users\\dev\\AppData\\Roaming", "opencode", "opencode.json")
|
|
);
|
|
});
|
|
|
|
test("T40: OpenCode config generator includes endpoint and selected API key", () => {
|
|
const providerConfig = buildOpenCodeProviderConfig({
|
|
baseUrl: "http://localhost:20128/v1/",
|
|
apiKey: "sk_test_opencode",
|
|
model: "claude-sonnet-4-5-thinking",
|
|
});
|
|
assert.equal(providerConfig.baseURL, "http://localhost:20128/v1");
|
|
assert.equal(providerConfig.apiKey, "sk_test_opencode");
|
|
assert.ok(providerConfig.models.includes("claude-sonnet-4-5-thinking"));
|
|
|
|
const mergedConfig = mergeOpenCodeConfig(
|
|
{ providers: { custom: { name: "Custom Provider" } } },
|
|
{
|
|
baseUrl: "http://localhost:20128/v1",
|
|
apiKey: "sk_test_opencode",
|
|
model: "claude-sonnet-4-5-thinking",
|
|
}
|
|
);
|
|
assert.ok(mergedConfig.providers.custom);
|
|
assert.equal(mergedConfig.providers.omniroute.baseURL, "http://localhost:20128/v1");
|
|
assert.equal(mergedConfig.providers.omniroute.apiKey, "sk_test_opencode");
|
|
});
|
|
|
|
test("T40: Windsurf card documents current official limitations honestly", () => {
|
|
const windsurf = CLI_TOOLS.windsurf;
|
|
assert.ok(windsurf, "Windsurf tool card must exist");
|
|
assert.equal(windsurf.configType, "guide");
|
|
|
|
const notesText = (windsurf.notes || [])
|
|
.map((note) => note?.text || "")
|
|
.join(" ")
|
|
.toLowerCase();
|
|
|
|
assert.match(notesText, /byok/);
|
|
assert.match(notesText, /custom openai-compatible provider/);
|
|
assert.match(notesText, /proxy documentation is for network proxies/);
|
|
});
|