@nodaro/shared 3.30.0 → 3.31.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/index.cjs +733 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +501 -36
- package/dist/index.d.ts +501 -36
- package/dist/index.js +673 -94
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/entity-image-handle.test.ts +61 -1
- package/src/__tests__/json-kinds.test.ts +10 -0
- package/src/__tests__/model-seed-capability.test.ts +34 -0
- package/src/__tests__/node-preset-extract.test.ts +8 -0
- package/src/__tests__/node-run-routes.test.ts +63 -0
- package/src/__tests__/node-runtime-keys.test.ts +61 -0
- package/src/__tests__/presentation-utils.test.ts +14 -0
- package/src/__tests__/producer-types.test.ts +15 -0
- package/src/__tests__/seedance-draft.test.ts +74 -0
- package/src/__tests__/ugc-clip-saved-list.test.ts +19 -0
- package/src/__tests__/ugc-node-wires.test.ts +600 -0
- package/src/__tests__/ugc-run-state.test.ts +80 -3
- package/src/__tests__/workflow-export-strip.test.ts +14 -0
- package/src/entity-image-handle.ts +48 -1
- package/src/index.ts +8 -1
- package/src/json-kinds.ts +9 -0
- package/src/model-catalog.ts +61 -2
- package/src/model-constants.ts +3 -0
- package/src/node-preset-export.ts +2 -2
- package/src/node-preset-extract.ts +6 -4
- package/src/node-run-routes.ts +76 -0
- package/src/node-runtime-keys.ts +42 -1
- package/src/presentation-utils.ts +3 -0
- package/src/producer-types.ts +10 -0
- package/src/seedance-draft.ts +64 -0
- package/src/social-post.ts +13 -0
- package/src/ugc-node-wires.ts +623 -0
- package/src/ugc-run-state.ts +60 -5
- package/src/workflow-export.ts +3 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seedance 2.5 Draft mode — the single source of truth for which models offer a
|
|
3
|
+
* draft, what a draft renders at, and how its 1080p finalize is priced.
|
|
4
|
+
*
|
|
5
|
+
* A DRAFT is an ordinary Seedance 2.5 run with the provider's draft flag set: it
|
|
6
|
+
* renders at 480p only and costs exactly what a normal 480p run of the same
|
|
7
|
+
* shape costs. The FINALIZE ("Seedance 2.5 HD (from draft)", a Video Upscale
|
|
8
|
+
* provider) re-renders that same take — same seed, prompt, references and
|
|
9
|
+
* timing — at 1080p, frame for frame, at the draft's own length. Nothing
|
|
10
|
+
* creative is re-sent: the finalize names the draft's provider task and nothing
|
|
11
|
+
* else.
|
|
12
|
+
*
|
|
13
|
+
* Every surface (generation routes, the workflow engine, MCP, the editor's
|
|
14
|
+
* toggle) gates on {@link isSeedanceDraftCapable}; never hand-list the model.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** Models that accept the draft flag. */
|
|
18
|
+
export const SEEDANCE_DRAFT_MODELS = ["seedance-2-5"] as const
|
|
19
|
+
export type SeedanceDraftModel = typeof SEEDANCE_DRAFT_MODELS[number]
|
|
20
|
+
|
|
21
|
+
export function isSeedanceDraftCapable(provider: string | undefined): provider is SeedanceDraftModel {
|
|
22
|
+
return !!provider && (SEEDANCE_DRAFT_MODELS as readonly string[]).includes(provider)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The only resolution a draft renders at. Any other value is coerced to it. */
|
|
26
|
+
export const SEEDANCE_DRAFT_RESOLUTION = "480p"
|
|
27
|
+
|
|
28
|
+
/** The Video Upscale provider that finalizes a draft. */
|
|
29
|
+
export const SEEDANCE_DRAFT_FINALIZE_PROVIDER = "seedance-2-5-hd"
|
|
30
|
+
|
|
31
|
+
/** The only resolution a finalize renders at. */
|
|
32
|
+
export const SEEDANCE_DRAFT_FINALIZE_RESOLUTION = "1080p"
|
|
33
|
+
|
|
34
|
+
/** Shortest / longest output the finalize price ladder is seeded for. */
|
|
35
|
+
export const SEEDANCE_DRAFT_FINALIZE_MIN_SEC = 4
|
|
36
|
+
export const SEEDANCE_DRAFT_FINALIZE_MAX_SEC = 30
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Whole seconds the finalize bills for a measured draft length.
|
|
40
|
+
*
|
|
41
|
+
* A container reports a hair over the nominal length (4.04 s for a 4 s clip), so
|
|
42
|
+
* the seconds round UP only past a quarter second — the same rule the Seedance
|
|
43
|
+
* auto-duration settlement uses — and land on the seeded ladder (4–30 s).
|
|
44
|
+
*/
|
|
45
|
+
export function seedanceDraftFinalizeBillableSec(measuredSec: number): number {
|
|
46
|
+
const whole = Math.max(1, Math.ceil(measuredSec - 0.25))
|
|
47
|
+
return Math.min(SEEDANCE_DRAFT_FINALIZE_MAX_SEC, Math.max(SEEDANCE_DRAFT_FINALIZE_MIN_SEC, whole))
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The credit identifier a finalize reserves under.
|
|
52
|
+
*
|
|
53
|
+
* Same encoding as the Seedance 2.5 generation ladder: one row per OUTPUT second
|
|
54
|
+
* (`seedance-2-5-hd:{N}s`), and a `-ref` twin for a draft that had a reference
|
|
55
|
+
* VIDEO. As on the generation lane, the `-ref` row encodes the per-second rate
|
|
56
|
+
* only; a reference run bills `rate × (input + output)` seconds, which the
|
|
57
|
+
* reservation computes from the 8 s `-ref` row (see the backend's
|
|
58
|
+
* `seedanceDraftFinalizeRefBaseCredits`). Reference IMAGES do not change the
|
|
59
|
+
* rate — only a reference video does.
|
|
60
|
+
*/
|
|
61
|
+
export function seedanceDraftFinalizeCreditId(durationSec: number, hasRefVideo: boolean): string {
|
|
62
|
+
const n = seedanceDraftFinalizeBillableSec(durationSec)
|
|
63
|
+
return `${SEEDANCE_DRAFT_FINALIZE_PROVIDER}:${n}s${hasRefVideo ? "-ref" : ""}`
|
|
64
|
+
}
|
package/src/social-post.ts
CHANGED
|
@@ -22,6 +22,19 @@ export const SOCIAL_POST_NODE_TYPES = new Set([
|
|
|
22
22
|
"publish-social",
|
|
23
23
|
])
|
|
24
24
|
|
|
25
|
+
/** The platform each per-platform social post node publishes to. The unified
|
|
26
|
+
* `publish-social` node is absent on purpose: its platform comes from the
|
|
27
|
+
* chosen connection (`data.platform`). */
|
|
28
|
+
export const SOCIAL_POST_NODE_PLATFORM: Readonly<Record<string, string>> = Object.freeze({
|
|
29
|
+
"instagram-post": "instagram",
|
|
30
|
+
"tiktok-post": "tiktok",
|
|
31
|
+
"youtube-upload": "youtube",
|
|
32
|
+
"linkedin-post": "linkedin",
|
|
33
|
+
"x-post": "x",
|
|
34
|
+
"facebook-post": "facebook",
|
|
35
|
+
"telegram-post": "telegram",
|
|
36
|
+
})
|
|
37
|
+
|
|
25
38
|
/** Instagram carousel limits per Meta Graph API.
|
|
26
39
|
* Meta's documented limit is 10 items; sending >10 fails at container
|
|
27
40
|
* creation with "(#100) too little or too many attachments". */
|