@shop-os/modelkit 0.2.7 → 0.2.9

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.
@@ -37,6 +37,9 @@ interface UpscaleOptions {
37
37
  }
38
38
  type ModelType = "text" | "image" | "video" | "audio" | "upscale" | "bg-remove";
39
39
  type Lifecycle = "active" | "deprecated" | "retired";
40
+ type Surface = "cowork" | "space_builder";
41
+ /** @deprecated use Surface[] */
42
+ type Exposure = Surface[];
40
43
  type AdapterId = "ai-sdk-text" | "google-image" | "openai-image" | "google-genai" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "xai-video";
41
44
  /** Gemini image safety threshold, per category, sent only when the caller opts in. */
42
45
  type ImageSafetySetting = {
@@ -257,10 +260,12 @@ interface CatalogModel {
257
260
  lifecycle: Lifecycle;
258
261
  replacedBy?: string;
259
262
  /**
260
- * "catalog" = offered in product pickers (Creative Studio, chat, Space Builder);
261
- * "internal" = callable by id only.
263
+ * Surfaces the row is listed on: "cowork" = listed in Cowork pickers
264
+ * (Creative Studio, chat); "space_builder" = listed in Space Builder
265
+ * pickers; [] = hidden from every picker, callable by id (the old
266
+ * "internal"); ["cowork", "space_builder"] = the old "catalog".
262
267
  */
263
- exposure: "catalog" | "internal";
268
+ exposure: Surface[];
264
269
  constraints: ModelConstraints;
265
270
  defaults: Partial<Omit<ImageRequest, "model" | "prompt"> & Omit<VideoRequest, "model" | "prompt"> & Omit<AudioRequest, "model" | "prompt">>;
266
271
  /** Provider options merged under the caller's on every call. Chat-only tuning belongs in display.chat. */
@@ -436,10 +441,22 @@ declare class Catalog {
436
441
  declare function compareCatalogOrder(a: CatalogModel, b: CatalogModel): number;
437
442
  declare function sortCatalogRows<T extends CatalogModel>(rows: readonly T[]): T[];
438
443
 
444
+ declare function normalizeExposure(value: unknown): unknown;
445
+ /** True when an active row is listed on `surface`. */
446
+ declare function isListedOn(row: CatalogModel, surface: Surface): boolean;
447
+ /** True when an active row is listed on at least one surface. */
448
+ declare function isListed(row: CatalogModel): boolean;
449
+
439
450
  /** Seeded from Cowork, Space Builder and trigger-workflows. See catalog/*.ts. */
440
451
  declare const MODELS: CatalogModel[];
441
452
 
442
453
  declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-image", "google-genai", "ark", "fal", "replicate", "prodia", "higgsfield", "xai-video"];
454
+ declare const SurfaceSchema: z.ZodEnum<{
455
+ cowork: "cowork";
456
+ space_builder: "space_builder";
457
+ }>;
458
+ declare const SURFACES: ("cowork" | "space_builder")[];
459
+ declare const ExposureSchema: z.ZodType<Surface[], unknown>;
443
460
  declare const CatalogModelSchema: z.ZodType<CatalogModel>;
444
461
  declare const CatalogSchema: z.ZodType<CatalogModel[]>;
445
462
 
@@ -545,4 +562,4 @@ declare function isModelKitError(err: unknown): err is ModelKitError;
545
562
  /** Resolve caller options against a catalog row, dispatching on `model.type`. */
546
563
  declare function resolveOptions(model: CatalogModel, request: ImageRequest | VideoRequest | AudioRequest, onUnsupported?: OnUnsupported): ResolveResult<ImageRequest | VideoRequest | AudioRequest>;
547
564
 
548
- export { ADAPTER_IDS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, type CatalogOrigin, CatalogSchema, type CatalogSource, type GeneratedImage, IMAGE_MODELS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type ResolveResult, type Routing, type SupportedOption, TEXT_MODELS, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, compareCatalogOrder, isModelKitError, liveCatalog, liveState, nearestAspectRatio, primeCatalog, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveOptions, resolveVideoOptions, sortCatalogRows };
565
+ export { ADAPTER_IDS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, type CatalogOrigin, CatalogSchema, type CatalogSource, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, compareCatalogOrder, isListed, isListedOn, isModelKitError, liveCatalog, liveState, nearestAspectRatio, normalizeExposure, primeCatalog, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveOptions, resolveVideoOptions, sortCatalogRows };
package/dist/catalog.d.ts CHANGED
@@ -37,6 +37,9 @@ interface UpscaleOptions {
37
37
  }
38
38
  type ModelType = "text" | "image" | "video" | "audio" | "upscale" | "bg-remove";
39
39
  type Lifecycle = "active" | "deprecated" | "retired";
40
+ type Surface = "cowork" | "space_builder";
41
+ /** @deprecated use Surface[] */
42
+ type Exposure = Surface[];
40
43
  type AdapterId = "ai-sdk-text" | "google-image" | "openai-image" | "google-genai" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "xai-video";
41
44
  /** Gemini image safety threshold, per category, sent only when the caller opts in. */
42
45
  type ImageSafetySetting = {
@@ -257,10 +260,12 @@ interface CatalogModel {
257
260
  lifecycle: Lifecycle;
258
261
  replacedBy?: string;
259
262
  /**
260
- * "catalog" = offered in product pickers (Creative Studio, chat, Space Builder);
261
- * "internal" = callable by id only.
263
+ * Surfaces the row is listed on: "cowork" = listed in Cowork pickers
264
+ * (Creative Studio, chat); "space_builder" = listed in Space Builder
265
+ * pickers; [] = hidden from every picker, callable by id (the old
266
+ * "internal"); ["cowork", "space_builder"] = the old "catalog".
262
267
  */
263
- exposure: "catalog" | "internal";
268
+ exposure: Surface[];
264
269
  constraints: ModelConstraints;
265
270
  defaults: Partial<Omit<ImageRequest, "model" | "prompt"> & Omit<VideoRequest, "model" | "prompt"> & Omit<AudioRequest, "model" | "prompt">>;
266
271
  /** Provider options merged under the caller's on every call. Chat-only tuning belongs in display.chat. */
@@ -436,10 +441,22 @@ declare class Catalog {
436
441
  declare function compareCatalogOrder(a: CatalogModel, b: CatalogModel): number;
437
442
  declare function sortCatalogRows<T extends CatalogModel>(rows: readonly T[]): T[];
438
443
 
444
+ declare function normalizeExposure(value: unknown): unknown;
445
+ /** True when an active row is listed on `surface`. */
446
+ declare function isListedOn(row: CatalogModel, surface: Surface): boolean;
447
+ /** True when an active row is listed on at least one surface. */
448
+ declare function isListed(row: CatalogModel): boolean;
449
+
439
450
  /** Seeded from Cowork, Space Builder and trigger-workflows. See catalog/*.ts. */
440
451
  declare const MODELS: CatalogModel[];
441
452
 
442
453
  declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-image", "google-genai", "ark", "fal", "replicate", "prodia", "higgsfield", "xai-video"];
454
+ declare const SurfaceSchema: z.ZodEnum<{
455
+ cowork: "cowork";
456
+ space_builder: "space_builder";
457
+ }>;
458
+ declare const SURFACES: ("cowork" | "space_builder")[];
459
+ declare const ExposureSchema: z.ZodType<Surface[], unknown>;
443
460
  declare const CatalogModelSchema: z.ZodType<CatalogModel>;
444
461
  declare const CatalogSchema: z.ZodType<CatalogModel[]>;
445
462
 
@@ -545,4 +562,4 @@ declare function isModelKitError(err: unknown): err is ModelKitError;
545
562
  /** Resolve caller options against a catalog row, dispatching on `model.type`. */
546
563
  declare function resolveOptions(model: CatalogModel, request: ImageRequest | VideoRequest | AudioRequest, onUnsupported?: OnUnsupported): ResolveResult<ImageRequest | VideoRequest | AudioRequest>;
547
564
 
548
- export { ADAPTER_IDS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, type CatalogOrigin, CatalogSchema, type CatalogSource, type GeneratedImage, IMAGE_MODELS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type ResolveResult, type Routing, type SupportedOption, TEXT_MODELS, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, compareCatalogOrder, isModelKitError, liveCatalog, liveState, nearestAspectRatio, primeCatalog, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveOptions, resolveVideoOptions, sortCatalogRows };
565
+ export { ADAPTER_IDS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, type CatalogOrigin, CatalogSchema, type CatalogSource, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type ReferenceLimits, type RequiredInput, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, compareCatalogOrder, isListed, isListedOn, isModelKitError, liveCatalog, liveState, nearestAspectRatio, normalizeExposure, primeCatalog, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveOptions, resolveVideoOptions, sortCatalogRows };