@dbx-tools/dbx-model-catalog 0.2.0 → 0.3.0

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
@@ -0,0 +1,31 @@
1
+ import type { CatalogSearchIndexPayload, EffectiveModelCatalog, ModelCatalog, WorkspaceRefresh } from "./_generated/schemas.js";
2
+ import { type WorkspaceEndpoint } from "./serving-endpoints.js";
3
+ /** Version of the effective-catalog contract; part of every workspace cache key. */
4
+ export declare const EFFECTIVE_CATALOG_CONTRACT_VERSION: number;
5
+ /**
6
+ * Merge normalized endpoints over `publicCatalog` with live-over-public precedence, following
7
+ * the Python reference (`build_effective_catalog`) and the shared `WORKSPACE_OVERLAY_RULES`:
8
+ *
9
+ * - A repeated endpoint name keeps its first entry.
10
+ * - An endpoint matches the first identity candidate the public index resolves exactly
11
+ * (case-insensitive) or by normalized identity; never fuzzy.
12
+ * - Each overlay field the endpoint supplies replaces the public value (origin `workspace`) and
13
+ * drops `sources[target]`; omitted fields keep the public value and sources (origin `public`).
14
+ * Unmatched endpoints start from schema-required placeholders (origin `placeholder`).
15
+ * - An unmatched endpoint whose task maps to no type gets no record or search document: it is
16
+ * listed in `endpoints` only, with no field origins, because any type would be invented.
17
+ * - The record id is the endpoint name. Public order is kept, an endpoint named like a public id
18
+ * replaces it in place, and other endpoint records follow sorted by name.
19
+ * - Endpoint identities other than the name become aliases only when the public index does not
20
+ * resolve them and no public record or earlier endpoint already claims them.
21
+ */
22
+ export declare function buildEffectiveCatalog(publicCatalog: ModelCatalog, endpoints?: Iterable<WorkspaceEndpoint>, workspace?: WorkspaceRefresh): EffectiveModelCatalog;
23
+ /** True when the workspace listed `id` as an invocable endpoint. */
24
+ export declare function isEffectiveModelAccessible(effective: EffectiveModelCatalog, id: string): boolean;
25
+ /**
26
+ * Search documents for every effective record. Text fields come from the effective record;
27
+ * quality comes from the public search index: an unchanged public record reuses its own document,
28
+ * an endpoint record inherits its matched public record's quality, and an unmatched endpoint uses
29
+ * `runtime_search_quality`.
30
+ */
31
+ export declare function buildEffectiveSearchIndex(effective: EffectiveModelCatalog, publicIndex: CatalogSearchIndexPayload): CatalogSearchIndexPayload;
package/dist/index.d.ts CHANGED
@@ -1,18 +1,35 @@
1
- import type { CatalogClient } from "./types.js";
2
- export interface ConnectModelCatalogOptions {
3
- catalogPath?: string;
4
- catalogUrl?: string;
5
- fetch?: typeof globalThis.fetch;
6
- searchIndexPath?: string;
7
- searchIndexUrl?: string;
1
+ import { type CatalogSourceOptions, type ModelCatalogSourceInput } from "./sources.js";
2
+ import type { ModelCatalogClient } from "./types.js";
3
+ import { type ModelServingClientOption } from "./workspace-client.js";
4
+ import type { WorkspaceCacheOptions } from "./workspace-overlay.js";
5
+ /** Options for the Node `createModelCatalogClient`, which also accepts SDK clients. */
6
+ export interface ModelCatalogClientOptions extends CatalogSourceOptions {
7
+ /**
8
+ * Workspace connection: a `@databricks/sdk-experimental` `WorkspaceClient`, a
9
+ * `@databricks/sdk-modelserving` `ModelServingClient`, a `{ host, headers }` connection, or a sync
10
+ * or async function returning one. Validated before any request.
11
+ */
12
+ modelServingClient?: ModelServingClientOption;
13
+ /** Workspace overlay refresh and cache settings. */
14
+ workspaceCache?: NodeWorkspaceCacheOptions;
8
15
  }
9
- export interface ModelCatalogSession extends AsyncDisposable {
10
- readonly client: CatalogClient;
11
- readonly mode: "file" | "published" | "url";
12
- readonly root: string;
13
- readonly source: string;
14
- close(): Promise<void>;
16
+ /**
17
+ * Node workspace cache settings. By default principal-scoped overlays persist to a `keyv-file`
18
+ * store under the user cache directory; `persistent: false` keeps them in process memory.
19
+ */
20
+ export interface NodeWorkspaceCacheOptions extends WorkspaceCacheOptions {
21
+ /** Cache file for the default persistent store. */
22
+ filename?: string;
15
23
  }
16
- export declare function connectModelCatalog(input?: string | ConnectModelCatalogOptions): Promise<ModelCatalogSession>;
17
- export type * from "./browser.js";
18
- export { PUBLISHED_CATALOG_DATABASE_URL, PUBLISHED_CATALOG_INDEX_URL, PUBLISHED_CATALOG_ROOT_URL, PUBLISHED_CATALOG_SCHEMA_URL, PUBLISHED_CATALOG_SCHEMA_VERSION, PUBLISHED_CATALOG_SEARCH_INDEX_URL, PUBLISHED_CATALOG_URL, createModelCatalogClient, filterCatalogRecords, loadModelCatalog, loadModelCatalogIndex, searchCatalogRecords, } from "./browser.js";
24
+ /**
25
+ * Create a catalog client from any source: the published catalog by default (or the files named by
26
+ * `DBX_MODEL_CATALOG_PATH`), an `http(s)` catalog URL, a `ws(s)` URL of the Python catalog server
27
+ * (needs the optional `pynect` and `@chanx-js/client` peers), a catalog file path or `file:` URL
28
+ * (`search-index.json` beside it), or an in-memory catalog with `options.searchIndex`. With
29
+ * `modelServingClient` every read serves the workspace-effective catalog, whatever the source.
30
+ */
31
+ export declare function createModelCatalogClient(source?: ModelCatalogSourceInput, options?: ModelCatalogClientOptions): Promise<ModelCatalogClient>;
32
+ export { createPersistentWorkspaceCatalogCache } from "./workspace-file-cache.js";
33
+ export type { ModelServingClientOption, ModelServingSdkClientLike, WorkspaceClientLike, WorkspaceClientRequest, } from "./workspace-client.js";
34
+ export type { Availability, AveragePrice, Benchmark, BrowserModelServingClientOption, CachedWorkspaceOverlay, Capabilities, CatalogFilters, CatalogIdentityMatch, CatalogModel, CatalogModelRecord, CatalogSearchIndexDocument, CatalogSearchIndexPayload, CatalogSearchMatch, CatalogSearchQualityScores, EffectiveEndpoint, EffectiveModelCatalog, FieldOrigin, IdentityCandidate, Latency, Limits, MatchedPublicIdentity, Modalities, ModelCatalog, ModelCatalogClient, ModelCatalogSource, ModelCatalogSourceInput, ModelCatalogSourceKind, ModelIdentity, ModelIdentityKind, ModelServingConnection, ModelServingConnectionGenerator, Notice, Price, Rankings, RateLimits, Reasoning, Retirement, SourceLink, Status, Type, WorkspaceCacheOptions, WorkspaceCacheStore, WorkspaceCatalogCache, WorkspaceEndpointCapabilities, WorkspaceEndpointSource, WorkspaceModelProfile, WorkspaceRefresh, WorkspaceRefreshStatus, } from "./browser.js";
35
+ export { CatalogAveragePriceSchema, CatalogCapabilitiesSchema, CatalogLatencySchema, CatalogModelRecordSchema, CatalogModelSchema, CatalogPreferenceRankingSchema, CatalogPriceSchema, CatalogRankingSchema, CatalogRateLimitsSchema, CatalogScoreRankingSchema, CatalogSearchIndexSchema, CatalogStatusSchema, EFFECTIVE_CATALOG_CONTRACT_VERSION, EffectiveModelCatalogSchema, ModelCatalogSchema, PUBLISHED_CATALOG_DATABASE_URL, PUBLISHED_CATALOG_INDEX_URL, PUBLISHED_CATALOG_ROOT_URL, PUBLISHED_CATALOG_SCHEMA_URL, PUBLISHED_CATALOG_SCHEMA_VERSION, PUBLISHED_CATALOG_SEARCH_INDEX_URL, PUBLISHED_CATALOG_URL, WorkspaceRefreshSchema, parseCatalogModelRecord, parseCatalogSearchIndex, parseEffectiveModelCatalog, parseModelCatalog, } from "./browser.js";