@suluk/models 0.1.0 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suluk/models",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "A weekly, PUBLIC-DATA-ONLY catalog of OpenRouter models + a selector: a suluk skill declares NEEDS (hard filters) + a small PREFERENCE (a named profile), and selectModel picks the best CURRENT model — never a hard-coded id. Decidable OpenRouter facts as numbers; noisy benchmarks as COARSE TIERS with {source, asOf}; no cross-axis composite (blending is the selector's job). CANDIDATE tooling — NOT official OAS.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Weekly refresh (Class A) — fetch OpenRouter /models, normalize to the fact-cell catalog, and write the committed,
3
+ * content-addressed artifact `src/openrouter-catalog.json`. Run: `bun scripts/refresh.ts [asOf]`. NETWORK.
4
+ * The benchmark TIER overlay (Class B) is a separate, lower-cadence, human-reviewed step (see REFRESH.md).
5
+ */
6
+ import { fetchOpenRouterCatalog, applyTierOverlay, KNOWN_TIERS } from "../src/index";
7
+
8
+ const asOf = process.argv[2] ?? new Date().toISOString().slice(0, 10);
9
+ let cat = await fetchOpenRouterCatalog(asOf);
10
+ // Class-B bootstrap: overlay the small cited frontier-standings seed onto intel.* (the full curation is the TODO).
11
+ cat = applyTierOverlay(cat, KNOWN_TIERS, { source: "public-leaderboard-consensus", asOf });
12
+ const overlaid = cat.rows.filter((r) => r.intel.reasoning.value !== null).length;
13
+ const out = new URL("../src/openrouter-catalog.json", import.meta.url);
14
+ await Bun.write(out, JSON.stringify(cat) + "\n"); // compact — it ships in the npm package (transitively via @suluk/agents)
15
+ console.log(`@suluk/models: wrote ${cat.rows.length} models (${overlaid} with intel tiers) · asOf ${asOf} · ${cat.snapshotHash}`);
package/src/index.ts CHANGED
@@ -6,13 +6,19 @@
6
6
  * Council wf_729cde52-cc7. CANDIDATE tooling — NOT official OAS. The live weekly fetcher is specified in REFRESH.md
7
7
  * (this package ships the schema + selector + a SEED catalog; the 200-row generated catalog is the data-eng spine).
8
8
  */
9
+ import type { ModelCatalog } from "./types";
9
10
  export type {
10
11
  Tier, Cell, DataRetention, ModelRecord, ModelCatalog, HardFilters, Profile, Preferences, RankedModel, SelectResult,
11
12
  } from "./types";
12
13
  export { SEED_CATALOG } from "./catalog";
14
+ // the committed, content-addressed OpenRouter fact catalog (generated weekly by scripts/refresh.ts): real prices /
15
+ // context / caps for ~300+ models. Benchmark TIER cells (intel.*) stay UNKNOWN until the Class-B overlay lands.
16
+ import OPENROUTER_CATALOG_JSON from "./openrouter-catalog.json";
17
+ export const OPENROUTER_CATALOG = OPENROUTER_CATALOG_JSON as unknown as ModelCatalog;
13
18
  export { PROFILES, type ResolvedProfile } from "./profiles";
14
19
  export { selectModel, deriveRequirements } from "./select";
15
20
  // the weekly fetcher spine: documented tier bucketing rules (red-line) + the pure OpenRouter facts transform + a thin live fetch.
16
21
  export { BUCKETING_RULES, applyBucketing, type AxisRule } from "./bucketing";
17
22
  export { normalizeOpenRouter, normalizeOpenRouterModel, catalogFrom, snapshotHash, type ORModel } from "./normalize";
18
23
  export { fetchOpenRouterCatalog } from "./fetch";
24
+ export { applyTierOverlay, KNOWN_TIERS, type IntelAxis } from "./overlay";
package/src/normalize.ts CHANGED
@@ -68,9 +68,10 @@ export function normalizeOpenRouter(models: ORModel[], asOf: string): ModelRecor
68
68
  return models.map((m) => normalizeOpenRouterModel(m, asOf)).sort((a, b) => a.id.localeCompare(b.id));
69
69
  }
70
70
 
71
- /** A content-addressed hash over the rows' load-bearing FACT cells (reproducible pin; ties C027 contentHash). */
71
+ /** A content-addressed hash over the rows' load-bearing SELECTION inputs facts AND intel tiers (a re-pick under a
72
+ * different catalog must differ; reproducible pin; ties C027 contentHash). */
72
73
  export function snapshotHash(rows: ModelRecord[]): string {
73
- const facts = rows.map((r) => [r.id, r.cost.inputPerMtok.value, r.cost.outputPerMtok.value, r.context.maxWindow.value, r.caps.toolCalling.value]);
74
+ const facts = rows.map((r) => [r.id, r.cost.inputPerMtok.value, r.cost.outputPerMtok.value, r.context.maxWindow.value, r.caps.toolCalling.value, ...Object.values(r.intel).map((c) => c.value)]);
74
75
  return "sha256-" + createHash("sha256").update(JSON.stringify(facts), "utf8").digest("hex").slice(0, 16);
75
76
  }
76
77