@shop-os/modelkit 0.2.8 → 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.
package/dist/index.d.cts CHANGED
@@ -40,6 +40,9 @@ interface UpscaleOptions {
40
40
  }
41
41
  type ModelType = "text" | "image" | "video" | "audio" | "upscale" | "bg-remove";
42
42
  type Lifecycle = "active" | "deprecated" | "retired";
43
+ type Surface = "cowork" | "space_builder";
44
+ /** @deprecated use Surface[] */
45
+ type Exposure = Surface[];
43
46
  type AdapterId = "ai-sdk-text" | "google-image" | "openai-image" | "google-genai" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "xai-video";
44
47
  /** Gemini image safety threshold, per category, sent only when the caller opts in. */
45
48
  type ImageSafetySetting = {
@@ -260,10 +263,12 @@ interface CatalogModel {
260
263
  lifecycle: Lifecycle;
261
264
  replacedBy?: string;
262
265
  /**
263
- * "catalog" = offered in product pickers (Creative Studio, chat, Space Builder);
264
- * "internal" = callable by id only.
266
+ * Surfaces the row is listed on: "cowork" = listed in Cowork pickers
267
+ * (Creative Studio, chat); "space_builder" = listed in Space Builder
268
+ * pickers; [] = hidden from every picker, callable by id (the old
269
+ * "internal"); ["cowork", "space_builder"] = the old "catalog".
265
270
  */
266
- exposure: "catalog" | "internal";
271
+ exposure: Surface[];
267
272
  constraints: ModelConstraints;
268
273
  defaults: Partial<Omit<ImageRequest, "model" | "prompt"> & Omit<VideoRequest, "model" | "prompt"> & Omit<AudioRequest, "model" | "prompt">>;
269
274
  /** Provider options merged under the caller's on every call. Chat-only tuning belongs in display.chat. */
@@ -463,10 +468,22 @@ declare class Catalog {
463
468
  declare function compareCatalogOrder(a: CatalogModel, b: CatalogModel): number;
464
469
  declare function sortCatalogRows<T extends CatalogModel>(rows: readonly T[]): T[];
465
470
 
471
+ declare function normalizeExposure(value: unknown): unknown;
472
+ /** True when an active row is listed on `surface`. */
473
+ declare function isListedOn(row: CatalogModel, surface: Surface): boolean;
474
+ /** True when an active row is listed on at least one surface. */
475
+ declare function isListed(row: CatalogModel): boolean;
476
+
466
477
  /** Seeded from Cowork, Space Builder and trigger-workflows. See catalog/*.ts. */
467
478
  declare const MODELS: CatalogModel[];
468
479
 
469
480
  declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-image", "google-genai", "ark", "fal", "replicate", "prodia", "higgsfield", "xai-video"];
481
+ declare const SurfaceSchema: z.ZodEnum<{
482
+ cowork: "cowork";
483
+ space_builder: "space_builder";
484
+ }>;
485
+ declare const SURFACES: ("cowork" | "space_builder")[];
486
+ declare const ExposureSchema: z.ZodType<Surface[], unknown>;
470
487
  declare const CatalogModelSchema: z.ZodType<CatalogModel>;
471
488
  declare const CatalogSchema: z.ZodType<CatalogModel[]>;
472
489
 
@@ -761,4 +778,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
761
778
  /** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
762
779
  declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
763
780
 
764
- export { ADAPTER_IDS, ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, 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 CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, 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, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
781
+ export { ADAPTER_IDS, ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, 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 CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type Exposure, ExposureSchema, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, 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, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
package/dist/index.d.ts CHANGED
@@ -40,6 +40,9 @@ interface UpscaleOptions {
40
40
  }
41
41
  type ModelType = "text" | "image" | "video" | "audio" | "upscale" | "bg-remove";
42
42
  type Lifecycle = "active" | "deprecated" | "retired";
43
+ type Surface = "cowork" | "space_builder";
44
+ /** @deprecated use Surface[] */
45
+ type Exposure = Surface[];
43
46
  type AdapterId = "ai-sdk-text" | "google-image" | "openai-image" | "google-genai" | "ark" | "fal" | "replicate" | "prodia" | "higgsfield" | "xai-video";
44
47
  /** Gemini image safety threshold, per category, sent only when the caller opts in. */
45
48
  type ImageSafetySetting = {
@@ -260,10 +263,12 @@ interface CatalogModel {
260
263
  lifecycle: Lifecycle;
261
264
  replacedBy?: string;
262
265
  /**
263
- * "catalog" = offered in product pickers (Creative Studio, chat, Space Builder);
264
- * "internal" = callable by id only.
266
+ * Surfaces the row is listed on: "cowork" = listed in Cowork pickers
267
+ * (Creative Studio, chat); "space_builder" = listed in Space Builder
268
+ * pickers; [] = hidden from every picker, callable by id (the old
269
+ * "internal"); ["cowork", "space_builder"] = the old "catalog".
265
270
  */
266
- exposure: "catalog" | "internal";
271
+ exposure: Surface[];
267
272
  constraints: ModelConstraints;
268
273
  defaults: Partial<Omit<ImageRequest, "model" | "prompt"> & Omit<VideoRequest, "model" | "prompt"> & Omit<AudioRequest, "model" | "prompt">>;
269
274
  /** Provider options merged under the caller's on every call. Chat-only tuning belongs in display.chat. */
@@ -463,10 +468,22 @@ declare class Catalog {
463
468
  declare function compareCatalogOrder(a: CatalogModel, b: CatalogModel): number;
464
469
  declare function sortCatalogRows<T extends CatalogModel>(rows: readonly T[]): T[];
465
470
 
471
+ declare function normalizeExposure(value: unknown): unknown;
472
+ /** True when an active row is listed on `surface`. */
473
+ declare function isListedOn(row: CatalogModel, surface: Surface): boolean;
474
+ /** True when an active row is listed on at least one surface. */
475
+ declare function isListed(row: CatalogModel): boolean;
476
+
466
477
  /** Seeded from Cowork, Space Builder and trigger-workflows. See catalog/*.ts. */
467
478
  declare const MODELS: CatalogModel[];
468
479
 
469
480
  declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-image", "google-genai", "ark", "fal", "replicate", "prodia", "higgsfield", "xai-video"];
481
+ declare const SurfaceSchema: z.ZodEnum<{
482
+ cowork: "cowork";
483
+ space_builder: "space_builder";
484
+ }>;
485
+ declare const SURFACES: ("cowork" | "space_builder")[];
486
+ declare const ExposureSchema: z.ZodType<Surface[], unknown>;
470
487
  declare const CatalogModelSchema: z.ZodType<CatalogModel>;
471
488
  declare const CatalogSchema: z.ZodType<CatalogModel[]>;
472
489
 
@@ -761,4 +778,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
761
778
  /** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
762
779
  declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
763
780
 
764
- export { ADAPTER_IDS, ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, 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 CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, 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, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
781
+ export { ADAPTER_IDS, ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, 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 CatalogTextModel, DEFAULT_ADAPTERS, type DefaultObjectOutput, type Exposure, ExposureSchema, type GeneratedImage, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, JsonObjectSchema, type JsonPrimitive, type JsonValue, JsonValueSchema, type LanguageModelHandle, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKit, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, type ModelkitGenerateObjectOptions, type ModelkitGenerateTextOptions, type ModelkitStreamObjectOptions, type ModelkitStreamTextOptions, type ObjectOutput, type ObjectResult, 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, type TextMethods, type TextModelInstance, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type Warning, aiSdkTextAdapter, arkAdapter, aspectRatioToSize, classifyHttpError, compareCatalogOrder, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isListed, isListedOn, isModelKitError, keysFromEnv, languageModel, liveCatalog, liveState, mergeTextProviderOptions, nearestAspectRatio, normalizeExposure, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, sortCatalogRows, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };