@nodaro/shared 3.26.0 → 3.30.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 +726 -174
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +569 -34
- package/dist/index.d.ts +569 -34
- package/dist/index.js +667 -175
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/auto-aspect-source.test.ts +372 -0
- package/src/__tests__/camera-switch-contract.test.ts +10 -0
- package/src/__tests__/collections.test.ts +10 -0
- package/src/__tests__/edl.test.ts +319 -4
- package/src/__tests__/json-kinds.test.ts +11 -1
- package/src/__tests__/llm-models.test.ts +120 -8
- package/src/__tests__/pitch-tempo-pricing.test.ts +62 -0
- package/src/__tests__/render-nodes.test.ts +84 -5
- package/src/__tests__/transcribe-preflight.test.ts +5 -0
- package/src/__tests__/video-depth.test.ts +146 -0
- package/src/__tests__/video-mask.test.ts +77 -0
- package/src/camera-switch-contract.ts +9 -6
- package/src/collections.ts +72 -2
- package/src/credit-estimators/index.ts +10 -0
- package/src/credit-estimators/pitch-tempo.ts +68 -0
- package/src/credit-identifiers.ts +87 -19
- package/src/edl.ts +143 -23
- package/src/fan-out-rows.ts +3 -1
- package/src/i18n/camera-format.ko.ts +3 -3
- package/src/index.ts +35 -0
- package/src/json-kinds.ts +11 -6
- package/src/llm-models.ts +87 -2
- package/src/mask-composite.ts +108 -0
- package/src/model-catalog.ts +146 -4
- package/src/model-constants.ts +2 -1
- package/src/model-tree.ts +2 -0
- package/src/node-mappable-fields.ts +2 -0
- package/src/node-runtime-keys.ts +3 -0
- package/src/normalize-node-params.ts +47 -4
- package/src/pipeline-types.ts +16 -3
- package/src/presentation-utils.ts +3 -2
- package/src/producer-types.ts +13 -0
- package/src/render-nodes.ts +71 -6
- package/src/transcribe-preflight.ts +11 -10
- package/src/video-depth.ts +151 -0
- package/src/video-mask.ts +96 -0
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
import { isFlux2Model, FLUX2_RES_MP, type Flux2Model } from "./flux2-pricing.js"
|
|
32
32
|
import { VIDEO_DURATION_AUTO } from "./video-duration-auto.js"
|
|
33
33
|
import { uiResolutionFill } from "./video-ui-defaults.js"
|
|
34
|
-
import { MODEL_CATALOG, normalizeModelInput, defaultResolutionFor, type ModelInputAdjustment } from "./model-catalog.js"
|
|
34
|
+
import { MODEL_CATALOG, autoAspectNeedsSourceImage, normalizeModelInput, defaultResolutionFor, type ModelInputAdjustment, type SourceImageSize } from "./model-catalog.js"
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* The megapixel tier a Flux 2 credit identifier is keyed on, for ANY incoming
|
|
@@ -138,6 +138,42 @@ export interface NormalizedImageGen {
|
|
|
138
138
|
adjustments: ModelInputAdjustment[]
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
/**
|
|
142
|
+
* The catalog model `resolveNormalizedImageGen` snaps against: the provider
|
|
143
|
+
* (Nano Banana when none is named), or — with `swapToI2i` and references
|
|
144
|
+
* attached — its i2i sibling, the model the generate-image route and the
|
|
145
|
+
* workflow payload builder then send. That sibling has its OWN catalog entry
|
|
146
|
+
* and lever lists. Exported so a caller that has to decide something about
|
|
147
|
+
* those lists before the snap (whether a photo's size is worth reading) asks
|
|
148
|
+
* about the same model the snap will use.
|
|
149
|
+
*/
|
|
150
|
+
export function normalizedImageGenModelId(opts: {
|
|
151
|
+
provider: unknown
|
|
152
|
+
refCount: number
|
|
153
|
+
swapToI2i?: boolean
|
|
154
|
+
}): string {
|
|
155
|
+
const provider = typeof opts.provider === "string" && opts.provider.length > 0 ? opts.provider : "nano-banana"
|
|
156
|
+
return opts.swapToI2i && opts.refCount > 0 ? (T2I_TO_I2I_VARIANT[provider] ?? provider) : provider
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Whether "auto" on a Generate Image request can need its photo's size: the
|
|
161
|
+
* model the snap runs against (`normalizedImageGenModelId` with the swap on)
|
|
162
|
+
* has no native auto. Given the ASSEMBLED reference count, it asks about exactly
|
|
163
|
+
* that model; without one — a write boundary, or a run before its references
|
|
164
|
+
* assemble — about both the provider and its i2i sibling, since references may
|
|
165
|
+
* yet attach.
|
|
166
|
+
*/
|
|
167
|
+
export function imageGenAutoAspectNeedsSourceImage(opts: {
|
|
168
|
+
provider: unknown
|
|
169
|
+
aspectRatio: unknown
|
|
170
|
+
refCount?: number
|
|
171
|
+
}): boolean {
|
|
172
|
+
const asks = (refCount: number) =>
|
|
173
|
+
autoAspectNeedsSourceImage(normalizedImageGenModelId({ provider: opts.provider, refCount, swapToI2i: true }), opts.aspectRatio)
|
|
174
|
+
return opts.refCount === undefined ? asks(0) || asks(1) : asks(opts.refCount)
|
|
175
|
+
}
|
|
176
|
+
|
|
141
177
|
/**
|
|
142
178
|
* Snap an image request's catalog-governed levers to a combination the model
|
|
143
179
|
* actually accepts, and price the credit identifier off the SNAPPED values.
|
|
@@ -159,6 +195,13 @@ export interface NormalizedImageGen {
|
|
|
159
195
|
*
|
|
160
196
|
* Unknown model ids pass through untouched (same contract as
|
|
161
197
|
* `normalizeModelInput`) — the route's provider enum is the gate for those.
|
|
198
|
+
*
|
|
199
|
+
* `sourceImage` is the size of the photo the request transforms or is drawn
|
|
200
|
+
* from (an image-to-image / edit source, or Generate Image's first wired
|
|
201
|
+
* reference). It only decides "auto" on a model without a native auto, and the
|
|
202
|
+
* ratio is not a pricing dimension on any such model (pinned across the catalog
|
|
203
|
+
* by `auto-aspect-source.test.ts`), so a CHECK that runs before the size is
|
|
204
|
+
* known prices the same identifier as the DEBIT that knows it.
|
|
162
205
|
*/
|
|
163
206
|
export function resolveNormalizedImageGen(opts: {
|
|
164
207
|
provider: string | undefined
|
|
@@ -168,22 +211,22 @@ export function resolveNormalizedImageGen(opts: {
|
|
|
168
211
|
renderingSpeed?: unknown
|
|
169
212
|
refCount: number
|
|
170
213
|
swapToI2i?: boolean
|
|
214
|
+
sourceImage?: SourceImageSize
|
|
171
215
|
}): NormalizedImageGen {
|
|
172
216
|
const str = (v: unknown): string | undefined =>
|
|
173
217
|
typeof v === "string" && v.length > 0 ? v : undefined
|
|
174
218
|
|
|
175
|
-
const
|
|
176
|
-
// Same swap `resolveEffectiveProvider` applies in the route: refs attached to
|
|
177
|
-
// a bare T2I provider route the run to its i2i sibling, which has its OWN
|
|
178
|
-
// catalog entry and its own lever lists.
|
|
179
|
-
const modelId =
|
|
180
|
-
opts.swapToI2i && opts.refCount > 0 ? (T2I_TO_I2I_VARIANT[provider] ?? provider) : provider
|
|
219
|
+
const modelId = normalizedImageGenModelId(opts)
|
|
181
220
|
|
|
182
|
-
const n = normalizeModelInput(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
221
|
+
const n = normalizeModelInput(
|
|
222
|
+
modelId,
|
|
223
|
+
{
|
|
224
|
+
aspectRatio: str(opts.aspectRatio),
|
|
225
|
+
resolution: str(opts.resolution),
|
|
226
|
+
quality: str(opts.quality),
|
|
227
|
+
},
|
|
228
|
+
{ sourceImage: opts.sourceImage },
|
|
229
|
+
)
|
|
187
230
|
|
|
188
231
|
return {
|
|
189
232
|
identifier: buildCreditModelIdentifier(
|
|
@@ -675,14 +718,39 @@ export function applyEdlCreditId(quality: unknown): "apply-edl" | "apply-edl:pro
|
|
|
675
718
|
}
|
|
676
719
|
|
|
677
720
|
/**
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
* `
|
|
681
|
-
*
|
|
682
|
-
*
|
|
721
|
+
* Speaker View's price tiers (decided 2026-10-10, C4): a render is priced by
|
|
722
|
+
* how many speakers it composites at once. `standard` — at most two tiles on
|
|
723
|
+
* any segment and no zoom; `complex` — three to six tiles, or any zoom. Which
|
|
724
|
+
* tier a render is in is the render rule's to say (the app's
|
|
725
|
+
* `@nodaro/render-rules`), never this vocabulary's.
|
|
726
|
+
*/
|
|
727
|
+
export const SPEAKER_VIEW_PRICE_TIERS = ["standard", "complex"] as const
|
|
728
|
+
export type SpeakerViewPriceTier = (typeof SPEAKER_VIEW_PRICE_TIERS)[number]
|
|
729
|
+
|
|
730
|
+
export type SpeakerViewCreditId = "speaker-view" | "speaker-view:proxy" | "speaker-view:complex" | "speaker-view:complex:proxy"
|
|
731
|
+
|
|
732
|
+
/** Every id `speakerViewCreditId` can name. */
|
|
733
|
+
export const SPEAKER_VIEW_CREDIT_IDS: readonly SpeakerViewCreditId[] = Object.freeze([
|
|
734
|
+
"speaker-view",
|
|
735
|
+
"speaker-view:proxy",
|
|
736
|
+
"speaker-view:complex",
|
|
737
|
+
"speaker-view:complex:proxy",
|
|
738
|
+
] as const)
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* The credit id of a Speaker View render (F4, decided 2026-09-23; tiers
|
|
742
|
+
* decided 2026-10-10): a Preview (`quality` "proxy") reserves on its own row,
|
|
743
|
+
* anything else on the final's, and each in its price tier — `standard` on
|
|
744
|
+
* `speaker-view` / `speaker-view:proxy`, `complex` on `speaker-view:complex` /
|
|
745
|
+
* `speaker-view:complex:proxy`. A tier that is not exactly `standard` (absent
|
|
746
|
+
* included) names the `complex` row: a caller that cannot tell quotes high,
|
|
747
|
+
* never low. The job is always named `speaker-view`; only its credit id
|
|
748
|
+
* follows the quality and the tier.
|
|
683
749
|
*/
|
|
684
|
-
export function speakerViewCreditId(quality: unknown):
|
|
685
|
-
|
|
750
|
+
export function speakerViewCreditId(quality: unknown, tier?: unknown): SpeakerViewCreditId {
|
|
751
|
+
const proxy = quality === "proxy"
|
|
752
|
+
if (tier === "standard") return proxy ? "speaker-view:proxy" : "speaker-view"
|
|
753
|
+
return proxy ? "speaker-view:complex:proxy" : "speaker-view:complex"
|
|
686
754
|
}
|
|
687
755
|
|
|
688
756
|
/**
|
package/src/edl.ts
CHANGED
|
@@ -40,6 +40,11 @@ import type { EdlTargetAspect } from "./speaker-layouts.js"
|
|
|
40
40
|
* slot; `slots[].weight` (0..1, active = 1) replaces the design's
|
|
41
41
|
* `slots[].emphasis` so it no longer collides with `layout.emphasis`
|
|
42
42
|
* ({ style, durationMs }).
|
|
43
|
+
* - P3-8 FOLLOW (decided 2026-10-06, field added decided 2026-10-09): a
|
|
44
|
+
* slot a renderer framed on a face track names that track in
|
|
45
|
+
* `slots[].follow` (`EdlSlotFollow`). It records what the render followed;
|
|
46
|
+
* the path itself is recomputed from the tracks, and `slot.region` keeps a
|
|
47
|
+
* static region, so a reader that ignores `follow` still gets a sane frame.
|
|
43
48
|
*
|
|
44
49
|
* Time is INTEGER MILLISECONDS everywhere. There is no seconds→ms guessing
|
|
45
50
|
* (`normalizeEdl` never reinterprets a unit — an implausible value is a
|
|
@@ -80,6 +85,24 @@ export interface EdlSource {
|
|
|
80
85
|
readonly region?: EdlRegion
|
|
81
86
|
}
|
|
82
87
|
|
|
88
|
+
export type EdlSlotFollowMotion = "static" | "glide"
|
|
89
|
+
|
|
90
|
+
/** Module-private on purpose: the follow contract is types only (decided
|
|
91
|
+
* 2026-10-09), so no runtime value joins the published surface. */
|
|
92
|
+
const FOLLOW_MOTIONS = ["static", "glide"] as const satisfies readonly EdlSlotFollowMotion[]
|
|
93
|
+
const KNOWN_FOLLOW_MOTIONS: ReadonlySet<string> = new Set(FOLLOW_MOTIONS)
|
|
94
|
+
|
|
95
|
+
/** The face track a slot followed (P3-8). `sourceId` is the slot's own video
|
|
96
|
+
* source; `trackId` is a track id of the speaker-track set the render read
|
|
97
|
+
* (unique in that set); `motion` is how it followed: `static` = one region
|
|
98
|
+
* per segment from the track, `glide` = a moving crop along it. Additive and
|
|
99
|
+
* optional: an EDL without it is unchanged. */
|
|
100
|
+
export interface EdlSlotFollow {
|
|
101
|
+
readonly sourceId: string
|
|
102
|
+
readonly trackId: string
|
|
103
|
+
readonly motion: EdlSlotFollowMotion
|
|
104
|
+
}
|
|
105
|
+
|
|
83
106
|
/** How a segment is presented on screen (speaker-view, phase 2). `mode` and
|
|
84
107
|
* `transition.type` are ids from the `SPEAKER_LAYOUTS` / `SPEAKER_SWITCHES`
|
|
85
108
|
* registries (speaker-layouts.ts); `emphasis.style` is a `+`-joined set of
|
|
@@ -96,6 +119,9 @@ export interface EdlLayout {
|
|
|
96
119
|
/** D20: 0..1, the active slot = 1. (Was `emphasis`; renamed to avoid
|
|
97
120
|
* colliding with `layout.emphasis`.) */
|
|
98
121
|
readonly weight?: number
|
|
122
|
+
/** P3-8: the face track this slot followed. `region` then holds the
|
|
123
|
+
* static region an older reader draws. */
|
|
124
|
+
readonly follow?: EdlSlotFollow
|
|
99
125
|
}>
|
|
100
126
|
/** A "+"-joined set of "none" | "scale" | "border" | "dim" | …, eased over durationMs. */
|
|
101
127
|
readonly emphasis?: { readonly style: string; readonly durationMs: number }
|
|
@@ -189,6 +215,10 @@ export interface Transcript {
|
|
|
189
215
|
readonly text: string
|
|
190
216
|
readonly speaker?: string
|
|
191
217
|
}>
|
|
218
|
+
/** Raw speaker label → the display name the words and segments now carry,
|
|
219
|
+
* published by a node that renamed the speakers (Camera Switch), so a later
|
|
220
|
+
* node can still find a speaker's original label. Absent = not renamed. */
|
|
221
|
+
readonly speakerNames?: Readonly<Record<string, string>>
|
|
192
222
|
}
|
|
193
223
|
|
|
194
224
|
/** Duration (seconds) implied by a transcript — the LATEST word/segment `endMs`
|
|
@@ -421,6 +451,7 @@ export function validateEdl(edl: Edl): EdlValidation {
|
|
|
421
451
|
}
|
|
422
452
|
if (slot.weight !== undefined && !inRange(slot.weight)) issues.push(`${at}: slot.weight=${slot.weight} out of 0..1`)
|
|
423
453
|
if (slot.region) issues.push(...regionIssues(slot.region, `${at} slot "${slot.source}"`))
|
|
454
|
+
if (slot.follow) issues.push(...followIssues(slot.follow, slot.source, `${at} slot "${slot.source}"`))
|
|
424
455
|
}
|
|
425
456
|
})
|
|
426
457
|
|
|
@@ -501,13 +532,22 @@ export function outputMsToMasterMs(edl: Edl, outputMs: number): number | null {
|
|
|
501
532
|
|
|
502
533
|
/**
|
|
503
534
|
* Remap a transcript onto the rendered output: drop words that fall entirely
|
|
504
|
-
* in removed material, clip a word that straddles a cut to its kept part
|
|
505
|
-
*
|
|
535
|
+
* in removed material, clip a word that straddles a cut to its kept part (a
|
|
536
|
+
* word running across two TOUCHING segments — contiguous on both the master
|
|
537
|
+
* and the output clock — is not cut, and keeps its full length), and apply
|
|
538
|
+
* the source offset (via `transcript.sourceId`). Captions, chapters and
|
|
506
539
|
* clip offsets all depend on this one function.
|
|
507
540
|
*/
|
|
508
541
|
export function remapTranscriptThroughEdl(edl: Edl, transcript: Transcript): Transcript {
|
|
509
542
|
const off = offsetFor(edl, transcript.sourceId)
|
|
510
543
|
const starts = segmentOutputStarts(edl)
|
|
544
|
+
/** Segment `j + 1` continues segment `j` on BOTH clocks: master time with no
|
|
545
|
+
* jump, output time with no overlap. */
|
|
546
|
+
const touches = (j: number): boolean => {
|
|
547
|
+
const a = edl.segments[j]
|
|
548
|
+
const b = edl.segments[j + 1]
|
|
549
|
+
return b.inMs === a.outMs && starts[j + 1] === starts[j] + Math.max(0, a.outMs - a.inMs)
|
|
550
|
+
}
|
|
511
551
|
|
|
512
552
|
const mapWord = (w: Transcript["words"][number]): (Transcript["words"][number]) | null => {
|
|
513
553
|
const startMaster = w.startMs + off
|
|
@@ -525,12 +565,21 @@ export function remapTranscriptThroughEdl(edl: Edl, transcript: Transcript): Tra
|
|
|
525
565
|
return null
|
|
526
566
|
}
|
|
527
567
|
// Find the first kept segment that intersects [startMaster, endMaster) and
|
|
528
|
-
// clip the word to that kept part
|
|
568
|
+
// clip the word to that kept part — extended across every following
|
|
569
|
+
// segment that TOUCHES it (decided 2026-10-08): the next segment resumes
|
|
570
|
+
// the master clock exactly where this one ends and starts on the output
|
|
571
|
+
// exactly where this one ends (no overlap into it), so the word plays
|
|
572
|
+
// through unbroken and keeps its full length. A Speaker View turn split is
|
|
573
|
+
// the common case. A jump in the master clock, or a crossfade / xfade into
|
|
574
|
+
// the next segment, still clips the word to its first kept part.
|
|
529
575
|
for (let i = 0; i < edl.segments.length; i++) {
|
|
530
576
|
const seg = edl.segments[i]
|
|
531
577
|
const lo = Math.max(startMaster, seg.inMs)
|
|
532
|
-
|
|
578
|
+
let hi = Math.min(endMaster, seg.outMs)
|
|
533
579
|
if (lo < hi) {
|
|
580
|
+
for (let j = i; hi < endMaster && j + 1 < edl.segments.length && touches(j); j++) {
|
|
581
|
+
hi = Math.min(endMaster, edl.segments[j + 1].outMs)
|
|
582
|
+
}
|
|
534
583
|
return {
|
|
535
584
|
...w,
|
|
536
585
|
startMs: Math.round(starts[i] + (lo - seg.inMs)),
|
|
@@ -701,6 +750,32 @@ export function normalizeEdl(input: unknown): Edl {
|
|
|
701
750
|
}
|
|
702
751
|
}
|
|
703
752
|
|
|
753
|
+
/** A slot's `follow` is structurally sound: the slot's own source (the crop
|
|
754
|
+
* is on that frame — a follow of another camera cannot describe the render),
|
|
755
|
+
* a track id, a known motion. */
|
|
756
|
+
function followIssues(follow: EdlSlotFollow, slotSource: string, at: string): string[] {
|
|
757
|
+
const f = follow as unknown as Record<string, unknown>
|
|
758
|
+
const issues: string[] = []
|
|
759
|
+
if (f.sourceId !== slotSource) issues.push(`${at}: follow.sourceId ${JSON.stringify(f.sourceId)} is not the slot's source "${slotSource}"`)
|
|
760
|
+
if (typeof f.trackId !== "string" || !f.trackId.trim()) issues.push(`${at}: follow.trackId is empty`)
|
|
761
|
+
if (typeof f.motion !== "string" || !KNOWN_FOLLOW_MOTIONS.has(f.motion)) {
|
|
762
|
+
issues.push(`${at}: follow.motion ${JSON.stringify(f.motion)} is not one of ${FOLLOW_MOTIONS.join(", ")}`)
|
|
763
|
+
}
|
|
764
|
+
return issues
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/** `follow` with its three fields, unknown keys dropped; undefined when any
|
|
768
|
+
* field is missing or malformed (never guessed: an unknown motion is not a
|
|
769
|
+
* motion this contract can describe). */
|
|
770
|
+
function normalizeFollow(input: unknown): EdlSlotFollow | undefined {
|
|
771
|
+
if (!input || typeof input !== "object") return undefined
|
|
772
|
+
const o = input as Record<string, unknown>
|
|
773
|
+
const sourceId = str(o.sourceId)
|
|
774
|
+
const trackId = str(o.trackId)
|
|
775
|
+
if (!sourceId || !trackId || typeof o.motion !== "string" || !KNOWN_FOLLOW_MOTIONS.has(o.motion)) return undefined
|
|
776
|
+
return { sourceId, trackId, motion: o.motion as EdlSlotFollowMotion }
|
|
777
|
+
}
|
|
778
|
+
|
|
704
779
|
function normalizeLayout(input: unknown, dropTransition = false): EdlLayout | undefined {
|
|
705
780
|
if (!input || typeof input !== "object") return undefined
|
|
706
781
|
const o = input as Record<string, unknown>
|
|
@@ -715,11 +790,13 @@ function normalizeLayout(input: unknown, dropTransition = false): EdlLayout | un
|
|
|
715
790
|
const source = str(s.source)
|
|
716
791
|
if (!source) return null
|
|
717
792
|
const region = normalizeRegion(s.region)
|
|
793
|
+
const follow = normalizeFollow(s.follow)
|
|
718
794
|
return {
|
|
719
795
|
source,
|
|
720
796
|
...(region ? { region } : {}),
|
|
721
797
|
...(str(s.speaker) ? { speaker: str(s.speaker) } : {}),
|
|
722
798
|
...(s.weight !== undefined ? { weight: clamp01(num(s.weight)) } : {}),
|
|
799
|
+
...(follow ? { follow } : {}),
|
|
723
800
|
}
|
|
724
801
|
})
|
|
725
802
|
.filter((x): x is NonNullable<typeof x> => x !== null)
|
|
@@ -738,36 +815,79 @@ function normalizeLayout(input: unknown, dropTransition = false): EdlLayout | un
|
|
|
738
815
|
}
|
|
739
816
|
}
|
|
740
817
|
|
|
741
|
-
/**
|
|
818
|
+
/** A time field as integer ms: a finite, non-negative number or numeric
|
|
819
|
+
* string; `undefined` for anything else. */
|
|
820
|
+
function timeMs(v: unknown): number | undefined {
|
|
821
|
+
const n = typeof v === "number" ? v : typeof v === "string" && v.trim() !== "" ? Number(v) : Number.NaN
|
|
822
|
+
return Number.isFinite(n) && n >= 0 ? Math.round(n) : undefined
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/** A word's or segment's span: `startMs`/`endMs` (or the `start`/`end`
|
|
826
|
+
* aliases). A zero-width span is a point and is kept; `undefined` only for a
|
|
827
|
+
* broken one — a missing or unusable time, or an end before its start. */
|
|
828
|
+
function spanMs(o: Record<string, unknown>): { startMs: number; endMs: number } | undefined {
|
|
829
|
+
const startMs = timeMs(o.startMs ?? o.start)
|
|
830
|
+
const endMs = timeMs(o.endMs ?? o.end)
|
|
831
|
+
if (startMs === undefined || endMs === undefined || endMs < startMs) return undefined
|
|
832
|
+
return { startMs, endMs }
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Coerce an unknown value into a `Transcript` — THE transcript reader
|
|
837
|
+
* (decided 2026-10-08). The Cloud plugin's `coerceTranscript` reads by the
|
|
838
|
+
* same rule, so the app and the plugin read one transcript the same way.
|
|
839
|
+
* ms-only, as `normalizeEdl`; the `start`/`end` aliases are read when
|
|
840
|
+
* `startMs`/`endMs` are absent. A zero-width word or segment (also one that
|
|
841
|
+
* rounds to zero width) is a POINT and is kept, as before. Only a broken one
|
|
842
|
+
* is dropped, never clamped: a missing start or end, a time that is not a
|
|
843
|
+
* finite, non-negative number, or an end before its start. Words come out
|
|
844
|
+
* sorted by start time (stable). A renamed transcript's `speakerNames` map is
|
|
845
|
+
* kept (its non-empty string entries).
|
|
846
|
+
*/
|
|
742
847
|
export function normalizeTranscript(input: unknown): Transcript {
|
|
743
848
|
const o = (input && typeof input === "object" ? input : {}) as Record<string, unknown>
|
|
744
|
-
const words: Transcript["words"][number][] =
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
}
|
|
849
|
+
const words: Transcript["words"][number][] = []
|
|
850
|
+
if (Array.isArray(o.words)) {
|
|
851
|
+
for (const raw of o.words) {
|
|
852
|
+
if (!raw || typeof raw !== "object") continue
|
|
853
|
+
const w = raw as Record<string, unknown>
|
|
854
|
+
const span = spanMs(w)
|
|
855
|
+
if (!span) continue
|
|
856
|
+
words.push({
|
|
857
|
+
text: str(w.text) ?? "",
|
|
858
|
+
...span,
|
|
859
|
+
...(str(w.speaker) ? { speaker: str(w.speaker) } : {}),
|
|
860
|
+
...(typeof w.confidence === "number" ? { confidence: w.confidence } : {}),
|
|
757
861
|
})
|
|
758
|
-
|
|
862
|
+
}
|
|
863
|
+
words.sort((a, b) => a.startMs - b.startMs)
|
|
864
|
+
}
|
|
759
865
|
const segments = Array.isArray(o.segments)
|
|
760
|
-
? o.segments.
|
|
761
|
-
|
|
762
|
-
const
|
|
763
|
-
|
|
866
|
+
? o.segments.flatMap(raw => {
|
|
867
|
+
if (!raw || typeof raw !== "object") return []
|
|
868
|
+
const s = raw as Record<string, unknown>
|
|
869
|
+
const span = spanMs(s)
|
|
870
|
+
return span ? [{ ...span, text: str(s.text) ?? "", ...(str(s.speaker) ? { speaker: str(s.speaker) } : {}) }] : []
|
|
764
871
|
})
|
|
765
872
|
: undefined
|
|
873
|
+
const speakerNames = speakerNamesOf(o.speakerNames)
|
|
766
874
|
return {
|
|
767
875
|
version: EDL_VERSION,
|
|
768
876
|
...(str(o.sourceId) ? { sourceId: str(o.sourceId) } : {}),
|
|
769
877
|
...(str(o.language) ? { language: str(o.language) } : {}),
|
|
770
878
|
words,
|
|
771
879
|
...(segments ? { segments } : {}),
|
|
880
|
+
...(speakerNames ? { speakerNames } : {}),
|
|
772
881
|
}
|
|
773
882
|
}
|
|
883
|
+
|
|
884
|
+
/** A renamed transcript's raw → display map: entries whose label and name are
|
|
885
|
+
* both non-empty strings; undefined when none is left. Built with
|
|
886
|
+
* `Object.fromEntries`, so every label (even `__proto__`) stays an own entry. */
|
|
887
|
+
function speakerNamesOf(v: unknown): Record<string, string> | undefined {
|
|
888
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return undefined
|
|
889
|
+
const entries = Object.entries(v as Record<string, unknown>).filter(
|
|
890
|
+
(e): e is [string, string] => e[0].length > 0 && typeof e[1] === "string" && e[1].length > 0,
|
|
891
|
+
)
|
|
892
|
+
return entries.length > 0 ? Object.fromEntries(entries) : undefined
|
|
893
|
+
}
|
package/src/fan-out-rows.ts
CHANGED
|
@@ -41,8 +41,10 @@ export const NON_PROMPT_TEXT_LANES: Readonly<Record<string, "*" | readonly strin
|
|
|
41
41
|
negative: "*",
|
|
42
42
|
"system-prompt": "*",
|
|
43
43
|
script: ["ai-avatar"],
|
|
44
|
-
transcript: ["add-captions", "apply-edl", "edit-plan", "camera-switch", "speaker-view"],
|
|
44
|
+
transcript: ["add-captions", "apply-edl", "edit-plan", "camera-switch", "speaker-view", "speaker-frames"],
|
|
45
45
|
edl: ["apply-edl", "camera-switch", "speaker-view"],
|
|
46
|
+
// Speaker View's face tracks (Speaker Frames' descriptor): framing data, never a prompt.
|
|
47
|
+
tracks: ["speaker-view"],
|
|
46
48
|
silence: ["edit-plan"],
|
|
47
49
|
offsets: ["edit-plan"],
|
|
48
50
|
qrText: ["image-overlay"],
|
|
@@ -14,8 +14,8 @@ const map: LocaleCatalogMap = {
|
|
|
14
14
|
"dslr": { description: "선명한 DSLR 동영상 룩" },
|
|
15
15
|
"mirrorless-a7iii": { description: "모던 하이브리드 미러리스" },
|
|
16
16
|
"canon-r5": { description: "고해상도 패션 에디토리얼 미러리스" },
|
|
17
|
-
"hasselblad-medium-format": { description: "에디토리얼 미디엄 포맷" },
|
|
18
|
-
"leica-m-rangefinder": { description: "클래식 35mm 레인지파인더" },
|
|
17
|
+
"hasselblad-medium-format": { label: "Hasselblad 중형 포맷", description: "에디토리얼 미디엄 포맷" },
|
|
18
|
+
"leica-m-rangefinder": { label: "Leica M 레인지파인더", description: "클래식 35mm 레인지파인더" },
|
|
19
19
|
"voigtlander": { description: "부티크 레인지파인더 특유의 개성" },
|
|
20
20
|
"fuji-xt4": { description: "필름 느낌을 재현하는 Fuji 컬러" },
|
|
21
21
|
"drone-aerial": { label: "드론(항공)", description: "짐벌로 안정화한 부감 항공 촬영" },
|
|
@@ -28,7 +28,7 @@ const map: LocaleCatalogMap = {
|
|
|
28
28
|
"disposable-camera": { label: "일회용 카메라", description: "90년대/2000년대 일회용 필름" },
|
|
29
29
|
"toy-camera-holga": { label: "토이 카메라(Holga)", description: "Holga / Lomo 플라스틱 렌즈의 로파이 룩" },
|
|
30
30
|
"tintype-wet-plate": { label: "틴타입 / 습판", description: "빈티지 습판 콜로디온 기법" },
|
|
31
|
-
"daguerreotype": { description: "1840년대 은판 사진 기법" },
|
|
31
|
+
"daguerreotype": { label: "다게레오타입", description: "1840년대 은판 사진 기법" },
|
|
32
32
|
"security-cam": { label: "보안 카메라(CCTV)", description: "어안 렌즈와 타임스탬프 오버레이가 있는 CCTV 화면" },
|
|
33
33
|
"bw-film": { label: "흑백 필름", description: "흑백 필름 스톡" },
|
|
34
34
|
"iphone": { label: "iPhone", description: "모던한 폰 카메라 룩" },
|
package/src/index.ts
CHANGED
|
@@ -295,6 +295,8 @@ export {
|
|
|
295
295
|
buildCreditModelIdentifier,
|
|
296
296
|
resolveImageGenCreditIdentifier,
|
|
297
297
|
resolveNormalizedImageGen,
|
|
298
|
+
normalizedImageGenModelId,
|
|
299
|
+
imageGenAutoAspectNeedsSourceImage,
|
|
298
300
|
buildVideoCreditModelIdentifier,
|
|
299
301
|
seedanceVideoEditCreditId,
|
|
300
302
|
pricedVideoSelection,
|
|
@@ -302,6 +304,10 @@ export {
|
|
|
302
304
|
speedRampCreditId,
|
|
303
305
|
applyEdlCreditId,
|
|
304
306
|
speakerViewCreditId,
|
|
307
|
+
SPEAKER_VIEW_CREDIT_IDS,
|
|
308
|
+
SPEAKER_VIEW_PRICE_TIERS,
|
|
309
|
+
type SpeakerViewPriceTier,
|
|
310
|
+
type SpeakerViewCreditId,
|
|
305
311
|
sunoCreditType,
|
|
306
312
|
SUNO_VERSION_CREDIT_KEYS,
|
|
307
313
|
SUNO_VERSION_PRICED_OPERATIONS,
|
|
@@ -401,6 +407,8 @@ export {
|
|
|
401
407
|
isVideoAnalysisMixedTier,
|
|
402
408
|
resolveVideoAnalysisModel,
|
|
403
409
|
LLM_FEATURE_DEFAULTS,
|
|
410
|
+
LLM_FEATURE_DEFAULT_EFFORTS,
|
|
411
|
+
defaultReasoningEffort,
|
|
404
412
|
LLM_MODALITY_CAPS,
|
|
405
413
|
LLM_REASONING_EFFORTS,
|
|
406
414
|
EFFORT_TIER_BUMP,
|
|
@@ -546,6 +554,7 @@ export {
|
|
|
546
554
|
buildLipSyncCreditId,
|
|
547
555
|
} from "./lip-sync-pricing.js"
|
|
548
556
|
export type { LipSyncDurationBucket } from "./lip-sync-pricing.js"
|
|
557
|
+
export * from "./video-depth.js"
|
|
549
558
|
|
|
550
559
|
export { isFlux2Model, FLUX2_RES_MP } from "./flux2-pricing.js"
|
|
551
560
|
export type { Flux2Model } from "./flux2-pricing.js"
|
|
@@ -767,6 +776,12 @@ export {
|
|
|
767
776
|
isRenderNodeType,
|
|
768
777
|
rendersLatestBatch,
|
|
769
778
|
rendersTranscriptJson,
|
|
779
|
+
RENDER_JSON_HANDLE,
|
|
780
|
+
renderTranscriptOutputOf,
|
|
781
|
+
isRenderDataHandle,
|
|
782
|
+
renderSavedJsonOutputs,
|
|
783
|
+
type RenderTranscriptOutput,
|
|
784
|
+
type RenderSavedJsonOutput,
|
|
770
785
|
type RenderNodeDescriptor,
|
|
771
786
|
type RenderClockSource,
|
|
772
787
|
type RenderJsonKind,
|
|
@@ -1085,6 +1100,17 @@ export {
|
|
|
1085
1100
|
type CollectionDigestFormat,
|
|
1086
1101
|
type CollectionReadWindowUnit,
|
|
1087
1102
|
type CollectionReadOrder,
|
|
1103
|
+
COLLECTION_USAGES,
|
|
1104
|
+
type CollectionUsage,
|
|
1105
|
+
type SetCollectionRecordUsedInput,
|
|
1106
|
+
COLLECTION_RECORD_STATUSES,
|
|
1107
|
+
type CollectionRecordStatus,
|
|
1108
|
+
COLLECTION_BULK_MAX,
|
|
1109
|
+
COLLECTION_BULK_ACTIONS,
|
|
1110
|
+
COLLECTION_RECORDS_OFFSET_MAX,
|
|
1111
|
+
type CollectionBulkAction,
|
|
1112
|
+
type BulkCollectionRecordsInput,
|
|
1113
|
+
type BulkCollectionRecordsResult,
|
|
1088
1114
|
type IngestedRecord,
|
|
1089
1115
|
} from "./collections.js"
|
|
1090
1116
|
|
|
@@ -1291,6 +1317,9 @@ export {
|
|
|
1291
1317
|
normalizeVideoRequestParams,
|
|
1292
1318
|
fitAspectRatioToModel,
|
|
1293
1319
|
defaultResolutionFor,
|
|
1320
|
+
nearestCatalogAspectRatio,
|
|
1321
|
+
autoAspectNeedsSourceImage,
|
|
1322
|
+
isAutoAspectToken,
|
|
1294
1323
|
} from "./model-catalog.js"
|
|
1295
1324
|
export type {
|
|
1296
1325
|
NormalizedVideoRequest,
|
|
@@ -1305,6 +1334,8 @@ export type {
|
|
|
1305
1334
|
ModelMenuOption,
|
|
1306
1335
|
ModelInputAdjustment,
|
|
1307
1336
|
NormalizedModelInput,
|
|
1337
|
+
ModelInputContext,
|
|
1338
|
+
SourceImageSize,
|
|
1308
1339
|
TtsCapabilities,
|
|
1309
1340
|
TtsSettingLever,
|
|
1310
1341
|
} from "./model-catalog.js"
|
|
@@ -1638,6 +1669,8 @@ export type { ExecutionOutcome } from "./execution-outcome.js"
|
|
|
1638
1669
|
|
|
1639
1670
|
export {
|
|
1640
1671
|
MODEL_PARAM_NODE_TYPES,
|
|
1672
|
+
SOURCE_IMAGE_NODE_TYPES,
|
|
1673
|
+
AUTO_ASPECT_AT_RUN_NODE_TYPES,
|
|
1641
1674
|
normalizeNodeModelParams,
|
|
1642
1675
|
describeNodeAdjustments,
|
|
1643
1676
|
} from "./normalize-node-params.js"
|
|
@@ -1675,6 +1708,8 @@ export * from "./audio-fx-presets.js"
|
|
|
1675
1708
|
export * from "./supported-fonts.js"
|
|
1676
1709
|
export * from "./image-overlay-layers.js"
|
|
1677
1710
|
export * from "./video-overlay.js"
|
|
1711
|
+
export * from "./video-mask.js"
|
|
1712
|
+
export * from "./mask-composite.js"
|
|
1678
1713
|
export * from "./image-overlay-shapes.js"
|
|
1679
1714
|
export * from "./image-overlay-platforms.js"
|
|
1680
1715
|
// --- Shot-sequence visual elements (text/shape/image; shared with backend Zod validation) ---
|
package/src/json-kinds.ts
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* Output kinds are DATA, never a list of node names:
|
|
15
15
|
* - a render node's `json` pip answers its registry `jsonKind`
|
|
16
16
|
* (`RENDER_NODE_TYPES`), so a render registered later — Speaker View, whose
|
|
17
|
-
* json is an EDL — is covered by its own registry entry;
|
|
17
|
+
* json is an EDL — is covered by its own registry entry; its transcript pip
|
|
18
|
+
* (`transcriptOutput`, Speaker View's `transcript`) is a Transcript;
|
|
18
19
|
* - the other JSON producers declare a kind per output pip in
|
|
19
20
|
* `JSON_OUTPUT_KINDS` below. EVERY node with a JSON output declares one
|
|
20
21
|
* (decided 2026-10-08): `transcript`, `edl`, or `other` for JSON that is
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
* Input kinds follow the platform's handle vocabulary: a `transcript` pip
|
|
27
28
|
* expects a Transcript, an `edl` pip an EDL.
|
|
28
29
|
*/
|
|
29
|
-
import { RENDER_NODE_TYPES, type RenderNodeDescriptor } from "./render-nodes.js"
|
|
30
|
+
import { RENDER_JSON_HANDLE, RENDER_NODE_TYPES, type RenderNodeDescriptor } from "./render-nodes.js"
|
|
30
31
|
|
|
31
32
|
/** The two JSON shapes the platform's handle vocabulary tells apart. */
|
|
32
33
|
export type JsonKind = "transcript" | "edl"
|
|
@@ -52,6 +53,9 @@ const JSON_OUTPUT_KINDS: Readonly<Record<string, JsonOutputs>> = Object.freeze({
|
|
|
52
53
|
transcribe: { primary: "json", pips: { json: "transcript" } },
|
|
53
54
|
// Camera Switch: the switched edit and the renamed (still a Transcript) transcript.
|
|
54
55
|
"camera-switch": { primary: "edl", pips: { edl: "edl", transcript: "transcript" } },
|
|
56
|
+
// Speaker Frames: the stored track file's descriptor (P3-22) — neither a
|
|
57
|
+
// Transcript nor an EDL, read by Speaker View's `tracks` input (P3.9).
|
|
58
|
+
"speaker-frames": { primary: "tracks", pips: { tracks: "other" } },
|
|
55
59
|
// Text to Dialogue: the Transcript built from the model's own word timings (its default read is the audio).
|
|
56
60
|
"text-to-dialogue": { pips: { json: "transcript" } },
|
|
57
61
|
|
|
@@ -81,9 +85,6 @@ const JSON_OUTPUT_KINDS: Readonly<Record<string, JsonOutputs>> = Object.freeze({
|
|
|
81
85
|
"describe-to-picker": { primary: "picker-json", pips: { "picker-json": "other" } },
|
|
82
86
|
})
|
|
83
87
|
|
|
84
|
-
/** The pip a render's order reads/writes its json on. */
|
|
85
|
-
const RENDER_JSON_PIP = "json"
|
|
86
|
-
|
|
87
88
|
/** The input pips whose kind is fixed by the handle vocabulary. */
|
|
88
89
|
const JSON_INPUT_KINDS: Readonly<Record<string, JsonKind>> = Object.freeze({
|
|
89
90
|
transcript: "transcript",
|
|
@@ -107,7 +108,11 @@ export function declaredJsonOutput(
|
|
|
107
108
|
): JsonOutputDeclaration | undefined {
|
|
108
109
|
if (typeof nodeType !== "string") return undefined
|
|
109
110
|
const render = own(renders, nodeType)
|
|
110
|
-
if (render)
|
|
111
|
+
if (render) {
|
|
112
|
+
const pip = sourceHandle ?? RENDER_JSON_HANDLE
|
|
113
|
+
if (pip === RENDER_JSON_HANDLE) return render.jsonKind
|
|
114
|
+
return pip === render.transcriptOutput.handle ? "transcript" : undefined
|
|
115
|
+
}
|
|
111
116
|
const outputs = own(JSON_OUTPUT_KINDS, nodeType)
|
|
112
117
|
if (!outputs) return undefined
|
|
113
118
|
const pip = sourceHandle ?? outputs.primary
|