mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-03 05:45:04 +03:00
* fix(dashboard): resolve Kimi banner casing collision + shrink frozen test file (release tip) - Rename src/app/(dashboard)/dashboard/kimiSponsorBanner.ts to kimiSponsorBannerGate.ts so it no longer differs from KimiSponsorBanner.tsx only by the first letter's case (breaks next build on case-insensitive filesystems). Updates the sole importer (KimiSponsorBanner.tsx) and the two tests that reference it. - Extract the 8 Kimi/Moonshot featured-ordering tests out of the frozen tests/unit/providers-page-utils.test.ts (grown 3 lines past its 1294 cap by #8039's rebrand-comment update) into a new sibling file tests/unit/providers-page-utils-kimi.test.ts. No assertions dropped; both files pass in full (24 + 8 = 32 tests). * fix(sse): register PromptQlExecutor in the executor registry (release tip) getExecutor("promptql") had no entry in open-sse/executors/index.ts, so it silently fell through to DefaultExecutor's provider fallback, which issues a raw fetch() and returns the bare upstream Response instead of the executor wrapper shape {response, url, headers, transformedBody}. The real PromptQlExecutor class (open-sse/executors/promptql.ts) already honors the contract correctly — it was just never wired into the registry. Fixes tests/unit/executor-web-cookie-sweep.test.ts "promptql executor returns wrapper shape". * fix(i18n): backfill 2220 missing pt-BR keys to restore en.json parity (release tip) pt-BR.json fell behind after #7935 restored +2220 keys into en.json and vi.json but left pt-BR.json unmodified. Translated all missing entries to Brazilian Portuguese, preserving ICU/interpolation placeholders and existing terminology, and merged them mirroring en.json's key order so the diff is additions-only (the small comma-only deletions are pure JSON reformatting from new sibling keys). * fix(providers): repair 4 pre-existing catalog/registry reds on release tip - providers-constants-split.test.ts: APIKEY_PROVIDERS grew 182->187 (PR #7887 added 5 free-tier providers: ainative/aion/sealion/routeway/nara). Verified no dup/loss (6-family partition sums exactly to 187) and updated the stale expected count + comment trail to match. - cline registry: added the missing minimax/minimax-m3 free OpenRouter entry (#3321) and fixed the neighbouring nemotron-3-ultra-550b-a55b entry, which carried a stray ":free" id suffix and an imprecise 1_000_000 contextLength instead of the 1_048_576 the test (and every sibling 1M-context entry in this catalog) expects. - promptqlModels.ts / registry/promptql/index.ts: PROMPTQL_FALLBACK_MODELS's minimax-m3 entry was missing supportsVision, and the registry mapping dropped it entirely (only id/name were passed through) — it was the sole minimax-m3 entry across the whole registry not flagged multimodal, despite every other provider (minimax, minimax-cn, ollama-cloud, trae, bazaarlink, clinepass, codebuddy-cn, opencode-zen/go, synthetic, huggingchat, lmarena) agreeing MiniMax-M3 supports vision. Added the field to the PromptQlModel type and threaded it through. - tests/snapshots/provider/translate-path.json: regenerated the golden via UPDATE_GOLDEN=1. Diffed old vs new — zero providers removed, 5 added (ainative/aion/nara/routeway/sealion, matching #7887), and the only changed entry (cline) reflects the already-merged #7914 ClinePass header protocol change (Cline/<version> User-Agent + X-Task-ID) that a prior narrow golden touch-up missed capturing. * fix(docs): repair docs-sync/env-sync/repo-contract gates (release tip) Six pre-existing reds on release/v3.8.49, all "repo drifted from its own documented contract": - check-docs-counts-sync: free-tier headline was stale (~1.4B/~2.0B) vs the live catalog (~1.53B steady / ~2.15B first month, 43 pools). Updated README.md and docs/reference/FREE_TIERS.md to the live numbers and added a v3.8.49 correction note explaining the pool-count delta (39->43, #7840). Also fixed a soft executors-count drift in ARCHITECTURE.md (84->86, 268->271 providers) while touching that line. - release-green-docs-drift-7253: docs/proxy-subscriptions.md referenced a fabricated migration filename (123_proxy_subscriptions.sql); the real file is 131_proxy_subscriptions.sql. Fixed all 3 occurrences. - check-env-doc-sync + issue-7793-env-doc-sync-repro: OMNIROUTE_DATA_DIR (DATA_DIR fallback alias read by open-sse/executors/promptql/threadSticky.ts) was undocumented. Added to .env.example and docs/reference/ENVIRONMENT.md. - check-db-rules: src/lib/db/proxySubscriptions.ts (#7299) is a db-internal split of proxies.ts (kept under the frozen file-size cap) whose one export is already re-exported via proxies.ts -> localDb.ts. Added it to INTENTIONALLY_INTERNAL with the same db-internal justification used for identical split modules (apiKeyColumnFallbacks, providerNodeSelect, webSessionDedup) rather than a redundant direct re-export from localDb.ts. - mcp-server-hollow-dist-deps: the sanity test expected better-sqlite3 among the MCP bundle's static top-level external imports. That's been stale since the pre-#7878 migration to a cascading SqliteAdapter driver factory (createRequire()-based lazy require, not a static import); better-sqlite3 already has its own native-asset copy guarantee in assembleStandalone.mjs, unrelated to this test's EXTRA_MODULE_ENTRIES concern. Updated the assertion to a still-genuinely-static external (zod) with a comment explaining the change. No production runtime behavior changed — docs, .env.example, and a checker allowlist/test-expectation only. * fix(dashboard): repair stale UI component-shape test assertions (release tip) Two pre-existing reds in the dashboard UI component-contract cluster were caused by test assertions that had gone stale after intentional, correct refactors — not by real defects in the components: - quota-pool-wizard-multi.test.ts: the step-3 preview assertion required the literal single-line substring "connectionIds.map((cid)". Prettier (100-char width, project config) legitimately breaks the connectionIds.map(...).filter(...) chain across lines because of the multi-line callback body, so the literal never matches. PoolWizard.tsx still builds previewByProvider correctly by mapping over connectionIds; updated the assertion to a regex that tolerates the line break. - v388-phase1-screen-fixes.test.ts: the shared Select placeholder-guard assertion required the literal "!children && placeholder". An earlier, intentional i18n commit changed the hardcoded "Select an option" default to a translated fallback (`placeholder ?? t("selectOption")`), which requires parens around the ?? expression for operator precedence. The guard behavior is unchanged (still gated on !children); updated the assertion to match the current, correct guard shape. Both fixes are read-only test-file changes; no production behavior changed. review-reviews-v3814-fixes.test.ts still has one pre-existing, unrelated red (LEDGER-4: minimax-m3 registry entries missing supportsVision) that requires editing the promptql provider registry/catalog — out of this cluster's scope, left untouched and reported separately. * fix(providers): reconcile cline catalog contradictions + deterministic golden (release tip) The first tip-green pass introduced 3 regressions caught by CI on sibling guard tests: - clinepass-provider + cline-catalog-models-3321 encoded OPPOSITE expectations of the same cline model list (minimax presence, nvidia :free suffix). Reference upstream (OpenRouter free lineup) confirms nvidia/nemotron-3-ultra-550b-a55b:free (with :free, 1M ctx) is correct, so restore that id and fix #3321's stale no-:free assertion; add minimax/minimax-m3 (the real #3321 gap) to clinepass-provider's list. - check-db-rules-classification froze INTENTIONALLY_INTERNAL at 35; proxySubscriptions was the intentional 36th entry — add it + bump the count. - provider-translate-path golden stored a LITERAL Cline/3.8.49: clineAuth resolves the version from APP_CONFIG.version (stable), but the golden sanitizer collapsed only process.env.npm_package_version (unset under `node`, set under `npm run`) — so the golden was shard-dependent. Resolve APP_VERSION from APP_CONFIG.version like clineAuth and regenerate; now Cline/<APP> normalizes identically in every shard. * fix(services): type execFile signal/killed in classifyError + ratchet dashboard baseline (release tip) Pre-existing base-red on the tip's Fast Quality Gates (dashboard-typecheck), missed in the first inventory: - src/lib/services/installers/utils.ts TS2339 — `err.signal` was read off a value typed as NodeJS.ErrnoException, which @types/node does not declare `signal`/`killed` on (those belong to execFile's ExecFileException). Widen classifyError's param to type both, and drop the now-redundant `(err as … { killed })` cast. - Ratchet config/quality/dashboard-typecheck-baseline.json down: 5 baselined errors were fixed by already-merged PRs but never ratcheted (OAuthModal TS2769 4→3 / TS2345 4→3, CliproxyModelMappingEditor TS2339, CompressionPreviewAccordion TS4104, MonacoEditor TS2307). Baseline now 254, matching live — gate exits 0.
207 lines
5.9 KiB
TypeScript
207 lines
5.9 KiB
TypeScript
/**
|
|
* PromptQL (prompt.ql.app) model catalog helpers.
|
|
*
|
|
* Live catalog: GraphQL `FetchLlmConfigs` against the playground Hasura endpoint.
|
|
* Fallback: static seed captured 2026-07-20 (display_label / model_reference / model_id).
|
|
*/
|
|
|
|
export interface PromptQlModel {
|
|
/** Client-facing id (model_reference slug, e.g. gemini-3.5-flash). */
|
|
id: string;
|
|
/** Friendly picker label. */
|
|
name: string;
|
|
/** Hasura llm_config.id (uuid) — used as llmConfigId on start_thread. */
|
|
configId?: string;
|
|
/** Upstream model id string from PromptQL. */
|
|
modelId?: string;
|
|
/** Whether the underlying model accepts image inputs (matches upstream capability). */
|
|
supportsVision?: boolean;
|
|
}
|
|
|
|
/** Offline seed when discovery fails (from live FetchLlmConfigs capture). */
|
|
export const PROMPTQL_FALLBACK_MODELS: PromptQlModel[] = [
|
|
{
|
|
id: "vertex-claude-fable-5",
|
|
name: "Claude Fable 5",
|
|
configId: "967e6517-1d6b-4e22-82fb-3463bab239c4",
|
|
modelId: "anthropic/claude-fable-5",
|
|
},
|
|
{
|
|
id: "bedrock-claude-opus-4-8",
|
|
name: "Claude Opus 4.8",
|
|
configId: "e97e7f50-9e4a-4685-bc14-1854f1f79782",
|
|
modelId: "us.anthropic.claude-opus-4-8",
|
|
},
|
|
{
|
|
id: "bedrock-claude-sonnet-4-5",
|
|
name: "Claude Sonnet 4.5",
|
|
configId: "48105d83-9a45-4ec6-8b58-f3cf44094f92",
|
|
modelId: "us.anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
},
|
|
{
|
|
id: "deepseek-v4-pro",
|
|
name: "DeepSeek V4 Pro",
|
|
configId: "5a23af33-b31b-4215-892c-20ef633a8848",
|
|
modelId: "accounts/fireworks/models/deepseek-v4-pro",
|
|
},
|
|
{
|
|
id: "gemini-3.1-pro-preview",
|
|
name: "Gemini 3.1 Pro Preview",
|
|
configId: "d2bda5cd-881b-4044-aeb9-02a83cc0ca27",
|
|
modelId: "google/gemini-3.1-pro-preview",
|
|
},
|
|
{
|
|
id: "gemini-3.5-flash",
|
|
name: "Gemini 3.5 Flash",
|
|
configId: "c3a25aa0-ca48-4577-b52d-71282aacb687",
|
|
modelId: "google/gemini-3.5-flash",
|
|
},
|
|
{
|
|
id: "glm-5.2",
|
|
name: "GLM 5.2",
|
|
configId: "64a1fa3d-bf2e-4bb9-8c2b-fa76c218d636",
|
|
modelId: "accounts/fireworks/models/glm-5p2",
|
|
},
|
|
{
|
|
id: "gpt-5.5",
|
|
name: "GPT 5.5",
|
|
configId: "1762fbce-d5bf-4bf4-ba3d-8b1201f8e204",
|
|
modelId: "gpt-5.5",
|
|
},
|
|
{
|
|
id: "gpt-5.6-luna",
|
|
name: "GPT-5.6 Luna",
|
|
configId: "a9c45ba7-87fa-49a1-8165-76b0864c3a55",
|
|
modelId: "gpt-5.6-luna",
|
|
},
|
|
{
|
|
id: "gpt-5.6-sol",
|
|
name: "GPT-5.6 Sol",
|
|
configId: "34c80712-def3-4db3-9e7a-f57b0324b43d",
|
|
modelId: "gpt-5.6-sol",
|
|
},
|
|
{
|
|
id: "gpt-5.6-terra",
|
|
name: "GPT-5.6 Terra",
|
|
configId: "04f1a08c-42b2-4371-b6d8-75c50b9bb990",
|
|
modelId: "gpt-5.6-terra",
|
|
},
|
|
{
|
|
id: "xai-grok-4-5",
|
|
name: "Grok 4.5",
|
|
configId: "068b2ef2-e432-422b-98e5-5863a1852c47",
|
|
modelId: "grok-4.5",
|
|
},
|
|
{
|
|
id: "kimi-k2.6",
|
|
name: "Kimi K2.6",
|
|
configId: "placeholder-kimi-k2.6",
|
|
modelId: "accounts/fireworks/models/kimi-k2p6",
|
|
},
|
|
{
|
|
id: "kimi-k2.7-code",
|
|
name: "Kimi K2.7 Code",
|
|
configId: "placeholder-kimi-k2.7-code",
|
|
modelId: "accounts/fireworks/models/kimi-k2p7-code",
|
|
},
|
|
{
|
|
id: "minimax-m3",
|
|
name: "Minimax M3",
|
|
configId: "placeholder-minimax-m3",
|
|
modelId: "accounts/fireworks/models/minimax-m3",
|
|
supportsVision: true,
|
|
},
|
|
];
|
|
|
|
const FETCH_LLM_CONFIGS = `
|
|
query FetchLlmConfigs {
|
|
llm_config(
|
|
where: {deleted_at: {_is_null: true}}
|
|
order_by: {display_label: asc}
|
|
) {
|
|
id
|
|
display_label
|
|
model_reference
|
|
model_id
|
|
}
|
|
}`;
|
|
|
|
export function stripPromptQlModelPrefix(model: string): string {
|
|
let m = (model || "").trim();
|
|
if (m.startsWith("promptql/")) m = m.slice("promptql/".length);
|
|
else if (m.startsWith("pql/")) m = m.slice(4);
|
|
return m;
|
|
}
|
|
|
|
/** Resolve client model slug / display name / config uuid → catalog entry. */
|
|
export function resolvePromptQlModel(model: unknown): PromptQlModel | null {
|
|
const raw = typeof model === "string" ? stripPromptQlModelPrefix(model) : "";
|
|
if (!raw) return null;
|
|
const lower = raw.toLowerCase();
|
|
const catalog = PROMPTQL_FALLBACK_MODELS;
|
|
return (
|
|
catalog.find((m) => m.id.toLowerCase() === lower) ||
|
|
catalog.find((m) => m.name.toLowerCase() === lower) ||
|
|
catalog.find((m) => (m.modelId || "").toLowerCase() === lower) ||
|
|
catalog.find((m) => (m.configId || "").toLowerCase() === lower) ||
|
|
catalog.find((m) => lower.includes(m.id.toLowerCase())) ||
|
|
null
|
|
);
|
|
}
|
|
|
|
export function clientFacingPromptQlModelId(model: unknown): string {
|
|
const resolved = resolvePromptQlModel(model);
|
|
if (resolved) return resolved.id;
|
|
const stripped = typeof model === "string" ? stripPromptQlModelPrefix(model) : "";
|
|
return stripped || "promptql-default";
|
|
}
|
|
|
|
export async function discoverPromptQlModels(opts: {
|
|
token: string;
|
|
graphqlEndpoint: string;
|
|
signal?: AbortSignal | null;
|
|
}): Promise<PromptQlModel[]> {
|
|
const res = await fetch(opts.graphqlEndpoint, {
|
|
method: "POST",
|
|
headers: {
|
|
accept: "application/json",
|
|
"content-type": "application/json",
|
|
authorization: `Bearer ${opts.token}`,
|
|
origin: "https://prompt.ql.app",
|
|
referer: "https://prompt.ql.app/",
|
|
},
|
|
body: JSON.stringify({ query: FETCH_LLM_CONFIGS, operationName: "FetchLlmConfigs" }),
|
|
signal: opts.signal ?? undefined,
|
|
});
|
|
if (!res.ok) {
|
|
throw new Error(`FetchLlmConfigs HTTP ${res.status}`);
|
|
}
|
|
const json = (await res.json()) as {
|
|
data?: {
|
|
llm_config?: Array<{
|
|
id?: string;
|
|
display_label?: string;
|
|
model_reference?: string;
|
|
model_id?: string;
|
|
}>;
|
|
};
|
|
errors?: Array<{ message?: string }>;
|
|
};
|
|
if (json.errors?.length) {
|
|
throw new Error(json.errors.map((e) => e.message || "error").join("; "));
|
|
}
|
|
const rows = json.data?.llm_config || [];
|
|
return rows
|
|
.map((r): PromptQlModel | null => {
|
|
const id = (r.model_reference || r.model_id || r.id || "").trim();
|
|
if (!id) return null;
|
|
return {
|
|
id,
|
|
name: (r.display_label || id).trim(),
|
|
configId: r.id,
|
|
modelId: r.model_id,
|
|
};
|
|
})
|
|
.filter((x): x is PromptQlModel => Boolean(x));
|
|
}
|