@dbx-tools/dbx-model-catalog 0.2.0 → 0.3.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.
Files changed (54) hide show
  1. package/README.md +294 -57
  2. package/dist/_generated/channels.d.ts +4 -3
  3. package/dist/_generated/json-schema.d.ts +6527 -175
  4. package/dist/_generated/schemas.d.ts +154 -0
  5. package/dist/_generated/workspace-rules.d.ts +133 -0
  6. package/dist/browser.d.ts +34 -17
  7. package/dist/browser.js +1192 -149
  8. package/dist/catalog-index.d.ts +15 -2
  9. package/dist/chunk-engbh7tj.js +39 -0
  10. package/dist/chunk-gzjer0mc.js +1797 -0
  11. package/dist/chunk-pp7fw379.js +51 -0
  12. package/dist/chunk-pwssxaq0.js +39 -0
  13. package/dist/cli.js +9 -654
  14. package/dist/effective.d.ts +31 -0
  15. package/dist/index.d.ts +33 -16
  16. package/dist/index.js +60 -660
  17. package/dist/local-client.d.ts +16 -3
  18. package/dist/pynect.d.ts +6 -3
  19. package/dist/search.d.ts +7 -1
  20. package/dist/serving-endpoints.d.ts +15 -0
  21. package/dist/sources.d.ts +30 -0
  22. package/dist/types.d.ts +31 -3
  23. package/dist/validation.d.ts +15 -1
  24. package/dist/workspace-cache.d.ts +68 -0
  25. package/dist/workspace-client.d.ts +49 -0
  26. package/dist/workspace-connection.d.ts +67 -0
  27. package/dist/workspace-file-cache.d.ts +11 -0
  28. package/dist/workspace-identity.d.ts +27 -0
  29. package/dist/workspace-overlay.d.ts +71 -0
  30. package/package.json +5 -6
  31. package/src/_generated/channels.ts +5 -2
  32. package/src/_generated/json-schema.ts +4 -2
  33. package/src/_generated/schemas.ts +177 -0
  34. package/src/_generated/workspace-rules.ts +285 -0
  35. package/src/browser.ts +105 -54
  36. package/src/catalog-index.ts +46 -19
  37. package/src/cli.ts +8 -11
  38. package/src/effective.ts +200 -0
  39. package/src/identity.ts +3 -26
  40. package/src/index.ts +155 -82
  41. package/src/local-client.ts +94 -18
  42. package/src/pynect.ts +28 -65
  43. package/src/search.ts +48 -0
  44. package/src/serving-endpoints.ts +157 -0
  45. package/src/sources.ts +107 -0
  46. package/src/types.ts +32 -2
  47. package/src/validation.ts +33 -0
  48. package/src/workspace-cache.ts +234 -0
  49. package/src/workspace-client.ts +134 -0
  50. package/src/workspace-connection.ts +160 -0
  51. package/src/workspace-file-cache.ts +45 -0
  52. package/src/workspace-identity.ts +77 -0
  53. package/src/workspace-overlay.ts +200 -0
  54. package/dist/pynect.js +0 -557
@@ -1,6 +1,13 @@
1
1
  // Generated by @chanx-js/codegen. Do not edit.
2
2
  // Regenerate with: npx @chanx-js/codegen
3
3
 
4
+ /** AI Gateway relative quality, speed, and cost profile. */
5
+ export interface AiGatewayModelProfile {
6
+ quality?: number | null;
7
+ speed?: number | null;
8
+ cost?: number | null;
9
+ }
10
+
4
11
  /** Model availability on one Databricks cloud provider. */
5
12
  export interface Availability {
6
13
  status: Status1;
@@ -157,9 +164,62 @@ export interface CatalogSearchWeights {
157
164
  /** Default reasoning effort when no level is specified. */
158
165
  export type DefaultEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "default";
159
166
 
167
+ /** Accessible endpoint: normalized live metadata, public match, and field provenance. */
168
+ export interface EffectiveEndpoint {
169
+ /** Invocable serving endpoint name. */
170
+ name: string;
171
+ display_name?: string | null;
172
+ description?: string | null;
173
+ /** Databricks serving task, such as llm/v1/chat. */
174
+ task?: string | null;
175
+ /** Catalog type mapped from a known task. */
176
+ type?: Type | null;
177
+ /** Modalities mapped from a known task. */
178
+ modalities?: Modalities | null;
179
+ /** Endpoint readiness, such as READY. */
180
+ state?: string | null;
181
+ source: WorkspaceEndpointSource;
182
+ family?: string | null;
183
+ capabilities: WorkspaceEndpointCapabilities;
184
+ profile?: WorkspaceModelProfile | null;
185
+ identities: Array<IdentityCandidate>;
186
+ match?: MatchedPublicIdentity | null;
187
+ /** Origin of each overlay or placeholder field (dotted path). Matched records inherit every unlisted field from the public record, attributed by the record's sources; placeholder values are schema-required, not facts. */
188
+ fields: Record<string, FieldOrigin>;
189
+ }
190
+
191
+ /** Public catalog merged with one workspace's accessible endpoints. */
192
+ export interface EffectiveModelCatalog {
193
+ contract_version: number;
194
+ catalog: ModelCatalog;
195
+ workspace: WorkspaceRefresh;
196
+ /** Accessible endpoints keyed by invocable endpoint name, which is also the record id in catalog.models when the endpoint has a record. An unmatched endpoint whose task maps to no catalog type is listed here only. Records without an entry are public references not confirmed accessible in the workspace. */
197
+ endpoints: Record<string, EffectiveEndpoint>;
198
+ }
199
+
160
200
  /** Normalized reasoning effort level. */
161
201
  export type EffortEnum = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "default";
162
202
 
203
+ /** External model provider and name reported for a served entity. */
204
+ export interface ExternalModel {
205
+ name?: string | null;
206
+ provider?: string | null;
207
+ task?: string | null;
208
+ }
209
+
210
+ /** Where an effective record field value came from. */
211
+ export type FieldOrigin = "workspace" | "public" | "placeholder";
212
+
213
+ /** Foundation model metadata reported for a served entity. */
214
+ export interface FoundationModel {
215
+ name?: string | null;
216
+ display_name?: string | null;
217
+ description?: string | null;
218
+ docs?: string | null;
219
+ model_class?: string | null;
220
+ ai_gateway_model_profile?: AiGatewayModelProfile | null;
221
+ }
222
+
163
223
  export interface GetCatalogRequest {
164
224
  action: "get_catalog";
165
225
  payload: CatalogFilters;
@@ -180,6 +240,12 @@ export interface GetSearchIndexResponse {
180
240
  payload: CatalogSearchIndexPayload;
181
241
  }
182
242
 
243
+ /** One exact identity reported for an endpoint. */
244
+ export interface IdentityCandidate {
245
+ kind: "endpoint_name" | "served_entity" | "foundation_model" | "external_model" | "model_service";
246
+ value: string;
247
+ }
248
+
183
249
  /** Known model input and output modalities. */
184
250
  export type Input = "text" | "image" | "audio" | "video" | "application/pdf" | "embedding" | "reranking" | "decision";
185
251
 
@@ -218,6 +284,15 @@ export interface ListModelsResponse {
218
284
  payload: Array<CatalogModelRecord>;
219
285
  }
220
286
 
287
+ /** Public catalog record an endpoint matched, and the endpoint identity that matched it. */
288
+ export interface MatchedPublicIdentity {
289
+ /** Public catalog record id. */
290
+ id: string;
291
+ kind: "endpoint_name" | "served_entity" | "foundation_model" | "external_model" | "model_service";
292
+ /** Endpoint identity that matched exactly. */
293
+ value: string;
294
+ }
295
+
221
296
  /** Model input and output modalities. */
222
297
  export interface Modalities {
223
298
  input: Array<Input | string>;
@@ -242,6 +317,16 @@ export interface Notice {
242
317
  /** Known model input and output modalities. */
243
318
  export type Output = "text" | "image" | "audio" | "video" | "application/pdf" | "embedding" | "reranking" | "decision";
244
319
 
320
+ export interface OverlayServingEndpointsRequest {
321
+ action: "overlay_serving_endpoints";
322
+ payload: ServingEndpointsResponse;
323
+ }
324
+
325
+ export interface OverlayServingEndpointsResponse {
326
+ action: "effective_catalog";
327
+ payload: EffectiveModelCatalog;
328
+ }
329
+
245
330
  /** Normalized Databricks price in one currency. */
246
331
  export interface Price {
247
332
  unit: Unit;
@@ -337,6 +422,62 @@ export interface Schedule {
337
422
  dates: Array<string>;
338
423
  }
339
424
 
425
+ /** One served entity in a Serving Endpoints configuration. */
426
+ export interface ServedEntity {
427
+ name?: string | null;
428
+ entity_name?: string | null;
429
+ entity_version?: string | null;
430
+ foundation_model?: FoundationModel | null;
431
+ external_model?: ExternalModel | null;
432
+ }
433
+
434
+ /** Legacy served model in a Serving Endpoints configuration. */
435
+ export interface ServedModel {
436
+ name?: string | null;
437
+ model_name?: string | null;
438
+ model_version?: string | null;
439
+ }
440
+
441
+ /** One serving endpoint from ``GET /api/2.0/serving-endpoints``. */
442
+ export interface ServingEndpoint {
443
+ name?: string | null;
444
+ id?: string | null;
445
+ description?: string | null;
446
+ task?: string | null;
447
+ state?: ServingEndpointState | null;
448
+ config?: ServingEndpointConfig | null;
449
+ tags?: Array<ServingEndpointTag>;
450
+ capabilities?: ServingEndpointCapabilities | null;
451
+ }
452
+
453
+ /** Explicit endpoint capabilities reported by the workspace. */
454
+ export interface ServingEndpointCapabilities {
455
+ function_calling?: boolean | null;
456
+ }
457
+
458
+ /** Served entities and legacy served models for one endpoint. */
459
+ export interface ServingEndpointConfig {
460
+ served_entities?: Array<ServedEntity>;
461
+ served_models?: Array<ServedModel>;
462
+ }
463
+
464
+ /** Serving endpoint readiness and configuration update state. */
465
+ export interface ServingEndpointState {
466
+ ready?: string | null;
467
+ config_update?: string | null;
468
+ }
469
+
470
+ /** User-defined serving endpoint tag. */
471
+ export interface ServingEndpointTag {
472
+ key: string;
473
+ value?: string | null;
474
+ }
475
+
476
+ /** Raw ``GET /api/2.0/serving-endpoints`` response body. */
477
+ export interface ServingEndpointsResponse {
478
+ endpoints?: Array<ServingEndpoint>;
479
+ }
480
+
340
481
  /** Databricks serving mode available for the model. */
341
482
  export type ServingMode = "pay_per_token" | "priority_pay_per_token" | "provisioned_throughput" | "batch";
342
483
 
@@ -406,3 +547,39 @@ export interface Variant2 {
406
547
  harness?: string | null;
407
548
  context?: number | null;
408
549
  }
550
+
551
+ /** Capabilities the workspace states explicitly; ``None`` means unknown. */
552
+ export interface WorkspaceEndpointCapabilities {
553
+ function_calling?: boolean | null;
554
+ }
555
+
556
+ /** How the workspace serves the endpoint's model. */
557
+ export type WorkspaceEndpointSource = "foundation" | "external" | "custom";
558
+
559
+ /** AI Gateway relative quality, speed, and cost scores. */
560
+ export interface WorkspaceModelProfile {
561
+ quality?: number | null;
562
+ speed?: number | null;
563
+ cost?: number | null;
564
+ }
565
+
566
+ /** Workspace overlay refresh state for one effective catalog. */
567
+ export interface WorkspaceRefresh {
568
+ /** disabled: no workspace connection. current: overlay refreshed within the refresh interval. stale: a cached overlay served after a failed refresh. unavailable: discovery failed with no eligible cached overlay, so no workspace access is claimed. */
569
+ status: WorkspaceRefreshStatus;
570
+ /** Normalized workspace identity: id:<workspace id> or host:<host[/path]>. */
571
+ workspace?: string | null;
572
+ /** True when the overlay is stored in the shared persistent cache. */
573
+ persistent?: boolean;
574
+ /** When the served endpoint inventory was fetched. */
575
+ refreshed_at?: string | null;
576
+ /** When the most recent refresh was attempted. */
577
+ attempted_at?: string | null;
578
+ /** Age of the served inventory when this catalog was built. */
579
+ age_seconds?: number | null;
580
+ /** Most recent refresh error. */
581
+ error?: string | null;
582
+ }
583
+
584
+ /** Whether, and how currently, workspace enrichment applies. */
585
+ export type WorkspaceRefreshStatus = "disabled" | "current" | "stale" | "unavailable";
@@ -0,0 +1,285 @@
1
+ // Generated from the Python-owned workspace overlay rules. Do not edit.
2
+ export const WORKSPACE_OVERLAY_RULES = {
3
+ "contract_version": 1,
4
+ "serving_endpoints_path": "/api/2.0/serving-endpoints",
5
+ "principal": {
6
+ "path": "/api/2.0/preview/scim/v2/Me",
7
+ "fields": [
8
+ "id",
9
+ "userName"
10
+ ]
11
+ },
12
+ "cache": {
13
+ "refresh_interval_seconds": 300,
14
+ "stale_ttl_seconds": 604800
15
+ },
16
+ "identity_fields": [
17
+ {
18
+ "kind": "endpoint_name",
19
+ "path": [
20
+ "name"
21
+ ]
22
+ },
23
+ {
24
+ "kind": "served_entity",
25
+ "path": [
26
+ "config",
27
+ "served_entities",
28
+ "*",
29
+ "entity_name"
30
+ ]
31
+ },
32
+ {
33
+ "kind": "served_entity",
34
+ "path": [
35
+ "config",
36
+ "served_models",
37
+ "*",
38
+ "model_name"
39
+ ]
40
+ },
41
+ {
42
+ "kind": "foundation_model",
43
+ "path": [
44
+ "config",
45
+ "served_entities",
46
+ "*",
47
+ "foundation_model",
48
+ "name"
49
+ ]
50
+ },
51
+ {
52
+ "kind": "external_model",
53
+ "path": [
54
+ "config",
55
+ "served_entities",
56
+ "*",
57
+ "external_model",
58
+ "name"
59
+ ]
60
+ },
61
+ {
62
+ "kind": "external_model",
63
+ "path": [
64
+ "config",
65
+ "served_entities",
66
+ "*",
67
+ "external_model"
68
+ ],
69
+ "join": [
70
+ "provider",
71
+ "name"
72
+ ]
73
+ }
74
+ ],
75
+ "model_service_prefixes": [
76
+ "system.ai."
77
+ ],
78
+ "display_name_fields": [
79
+ [
80
+ "config",
81
+ "served_entities",
82
+ "*",
83
+ "foundation_model",
84
+ "display_name"
85
+ ]
86
+ ],
87
+ "display_name_tag_keys": [
88
+ "display_name",
89
+ "displayName"
90
+ ],
91
+ "description_fields": [
92
+ [
93
+ "description"
94
+ ],
95
+ [
96
+ "config",
97
+ "served_entities",
98
+ "*",
99
+ "foundation_model",
100
+ "description"
101
+ ]
102
+ ],
103
+ "family_fields": [
104
+ [
105
+ "config",
106
+ "served_entities",
107
+ "*",
108
+ "foundation_model",
109
+ "model_class"
110
+ ]
111
+ ],
112
+ "profile_fields": [
113
+ [
114
+ "config",
115
+ "served_entities",
116
+ "*",
117
+ "foundation_model",
118
+ "ai_gateway_model_profile"
119
+ ]
120
+ ],
121
+ "profile_keys": [
122
+ "quality",
123
+ "speed",
124
+ "cost"
125
+ ],
126
+ "capability_fields": {
127
+ "function_calling": [
128
+ "capabilities",
129
+ "function_calling"
130
+ ]
131
+ },
132
+ "task_types": {
133
+ "llm/v1/chat": {
134
+ "type": "chat",
135
+ "modalities": {
136
+ "input": [
137
+ "text"
138
+ ],
139
+ "output": [
140
+ "text"
141
+ ]
142
+ }
143
+ },
144
+ "llm/v1/completions": {
145
+ "type": "chat",
146
+ "modalities": {
147
+ "input": [
148
+ "text"
149
+ ],
150
+ "output": [
151
+ "text"
152
+ ]
153
+ }
154
+ },
155
+ "llm/v1/embeddings": {
156
+ "type": "embedding",
157
+ "modalities": {
158
+ "input": [
159
+ "text"
160
+ ],
161
+ "output": [
162
+ "embedding"
163
+ ]
164
+ }
165
+ },
166
+ "agent/v1/chat": {
167
+ "type": "chat",
168
+ "modalities": {
169
+ "input": [
170
+ "text"
171
+ ],
172
+ "output": [
173
+ "text"
174
+ ]
175
+ }
176
+ },
177
+ "agent/v2/chat": {
178
+ "type": "chat",
179
+ "modalities": {
180
+ "input": [
181
+ "text"
182
+ ],
183
+ "output": [
184
+ "text"
185
+ ]
186
+ }
187
+ },
188
+ "agent/v1/responses": {
189
+ "type": "chat",
190
+ "modalities": {
191
+ "input": [
192
+ "text"
193
+ ],
194
+ "output": [
195
+ "text"
196
+ ]
197
+ }
198
+ }
199
+ },
200
+ "overlay_fields": [
201
+ {
202
+ "target": "name",
203
+ "source": "display_name"
204
+ },
205
+ {
206
+ "target": "description",
207
+ "source": "description"
208
+ },
209
+ {
210
+ "target": "family",
211
+ "source": "family"
212
+ },
213
+ {
214
+ "target": "capabilities.tools",
215
+ "source": "capabilities.function_calling"
216
+ },
217
+ {
218
+ "target": "type",
219
+ "source": "type",
220
+ "unmatched_only": true
221
+ },
222
+ {
223
+ "target": "modalities",
224
+ "source": "modalities",
225
+ "unmatched_only": true
226
+ }
227
+ ],
228
+ "placeholders": {
229
+ "description": "",
230
+ "type": "chat",
231
+ "status": "active",
232
+ "modalities": {
233
+ "input": [],
234
+ "output": []
235
+ },
236
+ "capabilities.responses": false,
237
+ "capabilities.apply_patch": false,
238
+ "capabilities.web_search": false
239
+ },
240
+ "runtime_search_quality": {
241
+ "leaderboard": 50,
242
+ "benchmark": 50,
243
+ "version": 50,
244
+ "freshness": 50,
245
+ "lifecycle": 100
246
+ },
247
+ "provider_prefixes": [
248
+ "alibaba",
249
+ "anthropic",
250
+ "deepseek",
251
+ "google",
252
+ "meta",
253
+ "moonshot",
254
+ "openai",
255
+ "xai",
256
+ "zhipu"
257
+ ],
258
+ "provider_families": [
259
+ "claude",
260
+ "deepseek",
261
+ "gemini",
262
+ "gemma",
263
+ "glm",
264
+ "gpt",
265
+ "grok",
266
+ "gte",
267
+ "bge",
268
+ "kimi",
269
+ "llama",
270
+ "qwen"
271
+ ],
272
+ "workspace_identity": {
273
+ "header_names": [
274
+ "x-databricks-org-id",
275
+ "x-databricks-workspace-id"
276
+ ],
277
+ "host_patterns": [
278
+ "^adb-(\\d+)\\.\\d+\\.azuredatabricks\\.net$",
279
+ "^(\\d+)\\.\\d+\\.gcp\\.databricks\\.com$"
280
+ ],
281
+ "query_parameters": [
282
+ "o"
283
+ ]
284
+ }
285
+ } as const;
package/src/browser.ts CHANGED
@@ -1,14 +1,88 @@
1
- import { createModelCatalogClient } from "./local-client.js";
2
- import type { CatalogClient } from "./types.js";
3
- import { createModelCatalogIndex, type ModelCatalogIndex } from "./catalog-index.js";
4
- import {
5
- PUBLISHED_CATALOG_SEARCH_INDEX_URL,
6
- PUBLISHED_CATALOG_URL,
7
- } from "./_generated/published.js";
8
- import { parseCatalogSearchIndex, parseModelCatalog } from "./validation.js";
1
+ import { createCatalogClient, workspaceOverlay } from "./local-client.js";
2
+ import { type CatalogSourceOptions, type ModelCatalogSourceInput, loadBrowserSource } from "./sources.js";
3
+ import type { ModelCatalogClient } from "./types.js";
4
+ import { type BrowserModelServingClientOption, connectBrowserModelServing } from "./workspace-connection.js";
5
+ import type { WorkspaceCacheOptions } from "./workspace-overlay.js";
6
+
7
+ /** Options for the browser `createModelCatalogClient`. */
8
+ interface BrowserModelCatalogClientOptions extends CatalogSourceOptions {
9
+ /**
10
+ * Workspace connection: a `{ host, headers }` connection or a sync or async function returning
11
+ * one. SDK clients need the Node entry point.
12
+ */
13
+ modelServingClient?: BrowserModelServingClientOption;
14
+ /** Workspace overlay refresh and cache settings. Defaults to process memory. */
15
+ workspaceCache?: WorkspaceCacheOptions;
16
+ }
17
+
18
+ /**
19
+ * Create a catalog client from any source: the published catalog by default, an `http(s)` catalog
20
+ * URL (its `search-index.json` is read from the same directory), a `ws(s)` URL of the Python
21
+ * catalog server (needs the optional `pynect` and `@chanx-js/client` peers), or an in-memory
22
+ * catalog with `options.searchIndex`. With `modelServingClient` every read serves the
23
+ * workspace-effective catalog, whatever the source.
24
+ */
25
+ export async function createModelCatalogClient(
26
+ source?: ModelCatalogSourceInput,
27
+ options: BrowserModelCatalogClientOptions = {},
28
+ ): Promise<ModelCatalogClient> {
29
+ // Validate the optional workspace connection before any request.
30
+ const connector = options.modelServingClient === undefined
31
+ ? undefined
32
+ : connectBrowserModelServing(options.modelServingClient, { fetch: options.fetch });
33
+ const loaded = await loadBrowserSource(source, options);
34
+ return createCatalogClient(loaded, workspaceOverlay(connector, options.workspaceCache));
35
+ }
9
36
 
10
- export type * from "./_generated/schemas.js";
11
- export type * from "./types.js";
37
+ export type { BrowserModelCatalogClientOptions as ModelCatalogClientOptions };
38
+ export type { ModelCatalogSourceInput } from "./sources.js";
39
+ export type { ModelCatalogClient, ModelCatalogSource, ModelCatalogSourceKind } from "./types.js";
40
+ export type {
41
+ Availability,
42
+ AveragePrice,
43
+ Benchmark,
44
+ Capabilities,
45
+ CatalogFilters,
46
+ CatalogModel,
47
+ CatalogModelRecord,
48
+ CatalogSearchIndexDocument,
49
+ CatalogSearchIndexPayload,
50
+ CatalogSearchQualityScores,
51
+ EffectiveEndpoint,
52
+ EffectiveModelCatalog,
53
+ FieldOrigin,
54
+ IdentityCandidate,
55
+ Latency,
56
+ Limits,
57
+ MatchedPublicIdentity,
58
+ Modalities,
59
+ ModelCatalog,
60
+ Notice,
61
+ Price,
62
+ Rankings,
63
+ RateLimits,
64
+ Reasoning,
65
+ Retirement,
66
+ SourceLink,
67
+ Status,
68
+ Type,
69
+ WorkspaceEndpointCapabilities,
70
+ WorkspaceEndpointSource,
71
+ WorkspaceModelProfile,
72
+ WorkspaceRefresh,
73
+ WorkspaceRefreshStatus,
74
+ } from "./_generated/schemas.js";
75
+ export type { CatalogIdentityMatch } from "./catalog-index.js";
76
+ export type { ModelIdentity, ModelIdentityKind } from "./identity.js";
77
+ export type { CatalogSearchMatch } from "./search.js";
78
+ export type { CachedWorkspaceOverlay, WorkspaceCacheOptions } from "./workspace-overlay.js";
79
+ export type { WorkspaceCacheStore, WorkspaceCatalogCache } from "./workspace-cache.js";
80
+ export type {
81
+ BrowserModelServingClientOption,
82
+ ModelServingConnection,
83
+ ModelServingConnectionGenerator,
84
+ } from "./workspace-connection.js";
85
+ export { EFFECTIVE_CATALOG_CONTRACT_VERSION } from "./effective.js";
12
86
  export {
13
87
  PUBLISHED_CATALOG_DATABASE_URL,
14
88
  PUBLISHED_CATALOG_INDEX_URL,
@@ -18,47 +92,24 @@ export {
18
92
  PUBLISHED_CATALOG_SEARCH_INDEX_URL,
19
93
  PUBLISHED_CATALOG_URL,
20
94
  } from "./_generated/published.js";
21
-
22
- export interface LoadModelCatalogOptions {
23
- catalogUrl?: string;
24
- fetch?: typeof globalThis.fetch;
25
- searchIndexUrl?: string;
26
- }
27
-
28
- export async function loadModelCatalog(
29
- options: LoadModelCatalogOptions = {},
30
- ): Promise<CatalogClient> {
31
- const index = await loadModelCatalogIndex(options);
32
- return createModelCatalogClient(index.catalog, index.searchIndex);
33
- }
34
-
35
- export async function loadModelCatalogIndex(
36
- options: LoadModelCatalogOptions = {},
37
- ): Promise<ModelCatalogIndex> {
38
- const loader = options.fetch ?? globalThis.fetch;
39
- const catalogUrl = options.catalogUrl ?? PUBLISHED_CATALOG_URL;
40
- const searchIndexUrl = options.searchIndexUrl ?? (
41
- options.catalogUrl
42
- ? new URL("search-index.json", options.catalogUrl).toString()
43
- : PUBLISHED_CATALOG_SEARCH_INDEX_URL
44
- );
45
- const [catalogResponse, searchIndexResponse] = await Promise.all([
46
- loader(catalogUrl),
47
- loader(searchIndexUrl),
48
- ]);
49
- if (!catalogResponse.ok) throw new Error(`Catalog request failed with ${catalogResponse.status}`);
50
- if (!searchIndexResponse.ok) {
51
- throw new Error(`Search index request failed with ${searchIndexResponse.status}`);
52
- }
53
- return createModelCatalogIndex(
54
- parseModelCatalog(await catalogResponse.json()),
55
- parseCatalogSearchIndex(await searchIndexResponse.json()),
56
- );
57
- }
58
-
59
- export * from "./catalog-index.js";
60
- export * from "./identity.js";
61
- export * from "./validation.js";
62
- export { createModelCatalogClient } from "./local-client.js";
63
- export { filterCatalogRecords } from "./local-client.js";
64
- export { searchCatalogMatches, searchCatalogRecords } from "./search.js";
95
+ export {
96
+ CatalogAveragePriceSchema,
97
+ CatalogCapabilitiesSchema,
98
+ CatalogLatencySchema,
99
+ CatalogModelRecordSchema,
100
+ CatalogModelSchema,
101
+ CatalogPreferenceRankingSchema,
102
+ CatalogPriceSchema,
103
+ CatalogRankingSchema,
104
+ CatalogRateLimitsSchema,
105
+ CatalogScoreRankingSchema,
106
+ CatalogSearchIndexSchema,
107
+ CatalogStatusSchema,
108
+ EffectiveModelCatalogSchema,
109
+ ModelCatalogSchema,
110
+ WorkspaceRefreshSchema,
111
+ parseCatalogModelRecord,
112
+ parseCatalogSearchIndex,
113
+ parseEffectiveModelCatalog,
114
+ parseModelCatalog,
115
+ } from "./validation.js";