@shop-os/modelkit 0.2.8 → 0.2.10

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 = {
@@ -103,6 +106,8 @@ interface VideoRequest {
103
106
  watermark?: boolean;
104
107
  /** Provider-side safety checker toggle (fal MiniMax). Provider default when unset. */
105
108
  safetyChecker?: boolean;
109
+ /** Seedance omni-reference subtask hint. `edit` forces duration -1 and adaptive ratio. */
110
+ taskType?: "reference" | "edit" | "extend";
106
111
  mode?: "standard" | "pro";
107
112
  }
108
113
  /**
@@ -154,9 +159,11 @@ interface MediaPart {
154
159
  cleanup?: () => Promise<void>;
155
160
  }
156
161
  type RequiredInput = "firstFrame" | "sourceVideo" | "references";
157
- type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "safetySettings" | "temperature" | "upscale" | "watermark" | "safetyChecker" | "instrumental";
162
+ type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "safetySettings" | "temperature" | "upscale" | "watermark" | "safetyChecker" | "taskType" | "instrumental";
158
163
  interface ReferenceLimits {
159
164
  images?: number;
165
+ /** Lower image cap when a reference video is also sent (Kling V3 Omni: 7 → 4). */
166
+ imagesWithVideo?: number;
160
167
  videos?: number;
161
168
  audios?: number;
162
169
  total?: number;
@@ -260,10 +267,12 @@ interface CatalogModel {
260
267
  lifecycle: Lifecycle;
261
268
  replacedBy?: string;
262
269
  /**
263
- * "catalog" = offered in product pickers (Creative Studio, chat, Space Builder);
264
- * "internal" = callable by id only.
270
+ * Surfaces the row is listed on: "cowork" = listed in Cowork pickers
271
+ * (Creative Studio, chat); "space_builder" = listed in Space Builder
272
+ * pickers; [] = hidden from every picker, callable by id (the old
273
+ * "internal"); ["cowork", "space_builder"] = the old "catalog".
265
274
  */
266
- exposure: "catalog" | "internal";
275
+ exposure: Surface[];
267
276
  constraints: ModelConstraints;
268
277
  defaults: Partial<Omit<ImageRequest, "model" | "prompt"> & Omit<VideoRequest, "model" | "prompt"> & Omit<AudioRequest, "model" | "prompt">>;
269
278
  /** Provider options merged under the caller's on every call. Chat-only tuning belongs in display.chat. */
@@ -463,10 +472,22 @@ declare class Catalog {
463
472
  declare function compareCatalogOrder(a: CatalogModel, b: CatalogModel): number;
464
473
  declare function sortCatalogRows<T extends CatalogModel>(rows: readonly T[]): T[];
465
474
 
475
+ declare function normalizeExposure(value: unknown): unknown;
476
+ /** True when an active row is listed on `surface`. */
477
+ declare function isListedOn(row: CatalogModel, surface: Surface): boolean;
478
+ /** True when an active row is listed on at least one surface. */
479
+ declare function isListed(row: CatalogModel): boolean;
480
+
466
481
  /** Seeded from Cowork, Space Builder and trigger-workflows. See catalog/*.ts. */
467
482
  declare const MODELS: CatalogModel[];
468
483
 
469
484
  declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-image", "google-genai", "ark", "fal", "replicate", "prodia", "higgsfield", "xai-video"];
485
+ declare const SurfaceSchema: z.ZodEnum<{
486
+ cowork: "cowork";
487
+ space_builder: "space_builder";
488
+ }>;
489
+ declare const SURFACES: ("cowork" | "space_builder")[];
490
+ declare const ExposureSchema: z.ZodType<Surface[], unknown>;
470
491
  declare const CatalogModelSchema: z.ZodType<CatalogModel>;
471
492
  declare const CatalogSchema: z.ZodType<CatalogModel[]>;
472
493
 
@@ -761,4 +782,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
761
782
  /** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
762
783
  declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
763
784
 
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 };
785
+ 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 = {
@@ -103,6 +106,8 @@ interface VideoRequest {
103
106
  watermark?: boolean;
104
107
  /** Provider-side safety checker toggle (fal MiniMax). Provider default when unset. */
105
108
  safetyChecker?: boolean;
109
+ /** Seedance omni-reference subtask hint. `edit` forces duration -1 and adaptive ratio. */
110
+ taskType?: "reference" | "edit" | "extend";
106
111
  mode?: "standard" | "pro";
107
112
  }
108
113
  /**
@@ -154,9 +159,11 @@ interface MediaPart {
154
159
  cleanup?: () => Promise<void>;
155
160
  }
156
161
  type RequiredInput = "firstFrame" | "sourceVideo" | "references";
157
- type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "safetySettings" | "temperature" | "upscale" | "watermark" | "safetyChecker" | "instrumental";
162
+ type SupportedOption = "seed" | "quality" | "negativePrompt" | "cfgScale" | "generateAudio" | "promptExpansion" | "lastFrame" | "count" | "outputFormat" | "scaleFactor" | "safetySettings" | "temperature" | "upscale" | "watermark" | "safetyChecker" | "taskType" | "instrumental";
158
163
  interface ReferenceLimits {
159
164
  images?: number;
165
+ /** Lower image cap when a reference video is also sent (Kling V3 Omni: 7 → 4). */
166
+ imagesWithVideo?: number;
160
167
  videos?: number;
161
168
  audios?: number;
162
169
  total?: number;
@@ -260,10 +267,12 @@ interface CatalogModel {
260
267
  lifecycle: Lifecycle;
261
268
  replacedBy?: string;
262
269
  /**
263
- * "catalog" = offered in product pickers (Creative Studio, chat, Space Builder);
264
- * "internal" = callable by id only.
270
+ * Surfaces the row is listed on: "cowork" = listed in Cowork pickers
271
+ * (Creative Studio, chat); "space_builder" = listed in Space Builder
272
+ * pickers; [] = hidden from every picker, callable by id (the old
273
+ * "internal"); ["cowork", "space_builder"] = the old "catalog".
265
274
  */
266
- exposure: "catalog" | "internal";
275
+ exposure: Surface[];
267
276
  constraints: ModelConstraints;
268
277
  defaults: Partial<Omit<ImageRequest, "model" | "prompt"> & Omit<VideoRequest, "model" | "prompt"> & Omit<AudioRequest, "model" | "prompt">>;
269
278
  /** Provider options merged under the caller's on every call. Chat-only tuning belongs in display.chat. */
@@ -463,10 +472,22 @@ declare class Catalog {
463
472
  declare function compareCatalogOrder(a: CatalogModel, b: CatalogModel): number;
464
473
  declare function sortCatalogRows<T extends CatalogModel>(rows: readonly T[]): T[];
465
474
 
475
+ declare function normalizeExposure(value: unknown): unknown;
476
+ /** True when an active row is listed on `surface`. */
477
+ declare function isListedOn(row: CatalogModel, surface: Surface): boolean;
478
+ /** True when an active row is listed on at least one surface. */
479
+ declare function isListed(row: CatalogModel): boolean;
480
+
466
481
  /** Seeded from Cowork, Space Builder and trigger-workflows. See catalog/*.ts. */
467
482
  declare const MODELS: CatalogModel[];
468
483
 
469
484
  declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-image", "google-genai", "ark", "fal", "replicate", "prodia", "higgsfield", "xai-video"];
485
+ declare const SurfaceSchema: z.ZodEnum<{
486
+ cowork: "cowork";
487
+ space_builder: "space_builder";
488
+ }>;
489
+ declare const SURFACES: ("cowork" | "space_builder")[];
490
+ declare const ExposureSchema: z.ZodType<Surface[], unknown>;
470
491
  declare const CatalogModelSchema: z.ZodType<CatalogModel>;
471
492
  declare const CatalogSchema: z.ZodType<CatalogModel[]>;
472
493
 
@@ -761,4 +782,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
761
782
  /** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
762
783
  declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
763
784
 
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 };
785
+ 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 };