@shop-os/modelkit 0.2.0 → 0.2.3

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
@@ -222,8 +222,9 @@ interface CatalogDisplay {
222
222
  /** Chat picker highlight flag. */
223
223
  recommended?: boolean;
224
224
  /**
225
- * Picker position: lower comes first; rows without one keep catalog order
226
- * after the ordered ones. Set it to surface a new model at the top.
225
+ * Picker position: higher comes first; rows without one keep catalog order
226
+ * after the ordered ones. Give a new model the next number up to surface
227
+ * it at the top.
227
228
  */
228
229
  sortOrder?: number;
229
230
  /**
@@ -456,6 +457,23 @@ declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-imag
456
457
  declare const CatalogModelSchema: z.ZodType<CatalogModel>;
457
458
  declare const CatalogSchema: z.ZodType<CatalogModel[]>;
458
459
 
460
+ type CatalogOrigin = "remote" | "last-good" | "snapshot";
461
+ interface PrimeCatalogResult {
462
+ origin: CatalogOrigin;
463
+ rowCount: number;
464
+ revision?: string;
465
+ error?: string;
466
+ }
467
+ interface LiveCatalogState {
468
+ catalog: Catalog;
469
+ memo: Promise<PrimeCatalogResult> | undefined;
470
+ timer: (ReturnType<typeof setInterval> & {
471
+ unref?: () => void;
472
+ }) | undefined;
473
+ revision: string | undefined;
474
+ origin: CatalogOrigin;
475
+ }
476
+ declare const liveState: LiveCatalogState;
459
477
  declare const liveCatalog: Catalog;
460
478
 
461
479
  interface CatalogCache {
@@ -477,16 +495,14 @@ interface CatalogSource {
477
495
  fetch?: typeof fetch;
478
496
  logger?: Pick<Console, "debug" | "info" | "warn" | "error">;
479
497
  }
480
- type CatalogOrigin = "remote" | "last-good" | "snapshot";
481
- interface PrimeCatalogResult {
482
- origin: CatalogOrigin;
483
- rowCount: number;
498
+
499
+ interface CatalogEnvelope {
500
+ rows: CatalogModel[];
484
501
  revision?: string;
485
- error?: string;
486
502
  }
487
503
  /** Fetch, validate, swap into liveCatalog. Never throws. Second call returns the same promise. */
488
504
  declare function primeCatalog(source: CatalogSource): Promise<PrimeCatalogResult>;
489
- /** Test seam: stop the refresh timer and reset liveCatalog to MODELS and clear the memo. */
505
+ /** Test seam: stop the refresh timer, reset liveCatalog to MODELS and clear the memo. */
490
506
  declare function resetLiveCatalog(): void;
491
507
 
492
508
  declare function fileCatalogCache(path: string): CatalogCache;
@@ -732,4 +748,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
732
748
  /** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
733
749
  declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
734
750
 
735
- 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 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, 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, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, liveCatalog, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
751
+ 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, 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, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
package/dist/index.d.ts CHANGED
@@ -222,8 +222,9 @@ interface CatalogDisplay {
222
222
  /** Chat picker highlight flag. */
223
223
  recommended?: boolean;
224
224
  /**
225
- * Picker position: lower comes first; rows without one keep catalog order
226
- * after the ordered ones. Set it to surface a new model at the top.
225
+ * Picker position: higher comes first; rows without one keep catalog order
226
+ * after the ordered ones. Give a new model the next number up to surface
227
+ * it at the top.
227
228
  */
228
229
  sortOrder?: number;
229
230
  /**
@@ -456,6 +457,23 @@ declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-imag
456
457
  declare const CatalogModelSchema: z.ZodType<CatalogModel>;
457
458
  declare const CatalogSchema: z.ZodType<CatalogModel[]>;
458
459
 
460
+ type CatalogOrigin = "remote" | "last-good" | "snapshot";
461
+ interface PrimeCatalogResult {
462
+ origin: CatalogOrigin;
463
+ rowCount: number;
464
+ revision?: string;
465
+ error?: string;
466
+ }
467
+ interface LiveCatalogState {
468
+ catalog: Catalog;
469
+ memo: Promise<PrimeCatalogResult> | undefined;
470
+ timer: (ReturnType<typeof setInterval> & {
471
+ unref?: () => void;
472
+ }) | undefined;
473
+ revision: string | undefined;
474
+ origin: CatalogOrigin;
475
+ }
476
+ declare const liveState: LiveCatalogState;
459
477
  declare const liveCatalog: Catalog;
460
478
 
461
479
  interface CatalogCache {
@@ -477,16 +495,14 @@ interface CatalogSource {
477
495
  fetch?: typeof fetch;
478
496
  logger?: Pick<Console, "debug" | "info" | "warn" | "error">;
479
497
  }
480
- type CatalogOrigin = "remote" | "last-good" | "snapshot";
481
- interface PrimeCatalogResult {
482
- origin: CatalogOrigin;
483
- rowCount: number;
498
+
499
+ interface CatalogEnvelope {
500
+ rows: CatalogModel[];
484
501
  revision?: string;
485
- error?: string;
486
502
  }
487
503
  /** Fetch, validate, swap into liveCatalog. Never throws. Second call returns the same promise. */
488
504
  declare function primeCatalog(source: CatalogSource): Promise<PrimeCatalogResult>;
489
- /** Test seam: stop the refresh timer and reset liveCatalog to MODELS and clear the memo. */
505
+ /** Test seam: stop the refresh timer, reset liveCatalog to MODELS and clear the memo. */
490
506
  declare function resetLiveCatalog(): void;
491
507
 
492
508
  declare function fileCatalogCache(path: string): CatalogCache;
@@ -732,4 +748,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
732
748
  /** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
733
749
  declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
734
750
 
735
- 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 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, 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, createDefaultModelKit, createModelKit, describe, describeThrown, generateImage as experimental_generateImage, falAdapter, fileCatalogCache, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, liveCatalog, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, primeCatalog, prodiaAdapter, readErrorBody, replicateAdapter, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
751
+ 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, 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, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };