@suluk/models 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/overlay.ts ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The Class-B TIER OVERLAY — patches `intel.*` coarse tiers onto the facts-only catalog. Tiers are ADOPTED PUBLIC
3
+ * PRIORS (cited + asOf-stamped), never our measured facts — we do not self-test. The real pass curates them from
4
+ * BFCL/IFEval/SWE-bench/GPQA/RULER/MMLU-Pro/LMArena snapshots through `applyBucketing` (see REFRESH.md); this file
5
+ * also ships a SMALL, conservative seed of well-established frontier standings so the catalog's intelligence
6
+ * dimension isn't entirely UNKNOWN. UNKNOWN axes are left absent (NEVER imputed to worst).
7
+ */
8
+ import type { ModelCatalog, Tier } from "./types";
9
+ import { catalogFrom } from "./normalize";
10
+
11
+ export type IntelAxis = "agenticToolUse" | "instructionFollowing" | "reasoning" | "coding" | "longCtxComprehension" | "knowledge" | "humanPreference";
12
+
13
+ /** Overlay coarse tiers onto matching rows' intel cells, then re-hash (selection now depends on these tiers). */
14
+ export function applyTierOverlay(catalog: ModelCatalog, tiers: Record<string, Partial<Record<IntelAxis, Tier>>>, opts: { source: string; asOf: string }): ModelCatalog {
15
+ const rows = catalog.rows.map((r) => {
16
+ const t = tiers[r.id];
17
+ if (!t) return r;
18
+ const intel = { ...r.intel };
19
+ for (const axis of Object.keys(t) as IntelAxis[]) {
20
+ const v = t[axis];
21
+ if (v) intel[axis] = { value: v, source: opts.source, asOf: opts.asOf };
22
+ }
23
+ return { ...r, intel };
24
+ });
25
+ return catalogFrom(rows, catalog.generatedAt);
26
+ }
27
+
28
+ /**
29
+ * A SMALL, conservatively-CITED seed of coarse public standings for headline frontier models (the bootstrap until
30
+ * the full Class-B curation lands). These are adopted public-consensus priors at a LOW ceiling — verify at source;
31
+ * tune at review. Absent axes stay UNKNOWN. Source stamped `public-leaderboard-consensus`.
32
+ */
33
+ export const KNOWN_TIERS: Record<string, Partial<Record<IntelAxis, Tier>>> = {
34
+ "anthropic/claude-opus-4.1": { agenticToolUse: "frontier", instructionFollowing: "frontier", reasoning: "frontier", coding: "frontier", knowledge: "frontier", humanPreference: "frontier" },
35
+ "anthropic/claude-opus-4": { agenticToolUse: "frontier", instructionFollowing: "frontier", reasoning: "frontier", coding: "frontier", knowledge: "frontier", humanPreference: "frontier" },
36
+ "anthropic/claude-sonnet-4.5": { agenticToolUse: "frontier", instructionFollowing: "frontier", reasoning: "strong", coding: "frontier", knowledge: "strong", humanPreference: "strong" },
37
+ "google/gemini-2.5-pro": { agenticToolUse: "strong", instructionFollowing: "frontier", reasoning: "frontier", coding: "strong", longCtxComprehension: "frontier", knowledge: "frontier", humanPreference: "frontier" },
38
+ "google/gemini-2.5-flash": { agenticToolUse: "strong", instructionFollowing: "strong", reasoning: "mid", coding: "strong", knowledge: "strong", humanPreference: "strong" },
39
+ "openai/gpt-5": { agenticToolUse: "frontier", instructionFollowing: "frontier", reasoning: "frontier", coding: "frontier", knowledge: "frontier", humanPreference: "frontier" },
40
+ "deepseek/deepseek-chat-v3.1": { agenticToolUse: "mid", instructionFollowing: "strong", reasoning: "strong", coding: "strong", knowledge: "strong", humanPreference: "strong" },
41
+ "x-ai/grok-4.3": { agenticToolUse: "strong", instructionFollowing: "strong", reasoning: "frontier", coding: "strong", knowledge: "frontier", humanPreference: "strong" },
42
+ "meta-llama/llama-4-maverick": { instructionFollowing: "mid", reasoning: "mid", coding: "mid", knowledge: "strong", humanPreference: "mid" },
43
+ };
package/src/types.ts CHANGED
@@ -1,6 +1,12 @@
1
1
  /**
2
- * @suluk/models — the catalog schema (council wf_729cde52-cc7). A row is one model+provider endpoint. Decidable
3
- * OpenRouter facts are NUMBERS/BOOLS; noisy third-party benchmarks are COARSE TIERS (frontier/strong/mid/basic/
2
+ * @suluk/models — the catalog schema (council wf_729cde52-cc7). A row is keyed BY MODEL (id, capabilities, benchmark
3
+ * tiers, context window all per-model). Per-ENDPOINT axes (price/region/data-retention/latency, which differ across
4
+ * the provider endpoints one model fans out to) belong in a future optional `endpoints[]` sub-list (keying micro-panel
5
+ * wf_27de1bec-a42: model-keyed HYBRID, @0.6 — RESERVED, not built: OpenRouter routes endpoints at runtime + honors ZDR
6
+ * via a request flag, and no fleet needs per-endpoint region governance yet). NB until then `gov.region`/`dataRetention`
7
+ * are per-MODEL and stay UNKNOWN (fail-closed) — do NOT populate a "representative" region (it would silently degrade
8
+ * fail-closed to fail-OPEN at the endpoint layer — a forged in-region attestation; see C030).
9
+ * Decidable OpenRouter facts are NUMBERS/BOOLS; noisy third-party benchmarks are COARSE TIERS (frontier/strong/mid/basic/
4
10
  * unknown) — never a 2-decimal score (that launders noisy/contaminated public data as precision). Every cell carries
5
11
  * {source, asOf}; an unsourced cell is MISSING, never a confident value, and a missing tier is NEVER imputed to
6
12
  * worst (that would kill new models). The catalog stores NO cross-axis composite — blending is the selector's job
@@ -9,14 +9,20 @@ describe("@suluk/models — the committed OpenRouter catalog", () => {
9
9
  for (const r of OPENROUTER_CATALOG.rows.slice(0, 20)) {
10
10
  expect(r.id).toBeTruthy();
11
11
  expect(r.cost.inputPerMtok.value === null || typeof r.cost.inputPerMtok.value === "number").toBe(true);
12
- // benchmark tiers are UNKNOWN in the facts-only catalog (never imputed)
13
- expect(r.intel.agenticToolUse.value).toBeNull();
14
12
  }
13
+ // a few frontier rows carry CITED intel tiers (the Class-B seed); the long tail stays UNKNOWN, never imputed
14
+ const withTier = OPENROUTER_CATALOG.rows.filter((r) => r.intel.reasoning.value !== null);
15
+ expect(withTier.length).toBeGreaterThan(0);
16
+ expect(withTier.length).toBeLessThan(OPENROUTER_CATALOG.rows.length);
17
+ expect(withTier[0].intel.reasoning.source).toBeTruthy();
15
18
  });
16
19
 
17
- test("the selector runs end-to-end against the real catalog (tool-reliable, min-context)", () => {
18
- const r = selectModel({ needsTools: true, minWindowRequired: 200000 }, { profile: "tool-reliable" }, OPENROUTER_CATALOG);
19
- expect(r.ranked.length).toBeGreaterThan(0);
20
- expect(r.ranked[0].why.passedFilters).toContain("tool-calling");
20
+ test("the selector runs end-to-end against the real catalog + uses the overlaid tiers", () => {
21
+ const tool = selectModel({ needsTools: true, minWindowRequired: 200000 }, { profile: "tool-reliable" }, OPENROUTER_CATALOG);
22
+ expect(tool.ranked.length).toBeGreaterThan(0);
23
+ expect(tool.ranked[0].why.passedFilters).toContain("tool-calling");
24
+ // max-reasoning ⇒ a frontier/strong reasoner floats to the top (the overlay is live)
25
+ const reason = selectModel({ needsTools: true, minWindowRequired: 200000 }, { profile: "max-reasoning" }, OPENROUTER_CATALOG);
26
+ expect(["frontier", "strong"]).toContain(reason.ranked[0].why.tierByAxis.intelligence.tier);
21
27
  });
22
28
  });