|
|
|
|
@@ -227,7 +227,7 @@ test("config: with valid auth.json + apiKey + baseURL → mutates input.provider
|
|
|
|
|
// Stripped per-model shape: name + cap flags + modalities + (optional)
|
|
|
|
|
// cost. OC's SDK static schema accepts only `limit.{context,output}` —
|
|
|
|
|
// `limit.input` is NOT in the SDK shape and gets dropped silently.
|
|
|
|
|
const claude = entry.models["opencode-omniroute/claude-sonnet-4-6"];
|
|
|
|
|
const claude = entry.models["claude-sonnet-4-6"];
|
|
|
|
|
assert.ok(claude, "claude model surfaced");
|
|
|
|
|
assert.equal(claude.name, "claude-sonnet-4-6");
|
|
|
|
|
assert.equal(claude.attachment, true);
|
|
|
|
|
@@ -248,7 +248,7 @@ test("config: with valid auth.json + apiKey + baseURL → mutates input.provider
|
|
|
|
|
|
|
|
|
|
// Combo surfaces under bare key + LCD'd
|
|
|
|
|
// (gemini's reasoning=false → combo reasoning=false).
|
|
|
|
|
const combo = entry.models["omniroute/claude-tier"];
|
|
|
|
|
const combo = entry.models["claude-tier"];
|
|
|
|
|
assert.ok(combo, "combo surfaced under bare key");
|
|
|
|
|
assert.equal(combo.name, "Claude Tier");
|
|
|
|
|
assert.equal(combo.reasoning, false, "LCD: any member reasoning=false → combo reasoning=false");
|
|
|
|
|
@@ -471,10 +471,10 @@ test("config: combos fetcher throws → emit models-only catalog (no combos in m
|
|
|
|
|
assert.ok(entry);
|
|
|
|
|
const ids = Object.keys(entry.models).sort();
|
|
|
|
|
assert.deepEqual(ids, [
|
|
|
|
|
"opencode-omniroute/claude-sonnet-4-6",
|
|
|
|
|
"opencode-omniroute/gemini-3-flash",
|
|
|
|
|
"claude-sonnet-4-6",
|
|
|
|
|
"gemini-3-flash",
|
|
|
|
|
]);
|
|
|
|
|
assert.equal(entry.models["omniroute/claude-tier"], undefined, "no combo entry");
|
|
|
|
|
assert.equal(entry.models["claude-tier"], undefined, "no combo entry");
|
|
|
|
|
assert.ok(
|
|
|
|
|
logger.entries.some((e) => String(e[0]).includes("/api/combos fetch failed")),
|
|
|
|
|
"combos-fetch breadcrumb emitted"
|
|
|
|
|
@@ -723,7 +723,7 @@ test("buildStaticProviderEntry: stripped per-model shape matches sibling @omniro
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Sanity: claude entry has all expected stripped fields.
|
|
|
|
|
const claude = block.models["opencode-omniroute/claude-sonnet-4-6"];
|
|
|
|
|
const claude = block.models["claude-sonnet-4-6"];
|
|
|
|
|
assert.equal(typeof claude.name, "string");
|
|
|
|
|
assert.equal(typeof claude.attachment, "boolean");
|
|
|
|
|
assert.equal(typeof claude.reasoning, "boolean");
|
|
|
|
|
@@ -748,8 +748,8 @@ test("buildStaticProviderEntry: hidden combos are excluded", () => {
|
|
|
|
|
"https://or.example/v1",
|
|
|
|
|
"sk-test"
|
|
|
|
|
);
|
|
|
|
|
assert.equal(block.models["omniroute/claude-tier"], undefined);
|
|
|
|
|
assert.ok(block.models["opencode-omniroute/claude-sonnet-4-6"]);
|
|
|
|
|
assert.equal(block.models["claude-tier"], undefined);
|
|
|
|
|
assert.ok(block.models["claude-sonnet-4-6"]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// ────────────────────────────────────────────────────────────────────────────
|
|
|
|
|
@@ -765,7 +765,7 @@ test("buildStaticProviderEntry: emits modalities.input from raw.input_modalities
|
|
|
|
|
"https://or.example/v1",
|
|
|
|
|
"sk-test"
|
|
|
|
|
);
|
|
|
|
|
const claude = block.models["opencode-omniroute/claude-sonnet-4-6"];
|
|
|
|
|
const claude = block.models["claude-sonnet-4-6"];
|
|
|
|
|
assert.deepEqual(claude.modalities?.input, ["text", "image"]);
|
|
|
|
|
assert.deepEqual(claude.modalities?.output, ["text"]);
|
|
|
|
|
});
|
|
|
|
|
@@ -779,7 +779,7 @@ test("buildStaticProviderEntry: never emits limit.input (OC SDK rejects it)", ()
|
|
|
|
|
"https://or.example/v1",
|
|
|
|
|
"sk-test"
|
|
|
|
|
);
|
|
|
|
|
const claude = block.models["opencode-omniroute/claude-sonnet-4-6"];
|
|
|
|
|
const claude = block.models["claude-sonnet-4-6"];
|
|
|
|
|
assert.equal((claude.limit as Record<string, unknown>).input, undefined);
|
|
|
|
|
assert.equal(typeof claude.limit?.context, "number");
|
|
|
|
|
assert.equal(typeof claude.limit?.output, "number");
|
|
|
|
|
@@ -807,7 +807,7 @@ test("buildStaticProviderEntry: emits cost when enrichment carries pricing", ()
|
|
|
|
|
"sk-test",
|
|
|
|
|
enrichment
|
|
|
|
|
);
|
|
|
|
|
const claude = block.models["opencode-omniroute/claude-sonnet-4-6"];
|
|
|
|
|
const claude = block.models["claude-sonnet-4-6"];
|
|
|
|
|
assert.equal(claude.cost?.input, 3);
|
|
|
|
|
assert.equal(claude.cost?.output, 15);
|
|
|
|
|
assert.equal(claude.cost?.cache_read, 0.3);
|
|
|
|
|
@@ -828,8 +828,8 @@ test("buildStaticProviderEntry: emits release_date when raw carries it; omits wh
|
|
|
|
|
"https://or.example/v1",
|
|
|
|
|
"sk-test"
|
|
|
|
|
);
|
|
|
|
|
assert.equal(block.models["opencode-omniroute/claude-with-date"].release_date, "2026-02-19");
|
|
|
|
|
assert.equal(block.models["opencode-omniroute/gemini-3-flash"].release_date, undefined);
|
|
|
|
|
assert.equal(block.models["claude-with-date"].release_date, "2026-02-19");
|
|
|
|
|
assert.equal(block.models["gemini-3-flash"].release_date, undefined);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("buildStaticProviderEntry: combo modalities = intersection of members (LCD)", () => {
|
|
|
|
|
@@ -858,7 +858,7 @@ test("buildStaticProviderEntry: combo modalities = intersection of members (LCD)
|
|
|
|
|
"https://or.example/v1",
|
|
|
|
|
"sk-test"
|
|
|
|
|
);
|
|
|
|
|
const combo = block.models["omniroute/mixed-tier"];
|
|
|
|
|
const combo = block.models["mixed-tier"];
|
|
|
|
|
assert.ok(combo, "combo emitted under slug key");
|
|
|
|
|
// claude has text+image, text-only has text → intersection drops image.
|
|
|
|
|
assert.deepEqual(combo.modalities?.input, ["text"]);
|
|
|
|
|
@@ -967,10 +967,10 @@ test("config: enrichment fetched + name overlaid on raw-model entries", async ()
|
|
|
|
|
"opencode-omniroute"
|
|
|
|
|
];
|
|
|
|
|
assert.ok(entry);
|
|
|
|
|
assert.equal(entry.models["opencode-omniroute/claude-sonnet-4-6"].name, "Claude Sonnet 4.6");
|
|
|
|
|
assert.equal(entry.models["opencode-omniroute/gemini-3-flash"].name, "Gemini 3 Flash");
|
|
|
|
|
assert.equal(entry.models["claude-sonnet-4-6"].name, "Claude Sonnet 4.6");
|
|
|
|
|
assert.equal(entry.models["gemini-3-flash"].name, "Gemini 3 Flash");
|
|
|
|
|
// Combo names still come from /api/combos — enrichment overlay does NOT touch combos.
|
|
|
|
|
assert.equal(entry.models["omniroute/claude-tier"].name, "Claude Tier");
|
|
|
|
|
assert.equal(entry.models["claude-tier"].name, "Claude Tier");
|
|
|
|
|
assert.equal(enrichmentFetcher.callCount(), 1);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -1000,7 +1000,7 @@ test("config: features.enrichment=false skips enrichment fetch + keeps raw-id na
|
|
|
|
|
assert.ok(entry);
|
|
|
|
|
assert.equal(enrichmentFetcher.callCount(), 0, "enrichment fetch suppressed by feature flag");
|
|
|
|
|
assert.equal(
|
|
|
|
|
entry.models["opencode-omniroute/claude-sonnet-4-6"].name,
|
|
|
|
|
entry.models["claude-sonnet-4-6"].name,
|
|
|
|
|
"claude-sonnet-4-6",
|
|
|
|
|
"raw id retained"
|
|
|
|
|
);
|
|
|
|
|
@@ -1027,7 +1027,7 @@ test("config: enrichment fetcher throws → soft-fail (warn + raw-id static cata
|
|
|
|
|
];
|
|
|
|
|
assert.ok(entry, "static block still published on enrichment failure");
|
|
|
|
|
assert.equal(
|
|
|
|
|
entry.models["opencode-omniroute/claude-sonnet-4-6"].name,
|
|
|
|
|
entry.models["claude-sonnet-4-6"].name,
|
|
|
|
|
"claude-sonnet-4-6",
|
|
|
|
|
"raw id retained"
|
|
|
|
|
);
|
|
|
|
|
@@ -1229,11 +1229,11 @@ test("config: diskCache hydrates stale snapshot when /v1/models throws", async (
|
|
|
|
|
"opencode-omniroute"
|
|
|
|
|
];
|
|
|
|
|
assert.ok(
|
|
|
|
|
entry.models["opencode-omniroute/claude-sonnet-4-6"],
|
|
|
|
|
entry.models["claude-sonnet-4-6"],
|
|
|
|
|
"stale snapshot hydrated into static block"
|
|
|
|
|
);
|
|
|
|
|
assert.equal(
|
|
|
|
|
entry.models["opencode-omniroute/claude-sonnet-4-6"].name,
|
|
|
|
|
entry.models["claude-sonnet-4-6"].name,
|
|
|
|
|
"Claude Sonnet 4.6 (cached)",
|
|
|
|
|
"stale enrichment also reused"
|
|
|
|
|
);
|
|
|
|
|
@@ -1281,7 +1281,7 @@ test("config: cached rawEnrichment from earlier provider hook is reused (no refe
|
|
|
|
|
const entry = (input as { provider: Record<string, OmniRouteStaticProviderEntry> }).provider[
|
|
|
|
|
"opencode-omniroute"
|
|
|
|
|
];
|
|
|
|
|
assert.equal(entry.models["opencode-omniroute/claude-sonnet-4-6"].name, "Claude Sonnet 4.6");
|
|
|
|
|
assert.equal(entry.models["claude-sonnet-4-6"].name, "Claude Sonnet 4.6");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// ─────────────────────────────────────────────────────────────────────
|
|
|
|
|
@@ -1332,12 +1332,12 @@ test("config: providerTag (default-on) prepends '<provider> - ' to enriched raw-
|
|
|
|
|
];
|
|
|
|
|
assert.ok(entry);
|
|
|
|
|
assert.equal(
|
|
|
|
|
entry.models["opencode-omniroute/claude-sonnet-4-6"].name,
|
|
|
|
|
entry.models["claude-sonnet-4-6"].name,
|
|
|
|
|
"Claude - Claude Sonnet 4.6"
|
|
|
|
|
);
|
|
|
|
|
assert.equal(entry.models["opencode-omniroute/gemini-3-flash"].name, "Gemini - Gemini 3 Flash");
|
|
|
|
|
assert.equal(entry.models["gemini-3-flash"].name, "Gemini - Gemini 3 Flash");
|
|
|
|
|
// Combos stay untouched — `Combo: ` prefix already conveys multi-upstream.
|
|
|
|
|
assert.equal(entry.models["omniroute/claude-tier"].name, "Claude Tier");
|
|
|
|
|
assert.equal(entry.models["claude-tier"].name, "Claude Tier");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("config: providerTag=false suppresses the suffix", async () => {
|
|
|
|
|
@@ -1364,7 +1364,7 @@ test("config: providerTag=false suppresses the suffix", async () => {
|
|
|
|
|
"opencode-omniroute"
|
|
|
|
|
];
|
|
|
|
|
assert.equal(
|
|
|
|
|
entry.models["opencode-omniroute/claude-sonnet-4-6"].name,
|
|
|
|
|
entry.models["claude-sonnet-4-6"].name,
|
|
|
|
|
"Claude Sonnet 4.6",
|
|
|
|
|
"enriched name kept, provider tag suppressed"
|
|
|
|
|
);
|
|
|
|
|
@@ -1396,7 +1396,7 @@ test("config: providerTag falls back to UPPER(alias) when providerDisplayName mi
|
|
|
|
|
const entry = (input as { provider: Record<string, OmniRouteStaticProviderEntry> }).provider[
|
|
|
|
|
"opencode-omniroute"
|
|
|
|
|
];
|
|
|
|
|
assert.equal(entry.models["opencode-omniroute/claude-sonnet-4-6"].name, "CC - Claude Sonnet 4.6");
|
|
|
|
|
assert.equal(entry.models["claude-sonnet-4-6"].name, "CC - Claude Sonnet 4.6");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("config: providerTag skipped entirely when neither providerDisplayName nor providerAlias set", async () => {
|
|
|
|
|
@@ -1423,7 +1423,7 @@ test("config: providerTag skipped entirely when neither providerDisplayName nor
|
|
|
|
|
const entry = (input as { provider: Record<string, OmniRouteStaticProviderEntry> }).provider[
|
|
|
|
|
"opencode-omniroute"
|
|
|
|
|
];
|
|
|
|
|
assert.equal(entry.models["opencode-omniroute/claude-sonnet-4-6"].name, "Claude Sonnet 4.6");
|
|
|
|
|
assert.equal(entry.models["claude-sonnet-4-6"].name, "Claude Sonnet 4.6");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("config: providerTag is idempotent — second hook call doesn't double-suffix", async () => {
|
|
|
|
|
@@ -1451,7 +1451,7 @@ test("config: providerTag is idempotent — second hook call doesn't double-suff
|
|
|
|
|
"opencode-omniroute"
|
|
|
|
|
];
|
|
|
|
|
assert.equal(
|
|
|
|
|
entryA.models["opencode-omniroute/claude-sonnet-4-6"].name,
|
|
|
|
|
entryA.models["claude-sonnet-4-6"].name,
|
|
|
|
|
"Claude - Claude Sonnet 4.6"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@@ -1462,7 +1462,7 @@ test("config: providerTag is idempotent — second hook call doesn't double-suff
|
|
|
|
|
"opencode-omniroute"
|
|
|
|
|
];
|
|
|
|
|
assert.equal(
|
|
|
|
|
entryB.models["opencode-omniroute/claude-sonnet-4-6"].name,
|
|
|
|
|
entryB.models["claude-sonnet-4-6"].name,
|
|
|
|
|
"Claude - Claude Sonnet 4.6"
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -1516,7 +1516,7 @@ test("buildStaticProviderEntry: nested combo-ref context is the bottleneck acros
|
|
|
|
|
);
|
|
|
|
|
// Pre-fix: Parent would advertise 200_000 (only raw-big counted).
|
|
|
|
|
// Post-fix: Parent should advertise 8_000 (TinyCombo bottleneck).
|
|
|
|
|
const parent = block.models["omniroute/parent"];
|
|
|
|
|
const parent = block.models["parent"];
|
|
|
|
|
assert.ok(parent, "Parent combo must be in the static catalog");
|
|
|
|
|
assert.equal(parent.limit?.context, 8_000);
|
|
|
|
|
});
|
|
|
|
|
|