@morshoto/framekit 0.1.5 → 0.1.10
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/bin/framekit.mjs +2 -1
- package/dist-package/adapters/final-cut/typescript/src/assets.js +223 -15
- package/dist-package/adapters/final-cut/typescript/src/background-export.js +384 -0
- package/dist-package/adapters/final-cut/typescript/src/canonical.js +588 -0
- package/dist-package/adapters/final-cut/typescript/src/connection.js +20 -5
- package/dist-package/adapters/final-cut/typescript/src/disposable-native.js +33 -7
- package/dist-package/adapters/final-cut/typescript/src/fcpxml.js +805 -51
- package/dist-package/adapters/final-cut/typescript/src/index.js +5 -0
- package/dist-package/adapters/final-cut/typescript/src/library-inspection.js +390 -0
- package/dist-package/adapters/final-cut/typescript/src/live.js +6 -3
- package/dist-package/adapters/final-cut/typescript/src/media.js +151 -0
- package/dist-package/adapters/final-cut/typescript/src/native-session.js +412 -0
- package/dist-package/adapters/final-cut/typescript/src/native.js +2271 -424
- package/dist-package/adapters/final-cut/typescript/src/publisher.js +225 -32
- package/dist-package/adapters/final-cut/typescript/src/session.js +145 -17
- package/dist-package/apps/mcp-server/src/main.js +73 -17
- package/dist-package/apps/mcp-server/src/routing.js +242 -39
- package/dist-package/apps/mcp-server/src/server.js +677 -89
- package/dist-package/apps/mcp-server/src/version.js +109 -1
- package/dist-package/packages/runtime/src/application/media-analysis-service.js +3 -4
- package/dist-package/packages/runtime/src/application/project-service.js +46 -7
- package/dist-package/packages/runtime/src/audio/dialogue-normalization.js +9 -0
- package/dist-package/packages/runtime/src/capabilities.js +62 -9
- package/dist-package/packages/runtime/src/context/project-catalog.js +159 -0
- package/dist-package/packages/runtime/src/domain/capabilities.js +33 -0
- package/dist-package/packages/runtime/src/domain/context.js +14 -1
- package/dist-package/packages/runtime/src/domain/editing.js +27 -1
- package/dist-package/packages/runtime/src/domain/index.js +1 -0
- package/dist-package/packages/runtime/src/domain/skills.js +2 -0
- package/dist-package/packages/runtime/src/domain/timeline-target.js +217 -0
- package/dist-package/packages/runtime/src/editing/edit-service.js +57 -1
- package/dist-package/packages/runtime/src/editing/intent.js +178 -2
- package/dist-package/packages/runtime/src/index.js +1 -0
- package/dist-package/packages/runtime/src/runtime.js +2 -2
- package/dist-package/packages/runtime/src/skills/builtin.js +314 -39
- package/dist-package/packages/runtime/src/skills/requirements.js +1 -0
- package/dist-package/packages/runtime/src/skills/runtime.js +33 -8
- package/dist-package/packages/runtime/src/verification/verification.js +81 -4
- package/dist-package/packages/testkit/src/in-memory-editor.js +130 -4
- package/package.json +12 -2
|
@@ -42,7 +42,8 @@ function validateAssertion(assertion, index) {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
if (assertion.type === "audio-loudness") {
|
|
45
|
-
if (!
|
|
45
|
+
if ((assertion.occurrenceId !== undefined && !assertion.occurrenceId.trim())
|
|
46
|
+
|| !Number.isFinite(assertion.targetLufs)
|
|
46
47
|
|| assertion.toleranceDb !== undefined
|
|
47
48
|
&& (!Number.isFinite(assertion.toleranceDb) || assertion.toleranceDb < 0)) {
|
|
48
49
|
throw new Error(`INVALID_VERIFICATION_POLICY: ${path} has invalid loudness values`);
|
|
@@ -125,6 +126,13 @@ export class DefaultVerificationEngine {
|
|
|
125
126
|
detail: constructionStateDetail(transaction),
|
|
126
127
|
});
|
|
127
128
|
}
|
|
129
|
+
if (transaction.planned.some((operation) => operation.type === "timeline.mask.add")) {
|
|
130
|
+
checks.push({
|
|
131
|
+
name: "mask-state",
|
|
132
|
+
passed: maskStateIsValid(transaction),
|
|
133
|
+
detail: maskStateDetail(transaction),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
128
136
|
if (policy.requireExpectedChange !== false) {
|
|
129
137
|
checks.push({
|
|
130
138
|
name: "expected-change",
|
|
@@ -136,8 +144,9 @@ export class DefaultVerificationEngine {
|
|
|
136
144
|
}
|
|
137
145
|
if (policy.maxTruePeakDb !== undefined) {
|
|
138
146
|
const peaks = transaction.attemptedAfter.media
|
|
147
|
+
.filter((media) => media.audio?.valid !== false)
|
|
139
148
|
.map((media) => media.audio?.truePeakDb)
|
|
140
|
-
.filter((peak) => peak !== undefined);
|
|
149
|
+
.filter((peak) => peak !== undefined && Number.isFinite(peak));
|
|
141
150
|
const passed = peaks.length > 0 && peaks.every((peak) => peak <= policy.maxTruePeakDb);
|
|
142
151
|
checks.push({
|
|
143
152
|
name: "true-peak-limit",
|
|
@@ -150,8 +159,9 @@ export class DefaultVerificationEngine {
|
|
|
150
159
|
if (policy.targetLufs !== undefined) {
|
|
151
160
|
const tolerance = policy.loudnessToleranceDb ?? 0.5;
|
|
152
161
|
const loudness = transaction.attemptedAfter.media
|
|
162
|
+
.filter((media) => media.audio?.valid !== false)
|
|
153
163
|
.map((media) => media.audio?.integratedLufs)
|
|
154
|
-
.filter((value) => value !== undefined);
|
|
164
|
+
.filter((value) => value !== undefined && Number.isFinite(value));
|
|
155
165
|
const passed = loudness.length > 0 && loudness.every((value) => Math.abs(value - policy.targetLufs) <= tolerance);
|
|
156
166
|
checks.push({
|
|
157
167
|
name: "integrated-loudness-target",
|
|
@@ -331,9 +341,26 @@ function verifyAudioLoudness(transaction, assertion) {
|
|
|
331
341
|
const toleranceDb = assertion.toleranceDb ?? 0.5;
|
|
332
342
|
const expected = {
|
|
333
343
|
mediaId: assertion.mediaId,
|
|
344
|
+
...(assertion.occurrenceId ? { occurrenceId: assertion.occurrenceId } : {}),
|
|
334
345
|
targetLufs: assertion.targetLufs,
|
|
335
346
|
toleranceDb,
|
|
336
347
|
};
|
|
348
|
+
const occurrence = assertion.occurrenceId
|
|
349
|
+
? transaction.attemptedAfter.timeline.clips.find((clip) => clip.id === assertion.occurrenceId)
|
|
350
|
+
: undefined;
|
|
351
|
+
if (assertion.occurrenceId && (!occurrence || occurrence.mediaId !== assertion.mediaId)) {
|
|
352
|
+
return {
|
|
353
|
+
name: assertion.type,
|
|
354
|
+
passed: false,
|
|
355
|
+
status: "failed",
|
|
356
|
+
expected,
|
|
357
|
+
observed: { mediaId: assertion.mediaId, occurrenceId: assertion.occurrenceId },
|
|
358
|
+
reason: !occurrence ? "OCCURRENCE_NOT_FOUND" : "TARGET_MISMATCH",
|
|
359
|
+
detail: !occurrence
|
|
360
|
+
? `expected occurrence ${assertion.occurrenceId}, but it was not observed`
|
|
361
|
+
: `occurrence ${assertion.occurrenceId} does not reference media ${assertion.mediaId}`,
|
|
362
|
+
};
|
|
363
|
+
}
|
|
337
364
|
const media = transaction.attemptedAfter.media.find((candidate) => candidate.mediaId === assertion.mediaId);
|
|
338
365
|
if (!media) {
|
|
339
366
|
return {
|
|
@@ -357,6 +384,19 @@ function verifyAudioLoudness(transaction, assertion) {
|
|
|
357
384
|
detail: `audio analysis is unavailable for media ${assertion.mediaId}`,
|
|
358
385
|
};
|
|
359
386
|
}
|
|
387
|
+
if (media.audio.valid === false
|
|
388
|
+
|| !Number.isFinite(media.audio.integratedLufs)
|
|
389
|
+
|| !Number.isFinite(media.audio.truePeakDb)) {
|
|
390
|
+
return {
|
|
391
|
+
name: assertion.type,
|
|
392
|
+
passed: false,
|
|
393
|
+
status: "failed",
|
|
394
|
+
expected,
|
|
395
|
+
observed: media.audio,
|
|
396
|
+
reason: "AUDIO_MEASUREMENT_INVALID",
|
|
397
|
+
detail: `audio measurement for media ${assertion.mediaId} is invalid`,
|
|
398
|
+
};
|
|
399
|
+
}
|
|
360
400
|
const observed = media.audio.integratedLufs;
|
|
361
401
|
const passed = Math.abs(observed - assertion.targetLufs) <= toleranceDb;
|
|
362
402
|
return {
|
|
@@ -652,9 +692,23 @@ function audioStateDetail(transaction) {
|
|
|
652
692
|
? "music placement, duration, gain, and fades match the planned audio state"
|
|
653
693
|
: "music placement, duration, gain, or fades do not match the planned audio state";
|
|
654
694
|
}
|
|
695
|
+
function maskStateIsValid(transaction) {
|
|
696
|
+
return transaction.planned.every((operation) => {
|
|
697
|
+
if (operation.type !== "timeline.mask.add")
|
|
698
|
+
return true;
|
|
699
|
+
const clip = transaction.after.timeline.clips.find(({ id }) => id === operation.occurrenceId);
|
|
700
|
+
return clip?.mask !== undefined && JSON.stringify(clip.mask) === JSON.stringify(operation.mask);
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
function maskStateDetail(transaction) {
|
|
704
|
+
return maskStateIsValid(transaction)
|
|
705
|
+
? "mask target and requested configuration match the canonical timeline state"
|
|
706
|
+
: "mask target or requested configuration does not match the canonical timeline state";
|
|
707
|
+
}
|
|
655
708
|
function isConstructionOperation(operation) {
|
|
656
709
|
return operation.type === "media.import"
|
|
657
710
|
|| operation.type === "timeline.media.add"
|
|
711
|
+
|| operation.type === "timeline.picture-in-picture.add"
|
|
658
712
|
|| operation.type === "timeline.media.move"
|
|
659
713
|
|| operation.type === "timeline.media.replace"
|
|
660
714
|
|| operation.type === "timeline.media.remove"
|
|
@@ -673,6 +727,7 @@ function constructionStateIsValid(transaction) {
|
|
|
673
727
|
&& media.sourceDigest === operation.sourceDigest;
|
|
674
728
|
}
|
|
675
729
|
if (operation.type === "timeline.media.add"
|
|
730
|
+
|| operation.type === "timeline.picture-in-picture.add"
|
|
676
731
|
|| operation.type === "timeline.media.move"
|
|
677
732
|
|| operation.type === "timeline.media.replace"
|
|
678
733
|
|| operation.type === "timeline.media.remove"
|
|
@@ -714,6 +769,10 @@ function expectedConstructionClips(transaction) {
|
|
|
714
769
|
duration: clip.duration,
|
|
715
770
|
track: clip.track,
|
|
716
771
|
attachedTo: clip.attachedTo,
|
|
772
|
+
position: clip.position,
|
|
773
|
+
scale: clip.scale,
|
|
774
|
+
crop: clip.crop,
|
|
775
|
+
frame: clip.frame,
|
|
717
776
|
}]));
|
|
718
777
|
const media = new Map(transaction.before.media.map((item) => [item.mediaId, item]));
|
|
719
778
|
for (const operation of transaction.planned) {
|
|
@@ -730,6 +789,20 @@ function expectedConstructionClips(transaction) {
|
|
|
730
789
|
});
|
|
731
790
|
continue;
|
|
732
791
|
}
|
|
792
|
+
if (operation.type === "timeline.picture-in-picture.add") {
|
|
793
|
+
clips.set(operation.occurrenceId, {
|
|
794
|
+
mediaId: operation.mediaId,
|
|
795
|
+
start: operation.start,
|
|
796
|
+
duration: operation.duration,
|
|
797
|
+
track: operation.targetLane,
|
|
798
|
+
attachedTo: operation.attachedTo,
|
|
799
|
+
position: operation.position,
|
|
800
|
+
scale: operation.scale,
|
|
801
|
+
crop: operation.crop,
|
|
802
|
+
frame: operation.frame,
|
|
803
|
+
});
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
733
806
|
if (operation.type === "timeline.title.add") {
|
|
734
807
|
clips.set(operation.occurrenceId, {
|
|
735
808
|
start: operation.start,
|
|
@@ -800,7 +873,11 @@ function sameConstructionClip(actual, expected) {
|
|
|
800
873
|
&& actual.start === expected.start
|
|
801
874
|
&& actual.duration === expected.duration
|
|
802
875
|
&& actual.track === expected.track
|
|
803
|
-
&& actual.attachedTo === expected.attachedTo
|
|
876
|
+
&& actual.attachedTo === expected.attachedTo
|
|
877
|
+
&& JSON.stringify(actual.position) === JSON.stringify(expected.position)
|
|
878
|
+
&& actual.scale === expected.scale
|
|
879
|
+
&& JSON.stringify(actual.crop) === JSON.stringify(expected.crop)
|
|
880
|
+
&& JSON.stringify(actual.frame) === JSON.stringify(expected.frame);
|
|
804
881
|
}
|
|
805
882
|
function applyExpectedRippleDelete(clips, start, end) {
|
|
806
883
|
const removedDuration = end - start;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { diffSnapshots, withCapabilityFamilies } from "../../runtime/src/index.js";
|
|
1
|
+
import { createProjectSelectionResult, diffSnapshots, withCapabilityFamilies } from "../../runtime/src/index.js";
|
|
2
2
|
export class InMemoryEditorAdapter {
|
|
3
3
|
getManagedArtifact;
|
|
4
4
|
snapshot;
|
|
@@ -62,6 +62,7 @@ export class InMemoryEditorAdapter {
|
|
|
62
62
|
compositeTransactions: true,
|
|
63
63
|
mediaImport: true,
|
|
64
64
|
mediaPlacement: true,
|
|
65
|
+
pictureInPicture: true,
|
|
65
66
|
titlePlacement: true,
|
|
66
67
|
clipMove: true,
|
|
67
68
|
clipReplace: true,
|
|
@@ -71,6 +72,8 @@ export class InMemoryEditorAdapter {
|
|
|
71
72
|
audioMixing: true,
|
|
72
73
|
noiseReduction: true,
|
|
73
74
|
colorCorrection: true,
|
|
75
|
+
masking: true,
|
|
76
|
+
personCutout: false,
|
|
74
77
|
semanticOperations: {
|
|
75
78
|
"rename-clip": true,
|
|
76
79
|
"trim-clip": true,
|
|
@@ -81,6 +84,7 @@ export class InMemoryEditorAdapter {
|
|
|
81
84
|
"add-marker": true,
|
|
82
85
|
"media.import": true,
|
|
83
86
|
"timeline.media.add": true,
|
|
87
|
+
"timeline.picture-in-picture.add": true,
|
|
84
88
|
"timeline.audio.fades": true,
|
|
85
89
|
"timeline.title.add": true,
|
|
86
90
|
"timeline.media.move": true,
|
|
@@ -89,6 +93,7 @@ export class InMemoryEditorAdapter {
|
|
|
89
93
|
"timeline.transition.add": true,
|
|
90
94
|
"timeline.audio.attach": true,
|
|
91
95
|
"timeline.audio.mix": true,
|
|
96
|
+
"timeline.mask.add": true,
|
|
92
97
|
},
|
|
93
98
|
},
|
|
94
99
|
analyzers: {
|
|
@@ -152,8 +157,9 @@ export class InMemoryEditorAdapter {
|
|
|
152
157
|
if (target.timeline.id !== sequenceId) {
|
|
153
158
|
throw new Error(`UNSUPPORTED_PROJECT_SELECTION: no canonical snapshot for sequence ${sequenceId}`);
|
|
154
159
|
}
|
|
155
|
-
if (this.activeProjectId === project.id && this.activeSequenceId === sequenceId)
|
|
156
|
-
return this.listProjects();
|
|
160
|
+
if (this.activeProjectId === project.id && this.activeSequenceId === sequenceId) {
|
|
161
|
+
return createProjectSelectionResult(await this.listProjects(), selection, this.snapshot.revision);
|
|
162
|
+
}
|
|
157
163
|
this.selectionRevision += 1;
|
|
158
164
|
this.snapshot = {
|
|
159
165
|
...structuredClone(target),
|
|
@@ -167,7 +173,7 @@ export class InMemoryEditorAdapter {
|
|
|
167
173
|
this.history.set(this.snapshot.revision.id, structuredClone(this.snapshot));
|
|
168
174
|
this.activeProjectId = project.id;
|
|
169
175
|
this.activeSequenceId = sequenceId;
|
|
170
|
-
return this.listProjects();
|
|
176
|
+
return createProjectSelectionResult(await this.listProjects(), selection, this.snapshot.revision);
|
|
171
177
|
}
|
|
172
178
|
async readChanges(since) {
|
|
173
179
|
const before = this.history.get(since.id);
|
|
@@ -277,6 +283,76 @@ export class InMemoryEditorAdapter {
|
|
|
277
283
|
},
|
|
278
284
|
};
|
|
279
285
|
}
|
|
286
|
+
if (operation.type === "timeline.picture-in-picture.add") {
|
|
287
|
+
const media = snapshot.media.find((candidate) => candidate.mediaId === operation.mediaId);
|
|
288
|
+
if (!media)
|
|
289
|
+
throw new Error(`MEDIA_NOT_FOUND: ${operation.mediaId}`);
|
|
290
|
+
if (media.mediaKind !== undefined && media.mediaKind !== "video") {
|
|
291
|
+
throw new Error(`MEDIA_KIND_MISMATCH: ${operation.mediaId}`);
|
|
292
|
+
}
|
|
293
|
+
if (snapshot.timeline.clips.some((clip) => clip.id === operation.occurrenceId)) {
|
|
294
|
+
throw new Error(`OCCURRENCE_ALREADY_EXISTS: ${operation.occurrenceId}`);
|
|
295
|
+
}
|
|
296
|
+
const anchor = snapshot.timeline.clips.find((clip) => clip.id === operation.attachedTo);
|
|
297
|
+
if (!anchor)
|
|
298
|
+
throw new Error(`CLIP_NOT_FOUND: ${operation.attachedTo}`);
|
|
299
|
+
if (anchor.role !== undefined && anchor.role !== "video") {
|
|
300
|
+
throw new Error("INVALID_OPERATION: PIP anchor must be a video occurrence");
|
|
301
|
+
}
|
|
302
|
+
if (!Number.isFinite(operation.start) || !Number.isFinite(operation.duration)
|
|
303
|
+
|| operation.start < anchor.start
|
|
304
|
+
|| operation.duration <= 0
|
|
305
|
+
|| operation.start + operation.duration > anchor.start + anchor.duration
|
|
306
|
+
|| media.duration !== undefined && operation.duration > media.duration
|
|
307
|
+
|| !Number.isInteger(operation.targetLane)
|
|
308
|
+
|| operation.targetLane === 0
|
|
309
|
+
|| !Number.isFinite(operation.position.x)
|
|
310
|
+
|| !Number.isFinite(operation.position.y)
|
|
311
|
+
|| !Number.isFinite(operation.scale)
|
|
312
|
+
|| operation.scale <= 0) {
|
|
313
|
+
throw new Error("INVALID_OPERATION: PIP timing, connected lane, position, and scale are invalid");
|
|
314
|
+
}
|
|
315
|
+
if (operation.crop)
|
|
316
|
+
assertPictureInPictureCrop(operation.crop);
|
|
317
|
+
if (operation.frame)
|
|
318
|
+
assertPictureInPictureFrame(operation.frame);
|
|
319
|
+
const clip = withClipTime({
|
|
320
|
+
id: operation.occurrenceId,
|
|
321
|
+
mediaId: operation.mediaId,
|
|
322
|
+
name: media.source.split("/").pop() || media.mediaId,
|
|
323
|
+
start: operation.start,
|
|
324
|
+
duration: operation.duration,
|
|
325
|
+
track: operation.targetLane,
|
|
326
|
+
role: "video",
|
|
327
|
+
attachedTo: operation.attachedTo,
|
|
328
|
+
position: structuredClone(operation.position),
|
|
329
|
+
scale: operation.scale,
|
|
330
|
+
...(operation.crop ? { crop: structuredClone(operation.crop) } : {}),
|
|
331
|
+
...(operation.frame ? { frame: structuredClone(operation.frame) } : {}),
|
|
332
|
+
});
|
|
333
|
+
return {
|
|
334
|
+
...snapshot,
|
|
335
|
+
timeline: {
|
|
336
|
+
...snapshot.timeline,
|
|
337
|
+
clips: [...snapshot.timeline.clips, clip],
|
|
338
|
+
storyElements: [...snapshot.timeline.storyElements, {
|
|
339
|
+
id: clip.id,
|
|
340
|
+
kind: "asset-clip",
|
|
341
|
+
start: clip.start,
|
|
342
|
+
duration: clip.duration,
|
|
343
|
+
startTime: clip.startTime,
|
|
344
|
+
durationTime: clip.durationTime,
|
|
345
|
+
lane: clip.track,
|
|
346
|
+
mediaId: clip.mediaId,
|
|
347
|
+
attachedTo: clip.attachedTo,
|
|
348
|
+
position: clip.position,
|
|
349
|
+
scale: clip.scale,
|
|
350
|
+
...(clip.crop ? { crop: clip.crop } : {}),
|
|
351
|
+
...(clip.frame ? { frame: clip.frame } : {}),
|
|
352
|
+
}],
|
|
353
|
+
},
|
|
354
|
+
};
|
|
355
|
+
}
|
|
280
356
|
if (operation.type === "timeline.audio.fades") {
|
|
281
357
|
const clip = snapshot.timeline.clips.find(({ id }) => id === operation.clipId);
|
|
282
358
|
if (!clip)
|
|
@@ -525,6 +601,32 @@ export class InMemoryEditorAdapter {
|
|
|
525
601
|
fadeOut,
|
|
526
602
|
});
|
|
527
603
|
}
|
|
604
|
+
if (operation.type === "timeline.mask.add") {
|
|
605
|
+
const matches = snapshot.timeline.clips.filter(({ id }) => id === operation.occurrenceId);
|
|
606
|
+
if (matches.length === 0)
|
|
607
|
+
throw new Error(`CLIP_NOT_FOUND: ${operation.occurrenceId}`);
|
|
608
|
+
if (matches.length > 1)
|
|
609
|
+
throw new Error(`AMBIGUOUS_MASK_TARGET: ${operation.occurrenceId}`);
|
|
610
|
+
if (operation.mask.mode === "person-cutout") {
|
|
611
|
+
throw new Error("CAPABILITY_UNAVAILABLE: person cutout");
|
|
612
|
+
}
|
|
613
|
+
const clip = matches[0];
|
|
614
|
+
const media = clip.mediaId ? snapshot.media.find(({ mediaId }) => mediaId === clip.mediaId) : undefined;
|
|
615
|
+
if (clip.role === "audio" || clip.role === "music" || media?.mediaKind === "audio") {
|
|
616
|
+
throw new Error("MASK_TARGET_INCOMPATIBLE: masking requires a video clip");
|
|
617
|
+
}
|
|
618
|
+
if (operation.mask.mode === "supplied-alpha") {
|
|
619
|
+
const alpha = snapshot.media.find(({ mediaId }) => mediaId === operation.mask.alphaMediaId);
|
|
620
|
+
if (!alpha)
|
|
621
|
+
throw new Error(`MEDIA_NOT_FOUND: ${operation.mask.alphaMediaId}`);
|
|
622
|
+
if (alpha.mediaKind !== "video")
|
|
623
|
+
throw new Error(`MEDIA_KIND_MISMATCH: ${operation.mask.alphaMediaId}`);
|
|
624
|
+
}
|
|
625
|
+
return this.updateClip(snapshot, {
|
|
626
|
+
...clip,
|
|
627
|
+
mask: structuredClone(operation.mask),
|
|
628
|
+
});
|
|
629
|
+
}
|
|
528
630
|
if (operation.type === "reduce-noise") {
|
|
529
631
|
const clip = snapshot.timeline.clips.find(({ id }) => id === operation.clipId);
|
|
530
632
|
if (!clip)
|
|
@@ -622,6 +724,7 @@ export class InMemoryEditorAdapter {
|
|
|
622
724
|
lane: updatedClip.track,
|
|
623
725
|
...(updatedClip.mediaId ? { mediaId: updatedClip.mediaId } : {}),
|
|
624
726
|
...(updatedClip.attachedTo ? { attachedTo: updatedClip.attachedTo } : {}),
|
|
727
|
+
...(updatedClip.mask ? { mask: structuredClone(updatedClip.mask) } : {}),
|
|
625
728
|
}
|
|
626
729
|
: element),
|
|
627
730
|
},
|
|
@@ -633,6 +736,9 @@ export class InMemoryEditorAdapter {
|
|
|
633
736
|
if (!Number.isFinite(start) || !Number.isFinite(end) || start < 0 || end <= start) {
|
|
634
737
|
throw new Error("INVALID_OPERATION: ripple delete range must be positive");
|
|
635
738
|
}
|
|
739
|
+
if (end > snapshot.timeline.duration) {
|
|
740
|
+
throw new Error(`INVALID_OPERATION: ripple delete range [${start}, ${end}) must fit timeline bounds [0, ${snapshot.timeline.duration})`);
|
|
741
|
+
}
|
|
636
742
|
const removedDuration = end - start;
|
|
637
743
|
const clips = snapshot.timeline.clips.flatMap((clip) => {
|
|
638
744
|
const clipEnd = clip.start + clip.duration;
|
|
@@ -743,6 +849,7 @@ function createSnapshot(fixture) {
|
|
|
743
849
|
name: fixture.timelineName,
|
|
744
850
|
duration: clips.reduce((end, clip) => Math.max(end, clip.start + clip.duration), 0),
|
|
745
851
|
durationTime: decimalToRational(clips.reduce((end, clip) => Math.max(end, clip.start + clip.duration), 0)),
|
|
852
|
+
...(fixture.frameDuration ? { frameDuration: structuredClone(fixture.frameDuration) } : {}),
|
|
746
853
|
clips,
|
|
747
854
|
storyElements: clips.map((clip) => ({
|
|
748
855
|
id: clip.id,
|
|
@@ -754,6 +861,11 @@ function createSnapshot(fixture) {
|
|
|
754
861
|
lane: clip.track,
|
|
755
862
|
mediaId: clip.mediaId,
|
|
756
863
|
...(clip.attachedTo ? { attachedTo: clip.attachedTo } : {}),
|
|
864
|
+
...(clip.position ? { position: structuredClone(clip.position) } : {}),
|
|
865
|
+
...(clip.scale !== undefined ? { scale: clip.scale } : {}),
|
|
866
|
+
...(clip.crop ? { crop: structuredClone(clip.crop) } : {}),
|
|
867
|
+
...(clip.frame ? { frame: structuredClone(clip.frame) } : {}),
|
|
868
|
+
...(clip.mask ? { mask: structuredClone(clip.mask) } : {}),
|
|
757
869
|
})),
|
|
758
870
|
markers: (fixture.markers ?? []).map((marker) => normalizeMarker(marker)),
|
|
759
871
|
captions: (fixture.captions ?? []).map((caption) => normalizeCaption(caption)),
|
|
@@ -802,3 +914,17 @@ function isMediaCompatible(role, mediaKind) {
|
|
|
802
914
|
return false;
|
|
803
915
|
return true;
|
|
804
916
|
}
|
|
917
|
+
function assertPictureInPictureCrop(crop) {
|
|
918
|
+
const values = [crop.top, crop.right, crop.bottom, crop.left];
|
|
919
|
+
if (!values.every((value) => Number.isFinite(value) && value >= 0 && value < 1)
|
|
920
|
+
|| crop.left + crop.right >= 1
|
|
921
|
+
|| crop.top + crop.bottom >= 1) {
|
|
922
|
+
throw new Error("INVALID_OPERATION: PIP crop must leave a positive source rectangle");
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
function assertPictureInPictureFrame(frame) {
|
|
926
|
+
if (frame.style !== "solid" || !/^#[0-9a-f]{6}$/i.test(frame.color)
|
|
927
|
+
|| !Number.isFinite(frame.width) || frame.width < 0) {
|
|
928
|
+
throw new Error("INVALID_OPERATION: PIP frame must be a solid hex-colored non-negative width");
|
|
929
|
+
}
|
|
930
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morshoto/framekit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"packageManager": "pnpm@12.3.4",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -22,12 +22,15 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsc -p tsconfig.json",
|
|
24
24
|
"build:package": "tsc -p tsconfig.package.json && tsc-alias -p tsconfig.package.json",
|
|
25
|
-
"test": "tsx --test tests/integration/*.test.ts tests/evaluation/*.test.ts tests/filler-removal/*.test.ts tests/speech/*.test.ts tests/golden/*.test.ts tests/release-gate/*.test.ts",
|
|
25
|
+
"test": "tsx --test tests/integration/*.test.ts tests/evaluation/*.test.ts tests/filler-removal/*.test.ts tests/speech/*.test.ts tests/golden/*.test.ts tests/release-gate/*.test.ts tests/release-report/*.test.ts",
|
|
26
|
+
"test:coverage": "c8 --reporter=json-summary --reporter=text --reports-dir=\"${C8_REPORTS_DIR:-coverage}\" pnpm test",
|
|
26
27
|
"test:filler-removal": "tsx --test tests/filler-removal/*.test.ts",
|
|
27
28
|
"benchmark:filler-removal": "tsx scripts/run-filler-removal-benchmark.ts",
|
|
28
29
|
"test:golden": "tsx --test tests/golden/*.test.ts",
|
|
29
30
|
"test:release-gate": "tsx --test tests/release-gate/*.test.ts",
|
|
30
31
|
"release-gate": "tsx scripts/run-release-gate.ts",
|
|
32
|
+
"release-report": "tsx scripts/generate-release-report.ts",
|
|
33
|
+
"verify-release-provenance": "tsx scripts/verify-release-provenance.ts",
|
|
31
34
|
"test:codex-plugin": "node scripts/codex-plugin-smoke.mjs",
|
|
32
35
|
"test:clean-mcp-clients": "node scripts/clean-mcp-client-smoke.mjs",
|
|
33
36
|
"evaluate": "tsx scripts/run-mcp-evaluation.ts",
|
|
@@ -41,6 +44,11 @@
|
|
|
41
44
|
"test:watch": "tsx --test --watch tests/integration/*.test.ts tests/evaluation/*.test.ts tests/filler-removal/*.test.ts tests/golden/*.test.ts",
|
|
42
45
|
"test:final-cut-disposable-headed": "node scripts/final-cut-disposable-native-headed-e2e.mjs",
|
|
43
46
|
"test:final-cut-transition-headed": "node scripts/final-cut-transition-headed-e2e.mjs",
|
|
47
|
+
"test:final-cut-pip-headed": "node scripts/final-cut-picture-in-picture-headed-e2e.mjs",
|
|
48
|
+
"test:final-cut-masking-headed": "node scripts/final-cut-masking-headed-e2e.mjs",
|
|
49
|
+
"test:final-cut-title-headed": "node scripts/final-cut-title-discovery-headed-e2e.mjs",
|
|
50
|
+
"test:final-cut-rough-cut-headed": "node scripts/final-cut-rough-cut-headed-e2e.mjs",
|
|
51
|
+
"test:final-cut-background-headed": "node scripts/final-cut-background-regression-headed-e2e.mjs",
|
|
44
52
|
"hooks:install": "node scripts/install-git-hooks.mjs",
|
|
45
53
|
"mcp": "tsx apps/mcp-server/src/main.ts",
|
|
46
54
|
"framekit": "node ./bin/framekit.mjs",
|
|
@@ -65,7 +73,9 @@
|
|
|
65
73
|
"zod": "^3.25.76"
|
|
66
74
|
},
|
|
67
75
|
"devDependencies": {
|
|
76
|
+
"@openai/codex": "0.144.1",
|
|
68
77
|
"@types/node": "24.13.3",
|
|
78
|
+
"c8": "10.1.3",
|
|
69
79
|
"tsc-alias": "1.9.4",
|
|
70
80
|
"tsx": "4.23.13",
|
|
71
81
|
"typescript": "7.0.2"
|