@shop-os/modelkit 0.2.24 → 0.2.26
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 +14 -0
- package/README.md +6 -3
- package/dist/catalog.cjs +18 -2
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +6 -3
- package/dist/catalog.d.ts +6 -3
- package/dist/catalog.js +18 -2
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +54 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -7
- package/dist/index.d.ts +14 -7
- package/dist/index.js +52 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/catalog.d.cts
CHANGED
|
@@ -437,6 +437,8 @@ type ProviderKeys = Partial<Record<ProviderKeyName, string>> & {
|
|
|
437
437
|
}>;
|
|
438
438
|
};
|
|
439
439
|
};
|
|
440
|
+
/** Which key set a call uses. Enterprise falls back to pro; sloosh never falls back. */
|
|
441
|
+
type KeyTier = "pro" | "enterprise" | "sloosh";
|
|
440
442
|
/** Key names a call can require, including the Bedrock credentials object. */
|
|
441
443
|
type RequiredKeyName = ProviderKeyName | "aws";
|
|
442
444
|
/** True when region is set AND (apiKey OR credentialProvider OR both static keys). */
|
|
@@ -468,6 +470,7 @@ interface ModelKitConfig {
|
|
|
468
470
|
keys: {
|
|
469
471
|
pro: ProviderKeys;
|
|
470
472
|
enterprise?: ProviderKeys;
|
|
473
|
+
sloosh?: ProviderKeys;
|
|
471
474
|
};
|
|
472
475
|
routing?: Routing;
|
|
473
476
|
/** Provider base-url overrides; unset entries use each adapter's documented default. */
|
|
@@ -480,8 +483,8 @@ interface ModelKitConfig {
|
|
|
480
483
|
logger?: Pick<Console, "debug" | "info" | "warn" | "error">;
|
|
481
484
|
}
|
|
482
485
|
interface CallContext {
|
|
483
|
-
/** "enterprise" picks keys.enterprise when every key for the provider is set, else falls back to pro. */
|
|
484
|
-
tier?:
|
|
486
|
+
/** "enterprise" picks keys.enterprise when every key for the provider is set, else falls back to pro. "sloosh" uses keys.sloosh only and never falls back. */
|
|
487
|
+
tier?: KeyTier;
|
|
485
488
|
signal?: AbortSignal;
|
|
486
489
|
/** Media retries after the initial request. Set 0 when a durable host owns recovery.
|
|
487
490
|
* Unset preserves adapter defaults. Successful pending-job polls are not retries.
|
|
@@ -992,4 +995,4 @@ declare function isModelKitError(err: unknown): err is ModelKitError;
|
|
|
992
995
|
/** Resolve caller options against a catalog row, dispatching on `model.type`. */
|
|
993
996
|
declare function resolveOptions(model: CatalogModel, request: ImageRequest | VideoRequest | AudioRequest, onUnsupported?: OnUnsupported): ResolveResult<ImageRequest | VideoRequest | AudioRequest>;
|
|
994
997
|
|
|
995
|
-
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioOutput, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, 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 PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, 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 VideoSecondsLimits, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, nearestAspectRatio, normalizeExposure, outputAudio, primeCatalog, promptConventions, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveOptions, resolveVideoOptions, sortCatalogRows, videoLengthViolation };
|
|
998
|
+
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioOutput, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, 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 KeyTier, 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 PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, 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 VideoSecondsLimits, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, nearestAspectRatio, normalizeExposure, outputAudio, primeCatalog, promptConventions, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveOptions, resolveVideoOptions, sortCatalogRows, videoLengthViolation };
|
package/dist/catalog.d.ts
CHANGED
|
@@ -437,6 +437,8 @@ type ProviderKeys = Partial<Record<ProviderKeyName, string>> & {
|
|
|
437
437
|
}>;
|
|
438
438
|
};
|
|
439
439
|
};
|
|
440
|
+
/** Which key set a call uses. Enterprise falls back to pro; sloosh never falls back. */
|
|
441
|
+
type KeyTier = "pro" | "enterprise" | "sloosh";
|
|
440
442
|
/** Key names a call can require, including the Bedrock credentials object. */
|
|
441
443
|
type RequiredKeyName = ProviderKeyName | "aws";
|
|
442
444
|
/** True when region is set AND (apiKey OR credentialProvider OR both static keys). */
|
|
@@ -468,6 +470,7 @@ interface ModelKitConfig {
|
|
|
468
470
|
keys: {
|
|
469
471
|
pro: ProviderKeys;
|
|
470
472
|
enterprise?: ProviderKeys;
|
|
473
|
+
sloosh?: ProviderKeys;
|
|
471
474
|
};
|
|
472
475
|
routing?: Routing;
|
|
473
476
|
/** Provider base-url overrides; unset entries use each adapter's documented default. */
|
|
@@ -480,8 +483,8 @@ interface ModelKitConfig {
|
|
|
480
483
|
logger?: Pick<Console, "debug" | "info" | "warn" | "error">;
|
|
481
484
|
}
|
|
482
485
|
interface CallContext {
|
|
483
|
-
/** "enterprise" picks keys.enterprise when every key for the provider is set, else falls back to pro. */
|
|
484
|
-
tier?:
|
|
486
|
+
/** "enterprise" picks keys.enterprise when every key for the provider is set, else falls back to pro. "sloosh" uses keys.sloosh only and never falls back. */
|
|
487
|
+
tier?: KeyTier;
|
|
485
488
|
signal?: AbortSignal;
|
|
486
489
|
/** Media retries after the initial request. Set 0 when a durable host owns recovery.
|
|
487
490
|
* Unset preserves adapter defaults. Successful pending-job polls are not retries.
|
|
@@ -992,4 +995,4 @@ declare function isModelKitError(err: unknown): err is ModelKitError;
|
|
|
992
995
|
/** Resolve caller options against a catalog row, dispatching on `model.type`. */
|
|
993
996
|
declare function resolveOptions(model: CatalogModel, request: ImageRequest | VideoRequest | AudioRequest, onUnsupported?: OnUnsupported): ResolveResult<ImageRequest | VideoRequest | AudioRequest>;
|
|
994
997
|
|
|
995
|
-
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioOutput, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, 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 PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, 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 VideoSecondsLimits, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, nearestAspectRatio, normalizeExposure, outputAudio, primeCatalog, promptConventions, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveOptions, resolveVideoOptions, sortCatalogRows, videoLengthViolation };
|
|
998
|
+
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioOutput, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, 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 KeyTier, 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 PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, 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 VideoSecondsLimits, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, nearestAspectRatio, normalizeExposure, outputAudio, primeCatalog, promptConventions, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveOptions, resolveVideoOptions, sortCatalogRows, videoLengthViolation };
|
package/dist/catalog.js
CHANGED
|
@@ -2094,6 +2094,14 @@ var VIDEO_INPUT_SPEC_KEYS = [
|
|
|
2094
2094
|
"promptExpansion",
|
|
2095
2095
|
"referenceImages"
|
|
2096
2096
|
];
|
|
2097
|
+
var IMAGE_INPUT_SPEC_KEYS = [
|
|
2098
|
+
"prompt",
|
|
2099
|
+
"references",
|
|
2100
|
+
"aspectRatio",
|
|
2101
|
+
"size",
|
|
2102
|
+
"outputFormat",
|
|
2103
|
+
"seed"
|
|
2104
|
+
];
|
|
2097
2105
|
var AUDIO_INPUT_SPEC_KEYS = [
|
|
2098
2106
|
"prompt",
|
|
2099
2107
|
"durationSeconds",
|
|
@@ -2110,14 +2118,22 @@ var INPUT_SPEC_SUPPORTS_KEYS = [
|
|
|
2110
2118
|
"generateAudio",
|
|
2111
2119
|
"cfgScale",
|
|
2112
2120
|
"promptExpansion",
|
|
2121
|
+
"outputFormat",
|
|
2113
2122
|
"instrumental"
|
|
2114
2123
|
];
|
|
2115
2124
|
var VIDEO_KEY_SET = new Set(VIDEO_INPUT_SPEC_KEYS);
|
|
2125
|
+
var IMAGE_KEY_SET = new Set(IMAGE_INPUT_SPEC_KEYS);
|
|
2116
2126
|
var AUDIO_KEY_SET = new Set(AUDIO_INPUT_SPEC_KEYS);
|
|
2117
2127
|
var ALL_KEY_SET = /* @__PURE__ */ new Set([
|
|
2118
2128
|
...VIDEO_INPUT_SPEC_KEYS,
|
|
2129
|
+
...IMAGE_INPUT_SPEC_KEYS,
|
|
2119
2130
|
...AUDIO_INPUT_SPEC_KEYS
|
|
2120
2131
|
]);
|
|
2132
|
+
var ALLOWED_KEYS_BY_TYPE = /* @__PURE__ */ new Map([
|
|
2133
|
+
["video", VIDEO_KEY_SET],
|
|
2134
|
+
["image", IMAGE_KEY_SET],
|
|
2135
|
+
["audio", AUDIO_KEY_SET]
|
|
2136
|
+
]);
|
|
2121
2137
|
var ProviderScalarSchema = z2.union([z2.string(), z2.number(), z2.boolean()]);
|
|
2122
2138
|
var FieldsSchema = z2.record(z2.string(), z2.string().min(1)).superRefine((fields, ctx) => {
|
|
2123
2139
|
const keys = Object.keys(fields);
|
|
@@ -2183,13 +2199,13 @@ function validateInputSpec(raw, row) {
|
|
|
2183
2199
|
};
|
|
2184
2200
|
}
|
|
2185
2201
|
const issues = [];
|
|
2186
|
-
|
|
2202
|
+
const allowed = ALLOWED_KEYS_BY_TYPE.get(row.type);
|
|
2203
|
+
if (allowed === void 0) {
|
|
2187
2204
|
issues.push({
|
|
2188
2205
|
path: [],
|
|
2189
2206
|
message: `inputSpec is not supported for "${row.type}" rows`
|
|
2190
2207
|
});
|
|
2191
2208
|
} else {
|
|
2192
|
-
const allowed = row.type === "video" ? VIDEO_KEY_SET : AUDIO_KEY_SET;
|
|
2193
2209
|
for (const key of Object.keys(spec.fields)) {
|
|
2194
2210
|
if (!allowed.has(key)) {
|
|
2195
2211
|
issues.push({
|