@morshoto/framekit 0.1.0 → 0.1.5
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/README.md +42 -17
- package/dist-package/adapters/final-cut/typescript/src/analyzers.js +86 -2
- package/dist-package/adapters/final-cut/typescript/src/connection.js +5 -1
- package/dist-package/adapters/final-cut/typescript/src/export.js +231 -8
- package/dist-package/adapters/final-cut/typescript/src/fcpxml.js +70 -9
- package/dist-package/adapters/final-cut/typescript/src/live.js +2 -2
- package/dist-package/adapters/final-cut/typescript/src/native.js +1000 -100
- package/dist-package/adapters/final-cut/typescript/src/publisher.js +242 -30
- package/dist-package/adapters/final-cut/typescript/src/session.js +86 -9
- package/dist-package/apps/mcp-server/src/main.js +10 -1
- package/dist-package/apps/mcp-server/src/routing.js +172 -0
- package/dist-package/apps/mcp-server/src/server.js +867 -52
- package/dist-package/apps/mcp-server/src/version.js +34 -0
- package/dist-package/packages/runtime/src/application/duration-policy-service.js +6 -0
- package/dist-package/packages/runtime/src/application/media-analysis-service.js +473 -0
- package/dist-package/packages/runtime/src/application/project-service.js +146 -0
- package/dist-package/packages/runtime/src/application/runtime-options.js +1 -0
- package/dist-package/packages/runtime/src/application/transaction-store.js +12 -0
- package/dist-package/packages/runtime/src/audio/dialogue-normalization.js +64 -0
- package/dist-package/packages/runtime/src/audio/noise-reduction.js +46 -0
- package/dist-package/packages/runtime/src/capabilities.js +187 -1
- package/dist-package/packages/runtime/src/color-correction.js +48 -0
- package/dist-package/packages/runtime/src/context/context-engine.js +20 -6
- package/dist-package/packages/runtime/src/context/context-service.js +30 -0
- package/dist-package/packages/runtime/src/context/revision.js +3 -0
- package/dist-package/packages/runtime/src/domain/capabilities.js +1 -0
- package/dist-package/packages/runtime/src/domain/context.js +1 -0
- package/dist-package/packages/runtime/src/domain/diff.js +1 -0
- package/dist-package/packages/runtime/src/domain/duration.js +1 -0
- package/dist-package/packages/runtime/src/domain/editing.js +1 -0
- package/dist-package/packages/runtime/src/domain/index.js +12 -0
- package/dist-package/packages/runtime/src/domain/media.js +8 -0
- package/dist-package/packages/runtime/src/domain/ports.js +1 -0
- package/dist-package/packages/runtime/src/domain/primitives.js +1 -0
- package/dist-package/packages/runtime/src/domain/project.js +1 -0
- package/dist-package/packages/runtime/src/domain/rough-cut.js +69 -0
- package/dist-package/packages/runtime/src/domain/skills.js +33 -0
- package/dist-package/packages/runtime/src/domain/types.js +5 -1
- package/dist-package/packages/runtime/src/domain/verification.js +1 -0
- package/dist-package/packages/runtime/src/editing/dialogue-normalization-service.js +141 -0
- package/dist-package/packages/runtime/src/editing/duration-policy.js +187 -0
- package/dist-package/packages/runtime/src/editing/edit-service.js +449 -0
- package/dist-package/packages/runtime/src/editing/filler-removal-service.js +361 -0
- package/dist-package/packages/runtime/src/editing/music-service.js +85 -0
- package/dist-package/packages/runtime/src/index.js +14 -3
- package/dist-package/packages/runtime/src/planning/rough-cut.js +71 -0
- package/dist-package/packages/runtime/src/runtime.js +131 -826
- package/dist-package/packages/runtime/src/skills/builtin.js +339 -0
- package/dist-package/packages/runtime/src/skills/index.js +3 -0
- package/dist-package/packages/runtime/src/skills/registry.js +74 -0
- package/dist-package/packages/runtime/src/skills/requirements.js +170 -0
- package/dist-package/packages/runtime/src/skills/runtime.js +239 -0
- package/dist-package/packages/runtime/src/speech/analysis.js +301 -0
- package/dist-package/packages/runtime/src/speech/filler-detector.js +132 -0
- package/dist-package/packages/runtime/src/speech/mapping.js +227 -0
- package/dist-package/packages/runtime/src/speech/safe-cut-resolver.js +314 -0
- package/dist-package/packages/runtime/src/timeline/rational-time.js +63 -0
- package/dist-package/packages/runtime/src/verification/verification.js +712 -1
- package/dist-package/packages/testkit/src/fixture-analyzers.js +28 -0
- package/dist-package/packages/testkit/src/in-memory-editor.js +287 -3
- package/dist-package/packages/testkit/src/index.js +1 -0
- package/dist-package/packages/testkit/src/skill-fixtures.js +64 -0
- package/package.json +17 -8
- /package/dist-package/packages/runtime/src/{diff/diff.js → timeline/snapshot-diff.js} +0 -0
- /package/dist-package/packages/runtime/src/{snapshot-digest.js → timeline/snapshot-digest.js} +0 -0
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
export class FixtureSpeechAnalyzer {
|
|
2
|
+
descriptor = { id: "fixture.speech", provider: "fixture", version: "1" };
|
|
3
|
+
capabilities = { transcription: true, vad: true };
|
|
2
4
|
async analyze(input, range) {
|
|
3
5
|
const speech = input.media.speech;
|
|
4
6
|
if (!speech)
|
|
5
7
|
throw new Error(`ANALYSIS_FAILED: no speech fixture for ${input.media.mediaId}`);
|
|
6
8
|
return {
|
|
7
9
|
words: filterRange(speech.words, range),
|
|
10
|
+
...(speech.vadSegments ? { vadSegments: filterSegments(speech.vadSegments, range) } : {}),
|
|
11
|
+
...(speech.silenceSegments ? { silenceSegments: filterSegments(speech.silenceSegments, range) } : {}),
|
|
12
|
+
...(speech.protectedSegments ? { protectedSegments: filterSegments(speech.protectedSegments, range) } : {}),
|
|
8
13
|
};
|
|
9
14
|
}
|
|
10
15
|
}
|
|
11
16
|
export class FixtureAudioAnalyzer {
|
|
17
|
+
descriptor = { id: "fixture.audio", provider: "fixture", version: "1" };
|
|
12
18
|
async analyze(input, range) {
|
|
13
19
|
if (!input.media.audio)
|
|
14
20
|
throw new Error(`ANALYSIS_FAILED: no audio fixture for ${input.media.mediaId}`);
|
|
@@ -16,6 +22,7 @@ export class FixtureAudioAnalyzer {
|
|
|
16
22
|
}
|
|
17
23
|
}
|
|
18
24
|
export class FixtureVisualAnalyzer {
|
|
25
|
+
descriptor = { id: "fixture.visual", provider: "fixture", version: "1" };
|
|
19
26
|
async analyze(input, range) {
|
|
20
27
|
const visual = input.media.visual;
|
|
21
28
|
if (!visual)
|
|
@@ -30,6 +37,20 @@ export class FixtureVisualAnalyzer {
|
|
|
30
37
|
};
|
|
31
38
|
}
|
|
32
39
|
}
|
|
40
|
+
export class FixtureMetadataAnalyzer {
|
|
41
|
+
descriptor = { id: "fixture.metadata", provider: "fixture", version: "1" };
|
|
42
|
+
async analyze(input, range) {
|
|
43
|
+
if (!input.media.metadata)
|
|
44
|
+
throw new Error(`ANALYSIS_FAILED: no metadata fixture for ${input.media.mediaId}`);
|
|
45
|
+
const metadata = structuredClone(input.media.metadata);
|
|
46
|
+
if (!range || !metadata.usableRanges)
|
|
47
|
+
return metadata;
|
|
48
|
+
return {
|
|
49
|
+
...metadata,
|
|
50
|
+
usableRanges: metadata.usableRanges.filter((candidate) => candidate.end > range.start && candidate.start < range.end),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
33
54
|
function filterRange(words, range) {
|
|
34
55
|
if (!range)
|
|
35
56
|
return words.map((word) => ({ ...word }));
|
|
@@ -37,3 +58,10 @@ function filterRange(words, range) {
|
|
|
37
58
|
.filter((word) => word.end > range.start && word.start < range.end)
|
|
38
59
|
.map((word) => ({ ...word }));
|
|
39
60
|
}
|
|
61
|
+
function filterSegments(segments, range) {
|
|
62
|
+
if (!range)
|
|
63
|
+
return segments.map((segment) => ({ ...segment }));
|
|
64
|
+
return segments
|
|
65
|
+
.filter((segment) => segment.end > range.start && segment.start < range.end)
|
|
66
|
+
.map((segment) => ({ ...segment }));
|
|
67
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { diffSnapshots } from "../../runtime/src/index.js";
|
|
1
|
+
import { diffSnapshots, withCapabilityFamilies } from "../../runtime/src/index.js";
|
|
2
2
|
export class InMemoryEditorAdapter {
|
|
3
|
+
getManagedArtifact;
|
|
3
4
|
snapshot;
|
|
4
5
|
assets;
|
|
5
6
|
history = new Map();
|
|
@@ -43,7 +44,7 @@ export class InMemoryEditorAdapter {
|
|
|
43
44
|
return { name: "In-memory Editor", version: "phase-2-fixture", backend: "fixture" };
|
|
44
45
|
}
|
|
45
46
|
async getCapabilities() {
|
|
46
|
-
return {
|
|
47
|
+
return withCapabilityFamilies({
|
|
47
48
|
editor: {
|
|
48
49
|
projectRead: true,
|
|
49
50
|
timelineSnapshotRead: true,
|
|
@@ -62,6 +63,33 @@ export class InMemoryEditorAdapter {
|
|
|
62
63
|
mediaImport: true,
|
|
63
64
|
mediaPlacement: true,
|
|
64
65
|
titlePlacement: true,
|
|
66
|
+
clipMove: true,
|
|
67
|
+
clipReplace: true,
|
|
68
|
+
clipRemoval: true,
|
|
69
|
+
transitionPlacement: true,
|
|
70
|
+
audioAttachment: true,
|
|
71
|
+
audioMixing: true,
|
|
72
|
+
noiseReduction: true,
|
|
73
|
+
colorCorrection: true,
|
|
74
|
+
semanticOperations: {
|
|
75
|
+
"rename-clip": true,
|
|
76
|
+
"trim-clip": true,
|
|
77
|
+
"set-gain": true,
|
|
78
|
+
"reduce-noise": true,
|
|
79
|
+
"set-color-correction": true,
|
|
80
|
+
"ripple-delete": true,
|
|
81
|
+
"add-marker": true,
|
|
82
|
+
"media.import": true,
|
|
83
|
+
"timeline.media.add": true,
|
|
84
|
+
"timeline.audio.fades": true,
|
|
85
|
+
"timeline.title.add": true,
|
|
86
|
+
"timeline.media.move": true,
|
|
87
|
+
"timeline.media.replace": true,
|
|
88
|
+
"timeline.media.remove": true,
|
|
89
|
+
"timeline.transition.add": true,
|
|
90
|
+
"timeline.audio.attach": true,
|
|
91
|
+
"timeline.audio.mix": true,
|
|
92
|
+
},
|
|
65
93
|
},
|
|
66
94
|
analyzers: {
|
|
67
95
|
speechTranscribe: false,
|
|
@@ -69,7 +97,7 @@ export class InMemoryEditorAdapter {
|
|
|
69
97
|
audioLoudness: false,
|
|
70
98
|
visualTrack: false,
|
|
71
99
|
},
|
|
72
|
-
};
|
|
100
|
+
}, { backend: "fixture" });
|
|
73
101
|
}
|
|
74
102
|
async captureFrame(position, expectedRevision) {
|
|
75
103
|
if (this.snapshot.revision.id !== expectedRevision.id
|
|
@@ -204,6 +232,9 @@ export class InMemoryEditorAdapter {
|
|
|
204
232
|
const media = snapshot.media.find((candidate) => candidate.mediaId === operation.mediaId);
|
|
205
233
|
if (!media)
|
|
206
234
|
throw new Error(`MEDIA_NOT_FOUND: ${operation.mediaId}`);
|
|
235
|
+
if (!isMediaCompatible(operation.role, media.mediaKind)) {
|
|
236
|
+
throw new Error(`MEDIA_KIND_MISMATCH: ${operation.mediaId}`);
|
|
237
|
+
}
|
|
207
238
|
if (snapshot.timeline.clips.some((clip) => clip.id === operation.occurrenceId)) {
|
|
208
239
|
throw new Error(`OCCURRENCE_ALREADY_EXISTS: ${operation.occurrenceId}`);
|
|
209
240
|
}
|
|
@@ -225,6 +256,7 @@ export class InMemoryEditorAdapter {
|
|
|
225
256
|
start: operation.start,
|
|
226
257
|
duration: operation.duration,
|
|
227
258
|
track: typeof lane === "number" ? lane : 0,
|
|
259
|
+
role: operation.role,
|
|
228
260
|
});
|
|
229
261
|
return {
|
|
230
262
|
...snapshot,
|
|
@@ -240,6 +272,7 @@ export class InMemoryEditorAdapter {
|
|
|
240
272
|
durationTime: clip.durationTime,
|
|
241
273
|
lane: clip.track,
|
|
242
274
|
mediaId: clip.mediaId,
|
|
275
|
+
...(clip.attachedTo ? { attachedTo: clip.attachedTo } : {}),
|
|
243
276
|
}],
|
|
244
277
|
},
|
|
245
278
|
};
|
|
@@ -300,6 +333,226 @@ export class InMemoryEditorAdapter {
|
|
|
300
333
|
},
|
|
301
334
|
};
|
|
302
335
|
}
|
|
336
|
+
if (operation.type === "timeline.media.move") {
|
|
337
|
+
const clip = snapshot.timeline.clips.find(({ id }) => id === operation.occurrenceId);
|
|
338
|
+
if (!clip)
|
|
339
|
+
throw new Error(`CLIP_NOT_FOUND: ${operation.occurrenceId}`);
|
|
340
|
+
if (!Number.isFinite(operation.start) || operation.start < 0) {
|
|
341
|
+
throw new Error("INVALID_OPERATION: media move start must be non-negative");
|
|
342
|
+
}
|
|
343
|
+
const lane = operation.targetLane ?? (clip.track === 0 ? "primary" : clip.track);
|
|
344
|
+
if (lane === "primary") {
|
|
345
|
+
if (clip.role !== undefined && clip.role !== "video") {
|
|
346
|
+
throw new Error("INVALID_OPERATION: audio and title clips require a non-primary lane");
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
else if (!Number.isInteger(lane) || lane === 0) {
|
|
350
|
+
throw new Error("INVALID_OPERATION: media move requires a valid lane");
|
|
351
|
+
}
|
|
352
|
+
return this.updateClip(snapshot, withClipTime({
|
|
353
|
+
...clip,
|
|
354
|
+
start: operation.start,
|
|
355
|
+
track: lane === "primary" ? 0 : lane,
|
|
356
|
+
startTime: undefined,
|
|
357
|
+
durationTime: undefined,
|
|
358
|
+
}));
|
|
359
|
+
}
|
|
360
|
+
if (operation.type === "timeline.media.replace") {
|
|
361
|
+
const clip = snapshot.timeline.clips.find(({ id }) => id === operation.occurrenceId);
|
|
362
|
+
if (!clip)
|
|
363
|
+
throw new Error(`CLIP_NOT_FOUND: ${operation.occurrenceId}`);
|
|
364
|
+
const media = snapshot.media.find(({ mediaId }) => mediaId === operation.mediaId);
|
|
365
|
+
if (!media)
|
|
366
|
+
throw new Error(`MEDIA_NOT_FOUND: ${operation.mediaId}`);
|
|
367
|
+
const currentMedia = clip.mediaId
|
|
368
|
+
? snapshot.media.find(({ mediaId }) => mediaId === clip.mediaId)
|
|
369
|
+
: undefined;
|
|
370
|
+
const currentKind = clip.role === "audio" || clip.role === "music"
|
|
371
|
+
? "audio"
|
|
372
|
+
: clip.role === "video" ? "video" : currentMedia?.mediaKind;
|
|
373
|
+
if (!isMediaCompatible(clip.role, media.mediaKind)
|
|
374
|
+
|| (currentKind !== undefined && media.mediaKind !== undefined && currentKind !== media.mediaKind)) {
|
|
375
|
+
throw new Error(`MEDIA_KIND_MISMATCH: ${operation.mediaId}`);
|
|
376
|
+
}
|
|
377
|
+
const duration = operation.duration ?? clip.duration;
|
|
378
|
+
if (!Number.isFinite(duration) || duration <= 0 || (media.duration !== undefined && duration > media.duration)) {
|
|
379
|
+
throw new Error("INVALID_OPERATION: replacement duration must fit the source");
|
|
380
|
+
}
|
|
381
|
+
return this.updateClip(snapshot, withClipTime({
|
|
382
|
+
...clip,
|
|
383
|
+
mediaId: operation.mediaId,
|
|
384
|
+
name: media.source.split("/").pop() || media.mediaId,
|
|
385
|
+
duration,
|
|
386
|
+
startTime: undefined,
|
|
387
|
+
durationTime: undefined,
|
|
388
|
+
}));
|
|
389
|
+
}
|
|
390
|
+
if (operation.type === "timeline.media.remove") {
|
|
391
|
+
const clip = snapshot.timeline.clips.find(({ id }) => id === operation.occurrenceId);
|
|
392
|
+
if (!clip)
|
|
393
|
+
throw new Error(`CLIP_NOT_FOUND: ${operation.occurrenceId}`);
|
|
394
|
+
const removedIds = new Set([operation.occurrenceId]);
|
|
395
|
+
snapshot.timeline.clips.forEach((candidate) => {
|
|
396
|
+
if (candidate.attachedTo === operation.occurrenceId)
|
|
397
|
+
removedIds.add(candidate.id);
|
|
398
|
+
});
|
|
399
|
+
return {
|
|
400
|
+
...snapshot,
|
|
401
|
+
timeline: {
|
|
402
|
+
...snapshot.timeline,
|
|
403
|
+
clips: snapshot.timeline.clips.filter((candidate) => !removedIds.has(candidate.id)),
|
|
404
|
+
storyElements: snapshot.timeline.storyElements.filter((element) => !removedIds.has(element.id)
|
|
405
|
+
&& !removedIds.has(element.attachedTo ?? "")
|
|
406
|
+
&& !removedIds.has(element.beforeClipId ?? "")
|
|
407
|
+
&& !removedIds.has(element.afterClipId ?? "")),
|
|
408
|
+
},
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
if (operation.type === "timeline.transition.add") {
|
|
412
|
+
const asset = this.assets.find((candidate) => candidate.id === operation.assetId && candidate.kind === "transition");
|
|
413
|
+
if (!asset)
|
|
414
|
+
throw new Error(`TRANSITION_ASSET_NOT_FOUND: ${operation.assetId}`);
|
|
415
|
+
if (asset.compatibility?.timelineKinds?.includes("asset-clip") !== true) {
|
|
416
|
+
throw new Error(`TRANSITION_ASSET_INCOMPATIBLE: ${operation.assetId}`);
|
|
417
|
+
}
|
|
418
|
+
if (snapshot.timeline.storyElements.some(({ id }) => id === operation.transitionId)
|
|
419
|
+
|| snapshot.timeline.clips.some(({ id }) => id === operation.transitionId)) {
|
|
420
|
+
throw new Error(`OCCURRENCE_ALREADY_EXISTS: ${operation.transitionId}`);
|
|
421
|
+
}
|
|
422
|
+
const before = snapshot.timeline.clips.find(({ id }) => id === operation.beforeClipId);
|
|
423
|
+
const after = snapshot.timeline.clips.find(({ id }) => id === operation.afterClipId);
|
|
424
|
+
if (!before || !after)
|
|
425
|
+
throw new Error("EDIT_POINT_NOT_FOUND: transition clips are required");
|
|
426
|
+
if (before.track !== after.track || Math.abs((before.start + before.duration) - after.start) > 1e-6) {
|
|
427
|
+
throw new Error("EDIT_POINT_INVALID: transition clips must meet on one lane");
|
|
428
|
+
}
|
|
429
|
+
if (!Number.isFinite(operation.duration) || operation.duration <= 0
|
|
430
|
+
|| operation.duration > Math.min(before.duration, after.duration)) {
|
|
431
|
+
throw new Error("INVALID_OPERATION: transition duration must fit both clips");
|
|
432
|
+
}
|
|
433
|
+
const start = after.start - operation.duration / 2;
|
|
434
|
+
return {
|
|
435
|
+
...snapshot,
|
|
436
|
+
timeline: {
|
|
437
|
+
...snapshot.timeline,
|
|
438
|
+
storyElements: [...snapshot.timeline.storyElements, {
|
|
439
|
+
id: operation.transitionId,
|
|
440
|
+
kind: "transition",
|
|
441
|
+
start,
|
|
442
|
+
duration: operation.duration,
|
|
443
|
+
startTime: decimalToRational(start),
|
|
444
|
+
durationTime: decimalToRational(operation.duration),
|
|
445
|
+
lane: before.track,
|
|
446
|
+
assetId: operation.assetId,
|
|
447
|
+
beforeClipId: operation.beforeClipId,
|
|
448
|
+
afterClipId: operation.afterClipId,
|
|
449
|
+
}],
|
|
450
|
+
},
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
if (operation.type === "timeline.audio.attach") {
|
|
454
|
+
const target = snapshot.timeline.clips.find(({ id }) => id === operation.targetClipId);
|
|
455
|
+
if (!target)
|
|
456
|
+
throw new Error(`CLIP_NOT_FOUND: ${operation.targetClipId}`);
|
|
457
|
+
const media = snapshot.media.find(({ mediaId }) => mediaId === operation.mediaId);
|
|
458
|
+
if (!media)
|
|
459
|
+
throw new Error(`MEDIA_NOT_FOUND: ${operation.mediaId}`);
|
|
460
|
+
if (media.mediaKind !== "audio")
|
|
461
|
+
throw new Error(`AUDIO_MEDIA_REQUIRED: ${operation.mediaId}`);
|
|
462
|
+
if (snapshot.timeline.clips.some(({ id }) => id === operation.occurrenceId)
|
|
463
|
+
|| snapshot.timeline.storyElements.some(({ id }) => id === operation.occurrenceId)) {
|
|
464
|
+
throw new Error(`OCCURRENCE_ALREADY_EXISTS: ${operation.occurrenceId}`);
|
|
465
|
+
}
|
|
466
|
+
const startOffset = operation.startOffset ?? 0;
|
|
467
|
+
const duration = operation.duration ?? media.duration;
|
|
468
|
+
if (!Number.isFinite(startOffset) || startOffset < 0 || duration === undefined
|
|
469
|
+
|| !Number.isFinite(duration) || duration <= 0
|
|
470
|
+
|| (media.duration !== undefined && duration > media.duration)
|
|
471
|
+
|| startOffset + duration > target.duration) {
|
|
472
|
+
throw new Error("INVALID_OPERATION: attached audio must fit within the target clip");
|
|
473
|
+
}
|
|
474
|
+
const clip = withClipTime({
|
|
475
|
+
id: operation.occurrenceId,
|
|
476
|
+
mediaId: operation.mediaId,
|
|
477
|
+
name: media.source.split("/").pop() || media.mediaId,
|
|
478
|
+
start: target.start + startOffset,
|
|
479
|
+
duration,
|
|
480
|
+
track: -1,
|
|
481
|
+
role: "audio",
|
|
482
|
+
attachedTo: target.id,
|
|
483
|
+
});
|
|
484
|
+
return {
|
|
485
|
+
...snapshot,
|
|
486
|
+
timeline: {
|
|
487
|
+
...snapshot.timeline,
|
|
488
|
+
clips: [...snapshot.timeline.clips, clip],
|
|
489
|
+
storyElements: [...snapshot.timeline.storyElements, {
|
|
490
|
+
id: clip.id,
|
|
491
|
+
kind: "asset-clip",
|
|
492
|
+
start: clip.start,
|
|
493
|
+
duration: clip.duration,
|
|
494
|
+
startTime: clip.startTime,
|
|
495
|
+
durationTime: clip.durationTime,
|
|
496
|
+
lane: clip.track,
|
|
497
|
+
mediaId: clip.mediaId,
|
|
498
|
+
attachedTo: clip.attachedTo,
|
|
499
|
+
}],
|
|
500
|
+
},
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
if (operation.type === "timeline.audio.mix") {
|
|
504
|
+
const clip = snapshot.timeline.clips.find(({ id }) => id === operation.clipId);
|
|
505
|
+
if (!clip)
|
|
506
|
+
throw new Error(`CLIP_NOT_FOUND: ${operation.clipId}`);
|
|
507
|
+
const media = clip.mediaId ? snapshot.media.find(({ mediaId }) => mediaId === clip.mediaId) : undefined;
|
|
508
|
+
if (clip.role !== "audio" && clip.role !== "music" && media?.mediaKind !== "audio") {
|
|
509
|
+
throw new Error("INVALID_OPERATION: audio mix requires an audio clip");
|
|
510
|
+
}
|
|
511
|
+
if (operation.gainDb === undefined && operation.fadeIn === undefined && operation.fadeOut === undefined) {
|
|
512
|
+
throw new Error("INVALID_OPERATION: audio mix requires a gain or fade change");
|
|
513
|
+
}
|
|
514
|
+
const fadeIn = operation.fadeIn ?? clip.fadeIn ?? 0;
|
|
515
|
+
const fadeOut = operation.fadeOut ?? clip.fadeOut ?? 0;
|
|
516
|
+
if ((operation.gainDb !== undefined && !Number.isFinite(operation.gainDb))
|
|
517
|
+
|| !Number.isFinite(fadeIn) || !Number.isFinite(fadeOut)
|
|
518
|
+
|| fadeIn < 0 || fadeOut < 0 || fadeIn + fadeOut > clip.duration) {
|
|
519
|
+
throw new Error("INVALID_OPERATION: audio mix values must fit the clip");
|
|
520
|
+
}
|
|
521
|
+
return this.updateClip(snapshot, {
|
|
522
|
+
...clip,
|
|
523
|
+
...(operation.gainDb !== undefined ? { gainDb: operation.gainDb } : {}),
|
|
524
|
+
fadeIn,
|
|
525
|
+
fadeOut,
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
if (operation.type === "reduce-noise") {
|
|
529
|
+
const clip = snapshot.timeline.clips.find(({ id }) => id === operation.clipId);
|
|
530
|
+
if (!clip)
|
|
531
|
+
throw new Error(`CLIP_NOT_FOUND: ${operation.clipId}`);
|
|
532
|
+
const media = clip.mediaId ? snapshot.media.find(({ mediaId }) => mediaId === clip.mediaId) : undefined;
|
|
533
|
+
if (clip.role !== "audio" && clip.role !== "music" && media?.mediaKind !== "audio") {
|
|
534
|
+
throw new Error("INVALID_OPERATION: noise reduction requires an audio clip");
|
|
535
|
+
}
|
|
536
|
+
if (!Number.isFinite(operation.reductionDb) || operation.reductionDb <= 0
|
|
537
|
+
|| operation.range.start < clip.start
|
|
538
|
+
|| operation.range.end > clip.start + clip.duration
|
|
539
|
+
|| operation.range.end <= operation.range.start) {
|
|
540
|
+
throw new Error("INVALID_OPERATION: noise reduction range and adjustment must fit the clip");
|
|
541
|
+
}
|
|
542
|
+
return this.updateClip(snapshot, {
|
|
543
|
+
...clip,
|
|
544
|
+
noiseReductionDb: (clip.noiseReductionDb ?? 0) + operation.reductionDb,
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
if (operation.type === "set-color-correction") {
|
|
548
|
+
const clip = snapshot.timeline.clips.find(({ id }) => id === operation.clipId);
|
|
549
|
+
if (!clip)
|
|
550
|
+
throw new Error(`CLIP_NOT_FOUND: ${operation.clipId}`);
|
|
551
|
+
return this.updateClip(snapshot, {
|
|
552
|
+
...clip,
|
|
553
|
+
colorCorrection: structuredClone(operation.correction),
|
|
554
|
+
});
|
|
555
|
+
}
|
|
303
556
|
if (operation.type === "ripple-delete") {
|
|
304
557
|
return this.applyRippleDelete(snapshot, operation.timelineId, operation.range.start, operation.range.end);
|
|
305
558
|
}
|
|
@@ -353,6 +606,27 @@ export class InMemoryEditorAdapter {
|
|
|
353
606
|
},
|
|
354
607
|
};
|
|
355
608
|
}
|
|
609
|
+
updateClip(snapshot, updatedClip) {
|
|
610
|
+
return {
|
|
611
|
+
...snapshot,
|
|
612
|
+
timeline: {
|
|
613
|
+
...snapshot.timeline,
|
|
614
|
+
clips: snapshot.timeline.clips.map((candidate) => candidate.id === updatedClip.id ? updatedClip : candidate),
|
|
615
|
+
storyElements: snapshot.timeline.storyElements.map((element) => element.id === updatedClip.id
|
|
616
|
+
? {
|
|
617
|
+
...element,
|
|
618
|
+
start: updatedClip.start,
|
|
619
|
+
duration: updatedClip.duration,
|
|
620
|
+
startTime: updatedClip.startTime,
|
|
621
|
+
durationTime: updatedClip.durationTime,
|
|
622
|
+
lane: updatedClip.track,
|
|
623
|
+
...(updatedClip.mediaId ? { mediaId: updatedClip.mediaId } : {}),
|
|
624
|
+
...(updatedClip.attachedTo ? { attachedTo: updatedClip.attachedTo } : {}),
|
|
625
|
+
}
|
|
626
|
+
: element),
|
|
627
|
+
},
|
|
628
|
+
};
|
|
629
|
+
}
|
|
356
630
|
applyRippleDelete(snapshot, timelineId, start, end) {
|
|
357
631
|
if (timelineId !== snapshot.timeline.id)
|
|
358
632
|
throw new Error(`TIMELINE_NOT_FOUND: ${timelineId}`);
|
|
@@ -479,6 +753,7 @@ function createSnapshot(fixture) {
|
|
|
479
753
|
durationTime: clip.durationTime,
|
|
480
754
|
lane: clip.track,
|
|
481
755
|
mediaId: clip.mediaId,
|
|
756
|
+
...(clip.attachedTo ? { attachedTo: clip.attachedTo } : {}),
|
|
482
757
|
})),
|
|
483
758
|
markers: (fixture.markers ?? []).map((marker) => normalizeMarker(marker)),
|
|
484
759
|
captions: (fixture.captions ?? []).map((caption) => normalizeCaption(caption)),
|
|
@@ -518,3 +793,12 @@ function decimalToRational(value) {
|
|
|
518
793
|
const scale = 10 ** decimals;
|
|
519
794
|
return { value: String(Math.round(value * scale)), timescale: String(scale) };
|
|
520
795
|
}
|
|
796
|
+
function isMediaCompatible(role, mediaKind) {
|
|
797
|
+
if (role === "video")
|
|
798
|
+
return mediaKind === undefined || mediaKind === "video";
|
|
799
|
+
if (role === "audio" || role === "music")
|
|
800
|
+
return mediaKind === undefined || mediaKind === "audio";
|
|
801
|
+
if (role === "title")
|
|
802
|
+
return false;
|
|
803
|
+
return true;
|
|
804
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** Neutral Skill used to conformance-test runtime and adapter boundaries. */
|
|
2
|
+
export function createAddMarkerSkill() {
|
|
3
|
+
return {
|
|
4
|
+
manifest: {
|
|
5
|
+
contractVersion: 1,
|
|
6
|
+
id: "fixture.add-marker",
|
|
7
|
+
version: "0.0.2",
|
|
8
|
+
title: "Add marker",
|
|
9
|
+
description: "Add one deterministic review marker to the active timeline.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
name: { type: "string", minLength: 1 },
|
|
14
|
+
start: { type: "number", minimum: 0 },
|
|
15
|
+
},
|
|
16
|
+
required: ["name", "start"],
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
},
|
|
19
|
+
requirements: {
|
|
20
|
+
type: "anyOf",
|
|
21
|
+
requirements: [
|
|
22
|
+
{
|
|
23
|
+
type: "allOf",
|
|
24
|
+
requirements: [
|
|
25
|
+
{ type: "editor", capability: "timelineSnapshotRead" },
|
|
26
|
+
{ type: "editor", capability: "timelineWrite" },
|
|
27
|
+
{ type: "editor", capability: "readAfterWrite" },
|
|
28
|
+
{ type: "editor", capability: "rollback" },
|
|
29
|
+
{ type: "operation", operation: "add-marker" },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: "allOf",
|
|
34
|
+
requirements: [
|
|
35
|
+
{ type: "editor", capability: "timelineSnapshotRead" },
|
|
36
|
+
{ type: "editor", capability: "timelineArtifactWrite" },
|
|
37
|
+
{ type: "editor", capability: "readAfterWrite" },
|
|
38
|
+
{ type: "editor", capability: "rollback" },
|
|
39
|
+
{ type: "operation", operation: "add-marker" },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
verification: { requireExpectedChange: true },
|
|
45
|
+
},
|
|
46
|
+
handler: {
|
|
47
|
+
normalize: (input) => input,
|
|
48
|
+
plan: (context, input) => ({
|
|
49
|
+
operations: [{
|
|
50
|
+
type: "add-marker",
|
|
51
|
+
timelineId: context.project.timeline.id,
|
|
52
|
+
marker: {
|
|
53
|
+
id: `fixture-marker-${String(input.start)}`,
|
|
54
|
+
start: input.start,
|
|
55
|
+
duration: 0,
|
|
56
|
+
name: input.name,
|
|
57
|
+
},
|
|
58
|
+
}],
|
|
59
|
+
affectedRanges: [{ start: input.start, end: input.start }],
|
|
60
|
+
warnings: [],
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morshoto/framekit",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"packageManager": "pnpm@
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"packageManager": "pnpm@12.3.4",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "Agentic video editing runtime and MCP server for Final Cut Pro",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/morshoto/framekit.git"
|
|
11
|
+
},
|
|
8
12
|
"files": [
|
|
9
13
|
"bin",
|
|
10
14
|
"dist-package"
|
|
@@ -18,25 +22,30 @@
|
|
|
18
22
|
"scripts": {
|
|
19
23
|
"build": "tsc -p tsconfig.json",
|
|
20
24
|
"build:package": "tsc -p tsconfig.package.json && tsc-alias -p tsconfig.package.json",
|
|
21
|
-
"test": "tsx --test tests/integration/*.test.ts tests/evaluation/*.test.ts tests/filler-removal/*.test.ts tests/golden/*.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",
|
|
22
26
|
"test:filler-removal": "tsx --test tests/filler-removal/*.test.ts",
|
|
23
27
|
"benchmark:filler-removal": "tsx scripts/run-filler-removal-benchmark.ts",
|
|
24
28
|
"test:golden": "tsx --test tests/golden/*.test.ts",
|
|
29
|
+
"test:release-gate": "tsx --test tests/release-gate/*.test.ts",
|
|
30
|
+
"release-gate": "tsx scripts/run-release-gate.ts",
|
|
25
31
|
"test:codex-plugin": "node scripts/codex-plugin-smoke.mjs",
|
|
26
32
|
"test:clean-mcp-clients": "node scripts/clean-mcp-client-smoke.mjs",
|
|
27
33
|
"evaluate": "tsx scripts/run-mcp-evaluation.ts",
|
|
28
34
|
"test:final-cut-headless": "tsx --test tests/integration/connection.test.ts tests/integration/finalcut-mcp.test.ts tests/integration/native.test.ts",
|
|
29
35
|
"test:final-cut-overlay-headed": "node scripts/final-cut-overlay-headed-e2e.mjs",
|
|
30
36
|
"test:final-cut-canonical-read-headed": "node scripts/final-cut-canonical-read-headed-e2e.mjs",
|
|
37
|
+
"test:final-cut-publisher-headed": "node scripts/final-cut-publisher-headed-e2e.mjs",
|
|
38
|
+
"test:final-cut-project-selection-headed": "node scripts/final-cut-project-selection-headed-e2e.mjs",
|
|
31
39
|
"test:final-cut-canonical-headed": "node scripts/final-cut-canonical-headed-e2e.mjs",
|
|
32
40
|
"test:final-cut-filler-headed": "node scripts/final-cut-filler-removal-headed-e2e.mjs",
|
|
33
41
|
"test:watch": "tsx --test --watch tests/integration/*.test.ts tests/evaluation/*.test.ts tests/filler-removal/*.test.ts tests/golden/*.test.ts",
|
|
34
42
|
"test:final-cut-disposable-headed": "node scripts/final-cut-disposable-native-headed-e2e.mjs",
|
|
43
|
+
"test:final-cut-transition-headed": "node scripts/final-cut-transition-headed-e2e.mjs",
|
|
35
44
|
"hooks:install": "node scripts/install-git-hooks.mjs",
|
|
36
45
|
"mcp": "tsx apps/mcp-server/src/main.ts",
|
|
37
46
|
"framekit": "node ./bin/framekit.mjs",
|
|
38
47
|
"package:final-cut-release": "bash scripts/package-final-cut-release.sh",
|
|
39
|
-
"prepack": "
|
|
48
|
+
"prepack": "tsc -p tsconfig.package.json && tsc-alias -p tsconfig.package.json",
|
|
40
49
|
"xcode:check": "bash nix/check-xcode.sh",
|
|
41
50
|
"check:boundaries": "node scripts/check-boundaries.mjs"
|
|
42
51
|
},
|
|
@@ -56,9 +65,9 @@
|
|
|
56
65
|
"zod": "^3.25.76"
|
|
57
66
|
},
|
|
58
67
|
"devDependencies": {
|
|
59
|
-
"@types/node": "
|
|
60
|
-
"tsc-alias": "
|
|
61
|
-
"tsx": "
|
|
62
|
-
"typescript": "
|
|
68
|
+
"@types/node": "24.13.3",
|
|
69
|
+
"tsc-alias": "1.9.4",
|
|
70
|
+
"tsx": "4.23.13",
|
|
71
|
+
"typescript": "7.0.2"
|
|
63
72
|
}
|
|
64
73
|
}
|
|
File without changes
|
/package/dist-package/packages/runtime/src/{snapshot-digest.js → timeline/snapshot-digest.js}
RENAMED
|
File without changes
|