Files
OmniRoute/tests/unit/providers-page-utils.test.ts
Diego Rodrigues de Sa e Souza 75d9a83c25 Release v3.8.3 (#2617)
* chore(config): ignore additional agent workflow command files

Add newly introduced agent workflow and Claude command files to
.gitignore so proprietary automation assets are not committed.

* feat(deepseek-web): fix auth to use userToken + WASM PoW solver

Rewrite deepseek-web executor from broken cookie auth to userToken
Bearer flow (like Chat2API). Replace pure JS Keccak PoW with WASM
solver (5.8s → 86ms). Add 14 models, validation, and dashboard UX.

* fix(deepseek-web): update target_path to use challenge property

* refactor(deepseek-web): streamline token handling and implement cache eviction

* fix(deepseek-web): fix SSE parser, prompt format, and error handling

- Handle all 3 DeepSeek SSE stream formats: initial fragments,
  APPEND operations, and bare string tokens (fixes truncated responses)
- Simplify prompt builder to send system + last user message only
  (DeepSeek web API is single-turn, full history caused marker leakage)
- Check json.code before token extraction (fixes "did not return
  access token: Authorization" on code 40003 with HTTP 200)
- Clear session cache alongside token cache on auth errors
- Add dev origin for remote testing

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: ignore memory-bank and cursor agent rules from tracking

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: enhance documentation and configuration for Fumadocs integration

- Added Fumadocs MDX support in the Next.js configuration.
- Updated transpile packages to include fumadocs-ui and fumadocs-core.
- Implemented a comprehensive set of redirects for documentation paths to improve navigation.
- Removed the generate-docs-index script as it is no longer needed.
- Updated various documentation titles for consistency and clarity.
- Enhanced global styles to incorporate Fumadocs UI themes and styles.

* refactor(docs): cleanup fumadocs PR — revert deepseek, add i18n fallback, restore LanguageSelector

- Revert unrelated deepseek-web.ts changes (should be separate PR)
- Add .source/ to .gitignore (Fumadocs generated files)
- Remove contributor IP from allowedDevOrigins
- Add i18n runtime fallback: reads NEXT_LOCALE cookie, loads translated
  .md from docs/i18n/<locale>/docs/ (preserves existing translation pipeline)
- Restore LanguageSelector in Fumadocs layout nav
- Restore SEO metadata (title template, description, robots)

* fix(codex): use allowlist to strip non-Responses-API fields in non-passthrough path (#2608) (#2615)

Integrated into release/v3.8.3 — fix(codex): allowlist-based sanitization for gpt-5.5 Responses API

* fix(deepseek-web): fix SSE parser, prompt format, error handling, and cache keys (#2616)

Integrated into release/v3.8.3 — fix(deepseek-web): SSE parser (APPEND + bare tokens), prompt builder, error handling, session cache cleanup

* chore(config): ignore additional agent workflow command files

Add newly introduced agent workflow and Claude command files to
.gitignore so proprietary automation assets are not committed.

* feat(docs): migrate /docs to Fumadocs MDX with nested routes (#2614)

Integrated into release/v3.8.3 — Fumadocs MDX migration with nested routes, search API, and 50+ URL redirects

* fix(catalog): skip static PROVIDER_MODELS when synced models exist (#2625)

Integrated into release/v3.8.3

* fix(qoder): Cosy auth fallback for PAT tokens + vision support for qwen3-vl-plus (#2629)

Integrated into release/v3.8.3

* fix(cli): register tsx loader and add opencode config subcommand (#2631)

Integrated into release/v3.8.3

* feat(dashboard): add search and filters to /dashboard/api-manager (#2628)

Integrated into release/v3.8.3

* fix(claude): improve Pi and OpenCode compatibility (#2621)

Integrated into release/v3.8.3

* fix: restore semantic passthrough system-role-only extraction instead of full normalization (#2620)

Integrated into release/v3.8.3

* fix(kiro): stabilize conversationId across prompt compression (#2630)

Integrated into release/v3.8.3

* fix(deepseek-web): SSE thinking/search routing and session lifecycle (#2624)

Integrated into release/v3.8.3 — DeepSeek Web SSE thinking/search routing overhaul

* feat(dashboard): free-tier grouping with symbolic link in /providers (#2632)

Integrated into release/v3.8.3

* fix: close implementation gaps — t3-chat-web, stream_options, combo_strategy, batch config (#2634)

Integrated into release/v3.8.3

* feat(dashboard): risk notice modal for sensitive providers (#2633)

Integrated into release/v3.8.3

* fix(reasoning): extend reasoning_content injection to Kimi K2 and other replay models (#2639)

Integrated into release/v3.8.3

* fix(cli): Linux autostart via systemd user service (fixes #2627) (#2635)

Integrated into release/v3.8.3

* Refactor/providers free tier (#2640)

Integrated into release/v3.8.3

* fix(tests): remove duplicate assertion in schema coercion & fix(cli): ignore system vars in env check

* fix(combo): preserve omniModel tag in streaming output for round-trip context pinning (#2646)

Integrated into release/v3.8.3

* feat(dashboard): media providers pages + Web Fetch category (#2645)

Integrated into release/v3.8.3

* Feature provider adapta org com tutorial de conexão em modal (#2643)

Integrated into release/v3.8.3

* fix(rtk): skip content-based filter matching for non-shell tool results (#2642)

Integrated into release/v3.8.3

* fix(translator): enable Claude extended thinking for Copilot Responses-API requests (#2647)

Integrated into release/v3.8.3

* feat(dashboard): add search and filters to /dashboard/api-manager (#2641)

Integrated into release/v3.8.3

* feat(dashboard): risk notice modal for sensitive providers (#2638)

Integrated into release/v3.8.3

* feat(dashboard): mini-playground inline (Phase 4) (#2648)

Integrated into release/v3.8.3

* fix(settings): fix Require Login modal Cancel button text and dismissal (#2649)

Integrated into release/v3.8.3

* feat(combos): universal context handoff for cross-model conversation continuity (#2653)

Integrated into release/v3.8.3

* chore(release): bump to v3.8.3 — changelog, docs, version sync

* feat(i18n): complete zh-CN translations for 1220 missing keys (#2655)

Integrated into release/v3.8.3

* chore(release): include electron package changes in v3.8.3

* docs(changelog): integrate PR #2655 into v3.8.3

* feat(i18n): translate 377 additional zh-CN entries (81 new keys + 296 same-as-en) (#2659)

Integrated into release/v3.8.3

* feat(dashboard): add Cmd+K / Ctrl+K command palette for sidebar navigation (#2656)

Integrated into release/v3.8.3

* docs: update changelog for PR integrations under v3.8.3

* feat(cli): integrate native updates, autostart and headless CLI mode (#2662)

Integrated into release/v3.8.3

* fix(proxy): save dashboard custom proxies in registry (#2661)

Integrated into release/v3.8.3

* feat(dashboard): chat-first test slide-over (Option A) (#2660)

Integrated into release/v3.8.3

* docs: update changelog with Batch 2 PR merges for v3.8.3

* fix: add xhigh+max to effortLevel schema; add opencode-plugin publish job (#2666)

Integrated into release/v3.8.3

* docs: update changelog with Batch 3 PR #2666 merge for v3.8.3

* feat(quota+providers): card-grid layout, provider group headers, Codex race fix (#2667)

Integrated into release/v3.8.3

* feat(dashboard): real-time live WebSocket monitoring (#2668)

Integrated into release/v3.8.3

* feat(copilot): AI assistant with CodeGraph + CLI + knowledge base (#2669)

Integrated into release/v3.8.3

* feat(pipeline): pre-request middleware hooks (#2670)

Integrated into release/v3.8.3

* feat(resilience): credential health check + adaptive circuit breaker (#2671)

Integrated into release/v3.8.3

* feat(playground): combo routing visual simulator (#2672)

Integrated into release/v3.8.3

* feat(auth): API key groups with model-level permissions (#2673)

Integrated into release/v3.8.3

* feat(pwa): enhanced manifest + push notification support (#2674)

Integrated into release/v3.8.3

* feat(proxy): serverless relay endpoints with rate limiting (#2675)

Integrated into release/v3.8.3

* docs(changelog): update changelog for PRs 2667-2675 & fix: resolve typescript compile-time errors

* fix(db): remove transactions from migrations

Remove explicit transaction wrappers from recent migrations and correct
the API key groups migration metadata. Also fix codegraph path resolution
for ESM environments and refresh generated fumadocs source output.

---------

Co-authored-by: Ömer Vehbe <ovehbe@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Mr. Meowgi <mr@meowgi.dev>
Co-authored-by: Hernan Javier Ardila Sanchez <hjasgr@gmail.com>
Co-authored-by: amogus22877769 <y.lev357@gmail.com>
Co-authored-by: Halil Tezcan KARABULUT <info@hlltzcnkb.com>
Co-authored-by: Tentoxa <53821604+Tentoxa@users.noreply.github.com>
Co-authored-by: HALDRO <121296348+HALDRO@users.noreply.github.com>
Co-authored-by: Paijo <14921983+oyi77@users.noreply.github.com>
Co-authored-by: janeza2 <49841619+janeza2@users.noreply.github.com>
Co-authored-by: df4p <38404+df4p@users.noreply.github.com>
Co-authored-by: ivan-mezentsev <ivan@mezentsev.me>
Co-authored-by: Chewji <126886556+Chewji9875@users.noreply.github.com>
Co-authored-by: L-aros <107354918+L-aros@users.noreply.github.com>
Co-authored-by: M.M <mr.maatoug@gmail.com>
Co-authored-by: Benson K B <bensonkbmca@gmail.com>
Co-authored-by: terence71-glitch <mcdowellterence71@gmail.com>
2026-05-24 18:05:58 -03:00

625 lines
26 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
const providerPageUtils =
await import("../../src/app/(dashboard)/dashboard/providers/providerPageUtils.ts");
const providerPageStorage =
await import("../../src/app/(dashboard)/dashboard/providers/providerPageStorage.ts");
const providers = await import("../../src/shared/constants/providers.ts");
const providerCatalog = await import("../../src/lib/providers/catalog.ts");
test("merged OAuth providers keep free-tier providers in the OAuth section", () => {
const statsCalls = [];
const getProviderStats = (providerId, authType) => {
statsCalls.push({ providerId, authType });
return { total: authType === "free" ? 1 : 0 };
};
const mockOauthProviders = { claude: { name: "Claude" } };
const mockFreeProviders = { "gemini-cli": { name: "Gemini CLI" } };
const entries = providerPageUtils.buildMergedOAuthProviderEntries(
mockOauthProviders,
mockFreeProviders,
getProviderStats
);
const oauthIds = Object.keys(mockOauthProviders);
const freeIds = Object.keys(mockFreeProviders);
assert.deepEqual(
entries.slice(0, oauthIds.length).map((entry) => entry.providerId),
oauthIds
);
assert.deepEqual(
entries.slice(oauthIds.length).map((entry) => entry.providerId),
freeIds
);
const freeEntry = entries.find((entry) => entry.providerId === freeIds[0]);
assert.ok(freeEntry, "Should find the free entry");
assert.equal(freeEntry.displayAuthType, "oauth");
assert.equal(freeEntry.toggleAuthType, "free");
assert.equal(
statsCalls.some((call) => call.providerId === freeIds[0] && call.authType === "free"),
true
);
});
test("configured-only filter keeps only providers with saved connections", () => {
const entries = [
{
providerId: "claude",
provider: { id: "claude" },
stats: { total: 2 },
displayAuthType: "oauth",
toggleAuthType: "oauth",
},
{
providerId: "codex",
provider: { id: "codex" },
stats: { total: 0 },
displayAuthType: "oauth",
toggleAuthType: "oauth",
},
{
providerId: "cursor",
provider: { id: "cursor" },
stats: { total: 1 },
displayAuthType: "oauth",
toggleAuthType: "oauth",
},
];
const visible = providerPageUtils.filterConfiguredProviderEntries(entries, true);
assert.deepEqual(
visible.map((entry) => entry.providerId),
["claude", "cursor"]
);
assert.equal(providerPageUtils.filterConfiguredProviderEntries(entries, false).length, 3);
});
test("search filter matches provider name and id case-insensitively", () => {
const entries = [
{
providerId: "claude",
provider: { id: "claude", name: "Claude" },
stats: { total: 2 },
displayAuthType: "oauth",
toggleAuthType: "oauth",
},
{
providerId: "openai",
provider: { id: "openai", name: "OpenAI" },
stats: { total: 1 },
displayAuthType: "oauth",
toggleAuthType: "oauth",
},
{
providerId: "gemini",
provider: { id: "gemini", name: "Google Gemini" },
stats: { total: 1 },
displayAuthType: "oauth",
toggleAuthType: "oauth",
},
];
const byName = providerPageUtils.filterConfiguredProviderEntries(entries, false, "claude");
assert.deepEqual(
byName.map((e) => e.providerId),
["claude"]
);
const byNameCaseInsensitive = providerPageUtils.filterConfiguredProviderEntries(
entries,
false,
"OPENAI"
);
assert.deepEqual(
byNameCaseInsensitive.map((e) => e.providerId),
["openai"]
);
const byPartialName = providerPageUtils.filterConfiguredProviderEntries(entries, false, "google");
assert.deepEqual(
byPartialName.map((e) => e.providerId),
["gemini"]
);
const byId = providerPageUtils.filterConfiguredProviderEntries(entries, false, "gem");
assert.deepEqual(
byId.map((e) => e.providerId),
["gemini"]
);
const noMatch = providerPageUtils.filterConfiguredProviderEntries(entries, false, "xyz");
assert.equal(noMatch.length, 0);
const emptySearch = providerPageUtils.filterConfiguredProviderEntries(entries, false, "");
assert.equal(emptySearch.length, 3);
const whitespaceSearch = providerPageUtils.filterConfiguredProviderEntries(entries, false, " ");
assert.equal(whitespaceSearch.length, 3);
});
test("search and configured-only filters work together", () => {
const entries = [
{
providerId: "claude",
provider: { id: "claude", name: "Claude" },
stats: { total: 2 },
displayAuthType: "oauth",
toggleAuthType: "oauth",
},
{
providerId: "openai",
provider: { id: "openai", name: "OpenAI" },
stats: { total: 0 },
displayAuthType: "oauth",
toggleAuthType: "oauth",
},
{
providerId: "gemini",
provider: { id: "gemini", name: "Google Gemini" },
stats: { total: 1 },
displayAuthType: "oauth",
toggleAuthType: "oauth",
},
];
const configuredAndSearched = providerPageUtils.filterConfiguredProviderEntries(
entries,
true,
"claude"
);
assert.deepEqual(
configuredAndSearched.map((e) => e.providerId),
["claude"]
);
const configuredButNoMatch = providerPageUtils.filterConfiguredProviderEntries(
entries,
true,
"openai"
);
assert.equal(configuredButNoMatch.length, 0);
});
test("configured-only preference parser only enables explicit true values", () => {
assert.equal(providerPageStorage.parseConfiguredOnlyPreference("true"), true);
assert.equal(providerPageStorage.parseConfiguredOnlyPreference("false"), false);
assert.equal(providerPageStorage.parseConfiguredOnlyPreference(null), false);
assert.equal(providerPageStorage.parseConfiguredOnlyPreference(undefined), false);
});
test("configured-only filter is ignored before the first provider is connected", () => {
assert.equal(providerPageUtils.shouldApplyConfiguredOnlyFilter(true, 0), false);
assert.equal(providerPageUtils.shouldApplyConfiguredOnlyFilter(false, 0), false);
assert.equal(providerPageUtils.shouldApplyConfiguredOnlyFilter(true, 1), true);
});
test("first-provider hint is shown only when no providers are connected and search is empty", () => {
assert.equal(providerPageUtils.shouldShowFirstProviderHint(0, ""), true);
assert.equal(providerPageUtils.shouldShowFirstProviderHint(0, " "), true);
assert.equal(providerPageUtils.shouldShowFirstProviderHint(0, "codex"), false);
assert.equal(providerPageUtils.shouldShowFirstProviderHint(1, ""), false);
});
test("configured-only preference storage round-trips correctly", () => {
const storage = new Map();
const mockStorage = {
getItem(key) {
return storage.has(key) ? storage.get(key) : null;
},
setItem(key, value) {
storage.set(key, value);
},
removeItem(key) {
storage.delete(key);
},
};
assert.equal(providerPageStorage.readConfiguredOnlyPreference(mockStorage), false);
providerPageStorage.writeConfiguredOnlyPreference(true, mockStorage);
assert.equal(storage.get(providerPageStorage.SHOW_CONFIGURED_ONLY_STORAGE_KEY), "true");
assert.equal(providerPageStorage.readConfiguredOnlyPreference(mockStorage), true);
providerPageStorage.writeConfiguredOnlyPreference(false, mockStorage);
assert.equal(storage.has(providerPageStorage.SHOW_CONFIGURED_ONLY_STORAGE_KEY), false);
assert.equal(providerPageStorage.readConfiguredOnlyPreference(mockStorage), false);
});
test("static catalog entries resolve local, search, audio, web-cookie and upstream providers", () => {
const freeProvider = providerPageUtils.resolveDashboardProviderInfo("amazon-q");
const localProvider = providerPageUtils.resolveDashboardProviderInfo("sdwebui");
const localChatProvider = providerPageUtils.resolveDashboardProviderInfo("lm-studio");
const lemonadeProvider = providerPageUtils.resolveDashboardProviderInfo("lemonade");
const searchProvider = providerPageUtils.resolveDashboardProviderInfo("brave-search");
const youcomSearchProvider = providerPageUtils.resolveDashboardProviderInfo("youcom-search");
const audioProvider = providerPageUtils.resolveDashboardProviderInfo("assemblyai");
const awsPollyProvider = providerPageUtils.resolveDashboardProviderInfo("aws-polly");
const webCookieProvider = providerPageUtils.resolveDashboardProviderInfo("grok-web");
const apiKeyProvider = providerPageUtils.resolveDashboardProviderInfo("glhf");
const gitlabProvider = providerPageUtils.resolveDashboardProviderInfo("gitlab");
const gitlabDuoProvider = providerPageUtils.resolveDashboardProviderInfo("gitlab-duo");
const chutesProvider = providerPageUtils.resolveDashboardProviderInfo("chutes");
const datarobotProvider = providerPageUtils.resolveDashboardProviderInfo("datarobot");
const clarifaiProvider = providerPageUtils.resolveDashboardProviderInfo("clarifai");
const empowerProvider = providerPageUtils.resolveDashboardProviderInfo("empower");
const nousProvider = providerPageUtils.resolveDashboardProviderInfo("nous-research");
const petalsProvider = providerPageUtils.resolveDashboardProviderInfo("petals");
const poeProvider = providerPageUtils.resolveDashboardProviderInfo("poe");
const azureOpenAiProvider = providerPageUtils.resolveDashboardProviderInfo("azure-openai");
const azureAiProvider = providerPageUtils.resolveDashboardProviderInfo("azure-ai");
const watsonxProvider = providerPageUtils.resolveDashboardProviderInfo("watsonx");
const ociProvider = providerPageUtils.resolveDashboardProviderInfo("oci");
const sapProvider = providerPageUtils.resolveDashboardProviderInfo("sap");
const modalProvider = providerPageUtils.resolveDashboardProviderInfo("modal");
const rekaProvider = providerPageUtils.resolveDashboardProviderInfo("reka");
const nlpCloudProvider = providerPageUtils.resolveDashboardProviderInfo("nlpcloud");
const runwayProvider = providerPageUtils.resolveDashboardProviderInfo("runwayml");
const embeddingProvider = providerPageUtils.resolveDashboardProviderInfo("voyage-ai");
const rerankProvider = providerPageUtils.resolveDashboardProviderInfo("jina-ai");
const perplexityWebProvider = providerPageUtils.resolveDashboardProviderInfo("perplexity-web");
const blackboxWebProvider = providerPageUtils.resolveDashboardProviderInfo("blackbox-web");
const museSparkWebProvider = providerPageUtils.resolveDashboardProviderInfo("muse-spark-web");
const upstreamProvider = providerPageUtils.resolveDashboardProviderInfo("cliproxyapi");
assert.equal(freeProvider?.category, "oauth");
assert.equal(freeProvider?.name, providers.OAUTH_PROVIDERS["amazon-q"].name);
assert.equal(localProvider?.category, "local");
assert.equal(localProvider?.name, providers.LOCAL_PROVIDERS.sdwebui.name);
assert.equal(localChatProvider?.category, "local");
assert.equal(localChatProvider?.name, providers.LOCAL_PROVIDERS["lm-studio"].name);
assert.equal(lemonadeProvider?.category, "local");
assert.equal(lemonadeProvider?.name, providers.LOCAL_PROVIDERS.lemonade.name);
assert.equal(searchProvider?.category, "search");
assert.equal(searchProvider?.name, providers.SEARCH_PROVIDERS["brave-search"].name);
assert.equal(youcomSearchProvider?.category, "search");
assert.equal(youcomSearchProvider?.name, providers.SEARCH_PROVIDERS["youcom-search"].name);
assert.equal(audioProvider?.category, "audio");
assert.equal(audioProvider?.name, providers.AUDIO_ONLY_PROVIDERS.assemblyai.name);
assert.equal(awsPollyProvider?.category, "audio");
assert.equal(awsPollyProvider?.name, providers.AUDIO_ONLY_PROVIDERS["aws-polly"].name);
assert.equal(apiKeyProvider?.category, "apikey");
assert.equal(apiKeyProvider?.name, providers.APIKEY_PROVIDERS.glhf.name);
assert.equal(gitlabProvider?.category, "apikey");
assert.equal(gitlabProvider?.name, providers.APIKEY_PROVIDERS.gitlab.name);
assert.equal(gitlabDuoProvider?.category, "oauth");
assert.equal(gitlabDuoProvider?.name, providers.OAUTH_PROVIDERS["gitlab-duo"].name);
assert.equal(chutesProvider?.category, "apikey");
assert.equal(chutesProvider?.name, providers.APIKEY_PROVIDERS.chutes.name);
assert.equal(datarobotProvider?.category, "apikey");
assert.equal(datarobotProvider?.name, providers.APIKEY_PROVIDERS.datarobot.name);
assert.equal(clarifaiProvider?.category, "apikey");
assert.equal(clarifaiProvider?.name, providers.APIKEY_PROVIDERS.clarifai.name);
assert.equal(empowerProvider?.category, "apikey");
assert.equal(empowerProvider?.name, providers.APIKEY_PROVIDERS.empower.name);
assert.equal(nousProvider?.category, "apikey");
assert.equal(nousProvider?.name, providers.APIKEY_PROVIDERS["nous-research"].name);
assert.equal(petalsProvider?.category, "apikey");
assert.equal(petalsProvider?.name, providers.APIKEY_PROVIDERS.petals.name);
assert.equal(poeProvider?.category, "apikey");
assert.equal(poeProvider?.name, providers.APIKEY_PROVIDERS.poe.name);
assert.equal(azureOpenAiProvider?.category, "apikey");
assert.equal(azureOpenAiProvider?.name, providers.APIKEY_PROVIDERS["azure-openai"].name);
assert.equal(azureAiProvider?.category, "apikey");
assert.equal(azureAiProvider?.name, providers.APIKEY_PROVIDERS["azure-ai"].name);
assert.equal(watsonxProvider?.category, "apikey");
assert.equal(watsonxProvider?.name, providers.APIKEY_PROVIDERS.watsonx.name);
assert.equal(ociProvider?.category, "apikey");
assert.equal(ociProvider?.name, providers.APIKEY_PROVIDERS.oci.name);
assert.equal(sapProvider?.category, "apikey");
assert.equal(sapProvider?.name, providers.APIKEY_PROVIDERS.sap.name);
assert.equal(modalProvider?.category, "apikey");
assert.equal(modalProvider?.name, providers.APIKEY_PROVIDERS.modal.name);
assert.equal(rekaProvider?.category, "apikey");
assert.equal(rekaProvider?.name, providers.APIKEY_PROVIDERS.reka.name);
assert.equal(nlpCloudProvider?.category, "apikey");
assert.equal(nlpCloudProvider?.name, providers.APIKEY_PROVIDERS.nlpcloud.name);
assert.equal(runwayProvider?.category, "apikey");
assert.equal(runwayProvider?.name, providers.APIKEY_PROVIDERS.runwayml.name);
assert.equal(embeddingProvider?.category, "apikey");
assert.equal(embeddingProvider?.name, providers.APIKEY_PROVIDERS["voyage-ai"].name);
assert.equal(rerankProvider?.category, "apikey");
assert.equal(rerankProvider?.name, providers.APIKEY_PROVIDERS["jina-ai"].name);
assert.equal(webCookieProvider?.category, "web-cookie");
assert.equal(webCookieProvider?.name, providers.WEB_COOKIE_PROVIDERS["grok-web"].name);
assert.equal(perplexityWebProvider?.category, "web-cookie");
assert.equal(perplexityWebProvider?.name, providers.WEB_COOKIE_PROVIDERS["perplexity-web"].name);
assert.equal(blackboxWebProvider?.category, "web-cookie");
assert.equal(blackboxWebProvider?.name, providers.WEB_COOKIE_PROVIDERS["blackbox-web"].name);
assert.equal(museSparkWebProvider?.category, "web-cookie");
assert.equal(museSparkWebProvider?.name, providers.WEB_COOKIE_PROVIDERS["muse-spark-web"].name);
assert.equal(upstreamProvider?.category, "upstream-proxy");
assert.equal(
upstreamProvider?.name,
providerCatalog.STATIC_PROVIDER_CATALOG_GROUPS["upstream-proxy"].providers.cliproxyapi.name
);
});
test("managed provider connection ids include supported static categories and exclude upstream proxy", () => {
assert.equal(providerCatalog.isManagedProviderConnectionId("qoder"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("glhf"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("gitlab"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("cablyai"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("thebai"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("fenayai"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("chutes"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("datarobot"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("clarifai"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("empower"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("nous-research"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("petals"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("poe"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("azure-openai"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("azure-ai"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("bedrock"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("watsonx"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("oci"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("sap"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("modal"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("reka"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("nlpcloud"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("runwayml"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("voyage-ai"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("jina-ai"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("sdwebui"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("lm-studio"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("vllm"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("lemonade"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("assemblyai"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("aws-polly"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("grok-web"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("perplexity-web"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("blackbox-web"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("muse-spark-web"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("brave-search"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("youcom-search"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("cliproxyapi"), false);
assert.equal(providerCatalog.isManagedProviderConnectionId("claude"), false);
assert.equal(providerCatalog.isManagedProviderConnectionId("jules"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("devin"), true);
assert.equal(providerCatalog.isManagedProviderConnectionId("codex-cloud"), true);
});
test("grok-web taxonomy stays web-cookie only and does not leak into api-key entries", () => {
assert.equal("grok-web" in providers.APIKEY_PROVIDERS, false);
assert.equal("grok-web" in providers.WEB_COOKIE_PROVIDERS, true);
assert.equal("sdwebui" in providers.APIKEY_PROVIDERS, false);
assert.equal("sdwebui" in providers.LOCAL_PROVIDERS, true);
assert.equal("lm-studio" in providers.APIKEY_PROVIDERS, false);
assert.equal("lm-studio" in providers.LOCAL_PROVIDERS, true);
assert.equal("vllm" in providers.APIKEY_PROVIDERS, false);
assert.equal("vllm" in providers.LOCAL_PROVIDERS, true);
assert.equal("lemonade" in providers.APIKEY_PROVIDERS, false);
assert.equal("lemonade" in providers.LOCAL_PROVIDERS, true);
assert.equal("comfyui" in providers.APIKEY_PROVIDERS, false);
assert.equal("comfyui" in providers.LOCAL_PROVIDERS, true);
assert.equal("blackbox-web" in providers.APIKEY_PROVIDERS, false);
assert.equal("blackbox-web" in providers.WEB_COOKIE_PROVIDERS, true);
assert.equal("muse-spark-web" in providers.APIKEY_PROVIDERS, false);
assert.equal("muse-spark-web" in providers.WEB_COOKIE_PROVIDERS, true);
assert.equal("glhf" in providers.APIKEY_PROVIDERS, true);
assert.equal("gitlab" in providers.APIKEY_PROVIDERS, true);
assert.equal("gitlab-duo" in providers.OAUTH_PROVIDERS, true);
assert.equal("cablyai" in providers.APIKEY_PROVIDERS, true);
assert.equal("thebai" in providers.APIKEY_PROVIDERS, true);
assert.equal("fenayai" in providers.APIKEY_PROVIDERS, true);
assert.equal("chutes" in providers.APIKEY_PROVIDERS, true);
assert.equal("datarobot" in providers.APIKEY_PROVIDERS, true);
assert.equal("clarifai" in providers.APIKEY_PROVIDERS, true);
assert.equal("empower" in providers.APIKEY_PROVIDERS, true);
assert.equal("nous-research" in providers.APIKEY_PROVIDERS, true);
assert.equal("petals" in providers.APIKEY_PROVIDERS, true);
assert.equal("poe" in providers.APIKEY_PROVIDERS, true);
assert.equal("azure-ai" in providers.APIKEY_PROVIDERS, true);
assert.equal("bedrock" in providers.APIKEY_PROVIDERS, true);
assert.equal("watsonx" in providers.APIKEY_PROVIDERS, true);
assert.equal("oci" in providers.APIKEY_PROVIDERS, true);
assert.equal("sap" in providers.APIKEY_PROVIDERS, true);
assert.equal("modal" in providers.APIKEY_PROVIDERS, true);
assert.equal("reka" in providers.APIKEY_PROVIDERS, true);
assert.equal("nlpcloud" in providers.APIKEY_PROVIDERS, true);
assert.equal("runwayml" in providers.APIKEY_PROVIDERS, true);
assert.equal("voyage-ai" in providers.APIKEY_PROVIDERS, true);
assert.equal("jina-ai" in providers.APIKEY_PROVIDERS, true);
const apiKeyEntries = providerPageUtils.buildStaticProviderEntries("apikey", () => ({
total: 0,
}));
const localEntries = providerPageUtils.buildStaticProviderEntries("local", () => ({
total: 0,
}));
const webCookieEntries = providerPageUtils.buildStaticProviderEntries("web-cookie", () => ({
total: 0,
}));
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "sdwebui"),
false
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "comfyui"),
false
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "lm-studio"),
false
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "vllm"),
false
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "lemonade"),
false
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "grok-web"),
false
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "glhf"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "gitlab"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "cablyai"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "thebai"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "fenayai"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "chutes"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "datarobot"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "clarifai"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "empower"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "nous-research"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "petals"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "poe"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "azure-ai"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "bedrock"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "watsonx"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "oci"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "sap"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "modal"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "reka"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "nlpcloud"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "runwayml"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "voyage-ai"),
true
);
assert.equal(
apiKeyEntries.some((entry) => entry.providerId === "jina-ai"),
true
);
assert.equal(
localEntries.some((entry) => entry.providerId === "sdwebui"),
true
);
assert.equal(
localEntries.some((entry) => entry.providerId === "comfyui"),
true
);
assert.equal(
localEntries.some((entry) => entry.providerId === "lm-studio"),
true
);
assert.equal(
localEntries.some((entry) => entry.providerId === "vllm"),
true
);
assert.equal(
localEntries.some((entry) => entry.providerId === "lemonade"),
true
);
assert.equal(
webCookieEntries.some((entry) => entry.providerId === "grok-web"),
true
);
assert.equal(
webCookieEntries.some((entry) => entry.providerId === "blackbox-web"),
true
);
assert.equal(
webCookieEntries.some((entry) => entry.providerId === "muse-spark-web"),
true
);
});
test("compatible catalog entries keep dynamic compatible metadata", () => {
const compatibleProvider = providerPageUtils.resolveDashboardProviderInfo(
"openai-compatible-lab",
{
providerNode: {
id: "openai-compatible-lab",
type: "openai-compatible",
apiType: "responses",
baseUrl: "https://example.test",
},
compatibleLabels: {
ccCompatibleName: "CC Compatible",
anthropicCompatibleName: "Anthropic Compatible",
openAiCompatibleName: "OpenAI Compatible",
},
}
);
assert.equal(compatibleProvider?.category, "compatible");
assert.equal(compatibleProvider?.displayAuthType, "compatible");
assert.equal(compatibleProvider?.toggleAuthType, "apikey");
assert.equal(compatibleProvider?.apiType, "responses");
assert.equal(compatibleProvider?.baseUrl, "https://example.test");
});