@nodaro/shared 3.62.0 → 3.64.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-C7POAYFE.js → chunk-36VWLB4J.js} +3 -3
- package/dist/{chunk-C7POAYFE.js.map → chunk-36VWLB4J.js.map} +1 -1
- package/dist/{chunk-S24ZBUB4.js → chunk-3AYM47GW.js} +6 -32
- package/dist/chunk-3AYM47GW.js.map +1 -0
- package/dist/{chunk-YCXRSWCQ.js → chunk-3KTWYYCN.js} +8 -5
- package/dist/chunk-3KTWYYCN.js.map +1 -0
- package/dist/{chunk-ZES6EZC4.js → chunk-4IUE2JB7.js} +3 -3
- package/dist/{chunk-ZES6EZC4.js.map → chunk-4IUE2JB7.js.map} +1 -1
- package/dist/{chunk-MYJQELFN.cjs → chunk-5OBTGNUQ.cjs} +547 -29
- package/dist/chunk-5OBTGNUQ.cjs.map +1 -0
- package/dist/{chunk-TWF2OSH4.cjs → chunk-67CMMTLN.cjs} +4 -4
- package/dist/{chunk-TWF2OSH4.cjs.map → chunk-67CMMTLN.cjs.map} +1 -1
- package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
- package/dist/chunk-6BRWPJPP.cjs.map +1 -0
- package/dist/{chunk-S5TMRJMX.js → chunk-6YIV37V7.js} +4 -4
- package/dist/{chunk-S5TMRJMX.js.map → chunk-6YIV37V7.js.map} +1 -1
- package/dist/{chunk-3M4BNKFJ.cjs → chunk-7AJGUI7L.cjs} +202 -16
- package/dist/chunk-7AJGUI7L.cjs.map +1 -0
- package/dist/{chunk-JZGZ26YB.js → chunk-7KQ6W5DS.js} +4 -4
- package/dist/{chunk-JZGZ26YB.js.map → chunk-7KQ6W5DS.js.map} +1 -1
- package/dist/{chunk-IWWVPR3W.cjs → chunk-ACZZHHFZ.cjs} +149 -34
- package/dist/chunk-ACZZHHFZ.cjs.map +1 -0
- package/dist/{chunk-2W745U4A.cjs → chunk-AZNZ5WNZ.cjs} +42 -70
- package/dist/chunk-AZNZ5WNZ.cjs.map +1 -0
- package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
- package/dist/chunk-BQYCZLMF.js.map +1 -0
- package/dist/chunk-CHS2SIP6.cjs +504 -0
- package/dist/chunk-CHS2SIP6.cjs.map +1 -0
- package/dist/{chunk-CIPPPT7E.cjs → chunk-CHTZZRAL.cjs} +6 -6
- package/dist/{chunk-CIPPPT7E.cjs.map → chunk-CHTZZRAL.cjs.map} +1 -1
- package/dist/{chunk-AOJ6B7K4.cjs → chunk-D4KWNDPH.cjs} +12 -12
- package/dist/chunk-D4KWNDPH.cjs.map +1 -0
- package/dist/{chunk-5YYN5X57.js → chunk-DZ4IOP3Q.js} +536 -30
- package/dist/chunk-DZ4IOP3Q.js.map +1 -0
- package/dist/{chunk-VACPZPUA.cjs → chunk-EXEVT6D2.cjs} +15 -5
- package/dist/chunk-EXEVT6D2.cjs.map +1 -0
- package/dist/{chunk-5M43XMRB.cjs → chunk-FHGRKQVZ.cjs} +8 -8
- package/dist/{chunk-5M43XMRB.cjs.map → chunk-FHGRKQVZ.cjs.map} +1 -1
- package/dist/{chunk-KJSRPHJ2.cjs → chunk-GTWUS6MQ.cjs} +165 -54
- package/dist/chunk-GTWUS6MQ.cjs.map +1 -0
- package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
- package/dist/chunk-H5KHWTAE.js.map +1 -0
- package/dist/{chunk-G3KVK7OU.cjs → chunk-HDPJNNMF.cjs} +21 -21
- package/dist/{chunk-G3KVK7OU.cjs.map → chunk-HDPJNNMF.cjs.map} +1 -1
- package/dist/{chunk-3OYO3XCC.js → chunk-IYSOVS7O.js} +118 -24
- package/dist/chunk-IYSOVS7O.js.map +1 -0
- package/dist/{chunk-AFYTX4AI.cjs → chunk-J6B7J73J.cjs} +110 -50
- package/dist/chunk-J6B7J73J.cjs.map +1 -0
- package/dist/{chunk-I2RQB7VG.js → chunk-KB2SQAR3.js} +3 -3
- package/dist/{chunk-I2RQB7VG.js.map → chunk-KB2SQAR3.js.map} +1 -1
- package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
- package/dist/chunk-KSHAAPQF.cjs.map +1 -0
- package/dist/{chunk-6G7NN4S4.js → chunk-NIAFR5EE.js} +2 -2
- package/dist/chunk-NIAFR5EE.js.map +1 -0
- package/dist/{chunk-CF4S4N5X.js → chunk-O2QOBA6Q.js} +2 -2
- package/dist/{chunk-CF4S4N5X.js.map → chunk-O2QOBA6Q.js.map} +1 -1
- package/dist/{chunk-IDTKF5EX.cjs → chunk-O4RPXBDZ.cjs} +12 -8
- package/dist/chunk-O4RPXBDZ.cjs.map +1 -0
- package/dist/{chunk-4GGLKRYI.cjs → chunk-O6TBB4IF.cjs} +2 -2
- package/dist/{chunk-4GGLKRYI.cjs.map → chunk-O6TBB4IF.cjs.map} +1 -1
- package/dist/{chunk-PTD6EDUU.js → chunk-OBOOHG3N.js} +13 -4
- package/dist/chunk-OBOOHG3N.js.map +1 -0
- package/dist/{chunk-2D5LQFV4.cjs → chunk-OOZW2MM6.cjs} +9 -9
- package/dist/{chunk-2D5LQFV4.cjs.map → chunk-OOZW2MM6.cjs.map} +1 -1
- package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
- package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
- package/dist/{chunk-G4U3HW6W.js → chunk-PJJAZQVZ.js} +3 -3
- package/dist/{chunk-G4U3HW6W.js.map → chunk-PJJAZQVZ.js.map} +1 -1
- package/dist/{chunk-E2HZTGYX.js → chunk-Q2Y4JHF7.js} +7 -7
- package/dist/chunk-Q2Y4JHF7.js.map +1 -0
- package/dist/{chunk-FVII3KHN.js → chunk-QYU7J5EQ.js} +198 -17
- package/dist/chunk-QYU7J5EQ.js.map +1 -0
- package/dist/{chunk-JJNNM23P.js → chunk-S3UGLZSF.js} +3 -3
- package/dist/{chunk-JJNNM23P.js.map → chunk-S3UGLZSF.js.map} +1 -1
- package/dist/{chunk-CC4V2B7S.js → chunk-SHH2T4CR.js} +3 -3
- package/dist/{chunk-CC4V2B7S.js.map → chunk-SHH2T4CR.js.map} +1 -1
- package/dist/{chunk-4ZEFP2FQ.cjs → chunk-SPAHI7DY.cjs} +4 -4
- package/dist/{chunk-4ZEFP2FQ.cjs.map → chunk-SPAHI7DY.cjs.map} +1 -1
- package/dist/{chunk-Y6X7UJSD.js → chunk-SXHHLZ22.js} +122 -15
- package/dist/chunk-SXHHLZ22.js.map +1 -0
- package/dist/{chunk-HRY7KGAE.cjs → chunk-T2OVDF2M.cjs} +6 -6
- package/dist/{chunk-HRY7KGAE.cjs.map → chunk-T2OVDF2M.cjs.map} +1 -1
- package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
- package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
- package/dist/{chunk-NGKKNSK6.js → chunk-TPQJKS7D.js} +139 -16
- package/dist/chunk-TPQJKS7D.js.map +1 -0
- package/dist/{chunk-N7OUQK7E.cjs → chunk-TQW3R44P.cjs} +8 -8
- package/dist/{chunk-N7OUQK7E.cjs.map → chunk-TQW3R44P.cjs.map} +1 -1
- package/dist/{chunk-GSFB537T.js → chunk-TTGZ2L3O.js} +23 -4
- package/dist/chunk-TTGZ2L3O.js.map +1 -0
- package/dist/{chunk-SYWR5G3T.js → chunk-VPTA4Z7G.js} +54 -7
- package/dist/chunk-VPTA4Z7G.js.map +1 -0
- package/dist/{chunk-2HZGDZZN.cjs → chunk-VZ6TE23U.cjs} +6 -6
- package/dist/{chunk-2HZGDZZN.cjs.map → chunk-VZ6TE23U.cjs.map} +1 -1
- package/dist/{chunk-TRVWMKNE.cjs → chunk-W6VJAUGM.cjs} +285 -64
- package/dist/chunk-W6VJAUGM.cjs.map +1 -0
- package/dist/{chunk-UDDVDQMF.js → chunk-W7KHHNZR.js} +235 -37
- package/dist/chunk-W7KHHNZR.js.map +1 -0
- package/dist/{chunk-KYMHFVAZ.cjs → chunk-Y4GCJJPF.cjs} +2 -2
- package/dist/chunk-Y4GCJJPF.cjs.map +1 -0
- package/dist/{chunk-6CSXMWL4.cjs → chunk-YQV53HRR.cjs} +27 -4
- package/dist/chunk-YQV53HRR.cjs.map +1 -0
- package/dist/{chunk-7FCTCWHD.js → chunk-ZI3QDUHO.js} +3 -3
- package/dist/{chunk-7FCTCWHD.js.map → chunk-ZI3QDUHO.js.map} +1 -1
- package/dist/entries/apps.cjs +43 -42
- package/dist/entries/apps.js +8 -7
- package/dist/entries/captions.cjs +38 -30
- package/dist/entries/captions.d.cts +47 -1
- package/dist/entries/captions.d.ts +47 -1
- package/dist/entries/captions.js +1 -1
- package/dist/entries/credits.cjs +354 -174
- package/dist/entries/credits.d.cts +378 -27
- package/dist/entries/credits.d.ts +378 -27
- package/dist/entries/credits.js +11 -11
- package/dist/entries/llm-models.cjs +77 -57
- package/dist/entries/llm-models.d.cts +108 -7
- package/dist/entries/llm-models.d.ts +108 -7
- package/dist/entries/llm-models.js +2 -2
- package/dist/entries/media.cjs +63 -63
- package/dist/entries/media.d.cts +8 -0
- package/dist/entries/media.d.ts +8 -0
- package/dist/entries/media.js +1 -1
- package/dist/entries/model-catalog.cjs +161 -105
- package/dist/entries/model-catalog.d.cts +109 -22
- package/dist/entries/model-catalog.d.ts +109 -22
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +466 -322
- package/dist/entries/models.d.cts +71 -5
- package/dist/entries/models.d.ts +71 -5
- package/dist/entries/models.js +5 -5
- package/dist/entries/nodes.cjs +226 -209
- package/dist/entries/nodes.d.cts +66 -7
- package/dist/entries/nodes.d.ts +66 -7
- package/dist/entries/nodes.js +10 -9
- package/dist/entries/pipeline.cjs +156 -152
- package/dist/entries/pipeline.d.cts +14 -4
- package/dist/entries/pipeline.d.ts +14 -4
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/runtime-config.cjs +29 -29
- package/dist/entries/runtime-config.d.cts +10 -7
- package/dist/entries/runtime-config.d.ts +10 -7
- package/dist/entries/runtime-config.js +1 -1
- package/dist/entries/social.cjs +177 -177
- package/dist/entries/social.js +2 -2
- package/dist/entries/types.d.cts +8 -0
- package/dist/entries/types.d.ts +8 -0
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +154 -150
- package/dist/entries/video.d.cts +11 -2
- package/dist/entries/video.d.ts +11 -2
- package/dist/entries/video.js +6 -6
- package/dist/entries/workflow.cjs +150 -150
- package/dist/entries/workflow.d.cts +1 -1
- package/dist/entries/workflow.d.ts +1 -1
- package/dist/entries/workflow.js +2 -2
- package/dist/index.cjs +2136 -1704
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +27 -27
- package/dist/{model-catalog-CCEcv08q.d.ts → model-catalog-Cf9fkEUp.d.cts} +45 -2
- package/dist/{model-catalog-CCEcv08q.d.cts → model-catalog-Cf9fkEUp.d.ts} +45 -2
- package/dist/{model-constants-B88p6XR0.d.ts → model-constants-BxjiWVQ9.d.ts} +215 -32
- package/dist/{model-constants-Cf3zaITt.d.cts → model-constants-C_Nyft_i.d.cts} +215 -32
- package/package.json +1 -1
- package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
- package/src/__tests__/credit-identifiers.test.ts +29 -0
- package/src/__tests__/extend-providers.test.ts +359 -39
- package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
- package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
- package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
- package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
- package/src/__tests__/flux-3-klein.test.ts +203 -0
- package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
- package/src/__tests__/gvp-supported-providers.test.ts +27 -2
- package/src/__tests__/lip-sync-audio-rate.test.ts +74 -0
- package/src/__tests__/lip-sync-levers.test.ts +31 -0
- package/src/__tests__/llm-models.test.ts +139 -12
- package/src/__tests__/llm-price-key.test.ts +164 -1
- package/src/__tests__/model-makers.test.ts +3 -0
- package/src/__tests__/nemotron-transcribe-pricing.test.ts +61 -0
- package/src/__tests__/node-runtime-keys.test.ts +7 -0
- package/src/__tests__/normalize-node-params.test.ts +172 -1
- package/src/__tests__/pixverse-v6-max-catalog.test.ts +271 -0
- package/src/__tests__/prompt-length-limits.test.ts +4 -0
- package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
- package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
- package/src/__tests__/seedance-task-type.test.ts +13 -3
- package/src/__tests__/sequence-execution.test.ts +22 -1
- package/src/__tests__/suno-credit-type.test.ts +21 -2
- package/src/__tests__/transcribe-capabilities.test.ts +41 -2
- package/src/__tests__/transcribe-preflight.test.ts +50 -1
- package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
- package/src/__tests__/video-analysis-pricing.test.ts +10 -9
- package/src/__tests__/video-audio-capability.test.ts +35 -6
- package/src/__tests__/video-resolution-billed-as-named.test.ts +30 -0
- package/src/__tests__/video-upscale-params.test.ts +62 -0
- package/src/caption-styles.ts +62 -0
- package/src/catalog-projection.ts +8 -0
- package/src/credit-estimators/add-captions-nemotron.ts +73 -0
- package/src/credit-estimators/index.ts +20 -0
- package/src/credit-estimators/nemotron-transcribe.ts +87 -0
- package/src/credit-identifiers.ts +351 -41
- package/src/entries/captions.ts +2 -0
- package/src/entries/credits.ts +37 -2
- package/src/entries/llm-models.ts +6 -0
- package/src/entries/model-catalog.ts +22 -0
- package/src/entries/models.ts +50 -0
- package/src/entries/nodes.ts +4 -0
- package/src/entries/pipeline.ts +1 -1
- package/src/entries/video.ts +1 -1
- package/src/flux-3-klein.ts +69 -0
- package/src/freecut-protocol.ts +8 -0
- package/src/input-image-pricing.ts +23 -6
- package/src/lip-sync-levers.ts +56 -0
- package/src/lip-sync-pricing.ts +91 -1
- package/src/llm-models.ts +305 -16
- package/src/model-catalog.ts +529 -28
- package/src/model-constants.ts +417 -41
- package/src/model-tree.ts +2 -1
- package/src/nodaro-video-upscale.ts +48 -0
- package/src/node-default-mappings.ts +6 -0
- package/src/node-runtime-keys.ts +3 -0
- package/src/normalize-node-params.ts +172 -3
- package/src/runtime-config/contract.ts +10 -7
- package/src/seedance-draft.ts +2 -1
- package/src/seedance-extend-rate.ts +116 -0
- package/src/sequence-execution.ts +24 -0
- package/src/transcribe-preflight.ts +81 -7
- package/src/video-analysis-pricing.ts +28 -15
- package/src/video-duration.ts +9 -0
- package/src/video-ui-defaults.ts +5 -3
- package/src/video-upscale-params.ts +67 -0
- package/dist/chunk-2W745U4A.cjs.map +0 -1
- package/dist/chunk-3M4BNKFJ.cjs.map +0 -1
- package/dist/chunk-3OYO3XCC.js.map +0 -1
- package/dist/chunk-5YYN5X57.js.map +0 -1
- package/dist/chunk-6CSXMWL4.cjs.map +0 -1
- package/dist/chunk-6G7NN4S4.js.map +0 -1
- package/dist/chunk-AFYTX4AI.cjs.map +0 -1
- package/dist/chunk-AOJ6B7K4.cjs.map +0 -1
- package/dist/chunk-BLJUCPMV.cjs.map +0 -1
- package/dist/chunk-E2HZTGYX.js.map +0 -1
- package/dist/chunk-FVII3KHN.js.map +0 -1
- package/dist/chunk-GSFB537T.js.map +0 -1
- package/dist/chunk-HSHCCBIV.js.map +0 -1
- package/dist/chunk-IDTKF5EX.cjs.map +0 -1
- package/dist/chunk-IWWVPR3W.cjs.map +0 -1
- package/dist/chunk-KJSRPHJ2.cjs.map +0 -1
- package/dist/chunk-KYMHFVAZ.cjs.map +0 -1
- package/dist/chunk-MYJQELFN.cjs.map +0 -1
- package/dist/chunk-NGKKNSK6.js.map +0 -1
- package/dist/chunk-PTD6EDUU.js.map +0 -1
- package/dist/chunk-Q6IES3U2.js.map +0 -1
- package/dist/chunk-QWYFHQYK.cjs +0 -357
- package/dist/chunk-QWYFHQYK.cjs.map +0 -1
- package/dist/chunk-S24ZBUB4.js.map +0 -1
- package/dist/chunk-SYWR5G3T.js.map +0 -1
- package/dist/chunk-TRVWMKNE.cjs.map +0 -1
- package/dist/chunk-UDDVDQMF.js.map +0 -1
- package/dist/chunk-VACPZPUA.cjs.map +0 -1
- package/dist/chunk-WRSWH7US.cjs.map +0 -1
- package/dist/chunk-Y6X7UJSD.js.map +0 -1
- package/dist/chunk-YCXRSWCQ.js.map +0 -1
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest"
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
LLM_FEATURE_DEFAULTS,
|
|
4
|
+
LLM_FEATURE_DEFAULTS_FROM,
|
|
5
|
+
LLM_MODELS,
|
|
6
|
+
LLM_REASONING_EFFORTS,
|
|
7
|
+
STRUCTURED_VISION_MODELS,
|
|
8
|
+
defaultReasoningEffort,
|
|
9
|
+
effectiveReasoningEffort,
|
|
10
|
+
getLlmModel,
|
|
11
|
+
llmDefaultsFeature,
|
|
12
|
+
llmPriceKey,
|
|
13
|
+
llmSendsSchema,
|
|
14
|
+
llmServesDirect,
|
|
15
|
+
parseLlmPriceKeyModel,
|
|
16
|
+
structuredWireMode,
|
|
17
|
+
} from "../entries/llm-models.js"
|
|
3
18
|
|
|
4
19
|
// The key a client asks `POST /v1/credits/model-costs` for a metered LLM
|
|
5
20
|
// call's price with: `<feature>:<model>`, plus `:direct` when the call is
|
|
@@ -53,3 +68,151 @@ describe("llmPriceKey", () => {
|
|
|
53
68
|
expect(() => llmPriceKey("llm-chat", "")).toThrow(TypeError)
|
|
54
69
|
})
|
|
55
70
|
})
|
|
71
|
+
|
|
72
|
+
// A model whose price depends on the effort a call sends (`effortPriced`)
|
|
73
|
+
// names that effort in its key — no model does today (GPT-6.1 Terra did for
|
|
74
|
+
// part of 2026-11-12), so every key is exactly what it was before the suffix
|
|
75
|
+
// existed. The mechanism is exercised on a stand-in: Terra flagged for the
|
|
76
|
+
// length of one test.
|
|
77
|
+
describe("llmPriceKey: the effort, on a model whose price depends on it (`effortPriced`)", () => {
|
|
78
|
+
/** The key as it was built before effort-priced models existed. */
|
|
79
|
+
const keyBefore = (feature: string, modelId: string, effort?: string, advanced?: boolean) => {
|
|
80
|
+
const e = effort ?? defaultReasoningEffort(llmDefaultsFeature(feature), modelId)
|
|
81
|
+
return llmServesDirect(modelId, e, advanced) ? `${feature}:${modelId}:direct` : `${feature}:${modelId}`
|
|
82
|
+
}
|
|
83
|
+
/** Run `fn` with `modelId` flagged `effortPriced`, then put the registry back. */
|
|
84
|
+
const whileEffortPriced = (modelId: string, fn: () => void) => {
|
|
85
|
+
const model = getLlmModel(modelId) as { effortPriced?: true }
|
|
86
|
+
const before = model.effortPriced
|
|
87
|
+
model.effortPriced = true
|
|
88
|
+
try {
|
|
89
|
+
fn()
|
|
90
|
+
} finally {
|
|
91
|
+
if (before === undefined) delete model.effortPriced
|
|
92
|
+
else model.effortPriced = before
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
it("no model is effort-priced today", () => {
|
|
97
|
+
expect(LLM_MODELS.filter((m) => m.effortPriced).map((m) => m.id)).toEqual([])
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it("every model's key is unchanged, at every effort, with Advanced mode on or off", () => {
|
|
101
|
+
for (const m of LLM_MODELS) {
|
|
102
|
+
for (const feature of ["llm-chat", "ai-writer", "describe-to-picker", "text-to-picker"]) {
|
|
103
|
+
for (const effort of [undefined, ...LLM_REASONING_EFFORTS]) {
|
|
104
|
+
for (const advanced of [false, true]) {
|
|
105
|
+
expect(llmPriceKey(feature, m.id, effort, advanced), `${feature} ${m.id} ${effort} ${advanced}`).toBe(keyBefore(feature, m.id, effort, advanced))
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it("GPT-6.1 Terra's key is the bare key at every effort", () => {
|
|
113
|
+
for (const effort of [undefined, ...LLM_REASONING_EFFORTS]) {
|
|
114
|
+
expect(llmPriceKey("llm-chat", "gpt-6.1-terra", effort), String(effort)).toBe("llm-chat:gpt-6.1-terra")
|
|
115
|
+
expect(llmPriceKey("ai-writer", "gpt-6.1-terra", effort), String(effort)).toBe("ai-writer:gpt-6.1-terra")
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
it("an effort-priced model's key names the effort its call sends: none at Auto (or a level it does not offer), the level otherwise", () => {
|
|
120
|
+
whileEffortPriced("gpt-6.1-terra", () => {
|
|
121
|
+
expect(llmPriceKey("llm-chat", "gpt-6.1-terra")).toBe("llm-chat:gpt-6.1-terra")
|
|
122
|
+
expect(llmPriceKey("llm-chat", "gpt-6.1-terra", "none")).toBe("llm-chat:gpt-6.1-terra")
|
|
123
|
+
expect(llmPriceKey("llm-chat", "gpt-6.1-terra", "high")).toBe("llm-chat:gpt-6.1-terra:effort-high")
|
|
124
|
+
expect(llmPriceKey("ai-writer", "gpt-6.1-terra", "max", true)).toBe("ai-writer:gpt-6.1-terra:effort-max")
|
|
125
|
+
expect(parseLlmPriceKeyModel("gpt-6.1-terra:effort-high")).toEqual({ modelId: "gpt-6.1-terra", reasoningEffort: "high" })
|
|
126
|
+
// A level it does not offer, and both suffixes at once, are no key.
|
|
127
|
+
expect(parseLlmPriceKeyModel("gpt-6.1-terra:effort-none")).toBeNull()
|
|
128
|
+
expect(parseLlmPriceKeyModel("gpt-6.1-terra:effort-high:direct")).toBeNull()
|
|
129
|
+
expect(parseLlmPriceKeyModel("gpt-6.1-terra:direct:effort-high")).toBeNull()
|
|
130
|
+
})
|
|
131
|
+
expect(getLlmModel("gpt-6.1-terra")?.effortPriced).toBeUndefined()
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
it("parseLlmPriceKeyModel reads back exactly the keys llmPriceKey builds", () => {
|
|
135
|
+
expect(parseLlmPriceKeyModel("gpt-6.1-terra")).toEqual({ modelId: "gpt-6.1-terra" })
|
|
136
|
+
expect(parseLlmPriceKeyModel("claude-opus-5.5:direct")).toEqual({ modelId: "claude-opus-5.5", lane: "direct" })
|
|
137
|
+
for (const m of LLM_MODELS) {
|
|
138
|
+
for (const effort of [undefined, ...LLM_REASONING_EFFORTS]) {
|
|
139
|
+
for (const advanced of [false, true]) {
|
|
140
|
+
const key = llmPriceKey("llm-chat", m.id, effort, advanced)
|
|
141
|
+
expect(parseLlmPriceKeyModel(key.slice("llm-chat:".length))?.modelId, key).toBe(m.id)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
it("parseLlmPriceKeyModel refuses what no key carries", () => {
|
|
148
|
+
// An effort on a model whose price does not depend on it — Terra's included now.
|
|
149
|
+
expect(parseLlmPriceKeyModel("gpt-6.1-terra:effort-high")).toBeNull()
|
|
150
|
+
expect(parseLlmPriceKeyModel("gpt-6.1-sol:effort-high")).toBeNull()
|
|
151
|
+
expect(parseLlmPriceKeyModel("claude-opus-5.5:effort-high")).toBeNull()
|
|
152
|
+
// Unknown models, borrowed slugs, other suffixes.
|
|
153
|
+
expect(parseLlmPriceKeyModel("no-such-model")).toBeNull()
|
|
154
|
+
expect(parseLlmPriceKeyModel("gpt-6-1-terra")).toBeNull()
|
|
155
|
+
expect(parseLlmPriceKeyModel("gpt-6.1-terra:premium")).toBeNull()
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
describe("effortBelowLowestSendsLowest (Kimi K3 and K3.1 Pro)", () => {
|
|
160
|
+
it("a request below the lowest level sends the lowest level; Auto still sends nothing", () => {
|
|
161
|
+
for (const id of ["kimi-k3", "kimi-k3.1-pro"]) {
|
|
162
|
+
expect(getLlmModel(id)?.effortBelowLowestSendsLowest, id).toBe(true)
|
|
163
|
+
expect(effectiveReasoningEffort(id, "none"), id).toBe("low")
|
|
164
|
+
expect(effectiveReasoningEffort(id, undefined), id).toBeUndefined()
|
|
165
|
+
expect(effectiveReasoningEffort(id, "low"), id).toBe("low")
|
|
166
|
+
}
|
|
167
|
+
// The clamp above the lowest level is unchanged.
|
|
168
|
+
expect(effectiveReasoningEffort("kimi-k3.1-pro", "medium")).toBe("low")
|
|
169
|
+
expect(effectiveReasoningEffort("kimi-k3.1-pro", "xhigh")).toBe("high")
|
|
170
|
+
expect(effectiveReasoningEffort("kimi-k3", "medium")).toBe("medium")
|
|
171
|
+
expect(effectiveReasoningEffort("kimi-k3", "max")).toBe("high")
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
it("only the two Kimi models declare it — every other model still drops a request below its lowest level", () => {
|
|
175
|
+
expect(LLM_MODELS.filter((m) => m.effortBelowLowestSendsLowest).map((m) => m.id).sort()).toEqual(["kimi-k3", "kimi-k3.1-pro"])
|
|
176
|
+
expect(effectiveReasoningEffort("gpt-6.1-sol", "none")).toBeUndefined()
|
|
177
|
+
expect(effectiveReasoningEffort("gpt-6.1-terra", "none")).toBeUndefined()
|
|
178
|
+
expect(effectiveReasoningEffort("gemini-4-carbon", "none")).toBeUndefined()
|
|
179
|
+
})
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
describe("structured output: a trusted mode vs a schema hint", () => {
|
|
183
|
+
it("Gemini 4 Carbon sends its schema as a hint, never as a trusted mode", () => {
|
|
184
|
+
const carbon = getLlmModel("gemini-4-carbon")!
|
|
185
|
+
expect(carbon.structuredOutputMode).toBeUndefined()
|
|
186
|
+
expect(carbon.structuredOutputHint).toBe("kie-response-format")
|
|
187
|
+
expect(structuredWireMode(carbon)).toBe("kie-response-format")
|
|
188
|
+
expect(STRUCTURED_VISION_MODELS.map((m) => m.id)).not.toContain("gemini-4-carbon")
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
it("a hint is never set beside a trusted mode; a trusted model's wire mode is its mode", () => {
|
|
192
|
+
for (const m of LLM_MODELS) {
|
|
193
|
+
expect(m.structuredOutputMode !== undefined && m.structuredOutputHint !== undefined, m.id).toBe(false)
|
|
194
|
+
if (m.structuredOutputMode) expect(structuredWireMode(m), m.id).toBe(m.structuredOutputMode)
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
it("kieSchemaInPrompt: only 3.8 Flash and 3.7 Flash (one KIE endpoint), only on a chat-completions response_format model, trust kept", () => {
|
|
199
|
+
expect(LLM_MODELS.filter((m) => m.kieSchemaInPrompt).map((m) => m.id).sort()).toEqual(["gemini-3.7-flash", "gemini-3.8-flash"])
|
|
200
|
+
for (const m of LLM_MODELS.filter((x) => x.kieSchemaInPrompt)) {
|
|
201
|
+
expect(m.kieFormat, m.id).toBe("chat-completions")
|
|
202
|
+
expect(structuredWireMode(m), m.id).toBe("kie-response-format")
|
|
203
|
+
// Per lane: the model-level mode, and the trust it carries, stay.
|
|
204
|
+
expect(m.structuredOutputMode, m.id).toBe("kie-response-format")
|
|
205
|
+
expect(llmSendsSchema(m.id), m.id).toBe(true)
|
|
206
|
+
}
|
|
207
|
+
expect(STRUCTURED_VISION_MODELS.map((m) => m.id)).toContain("gemini-3.8-flash")
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
it("llmSendsSchema: a model that sends its schema (trusted or hinted) counts it; one that sends none does not", () => {
|
|
211
|
+
expect(llmSendsSchema("gemini-4-carbon")).toBe(true)
|
|
212
|
+
expect(llmSendsSchema("gpt-6.1-terra")).toBe(true)
|
|
213
|
+
expect(llmSendsSchema("gpt-5.2")).toBe(false)
|
|
214
|
+
// Unset model = the feature's default; an unknown model counts it.
|
|
215
|
+
expect(llmSendsSchema(undefined, "llm-chat")).toBe(llmSendsSchema(LLM_FEATURE_DEFAULTS["llm-chat"]))
|
|
216
|
+
expect(llmSendsSchema("no-such-model")).toBe(true)
|
|
217
|
+
})
|
|
218
|
+
})
|
|
@@ -93,6 +93,9 @@ describe("model makers", () => {
|
|
|
93
93
|
expect(MODEL_CATALOG["depth-anything-frames"]!.maker).toBe("bytedance")
|
|
94
94
|
expect(MODEL_CATALOG["volcengine-lipsync"]!.maker).toBe("bytedance") // Volcano Engine
|
|
95
95
|
expect(MODEL_CATALOG["infinitalk"]!.maker).toBe("meituan") // MeiGen-AI
|
|
96
|
+
expect(MODEL_CATALOG["latentsync"]!.maker).toBe("bytedance") // ByteDance's research release
|
|
97
|
+
expect(MODEL_CATALOG["lipsync-2-pro"]!.maker).toBe("sync-labs") // sync.so
|
|
98
|
+
expect(MODEL_CATALOG["heygen-lipsync-precision"]!.maker).toBe("heygen")
|
|
96
99
|
})
|
|
97
100
|
|
|
98
101
|
it("modelMakerOf serves the maker's id and the company's name", () => {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import {
|
|
3
|
+
NEMOTRON_TRANSCRIBE_ID,
|
|
4
|
+
NEMOTRON_TRANSCRIBE_PRICING,
|
|
5
|
+
nemotronTranscribeBaseCredits,
|
|
6
|
+
nemotronTranscribeCreditId,
|
|
7
|
+
nemotronTranscribeQuoteCreditId,
|
|
8
|
+
nemotronTranscribeStartedMinutes,
|
|
9
|
+
parseNemotronTranscribeCreditId,
|
|
10
|
+
} from "../credit-estimators/nemotron-transcribe.js"
|
|
11
|
+
import { MODEL_CATALOG } from "../model-catalog.js"
|
|
12
|
+
|
|
13
|
+
const RATE = NEMOTRON_TRANSCRIBE_PRICING.CREDITS_PER_RATE_DEFAULT
|
|
14
|
+
|
|
15
|
+
describe("Nemotron 3.5 Transcribe pricing (per started minute, decided 2026-11-12)", () => {
|
|
16
|
+
// 0.75 base credits a minute: the four-minute row (3) × minutes ÷ 4, rounded up once.
|
|
17
|
+
it.each([
|
|
18
|
+
[45, 1],
|
|
19
|
+
[60, 1],
|
|
20
|
+
[61, 2], // 2 started minutes → 1.5 → 2
|
|
21
|
+
[180, 3], // 3 minutes → 2.25 → 3
|
|
22
|
+
[600, 8], // 10 minutes → 7.5 → 8
|
|
23
|
+
[3600, 45], // 60 minutes → 45
|
|
24
|
+
])("%ss of audio has a base of %s credits at the launch rate", (sec, credits) => {
|
|
25
|
+
expect(nemotronTranscribeBaseCredits(RATE, nemotronTranscribeStartedMinutes(sec))).toBe(credits)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it("is 0.75 credits a minute at the launch rate", () => {
|
|
29
|
+
expect(RATE / NEMOTRON_TRANSCRIBE_PRICING.RATE_MINUTES).toBe(0.75)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it("counts an unknown or non-positive length as one minute, and caps at 60", () => {
|
|
33
|
+
expect(nemotronTranscribeStartedMinutes(undefined)).toBe(1)
|
|
34
|
+
expect(nemotronTranscribeStartedMinutes(0)).toBe(1)
|
|
35
|
+
expect(nemotronTranscribeStartedMinutes(Number.NaN)).toBe(1)
|
|
36
|
+
expect(nemotronTranscribeStartedMinutes(3600.2)).toBe(60)
|
|
37
|
+
expect(nemotronTranscribeStartedMinutes(99_999)).toBe(60)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it("builds and parses the per-minute id", () => {
|
|
41
|
+
expect(nemotronTranscribeCreditId(190)).toBe("nemotron-3-5-transcribe:4m")
|
|
42
|
+
expect(parseNemotronTranscribeCreditId("nemotron-3-5-transcribe:4m")).toEqual({ minutes: 4 })
|
|
43
|
+
expect(parseNemotronTranscribeCreditId("nemotron-3-5-transcribe:60m")).toEqual({ minutes: 60 })
|
|
44
|
+
expect(parseNemotronTranscribeCreditId("nemotron-3-5-transcribe:61m")).toBeUndefined()
|
|
45
|
+
expect(parseNemotronTranscribeCreditId("nemotron-3-5-transcribe:0m")).toBeUndefined()
|
|
46
|
+
expect(parseNemotronTranscribeCreditId("nemotron-3-5-transcribe")).toBeUndefined()
|
|
47
|
+
expect(parseNemotronTranscribeCreditId(NEMOTRON_TRANSCRIBE_PRICING.RATE_CREDIT_ID)).toBeUndefined()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it("quotes an unknown length at 60 minutes, the most a run is charged", () => {
|
|
51
|
+
expect(nemotronTranscribeQuoteCreditId(undefined)).toBe("nemotron-3-5-transcribe:60m")
|
|
52
|
+
expect(nemotronTranscribeQuoteCreditId(null)).toBe("nemotron-3-5-transcribe:60m")
|
|
53
|
+
expect(nemotronTranscribeQuoteCreditId(125)).toBe("nemotron-3-5-transcribe:3m")
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it("lists the four-minute rate row in the catalog at the launch rate", () => {
|
|
57
|
+
const entry = MODEL_CATALOG[NEMOTRON_TRANSCRIBE_ID as keyof typeof MODEL_CATALOG] as unknown as { pricing: Array<{ identifier: string; credits: number }>; maker?: string }
|
|
58
|
+
expect(entry.pricing).toEqual([expect.objectContaining({ identifier: NEMOTRON_TRANSCRIBE_PRICING.RATE_CREDIT_ID, credits: RATE })])
|
|
59
|
+
expect(entry.maker).toBe("nvidia")
|
|
60
|
+
})
|
|
61
|
+
})
|
|
@@ -158,6 +158,13 @@ describe("EXECUTION_DATA_KEYS", () => {
|
|
|
158
158
|
}
|
|
159
159
|
})
|
|
160
160
|
|
|
161
|
+
it("files an Extend / Upscale Video run's own output task as a run result: never undo, preset or template state, and persisted", () => {
|
|
162
|
+
for (const type of ["extend-video", "video-upscale", undefined]) {
|
|
163
|
+
expect(isExecutionDataKey("outputKieTaskId", type), String(type)).toBe(true)
|
|
164
|
+
}
|
|
165
|
+
expect(TRANSIENT_RUNTIME_KEYS.has("outputKieTaskId")).toBe(false)
|
|
166
|
+
})
|
|
167
|
+
|
|
161
168
|
it("a type's own keys come with every global one, as a set", () => {
|
|
162
169
|
const ugcClip = executionDataKeysOf("ugc-clip")
|
|
163
170
|
for (const key of EXECUTION_DATA_KEYS) expect(ugcClip.has(key), key).toBe(true)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest"
|
|
2
|
-
import { normalizeNodeModelParams, MODEL_PARAM_NODE_TYPES } from "../normalize-node-params.js"
|
|
2
|
+
import { describeNodeAdjustments, normalizeNodeModelParams, withListedReferenceTaskTypes, MODEL_PARAM_NODE_TYPES } from "../normalize-node-params.js"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Write-boundary guard for agent/import-authored graphs. The config panel's
|
|
@@ -129,3 +129,174 @@ describe("normalizeNodeModelParams", () => {
|
|
|
129
129
|
expect(second.adjustments).toEqual([])
|
|
130
130
|
})
|
|
131
131
|
})
|
|
132
|
+
|
|
133
|
+
describe("normalizeNodeModelParams — Motion Transfer (decided 2026-11-12)", () => {
|
|
134
|
+
it("a Wan Animate node at a size it does not have is written at 720p, the size it runs at", () => {
|
|
135
|
+
const { nodes, adjustments } = normalizeNodeModelParams([
|
|
136
|
+
{ id: "m1", type: "motion-transfer", data: { provider: "wan-animate-move", resolution: "1080p", prompt: "dance" } },
|
|
137
|
+
])
|
|
138
|
+
expect(nodes[0]!.data).toEqual({ provider: "wan-animate-move", resolution: "720p", prompt: "dance" })
|
|
139
|
+
expect(adjustments.map(({ nodeId, provider, field, from, to }) => ({ nodeId, provider, field, from, to }))).toEqual([
|
|
140
|
+
{ nodeId: "m1", provider: "wan-animate-move", field: "resolution", from: "1080p", to: "720p" },
|
|
141
|
+
])
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
it("leaves a Wan Animate size it has, an unset size, and every Kling node as it came", () => {
|
|
145
|
+
const input = [
|
|
146
|
+
{ id: "a", type: "motion-transfer", data: { provider: "wan-animate-replace", resolution: "580p" } },
|
|
147
|
+
{ id: "b", type: "motion-transfer", data: { provider: "wan-animate-replace" } },
|
|
148
|
+
{ id: "c", type: "motion-transfer", data: { provider: "kling", resolution: "480p" } },
|
|
149
|
+
{ id: "d", type: "motion-transfer", data: { resolution: "580p" } },
|
|
150
|
+
{ id: "e", type: "motion-transfer", data: { provider: "kling-3.0", resolution: "1080p" } },
|
|
151
|
+
]
|
|
152
|
+
const { nodes, adjustments } = normalizeNodeModelParams(input)
|
|
153
|
+
expect(adjustments).toEqual([])
|
|
154
|
+
nodes.forEach((n, i) => expect(n).toBe(input[i]))
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* A video node's stored reference task type (decided 2026-11-13): kept only
|
|
160
|
+
* while a model the node runs lists it (`MODEL_CATALOG[id].referenceTaskTypes`,
|
|
161
|
+
* read through `listedSeedanceTaskType`), else removed — never left hidden on
|
|
162
|
+
* a model that ignores it, to come back when the node is later switched to one
|
|
163
|
+
* that reads it.
|
|
164
|
+
*/
|
|
165
|
+
describe("normalizeNodeModelParams — a stored reference task type (decided 2026-11-13)", () => {
|
|
166
|
+
const VIDEO_TYPES = ["generate-video", "image-to-video", "text-to-video", "video-to-video"] as const
|
|
167
|
+
const brief = (a: { nodeId: string; provider: string; field: string; from: unknown; to: unknown }) =>
|
|
168
|
+
({ nodeId: a.nodeId, provider: a.provider, field: a.field, from: a.from, to: a.to })
|
|
169
|
+
|
|
170
|
+
it.each(VIDEO_TYPES)("%s on Kling, written with edit: the key is removed, and the removal reported", (type) => {
|
|
171
|
+
const input = [node("k", type, { provider: "kling-3.0", prompt: "a cat", referenceTaskType: "edit" })]
|
|
172
|
+
const { nodes, adjustments } = normalizeNodeModelParams(input)
|
|
173
|
+
expect(nodes[0]!.data).toStrictEqual({ provider: "kling-3.0", prompt: "a cat" })
|
|
174
|
+
expect(nodes[0]!.data).not.toHaveProperty("referenceTaskType")
|
|
175
|
+
expect(adjustments.map(brief)).toEqual([{ nodeId: "k", provider: "kling-3.0", field: "referenceTaskType", from: "edit", to: undefined }])
|
|
176
|
+
// The caller's node is never mutated.
|
|
177
|
+
expect(input[0]!.data.referenceTaskType).toBe("edit")
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
it.each(VIDEO_TYPES)("%s on Seedance 2.5 keeps every value it lists, the node returned as it came", (type) => {
|
|
181
|
+
for (const value of ["reference", "edit", "extend"]) {
|
|
182
|
+
const input = [node("s", type, { provider: "seedance-2-5", referenceTaskType: value })]
|
|
183
|
+
const { nodes, adjustments } = normalizeNodeModelParams(input)
|
|
184
|
+
expect(adjustments).toEqual([])
|
|
185
|
+
expect(nodes[0]).toBe(input[0])
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
it("\"auto\", a wrong case, a number and any other value no model lists are removed, even on Seedance 2.5", () => {
|
|
190
|
+
for (const value of ["auto", "Edit", "bogus", 3, null, true]) {
|
|
191
|
+
const { nodes, adjustments } = normalizeNodeModelParams([node("s", "generate-video", { provider: "seedance-2-5", referenceTaskType: value })])
|
|
192
|
+
expect(nodes[0]!.data, String(value)).toStrictEqual({ provider: "seedance-2-5" })
|
|
193
|
+
expect(adjustments.map(brief), String(value)).toEqual([
|
|
194
|
+
{ nodeId: "s", provider: "seedance-2-5", field: "referenceTaskType", from: typeof value === "number" ? value : String(value), to: undefined },
|
|
195
|
+
])
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
it("a node of another type is untouched, whatever it stores", () => {
|
|
200
|
+
const input = [
|
|
201
|
+
node("img", "generate-image", { provider: "gpt-image-2", aspectRatio: "16:9", resolution: "2K", referenceTaskType: "edit" }),
|
|
202
|
+
node("ext", "extend-video", { provider: "seedance-2-5-extend", referenceTaskType: "auto" }),
|
|
203
|
+
node("txt", "text-prompt", { text: "hi", referenceTaskType: "edit" }),
|
|
204
|
+
node("up", "upload-video", { url: "https://cdn.example/a.mp4", referenceTaskType: "bogus" }),
|
|
205
|
+
]
|
|
206
|
+
const { nodes, adjustments } = normalizeNodeModelParams(input)
|
|
207
|
+
expect(adjustments).toEqual([])
|
|
208
|
+
nodes.forEach((n, i) => expect(n).toBe(input[i]))
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
it("a video node with no task type stored (or the editor's in-memory undefined for Auto) is returned as it came", () => {
|
|
212
|
+
const input = [
|
|
213
|
+
...VIDEO_TYPES.map((type) => node(type, type, { provider: "kling-3.0", aspectRatio: "21:9", duration: 5 })),
|
|
214
|
+
node("auto", "generate-video", { provider: "kling-3.0", referenceTaskType: undefined }),
|
|
215
|
+
]
|
|
216
|
+
const { nodes, adjustments } = normalizeNodeModelParams(input)
|
|
217
|
+
expect(adjustments).toEqual([])
|
|
218
|
+
nodes.forEach((n, i) => expect(n).toBe(input[i]))
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
it("a node naming no model is judged on the model its run uses (none of today's defaults lists one)", () => {
|
|
222
|
+
for (const type of VIDEO_TYPES) {
|
|
223
|
+
const { nodes, adjustments } = normalizeNodeModelParams([node("d", type, { referenceTaskType: "edit" })])
|
|
224
|
+
expect(nodes[0]!.data, type).toStrictEqual({})
|
|
225
|
+
expect(adjustments.map((a) => a.field), type).toEqual(["referenceTaskType"])
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
it("a node naming several models keeps it while any of them lists it", () => {
|
|
230
|
+
const kept = [node("m", "image-to-video", { providers: ["kling-3.0", "seedance-2-5"], provider: "kling-3.0", referenceTaskType: "extend" })]
|
|
231
|
+
expect(normalizeNodeModelParams(kept).nodes[0]).toBe(kept[0])
|
|
232
|
+
const dropped = normalizeNodeModelParams([node("m", "image-to-video", { providers: ["kling-3.0", "seedance-2-fast"], provider: "kling-3.0", referenceTaskType: "extend" })])
|
|
233
|
+
expect(dropped.nodes[0]!.data).not.toHaveProperty("referenceTaskType")
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
it("is idempotent — a second pass reports nothing", () => {
|
|
237
|
+
const first = normalizeNodeModelParams([node("k", "generate-video", { provider: "kling-3.0", referenceTaskType: "edit" })])
|
|
238
|
+
const second = normalizeNodeModelParams(first.nodes)
|
|
239
|
+
expect(second.adjustments).toEqual([])
|
|
240
|
+
expect(second.nodes[0]).toBe(first.nodes[0])
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
it("describes a removal as one line", () => {
|
|
244
|
+
const { adjustments } = normalizeNodeModelParams([node("k", "generate-video", { provider: "kling-3.0", referenceTaskType: "edit" })])
|
|
245
|
+
expect(describeNodeAdjustments(adjustments)).toEqual([
|
|
246
|
+
expect.stringMatching(/^k \(kling-3\.0\): referenceTaskType "edit" → removed — /),
|
|
247
|
+
])
|
|
248
|
+
})
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* `withListedReferenceTaskTypes` (decided 2026-11-13): the one rule for a
|
|
253
|
+
* stored reference task type that every workflow write runs — the editor's
|
|
254
|
+
* saves, the REST writes, imports, copies, clones, published snapshots — and
|
|
255
|
+
* `normalizeNodeModelParams` runs for that field. It removes that one key and
|
|
256
|
+
* coerces nothing else.
|
|
257
|
+
*/
|
|
258
|
+
describe("withListedReferenceTaskTypes — the write paths' rule", () => {
|
|
259
|
+
const GRAPH = [
|
|
260
|
+
node("kling", "generate-video", { provider: "kling-3.0", prompt: "a cat", aspectRatio: "21:9", resolution: "4K", referenceTaskType: "edit" }),
|
|
261
|
+
node("sd25", "generate-video", { provider: "seedance-2-5", prompt: "a cat", referenceTaskType: "edit" }),
|
|
262
|
+
// An image ratio the catalog normalizer WOULD snap: the write paths leave it as stored.
|
|
263
|
+
node("img", "generate-image", { provider: "gpt-image", aspectRatio: "16:9", resolution: "2K" }),
|
|
264
|
+
node("t", "text-prompt", { text: "hi" }),
|
|
265
|
+
]
|
|
266
|
+
|
|
267
|
+
it("removes only that key: the whole graph is otherwise exactly as written", () => {
|
|
268
|
+
const out = withListedReferenceTaskTypes(GRAPH)
|
|
269
|
+
expect(out).toStrictEqual([
|
|
270
|
+
node("kling", "generate-video", { provider: "kling-3.0", prompt: "a cat", aspectRatio: "21:9", resolution: "4K" }),
|
|
271
|
+
GRAPH[1],
|
|
272
|
+
GRAPH[2],
|
|
273
|
+
GRAPH[3],
|
|
274
|
+
])
|
|
275
|
+
expect(out[1]).toBe(GRAPH[1])
|
|
276
|
+
expect(out[2]).toBe(GRAPH[2])
|
|
277
|
+
expect(JSON.stringify(out[0])).toBe(JSON.stringify(GRAPH[0]).replace(',"referenceTaskType":"edit"', ""))
|
|
278
|
+
// The caller's graph is never mutated.
|
|
279
|
+
expect(GRAPH[0]!.data).toHaveProperty("referenceTaskType", "edit")
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
it("a graph without such a value comes back as the SAME array (written byte for byte as before)", () => {
|
|
283
|
+
const clean = [GRAPH[1], GRAPH[2], GRAPH[3]]
|
|
284
|
+
expect(withListedReferenceTaskTypes(clean)).toBe(clean)
|
|
285
|
+
expect(withListedReferenceTaskTypes([])).toStrictEqual([])
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
it("takes the stored value as it comes: anything that is not an array, or a malformed entry, is left as it came", () => {
|
|
289
|
+
for (const v of [undefined, null, "nodes", 3, { id: "x" }]) expect(withListedReferenceTaskTypes(v)).toBe(v)
|
|
290
|
+
const odd = [null, 7, "x", [], { type: "generate-video" }, { type: "generate-video", data: null }]
|
|
291
|
+
expect(withListedReferenceTaskTypes(odd)).toBe(odd)
|
|
292
|
+
})
|
|
293
|
+
|
|
294
|
+
it("is the rule normalizeNodeModelParams runs for the field: the same nodes and the same reports", () => {
|
|
295
|
+
const videoOnly = GRAPH.filter((n) => n.type !== "generate-image")
|
|
296
|
+
const adjustments: Parameters<typeof withListedReferenceTaskTypes>[1] = []
|
|
297
|
+
const viaWrites = withListedReferenceTaskTypes(videoOnly, adjustments)
|
|
298
|
+
const viaNormalizer = normalizeNodeModelParams(videoOnly)
|
|
299
|
+
expect(viaWrites).toStrictEqual(viaNormalizer.nodes)
|
|
300
|
+
expect(adjustments).toStrictEqual(viaNormalizer.adjustments)
|
|
301
|
+
})
|
|
302
|
+
})
|