@nodaro/shared 3.26.0 → 3.27.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 +410 -163
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +269 -24
- package/dist/index.d.ts +269 -24
- package/dist/index.js +391 -164
- 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__/render-nodes.test.ts +46 -1
- package/src/__tests__/transcribe-preflight.test.ts +5 -0
- package/src/camera-switch-contract.ts +9 -6
- package/src/collections.ts +72 -2
- package/src/credit-identifiers.ts +56 -13
- package/src/edl.ts +143 -23
- package/src/fan-out-rows.ts +1 -1
- package/src/i18n/camera-format.ko.ts +3 -3
- package/src/index.ts +28 -0
- package/src/json-kinds.ts +11 -6
- package/src/llm-models.ts +87 -2
- package/src/model-catalog.ts +106 -4
- package/src/model-constants.ts +2 -1
- 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/producer-types.ts +4 -0
- package/src/render-nodes.ts +58 -2
- package/src/transcribe-preflight.ts +11 -10
|
@@ -37,6 +37,11 @@ describe("findWordlessTranscriptFeeds", () => {
|
|
|
37
37
|
)
|
|
38
38
|
expect(hits.map((h) => h.consumerNodeId)).toEqual(["c"])
|
|
39
39
|
})
|
|
40
|
+
it("follows the transcript THROUGH speaker-view (transcript in → its own transcript out, decided 2026-10-08), never its EDL json", () => {
|
|
41
|
+
const nodes = [n("t", "transcribe", { provider: "whisper" }), n("sv", "speaker-view"), n("c", "add-captions")]
|
|
42
|
+
expect(findWordlessTranscriptFeeds(nodes, [e("t", "json", "sv", "transcript"), e("sv", "transcript", "c", "transcript")]).map((h) => h.consumerNodeId)).toEqual(["c"])
|
|
43
|
+
expect(findWordlessTranscriptFeeds(nodes, [e("t", "json", "sv", "transcript"), e("sv", "json", "c", "transcript")])).toEqual([])
|
|
44
|
+
})
|
|
40
45
|
it("does NOT flag a word-capable lane, the text handle, or a non-caption consumer", () => {
|
|
41
46
|
const nodes = [n("ok", "transcribe", { provider: "elevenlabs-stt" }), n("w", "transcribe", { provider: "whisper" }), n("c", "add-captions"), n("p", "edit-plan")]
|
|
42
47
|
expect(findWordlessTranscriptFeeds(nodes, [e("ok", "json", "c", "transcript")])).toEqual([])
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* screen is decided by the Cloud plugin; these only read the inputs it needs
|
|
5
5
|
* and pre-fill the speaker table. Pure, no I/O.
|
|
6
6
|
*/
|
|
7
|
+
import { normalizeTranscript } from "./edl.js"
|
|
7
8
|
|
|
8
9
|
/** The settings and their decided defaults (the plugin holds its own copy, D13). */
|
|
9
10
|
export const CAMERA_SWITCH_DEFAULTS = Object.freeze({
|
|
@@ -28,14 +29,16 @@ const parseMaybe = (raw: unknown): unknown => {
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
/** Distinct speaker labels of a transcript (an object or its JSON string), in
|
|
31
|
-
* order of first appearance
|
|
32
|
+
* order of first appearance in time. Read through `normalizeTranscript`
|
|
33
|
+
* (decided 2026-10-08) — the Cloud plugin's reading — so a broken word (no
|
|
34
|
+
* usable time) names no speaker here either; a zero-width word is a point
|
|
35
|
+
* and does. Empty → camera-switch refuses before charging. */
|
|
32
36
|
export function transcriptSpeakerLabels(transcript: unknown): string[] {
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
37
|
+
const parsed = parseMaybe(transcript)
|
|
38
|
+
if (!parsed || typeof parsed !== "object") return []
|
|
35
39
|
const seen = new Set<string>()
|
|
36
|
-
for (const w of words) {
|
|
37
|
-
|
|
38
|
-
if (typeof s === "string" && s && !seen.has(s)) seen.add(s)
|
|
40
|
+
for (const w of normalizeTranscript(parsed).words) {
|
|
41
|
+
if (w.speaker && !seen.has(w.speaker)) seen.add(w.speaker)
|
|
39
42
|
}
|
|
40
43
|
return [...seen]
|
|
41
44
|
}
|
package/src/collections.ts
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* read node, MCP and the CLI render records with.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { loneMediaUrlKind } from "./lone-media-url.js"
|
|
18
|
+
|
|
17
19
|
export const COLLECTION_NAME_MAX = 80
|
|
18
20
|
export const COLLECTION_DESCRIPTION_MAX = 500
|
|
19
21
|
export const COLLECTION_RECORD_TITLE_MAX = 500
|
|
@@ -77,21 +79,32 @@ export interface Collection {
|
|
|
77
79
|
readonly name: string
|
|
78
80
|
readonly description: string
|
|
79
81
|
readonly recordCount: number
|
|
82
|
+
/** How many of its records have been used (`usedAt` set) and are not in the Trash. On the one-collection read; a server before the usage migration leaves it out. */
|
|
83
|
+
readonly usedCount?: number
|
|
84
|
+
/** How many of its records are in the Trash. On the one-collection read; a server before the usage migration leaves it out. `recordCount` counts them too (they still count toward the cap). */
|
|
85
|
+
readonly trashCount?: number
|
|
80
86
|
readonly createdAt: string
|
|
81
87
|
readonly updatedAt: string
|
|
82
88
|
}
|
|
83
89
|
|
|
84
|
-
/** Where a record came from — a node in a run, or a direct write. */
|
|
90
|
+
/** Where a record came from — a node in a run, or a direct write. The same shape says who USED it. */
|
|
85
91
|
export interface CollectionRecordSource {
|
|
86
92
|
readonly via?: "api" | "mcp" | "node" | "ui"
|
|
87
93
|
readonly nodeType?: string
|
|
88
94
|
readonly workflowId?: string
|
|
89
95
|
readonly executionId?: string
|
|
90
96
|
readonly nodeId?: string
|
|
97
|
+
/** Read-side enrichment: the workflow's name and project, looked up when the records are listed. Ignored on a write. */
|
|
98
|
+
readonly workflowName?: string
|
|
99
|
+
readonly projectId?: string
|
|
91
100
|
}
|
|
92
101
|
|
|
93
102
|
export type CollectionFieldValue = string | number | boolean
|
|
94
103
|
|
|
104
|
+
/** Which records a list or a read returns: every record, the ones not used yet, or the ones used. */
|
|
105
|
+
export const COLLECTION_USAGES = ["all", "unused", "used"] as const
|
|
106
|
+
export type CollectionUsage = (typeof COLLECTION_USAGES)[number]
|
|
107
|
+
|
|
95
108
|
export interface CollectionRecord {
|
|
96
109
|
readonly id: string
|
|
97
110
|
readonly collectionId: string
|
|
@@ -104,6 +117,35 @@ export interface CollectionRecord {
|
|
|
104
117
|
readonly dedupeKey: string | null
|
|
105
118
|
readonly source: CollectionRecordSource
|
|
106
119
|
readonly createdAt: string
|
|
120
|
+
/** When the record was used (a Save to Collection node with "mark the item as used", the API, the page) — null until then. A server before the usage migration leaves it out. */
|
|
121
|
+
readonly usedAt?: string | null
|
|
122
|
+
/** Who used it, in the shape of `source`; empty until then. */
|
|
123
|
+
readonly usedBy?: CollectionRecordSource
|
|
124
|
+
/** When the record was moved to the Trash (a delete on the page, the API or the CLI); null while it is live. A server before the usage migration leaves it out. */
|
|
125
|
+
readonly deletedAt?: string | null
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Which records a list returns: the live ones (`active`, the default) or the ones in the Trash. Nodes, exports and MCP read the live ones only. */
|
|
129
|
+
export const COLLECTION_RECORD_STATUSES = ["active", "trash"] as const
|
|
130
|
+
export type CollectionRecordStatus = (typeof COLLECTION_RECORD_STATUSES)[number]
|
|
131
|
+
|
|
132
|
+
/** The most records one bulk call (`POST /v1/collections/:id/records/bulk`) touches. */
|
|
133
|
+
export const COLLECTION_BULK_MAX = 100
|
|
134
|
+
/** The actions of a bulk call: move the records to the Trash, bring them back, or delete records already in the Trash for good. */
|
|
135
|
+
export const COLLECTION_BULK_ACTIONS = ["trash", "restore", "delete"] as const
|
|
136
|
+
export type CollectionBulkAction = (typeof COLLECTION_BULK_ACTIONS)[number]
|
|
137
|
+
/** The most records a numbered page may skip (`offset`) — past any page a person turns to, within the largest cap. */
|
|
138
|
+
export const COLLECTION_RECORDS_OFFSET_MAX = 1_000_000
|
|
139
|
+
|
|
140
|
+
/** The body of `POST /v1/collections/:id/records/bulk`. */
|
|
141
|
+
export type BulkCollectionRecordsInput = {
|
|
142
|
+
readonly ids: readonly string[]
|
|
143
|
+
readonly action: CollectionBulkAction
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface BulkCollectionRecordsResult {
|
|
147
|
+
/** How many of the ids were the caller's records in that collection and changed (a record already in the asked state is not counted). */
|
|
148
|
+
readonly updated: number
|
|
107
149
|
}
|
|
108
150
|
|
|
109
151
|
/** The caller's limits as the API quotes them: `null` is "no limit" (a
|
|
@@ -139,15 +181,34 @@ export type ListCollectionRecordsParams = {
|
|
|
139
181
|
readonly q?: string
|
|
140
182
|
/** Only records saved at or after this ISO timestamp (date and time). */
|
|
141
183
|
readonly since?: string
|
|
142
|
-
/**
|
|
184
|
+
/** Only records saved before this ISO timestamp (date and time). */
|
|
185
|
+
readonly until?: string
|
|
186
|
+
/** `all` (default), `unused` (not used yet) or `used`. */
|
|
187
|
+
readonly usage?: CollectionUsage
|
|
188
|
+
/** `newest` (default) or `oldest` first. */
|
|
189
|
+
readonly order?: "newest" | "oldest"
|
|
190
|
+
/** `active` (default: the live records) or `trash`. */
|
|
191
|
+
readonly status?: CollectionRecordStatus
|
|
192
|
+
/** The `nextCursor` of the previous page. Not together with `offset`. */
|
|
143
193
|
readonly cursor?: string
|
|
194
|
+
/** Skip this many records first (0–`COLLECTION_RECORDS_OFFSET_MAX`; a numbered page is `offset = (page - 1) × limit`). Not together with `cursor`; the result then carries `total`. */
|
|
195
|
+
readonly offset?: number
|
|
144
196
|
/** 1–100, default 50. */
|
|
145
197
|
readonly limit?: number
|
|
146
198
|
}
|
|
147
199
|
|
|
200
|
+
/** The body of `PATCH /v1/collections/:id/records/:recordId`: mark a record used (or not used again). */
|
|
201
|
+
export type SetCollectionRecordUsedInput = {
|
|
202
|
+
readonly used: boolean
|
|
203
|
+
/** Who is marking it; the API fills `via` when absent. */
|
|
204
|
+
readonly source?: CollectionRecordSource
|
|
205
|
+
}
|
|
206
|
+
|
|
148
207
|
export interface ListCollectionRecordsResult {
|
|
149
208
|
readonly data: readonly CollectionRecord[]
|
|
150
209
|
readonly nextCursor: string | null
|
|
210
|
+
/** How many records match the filters in all (a numbered page is `ceil(total / limit)` pages). Only on a page asked for by `offset`, and left out when the server could not count. */
|
|
211
|
+
readonly total?: number
|
|
151
212
|
}
|
|
152
213
|
|
|
153
214
|
/** The body of `POST /v1/collections/:id/records`. An explicit field wins over
|
|
@@ -437,9 +498,18 @@ function mediaFromItem(item: Record<string, unknown>): CollectionMedia[] {
|
|
|
437
498
|
for (const key of IMAGE_KEYS) if (isHttpUrl(item[key]) && !push({ type: "image", url: item[key] as string })) break
|
|
438
499
|
for (const key of VIDEO_KEYS) if (isHttpUrl(item[key]) && !push({ type: "video", url: item[key] as string })) break
|
|
439
500
|
for (const key of AUDIO_KEYS) if (isHttpUrl(item[key]) && !push({ type: "audio", url: item[key] as string })) break
|
|
501
|
+
// A `mediaUrl` whose kind sits beside it (`mediaKind`: image / photo / video / audio), else read off the
|
|
502
|
+
// file's ending, else a plain link. Both keys stay fields as well: a workflow may read them there.
|
|
503
|
+
if (isHttpUrl(item.mediaUrl)) push({ type: mediaKindOf(item.mediaKind, item.mediaUrl), url: item.mediaUrl })
|
|
440
504
|
return out
|
|
441
505
|
}
|
|
442
506
|
|
|
507
|
+
function mediaKindOf(kind: unknown, url: string): CollectionMediaType {
|
|
508
|
+
if (kind === "photo" || kind === "image") return "image"
|
|
509
|
+
if (kind === "video" || kind === "audio") return kind
|
|
510
|
+
return loneMediaUrlKind(url) ?? "link"
|
|
511
|
+
}
|
|
512
|
+
|
|
443
513
|
/**
|
|
444
514
|
* A record read out of any JSON item — a Telegram post, a Social Search
|
|
445
515
|
* result, an LLM's object, a plain string. Title ← title / headline / name;
|
|
@@ -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
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
})
|
|
219
|
+
const modelId = normalizedImageGenModelId(opts)
|
|
220
|
+
|
|
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(
|
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,7 +41,7 @@ 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
46
|
silence: ["edit-plan"],
|
|
47
47
|
offsets: ["edit-plan"],
|
|
@@ -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,
|
|
@@ -401,6 +403,8 @@ export {
|
|
|
401
403
|
isVideoAnalysisMixedTier,
|
|
402
404
|
resolveVideoAnalysisModel,
|
|
403
405
|
LLM_FEATURE_DEFAULTS,
|
|
406
|
+
LLM_FEATURE_DEFAULT_EFFORTS,
|
|
407
|
+
defaultReasoningEffort,
|
|
404
408
|
LLM_MODALITY_CAPS,
|
|
405
409
|
LLM_REASONING_EFFORTS,
|
|
406
410
|
EFFORT_TIER_BUMP,
|
|
@@ -767,6 +771,12 @@ export {
|
|
|
767
771
|
isRenderNodeType,
|
|
768
772
|
rendersLatestBatch,
|
|
769
773
|
rendersTranscriptJson,
|
|
774
|
+
RENDER_JSON_HANDLE,
|
|
775
|
+
renderTranscriptOutputOf,
|
|
776
|
+
isRenderDataHandle,
|
|
777
|
+
renderSavedJsonOutputs,
|
|
778
|
+
type RenderTranscriptOutput,
|
|
779
|
+
type RenderSavedJsonOutput,
|
|
770
780
|
type RenderNodeDescriptor,
|
|
771
781
|
type RenderClockSource,
|
|
772
782
|
type RenderJsonKind,
|
|
@@ -1085,6 +1095,17 @@ export {
|
|
|
1085
1095
|
type CollectionDigestFormat,
|
|
1086
1096
|
type CollectionReadWindowUnit,
|
|
1087
1097
|
type CollectionReadOrder,
|
|
1098
|
+
COLLECTION_USAGES,
|
|
1099
|
+
type CollectionUsage,
|
|
1100
|
+
type SetCollectionRecordUsedInput,
|
|
1101
|
+
COLLECTION_RECORD_STATUSES,
|
|
1102
|
+
type CollectionRecordStatus,
|
|
1103
|
+
COLLECTION_BULK_MAX,
|
|
1104
|
+
COLLECTION_BULK_ACTIONS,
|
|
1105
|
+
COLLECTION_RECORDS_OFFSET_MAX,
|
|
1106
|
+
type CollectionBulkAction,
|
|
1107
|
+
type BulkCollectionRecordsInput,
|
|
1108
|
+
type BulkCollectionRecordsResult,
|
|
1088
1109
|
type IngestedRecord,
|
|
1089
1110
|
} from "./collections.js"
|
|
1090
1111
|
|
|
@@ -1291,6 +1312,9 @@ export {
|
|
|
1291
1312
|
normalizeVideoRequestParams,
|
|
1292
1313
|
fitAspectRatioToModel,
|
|
1293
1314
|
defaultResolutionFor,
|
|
1315
|
+
nearestCatalogAspectRatio,
|
|
1316
|
+
autoAspectNeedsSourceImage,
|
|
1317
|
+
isAutoAspectToken,
|
|
1294
1318
|
} from "./model-catalog.js"
|
|
1295
1319
|
export type {
|
|
1296
1320
|
NormalizedVideoRequest,
|
|
@@ -1305,6 +1329,8 @@ export type {
|
|
|
1305
1329
|
ModelMenuOption,
|
|
1306
1330
|
ModelInputAdjustment,
|
|
1307
1331
|
NormalizedModelInput,
|
|
1332
|
+
ModelInputContext,
|
|
1333
|
+
SourceImageSize,
|
|
1308
1334
|
TtsCapabilities,
|
|
1309
1335
|
TtsSettingLever,
|
|
1310
1336
|
} from "./model-catalog.js"
|
|
@@ -1638,6 +1664,8 @@ export type { ExecutionOutcome } from "./execution-outcome.js"
|
|
|
1638
1664
|
|
|
1639
1665
|
export {
|
|
1640
1666
|
MODEL_PARAM_NODE_TYPES,
|
|
1667
|
+
SOURCE_IMAGE_NODE_TYPES,
|
|
1668
|
+
AUTO_ASPECT_AT_RUN_NODE_TYPES,
|
|
1641
1669
|
normalizeNodeModelParams,
|
|
1642
1670
|
describeNodeAdjustments,
|
|
1643
1671
|
} from "./normalize-node-params.js"
|