@nodaro/sdk 2.68.2 → 2.70.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/{chunk-KG4R454Z.js → chunk-25IKUIM3.js} +4 -3
- package/dist/chunk-25IKUIM3.js.map +1 -0
- package/dist/{chunk-PTH6ZUW3.cjs → chunk-4RPUONS5.cjs} +22 -22
- package/dist/{chunk-PTH6ZUW3.cjs.map → chunk-4RPUONS5.cjs.map} +1 -1
- package/dist/{chunk-3G65RIZS.cjs → chunk-5W4OCRFX.cjs} +66 -16
- package/dist/chunk-5W4OCRFX.cjs.map +1 -0
- package/dist/{chunk-FFT2YPB4.js → chunk-6SWRJJQE.js} +66 -16
- package/dist/chunk-6SWRJJQE.js.map +1 -0
- package/dist/{chunk-7CK6I4CT.cjs → chunk-7WS3VTUG.cjs} +2 -2
- package/dist/{chunk-7CK6I4CT.cjs.map → chunk-7WS3VTUG.cjs.map} +1 -1
- package/dist/{chunk-7FLTDTHR.cjs → chunk-BNJUMQQ3.cjs} +2 -2
- package/dist/chunk-BNJUMQQ3.cjs.map +1 -0
- package/dist/{chunk-QAVLYMGM.js → chunk-BY3XIXWC.js} +2 -2
- package/dist/chunk-BY3XIXWC.js.map +1 -0
- package/dist/{chunk-BPWUWUZ3.cjs → chunk-C4LXPSSF.cjs} +4 -3
- package/dist/chunk-C4LXPSSF.cjs.map +1 -0
- package/dist/{chunk-PUD5U3EN.cjs → chunk-C5GFDCK2.cjs} +2 -2
- package/dist/chunk-C5GFDCK2.cjs.map +1 -0
- package/dist/{chunk-PGT4BXR2.cjs → chunk-CAM74LQ2.cjs} +15 -4
- package/dist/chunk-CAM74LQ2.cjs.map +1 -0
- package/dist/{chunk-7UOEEYJ2.js → chunk-CGRH5UFG.js} +3 -3
- package/dist/{chunk-7UOEEYJ2.js.map → chunk-CGRH5UFG.js.map} +1 -1
- package/dist/{chunk-52V2G7SL.js → chunk-GKETMNEM.js} +12 -12
- package/dist/{chunk-52V2G7SL.js.map → chunk-GKETMNEM.js.map} +1 -1
- package/dist/{chunk-QXRV2IMW.cjs → chunk-HRFLEHSS.cjs} +2 -2
- package/dist/chunk-HRFLEHSS.cjs.map +1 -0
- package/dist/{chunk-5ZLGXVYV.js → chunk-HRW5IGJ2.js} +2 -2
- package/dist/chunk-HRW5IGJ2.js.map +1 -0
- package/dist/chunk-IWASCR2O.js +3 -0
- package/dist/{chunk-ZYPH2FPT.js.map → chunk-IWASCR2O.js.map} +1 -1
- package/dist/{chunk-OHC4JIUP.js → chunk-JAGTW35C.js} +15 -4
- package/dist/chunk-JAGTW35C.js.map +1 -0
- package/dist/{chunk-EP4J3TLQ.cjs → chunk-O4UXEIV6.cjs} +2 -2
- package/dist/chunk-O4UXEIV6.cjs.map +1 -0
- package/dist/{chunk-76YMDYMT.cjs → chunk-P7UT2YH4.cjs} +2 -2
- package/dist/chunk-P7UT2YH4.cjs.map +1 -0
- package/dist/{chunk-U6LEZT5B.js → chunk-R5DTFY73.js} +2 -2
- package/dist/chunk-R5DTFY73.js.map +1 -0
- package/dist/{chunk-CGSDEKJL.cjs → chunk-REXDUXL3.cjs} +3 -3
- package/dist/{chunk-CGSDEKJL.cjs.map → chunk-REXDUXL3.cjs.map} +1 -1
- package/dist/{chunk-AEUPH7EE.js → chunk-ROUCXQU3.js} +17 -2
- package/dist/chunk-ROUCXQU3.js.map +1 -0
- package/dist/{chunk-F3AV3TC7.js → chunk-UDRP64FX.js} +2 -2
- package/dist/chunk-UDRP64FX.js.map +1 -0
- package/dist/{chunk-Q45PC4YD.cjs → chunk-Z3RI7CSA.cjs} +17 -2
- package/dist/chunk-Z3RI7CSA.cjs.map +1 -0
- package/dist/{chunk-VS5JTLWE.js → chunk-ZMSGJC7L.js} +2 -2
- package/dist/chunk-ZMSGJC7L.js.map +1 -0
- package/dist/entries/audio.cjs +2 -2
- package/dist/entries/audio.d.cts +16 -3
- package/dist/entries/audio.d.ts +16 -3
- package/dist/entries/audio.js +1 -1
- package/dist/entries/catalogs.cjs +2 -2
- package/dist/entries/catalogs.d.cts +15 -4
- package/dist/entries/catalogs.d.ts +15 -4
- package/dist/entries/catalogs.js +1 -1
- package/dist/entries/characters.d.cts +1 -1
- package/dist/entries/characters.d.ts +1 -1
- package/dist/entries/client.cjs +16 -16
- package/dist/entries/client.d.cts +1 -1
- package/dist/entries/client.d.ts +1 -1
- package/dist/entries/client.js +11 -11
- package/dist/entries/core.cjs +5 -5
- package/dist/entries/core.js +1 -1
- package/dist/entries/creatures.d.cts +1 -1
- package/dist/entries/creatures.d.ts +1 -1
- package/dist/entries/credits.cjs +2 -2
- package/dist/entries/credits.d.cts +1 -1
- package/dist/entries/credits.d.ts +1 -1
- package/dist/entries/credits.js +1 -1
- package/dist/entries/jobs.cjs +2 -2
- package/dist/entries/jobs.d.cts +3 -1
- package/dist/entries/jobs.d.ts +3 -1
- package/dist/entries/jobs.js +1 -1
- package/dist/entries/locations.d.cts +1 -1
- package/dist/entries/locations.d.ts +1 -1
- package/dist/entries/media.cjs +2 -2
- package/dist/entries/media.d.cts +147 -18
- package/dist/entries/media.d.ts +147 -18
- package/dist/entries/media.js +1 -1
- package/dist/entries/models.cjs +2 -2
- package/dist/entries/models.d.cts +13 -4
- package/dist/entries/models.d.ts +13 -4
- package/dist/entries/models.js +1 -1
- package/dist/entries/node-presets.cjs +2 -2
- package/dist/entries/node-presets.d.cts +38 -1
- package/dist/entries/node-presets.d.ts +38 -1
- package/dist/entries/node-presets.js +1 -1
- package/dist/entries/nodes.cjs +5 -5
- package/dist/entries/nodes.d.cts +2 -2
- package/dist/entries/nodes.d.ts +2 -2
- package/dist/entries/nodes.js +2 -2
- package/dist/entries/objects.d.cts +1 -1
- package/dist/entries/objects.d.ts +1 -1
- package/dist/entries/picker-catalogs.cjs +2 -2
- package/dist/entries/picker-catalogs.d.cts +8 -0
- package/dist/entries/picker-catalogs.d.ts +8 -0
- package/dist/entries/picker-catalogs.js +1 -1
- package/dist/entries/scene3d.d.cts +2 -2
- package/dist/entries/scene3d.d.ts +2 -2
- package/dist/index.cjs +29 -29
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +12 -12
- package/dist/{nodes-BYgAjPlF.d.cts → nodes-BHl7gwUn.d.cts} +95 -20
- package/dist/{nodes-DC80OcWe.d.ts → nodes-C1pqCwkS.d.ts} +95 -20
- package/package.json +3 -3
- package/dist/chunk-3G65RIZS.cjs.map +0 -1
- package/dist/chunk-5ZLGXVYV.js.map +0 -1
- package/dist/chunk-76YMDYMT.cjs.map +0 -1
- package/dist/chunk-7FLTDTHR.cjs.map +0 -1
- package/dist/chunk-AEUPH7EE.js.map +0 -1
- package/dist/chunk-BPWUWUZ3.cjs.map +0 -1
- package/dist/chunk-EP4J3TLQ.cjs.map +0 -1
- package/dist/chunk-F3AV3TC7.js.map +0 -1
- package/dist/chunk-FFT2YPB4.js.map +0 -1
- package/dist/chunk-KG4R454Z.js.map +0 -1
- package/dist/chunk-OHC4JIUP.js.map +0 -1
- package/dist/chunk-PGT4BXR2.cjs.map +0 -1
- package/dist/chunk-PUD5U3EN.cjs.map +0 -1
- package/dist/chunk-Q45PC4YD.cjs.map +0 -1
- package/dist/chunk-QAVLYMGM.js.map +0 -1
- package/dist/chunk-QXRV2IMW.cjs.map +0 -1
- package/dist/chunk-U6LEZT5B.js.map +0 -1
- package/dist/chunk-VS5JTLWE.js.map +0 -1
- package/dist/chunk-ZYPH2FPT.js +0 -3
|
@@ -6,7 +6,7 @@ import { SocialSearchParams, SocialPost, SocialPlatform, SocialSearchMode } from
|
|
|
6
6
|
import { GenerateMaskOutput, GenerateMaskRequest, VideoDepthProvider, VideoDepthModelSize, VideoDepthColormap, VideoDepthResolution } from '@nodaro/shared/media';
|
|
7
7
|
import * as _nodaro_shared_scene3d from '@nodaro/shared/scene3d';
|
|
8
8
|
import { Scene3DPlan, Scene3DEditOperation, Scene3DV2EditOperation, Scene3DReference, Pro3DRenderSource, Pro3DRenderEngine, Pro3DRenderQuality, Pro3DRenderStyle, Scene3DJobOutputAny, Pro3DRenderJobOutput as Pro3DRenderJobOutput$1, Pro3DRenderCapabilities, Scene3DPlanV2, Pro3DRenderQuote as Pro3DRenderQuote$1 } from '@nodaro/shared/scene3d';
|
|
9
|
-
import {
|
|
9
|
+
import { UpscaleFactor } from '@nodaro/shared/credits';
|
|
10
10
|
import { ImageToImageAttachColumn } from '@nodaro/shared/entities';
|
|
11
11
|
import { N as NodaroClientCore } from './developer-apps-CMUzKpE9.cjs';
|
|
12
12
|
import { JobsResource, JobStatusResult } from './entries/jobs.cjs';
|
|
@@ -324,11 +324,11 @@ interface ImageToImageParams extends GenerationSessionParams {
|
|
|
324
324
|
userPrompt?: string;
|
|
325
325
|
/** Omitted: the platform's default edit model for the requested `aspectRatio`. */
|
|
326
326
|
provider?: ModifyImageProvider;
|
|
327
|
-
/** Extra reference images, up to 13. On models priced per reference, `imageUrl` counts as one. */
|
|
327
|
+
/** Extra reference images, up to 13 (15 on GPT Image 2.6, 9 on Seedream 5.5). On models priced per reference, `imageUrl` counts as one. */
|
|
328
328
|
referenceImageUrls?: string[];
|
|
329
329
|
resolution?: ImageResolution;
|
|
330
330
|
quality?: ImageQuality;
|
|
331
|
-
/** Image background, on the models that take one. `transparent` renders at 1K. */
|
|
331
|
+
/** Image background, on the models that take one. On GPT Image `transparent` renders at 1K; Seedream 5.5 renders it at any size, as a PNG. */
|
|
332
332
|
background?: ImageBackground;
|
|
333
333
|
/**
|
|
334
334
|
* The file the run writes, on the models that list `outputFormats`:
|
|
@@ -396,9 +396,13 @@ interface EditImageCommonParams extends GenerationSessionParams {
|
|
|
396
396
|
prompt?: string;
|
|
397
397
|
/** The prompt as your user typed it. Stored on the job; never sent to the model. */
|
|
398
398
|
userPrompt?: string;
|
|
399
|
-
/**
|
|
400
|
-
|
|
401
|
-
|
|
399
|
+
/**
|
|
400
|
+
* The upscale factor. `topaz-image-upscale`: 1, 2 or 4, and it wins over
|
|
401
|
+
* `targetResolution`. `nodaro-image-upscale`: 1, 2, 4 or 8 (default 2; 1 enhances
|
|
402
|
+
* at the same size) — a factor the model does not take is a `400 validation_error`.
|
|
403
|
+
*/
|
|
404
|
+
upscaleFactor?: UpscaleFactor;
|
|
405
|
+
/** The upscalers' output tier. On `topaz-image-upscale` it maps to a factor (2K → 2, 4K and 8K → 4) when `upscaleFactor` is absent. `nodaro-image-upscale` ignores it: its price follows the output's size. */
|
|
402
406
|
targetResolution?: ImageEditTargetResolution;
|
|
403
407
|
/** Corrected per model; dropped for the models that take none (the upscalers, background removal, the Grok task ops). */
|
|
404
408
|
aspectRatio?: ImageAspectRatio;
|
|
@@ -520,7 +524,9 @@ interface VideoToVideoParams extends GenerationSessionParams {
|
|
|
520
524
|
/** The person's own words, kept for the record when `prompt` was rewritten. */
|
|
521
525
|
userPrompt?: string;
|
|
522
526
|
/** Default `"wan"`. `seedance-2-5` edits the whole clip and is priced by the
|
|
523
|
-
* clip's length (see `nodes.quote`).
|
|
527
|
+
* clip's length (see `nodes.quote`). The platform tells Seedance the run is
|
|
528
|
+
* an edit when every clip (`videoUrl` and `referenceVideoUrls`) is 4–30 s
|
|
529
|
+
* long (a draft included), so this lane takes no `referenceTaskType` of its own. */
|
|
524
530
|
provider?: VideoToVideoNodeProvider;
|
|
525
531
|
/** Wan / Wan Flash. A Seedance edit ignores it: the result keeps the source
|
|
526
532
|
* clip's own length. */
|
|
@@ -568,7 +574,9 @@ interface VideoToVideoParams extends GenerationSessionParams {
|
|
|
568
574
|
/** One way the platform shaped the price — shown so a client can explain it. */
|
|
569
575
|
interface QuoteAdjustment {
|
|
570
576
|
/** Stable code, e.g. `ref_video_length`, `extra_reference_images`,
|
|
571
|
-
* `loop_trim_addon`, `voiced_audio_addon`, `params_adjusted
|
|
577
|
+
* `loop_trim_addon`, `voiced_audio_addon`, `params_adjusted`,
|
|
578
|
+
* `output_size` (priced by the output's size), `max_images` (priced as the
|
|
579
|
+
* most images the run can return). */
|
|
572
580
|
readonly code: string;
|
|
573
581
|
readonly message: string;
|
|
574
582
|
/** Credits this adjustment adds to `reserve`, when it is a separate amount. */
|
|
@@ -576,7 +584,9 @@ interface QuoteAdjustment {
|
|
|
576
584
|
}
|
|
577
585
|
/** Something the caller should know before running. */
|
|
578
586
|
interface QuoteWarning {
|
|
579
|
-
/** Stable code, e.g. `ref_video_unmeasured`, `
|
|
587
|
+
/** Stable code, e.g. `ref_video_unmeasured`, `image_size_unmeasured`,
|
|
588
|
+
* `settles_to_actual` (`reserve` is the most the run can cost: it is
|
|
589
|
+
* charged for what it delivers and the rest is refunded). */
|
|
580
590
|
readonly code: string;
|
|
581
591
|
readonly message: string;
|
|
582
592
|
}
|
|
@@ -872,7 +882,7 @@ interface GenerateImageParams extends StructuredReferenceParams, GenerationSessi
|
|
|
872
882
|
* `provider`. models × count is at most 8. With `presetId`, the preset is
|
|
873
883
|
* applied once per model. */
|
|
874
884
|
models?: string[];
|
|
875
|
-
/** Image background, on the models that take one. `transparent` renders at 1K. */
|
|
885
|
+
/** Image background, on the models that take one. On GPT Image `transparent` renders at 1K; Seedream 5.5 renders it at any size, as a PNG. */
|
|
876
886
|
background?: ImageBackground;
|
|
877
887
|
/**
|
|
878
888
|
* The file the run writes, on the models that list `outputFormats`:
|
|
@@ -1023,11 +1033,15 @@ interface GenerateVideoParams extends StructuredReferenceParams, ReferenceCaptio
|
|
|
1023
1033
|
* `extraImageUrls`; one with a single image is sent as a reference image.
|
|
1024
1034
|
* Counts toward the model's 15 materials. No `voice` (send a recorded
|
|
1025
1035
|
* voice as `referenceAudioUrls`).
|
|
1036
|
+
* - Kling 4.0 Flash (`kling-4-flash`): the same named subjects, and
|
|
1037
|
+
* `referenceAudioUrls` clip N becomes the voice of entry N. An entry needs
|
|
1038
|
+
* 2–4 images to carry a voice; otherwise its clip is dropped, as is any
|
|
1039
|
+
* clip past the last entry.
|
|
1026
1040
|
*/
|
|
1027
1041
|
characterReferences?: VideoCharacterReference[];
|
|
1028
|
-
/** Kling 4.0 (`kling-4`): keep the reference videos' own
|
|
1029
|
-
* generating new sound. Ignored without a reference video
|
|
1030
|
-
* other model. */
|
|
1042
|
+
/** Kling 4.0 (`kling-4`, `kling-4-flash`): keep the reference videos' own
|
|
1043
|
+
* sound instead of generating new sound. Ignored without a reference video
|
|
1044
|
+
* and by every other model. */
|
|
1031
1045
|
keepOriginalSound?: boolean;
|
|
1032
1046
|
/** Kling 4.0 (`kling-4`): play the first `referenceAudioUrls` clip as the
|
|
1033
1047
|
* result's soundtrack — it is sent as one more reference video (a still
|
|
@@ -1050,6 +1064,34 @@ interface GenerateVideoParams extends StructuredReferenceParams, ReferenceCaptio
|
|
|
1050
1064
|
* { provider: "seedance-2-5-hd", sourceJobId })`: the same take, frame for
|
|
1051
1065
|
* frame, at 1080p. Drafts are kept about 7 days. */
|
|
1052
1066
|
draft?: boolean;
|
|
1067
|
+
/**
|
|
1068
|
+
* Seedance 2.5 (`seedance-2-5` only; every other model ignores it): what the
|
|
1069
|
+
* reference media (`referenceImageUrls` / `referenceVideoUrls` /
|
|
1070
|
+
* `referenceAudioUrls`) is for, so the model does not have to guess it from
|
|
1071
|
+
* the prompt.
|
|
1072
|
+
*
|
|
1073
|
+
* - `"auto"` (or absent): nothing is declared; the model decides from the prompt.
|
|
1074
|
+
* - `"reference"`: the media only guides a new clip; your `aspectRatio` and
|
|
1075
|
+
* `duration` are kept.
|
|
1076
|
+
* - `"edit"`: an edit of the reference video. The run takes the video's own
|
|
1077
|
+
* shape and length (`aspectRatio` becomes `"adaptive"`, `duration` Auto).
|
|
1078
|
+
* Needs a reference video, and every reference video 4–30 s long as the
|
|
1079
|
+
* platform measures it; otherwise nothing is declared and the run goes out
|
|
1080
|
+
* with the ratio and length you sent.
|
|
1081
|
+
* - `"extend"`: continues the reference video, in its own shape
|
|
1082
|
+
* (`"adaptive"`), at a set length (Auto or no `duration` becomes the
|
|
1083
|
+
* model's default). The platform returns the model's clip as delivered,
|
|
1084
|
+
* without joining the source to it, so expect the continuation only; for
|
|
1085
|
+
* both as one video, run `extend-video`. Needs a reference video.
|
|
1086
|
+
*
|
|
1087
|
+
* Ignored on a run with no reference media (a start or end frame is not
|
|
1088
|
+
* reference media). A draft (`draft: true`) declares it exactly as the same
|
|
1089
|
+
* run without `draft`, at 480p. Every ratio or length it changes is
|
|
1090
|
+
* reported in the response's `adjustments`, and the run is priced, reserved
|
|
1091
|
+
* and sent at the ratio and length it runs at. A dropped declaration is not
|
|
1092
|
+
* reported.
|
|
1093
|
+
*/
|
|
1094
|
+
referenceTaskType?: "auto" | "reference" | "edit" | "extend";
|
|
1053
1095
|
[k: string]: unknown;
|
|
1054
1096
|
}
|
|
1055
1097
|
/**
|
|
@@ -1079,7 +1121,7 @@ interface TextToVideoParams extends StructuredReferenceParams, ReferenceCaptionP
|
|
|
1079
1121
|
referenceAudioUrls?: string[];
|
|
1080
1122
|
/** Identity inputs that keep a real person's face — see {@link GenerateVideoParams.characterReferences}. */
|
|
1081
1123
|
characterReferences?: VideoCharacterReference[];
|
|
1082
|
-
/** Kling 4.0 (`kling-4`): keep the reference videos' own sound — see {@link GenerateVideoParams.keepOriginalSound}. */
|
|
1124
|
+
/** Kling 4.0 (`kling-4`, `kling-4-flash`): keep the reference videos' own sound — see {@link GenerateVideoParams.keepOriginalSound}. */
|
|
1083
1125
|
keepOriginalSound?: boolean;
|
|
1084
1126
|
/** Kling 4.0 (`kling-4`): play the first audio clip as the soundtrack — see {@link GenerateVideoParams.audioSoundtrack}. */
|
|
1085
1127
|
audioSoundtrack?: boolean;
|
|
@@ -1093,6 +1135,12 @@ interface TextToVideoParams extends StructuredReferenceParams, ReferenceCaptionP
|
|
|
1093
1135
|
* { provider: "seedance-2-5-hd", sourceJobId })`: the same take, frame for
|
|
1094
1136
|
* frame, at 1080p. Drafts are kept about 7 days. */
|
|
1095
1137
|
draft?: boolean;
|
|
1138
|
+
/** Seedance 2.5 (`seedance-2-5` only; ignored elsewhere): what the reference
|
|
1139
|
+
* media is for — `"auto"` (default: the model decides from the prompt),
|
|
1140
|
+
* `"reference"`, `"edit"` (takes the reference video's own shape and
|
|
1141
|
+
* length; every reference video 4–30 s) or `"extend"` (continues it; the
|
|
1142
|
+
* source is not joined to the result). See {@link GenerateVideoParams.referenceTaskType}. */
|
|
1143
|
+
referenceTaskType?: "auto" | "reference" | "edit" | "extend";
|
|
1096
1144
|
/** Absent / `true`: a copyright refusal is retried once with a reworded
|
|
1097
1145
|
* prompt. `false` = a copyright refusal fails the job instead of retrying
|
|
1098
1146
|
* once with a reworded prompt. */
|
|
@@ -1115,14 +1163,31 @@ interface TextToVideoParams extends StructuredReferenceParams, ReferenceCaptionP
|
|
|
1115
1163
|
* price comes from the draft (its length, and whether it used a reference
|
|
1116
1164
|
* video), never from this body. A foreign, unfinished or non-draft source is
|
|
1117
1165
|
* refused with a 4xx before anything is charged.
|
|
1166
|
+
* - `nodaro-video-upscale`: upscale any `videoUrl` of up to 60 s and 50 MB
|
|
1167
|
+
* into a `targetResolution` frame (1080p / 2k / 4k, default 1080p), keeping
|
|
1168
|
+
* its shape, frame rate, length and sound; a `targetResolution` it does not
|
|
1169
|
+
* take (720p) runs at 1080p. Priced per second of the clip, measured before
|
|
1170
|
+
* anything is held (the hold is the charge). Offered only where the server
|
|
1171
|
+
* lists it (`models.list`). Every refusal comes before anything is charged:
|
|
1172
|
+
* `403 model_not_available` where it is not offered (a `ForbiddenError`, as
|
|
1173
|
+
* for any model the deployment does not offer); `400` for the clip
|
|
1174
|
+
* (`video_too_long`, `video_too_large`, `video_unreadable`) or a body
|
|
1175
|
+
* without a `videoUrl` (`validation_error`); `403 link_imports_disabled` for
|
|
1176
|
+
* a link to another site where the deployment turned such links off;
|
|
1177
|
+
* `422 upload_blocked` where its upload policy refuses the clip; and
|
|
1178
|
+
* `429 input_busy`, `503 input_timed_out` or `503 input_failed` when the
|
|
1179
|
+
* clip could not be fetched just now — send the same request again.
|
|
1118
1180
|
*
|
|
1181
|
+
* Every provider but `nodaro-video-upscale` takes Topaz's `targetResolution`
|
|
1182
|
+
* values only (720p / 1080p / 4k): `2k` is a 400 for them.
|
|
1119
1183
|
* Any other route field passes through.
|
|
1120
1184
|
*/
|
|
1121
1185
|
interface VideoUpscaleParams extends GenerationSessionParams {
|
|
1122
|
-
provider?: "topaz" | "veo-1080p" | "veo-4k" | "seedance-2-5-hd";
|
|
1186
|
+
provider?: "topaz" | "veo-1080p" | "veo-4k" | "seedance-2-5-hd" | "nodaro-video-upscale";
|
|
1123
1187
|
videoUrl?: string;
|
|
1124
|
-
/** topaz:
|
|
1125
|
-
|
|
1188
|
+
/** topaz: the frame's short side (720p / 1080p / 4k; "2k" is a 400);
|
|
1189
|
+
* nodaro-video-upscale: the output frame (1080p / 2k / 4k). Default "1080p". */
|
|
1190
|
+
targetResolution?: "720p" | "1080p" | "2k" | "4k";
|
|
1126
1191
|
/** topaz: output frame rate, 15–60. Default: the source's own rate. */
|
|
1127
1192
|
targetFps?: number;
|
|
1128
1193
|
/** @deprecated Legacy topaz lever — use `targetResolution`. */
|
|
@@ -1388,9 +1453,14 @@ declare class NodesResource {
|
|
|
1388
1453
|
* `reserve` is what the run will hold when it starts; `expected`, when
|
|
1389
1454
|
* present, is what it should actually cost (a Seedance edit renders the
|
|
1390
1455
|
* source clip's length). A run settles to what was generated, never above
|
|
1391
|
-
* `reserve`.
|
|
1392
|
-
*
|
|
1393
|
-
* run body
|
|
1456
|
+
* `reserve`. A `settles_to_actual` warning marks a `reserve` that is the
|
|
1457
|
+
* most the run can cost rather than its exact price. Rejects with the same
|
|
1458
|
+
* `400` / `403` the run would answer (an invalid body, a model or node this
|
|
1459
|
+
* deployment does not offer you). Typed for the video lanes and
|
|
1460
|
+
* `edit-image`; any other quotable node type takes its run body as-is —
|
|
1461
|
+
* `"split-into-layers"` takes the body `client.media.splitIntoLayers` takes
|
|
1462
|
+
* (`SplitIntoLayersInput`), and its `reserve` is the hold: `maxLayers` + 1
|
|
1463
|
+
* images at the size's price.
|
|
1394
1464
|
*
|
|
1395
1465
|
* @param type Node type slug, as for {@link run}.
|
|
1396
1466
|
* @param params The run body.
|
|
@@ -1401,6 +1471,11 @@ declare class NodesResource {
|
|
|
1401
1471
|
/** A Seedance 2.5 draft's 1080p finalize (`seedance-2-5-hd`) is priced from
|
|
1402
1472
|
* the draft itself, including the clips it was made with. */
|
|
1403
1473
|
quote(type: "video-upscale", params: VideoUpscaleParams): Promise<NodeQuote>;
|
|
1474
|
+
/** Every edit model. `nodaro-image-upscale` is priced by its output's size:
|
|
1475
|
+
* the platform reads the picture (storing nothing) and quotes that size's
|
|
1476
|
+
* exact tier; an unreadable size quotes the hold, with a `settles_to_actual`
|
|
1477
|
+
* warning. Where the model is not offered the quote is refused as the run is. */
|
|
1478
|
+
quote(type: "edit-image", params: EditImageParams): Promise<NodeQuote>;
|
|
1404
1479
|
quote(type: string, params?: Record<string, unknown>): Promise<NodeQuote>;
|
|
1405
1480
|
/**
|
|
1406
1481
|
* Run a single async node to completion: {@link run} it, extract the
|
|
@@ -6,7 +6,7 @@ import { SocialSearchParams, SocialPost, SocialPlatform, SocialSearchMode } from
|
|
|
6
6
|
import { GenerateMaskOutput, GenerateMaskRequest, VideoDepthProvider, VideoDepthModelSize, VideoDepthColormap, VideoDepthResolution } from '@nodaro/shared/media';
|
|
7
7
|
import * as _nodaro_shared_scene3d from '@nodaro/shared/scene3d';
|
|
8
8
|
import { Scene3DPlan, Scene3DEditOperation, Scene3DV2EditOperation, Scene3DReference, Pro3DRenderSource, Pro3DRenderEngine, Pro3DRenderQuality, Pro3DRenderStyle, Scene3DJobOutputAny, Pro3DRenderJobOutput as Pro3DRenderJobOutput$1, Pro3DRenderCapabilities, Scene3DPlanV2, Pro3DRenderQuote as Pro3DRenderQuote$1 } from '@nodaro/shared/scene3d';
|
|
9
|
-
import {
|
|
9
|
+
import { UpscaleFactor } from '@nodaro/shared/credits';
|
|
10
10
|
import { ImageToImageAttachColumn } from '@nodaro/shared/entities';
|
|
11
11
|
import { N as NodaroClientCore } from './developer-apps-CMUzKpE9.js';
|
|
12
12
|
import { JobsResource, JobStatusResult } from './entries/jobs.js';
|
|
@@ -324,11 +324,11 @@ interface ImageToImageParams extends GenerationSessionParams {
|
|
|
324
324
|
userPrompt?: string;
|
|
325
325
|
/** Omitted: the platform's default edit model for the requested `aspectRatio`. */
|
|
326
326
|
provider?: ModifyImageProvider;
|
|
327
|
-
/** Extra reference images, up to 13. On models priced per reference, `imageUrl` counts as one. */
|
|
327
|
+
/** Extra reference images, up to 13 (15 on GPT Image 2.6, 9 on Seedream 5.5). On models priced per reference, `imageUrl` counts as one. */
|
|
328
328
|
referenceImageUrls?: string[];
|
|
329
329
|
resolution?: ImageResolution;
|
|
330
330
|
quality?: ImageQuality;
|
|
331
|
-
/** Image background, on the models that take one. `transparent` renders at 1K. */
|
|
331
|
+
/** Image background, on the models that take one. On GPT Image `transparent` renders at 1K; Seedream 5.5 renders it at any size, as a PNG. */
|
|
332
332
|
background?: ImageBackground;
|
|
333
333
|
/**
|
|
334
334
|
* The file the run writes, on the models that list `outputFormats`:
|
|
@@ -396,9 +396,13 @@ interface EditImageCommonParams extends GenerationSessionParams {
|
|
|
396
396
|
prompt?: string;
|
|
397
397
|
/** The prompt as your user typed it. Stored on the job; never sent to the model. */
|
|
398
398
|
userPrompt?: string;
|
|
399
|
-
/**
|
|
400
|
-
|
|
401
|
-
|
|
399
|
+
/**
|
|
400
|
+
* The upscale factor. `topaz-image-upscale`: 1, 2 or 4, and it wins over
|
|
401
|
+
* `targetResolution`. `nodaro-image-upscale`: 1, 2, 4 or 8 (default 2; 1 enhances
|
|
402
|
+
* at the same size) — a factor the model does not take is a `400 validation_error`.
|
|
403
|
+
*/
|
|
404
|
+
upscaleFactor?: UpscaleFactor;
|
|
405
|
+
/** The upscalers' output tier. On `topaz-image-upscale` it maps to a factor (2K → 2, 4K and 8K → 4) when `upscaleFactor` is absent. `nodaro-image-upscale` ignores it: its price follows the output's size. */
|
|
402
406
|
targetResolution?: ImageEditTargetResolution;
|
|
403
407
|
/** Corrected per model; dropped for the models that take none (the upscalers, background removal, the Grok task ops). */
|
|
404
408
|
aspectRatio?: ImageAspectRatio;
|
|
@@ -520,7 +524,9 @@ interface VideoToVideoParams extends GenerationSessionParams {
|
|
|
520
524
|
/** The person's own words, kept for the record when `prompt` was rewritten. */
|
|
521
525
|
userPrompt?: string;
|
|
522
526
|
/** Default `"wan"`. `seedance-2-5` edits the whole clip and is priced by the
|
|
523
|
-
* clip's length (see `nodes.quote`).
|
|
527
|
+
* clip's length (see `nodes.quote`). The platform tells Seedance the run is
|
|
528
|
+
* an edit when every clip (`videoUrl` and `referenceVideoUrls`) is 4–30 s
|
|
529
|
+
* long (a draft included), so this lane takes no `referenceTaskType` of its own. */
|
|
524
530
|
provider?: VideoToVideoNodeProvider;
|
|
525
531
|
/** Wan / Wan Flash. A Seedance edit ignores it: the result keeps the source
|
|
526
532
|
* clip's own length. */
|
|
@@ -568,7 +574,9 @@ interface VideoToVideoParams extends GenerationSessionParams {
|
|
|
568
574
|
/** One way the platform shaped the price — shown so a client can explain it. */
|
|
569
575
|
interface QuoteAdjustment {
|
|
570
576
|
/** Stable code, e.g. `ref_video_length`, `extra_reference_images`,
|
|
571
|
-
* `loop_trim_addon`, `voiced_audio_addon`, `params_adjusted
|
|
577
|
+
* `loop_trim_addon`, `voiced_audio_addon`, `params_adjusted`,
|
|
578
|
+
* `output_size` (priced by the output's size), `max_images` (priced as the
|
|
579
|
+
* most images the run can return). */
|
|
572
580
|
readonly code: string;
|
|
573
581
|
readonly message: string;
|
|
574
582
|
/** Credits this adjustment adds to `reserve`, when it is a separate amount. */
|
|
@@ -576,7 +584,9 @@ interface QuoteAdjustment {
|
|
|
576
584
|
}
|
|
577
585
|
/** Something the caller should know before running. */
|
|
578
586
|
interface QuoteWarning {
|
|
579
|
-
/** Stable code, e.g. `ref_video_unmeasured`, `
|
|
587
|
+
/** Stable code, e.g. `ref_video_unmeasured`, `image_size_unmeasured`,
|
|
588
|
+
* `settles_to_actual` (`reserve` is the most the run can cost: it is
|
|
589
|
+
* charged for what it delivers and the rest is refunded). */
|
|
580
590
|
readonly code: string;
|
|
581
591
|
readonly message: string;
|
|
582
592
|
}
|
|
@@ -872,7 +882,7 @@ interface GenerateImageParams extends StructuredReferenceParams, GenerationSessi
|
|
|
872
882
|
* `provider`. models × count is at most 8. With `presetId`, the preset is
|
|
873
883
|
* applied once per model. */
|
|
874
884
|
models?: string[];
|
|
875
|
-
/** Image background, on the models that take one. `transparent` renders at 1K. */
|
|
885
|
+
/** Image background, on the models that take one. On GPT Image `transparent` renders at 1K; Seedream 5.5 renders it at any size, as a PNG. */
|
|
876
886
|
background?: ImageBackground;
|
|
877
887
|
/**
|
|
878
888
|
* The file the run writes, on the models that list `outputFormats`:
|
|
@@ -1023,11 +1033,15 @@ interface GenerateVideoParams extends StructuredReferenceParams, ReferenceCaptio
|
|
|
1023
1033
|
* `extraImageUrls`; one with a single image is sent as a reference image.
|
|
1024
1034
|
* Counts toward the model's 15 materials. No `voice` (send a recorded
|
|
1025
1035
|
* voice as `referenceAudioUrls`).
|
|
1036
|
+
* - Kling 4.0 Flash (`kling-4-flash`): the same named subjects, and
|
|
1037
|
+
* `referenceAudioUrls` clip N becomes the voice of entry N. An entry needs
|
|
1038
|
+
* 2–4 images to carry a voice; otherwise its clip is dropped, as is any
|
|
1039
|
+
* clip past the last entry.
|
|
1026
1040
|
*/
|
|
1027
1041
|
characterReferences?: VideoCharacterReference[];
|
|
1028
|
-
/** Kling 4.0 (`kling-4`): keep the reference videos' own
|
|
1029
|
-
* generating new sound. Ignored without a reference video
|
|
1030
|
-
* other model. */
|
|
1042
|
+
/** Kling 4.0 (`kling-4`, `kling-4-flash`): keep the reference videos' own
|
|
1043
|
+
* sound instead of generating new sound. Ignored without a reference video
|
|
1044
|
+
* and by every other model. */
|
|
1031
1045
|
keepOriginalSound?: boolean;
|
|
1032
1046
|
/** Kling 4.0 (`kling-4`): play the first `referenceAudioUrls` clip as the
|
|
1033
1047
|
* result's soundtrack — it is sent as one more reference video (a still
|
|
@@ -1050,6 +1064,34 @@ interface GenerateVideoParams extends StructuredReferenceParams, ReferenceCaptio
|
|
|
1050
1064
|
* { provider: "seedance-2-5-hd", sourceJobId })`: the same take, frame for
|
|
1051
1065
|
* frame, at 1080p. Drafts are kept about 7 days. */
|
|
1052
1066
|
draft?: boolean;
|
|
1067
|
+
/**
|
|
1068
|
+
* Seedance 2.5 (`seedance-2-5` only; every other model ignores it): what the
|
|
1069
|
+
* reference media (`referenceImageUrls` / `referenceVideoUrls` /
|
|
1070
|
+
* `referenceAudioUrls`) is for, so the model does not have to guess it from
|
|
1071
|
+
* the prompt.
|
|
1072
|
+
*
|
|
1073
|
+
* - `"auto"` (or absent): nothing is declared; the model decides from the prompt.
|
|
1074
|
+
* - `"reference"`: the media only guides a new clip; your `aspectRatio` and
|
|
1075
|
+
* `duration` are kept.
|
|
1076
|
+
* - `"edit"`: an edit of the reference video. The run takes the video's own
|
|
1077
|
+
* shape and length (`aspectRatio` becomes `"adaptive"`, `duration` Auto).
|
|
1078
|
+
* Needs a reference video, and every reference video 4–30 s long as the
|
|
1079
|
+
* platform measures it; otherwise nothing is declared and the run goes out
|
|
1080
|
+
* with the ratio and length you sent.
|
|
1081
|
+
* - `"extend"`: continues the reference video, in its own shape
|
|
1082
|
+
* (`"adaptive"`), at a set length (Auto or no `duration` becomes the
|
|
1083
|
+
* model's default). The platform returns the model's clip as delivered,
|
|
1084
|
+
* without joining the source to it, so expect the continuation only; for
|
|
1085
|
+
* both as one video, run `extend-video`. Needs a reference video.
|
|
1086
|
+
*
|
|
1087
|
+
* Ignored on a run with no reference media (a start or end frame is not
|
|
1088
|
+
* reference media). A draft (`draft: true`) declares it exactly as the same
|
|
1089
|
+
* run without `draft`, at 480p. Every ratio or length it changes is
|
|
1090
|
+
* reported in the response's `adjustments`, and the run is priced, reserved
|
|
1091
|
+
* and sent at the ratio and length it runs at. A dropped declaration is not
|
|
1092
|
+
* reported.
|
|
1093
|
+
*/
|
|
1094
|
+
referenceTaskType?: "auto" | "reference" | "edit" | "extend";
|
|
1053
1095
|
[k: string]: unknown;
|
|
1054
1096
|
}
|
|
1055
1097
|
/**
|
|
@@ -1079,7 +1121,7 @@ interface TextToVideoParams extends StructuredReferenceParams, ReferenceCaptionP
|
|
|
1079
1121
|
referenceAudioUrls?: string[];
|
|
1080
1122
|
/** Identity inputs that keep a real person's face — see {@link GenerateVideoParams.characterReferences}. */
|
|
1081
1123
|
characterReferences?: VideoCharacterReference[];
|
|
1082
|
-
/** Kling 4.0 (`kling-4`): keep the reference videos' own sound — see {@link GenerateVideoParams.keepOriginalSound}. */
|
|
1124
|
+
/** Kling 4.0 (`kling-4`, `kling-4-flash`): keep the reference videos' own sound — see {@link GenerateVideoParams.keepOriginalSound}. */
|
|
1083
1125
|
keepOriginalSound?: boolean;
|
|
1084
1126
|
/** Kling 4.0 (`kling-4`): play the first audio clip as the soundtrack — see {@link GenerateVideoParams.audioSoundtrack}. */
|
|
1085
1127
|
audioSoundtrack?: boolean;
|
|
@@ -1093,6 +1135,12 @@ interface TextToVideoParams extends StructuredReferenceParams, ReferenceCaptionP
|
|
|
1093
1135
|
* { provider: "seedance-2-5-hd", sourceJobId })`: the same take, frame for
|
|
1094
1136
|
* frame, at 1080p. Drafts are kept about 7 days. */
|
|
1095
1137
|
draft?: boolean;
|
|
1138
|
+
/** Seedance 2.5 (`seedance-2-5` only; ignored elsewhere): what the reference
|
|
1139
|
+
* media is for — `"auto"` (default: the model decides from the prompt),
|
|
1140
|
+
* `"reference"`, `"edit"` (takes the reference video's own shape and
|
|
1141
|
+
* length; every reference video 4–30 s) or `"extend"` (continues it; the
|
|
1142
|
+
* source is not joined to the result). See {@link GenerateVideoParams.referenceTaskType}. */
|
|
1143
|
+
referenceTaskType?: "auto" | "reference" | "edit" | "extend";
|
|
1096
1144
|
/** Absent / `true`: a copyright refusal is retried once with a reworded
|
|
1097
1145
|
* prompt. `false` = a copyright refusal fails the job instead of retrying
|
|
1098
1146
|
* once with a reworded prompt. */
|
|
@@ -1115,14 +1163,31 @@ interface TextToVideoParams extends StructuredReferenceParams, ReferenceCaptionP
|
|
|
1115
1163
|
* price comes from the draft (its length, and whether it used a reference
|
|
1116
1164
|
* video), never from this body. A foreign, unfinished or non-draft source is
|
|
1117
1165
|
* refused with a 4xx before anything is charged.
|
|
1166
|
+
* - `nodaro-video-upscale`: upscale any `videoUrl` of up to 60 s and 50 MB
|
|
1167
|
+
* into a `targetResolution` frame (1080p / 2k / 4k, default 1080p), keeping
|
|
1168
|
+
* its shape, frame rate, length and sound; a `targetResolution` it does not
|
|
1169
|
+
* take (720p) runs at 1080p. Priced per second of the clip, measured before
|
|
1170
|
+
* anything is held (the hold is the charge). Offered only where the server
|
|
1171
|
+
* lists it (`models.list`). Every refusal comes before anything is charged:
|
|
1172
|
+
* `403 model_not_available` where it is not offered (a `ForbiddenError`, as
|
|
1173
|
+
* for any model the deployment does not offer); `400` for the clip
|
|
1174
|
+
* (`video_too_long`, `video_too_large`, `video_unreadable`) or a body
|
|
1175
|
+
* without a `videoUrl` (`validation_error`); `403 link_imports_disabled` for
|
|
1176
|
+
* a link to another site where the deployment turned such links off;
|
|
1177
|
+
* `422 upload_blocked` where its upload policy refuses the clip; and
|
|
1178
|
+
* `429 input_busy`, `503 input_timed_out` or `503 input_failed` when the
|
|
1179
|
+
* clip could not be fetched just now — send the same request again.
|
|
1118
1180
|
*
|
|
1181
|
+
* Every provider but `nodaro-video-upscale` takes Topaz's `targetResolution`
|
|
1182
|
+
* values only (720p / 1080p / 4k): `2k` is a 400 for them.
|
|
1119
1183
|
* Any other route field passes through.
|
|
1120
1184
|
*/
|
|
1121
1185
|
interface VideoUpscaleParams extends GenerationSessionParams {
|
|
1122
|
-
provider?: "topaz" | "veo-1080p" | "veo-4k" | "seedance-2-5-hd";
|
|
1186
|
+
provider?: "topaz" | "veo-1080p" | "veo-4k" | "seedance-2-5-hd" | "nodaro-video-upscale";
|
|
1123
1187
|
videoUrl?: string;
|
|
1124
|
-
/** topaz:
|
|
1125
|
-
|
|
1188
|
+
/** topaz: the frame's short side (720p / 1080p / 4k; "2k" is a 400);
|
|
1189
|
+
* nodaro-video-upscale: the output frame (1080p / 2k / 4k). Default "1080p". */
|
|
1190
|
+
targetResolution?: "720p" | "1080p" | "2k" | "4k";
|
|
1126
1191
|
/** topaz: output frame rate, 15–60. Default: the source's own rate. */
|
|
1127
1192
|
targetFps?: number;
|
|
1128
1193
|
/** @deprecated Legacy topaz lever — use `targetResolution`. */
|
|
@@ -1388,9 +1453,14 @@ declare class NodesResource {
|
|
|
1388
1453
|
* `reserve` is what the run will hold when it starts; `expected`, when
|
|
1389
1454
|
* present, is what it should actually cost (a Seedance edit renders the
|
|
1390
1455
|
* source clip's length). A run settles to what was generated, never above
|
|
1391
|
-
* `reserve`.
|
|
1392
|
-
*
|
|
1393
|
-
* run body
|
|
1456
|
+
* `reserve`. A `settles_to_actual` warning marks a `reserve` that is the
|
|
1457
|
+
* most the run can cost rather than its exact price. Rejects with the same
|
|
1458
|
+
* `400` / `403` the run would answer (an invalid body, a model or node this
|
|
1459
|
+
* deployment does not offer you). Typed for the video lanes and
|
|
1460
|
+
* `edit-image`; any other quotable node type takes its run body as-is —
|
|
1461
|
+
* `"split-into-layers"` takes the body `client.media.splitIntoLayers` takes
|
|
1462
|
+
* (`SplitIntoLayersInput`), and its `reserve` is the hold: `maxLayers` + 1
|
|
1463
|
+
* images at the size's price.
|
|
1394
1464
|
*
|
|
1395
1465
|
* @param type Node type slug, as for {@link run}.
|
|
1396
1466
|
* @param params The run body.
|
|
@@ -1401,6 +1471,11 @@ declare class NodesResource {
|
|
|
1401
1471
|
/** A Seedance 2.5 draft's 1080p finalize (`seedance-2-5-hd`) is priced from
|
|
1402
1472
|
* the draft itself, including the clips it was made with. */
|
|
1403
1473
|
quote(type: "video-upscale", params: VideoUpscaleParams): Promise<NodeQuote>;
|
|
1474
|
+
/** Every edit model. `nodaro-image-upscale` is priced by its output's size:
|
|
1475
|
+
* the platform reads the picture (storing nothing) and quotes that size's
|
|
1476
|
+
* exact tier; an unreadable size quotes the hold, with a `settles_to_actual`
|
|
1477
|
+
* warning. Where the model is not offered the quote is refused as the run is. */
|
|
1478
|
+
quote(type: "edit-image", params: EditImageParams): Promise<NodeQuote>;
|
|
1404
1479
|
quote(type: string, params?: Record<string, unknown>): Promise<NodeQuote>;
|
|
1405
1480
|
/**
|
|
1406
1481
|
* Run a single async node to completion: {@link run} it, extract the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodaro/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.70.0",
|
|
4
4
|
"description": "Typed REST client for the Nodaro API — workflows, jobs, executions, apps, characters, and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -337,8 +337,8 @@
|
|
|
337
337
|
"test:watch": "vitest"
|
|
338
338
|
},
|
|
339
339
|
"dependencies": {
|
|
340
|
-
"@nodaro/shared": "^3.
|
|
341
|
-
"@nodaro/prompts": "^1.
|
|
340
|
+
"@nodaro/shared": "^3.63.0",
|
|
341
|
+
"@nodaro/prompts": "^1.55.0"
|
|
342
342
|
},
|
|
343
343
|
"peerDependencies": {
|
|
344
344
|
"@fingerprintjs/fingerprintjs": "^5.2.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resources/media.ts"],"names":["readSseStream"],"mappings":";;;;;AAsGO,IAAM,gBAAN,MAAoB;AAAA,EACzB,YAAoB,MAAA,EAA0B;AAA1B,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAA2B;AAAA,EAA3B,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBpB,cAAc,KAAA,EAQsB;AAClC,IAAA,OAAO,IA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A;AAAA;AAAA,EAaA,QAAQ,KAAA,EAA+D;AACrE,IAAA,OAAO,IAAA,CAAK,OAAO,OAAA,CAAsC,MAAA,EAAQ,qBAAqB,EAAE,IAAA,EAAM,OAAO,CAAA;AAAA,EACvG;AACF","file":"chunk-3G65RIZS.cjs","sourcesContent":["import type { NodaroClientCore } from \"../core.js\"\nimport { readSseStream } from \"../sse.js\"\nimport type { OverlayAnchor, VideoMaskRequest, MaskCompositeRequest } from \"@nodaro/shared/media\"\nimport type { CaptionStyle, CaptionLookId, SupportedFontName } from \"@nodaro/shared/captions\"\nimport type { TranscribeLane } from \"@nodaro/shared/models\"\nimport type { VideoOverlayRequest } from \"@nodaro/shared/video\"\n\n/** One word-timed caption entry (one per WORD for the kinetic styles). */\nexport interface CaptionEntry {\n text: string\n startMs: number\n endMs: number\n timestampMs?: number | null\n confidence?: number | null\n}\n\n/** Look + motion levers — see {@link MediaResource.addCaptions}. `look` is a\n * named preset the explicit levers override; an unset look renders as `outline`\n * (the default). The STYLING levers (`look`, `fontFamily`, `fontWeight`,\n * `strokeColor`/`strokeWidth`, `uppercase`, `positionY`, `maxWordsPerLine`) now\n * apply to the static `subtitle` style too — a subtitle carrying any of them\n * renders via Remotion. Only `highlightColor` (no spoken-word cursor to colour)\n * and `animate` (no motion to freeze) stay kinetic-only and are rejected (400)\n * on `subtitle`. */\nexport interface CaptionLookInput {\n look?: CaptionLookId\n fontFamily?: SupportedFontName\n fontWeight?: number\n strokeColor?: string\n strokeWidth?: number\n highlightColor?: string\n uppercase?: boolean\n positionY?: number\n /** Cap on how many words one caption LINE (or `tiktok-words` page) may hold,\n * 1-20, on TOP of the frame-width budget, sentence ends and pauses that\n * already close a line — 1-2 gives the punchy CapCut read, unset fits the\n * width. Applies to `word-highlight` / `karaoke` / `bouncy` / `tiktok-words`\n * and to a Remotion-rendered `subtitle`; inert on `word-pop` (always one\n * word). */\n maxWordsPerLine?: number\n /** Kinetic styles only. `false` freezes the per-word MOTION — the grouping,\n * line-holding and spoken-word highlight stay, only the movement stops;\n * default `true`. Rejected (400) on the static `subtitle` style. */\n animate?: boolean\n}\n\n/** One caption SEGMENT: a time range with optional style/look overrides and its\n * own words (`text`/`captions`, else the shared transcript filtered to range).\n * A segmented render is entirely Remotion, so any `style` is valid here. */\nexport interface CaptionSegmentInput extends CaptionLookInput {\n startMs: number\n endMs: number\n style?: CaptionStyle\n position?: \"bottom\" | \"top\" | \"center\"\n fontSize?: number\n color?: string\n backgroundColor?: string\n text?: string\n captions?: CaptionEntry[]\n}\n\n/** {@link MediaResource.addCaptions} input. */\nexport interface AddCaptionsInput extends CaptionLookInput {\n videoUrl: string\n text?: string\n captions?: CaptionEntry[]\n /** Transcribe the video's audio when no text/captions are given (default true). */\n autoTranscribe?: boolean\n transcribeProvider?: TranscribeLane\n style?: CaptionStyle\n position?: \"bottom\" | \"top\" | \"center\"\n fontSize?: number\n color?: string\n backgroundColor?: string\n /** Apply different treatments to time ranges in one call (non-overlapping). */\n segments?: CaptionSegmentInput[]\n}\n\n/**\n * Media ingestion + trimming — the source-preparation steps a Voice Changer Pro\n * flow (or any pipeline) needs before it has a clip to work on: pull a social\n * video into storage, copy a remote URL into storage, trim a video/audio to a\n * range, and probe a video's metadata. Each generation-style op returns a job id\n * to poll (`jobs.get(jobId)`); `videoMetadata` is a direct read.\n */\n/**\n * Where one overlay layer should go, in {@link MediaResource.imageOverlay}'s\n * percent units — the answer from {@link MediaResource.suggestOverlayPlacement}.\n */\nexport interface OverlayPlacement {\n /** The point on the base image the layer attaches to. */\n anchor: OverlayAnchor\n /** Offset from the anchor in % of the base width (negative on a right anchor = inward). */\n x: number\n /** Offset from the anchor in % of the base height (negative on a bottom anchor = inward). */\n y: number\n /** The layer's width in % of the base width. */\n width: number\n /** One sentence, plain language, on why this spot. */\n reason: string\n}\n\nexport class MediaResource {\n constructor(private client: NodaroClientCore) {}\n\n /**\n * Download the video behind a link (the video's page, or a direct video file\n * link) into your storage (`POST /v1/download-video`). `maxHeight` caps the resolution\n * (default \"best\"); `sectionStartSec` + `sectionEndSec` (both-or-neither) fetch\n * ONLY that time range instead of the whole video. A download that arrives\n * with no audio stream FAILS by default (it is usually a degraded source\n * response, and is retried through other routes first); pass\n * `requireAudio: false` to accept a clip that really has no sound. Returns a\n * `downloadId`; progress streams from\n * `GET /v1/download-video/progress/:downloadId` (server-sent events) and the\n * finished file lands in your library. A section is fetched with ±3 s of\n * padding for the caller to trim; `exactSection: true` cuts it exactly at\n * `sectionStartSec`–`sectionEndSec` instead. `confirmationId` is the content\n * rights confirmation the import is made under (`contentRights.confirm`):\n * checked and consumed before the download starts, written on the stored\n * file; a download without one is refused (`403 rights_confirmation_required`)\n * once the deployment requires it, so a client always sends one.\n */\n downloadVideo(input: {\n url: string\n maxHeight?: number\n sectionStartSec?: number\n sectionEndSec?: number\n exactSection?: boolean\n requireAudio?: boolean\n confirmationId?: string\n }): Promise<{ downloadId: string }> {\n return this.client.request<{ downloadId: string }>(\"POST\", \"/v1/download-video\", { body: input })\n }\n\n /**\n * Stream the live progress of a {@link MediaResource.downloadVideo} import\n * (`GET /v1/download-video/progress/:downloadId`, server-sent events) as an\n * async iterable. Yields a {@link DownloadVideoProgress} roughly every 500ms\n * until the download reaches `completed` (its event carries the stored\n * `videoUrl`) or `failed` (its event carries `error`), then ends. The progress\n * state expires server-side shortly after the download starts existing, so\n * start iterating promptly after `downloadVideo` returns.\n *\n * No request timeout is applied (a large import legitimately takes minutes) —\n * pass an `AbortSignal` to cancel from the caller.\n */\n async *downloadVideoProgress(\n downloadId: string,\n opts: { signal?: AbortSignal } = {},\n ): AsyncGenerator<DownloadVideoProgress, void, undefined> {\n const url = `${this.client.baseUrl}/v1/download-video/progress/${encodeURIComponent(downloadId)}`\n const token = await this.client.auth.getToken()\n const res = await this.client.fetch(url, {\n headers: token ? { Authorization: `Bearer ${token}` } : {},\n signal: opts.signal,\n })\n // The shared reader owns the non-OK throw, the empty-body guard, the frame\n // parse and the cancel-on-early-exit — this route emits the same\n // `data: <json>` frames every other stream here does.\n yield* readSseStream<DownloadVideoProgress>(res, { label: \"progress stream\" })\n }\n\n /**\n * Copy an external media URL into your Nodaro storage (`POST /v1/save-to-storage`)\n * — a server-side fetch, so nothing round-trips through the client. Poll\n * `jobs.get(jobId)`.\n */\n saveToStorage(input: { mediaUrl: string; filename?: string; mediaType?: \"image\" | \"video\" | \"audio\" }): Promise<{ jobId: string }> {\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/save-to-storage\", { body: input })\n }\n\n /**\n * Composite 2–30 images into ONE large 2K/4K collage (`POST /v1/image-collage`).\n * `layout` `\"smart\"` (default — justified rows at each image's exact aspect\n * ratio, no cropping; the output height floats) or `\"grid\"` (uniform,\n * letterboxed cells). `imageSizes` is index-aligned with `imageUrls` and\n * gives per-image RELATIVE size hints for the smart layout: `0` auto\n * (\"don't care\", default), `1` big (~2× linear vs medium), `2` medium,\n * `3` small (~½ linear). All-equal hints change nothing; grid ignores them.\n * For storyboards, set `numbered` to stamp a 1-based sequence badge at each\n * image's corner (top-left by default; `badgePosition: \"top-right\"` moves it;\n * in `imageUrls` order) and pass `imageLabels`\n * (index-aligned with `imageUrls`; `null`/`\"\"`/omitted = no caption for that\n * image) to caption images after the number, e.g. `3 · Close-up`. Badges are\n * an overlay only — they never change the layout, the output size or the\n * credit cost. Poll `jobs.get(jobId)` for the finished image.\n */\n imageCollage(input: {\n imageUrls: string[]\n imageSizes?: Array<0 | 1 | 2 | 3>\n numbered?: boolean\n imageLabels?: Array<string | null>\n /** Corner the badges sit in — `\"top-left\"` (default, storyboard convention) or `\"top-right\"`. */\n badgePosition?: \"top-left\" | \"top-right\"\n layout?: \"smart\" | \"grid\"\n resolution?: \"2K\" | \"4K\"\n aspectRatio?: string\n gap?: number\n backgroundColor?: string\n }): Promise<{ jobId: string }> {\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/image-collage\", { body: input })\n }\n\n /**\n * Place 1–12 layers — pictures, real text, QR codes, shapes — on a base image,\n * pixel-exactly (`POST /v1/image-overlay`) — local, deterministic, no AI.\n * Every layer position/size is a PERCENT of the base image: `anchor` (nine\n * positions, default `\"center\"`), `x`/`y` (offset from the anchor in % of\n * the base width/height; negative on a right/bottom anchor moves inward),\n * `width` (% of the base width, default 25 — height follows the layer's\n * aspect unless `height` is set). Plus `opacity` (0..1), `rotation`\n * (degrees), `blend` (`\"over\"` | `\"multiply\"` | `\"screen\"`), `fit`,\n * `shadow` and `roundedCorners`. The output keeps the base's pixel size\n * unless `canvas` is set. Flat credit cost. Poll `jobs.get(jobId)` for the\n * finished image.\n */\n imageOverlay(input: {\n imageUrl: string\n layers: Array<{\n imageUrl: string\n anchor?: OverlayAnchor\n x?: number\n y?: number\n width?: number\n height?: number\n opacity?: number\n rotation?: number\n blend?: \"over\" | \"multiply\" | \"screen\"\n fit?: \"contain\" | \"cover\" | \"stretch\"\n shadow?: { blur: number; offsetX: number; offsetY: number; color: string; opacity: number }\n roundedCorners?: number\n zIndex?: number\n /** \"image\" (default, needs imageUrl) | \"text\" | \"qr\" | \"shape\" — see @nodaro/shared image-overlay-layers. */\n kind?: \"image\" | \"text\" | \"qr\" | \"shape\"\n text?: Record<string, unknown>\n qr?: Record<string, unknown>\n shape?: Record<string, unknown>\n effects?: Record<string, unknown>\n }>\n canvas?: { width: number; height: number; backgroundColor?: string }\n baseFit?: \"contain\" | \"cover\"\n outputFormat?: \"png\" | \"jpg\" | \"webp\"\n /** Extra platform renders (see OVERLAY_PLATFORMS in @nodaro/shared); returned as output `variants[]`. */\n variants?: string[]\n /** The mask the job also emits as output `maskUrl` (white = may change). Default \"around\". */\n maskMode?: \"none\" | \"layers\" | \"around\" | \"outside\"\n maskSpread?: number\n /** Fills every QR layer whose `qr.fromInput` is true — the node's QR link handle. */\n qrText?: string\n }): Promise<{ jobId: string }> {\n // The finished job's output: { imageUrl, width, height, maskUrl?, variants?: [{ id, label, width, height, url }] }.\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/image-overlay\", { body: input })\n }\n\n /**\n * Ask a vision model WHERE one overlay layer should sit on a base image\n * (`POST /v1/image-overlay/suggest-placement`) — it reads the picture and\n * keeps the element off the faces, the subject and the busiest texture.\n * The answer comes back in {@link MediaResource.imageOverlay}'s own percent\n * units — `anchor`, `x`/`y` offsets, `width` — so it drops straight onto a\n * layer (`const { reason, ...box } = placement`), plus a one-sentence\n * `reason` you can show a user. Nothing is composited here: apply the\n * placement yourself.\n *\n * `layerAspect` is the element's width / height (1 = square, the default) so\n * the proposed box stays in proportion; `intent` says what the element is\n * (\"a logo\", \"a price badge\"); `safeArea` is the always-visible region as\n * fractions of the canvas (a platform preset's safe area), which the\n * placement is kept inside. Unlike the other media calls this one answers\n * synchronously — there is nothing to poll; `jobId` is the billing record\n * (one image-to-text call).\n */\n suggestOverlayPlacement(input: {\n imageUrl: string\n layerAspect?: number\n intent?: string\n safeArea?: { x: number; y: number; w: number; h: number }\n llmModel?: string\n }): Promise<{ jobId: string; placement: OverlayPlacement }> {\n return this.client.request<{ jobId: string; placement: OverlayPlacement }>(\n \"POST\",\n \"/v1/image-overlay/suggest-placement\",\n { body: input },\n )\n }\n\n /**\n * Trim a video to a range (`POST /v1/trim-video`). Give the range in whichever\n * unit fits: `startTime`/`endTime` seconds, `trim*Frames`, `trim*Seconds`, or\n * `keepFirst`/`keepLastSeconds`. Poll `jobs.get(jobId)`.\n */\n trimVideo(input: {\n videoUrl: string\n startTime?: number\n endTime?: number\n trimStartFrames?: number\n trimEndFrames?: number\n trimStartSeconds?: number\n trimEndSeconds?: number\n keepFirstSeconds?: number\n keepLastSeconds?: number\n }): Promise<{ jobId: string }> {\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/trim-video\", { body: input })\n }\n\n /**\n * Burn captions into a video (`POST /v1/add-captions`). Give the words as\n * `text`, word-timed `captions[]`, or let it transcribe (`autoTranscribe`,\n * the default when neither is set).\n *\n * `style: \"subtitle\"` renders statically (FFmpeg) UNLESS it carries a styling\n * lever, in which case it — like the KINETIC styles (`word-highlight` /\n * `karaoke` / `tiktok-words` / `word-pop` / `bouncy`) — renders via Remotion.\n * `look` picks a preset — `outline` (Montserrat 900, UPPERCASE, black outline,\n * yellow spoken word — the TikTok/Reels read) or `clean`; an UNSET look renders\n * as `outline`. The explicit STYLING levers (`fontFamily`, `fontWeight`,\n * `strokeColor`/`strokeWidth`, `uppercase`, `positionY`, `maxWordsPerLine`)\n * override individual fields of it and now apply to `subtitle` too. Only\n * `highlightColor` (the spoken-word cursor) and `animate` stay kinetic-only\n * and are REJECTED on `subtitle`.\n *\n * `animate` (default true) freezes the per-word MOTION on the kinetic styles\n * when set to false — the grouping, line-holding and spoken-word highlight\n * stay; only the movement stops.\n *\n * `maxWordsPerLine` (1-20) caps how many words a line — or a `tiktok-words`\n * page — may hold, on top of the width budget / sentence ends / pauses that\n * already close one; it is inert on `word-pop`, which is always one word.\n * Like every lever here it exists top-level AND per segment, and a segment\n * that does not name its own inherits the top-level value.\n *\n * `segments[]` applies DIFFERENT treatments to non-overlapping time ranges in\n * one call (e.g. a large top intro, then a small bottom body); a segment that\n * names its own `look` starts fresh from that preset and does not inherit the\n * top-level explicit levers. Poll `jobs.get(jobId)`.\n *\n * `word-highlight` shows ONE held line at a time and a word's\n * `startMs`/`endMs` is its SPOKEN window (what times the highlight, not how\n * long the text is on screen) — so `captions[]` can be handed over verbatim\n * from an `audio.transcribe()` job's `output_data.words`, with\n * `autoTranscribe: false`.\n */\n addCaptions(input: AddCaptionsInput): Promise<{ jobId: string }> {\n const { autoTranscribe, transcribeProvider, ...rest } = input\n // The route body is camelCase except these two flags (worker snake_case);\n // omit each when unset so an absent flag stays absent on the wire.\n const body: Record<string, unknown> = {\n ...rest,\n ...(autoTranscribe !== undefined ? { auto_transcribe: autoTranscribe } : {}),\n ...(transcribeProvider !== undefined ? { transcribe_provider: transcribeProvider } : {}),\n }\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/add-captions\", { body })\n }\n\n /**\n * Trim (and extract) audio from a video or audio source\n * (`POST /v1/trim-audio`) to `[startTime, endTime]` seconds, in `audioFormat`\n * (`mp3` default / `wav` / `aac`). Poll `jobs.get(jobId)`.\n */\n trimAudio(input: {\n videoUrl?: string\n audioUrl?: string\n audioFormat?: \"mp3\" | \"wav\" | \"aac\"\n startTime?: number\n endTime?: number\n }): Promise<{ jobId: string }> {\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/trim-audio\", { body: input })\n }\n\n /**\n * Cut a video and/or an audio file into consecutive parts\n * (`POST /v1/split-media`). Every part is at most `chunkDuration` seconds and\n * at least `minPartDuration` (default 4, never above `chunkDuration`) — a\n * short leftover is evened out with the parts before it. Video is cut on\n * whole frames with each part's sound matching its picture; audio parts are\n * sample-exact, in `audioFormat` (`mp3` default / `wav` / `aac`). With both\n * sources each is split on its own. At most 200 parts per input. With\n * `mode: \"shots\"` a video is instead cut into one part per shot, at the cuts\n * measured from the file (no part length; a video only, up to 30 minutes and\n * 200 shots; each part keeps the video's own sound). Poll `jobs.get(jobId)`;\n * the parts are on the completed job's `output_data` — see\n * {@link SplitMediaOutput}.\n */\n splitMedia(input: SplitMediaInput): Promise<{ jobId: string }> {\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/split-media\", { body: input })\n }\n\n /**\n * Where every shot of a video starts and ends (`POST /v1/shot-cuts`),\n * measured from the file: every decoded frame is scored and each hard cut\n * starts a new shot (dissolves and fades are not cuts). Videos up to 30\n * minutes. `frames: true` also saves each shot's exact first and last frame\n * as PNG images (up to 1,000 shots; same price). Poll `jobs.get(jobId)`; the\n * completed job's `output_data.json` is a {@link ShotCutsResult} — see\n * {@link ShotCutsOutput}.\n */\n shotCuts(input: ShotCutsInput): Promise<{ jobId: string }> {\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/shot-cuts\", { body: input })\n }\n\n /**\n * Turn one still image + one audio track into an MP4\n * (`POST /v1/still-to-video`) — locally rendered (FFmpeg), no AI model,\n * zero credits. The output duration IS the audio's duration; there is no\n * duration field. Optional `motion` animates the still (zoom / pan /\n * ken-burns) at `intensity` 1–10. `fit: \"contain\"` letterboxes with\n * `padColor` instead of cropping. Poll `jobs.get(jobId)`.\n */\n stillToVideo(input: {\n imageUrl: string\n audioUrl: string\n motion?: \"none\" | \"zoom-in\" | \"zoom-out\" | \"pan-left\" | \"pan-right\" | \"ken-burns\"\n intensity?: number\n resolution?: \"720p\" | \"1080p\" | \"4K\"\n aspectRatio?: \"16:9\" | \"9:16\" | \"1:1\" | \"4:3\"\n fps?: 24 | 30\n fit?: \"cover\" | \"contain\"\n padColor?: string\n }): Promise<{ jobId: string }> {\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/still-to-video\", { body: input })\n }\n\n /**\n * Turn 2–100 images + one optional audio track into an MP4 slideshow\n * (`POST /v1/slideshow`) — locally rendered (FFmpeg), zero credits. With\n * audio, the output duration IS the audio's duration (equal split unless\n * `imageDurations` pins rows — null entries = auto; mismatched pinned sums\n * scale proportionally and the factor is disclosed in the job output).\n * Without audio: N × `perImageDuration`, silent output. Transitions\n * consume the outgoing slide, so totals stay exact. For a single image use\n * `stillToVideo`. Poll `jobs.get(jobId)`.\n */\n slideshow(input: {\n imageUrls: string[]\n audioUrl?: string\n imageDurations?: Array<number | null>\n perImageDuration?: number\n transition?: string\n transitionDuration?: number\n motion?: \"none\" | \"zoom-in\" | \"zoom-out\" | \"ken-burns\" | \"alternate\"\n intensity?: number\n resolution?: \"720p\" | \"1080p\" | \"4K\"\n aspectRatio?: \"16:9\" | \"9:16\" | \"1:1\" | \"4:3\"\n fps?: 24 | 30\n fit?: \"cover\" | \"contain\"\n padColor?: string\n }): Promise<{ jobId: string }> {\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/slideshow\", { body: input })\n }\n\n /**\n * Place 1–20 timed image layers over a video (`POST /v1/video-overlay`) —\n * rendered locally (FFmpeg) in one pass, no AI; the base audio is kept\n * untouched. Each layer has an `imageUrl`, a `start` and an optional `end`\n * in seconds (no `end` = to the end of the video) and a placement: a\n * `preset` (`\"card\"`, `\"corner-badge\"` with a `corner`, `\"full-frame\"`) or\n * an explicit box in {@link MediaResource.imageOverlay}'s percent vocabulary\n * (`anchor`, `x`, `y`, `width`, `height`, `fit`) — an explicit box field\n * overrides the preset, and a layer with neither is a corner badge\n * (bottom-right, or the `corner` it names). `outputAspect` renders onto a\n * 16:9 / 9:16 / 1:1 / 4:5 canvas\n * (`baseFit` cover by default; `backgroundColor` pads `contain`). Poll\n * `jobs.get(jobId)`: the output carries `videoUrl`, `thumbnailUrl`, `width`,\n * `height`, `durationSec` and `warnings[]` (a layer clipped or skipped at the\n * video's end, an animated image's first frame, re-encoded audio).\n */\n videoOverlay(input: VideoOverlayRequest): Promise<{ jobId: string }> {\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/video-overlay\", { body: input })\n }\n\n /**\n * Track a subject described in plain text through a video and get a\n * black-and-white MASK VIDEO back (`POST /v1/video-mask`, SAM 3.1 by default,\n * or `provider: \"sam-3\"` at half the price) — white = the subject. Clips up\n * to 5 minutes at 30 fps (a faster clip counts\n * proportionally longer), priced by the clip's length. Poll\n * `jobs.get(jobId)`: the output carries `videoUrl` (the mask), `width`,\n * `height`, `frames`, `coverage` (the fraction of pixels selected, rounded\n * to 4 decimals) and `kept` (any region left on any frame: false only when\n * the size / zone filters left an empty mask — read it rather than\n * `coverage`, which a few pixels round to 0), and `recipe` (the version of\n * the masking algorithm that made it, `VIDEO_MASK_RECIPE`: it changes\n * whenever the same clip and settings would give a different mask). Feed the mask to\n * {@link MediaResource.maskComposite}.\n *\n * `holdLastMask: true` keeps the last mask on frames where the subject is\n * lost (a mask covering under 0.002 % of the frame, e.g. a face behind a\n * hand): each such frame after the first detection repeats the most recent\n * non-empty one, for at most 1 s of frames (`VIDEO_MASK_LIMITS.HOLD_MAX_SEC`;\n * longer gaps stay empty after that); the output then also carries `heldFrames`.\n * `minSubjectHeightPct` (0–100, default 0 = off) drops every connected\n * region whose bounding box is shorter than that % of the frame height\n * (extras' small faces behind the main subject); it runs before\n * `holdLastMask`, and the output then carries `droppedRegions`.\n * `maxSubjectHeightPct` (0–100, default 0 = off) is its mirror: it drops\n * regions TALLER than that % (keep only the small background faces). With\n * both set a region is kept when min ≤ height ≤ max; min > max is a 400.\n * `zone` (`{ leftPct, rightPct, topPct, bottomPct }`, each 0–49 % of the\n * frame, a margin left out = 0; default null = off) keeps only the regions\n * whose bounding-box centre lies inside the frame minus those margins (after\n * the size cuts, before `holdLastMask`). `perShot: true` finds the clip's\n * scene cuts first and segments each shot on its own: the subject is\n * detected again after every cut, `holdLastMask` never crosses a cut, and\n * each shot's mask is fitted to that shot's exact frame count; on a clip\n * with no cut it gives the same mask, fitted to the clip's exact frame\n * count. The output carries `shots` (1 when off). `redetectEverySec` (0 =\n * off, the default, or 1–10) also detects the subject again every that\n * many seconds — the clip (each shot, with `perShot`) is sent to the model\n * in pieces of at most that length, a last piece under 8 frames joining the\n * one before — so someone who walks in or turns to the camera mid-shot is\n * masked from the next boundary on. These boundaries are not cuts:\n * `holdLastMask` holds across them. Each piece is one more model request\n * (three run at a time), so it is slower; the price does not change. The\n * output's `chunks` counts the requests.\n */\n videoMask(input: VideoMaskRequest): Promise<{ jobId: string }> {\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/video-mask\", { body: input })\n }\n\n /**\n * Place a foreground video over a background video through a mask video\n * (`POST /v1/mask-composite`; white = foreground) — local FFmpeg, no AI.\n * The result follows the foreground's size, frame rate and length; the\n * background is fitted (`backgroundFit`, default cover) and loops when\n * shorter; the mask holds its last frame when shorter. Optional\n * `invertMask`, `feather` (0–20 px), `grow` (−10–10 px), `opacity` (0–1,\n * default 1: how strongly the foreground covers the background inside the\n * mask) and `audioSource` (foreground / background / mix / none). Priced per started 5 seconds of\n * the result (the video it follows up to 300 s). Poll `jobs.get(jobId)` for `videoUrl`.\n *\n * `fill` picks what fills the masked area: `video` (default — the\n * foreground, required then), `pixelate` (the background itself in\n * blocks of `pixelSizePct` % of the frame width, 0.2–10, default 1.25) or\n * `blur` (the background blurred, sigma `blurStrengthPct` % of the frame\n * width, 0.1–5, default 2). Pixelate and blur take no\n * `foregroundUrl` (one sent is ignored): the result follows the background\n * and is priced on its length, and it always carries the background's sound\n * (`audioSource` is ignored).\n */\n maskComposite(input: MaskCompositeRequest): Promise<{ jobId: string }> {\n return this.client.request<{ jobId: string }>(\"POST\", \"/v1/mask-composite\", { body: input })\n }\n\n /**\n * Probe a social video's metadata (`POST /v1/video-metadata`) — duration,\n * dimensions, title, live status — WITHOUT downloading it. A direct read, not a\n * job. Use it to decide whether to trim before importing.\n */\n videoMetadata(input: { url: string }): Promise<VideoMetadata> {\n return this.client.request<VideoMetadata>(\"POST\", \"/v1/video-metadata\", { body: input })\n }\n\n /**\n * Cut or crop a stored file (`POST /v1/media/process`) — synchronous and\n * free, the source-preparation sibling of the priced `trimVideo` node.\n * `trim` is `[startTime, endTime]` in seconds; `deleteSource: true` removes\n * the source object afterwards when it is yours and nothing else references\n * it (\"the cut replaces the original\"). Answers the stored file. The\n * platform may take up to 300 s on a long file: pass `timeoutMs` to wait\n * longer than the client's default.\n */\n process(\n input: MediaProcessInput,\n options: { timeoutMs?: number; signal?: AbortSignal } = {},\n ): Promise<{ data: MediaProcessResult }> {\n return this.client.request<{ data: MediaProcessResult }>(\"POST\", \"/v1/media/process\", { body: input, ...options })\n }\n\n /**\n * Throw away a file you just made and no longer need (`POST /v1/media/discard`):\n * a link download replaced before use, a cut superseded by a newer one, a\n * picture imported then cancelled. Not a general delete. The file goes only\n * when it is your own, was made by a link download (`downloadVideo`), a cut\n * (`process`) or a URL import, is under 24 hours old, and no job of yours\n * uses it (as an output or as an input such as a run's `videoUrl`);\n * otherwise it is left untouched and the call fails with 409\n * `not_discardable`. `discarded: false` means there was nothing of yours at\n * that address (already gone, or not yours).\n */\n discard(input: { url: string }): Promise<{ data: MediaDiscardResult }> {\n return this.client.request<{ data: MediaDiscardResult }>(\"POST\", \"/v1/media/discard\", { body: input })\n }\n}\n\n/**\n * One event from {@link MediaResource.downloadVideoProgress}. The stream ends\n * after a `completed` event (which carries the stored `videoUrl` + an optional\n * `thumbnailUrl`) or a `failed` event (which carries `error`).\n */\nexport interface DownloadVideoProgress {\n phase: \"downloading\" | \"processing\" | \"uploading\" | \"completed\" | \"failed\"\n /** Download percent (0–100). Section fetches report jumpy percents — display, don't sum. */\n percent: number\n /** The imported video's storage URL — set on the `completed` event. */\n videoUrl?: string\n /** Thumbnail storage URL — set on the `completed` event when one was captured. */\n thumbnailUrl?: string\n /** What went wrong — set on the `failed` event. */\n error?: string\n}\n\n/** Result of {@link MediaResource.videoMetadata}. Fields are best-effort — a probe may omit some. */\nexport interface VideoMetadata {\n durationSec?: number | null\n width?: number | null\n height?: number | null\n title?: string | null\n isLive?: boolean\n [key: string]: unknown\n}\n\n/** Body of {@link MediaResource.splitMedia} (`POST /v1/split-media`): parts of a set length, or one part per shot of a video. */\nexport type SplitMediaInput = SplitMediaByDurationInput | SplitMediaByShotsInput\n\n/** {@link SplitMediaInput} cutting parts of at most `chunkDuration` seconds. At least one of `videoUrl` / `audioUrl`. */\nexport interface SplitMediaByDurationInput {\n /** Video to split. */\n videoUrl?: string\n /** Audio file to split (split on its own when a video is given too). */\n audioUrl?: string\n /** The default: parts of a set length. */\n mode?: \"duration\"\n /** The longest a part may be, in seconds (at least 1). Every part is at most this long. */\n chunkDuration: number\n /** The shortest a part may be, in seconds (0 or more, default 4). Must not exceed `chunkDuration` (400 otherwise). */\n minPartDuration?: number\n /** Format of the audio parts. Default `mp3`. */\n audioFormat?: \"mp3\" | \"wav\" | \"aac\"\n}\n\n/** {@link SplitMediaInput} cutting a video into one part per shot, at its measured cuts. */\nexport interface SplitMediaByShotsInput {\n /** The video to split (up to 30 minutes). A separate audio file is refused (each part keeps the video's own sound). */\n videoUrl: string\n mode: \"shots\"\n}\n\n/** One part's shot in a shots-mode split: its place on the video, seconds to the millisecond. */\nexport interface SplitMediaShot {\n index: number\n startSec: number\n endSec: number\n durationSec: number\n}\n\n/** A completed split-media job's `output_data`. */\nexport interface SplitMediaOutput {\n /** The video parts, in order (when a video was split). */\n videoUrls?: string[]\n /** The audio parts, in order (when an audio file was split). */\n audioUrls?: string[]\n /** The number of parts — the larger of the two lists. */\n chunkCount: number\n /** Each part's exact length in seconds: the video parts' when a video was split, else the audio parts'. */\n partDurationsSec?: number[]\n /** The audio parts' lengths, only when BOTH a video and an audio file were split. */\n audioPartDurationsSec?: number[]\n /** Shots mode: the number of shots (= parts). */\n shotCount?: number\n /** Shots mode: each part's shot, in part order. */\n shots?: SplitMediaShot[]\n}\n\n/** Body of {@link MediaResource.shotCuts} (`POST /v1/shot-cuts`). */\nexport interface ShotCutsInput {\n /** The video to measure: MP4, MOV, MKV or WebM, up to 30 minutes. */\n videoUrl: string\n /** Also save each shot's first and last frame as images (up to 1,000 shots). Default false. */\n frames?: boolean\n}\n\n/** One shot of a {@link ShotCutsResult}: seconds from the video's first frame, to the millisecond. */\nexport interface ShotCutsShot {\n index: number\n startSec: number\n /** Where the next shot starts, or the video's end. */\n endSec: number\n durationSec: number\n /** With `frames`: the shot's first decoded frame (PNG). */\n firstFrameUrl?: string\n /** With `frames`: its last decoded frame — the one before the next cut, or the video's last. */\n lastFrameUrl?: string\n}\n\n/** What a Shot Cuts run measured (`output_data.json`). */\nexport interface ShotCutsResult {\n shotCount: number\n /** Where each new shot starts: ascending, never 0; `[]` for a single shot. */\n cutsSec: number[]\n /** The video's length. */\n durationSec: number\n shots: ShotCutsShot[]\n}\n\n/** A completed shot-cuts job's `output_data`. */\nexport interface ShotCutsOutput {\n json: ShotCutsResult\n /** With `frames`: each shot's first frame, in shot order. */\n firstFrames?: string[]\n /** With `frames`: each shot's last frame, in shot order. */\n lastFrames?: string[]\n}\n\nexport interface MediaProcessInput {\n sourceUrl: string\n type: \"video\" | \"audio\"\n trim?: { startTime: number; endTime: number }\n crop?: { x: number; y: number; width: number; height: number }\n format?: \"mp4\" | \"webm\" | \"mp3\" | \"wav\" | \"m4a\" | \"aac\"\n deleteSource?: boolean\n}\n\n/** Result of {@link MediaResource.discard}. */\nexport interface MediaDiscardResult {\n /** True when the file was deleted; false when there was nothing of yours at that address. */\n discarded: boolean\n}\n\nexport interface MediaProcessResult {\n url: string\n thumbnailUrl: string | null\n assetId: string | null\n sizeBytes: number\n mimeType: string\n metadata: Record<string, unknown>\n}\n"]}
|