@byte_fluffy/nexra-sdk 0.1.0-alpha.44 → 0.1.0-alpha.46

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/README.md CHANGED
@@ -65,6 +65,38 @@ The migrated task input also accepts the existing image fields
65
65
  fields `video_url`/`vid`, `config`, and `target.res`. Use one input contract per
66
66
  request. Credentials, VOD space, and playback signing belong to the server channel.
67
67
 
68
+ ## Image layer decomposition
69
+
70
+ Seedream Pro accepts one source image in `output_mode: "layers"`. Resolution is
71
+ `1K`, `1.5K`, or `2K`; `prompt_optimization` selects `standard` or `fast`.
72
+ Layers retain the source aspect ratio and use PNG for transparency.
73
+
74
+ ```ts
75
+ import type { NexraImageLayerDecompositionOutput } from "@byte_fluffy/nexra-sdk";
76
+
77
+ const result = await nexra.tasks.run<NexraImageLayerDecompositionOutput>(
78
+ "bytedance/doubao-seedream-5-0-pro-260628",
79
+ {
80
+ content: [{ type: "image", source: "https://example.com/poster.png", role: "source" }],
81
+ output_mode: "layers",
82
+ resolution: "2K",
83
+ prompt_optimization: "standard",
84
+ output_format: "png",
85
+ },
86
+ { idempotencyKey: "poster-layers-1" },
87
+ );
88
+ for (const layer of result.output.layer_decomposition.layers) {
89
+ const url = result.output.images[layer.image_index];
90
+ console.log(layer.z_index, layer.name, layer.bounding_box, url);
91
+ }
92
+ ```
93
+
94
+ `image_index` associates metadata with the image array; `z_index` defines stacking
95
+ order, with zero for the background. Use `tasks.wait` when recovering an accepted
96
+ task. A background-delivery task is usable only when `deliveryStatus` is `ready`;
97
+ the stored image URLs can be reused without uploading them again. The provider's
98
+ Native request format remains available on its existing endpoint.
99
+
68
100
  ## Dolphin Seedance
69
101
 
70
102
  `0.1.0-alpha.41` adds the independently addressable models
package/dist/catalog.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as JsonObject } from './json-Cz0MkWQn.js';
2
- import { H as HttpTransport, A as NexraCatalogChangeParams, B as NexraCatalogChangePage, D as NexraCatalogModelState, u as NexraSalePriceList, d as CreateNexraQuoteRequest, s as NexraQuote, C as CreateNexraDisplayQuoteBatchRequest, n as NexraDisplayQuoteBatch, m as NexraCatalogRevision, q as NexraModelSpec, E as NexraModelEndpointSpec, r as NexraModelSpecFilter } from './media-geometry-YD9Y_CFw.js';
3
- export { e as MediaGeometryField, f as MediaGeometryProjection, l as NexraBillingCurrency, G as NexraCatalogModelIdentity, p as NexraModelOperation, t as NexraSalePrice, v as NexraSettlement, U as UnifiedMediaGeometry, w as applyMediaGeometry, x as decodeMediaGeometry, y as encodeMediaGeometry, z as projectMediaGeometry } from './media-geometry-YD9Y_CFw.js';
2
+ import { H as HttpTransport, N as NexraCatalogChangeParams, a as NexraCatalogChangePage, b as NexraCatalogModelState, c as NexraSalePriceList, C as CreateNexraQuoteRequest, d as NexraQuote, e as CreateNexraDisplayQuoteBatchRequest, f as NexraDisplayQuoteBatch, g as NexraCatalogRevision, h as NexraModelSpec, i as NexraModelEndpointSpec, j as NexraModelSpecFilter } from './media-geometry-BS4DZh4B.js';
3
+ export { M as MediaGeometryField, k as MediaGeometryProjection, l as NexraBillingCurrency, m as NexraCatalogModelIdentity, n as NexraModelOperation, o as NexraSalePrice, p as NexraSettlement, U as UnifiedMediaGeometry, q as applyMediaGeometry, r as decodeMediaGeometry, s as encodeMediaGeometry, t as projectMediaGeometry } from './media-geometry-BS4DZh4B.js';
4
4
 
5
5
  declare function formatModelDisplayName(displayName: string, identity?: {
6
6
  modelId: string;
package/dist/catalog.js CHANGED
@@ -9,8 +9,8 @@ import {
9
9
  listModelSpecs,
10
10
  projectMediaGeometry,
11
11
  resolveNexraLanguageReasoning
12
- } from "./chunk-JJD32I64.js";
13
- import "./chunk-ESPUF2D4.js";
12
+ } from "./chunk-ZNPLN7N6.js";
13
+ import "./chunk-LXR3MEF3.js";
14
14
  export {
15
15
  CatalogClient,
16
16
  applyMediaGeometry,
@@ -10,6 +10,7 @@ var MEDIA_KINDS = [
10
10
 
11
11
  // ../contracts/src/public-error-catalog.ts
12
12
  var PUBLIC_ERROR_CATALOG = {
13
+ queue_wait_timeout: { "zh-CN": "\u4EFB\u52A1\u6392\u961F\u7B49\u5F85\u6267\u884C\u8D85\u8FC7\u65F6\u9650\uFF0C\u5C1A\u672A\u63D0\u4EA4\u7ED9\u6A21\u578B\u670D\u52A1\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\uFF1B\u6301\u7EED\u8D85\u65F6\u65F6\u51ED\u8BF7\u6C42 ID \u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u3002", en: "The task exceeded its queue wait limit before submission to the model service. Try again later; contact a platform administrator with the request ID if queue timeouts persist." },
13
14
  task_execution_timeout: { "zh-CN": "\u4EFB\u52A1\u8D85\u8FC7\u603B\u65F6\u9650\uFF0C\u5DF2\u7ED3\u675F\u3002\u4E0A\u6E38\u53EF\u80FD\u4ECD\u5728\u5904\u7406\uFF0C\u8BF7\u5148\u6838\u5BF9\u539F\u8BF7\u6C42\u7ED3\u679C\uFF0C\u907F\u514D\u91CD\u590D\u63D0\u4EA4\u3002", en: "The task exceeded its total time limit and has ended. The upstream service may still be processing it; check the original request before submitting again." },
14
15
  authentication_required: { "zh-CN": "\u8BF7\u6C42\u672A\u63D0\u4F9B\u53EF\u7528\u7684 Nexra \u8EAB\u4EFD\u51ED\u8BC1\u3002\u8BF7\u767B\u5F55\u8D26\u6237\uFF0C\u6216\u5728\u8BF7\u6C42\u4E2D\u63D0\u4F9B\u6709\u6548\u7684 Nexra API Key\u3002", en: "The request has no usable Nexra credentials. Sign in or include a valid Nexra API key." },
15
16
  invalid_api_key: { "zh-CN": "\u63D0\u4F9B\u7684 Nexra API Key \u672A\u901A\u8FC7\u9A8C\u8BC1\u3002\u8BF7\u68C0\u67E5 Key \u662F\u5426\u6B63\u786E\u3001\u4ECD\u6709\u6548\u4E14\u672A\u88AB\u64A4\u9500\u3002", en: "The Nexra API key could not be verified. Check that it is correct, still valid, and has not been revoked." },
@@ -28,6 +29,7 @@ var PUBLIC_ERROR_CATALOG = {
28
29
  upstream_busy: { "zh-CN": "\u6A21\u578B\u670D\u52A1\u5F53\u524D\u7E41\u5FD9\u3002\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF1B\u5982\u5DF2\u6709\u8BF7\u6C42\u6216\u4EFB\u52A1 ID\uFF0C\u8BF7\u5148\u6838\u5BF9\u539F\u8BF7\u6C42\u72B6\u6001\uFF0C\u907F\u514D\u91CD\u590D\u63D0\u4EA4\u3002", en: "The model service is currently busy. Try again later; if a request or task ID already exists, check its status first to avoid duplicate submissions." },
29
30
  upstream_unavailable: { "zh-CN": "\u672C\u6B21\u6A21\u578B\u670D\u52A1\u8C03\u7528\u6682\u65F6\u4E0D\u53EF\u7528\u3002\u5982\u4EFB\u52A1\u5DF2\u7ECF\u63D0\u4EA4\uFF0C\u8BF7\u5148\u67E5\u8BE2\u539F\u4EFB\u52A1\u72B6\u6001\uFF1B\u6301\u7EED\u5F02\u5E38\u65F6\u51ED\u8BF7\u6C42 ID \u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u6838\u5BF9\u4E0A\u6E38\u670D\u52A1\u3002", en: "This call to the model service is currently unavailable. If a task has already been submitted, check its status first. Contact a platform administrator with the request ID if the problem persists." },
30
31
  upstream_response_invalid: { "zh-CN": "\u6A21\u578B\u670D\u52A1\u8FD4\u56DE\u7684\u54CD\u5E94\u4E0D\u7B26\u5408\u63A5\u53E3\u7EA6\u5B9A\uFF0C\u5E73\u53F0\u65E0\u6CD5\u53EF\u9760\u8BFB\u53D6\u7ED3\u679C\u3002\u8BF7\u67E5\u770B\u53EF\u7528\u7684\u4E0A\u6E38\u9519\u8BEF\u8BE6\u60C5\u548C\u539F\u8BF7\u6C42\u72B6\u6001\uFF0C\u5E76\u51ED\u8BF7\u6C42 ID \u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u3002", en: "The model service response does not meet the API contract, so the platform cannot read the result reliably. Check the available upstream error details and original request status, and contact a platform administrator with the request ID." },
32
+ upstream_image_missing: { "zh-CN": "\u6A21\u578B\u672A\u8FD4\u56DE\u56FE\u7247\u3002\u8BF7\u67E5\u770B\u6A21\u578B\u8FD4\u56DE\u7684\u5177\u4F53\u8BF4\u660E\uFF0C\u5E76\u6838\u5BF9\u539F\u8BF7\u6C42\u6216\u4EFB\u52A1\u72B6\u6001\u3002", en: "The model did not return an image. Review the model's explanation and check the original request or task status." },
31
33
  upstream_error: { "zh-CN": "\u672C\u6B21\u6A21\u578B\u670D\u52A1\u8C03\u7528\u51FA\u73B0\u9519\u8BEF\uFF0C\u5177\u4F53\u539F\u56E0\u5C1A\u672A\u786E\u8BA4\u3002\u8BF7\u67E5\u770B\u53EF\u7528\u7684\u9519\u8BEF\u8BE6\u60C5\u548C\u539F\u8BF7\u6C42\u6216\u4EFB\u52A1\u72B6\u6001\uFF1B\u9700\u8981\u534F\u52A9\u65F6\u63D0\u4F9B\u8BF7\u6C42 ID\u3002", en: "This call to the model service encountered an error whose specific cause has not been confirmed. Check the available error details and the original request or task status, and provide the request ID when requesting assistance." },
32
34
  execution_outcome_unknown: { "zh-CN": "\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u539F\u8BF7\u6C42\u662F\u5426\u5DF2\u88AB\u53D7\u7406\u6216\u5B8C\u6210\u3002\u8BF7\u4F7F\u7528\u539F\u8BF7\u6C42\u6216\u4EFB\u52A1 ID \u67E5\u8BE2\u72B6\u6001\uFF0C\u786E\u8BA4\u7ED3\u679C\u524D\u4E0D\u8981\u91CD\u590D\u63D0\u4EA4\u3002", en: "It is not yet known whether the original request was accepted or completed. Check its status using the original request or task ID, and do not submit it again until the outcome is confirmed." },
33
35
  stream_interrupted: { "zh-CN": "\u54CD\u5E94\u672A\u5B8C\u6574\u7ED3\u675F\uFF0C\u5DF2\u6536\u5230\u7684\u8F93\u51FA\u53EF\u80FD\u4E0D\u5B8C\u6574\u3002\u8BF7\u4FDD\u7559\u539F\u8BF7\u6C42 ID \u5E76\u67E5\u8BE2\u539F\u8BF7\u6C42\u72B6\u6001\uFF0C\u786E\u8BA4\u7ED3\u679C\u524D\u4E0D\u8981\u91CD\u590D\u63D0\u4EA4\u3002", en: "The response did not finish completely, so the output received may be incomplete. Keep the original request ID and check its status; do not submit again until the outcome is confirmed." },
@@ -123,7 +125,7 @@ var PUBLIC_ERROR_CATALOG = {
123
125
  invalid_input_format: { "zh-CN": "\u65E0\u6CD5\u8BC6\u522B\u8F93\u5165\u683C\u5F0F\u6807\u8BC6\u3002\u8BF7\u4F7F\u7528\u63A5\u53E3\u652F\u6301\u7684 inputFormat\uFF0C\u4E0D\u8981\u81EA\u884C\u589E\u52A0\u683C\u5F0F\u7248\u672C\u3002", en: "The input format identifier is not recognized. Use an inputFormat supported by the endpoint rather than inventing a format version." },
124
126
  invalid_input_mode: { "zh-CN": "\u8F93\u5165\u6A21\u5F0F\u4E3A\u7A7A\u6216\u4E0D\u7B26\u5408\u4EFB\u52A1\u7EC4\u8981\u6C42\u3002\u8BF7\u9009\u62E9\u652F\u6301\u7684 inputMode\uFF0C\u5E76\u63D0\u4F9B\u5339\u914D\u7684\u8F93\u5165\u5185\u5BB9\u3002", en: "The input mode is missing or does not meet the task run's requirements. Choose a supported inputMode and provide matching input content." },
125
127
  invalid_json: { "zh-CN": "\u8BF7\u6C42\u6B63\u6587\u65E0\u6CD5\u4F5C\u4E3A\u6709\u6548 JSON \u89E3\u6790\u3002\u8BF7\u68C0\u67E5 JSON \u8BED\u6CD5\u548C\u9876\u5C42\u7ED3\u6784\uFF0C\u5E76\u4F7F\u7528\u6B63\u786E\u7684 Content-Type\u3002", en: "The request body cannot be parsed as valid JSON. Check its syntax and top-level structure and use the correct Content-Type." },
126
- invalid_metadata: { "zh-CN": "\u4E1A\u52A1\u5143\u6570\u636E\u4E0D\u7B26\u5408\u8981\u6C42\u3002\u8BF7\u63D0\u4F9B JSON \u5BF9\u8C61\uFF0C\u5E76\u68C0\u67E5\u4FDD\u7559\u5B57\u6BB5 callerUrl \u7684 HTTPS \u6765\u6E90\u683C\u5F0F\u53CA endUserId \u7684\u5B57\u7B26\u4E32\u683C\u5F0F\u3002", en: "The metadata does not meet the requirements. Provide a JSON object and check the HTTPS origin format of callerUrl and the string format of endUserId." },
128
+ invalid_metadata: { "zh-CN": "\u4E1A\u52A1\u5143\u6570\u636E\u4E0D\u7B26\u5408\u8981\u6C42\u3002\u8BF7\u63D0\u4F9B JSON \u5BF9\u8C61\uFF0C\u5E76\u68C0\u67E5\u4FDD\u7559\u5B57\u6BB5 callerUrl \u7684 HTTPS \u6765\u6E90\u683C\u5F0F\u3001endUserId \u7684\u5B57\u7B26\u4E32\u683C\u5F0F\u53CA endUserIp \u7684 IPv4/IPv6 \u5730\u5740\u683C\u5F0F\u3002", en: "The metadata does not meet the requirements. Provide a JSON object and check the HTTPS origin format of callerUrl, the string format of endUserId, and the IPv4/IPv6 address format of endUserIp." },
127
129
  invalid_model: { "zh-CN": "\u8BF7\u6C42\u4E2D\u7684\u6A21\u578B\u6807\u8BC6\u6216\u6A21\u578B\u914D\u7F6E\u4E0D\u6EE1\u8DB3\u63A5\u53E3\u8981\u6C42\u3002\u8BF7\u6838\u5BF9\u5BF9\u5E94\u63A5\u53E3\u7684 model/Model ID \u548C\u6A21\u578B\u914D\u7F6E\u5B57\u6BB5\u3002", en: "The model identifier or configuration does not meet the endpoint's requirements. Check the endpoint's model or model ID and the model configuration fields." },
128
130
  invalid_model_endpoint: { "zh-CN": "\u6A21\u578B\u7AEF\u70B9\u914D\u7F6E\u672A\u6EE1\u8DB3\u8981\u6C42\u3002\u8BF7\u6838\u5BF9\u7AEF\u70B9\u6807\u8BC6\u3001\u534F\u8BAE\u3001\u64CD\u4F5C\u8DEF\u5F84\u548C\u53C2\u6570\u7ED3\u6784\u3002", en: "The model endpoint configuration does not meet the requirements. Check the endpoint identifier, protocol, operation paths, and parameter schema." },
129
131
  invalid_model_import: { "zh-CN": "\u6A21\u578B\u5BFC\u5165\u4FE1\u606F\u4E0D\u5B8C\u6574\u6216\u4E0D\u5339\u914D\u3002\u8BF7\u63D0\u4F9B\u4E0A\u6E38 Model ID\uFF0C\u5E76\u9009\u62E9\u5BF9\u5E94\u7684\u4EE3\u7801\u6A21\u578B\u3002", en: "The model import information is incomplete or inconsistent. Provide the upstream model ID and select the corresponding code-defined model." },
@@ -365,6 +367,19 @@ function extractUpstreamErrorMessage(value) {
365
367
  const message = record[key];
366
368
  if (typeof message === "string" && message.trim()) return message;
367
369
  }
370
+ if (Array.isArray(record.candidates)) {
371
+ const messages = record.candidates.flatMap((candidate2) => {
372
+ if (!isRecord(candidate2)) return [];
373
+ const parts = isRecord(candidate2.content) ? candidate2.content.parts : void 0;
374
+ const texts = Array.isArray(parts) ? parts.flatMap((part) => isRecord(part) && part.thought !== true && typeof part.text === "string" && part.text.trim() ? [part.text] : []) : [];
375
+ return texts.length ? texts : typeof candidate2.finishMessage === "string" && candidate2.finishMessage.trim() ? [candidate2.finishMessage] : [];
376
+ });
377
+ if (messages.length) return messages.join("\n");
378
+ }
379
+ if (isRecord(record.promptFeedback)) {
380
+ const message = record.promptFeedback.blockReasonMessage;
381
+ if (typeof message === "string" && message.trim()) return message;
382
+ }
368
383
  return void 0;
369
384
  };
370
385
  return read(value, 0);
@@ -404,21 +419,27 @@ var NEXRA_GENERATION_OPERATIONS = [
404
419
  "video.generate",
405
420
  "audio.generate",
406
421
  "image.upscale",
407
- "video.upscale"
422
+ "video.upscale",
423
+ "video.depth",
424
+ "video.segment"
408
425
  ];
409
426
  var NEXRA_MEDIA_OPERATIONS = [
410
427
  "image.generate",
411
428
  "video.generate",
412
429
  "audio.generate",
413
430
  "image.upscale",
414
- "video.upscale"
431
+ "video.upscale",
432
+ "video.depth",
433
+ "video.segment"
415
434
  ];
416
435
  var NEXRA_PUBLISHED_MEDIA_OPERATIONS = [
417
436
  "image.generate",
418
437
  "video.generate",
419
438
  "audio.generate",
420
439
  "image.upscale",
421
- "video.upscale"
440
+ "video.upscale",
441
+ "video.depth",
442
+ "video.segment"
422
443
  ];
423
444
  var NEXRA_MEDIA_FEATURES = [
424
445
  "text-to-image",
@@ -444,7 +465,9 @@ var NEXRA_MEDIA_FEATURES = [
444
465
  "voice-reference",
445
466
  "voice-design",
446
467
  "scale-factor",
447
- "target-resolution"
468
+ "target-resolution",
469
+ "video-depth",
470
+ "video-segment"
448
471
  ];
449
472
  var NEXRA_MEDIA_OPERATION_DEFINITIONS = Object.freeze([
450
473
  {
@@ -452,7 +475,7 @@ var NEXRA_MEDIA_OPERATION_DEFINITIONS = Object.freeze([
452
475
  status: "active",
453
476
  outputKind: "image",
454
477
  features: ["text-to-image", "image-to-image", "image-reference", "image-edit", "image-inpaint", "image-control"],
455
- parameterKeys: ["aspect_ratio", "resolution", "quality", "count", "output_format", "seed"]
478
+ parameterKeys: ["aspect_ratio", "resolution", "quality", "count", "output_format", "seed", "output_mode", "prompt_optimization"]
456
479
  },
457
480
  {
458
481
  operation: "video.generate",
@@ -481,6 +504,20 @@ var NEXRA_MEDIA_OPERATION_DEFINITIONS = Object.freeze([
481
504
  outputKind: "video",
482
505
  features: ["scale-factor", "target-resolution"],
483
506
  parameterKeys: ["scale", "resolution", "output_format", "preserve_details"]
507
+ },
508
+ {
509
+ operation: "video.depth",
510
+ status: "active",
511
+ outputKind: "video",
512
+ features: ["video-depth"],
513
+ parameterKeys: ["resolution"]
514
+ },
515
+ {
516
+ operation: "video.segment",
517
+ status: "active",
518
+ outputKind: "video",
519
+ features: ["video-segment"],
520
+ parameterKeys: ["resolution"]
484
521
  }
485
522
  ]);
486
523
  var mediaSourceSchema = {
@@ -538,9 +575,20 @@ function inputSchema(contentItems, properties, contentBounds = {}) {
538
575
  };
539
576
  }
540
577
  var imagePart = mediaPartSchema("image", ["source", "reference", "first_frame", "last_frame", "mask", "control", "subject", "background"]);
541
- var videoImagePart = mediaPartSchema("image", ["source", "reference", "first_frame", "last_frame", "mask", "control", "subject", "background", "keyframe"]);
578
+ var videoImagePart = mediaPartSchema("image", ["source", "reference", "first_frame", "middle_frame", "last_frame", "mask", "control", "subject", "background", "keyframe"]);
542
579
  var videoPart = mediaPartSchema("video", ["source", "reference", "edit", "extend"]);
543
580
  var audioPart = mediaPartSchema("audio", ["source", "reference", "voice_reference"]);
581
+ var resourcePart = {
582
+ type: "object",
583
+ properties: {
584
+ type: { const: "resource" },
585
+ resource: { type: "string", enum: ["element", "voice"] },
586
+ source: { type: "string", minLength: 1 },
587
+ name: { type: "string", minLength: 1 }
588
+ },
589
+ required: ["type", "resource", "source", "name"],
590
+ additionalProperties: false
591
+ };
544
592
  var draftPart = {
545
593
  type: "object",
546
594
  properties: {
@@ -554,6 +602,8 @@ var NEXRA_MEDIA_INPUT_SCHEMAS = Object.freeze({
554
602
  "image.generate": inputSchema(
555
603
  [textPartSchema(["prompt", "negative_prompt"]), imagePart],
556
604
  {
605
+ output_mode: { type: "string", enum: ["image", "layers"], "x-ui": { hidden: true } },
606
+ prompt_optimization: { type: "string", enum: ["standard", "fast"], "x-ui": { hidden: true } },
557
607
  aspect_ratio: { type: "string", minLength: 1, "x-ui": { order: 10 } },
558
608
  resolution: { type: "string", minLength: 1, "x-ui": { order: 11 } },
559
609
  quality: { type: "string", minLength: 1, "x-ui": { order: 12 } },
@@ -563,7 +613,7 @@ var NEXRA_MEDIA_INPUT_SCHEMAS = Object.freeze({
563
613
  }
564
614
  ),
565
615
  "video.generate": inputSchema(
566
- [textPartSchema(["prompt", "negative_prompt", "script"]), videoImagePart, videoPart, audioPart, draftPart],
616
+ [textPartSchema(["prompt", "negative_prompt", "script"]), videoImagePart, videoPart, audioPart, draftPart, resourcePart],
567
617
  {
568
618
  task_type: { type: "string", minLength: 1, "x-ui": { order: 8, control: "segmented" } },
569
619
  voice: { type: "string", minLength: 1, "x-ui": { order: 9, control: "resource", resource: "voice" } },
@@ -618,6 +668,16 @@ var NEXRA_MEDIA_INPUT_SCHEMAS = Object.freeze({
618
668
  preserve_details: { type: "boolean", "x-ui": { order: 13, control: "switch" } }
619
669
  },
620
670
  { minItems: 1, maxItems: 1 }
671
+ ),
672
+ "video.segment": inputSchema(
673
+ [textPartSchema(["prompt"]), mediaPartSchema("video", ["source"])],
674
+ { resolution: { type: "string", minLength: 1, "x-ui": { order: 10 } } },
675
+ { minItems: 2, maxItems: 2 }
676
+ ),
677
+ "video.depth": inputSchema(
678
+ [mediaPartSchema("video", ["source"])],
679
+ { resolution: { type: "string", minLength: 1, "x-ui": { order: 10 } } },
680
+ { minItems: 1, maxItems: 1 }
621
681
  )
622
682
  });
623
683
  function nexraMediaInputSchema(operation) {
@@ -632,6 +692,7 @@ function isNexraMediaInput(value) {
632
692
  return Array.isArray(content) && content.length > 0 && content.every((part) => {
633
693
  if (!part || typeof part !== "object" || Array.isArray(part)) return false;
634
694
  if (part.type === "text") return typeof part.text === "string" && part.text.length > 0;
695
+ if (part.type === "resource") return ["element", "voice"].includes(String(part.resource)) && typeof part.source === "string" && part.source.length > 0 && typeof part.name === "string" && part.name.length > 0;
635
696
  if (part.type === "draft_task") {
636
697
  const reference = part.draft_task;
637
698
  return Boolean(reference && typeof reference === "object" && !Array.isArray(reference) && typeof reference.id === "string" && reference.id.length > 0);
@@ -646,6 +707,9 @@ function nexraMediaOperationForMode(mode) {
646
707
  if (["text-to-video", "image-to-video", "multimodal-to-video", "avatar-video"].includes(mode)) return "video.generate";
647
708
  if (["text-to-speech", "text-to-music", "text-to-sfx"].includes(mode)) return "audio.generate";
648
709
  if (mode === "image-upscale") return "image.upscale";
710
+ if (mode === "video-upscale") return "video.upscale";
711
+ if (mode === "video-depth") return "video.depth";
712
+ if (mode === "video-segment") return "video.segment";
649
713
  return void 0;
650
714
  }
651
715
  function nexraMediaInputSchemaForMode(mode) {
@@ -687,10 +751,11 @@ function nexraMediaInputSchemaForMode(mode) {
687
751
  variant.required = [...required];
688
752
  }
689
753
  }
690
- const requiredMedia = mode === "image-to-image" || mode === "image-to-video" || mode === "avatar-video" ? "image" : void 0;
754
+ const requiredMedia = ["video-depth", "video-segment"].includes(mode) ? "video" : mode === "image-to-image" || mode === "image-to-video" || mode === "avatar-video" ? "image" : void 0;
691
755
  const requiresReferenceMedia = mode === "multimodal-to-video";
756
+ const hasTextPart = items.oneOf.some((variant) => variant.properties.type.const === "text");
692
757
  content.allOf = [
693
- ...mode === "avatar-video" ? [] : [{
758
+ ...mode === "avatar-video" || !hasTextPart ? [] : [{
694
759
  contains: { type: "object", properties: { type: { const: "text" } }, required: ["type"] },
695
760
  minContains: 1
696
761
  }],