@shop-os/modelkit 0.17.1 → 0.18.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/dist/index.js CHANGED
@@ -450,6 +450,25 @@ var NANO_BANANA_2_1_RATIOS = [
450
450
  "adaptive"
451
451
  ];
452
452
  var GEMINI_PROMPT_MAX_CHARS = 5e4;
453
+ var GPT_IMAGE_2_6_ANIMATION = {
454
+ frameSizes: [
455
+ { size: "288x288", minFrames: 2, maxFrames: 16 },
456
+ { size: "384x384", minFrames: 2, maxFrames: 16 },
457
+ { size: "512x288", minFrames: 2, maxFrames: 16 },
458
+ { size: "288x512", minFrames: 2, maxFrames: 16 },
459
+ { size: "512x512", minFrames: 2, maxFrames: 16 },
460
+ { size: "768x768", minFrames: 2, maxFrames: 12 }
461
+ ],
462
+ frameDurationMs: { min: 20, max: 2e3 },
463
+ defaultFrameCount: 9,
464
+ defaultFrameDurationMs: 200
465
+ };
466
+ var GPT_IMAGE_2_6_OUTPUT = {
467
+ imageFormats: ["png", "gif", "svg"],
468
+ backgrounds: ["auto", "opaque", "transparent"],
469
+ animation: GPT_IMAGE_2_6_ANIMATION,
470
+ svgModel: "gpt-6.1-sol"
471
+ };
453
472
  var GPT_IMAGE_PROMPT = { referenceSyntax: "numbered", maxChars: 32e3 };
454
473
  function geminiImage(id, label, aliases, sizes, display, exposure, references, promptMaxChars, aspectRatios = GEMINI_RATIOS) {
455
474
  const prompt = { referenceSyntax: "caption" };
@@ -618,7 +637,8 @@ var IMAGE_MODELS = [
618
637
  qualityOptions: ["auto", "low", "medium", "high", "xhigh", "max"],
619
638
  references: { images: 16 },
620
639
  supports: ["quality", "count", "outputFormat"],
621
- prompt: GPT_IMAGE_PROMPT
640
+ prompt: GPT_IMAGE_PROMPT,
641
+ ...GPT_IMAGE_2_6_OUTPUT
622
642
  },
623
643
  defaults: { size: "1K", aspectRatio: "adaptive", quality: "auto" },
624
644
  usage: { ...IMAGE_USAGE3 },
@@ -653,7 +673,8 @@ var IMAGE_MODELS = [
653
673
  qualityOptions: ["auto", "low", "medium", "high", "xhigh", "max"],
654
674
  references: { images: 16 },
655
675
  supports: ["quality", "count", "outputFormat"],
656
- prompt: GPT_IMAGE_PROMPT
676
+ prompt: GPT_IMAGE_PROMPT,
677
+ ...GPT_IMAGE_2_6_OUTPUT
657
678
  },
658
679
  defaults: { size: "1K", aspectRatio: "adaptive", quality: "auto" },
659
680
  usage: { ...IMAGE_USAGE3 },
@@ -7879,7 +7900,20 @@ var AspectRatioSchema = z3.enum([
7879
7900
  var ImageSizeSchema = z3.enum(["512", "1K", "2K", "4K"]);
7880
7901
  var VideoResolutionSchema = z3.enum(["360p", "480p", "720p", "768p", "1080p", "2k", "4k"]);
7881
7902
  var ImageQualitySchema = z3.enum(["auto", "low", "medium", "high", "xhigh", "max"]);
7882
- var OutputFormatSchema = z3.enum(["png", "jpeg", "webp"]);
7903
+ var OutputFormatSchema = z3.enum(["png", "jpeg", "webp", "gif", "svg"]);
7904
+ var ImageBackgroundSchema = z3.enum(["auto", "opaque", "transparent"]);
7905
+ var AnimationLimitsSchema = z3.looseObject({
7906
+ frameSizes: z3.array(
7907
+ z3.looseObject({
7908
+ size: z3.string().regex(/^\d+x\d+$/u),
7909
+ minFrames: z3.number().int().positive(),
7910
+ maxFrames: z3.number().int().positive()
7911
+ })
7912
+ ).min(1),
7913
+ frameDurationMs: z3.looseObject({ min: z3.number().positive(), max: z3.number().positive() }),
7914
+ defaultFrameCount: z3.number().int().positive(),
7915
+ defaultFrameDurationMs: z3.number().positive()
7916
+ });
7883
7917
  var RequiredInputSchema = z3.enum(["firstFrame", "sourceVideo", "references", "sourceAudio"]);
7884
7918
  var SupportedOptionSchema = z3.enum([
7885
7919
  "seed",
@@ -8033,6 +8067,10 @@ var ModelConstraintsSchema = z3.looseObject({
8033
8067
  }).optional(),
8034
8068
  languages: z3.array(LanguageOptionSchema).optional(),
8035
8069
  outputFormats: z3.array(z3.string().min(1)).min(1).optional(),
8070
+ imageFormats: z3.array(OutputFormatSchema).min(1).optional(),
8071
+ backgrounds: z3.array(ImageBackgroundSchema).min(1).optional(),
8072
+ animation: AnimationLimitsSchema.optional(),
8073
+ svgModel: z3.string().min(1).optional(),
8036
8074
  sourceVideoPixels: VideoPixelLimitsSchema.optional(),
8037
8075
  sourceVideoSeconds: VideoSecondsLimitsSchema.omit({ total: true }).extend({ inReferenceTotal: z3.boolean().optional() }).optional(),
8038
8076
  // segmentSeconds/maxTotalSeconds stay required: a kit before 0.3.0 drops a row whose
@@ -15831,7 +15869,37 @@ var lumaAdapter = {
15831
15869
  // src/adapters/openai-image.ts
15832
15870
  import OpenAI from "openai";
15833
15871
  import { z as z28 } from "zod";
15872
+
15873
+ // src/adapters/svg-sanitize.ts
15874
+ var BLOCK_ELEMENTS = /<(script|foreignObject|iframe|object|embed|audio|video|handler|listener)\b[\s\S]*?<\/\1\s*>/giu;
15875
+ var SELF_CLOSING = /<(script|foreignObject|iframe|object|embed|audio|video|handler|listener)\b[^>]*\/>/giu;
15876
+ var EVENT_ATTRIBUTE = /\s+on[a-z]+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/giu;
15877
+ var EXTERNAL_HREF = /\s+(xlink:)?href\s*=\s*("(?!#)[^"]*"|'(?!#)[^']*')/giu;
15878
+ var STYLE_IMPORT = /@import\b[^;]*;?/giu;
15879
+ var STILL_ACTIVE = /<(script|foreignObject|iframe|object|embed)\b|\son[a-z]+\s*=|javascript:|<!ENTITY|<\?xml-stylesheet/iu;
15880
+ function sanitizeSvg(svg, model) {
15881
+ const cleaned = svg.replace(BLOCK_ELEMENTS, "").replace(SELF_CLOSING, "").replace(EVENT_ATTRIBUTE, "").replace(EXTERNAL_HREF, "").replace(STYLE_IMPORT, "");
15882
+ if (!/<svg\b/iu.test(cleaned) || STILL_ACTIVE.test(cleaned)) {
15883
+ throw new ModelKitError({
15884
+ code: "provider_rejected",
15885
+ message: `${model} returned an SVG that could not be made safe`,
15886
+ provider: "openai-image",
15887
+ model,
15888
+ retryable: false
15889
+ });
15890
+ }
15891
+ return cleaned;
15892
+ }
15893
+
15894
+ // src/adapters/openai-image.ts
15834
15895
  var MAX_EDIT_REFERENCES = 16;
15896
+ var MIME_BY_FORMAT = {
15897
+ png: "image/png",
15898
+ jpeg: "image/jpeg",
15899
+ webp: "image/webp",
15900
+ gif: "image/gif",
15901
+ svg: "image/svg+xml"
15902
+ };
15835
15903
  function aspectRatioToSize(ratio, tier) {
15836
15904
  const TIER_LONG_EDGE = {
15837
15905
  "1K": 1024,
@@ -15943,7 +16011,6 @@ var openaiImageAdapter = {
15943
16011
  const isEdit = refs.length > 0;
15944
16012
  const quality = req.quality ?? (isEdit ? "medium" : "auto");
15945
16013
  const sdkQuality = quality;
15946
- const count2 = req.count !== void 0 && req.count > 1 ? { n: req.count } : {};
15947
16014
  let outputFormat = req.outputFormat;
15948
16015
  if (outputFormat === "webp") {
15949
16016
  ctx.warnings.push({
@@ -15955,35 +16022,50 @@ var openaiImageAdapter = {
15955
16022
  });
15956
16023
  outputFormat = "png";
15957
16024
  }
15958
- const format = outputFormat !== void 0 ? { output_format: outputFormat } : {};
15959
- const mime = outputFormat === "jpeg" ? "image/jpeg" : "image/png";
16025
+ if (isEdit && outputFormat === "svg") {
16026
+ throw new ModelKitError({
16027
+ code: "unsupported_option",
16028
+ message: `${ctx.model.id} cannot make an SVG from reference images`,
16029
+ provider: "openai-image",
16030
+ model: ctx.model.id,
16031
+ retryable: false
16032
+ });
16033
+ }
16034
+ const svgModel = ctx.model.constraints.svgModel;
16035
+ if (outputFormat === "svg" && !svgModel) {
16036
+ throw new ModelKitError({
16037
+ code: "unsupported_option",
16038
+ message: `${ctx.model.id} names no svgModel to write the SVG`,
16039
+ provider: "openai-image",
16040
+ model: ctx.model.id,
16041
+ retryable: false
16042
+ });
16043
+ }
16044
+ const params = {
16045
+ model: ctx.model.providerModelId,
16046
+ prompt: req.prompt,
16047
+ quality: sdkQuality,
16048
+ ...size !== void 0 && { size },
16049
+ // SVG takes no `n` at all (OpenAI: "Use n=1"), not even 1.
16050
+ ...req.count !== void 0 && req.count > 1 && outputFormat !== "svg" && { n: req.count },
16051
+ ...outputFormat !== void 0 && { output_format: outputFormat },
16052
+ ...req.background !== void 0 && { background: req.background },
16053
+ ...outputFormat === "gif" && req.animation?.frameCount !== void 0 && {
16054
+ frame_count: req.animation.frameCount
16055
+ },
16056
+ ...outputFormat === "gif" && req.animation?.frameDurationMs !== void 0 && {
16057
+ frame_duration_ms: req.animation.frameDurationMs
16058
+ },
16059
+ ...outputFormat === "svg" && { svg: { model: svgModel } }
16060
+ };
16061
+ const mime = MIME_BY_FORMAT[outputFormat ?? "png"];
15960
16062
  const retryOptions = mediaRetryOptions(ctx.call, ctx.signal);
15961
16063
  const response = await withRetry(async () => {
15962
16064
  try {
15963
16065
  if (!isEdit) {
15964
- if (size !== void 0) {
15965
- return await client2.images.generate(
15966
- {
15967
- model: ctx.model.providerModelId,
15968
- prompt: req.prompt,
15969
- size,
15970
- quality: sdkQuality,
15971
- ...count2,
15972
- ...format
15973
- },
15974
- { signal: ctx.signal }
15975
- );
15976
- }
15977
- return await client2.images.generate(
15978
- {
15979
- model: ctx.model.providerModelId,
15980
- prompt: req.prompt,
15981
- quality: sdkQuality,
15982
- ...count2,
15983
- ...format
15984
- },
15985
- { signal: ctx.signal }
15986
- );
16066
+ return await client2.images.generate(params, {
16067
+ signal: ctx.signal
16068
+ });
15987
16069
  }
15988
16070
  const files = await Promise.all(
15989
16071
  refs.slice(0, MAX_EDIT_REFERENCES).map(async (ref, i) => {
@@ -15998,37 +16080,19 @@ var openaiImageAdapter = {
15998
16080
  );
15999
16081
  const single = files.length === 1 ? files[0] : void 0;
16000
16082
  const imageInput = single ?? files;
16001
- if (size !== void 0) {
16002
- return await client2.images.edit(
16003
- {
16004
- model: ctx.model.providerModelId,
16005
- image: imageInput,
16006
- prompt: req.prompt,
16007
- size,
16008
- quality: sdkQuality,
16009
- ...count2,
16010
- ...format
16011
- },
16012
- { signal: ctx.signal }
16013
- );
16014
- }
16015
16083
  return await client2.images.edit(
16016
- {
16017
- model: ctx.model.providerModelId,
16018
- image: imageInput,
16019
- prompt: req.prompt,
16020
- quality: sdkQuality,
16021
- ...count2,
16022
- ...format
16023
- },
16084
+ { ...params, image: imageInput },
16024
16085
  { signal: ctx.signal }
16025
16086
  );
16026
16087
  } catch (cause) {
16027
16088
  throw toProviderError2(cause, ctx);
16028
16089
  }
16029
16090
  }, retryOptions);
16091
+ const decode = (b64) => outputFormat === "svg" ? new TextEncoder().encode(
16092
+ sanitizeSvg(new TextDecoder().decode(base64ToBytes(b64)), ctx.model.id)
16093
+ ) : base64ToBytes(b64);
16030
16094
  const images = (response.data ?? []).flatMap(
16031
- (item) => item.b64_json ? [{ bytes: base64ToBytes(item.b64_json), mime }] : []
16095
+ (item) => item.b64_json ? [{ bytes: decode(item.b64_json), mime }] : []
16032
16096
  );
16033
16097
  if (images.length === 0)
16034
16098
  throw classifyHttpError(
@@ -17612,6 +17676,155 @@ function fileCatalogCache(path) {
17612
17676
  };
17613
17677
  }
17614
17678
 
17679
+ // src/resolve-image-output.ts
17680
+ var BASE_FORMATS = ["png", "jpeg", "webp"];
17681
+ var ONE_K_FRAME_PIXELS = 288 * 512;
17682
+ function imageOutputFormats(model) {
17683
+ return model.constraints.imageFormats ?? BASE_FORMATS;
17684
+ }
17685
+ function animationTier(model, frameSize) {
17686
+ const [w, h] = frameSize.split("x").map(Number);
17687
+ const tier = (w ?? 0) * (h ?? 0) <= ONE_K_FRAME_PIXELS ? "1K" : "2K";
17688
+ const offered = model.constraints.sizes ?? ["1K", "2K", "4K"];
17689
+ if (offered.includes(tier)) return tier;
17690
+ return offered[offered.length - 1] ?? tier;
17691
+ }
17692
+ function refuse(model, message) {
17693
+ throw new ModelKitError({ code: "unsupported_option", message, model: model.id });
17694
+ }
17695
+ function clamp(value, min, max) {
17696
+ return Math.min(Math.max(value, min), max);
17697
+ }
17698
+ function applyAnimation(model, req, onUnsupported, warnings) {
17699
+ const limits = model.constraints.animation;
17700
+ if (!limits) return;
17701
+ const sizes = limits.frameSizes;
17702
+ let frameSize = sizes.find((s) => s.size === req.exactSize);
17703
+ if (!frameSize) {
17704
+ const fallback = sizes[0];
17705
+ if (req.exactSize !== void 0) {
17706
+ if (onUnsupported === "error") {
17707
+ refuse(
17708
+ model,
17709
+ `${model.id} makes GIF frames at ${sizes.map((s) => s.size).join(", ")}; got ${req.exactSize}`
17710
+ );
17711
+ }
17712
+ warnings.push({
17713
+ code: "option_ignored",
17714
+ field: "exactSize",
17715
+ from: req.exactSize,
17716
+ to: fallback.size,
17717
+ message: `${model.id} has no ${req.exactSize} GIF frame; using ${fallback.size}`
17718
+ });
17719
+ }
17720
+ frameSize = fallback;
17721
+ }
17722
+ req.exactSize = frameSize.size;
17723
+ delete req.aspectRatio;
17724
+ const animation = { ...req.animation };
17725
+ const asked = animation.frameCount;
17726
+ const frames = asked ?? clamp(limits.defaultFrameCount, frameSize.minFrames, frameSize.maxFrames);
17727
+ if (frames < frameSize.minFrames || frames > frameSize.maxFrames || !Number.isInteger(frames)) {
17728
+ if (onUnsupported === "error") {
17729
+ refuse(
17730
+ model,
17731
+ `${model.id} makes ${frameSize.minFrames} to ${frameSize.maxFrames} frames at ${frameSize.size}; got ${frames}`
17732
+ );
17733
+ }
17734
+ const snapped = clamp(Math.round(frames), frameSize.minFrames, frameSize.maxFrames);
17735
+ warnings.push({
17736
+ code: "option_ignored",
17737
+ field: "animation.frameCount",
17738
+ from: frames,
17739
+ to: snapped,
17740
+ message: `${model.id} makes ${frameSize.minFrames} to ${frameSize.maxFrames} frames at ${frameSize.size}; using ${snapped}`
17741
+ });
17742
+ animation.frameCount = snapped;
17743
+ } else {
17744
+ animation.frameCount = frames;
17745
+ }
17746
+ const { min, max } = limits.frameDurationMs;
17747
+ const duration = animation.frameDurationMs ?? limits.defaultFrameDurationMs;
17748
+ if (duration < min || duration > max) {
17749
+ if (onUnsupported === "error") {
17750
+ refuse(model, `${model.id} shows each GIF frame ${min} to ${max} ms; got ${duration}`);
17751
+ }
17752
+ const snapped = clamp(duration, min, max);
17753
+ warnings.push({
17754
+ code: "option_ignored",
17755
+ field: "animation.frameDurationMs",
17756
+ from: duration,
17757
+ to: snapped,
17758
+ message: `${model.id} shows each GIF frame ${min} to ${max} ms; using ${snapped}`
17759
+ });
17760
+ animation.frameDurationMs = snapped;
17761
+ } else {
17762
+ animation.frameDurationMs = duration;
17763
+ }
17764
+ req.animation = animation;
17765
+ req.size = animationTier(model, frameSize.size);
17766
+ }
17767
+ function applyImageOutputRules(model, req, onUnsupported, warnings) {
17768
+ const c = model.constraints;
17769
+ const format = req.outputFormat;
17770
+ if (format !== void 0 && !imageOutputFormats(model).includes(format)) {
17771
+ if (onUnsupported === "error") {
17772
+ refuse(
17773
+ model,
17774
+ `${model.id} does not offer outputFormat ${format}. Supported: ${imageOutputFormats(model).join(", ")}.`
17775
+ );
17776
+ }
17777
+ warnings.push({
17778
+ code: "option_ignored",
17779
+ field: "outputFormat",
17780
+ from: format,
17781
+ message: `${model.id} does not offer ${format}; ignored`
17782
+ });
17783
+ delete req.outputFormat;
17784
+ }
17785
+ if (req.background !== void 0 && !(c.backgrounds ?? []).includes(req.background)) {
17786
+ if (onUnsupported === "error") {
17787
+ refuse(model, `${model.id} does not offer background ${req.background}`);
17788
+ }
17789
+ warnings.push({
17790
+ code: "option_ignored",
17791
+ field: "background",
17792
+ from: req.background,
17793
+ message: `${model.id} does not offer background ${req.background}; ignored`
17794
+ });
17795
+ delete req.background;
17796
+ }
17797
+ if (req.outputFormat === "gif") {
17798
+ applyAnimation(model, req, onUnsupported, warnings);
17799
+ } else if (req.animation !== void 0) {
17800
+ warnings.push({
17801
+ code: "option_ignored",
17802
+ field: "animation",
17803
+ message: `animation applies to GIF output only; ignored`
17804
+ });
17805
+ delete req.animation;
17806
+ }
17807
+ if (req.outputFormat === "svg") {
17808
+ if (!c.svgModel) refuse(model, `${model.id} names no svgModel to write the SVG`);
17809
+ if ((req.references ?? []).length > 0) {
17810
+ refuse(model, `${model.label} cannot make an SVG from reference images`);
17811
+ }
17812
+ if ((req.count ?? 1) > 1) {
17813
+ if (onUnsupported === "error") {
17814
+ refuse(model, `${model.label} makes one SVG per call`);
17815
+ }
17816
+ warnings.push({
17817
+ code: "option_ignored",
17818
+ field: "count",
17819
+ from: req.count,
17820
+ to: 1,
17821
+ message: `${model.id} makes one SVG per call; using 1`
17822
+ });
17823
+ req.count = 1;
17824
+ }
17825
+ }
17826
+ }
17827
+
17615
17828
  // src/resolve-lists.ts
17616
17829
  function preview(listed2) {
17617
17830
  const shown = listed2.slice(0, 12).join(", ");
@@ -17924,6 +18137,7 @@ function resolveImageOptions(model, request, onUnsupported = "error") {
17924
18137
  "points",
17925
18138
  "boxes"
17926
18139
  ]);
18140
+ applyImageOutputRules(model, merged, onUnsupported, warnings);
17927
18141
  const factor = merged.scaleFactor;
17928
18142
  if (factor !== void 0 && c.scaleFactors && !c.scaleFactors.includes(factor)) {
17929
18143
  if (onUnsupported === "error") {
@@ -18260,7 +18474,7 @@ function setOrDelete(req, field, refs) {
18260
18474
  else delete req[field];
18261
18475
  }
18262
18476
  function isImageFormat(format) {
18263
- return format === "png" || format === "jpeg" || format === "webp";
18477
+ return format === "png" || format === "jpeg" || format === "webp" || format === "gif" || format === "svg";
18264
18478
  }
18265
18479
  function stripUndefined(obj) {
18266
18480
  return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== void 0));
@@ -18467,7 +18681,7 @@ function resolveTranscriptionOptions(model, request, onUnsupported = "error") {
18467
18681
  }
18468
18682
 
18469
18683
  // src/resolve-voice.ts
18470
- function refuse(model, code, message) {
18684
+ function refuse2(model, code, message) {
18471
18685
  return new ModelKitError({ code, message: `${model.label} ${message}`, model: model.id });
18472
18686
  }
18473
18687
  function checkSample(model, sample, index) {
@@ -18476,7 +18690,7 @@ function checkSample(model, sample, index) {
18476
18690
  if (limits === void 0 || length === void 0) return;
18477
18691
  if (limits.min !== void 0 && length < limits.min || limits.max !== void 0 && length > limits.max) {
18478
18692
  const range2 = `${limits.min ?? 0}-${limits.max ?? "any"} s`;
18479
- throw refuse(
18693
+ throw refuse2(
18480
18694
  model,
18481
18695
  "unsupported_option",
18482
18696
  `takes samples of ${range2}; sample ${index + 1} is ${length} s`
@@ -18485,11 +18699,11 @@ function checkSample(model, sample, index) {
18485
18699
  }
18486
18700
  function resolveVoiceCloneOptions(model, request) {
18487
18701
  const title = request.title.trim();
18488
- if (!title) throw refuse(model, "missing_input", "needs a title");
18489
- if (request.samples.length === 0) throw refuse(model, "missing_input", "needs a voice sample");
18702
+ if (!title) throw refuse2(model, "missing_input", "needs a title");
18703
+ if (request.samples.length === 0) throw refuse2(model, "missing_input", "needs a voice sample");
18490
18704
  const max = model.constraints.references?.audios;
18491
18705
  if (max !== void 0 && request.samples.length > max) {
18492
- throw refuse(
18706
+ throw refuse2(
18493
18707
  model,
18494
18708
  "unsupported_option",
18495
18709
  `takes up to ${max} samples; got ${request.samples.length}`
@@ -18499,7 +18713,7 @@ function resolveVoiceCloneOptions(model, request) {
18499
18713
  const total = model.constraints.references?.audioSeconds?.total;
18500
18714
  const seconds3 = request.samples.reduce((sum, s) => sum + (s.audio.durationSeconds ?? 0), 0);
18501
18715
  if (total !== void 0 && seconds3 > total) {
18502
- throw refuse(
18716
+ throw refuse2(
18503
18717
  model,
18504
18718
  "unsupported_option",
18505
18719
  `takes up to ${total} s of samples; got ${seconds3} s`
@@ -18508,7 +18722,7 @@ function resolveVoiceCloneOptions(model, request) {
18508
18722
  for (const field of ["transcript", "designSignature"]) {
18509
18723
  const set = request.samples.filter((s) => s[field]?.trim()).length;
18510
18724
  if (set !== 0 && set !== request.samples.length) {
18511
- throw refuse(model, "missing_input", `needs ${field} on every sample or on none`);
18725
+ throw refuse2(model, "missing_input", `needs ${field} on every sample or on none`);
18512
18726
  }
18513
18727
  }
18514
18728
  return { request: { ...request, model: model.id, title }, warnings: [] };
@@ -18516,10 +18730,10 @@ function resolveVoiceCloneOptions(model, request) {
18516
18730
  function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
18517
18731
  const warnings = [];
18518
18732
  const prompt = request.prompt.trim();
18519
- if (!prompt) throw refuse(model, "missing_input", "needs a voice description");
18733
+ if (!prompt) throw refuse2(model, "missing_input", "needs a voice description");
18520
18734
  const maxChars = promptConventions(model).maxChars;
18521
18735
  if (maxChars !== void 0 && prompt.length > maxChars) {
18522
- throw refuse(
18736
+ throw refuse2(
18523
18737
  model,
18524
18738
  "unsupported_option",
18525
18739
  `takes up to ${maxChars} characters; got ${prompt.length}`
@@ -18530,7 +18744,7 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
18530
18744
  const preview2 = request.previewText?.trim();
18531
18745
  if (preview2) {
18532
18746
  if (limits !== void 0 && preview2.length > limits.previewMaxChars) {
18533
- throw refuse(
18747
+ throw refuse2(
18534
18748
  model,
18535
18749
  "unsupported_option",
18536
18750
  `takes a preview line of up to ${limits.previewMaxChars} characters; got ${preview2.length}`
@@ -18546,7 +18760,7 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
18546
18760
  const cap = limits?.maxCandidates ?? count2;
18547
18761
  if (!Number.isInteger(count2) || count2 < 1 || count2 > cap) {
18548
18762
  if (onUnsupported === "error" || !Number.isInteger(count2)) {
18549
- throw refuse(
18763
+ throw refuse2(
18550
18764
  model,
18551
18765
  "unsupported_option",
18552
18766
  `returns 1-${cap} candidates; got ${count2}`
@@ -20062,6 +20276,7 @@ export {
20062
20276
  VideoResolutionSchema,
20063
20277
  adapterServesType,
20064
20278
  aiSdkTextAdapter,
20279
+ animationTier,
20065
20280
  arkAdapter,
20066
20281
  aspectRatioToSize,
20067
20282
  byokProviderForModel,
@@ -20087,6 +20302,7 @@ export {
20087
20302
  googleImageAdapter,
20088
20303
  hasAwsCredentials,
20089
20304
  higgsfieldAdapter,
20305
+ imageOutputFormats,
20090
20306
  isArrayInputSpecKey,
20091
20307
  isInputSpecKey,
20092
20308
  isListed,