@nodaro/shared 3.52.1 → 3.54.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-6CVY3345.js → chunk-25KAGSPT.js} +3 -3
- package/dist/{chunk-6CVY3345.js.map → chunk-25KAGSPT.js.map} +1 -1
- package/dist/{chunk-FBLMWA2R.cjs → chunk-2OYV6K7D.cjs} +4 -4
- package/dist/{chunk-FBLMWA2R.cjs.map → chunk-2OYV6K7D.cjs.map} +1 -1
- package/dist/{chunk-J3HPEKGJ.cjs → chunk-2R74OU76.cjs} +23 -23
- package/dist/chunk-2R74OU76.cjs.map +1 -0
- package/dist/{chunk-CSPELPDB.cjs → chunk-3633VD2M.cjs} +8 -8
- package/dist/{chunk-CSPELPDB.cjs.map → chunk-3633VD2M.cjs.map} +1 -1
- package/dist/{chunk-A24LLEXS.js → chunk-3CHOZ573.js} +23 -23
- package/dist/chunk-3CHOZ573.js.map +1 -0
- package/dist/{chunk-IJ6XNHSD.cjs → chunk-3GMTGX3D.cjs} +27 -27
- package/dist/{chunk-IJ6XNHSD.cjs.map → chunk-3GMTGX3D.cjs.map} +1 -1
- package/dist/{chunk-AJFQ5242.js → chunk-5DVDHL7Y.js} +5 -5
- package/dist/{chunk-AJFQ5242.js.map → chunk-5DVDHL7Y.js.map} +1 -1
- package/dist/{chunk-VNHX6TQT.cjs → chunk-5R6LTKE5.cjs} +5 -5
- package/dist/{chunk-VNHX6TQT.cjs.map → chunk-5R6LTKE5.cjs.map} +1 -1
- package/dist/{chunk-YOH5AUYL.js → chunk-6UR5UE5G.js} +9 -9
- package/dist/{chunk-YOH5AUYL.js.map → chunk-6UR5UE5G.js.map} +1 -1
- package/dist/{chunk-3RYKIUAE.js → chunk-6XVHYD5R.js} +12 -8
- package/dist/chunk-6XVHYD5R.js.map +1 -0
- package/dist/{chunk-FRXVOYL2.js → chunk-ADWIAQQS.js} +3 -3
- package/dist/{chunk-FRXVOYL2.js.map → chunk-ADWIAQQS.js.map} +1 -1
- package/dist/{chunk-VLNOQJDO.cjs → chunk-AGTCHDG5.cjs} +6 -6
- package/dist/{chunk-VLNOQJDO.cjs.map → chunk-AGTCHDG5.cjs.map} +1 -1
- package/dist/{chunk-MI63SSCJ.cjs → chunk-ATWLKUAI.cjs} +4 -4
- package/dist/{chunk-MI63SSCJ.cjs.map → chunk-ATWLKUAI.cjs.map} +1 -1
- package/dist/{chunk-FIROF3TM.js → chunk-C5S75476.js} +5 -5
- package/dist/{chunk-FIROF3TM.js.map → chunk-C5S75476.js.map} +1 -1
- package/dist/{chunk-7HWXJIQ6.cjs → chunk-C6IQCKJT.cjs} +4 -4
- package/dist/{chunk-7HWXJIQ6.cjs.map → chunk-C6IQCKJT.cjs.map} +1 -1
- package/dist/{chunk-K3QNGRRX.js → chunk-CZCOL3M5.js} +10 -6
- package/dist/chunk-CZCOL3M5.js.map +1 -0
- package/dist/{chunk-JAGYUDOK.js → chunk-DUL5ZLTJ.js} +3 -3
- package/dist/{chunk-JAGYUDOK.js.map → chunk-DUL5ZLTJ.js.map} +1 -1
- package/dist/{chunk-BG5272F5.js → chunk-E4YES25K.js} +4 -4
- package/dist/{chunk-BG5272F5.js.map → chunk-E4YES25K.js.map} +1 -1
- package/dist/{chunk-QBXC3AXS.cjs → chunk-FIYVKW7F.cjs} +12 -12
- package/dist/{chunk-QBXC3AXS.cjs.map → chunk-FIYVKW7F.cjs.map} +1 -1
- package/dist/{chunk-CQJYKSXF.js → chunk-FVVD6XY2.js} +5 -3
- package/dist/chunk-FVVD6XY2.js.map +1 -0
- package/dist/chunk-HD45Y7QU.cjs +27 -0
- package/dist/{chunk-H7HKLN2W.cjs.map → chunk-HD45Y7QU.cjs.map} +1 -1
- package/dist/{chunk-JAD2SBD4.js → chunk-HEF4BIMA.js} +4 -4
- package/dist/{chunk-JAD2SBD4.js.map → chunk-HEF4BIMA.js.map} +1 -1
- package/dist/{chunk-GL5Z3CC4.js → chunk-HG3KKCJJ.js} +3 -3
- package/dist/{chunk-GL5Z3CC4.js.map → chunk-HG3KKCJJ.js.map} +1 -1
- package/dist/{chunk-MI6CZQCG.cjs → chunk-IPCWYKX5.cjs} +45 -45
- package/dist/{chunk-MI6CZQCG.cjs.map → chunk-IPCWYKX5.cjs.map} +1 -1
- package/dist/{chunk-7YFQKR5C.cjs → chunk-KM35K2M5.cjs} +21 -21
- package/dist/{chunk-7YFQKR5C.cjs.map → chunk-KM35K2M5.cjs.map} +1 -1
- package/dist/{chunk-OWVWV4T2.js → chunk-KMSEU6FK.js} +3 -3
- package/dist/{chunk-OWVWV4T2.js.map → chunk-KMSEU6FK.js.map} +1 -1
- package/dist/{chunk-2LNQ2MDO.js → chunk-LYWJAXPT.js} +3 -3
- package/dist/{chunk-2LNQ2MDO.js.map → chunk-LYWJAXPT.js.map} +1 -1
- package/dist/{chunk-6DAWSVX2.cjs → chunk-M3SXUUWC.cjs} +13 -7
- package/dist/chunk-M3SXUUWC.cjs.map +1 -0
- package/dist/{chunk-JZJRD7RG.js → chunk-MGJR5OXO.js} +5 -5
- package/dist/{chunk-JZJRD7RG.js.map → chunk-MGJR5OXO.js.map} +1 -1
- package/dist/{chunk-AVUW7XKP.cjs → chunk-MTUNORQB.cjs} +11 -11
- package/dist/{chunk-AVUW7XKP.cjs.map → chunk-MTUNORQB.cjs.map} +1 -1
- package/dist/{chunk-6LCZPDIF.js → chunk-N3WL6IOJ.js} +3 -3
- package/dist/{chunk-6LCZPDIF.js.map → chunk-N3WL6IOJ.js.map} +1 -1
- package/dist/{chunk-XRXPWW7P.cjs → chunk-ND3IE3IB.cjs} +47 -47
- package/dist/{chunk-XRXPWW7P.cjs.map → chunk-ND3IE3IB.cjs.map} +1 -1
- package/dist/{chunk-34EXMNOX.cjs → chunk-NEIWY6CC.cjs} +6 -6
- package/dist/{chunk-34EXMNOX.cjs.map → chunk-NEIWY6CC.cjs.map} +1 -1
- package/dist/{chunk-AJPV3RZJ.js → chunk-NMX6HQC3.js} +5 -5
- package/dist/{chunk-AJPV3RZJ.js.map → chunk-NMX6HQC3.js.map} +1 -1
- package/dist/{chunk-66GADQRV.cjs → chunk-OVIIJVXH.cjs} +21 -21
- package/dist/{chunk-66GADQRV.cjs.map → chunk-OVIIJVXH.cjs.map} +1 -1
- package/dist/{chunk-5PCI6M44.cjs → chunk-PONP5J5E.cjs} +5 -3
- package/dist/chunk-PONP5J5E.cjs.map +1 -0
- package/dist/{chunk-ETU6NWE2.cjs → chunk-QP5JLSCJ.cjs} +10 -6
- package/dist/chunk-QP5JLSCJ.cjs.map +1 -0
- package/dist/{chunk-SRLWSI6Q.cjs → chunk-SEEQ3H22.cjs} +5 -5
- package/dist/{chunk-SRLWSI6Q.cjs.map → chunk-SEEQ3H22.cjs.map} +1 -1
- package/dist/{chunk-25OWMP6B.cjs → chunk-SZUDEFX2.cjs} +41 -41
- package/dist/{chunk-25OWMP6B.cjs.map → chunk-SZUDEFX2.cjs.map} +1 -1
- package/dist/{chunk-TRZMLQSL.js → chunk-YBZQXZ6A.js} +3 -3
- package/dist/{chunk-TRZMLQSL.js.map → chunk-YBZQXZ6A.js.map} +1 -1
- package/dist/{chunk-WBPJNXYN.js → chunk-ZKHQSG76.js} +4 -4
- package/dist/{chunk-WBPJNXYN.js.map → chunk-ZKHQSG76.js.map} +1 -1
- package/dist/{chunk-VSNQLSME.js → chunk-ZWB3NG4M.js} +3 -3
- package/dist/{chunk-VSNQLSME.js.map → chunk-ZWB3NG4M.js.map} +1 -1
- package/dist/entries/apps.cjs +43 -43
- package/dist/entries/apps.js +8 -8
- package/dist/entries/credits.cjs +150 -150
- package/dist/entries/credits.js +7 -7
- package/dist/entries/media.cjs +81 -73
- package/dist/entries/media.d.cts +60 -80
- package/dist/entries/media.d.ts +60 -80
- package/dist/entries/media.js +2 -2
- package/dist/entries/model-catalog.cjs +66 -66
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +277 -277
- package/dist/entries/models.js +5 -5
- package/dist/entries/nodes.cjs +207 -207
- package/dist/entries/nodes.js +9 -9
- package/dist/entries/pipeline.cjs +149 -149
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/types.d.cts +13 -0
- package/dist/entries/types.d.ts +13 -0
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +117 -117
- package/dist/entries/video.js +4 -4
- package/dist/entries/workflow.cjs +99 -99
- package/dist/entries/workflow.js +2 -2
- package/dist/index.cjs +1233 -1225
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +21 -21
- package/package.json +1 -1
- package/src/__tests__/priced-clip-seconds.test.ts +193 -0
- package/src/__tests__/video-depth.test.ts +61 -19
- package/src/__tests__/video-face-mesh.test.ts +3 -2
- package/src/__tests__/video-mask.test.ts +1 -1
- package/src/catalog-projection.ts +13 -0
- package/src/entries/media.ts +1 -0
- package/src/generated/unit-contracts.ts +1 -0
- package/src/i18n/style.ar.ts +5 -0
- package/src/i18n/style.de.ts +5 -0
- package/src/i18n/style.es.ts +5 -0
- package/src/i18n/style.fr.ts +5 -0
- package/src/i18n/style.he.ts +5 -0
- package/src/i18n/style.hi.ts +5 -0
- package/src/i18n/style.ja.ts +5 -0
- package/src/i18n/style.ko.ts +5 -0
- package/src/i18n/style.pt-BR.ts +5 -0
- package/src/i18n/style.ru.ts +5 -0
- package/src/i18n/style.zh-CN.ts +5 -0
- package/src/mask-composite.ts +6 -5
- package/src/model-catalog.ts +21 -21
- package/src/priced-clip-seconds.ts +28 -0
- package/src/video-depth.ts +25 -12
- package/src/video-face-mesh.ts +10 -4
- package/src/video-mask.ts +12 -7
- package/dist/chunk-3RYKIUAE.js.map +0 -1
- package/dist/chunk-5PCI6M44.cjs.map +0 -1
- package/dist/chunk-6DAWSVX2.cjs.map +0 -1
- package/dist/chunk-A24LLEXS.js.map +0 -1
- package/dist/chunk-CQJYKSXF.js.map +0 -1
- package/dist/chunk-ETU6NWE2.cjs.map +0 -1
- package/dist/chunk-H7HKLN2W.cjs +0 -27
- package/dist/chunk-J3HPEKGJ.cjs.map +0 -1
- package/dist/chunk-K3QNGRRX.js.map +0 -1
|
@@ -24,6 +24,19 @@ export interface ProjectedCatalogOption {
|
|
|
24
24
|
icon?: string
|
|
25
25
|
/** Authored Character Motion prerequisites and sequence state. Missing means unknown. */
|
|
26
26
|
motion?: CharacterMotionMetadata
|
|
27
|
+
/**
|
|
28
|
+
* Style only: the outputs the style is offered for. Present only on a style
|
|
29
|
+
* offered for one of them (`["video"]`: a look that only works in motion);
|
|
30
|
+
* absent means both. An image style list leaves out an option without
|
|
31
|
+
* "image".
|
|
32
|
+
*/
|
|
33
|
+
media?: Array<"image" | "video">
|
|
34
|
+
/**
|
|
35
|
+
* Style only: `false` on a style that does not hold up as a restyle of
|
|
36
|
+
* filmed footage; a restyle style list leaves it out. Absent means offered.
|
|
37
|
+
* Video generation still offers it.
|
|
38
|
+
*/
|
|
39
|
+
restyle?: false
|
|
27
40
|
/**
|
|
28
41
|
* Per-option parameters — node-data fields that apply only while THIS option
|
|
29
42
|
* is picked (the Transition catalog's `wipe` → `wipeDirection`). Same shape
|
package/src/entries/media.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
export * from "../freecut-protocol.js"
|
|
9
9
|
export { describeMaskRegion } from "../inpaint-region.js"
|
|
10
10
|
export type { MaskRegionDescriptor, PixelBox } from "../inpaint-region.js"
|
|
11
|
+
export * from "../priced-clip-seconds.js"
|
|
11
12
|
export * from "../video-depth.js"
|
|
12
13
|
export {
|
|
13
14
|
applySlots,
|
|
@@ -32,6 +32,7 @@ export const UNIT_JSON_PIPS: ReadonlyArray<readonly [type: string, pips: Readonl
|
|
|
32
32
|
["clip-pack", { "json": "edl" }], // unit:clip-pack
|
|
33
33
|
["speaker-layout", { "json": "edl" }], // unit:speaker-layout
|
|
34
34
|
["speaker-map", { "edl": "edl", "json": "other" }], // unit:speaker-map
|
|
35
|
+
["shot-cuts", { "firstFrames": "other", "json": "other", "lastFrames": "other" }], // unit:shot-cuts
|
|
35
36
|
]
|
|
36
37
|
|
|
37
38
|
// Input pips that are never a prompt lane (contract.nonPromptInputs) — fan-out-rows.ts composes these.
|
package/src/i18n/style.ar.ts
CHANGED
|
@@ -52,6 +52,11 @@ const map: LocaleCatalogMap = {
|
|
|
52
52
|
"manga": { label: "مانغا", description: "فن لوحات مرسومة بالحبر أبيض وأسود بتظليل Screen-tone" },
|
|
53
53
|
// --- picker-gaps 2026-09-01 ---
|
|
54
54
|
"early-color-photo": { label: "صورة ملونة مبكرة", description: "ألوان مطلع القرن العشرين بأسلوب بروكودين-غورسكي / أوتوكروم" },
|
|
55
|
+
"felt-puppet": { label: "دمية لباد", description: "دمى ومشاهد من اللباد بأسلوب ستوب موشن" },
|
|
56
|
+
"knitted-yarn": { label: "عالم محبوك", description: "عالم محبوك من خيوط الصوف" },
|
|
57
|
+
"toy-figure-3d": { label: "مجسم لعبة ثلاثي الأبعاد", description: "مجسمات فينيل مستديرة" },
|
|
58
|
+
"painterly-3d": { label: "ثلاثي أبعاد تصويري", description: "ثلاثي أبعاد بأسلوب كتب الحكايات بلمسة مرسومة يدويًا" },
|
|
59
|
+
"painted-clay": { label: "صلصال ملوّن", description: "صلصال منحوت بلمسة ملوّنة" },
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
export default map
|
package/src/i18n/style.de.ts
CHANGED
|
@@ -52,6 +52,11 @@ const map: LocaleCatalogMap = {
|
|
|
52
52
|
|
|
53
53
|
// --- picker-gaps 2026-09-01 ---
|
|
54
54
|
"early-color-photo": { label: "Frühe Farbfotografie", description: "Prokudin-Gorski / Autochrom-Farbe der frühen 1900er" },
|
|
55
|
+
"felt-puppet": { label: "Filzpuppe", description: "Nadelgefilzte Stop-Motion-Puppen und Kulissen" },
|
|
56
|
+
"knitted-yarn": { label: "Strickwelt", description: "Eine aus Wolle gestrickte Welt" },
|
|
57
|
+
"toy-figure-3d": { label: "Spielfigur 3D", description: "Runde Vinyl-Spielfiguren" },
|
|
58
|
+
"painterly-3d": { label: "Malerisches 3D", description: "Bilderbuch-3D mit handgemaltem Finish" },
|
|
59
|
+
"painted-clay": { label: "Bemalter Ton", description: "Modellierter Ton mit bemaltem Finish" },
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
export default map
|
package/src/i18n/style.es.ts
CHANGED
|
@@ -52,6 +52,11 @@ const map: LocaleCatalogMap = {
|
|
|
52
52
|
|
|
53
53
|
// --- picker-gaps 2026-09-01 ---
|
|
54
54
|
"early-color-photo": { label: "Foto a Color Temprana", description: "Color de principios de 1900, estilo Prokudin-Gorski / autocromo" },
|
|
55
|
+
"felt-puppet": { label: "Títere de fieltro", description: "Títeres y decorado de fieltro en stop-motion" },
|
|
56
|
+
"knitted-yarn": { label: "Mundo tejido", description: "Un mundo tejido con lana" },
|
|
57
|
+
"toy-figure-3d": { label: "Figura de juguete 3D", description: "Figuras de vinilo redondeadas" },
|
|
58
|
+
"painterly-3d": { label: "3D pictórico", description: "3D de cuento con acabado pintado a mano" },
|
|
59
|
+
"painted-clay": { label: "Arcilla pintada", description: "Arcilla esculpida con acabado pintado" },
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
export default map
|
package/src/i18n/style.fr.ts
CHANGED
|
@@ -51,6 +51,11 @@ const map: LocaleCatalogMap = {
|
|
|
51
51
|
"manga": { label: "Manga", description: "Art encré N&B en cases, ombrage à trame" },
|
|
52
52
|
// --- picker-gaps 2026-09-01 ---
|
|
53
53
|
"early-color-photo": { label: "Photo couleur ancienne", description: "Couleur du début des années 1900, autochrome / Prokoudine-Gorski" },
|
|
54
|
+
"felt-puppet": { label: "Marionnette en feutre", description: "Marionnettes et décor en feutre, en stop-motion" },
|
|
55
|
+
"knitted-yarn": { label: "Monde tricoté", description: "Un monde tricoté en laine" },
|
|
56
|
+
"toy-figure-3d": { label: "Figurine 3D", description: "Figurines en vinyle aux formes arrondies" },
|
|
57
|
+
"painterly-3d": { label: "3D pictural", description: "3D de livre illustré à la finition peinte à la main" },
|
|
58
|
+
"painted-clay": { label: "Argile peinte", description: "Argile sculptée à la finition peinte" },
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
export default map
|
package/src/i18n/style.he.ts
CHANGED
|
@@ -52,6 +52,11 @@ const map: LocaleCatalogMap = {
|
|
|
52
52
|
|
|
53
53
|
// --- picker-gaps 2026-09-01 ---
|
|
54
54
|
"early-color-photo": { label: "צילום צבע מוקדם", description: "צבע מוקדם של תחילת המאה ה-20 בסגנון פרוקודין-גורסקי / אוטוכרום" },
|
|
55
|
+
"felt-puppet": { label: "בובות לבד", description: "בובות לבד וסט בהנפשת סטופ-מושן" },
|
|
56
|
+
"knitted-yarn": { label: "עולם סרוג", description: "עולם סרוג מחוטי צמר" },
|
|
57
|
+
"toy-figure-3d": { label: "בובת צעצוע תלת-ממד", description: "דמויות צעצוע עגולות מוויניל" },
|
|
58
|
+
"painterly-3d": { label: "תלת-ממד ציורי", description: "תלת-ממד בסגנון ספר אגדה עם גימור צבוע ביד" },
|
|
59
|
+
"painted-clay": { label: "חימר צבוע", description: "חימר מפוסל עם גימור צבוע" },
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
export default map
|
package/src/i18n/style.hi.ts
CHANGED
|
@@ -51,6 +51,11 @@ const map: LocaleCatalogMap = {
|
|
|
51
51
|
"manga": { label: "Manga", description: "Inked B&W panel कला, screen-tone shading" },
|
|
52
52
|
// --- picker-gaps 2026-09-01 ---
|
|
53
53
|
"early-color-photo": { label: "प्रारंभिक रंगीन फ़ोटो", description: "Prokudin-Gorsky / autochrome शैली का 1900 के दशक का आरंभिक रंगीन फ़ोटो लुक" },
|
|
54
|
+
"felt-puppet": { label: "फ़ेल्ट कठपुतली", description: "नीडल-फ़ेल्ट स्टॉप-मोशन कठपुतलियाँ और सेट" },
|
|
55
|
+
"knitted-yarn": { label: "बुनी हुई दुनिया", description: "ऊन के धागे से बुनी दुनिया" },
|
|
56
|
+
"toy-figure-3d": { label: "खिलौना फ़िगर 3D", description: "गोल-मटोल विनाइल खिलौना फ़िगर" },
|
|
57
|
+
"painterly-3d": { label: "पेंटरली 3D", description: "हाथ से पेंट किए फ़िनिश वाला कहानी-किताब 3D" },
|
|
58
|
+
"painted-clay": { label: "पेंट की हुई मिट्टी", description: "पेंट फ़िनिश वाली गढ़ी हुई मिट्टी" },
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
export default map
|
package/src/i18n/style.ja.ts
CHANGED
|
@@ -52,6 +52,11 @@ const map: LocaleCatalogMap = {
|
|
|
52
52
|
|
|
53
53
|
// --- picker-gaps 2026-09-01 ---
|
|
54
54
|
"early-color-photo": { label: "初期のカラー写真", description: "Prokudin-Gorsky/オートクロームによる1900年代初頭のカラー" },
|
|
55
|
+
"felt-puppet": { label: "フェルト人形", description: "ニードルフェルトのストップモーション人形とセット" },
|
|
56
|
+
"knitted-yarn": { label: "ニットの世界", description: "毛糸で編んだ世界" },
|
|
57
|
+
"toy-figure-3d": { label: "トイフィギュア3D", description: "丸みのあるソフビ人形" },
|
|
58
|
+
"painterly-3d": { label: "ペインタリー3D", description: "手描き風仕上げの絵本調3D" },
|
|
59
|
+
"painted-clay": { label: "彩色クレイ", description: "彩色仕上げの粘土造形" },
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
export default map
|
package/src/i18n/style.ko.ts
CHANGED
|
@@ -52,6 +52,11 @@ const map: LocaleCatalogMap = {
|
|
|
52
52
|
|
|
53
53
|
// --- picker-gaps 2026-09-01 ---
|
|
54
54
|
"early-color-photo": { label: "초기 컬러 사진", description: "Prokudin-Gorsky / 오토크롬 방식의 1900년대 초 컬러" },
|
|
55
|
+
"felt-puppet": { label: "펠트 인형", description: "니들 펠트 스톱모션 인형과 세트" },
|
|
56
|
+
"knitted-yarn": { label: "니트 얀", description: "털실로 뜬 세계" },
|
|
57
|
+
"toy-figure-3d": { label: "토이 피규어 3D", description: "둥근 비닐 장난감 피규어" },
|
|
58
|
+
"painterly-3d": { label: "페인터리 3D", description: "손으로 칠한 마감의 동화풍 3D" },
|
|
59
|
+
"painted-clay": { label: "채색 점토", description: "채색 마감의 조각 점토" },
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
export default map
|
package/src/i18n/style.pt-BR.ts
CHANGED
|
@@ -54,6 +54,11 @@ const map: LocaleCatalogMap = {
|
|
|
54
54
|
|
|
55
55
|
// --- picker-gaps 2026-09-01 ---
|
|
56
56
|
"early-color-photo": { label: "Foto colorida antiga", description: "Cor do início dos anos 1900, autochrome / Prokudin-Gorsky" },
|
|
57
|
+
"felt-puppet": { label: "Boneco de feltro", description: "Bonecos e cenário de feltro em stop-motion" },
|
|
58
|
+
"knitted-yarn": { label: "Tricô", description: "Um mundo tricotado em lã" },
|
|
59
|
+
"toy-figure-3d": { label: "Boneco de vinil 3D", description: "Bonecos de vinil arredondados" },
|
|
60
|
+
"painterly-3d": { label: "3D pictórico", description: "3D de livro ilustrado com acabamento pintado à mão" },
|
|
61
|
+
"painted-clay": { label: "Argila pintada", description: "Argila esculpida com acabamento pintado" },
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
export default map
|
package/src/i18n/style.ru.ts
CHANGED
|
@@ -51,6 +51,11 @@ const map: LocaleCatalogMap = {
|
|
|
51
51
|
"manga": { label: "Манга", description: "Чёрно-белые панели тушью с тонированием скринтонами" },
|
|
52
52
|
// --- picker-gaps 2026-09-01 ---
|
|
53
53
|
"early-color-photo": { label: "Ранняя цветная фотография", description: "Цвет начала 1900-х в духе Прокудина-Горского / автохрома" },
|
|
54
|
+
"felt-puppet": { label: "Войлочная кукла", description: "Кукольная анимация из валяного войлока" },
|
|
55
|
+
"knitted-yarn": { label: "Вязаный мир", description: "Мир, связанный из шерстяной пряжи" },
|
|
56
|
+
"toy-figure-3d": { label: "Игрушечная фигурка 3D", description: "Округлые виниловые фигурки" },
|
|
57
|
+
"painterly-3d": { label: "Живописное 3D", description: "Сказочное 3D с ручной росписью" },
|
|
58
|
+
"painted-clay": { label: "Расписная глина", description: "Лепка из глины с росписью" },
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
export default map
|
package/src/i18n/style.zh-CN.ts
CHANGED
|
@@ -52,6 +52,11 @@ const map: LocaleCatalogMap = {
|
|
|
52
52
|
|
|
53
53
|
// --- picker-gaps 2026-09-01 ---
|
|
54
54
|
"early-color-photo": { label: "早期彩色照片", description: "普罗库金-戈尔斯基 / Autochrome 微粒彩屏,1900 年代早期彩色" },
|
|
55
|
+
"felt-puppet": { label: "毛毡玩偶", description: "针毡定格动画玩偶与场景" },
|
|
56
|
+
"knitted-yarn": { label: "毛线编织世界", description: "用毛线编织的世界" },
|
|
57
|
+
"toy-figure-3d": { label: "玩具手办 3D", description: "圆润的搪胶玩具人偶" },
|
|
58
|
+
"painterly-3d": { label: "绘画风 3D", description: "手绘质感的绘本风 3D" },
|
|
59
|
+
"painted-clay": { label: "彩绘黏土", description: "彩绘的雕塑黏土" },
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
export default map
|
package/src/mask-composite.ts
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
* Wire contract only — no I/O.
|
|
29
29
|
*/
|
|
30
|
+
import { pricedClipSeconds } from "./priced-clip-seconds.js"
|
|
30
31
|
|
|
31
32
|
/** How the background is fitted to the foreground's frame. */
|
|
32
33
|
export const MASK_COMPOSITE_BACKGROUND_FITS = ["cover", "contain", "stretch"] as const
|
|
@@ -68,17 +69,17 @@ export const MASK_COMPOSITE_UNIT_SEC = 5
|
|
|
68
69
|
|
|
69
70
|
/**
|
|
70
71
|
* Pricing units for a result `durationSec` long: one per started 5 seconds,
|
|
71
|
-
* at least one
|
|
72
|
-
*
|
|
73
|
-
*
|
|
72
|
+
* at least one, after `pricedClipSeconds` (up to 0.05 s past a whole second is
|
|
73
|
+
* ignored, so a 10.01 s result is 2 units, not 3). An unknown length counts the
|
|
74
|
+
* longest result a run accepts (an upper bound — the pre-run quote for a clip
|
|
75
|
+
* whose length is not known yet; every run measures its foreground).
|
|
74
76
|
*/
|
|
75
77
|
export function maskCompositeUnits(durationSec: number | null | undefined): number {
|
|
76
78
|
const sec =
|
|
77
79
|
typeof durationSec === "number" && Number.isFinite(durationSec) && durationSec > 0
|
|
78
80
|
? Math.min(durationSec, MASK_COMPOSITE_BOUNDS.MAX_DURATION_SEC)
|
|
79
81
|
: MASK_COMPOSITE_BOUNDS.MAX_DURATION_SEC
|
|
80
|
-
|
|
81
|
-
return Math.max(1, Math.ceil(sec / MASK_COMPOSITE_UNIT_SEC - 1e-6))
|
|
82
|
+
return Math.ceil(pricedClipSeconds(sec) / MASK_COMPOSITE_UNIT_SEC)
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
export const MASK_COMPOSITE_DEFAULTS = {
|
package/src/model-catalog.ts
CHANGED
|
@@ -838,8 +838,8 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
838
838
|
resolutions: ["1K", "2K", "4K"],
|
|
839
839
|
pricing: [
|
|
840
840
|
{ identifier: "gpt-image-2", credits: 15, note: "1K default" },
|
|
841
|
-
{ identifier: "gpt-image-2:2K", credits:
|
|
842
|
-
{ identifier: "gpt-image-2:4K", credits:
|
|
841
|
+
{ identifier: "gpt-image-2:2K", credits: 25, note: "2K" },
|
|
842
|
+
{ identifier: "gpt-image-2:4K", credits: 40, note: "4K" },
|
|
843
843
|
],
|
|
844
844
|
safetyFilter: { stochastic: true, fallback: "nano-banana-pro" },
|
|
845
845
|
featured: true,
|
|
@@ -860,8 +860,8 @@ const IMAGE_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
860
860
|
resolutions: ["1K", "2K", "4K"],
|
|
861
861
|
pricing: [
|
|
862
862
|
{ identifier: "gpt-image-2-i2i", credits: 15, note: "1K default" },
|
|
863
|
-
{ identifier: "gpt-image-2-i2i:2K", credits:
|
|
864
|
-
{ identifier: "gpt-image-2-i2i:4K", credits:
|
|
863
|
+
{ identifier: "gpt-image-2-i2i:2K", credits: 25, note: "2K" },
|
|
864
|
+
{ identifier: "gpt-image-2-i2i:4K", credits: 40, note: "4K" },
|
|
865
865
|
],
|
|
866
866
|
},
|
|
867
867
|
|
|
@@ -2029,13 +2029,13 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
2029
2029
|
{ identifier: "seedance-2-5", credits: 1260, note: "default 8s 720p — see :Ns:res variants for exact" },
|
|
2030
2030
|
{ identifier: "seedance-2-5:8s:480p", credits: 560, note: "8s 480p" },
|
|
2031
2031
|
{ identifier: "seedance-2-5:8s:720p", credits: 1260, note: "8s 720p" },
|
|
2032
|
-
{ identifier: "seedance-2-5:8s:1080p", credits:
|
|
2032
|
+
{ identifier: "seedance-2-5:8s:1080p", credits: 3160, note: "8s 1080p" },
|
|
2033
2033
|
{ identifier: "seedance-2-5:8s:480p-ref", credits: 340, note: "8s 480p with reference video" },
|
|
2034
2034
|
{ identifier: "seedance-2-5:8s:720p-ref", credits: 760, note: "8s 720p with reference video" },
|
|
2035
|
-
{ identifier: "seedance-2-5:8s:1080p-ref", credits:
|
|
2035
|
+
{ identifier: "seedance-2-5:8s:1080p-ref", credits: 1900, note: "8s 1080p with reference video" },
|
|
2036
2036
|
{ identifier: "seedance-2-5:30s:480p", credits: 2100, note: "30s 480p (max)" },
|
|
2037
2037
|
{ identifier: "seedance-2-5:30s:720p", credits: 4730, note: "30s 720p (max)" },
|
|
2038
|
-
{ identifier: "seedance-2-5:30s:1080p", credits:
|
|
2038
|
+
{ identifier: "seedance-2-5:30s:1080p", credits: 11850, note: "30s 1080p (max)" },
|
|
2039
2039
|
],
|
|
2040
2040
|
},
|
|
2041
2041
|
|
|
@@ -2816,9 +2816,11 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
2816
2816
|
{ identifier: "volcengine-lipsync:300s", credits: 6000, note: "5-min ceiling" },
|
|
2817
2817
|
],
|
|
2818
2818
|
},
|
|
2819
|
-
// ── Video Depth ── (video-depth node;
|
|
2820
|
-
// videoDepthCreditId in video-depth.ts — `<provider>:<
|
|
2821
|
-
// the
|
|
2819
|
+
// ── Video Depth ── (video-depth node; priced by the input clip's length via
|
|
2820
|
+
// videoDepthCreditId in video-depth.ts — `<provider>:<n>s`, one row per whole
|
|
2821
|
+
// second of the clip (`pricedClipSeconds`), representative rows below: `:1s` …
|
|
2822
|
+
// `:300s` on Video Depth Anything, `:1s` … `:80s` on Depth Anything per frame.
|
|
2823
|
+
// Bare row = the provider's longest clip: 300 s and 80 s.)
|
|
2822
2824
|
"video-depth-anything": {
|
|
2823
2825
|
id: "video-depth-anything",
|
|
2824
2826
|
kind: "video",
|
|
@@ -2831,11 +2833,10 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
2831
2833
|
useCases: ["depth", "video-to-video", "compositing"],
|
|
2832
2834
|
pricing: [
|
|
2833
2835
|
{ identifier: "video-depth-anything", credits: 6000, note: "5-min ceiling (no duration given)" },
|
|
2834
|
-
{ identifier: "video-depth-anything:
|
|
2835
|
-
{ identifier: "video-depth-anything:
|
|
2836
|
-
{ identifier: "video-depth-anything:60s", credits: 1200 },
|
|
2837
|
-
{ identifier: "video-depth-anything:
|
|
2838
|
-
{ identifier: "video-depth-anything:300s", credits: 6000, note: "5-min ceiling" },
|
|
2836
|
+
{ identifier: "video-depth-anything:1s", credits: 20, note: "1s (min) — priced per second of the clip at this row's credits, the length rounded up after ignoring up to 0.05 s past a whole second" },
|
|
2837
|
+
{ identifier: "video-depth-anything:15s", credits: 300, note: "15s" },
|
|
2838
|
+
{ identifier: "video-depth-anything:60s", credits: 1200, note: "1 min" },
|
|
2839
|
+
{ identifier: "video-depth-anything:300s", credits: 6000, note: "5-min ceiling (max)" },
|
|
2839
2840
|
],
|
|
2840
2841
|
},
|
|
2841
2842
|
"depth-anything-frames": {
|
|
@@ -2849,12 +2850,11 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
2849
2850
|
description: "Depth Anything v1 run on each frame. Grayscale or inferno colormap; may flicker between frames. Up to 80 s.",
|
|
2850
2851
|
useCases: ["depth", "video-to-video"],
|
|
2851
2852
|
pricing: [
|
|
2852
|
-
{ identifier: "depth-anything-frames", credits:
|
|
2853
|
-
{ identifier: "depth-anything-frames:
|
|
2854
|
-
{ identifier: "depth-anything-frames:
|
|
2855
|
-
{ identifier: "depth-anything-frames:60s", credits: 120 },
|
|
2856
|
-
{ identifier: "depth-anything-frames:
|
|
2857
|
-
{ identifier: "depth-anything-frames:300s", credits: 600, note: "5-min ceiling" },
|
|
2853
|
+
{ identifier: "depth-anything-frames", credits: 160, note: "80s ceiling (no duration given)" },
|
|
2854
|
+
{ identifier: "depth-anything-frames:1s", credits: 2, note: "1s (min) — priced per second of the clip at this row's credits, the length rounded up after ignoring up to 0.05 s past a whole second" },
|
|
2855
|
+
{ identifier: "depth-anything-frames:15s", credits: 30, note: "15s" },
|
|
2856
|
+
{ identifier: "depth-anything-frames:60s", credits: 120, note: "1 min" },
|
|
2857
|
+
{ identifier: "depth-anything-frames:80s", credits: 160, note: "80s ceiling (max)" },
|
|
2858
2858
|
],
|
|
2859
2859
|
},
|
|
2860
2860
|
// ── Gemini video analysis ── (Gemini-only; billed per duration bucket — the
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The whole seconds a clip is PRICED at by Video Depth (both providers), Video
|
|
3
|
+
* Mask, Mask Composite and the face mesh: its length rounded up, after ignoring
|
|
4
|
+
* up to {@link CLIP_PRICE_GRACE_SEC} past a whole second.
|
|
5
|
+
*
|
|
6
|
+
* A whole-second cut of a 29.97 or 23.976 fps clip can come out a little long:
|
|
7
|
+
* 12 s is 360 frames, a 12.012 s file. A quote reads the cut, a run measures the
|
|
8
|
+
* file, and both land on the same row through this one rule, wherever those steps
|
|
9
|
+
* are reserved, charged or quoted.
|
|
10
|
+
*
|
|
11
|
+
* It decides the price only. Each step's limits (the 300 s cap, the frame cap)
|
|
12
|
+
* read the clip's real length. Other models round as they always have.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** How far past a whole second a clip is still priced as that second. */
|
|
16
|
+
export const CLIP_PRICE_GRACE_SEC = 0.05
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Float noise: a length that is arithmetic can land a hair past the edge, and
|
|
20
|
+
* must not round up for it. 1.35 s at 90 fps, priced at the 30 fps basis, is
|
|
21
|
+
* 4.050000000000001: 4, not 5.
|
|
22
|
+
*/
|
|
23
|
+
const FLOAT_NOISE_SEC = 1e-9
|
|
24
|
+
|
|
25
|
+
/** At least one second. The caller has checked that `sec` is a real length. */
|
|
26
|
+
export function pricedClipSeconds(sec: number): number {
|
|
27
|
+
return Math.max(1, Math.ceil(sec - CLIP_PRICE_GRACE_SEC - FLOAT_NOISE_SEC))
|
|
28
|
+
}
|
package/src/video-depth.ts
CHANGED
|
@@ -9,11 +9,15 @@
|
|
|
9
9
|
* produces from the inferno output (`videoDepthNeedsGrayscalePass`).
|
|
10
10
|
*
|
|
11
11
|
* Price rows are `model_pricing` rows (`<provider>:<n>s`); the credit amounts
|
|
12
|
-
* live there, never here.
|
|
12
|
+
* live there, never here. Both providers have one row per whole second of the
|
|
13
|
+
* clip, up to the longest clip each accepts. Worked examples (repeated in
|
|
13
14
|
* docs/nodes/processing-video/video-depth.md):
|
|
14
|
-
*
|
|
15
|
+
* video-depth-anything: 0.4 s → `:1s`, 9 s → `:9s`, 9.2 s → `:10s`, 15.015 s → `:15s`, 15.06 s → `:16s`.
|
|
16
|
+
* depth-anything-frames: 0.4 s → `:1s`, 4 s → `:4s`, 4.1 s → `:5s`, 15.015 s → `:15s`, 15.06 s → `:16s`, 80 s → `:80s`.
|
|
15
17
|
*/
|
|
16
18
|
|
|
19
|
+
import { pricedClipSeconds } from "./priced-clip-seconds.js"
|
|
20
|
+
|
|
17
21
|
export const VIDEO_DEPTH_PROVIDERS = ["video-depth-anything", "depth-anything-frames"] as const
|
|
18
22
|
export type VideoDepthProvider = (typeof VIDEO_DEPTH_PROVIDERS)[number]
|
|
19
23
|
|
|
@@ -84,7 +88,7 @@ export function videoDepthNeedsGrayscalePass(provider: string, colormap: VideoDe
|
|
|
84
88
|
export const VIDEO_DEPTH_LIMITS = {
|
|
85
89
|
/** fal `max_frames` ceiling. */
|
|
86
90
|
FAL_MAX_FRAMES: 2400,
|
|
87
|
-
/** Longest clip the fal lane accepts, whatever its frame rate:
|
|
91
|
+
/** Longest clip the fal lane accepts, whatever its frame rate: its top price row, `:300s` (a low-fps clip under the frame limit can otherwise run past every price row). */
|
|
88
92
|
FAL_MAX_SECONDS: 300,
|
|
89
93
|
/** Frame rate assumed when the clip reports none (variable-rate or missing). */
|
|
90
94
|
ASSUMED_FPS: 30,
|
|
@@ -125,6 +129,13 @@ export function checkVideoDepthLength(
|
|
|
125
129
|
}
|
|
126
130
|
}
|
|
127
131
|
|
|
132
|
+
/**
|
|
133
|
+
* The length buckets, in seconds, both providers were priced in before their
|
|
134
|
+
* per-second rows. A row is no longer picked from these: a clip's whole seconds
|
|
135
|
+
* name its row, so a `:15s` is the 15-second row and a `:120s` on Depth Anything
|
|
136
|
+
* per frame is past its limit. Each per-second row took its admin switches from
|
|
137
|
+
* the bucket that priced it (migrations 590 and 595).
|
|
138
|
+
*/
|
|
128
139
|
export const VIDEO_DEPTH_BUCKETS = [15, 30, 60, 120, 300] as const
|
|
129
140
|
|
|
130
141
|
/** The longest clip `provider` accepts (`checkVideoDepthLength`); the fal limit for anything else. */
|
|
@@ -135,17 +146,19 @@ function videoDepthMaxSeconds(provider: string): number {
|
|
|
135
146
|
}
|
|
136
147
|
|
|
137
148
|
/**
|
|
138
|
-
* The price row for a clip of `durationSec`.
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
149
|
+
* The price row for a clip of `durationSec`.
|
|
150
|
+
*
|
|
151
|
+
* One row per whole second of the clip on both lanes: the clip's length rounded
|
|
152
|
+
* UP (`pricedClipSeconds`: up to 0.05 s past a whole second is ignored first), so
|
|
153
|
+
* a clip under one second is priced as one. `video-depth-anything:1s` … `:300s`
|
|
154
|
+
* (decided 2026-11-03), `depth-anything-frames:1s` … `:80s` (decided 2026-11-04).
|
|
155
|
+
*
|
|
156
|
+
* Unknown, non-positive or longer than the provider accepts → the provider's
|
|
157
|
+
* longest clip (fal `:300s`, Replicate `:80s`), its highest REACHABLE row — the
|
|
158
|
+
* most a run on it can be charged, never a row a run could not reach.
|
|
143
159
|
*/
|
|
144
160
|
export function videoDepthCreditId(provider: string, durationSec: number | null | undefined): string {
|
|
145
|
-
const top = VIDEO_DEPTH_BUCKETS[VIDEO_DEPTH_BUCKETS.length - 1]
|
|
146
161
|
const maxSec = videoDepthMaxSeconds(provider)
|
|
147
|
-
const reachableCeiling = VIDEO_DEPTH_BUCKETS.find((b) => b >= maxSec) ?? top
|
|
148
162
|
const known = typeof durationSec === "number" && Number.isFinite(durationSec) && durationSec > 0 && durationSec <= maxSec
|
|
149
|
-
|
|
150
|
-
return `${provider}:${bucket}s`
|
|
163
|
+
return `${provider}:${known ? pricedClipSeconds(durationSec) : maxSec}s`
|
|
151
164
|
}
|
package/src/video-face-mesh.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Priced by the clip's length at the 30 fps basis Video Mask uses
|
|
11
11
|
* (`videoMaskBilledSeconds`), one row per length bucket.
|
|
12
12
|
*/
|
|
13
|
+
import { pricedClipSeconds } from "./priced-clip-seconds.js"
|
|
13
14
|
import { VIDEO_MASK_LIMITS, type VideoMaskZone } from "./video-mask.js"
|
|
14
15
|
import type { VideoDepthColormap } from "./video-depth.js"
|
|
15
16
|
|
|
@@ -47,9 +48,12 @@ export type VideoFaceMeshParts = (typeof VIDEO_FACE_MESH_PARTS)[number]
|
|
|
47
48
|
* same input: the model, the crop, the smoothing, the filters, the colours or
|
|
48
49
|
* the widths. Never for pricing, limits or messages. 2026-11-02: MediaPipe's
|
|
49
50
|
* refined landmark model (478 points, a 256 × 256 crop) in place of the basic
|
|
50
|
-
* one; the lines' colours and widths are 2026-11-01's.
|
|
51
|
+
* one; the lines' colours and widths are 2026-11-01's. 2026-11-03: a face gets
|
|
52
|
+
* lines only when it is found in at least 3 frames of its track (found faces
|
|
53
|
+
* at the same place in frames at most 2 apart): one found in a frame or two
|
|
54
|
+
* is never drawn.
|
|
51
55
|
*/
|
|
52
|
-
export const VIDEO_FACE_MESH_RECIPE = "2026-11-
|
|
56
|
+
export const VIDEO_FACE_MESH_RECIPE = "2026-11-03"
|
|
53
57
|
|
|
54
58
|
const VIDEO_FACE_MESH_BUCKETS_SEC = [5, 10, 15, 30, 60, 120, 300] as const
|
|
55
59
|
|
|
@@ -60,14 +64,16 @@ export function videoFaceMeshCreditIds(): string[] {
|
|
|
60
64
|
|
|
61
65
|
/**
|
|
62
66
|
* The price row for a clip priced at `billedSec` seconds: the smallest bucket
|
|
63
|
-
* that holds it
|
|
67
|
+
* that holds it, after `pricedClipSeconds` (up to 0.05 s past a bucket's length
|
|
68
|
+
* stays in that bucket). An unknown or non-positive length, or one past the cap,
|
|
64
69
|
* prices the LONGEST row (the route measures every clip and refuses one past
|
|
65
70
|
* the cap, so this is only ever a ceiling).
|
|
66
71
|
*/
|
|
67
72
|
export function videoFaceMeshCreditId(billedSec: number | null | undefined): string {
|
|
68
73
|
const ids = videoFaceMeshCreditIds()
|
|
69
74
|
if (typeof billedSec !== "number" || !Number.isFinite(billedSec) || billedSec <= 0) return ids[ids.length - 1]!
|
|
70
|
-
const
|
|
75
|
+
const priced = pricedClipSeconds(billedSec)
|
|
76
|
+
const i = VIDEO_FACE_MESH_BUCKETS_SEC.findIndex((b) => priced <= b)
|
|
71
77
|
return ids[i === -1 ? ids.length - 1 : i]!
|
|
72
78
|
}
|
|
73
79
|
|
package/src/video-mask.ts
CHANGED
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
* charged from. The credit amounts live in the rows, never here.
|
|
11
11
|
*
|
|
12
12
|
* Worked examples (repeated in docs/nodes/ai-video/video-mask.md):
|
|
13
|
-
* 4 s at 30 fps → `sam-3.1-video:5s`, 12 s at 24 fps → `sam-3.1-video:15s`,
|
|
13
|
+
* 4 s at 30 fps → `sam-3.1-video:5s`, 5.005 s at 29.97 fps → `sam-3.1-video:5s`, 12 s at 24 fps → `sam-3.1-video:15s`,
|
|
14
14
|
* 10 s at 60 fps (priced as 20 s) → `sam-3.1-video:30s`, 45 s at 30 fps → `sam-3.1-video:60s`,
|
|
15
15
|
* 100 s at 30 fps → `sam-3.1-video:120s`, 4 min at 30 fps on SAM 3 → `sam-3-video:240s`.
|
|
16
16
|
*
|
|
17
17
|
* Wire contract only — no I/O.
|
|
18
18
|
*/
|
|
19
|
+
import { pricedClipSeconds } from "./priced-clip-seconds.js"
|
|
19
20
|
|
|
20
21
|
/** Segmentation models a Video Mask run can use. SAM 3.1 (the default)
|
|
21
22
|
* tracks several objects in one pass and runs faster; SAM 3 costs half. */
|
|
@@ -166,7 +167,8 @@ export function videoMaskCreditIds(provider: VideoMaskProvider = DEFAULT_VIDEO_M
|
|
|
166
167
|
/**
|
|
167
168
|
* The length a clip is priced at: its duration at the 30 fps basis. A clip
|
|
168
169
|
* at or under 30 fps is priced at its own length; a 60 fps clip at twice it.
|
|
169
|
-
* An unknown frame rate counts as the basis.
|
|
170
|
+
* An unknown frame rate counts as the basis. The cap reads this figure; the
|
|
171
|
+
* price row reads it through `pricedClipSeconds`.
|
|
170
172
|
*/
|
|
171
173
|
export function videoMaskBilledSeconds(durationSec: number, fps?: number | null): number {
|
|
172
174
|
const rate = typeof fps === "number" && Number.isFinite(fps) && fps > 0 ? fps : VIDEO_MASK_LIMITS.FPS_BASIS
|
|
@@ -174,10 +176,12 @@ export function videoMaskBilledSeconds(durationSec: number, fps?: number | null)
|
|
|
174
176
|
}
|
|
175
177
|
|
|
176
178
|
/**
|
|
177
|
-
* The price row for a clip priced at `billedSec` seconds
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
179
|
+
* The price row for a clip priced at `billedSec` seconds: the smallest that
|
|
180
|
+
* holds it, after `pricedClipSeconds` (up to 0.05 s past a row's length stays in
|
|
181
|
+
* that row). An unknown or non-positive length prices the LONGEST row (a clip
|
|
182
|
+
* the route could not measure is refused, so this is only the pre-run quote for
|
|
183
|
+
* a clip whose length is not known yet); anything past the cap prices the last
|
|
184
|
+
* row.
|
|
181
185
|
*/
|
|
182
186
|
export function videoMaskCreditId(
|
|
183
187
|
billedSec: number | null | undefined,
|
|
@@ -185,7 +189,8 @@ export function videoMaskCreditId(
|
|
|
185
189
|
): string {
|
|
186
190
|
const ids = videoMaskCreditIds(provider)
|
|
187
191
|
if (typeof billedSec !== "number" || !Number.isFinite(billedSec) || billedSec <= 0) return ids[ids.length - 1]!
|
|
188
|
-
const
|
|
192
|
+
const priced = pricedClipSeconds(billedSec)
|
|
193
|
+
const i = VIDEO_MASK_BUCKETS_SEC.findIndex((b) => priced <= b)
|
|
189
194
|
return ids[i === -1 ? ids.length - 1 : i]!
|
|
190
195
|
}
|
|
191
196
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/video-depth.ts"],"names":[],"mappings":";AAgBO,IAAM,qBAAA,GAAwB,CAAC,sBAAA,EAAwB,uBAAuB;AAG9E,IAAM,yBAAA,mBAAiD,IAAI,GAAA,CAAI,CAAC,sBAAsB,CAAC;AACvF,IAAM,+BAAA,mBAAuD,IAAI,GAAA,CAAI,CAAC,uBAAuB,CAAC;AAQ9F,SAAS,0BAA0B,GAAA,EAAkC;AAC1E,EAAA,OAAO,OAAO,QAAQ,QAAA,IAAa,qBAAA,CAA4C,SAAS,GAAG,CAAA,GACtF,GAAA,GACD,qBAAA,CAAsB,CAAC,CAAA;AAC7B;AAEO,IAAM,uBAAA,GAA0B,CAAC,OAAA,EAAS,MAAA,EAAQ,OAAO;AAIzD,SAAS,2BAA2B,GAAA,EAAmC;AAC5E,EAAA,OAAO,OAAO,GAAA,KAAQ,QAAA,IAAa,wBAA8C,QAAA,CAA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,KAAM,WAAA,IAAe,CAAC,CAAA,IAAK,GAAA,GAAO,gBAAA;AACpF,EAAA,OAAO,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,MAAM,CAAA,CAAA,CAAA;AAC9B","file":"chunk-3RYKIUAE.js","sourcesContent":["/**\n * Video Depth — the one contract every layer reads: which providers exist and\n * which lane serves each, which optional levers a provider honours, how long a\n * clip may be, and which price row a run is charged from.\n *\n * Colormaps: fal renders every `VIDEO_DEPTH_COLORMAPS` entry natively. The\n * Replicate model's native output is inferno-colorized, so it offers only\n * `inferno` (passed through as-is) and `grayscale`, which a worker ffmpeg pass\n * produces from the inferno output (`videoDepthNeedsGrayscalePass`).\n *\n * Price rows are `model_pricing` rows (`<provider>:<n>s`); the credit amounts\n * live there, never here. Worked examples (repeated in\n * docs/nodes/processing-video/video-depth.md):\n * 5 s → `:15s`, 15 s → `:15s`, 15.01 s → `:30s`, 61 s → `:120s`.\n */\n\nexport const VIDEO_DEPTH_PROVIDERS = [\"video-depth-anything\", \"depth-anything-frames\"] as const\nexport type VideoDepthProvider = (typeof VIDEO_DEPTH_PROVIDERS)[number]\n\nexport const FAL_VIDEO_DEPTH_PROVIDERS: ReadonlySet<string> = new Set([\"video-depth-anything\"])\nexport const REPLICATE_VIDEO_DEPTH_PROVIDERS: ReadonlySet<string> = new Set([\"depth-anything-frames\"])\n\n/**\n * The provider a run uses: `raw` when it is a Video Depth provider, else the\n * default (the first entry). Raw workflow JSON or a FieldMapping can carry any\n * value; the dispatch, the model deny and the price row all read this one\n * resolution, so an unknown id never reaches a price row or slips the deny.\n */\nexport function resolveVideoDepthProvider(raw: unknown): VideoDepthProvider {\n return typeof raw === \"string\" && (VIDEO_DEPTH_PROVIDERS as readonly string[]).includes(raw)\n ? (raw as VideoDepthProvider)\n : VIDEO_DEPTH_PROVIDERS[0]\n}\n\nexport const VIDEO_DEPTH_MODEL_SIZES = [\"small\", \"base\", \"large\"] as const\nexport type VideoDepthModelSize = (typeof VIDEO_DEPTH_MODEL_SIZES)[number]\n\n/** The model size a run uses: `raw` when it is one, else `large` (the providers index lookup tables with it). */\nexport function resolveVideoDepthModelSize(raw: unknown): VideoDepthModelSize {\n return typeof raw === \"string\" && (VIDEO_DEPTH_MODEL_SIZES as readonly string[]).includes(raw)\n ? (raw as VideoDepthModelSize)\n : \"large\"\n}\nexport const VIDEO_DEPTH_COLORMAPS = [\"grayscale\", \"turbo\", \"inferno\", \"magma\", \"viridis\"] as const\nexport type VideoDepthColormap = (typeof VIDEO_DEPTH_COLORMAPS)[number]\nexport const VIDEO_DEPTH_RESOLUTIONS = [\"auto\", \"360p\", \"480p\", \"720p\", \"1080p\"] as const\nexport type VideoDepthResolution = (typeof VIDEO_DEPTH_RESOLUTIONS)[number]\n\nexport type VideoDepthLever = \"colormap\" | \"resolution\" | \"sideBySide\"\nconst ALL_LEVERS: ReadonlySet<VideoDepthLever> = new Set([\"colormap\", \"resolution\", \"sideBySide\"])\nconst COLORMAP_ONLY: ReadonlySet<VideoDepthLever> = new Set([\"colormap\"])\nconst NO_LEVERS: ReadonlySet<VideoDepthLever> = new Set()\n\n/** The optional levers `provider` honours. A lever absent here is dropped, never sent. */\nexport function videoDepthLevers(provider: string): ReadonlySet<VideoDepthLever> {\n if (FAL_VIDEO_DEPTH_PROVIDERS.has(provider)) return ALL_LEVERS\n if (REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)) return COLORMAP_ONLY\n return NO_LEVERS\n}\n\nconst REPLICATE_COLORMAPS: readonly VideoDepthColormap[] = [\"grayscale\", \"inferno\"]\n\n/** The colormaps `provider` can deliver, in display order; empty when it has no colormap lever. */\nexport function videoDepthColormaps(provider: string): readonly VideoDepthColormap[] {\n if (FAL_VIDEO_DEPTH_PROVIDERS.has(provider)) return VIDEO_DEPTH_COLORMAPS\n if (REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)) return REPLICATE_COLORMAPS\n return []\n}\n\n/** The colormap a run uses: the requested one when `provider` offers it, else `grayscale`; `undefined` when the provider has no colormap lever. Coerces, never throws. */\nexport function resolveVideoDepthColormap(provider: string, requested: unknown): VideoDepthColormap | undefined {\n if (!videoDepthLevers(provider).has(\"colormap\")) return undefined\n const offered = videoDepthColormaps(provider)\n return typeof requested === \"string\" && (offered as readonly string[]).includes(requested)\n ? (requested as VideoDepthColormap)\n : \"grayscale\"\n}\n\n/** True when the worker must turn the Replicate model's native inferno output into grayscale with ffmpeg. */\nexport function videoDepthNeedsGrayscalePass(provider: string, colormap: VideoDepthColormap | undefined): boolean {\n return REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider) && resolveVideoDepthColormap(provider, colormap) === \"grayscale\"\n}\n\nexport const VIDEO_DEPTH_LIMITS = {\n /** fal `max_frames` ceiling. */\n FAL_MAX_FRAMES: 2400,\n /** Longest clip the fal lane accepts, whatever its frame rate: the top price bucket (a low-fps clip under the frame limit can otherwise run past every price row). */\n FAL_MAX_SECONDS: 300,\n /** Frame rate assumed when the clip reports none (variable-rate or missing). */\n ASSUMED_FPS: 30,\n /** Longest clip the Replicate lane accepts. */\n REPLICATE_MAX_SECONDS: 80,\n} as const\n\nconst fmt = (n: number): string => n.toLocaleString(\"en-US\")\n\n/** Refuse a clip the provider cannot take — run BEFORE any credit reservation. */\nexport function checkVideoDepthLength(\n provider: string,\n probe: { durationSec: number; fps?: number },\n): { ok: true } | { ok: false; message: string } {\n if (REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)) {\n if (probe.durationSec <= VIDEO_DEPTH_LIMITS.REPLICATE_MAX_SECONDS) return { ok: true }\n return {\n ok: false,\n message: `Video is ${Math.ceil(probe.durationSec)} s. This provider accepts at most ${VIDEO_DEPTH_LIMITS.REPLICATE_MAX_SECONDS} s.`,\n }\n }\n if (probe.durationSec > VIDEO_DEPTH_LIMITS.FAL_MAX_SECONDS) {\n return {\n ok: false,\n message: `Video is ${Math.ceil(probe.durationSec)} s. This provider accepts at most ${VIDEO_DEPTH_LIMITS.FAL_MAX_SECONDS} s. Trim the clip and run again.`,\n }\n }\n const assumed = !(typeof probe.fps === \"number\" && probe.fps > 0)\n const fps = assumed ? VIDEO_DEPTH_LIMITS.ASSUMED_FPS : (probe.fps as number)\n const frames = Math.ceil(probe.durationSec * fps - 1e-9)\n if (frames <= VIDEO_DEPTH_LIMITS.FAL_MAX_FRAMES) return { ok: true }\n const maxSec = Math.floor(VIDEO_DEPTH_LIMITS.FAL_MAX_FRAMES / fps)\n return {\n ok: false,\n message:\n `Video is ${fmt(frames)} frames; the limit is ${fmt(VIDEO_DEPTH_LIMITS.FAL_MAX_FRAMES)} ` +\n `(about ${maxSec} s at ${Math.round(fps)} fps${assumed ? \", assumed 30 fps because the clip reports no frame rate\" : \"\"}). Trim the clip and run again.`,\n }\n}\n\nexport const VIDEO_DEPTH_BUCKETS = [15, 30, 60, 120, 300] as const\n\n/** The longest clip `provider` accepts (`checkVideoDepthLength`); the fal limit for anything else. */\nfunction videoDepthMaxSeconds(provider: string): number {\n return REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)\n ? VIDEO_DEPTH_LIMITS.REPLICATE_MAX_SECONDS\n : VIDEO_DEPTH_LIMITS.FAL_MAX_SECONDS\n}\n\n/**\n * The price row for a clip of `durationSec`. Unknown, non-positive or longer\n * than the provider accepts → the provider's highest REACHABLE row: the\n * smallest bucket at or above its longest clip (Replicate 80 s → `:120s`,\n * fal 300 s → `:300s`) — the most a run on it can be charged, never a row a\n * run could not reach.\n */\nexport function videoDepthCreditId(provider: string, durationSec: number | null | undefined): string {\n const top = VIDEO_DEPTH_BUCKETS[VIDEO_DEPTH_BUCKETS.length - 1]\n const maxSec = videoDepthMaxSeconds(provider)\n const reachableCeiling = VIDEO_DEPTH_BUCKETS.find((b) => b >= maxSec) ?? top\n const known = typeof durationSec === \"number\" && Number.isFinite(durationSec) && durationSec > 0 && durationSec <= maxSec\n const bucket = known ? (VIDEO_DEPTH_BUCKETS.find((b) => durationSec <= b) ?? top) : reachableCeiling\n return `${provider}:${bucket}s`\n}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AK,CAAA,IAAK,KAAA,EAAO;AACjC,IAAA,IAAI,MAAA,CAAO,MAAA,CAAO,MAAA,EAAQ,IAAI,CAAA,EAAG,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,IAAI,CAAA,EAAA,EAAK,IAAI,CAAA,8FAAA,CAA2F,CAAA;AAC5J,IAAA,IAAI,MAAA,CAAO,MAAA,CAAO,GAAA,EAAK,IAAI,CAAA,EAAG,MAAM,IAAI,KAAA,CAAM,CAAA,EAAG,IAAI,CAAA,YAAA,EAAe,IAAI,CAAA,sBAAA,CAAwB,CAAA;AAChG,IAAA,GAAA,CAAI,IAAI,CAAA,GAAI,KAAA;AAAA,EACd;AACA,EAAA,OAAO,GAAA;AACT;AAGO,IAAM,gBAAgB,CAAC,IAAA,KAC5B,eAAe,MAAA,CAAO,CAAC,GAAG,QAAQ,CAAA,KAAM,QAAA,KAAa,IAAI,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,IAAI,MAAM,IAAI;AAG1E,IAAM,kBAAkB,CAAC,IAAA,KAC9B,cAAc,MAAA,CAAO,CAAC,GAAG,QAAQ,CAAA,KAAM,QAAA,KAAa,IAAI,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,IAAI,MAAM,IAAI;AAGzE,IAAM,eAAe,MAAkG;AAGvH,IAAM,sBAAsB,MAA+D;AAG3F,IAAM,kBAAkB,MAAyB;AAGjD,IAAM,iBAAiB,MAA4G","file":"chunk-5PCI6M44.cjs","sourcesContent":["// GENERATED by tools/units/gen.mjs — do not edit; run npm run gen:units\n// The unit contract published in @nodaro/shared (decided 2026-10-16, widened 2026-10-18): node type\n// ids with closed vocabularies — each unit's producer kind, the use-case types, what each JSON pip\n// carries, the input pips that are never a prompt lane, the review holds, how a published app\n// presents the result and which outputs fan out item by item. Never a price, credit id, number,\n// prompt or doctrine string. Each block feeds a published table that composes its rows with the\n// hand-written ones (unit-contract-compose.ts); every row is an irrevocable Apache grant.\n\nexport const UNIT_CONTRACTS: ReadonlyArray<readonly [type: string, producer: \"audio\" | \"video\" | \"image\" | \"dynamic\"]> = [\n [\"tighten-episode\", \"dynamic\"], // unit:tighten-episode\n [\"episode-trailer\", \"video\"], // unit:episode-trailer\n [\"clip-pack\", \"dynamic\"], // unit:clip-pack\n [\"speaker-layout\", \"video\"], // unit:speaker-layout\n [\"remove-audio\", \"video\"], // unit:remove-audio\n [\"gif-to-video\", \"video\"], // unit:gif-to-video\n]\n\n// The use-case node units (execution.kind \"use-case\"), in position order — each a route POST /v1/<type> (+ /estimate, /continue).\nexport const UNIT_USE_CASE_TYPES = [\n \"tighten-episode\", // unit:tighten-episode\n \"episode-chapters\", // unit:episode-chapters\n \"episode-trailer\", // unit:episode-trailer\n \"clip-pack\", // unit:clip-pack\n \"speaker-layout\", // unit:speaker-layout\n] as const\n\n// What each JSON (look) output pip carries (contract.jsonPips) — json-kinds.ts composes these.\nexport const UNIT_JSON_PIPS: ReadonlyArray<readonly [type: string, pips: Readonly<Record<string, \"transcript\" | \"edl\" | \"other\">>]> = [\n [\"tighten-episode\", { \"json\": \"edl\" }], // unit:tighten-episode\n [\"episode-chapters\", { \"json\": \"other\" }], // unit:episode-chapters\n [\"episode-trailer\", { \"json\": \"edl\" }], // unit:episode-trailer\n [\"clip-pack\", { \"json\": \"edl\" }], // unit:clip-pack\n [\"speaker-layout\", { \"json\": \"edl\" }], // unit:speaker-layout\n [\"speaker-map\", { \"edl\": \"edl\", \"json\": \"other\" }], // unit:speaker-map\n]\n\n// Input pips that are never a prompt lane (contract.nonPromptInputs) — fan-out-rows.ts composes these.\nexport const UNIT_NON_PROMPT_INPUTS: ReadonlyArray<readonly [type: string, handles: ReadonlyArray<string>]> = [\n [\"tighten-episode\", [\"music\", \"masterAudio\"]], // unit:tighten-episode\n [\"episode-trailer\", [\"introCard\", \"masterAudio\"]], // unit:episode-trailer\n [\"clip-pack\", [\"masterAudio\"]], // unit:clip-pack\n [\"speaker-layout\", [\"masterAudio\"]], // unit:speaker-layout\n]\n\n// Use-case units whose review-on run ends at a Preview that holds what follows (contract.reviewHold) — preview-gate.ts.\nexport const UNIT_REVIEW_HOLDS: ReadonlyArray<string> = [\n \"tighten-episode\", // unit:tighten-episode\n \"episode-trailer\", // unit:episode-trailer\n \"clip-pack\", // unit:clip-pack\n \"speaker-layout\", // unit:speaker-layout\n]\n\n// How a published app shows each unit's result where the producer sets do not decide it (contract.presents) — presentation-utils.ts.\nexport const UNIT_PRESENTS: ReadonlyArray<readonly [type: string, presents: \"image\" | \"video\" | \"audio\" | \"text\"]> = [\n [\"tighten-episode\", \"video\"], // unit:tighten-episode\n [\"episode-chapters\", \"text\"], // unit:episode-chapters\n [\"clip-pack\", \"video\"], // unit:clip-pack\n]\n\n// The outputs an \"each\" edge reads item by item when the unit ran once per item, and the pip an edge naming none reads (contract.fanOutEach) — producer-types.ts.\nexport const UNIT_FAN_OUT_EACH: ReadonlyArray<readonly [type: string, handles: { readonly each: ReadonlyArray<string>; readonly primary: string }]> = [\n [\"episode-trailer\", { \"each\": [\"media\"], \"primary\": \"media\" }], // unit:episode-trailer\n [\"clip-pack\", { \"each\": [\"clips\"], \"primary\": \"clips\" }], // unit:clip-pack\n]\n","/**\n * The node units' rows in @nodaro/shared (tools/units/README.md): the readers\n * of `generated/unit-contracts.ts` and the one rule every table that composes\n * them keeps — a type is hand-written or a node unit, never both. Internal:\n * no entry exports this module, so it adds nothing to the published surface;\n * the tables that compose its rows (producer-types, presentation-utils,\n * json-kinds, fan-out-rows, preview-gate) are what consumers read.\n */\nimport { UNIT_CONTRACTS, UNIT_FAN_OUT_EACH, UNIT_JSON_PIPS, UNIT_NON_PROMPT_INPUTS, UNIT_PRESENTS, UNIT_REVIEW_HOLDS } from \"./generated/unit-contracts.js\"\n\n/**\n * `legacy ∪ units` as a set, `legacy` first, refusing a type that is in both —\n * a type lives in one place (G1; the editor's and the server's composeSet keep\n * the same rule). Throws at module load, so any import of the set fails.\n */\nexport function composeUnitSet(what: string, legacy: readonly string[], units: readonly string[]): ReadonlySet<string> {\n const clash = units.filter((t) => legacy.includes(t))\n if (clash.length > 0) throw new Error(`${what}: ${clash.join(\", \")} is both hand-written and a node unit — a type lives in one place (tools/units/README.md)`)\n return new Set([...legacy, ...units])\n}\n\n/**\n * `legacy` with each unit row added after it, refusing a type that is in both\n * or a unit row given twice — the record twin of `composeUnitSet`. Throws at\n * module load, so any import of the record fails.\n */\nexport function composeUnitRecord<V>(what: string, legacy: Readonly<Record<string, V>>, units: ReadonlyArray<readonly [string, V]>): Readonly<Record<string, V>> {\n const out: Record<string, V> = { ...legacy }\n for (const [type, value] of units) {\n if (Object.hasOwn(legacy, type)) throw new Error(`${what}: ${type} is both hand-written and a node unit — a type lives in one place (tools/units/README.md)`)\n if (Object.hasOwn(out, type)) throw new Error(`${what}: node unit ${type} has more than one row`)\n out[type] = value\n }\n return out\n}\n\n/** The node units of one producer kind (`contract.producer`), in generated order. */\nexport const unitProducers = (kind: \"audio\" | \"video\" | \"image\" | \"dynamic\"): string[] =>\n UNIT_CONTRACTS.filter(([, producer]) => producer === kind).map(([type]) => type)\n\n/** The node units a published app shows as `kind` (`contract.presents`). */\nexport const unitsPresenting = (kind: \"image\" | \"video\" | \"audio\" | \"text\"): string[] =>\n UNIT_PRESENTS.filter(([, presents]) => presents === kind).map(([type]) => type)\n\n/** What each node unit's JSON (look) output pips carry (`contract.jsonPips`). */\nexport const unitJsonPips = (): ReadonlyArray<readonly [string, Readonly<Record<string, \"transcript\" | \"edl\" | \"other\">>]> => UNIT_JSON_PIPS\n\n/** Each node unit's input pips that are never a prompt lane (`contract.nonPromptInputs`). */\nexport const unitNonPromptInputs = (): ReadonlyArray<readonly [string, ReadonlyArray<string>]> => UNIT_NON_PROMPT_INPUTS\n\n/** The use-case units whose review-on run ends at a Preview that holds what follows (`contract.reviewHold`). */\nexport const unitReviewHolds = (): readonly string[] => UNIT_REVIEW_HOLDS\n\n/** Each node unit's fan-out \"each\" outputs and primary pip (`contract.fanOutEach`), in generated order. */\nexport const unitFanOutEach = (): ReadonlyArray<readonly [string, { readonly each: ReadonlyArray<string>; readonly primary: string }]> => UNIT_FAN_OUT_EACH\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/video-depth.ts"],"names":[],"mappings":";;;AAgBO,IAAM,qBAAA,GAAwB,CAAC,sBAAA,EAAwB,uBAAuB;AAG9E,IAAM,yBAAA,mBAAiD,IAAI,GAAA,CAAI,CAAC,sBAAsB,CAAC;AACvF,IAAM,+BAAA,mBAAuD,IAAI,GAAA,CAAI,CAAC,uBAAuB,CAAC;AAQ9F,SAAS,0BAA0B,GAAA,EAAkC;AAC1E,EAAA,OAAO,OAAO,QAAQ,QAAA,IAAa,qBAAA,CAA4C,SAAS,GAAG,CAAA,GACtF,GAAA,GACD,qBAAA,CAAsB,CAAC,CAAA;AAC7B;AAEO,IAAM,uBAAA,GAA0B,CAAC,OAAA,EAAS,MAAA,EAAQ,OAAO;AAIzD,SAAS,2BAA2B,GAAA,EAAmC;AAC5E,EAAA,OAAO,OAAO,GAAA,KAAQ,QAAA,IAAa,wBAA8C,QAAA,CAAS,GAAG,IACxF,GAAA,GACD,OAAA;AACN;AACO,IAAM,wBAAwB,CAAC,WAAA,EAAa,OAAA,EAAS,SAAA,EAAW,SAAS,SAAS;AAElF,IAAM,0BAA0B,CAAC,MAAA,EAAQ,MAAA,EAAQ,MAAA,EAAQ,QAAQ,OAAO;AAI/E,IAAM,6BAA2C,IAAI,GAAA,CAAI,CAAC,UAAA,EAAY,YAAA,EAAc,YAAY,CAAC,CAAA;AACjG,IAAM,aAAA,mBAA8C,IAAI,GAAA,CAAI,CAAC,UAAU,CAAC,CAAA;AACxE,IAAM,SAAA,uBAA8C,GAAA,EAAI;AAGjD,SAAS,iBAAiB,QAAA,EAAgD;AAC/E,EAAA,IAAI,yBAAA,CAA0B,GAAA,CAAI,QAAQ,CAAA,EAAG,OAAO,UAAA;AACpD,EAAA,IAAI,+BAAA,CAAgC,GAAA,CAAI,QAAQ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AI,EAAA,EAAI,EAAA,EAAI,KAAK,GAAG;AAGxD,SAAS,qBAAqB,QAAA,EAA0B;AACtD,EAAA,OAAO,gCAAgC,GAAA,CAAI,QAAQ,CAAA,GAC/C,kBAAA,CAAmB,wBACnB,kBAAA,CAAmB,eAAA;AACzB;AASO,SAAS,kBAAA,CAAmB,UAAkB,WAAA,EAAgD;AACnG,EAAA,MAAM,GAAA,GAAM,mBAAA,CAAoB,mBAAA,CAAoB,MAAA,GAAS,CAAC,CAAA;AAC9D,EAAA,MAAM,MAAA,GAAS,qBAAqB,QAAQ,CAAA;AAC5C,EAAA,MAAM,mBAAmB,mBAAA,CAAoB,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,IAAK,MAAM,CAAA,IAAK,GAAA;AACzE,EAAA,MAAM,KAAA,GAAQ,OAAO,WAAA,KAAgB,QAAA,IAAY,MAAA,CAAO,SAAS,WAAW,CAAA,IAAK,WAAA,GAAc,CAAA,IAAK,WAAA,IAAe,MAAA;AACnH,EAAA,MAAM,MAAA,GAAS,QAAS,mBAAA,CAAoB,IAAA,CAAK,CAAC,CAAA,KAAM,WAAA,IAAe,CAAC,CAAA,IAAK,GAAA,GAAO,gBAAA;AACpF,EAAA,OAAO,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,MAAM,CAAA,CAAA,CAAA;AAC9B","file":"chunk-6DAWSVX2.cjs","sourcesContent":["/**\n * Video Depth — the one contract every layer reads: which providers exist and\n * which lane serves each, which optional levers a provider honours, how long a\n * clip may be, and which price row a run is charged from.\n *\n * Colormaps: fal renders every `VIDEO_DEPTH_COLORMAPS` entry natively. The\n * Replicate model's native output is inferno-colorized, so it offers only\n * `inferno` (passed through as-is) and `grayscale`, which a worker ffmpeg pass\n * produces from the inferno output (`videoDepthNeedsGrayscalePass`).\n *\n * Price rows are `model_pricing` rows (`<provider>:<n>s`); the credit amounts\n * live there, never here. Worked examples (repeated in\n * docs/nodes/processing-video/video-depth.md):\n * 5 s → `:15s`, 15 s → `:15s`, 15.01 s → `:30s`, 61 s → `:120s`.\n */\n\nexport const VIDEO_DEPTH_PROVIDERS = [\"video-depth-anything\", \"depth-anything-frames\"] as const\nexport type VideoDepthProvider = (typeof VIDEO_DEPTH_PROVIDERS)[number]\n\nexport const FAL_VIDEO_DEPTH_PROVIDERS: ReadonlySet<string> = new Set([\"video-depth-anything\"])\nexport const REPLICATE_VIDEO_DEPTH_PROVIDERS: ReadonlySet<string> = new Set([\"depth-anything-frames\"])\n\n/**\n * The provider a run uses: `raw` when it is a Video Depth provider, else the\n * default (the first entry). Raw workflow JSON or a FieldMapping can carry any\n * value; the dispatch, the model deny and the price row all read this one\n * resolution, so an unknown id never reaches a price row or slips the deny.\n */\nexport function resolveVideoDepthProvider(raw: unknown): VideoDepthProvider {\n return typeof raw === \"string\" && (VIDEO_DEPTH_PROVIDERS as readonly string[]).includes(raw)\n ? (raw as VideoDepthProvider)\n : VIDEO_DEPTH_PROVIDERS[0]\n}\n\nexport const VIDEO_DEPTH_MODEL_SIZES = [\"small\", \"base\", \"large\"] as const\nexport type VideoDepthModelSize = (typeof VIDEO_DEPTH_MODEL_SIZES)[number]\n\n/** The model size a run uses: `raw` when it is one, else `large` (the providers index lookup tables with it). */\nexport function resolveVideoDepthModelSize(raw: unknown): VideoDepthModelSize {\n return typeof raw === \"string\" && (VIDEO_DEPTH_MODEL_SIZES as readonly string[]).includes(raw)\n ? (raw as VideoDepthModelSize)\n : \"large\"\n}\nexport const VIDEO_DEPTH_COLORMAPS = [\"grayscale\", \"turbo\", \"inferno\", \"magma\", \"viridis\"] as const\nexport type VideoDepthColormap = (typeof VIDEO_DEPTH_COLORMAPS)[number]\nexport const VIDEO_DEPTH_RESOLUTIONS = [\"auto\", \"360p\", \"480p\", \"720p\", \"1080p\"] as const\nexport type VideoDepthResolution = (typeof VIDEO_DEPTH_RESOLUTIONS)[number]\n\nexport type VideoDepthLever = \"colormap\" | \"resolution\" | \"sideBySide\"\nconst ALL_LEVERS: ReadonlySet<VideoDepthLever> = new Set([\"colormap\", \"resolution\", \"sideBySide\"])\nconst COLORMAP_ONLY: ReadonlySet<VideoDepthLever> = new Set([\"colormap\"])\nconst NO_LEVERS: ReadonlySet<VideoDepthLever> = new Set()\n\n/** The optional levers `provider` honours. A lever absent here is dropped, never sent. */\nexport function videoDepthLevers(provider: string): ReadonlySet<VideoDepthLever> {\n if (FAL_VIDEO_DEPTH_PROVIDERS.has(provider)) return ALL_LEVERS\n if (REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)) return COLORMAP_ONLY\n return NO_LEVERS\n}\n\nconst REPLICATE_COLORMAPS: readonly VideoDepthColormap[] = [\"grayscale\", \"inferno\"]\n\n/** The colormaps `provider` can deliver, in display order; empty when it has no colormap lever. */\nexport function videoDepthColormaps(provider: string): readonly VideoDepthColormap[] {\n if (FAL_VIDEO_DEPTH_PROVIDERS.has(provider)) return VIDEO_DEPTH_COLORMAPS\n if (REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)) return REPLICATE_COLORMAPS\n return []\n}\n\n/** The colormap a run uses: the requested one when `provider` offers it, else `grayscale`; `undefined` when the provider has no colormap lever. Coerces, never throws. */\nexport function resolveVideoDepthColormap(provider: string, requested: unknown): VideoDepthColormap | undefined {\n if (!videoDepthLevers(provider).has(\"colormap\")) return undefined\n const offered = videoDepthColormaps(provider)\n return typeof requested === \"string\" && (offered as readonly string[]).includes(requested)\n ? (requested as VideoDepthColormap)\n : \"grayscale\"\n}\n\n/** True when the worker must turn the Replicate model's native inferno output into grayscale with ffmpeg. */\nexport function videoDepthNeedsGrayscalePass(provider: string, colormap: VideoDepthColormap | undefined): boolean {\n return REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider) && resolveVideoDepthColormap(provider, colormap) === \"grayscale\"\n}\n\nexport const VIDEO_DEPTH_LIMITS = {\n /** fal `max_frames` ceiling. */\n FAL_MAX_FRAMES: 2400,\n /** Longest clip the fal lane accepts, whatever its frame rate: the top price bucket (a low-fps clip under the frame limit can otherwise run past every price row). */\n FAL_MAX_SECONDS: 300,\n /** Frame rate assumed when the clip reports none (variable-rate or missing). */\n ASSUMED_FPS: 30,\n /** Longest clip the Replicate lane accepts. */\n REPLICATE_MAX_SECONDS: 80,\n} as const\n\nconst fmt = (n: number): string => n.toLocaleString(\"en-US\")\n\n/** Refuse a clip the provider cannot take — run BEFORE any credit reservation. */\nexport function checkVideoDepthLength(\n provider: string,\n probe: { durationSec: number; fps?: number },\n): { ok: true } | { ok: false; message: string } {\n if (REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)) {\n if (probe.durationSec <= VIDEO_DEPTH_LIMITS.REPLICATE_MAX_SECONDS) return { ok: true }\n return {\n ok: false,\n message: `Video is ${Math.ceil(probe.durationSec)} s. This provider accepts at most ${VIDEO_DEPTH_LIMITS.REPLICATE_MAX_SECONDS} s.`,\n }\n }\n if (probe.durationSec > VIDEO_DEPTH_LIMITS.FAL_MAX_SECONDS) {\n return {\n ok: false,\n message: `Video is ${Math.ceil(probe.durationSec)} s. This provider accepts at most ${VIDEO_DEPTH_LIMITS.FAL_MAX_SECONDS} s. Trim the clip and run again.`,\n }\n }\n const assumed = !(typeof probe.fps === \"number\" && probe.fps > 0)\n const fps = assumed ? VIDEO_DEPTH_LIMITS.ASSUMED_FPS : (probe.fps as number)\n const frames = Math.ceil(probe.durationSec * fps - 1e-9)\n if (frames <= VIDEO_DEPTH_LIMITS.FAL_MAX_FRAMES) return { ok: true }\n const maxSec = Math.floor(VIDEO_DEPTH_LIMITS.FAL_MAX_FRAMES / fps)\n return {\n ok: false,\n message:\n `Video is ${fmt(frames)} frames; the limit is ${fmt(VIDEO_DEPTH_LIMITS.FAL_MAX_FRAMES)} ` +\n `(about ${maxSec} s at ${Math.round(fps)} fps${assumed ? \", assumed 30 fps because the clip reports no frame rate\" : \"\"}). Trim the clip and run again.`,\n }\n}\n\nexport const VIDEO_DEPTH_BUCKETS = [15, 30, 60, 120, 300] as const\n\n/** The longest clip `provider` accepts (`checkVideoDepthLength`); the fal limit for anything else. */\nfunction videoDepthMaxSeconds(provider: string): number {\n return REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)\n ? VIDEO_DEPTH_LIMITS.REPLICATE_MAX_SECONDS\n : VIDEO_DEPTH_LIMITS.FAL_MAX_SECONDS\n}\n\n/**\n * The price row for a clip of `durationSec`. Unknown, non-positive or longer\n * than the provider accepts → the provider's highest REACHABLE row: the\n * smallest bucket at or above its longest clip (Replicate 80 s → `:120s`,\n * fal 300 s → `:300s`) — the most a run on it can be charged, never a row a\n * run could not reach.\n */\nexport function videoDepthCreditId(provider: string, durationSec: number | null | undefined): string {\n const top = VIDEO_DEPTH_BUCKETS[VIDEO_DEPTH_BUCKETS.length - 1]\n const maxSec = videoDepthMaxSeconds(provider)\n const reachableCeiling = VIDEO_DEPTH_BUCKETS.find((b) => b >= maxSec) ?? top\n const known = typeof durationSec === \"number\" && Number.isFinite(durationSec) && durationSec > 0 && durationSec <= maxSec\n const bucket = known ? (VIDEO_DEPTH_BUCKETS.find((b) => durationSec <= b) ?? top) : reachableCeiling\n return `${provider}:${bucket}s`\n}\n"]}
|