@nodaro/shared 3.36.0 → 3.38.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-FKQJYMCO.js → chunk-2BHOAYZW.js} +38 -13
- package/dist/chunk-2BHOAYZW.js.map +1 -0
- package/dist/{chunk-BSQCKTXH.cjs → chunk-33QG2DOW.cjs} +6 -6
- package/dist/{chunk-BSQCKTXH.cjs.map → chunk-33QG2DOW.cjs.map} +1 -1
- package/dist/{chunk-NYMOHNYV.js → chunk-5OED47LE.js} +3 -3
- package/dist/{chunk-NYMOHNYV.js.map → chunk-5OED47LE.js.map} +1 -1
- package/dist/{chunk-GZH2SIOF.cjs → chunk-5PCI6M44.cjs} +18 -6
- package/dist/chunk-5PCI6M44.cjs.map +1 -0
- package/dist/chunk-6Q4BS6AR.js +158 -0
- package/dist/chunk-6Q4BS6AR.js.map +1 -0
- package/dist/{chunk-AXUW64ZY.js → chunk-7QITUDRT.js} +3 -3
- package/dist/{chunk-AXUW64ZY.js.map → chunk-7QITUDRT.js.map} +1 -1
- package/dist/{chunk-V3N56Z2S.cjs → chunk-7VDPBFER.cjs} +43 -12
- package/dist/chunk-7VDPBFER.cjs.map +1 -0
- package/dist/{chunk-LT5IJO4Y.cjs → chunk-AQA6YXY5.cjs} +39 -10
- package/dist/chunk-AQA6YXY5.cjs.map +1 -0
- package/dist/{chunk-7AB3AE5L.js → chunk-BDSFMY4X.js} +5 -18
- package/dist/chunk-BDSFMY4X.js.map +1 -0
- package/dist/chunk-BLZBDPZJ.js +16 -0
- package/dist/chunk-BLZBDPZJ.js.map +1 -0
- package/dist/{chunk-TCBHVIMD.js → chunk-CQJYKSXF.js} +18 -6
- package/dist/chunk-CQJYKSXF.js.map +1 -0
- package/dist/{chunk-AWWOQH46.cjs → chunk-D33YBZ3B.cjs} +170 -143
- package/dist/chunk-D33YBZ3B.cjs.map +1 -0
- package/dist/chunk-DBD4BCGH.cjs +169 -0
- package/dist/chunk-DBD4BCGH.cjs.map +1 -0
- package/dist/{chunk-7VQPHLZ5.cjs → chunk-ENFBA33M.cjs} +21 -21
- package/dist/{chunk-7VQPHLZ5.cjs.map → chunk-ENFBA33M.cjs.map} +1 -1
- package/dist/{chunk-BBLE4UTG.cjs → chunk-GLON7ANZ.cjs} +48 -15
- package/dist/chunk-GLON7ANZ.cjs.map +1 -0
- package/dist/{chunk-JSGIEF6Z.cjs → chunk-HSJU5KNR.cjs} +6 -3
- package/dist/chunk-HSJU5KNR.cjs.map +1 -0
- package/dist/{chunk-YN6AXDN5.cjs → chunk-HZ46RDLD.cjs} +9 -24
- package/dist/chunk-HZ46RDLD.cjs.map +1 -0
- package/dist/{chunk-NITAUX3A.cjs → chunk-JLKZEKQ3.cjs} +45 -28
- package/dist/chunk-JLKZEKQ3.cjs.map +1 -0
- package/dist/{chunk-WXNQMJ67.js → chunk-LOWOJN65.js} +100 -6
- package/dist/chunk-LOWOJN65.js.map +1 -0
- package/dist/chunk-M7G66F6H.js +17 -0
- package/dist/chunk-M7G66F6H.js.map +1 -0
- package/dist/chunk-PSAWDKO3.cjs +19 -0
- package/dist/chunk-PSAWDKO3.cjs.map +1 -0
- package/dist/{chunk-2HVFF5SS.js → chunk-QLCSS6DK.js} +165 -141
- package/dist/chunk-QLCSS6DK.js.map +1 -0
- package/dist/{chunk-ANOQWAMU.js → chunk-R6B2UDFR.js} +35 -5
- package/dist/chunk-R6B2UDFR.js.map +1 -0
- package/dist/chunk-T3TOSWVH.cjs +20 -0
- package/dist/chunk-T3TOSWVH.cjs.map +1 -0
- package/dist/{chunk-J65CAOUV.cjs → chunk-TGZJXCLL.cjs} +105 -5
- package/dist/chunk-TGZJXCLL.cjs.map +1 -0
- package/dist/{chunk-56VQ7V3V.js → chunk-THGNDVVH.js} +29 -4
- package/dist/chunk-THGNDVVH.js.map +1 -0
- package/dist/{chunk-XNISPHTZ.js → chunk-WPT5ZTA2.js} +6 -3
- package/dist/chunk-WPT5ZTA2.js.map +1 -0
- package/dist/{chunk-NTHRTRQK.js → chunk-XA53RUSD.js} +22 -6
- package/dist/chunk-XA53RUSD.js.map +1 -0
- package/dist/entries/apps.cjs +38 -38
- package/dist/entries/apps.js +3 -3
- package/dist/entries/credits.cjs +135 -134
- package/dist/entries/credits.js +3 -2
- package/dist/entries/llm-models.cjs +81 -49
- package/dist/entries/llm-models.d.cts +82 -14
- package/dist/entries/llm-models.d.ts +82 -14
- package/dist/entries/llm-models.js +2 -2
- package/dist/entries/media.cjs +66 -42
- package/dist/entries/media.d.cts +145 -4
- package/dist/entries/media.d.ts +145 -4
- package/dist/entries/media.js +1 -1
- package/dist/entries/models.cjs +84 -27
- package/dist/entries/models.d.cts +109 -3
- package/dist/entries/models.d.ts +109 -3
- package/dist/entries/models.js +3 -2
- package/dist/entries/nodes.cjs +204 -199
- package/dist/entries/nodes.d.cts +19 -2
- package/dist/entries/nodes.d.ts +19 -2
- package/dist/entries/nodes.js +5 -4
- package/dist/entries/pipeline.d.cts +2 -2
- package/dist/entries/pipeline.d.ts +2 -2
- package/dist/entries/social.cjs +187 -174
- package/dist/entries/social.d.cts +26 -1
- package/dist/entries/social.d.ts +26 -1
- package/dist/entries/social.js +3 -2
- package/dist/entries/workflow.cjs +157 -144
- package/dist/entries/workflow.d.cts +49 -1
- package/dist/entries/workflow.d.ts +49 -1
- package/dist/entries/workflow.js +4 -3
- package/dist/index.cjs +942 -800
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +14 -12
- package/dist/{scene-node-types-Cvbtf-0a.d.ts → model-constants-C43YS07I.d.cts} +1 -497
- package/dist/{scene-node-types-Cvbtf-0a.d.cts → model-constants-C43YS07I.d.ts} +1 -497
- package/dist/scene-node-types-BSrTKnV7.d.cts +499 -0
- package/dist/scene-node-types-BSrTKnV7.d.ts +499 -0
- package/package.json +1 -1
- package/src/__tests__/cast-swap-limits.test.ts +40 -0
- package/src/__tests__/fixtures/root-exports.baseline.json +6 -0
- package/src/__tests__/llm-models.test.ts +61 -18
- package/src/__tests__/llm-price-key.test.ts +55 -0
- package/src/__tests__/node-preset-extract.test.ts +10 -0
- package/src/__tests__/node-runtime-keys.test.ts +21 -2
- package/src/__tests__/render-output.test.ts +64 -0
- package/src/__tests__/schedule-retry.test.ts +35 -0
- package/src/__tests__/scrape-analysis-pricing.test.ts +41 -0
- package/src/__tests__/suno-separate.test.ts +78 -0
- package/src/__tests__/video-mask.test.ts +27 -0
- package/src/cast-swap-limits.ts +52 -0
- package/src/entries/llm-models.ts +7 -0
- package/src/entries/models.ts +26 -1
- package/src/entries/social.ts +1 -0
- package/src/entries/workflow.ts +6 -0
- package/src/generated/unit-contracts.ts +8 -2
- package/src/llm-models.ts +111 -23
- package/src/mask-composite.ts +80 -3
- package/src/node-preset-extract.ts +4 -0
- package/src/node-runtime-keys.ts +7 -0
- package/src/render-output.ts +36 -1
- package/src/schedule-retry.ts +71 -0
- package/src/scrape-analysis-pricing.ts +73 -0
- package/src/script-model.ts +21 -0
- package/src/suno-separate.ts +210 -0
- package/src/video-mask.ts +97 -0
- package/dist/chunk-2HVFF5SS.js.map +0 -1
- package/dist/chunk-56VQ7V3V.js.map +0 -1
- package/dist/chunk-7AB3AE5L.js.map +0 -1
- package/dist/chunk-ANOQWAMU.js.map +0 -1
- package/dist/chunk-AWWOQH46.cjs.map +0 -1
- package/dist/chunk-BBLE4UTG.cjs.map +0 -1
- package/dist/chunk-FG4E7MTG.cjs +0 -4
- package/dist/chunk-FG4E7MTG.cjs.map +0 -1
- package/dist/chunk-FKQJYMCO.js.map +0 -1
- package/dist/chunk-GZH2SIOF.cjs.map +0 -1
- package/dist/chunk-J65CAOUV.cjs.map +0 -1
- package/dist/chunk-JSGIEF6Z.cjs.map +0 -1
- package/dist/chunk-LT5IJO4Y.cjs.map +0 -1
- package/dist/chunk-NITAUX3A.cjs.map +0 -1
- package/dist/chunk-NTHRTRQK.js.map +0 -1
- package/dist/chunk-TCBHVIMD.js.map +0 -1
- package/dist/chunk-TZE673G6.js +0 -3
- package/dist/chunk-TZE673G6.js.map +0 -1
- package/dist/chunk-V3N56Z2S.cjs.map +0 -1
- package/dist/chunk-WXNQMJ67.js.map +0 -1
- package/dist/chunk-XNISPHTZ.js.map +0 -1
- package/dist/chunk-YN6AXDN5.cjs.map +0 -1
|
@@ -3,6 +3,9 @@ import {
|
|
|
3
3
|
LLM_MODEL_IDS,
|
|
4
4
|
LLM_FEATURE_DEFAULTS,
|
|
5
5
|
DESCRIBE_TO_PICKER_FALLBACK_MODEL,
|
|
6
|
+
DESCRIBE_TO_PICKER_MODELS,
|
|
7
|
+
DESCRIBE_TO_PICKER_WITHHELD_MODELS,
|
|
8
|
+
LLM_STRUCTURED_WITHHELD_MODELS,
|
|
6
9
|
LLM_FEATURE_DEFAULT_EFFORTS,
|
|
7
10
|
defaultReasoningEffort,
|
|
8
11
|
STRUCTURED_VISION_MODELS,
|
|
@@ -475,11 +478,16 @@ describe("LLM_FEATURE_DEFAULTS", () => {
|
|
|
475
478
|
}
|
|
476
479
|
})
|
|
477
480
|
|
|
478
|
-
it('"describe-to-picker" defaults to "
|
|
479
|
-
expect(LLM_FEATURE_DEFAULTS["describe-to-picker"]).toBe("
|
|
480
|
-
expect(getLlmTier(LLM_FEATURE_DEFAULTS["describe-to-picker"])).toBe("
|
|
481
|
-
// The default MUST be an accepted analyzer model (vision + structured output).
|
|
482
|
-
expect(
|
|
481
|
+
it('"describe-to-picker" defaults to "gemini-3.8-flash" (economy vision; decided 2026-10-20 from a production cost audit)', () => {
|
|
482
|
+
expect(LLM_FEATURE_DEFAULTS["describe-to-picker"]).toBe("gemini-3.8-flash")
|
|
483
|
+
expect(getLlmTier(LLM_FEATURE_DEFAULTS["describe-to-picker"])).toBe("economy")
|
|
484
|
+
// The default MUST be an accepted analyzer model (vision + structured output, offered by the node).
|
|
485
|
+
expect(DESCRIBE_TO_PICKER_MODELS.map((m) => m.id)).toContain("gemini-3.8-flash")
|
|
486
|
+
// And it bills the cheapest rung on the aggregator: no effort, no direct lane.
|
|
487
|
+
const effort = defaultReasoningEffort("describe-to-picker", undefined)
|
|
488
|
+
expect(effort).toBeUndefined()
|
|
489
|
+
expect(llmServesDirect("gemini-3.8-flash", effort)).toBe(false)
|
|
490
|
+
expect(buildLlmCreditIdentifier("describe-to-picker", "gemini-3.8-flash", effort)).toBe("describe-to-picker:economy")
|
|
483
491
|
})
|
|
484
492
|
|
|
485
493
|
it("the describe-to-picker fallback is an accepted analyzer from another vendor, billed on the cheapest rung", () => {
|
|
@@ -521,19 +529,24 @@ describe("LLM_FEATURE_DEFAULTS", () => {
|
|
|
521
529
|
// defaultReasoningEffort — a feature's default effort rides its default model
|
|
522
530
|
// ---------------------------------------------------------------------------
|
|
523
531
|
describe("defaultReasoningEffort", () => {
|
|
524
|
-
it('"describe-to-picker" runs at "high"
|
|
525
|
-
expect(
|
|
532
|
+
it('"describe-to-picker" on Claude Opus 5.5 runs at "high" when named (the 2026-10-09 recipe stays with the model)', () => {
|
|
533
|
+
expect(LLM_FEATURE_DEFAULT_EFFORTS["describe-to-picker"]).toEqual({ model: "claude-opus-5.5", effort: "high" })
|
|
526
534
|
expect(defaultReasoningEffort("describe-to-picker", "claude-opus-5.5")).toBe("high")
|
|
527
|
-
// An unset model in node data can be "" — the same "use the default" the
|
|
528
|
-
// `llmModel || LLM_FEATURE_DEFAULTS[…]` reads give it.
|
|
529
|
-
expect(defaultReasoningEffort("describe-to-picker", "")).toBe("high")
|
|
530
535
|
})
|
|
531
536
|
|
|
532
|
-
it("names the
|
|
537
|
+
it("names the recipe model by any of its accepted ids", () => {
|
|
533
538
|
// The dash alias getLlmModel resolves to the canonical claude-opus-5.5.
|
|
534
539
|
expect(defaultReasoningEffort("describe-to-picker", "claude-opus-5-5")).toBe("high")
|
|
535
540
|
})
|
|
536
541
|
|
|
542
|
+
it("the feature's default model, omitted or named, gets no effort: it is not the recipe's model (decided 2026-10-20)", () => {
|
|
543
|
+
expect(defaultReasoningEffort("describe-to-picker", undefined)).toBeUndefined()
|
|
544
|
+
// An unset model in node data can be "" — the same "use the default" the
|
|
545
|
+
// `llmModel || LLM_FEATURE_DEFAULTS[…]` reads give it.
|
|
546
|
+
expect(defaultReasoningEffort("describe-to-picker", "")).toBeUndefined()
|
|
547
|
+
expect(defaultReasoningEffort("describe-to-picker", LLM_FEATURE_DEFAULTS["describe-to-picker"])).toBeUndefined()
|
|
548
|
+
})
|
|
549
|
+
|
|
537
550
|
it("a caller who picked another model and no effort keeps that model's Auto", () => {
|
|
538
551
|
expect(defaultReasoningEffort("describe-to-picker", "gemini-3.8-flash")).toBeUndefined()
|
|
539
552
|
expect(defaultReasoningEffort("describe-to-picker", "claude-opus-5")).toBeUndefined()
|
|
@@ -545,24 +558,54 @@ describe("defaultReasoningEffort", () => {
|
|
|
545
558
|
expect(defaultReasoningEffort("no-such-feature", undefined)).toBeUndefined()
|
|
546
559
|
})
|
|
547
560
|
|
|
548
|
-
it("every declared
|
|
561
|
+
it("every declared recipe effort is a level its model offers, on the aggregator lane and direct, and that model is a registered one", () => {
|
|
549
562
|
// The effort pickers show this level as selected — one the model does not
|
|
550
563
|
// offer would leave them blank (and the quick strip's fail-safe snapping).
|
|
551
|
-
for (const [feature,
|
|
552
|
-
|
|
553
|
-
expect(availableReasoningEfforts(model), feature).toContain(effort)
|
|
554
|
-
expect(availableReasoningEfforts(model, true), feature).toContain(effort)
|
|
564
|
+
for (const [feature, recipe] of Object.entries(LLM_FEATURE_DEFAULT_EFFORTS)) {
|
|
565
|
+
expect(getLlmModel(recipe.model)?.id, feature).toBe(recipe.model)
|
|
566
|
+
expect(availableReasoningEfforts(recipe.model), feature).toContain(recipe.effort)
|
|
567
|
+
expect(availableReasoningEfforts(recipe.model, true), feature).toContain(recipe.effort)
|
|
555
568
|
}
|
|
556
569
|
})
|
|
557
570
|
|
|
558
|
-
it("
|
|
559
|
-
const model =
|
|
571
|
+
it("describe-to-picker on Opus 5.5 runs and bills direct: its effort only works on Anthropic's API", () => {
|
|
572
|
+
const model = LLM_FEATURE_DEFAULT_EFFORTS["describe-to-picker"]!.model
|
|
560
573
|
const effort = defaultReasoningEffort("describe-to-picker", model)
|
|
561
574
|
expect(llmServesDirect(model, effort)).toBe(true)
|
|
562
575
|
expect(buildLlmCreditIdentifier("describe-to-picker", model, effort)).toBe("describe-to-picker:premium-direct")
|
|
563
576
|
})
|
|
564
577
|
})
|
|
565
578
|
|
|
579
|
+
// ---------------------------------------------------------------------------
|
|
580
|
+
// DESCRIBE_TO_PICKER_MODELS — what the node offers and its route accepts
|
|
581
|
+
// ---------------------------------------------------------------------------
|
|
582
|
+
describe("DESCRIBE_TO_PICKER_MODELS", () => {
|
|
583
|
+
it("is the whole structured vision list: nothing is withheld, Claude Fable 5 is offered again (metered pricing, 2026-10-20)", () => {
|
|
584
|
+
// Metered pricing charges a legend-sized read what it really costs, so the
|
|
585
|
+
// cost-audit withholding is gone; the deprecated set stays exported, empty.
|
|
586
|
+
expect(DESCRIBE_TO_PICKER_WITHHELD_MODELS.size).toBe(0)
|
|
587
|
+
const ids = DESCRIBE_TO_PICKER_MODELS.map((m) => m.id)
|
|
588
|
+
expect(ids).toContain("claude-fable-5")
|
|
589
|
+
expect(ids.sort()).toEqual(STRUCTURED_VISION_MODELS.map((m) => m.id).sort())
|
|
590
|
+
})
|
|
591
|
+
|
|
592
|
+
it("every withheld id is a registered model (a typo would withhold nothing)", () => {
|
|
593
|
+
for (const id of DESCRIBE_TO_PICKER_WITHHELD_MODELS) expect(getLlmModel(id)?.id, id).toBe(id)
|
|
594
|
+
})
|
|
595
|
+
|
|
596
|
+
it("the other legend-sized structured reads (text-to-picker, llm-structured) withhold nothing either", () => {
|
|
597
|
+
expect(LLM_STRUCTURED_WITHHELD_MODELS).toBe(DESCRIBE_TO_PICKER_WITHHELD_MODELS)
|
|
598
|
+
expect(LLM_STRUCTURED_WITHHELD_MODELS.has("claude-fable-5")).toBe(false)
|
|
599
|
+
})
|
|
600
|
+
|
|
601
|
+
it("offers the default, the fallback and the Opus 5.5 recipe model", () => {
|
|
602
|
+
const ids = DESCRIBE_TO_PICKER_MODELS.map((m) => m.id)
|
|
603
|
+
expect(ids).toContain(LLM_FEATURE_DEFAULTS["describe-to-picker"])
|
|
604
|
+
expect(ids).toContain(DESCRIBE_TO_PICKER_FALLBACK_MODEL)
|
|
605
|
+
expect(ids).toContain(LLM_FEATURE_DEFAULT_EFFORTS["describe-to-picker"]!.model)
|
|
606
|
+
})
|
|
607
|
+
})
|
|
608
|
+
|
|
566
609
|
// ---------------------------------------------------------------------------
|
|
567
610
|
// motionGraphicsFeature
|
|
568
611
|
// ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import { LLM_FEATURE_DEFAULTS, LLM_FEATURE_DEFAULTS_FROM, llmDefaultsFeature, llmPriceKey } from "../entries/llm-models.js"
|
|
3
|
+
|
|
4
|
+
// The key a client asks `POST /v1/credits/model-costs` for a metered LLM
|
|
5
|
+
// call's price with: `<feature>:<model>`, plus `:direct` when the call is
|
|
6
|
+
// served on the vendor's own API (it is then priced at the direct rate).
|
|
7
|
+
describe("llmPriceKey", () => {
|
|
8
|
+
it("is <feature>:<model> for a call on the model's primary lane", () => {
|
|
9
|
+
expect(llmPriceKey("llm-chat", "claude-opus-5.5")).toBe("llm-chat:claude-opus-5.5")
|
|
10
|
+
expect(llmPriceKey("llm-chat", "gemini-3.8-flash")).toBe("llm-chat:gemini-3.8-flash")
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it("adds :direct when an effort runs the model direct", () => {
|
|
14
|
+
expect(llmPriceKey("llm-chat", "claude-opus-5.5", "high")).toBe("llm-chat:claude-opus-5.5:direct")
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it("adds :direct in Advanced mode, only for a model that has it", () => {
|
|
18
|
+
expect(llmPriceKey("llm-chat", "claude-opus-5.5", undefined, true)).toBe("llm-chat:claude-opus-5.5:direct")
|
|
19
|
+
// GPT has no direct lane: Advanced mode cannot apply, so the key is the KIE one.
|
|
20
|
+
expect(llmPriceKey("llm-chat", "gpt-5.2", undefined, true)).toBe("llm-chat:gpt-5.2")
|
|
21
|
+
expect(llmPriceKey("llm-chat", "gpt-5.2", "high")).toBe("llm-chat:gpt-5.2")
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it("reads the feature's default effort when none is sent, as the run does", () => {
|
|
25
|
+
// describe-to-picker runs Opus 5.5 at `high` by default (LLM_FEATURE_DEFAULT_EFFORTS),
|
|
26
|
+
// which only Anthropic's own API honours: the call is held and charged direct.
|
|
27
|
+
expect(llmPriceKey("describe-to-picker", "claude-opus-5.5")).toBe("describe-to-picker:claude-opus-5.5:direct")
|
|
28
|
+
// …only on that model.
|
|
29
|
+
expect(llmPriceKey("describe-to-picker", "claude-sonnet-5.5")).toBe("describe-to-picker:claude-sonnet-5.5")
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it("a feature that borrows its defaults reads the effort of the feature it borrows from", () => {
|
|
33
|
+
// Text to Picker runs on Describe to Picker's defaults: Opus 5.5 at high → direct.
|
|
34
|
+
expect(llmPriceKey("text-to-picker", "claude-opus-5.5")).toBe("text-to-picker:claude-opus-5.5:direct")
|
|
35
|
+
// Generate Structured runs on Generate Text's (no recipe effort), the Choose
|
|
36
|
+
// Best judge on pick-best-llm's (none): their Opus 5.5 calls run on KIE.
|
|
37
|
+
expect(llmPriceKey("llm-structured", "claude-opus-5.5")).toBe("llm-structured:claude-opus-5.5")
|
|
38
|
+
expect(llmPriceKey("reduce:pick-best-llm", "claude-opus-5.5")).toBe("reduce:pick-best-llm:claude-opus-5.5")
|
|
39
|
+
// An explicit effort still decides.
|
|
40
|
+
expect(llmPriceKey("llm-structured", "claude-opus-5.5", "high")).toBe("llm-structured:claude-opus-5.5:direct")
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it("llmDefaultsFeature maps the borrowing features and leaves the rest alone", () => {
|
|
44
|
+
expect(llmDefaultsFeature("text-to-picker")).toBe("describe-to-picker")
|
|
45
|
+
expect(llmDefaultsFeature("llm-structured")).toBe("llm-chat")
|
|
46
|
+
expect(llmDefaultsFeature("reduce:pick-best-llm")).toBe("pick-best-llm")
|
|
47
|
+
expect(llmDefaultsFeature("llm-chat")).toBe("llm-chat")
|
|
48
|
+
expect(llmDefaultsFeature("toString")).toBe("toString")
|
|
49
|
+
for (const target of Object.values(LLM_FEATURE_DEFAULTS_FROM)) expect(LLM_FEATURE_DEFAULTS).toHaveProperty(target)
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it("refuses an unresolved (empty) model id", () => {
|
|
53
|
+
expect(() => llmPriceKey("llm-chat", "")).toThrow(TypeError)
|
|
54
|
+
})
|
|
55
|
+
})
|
|
@@ -140,6 +140,16 @@ describe("an audio-locked use-case node's memory is never a preset setting", ()
|
|
|
140
140
|
expect(tighten).not.toHaveProperty("settingsBeforeAudio")
|
|
141
141
|
expect(PRESET_EXCLUDED_KEYS.has("settingsBeforeAudio")).toBe(true)
|
|
142
142
|
})
|
|
143
|
+
|
|
144
|
+
it("a preset saved from a use-case node carries neither its recordings order (this node's wiring) nor its last run's cameras report", () => {
|
|
145
|
+
const tighten = extractPresetData({
|
|
146
|
+
label: "T", output: "video", cameras: { wide: 2 }, mediaOrder: ["cam-a", "cam-b"],
|
|
147
|
+
useCaseCameras: { speakers: [{ speaker: "speaker_0", ordinal: 1, camera: 2, marginDb: 7 }], syncNotes: [], mapNotes: [] },
|
|
148
|
+
}, "tighten-episode")
|
|
149
|
+
expect(tighten).toEqual({ output: "video", cameras: { wide: 2 } })
|
|
150
|
+
expect(PRESET_EXCLUDED_KEYS.has("mediaOrder")).toBe(true)
|
|
151
|
+
expect(PRESET_EXCLUDED_KEYS.has("useCaseCameras")).toBe(true)
|
|
152
|
+
})
|
|
143
153
|
})
|
|
144
154
|
|
|
145
155
|
describe("PRESET_EXCLUDED_KEYS ⊇ PRESET_APPLY_CLEAR_KEYS", () => {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
isExecutionDataKey,
|
|
9
9
|
stripTransientRuntimeData,
|
|
10
10
|
} from "../index.js"
|
|
11
|
+
import { SUNO_SEPARATE_RESULT_FIELDS } from "../suno-separate.js"
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* TRANSIENT_RUNTIME_KEYS = run-state that must neither mark the workflow
|
|
@@ -119,13 +120,31 @@ describe("EXECUTION_DATA_KEYS", () => {
|
|
|
119
120
|
expect(isExecutionDataKey("candidates", "ugc-clip")).toBe(false)
|
|
120
121
|
})
|
|
121
122
|
|
|
122
|
-
it("files only UGC types'
|
|
123
|
+
it("files only UGC types' and Suno Separate's own names: Video Overlay's results stay as every other surface reads them", () => {
|
|
123
124
|
// Presets capture them, Reset clears them, exports and the Copilot keep them — as on any node.
|
|
124
125
|
for (const key of ["durationSec", "width", "height", "warnings", "resultCompositionKey"]) {
|
|
125
126
|
expect(isExecutionDataKey(key, "video-overlay"), key).toBe(false)
|
|
126
127
|
}
|
|
127
128
|
expect(executionDataKeysOf("video-overlay")).toBe(EXECUTION_DATA_KEYS)
|
|
128
|
-
for (const type of Object.keys(NODE_TYPE_EXECUTION_DATA_KEYS)) expect(type, type).toMatch(/^ugc
|
|
129
|
+
for (const type of Object.keys(NODE_TYPE_EXECUTION_DATA_KEYS)) expect(type, type).toMatch(/^(ugc-|suno-separate$)/)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
it("files every Suno Separate result field and run fact as that type's run result: never undo, preset or template state", () => {
|
|
133
|
+
for (const key of [...SUNO_SEPARATE_RESULT_FIELDS, "engineUsed", "sunoRefused", "fallbackReason", "separateType"]) {
|
|
134
|
+
expect(isExecutionDataKey(key, "suno-separate"), key).toBe(true)
|
|
135
|
+
expect(TRANSIENT_RUNTIME_KEYS.has(key), `${key} must stay persisted`).toBe(false)
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
it("never files Suno Separate's settings as run state, nor its result names on another node", () => {
|
|
140
|
+
// stemName is the instrument SETTING (the run only echoes it back).
|
|
141
|
+
for (const key of ["stemName", "type", "fallbackToDemucs", "taskId", "audioId", "label"]) {
|
|
142
|
+
expect(isExecutionDataKey(key, "suno-separate"), key).toBe(false)
|
|
143
|
+
}
|
|
144
|
+
for (const key of ["vocalUrl", "isolatedUrl", "engineUsed"]) {
|
|
145
|
+
expect(isExecutionDataKey(key, "audio-separation"), key).toBe(false)
|
|
146
|
+
expect(isExecutionDataKey(key, undefined), key).toBe(false)
|
|
147
|
+
}
|
|
129
148
|
})
|
|
130
149
|
|
|
131
150
|
it("a type's own keys come with every global one, as a set", () => {
|
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
edlSpanKey,
|
|
6
6
|
planClipKeyAt,
|
|
7
7
|
renderClipKey,
|
|
8
|
+
renderLoneRow,
|
|
9
|
+
renderPlanBasis,
|
|
8
10
|
renderPlanClipKey,
|
|
9
11
|
renderPlanNodeId,
|
|
10
12
|
renderPlanPath,
|
|
@@ -390,3 +392,65 @@ describe("renderPlanClipKey — the clip a row reads is picked by every selector
|
|
|
390
392
|
})
|
|
391
393
|
})
|
|
392
394
|
})
|
|
395
|
+
|
|
396
|
+
describe("renderLoneRow — a render run once behind a Camera Switch with one delivered row (decided 2026-10-20)", () => {
|
|
397
|
+
const span = (inMs: number, outMs: number, title: string) =>
|
|
398
|
+
JSON.stringify({ version: 1, clock: "master", sources: [], segments: [{ id: `s${inMs}`, inMs, outMs }], meta: { title } })
|
|
399
|
+
const PLAN = [span(0, 1000, "one"), span(2000, 3000, "two"), span(4000, 5000, "three")]
|
|
400
|
+
const nodes = [
|
|
401
|
+
{ id: "plan", type: "edit-plan" },
|
|
402
|
+
{ id: "tp-send", type: "teleport-send" },
|
|
403
|
+
{ id: "tp-recv", type: "teleport-receive" },
|
|
404
|
+
{ id: "switch", type: "camera-switch" },
|
|
405
|
+
{ id: "render", type: "speaker-view" },
|
|
406
|
+
]
|
|
407
|
+
const viaSwitch = [
|
|
408
|
+
{ source: "plan", sourceHandle: "edl", target: "switch", targetHandle: "edl" },
|
|
409
|
+
{ source: "switch", sourceHandle: "edl", target: "render", targetHandle: "edl" },
|
|
410
|
+
]
|
|
411
|
+
const batchOf = (batch: readonly unknown[] | undefined) => (n: { id: string }) => (n.id === "switch" ? batch : PLAN)
|
|
412
|
+
const planList = () => PLAN
|
|
413
|
+
const ran: ReadonlySet<string> = new Set(["switch", "render"])
|
|
414
|
+
|
|
415
|
+
it("the switch's one delivered row is the row: the clip key and the plan basis are that clip's", () => {
|
|
416
|
+
const row = renderLoneRow("render", nodes, viaSwitch, batchOf(["", "", "switched-3"]))
|
|
417
|
+
expect(row).toBe(2)
|
|
418
|
+
expect(renderPlanClipKey("render", nodes, viaSwitch, planList, row)).toBe("4000-5000")
|
|
419
|
+
expect(renderPlanBasis("render", nodes, viaSwitch, planList, row, ran)).toBe(renderPlanBasis("render", nodes, viaSwitch, planList, 2, ran))
|
|
420
|
+
// Without it the render reads the plan's three clips and names none.
|
|
421
|
+
expect(renderPlanClipKey("render", nodes, viaSwitch, planList, undefined)).toBeUndefined()
|
|
422
|
+
expect(renderPlanBasis("render", nodes, viaSwitch, planList, undefined, ran)).toBeUndefined()
|
|
423
|
+
// `null` is a hole too, and a teleport between the switch and the render changes nothing.
|
|
424
|
+
expect(renderLoneRow("render", nodes, viaSwitch, batchOf([null, "switched-2", null]))).toBe(1)
|
|
425
|
+
const teleported = [
|
|
426
|
+
viaSwitch[0]!,
|
|
427
|
+
{ source: "switch", sourceHandle: "edl", target: "tp-send", targetHandle: "in" },
|
|
428
|
+
{ source: "tp-send", target: "tp-recv" },
|
|
429
|
+
{ source: "tp-recv", target: "render", targetHandle: "edl" },
|
|
430
|
+
]
|
|
431
|
+
expect(renderLoneRow("render", nodes, teleported, batchOf(["", "switched-2", ""]))).toBe(1)
|
|
432
|
+
})
|
|
433
|
+
|
|
434
|
+
it("the row is in the switch's KEPT-clip row space: a clip dropped from the plan has no switch row", () => {
|
|
435
|
+
const holed = () => [PLAN[0], "", PLAN[2]]
|
|
436
|
+
// Two kept clips, so the switch ran twice; its second row (plan clip 3) delivered.
|
|
437
|
+
const row = renderLoneRow("render", nodes, viaSwitch, () => ["", "switched-3"])
|
|
438
|
+
expect(row).toBe(1)
|
|
439
|
+
expect(renderPlanClipKey("render", nodes, viaSwitch, holed, row)).toBe("4000-5000")
|
|
440
|
+
})
|
|
441
|
+
|
|
442
|
+
it("names no row when the batch has several delivered rows, none, or no batch at all", () => {
|
|
443
|
+
expect(renderLoneRow("render", nodes, viaSwitch, batchOf(["a", "", "c"]))).toBeUndefined()
|
|
444
|
+
expect(renderLoneRow("render", nodes, viaSwitch, batchOf(["", "", ""]))).toBeUndefined()
|
|
445
|
+
expect(renderLoneRow("render", nodes, viaSwitch, batchOf(undefined))).toBeUndefined()
|
|
446
|
+
})
|
|
447
|
+
|
|
448
|
+
it("names no row for a render wired straight to its plan (a one-recording pack), a Selected wire, or a selector on the render's wire", () => {
|
|
449
|
+
const direct = [{ source: "plan", sourceHandle: "edl", target: "render", targetHandle: "edl" }]
|
|
450
|
+
expect(renderLoneRow("render", nodes, direct, () => ["", "", PLAN[2]])).toBeUndefined()
|
|
451
|
+
const selected = [viaSwitch[0]!, { ...viaSwitch[1]!, data: { outputMode: "last" } }]
|
|
452
|
+
expect(renderLoneRow("render", nodes, selected, batchOf(["", "", "switched-3"]))).toBeUndefined()
|
|
453
|
+
const picked = [viaSwitch[0]!, { ...viaSwitch[1]!, data: { selectorMode: "list", listExpression: "3" } }]
|
|
454
|
+
expect(renderLoneRow("render", nodes, picked, batchOf(["", "", "switched-3"]))).toBeUndefined()
|
|
455
|
+
})
|
|
456
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest"
|
|
2
|
+
import { SCHEDULE_RETRY_DEFAULTS, SCHEDULE_RETRY_LIMITS, normalizeScheduleRetry } from "../schedule-retry.js"
|
|
3
|
+
|
|
4
|
+
describe("normalizeScheduleRetry — the node's retry policy as the server runs it", () => {
|
|
5
|
+
it("absent, null or not an object is the feature off", () => {
|
|
6
|
+
expect(normalizeScheduleRetry(undefined)).toBeNull()
|
|
7
|
+
expect(normalizeScheduleRetry(null)).toBeNull()
|
|
8
|
+
expect(normalizeScheduleRetry(true)).toBeNull()
|
|
9
|
+
expect(normalizeScheduleRetry("30")).toBeNull()
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it("an empty object is the defaults: 30 minutes, 3 attempts, cheap lanes only", () => {
|
|
13
|
+
expect(normalizeScheduleRetry({})).toEqual(SCHEDULE_RETRY_DEFAULTS)
|
|
14
|
+
expect(SCHEDULE_RETRY_DEFAULTS).toEqual({ afterMinutes: 30, maxAttempts: 3, cheapLanesOnly: true })
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it("keeps in-range values, reads a numeric string, and clamps the rest into range", () => {
|
|
18
|
+
expect(normalizeScheduleRetry({ afterMinutes: 90, maxAttempts: 2, cheapLanesOnly: false })).toEqual({ afterMinutes: 90, maxAttempts: 2, cheapLanesOnly: false })
|
|
19
|
+
expect(normalizeScheduleRetry({ afterMinutes: "45", maxAttempts: "1" })).toMatchObject({ afterMinutes: 45, maxAttempts: 1 })
|
|
20
|
+
expect(normalizeScheduleRetry({ afterMinutes: 1, maxAttempts: 9 })).toMatchObject({
|
|
21
|
+
afterMinutes: SCHEDULE_RETRY_LIMITS.afterMinutes[0],
|
|
22
|
+
maxAttempts: SCHEDULE_RETRY_LIMITS.maxAttempts[1],
|
|
23
|
+
})
|
|
24
|
+
expect(normalizeScheduleRetry({ afterMinutes: 100000, maxAttempts: 0 })).toMatchObject({
|
|
25
|
+
afterMinutes: SCHEDULE_RETRY_LIMITS.afterMinutes[1],
|
|
26
|
+
maxAttempts: SCHEDULE_RETRY_LIMITS.maxAttempts[0],
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it("cheap lanes only is off only when said so — a missing or truthy flag keeps it on", () => {
|
|
31
|
+
expect(normalizeScheduleRetry({ cheapLanesOnly: false })?.cheapLanesOnly).toBe(false)
|
|
32
|
+
expect(normalizeScheduleRetry({ cheapLanesOnly: "false" })?.cheapLanesOnly).toBe(true)
|
|
33
|
+
expect(normalizeScheduleRetry({ cheapLanesOnly: undefined })?.cheapLanesOnly).toBe(true)
|
|
34
|
+
})
|
|
35
|
+
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest"
|
|
2
|
+
import { scrapeAnalysisPriceParts, scrapeAnalysisQuoteId, SCRAPE_ANALYSIS_FEATURE } from "../scrape-analysis-pricing.js"
|
|
3
|
+
import { buildMetaAdsScrapeCreditId, META_ADS_SCRAPE_MAX_COUNT } from "../meta-ads-scrape.js"
|
|
4
|
+
import { buildInstagramScrapeCreditId, INSTAGRAM_SCRAPE_MAX_COUNT } from "../instagram-scrape.js"
|
|
5
|
+
import { LLM_FEATURE_DEFAULTS } from "../llm-models.js"
|
|
6
|
+
import { resolveScriptModelId, SCRIPT_LEGACY_PROVIDER_MODELS } from "../script-model.js"
|
|
7
|
+
|
|
8
|
+
describe("scrapeAnalysisPriceParts — a scrape's analysis billed per call", () => {
|
|
9
|
+
it("no analysis, or another node: null", () => {
|
|
10
|
+
expect(scrapeAnalysisPriceParts({ type: "meta-ads-scrape", data: { count: 10 } })).toBeNull()
|
|
11
|
+
expect(scrapeAnalysisPriceParts({ type: "llm-chat", data: { analyze: true } })).toBeNull()
|
|
12
|
+
})
|
|
13
|
+
it("Meta Ads: its fixed scrape (no analysis suffix), the analysis model, count × sources items (clamped)", () => {
|
|
14
|
+
expect(scrapeAnalysisPriceParts({ type: "meta-ads-scrape", data: { count: 10, analyze: true } })).toEqual({
|
|
15
|
+
fixedId: buildMetaAdsScrapeCreditId({ count: 10, sources: 1 }),
|
|
16
|
+
analysisModel: LLM_FEATURE_DEFAULTS[SCRAPE_ANALYSIS_FEATURE],
|
|
17
|
+
items: 10,
|
|
18
|
+
})
|
|
19
|
+
expect(scrapeAnalysisPriceParts({ type: "meta-ads-scrape", data: { count: 9999, analyze: true, analysisModel: "claude-opus-5.5" } })).toMatchObject({ analysisModel: "claude-opus-5.5", items: META_ADS_SCRAPE_MAX_COUNT })
|
|
20
|
+
})
|
|
21
|
+
it("Instagram: the count the route accepts × the targets", () => {
|
|
22
|
+
const parts = scrapeAnalysisPriceParts({ type: "instagram-scrape", data: { count: 500, analyze: true, mode: "profile", targets: "a\nb" } })
|
|
23
|
+
expect(parts).toEqual({ fixedId: buildInstagramScrapeCreditId({ count: INSTAGRAM_SCRAPE_MAX_COUNT, sources: 2 }), analysisModel: LLM_FEATURE_DEFAULTS[SCRAPE_ANALYSIS_FEATURE], items: INSTAGRAM_SCRAPE_MAX_COUNT * 2 })
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
describe("scrapeAnalysisQuoteId — the whole analysis as one price id", () => {
|
|
28
|
+
it("is the analysis model's metered key as a `<key>:<items>u` quote", () => {
|
|
29
|
+
const parts = scrapeAnalysisPriceParts({ type: "meta-ads-scrape", data: { count: 10, analyze: true, analysisModel: "claude-opus-5.5" } })!
|
|
30
|
+
expect(scrapeAnalysisQuoteId(parts)).toBe(`${SCRAPE_ANALYSIS_FEATURE}:claude-opus-5.5:10u`)
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe("resolveScriptModelId — the model a Generate Script call runs on", () => {
|
|
35
|
+
it("an explicit model, else a legacy provider's, else the default", () => {
|
|
36
|
+
expect(resolveScriptModelId("claude", "gpt-5.2")).toBe("gpt-5.2")
|
|
37
|
+
expect(resolveScriptModelId("claude")).toBe(SCRIPT_LEGACY_PROVIDER_MODELS.claude)
|
|
38
|
+
expect(resolveScriptModelId()).toBe(LLM_FEATURE_DEFAULTS["generate-script"])
|
|
39
|
+
expect(resolveScriptModelId("toString")).toBe(LLM_FEATURE_DEFAULTS["generate-script"])
|
|
40
|
+
})
|
|
41
|
+
})
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest"
|
|
2
|
+
import {
|
|
3
|
+
SUNO_SEPARATE_TYPES,
|
|
4
|
+
SUNO_STEM_NAMES,
|
|
5
|
+
DEFAULT_SUNO_STEM_NAME,
|
|
6
|
+
SUNO_SEPARATE_STEM_FIELDS,
|
|
7
|
+
SUNO_SEPARATE_TAKE_FIELDS,
|
|
8
|
+
SUNO_SEPARATE_RESULT_FIELDS,
|
|
9
|
+
SUNO_SEPARATE_META_FIELDS,
|
|
10
|
+
sunoSeparateCreditId,
|
|
11
|
+
sunoSeparateHandleUrl,
|
|
12
|
+
sunoSeparatePrimaryUrl,
|
|
13
|
+
} from "../entries/models.js"
|
|
14
|
+
|
|
15
|
+
describe("sunoSeparateCreditId", () => {
|
|
16
|
+
it.each([
|
|
17
|
+
["separate_vocal", "suno-separate"], ["split_stem", "suno-separate-stem"],
|
|
18
|
+
["split_stem_advanced", "suno-separate-single"], [undefined, "suno-separate"], ["junk", "suno-separate"],
|
|
19
|
+
])("%s → %s", (t, id) => expect(sunoSeparateCreditId(t)).toBe(id))
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it("SUNO_STEM_NAMES is KIE's 98-value enum", () => {
|
|
23
|
+
expect(SUNO_STEM_NAMES).toHaveLength(98)
|
|
24
|
+
expect(new Set(SUNO_STEM_NAMES).size).toBe(98)
|
|
25
|
+
expect(SUNO_STEM_NAMES[0]).toBe("Lead Vocal")
|
|
26
|
+
expect(SUNO_STEM_NAMES[SUNO_STEM_NAMES.length - 1]).toBe("Didgeridoo")
|
|
27
|
+
expect(SUNO_STEM_NAMES).toContain("808")
|
|
28
|
+
expect(SUNO_STEM_NAMES).toContain(DEFAULT_SUNO_STEM_NAME)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it("the three separation modes", () => {
|
|
32
|
+
expect(SUNO_SEPARATE_TYPES).toEqual(["separate_vocal", "split_stem", "split_stem_advanced"])
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it("result-field lists", () => {
|
|
36
|
+
expect(SUNO_SEPARATE_STEM_FIELDS).toEqual([
|
|
37
|
+
"vocalUrl", "instrumentalUrl", "backingVocalsUrl", "drumsUrl",
|
|
38
|
+
"bassUrl", "guitarUrl", "pianoUrl", "keyboardUrl",
|
|
39
|
+
"percussionUrl", "stringsUrl", "synthUrl", "fxUrl",
|
|
40
|
+
"brassUrl", "woodwindsUrl", "otherUrl",
|
|
41
|
+
])
|
|
42
|
+
expect(SUNO_SEPARATE_TAKE_FIELDS).toEqual(["isolatedUrl", "withoutUrl", "isolated2Url", "without2Url"])
|
|
43
|
+
expect(SUNO_SEPARATE_RESULT_FIELDS).toEqual([...SUNO_SEPARATE_STEM_FIELDS, ...SUNO_SEPARATE_TAKE_FIELDS])
|
|
44
|
+
expect(SUNO_SEPARATE_META_FIELDS).toEqual(["separateType", "stemName", "engineUsed", "sunoRefused", "fallbackReason"])
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
describe("sunoSeparateHandleUrl", () => {
|
|
48
|
+
const legacy = { audioUrl: "A" }
|
|
49
|
+
const vocalOnly = { audioUrl: "V", vocalUrl: "V" }
|
|
50
|
+
const stems = { audioUrl: "V", vocalUrl: "V", drumsUrl: "D" }
|
|
51
|
+
const single = { audioUrl: "I", isolatedUrl: "I", withoutUrl: "W", isolated2Url: "I2" }
|
|
52
|
+
it("legacy shape (no per-field urls) still routes audioUrl", () => {
|
|
53
|
+
expect(sunoSeparateHandleUrl(legacy, "vocals")).toBe("A")
|
|
54
|
+
expect(sunoSeparateHandleUrl(legacy, "instrumental")).toBe("A")
|
|
55
|
+
})
|
|
56
|
+
it("a stem that did not come back is empty", () => {
|
|
57
|
+
expect(sunoSeparateHandleUrl(stems, "instrumental")).toBeUndefined()
|
|
58
|
+
expect(sunoSeparateHandleUrl(vocalOnly, "instrumental")).toBeUndefined()
|
|
59
|
+
})
|
|
60
|
+
it("one-instrument mode", () => {
|
|
61
|
+
expect(sunoSeparateHandleUrl(single, "vocals")).toBeUndefined()
|
|
62
|
+
expect(sunoSeparateHandleUrl(single, "instrumental")).toBeUndefined()
|
|
63
|
+
expect(sunoSeparateHandleUrl(single, "isolated")).toBe("I")
|
|
64
|
+
expect(sunoSeparateHandleUrl(single, "without")).toBe("W")
|
|
65
|
+
})
|
|
66
|
+
it("legacy handle spellings", () => {
|
|
67
|
+
expect(sunoSeparateHandleUrl(stems, "vocal-out")).toBe("V")
|
|
68
|
+
expect(sunoSeparateHandleUrl({ ...stems, instrumentalUrl: "N" }, "instrumental-out")).toBe("N")
|
|
69
|
+
})
|
|
70
|
+
it("no handle → primary", () => expect(sunoSeparateHandleUrl(single, null)).toBe("I"))
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it("sunoSeparatePrimaryUrl", () => {
|
|
74
|
+
expect(sunoSeparatePrimaryUrl({ vocalUrl: "V", instrumentalUrl: "N" })).toBe("V")
|
|
75
|
+
expect(sunoSeparatePrimaryUrl({ instrumentalUrl: "N" })).toBe("N")
|
|
76
|
+
expect(sunoSeparatePrimaryUrl({ isolatedUrl: "I", withoutUrl: "W" })).toBe("I")
|
|
77
|
+
expect(sunoSeparatePrimaryUrl({ drumsUrl: "D" })).toBe("D")
|
|
78
|
+
})
|
|
@@ -2,9 +2,11 @@ import { describe, it, expect } from "vitest"
|
|
|
2
2
|
import { readFileSync } from "node:fs"
|
|
3
3
|
import { resolve } from "node:path"
|
|
4
4
|
import {
|
|
5
|
+
VIDEO_MASK_DEFAULTS,
|
|
5
6
|
VIDEO_MASK_LIMITS,
|
|
6
7
|
VIDEO_MASK_PROVIDERS,
|
|
7
8
|
resolveVideoMaskProvider,
|
|
9
|
+
resolveVideoMaskZone,
|
|
8
10
|
videoMaskBilledSeconds,
|
|
9
11
|
videoMaskCreditId,
|
|
10
12
|
videoMaskCreditIds,
|
|
@@ -65,6 +67,31 @@ describe("Video Mask pricing", () => {
|
|
|
65
67
|
})
|
|
66
68
|
})
|
|
67
69
|
|
|
70
|
+
describe("Video Mask zone", () => {
|
|
71
|
+
it("is off by default, and each margin is 0–49 % (the inner rectangle can never be empty)", () => {
|
|
72
|
+
expect(VIDEO_MASK_DEFAULTS.zone).toBeNull()
|
|
73
|
+
expect(VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN).toBe(0)
|
|
74
|
+
expect(VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX).toBe(49)
|
|
75
|
+
expect(VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX * 2).toBeLessThan(100)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it("resolveVideoMaskZone reads a zone as the filter does: margins clamped to 0–49, anything else 0, all 0 = null", () => {
|
|
79
|
+
expect(resolveVideoMaskZone({ leftPct: 10, rightPct: 20, topPct: 5, bottomPct: 0 })).toEqual({ leftPct: 10, rightPct: 20, topPct: 5, bottomPct: 0 })
|
|
80
|
+
expect(resolveVideoMaskZone({ leftPct: 80, rightPct: -3 })).toEqual({ leftPct: 49, rightPct: 0, topPct: 0, bottomPct: 0 })
|
|
81
|
+
expect(resolveVideoMaskZone({ leftPct: "10", topPct: Number.NaN, bottomPct: Infinity })).toBeNull()
|
|
82
|
+
expect(resolveVideoMaskZone({ leftPct: 0, rightPct: 0, topPct: 0, bottomPct: 0 })).toBeNull()
|
|
83
|
+
expect(resolveVideoMaskZone(null)).toBeNull()
|
|
84
|
+
expect(resolveVideoMaskZone(undefined)).toBeNull()
|
|
85
|
+
expect(resolveVideoMaskZone("10,10,10,10")).toBeNull()
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
describe("Video Mask perShot", () => {
|
|
90
|
+
it("is off by default (one pass over the whole clip)", () => {
|
|
91
|
+
expect(VIDEO_MASK_DEFAULTS.perShot).toBe(false)
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
|
|
68
95
|
describe("Mask Composite units", () => {
|
|
69
96
|
// Repeated in docs/nodes/processing-video/mask-composite.md (at the 10-credit row).
|
|
70
97
|
it.each([[3, 1], [5, 1], [10, 2], [10.0000001, 2], [61, 13], [300, 60]])("%s s → %s unit(s)", (sec, units) => {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cast Swap's input limits, and what a trend built on it may put in its
|
|
3
|
+
* prompts. One definition read by the server (which enforces them) and by
|
|
4
|
+
* every screen that edits them (which holds Save before a refusal), so the two
|
|
5
|
+
* cannot drift apart.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** The longest `postPrompt` Cast Swap takes. */
|
|
9
|
+
export const CAST_SWAP_POST_PROMPT_MAX = 4000
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A trend's prompt limits.
|
|
13
|
+
*
|
|
14
|
+
* - `trendPromptMax` / `prePromptMax`: the longest prompt a trend version may
|
|
15
|
+
* store.
|
|
16
|
+
* - `detailsMax`: the longest details a user may add to a run. They follow the
|
|
17
|
+
* trend prompt in Cast Swap's `postPrompt`, after a blank line, so a new
|
|
18
|
+
* trend prompt is held to `CAST_SWAP_POST_PROMPT_MAX − 2 − detailsMax`.
|
|
19
|
+
* - `engineTextReserve`: the room kept for the text Cast Swap writes around a
|
|
20
|
+
* trend's prompts in the prompt it builds, at its longest (a block for each
|
|
21
|
+
* of the 13 roles a run allows with 200-character role names, five
|
|
22
|
+
* 500-character reference lines, the keep, mask and edit lines and the
|
|
23
|
+
* header: about 16,100 characters, rounded up so a small wording change does
|
|
24
|
+
* not need this moved). The pre prompt, the trend prompt and the details
|
|
25
|
+
* share what is left of Seedance 2.5's prompt cap.
|
|
26
|
+
*/
|
|
27
|
+
export const TREND_PROMPT_LIMITS = {
|
|
28
|
+
trendPromptMax: 3000,
|
|
29
|
+
prePromptMax: 3000,
|
|
30
|
+
detailsMax: 1000,
|
|
31
|
+
engineTextReserve: 17_000,
|
|
32
|
+
} as const
|
|
33
|
+
|
|
34
|
+
/** Cast Swap's `faceMasking` bounds, each `[min, max]` inclusive. */
|
|
35
|
+
export const CAST_SWAP_FACE_MASKING_BOUNDS = {
|
|
36
|
+
/** `minFaceHeightPct` and `maxFaceHeightPct`, % of the frame's height (max 0 = no limit). */
|
|
37
|
+
faceHeightPct: [0, 100],
|
|
38
|
+
/** Each `zone` margin, % of the frame. */
|
|
39
|
+
zonePct: [0, 49],
|
|
40
|
+
/** % of the frame's width. */
|
|
41
|
+
blurStrengthPct: [0.1, 5],
|
|
42
|
+
threshold: [0.05, 0.95],
|
|
43
|
+
} as const satisfies Record<string, readonly [number, number]>
|
|
44
|
+
|
|
45
|
+
/** What Cast Swap uses for a `faceMasking` setting left out. */
|
|
46
|
+
export const CAST_SWAP_FACE_MASKING_DEFAULTS = {
|
|
47
|
+
minFaceHeightPct: 15,
|
|
48
|
+
maxFaceHeightPct: 0,
|
|
49
|
+
zonePct: 0,
|
|
50
|
+
blurStrengthPct: 2,
|
|
51
|
+
threshold: 0.5,
|
|
52
|
+
} as const
|
|
@@ -34,6 +34,9 @@ export {
|
|
|
34
34
|
resolveVideoAnalysisModel,
|
|
35
35
|
LLM_FEATURE_DEFAULTS,
|
|
36
36
|
DESCRIBE_TO_PICKER_FALLBACK_MODEL,
|
|
37
|
+
DESCRIBE_TO_PICKER_MODELS,
|
|
38
|
+
DESCRIBE_TO_PICKER_WITHHELD_MODELS,
|
|
39
|
+
LLM_STRUCTURED_WITHHELD_MODELS,
|
|
37
40
|
LLM_FEATURE_DEFAULT_EFFORTS,
|
|
38
41
|
defaultReasoningEffort,
|
|
39
42
|
LLM_MODALITY_CAPS,
|
|
@@ -47,6 +50,9 @@ export {
|
|
|
47
50
|
resolveLlmCreditId,
|
|
48
51
|
supportsAdvancedMode,
|
|
49
52
|
llmServesDirect,
|
|
53
|
+
llmPriceKey,
|
|
54
|
+
LLM_FEATURE_DEFAULTS_FROM,
|
|
55
|
+
llmDefaultsFeature,
|
|
50
56
|
LLM_CREDIT_RUNGS,
|
|
51
57
|
type LlmCreditRung,
|
|
52
58
|
llmCreditIdForRung,
|
|
@@ -66,3 +72,4 @@ export {
|
|
|
66
72
|
type LlmModelDef,
|
|
67
73
|
type LlmReasoningEffort,
|
|
68
74
|
} from "../llm-models.js"
|
|
75
|
+
export { SCRIPT_LEGACY_PROVIDER_MODELS, resolveScriptModelId } from "../script-model.js"
|
package/src/entries/models.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@nodaro/shared/models` — Model constants: provider lists, prompt limits, per-model capability tables and defaults.
|
|
2
|
+
* `@nodaro/shared/models` — Model constants: provider lists, prompt limits, per-model capability tables and defaults, Cast Swap's input limits.
|
|
3
3
|
*
|
|
4
4
|
* One of the package's subpath entries (see `src/index.ts`). The root
|
|
5
5
|
* re-exports every entry, so each name here is also importable from
|
|
@@ -197,6 +197,12 @@ export {
|
|
|
197
197
|
maxVideoDurationSec,
|
|
198
198
|
PRICING_DEFAULT_RESOLUTION,
|
|
199
199
|
} from "../model-constants.js"
|
|
200
|
+
export {
|
|
201
|
+
CAST_SWAP_POST_PROMPT_MAX,
|
|
202
|
+
TREND_PROMPT_LIMITS,
|
|
203
|
+
CAST_SWAP_FACE_MASKING_BOUNDS,
|
|
204
|
+
CAST_SWAP_FACE_MASKING_DEFAULTS,
|
|
205
|
+
} from "../cast-swap-limits.js"
|
|
200
206
|
export type {
|
|
201
207
|
ImageAspectRatio,
|
|
202
208
|
ImageResolution,
|
|
@@ -281,6 +287,25 @@ export {
|
|
|
281
287
|
export * from "../provider-directive-defaults.js"
|
|
282
288
|
export * from "../lora-routing.js"
|
|
283
289
|
export { SUNO_TRACK_SOURCE_TYPES } from "../suno-track-sources.js"
|
|
290
|
+
// Suno Separate's public contract: modes, stem names, each mode's credit id, result + handle fields.
|
|
291
|
+
export {
|
|
292
|
+
SUNO_SEPARATE_TYPES,
|
|
293
|
+
SUNO_STEM_NAMES,
|
|
294
|
+
DEFAULT_SUNO_STEM_NAME,
|
|
295
|
+
sunoSeparateCreditId,
|
|
296
|
+
SUNO_SEPARATE_STEM_FIELDS,
|
|
297
|
+
SUNO_SEPARATE_TAKE_FIELDS,
|
|
298
|
+
SUNO_SEPARATE_RESULT_FIELDS,
|
|
299
|
+
SUNO_SEPARATE_META_FIELDS,
|
|
300
|
+
sunoSeparateHandleUrl,
|
|
301
|
+
sunoSeparatePrimaryUrl,
|
|
302
|
+
} from "../suno-separate.js"
|
|
303
|
+
export type {
|
|
304
|
+
SunoSeparateType,
|
|
305
|
+
SunoStemName,
|
|
306
|
+
SunoSeparateStemField,
|
|
307
|
+
SunoSeparateResultField,
|
|
308
|
+
} from "../suno-separate.js"
|
|
284
309
|
export {
|
|
285
310
|
VOICE_CHANGER_MODELS,
|
|
286
311
|
VOICE_CHANGER_MODEL_IDS,
|