@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
package/dist/browser.js CHANGED
@@ -1,40 +1,349 @@
1
+ import {
2
+ ModelCatalogSchema2,
3
+ CatalogSearchIndexSchema2,
4
+ CatalogModelSchema2,
5
+ CatalogModelRecordSchema2,
6
+ CatalogCapabilitiesSchema2,
7
+ CatalogRateLimitsSchema2,
8
+ CatalogLatencySchema2,
9
+ CatalogPriceSchema2,
10
+ CatalogAveragePriceSchema2,
11
+ CatalogPreferenceRankingSchema2,
12
+ CatalogScoreRankingSchema2,
13
+ CatalogRankingSchema2,
14
+ CatalogStatusSchema2,
15
+ EffectiveModelCatalogSchema2,
16
+ WorkspaceRefreshSchema2,
17
+ parseModelCatalog2,
18
+ parseCatalogSearchIndex2,
19
+ parseCatalogModelRecord2,
20
+ parseEffectiveModelCatalog2,
21
+ parseServingEndpointsResponse
22
+ } from "./chunk-pp7fw379.js";
23
+ var __chunkGraphs;
24
+ var __chunkSeen;
25
+ var __chunkNonce;
26
+ var __preload = (id, seenOnly) => {
27
+ for (var [base, graph, ids] of __chunkGraphs || [])
28
+ for (var stack = [id], g = globalThis, d = g.document, head, j, node, k, link;j = stack.pop(); )
29
+ if (!__chunkSeen[j] && (node = graph[j])) {
30
+ __chunkSeen[j] = 1;
31
+ for (k = 1;k < node.length; k++)
32
+ stack.push(ids[node[k]]);
33
+ if (!seenOnly && j !== id && (head = d && d.head)) {
34
+ if (__chunkNonce === undefined)
35
+ __chunkNonce = (k = d.querySelector("meta[property=csp-nonce]")) && (k.nonce || k.getAttribute("nonce")) || "";
36
+ link = d.createElement("link");
37
+ link.rel = "modulepreload";
38
+ link.crossOrigin = "";
39
+ if (__chunkNonce)
40
+ link.nonce = __chunkNonce;
41
+ link.href = new g.URL(node[0], base);
42
+ head.appendChild(link);
43
+ }
44
+ }
45
+ };
46
+ var __chunks = (base, ids, nodes, entry) => {
47
+ for (var graph = {}, i = 0;i < ids.length; i++)
48
+ graph[ids[i]] = nodes[i];
49
+ (__chunkGraphs ||= []).push([base, graph, ids]);
50
+ __chunkSeen ||= {};
51
+ __preload(ids[entry], 1);
52
+ };
53
+ __chunks(import.meta.url,["9nez2agq","engbh7tj","pp7fw379"],[["./browser.js",2],["./chunk-engbh7tj.js",2],["./chunk-pp7fw379.js"]],0);
54
+
55
+ // src/_generated/workspace-rules.ts
56
+ var WORKSPACE_OVERLAY_RULES = {
57
+ contract_version: 1,
58
+ serving_endpoints_path: "/api/2.0/serving-endpoints",
59
+ principal: {
60
+ path: "/api/2.0/preview/scim/v2/Me",
61
+ fields: [
62
+ "id",
63
+ "userName"
64
+ ]
65
+ },
66
+ cache: {
67
+ refresh_interval_seconds: 300,
68
+ stale_ttl_seconds: 604800
69
+ },
70
+ identity_fields: [
71
+ {
72
+ kind: "endpoint_name",
73
+ path: [
74
+ "name"
75
+ ]
76
+ },
77
+ {
78
+ kind: "served_entity",
79
+ path: [
80
+ "config",
81
+ "served_entities",
82
+ "*",
83
+ "entity_name"
84
+ ]
85
+ },
86
+ {
87
+ kind: "served_entity",
88
+ path: [
89
+ "config",
90
+ "served_models",
91
+ "*",
92
+ "model_name"
93
+ ]
94
+ },
95
+ {
96
+ kind: "foundation_model",
97
+ path: [
98
+ "config",
99
+ "served_entities",
100
+ "*",
101
+ "foundation_model",
102
+ "name"
103
+ ]
104
+ },
105
+ {
106
+ kind: "external_model",
107
+ path: [
108
+ "config",
109
+ "served_entities",
110
+ "*",
111
+ "external_model",
112
+ "name"
113
+ ]
114
+ },
115
+ {
116
+ kind: "external_model",
117
+ path: [
118
+ "config",
119
+ "served_entities",
120
+ "*",
121
+ "external_model"
122
+ ],
123
+ join: [
124
+ "provider",
125
+ "name"
126
+ ]
127
+ }
128
+ ],
129
+ model_service_prefixes: [
130
+ "system.ai."
131
+ ],
132
+ display_name_fields: [
133
+ [
134
+ "config",
135
+ "served_entities",
136
+ "*",
137
+ "foundation_model",
138
+ "display_name"
139
+ ]
140
+ ],
141
+ display_name_tag_keys: [
142
+ "display_name",
143
+ "displayName"
144
+ ],
145
+ description_fields: [
146
+ [
147
+ "description"
148
+ ],
149
+ [
150
+ "config",
151
+ "served_entities",
152
+ "*",
153
+ "foundation_model",
154
+ "description"
155
+ ]
156
+ ],
157
+ family_fields: [
158
+ [
159
+ "config",
160
+ "served_entities",
161
+ "*",
162
+ "foundation_model",
163
+ "model_class"
164
+ ]
165
+ ],
166
+ profile_fields: [
167
+ [
168
+ "config",
169
+ "served_entities",
170
+ "*",
171
+ "foundation_model",
172
+ "ai_gateway_model_profile"
173
+ ]
174
+ ],
175
+ profile_keys: [
176
+ "quality",
177
+ "speed",
178
+ "cost"
179
+ ],
180
+ capability_fields: {
181
+ function_calling: [
182
+ "capabilities",
183
+ "function_calling"
184
+ ]
185
+ },
186
+ task_types: {
187
+ "llm/v1/chat": {
188
+ type: "chat",
189
+ modalities: {
190
+ input: [
191
+ "text"
192
+ ],
193
+ output: [
194
+ "text"
195
+ ]
196
+ }
197
+ },
198
+ "llm/v1/completions": {
199
+ type: "chat",
200
+ modalities: {
201
+ input: [
202
+ "text"
203
+ ],
204
+ output: [
205
+ "text"
206
+ ]
207
+ }
208
+ },
209
+ "llm/v1/embeddings": {
210
+ type: "embedding",
211
+ modalities: {
212
+ input: [
213
+ "text"
214
+ ],
215
+ output: [
216
+ "embedding"
217
+ ]
218
+ }
219
+ },
220
+ "agent/v1/chat": {
221
+ type: "chat",
222
+ modalities: {
223
+ input: [
224
+ "text"
225
+ ],
226
+ output: [
227
+ "text"
228
+ ]
229
+ }
230
+ },
231
+ "agent/v2/chat": {
232
+ type: "chat",
233
+ modalities: {
234
+ input: [
235
+ "text"
236
+ ],
237
+ output: [
238
+ "text"
239
+ ]
240
+ }
241
+ },
242
+ "agent/v1/responses": {
243
+ type: "chat",
244
+ modalities: {
245
+ input: [
246
+ "text"
247
+ ],
248
+ output: [
249
+ "text"
250
+ ]
251
+ }
252
+ }
253
+ },
254
+ overlay_fields: [
255
+ {
256
+ target: "name",
257
+ source: "display_name"
258
+ },
259
+ {
260
+ target: "description",
261
+ source: "description"
262
+ },
263
+ {
264
+ target: "family",
265
+ source: "family"
266
+ },
267
+ {
268
+ target: "capabilities.tools",
269
+ source: "capabilities.function_calling"
270
+ },
271
+ {
272
+ target: "type",
273
+ source: "type",
274
+ unmatched_only: true
275
+ },
276
+ {
277
+ target: "modalities",
278
+ source: "modalities",
279
+ unmatched_only: true
280
+ }
281
+ ],
282
+ placeholders: {
283
+ description: "",
284
+ type: "chat",
285
+ status: "active",
286
+ modalities: {
287
+ input: [],
288
+ output: []
289
+ },
290
+ "capabilities.responses": false,
291
+ "capabilities.apply_patch": false,
292
+ "capabilities.web_search": false
293
+ },
294
+ runtime_search_quality: {
295
+ leaderboard: 50,
296
+ benchmark: 50,
297
+ version: 50,
298
+ freshness: 50,
299
+ lifecycle: 100
300
+ },
301
+ provider_prefixes: [
302
+ "alibaba",
303
+ "anthropic",
304
+ "deepseek",
305
+ "google",
306
+ "meta",
307
+ "moonshot",
308
+ "openai",
309
+ "xai",
310
+ "zhipu"
311
+ ],
312
+ provider_families: [
313
+ "claude",
314
+ "deepseek",
315
+ "gemini",
316
+ "gemma",
317
+ "glm",
318
+ "gpt",
319
+ "grok",
320
+ "gte",
321
+ "bge",
322
+ "kimi",
323
+ "llama",
324
+ "qwen"
325
+ ],
326
+ workspace_identity: {
327
+ header_names: [
328
+ "x-databricks-org-id",
329
+ "x-databricks-workspace-id"
330
+ ],
331
+ host_patterns: [
332
+ "^adb-(\\d+)\\.\\d+\\.azuredatabricks\\.net$",
333
+ "^(\\d+)\\.\\d+\\.gcp\\.databricks\\.com$"
334
+ ],
335
+ query_parameters: [
336
+ "o"
337
+ ]
338
+ }
339
+ };
340
+
1
341
  // src/identity.ts
2
- var providerPrefixes = new Set([
3
- "alibaba",
4
- "anthropic",
5
- "deepseek",
6
- "google",
7
- "meta",
8
- "moonshot",
9
- "openai",
10
- "xai",
11
- "zhipu"
12
- ]);
13
- var providerFamilies = [
14
- "claude",
15
- "deepseek",
16
- "gemini",
17
- "gemma",
18
- "glm",
19
- "gpt",
20
- "grok",
21
- "gte",
22
- "bge",
23
- "kimi",
24
- "llama",
25
- "qwen"
26
- ];
342
+ var providerPrefixes = new Set(WORKSPACE_OVERLAY_RULES.provider_prefixes);
343
+ var providerFamilies = WORKSPACE_OVERLAY_RULES.provider_families;
27
344
  function normalizeModelIdentity(value) {
28
345
  return value.trim().toLowerCase().replace(/^system\.ai[.-]/, "").replace(/^databricks-/, "").replace(/([a-z])(\d)/g, "$1-$2").replace(/(\d)([a-z])/g, "$1-$2").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
29
346
  }
30
- function modelProviderFamily(value) {
31
- const tokens = normalizeModelIdentity(value).split("-");
32
- return providerFamilies.find((family) => tokens.includes(family));
33
- }
34
- function modelVersion(value) {
35
- const match = /(?:^|[^a-z0-9])(\d+)(?:[.\-_](\d+))?(?:[.\-_](\d+))?(?![a-z0-9])/i.exec(value);
36
- return match ? match.slice(1).filter(Boolean).map(Number) : [];
37
- }
38
347
  function modelIdentities(record) {
39
348
  const identities = [record.id, ...record.aliases];
40
349
  return identities.map((value, index) => {
@@ -89,6 +398,38 @@ function searchCatalogMatches(index, models, query, limit = 50) {
89
398
  const results = scored.map(({ identityExact: _identityExact, releaseDate: _releaseDate, version: _version, ...candidate }) => candidate);
90
399
  return limit === null ? results : results.slice(0, limit);
91
400
  }
401
+ var qualityFields = ["leaderboard", "benchmark", "version", "freshness", "lifecycle"];
402
+ var documentDescriptionFields = new Set(["description", "notice"]);
403
+ var documentExactFields = new Set(["id", "name", "alias"]);
404
+ function catalogSearchQuality(scores, weights) {
405
+ let weighted = 0;
406
+ let total = 0;
407
+ for (const name of qualityFields) {
408
+ weighted += scores[name] * weights[name];
409
+ total += weights[name];
410
+ }
411
+ return {
412
+ quality_score: round3(weighted / total),
413
+ scores: Object.fromEntries(qualityFields.map((name) => [name, round3(scores[name])]))
414
+ };
415
+ }
416
+ function catalogSearchDocument(record, quality) {
417
+ const fields = searchFields(record);
418
+ const unique = (values) => [...new Set(values)];
419
+ const recordVersion = version(record.name);
420
+ return {
421
+ id: record.id,
422
+ exact_identities: unique(fields.filter((item) => documentExactFields.has(item.name)).map((item) => item.value)),
423
+ identities: unique(fields.filter((item) => item.identity).map((item) => item.value)),
424
+ keywords: unique(fields.filter((item) => !documentDescriptionFields.has(item.name)).map((item) => item.value)).join(" "),
425
+ description: unique(fields.filter((item) => documentDescriptionFields.has(item.name)).map((item) => item.value)).join(" "),
426
+ tokens: [...new Set(fields.flatMap((item) => tokens(item.value)))].sort(),
427
+ ...record.family == null ? {} : { family: record.family },
428
+ version: recordVersion.length ? recordVersion : version(record.id),
429
+ quality_score: quality.quality_score,
430
+ scores: { ...quality.scores }
431
+ };
432
+ }
92
433
  function scoreRecord(record, document, index, query, queryTokens, requestedVersion, referenceDate) {
93
434
  const fields = searchFields(record);
94
435
  const fieldScores = fields.map((field) => scoreField(field, query, new Set(queryTokens)));
@@ -458,34 +799,22 @@ function compareText2(left, right) {
458
799
  }
459
800
 
460
801
  // src/catalog-index.ts
461
- class ModelCatalogIndex {
462
- catalog;
463
- searchIndex;
464
- records;
802
+ class CatalogIdentityIndex {
465
803
  exact = new Map;
466
804
  normalized = new Map;
467
- constructor(catalog, searchIndex) {
468
- this.catalog = catalog;
469
- this.searchIndex = searchIndex;
470
- if (catalog.schema_version !== searchIndex.catalog_schema_version) {
471
- throw new Error(`Catalog schema v${catalog.schema_version} does not match search index schema v${searchIndex.catalog_schema_version}`);
472
- }
473
- if (catalog.updated_at !== searchIndex.updated_at) {
474
- throw new Error("Catalog and search index timestamps do not match");
475
- }
476
- this.records = Object.entries(catalog.models).map(([id, model]) => ({ ...model, id }));
477
- for (const record of this.records) {
805
+ constructor(records) {
806
+ for (const record of records) {
478
807
  for (const identity of modelIdentities(record)) {
479
808
  this.exact.set(identity.value.toLowerCase(), { identity, record });
480
809
  const key = normalizeModelIdentity(identity.value);
481
810
  const current = this.normalized.get(key);
482
- this.normalized.set(key, current === undefined ? { identity, record } : null);
811
+ if (current === undefined)
812
+ this.normalized.set(key, { identity, record });
813
+ else if (current !== null && current.record.id !== record.id)
814
+ this.normalized.set(key, null);
483
815
  }
484
816
  }
485
817
  }
486
- get(id) {
487
- return this.catalog.models[id] ? { ...this.catalog.models[id], id } : undefined;
488
- }
489
818
  resolve(value) {
490
819
  const exact = this.exact.get(value.trim().toLowerCase());
491
820
  if (exact)
@@ -500,6 +829,34 @@ class ModelCatalogIndex {
500
829
  }
501
830
  return;
502
831
  }
832
+ }
833
+
834
+ class ModelCatalogIndex {
835
+ catalog;
836
+ searchIndex;
837
+ records;
838
+ identities;
839
+ constructor(catalog, searchIndex) {
840
+ this.catalog = catalog;
841
+ this.searchIndex = searchIndex;
842
+ if (catalog.schema_version !== searchIndex.catalog_schema_version) {
843
+ throw new Error(`Catalog schema v${catalog.schema_version} does not match search index schema v${searchIndex.catalog_schema_version}`);
844
+ }
845
+ if (catalog.updated_at !== searchIndex.updated_at) {
846
+ throw new Error("Catalog and search index timestamps do not match");
847
+ }
848
+ this.records = catalogRecords(catalog);
849
+ this.identities = new CatalogIdentityIndex(this.records);
850
+ }
851
+ get(id) {
852
+ return this.catalog.models[id] ? { ...this.catalog.models[id], id } : undefined;
853
+ }
854
+ resolve(value) {
855
+ return this.identities.resolve(value);
856
+ }
857
+ matchAny(values) {
858
+ return this.identities.matchAny(values);
859
+ }
503
860
  list(filters = {}) {
504
861
  return filterCatalogRecords(this.records, this.searchIndex, filters);
505
862
  }
@@ -507,46 +864,663 @@ class ModelCatalogIndex {
507
864
  return searchCatalogMatches(this.searchIndex, this.records, query, limit);
508
865
  }
509
866
  }
510
- function createModelCatalogIndex(catalog, searchIndex) {
511
- return new ModelCatalogIndex(catalog, searchIndex);
867
+ function catalogRecords(catalog) {
868
+ return Object.entries(catalog.models).map(([id, model]) => ({ ...model, id }));
869
+ }
870
+
871
+ // src/serving-endpoints.ts
872
+ var RULES = WORKSPACE_OVERLAY_RULES;
873
+ var MODEL_SERVICE_KINDS = new Set(["served_entity", "foundation_model"]);
874
+ function normalizeServingEndpoints(response) {
875
+ const endpoints = new Map;
876
+ for (const endpoint of parseServingEndpointsResponse(response).endpoints ?? []) {
877
+ const name = text(endpoint.name);
878
+ if (name && !endpoints.has(name))
879
+ endpoints.set(name, normalizeEndpoint(endpoint));
880
+ }
881
+ return [...endpoints.keys()].sort(compareCodePoints).map((name) => endpoints.get(name));
882
+ }
883
+ function normalizeFamily(value) {
884
+ return value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || undefined;
512
885
  }
513
- function enrichLiveModels(index, models, identities) {
514
- return models.map((live) => {
515
- const published = index.matchAny(identities(live));
516
- return published ? { live, published } : { live };
886
+ function normalizeEndpoint(endpoint) {
887
+ const entities = endpoint.config?.served_entities ?? [];
888
+ const task = text(endpoint.task);
889
+ const taskType = task === undefined ? undefined : RULES.task_types[task];
890
+ const family = firstText(endpoint, RULES.family_fields);
891
+ const capabilities = {};
892
+ for (const [name, path] of Object.entries(RULES.capability_fields)) {
893
+ const value = values(endpoint, path).find((item) => typeof item === "boolean");
894
+ if (value !== undefined)
895
+ capabilities[name] = value;
896
+ }
897
+ return compact({
898
+ name: text(endpoint.name) ?? "",
899
+ display_name: firstText(endpoint, RULES.display_name_fields) ?? tagDisplayName(endpoint),
900
+ description: firstText(endpoint, RULES.description_fields),
901
+ task,
902
+ type: taskType?.type,
903
+ modalities: taskType ? structuredClone(taskType.modalities) : undefined,
904
+ state: text(endpoint.state?.ready),
905
+ source: entities.some((entity) => entity.foundation_model != null) ? "foundation" : entities.some((entity) => entity.external_model != null) ? "external" : "custom",
906
+ family: family === undefined ? undefined : normalizeFamily(family),
907
+ capabilities,
908
+ profile: profile(endpoint),
909
+ identities: identityCandidates(endpoint)
517
910
  });
518
911
  }
912
+ function identityCandidates(endpoint) {
913
+ const seen = new Set;
914
+ const candidates = [];
915
+ for (const rule of RULES.identity_fields) {
916
+ const join = "join" in rule ? rule.join : undefined;
917
+ for (const node of values(endpoint, rule.path)) {
918
+ let value;
919
+ if (join) {
920
+ const parts = isObject(node) ? join.map((key) => text(node[key])) : [undefined];
921
+ value = parts.every(Boolean) ? parts.join("/") : undefined;
922
+ } else {
923
+ value = text(node);
924
+ }
925
+ if (!value || seen.has(value))
926
+ continue;
927
+ seen.add(value);
928
+ const service = MODEL_SERVICE_KINDS.has(rule.kind) && RULES.model_service_prefixes.some((prefix) => value.startsWith(prefix));
929
+ candidates.push({ kind: service ? "model_service" : rule.kind, value });
930
+ }
931
+ }
932
+ return candidates;
933
+ }
934
+ function profile(endpoint) {
935
+ for (const path of RULES.profile_fields) {
936
+ for (const node of values(endpoint, path)) {
937
+ if (!isObject(node))
938
+ continue;
939
+ const scores = {};
940
+ for (const key of RULES.profile_keys) {
941
+ const value = node[key];
942
+ if (typeof value === "number" && Number.isFinite(value))
943
+ scores[key] = value;
944
+ }
945
+ if (Object.keys(scores).length)
946
+ return scores;
947
+ }
948
+ }
949
+ return;
950
+ }
951
+ function tagDisplayName(endpoint) {
952
+ const keys = RULES.display_name_tag_keys;
953
+ for (const tag of endpoint.tags ?? []) {
954
+ const value = keys.includes(tag.key) ? text(tag.value) : undefined;
955
+ if (value)
956
+ return value;
957
+ }
958
+ return;
959
+ }
960
+ function firstText(node, paths) {
961
+ for (const path of paths) {
962
+ for (const value of values(node, path)) {
963
+ const result = text(value);
964
+ if (result)
965
+ return result;
966
+ }
967
+ }
968
+ return;
969
+ }
970
+ function values(node, path) {
971
+ if (!path.length)
972
+ return [node];
973
+ const [head, ...rest] = path;
974
+ if (head === "*")
975
+ return Array.isArray(node) ? node.flatMap((item) => values(item, rest)) : [];
976
+ return isObject(node) && head in node ? values(node[head], rest) : [];
977
+ }
978
+ function text(value) {
979
+ return typeof value === "string" ? value.trim() || undefined : undefined;
980
+ }
981
+ function isObject(value) {
982
+ return typeof value === "object" && value !== null && !Array.isArray(value);
983
+ }
984
+ function compact(value) {
985
+ return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== undefined));
986
+ }
987
+ function compareCodePoints(left, right) {
988
+ return left < right ? -1 : left > right ? 1 : 0;
989
+ }
990
+
991
+ // src/effective.ts
992
+ var EFFECTIVE_CATALOG_CONTRACT_VERSION = WORKSPACE_OVERLAY_RULES.contract_version;
993
+ var RULES2 = WORKSPACE_OVERLAY_RULES;
994
+ function buildEffectiveCatalog(publicCatalog, endpoints = [], workspace = { status: "disabled" }) {
995
+ const index = new CatalogIdentityIndex(catalogRecords(publicCatalog));
996
+ const unique = new Map;
997
+ for (const endpoint of endpoints)
998
+ if (!unique.has(endpoint.name))
999
+ unique.set(endpoint.name, endpoint);
1000
+ const claimed = new Set([
1001
+ ...Object.entries(publicCatalog.models).flatMap(([id, model]) => [id, ...model.aliases]),
1002
+ ...unique.keys()
1003
+ ].map((value) => value.toLowerCase()));
1004
+ const overlays = {};
1005
+ const endpointModels = new Map;
1006
+ for (const name of [...unique.keys()].sort(compareCodePoints)) {
1007
+ const endpoint = unique.get(name);
1008
+ const match = matchEndpoint(endpoint, index);
1009
+ if (!match && endpoint.type == null) {
1010
+ overlays[name] = { ...structuredClone(endpoint), fields: {} };
1011
+ continue;
1012
+ }
1013
+ const matched = match ? publicCatalog.models[match.id] : undefined;
1014
+ const { data, fields } = overlay(endpoint, matched);
1015
+ const extra = [];
1016
+ for (const candidate of endpoint.identities) {
1017
+ const key = candidate.value.toLowerCase();
1018
+ if (candidate.value !== name && !claimed.has(key) && !index.resolve(candidate.value)) {
1019
+ claimed.add(key);
1020
+ extra.push(candidate.value);
1021
+ }
1022
+ }
1023
+ data.aliases = [...match?.id === name ? data.aliases : [], ...extra];
1024
+ endpointModels.set(name, CatalogModelSchema2.parse(data));
1025
+ overlays[name] = { ...structuredClone(endpoint), ...match ? { match } : {}, fields };
1026
+ }
1027
+ if (!endpointModels.size) {
1028
+ return { contract_version: EFFECTIVE_CATALOG_CONTRACT_VERSION, catalog: publicCatalog, workspace: refreshState(workspace), endpoints: overlays };
1029
+ }
1030
+ const models = {};
1031
+ for (const [id, model] of Object.entries(publicCatalog.models))
1032
+ models[id] = endpointModels.get(id) ?? model;
1033
+ for (const name of [...endpointModels.keys()].sort(compareCodePoints))
1034
+ models[name] ??= endpointModels.get(name);
1035
+ return {
1036
+ contract_version: EFFECTIVE_CATALOG_CONTRACT_VERSION,
1037
+ catalog: { schema_version: publicCatalog.schema_version, updated_at: publicCatalog.updated_at, models },
1038
+ workspace: refreshState(workspace),
1039
+ endpoints: overlays
1040
+ };
1041
+ }
1042
+ function isEffectiveModelAccessible(effective, id) {
1043
+ return Object.hasOwn(effective.endpoints, id);
1044
+ }
1045
+ function buildEffectiveSearchIndex(effective, publicIndex) {
1046
+ const publicDocuments = new Map(publicIndex.documents.map((document) => [document.id, document]));
1047
+ const runtime = catalogSearchQuality(RULES2.runtime_search_quality, publicIndex.weights);
1048
+ const documents = catalogRecords(effective.catalog).map((record) => {
1049
+ const endpoint = effective.endpoints[record.id];
1050
+ const own = endpoint ? undefined : publicDocuments.get(record.id);
1051
+ if (own)
1052
+ return own;
1053
+ const source = endpoint?.match ? publicDocuments.get(endpoint.match.id) : undefined;
1054
+ const quality = source ?? runtime;
1055
+ return catalogSearchDocument(record, quality);
1056
+ });
1057
+ return {
1058
+ schema_version: publicIndex.schema_version,
1059
+ catalog_schema_version: effective.catalog.schema_version,
1060
+ updated_at: effective.catalog.updated_at,
1061
+ weights: publicIndex.weights,
1062
+ documents
1063
+ };
1064
+ }
1065
+ function refreshState(workspace) {
1066
+ return { persistent: false, ...workspace };
1067
+ }
1068
+ function matchEndpoint(endpoint, index) {
1069
+ for (const candidate of endpoint.identities) {
1070
+ const resolved = index.resolve(candidate.value);
1071
+ if (resolved)
1072
+ return { id: resolved.record.id, kind: candidate.kind, value: candidate.value };
1073
+ }
1074
+ return;
1075
+ }
1076
+ function overlay(endpoint, matched) {
1077
+ const fields = {};
1078
+ let data;
1079
+ if (matched) {
1080
+ data = structuredClone(matched);
1081
+ } else {
1082
+ data = {
1083
+ name: endpoint.name,
1084
+ aliases: [],
1085
+ capabilities: {},
1086
+ tasks: [],
1087
+ use_cases: [],
1088
+ availability: {},
1089
+ price: {},
1090
+ average_price: {},
1091
+ sources: {},
1092
+ notices: [],
1093
+ rankings: [],
1094
+ benchmarks: []
1095
+ };
1096
+ fields.name = "workspace";
1097
+ for (const [target, value] of Object.entries(RULES2.placeholders)) {
1098
+ setPath(data, target, structuredClone(value));
1099
+ fields[target] = "placeholder";
1100
+ }
1101
+ }
1102
+ const sources = data.sources;
1103
+ for (const rule of RULES2.overlay_fields) {
1104
+ if ("unmatched_only" in rule && rule.unmatched_only && matched)
1105
+ continue;
1106
+ const value = getPath(endpoint, rule.source);
1107
+ if (value != null) {
1108
+ setPath(data, rule.target, structuredClone(value));
1109
+ delete sources[rule.target];
1110
+ fields[rule.target] = "workspace";
1111
+ } else if (matched && getPath(data, rule.target) != null) {
1112
+ fields[rule.target] = "public";
1113
+ }
1114
+ }
1115
+ return {
1116
+ data,
1117
+ fields: Object.fromEntries(Object.entries(fields).sort(([left], [right]) => compareCodePoints(left, right)))
1118
+ };
1119
+ }
1120
+ function getPath(data, path) {
1121
+ let node = data;
1122
+ for (const part of path.split(".")) {
1123
+ if (typeof node !== "object" || node === null || Array.isArray(node))
1124
+ return;
1125
+ node = node[part];
1126
+ }
1127
+ return node;
1128
+ }
1129
+ function setPath(data, path, value) {
1130
+ const parts = path.split(".");
1131
+ const leaf = parts.pop();
1132
+ let node = data;
1133
+ for (const part of parts)
1134
+ node = node[part] ??= {};
1135
+ node[leaf] = value;
1136
+ }
1137
+
1138
+ // src/workspace-cache.ts
1139
+ var DEFAULT_WORKSPACE_REFRESH_AFTER_MS = WORKSPACE_OVERLAY_RULES.cache.refresh_interval_seconds * 1000;
1140
+ var DEFAULT_WORKSPACE_STALE_ON_ERROR_MS = WORKSPACE_OVERLAY_RULES.cache.stale_ttl_seconds * 1000;
1141
+ var sharedMemoryStore = createMemoryWorkspaceCacheStore();
1142
+ var storeStates = new WeakMap;
1143
+ async function workspaceCacheKey(input) {
1144
+ const principal = input.workspace ? input.principal?.trim() : undefined;
1145
+ const scope = principal ? await sha256(principal) : "session";
1146
+ const workspace = input.workspace ? `${input.workspace.kind}:${encodeURIComponent(input.workspace.value)}` : "unknown";
1147
+ return {
1148
+ id: `workspace-catalog/v${input.contractVersion}/${workspace}/${scope}`,
1149
+ shared: Boolean(principal)
1150
+ };
1151
+ }
1152
+ function createMemoryWorkspaceCacheStore(now = Date.now) {
1153
+ const entries = new Map;
1154
+ return {
1155
+ async get(key) {
1156
+ const entry = entries.get(key);
1157
+ if (entry?.expires !== undefined && entry.expires <= now())
1158
+ entries.delete(key);
1159
+ return entries.get(key)?.value;
1160
+ },
1161
+ async set(key, value, ttl) {
1162
+ entries.set(key, ttl ? { value, expires: now() + ttl } : { value });
1163
+ return true;
1164
+ },
1165
+ async delete(key) {
1166
+ return entries.delete(key);
1167
+ },
1168
+ async clear() {
1169
+ entries.clear();
1170
+ }
1171
+ };
1172
+ }
1173
+ function createWorkspaceCatalogCache(options = {}) {
1174
+ const now = options.now ?? Date.now;
1175
+ const refreshAfterMs = options.refreshAfterMs ?? DEFAULT_WORKSPACE_REFRESH_AFTER_MS;
1176
+ const staleOnErrorMs = options.staleOnErrorMs ?? DEFAULT_WORKSPACE_STALE_ON_ERROR_MS;
1177
+ const shared = options.store ?? sharedMemoryStore;
1178
+ const session = createMemoryWorkspaceCacheStore(now);
1179
+ const background = new Set;
1180
+ const storeFor = (key) => key.shared ? shared : session;
1181
+ const read = async (key) => {
1182
+ const entry = await storeFor(key).get(key.id);
1183
+ if (!entry || typeof entry.writtenAt !== "number")
1184
+ return;
1185
+ return now() - entry.writtenAt < staleOnErrorMs ? entry : undefined;
1186
+ };
1187
+ const load = (key, loader) => {
1188
+ const store = storeFor(key);
1189
+ const state = stateFor(store);
1190
+ const existing = state.inflight.get(key.id);
1191
+ if (existing)
1192
+ return existing;
1193
+ const pending = (async () => {
1194
+ try {
1195
+ const entry = { value: await loader(), writtenAt: now() };
1196
+ await store.set(key.id, entry, staleOnErrorMs);
1197
+ state.failures.delete(key.id);
1198
+ return entry;
1199
+ } catch (error) {
1200
+ state.failures.set(key.id, { error, at: now() });
1201
+ throw error;
1202
+ } finally {
1203
+ state.inflight.delete(key.id);
1204
+ }
1205
+ })();
1206
+ state.inflight.set(key.id, pending);
1207
+ return pending;
1208
+ };
1209
+ const result = (key, entry, status, error) => ({
1210
+ value: entry.value,
1211
+ status,
1212
+ writtenAt: entry.writtenAt,
1213
+ ageMs: Math.max(0, now() - entry.writtenAt),
1214
+ shared: key.shared,
1215
+ ...status === "stale" ? { error } : {}
1216
+ });
1217
+ return {
1218
+ async get(key, loader) {
1219
+ const entry = await read(key);
1220
+ if (!entry)
1221
+ return result(key, await load(key, loader), "fresh");
1222
+ if (now() - entry.writtenAt < refreshAfterMs)
1223
+ return result(key, entry, "fresh");
1224
+ const failure = stateFor(storeFor(key)).failures.get(key.id);
1225
+ const failed = failure !== undefined && failure.at >= entry.writtenAt;
1226
+ if (!failed || now() - failure.at >= refreshAfterMs) {
1227
+ const refresh = load(key, loader).catch(() => {
1228
+ return;
1229
+ });
1230
+ background.add(refresh);
1231
+ refresh.finally(() => background.delete(refresh));
1232
+ }
1233
+ return failed ? result(key, entry, "stale", failure.error) : result(key, entry, "refreshing");
1234
+ },
1235
+ async refresh(key, loader) {
1236
+ try {
1237
+ return result(key, await load(key, loader), "fresh");
1238
+ } catch (error) {
1239
+ const entry = await read(key);
1240
+ if (!entry)
1241
+ throw error;
1242
+ return result(key, entry, "stale", error);
1243
+ }
1244
+ },
1245
+ async evict(key) {
1246
+ const store = storeFor(key);
1247
+ stateFor(store).failures.delete(key.id);
1248
+ return store.delete(key.id);
1249
+ },
1250
+ async clear() {
1251
+ stateFor(shared).failures.clear();
1252
+ stateFor(session).failures.clear();
1253
+ await Promise.all([shared.clear(), session.clear()]);
1254
+ },
1255
+ async settle() {
1256
+ while (background.size > 0)
1257
+ await Promise.all([...background]);
1258
+ }
1259
+ };
1260
+ }
1261
+ function stateFor(store) {
1262
+ let state = storeStates.get(store);
1263
+ if (!state) {
1264
+ state = { inflight: new Map, failures: new Map };
1265
+ storeStates.set(store, state);
1266
+ }
1267
+ return state;
1268
+ }
1269
+ async function sha256(value) {
1270
+ const digest = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(value));
1271
+ return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
1272
+ }
1273
+
1274
+ // src/workspace-identity.ts
1275
+ var RULES3 = WORKSPACE_OVERLAY_RULES.workspace_identity;
1276
+ var HOST_PATTERNS = RULES3.host_patterns.map((pattern) => new RegExp(pattern));
1277
+ var SCHEME = /^[a-z][a-z\d+.-]*:\/\//i;
1278
+
1279
+ class WorkspaceConnectionError extends TypeError {
1280
+ name = "WorkspaceConnectionError";
1281
+ }
1282
+ function parseWorkspaceUrl(host) {
1283
+ const trimmed = typeof host === "string" ? host.trim() : "";
1284
+ if (!trimmed)
1285
+ throw new WorkspaceConnectionError("Workspace host is required");
1286
+ try {
1287
+ return new URL(SCHEME.test(trimmed) ? trimmed : `https://${trimmed}`);
1288
+ } catch {
1289
+ throw new WorkspaceConnectionError(`Workspace host is not a valid host or URL: ${trimmed}`);
1290
+ }
1291
+ }
1292
+ function normalizeWorkspaceHost(host) {
1293
+ const url = parseWorkspaceUrl(host);
1294
+ return `${url.hostname.toLowerCase()}${url.port ? `:${url.port}` : ""}${url.pathname.replace(/\/+$/, "")}`;
1295
+ }
1296
+ function formatWorkspaceIdentity(identity) {
1297
+ return `${identity.kind === "workspace_id" ? "id" : "host"}:${identity.value}`;
1298
+ }
1299
+ function resolveWorkspaceIdentity(host, headers) {
1300
+ const url = parseWorkspaceUrl(host);
1301
+ const resolvedHeaders = new Headers(headers);
1302
+ for (const name of RULES3.header_names) {
1303
+ const value = resolvedHeaders.get(name)?.trim();
1304
+ if (value)
1305
+ return { kind: "workspace_id", value };
1306
+ }
1307
+ const hostname = url.hostname.toLowerCase();
1308
+ for (const pattern of HOST_PATTERNS) {
1309
+ const value = pattern.exec(hostname)?.[1];
1310
+ if (value)
1311
+ return { kind: "workspace_id", value };
1312
+ }
1313
+ for (const name of RULES3.query_parameters) {
1314
+ const value = url.searchParams.get(name)?.trim();
1315
+ if (value)
1316
+ return { kind: "workspace_id", value };
1317
+ }
1318
+ return { kind: "host", value: normalizeWorkspaceHost(host) };
1319
+ }
1320
+ function principalIdentity(user) {
1321
+ if (!user || typeof user !== "object")
1322
+ return;
1323
+ for (const field of ["id", "userName"]) {
1324
+ const value = user[field];
1325
+ if (typeof value === "string" && value.trim())
1326
+ return value.trim();
1327
+ }
1328
+ return;
1329
+ }
1330
+
1331
+ // src/workspace-overlay.ts
1332
+ class WorkspaceOverlaySession {
1333
+ modelServing;
1334
+ cache;
1335
+ now;
1336
+ persistent;
1337
+ refreshAfterMs;
1338
+ staleOnErrorMs;
1339
+ attemptedAt;
1340
+ entry;
1341
+ inflight;
1342
+ key;
1343
+ state;
1344
+ workspace;
1345
+ constructor(modelServing, options = {}) {
1346
+ this.modelServing = modelServing;
1347
+ this.now = options.now ?? Date.now;
1348
+ this.refreshAfterMs = options.refreshAfterMs ?? DEFAULT_WORKSPACE_REFRESH_AFTER_MS;
1349
+ this.staleOnErrorMs = options.staleOnErrorMs ?? DEFAULT_WORKSPACE_STALE_ON_ERROR_MS;
1350
+ this.persistent = options.persistent ?? false;
1351
+ this.cache = options.cache ?? createWorkspaceCatalogCache({
1352
+ refreshAfterMs: this.refreshAfterMs,
1353
+ staleOnErrorMs: this.staleOnErrorMs,
1354
+ now: this.now,
1355
+ ...options.store === undefined ? {} : { store: options.store }
1356
+ });
1357
+ }
1358
+ load(options = {}) {
1359
+ if (this.inflight)
1360
+ return this.inflight;
1361
+ const now = this.now();
1362
+ if (!options.force && this.state && this.attemptedAt !== undefined && now - this.attemptedAt < this.refreshAfterMs) {
1363
+ return Promise.resolve(this.state);
1364
+ }
1365
+ const attempt = this.attempt(Boolean(options.force), now).catch((error) => this.failed(error, now, this.workspace));
1366
+ this.inflight = attempt.finally(() => {
1367
+ this.inflight = undefined;
1368
+ });
1369
+ return this.inflight;
1370
+ }
1371
+ async evict(options = {}) {
1372
+ await this.inflight;
1373
+ if (options.all)
1374
+ await this.cache.clear();
1375
+ else if (this.key)
1376
+ await this.cache.evict(this.key);
1377
+ this.attemptedAt = this.entry = this.key = this.state = undefined;
1378
+ }
1379
+ async settle() {
1380
+ await this.inflight;
1381
+ await this.cache.settle();
1382
+ }
1383
+ async attempt(force, now) {
1384
+ this.attemptedAt = now;
1385
+ let snapshot;
1386
+ try {
1387
+ snapshot = await this.modelServing.snapshot();
1388
+ } catch (error) {
1389
+ return this.failed(error, now, this.workspace);
1390
+ }
1391
+ const scoped = snapshot;
1392
+ const workspace = scoped.workspace && formatWorkspaceIdentity(scoped.workspace);
1393
+ const principal = await Promise.resolve().then(() => scoped.principal()).catch(() => {
1394
+ return;
1395
+ });
1396
+ const key = await workspaceCacheKey({
1397
+ workspace: scoped.workspace,
1398
+ contractVersion: EFFECTIVE_CATALOG_CONTRACT_VERSION,
1399
+ principal
1400
+ });
1401
+ if (workspace !== this.workspace || key.id !== this.key?.id)
1402
+ this.entry = undefined;
1403
+ this.workspace = workspace;
1404
+ this.key = key;
1405
+ const loader = async () => ({
1406
+ endpoints: normalizeServingEndpoints(await scoped.listServingEndpoints())
1407
+ });
1408
+ try {
1409
+ let result = force ? await this.cache.refresh(key, loader) : await this.cache.get(key, loader);
1410
+ if (result.status !== "fresh")
1411
+ result = await this.cache.refresh(key, loader);
1412
+ return this.succeeded(result, now);
1413
+ } catch (error) {
1414
+ return this.failed(error, now, workspace);
1415
+ }
1416
+ }
1417
+ succeeded(result, now) {
1418
+ this.entry = { endpoints: result.value.endpoints, writtenAt: result.writtenAt };
1419
+ const stale = result.status === "stale";
1420
+ return this.serve(this.entry, now, {
1421
+ status: stale ? "stale" : "current",
1422
+ persistent: this.persistent && result.shared,
1423
+ ...stale ? { error: describeError(result.error) } : {}
1424
+ });
1425
+ }
1426
+ failed(error, now, workspace) {
1427
+ const fallback = this.entry && now - this.entry.writtenAt <= this.staleOnErrorMs ? this.entry : undefined;
1428
+ this.entry = fallback;
1429
+ this.workspace = workspace;
1430
+ return this.serve(fallback, now, {
1431
+ status: fallback ? "stale" : "unavailable",
1432
+ persistent: Boolean(fallback) && this.persistent && Boolean(this.key?.shared),
1433
+ error: describeError(error)
1434
+ });
1435
+ }
1436
+ serve(entry, now, refresh) {
1437
+ this.state = {
1438
+ ...entry && refresh.status !== "unavailable" ? { endpoints: entry.endpoints } : {},
1439
+ refresh: {
1440
+ status: refresh.status,
1441
+ ...this.workspace === undefined ? {} : { workspace: this.workspace },
1442
+ persistent: refresh.persistent ?? false,
1443
+ ...entry ? { refreshed_at: new Date(entry.writtenAt).toISOString() } : {},
1444
+ attempted_at: new Date(now).toISOString(),
1445
+ ...entry ? { age_seconds: Math.max(0, (now - entry.writtenAt) / 1000) } : {},
1446
+ ...refresh.error ? { error: refresh.error } : {}
1447
+ }
1448
+ };
1449
+ return this.state;
1450
+ }
1451
+ }
1452
+ function describeError(error) {
1453
+ return error instanceof Error ? `${error.name}: ${error.message}` : String(error);
1454
+ }
519
1455
 
520
1456
  // src/local-client.ts
521
- function createModelCatalogClient(catalog, searchIndex) {
522
- const index = createModelCatalogIndex(catalog, searchIndex);
523
- const records = [...index.records];
1457
+ function workspaceOverlay(connector, cache) {
1458
+ return connector && new WorkspaceOverlaySession(connector, cache);
1459
+ }
1460
+ function createCatalogClient({ catalog, searchIndex, source }, overlay) {
1461
+ const publicView = catalogView(buildEffectiveCatalog(catalog), searchIndex);
1462
+ let view = publicView;
1463
+ let state;
1464
+ const current = async (force = false) => {
1465
+ if (!overlay)
1466
+ return publicView;
1467
+ const next = await overlay.load({ force });
1468
+ if (next !== state) {
1469
+ state = next;
1470
+ view = catalogView(buildEffectiveCatalog(catalog, next.endpoints ?? [], next.refresh), searchIndex);
1471
+ }
1472
+ return view;
1473
+ };
1474
+ const close = async () => {
1475
+ await overlay?.settle();
1476
+ };
524
1477
  return {
1478
+ source,
525
1479
  async catalog() {
526
- return catalog;
1480
+ return (await current()).effective.catalog;
527
1481
  },
528
1482
  async searchIndex() {
529
- return searchIndex;
1483
+ return (await current()).index.searchIndex;
530
1484
  },
531
1485
  async list(filters = {}) {
532
- return filterCatalogRecords(records, searchIndex, filters);
1486
+ return (await current()).index.list(filters);
533
1487
  },
534
1488
  async get(identity) {
535
- return index.resolve(identity)?.record;
1489
+ return (await current()).index.resolve(identity)?.record;
536
1490
  },
537
1491
  async resolve(identity) {
538
- return index.resolve(identity);
1492
+ return (await current()).index.resolve(identity);
539
1493
  },
540
1494
  async search(query, limit = 50) {
541
- return index.search(query, limit);
1495
+ return (await current()).index.search(query, limit);
542
1496
  },
543
1497
  async* stream(filters = {}) {
544
- for (const record of filterCatalogRecords(records, searchIndex, filters))
1498
+ for (const record of (await current()).index.list(filters))
545
1499
  yield record;
546
1500
  },
547
- close() {}
1501
+ async effectiveCatalog() {
1502
+ return (await current()).effective;
1503
+ },
1504
+ async workspaceStatus() {
1505
+ return (await current()).effective.workspace;
1506
+ },
1507
+ async isAccessible(id) {
1508
+ return isEffectiveModelAccessible((await current()).effective, id);
1509
+ },
1510
+ async refreshWorkspace() {
1511
+ return (await current(true)).effective.workspace;
1512
+ },
1513
+ async evictWorkspace(evict = {}) {
1514
+ await overlay?.evict(evict);
1515
+ },
1516
+ close,
1517
+ [Symbol.asyncDispose]: close
548
1518
  };
549
1519
  }
1520
+ function catalogView(effective, publicIndex) {
1521
+ const searchIndex = Object.keys(effective.endpoints).length ? buildEffectiveSearchIndex(effective, publicIndex) : publicIndex;
1522
+ return { effective, index: new ModelCatalogIndex(effective.catalog, searchIndex) };
1523
+ }
550
1524
 
551
1525
  // src/_generated/published.ts
552
1526
  var PUBLISHED_CATALOG_SCHEMA_VERSION = 16;
@@ -557,81 +1531,159 @@ var PUBLISHED_CATALOG_URL = `${PUBLISHED_CATALOG_SCHEMA_URL}/catalog.json`;
557
1531
  var PUBLISHED_CATALOG_SEARCH_INDEX_URL = `${PUBLISHED_CATALOG_SCHEMA_URL}/search-index.json`;
558
1532
  var PUBLISHED_CATALOG_DATABASE_URL = `${PUBLISHED_CATALOG_SCHEMA_URL}/catalog.sqlite`;
559
1533
 
560
- // src/validation.ts
561
- import { z } from "zod";
1534
+ // src/sources.ts
1535
+ function isWebSocketUrl(value) {
1536
+ return /^wss?:/i.test(value);
1537
+ }
1538
+ async function loadBrowserSource(source, options) {
1539
+ if (source === undefined)
1540
+ return loadPublished(options);
1541
+ if (typeof source === "string" || source instanceof URL) {
1542
+ const location = source.toString();
1543
+ if (isWebSocketUrl(location))
1544
+ return loadWebSocket(location);
1545
+ return loadUrl(new URL(location, documentUrl()).toString(), options);
1546
+ }
1547
+ return loadMemory(source, options);
1548
+ }
1549
+ function documentUrl() {
1550
+ return globalThis.location?.href;
1551
+ }
1552
+ function loadPublished(options) {
1553
+ return download(PUBLISHED_CATALOG_URL, options.searchIndex ?? PUBLISHED_CATALOG_SEARCH_INDEX_URL, options, "published");
1554
+ }
1555
+ function loadUrl(url, options) {
1556
+ return download(url, options.searchIndex ?? new URL("search-index.json", url).toString(), options, "url");
1557
+ }
1558
+ function loadMemory(catalog, options) {
1559
+ if (options.searchIndex === undefined || typeof options.searchIndex === "string") {
1560
+ throw new TypeError("An in-memory catalog needs its search index payload as options.searchIndex");
1561
+ }
1562
+ return { catalog, searchIndex: options.searchIndex, source: { kind: "memory" } };
1563
+ }
1564
+ async function loadWebSocket(url) {
1565
+ let transport;
1566
+ try {
1567
+ transport = await (__preload("engbh7tj"), import("./chunk-engbh7tj.js"));
1568
+ } catch (cause) {
1569
+ throw new Error("WebSocket catalog sources need the optional peers pynect and @chanx-js/client; install them with `bun add pynect @chanx-js/client`", { cause });
1570
+ }
1571
+ return { ...await transport.downloadWebSocketCatalog(url), source: { kind: "websocket", location: url } };
1572
+ }
1573
+ async function download(catalogUrl, searchIndex, options, kind) {
1574
+ const fetcher = options.fetch ?? globalThis.fetch;
1575
+ const [catalog, index] = await Promise.all([
1576
+ fetchJson(fetcher, catalogUrl, "Catalog").then(parseModelCatalog2),
1577
+ typeof searchIndex === "string" ? fetchJson(fetcher, searchIndex, "Search index").then(parseCatalogSearchIndex2) : searchIndex
1578
+ ]);
1579
+ return { catalog, searchIndex: index, source: { kind, location: catalogUrl } };
1580
+ }
1581
+ async function fetchJson(fetcher, url, label) {
1582
+ const response = await fetcher(url);
1583
+ if (!response.ok)
1584
+ throw new Error(`${label} request failed with ${response.status}`);
1585
+ return response.json();
1586
+ }
562
1587
 
563
- // src/_generated/json-schema.ts
564
- var MODEL_CATALOG_JSON_SCHEMA = { additionalProperties: false, description: "Published Databricks model catalog with identity, capabilities, availability, pricing, lifecycle, rankings, and benchmarks.", properties: { schema_version: { const: 16, title: "Schema Version", type: "integer" }, updated_at: { format: "date-time", title: "Updated At", type: "string" }, models: { additionalProperties: { $ref: "#/$defs/CatalogModel" }, propertyNames: { minLength: 1 }, title: "Models", type: "object" } }, required: ["schema_version", "updated_at", "models"], title: "ModelCatalog", type: "object", $defs: { Availability: { additionalProperties: false, description: "Model availability on one Databricks cloud provider.", properties: { status: { $ref: "#/$defs/Status1" }, serving_modes: { items: { $ref: "#/$defs/ServingMode" }, title: "Serving Modes", type: "array" }, details: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Details" } }, required: ["status", "serving_modes"], title: "Availability", type: "object" }, AveragePrice: { additionalProperties: false, description: "Normalized Databricks price in one currency.", properties: { unit: { $ref: "#/$defs/Unit" }, rates: { additionalProperties: { minimum: 0, type: "number" }, propertyNames: { minLength: 1 }, title: "Rates", type: "object" } }, required: ["unit", "rates"], title: "AveragePrice", type: "object" }, Benchmark: { additionalProperties: false, description: "Task-suite benchmark result.", properties: { name: { title: "Name", type: "string" }, rank: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Rank", type: "integer" }, score: { title: "Score", type: "number" }, task_count: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Task Count", type: "integer" }, published_at: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Published At" }, variant: { anyOf: [{ $ref: "#/$defs/Variant2" }, { type: "null" }], default: null }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" } }, required: ["name", "rank", "score", "task_count", "sources"], title: "Benchmark", type: "object" }, Budget: { additionalProperties: false, description: "Supported reasoning-token budget range.", properties: { min: { anyOf: [{ maximum: 9007199254740991, minimum: -9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Min" }, max: { anyOf: [{ maximum: 9007199254740991, minimum: -9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Max" } }, title: "Budget", type: "object" }, Capabilities: { additionalProperties: false, description: "Capabilities used to select the model for a workload.", properties: { attachments: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Attachments" }, tools: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Tools" }, structured_output: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Structured Output" }, temperature: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Temperature" }, interleaved_reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Interleaved Reasoning" }, responses: { title: "Responses", type: "boolean" }, apply_patch: { title: "Apply Patch", type: "boolean" }, web_search: { title: "Web Search", type: "boolean" }, reasoning: { anyOf: [{ $ref: "#/$defs/Reasoning" }, { $ref: "#/$defs/Reasoning1" }, { type: "null" }], default: null, title: "Reasoning" } }, required: ["responses", "apply_patch", "web_search"], title: "Capabilities", type: "object" }, CatalogFilters: { additionalProperties: false, properties: { query: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Query" }, status: { items: { $ref: "#/$defs/Status" }, title: "Status", type: "array" }, type: { items: { $ref: "#/$defs/Type" }, title: "Type", type: "array" }, publisher: { items: { type: "string" }, title: "Publisher", type: "array" }, task: { items: { type: "string" }, title: "Task", type: "array" }, capability: { items: { enum: ["apply-patch", "attachments", "reasoning", "responses", "structured-output", "tools", "web-search"], type: "string" }, title: "Capability", type: "array" }, limit: { anyOf: [{ maximum: 1000, minimum: 0, type: "integer" }, { type: "null" }], default: 50, title: "Limit" } }, title: "CatalogFilters", type: "object" }, CatalogModel: { additionalProperties: false, description: "Published statistics for one Databricks model.", properties: { name: { title: "Name", type: "string" }, description: { title: "Description", type: "string" }, aliases: { items: { type: "string" }, title: "Aliases", type: "array" }, type: { $ref: "#/$defs/Type" }, family: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Family" }, publisher: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Publisher" }, license: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "License" }, open_weights: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Open Weights" }, status: { $ref: "#/$defs/Status" }, release_date: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Release Date" }, last_updated: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Last Updated" }, knowledge_cutoff: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Knowledge Cutoff" }, retirement: { anyOf: [{ $ref: "#/$defs/Retirement" }, { type: "null" }], default: null }, modalities: { $ref: "#/$defs/Modalities" }, capabilities: { $ref: "#/$defs/Capabilities" }, limits: { anyOf: [{ $ref: "#/$defs/Limits" }, { type: "null" }], default: null }, rate_limits: { anyOf: [{ $ref: "#/$defs/RateLimits" }, { type: "null" }], default: null }, latency: { anyOf: [{ $ref: "#/$defs/Latency" }, { type: "null" }], default: null }, tasks: { items: { type: "string" }, title: "Tasks", type: "array" }, use_cases: { items: { type: "string" }, title: "Use Cases", type: "array" }, availability: { additionalProperties: { $ref: "#/$defs/Availability" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Availability", type: "object" }, price: { additionalProperties: { additionalProperties: { $ref: "#/$defs/Price" }, propertyNames: { enum: ["DBU", "USD"] }, type: "object" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Price", type: "object" }, average_price: { additionalProperties: { $ref: "#/$defs/AveragePrice" }, propertyNames: { enum: ["DBU", "USD"] }, title: "Average Price", type: "object" }, sources: { additionalProperties: { items: { $ref: "#/$defs/SourceLink" }, type: "array" }, propertyNames: { minLength: 1 }, title: "Sources", type: "object" }, notices: { items: { $ref: "#/$defs/Notice" }, title: "Notices", type: "array" }, rankings: { items: { anyOf: [{ $ref: "#/$defs/Rankings" }, { $ref: "#/$defs/Rankings1" }] }, title: "Rankings", type: "array" }, benchmarks: { items: { $ref: "#/$defs/Benchmark" }, title: "Benchmarks", type: "array" } }, required: ["name", "description", "aliases", "type", "status", "modalities", "capabilities", "tasks", "use_cases", "availability", "price", "average_price", "sources", "notices", "rankings", "benchmarks"], title: "CatalogModel", type: "object" }, CatalogModelRecord: { additionalProperties: false, properties: { name: { title: "Name", type: "string" }, description: { title: "Description", type: "string" }, aliases: { items: { type: "string" }, title: "Aliases", type: "array" }, type: { $ref: "#/$defs/Type" }, family: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Family" }, publisher: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Publisher" }, license: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "License" }, open_weights: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Open Weights" }, status: { $ref: "#/$defs/Status" }, release_date: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Release Date" }, last_updated: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Last Updated" }, knowledge_cutoff: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Knowledge Cutoff" }, retirement: { anyOf: [{ $ref: "#/$defs/Retirement" }, { type: "null" }], default: null }, modalities: { $ref: "#/$defs/Modalities" }, capabilities: { $ref: "#/$defs/Capabilities" }, limits: { anyOf: [{ $ref: "#/$defs/Limits" }, { type: "null" }], default: null }, rate_limits: { anyOf: [{ $ref: "#/$defs/RateLimits" }, { type: "null" }], default: null }, latency: { anyOf: [{ $ref: "#/$defs/Latency" }, { type: "null" }], default: null }, tasks: { items: { type: "string" }, title: "Tasks", type: "array" }, use_cases: { items: { type: "string" }, title: "Use Cases", type: "array" }, availability: { additionalProperties: { $ref: "#/$defs/Availability" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Availability", type: "object" }, price: { additionalProperties: { additionalProperties: { $ref: "#/$defs/Price" }, propertyNames: { enum: ["DBU", "USD"] }, type: "object" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Price", type: "object" }, average_price: { additionalProperties: { $ref: "#/$defs/AveragePrice" }, propertyNames: { enum: ["DBU", "USD"] }, title: "Average Price", type: "object" }, sources: { additionalProperties: { items: { $ref: "#/$defs/SourceLink" }, type: "array" }, propertyNames: { minLength: 1 }, title: "Sources", type: "object" }, notices: { items: { $ref: "#/$defs/Notice" }, title: "Notices", type: "array" }, rankings: { items: { anyOf: [{ $ref: "#/$defs/Rankings" }, { $ref: "#/$defs/Rankings1" }] }, title: "Rankings", type: "array" }, benchmarks: { items: { $ref: "#/$defs/Benchmark" }, title: "Benchmarks", type: "array" }, id: { minLength: 1, title: "Id", type: "string" } }, required: ["name", "description", "aliases", "type", "status", "modalities", "capabilities", "tasks", "use_cases", "availability", "price", "average_price", "sources", "notices", "rankings", "benchmarks", "id"], title: "CatalogModelRecord", type: "object" }, CatalogSearchIndexDocument: { additionalProperties: false, properties: { id: { title: "Id", type: "string" }, exact_identities: { items: { type: "string" }, title: "Exact Identities", type: "array" }, identities: { items: { type: "string" }, title: "Identities", type: "array" }, keywords: { title: "Keywords", type: "string" }, description: { title: "Description", type: "string" }, tokens: { items: { type: "string" }, title: "Tokens", type: "array" }, family: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Family" }, version: { items: { type: "integer" }, title: "Version", type: "array" }, quality_score: { maximum: 100, minimum: 0, title: "Quality Score", type: "number" }, scores: { $ref: "#/$defs/CatalogSearchQualityScores" } }, required: ["id", "exact_identities", "identities", "keywords", "description", "tokens", "version", "quality_score", "scores"], title: "CatalogSearchIndexDocument", type: "object" }, CatalogSearchIndexPayload: { additionalProperties: false, properties: { schema_version: { title: "Schema Version", type: "integer" }, catalog_schema_version: { title: "Catalog Schema Version", type: "integer" }, updated_at: { format: "date-time", title: "Updated At", type: "string" }, weights: { $ref: "#/$defs/CatalogSearchWeights" }, documents: { items: { $ref: "#/$defs/CatalogSearchIndexDocument" }, title: "Documents", type: "array" } }, required: ["schema_version", "catalog_schema_version", "updated_at", "weights", "documents"], title: "CatalogSearchIndexPayload", type: "object" }, CatalogSearchQualityScores: { additionalProperties: false, properties: { leaderboard: { maximum: 100, minimum: 0, title: "Leaderboard", type: "number" }, benchmark: { maximum: 100, minimum: 0, title: "Benchmark", type: "number" }, version: { maximum: 100, minimum: 0, title: "Version", type: "number" }, freshness: { maximum: 100, minimum: 0, title: "Freshness", type: "number" }, lifecycle: { maximum: 100, minimum: 0, title: "Lifecycle", type: "number" } }, required: ["leaderboard", "benchmark", "version", "freshness", "lifecycle"], title: "CatalogSearchQualityScores", type: "object" }, CatalogSearchWeights: { additionalProperties: false, properties: { relevance: { title: "Relevance", type: "number" }, leaderboard: { title: "Leaderboard", type: "number" }, benchmark: { title: "Benchmark", type: "number" }, version: { title: "Version", type: "number" }, freshness: { title: "Freshness", type: "number" }, lifecycle: { title: "Lifecycle", type: "number" } }, required: ["relevance", "leaderboard", "benchmark", "version", "freshness", "lifecycle"], title: "CatalogSearchWeights", type: "object" }, DefaultEffort: { description: "Default reasoning effort when no level is specified.", enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"], title: "DefaultEffort", type: "string" }, EffortEnum: { description: "Normalized reasoning effort level.", enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"], title: "EffortEnum", type: "string" }, GetCatalogRequest: { properties: { action: { const: "get_catalog", default: "get_catalog", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "GetCatalogRequest", type: "object" }, GetCatalogResponse: { properties: { action: { const: "catalog", default: "catalog", title: "Action", type: "string" }, payload: { $ref: "#/$defs/ModelCatalog" } }, required: ["payload"], title: "GetCatalogResponse", type: "object" }, GetSearchIndexRequest: { properties: { action: { const: "get_search_index", default: "get_search_index", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "GetSearchIndexRequest", type: "object" }, GetSearchIndexResponse: { properties: { action: { const: "search_index", default: "search_index", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogSearchIndexPayload" } }, required: ["payload"], title: "GetSearchIndexResponse", type: "object" }, Input: { description: "Known model input and output modalities.", enum: ["text", "image", "audio", "video", "application/pdf", "embedding", "reranking", "decision"], title: "Input", type: "string" }, Kind: { description: "Known Databricks documentation notice kinds.", enum: ["note", "important", "warning", "tip", "caution", "info"], title: "Kind", type: "string" }, Latency: { additionalProperties: false, description: "Normalized response-time score and public benchmark measurements.", properties: { score: { exclusiveMinimum: 0, title: "Score", type: "number" }, measurements: { $ref: "#/$defs/LatencyMeasurements" } }, required: ["score", "measurements"], title: "Latency", type: "object" }, LatencyMeasurements: { additionalProperties: false, description: "Public benchmark measurements underlying one latency score.", properties: { time_to_first_token_ms: { minimum: 0, title: "Time To First Token Ms", type: "number" }, output_tokens_per_second: { exclusiveMinimum: 0, title: "Output Tokens Per Second", type: "number" }, successful_run_count: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Successful Run Count", type: "integer" }, completion_token_count: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Completion Token Count", type: "integer" }, measured_at: { format: "date-time", title: "Measured At", type: "string" } }, required: ["time_to_first_token_ms", "output_tokens_per_second", "successful_run_count", "completion_token_count", "measured_at"], title: "LatencyMeasurements", type: "object" }, Limits: { additionalProperties: false, description: "Documented token limits.", properties: { context: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], default: null, title: "Context" }, input: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], default: null, title: "Input" }, output: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], default: null, title: "Output" } }, title: "Limits", type: "object" }, ListModelsRequest: { properties: { action: { const: "list_models", default: "list_models", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "ListModelsRequest", type: "object" }, ListModelsResponse: { properties: { action: { const: "models", default: "models", title: "Action", type: "string" }, payload: { items: { $ref: "#/$defs/CatalogModelRecord" }, title: "Payload", type: "array" } }, required: ["payload"], title: "ListModelsResponse", type: "object" }, Modalities: { additionalProperties: false, description: "Model input and output modalities.", properties: { input: { items: { anyOf: [{ $ref: "#/$defs/Input" }, { pattern: "^(text|image|audio|video|application)\\/[A-Za-z0-9.+-]+$", type: "string" }] }, title: "Input", type: "array" }, output: { items: { anyOf: [{ $ref: "#/$defs/Output" }, { pattern: "^(text|image|audio|video|application)\\/[A-Za-z0-9.+-]+$", type: "string" }] }, title: "Output", type: "array" } }, required: ["input", "output"], title: "Modalities", type: "object" }, ModelCatalog: { additionalProperties: false, description: "Published Databricks model catalog with identity, capabilities, availability, pricing, lifecycle, rankings, and benchmarks.", properties: { schema_version: { const: 16, title: "Schema Version", type: "integer" }, updated_at: { format: "date-time", title: "Updated At", type: "string" }, models: { additionalProperties: { $ref: "#/$defs/CatalogModel" }, propertyNames: { minLength: 1 }, title: "Models", type: "object" } }, required: ["schema_version", "updated_at", "models"], title: "ModelCatalog", type: "object" }, Notice: { additionalProperties: false, description: "Important Databricks documentation notice.", properties: { kind: { anyOf: [{ $ref: "#/$defs/Kind" }, { minLength: 1, type: "string" }], title: "Kind" }, title: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Title" }, text: { title: "Text", type: "string" }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" } }, required: ["kind", "text", "sources"], title: "Notice", type: "object" }, Output: { description: "Known model input and output modalities.", enum: ["text", "image", "audio", "video", "application/pdf", "embedding", "reranking", "decision"], title: "Output", type: "string" }, Price: { additionalProperties: false, description: "Normalized Databricks price in one currency.", properties: { unit: { $ref: "#/$defs/Unit" }, rates: { additionalProperties: { minimum: 0, type: "number" }, propertyNames: { minLength: 1 }, title: "Rates", type: "object" } }, required: ["unit", "rates"], title: "Price", type: "object" }, ProblemDetails: { description: "An RFC 9457 problem details object, the payload of an error frame. See https://python.chanx.dev/en/latest/protocol.html#protocol-errors", properties: { type: { description: "A URI reference that identifies the problem type.", format: "uri-reference", type: "string" }, title: { description: "A short, human-readable summary of the problem type.", type: "string" }, status: { description: "The HTTP status code generated by the origin server for this occurrence of the problem.", maximum: 599, minimum: 100, type: "integer" }, detail: { description: "A human-readable explanation specific to this occurrence of the problem.", type: "string" }, instance: { description: "A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.", format: "uri-reference", type: "string" }, errors: { description: "The validation failures, when type is validation-failed.", items: { $ref: "#/$defs/ValidationFailure" }, type: "array" } }, required: ["type", "title", "detail"], title: "ProblemDetails", type: "object" }, Rankings: { additionalProperties: false, description: "Competitive ranking based on human preference ratings.", properties: { domain: { title: "Domain", type: "string" }, category: { title: "Category", type: "string" }, rank: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Rank", type: "integer" }, published_at: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Published At" }, variant: { anyOf: [{ $ref: "#/$defs/Variant" }, { type: "null" }], default: null }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" }, metric: { const: "rating", title: "Metric", type: "string" }, rating: { title: "Rating", type: "number" }, lower: { title: "Lower", type: "number" }, upper: { title: "Upper", type: "number" }, variance: { minimum: 0, title: "Variance", type: "number" }, votes: { maximum: 9007199254740991, minimum: 0, title: "Votes", type: "integer" } }, required: ["domain", "category", "rank", "sources", "metric", "rating", "lower", "upper", "variance", "votes"], title: "Rankings", type: "object" }, Rankings1: { additionalProperties: false, description: "Competitive ranking based on a scored evaluation.", properties: { domain: { title: "Domain", type: "string" }, category: { title: "Category", type: "string" }, rank: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Rank", type: "integer" }, published_at: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Published At" }, variant: { anyOf: [{ $ref: "#/$defs/Variant1" }, { type: "null" }], default: null }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" }, metric: { const: "score", title: "Metric", type: "string" }, score: { title: "Score", type: "number" }, lower: { title: "Lower", type: "number" }, upper: { title: "Upper", type: "number" }, observations: { maximum: 9007199254740991, minimum: 0, title: "Observations", type: "integer" }, sessions: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Sessions" } }, required: ["domain", "category", "rank", "sources", "metric", "score", "lower", "upper", "observations", "sessions"], title: "Rankings1", type: "object" }, RateLimits: { additionalProperties: false, description: "Published pay-per-token limits for one model.", properties: { input_tokens_per_minute: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Input Tokens Per Minute" }, output_tokens_per_minute: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Output Tokens Per Minute" }, queries_per_hour: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Queries Per Hour" } }, required: ["input_tokens_per_minute", "output_tokens_per_minute", "queries_per_hour"], title: "RateLimits", type: "object" }, Reasoning: { additionalProperties: false, description: "Reasoning support and controls when known.", properties: { supported: { const: false, title: "Supported", type: "boolean" } }, required: ["supported"], title: "Reasoning", type: "object" }, Reasoning1: { additionalProperties: false, description: "Reasoning support and controls when known.", properties: { supported: { const: true, title: "Supported", type: "boolean" }, effort: { anyOf: [{ items: { $ref: "#/$defs/EffortEnum" }, type: "array" }, { type: "null" }], default: null, title: "Effort" }, default_effort: { anyOf: [{ $ref: "#/$defs/DefaultEffort" }, { type: "null" }], default: null }, toggle: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Toggle" }, budget: { anyOf: [{ $ref: "#/$defs/Budget" }, { type: "null" }], default: null }, description: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Description" } }, required: ["supported"], title: "Reasoning1", type: "object" }, ReasoningEffort: { description: "Reasoning effort used by the evaluated variant.", enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"], title: "ReasoningEffort", type: "string" }, ReasoningMode: { description: "Reasoning execution mode used by the evaluated variant.", enum: ["auto", "thinking"], title: "ReasoningMode", type: "string" }, Retirement: { additionalProperties: false, description: "Databricks retirement and replacement information.", properties: { schedules: { items: { $ref: "#/$defs/Schedule" }, title: "Schedules", type: "array" }, replacement: { anyOf: [{ minLength: 1, type: "string" }, { type: "null" }], default: null, title: "Replacement" }, replacement_name: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Replacement Name" } }, required: ["schedules"], title: "Retirement", type: "object" }, Schedule: { additionalProperties: false, description: "Retirement dates for one serving offering.", properties: { offering: { title: "Offering", type: "string" }, dates: { items: { format: "date", type: "string" }, title: "Dates", type: "array" } }, required: ["offering", "dates"], title: "Schedule", type: "object" }, ServingMode: { description: "Databricks serving mode available for the model.", enum: ["pay_per_token", "priority_pay_per_token", "provisioned_throughput", "batch"], title: "ServingMode", type: "string" }, SourceLink: { additionalProperties: false, description: "Openable attribution for published catalog data.", properties: { label: { minLength: 1, title: "Label", type: "string" }, url: { minLength: 1, pattern: "^https?://", title: "Url", type: "string" } }, required: ["label", "url"], title: "SourceLink", type: "object" }, Status: { description: "Current normalized lifecycle state.", enum: ["active", "preview", "alpha", "beta", "legacy", "deprecated", "retired"], title: "Status", type: "string" }, Status1: { description: "Lifecycle state for this cloud-provider deployment.", enum: ["active", "preview", "alpha", "beta", "legacy", "deprecated", "retired"], title: "Status1", type: "string" }, StreamModelsRequest: { properties: { action: { const: "stream_models", default: "stream_models", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "StreamModelsRequest", type: "object" }, StreamModelsResponse: { properties: { action: { const: "model", default: "model", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogModelRecord" } }, required: ["payload"], title: "StreamModelsResponse", type: "object" }, Type: { description: "Normalized model type.", enum: ["chat", "image", "video", "embedding", "reranking", "decision", "transcription", "speech", "realtime", "extraction", "audio"], title: "Type", type: "string" }, Unit: { description: "Quantity to which the rates apply.", enum: ["per_million_tokens", "per_hour", "per_hour_per_50_model_units"], title: "Unit", type: "string" }, ValidationFailure: { description: "One validation failure, shaped like RFC 9457's validation example.", properties: { keyword: { description: "The JSON Schema keyword that failed, or custom.", type: "string" }, pointer: { description: "A JSON Pointer to the failing value in the frame; for required, the object lacking the member.", type: "string" }, detail: { description: "A human-readable message.", type: "string" }, property: { anyOf: [{ type: "string" }, { type: "integer" }], description: "For required only: the missing member." } }, required: ["keyword", "pointer", "detail"], title: "ValidationFailure", type: "object" }, Variant: { additionalProperties: false, description: "Evaluated model variant when it differs from the base model.", properties: { reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Reasoning" }, reasoning_effort: { anyOf: [{ $ref: "#/$defs/ReasoningEffort" }, { type: "null" }], default: null }, reasoning_mode: { anyOf: [{ $ref: "#/$defs/ReasoningMode" }, { type: "null" }], default: null }, harness: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Harness" }, context: { anyOf: [{ exclusiveMinimum: 0, maximum: 9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Context" } }, title: "Variant", type: "object" }, Variant1: { additionalProperties: false, description: "Evaluated model variant when it differs from the base model.", properties: { reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Reasoning" }, reasoning_effort: { anyOf: [{ $ref: "#/$defs/ReasoningEffort" }, { type: "null" }], default: null }, reasoning_mode: { anyOf: [{ $ref: "#/$defs/ReasoningMode" }, { type: "null" }], default: null }, harness: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Harness" }, context: { anyOf: [{ exclusiveMinimum: 0, maximum: 9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Context" } }, title: "Variant1", type: "object" }, Variant2: { additionalProperties: false, description: "Evaluated model variant when it differs from the base model.", properties: { reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Reasoning" }, reasoning_effort: { anyOf: [{ $ref: "#/$defs/ReasoningEffort" }, { type: "null" }], default: null }, reasoning_mode: { anyOf: [{ $ref: "#/$defs/ReasoningMode" }, { type: "null" }], default: null }, harness: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Harness" }, context: { anyOf: [{ exclusiveMinimum: 0, maximum: 9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Context" } }, title: "Variant2", type: "object" } } };
565
- var CATALOG_SEARCH_INDEX_JSON_SCHEMA = { additionalProperties: false, properties: { schema_version: { title: "Schema Version", type: "integer" }, catalog_schema_version: { title: "Catalog Schema Version", type: "integer" }, updated_at: { format: "date-time", title: "Updated At", type: "string" }, weights: { $ref: "#/$defs/CatalogSearchWeights" }, documents: { items: { $ref: "#/$defs/CatalogSearchIndexDocument" }, title: "Documents", type: "array" } }, required: ["schema_version", "catalog_schema_version", "updated_at", "weights", "documents"], title: "CatalogSearchIndexPayload", type: "object", $defs: { Availability: { additionalProperties: false, description: "Model availability on one Databricks cloud provider.", properties: { status: { $ref: "#/$defs/Status1" }, serving_modes: { items: { $ref: "#/$defs/ServingMode" }, title: "Serving Modes", type: "array" }, details: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Details" } }, required: ["status", "serving_modes"], title: "Availability", type: "object" }, AveragePrice: { additionalProperties: false, description: "Normalized Databricks price in one currency.", properties: { unit: { $ref: "#/$defs/Unit" }, rates: { additionalProperties: { minimum: 0, type: "number" }, propertyNames: { minLength: 1 }, title: "Rates", type: "object" } }, required: ["unit", "rates"], title: "AveragePrice", type: "object" }, Benchmark: { additionalProperties: false, description: "Task-suite benchmark result.", properties: { name: { title: "Name", type: "string" }, rank: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Rank", type: "integer" }, score: { title: "Score", type: "number" }, task_count: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Task Count", type: "integer" }, published_at: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Published At" }, variant: { anyOf: [{ $ref: "#/$defs/Variant2" }, { type: "null" }], default: null }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" } }, required: ["name", "rank", "score", "task_count", "sources"], title: "Benchmark", type: "object" }, Budget: { additionalProperties: false, description: "Supported reasoning-token budget range.", properties: { min: { anyOf: [{ maximum: 9007199254740991, minimum: -9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Min" }, max: { anyOf: [{ maximum: 9007199254740991, minimum: -9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Max" } }, title: "Budget", type: "object" }, Capabilities: { additionalProperties: false, description: "Capabilities used to select the model for a workload.", properties: { attachments: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Attachments" }, tools: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Tools" }, structured_output: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Structured Output" }, temperature: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Temperature" }, interleaved_reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Interleaved Reasoning" }, responses: { title: "Responses", type: "boolean" }, apply_patch: { title: "Apply Patch", type: "boolean" }, web_search: { title: "Web Search", type: "boolean" }, reasoning: { anyOf: [{ $ref: "#/$defs/Reasoning" }, { $ref: "#/$defs/Reasoning1" }, { type: "null" }], default: null, title: "Reasoning" } }, required: ["responses", "apply_patch", "web_search"], title: "Capabilities", type: "object" }, CatalogFilters: { additionalProperties: false, properties: { query: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Query" }, status: { items: { $ref: "#/$defs/Status" }, title: "Status", type: "array" }, type: { items: { $ref: "#/$defs/Type" }, title: "Type", type: "array" }, publisher: { items: { type: "string" }, title: "Publisher", type: "array" }, task: { items: { type: "string" }, title: "Task", type: "array" }, capability: { items: { enum: ["apply-patch", "attachments", "reasoning", "responses", "structured-output", "tools", "web-search"], type: "string" }, title: "Capability", type: "array" }, limit: { anyOf: [{ maximum: 1000, minimum: 0, type: "integer" }, { type: "null" }], default: 50, title: "Limit" } }, title: "CatalogFilters", type: "object" }, CatalogModel: { additionalProperties: false, description: "Published statistics for one Databricks model.", properties: { name: { title: "Name", type: "string" }, description: { title: "Description", type: "string" }, aliases: { items: { type: "string" }, title: "Aliases", type: "array" }, type: { $ref: "#/$defs/Type" }, family: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Family" }, publisher: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Publisher" }, license: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "License" }, open_weights: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Open Weights" }, status: { $ref: "#/$defs/Status" }, release_date: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Release Date" }, last_updated: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Last Updated" }, knowledge_cutoff: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Knowledge Cutoff" }, retirement: { anyOf: [{ $ref: "#/$defs/Retirement" }, { type: "null" }], default: null }, modalities: { $ref: "#/$defs/Modalities" }, capabilities: { $ref: "#/$defs/Capabilities" }, limits: { anyOf: [{ $ref: "#/$defs/Limits" }, { type: "null" }], default: null }, rate_limits: { anyOf: [{ $ref: "#/$defs/RateLimits" }, { type: "null" }], default: null }, latency: { anyOf: [{ $ref: "#/$defs/Latency" }, { type: "null" }], default: null }, tasks: { items: { type: "string" }, title: "Tasks", type: "array" }, use_cases: { items: { type: "string" }, title: "Use Cases", type: "array" }, availability: { additionalProperties: { $ref: "#/$defs/Availability" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Availability", type: "object" }, price: { additionalProperties: { additionalProperties: { $ref: "#/$defs/Price" }, propertyNames: { enum: ["DBU", "USD"] }, type: "object" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Price", type: "object" }, average_price: { additionalProperties: { $ref: "#/$defs/AveragePrice" }, propertyNames: { enum: ["DBU", "USD"] }, title: "Average Price", type: "object" }, sources: { additionalProperties: { items: { $ref: "#/$defs/SourceLink" }, type: "array" }, propertyNames: { minLength: 1 }, title: "Sources", type: "object" }, notices: { items: { $ref: "#/$defs/Notice" }, title: "Notices", type: "array" }, rankings: { items: { anyOf: [{ $ref: "#/$defs/Rankings" }, { $ref: "#/$defs/Rankings1" }] }, title: "Rankings", type: "array" }, benchmarks: { items: { $ref: "#/$defs/Benchmark" }, title: "Benchmarks", type: "array" } }, required: ["name", "description", "aliases", "type", "status", "modalities", "capabilities", "tasks", "use_cases", "availability", "price", "average_price", "sources", "notices", "rankings", "benchmarks"], title: "CatalogModel", type: "object" }, CatalogModelRecord: { additionalProperties: false, properties: { name: { title: "Name", type: "string" }, description: { title: "Description", type: "string" }, aliases: { items: { type: "string" }, title: "Aliases", type: "array" }, type: { $ref: "#/$defs/Type" }, family: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Family" }, publisher: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Publisher" }, license: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "License" }, open_weights: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Open Weights" }, status: { $ref: "#/$defs/Status" }, release_date: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Release Date" }, last_updated: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Last Updated" }, knowledge_cutoff: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Knowledge Cutoff" }, retirement: { anyOf: [{ $ref: "#/$defs/Retirement" }, { type: "null" }], default: null }, modalities: { $ref: "#/$defs/Modalities" }, capabilities: { $ref: "#/$defs/Capabilities" }, limits: { anyOf: [{ $ref: "#/$defs/Limits" }, { type: "null" }], default: null }, rate_limits: { anyOf: [{ $ref: "#/$defs/RateLimits" }, { type: "null" }], default: null }, latency: { anyOf: [{ $ref: "#/$defs/Latency" }, { type: "null" }], default: null }, tasks: { items: { type: "string" }, title: "Tasks", type: "array" }, use_cases: { items: { type: "string" }, title: "Use Cases", type: "array" }, availability: { additionalProperties: { $ref: "#/$defs/Availability" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Availability", type: "object" }, price: { additionalProperties: { additionalProperties: { $ref: "#/$defs/Price" }, propertyNames: { enum: ["DBU", "USD"] }, type: "object" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Price", type: "object" }, average_price: { additionalProperties: { $ref: "#/$defs/AveragePrice" }, propertyNames: { enum: ["DBU", "USD"] }, title: "Average Price", type: "object" }, sources: { additionalProperties: { items: { $ref: "#/$defs/SourceLink" }, type: "array" }, propertyNames: { minLength: 1 }, title: "Sources", type: "object" }, notices: { items: { $ref: "#/$defs/Notice" }, title: "Notices", type: "array" }, rankings: { items: { anyOf: [{ $ref: "#/$defs/Rankings" }, { $ref: "#/$defs/Rankings1" }] }, title: "Rankings", type: "array" }, benchmarks: { items: { $ref: "#/$defs/Benchmark" }, title: "Benchmarks", type: "array" }, id: { minLength: 1, title: "Id", type: "string" } }, required: ["name", "description", "aliases", "type", "status", "modalities", "capabilities", "tasks", "use_cases", "availability", "price", "average_price", "sources", "notices", "rankings", "benchmarks", "id"], title: "CatalogModelRecord", type: "object" }, CatalogSearchIndexDocument: { additionalProperties: false, properties: { id: { title: "Id", type: "string" }, exact_identities: { items: { type: "string" }, title: "Exact Identities", type: "array" }, identities: { items: { type: "string" }, title: "Identities", type: "array" }, keywords: { title: "Keywords", type: "string" }, description: { title: "Description", type: "string" }, tokens: { items: { type: "string" }, title: "Tokens", type: "array" }, family: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Family" }, version: { items: { type: "integer" }, title: "Version", type: "array" }, quality_score: { maximum: 100, minimum: 0, title: "Quality Score", type: "number" }, scores: { $ref: "#/$defs/CatalogSearchQualityScores" } }, required: ["id", "exact_identities", "identities", "keywords", "description", "tokens", "version", "quality_score", "scores"], title: "CatalogSearchIndexDocument", type: "object" }, CatalogSearchIndexPayload: { additionalProperties: false, properties: { schema_version: { title: "Schema Version", type: "integer" }, catalog_schema_version: { title: "Catalog Schema Version", type: "integer" }, updated_at: { format: "date-time", title: "Updated At", type: "string" }, weights: { $ref: "#/$defs/CatalogSearchWeights" }, documents: { items: { $ref: "#/$defs/CatalogSearchIndexDocument" }, title: "Documents", type: "array" } }, required: ["schema_version", "catalog_schema_version", "updated_at", "weights", "documents"], title: "CatalogSearchIndexPayload", type: "object" }, CatalogSearchQualityScores: { additionalProperties: false, properties: { leaderboard: { maximum: 100, minimum: 0, title: "Leaderboard", type: "number" }, benchmark: { maximum: 100, minimum: 0, title: "Benchmark", type: "number" }, version: { maximum: 100, minimum: 0, title: "Version", type: "number" }, freshness: { maximum: 100, minimum: 0, title: "Freshness", type: "number" }, lifecycle: { maximum: 100, minimum: 0, title: "Lifecycle", type: "number" } }, required: ["leaderboard", "benchmark", "version", "freshness", "lifecycle"], title: "CatalogSearchQualityScores", type: "object" }, CatalogSearchWeights: { additionalProperties: false, properties: { relevance: { title: "Relevance", type: "number" }, leaderboard: { title: "Leaderboard", type: "number" }, benchmark: { title: "Benchmark", type: "number" }, version: { title: "Version", type: "number" }, freshness: { title: "Freshness", type: "number" }, lifecycle: { title: "Lifecycle", type: "number" } }, required: ["relevance", "leaderboard", "benchmark", "version", "freshness", "lifecycle"], title: "CatalogSearchWeights", type: "object" }, DefaultEffort: { description: "Default reasoning effort when no level is specified.", enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"], title: "DefaultEffort", type: "string" }, EffortEnum: { description: "Normalized reasoning effort level.", enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"], title: "EffortEnum", type: "string" }, GetCatalogRequest: { properties: { action: { const: "get_catalog", default: "get_catalog", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "GetCatalogRequest", type: "object" }, GetCatalogResponse: { properties: { action: { const: "catalog", default: "catalog", title: "Action", type: "string" }, payload: { $ref: "#/$defs/ModelCatalog" } }, required: ["payload"], title: "GetCatalogResponse", type: "object" }, GetSearchIndexRequest: { properties: { action: { const: "get_search_index", default: "get_search_index", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "GetSearchIndexRequest", type: "object" }, GetSearchIndexResponse: { properties: { action: { const: "search_index", default: "search_index", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogSearchIndexPayload" } }, required: ["payload"], title: "GetSearchIndexResponse", type: "object" }, Input: { description: "Known model input and output modalities.", enum: ["text", "image", "audio", "video", "application/pdf", "embedding", "reranking", "decision"], title: "Input", type: "string" }, Kind: { description: "Known Databricks documentation notice kinds.", enum: ["note", "important", "warning", "tip", "caution", "info"], title: "Kind", type: "string" }, Latency: { additionalProperties: false, description: "Normalized response-time score and public benchmark measurements.", properties: { score: { exclusiveMinimum: 0, title: "Score", type: "number" }, measurements: { $ref: "#/$defs/LatencyMeasurements" } }, required: ["score", "measurements"], title: "Latency", type: "object" }, LatencyMeasurements: { additionalProperties: false, description: "Public benchmark measurements underlying one latency score.", properties: { time_to_first_token_ms: { minimum: 0, title: "Time To First Token Ms", type: "number" }, output_tokens_per_second: { exclusiveMinimum: 0, title: "Output Tokens Per Second", type: "number" }, successful_run_count: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Successful Run Count", type: "integer" }, completion_token_count: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Completion Token Count", type: "integer" }, measured_at: { format: "date-time", title: "Measured At", type: "string" } }, required: ["time_to_first_token_ms", "output_tokens_per_second", "successful_run_count", "completion_token_count", "measured_at"], title: "LatencyMeasurements", type: "object" }, Limits: { additionalProperties: false, description: "Documented token limits.", properties: { context: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], default: null, title: "Context" }, input: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], default: null, title: "Input" }, output: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], default: null, title: "Output" } }, title: "Limits", type: "object" }, ListModelsRequest: { properties: { action: { const: "list_models", default: "list_models", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "ListModelsRequest", type: "object" }, ListModelsResponse: { properties: { action: { const: "models", default: "models", title: "Action", type: "string" }, payload: { items: { $ref: "#/$defs/CatalogModelRecord" }, title: "Payload", type: "array" } }, required: ["payload"], title: "ListModelsResponse", type: "object" }, Modalities: { additionalProperties: false, description: "Model input and output modalities.", properties: { input: { items: { anyOf: [{ $ref: "#/$defs/Input" }, { pattern: "^(text|image|audio|video|application)\\/[A-Za-z0-9.+-]+$", type: "string" }] }, title: "Input", type: "array" }, output: { items: { anyOf: [{ $ref: "#/$defs/Output" }, { pattern: "^(text|image|audio|video|application)\\/[A-Za-z0-9.+-]+$", type: "string" }] }, title: "Output", type: "array" } }, required: ["input", "output"], title: "Modalities", type: "object" }, ModelCatalog: { additionalProperties: false, description: "Published Databricks model catalog with identity, capabilities, availability, pricing, lifecycle, rankings, and benchmarks.", properties: { schema_version: { const: 16, title: "Schema Version", type: "integer" }, updated_at: { format: "date-time", title: "Updated At", type: "string" }, models: { additionalProperties: { $ref: "#/$defs/CatalogModel" }, propertyNames: { minLength: 1 }, title: "Models", type: "object" } }, required: ["schema_version", "updated_at", "models"], title: "ModelCatalog", type: "object" }, Notice: { additionalProperties: false, description: "Important Databricks documentation notice.", properties: { kind: { anyOf: [{ $ref: "#/$defs/Kind" }, { minLength: 1, type: "string" }], title: "Kind" }, title: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Title" }, text: { title: "Text", type: "string" }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" } }, required: ["kind", "text", "sources"], title: "Notice", type: "object" }, Output: { description: "Known model input and output modalities.", enum: ["text", "image", "audio", "video", "application/pdf", "embedding", "reranking", "decision"], title: "Output", type: "string" }, Price: { additionalProperties: false, description: "Normalized Databricks price in one currency.", properties: { unit: { $ref: "#/$defs/Unit" }, rates: { additionalProperties: { minimum: 0, type: "number" }, propertyNames: { minLength: 1 }, title: "Rates", type: "object" } }, required: ["unit", "rates"], title: "Price", type: "object" }, ProblemDetails: { description: "An RFC 9457 problem details object, the payload of an error frame. See https://python.chanx.dev/en/latest/protocol.html#protocol-errors", properties: { type: { description: "A URI reference that identifies the problem type.", format: "uri-reference", type: "string" }, title: { description: "A short, human-readable summary of the problem type.", type: "string" }, status: { description: "The HTTP status code generated by the origin server for this occurrence of the problem.", maximum: 599, minimum: 100, type: "integer" }, detail: { description: "A human-readable explanation specific to this occurrence of the problem.", type: "string" }, instance: { description: "A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.", format: "uri-reference", type: "string" }, errors: { description: "The validation failures, when type is validation-failed.", items: { $ref: "#/$defs/ValidationFailure" }, type: "array" } }, required: ["type", "title", "detail"], title: "ProblemDetails", type: "object" }, Rankings: { additionalProperties: false, description: "Competitive ranking based on human preference ratings.", properties: { domain: { title: "Domain", type: "string" }, category: { title: "Category", type: "string" }, rank: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Rank", type: "integer" }, published_at: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Published At" }, variant: { anyOf: [{ $ref: "#/$defs/Variant" }, { type: "null" }], default: null }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" }, metric: { const: "rating", title: "Metric", type: "string" }, rating: { title: "Rating", type: "number" }, lower: { title: "Lower", type: "number" }, upper: { title: "Upper", type: "number" }, variance: { minimum: 0, title: "Variance", type: "number" }, votes: { maximum: 9007199254740991, minimum: 0, title: "Votes", type: "integer" } }, required: ["domain", "category", "rank", "sources", "metric", "rating", "lower", "upper", "variance", "votes"], title: "Rankings", type: "object" }, Rankings1: { additionalProperties: false, description: "Competitive ranking based on a scored evaluation.", properties: { domain: { title: "Domain", type: "string" }, category: { title: "Category", type: "string" }, rank: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Rank", type: "integer" }, published_at: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Published At" }, variant: { anyOf: [{ $ref: "#/$defs/Variant1" }, { type: "null" }], default: null }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" }, metric: { const: "score", title: "Metric", type: "string" }, score: { title: "Score", type: "number" }, lower: { title: "Lower", type: "number" }, upper: { title: "Upper", type: "number" }, observations: { maximum: 9007199254740991, minimum: 0, title: "Observations", type: "integer" }, sessions: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Sessions" } }, required: ["domain", "category", "rank", "sources", "metric", "score", "lower", "upper", "observations", "sessions"], title: "Rankings1", type: "object" }, RateLimits: { additionalProperties: false, description: "Published pay-per-token limits for one model.", properties: { input_tokens_per_minute: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Input Tokens Per Minute" }, output_tokens_per_minute: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Output Tokens Per Minute" }, queries_per_hour: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Queries Per Hour" } }, required: ["input_tokens_per_minute", "output_tokens_per_minute", "queries_per_hour"], title: "RateLimits", type: "object" }, Reasoning: { additionalProperties: false, description: "Reasoning support and controls when known.", properties: { supported: { const: false, title: "Supported", type: "boolean" } }, required: ["supported"], title: "Reasoning", type: "object" }, Reasoning1: { additionalProperties: false, description: "Reasoning support and controls when known.", properties: { supported: { const: true, title: "Supported", type: "boolean" }, effort: { anyOf: [{ items: { $ref: "#/$defs/EffortEnum" }, type: "array" }, { type: "null" }], default: null, title: "Effort" }, default_effort: { anyOf: [{ $ref: "#/$defs/DefaultEffort" }, { type: "null" }], default: null }, toggle: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Toggle" }, budget: { anyOf: [{ $ref: "#/$defs/Budget" }, { type: "null" }], default: null }, description: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Description" } }, required: ["supported"], title: "Reasoning1", type: "object" }, ReasoningEffort: { description: "Reasoning effort used by the evaluated variant.", enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"], title: "ReasoningEffort", type: "string" }, ReasoningMode: { description: "Reasoning execution mode used by the evaluated variant.", enum: ["auto", "thinking"], title: "ReasoningMode", type: "string" }, Retirement: { additionalProperties: false, description: "Databricks retirement and replacement information.", properties: { schedules: { items: { $ref: "#/$defs/Schedule" }, title: "Schedules", type: "array" }, replacement: { anyOf: [{ minLength: 1, type: "string" }, { type: "null" }], default: null, title: "Replacement" }, replacement_name: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Replacement Name" } }, required: ["schedules"], title: "Retirement", type: "object" }, Schedule: { additionalProperties: false, description: "Retirement dates for one serving offering.", properties: { offering: { title: "Offering", type: "string" }, dates: { items: { format: "date", type: "string" }, title: "Dates", type: "array" } }, required: ["offering", "dates"], title: "Schedule", type: "object" }, ServingMode: { description: "Databricks serving mode available for the model.", enum: ["pay_per_token", "priority_pay_per_token", "provisioned_throughput", "batch"], title: "ServingMode", type: "string" }, SourceLink: { additionalProperties: false, description: "Openable attribution for published catalog data.", properties: { label: { minLength: 1, title: "Label", type: "string" }, url: { minLength: 1, pattern: "^https?://", title: "Url", type: "string" } }, required: ["label", "url"], title: "SourceLink", type: "object" }, Status: { description: "Current normalized lifecycle state.", enum: ["active", "preview", "alpha", "beta", "legacy", "deprecated", "retired"], title: "Status", type: "string" }, Status1: { description: "Lifecycle state for this cloud-provider deployment.", enum: ["active", "preview", "alpha", "beta", "legacy", "deprecated", "retired"], title: "Status1", type: "string" }, StreamModelsRequest: { properties: { action: { const: "stream_models", default: "stream_models", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "StreamModelsRequest", type: "object" }, StreamModelsResponse: { properties: { action: { const: "model", default: "model", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogModelRecord" } }, required: ["payload"], title: "StreamModelsResponse", type: "object" }, Type: { description: "Normalized model type.", enum: ["chat", "image", "video", "embedding", "reranking", "decision", "transcription", "speech", "realtime", "extraction", "audio"], title: "Type", type: "string" }, Unit: { description: "Quantity to which the rates apply.", enum: ["per_million_tokens", "per_hour", "per_hour_per_50_model_units"], title: "Unit", type: "string" }, ValidationFailure: { description: "One validation failure, shaped like RFC 9457's validation example.", properties: { keyword: { description: "The JSON Schema keyword that failed, or custom.", type: "string" }, pointer: { description: "A JSON Pointer to the failing value in the frame; for required, the object lacking the member.", type: "string" }, detail: { description: "A human-readable message.", type: "string" }, property: { anyOf: [{ type: "string" }, { type: "integer" }], description: "For required only: the missing member." } }, required: ["keyword", "pointer", "detail"], title: "ValidationFailure", type: "object" }, Variant: { additionalProperties: false, description: "Evaluated model variant when it differs from the base model.", properties: { reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Reasoning" }, reasoning_effort: { anyOf: [{ $ref: "#/$defs/ReasoningEffort" }, { type: "null" }], default: null }, reasoning_mode: { anyOf: [{ $ref: "#/$defs/ReasoningMode" }, { type: "null" }], default: null }, harness: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Harness" }, context: { anyOf: [{ exclusiveMinimum: 0, maximum: 9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Context" } }, title: "Variant", type: "object" }, Variant1: { additionalProperties: false, description: "Evaluated model variant when it differs from the base model.", properties: { reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Reasoning" }, reasoning_effort: { anyOf: [{ $ref: "#/$defs/ReasoningEffort" }, { type: "null" }], default: null }, reasoning_mode: { anyOf: [{ $ref: "#/$defs/ReasoningMode" }, { type: "null" }], default: null }, harness: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Harness" }, context: { anyOf: [{ exclusiveMinimum: 0, maximum: 9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Context" } }, title: "Variant1", type: "object" }, Variant2: { additionalProperties: false, description: "Evaluated model variant when it differs from the base model.", properties: { reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Reasoning" }, reasoning_effort: { anyOf: [{ $ref: "#/$defs/ReasoningEffort" }, { type: "null" }], default: null }, reasoning_mode: { anyOf: [{ $ref: "#/$defs/ReasoningMode" }, { type: "null" }], default: null }, harness: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Harness" }, context: { anyOf: [{ exclusiveMinimum: 0, maximum: 9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Context" } }, title: "Variant2", type: "object" } } };
1588
+ // src/workspace-connection.ts
1589
+ var SERVING_ENDPOINTS_PATH = WORKSPACE_OVERLAY_RULES.serving_endpoints_path;
1590
+ var CURRENT_USER_PATH = WORKSPACE_OVERLAY_RULES.principal.path;
566
1591
 
567
- // src/validation.ts
568
- function modelCatalogDefinitionSchema(definition) {
569
- return z.fromJSONSchema({
570
- ...MODEL_CATALOG_JSON_SCHEMA.$defs[definition],
571
- $defs: MODEL_CATALOG_JSON_SCHEMA.$defs
1592
+ class WorkspaceRequestError extends Error {
1593
+ path;
1594
+ status;
1595
+ name = "WorkspaceRequestError";
1596
+ constructor(path, status) {
1597
+ super(`Workspace request ${path} failed with ${status}`);
1598
+ this.path = path;
1599
+ this.status = status;
1600
+ }
1601
+ }
1602
+ var BROWSER_MODEL_SERVING_FORMS = "a { host, headers } connection or a function returning one";
1603
+ function connectBrowserModelServing(source, options = {}, supportedForms = BROWSER_MODEL_SERVING_FORMS) {
1604
+ if (typeof source === "function") {
1605
+ return {
1606
+ kind: "generator",
1607
+ snapshot: async () => restSnapshot(validateConnection(await source(), "Model serving connection generator returned no host"), options.fetch)
1608
+ };
1609
+ }
1610
+ if (source && typeof source === "object" && (("host" in source) || ("headers" in source))) {
1611
+ const resolved = validateConnection(source, "Model serving connection requires a host");
1612
+ return { kind: "connection", snapshot: async () => restSnapshot(resolved, options.fetch) };
1613
+ }
1614
+ throw new WorkspaceConnectionError(`Unsupported modelServingClient; expected ${supportedForms}`);
1615
+ }
1616
+ function requesterSnapshot(workspace, get) {
1617
+ return {
1618
+ ...workspace === undefined ? {} : { workspace },
1619
+ listServingEndpoints: () => collectPages(async (pageToken) => {
1620
+ const page = await get(SERVING_ENDPOINTS_PATH, pageToken === undefined ? undefined : { page_token: pageToken });
1621
+ if (!page || typeof page !== "object")
1622
+ throw new TypeError("Serving Endpoints response is not a JSON object");
1623
+ const { endpoints, next_page_token: next } = page;
1624
+ return { endpoints: Array.isArray(endpoints) ? endpoints : [], next };
1625
+ }),
1626
+ principal: async () => principalIdentity(await get(CURRENT_USER_PATH))
1627
+ };
1628
+ }
1629
+ async function collectPages(page) {
1630
+ const endpoints = [];
1631
+ const seen = new Set;
1632
+ let pageToken;
1633
+ do {
1634
+ const { endpoints: items, next } = await page(pageToken);
1635
+ endpoints.push(...items);
1636
+ pageToken = typeof next === "string" && next && !seen.has(next) ? next : undefined;
1637
+ if (pageToken)
1638
+ seen.add(pageToken);
1639
+ } while (pageToken);
1640
+ return { endpoints };
1641
+ }
1642
+ function restSnapshot({ host, headers }, fetcher) {
1643
+ const origin = parseWorkspaceUrl(host).origin;
1644
+ return requesterSnapshot(resolveWorkspaceIdentity(host, headers), async (path, query) => {
1645
+ const url = new URL(path, origin);
1646
+ for (const [name, value] of Object.entries(query ?? {}))
1647
+ url.searchParams.set(name, value);
1648
+ const requestHeaders = new Headers(headers);
1649
+ if (!requestHeaders.has("accept"))
1650
+ requestHeaders.set("accept", "application/json");
1651
+ const response = await (fetcher ?? globalThis.fetch)(url, { headers: requestHeaders });
1652
+ if (!response.ok)
1653
+ throw new WorkspaceRequestError(path, response.status);
1654
+ return response.json();
572
1655
  });
573
1656
  }
574
- var ModelCatalogSchema = z.fromJSONSchema(MODEL_CATALOG_JSON_SCHEMA);
575
- var CatalogSearchIndexSchema = z.fromJSONSchema(CATALOG_SEARCH_INDEX_JSON_SCHEMA);
576
- var CatalogModelSchema = modelCatalogDefinitionSchema("CatalogModel");
577
- var CatalogModelRecordSchema = modelCatalogDefinitionSchema("CatalogModelRecord");
578
- var CatalogCapabilitiesSchema = modelCatalogDefinitionSchema("Capabilities");
579
- var CatalogRateLimitsSchema = modelCatalogDefinitionSchema("RateLimits");
580
- var CatalogLatencySchema = modelCatalogDefinitionSchema("Latency");
581
- var CatalogPriceSchema = modelCatalogDefinitionSchema("Price");
582
- var CatalogAveragePriceSchema = modelCatalogDefinitionSchema("AveragePrice");
583
- var CatalogPreferenceRankingSchema = modelCatalogDefinitionSchema("Rankings");
584
- var CatalogScoreRankingSchema = modelCatalogDefinitionSchema("Rankings1");
585
- var CatalogRankingSchema = z.union([
586
- CatalogPreferenceRankingSchema,
587
- CatalogScoreRankingSchema
588
- ]);
589
- var CatalogStatusSchema = modelCatalogDefinitionSchema("Status");
590
- function parseModelCatalog(value) {
591
- return ModelCatalogSchema.parse(value);
592
- }
593
- function parseCatalogSearchIndex(value) {
594
- return CatalogSearchIndexSchema.parse(value);
595
- }
596
- function parseCatalogModelRecord(value) {
597
- return CatalogModelRecordSchema.parse(value);
1657
+ function validateConnection(value, message) {
1658
+ const host = value && typeof value === "object" && typeof value.host === "string" ? value.host.trim() : "";
1659
+ if (!host)
1660
+ throw new WorkspaceConnectionError(message);
1661
+ parseWorkspaceUrl(host);
1662
+ return { host, headers: new Headers(value?.headers) };
598
1663
  }
599
1664
 
600
1665
  // src/browser.ts
601
- async function loadModelCatalog(options = {}) {
602
- const index = await loadModelCatalogIndex(options);
603
- return createModelCatalogClient(index.catalog, index.searchIndex);
604
- }
605
- async function loadModelCatalogIndex(options = {}) {
606
- const loader = options.fetch ?? globalThis.fetch;
607
- const catalogUrl = options.catalogUrl ?? PUBLISHED_CATALOG_URL;
608
- const searchIndexUrl = options.searchIndexUrl ?? (options.catalogUrl ? new URL("search-index.json", options.catalogUrl).toString() : PUBLISHED_CATALOG_SEARCH_INDEX_URL);
609
- const [catalogResponse, searchIndexResponse] = await Promise.all([
610
- loader(catalogUrl),
611
- loader(searchIndexUrl)
612
- ]);
613
- if (!catalogResponse.ok)
614
- throw new Error(`Catalog request failed with ${catalogResponse.status}`);
615
- if (!searchIndexResponse.ok) {
616
- throw new Error(`Search index request failed with ${searchIndexResponse.status}`);
617
- }
618
- return createModelCatalogIndex(parseModelCatalog(await catalogResponse.json()), parseCatalogSearchIndex(await searchIndexResponse.json()));
1666
+ async function createModelCatalogClient(source, options = {}) {
1667
+ const connector = options.modelServingClient === undefined ? undefined : connectBrowserModelServing(options.modelServingClient, { fetch: options.fetch });
1668
+ const loaded = await loadBrowserSource(source, options);
1669
+ return createCatalogClient(loaded, workspaceOverlay(connector, options.workspaceCache));
619
1670
  }
620
1671
  export {
621
- CatalogAveragePriceSchema,
622
- CatalogCapabilitiesSchema,
623
- CatalogLatencySchema,
624
- CatalogModelRecordSchema,
625
- CatalogModelSchema,
626
- CatalogPreferenceRankingSchema,
627
- CatalogPriceSchema,
628
- CatalogRankingSchema,
629
- CatalogRateLimitsSchema,
630
- CatalogScoreRankingSchema,
631
- CatalogSearchIndexSchema,
632
- CatalogStatusSchema,
633
- ModelCatalogIndex,
634
- ModelCatalogSchema,
1672
+ CatalogAveragePriceSchema2 as CatalogAveragePriceSchema,
1673
+ CatalogCapabilitiesSchema2 as CatalogCapabilitiesSchema,
1674
+ CatalogLatencySchema2 as CatalogLatencySchema,
1675
+ CatalogModelRecordSchema2 as CatalogModelRecordSchema,
1676
+ CatalogModelSchema2 as CatalogModelSchema,
1677
+ CatalogPreferenceRankingSchema2 as CatalogPreferenceRankingSchema,
1678
+ CatalogPriceSchema2 as CatalogPriceSchema,
1679
+ CatalogRankingSchema2 as CatalogRankingSchema,
1680
+ CatalogRateLimitsSchema2 as CatalogRateLimitsSchema,
1681
+ CatalogScoreRankingSchema2 as CatalogScoreRankingSchema,
1682
+ CatalogSearchIndexSchema2 as CatalogSearchIndexSchema,
1683
+ CatalogStatusSchema2 as CatalogStatusSchema,
1684
+ EFFECTIVE_CATALOG_CONTRACT_VERSION,
1685
+ EffectiveModelCatalogSchema2 as EffectiveModelCatalogSchema,
1686
+ ModelCatalogSchema2 as ModelCatalogSchema,
635
1687
  PUBLISHED_CATALOG_DATABASE_URL,
636
1688
  PUBLISHED_CATALOG_INDEX_URL,
637
1689
  PUBLISHED_CATALOG_ROOT_URL,
@@ -639,19 +1691,10 @@ export {
639
1691
  PUBLISHED_CATALOG_SCHEMA_VERSION,
640
1692
  PUBLISHED_CATALOG_SEARCH_INDEX_URL,
641
1693
  PUBLISHED_CATALOG_URL,
1694
+ WorkspaceRefreshSchema2 as WorkspaceRefreshSchema,
642
1695
  createModelCatalogClient,
643
- createModelCatalogIndex,
644
- enrichLiveModels,
645
- filterCatalogRecords,
646
- loadModelCatalog,
647
- loadModelCatalogIndex,
648
- modelIdentities,
649
- modelProviderFamily,
650
- modelVersion,
651
- normalizeModelIdentity,
652
- parseCatalogModelRecord,
653
- parseCatalogSearchIndex,
654
- parseModelCatalog,
655
- searchCatalogMatches,
656
- searchCatalogRecords
1696
+ parseCatalogModelRecord2 as parseCatalogModelRecord,
1697
+ parseCatalogSearchIndex2 as parseCatalogSearchIndex,
1698
+ parseEffectiveModelCatalog2 as parseEffectiveModelCatalog,
1699
+ parseModelCatalog2 as parseModelCatalog
657
1700
  };