@nodaro/shared 3.21.0 → 3.24.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.
Files changed (84) hide show
  1. package/dist/index.cjs +2291 -195
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +1929 -75
  4. package/dist/index.d.ts +1929 -75
  5. package/dist/index.js +2123 -196
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/__tests__/add-captions-plan.test.ts +33 -0
  9. package/src/__tests__/caption-plan-parse.test.ts +23 -0
  10. package/src/__tests__/caption-segment-schema.test.ts +30 -0
  11. package/src/__tests__/collections.test.ts +253 -0
  12. package/src/__tests__/dialogue-capabilities.test.ts +157 -0
  13. package/src/__tests__/edit-plan-review.test.ts +70 -0
  14. package/src/__tests__/edl-clocks.test.ts +97 -0
  15. package/src/__tests__/edl.test.ts +34 -0
  16. package/src/__tests__/execution-outcome.test.ts +44 -0
  17. package/src/__tests__/fan-out-meta.test.ts +23 -0
  18. package/src/__tests__/fan-out-rows.test.ts +36 -0
  19. package/src/__tests__/fan-out-url-item.test.ts +44 -0
  20. package/src/__tests__/fixtures/speaker-tracks.fixtures.json +622 -0
  21. package/src/__tests__/input-field-extra-keys.test.ts +34 -0
  22. package/src/__tests__/list-consumers-fan-in.test.ts +40 -0
  23. package/src/__tests__/model-tree.test.ts +7 -0
  24. package/src/__tests__/node-pass-through.test.ts +23 -0
  25. package/src/__tests__/node-runtime-keys.test.ts +1 -0
  26. package/src/__tests__/picker-restrictions.test.ts +36 -0
  27. package/src/__tests__/preview-gate.test.ts +305 -0
  28. package/src/__tests__/render-basis.test.ts +176 -0
  29. package/src/__tests__/render-nodes.test.ts +73 -0
  30. package/src/__tests__/render-output.test.ts +392 -0
  31. package/src/__tests__/run-continuation.test.ts +32 -0
  32. package/src/__tests__/speaker-tracks.test.ts +474 -0
  33. package/src/__tests__/speech-pricing.test.ts +69 -0
  34. package/src/__tests__/telegram-channel.test.ts +91 -0
  35. package/src/__tests__/tts-capabilities.test.ts +81 -4
  36. package/src/__tests__/tts-neighbour-text.test.ts +19 -0
  37. package/src/__tests__/ugc-call-body.test.ts +38 -0
  38. package/src/__tests__/ugc-run-state.test.ts +68 -0
  39. package/src/__tests__/video-character-refs.test.ts +213 -0
  40. package/src/__tests__/video-overlay-layer-plan.test.ts +94 -0
  41. package/src/add-captions-plan.ts +50 -0
  42. package/src/caption-plan.ts +45 -0
  43. package/src/caption-segment-schema.ts +82 -0
  44. package/src/collections.ts +482 -0
  45. package/src/competitors.ts +77 -0
  46. package/src/credit-estimators/index.ts +9 -0
  47. package/src/credit-estimators/speech.ts +51 -0
  48. package/src/dialogue-capabilities.ts +48 -0
  49. package/src/edit-plan-contract.ts +20 -9
  50. package/src/edit-plan-review.ts +40 -1
  51. package/src/edl.ts +27 -1
  52. package/src/execution-outcome.ts +41 -0
  53. package/src/fan-out-meta.ts +23 -0
  54. package/src/fan-out-rows.ts +74 -5
  55. package/src/gemini-omni-voices.ts +59 -0
  56. package/src/handle-aliases.ts +298 -0
  57. package/src/i18n/camera-motions.pt-BR.ts +14 -14
  58. package/src/i18n/transitions.pt-BR.ts +13 -13
  59. package/src/index.ts +180 -1
  60. package/src/model-catalog.ts +122 -13
  61. package/src/model-constants.ts +24 -4
  62. package/src/model-tree.ts +5 -1
  63. package/src/node-execution-state.ts +13 -0
  64. package/src/node-mappable-fields.ts +7 -1
  65. package/src/node-pass-through.ts +37 -0
  66. package/src/node-runtime-keys.ts +14 -0
  67. package/src/picker-restrictions.ts +49 -0
  68. package/src/presentation-types.ts +26 -2
  69. package/src/presentation-utils.ts +25 -7
  70. package/src/preview-gate.ts +279 -0
  71. package/src/producer-types.ts +58 -0
  72. package/src/render-final.ts +20 -0
  73. package/src/render-nodes.ts +92 -0
  74. package/src/render-output.ts +565 -0
  75. package/src/run-continuation.ts +39 -0
  76. package/src/speaker-tracks.ts +638 -0
  77. package/src/telegram-channel.ts +140 -0
  78. package/src/transcribe-preflight.ts +8 -4
  79. package/src/tts-capabilities.ts +19 -5
  80. package/src/tts-neighbour-text.ts +46 -0
  81. package/src/ugc-call-body.ts +86 -0
  82. package/src/ugc-run-state.ts +64 -0
  83. package/src/video-character-refs.ts +233 -0
  84. package/src/video-overlay.ts +78 -21
@@ -0,0 +1,622 @@
1
+ {
2
+ "about": "Property fixtures for @nodaro/shared speaker-tracks (normalizeSpeakerTracks / validateSpeakerTracks). Plain data on purpose: any other implementation of the same structural rules can load this file and must agree on every case — the same normalized set, the same ok, the same issues and warnings. Times are integer ms on each SOURCE's own clock; box coordinates are fractions 0..1 of the display-oriented frame. A case with \"validateInput\": true is validated exactly as given, without normalizing first (a producer that validates its own output before any normalizer runs).",
3
+ "edls": {
4
+ "twoHost": {
5
+ "version": 1,
6
+ "clock": "master",
7
+ "sources": [
8
+ {
9
+ "id": "wide",
10
+ "url": "https://media.example/wide.mp4",
11
+ "kind": "video",
12
+ "role": "wide",
13
+ "speakers": ["Host", "Guest"]
14
+ },
15
+ {
16
+ "id": "camA",
17
+ "url": "https://media.example/a.mp4",
18
+ "kind": "video",
19
+ "role": "camera",
20
+ "offsetMs": 1200,
21
+ "speakers": ["Host"]
22
+ },
23
+ {
24
+ "id": "camB",
25
+ "url": "https://media.example/b.mp4",
26
+ "kind": "video",
27
+ "role": "camera",
28
+ "offsetMs": -800,
29
+ "speakers": ["Guest"]
30
+ },
31
+ {"id": "mic", "url": "https://media.example/mic.wav", "kind": "audio", "role": "master-audio"}
32
+ ],
33
+ "segments": [
34
+ {"id": "s0", "inMs": 0, "outMs": 4000, "video": "wide", "speaker": "Host"},
35
+ {"id": "s1", "inMs": 4000, "outMs": 8000, "video": "camA", "speaker": "Host"},
36
+ {"id": "s2", "inMs": 8000, "outMs": 12000, "video": "camB", "speaker": "Guest"}
37
+ ]
38
+ },
39
+ "rawLabels": {
40
+ "version": 1,
41
+ "clock": "master",
42
+ "sources": [
43
+ {"id": "wide", "url": "https://media.example/wide.mp4", "kind": "video"},
44
+ {"id": "mic", "url": "https://media.example/mic.wav", "kind": "audio", "role": "master-audio"}
45
+ ],
46
+ "segments": [
47
+ {"id": "s0", "inMs": 0, "outMs": 4000, "video": "wide", "speaker": "SPEAKER_00"},
48
+ {
49
+ "id": "s1",
50
+ "inMs": 4000,
51
+ "outMs": 8000,
52
+ "video": "wide",
53
+ "speaker": "SPEAKER_01",
54
+ "layout": {
55
+ "mode": "side-by-side",
56
+ "slots": [{"source": "wide", "speaker": "SPEAKER_00"}, {"source": "wide", "speaker": "SPEAKER_01"}]
57
+ }
58
+ }
59
+ ]
60
+ },
61
+ "clipOne": {
62
+ "version": 1,
63
+ "clock": "master",
64
+ "sources": [{"id": "wide", "url": "https://media.example/wide.mp4", "kind": "video", "speakers": ["Host"]}],
65
+ "segments": [{"id": "c1", "inMs": 0, "outMs": 3000, "video": "wide", "speaker": "Host"}]
66
+ },
67
+ "clipTwo": {
68
+ "version": 1,
69
+ "clock": "master",
70
+ "sources": [{"id": "camB", "url": "https://media.example/b.mp4", "kind": "video", "speakers": ["Guest"]}],
71
+ "segments": [{"id": "c2", "inMs": 60000, "outMs": 63000, "video": "camB", "speaker": "Guest"}]
72
+ }
73
+ },
74
+ "cases": [
75
+ {
76
+ "name": "a two-host episode in the edit's speaker space: unknown keys dropped, boxes sorted by time, ms rounded",
77
+ "edl": "twoHost",
78
+ "input": {
79
+ "version": 1,
80
+ "sampleFps": 2,
81
+ "detector": {"id": "example:face-detector", "version": "1.0.0", "vendorExtra": true},
82
+ "extra": "dropped",
83
+ "sources": [
84
+ {
85
+ "sourceId": "wide",
86
+ "clock": "source",
87
+ "frame": {"w": 1920, "h": 1080},
88
+ "sampledSpans": [{"startMs": 0, "endMs": 6000}],
89
+ "tracks": [
90
+ {
91
+ "id": "wide/t1",
92
+ "speaker": "Host",
93
+ "attribution": {"method": "region", "confidence": 0.9},
94
+ "boxes": [
95
+ {"ms": 1000.4, "x": 0.2, "y": 0.25, "w": 0.1, "h": 0.2, "score": 0.97},
96
+ {"ms": 500, "x": 0.21, "y": 0.25, "w": 0.1, "h": 0.2, "score": 0.95, "landmarks": [1, 2]}
97
+ ]
98
+ },
99
+ {
100
+ "id": "wide/t2",
101
+ "speaker": "Guest",
102
+ "attribution": {"method": "mouth-motion", "confidence": 0.82, "rawSpeaker": "SPEAKER_01"},
103
+ "boxes": [
104
+ {"ms": 500, "x": 0.6, "y": 0.3, "w": 0.1, "h": 0.2},
105
+ {"ms": 1000, "x": 0.61, "y": 0.3, "w": 0.1, "h": 0.2}
106
+ ]
107
+ }
108
+ ]
109
+ },
110
+ {
111
+ "sourceId": "camA",
112
+ "clock": "source",
113
+ "frame": {"w": 1080, "h": 1920},
114
+ "sampledSpans": [{"startMs": 800, "endMs": 8800}],
115
+ "tracks": [
116
+ {
117
+ "id": "camA/t1",
118
+ "speaker": "Host",
119
+ "attribution": {"method": "source-map", "confidence": 1},
120
+ "boxes": [{"ms": 2800, "x": 0.3, "y": 0.2, "w": 0.4, "h": 0.25}]
121
+ }
122
+ ],
123
+ "cuts": []
124
+ }
125
+ ]
126
+ },
127
+ "normalized": {
128
+ "version": 1,
129
+ "sampleFps": 2,
130
+ "detector": {"id": "example:face-detector", "version": "1.0.0"},
131
+ "sources": [
132
+ {
133
+ "sourceId": "wide",
134
+ "clock": "source",
135
+ "frame": {"w": 1920, "h": 1080},
136
+ "sampledSpans": [{"startMs": 0, "endMs": 6000}],
137
+ "tracks": [
138
+ {
139
+ "id": "wide/t1",
140
+ "speaker": "Host",
141
+ "attribution": {"method": "region", "confidence": 0.9},
142
+ "boxes": [
143
+ {"ms": 500, "x": 0.21, "y": 0.25, "w": 0.1, "h": 0.2, "score": 0.95},
144
+ {"ms": 1000, "x": 0.2, "y": 0.25, "w": 0.1, "h": 0.2, "score": 0.97}
145
+ ]
146
+ },
147
+ {
148
+ "id": "wide/t2",
149
+ "speaker": "Guest",
150
+ "attribution": {"method": "mouth-motion", "confidence": 0.82, "rawSpeaker": "SPEAKER_01"},
151
+ "boxes": [
152
+ {"ms": 500, "x": 0.6, "y": 0.3, "w": 0.1, "h": 0.2},
153
+ {"ms": 1000, "x": 0.61, "y": 0.3, "w": 0.1, "h": 0.2}
154
+ ]
155
+ }
156
+ ]
157
+ },
158
+ {
159
+ "sourceId": "camA",
160
+ "clock": "source",
161
+ "frame": {"w": 1080, "h": 1920},
162
+ "sampledSpans": [{"startMs": 800, "endMs": 8800}],
163
+ "tracks": [
164
+ {
165
+ "id": "camA/t1",
166
+ "speaker": "Host",
167
+ "attribution": {"method": "source-map", "confidence": 1},
168
+ "boxes": [{"ms": 2800, "x": 0.3, "y": 0.2, "w": 0.4, "h": 0.25}]
169
+ }
170
+ ]
171
+ }
172
+ ]
173
+ },
174
+ "validation": {"ok": true, "issues": [], "warnings": []}
175
+ },
176
+ {
177
+ "name": "repairable garbage: boxes cropped to the frame (an overhang on any edge keeps only the visible part; a box entirely off-frame is dropped), malformed boxes dropped, spans merged, cuts sorted and de-duplicated, clamped confidence and score",
178
+ "edl": "twoHost",
179
+ "input": {
180
+ "version": 1,
181
+ "sampleFps": 2,
182
+ "detector": {"id": "example:face-detector"},
183
+ "sources": [
184
+ {
185
+ "sourceId": "wide",
186
+ "clock": "source",
187
+ "frame": {"w": 1920.6, "h": 1080},
188
+ "sampledSpans": [
189
+ {"startMs": 5000, "endMs": 9000},
190
+ {"startMs": 0, "endMs": 3000},
191
+ {"startMs": 2500, "endMs": 4000},
192
+ {"startMs": 7000, "endMs": 7000}
193
+ ],
194
+ "tracks": [
195
+ {
196
+ "id": "wide/t1",
197
+ "speaker": "",
198
+ "attribution": {"method": "manual", "confidence": 3},
199
+ "boxes": [
200
+ {"ms": 1000, "x": 0.9, "y": -0.5, "w": 0.5, "h": 0.4},
201
+ {"ms": 1500, "x": "0.2", "y": 0.2, "w": 0.1, "h": 0.1},
202
+ null,
203
+ {"ms": 2000, "x": 0.5, "y": 0.5, "w": 0, "h": 0.1},
204
+ {"ms": 900, "x": 0.9, "y": 0.8, "w": 0.5, "h": 0.4, "score": 1.5},
205
+ {"ms": 600, "x": -0.1, "y": 0.3, "w": 0.3, "h": 0.2}
206
+ ]
207
+ },
208
+ {
209
+ "speaker": "Host",
210
+ "attribution": {"confidence": 0.5},
211
+ "boxes": [{"ms": 5500, "x": 0.1, "y": 0.1, "w": 0.2, "h": 0.2}]
212
+ }
213
+ ],
214
+ "cuts": [4500.2, "x", 4500, 1200]
215
+ }
216
+ ]
217
+ },
218
+ "normalized": {
219
+ "version": 1,
220
+ "sampleFps": 2,
221
+ "detector": {"id": "example:face-detector"},
222
+ "sources": [
223
+ {
224
+ "sourceId": "wide",
225
+ "clock": "source",
226
+ "frame": {"w": 1921, "h": 1080},
227
+ "sampledSpans": [{"startMs": 0, "endMs": 4000}, {"startMs": 5000, "endMs": 9000}],
228
+ "tracks": [
229
+ {
230
+ "id": "wide/t1",
231
+ "attribution": {"method": "manual", "confidence": 1},
232
+ "boxes": [
233
+ {"ms": 600, "x": 0, "y": 0.3, "w": 0.19999999999999998, "h": 0.2},
234
+ {"ms": 900, "x": 0.9, "y": 0.8, "w": 0.09999999999999998, "h": 0.19999999999999996, "score": 1}
235
+ ]
236
+ },
237
+ {"id": "wide/t2", "speaker": "Host", "boxes": [{"ms": 5500, "x": 0.1, "y": 0.1, "w": 0.2, "h": 0.2}]}
238
+ ],
239
+ "cuts": [1200, 4500]
240
+ }
241
+ ]
242
+ },
243
+ "validation": {"ok": true, "issues": [], "warnings": []}
244
+ },
245
+ {
246
+ "name": "a box outside every sampled span, a repeated instant and a track across a cut are producer bugs the validator reports (normalize never hides them)",
247
+ "edl": "twoHost",
248
+ "input": {
249
+ "version": 1,
250
+ "sampleFps": 2,
251
+ "detector": {"id": "example:face-detector"},
252
+ "sources": [
253
+ {
254
+ "sourceId": "wide",
255
+ "clock": "source",
256
+ "frame": {"w": 1920, "h": 1080},
257
+ "sampledSpans": [{"startMs": 0, "endMs": 4000}],
258
+ "tracks": [
259
+ {
260
+ "id": "wide/t1",
261
+ "boxes": [
262
+ {"ms": 3000, "x": 0.1, "y": 0.1, "w": 0.2, "h": 0.2},
263
+ {"ms": 4000, "x": 0.1, "y": 0.1, "w": 0.2, "h": 0.2}
264
+ ]
265
+ },
266
+ {
267
+ "id": "wide/t2",
268
+ "boxes": [
269
+ {"ms": 1000, "x": 0.5, "y": 0.1, "w": 0.2, "h": 0.2},
270
+ {"ms": 1000, "x": 0.5, "y": 0.1, "w": 0.2, "h": 0.2}
271
+ ]
272
+ },
273
+ {
274
+ "id": "wide/t3",
275
+ "boxes": [
276
+ {"ms": 1500, "x": 0.7, "y": 0.1, "w": 0.2, "h": 0.2},
277
+ {"ms": 2500, "x": 0.7, "y": 0.1, "w": 0.2, "h": 0.2}
278
+ ]
279
+ },
280
+ {
281
+ "id": "wide/t4",
282
+ "boxes": [
283
+ {"ms": 2000, "x": 0.4, "y": 0.5, "w": 0.2, "h": 0.2},
284
+ {"ms": 3000, "x": 0.4, "y": 0.5, "w": 0.2, "h": 0.2}
285
+ ]
286
+ }
287
+ ],
288
+ "cuts": [2000]
289
+ }
290
+ ]
291
+ },
292
+ "normalized": {
293
+ "version": 1,
294
+ "sampleFps": 2,
295
+ "detector": {"id": "example:face-detector"},
296
+ "sources": [
297
+ {
298
+ "sourceId": "wide",
299
+ "clock": "source",
300
+ "frame": {"w": 1920, "h": 1080},
301
+ "sampledSpans": [{"startMs": 0, "endMs": 4000}],
302
+ "tracks": [
303
+ {
304
+ "id": "wide/t1",
305
+ "boxes": [
306
+ {"ms": 3000, "x": 0.1, "y": 0.1, "w": 0.2, "h": 0.2},
307
+ {"ms": 4000, "x": 0.1, "y": 0.1, "w": 0.2, "h": 0.2}
308
+ ]
309
+ },
310
+ {
311
+ "id": "wide/t2",
312
+ "boxes": [
313
+ {"ms": 1000, "x": 0.5, "y": 0.1, "w": 0.2, "h": 0.2},
314
+ {"ms": 1000, "x": 0.5, "y": 0.1, "w": 0.2, "h": 0.2}
315
+ ]
316
+ },
317
+ {
318
+ "id": "wide/t3",
319
+ "boxes": [
320
+ {"ms": 1500, "x": 0.7, "y": 0.1, "w": 0.2, "h": 0.2},
321
+ {"ms": 2500, "x": 0.7, "y": 0.1, "w": 0.2, "h": 0.2}
322
+ ]
323
+ },
324
+ {
325
+ "id": "wide/t4",
326
+ "boxes": [
327
+ {"ms": 2000, "x": 0.4, "y": 0.5, "w": 0.2, "h": 0.2},
328
+ {"ms": 3000, "x": 0.4, "y": 0.5, "w": 0.2, "h": 0.2}
329
+ ]
330
+ }
331
+ ],
332
+ "cuts": [2000]
333
+ }
334
+ ]
335
+ },
336
+ "validation": {
337
+ "ok": false,
338
+ "issues": [
339
+ "track \"wide/t1\" box[1]: ms 4000 is outside every sampled span of source \"wide\"",
340
+ "track \"wide/t2\" box[1]: ms 1000 is not after the previous box (1000)",
341
+ "track \"wide/t3\": spans the cut at 2000 ms (boxes 1500..2500)"
342
+ ],
343
+ "warnings": []
344
+ }
345
+ },
346
+ {
347
+ "name": "raw transcript labels against an edit that uses display names: no tracked speaker matches, so it is refused",
348
+ "edl": "twoHost",
349
+ "input": {
350
+ "version": 1,
351
+ "sampleFps": 2,
352
+ "detector": {"id": "example:face-detector"},
353
+ "sources": [
354
+ {
355
+ "sourceId": "wide",
356
+ "clock": "source",
357
+ "frame": {"w": 1920, "h": 1080},
358
+ "sampledSpans": [{"startMs": 0, "endMs": 4000}],
359
+ "tracks": [
360
+ {
361
+ "id": "wide/t1",
362
+ "speaker": "SPEAKER_00",
363
+ "attribution": {"method": "mouth-motion", "confidence": 0.9},
364
+ "boxes": [{"ms": 500, "x": 0.1, "y": 0.1, "w": 0.2, "h": 0.2}]
365
+ },
366
+ {
367
+ "id": "wide/t2",
368
+ "speaker": "SPEAKER_01",
369
+ "attribution": {"method": "mouth-motion", "confidence": 0.9},
370
+ "boxes": [{"ms": 500, "x": 0.6, "y": 0.1, "w": 0.2, "h": 0.2}]
371
+ },
372
+ {"id": "wide/t3", "boxes": [{"ms": 500, "x": 0.4, "y": 0.6, "w": 0.1, "h": 0.1}]}
373
+ ]
374
+ }
375
+ ]
376
+ },
377
+ "validation": {
378
+ "ok": false,
379
+ "issues": [
380
+ "no tracked speaker is in the edit's speaker set: the tracks are labelled \"SPEAKER_00\", \"SPEAKER_01\" and the edit uses \"Guest\", \"Host\" — wire Speaker Frames to the same transcript as Camera Switch"
381
+ ],
382
+ "warnings": []
383
+ }
384
+ },
385
+ {
386
+ "name": "a partial name-space mismatch is a warning naming the stray speaker; a track whose rawSpeaker is in the edit's set matches",
387
+ "edl": "rawLabels",
388
+ "input": {
389
+ "version": 1,
390
+ "sampleFps": 2,
391
+ "detector": {"id": "example:face-detector"},
392
+ "sources": [
393
+ {
394
+ "sourceId": "wide",
395
+ "clock": "source",
396
+ "frame": {"w": 1920, "h": 1080},
397
+ "sampledSpans": [{"startMs": 0, "endMs": 8000}],
398
+ "tracks": [
399
+ {
400
+ "id": "wide/t1",
401
+ "speaker": "Host",
402
+ "attribution": {"method": "manual", "confidence": 1, "rawSpeaker": "SPEAKER_00"},
403
+ "boxes": [{"ms": 500, "x": 0.1, "y": 0.1, "w": 0.2, "h": 0.2}]
404
+ },
405
+ {
406
+ "id": "wide/t2",
407
+ "speaker": "SPEAKER_01",
408
+ "attribution": {"method": "mouth-motion", "confidence": 0.7},
409
+ "boxes": [{"ms": 500, "x": 0.6, "y": 0.1, "w": 0.2, "h": 0.2}]
410
+ },
411
+ {
412
+ "id": "wide/t3",
413
+ "speaker": "Producer",
414
+ "attribution": {"method": "manual", "confidence": 1},
415
+ "boxes": [{"ms": 500, "x": 0.4, "y": 0.6, "w": 0.1, "h": 0.1}]
416
+ }
417
+ ]
418
+ }
419
+ ]
420
+ },
421
+ "validation": {
422
+ "ok": true,
423
+ "issues": [],
424
+ "warnings": ["track \"wide/t3\": speaker \"Producer\" is not in the edit's speaker set"]
425
+ }
426
+ },
427
+ {
428
+ "name": "source ids resolve against the EDL: an unknown source and an audio source are refused; an unknown attribution method is only a warning",
429
+ "edl": "twoHost",
430
+ "input": {
431
+ "version": 1,
432
+ "sampleFps": 2,
433
+ "detector": {"id": "example:face-detector"},
434
+ "sources": [
435
+ {
436
+ "sourceId": "ghost",
437
+ "clock": "source",
438
+ "frame": {"w": 1920, "h": 1080},
439
+ "sampledSpans": [{"startMs": 0, "endMs": 1000}],
440
+ "tracks": []
441
+ },
442
+ {
443
+ "sourceId": "mic",
444
+ "clock": "source",
445
+ "frame": {"w": 1920, "h": 1080},
446
+ "sampledSpans": [{"startMs": 0, "endMs": 1000}],
447
+ "tracks": []
448
+ },
449
+ {
450
+ "sourceId": "wide",
451
+ "clock": "source",
452
+ "frame": {"w": 1920, "h": 1080},
453
+ "sampledSpans": [{"startMs": 0, "endMs": 1000}],
454
+ "tracks": [
455
+ {
456
+ "id": "wide/t1",
457
+ "speaker": "Host",
458
+ "attribution": {"method": "lip-reader", "confidence": 0.6},
459
+ "boxes": [{"ms": 500, "x": 0.1, "y": 0.1, "w": 0.2, "h": 0.2}]
460
+ }
461
+ ]
462
+ }
463
+ ]
464
+ },
465
+ "validation": {
466
+ "ok": false,
467
+ "issues": [
468
+ "source \"ghost\": not a source of the EDL",
469
+ "source \"mic\": the EDL source is kind:\"audio\", tracks need a video source"
470
+ ],
471
+ "warnings": [
472
+ "track \"wide/t1\": unknown attribution method \"lip-reader\" (known: source-map, region, mouth-motion, manual)"
473
+ ]
474
+ }
475
+ },
476
+ {
477
+ "name": "structural defects a normalizer cannot repair (and never reinterprets): another version, another clock, no sample rate, an empty frame, duplicate source and track ids",
478
+ "input": {
479
+ "version": 2,
480
+ "detector": {"id": "example:face-detector"},
481
+ "sources": [
482
+ {
483
+ "sourceId": "wide",
484
+ "clock": "source",
485
+ "frame": {"w": 1920, "h": 1080},
486
+ "sampledSpans": [{"startMs": 0, "endMs": 1000}],
487
+ "tracks": [{"id": "t", "boxes": []}]
488
+ },
489
+ {"sourceId": "wide", "clock": "master", "sampledSpans": [], "tracks": [{"id": "t", "boxes": []}]}
490
+ ]
491
+ },
492
+ "normalized": {
493
+ "version": 2,
494
+ "sampleFps": 0,
495
+ "detector": {"id": "example:face-detector"},
496
+ "sources": [
497
+ {
498
+ "sourceId": "wide",
499
+ "clock": "source",
500
+ "frame": {"w": 1920, "h": 1080},
501
+ "sampledSpans": [{"startMs": 0, "endMs": 1000}],
502
+ "tracks": [{"id": "t", "boxes": []}]
503
+ },
504
+ {
505
+ "sourceId": "wide",
506
+ "clock": "master",
507
+ "frame": {"w": 0, "h": 0},
508
+ "sampledSpans": [],
509
+ "tracks": [{"id": "t", "boxes": []}]
510
+ }
511
+ ]
512
+ },
513
+ "validation": {
514
+ "ok": false,
515
+ "issues": [
516
+ "version must be 1",
517
+ "sampleFps must be a finite number > 0",
518
+ "duplicate source id \"wide\"",
519
+ "source \"wide\": clock must be \"source\"",
520
+ "source \"wide\": frame w/h must be positive",
521
+ "duplicate track id \"t\""
522
+ ],
523
+ "warnings": []
524
+ }
525
+ },
526
+ {
527
+ "name": "a clip pack: one track set validated against every clip's EDL (sources and speakers are the union)",
528
+ "edls": ["clipOne", "clipTwo"],
529
+ "input": {
530
+ "version": 1,
531
+ "sampleFps": 2,
532
+ "detector": {"id": "example:face-detector"},
533
+ "sources": [
534
+ {
535
+ "sourceId": "wide",
536
+ "clock": "source",
537
+ "frame": {"w": 1920, "h": 1080},
538
+ "sampledSpans": [{"startMs": 0, "endMs": 5000}],
539
+ "tracks": [
540
+ {
541
+ "id": "wide/t1",
542
+ "speaker": "Host",
543
+ "attribution": {"method": "source-map", "confidence": 1},
544
+ "boxes": [{"ms": 1000, "x": 0.1, "y": 0.1, "w": 0.2, "h": 0.2}]
545
+ }
546
+ ]
547
+ },
548
+ {
549
+ "sourceId": "camB",
550
+ "clock": "source",
551
+ "frame": {"w": 1920, "h": 1080},
552
+ "sampledSpans": [{"startMs": 58000, "endMs": 65000}],
553
+ "tracks": [
554
+ {
555
+ "id": "camB/t1",
556
+ "speaker": "Guest",
557
+ "attribution": {"method": "source-map", "confidence": 1},
558
+ "boxes": [{"ms": 60000, "x": 0.4, "y": 0.1, "w": 0.2, "h": 0.2}]
559
+ }
560
+ ]
561
+ }
562
+ ]
563
+ },
564
+ "validation": {"ok": true, "issues": [], "warnings": []}
565
+ },
566
+ {
567
+ "name": "times are integer ms: a fractional box ms or span bound is refused when the body is validated as given (validateInput), as cuts are",
568
+ "validateInput": true,
569
+ "input": {
570
+ "version": 1,
571
+ "sampleFps": 2,
572
+ "detector": {"id": "example:face-detector"},
573
+ "sources": [
574
+ {
575
+ "sourceId": "wide",
576
+ "clock": "source",
577
+ "frame": {"w": 1920, "h": 1080},
578
+ "sampledSpans": [{"startMs": 0.5, "endMs": 4000}, {"startMs": 5000, "endMs": 9000.25}],
579
+ "tracks": [
580
+ {
581
+ "id": "wide/t1",
582
+ "boxes": [
583
+ {"ms": 1000.5, "x": 0.1, "y": 0.1, "w": 0.2, "h": 0.2},
584
+ {"ms": 2000, "x": 0.1, "y": 0.1, "w": 0.2, "h": 0.2}
585
+ ]
586
+ }
587
+ ],
588
+ "cuts": [4500.5]
589
+ }
590
+ ]
591
+ },
592
+ "validation": {
593
+ "ok": false,
594
+ "issues": [
595
+ "source \"wide\": sampledSpans[0] [0.5,4000) is not integer ms",
596
+ "source \"wide\": sampledSpans[1] [5000,9000.25) is not integer ms",
597
+ "source \"wide\": cuts must be ascending non-negative ms",
598
+ "track \"wide/t1\" box[0]: ms 1000.5 is not an integer"
599
+ ],
600
+ "warnings": []
601
+ }
602
+ },
603
+ {
604
+ "name": "a present but non-numeric version (\"2\") is kept, never coerced to 1, so the validator refuses it",
605
+ "input": {"version": "2", "sampleFps": 2, "detector": {"id": "example:face-detector"}, "sources": []},
606
+ "normalized": {"version": "2", "sampleFps": 2, "detector": {"id": "example:face-detector"}, "sources": []},
607
+ "validation": {"ok": false, "issues": ["version must be 1"], "warnings": []}
608
+ },
609
+ {
610
+ "name": "a null version is kept, never coerced to 1, so the validator refuses it (only an absent version defaults to 1)",
611
+ "input": {"version": null, "sampleFps": 2, "detector": {"id": "example:face-detector"}, "sources": []},
612
+ "normalized": {"version": null, "sampleFps": 2, "detector": {"id": "example:face-detector"}, "sources": []},
613
+ "validation": {"ok": false, "issues": ["version must be 1"], "warnings": []}
614
+ },
615
+ {
616
+ "name": "an absent version defaults to 1",
617
+ "input": {"sampleFps": 2, "detector": {"id": "example:face-detector"}, "sources": []},
618
+ "normalized": {"version": 1, "sampleFps": 2, "detector": {"id": "example:face-detector"}, "sources": []},
619
+ "validation": {"ok": true, "issues": [], "warnings": []}
620
+ }
621
+ ]
622
+ }
@@ -0,0 +1,34 @@
1
+ import { describe, expect, it } from "vitest"
2
+ // The index's `INPUT_FIELD_MAP` is the component-types key-only map; the typed
3
+ // per-node-type table is read through `getInputFieldSchema`.
4
+ import { INPUT_FIELD_EXTRA_KEYS, INPUT_FIELD_MAP, UGC_OVERRIDABLE_FIELDS, getInputFieldExtraKeys, getInputFieldSchema } from "../index.js"
5
+
6
+ /** The keys the node actually reads (its data fields). PR B's UgcCreatorData must keep these names. */
7
+ const NODE_READS: Record<string, readonly string[]> = {
8
+ "ugc-creator": ["source", "gender", "photoUrl", "categoryOverride", "seed", "keepResult", "result"],
9
+ }
10
+
11
+ describe("INPUT_FIELD_EXTRA_KEYS (spec §6.6)", () => {
12
+ it("every extra key is a field the node reads and is overridable", () => {
13
+ for (const [type, extras] of Object.entries(INPUT_FIELD_EXTRA_KEYS)) {
14
+ for (const { key } of extras) {
15
+ expect(NODE_READS[type], type).toContain(key)
16
+ expect(UGC_OVERRIDABLE_FIELDS[type], `${type}.${key}`).toContain(key)
17
+ }
18
+ }
19
+ })
20
+ it("the primary key is overridable too, and the three creator keys are exactly the overridable set", () => {
21
+ expect(getInputFieldSchema("ugc-creator")).toEqual({ key: "source", type: "select" })
22
+ expect(INPUT_FIELD_MAP["ugc-creator"]).toBe("source")
23
+ const all = [getInputFieldSchema("ugc-creator")!.key, ...INPUT_FIELD_EXTRA_KEYS["ugc-creator"]!.map((e) => e.key)]
24
+ expect(all.sort()).toEqual([...UGC_OVERRIDABLE_FIELDS["ugc-creator"]!].sort())
25
+ })
26
+ it("getInputFieldExtraKeys returns the extras, and nothing for a type without any", () => {
27
+ expect(getInputFieldExtraKeys("ugc-creator")).toEqual([
28
+ { key: "gender", type: "select" },
29
+ { key: "photoUrl", type: "image-url" },
30
+ ])
31
+ expect(getInputFieldExtraKeys("text-prompt")).toEqual([])
32
+ expect(getInputFieldExtraKeys("constructor")).toEqual([])
33
+ })
34
+ })