mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-17 20:32:25 +03:00
Landed with the design call resolved per the owner's pick — **option 1**: the synced store is now endpoint-agnostic (persistDiscoveredModels and managedModelImport no longer drop non-chat models at write time), and chat selectability moved to read time (auto-pool expansion in autoStrategy applies filterChatSelectableModels; the models-route projection already had its chatOnly filter). Your discovery test now passes end-to-end (3/3): /api/show capabilities persist per connection and image/embedding requests route through the advertising host. Reconciliation notes: conflicted areas merged onto the current tip (adobe discovery import, requestedModel preflight signature, resolvedProvider fast-path coexists with the synced-route override — explicit resolution wins); carried base-red drains (#10055 memoization, #11071 test variants) dropped as already-landed; the managed-model-import exclusion test was propagated to the new contract (image/video models persist; the read filter still hides them from chat pickers — pinned by a new assertion). Full battery: 205/206 focused (the one red is a confirmed periodic-timer timing flake on the loaded devbox — 20/20 isolated), autoCombo vitest 30/30, combo suites 46/46, gates + typecheck clean. Thank you @yourspraveen — the capability probe + routing design was right; it just needed the store contract opened up. Fixes #11087.
81 lines
2.5 KiB
TypeScript
81 lines
2.5 KiB
TypeScript
/**
|
|
* Parity test for GHE Copilot targetFormat routing.
|
|
*
|
|
* Ensures that OpenAI-native models (gpt-5.4-mini, gpt-5.6-*, gpt-5.3-codex, etc.)
|
|
* under `ghe-copilot` carry `targetFormat: "openai-responses"`, while Claude and
|
|
* Gemini models do NOT.
|
|
*/
|
|
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
const { gheCopilotProvider } =
|
|
await import("../../open-sse/config/providers/registry/ghe-copilot/index.ts");
|
|
const { getModelsByProviderId } = await import("../../open-sse/config/providerModels.ts");
|
|
|
|
type ModelEntry = { id: string; targetFormat?: string; [k: string]: unknown };
|
|
|
|
function gheModel(id: string): ModelEntry | undefined {
|
|
return gheCopilotProvider.models.find((m) => m.id === id);
|
|
}
|
|
|
|
// Claude/Gemini models that must NOT route through the Responses API.
|
|
const MUST_NOT_BE_RESPONSES = [
|
|
"claude-fable-5",
|
|
"claude-opus-5",
|
|
"claude-opus-4.7",
|
|
"claude-opus-4.8",
|
|
"claude-opus-4.8-fast",
|
|
"claude-opus-4.5",
|
|
"claude-sonnet-4.6",
|
|
"claude-sonnet-5",
|
|
"claude-sonnet-4.5",
|
|
"claude-haiku-4.5",
|
|
"gemini-3.1-pro-preview",
|
|
"gemini-3.7-flash",
|
|
];
|
|
|
|
for (const id of MUST_NOT_BE_RESPONSES) {
|
|
test(`ghe-copilot/${id} must not use openai-responses targetFormat`, () => {
|
|
const model = gheModel(id);
|
|
assert.ok(model, `${id} must be registered under ghe-copilot`);
|
|
assert.notEqual(
|
|
model.targetFormat,
|
|
"openai-responses",
|
|
`ghe-copilot/${id} must route via chat/completions (Copilot Responses API rejects it)`
|
|
);
|
|
});
|
|
}
|
|
|
|
// OpenAI-native models that MUST use openai-responses targetFormat under ghe-copilot
|
|
const MUST_BE_RESPONSES = [
|
|
"gpt-5.6-sol",
|
|
"gpt-5.6-terra",
|
|
"gpt-5.6-luna",
|
|
"gpt-5.4",
|
|
"gpt-5.4-mini",
|
|
"gpt-5.3-codex",
|
|
"gpt-5-mini",
|
|
"mai-code-1-flash",
|
|
"oswe-vscode-prime",
|
|
];
|
|
|
|
for (const id of MUST_BE_RESPONSES) {
|
|
test(`ghe-copilot/${id} (OpenAI-native) uses openai-responses`, () => {
|
|
const model = gheModel(id);
|
|
assert.ok(model, `${id} must be registered under ghe-copilot`);
|
|
assert.equal(
|
|
model.targetFormat,
|
|
"openai-responses",
|
|
`ghe-copilot/${id} is OpenAI-native and must use the Responses API`
|
|
);
|
|
});
|
|
}
|
|
|
|
// Lookup-by-id helper resolves the same entries.
|
|
test("getModelsByProviderId(ghe-copilot) reflects the targetFormat settings", () => {
|
|
const models = getModelsByProviderId("ghe-copilot") as ModelEntry[];
|
|
const gpt54mini = models.find((m) => m.id === "gpt-5.4-mini");
|
|
assert.ok(gpt54mini, "gpt-5.4-mini resolvable via getModelsByProviderId");
|
|
assert.equal(gpt54mini.targetFormat, "openai-responses");
|
|
});
|