@nodaro/shared 3.60.1 → 3.62.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-5Y42RIGY.cjs → chunk-2D5LQFV4.cjs} +18 -332
- package/dist/chunk-2D5LQFV4.cjs.map +1 -0
- package/dist/{chunk-5G23AJBU.cjs → chunk-2HZGDZZN.cjs} +6 -6
- package/dist/{chunk-5G23AJBU.cjs.map → chunk-2HZGDZZN.cjs.map} +1 -1
- package/dist/{chunk-DS2TOM32.js → chunk-2QKF7M2Z.js} +28 -4
- package/dist/chunk-2QKF7M2Z.js.map +1 -0
- package/dist/{chunk-CIOXUPCJ.cjs → chunk-2W745U4A.cjs} +228 -355
- package/dist/chunk-2W745U4A.cjs.map +1 -0
- package/dist/{chunk-LN3EVFRS.js → chunk-3OYO3XCC.js} +70 -6
- package/dist/chunk-3OYO3XCC.js.map +1 -0
- package/dist/{chunk-5HK5Z5OB.cjs → chunk-4ZEFP2FQ.cjs} +4 -4
- package/dist/{chunk-5HK5Z5OB.cjs.map → chunk-4ZEFP2FQ.cjs.map} +1 -1
- package/dist/{chunk-KOLC7AF2.js → chunk-5YYN5X57.js} +398 -38
- package/dist/chunk-5YYN5X57.js.map +1 -0
- package/dist/{chunk-RRPPXZ36.cjs → chunk-6CSXMWL4.cjs} +4 -4
- package/dist/{chunk-RRPPXZ36.cjs.map → chunk-6CSXMWL4.cjs.map} +1 -1
- package/dist/{chunk-M3SXUUWC.cjs → chunk-6FQBKI2A.cjs} +4 -11
- package/dist/chunk-6FQBKI2A.cjs.map +1 -0
- package/dist/{chunk-G4XWVWRI.js → chunk-6G7NN4S4.js} +5 -4
- package/dist/chunk-6G7NN4S4.js.map +1 -0
- package/dist/{chunk-HOKWJXHA.cjs → chunk-A2PX5IRC.cjs} +31 -4
- package/dist/chunk-A2PX5IRC.cjs.map +1 -0
- package/dist/{chunk-W4M7TNXG.cjs → chunk-AFYTX4AI.cjs} +52 -43
- package/dist/chunk-AFYTX4AI.cjs.map +1 -0
- package/dist/chunk-ALRXY4QH.cjs +13 -0
- package/dist/chunk-ALRXY4QH.cjs.map +1 -0
- package/dist/chunk-AOJ6B7K4.cjs +351 -0
- package/dist/chunk-AOJ6B7K4.cjs.map +1 -0
- package/dist/{chunk-KJZVQIN4.js → chunk-C7POAYFE.js} +3 -3
- package/dist/{chunk-KJZVQIN4.js.map → chunk-C7POAYFE.js.map} +1 -1
- package/dist/{chunk-6Q6SI7AG.js → chunk-CC4V2B7S.js} +3 -3
- package/dist/{chunk-6Q6SI7AG.js.map → chunk-CC4V2B7S.js.map} +1 -1
- package/dist/{chunk-GNPJ2JLE.cjs → chunk-CIPPPT7E.cjs} +6 -6
- package/dist/{chunk-GNPJ2JLE.cjs.map → chunk-CIPPPT7E.cjs.map} +1 -1
- package/dist/{chunk-6XVHYD5R.js → chunk-CLAKSLXF.js} +4 -9
- package/dist/chunk-CLAKSLXF.js.map +1 -0
- package/dist/chunk-CTANEPMY.js +61 -0
- package/dist/chunk-CTANEPMY.js.map +1 -0
- package/dist/{chunk-WGKAOUEQ.cjs → chunk-D34K455O.cjs} +3 -2
- package/dist/chunk-D34K455O.cjs.map +1 -0
- package/dist/chunk-E2HZTGYX.js +331 -0
- package/dist/chunk-E2HZTGYX.js.map +1 -0
- package/dist/{chunk-SKFJIFEV.cjs → chunk-G3KVK7OU.cjs} +21 -21
- package/dist/{chunk-SKFJIFEV.cjs.map → chunk-G3KVK7OU.cjs.map} +1 -1
- package/dist/chunk-G4U3HW6W.js +453 -0
- package/dist/chunk-G4U3HW6W.js.map +1 -0
- package/dist/{chunk-EN2YI5TV.js → chunk-GSFB537T.js} +3 -3
- package/dist/{chunk-EN2YI5TV.js.map → chunk-GSFB537T.js.map} +1 -1
- package/dist/chunk-HRY7KGAE.cjs +506 -0
- package/dist/chunk-HRY7KGAE.cjs.map +1 -0
- package/dist/{chunk-6AJOTEVC.js → chunk-I2RQB7VG.js} +3 -3
- package/dist/{chunk-6AJOTEVC.js.map → chunk-I2RQB7VG.js.map} +1 -1
- package/dist/chunk-IDTKF5EX.cjs +48 -0
- package/dist/chunk-IDTKF5EX.cjs.map +1 -0
- package/dist/{chunk-DQIJPDHC.cjs → chunk-IWWVPR3W.cjs} +88 -11
- package/dist/chunk-IWWVPR3W.cjs.map +1 -0
- package/dist/{chunk-URLDVK67.js → chunk-JJNNM23P.js} +3 -3
- package/dist/{chunk-URLDVK67.js.map → chunk-JJNNM23P.js.map} +1 -1
- package/dist/{chunk-YHVEZVAO.js → chunk-JZGZ26YB.js} +6 -306
- package/dist/chunk-JZGZ26YB.js.map +1 -0
- package/dist/{chunk-XROE3CAS.cjs → chunk-KHH54GRP.cjs} +120 -79
- package/dist/chunk-KHH54GRP.cjs.map +1 -0
- package/dist/{chunk-AXT7YNOR.cjs → chunk-KJSRPHJ2.cjs} +48 -47
- package/dist/chunk-KJSRPHJ2.cjs.map +1 -0
- package/dist/{chunk-FVVD6XY2.js → chunk-KL6GAYTT.js} +13 -4
- package/dist/chunk-KL6GAYTT.js.map +1 -0
- package/dist/{chunk-AFQFGZN7.cjs → chunk-KYMHFVAZ.cjs} +8 -6
- package/dist/chunk-KYMHFVAZ.cjs.map +1 -0
- package/dist/{chunk-A6HRY3WF.cjs → chunk-MYJQELFN.cjs} +420 -37
- package/dist/chunk-MYJQELFN.cjs.map +1 -0
- package/dist/chunk-N5HH46JF.cjs +68 -0
- package/dist/chunk-N5HH46JF.cjs.map +1 -0
- package/dist/{chunk-BXNPO3PL.cjs → chunk-N7OUQK7E.cjs} +8 -8
- package/dist/{chunk-BXNPO3PL.cjs.map → chunk-N7OUQK7E.cjs.map} +1 -1
- package/dist/{chunk-JKZVRKN3.js → chunk-NGKKNSK6.js} +31 -8
- package/dist/chunk-NGKKNSK6.js.map +1 -0
- package/dist/{chunk-SWVGHAYO.js → chunk-O7RZRUMZ.js} +110 -74
- package/dist/chunk-O7RZRUMZ.js.map +1 -0
- package/dist/{chunk-SCYBGTX6.js → chunk-PTD6EDUU.js} +3 -3
- package/dist/{chunk-SCYBGTX6.js.map → chunk-PTD6EDUU.js.map} +1 -1
- package/dist/{chunk-BDXXOEBZ.cjs → chunk-QWYFHQYK.cjs} +79 -54
- package/dist/chunk-QWYFHQYK.cjs.map +1 -0
- package/dist/{chunk-VB2ARGQ6.js → chunk-RGNHHIMN.js} +3 -3
- package/dist/chunk-RGNHHIMN.js.map +1 -0
- package/dist/{chunk-AZGONXWV.js → chunk-S24ZBUB4.js} +194 -299
- package/dist/chunk-S24ZBUB4.js.map +1 -0
- package/dist/{chunk-IV6IDECY.js → chunk-S5TMRJMX.js} +4 -4
- package/dist/{chunk-IV6IDECY.js.map → chunk-S5TMRJMX.js.map} +1 -1
- package/dist/chunk-SMOO5FAH.js +10 -0
- package/dist/chunk-SMOO5FAH.js.map +1 -0
- package/dist/{chunk-HYBACFYW.js → chunk-SYWR5G3T.js} +16 -7
- package/dist/chunk-SYWR5G3T.js.map +1 -0
- package/dist/{chunk-GWBQ3GPO.cjs → chunk-TRVWMKNE.cjs} +343 -53
- package/dist/chunk-TRVWMKNE.cjs.map +1 -0
- package/dist/{chunk-G6GMY5BC.js → chunk-UDDVDQMF.js} +298 -36
- package/dist/chunk-UDDVDQMF.js.map +1 -0
- package/dist/{chunk-PONP5J5E.cjs → chunk-V24EPI5N.cjs} +13 -3
- package/dist/chunk-V24EPI5N.cjs.map +1 -0
- package/dist/{chunk-HDHLZK7C.cjs → chunk-VACPZPUA.cjs} +5 -5
- package/dist/{chunk-HDHLZK7C.cjs.map → chunk-VACPZPUA.cjs.map} +1 -1
- package/dist/{chunk-ICDLYU4I.js → chunk-Y6X7UJSD.js} +10 -9
- package/dist/chunk-Y6X7UJSD.js.map +1 -0
- package/dist/chunk-YCXRSWCQ.js +42 -0
- package/dist/chunk-YCXRSWCQ.js.map +1 -0
- package/dist/entries/apps.cjs +44 -44
- package/dist/entries/apps.js +9 -9
- package/dist/entries/credits.cjs +217 -152
- package/dist/entries/credits.d.cts +112 -6
- package/dist/entries/credits.d.ts +112 -6
- package/dist/entries/credits.js +13 -8
- package/dist/entries/entities.cjs +188 -143
- package/dist/entries/entities.d.cts +122 -1
- package/dist/entries/entities.d.ts +122 -1
- package/dist/entries/entities.js +2 -1
- package/dist/entries/llm-models.d.cts +2 -1
- package/dist/entries/llm-models.d.ts +2 -1
- package/dist/entries/media.cjs +92 -87
- package/dist/entries/media.d.cts +11 -1
- package/dist/entries/media.d.ts +11 -1
- package/dist/entries/media.js +3 -2
- package/dist/entries/model-catalog.cjs +207 -99
- package/dist/entries/model-catalog.d.cts +90 -4
- package/dist/entries/model-catalog.d.ts +90 -4
- package/dist/entries/model-catalog.js +5 -5
- package/dist/entries/models.cjs +407 -294
- package/dist/entries/models.d.cts +4 -3
- package/dist/entries/models.d.ts +4 -3
- package/dist/entries/models.js +6 -5
- package/dist/entries/nodes.cjs +241 -233
- package/dist/entries/nodes.d.cts +15 -2
- package/dist/entries/nodes.d.ts +15 -2
- package/dist/entries/nodes.js +10 -10
- package/dist/entries/pipeline.cjs +152 -152
- package/dist/entries/pipeline.d.cts +2 -1
- package/dist/entries/pipeline.d.ts +2 -1
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +308 -204
- package/dist/entries/video.d.cts +480 -98
- package/dist/entries/video.d.ts +480 -98
- package/dist/entries/video.js +8 -4
- package/dist/entries/workflow.cjs +111 -99
- package/dist/entries/workflow.d.cts +29 -2
- package/dist/entries/workflow.d.ts +29 -2
- package/dist/entries/workflow.js +2 -2
- package/dist/{gpt-image-2-6-BeZdT-pW.d.cts → gpt-image-2-6-jIRQBRag.d.cts} +6 -0
- package/dist/{gpt-image-2-6-BeZdT-pW.d.ts → gpt-image-2-6-jIRQBRag.d.ts} +6 -0
- package/dist/index.cjs +2321 -1870
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +26 -23
- package/dist/{model-catalog-D6Es7VG-.d.cts → model-catalog-CCEcv08q.d.cts} +179 -14
- package/dist/{model-catalog-D6Es7VG-.d.ts → model-catalog-CCEcv08q.d.ts} +179 -14
- package/dist/{model-constants-22k3fjp1.d.cts → model-constants-B88p6XR0.d.ts} +305 -20
- package/dist/{model-constants-22k3fjp1.d.ts → model-constants-Cf3zaITt.d.cts} +305 -20
- package/package.json +1 -1
- package/src/__tests__/extend-providers.test.ts +114 -0
- package/src/__tests__/fixtures/mask-composite-quote-parity.json +118 -0
- package/src/__tests__/fixtures/root-exports.baseline.json +68 -0
- package/src/__tests__/gpt-image-2-6-formats.test.ts +4 -1
- package/src/__tests__/gpt-image-2-6.test.ts +7 -0
- package/src/__tests__/grok-video-15-catalog.test.ts +189 -0
- package/src/__tests__/gvp-supported-providers.test.ts +5 -2
- package/src/__tests__/image-mask-mode.test.ts +34 -1
- package/src/__tests__/mask-edit-follows-source.test.ts +150 -0
- package/src/__tests__/minimax-h3-image.test.ts +140 -0
- package/src/__tests__/model-makers.test.ts +49 -11
- package/src/__tests__/model-tree.test.ts +13 -0
- package/src/__tests__/retired-video-provider.test.ts +15 -5
- package/src/__tests__/seedance-25-catalog-modes.test.ts +1 -1
- package/src/__tests__/seedance-task-type.test.ts +178 -0
- package/src/__tests__/seedream-5-5.test.ts +117 -0
- package/src/__tests__/unit-contract-compose.test.ts +27 -1
- package/src/__tests__/unit-contracts.test.ts +20 -6
- package/src/__tests__/upscale-factors.test.ts +107 -0
- package/src/__tests__/video-character-refs.test.ts +20 -2
- package/src/__tests__/video-collapse-parity.test.ts +19 -0
- package/src/__tests__/video-overlay-geometry.test.ts +68 -0
- package/src/__tests__/video-overlay-layer-plan.test.ts +3 -4
- package/src/__tests__/video-overlay-layouts.test.ts +529 -0
- package/src/__tests__/video-overlay-pricing.test.ts +61 -0
- package/src/__tests__/video-overlay-validate.test.ts +128 -0
- package/src/__tests__/video-overlay-wired-kind.test.ts +207 -0
- package/src/__tests__/video-overlay.test.ts +280 -194
- package/src/__tests__/video-ref-limits.test.ts +2 -1
- package/src/__tests__/video-reference-only.test.ts +6 -2
- package/src/__tests__/video-start-frame-only.test.ts +98 -0
- package/src/__tests__/wired-character-names.test.ts +220 -0
- package/src/credit-estimators/index.ts +8 -0
- package/src/credit-estimators/video-overlay.ts +70 -0
- package/src/credit-identifiers.ts +102 -5
- package/src/entity-image-url.ts +21 -0
- package/src/entries/credits.ts +14 -0
- package/src/entries/entities.ts +14 -0
- package/src/entries/model-catalog.ts +39 -1
- package/src/entries/models.ts +34 -0
- package/src/entries/nodes.ts +2 -0
- package/src/entries/video.ts +6 -0
- package/src/entries/workflow.ts +1 -0
- package/src/generated/unit-contracts.ts +8 -1
- package/src/gpt-image-2-6.ts +6 -0
- package/src/input-image-pricing.ts +76 -0
- package/src/mask-composite.ts +11 -0
- package/src/minimax-h3-image.ts +61 -0
- package/src/model-catalog.ts +512 -48
- package/src/model-constants.ts +602 -34
- package/src/node-default-mappings.ts +12 -2
- package/src/node-execution-state.ts +4 -1
- package/src/producer-types.ts +23 -1
- package/src/seedance-task-type.ts +37 -0
- package/src/seedream-5-5.ts +45 -0
- package/src/unit-contract-compose.ts +4 -1
- package/src/upscale-factors.ts +111 -0
- package/src/video-character-refs.ts +7 -4
- package/src/video-overlay-geometry.ts +99 -0
- package/src/video-overlay-input.ts +25 -0
- package/src/video-overlay-layout-ids.ts +48 -0
- package/src/video-overlay-layouts.ts +315 -0
- package/src/video-overlay-validate.ts +223 -0
- package/src/video-overlay-video-layers.ts +304 -0
- package/src/video-overlay.ts +165 -297
- package/src/video-ui-defaults.ts +8 -6
- package/src/wired-character-names.ts +202 -0
- package/src/wired-image-size.ts +55 -0
- package/dist/chunk-5Y42RIGY.cjs.map +0 -1
- package/dist/chunk-6XVHYD5R.js.map +0 -1
- package/dist/chunk-A6HRY3WF.cjs.map +0 -1
- package/dist/chunk-AFQFGZN7.cjs.map +0 -1
- package/dist/chunk-AXT7YNOR.cjs.map +0 -1
- package/dist/chunk-AZGONXWV.js.map +0 -1
- package/dist/chunk-BDXXOEBZ.cjs.map +0 -1
- package/dist/chunk-CIOXUPCJ.cjs.map +0 -1
- package/dist/chunk-DQIJPDHC.cjs.map +0 -1
- package/dist/chunk-DS2TOM32.js.map +0 -1
- package/dist/chunk-FVVD6XY2.js.map +0 -1
- package/dist/chunk-G4XWVWRI.js.map +0 -1
- package/dist/chunk-G6GMY5BC.js.map +0 -1
- package/dist/chunk-G7ZYZQKO.cjs +0 -27
- package/dist/chunk-G7ZYZQKO.cjs.map +0 -1
- package/dist/chunk-GWBQ3GPO.cjs.map +0 -1
- package/dist/chunk-HNEF2N5C.cjs +0 -19
- package/dist/chunk-HNEF2N5C.cjs.map +0 -1
- package/dist/chunk-HOKWJXHA.cjs.map +0 -1
- package/dist/chunk-HYBACFYW.js.map +0 -1
- package/dist/chunk-ICDLYU4I.js.map +0 -1
- package/dist/chunk-JKZVRKN3.js.map +0 -1
- package/dist/chunk-KOLC7AF2.js.map +0 -1
- package/dist/chunk-LN3EVFRS.js.map +0 -1
- package/dist/chunk-M3SXUUWC.cjs.map +0 -1
- package/dist/chunk-MHY47BLL.js +0 -23
- package/dist/chunk-MHY47BLL.js.map +0 -1
- package/dist/chunk-PONP5J5E.cjs.map +0 -1
- package/dist/chunk-SWVGHAYO.js.map +0 -1
- package/dist/chunk-VB2ARGQ6.js.map +0 -1
- package/dist/chunk-VYQ25YQF.js +0 -17
- package/dist/chunk-VYQ25YQF.js.map +0 -1
- package/dist/chunk-W4M7TNXG.cjs.map +0 -1
- package/dist/chunk-WGKAOUEQ.cjs.map +0 -1
- package/dist/chunk-XROE3CAS.cjs.map +0 -1
- package/dist/chunk-YHVEZVAO.js.map +0 -1
|
@@ -69,6 +69,19 @@ describe("buildModelTree", () => {
|
|
|
69
69
|
expect(flux?.models.some((m) => m.label.toLowerCase().includes("kontext"))).toBe(true)
|
|
70
70
|
expect(tree.some((l) => l.series.toLowerCase().includes("kontext"))).toBe(false)
|
|
71
71
|
})
|
|
72
|
+
it("keeps the Hailuo line the video line it was, and MiniMax H3 Image in a line of its own", () => {
|
|
73
|
+
const hailuo = tree.filter((l) => l.series === "Hailuo")
|
|
74
|
+
expect(hailuo).toHaveLength(1)
|
|
75
|
+
expect(hailuo[0]!.kind).toBe("video")
|
|
76
|
+
// The members the line had before MiniMax H3 Image was added: no image model joins it.
|
|
77
|
+
expect(hailuo[0]!.models.map((m) => m.id).sort()).toEqual(
|
|
78
|
+
["hailuo-2.3", "hailuo-2.3-pro", "hailuo-avatar", "hailuo-standard", "minimax", "minimax-h3"],
|
|
79
|
+
)
|
|
80
|
+
const image = tree.filter((l) => l.series === "MiniMax Image")
|
|
81
|
+
expect(image).toHaveLength(1)
|
|
82
|
+
expect(image[0]!.kind).toBe("image")
|
|
83
|
+
expect(image[0]!.models.map((m) => m.id).sort()).toEqual(["minimax-h3-image", "minimax-h3-image-i2i"])
|
|
84
|
+
})
|
|
72
85
|
})
|
|
73
86
|
|
|
74
87
|
describe("searchModelVariants", () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest"
|
|
2
2
|
import {
|
|
3
|
+
EXTEND_VIDEO_PROVIDERS,
|
|
3
4
|
IMAGE_TO_VIDEO_PROVIDERS,
|
|
4
5
|
OBJECT_MOTION_PROVIDERS,
|
|
5
6
|
RETIRED_VIDEO_PROVIDERS,
|
|
@@ -10,26 +11,35 @@ import { MODEL_CATALOG } from "../model-catalog.js"
|
|
|
10
11
|
import { PIPELINE_PINNABLE_VIDEO_MODELS, PipelineConfigSchema } from "../pipeline-types.js"
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
|
-
* A retired video model (Seedance 1.5, retired upstream 2026-10-25
|
|
14
|
+
* A retired video model id (Seedance 1.5, retired upstream 2026-10-25; the one
|
|
15
|
+
* Seedance Extend Video provider, split into one provider per model) has no
|
|
14
16
|
* catalog entry and is in no provider list; every stored or sent copy of its
|
|
15
17
|
* id runs as the model it became.
|
|
16
18
|
*/
|
|
17
19
|
describe("RETIRED_VIDEO_PROVIDERS", () => {
|
|
18
|
-
it("a retired id is gone from the catalog and every provider list; the model it runs as is live in
|
|
20
|
+
it("a retired id is gone from the catalog and every provider list; the model it runs as is live in the list of its own kind", () => {
|
|
19
21
|
for (const [retired, runsAs] of Object.entries(RETIRED_VIDEO_PROVIDERS)) {
|
|
20
22
|
expect(MODEL_CATALOG[retired], retired).toBeUndefined()
|
|
21
|
-
for (const list of [IMAGE_TO_VIDEO_PROVIDERS, TEXT_TO_VIDEO_PROVIDERS, OBJECT_MOTION_PROVIDERS, PIPELINE_PINNABLE_VIDEO_MODELS]) {
|
|
23
|
+
for (const list of [IMAGE_TO_VIDEO_PROVIDERS, TEXT_TO_VIDEO_PROVIDERS, OBJECT_MOTION_PROVIDERS, PIPELINE_PINNABLE_VIDEO_MODELS, EXTEND_VIDEO_PROVIDERS]) {
|
|
22
24
|
expect((list as readonly string[]).includes(retired), retired).toBe(false)
|
|
23
25
|
}
|
|
24
26
|
expect(MODEL_CATALOG[runsAs]?.kind, runsAs).toBe("video")
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
if (MODEL_CATALOG[runsAs]!.modes.includes("extend")) {
|
|
28
|
+
// An Extend Video provider: live in the extend list.
|
|
29
|
+
expect((EXTEND_VIDEO_PROVIDERS as readonly string[]).includes(runsAs), runsAs).toBe(true)
|
|
30
|
+
} else {
|
|
31
|
+
// A generation model: live in both modes.
|
|
32
|
+
expect((IMAGE_TO_VIDEO_PROVIDERS as readonly string[]).includes(runsAs), runsAs).toBe(true)
|
|
33
|
+
expect((TEXT_TO_VIDEO_PROVIDERS as readonly string[]).includes(runsAs), runsAs).toBe(true)
|
|
34
|
+
}
|
|
27
35
|
}
|
|
28
36
|
})
|
|
29
37
|
|
|
30
38
|
it("canonicalVideoProvider maps a retired id and passes anything else through", () => {
|
|
31
39
|
expect(canonicalVideoProvider("seedance")).toBe("seedance-2-mini")
|
|
40
|
+
expect(canonicalVideoProvider("seedance-2-extend")).toBe("seedance-2-5-extend")
|
|
32
41
|
expect(canonicalVideoProvider("seedance-2")).toBe("seedance-2")
|
|
42
|
+
expect(canonicalVideoProvider("seedance-2-0-extend")).toBe("seedance-2-0-extend")
|
|
33
43
|
expect(canonicalVideoProvider(undefined)).toBeUndefined()
|
|
34
44
|
expect(canonicalVideoProvider("constructor")).toBe("constructor")
|
|
35
45
|
})
|
|
@@ -30,6 +30,6 @@ describe("Seedance 2.5 in the catalog", () => {
|
|
|
30
30
|
|
|
31
31
|
it("is not listed as an extend model: extending is a model of its own", () => {
|
|
32
32
|
expect(entry.modes).not.toContain("extend")
|
|
33
|
-
expect(MODEL_CATALOG["seedance-2-extend"]?.modes).toContain("extend")
|
|
33
|
+
expect(MODEL_CATALOG["seedance-2-5-extend"]?.modes).toContain("extend")
|
|
34
34
|
})
|
|
35
35
|
})
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest"
|
|
2
|
+
import {
|
|
3
|
+
listedSeedanceTaskType,
|
|
4
|
+
resolveSeedanceTaskType,
|
|
5
|
+
seedanceTaskTypeFitsMedia,
|
|
6
|
+
supportsReferenceTaskType,
|
|
7
|
+
SEEDANCE_VIDEO_EDIT_SHAPE,
|
|
8
|
+
type SeedanceTaskTypeFacts,
|
|
9
|
+
} from "../model-constants.js"
|
|
10
|
+
import { isVideoAutoAspectToken, videoAutoAspectRunsAt } from "../model-catalog.js"
|
|
11
|
+
|
|
12
|
+
const base: Omit<SeedanceTaskTypeFacts, "requested"> = {
|
|
13
|
+
provider: "seedance-2-5",
|
|
14
|
+
draft: false,
|
|
15
|
+
referenceImageCount: 0,
|
|
16
|
+
referenceAudioCount: 0,
|
|
17
|
+
referenceVideoSec: [6],
|
|
18
|
+
aspectRatio: "16:9",
|
|
19
|
+
duration: 5,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Nothing declared, ratio and length exactly as given, nothing reported. */
|
|
23
|
+
function expectUnchanged(facts: SeedanceTaskTypeFacts): void {
|
|
24
|
+
expect(resolveSeedanceTaskType(facts)).toEqual({
|
|
25
|
+
taskType: undefined,
|
|
26
|
+
aspectRatio: facts.aspectRatio,
|
|
27
|
+
duration: facts.duration,
|
|
28
|
+
adjustments: [],
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
describe("resolveSeedanceTaskType", () => {
|
|
33
|
+
it("edit: declares it and forces adaptive + Auto", () => {
|
|
34
|
+
const r = resolveSeedanceTaskType({ ...base, requested: "edit" })
|
|
35
|
+
expect(r).toMatchObject({ taskType: "edit", aspectRatio: "adaptive", duration: -1 })
|
|
36
|
+
expect(r.adjustments.map((a) => a.field).sort()).toEqual(["aspectRatio", "duration"])
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it("extend: forces adaptive, keeps a fixed length, replaces Auto with the model's default", () => {
|
|
40
|
+
expect(resolveSeedanceTaskType({ ...base, requested: "extend" })).toMatchObject({ taskType: "extend", aspectRatio: "adaptive", duration: 5 })
|
|
41
|
+
expect(resolveSeedanceTaskType({ ...base, requested: "extend", duration: -1 }).duration).toBe(8)
|
|
42
|
+
expect(resolveSeedanceTaskType({ ...base, requested: "extend", duration: undefined }).duration).toBe(8)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it("reference: declares it and changes nothing, adaptive and Auto included", () => {
|
|
46
|
+
expect(resolveSeedanceTaskType({ ...base, requested: "reference", aspectRatio: "adaptive", duration: -1 }))
|
|
47
|
+
.toEqual({ taskType: "reference", aspectRatio: "adaptive", duration: -1, adjustments: [] })
|
|
48
|
+
expect(resolveSeedanceTaskType({ ...base, requested: "reference", referenceVideoSec: [], referenceImageCount: 2 }).taskType).toBe("reference")
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it.each([
|
|
52
|
+
["auto", "auto"], ["absent", undefined], ["wrong case", "EDIT"], ["number", 1], ["array", []], ["null", null],
|
|
53
|
+
])("%s is Auto: unchanged", (_n, requested) => {
|
|
54
|
+
expectUnchanged({ ...base, requested })
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it("another model: unchanged, even with a stale value", () => {
|
|
58
|
+
expectUnchanged({ ...base, provider: "kling-4", requested: "edit" })
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it("a draft: unchanged", () => {
|
|
62
|
+
expectUnchanged({ ...base, draft: true, requested: "edit" })
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it("no reference media at all: unchanged", () => {
|
|
66
|
+
expectUnchanged({ ...base, requested: "reference", referenceVideoSec: [], referenceImageCount: 0, referenceAudioCount: 0 })
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it("edit or extend without a reference video: unchanged", () => {
|
|
70
|
+
expectUnchanged({ ...base, requested: "edit", referenceVideoSec: [], referenceImageCount: 1 })
|
|
71
|
+
expectUnchanged({ ...base, requested: "extend", referenceVideoSec: [], referenceImageCount: 1 })
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
it.each([[[3]], [[6, 3]], [[31]], [[undefined]], [[6, undefined]]])("edit with videos %j: unchanged", (referenceVideoSec) => {
|
|
75
|
+
expectUnchanged({ ...base, requested: "edit", referenceVideoSec })
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it("edit at the bounds is declared", () => {
|
|
79
|
+
expect(resolveSeedanceTaskType({ ...base, requested: "edit", referenceVideoSec: [4] }).taskType).toBe("edit")
|
|
80
|
+
expect(resolveSeedanceTaskType({ ...base, requested: "edit", referenceVideoSec: [30] }).taskType).toBe("edit")
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
// Only `edit` needs measured lengths inside 4–30 s: `reference` and `extend`
|
|
84
|
+
// are declared whatever the reference video measures, or if it was not measured.
|
|
85
|
+
it.each([[[3]], [[31]], [[undefined]]])("reference and extend with videos %j are still declared", (referenceVideoSec) => {
|
|
86
|
+
expect(resolveSeedanceTaskType({ ...base, requested: "reference", referenceVideoSec }).taskType).toBe("reference")
|
|
87
|
+
expect(resolveSeedanceTaskType({ ...base, requested: "extend", referenceVideoSec }).taskType).toBe("extend")
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
it("edit reports the ratio and the length it replaces, from and to", () => {
|
|
91
|
+
const { adjustments } = resolveSeedanceTaskType({ ...base, requested: "edit" })
|
|
92
|
+
expect(adjustments).toEqual([
|
|
93
|
+
expect.objectContaining({ field: "aspectRatio", from: "16:9", to: "adaptive" }),
|
|
94
|
+
expect.objectContaining({ field: "duration", from: 5, to: -1 }),
|
|
95
|
+
])
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it("edit runs in the purpose-built edit shape", () => {
|
|
99
|
+
const r = resolveSeedanceTaskType({ ...base, requested: "edit" })
|
|
100
|
+
expect({ aspectRatio: r.aspectRatio, duration: r.duration }).toEqual(SEEDANCE_VIDEO_EDIT_SHAPE)
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
it("extend reports the ratio it replaces and an Auto length it replaces, from and to", () => {
|
|
104
|
+
expect(resolveSeedanceTaskType({ ...base, requested: "extend" }).adjustments).toEqual([
|
|
105
|
+
expect.objectContaining({ field: "aspectRatio", from: "16:9", to: "adaptive" }),
|
|
106
|
+
])
|
|
107
|
+
expect(resolveSeedanceTaskType({ ...base, requested: "extend", duration: -1 }).adjustments).toEqual([
|
|
108
|
+
expect.objectContaining({ field: "aspectRatio", from: "16:9", to: "adaptive" }),
|
|
109
|
+
expect.objectContaining({ field: "duration", from: -1, to: 8 }),
|
|
110
|
+
])
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
// "Auto" is the unified node's ratio token: with a reference video to match, a
|
|
114
|
+
// model that lists "adaptive" runs it at "adaptive" (`videoAutoAspectRunsAt`,
|
|
115
|
+
// the KIE adapter's own rule), so an edit or extend of an "Auto" request runs
|
|
116
|
+
// at the ratio it asked for — nothing is replaced, so nothing is reported.
|
|
117
|
+
it.each(["edit", "extend"] as const)("%s of an \"Auto\" or \"auto\" ratio reports no ratio adjustment, and still runs at adaptive", (requested) => {
|
|
118
|
+
for (const aspectRatio of ["Auto", "auto"]) {
|
|
119
|
+
const r = resolveSeedanceTaskType({ ...base, requested, aspectRatio, duration: requested === "edit" ? -1 : 8 })
|
|
120
|
+
expect(r).toEqual({ taskType: requested, aspectRatio: "adaptive", duration: requested === "edit" ? -1 : 8, adjustments: [] })
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
it.each(["edit", "extend"] as const)("%s of a fixed ratio still reports it", (requested) => {
|
|
125
|
+
const r = resolveSeedanceTaskType({ ...base, requested, aspectRatio: "16:9", duration: requested === "edit" ? -1 : 8 })
|
|
126
|
+
expect(r.adjustments).toEqual([expect.objectContaining({ field: "aspectRatio", from: "16:9", to: "adaptive" })])
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
it("the Auto token runs at adaptive only with a visual input, on a model that lists adaptive", () => {
|
|
130
|
+
expect(isVideoAutoAspectToken("Auto")).toBe(true)
|
|
131
|
+
expect(isVideoAutoAspectToken("auto")).toBe(true)
|
|
132
|
+
// Exactly the spellings the provider adapter matches.
|
|
133
|
+
for (const other of ["AUTO", " Auto", "adaptive", "16:9", "", undefined]) expect(isVideoAutoAspectToken(other)).toBe(false)
|
|
134
|
+
expect(videoAutoAspectRunsAt("seedance-2-5", true)).toBe("adaptive")
|
|
135
|
+
expect(videoAutoAspectRunsAt("seedance-2-5", false)).toBeUndefined()
|
|
136
|
+
expect(videoAutoAspectRunsAt("kling-4", true)).toBeUndefined()
|
|
137
|
+
expect(videoAutoAspectRunsAt(undefined, true)).toBeUndefined()
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
it("extend filling in a missing length reports nothing", () => {
|
|
141
|
+
const r = resolveSeedanceTaskType({ ...base, requested: "extend", aspectRatio: "adaptive", duration: undefined })
|
|
142
|
+
expect(r).toEqual({ taskType: "extend", aspectRatio: "adaptive", duration: 8, adjustments: [] })
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
it("the catalog names the model", () => {
|
|
146
|
+
expect(supportsReferenceTaskType("seedance-2-5")).toBe(true)
|
|
147
|
+
expect(supportsReferenceTaskType("seedance-2")).toBe(false)
|
|
148
|
+
expect(supportsReferenceTaskType(undefined)).toBe(false)
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
it("listedSeedanceTaskType: a value the model's list holds, matched exactly", () => {
|
|
152
|
+
for (const value of ["reference", "edit", "extend"]) {
|
|
153
|
+
expect(listedSeedanceTaskType("seedance-2-5", value)).toBe(value)
|
|
154
|
+
}
|
|
155
|
+
for (const value of ["auto", "EDIT", undefined, null, 1, []]) {
|
|
156
|
+
expect(listedSeedanceTaskType("seedance-2-5", value)).toBeUndefined()
|
|
157
|
+
}
|
|
158
|
+
expect(listedSeedanceTaskType("seedance-2", "edit")).toBeUndefined()
|
|
159
|
+
expect(listedSeedanceTaskType(undefined, "edit")).toBeUndefined()
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
describe("seedanceTaskTypeFitsMedia — the media each declared type needs", () => {
|
|
164
|
+
const none = { imageCount: 0, videoCount: 0, audioCount: 0 }
|
|
165
|
+
|
|
166
|
+
it("reference takes any reference media", () => {
|
|
167
|
+
expect(seedanceTaskTypeFitsMedia("reference", { ...none, imageCount: 1 })).toBe(true)
|
|
168
|
+
expect(seedanceTaskTypeFitsMedia("reference", { ...none, videoCount: 1 })).toBe(true)
|
|
169
|
+
expect(seedanceTaskTypeFitsMedia("reference", { ...none, audioCount: 1 })).toBe(true)
|
|
170
|
+
expect(seedanceTaskTypeFitsMedia("reference", none)).toBe(false)
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
it.each(["edit", "extend"] as const)("%s needs a reference video", (type) => {
|
|
174
|
+
expect(seedanceTaskTypeFitsMedia(type, { ...none, videoCount: 1 })).toBe(true)
|
|
175
|
+
expect(seedanceTaskTypeFitsMedia(type, { imageCount: 3, videoCount: 0, audioCount: 2 })).toBe(false)
|
|
176
|
+
expect(seedanceTaskTypeFitsMedia(type, none)).toBe(false)
|
|
177
|
+
})
|
|
178
|
+
})
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import { MODEL_CATALOG, defaultResolutionFor, normalizeModelInput } from "../model-catalog.js"
|
|
3
|
+
import { resolveNormalizedImageGen } from "../credit-identifiers.js"
|
|
4
|
+
import {
|
|
5
|
+
IMAGE_RESOLUTION_VALUES,
|
|
6
|
+
getMinImagePromptChars,
|
|
7
|
+
imageReferenceLimit,
|
|
8
|
+
requestImageLimit,
|
|
9
|
+
T2I_TO_I2I_VARIANT,
|
|
10
|
+
} from "../model-constants.js"
|
|
11
|
+
import { isPricedPerInputImage, isPricedPerInputImageEdit, pricedEstimatedImages, pricedSentImages } from "../input-image-pricing.js"
|
|
12
|
+
import { gptImage26EstimatedImages, gptImage26SentImages } from "../gpt-image-2-6.js"
|
|
13
|
+
import { SEEDREAM_5_5_DEFAULT_RESOLUTION, seedream55Resolution } from "../seedream-5-5.js"
|
|
14
|
+
|
|
15
|
+
describe("Seedream 5.5 in the catalog", () => {
|
|
16
|
+
it("takes 1K, 1.5K and 2K, 2K when none is named", () => {
|
|
17
|
+
for (const id of ["seedream-5-5", "seedream-5-5-i2i"]) {
|
|
18
|
+
expect(MODEL_CATALOG[id]!.resolutions).toEqual(["1K", "1.5K", "2K"])
|
|
19
|
+
expect(defaultResolutionFor(id)).toBe("2K")
|
|
20
|
+
}
|
|
21
|
+
expect(SEEDREAM_5_5_DEFAULT_RESOLUTION).toBe("2K")
|
|
22
|
+
expect(seedream55Resolution(undefined)).toBe("2K")
|
|
23
|
+
expect(seedream55Resolution("1.5k")).toBe("1.5K")
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it("text to image never lists auto (its schema requires a real ratio); the edit lists it first", () => {
|
|
27
|
+
expect(MODEL_CATALOG["seedream-5-5"]!.aspectRatios).not.toContain("auto")
|
|
28
|
+
expect(MODEL_CATALOG["seedream-5-5"]!.aspectRatios).toHaveLength(8)
|
|
29
|
+
expect(MODEL_CATALOG["seedream-5-5-i2i"]!.aspectRatios![0]).toBe("auto")
|
|
30
|
+
expect(MODEL_CATALOG["seedream-5-5-i2i"]!.aspectRatios).toHaveLength(9)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it("auto on text to image becomes a real ratio: the one nearest a photo, else the first listed", () => {
|
|
34
|
+
const none = normalizeModelInput("seedream-5-5", { aspectRatio: "auto" })
|
|
35
|
+
expect(none.aspectRatio).toBe("1:1")
|
|
36
|
+
const portrait = normalizeModelInput("seedream-5-5", { aspectRatio: "auto" }, { sourceImage: { width: 768, height: 1024 } })
|
|
37
|
+
expect(portrait.aspectRatio).toBe("3:4")
|
|
38
|
+
expect(normalizeModelInput("seedream-5-5-i2i", { aspectRatio: "auto" }).aspectRatio).toBe("auto")
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it("a stale size snaps to its default, 2K, and 1.5K is kept", () => {
|
|
42
|
+
expect(normalizeModelInput("seedream-5-5", { resolution: "4K" }).resolution).toBe("2K")
|
|
43
|
+
expect(normalizeModelInput("seedream-5-5", { resolution: "1.5K" }).resolution).toBe("1.5K")
|
|
44
|
+
expect(normalizeModelInput("seedream-5-5-i2i", { resolution: "1.5k" }).resolution).toBe("1.5K")
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it("1.5K is in the route vocabulary, and moves to a size the model lists on every other model", () => {
|
|
48
|
+
expect(IMAGE_RESOLUTION_VALUES).toContain("1.5K")
|
|
49
|
+
for (const [id, m] of Object.entries(MODEL_CATALOG)) {
|
|
50
|
+
if (m.kind !== "image" || id.startsWith("seedream-5-5")) continue
|
|
51
|
+
expect(m.resolutions ?? [], id).not.toContain("1.5K")
|
|
52
|
+
const n = normalizeModelInput(id, { resolution: "1.5K" })
|
|
53
|
+
expect(n.resolution === undefined || (m.resolutions ?? []).includes(n.resolution), id).toBe(true)
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it("a transparent background is kept in PNG and moved to auto in JPEG, before anything is priced", () => {
|
|
58
|
+
expect(normalizeModelInput("seedream-5-5", { background: "transparent" }).background).toBe("transparent")
|
|
59
|
+
expect(normalizeModelInput("seedream-5-5", { background: "transparent", outputFormat: "png" }).background).toBe("transparent")
|
|
60
|
+
const jpeg = normalizeModelInput("seedream-5-5-i2i", { background: "transparent", outputFormat: "jpeg" })
|
|
61
|
+
expect(jpeg.background).toBe("auto")
|
|
62
|
+
expect(jpeg.outputFormat).toBe("jpeg")
|
|
63
|
+
expect(jpeg.adjustments.map((a) => a.field)).toContain("background")
|
|
64
|
+
// A transparent background renders at every size here: nothing moves the size.
|
|
65
|
+
expect(normalizeModelInput("seedream-5-5", { background: "transparent", resolution: "2K" }).resolution).toBe("2K")
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it("writes PNG or JPEG only", () => {
|
|
69
|
+
expect(normalizeModelInput("seedream-5-5", { outputFormat: "webp" }).outputFormat).toBe("png")
|
|
70
|
+
expect(normalizeModelInput("seedream-5-5", { outputFormat: "jpg" }).outputFormat).toBe("jpeg")
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
describe("Seedream 5.5 input images", () => {
|
|
75
|
+
it("references swap text to image onto the edit, which takes up to 10", () => {
|
|
76
|
+
expect(T2I_TO_I2I_VARIANT["seedream-5-5"]).toBe("seedream-5-5-i2i")
|
|
77
|
+
expect(imageReferenceLimit("seedream-5-5")).toBe(10)
|
|
78
|
+
expect(requestImageLimit("seedream-5-5")).toBe(10)
|
|
79
|
+
expect(requestImageLimit("seedream-5-5-i2i")).toBe(10)
|
|
80
|
+
// Every other model's request limit is unchanged.
|
|
81
|
+
expect(requestImageLimit("seedream-5-flash-i2i")).toBe(14)
|
|
82
|
+
expect(requestImageLimit("gpt-image-2-6-flare-i2i")).toBe(16)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it("is priced per input image, and counted as GPT Image 2.6 is", () => {
|
|
86
|
+
expect(isPricedPerInputImage("seedream-5-5")).toBe(true)
|
|
87
|
+
expect(isPricedPerInputImageEdit("seedream-5-5-i2i")).toBe(true)
|
|
88
|
+
expect(isPricedPerInputImage("seedream-5-flash")).toBe(false)
|
|
89
|
+
expect(pricedSentImages("seedream-5-5", ["https://a.png"], "https://b.png")).toBe(2)
|
|
90
|
+
expect(pricedSentImages("seedream-5-flash", ["https://a.png"], "https://b.png")).toBe(1)
|
|
91
|
+
expect(pricedEstimatedImages("seedream-5-5-i2i", { referenceImageUrls: ["https://a.png"] }, 1)).toBe(3)
|
|
92
|
+
// The generic count is GPT Image 2.6's count, unchanged.
|
|
93
|
+
for (const model of ["gpt-image-2-6-flare", "gpt-image-2-6-sunburst-i2i", "gpt-image-2-5-flare", "nano-banana-pro"]) {
|
|
94
|
+
expect(pricedSentImages(model, ["https://a.png"], "https://b.png")).toBe(gptImage26SentImages(model, ["https://a.png"], "https://b.png"))
|
|
95
|
+
const data = { referenceImageUrls: ["https://a.png"], baseImageUrl: "https://b.png", direction: { style: "moodboard:1" } }
|
|
96
|
+
expect(pricedEstimatedImages(model, data, 2)).toBe(gptImage26EstimatedImages(model, data, 2))
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it("a Generate Image run with references is snapped and priced on the edit's own lists", () => {
|
|
101
|
+
const n = resolveNormalizedImageGen({ provider: "seedream-5-5", aspectRatio: "auto", resolution: "1.5K", refCount: 2, swapToI2i: true })
|
|
102
|
+
expect(n.modelId).toBe("seedream-5-5-i2i")
|
|
103
|
+
expect(n.aspectRatio).toBe("auto")
|
|
104
|
+
expect(n.identifier).toBe("seedream-5-5-i2i:1.5K:2ref")
|
|
105
|
+
const t2i = resolveNormalizedImageGen({ provider: "seedream-5-5", aspectRatio: "auto", refCount: 0, swapToI2i: true })
|
|
106
|
+
expect(t2i.modelId).toBe("seedream-5-5")
|
|
107
|
+
expect(t2i.aspectRatio).toBe("1:1")
|
|
108
|
+
expect(t2i.identifier).toBe("seedream-5-5:2K")
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it("states a 5-character prompt minimum; no other model has one", () => {
|
|
112
|
+
expect(getMinImagePromptChars("seedream-5-5")).toBe(5)
|
|
113
|
+
expect(getMinImagePromptChars("seedream-5-5-i2i")).toBe(5)
|
|
114
|
+
expect(getMinImagePromptChars("seedream-5-flash")).toBe(0)
|
|
115
|
+
expect(getMinImagePromptChars(undefined)).toBe(0)
|
|
116
|
+
})
|
|
117
|
+
})
|
|
@@ -17,6 +17,7 @@ type Rows = {
|
|
|
17
17
|
UNIT_REVIEW_HOLDS?: readonly string[]
|
|
18
18
|
UNIT_PRESENTS?: ReadonlyArray<readonly [string, string]>
|
|
19
19
|
UNIT_FAN_OUT_EACH?: ReadonlyArray<readonly [string, { each: readonly string[]; primary: string }]>
|
|
20
|
+
UNIT_LIST_PIPS?: ReadonlyArray<readonly [string, readonly string[]]>
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
function withRows(rows: Rows): void {
|
|
@@ -29,6 +30,7 @@ function withRows(rows: Rows): void {
|
|
|
29
30
|
UNIT_REVIEW_HOLDS: [],
|
|
30
31
|
UNIT_PRESENTS: [],
|
|
31
32
|
UNIT_FAN_OUT_EACH: [],
|
|
33
|
+
UNIT_LIST_PIPS: [],
|
|
32
34
|
...rows,
|
|
33
35
|
}))
|
|
34
36
|
}
|
|
@@ -85,10 +87,27 @@ describe("a node unit's contract rows join the published tables", () => {
|
|
|
85
87
|
expect(listResultsServeHandle("fixture-case", "json")).toBe(false)
|
|
86
88
|
})
|
|
87
89
|
|
|
90
|
+
it("a list pip's edges run the next node once per item by default; the unit's other pips and an edge naming none keep Selected", async () => {
|
|
91
|
+
withRows({ UNIT_LIST_PIPS: [["fixture-layers", ["layers"]]] })
|
|
92
|
+
const { LIST_OUTPUT_HANDLES, defaultEdgeOutputMode, isListOutputHandle } = await import("../producer-types.js")
|
|
93
|
+
expect(LIST_OUTPUT_HANDLES).toEqual({ "fixture-layers": ["layers"] })
|
|
94
|
+
expect(isListOutputHandle("fixture-layers", "layers")).toBe(true)
|
|
95
|
+
expect(isListOutputHandle("fixture-layers", "base")).toBe(false)
|
|
96
|
+
expect(isListOutputHandle("fixture-layers", undefined)).toBe(false)
|
|
97
|
+
expect(isListOutputHandle("constructor", "layers")).toBe(false)
|
|
98
|
+
expect(defaultEdgeOutputMode("fixture-layers", "layers")).toBe("each")
|
|
99
|
+
expect(defaultEdgeOutputMode("fixture-layers", "base")).toBe("last")
|
|
100
|
+
expect(defaultEdgeOutputMode("fixture-layers", undefined)).toBe("last")
|
|
101
|
+
// A legacy node's default is untouched.
|
|
102
|
+
expect(defaultEdgeOutputMode("split-text", undefined)).toBe("each")
|
|
103
|
+
expect(defaultEdgeOutputMode("generate-image", "image")).toBe("last")
|
|
104
|
+
})
|
|
105
|
+
|
|
88
106
|
it("with no rows every table is exactly its hand-written entries", async () => {
|
|
89
107
|
withRows({})
|
|
90
|
-
const { FAN_OUT_EACH_HANDLES } = await import("../producer-types.js")
|
|
108
|
+
const { FAN_OUT_EACH_HANDLES, LIST_OUTPUT_HANDLES } = await import("../producer-types.js")
|
|
91
109
|
expect(Object.keys(FAN_OUT_EACH_HANDLES)).toEqual(["camera-switch", "ugc-clips"])
|
|
110
|
+
expect(LIST_OUTPUT_HANDLES).toEqual({})
|
|
92
111
|
const { NON_PROMPT_TEXT_LANES } = await import("../fan-out-rows.js")
|
|
93
112
|
const { REVIEW_HOLDING_USE_CASE_TYPES } = await import("../preview-gate.js")
|
|
94
113
|
expect(NON_PROMPT_TEXT_LANES.music).toBeUndefined()
|
|
@@ -114,6 +133,13 @@ describe("a type that is hand-written and a node unit refuses to load", () => {
|
|
|
114
133
|
}
|
|
115
134
|
})
|
|
116
135
|
|
|
136
|
+
describe("a node unit with two list-pip rows refuses to load", () => {
|
|
137
|
+
it("../producer-types.js", async () => {
|
|
138
|
+
withRows({ UNIT_LIST_PIPS: [["fixture-layers", ["layers"]], ["fixture-layers", ["frames"]]] })
|
|
139
|
+
await expect(import("../producer-types.js")).rejects.toThrow(/LIST_OUTPUT_HANDLES: node unit fixture-layers has more than one row/)
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
|
|
117
143
|
describe("a node unit with two fan-out rows refuses to load", () => {
|
|
118
144
|
it("../producer-types.js", async () => {
|
|
119
145
|
withRows({ UNIT_FAN_OUT_EACH: [["fixture-case", { each: ["media"], primary: "media" }], ["fixture-case", { each: ["json"], primary: "json" }]] })
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import { readFileSync } from "node:fs"
|
|
3
3
|
import path from "node:path"
|
|
4
4
|
import { describe, expect, it } from "vitest"
|
|
5
|
-
import { UNIT_CONTRACTS, UNIT_FAN_OUT_EACH, UNIT_JSON_PIPS, UNIT_NON_PROMPT_INPUTS, UNIT_PRESENTS, UNIT_REVIEW_HOLDS, UNIT_USE_CASE_TYPES } from "../generated/unit-contracts.js"
|
|
5
|
+
import { UNIT_CONTRACTS, UNIT_FAN_OUT_EACH, UNIT_JSON_PIPS, UNIT_LIST_PIPS, UNIT_NON_PROMPT_INPUTS, UNIT_PRESENTS, UNIT_REVIEW_HOLDS, UNIT_USE_CASE_TYPES } from "../generated/unit-contracts.js"
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* What the node units may put in @nodaro/shared (decided 2026-10-16, widened
|
|
9
9
|
* 2026-10-18): node type ids with closed vocabularies — the producer kind, the
|
|
10
10
|
* use-case types, what a JSON pip carries, the non-prompt input pips, the
|
|
11
|
-
* review holds, how a published app presents the result
|
|
12
|
-
* fan out item by item. Each feeds a published table beside its hand-written
|
|
11
|
+
* review holds, how a published app presents the result, which output pips
|
|
12
|
+
* fan out item by item and which carry a list. Each feeds a published table beside its hand-written
|
|
13
13
|
* rows. Never a price, a credit id, a number, prompt or
|
|
14
14
|
* doctrine text: every published version of this package is an irrevocable
|
|
15
15
|
* Apache grant, and those live in backend/ (prices, ee/) and @nodaro/prompts
|
|
@@ -22,7 +22,7 @@ const GOLDEN = readFileSync(path.resolve(__dirname, "../../../../tools/units/__f
|
|
|
22
22
|
const TYPE = "[a-z][a-z0-9-]*"
|
|
23
23
|
const ROW_END = `, \\/\\/ unit:${TYPE}$`
|
|
24
24
|
const PIP = `"[a-zA-Z][\\w-]*"`
|
|
25
|
-
/** The
|
|
25
|
+
/** The eight declarations, in order, each with the one row shape its block may hold, and how the block ends. */
|
|
26
26
|
const DECLARATIONS: ReadonlyArray<{ readonly head: RegExp; readonly row: RegExp; readonly end: string }> = [
|
|
27
27
|
{
|
|
28
28
|
head: /^export const UNIT_CONTRACTS: ReadonlyArray<readonly \[type: string, producer: "audio" \| "video" \| "image" \| "dynamic"\]> = \[$/,
|
|
@@ -51,11 +51,16 @@ const DECLARATIONS: ReadonlyArray<{ readonly head: RegExp; readonly row: RegExp;
|
|
|
51
51
|
row: new RegExp(`^ {2}\\["${TYPE}", \\{ "each": \\[${PIP}(?:, ${PIP})*\\], "primary": ${PIP} \\}\\]${ROW_END}`),
|
|
52
52
|
end: "]",
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
head: /^export const UNIT_LIST_PIPS: ReadonlyArray<readonly \[type: string, pips: ReadonlyArray<string>\]> = \[$/,
|
|
56
|
+
row: new RegExp(`^ {2}\\["${TYPE}", \\[${PIP}(?:, ${PIP})*\\]\\]${ROW_END}`),
|
|
57
|
+
end: "]",
|
|
58
|
+
},
|
|
54
59
|
]
|
|
55
60
|
|
|
56
61
|
/**
|
|
57
62
|
* Problems with a contracts file's code lines (`//` comments and blanks aside —
|
|
58
|
-
* a `/** … *\/` line is code, and refused); [] when it holds exactly the
|
|
63
|
+
* a `/** … *\/` line is code, and refused); [] when it holds exactly the eight
|
|
59
64
|
* declarations, in order, each followed only by its own rows and its end line.
|
|
60
65
|
*/
|
|
61
66
|
function contractProblems(source: string): string[] {
|
|
@@ -98,9 +103,15 @@ describe("generated/unit-contracts.ts carries only type ids with closed vocabula
|
|
|
98
103
|
expect(h.each.length).toBeGreaterThan(0)
|
|
99
104
|
for (const pip of [...h.each, h.primary]) expect(pip).toMatch(PIP_ID)
|
|
100
105
|
}
|
|
106
|
+
// A list-pip row is a type id and pip ids only.
|
|
107
|
+
for (const [t, pips] of UNIT_LIST_PIPS) {
|
|
108
|
+
expect(t).toMatch(KEBAB)
|
|
109
|
+
expect(pips.length).toBeGreaterThan(0)
|
|
110
|
+
for (const pip of pips) expect(pip).toMatch(PIP_ID)
|
|
111
|
+
}
|
|
101
112
|
})
|
|
102
113
|
|
|
103
|
-
it("the file holds nothing else: the
|
|
114
|
+
it("the file holds nothing else: the eight declarations and their rows", () => {
|
|
104
115
|
expect(contractProblems(SOURCE)).toEqual([])
|
|
105
116
|
})
|
|
106
117
|
|
|
@@ -110,6 +121,7 @@ describe("generated/unit-contracts.ts carries only type ids with closed vocabula
|
|
|
110
121
|
const full = GOLDEN
|
|
111
122
|
.replace("ReadonlyArray<string>]> = [\n", 'ReadonlyArray<string>]> = [\n ["fixture-case", ["media"]], // unit:fixture-case\n')
|
|
112
123
|
.replace("UNIT_REVIEW_HOLDS: ReadonlyArray<string> = [\n", 'UNIT_REVIEW_HOLDS: ReadonlyArray<string> = [\n "fixture-case", // unit:fixture-case\n')
|
|
124
|
+
.replace("pips: ReadonlyArray<string>]> = [\n", 'pips: ReadonlyArray<string>]> = [\n ["fixture-echo", ["layers"]], // unit:fixture-echo\n')
|
|
113
125
|
expect(full).not.toBe(GOLDEN)
|
|
114
126
|
expect(contractProblems(full)).toEqual([])
|
|
115
127
|
const refused = [
|
|
@@ -125,6 +137,8 @@ describe("generated/unit-contracts.ts carries only type ids with closed vocabula
|
|
|
125
137
|
GOLDEN.replace('{ "each": ["text"], "primary": "text" }', '{ "each": ["text", 10], "primary": "text" }'),
|
|
126
138
|
GOLDEN.replace('{ "each": ["text"], "primary": "text" }', '{ "each": ["text"], "primary": "text", "fee": "x" }'),
|
|
127
139
|
GOLDEN.replace('{ "each": ["text"], "primary": "text" }', '{ "each": ["Make it cinematic"], "primary": "text" }'),
|
|
140
|
+
full.replace('["fixture-echo", ["layers"]]', '["fixture-echo", ["layers", 10]]'),
|
|
141
|
+
full.replace('["fixture-echo", ["layers"]]', '["fixture-echo", ["Split it nicely"]]'),
|
|
128
142
|
]
|
|
129
143
|
for (const [i, src] of refused.entries()) {
|
|
130
144
|
expect(src, `case ${i} changed the golden`).not.toBe(GOLDEN)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest"
|
|
2
|
+
import {
|
|
3
|
+
NODARO_IMAGE_UPSCALE_DEFAULT_FACTOR,
|
|
4
|
+
NODARO_IMAGE_UPSCALE_FACTORS,
|
|
5
|
+
UPSCALE_FACTORS,
|
|
6
|
+
resolveNodaroImageUpscaleFactor,
|
|
7
|
+
resolveTopazUpscale,
|
|
8
|
+
resolveUpscaleFactor,
|
|
9
|
+
snappedUpscaleFactor,
|
|
10
|
+
TOPAZ_UPSCALE_FACTORS,
|
|
11
|
+
upscaleFactorsFor,
|
|
12
|
+
} from "../entries/credits.js"
|
|
13
|
+
import { HOUSE_ONLY_UPSCALE_FACTORS } from "../upscale-factors.js"
|
|
14
|
+
import { buildCreditModelIdentifier } from "../credit-identifiers.js"
|
|
15
|
+
import { MODEL_CATALOG } from "../model-catalog.js"
|
|
16
|
+
import { IMAGE_EDIT_PROVIDERS, UPSCALE_IMAGE_PROVIDERS } from "../model-constants.js"
|
|
17
|
+
|
|
18
|
+
describe("the factors each upscaler takes", () => {
|
|
19
|
+
it("Nodaro Image Upscale takes 1 / 2 / 4 / 8, default 2; Topaz keeps 1 / 2 / 4; Recraft takes none", () => {
|
|
20
|
+
expect(NODARO_IMAGE_UPSCALE_FACTORS).toEqual(["1", "2", "4", "8"])
|
|
21
|
+
expect(NODARO_IMAGE_UPSCALE_DEFAULT_FACTOR).toBe("2")
|
|
22
|
+
expect(upscaleFactorsFor("nodaro-image-upscale")).toEqual(["1", "2", "4", "8"])
|
|
23
|
+
expect(upscaleFactorsFor("topaz-image-upscale")).toEqual(TOPAZ_UPSCALE_FACTORS)
|
|
24
|
+
expect(TOPAZ_UPSCALE_FACTORS).toEqual(["1", "2", "4"])
|
|
25
|
+
expect(upscaleFactorsFor("recraft-upscale")).toBeUndefined()
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it("UPSCALE_FACTORS is every factor any upscaler takes", () => {
|
|
29
|
+
const union = new Set(UPSCALE_IMAGE_PROVIDERS.flatMap((p) => upscaleFactorsFor(p) ?? []))
|
|
30
|
+
expect([...UPSCALE_FACTORS].sort()).toEqual([...union].sort())
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe("resolveNodaroImageUpscaleFactor / resolveUpscaleFactor", () => {
|
|
35
|
+
it("a listed factor is rendered as given; anything else at 2", () => {
|
|
36
|
+
for (const f of ["1", "2", "4", "8"]) expect(resolveNodaroImageUpscaleFactor(f)).toBe(f)
|
|
37
|
+
expect(resolveNodaroImageUpscaleFactor(" 8 ")).toBe("8")
|
|
38
|
+
expect(resolveNodaroImageUpscaleFactor(4)).toBe("4")
|
|
39
|
+
for (const f of [undefined, null, "", "3", "16", "8K", 0]) expect(resolveNodaroImageUpscaleFactor(f)).toBe("2")
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it("Topaz resolves exactly as resolveTopazUpscale (8 still renders at 2, a legacy tier still maps)", () => {
|
|
43
|
+
for (const upscaleFactor of [undefined, "1", "2", "4", "8"]) {
|
|
44
|
+
for (const targetResolution of [undefined, "2K", "4K", "8K"]) {
|
|
45
|
+
expect(resolveUpscaleFactor("topaz-image-upscale", { upscaleFactor, targetResolution })).toBe(
|
|
46
|
+
resolveTopazUpscale({ upscaleFactor, targetResolution }).upscaleFactor,
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it("Nodaro Image Upscale never reads a stored tier; a model with no factor list is sent its value as before, never an 8", () => {
|
|
53
|
+
expect(resolveUpscaleFactor("nodaro-image-upscale", { targetResolution: "4K" })).toBe("2")
|
|
54
|
+
// As it always was: a stored or mapped 1/2/4 is passed on.
|
|
55
|
+
expect(resolveUpscaleFactor("recraft-upscale", { upscaleFactor: "4" })).toBe("4")
|
|
56
|
+
expect(resolveUpscaleFactor("nano-banana-edit", { upscaleFactor: "2" })).toBe("2")
|
|
57
|
+
expect(resolveUpscaleFactor("grok-2-edit", { upscaleFactor: "1" })).toBe("1")
|
|
58
|
+
expect(resolveUpscaleFactor("recraft-upscale", {})).toBeUndefined()
|
|
59
|
+
// Only the house model takes 8: a node kept from it never sends it elsewhere.
|
|
60
|
+
expect(resolveUpscaleFactor("recraft-upscale", { upscaleFactor: "8" })).toBeUndefined()
|
|
61
|
+
expect(resolveUpscaleFactor(undefined, { upscaleFactor: "8" })).toBeUndefined()
|
|
62
|
+
expect(HOUSE_ONLY_UPSCALE_FACTORS).toEqual(["8"])
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
describe("snappedUpscaleFactor (the editor's fail-safe on a model switch)", () => {
|
|
67
|
+
it("a Nodaro Image Upscale 8x switched to Topaz runs, and is stored, at 2x", () => {
|
|
68
|
+
expect(snappedUpscaleFactor("topaz-image-upscale", { upscaleFactor: "8" })).toBe("2")
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it("a Nodaro Image Upscale 8x switched to Recraft (or to no model, which runs as Recraft) keeps no factor", () => {
|
|
72
|
+
expect(snappedUpscaleFactor("recraft-upscale", { upscaleFactor: "8" })).toBeNull()
|
|
73
|
+
expect(snappedUpscaleFactor(undefined, { upscaleFactor: "8" })).toBeNull()
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it("a saved Recraft node's own 1/2/4 stands, as it always did", () => {
|
|
77
|
+
for (const f of ["1", "2", "4"]) expect(snappedUpscaleFactor("recraft-upscale", { upscaleFactor: f }), f).toBeUndefined()
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it("a factor the new model takes, or no factor stored: nothing to change", () => {
|
|
81
|
+
expect(snappedUpscaleFactor("nodaro-image-upscale", { upscaleFactor: "4" })).toBeUndefined()
|
|
82
|
+
expect(snappedUpscaleFactor("topaz-image-upscale", { upscaleFactor: "4" })).toBeUndefined()
|
|
83
|
+
expect(snappedUpscaleFactor("topaz-image-upscale", {})).toBeUndefined()
|
|
84
|
+
expect(snappedUpscaleFactor("recraft-upscale", {})).toBeUndefined()
|
|
85
|
+
expect(snappedUpscaleFactor("nodaro-image-upscale", { upscaleFactor: "3" })).toBe("2")
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
describe("the catalog and the provider lists", () => {
|
|
90
|
+
it("Nodaro Image Upscale is an own-label image upscaler, priced by output tier with a hold", () => {
|
|
91
|
+
const entry = MODEL_CATALOG["nodaro-image-upscale"]!
|
|
92
|
+
expect(entry).toMatchObject({ kind: "image", modes: ["upscale"], ownLabel: true, family: "Nodaro Upscale", series: "Nodaro Upscale", label: "Nodaro Image Upscale" })
|
|
93
|
+
expect(entry).not.toHaveProperty("maker")
|
|
94
|
+
expect(entry.pricing.map((p) => [p.identifier, p.credits])).toEqual([
|
|
95
|
+
["nodaro-image-upscale:2K", 4],
|
|
96
|
+
["nodaro-image-upscale:4K", 10],
|
|
97
|
+
["nodaro-image-upscale:8K", 30],
|
|
98
|
+
["nodaro-image-upscale", 30],
|
|
99
|
+
])
|
|
100
|
+
expect(IMAGE_EDIT_PROVIDERS).toContain("nodaro-image-upscale")
|
|
101
|
+
expect(UPSCALE_IMAGE_PROVIDERS).toContain("nodaro-image-upscale")
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
it("the shared builder prices it at the hold — the size-aware id is built from the image's size, never a stored tier", () => {
|
|
105
|
+
expect(buildCreditModelIdentifier("nodaro-image-upscale", undefined, undefined, undefined, "4K")).toBe("nodaro-image-upscale")
|
|
106
|
+
})
|
|
107
|
+
})
|