mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-22 06:42:19 +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.
83 lines
3.2 KiB
TypeScript
83 lines
3.2 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { resolveRequestedModel } from "../../open-sse/utils/cursorAgentProtobuf";
|
|
|
|
// Issue #7289: pinned Claude/GPT models carrying an effort/reasoning suffix
|
|
// (e.g. "claude-opus-4-8-high") return an empty turn from cursor's server.
|
|
//
|
|
// Ground truth captured from the real cursor-agent 2026.07.09 (Node) client
|
|
// via an http2/fetch preload hook: the wire request for a pinned model with
|
|
// an effort suffix carries the BASE model id (suffix stripped) plus a
|
|
// separate ModelParameter — "effort" for Claude models, "reasoning" for GPT
|
|
// models — not the full suffixed id crammed into model_id.
|
|
test("resolveRequestedModel splits the effort suffix off pinned Claude model ids (#7289)", () => {
|
|
assert.deepEqual(resolveRequestedModel("claude-opus-4-8-high"), {
|
|
modelId: "claude-opus-4-8",
|
|
parameters: [{ id: "effort", value: "high" }],
|
|
});
|
|
});
|
|
|
|
test("resolveRequestedModel splits the effort suffix off pinned Claude sonnet model ids (#7289)", () => {
|
|
assert.deepEqual(resolveRequestedModel("claude-sonnet-5-high"), {
|
|
modelId: "claude-sonnet-5",
|
|
parameters: [{ id: "effort", value: "high" }],
|
|
});
|
|
});
|
|
|
|
test("resolveRequestedModel splits the reasoning suffix off pinned GPT model ids (#7289)", () => {
|
|
assert.deepEqual(resolveRequestedModel("gpt-5.5-high"), {
|
|
modelId: "gpt-5.5",
|
|
parameters: [{ id: "reasoning", value: "high" }],
|
|
});
|
|
});
|
|
|
|
test("resolveRequestedModel does not touch the composer -fast toggle (#7289 regression guard)", () => {
|
|
assert.deepEqual(resolveRequestedModel("composer-2-fast"), {
|
|
modelId: "composer-2",
|
|
parameters: [{ id: "fast", value: "true" }],
|
|
});
|
|
});
|
|
|
|
test("resolveRequestedModel does not rewrite ids with no recognized effort suffix (#7289 regression guard)", () => {
|
|
assert.deepEqual(resolveRequestedModel("claude-2.5"), {
|
|
modelId: "claude-2.5",
|
|
parameters: [],
|
|
});
|
|
assert.deepEqual(resolveRequestedModel("gpt-4o"), {
|
|
modelId: "gpt-4o",
|
|
parameters: [],
|
|
});
|
|
});
|
|
|
|
test("resolveRequestedModel splits effort off cursor-grok ids (empty-turn fix)", () => {
|
|
assert.deepEqual(resolveRequestedModel("cursor-grok-4.5-high"), {
|
|
modelId: "cursor-grok-4.5",
|
|
parameters: [{ id: "effort", value: "high" }],
|
|
});
|
|
assert.deepEqual(resolveRequestedModel("cursor-grok-4.5-medium"), {
|
|
modelId: "cursor-grok-4.5",
|
|
parameters: [{ id: "effort", value: "medium" }],
|
|
});
|
|
});
|
|
|
|
test("resolveRequestedModel splits effort off legacy grok- ids", () => {
|
|
// "grok-4.5-*" combos are pre-aliased to "cursor-grok-4.5-*" by
|
|
// CURSOR_MODEL_ALIASES (already shipped on the release tip), so this uses
|
|
// an unaliased grok version to actually exercise the bare "grok-" fallback
|
|
// in resolveGrokRequestedModel rather than the alias table's rewrite.
|
|
assert.deepEqual(resolveRequestedModel("grok-3-high"), {
|
|
modelId: "grok-3",
|
|
parameters: [{ id: "effort", value: "high" }],
|
|
});
|
|
});
|
|
|
|
test("resolveRequestedModel splits cursor-grok effort + fast together", () => {
|
|
assert.deepEqual(resolveRequestedModel("cursor-grok-4.5-high-fast"), {
|
|
modelId: "cursor-grok-4.5",
|
|
parameters: [
|
|
{ id: "effort", value: "high" },
|
|
{ id: "fast", value: "true" },
|
|
],
|
|
});
|
|
});
|