@shop-os/modelkit 0.1.11 → 0.2.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.
- package/CHANGELOG.md +24 -3
- package/dist/catalog.cjs +395 -0
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +41 -1
- package/dist/catalog.d.ts +41 -1
- package/dist/catalog.js +395 -0
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +539 -116
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -2
- package/dist/index.d.ts +43 -2
- package/dist/index.js +532 -116
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ImageModel, experimental_generateVideo, generateText as generateText$1, LanguageModel, FlexibleSchema, InferSchema, ToolSet, Output, streamText as streamText$1, JSONValue, generateObject as generateObject$1, streamObject as streamObject$1, LanguageModelUsage } from 'ai';
|
|
2
2
|
export * from 'ai';
|
|
3
3
|
export { Warning as AiWarning } from 'ai';
|
|
4
|
-
import { LanguageModelV3, LanguageModelV2 } from '@ai-sdk/provider';
|
|
5
4
|
import { z } from 'zod';
|
|
5
|
+
import { LanguageModelV3, LanguageModelV2 } from '@ai-sdk/provider';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Canonical vocabulary shared by every adapter. Adapters translate these
|
|
@@ -445,11 +445,52 @@ declare class Catalog {
|
|
|
445
445
|
}): CatalogModel[];
|
|
446
446
|
/** Merge rows by id. Used for catalogOverride. */
|
|
447
447
|
withOverrides(rows: CatalogModel[]): Catalog;
|
|
448
|
+
/** Atomically swap every row. Builds the maps first so a bad batch throws before anything changes. */
|
|
449
|
+
replace(rows: CatalogModel[]): void;
|
|
448
450
|
}
|
|
449
451
|
|
|
450
452
|
/** Seeded from Cowork, Space Builder and trigger-workflows. See catalog/*.ts. */
|
|
451
453
|
declare const MODELS: CatalogModel[];
|
|
452
454
|
|
|
455
|
+
declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-image", "google-genai", "ark", "fal", "replicate", "prodia", "higgsfield", "xai-video"];
|
|
456
|
+
declare const CatalogModelSchema: z.ZodType<CatalogModel>;
|
|
457
|
+
declare const CatalogSchema: z.ZodType<CatalogModel[]>;
|
|
458
|
+
|
|
459
|
+
declare const liveCatalog: Catalog;
|
|
460
|
+
|
|
461
|
+
interface CatalogCache {
|
|
462
|
+
get(): Promise<string | null>;
|
|
463
|
+
set(json: string): Promise<void>;
|
|
464
|
+
}
|
|
465
|
+
type CatalogAuth = {
|
|
466
|
+
bearer: string;
|
|
467
|
+
} | {
|
|
468
|
+
apiKey: string;
|
|
469
|
+
};
|
|
470
|
+
interface CatalogSource {
|
|
471
|
+
baseUrl: string;
|
|
472
|
+
auth: CatalogAuth;
|
|
473
|
+
ttlMs?: number;
|
|
474
|
+
/** Abort a fetch after this many ms. Default 10 s. */
|
|
475
|
+
timeoutMs?: number;
|
|
476
|
+
cache?: CatalogCache;
|
|
477
|
+
fetch?: typeof fetch;
|
|
478
|
+
logger?: Pick<Console, "debug" | "info" | "warn" | "error">;
|
|
479
|
+
}
|
|
480
|
+
type CatalogOrigin = "remote" | "last-good" | "snapshot";
|
|
481
|
+
interface PrimeCatalogResult {
|
|
482
|
+
origin: CatalogOrigin;
|
|
483
|
+
rowCount: number;
|
|
484
|
+
revision?: string;
|
|
485
|
+
error?: string;
|
|
486
|
+
}
|
|
487
|
+
/** Fetch, validate, swap into liveCatalog. Never throws. Second call returns the same promise. */
|
|
488
|
+
declare function primeCatalog(source: CatalogSource): Promise<PrimeCatalogResult>;
|
|
489
|
+
/** Test seam: stop the refresh timer and reset liveCatalog to MODELS and clear the memo. */
|
|
490
|
+
declare function resetLiveCatalog(): void;
|
|
491
|
+
|
|
492
|
+
declare function fileCatalogCache(path: string): CatalogCache;
|
|
493
|
+
|
|
453
494
|
type OnUnsupported = "error" | "coerce";
|
|
454
495
|
interface ResolveResult<T> {
|
|
455
496
|
request: T;
|
|
@@ -691,4 +732,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
|
|
|
691
732
|
/** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
|
|
692
733
|
declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
|
|
693
734
|
|
|
694
|
-
export { ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogCapabilities, type CatalogDisplay, type CatalogModel, 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 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, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, prodiaAdapter, readErrorBody, replicateAdapter, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ImageModel, experimental_generateVideo, generateText as generateText$1, LanguageModel, FlexibleSchema, InferSchema, ToolSet, Output, streamText as streamText$1, JSONValue, generateObject as generateObject$1, streamObject as streamObject$1, LanguageModelUsage } from 'ai';
|
|
2
2
|
export * from 'ai';
|
|
3
3
|
export { Warning as AiWarning } from 'ai';
|
|
4
|
-
import { LanguageModelV3, LanguageModelV2 } from '@ai-sdk/provider';
|
|
5
4
|
import { z } from 'zod';
|
|
5
|
+
import { LanguageModelV3, LanguageModelV2 } from '@ai-sdk/provider';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Canonical vocabulary shared by every adapter. Adapters translate these
|
|
@@ -445,11 +445,52 @@ declare class Catalog {
|
|
|
445
445
|
}): CatalogModel[];
|
|
446
446
|
/** Merge rows by id. Used for catalogOverride. */
|
|
447
447
|
withOverrides(rows: CatalogModel[]): Catalog;
|
|
448
|
+
/** Atomically swap every row. Builds the maps first so a bad batch throws before anything changes. */
|
|
449
|
+
replace(rows: CatalogModel[]): void;
|
|
448
450
|
}
|
|
449
451
|
|
|
450
452
|
/** Seeded from Cowork, Space Builder and trigger-workflows. See catalog/*.ts. */
|
|
451
453
|
declare const MODELS: CatalogModel[];
|
|
452
454
|
|
|
455
|
+
declare const ADAPTER_IDS: readonly ["ai-sdk-text", "google-image", "openai-image", "google-genai", "ark", "fal", "replicate", "prodia", "higgsfield", "xai-video"];
|
|
456
|
+
declare const CatalogModelSchema: z.ZodType<CatalogModel>;
|
|
457
|
+
declare const CatalogSchema: z.ZodType<CatalogModel[]>;
|
|
458
|
+
|
|
459
|
+
declare const liveCatalog: Catalog;
|
|
460
|
+
|
|
461
|
+
interface CatalogCache {
|
|
462
|
+
get(): Promise<string | null>;
|
|
463
|
+
set(json: string): Promise<void>;
|
|
464
|
+
}
|
|
465
|
+
type CatalogAuth = {
|
|
466
|
+
bearer: string;
|
|
467
|
+
} | {
|
|
468
|
+
apiKey: string;
|
|
469
|
+
};
|
|
470
|
+
interface CatalogSource {
|
|
471
|
+
baseUrl: string;
|
|
472
|
+
auth: CatalogAuth;
|
|
473
|
+
ttlMs?: number;
|
|
474
|
+
/** Abort a fetch after this many ms. Default 10 s. */
|
|
475
|
+
timeoutMs?: number;
|
|
476
|
+
cache?: CatalogCache;
|
|
477
|
+
fetch?: typeof fetch;
|
|
478
|
+
logger?: Pick<Console, "debug" | "info" | "warn" | "error">;
|
|
479
|
+
}
|
|
480
|
+
type CatalogOrigin = "remote" | "last-good" | "snapshot";
|
|
481
|
+
interface PrimeCatalogResult {
|
|
482
|
+
origin: CatalogOrigin;
|
|
483
|
+
rowCount: number;
|
|
484
|
+
revision?: string;
|
|
485
|
+
error?: string;
|
|
486
|
+
}
|
|
487
|
+
/** Fetch, validate, swap into liveCatalog. Never throws. Second call returns the same promise. */
|
|
488
|
+
declare function primeCatalog(source: CatalogSource): Promise<PrimeCatalogResult>;
|
|
489
|
+
/** Test seam: stop the refresh timer and reset liveCatalog to MODELS and clear the memo. */
|
|
490
|
+
declare function resetLiveCatalog(): void;
|
|
491
|
+
|
|
492
|
+
declare function fileCatalogCache(path: string): CatalogCache;
|
|
493
|
+
|
|
453
494
|
type OnUnsupported = "error" | "coerce";
|
|
454
495
|
interface ResolveResult<T> {
|
|
455
496
|
request: T;
|
|
@@ -691,4 +732,4 @@ declare function describeThrown(cause: unknown): ThrownErrorInfo;
|
|
|
691
732
|
/** Add the AI SDK `GeneratedFile` accessors to adapter image bytes. base64 is computed on first read. */
|
|
692
733
|
declare function toGeneratedImage(image: ImageBytes): GeneratedImage;
|
|
693
734
|
|
|
694
|
-
export { ADAPTER_KEYS, type Adapter, type AdapterContext, type AdapterEndpoints, type AdapterId, type AdapterRegistry, type AiTextProviderOptions, type AspectRatio, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogCapabilities, type CatalogDisplay, type CatalogModel, 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 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, generateAudio, generateImage, generateObject, generateText, generateVideo, googleGenaiAdapter, googleImageAdapter, higgsfieldAdapter, isModelKitError, keysFromEnv, languageModel, mergeTextProviderOptions, nearestAspectRatio, openaiImageAdapter, passthroughTextModel, pollUntil, prepareMediaPart, prodiaAdapter, readErrorBody, replicateAdapter, resolveAudioOptions, resolveImageOptions, resolveKeys, resolveVideoOptions, shouldRetry, sleep, streamObject, streamText, textUsageEvent, toGeneratedImage, withRetry, xaiVideoAdapter };
|
|
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 };
|