@agentmark-ai/model-registry 0.2.0 → 0.2.1

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,16 +1,19 @@
1
1
  {
2
2
  "name": "@agentmark-ai/model-registry",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "LLM model registry with provider metadata, pricing, and capabilities",
5
- "main": "src/index.ts",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
6
7
  "license": "MIT",
7
8
  "publishConfig": {
8
9
  "access": "public"
9
10
  },
10
11
  "scripts": {
12
+ "build": "tsup",
11
13
  "test": "jest"
12
14
  },
13
15
  "files": [
16
+ "dist",
14
17
  "models.json",
15
18
  "overrides.json",
16
19
  "provider-labels.json"
@@ -22,7 +25,8 @@
22
25
  "@types/jest": "^29.5.13",
23
26
  "@types/node": "^20",
24
27
  "jest": "^29.7.0",
25
- "ts-jest": "^29.1.1",
28
+ "ts-jest": "^29.4.8",
29
+ "tsup": "^8.5.1",
26
30
  "typescript": "^5.5.3"
27
31
  }
28
32
  }
package/src/index.ts DELETED
@@ -1,63 +0,0 @@
1
- import * as fs from "fs";
2
- import * as path from "path";
3
- import { modelsFileSchema, overridesFileSchema } from "./validation.js";
4
- import { ModelRegistryImpl } from "./registry.js";
5
- import type { ModelRegistry } from "./types.js";
6
-
7
- export type {
8
- ModelMode,
9
- ModelPricing,
10
- ModelContext,
11
- ModelCapabilities,
12
- ModelEntry,
13
- ProviderInfo,
14
- ModelsFile,
15
- OverridesFile,
16
- ModelRegistry,
17
- SyncResult,
18
- SyncChangelog,
19
- } from "./types.js";
20
-
21
- export { modelsFileSchema, overridesFileSchema } from "./validation.js";
22
- export { ModelRegistryImpl } from "./registry.js";
23
-
24
- let cachedRegistry: ModelRegistry | null = null;
25
-
26
- /**
27
- * Factory function that reads models.json + overrides.json from disk,
28
- * validates via Zod, constructs ModelRegistryImpl, and returns it.
29
- * Singleton pattern: caches the registry after first load.
30
- */
31
- export function getModelRegistry(): ModelRegistry {
32
- if (cachedRegistry) {
33
- return cachedRegistry;
34
- }
35
-
36
- const packageRoot = path.resolve(__dirname, "..");
37
- const modelsPath = path.resolve(packageRoot, "models.json");
38
- const overridesPath = path.resolve(packageRoot, "overrides.json");
39
-
40
- const modelsRaw = JSON.parse(fs.readFileSync(modelsPath, "utf-8"));
41
- const modelsFile = modelsFileSchema.parse(modelsRaw);
42
-
43
- let overridesFile = undefined;
44
- if (fs.existsSync(overridesPath)) {
45
- const overridesRaw = JSON.parse(fs.readFileSync(overridesPath, "utf-8"));
46
- overridesFile = overridesFileSchema.parse(overridesRaw);
47
- }
48
-
49
- const labelsPath = path.resolve(packageRoot, "provider-labels.json");
50
- const providerLabels: Record<string, string> = fs.existsSync(labelsPath)
51
- ? JSON.parse(fs.readFileSync(labelsPath, "utf-8"))
52
- : {};
53
-
54
- cachedRegistry = new ModelRegistryImpl(modelsFile, overridesFile, providerLabels);
55
- return cachedRegistry;
56
- }
57
-
58
- /**
59
- * Reset the cached registry (useful for testing).
60
- */
61
- export function resetRegistryCache(): void {
62
- cachedRegistry = null;
63
- }