@morshoto/framekit 0.2.2 → 0.2.4
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-package/adapters/final-cut/typescript/src/analyzers.d.ts +58 -0
- package/dist-package/adapters/final-cut/typescript/src/analyzers.js +52 -13
- package/dist-package/adapters/final-cut/typescript/src/assets.d.ts +24 -0
- package/dist-package/adapters/final-cut/typescript/src/background-export.d.ts +98 -0
- package/dist-package/adapters/final-cut/typescript/src/background-materialization.d.ts +47 -0
- package/dist-package/adapters/final-cut/typescript/src/canonical-recovery-guard.d.ts +32 -0
- package/dist-package/adapters/final-cut/typescript/src/canonical-recovery.d.ts +22 -0
- package/dist-package/adapters/final-cut/typescript/src/canonical-verification.d.ts +11 -0
- package/dist-package/adapters/final-cut/typescript/src/canonical.d.ts +184 -0
- package/dist-package/adapters/final-cut/typescript/src/canonical.js +33 -1
- package/dist-package/adapters/final-cut/typescript/src/connection.d.ts +103 -0
- package/dist-package/adapters/final-cut/typescript/src/disposable-native.d.ts +90 -0
- package/dist-package/adapters/final-cut/typescript/src/documents.d.ts +3 -0
- package/dist-package/adapters/final-cut/typescript/src/documents.js +3 -0
- package/dist-package/adapters/final-cut/typescript/src/experimental.d.ts +8 -0
- package/dist-package/adapters/final-cut/typescript/src/export.d.ts +125 -0
- package/dist-package/adapters/final-cut/typescript/src/fcpxml-console-experiment.d.ts +54 -0
- package/dist-package/adapters/final-cut/typescript/src/fcpxml.d.ts +75 -0
- package/dist-package/adapters/final-cut/typescript/src/fcpxml.js +6 -1
- package/dist-package/adapters/final-cut/typescript/src/index.d.ts +22 -0
- package/dist-package/adapters/final-cut/typescript/src/library-inspection.d.ts +101 -0
- package/dist-package/adapters/final-cut/typescript/src/live.d.ts +101 -0
- package/dist-package/adapters/final-cut/typescript/src/live.js +8 -0
- package/dist-package/adapters/final-cut/typescript/src/media.d.ts +12 -0
- package/dist-package/adapters/final-cut/typescript/src/native-operation.d.ts +6 -0
- package/dist-package/adapters/final-cut/typescript/src/native-recovery-inspection.d.ts +77 -0
- package/dist-package/adapters/final-cut/typescript/src/native-session.d.ts +130 -0
- package/dist-package/adapters/final-cut/typescript/src/native.d.ts +828 -0
- package/dist-package/adapters/final-cut/typescript/src/native.js +274 -107
- package/dist-package/adapters/final-cut/typescript/src/pasteboard-snapshot.d.ts +114 -0
- package/dist-package/adapters/final-cut/typescript/src/publish-readback.d.ts +26 -0
- package/dist-package/adapters/final-cut/typescript/src/publish-readback.js +18 -2
- package/dist-package/adapters/final-cut/typescript/src/publisher.d.ts +215 -0
- package/dist-package/adapters/final-cut/typescript/src/session.d.ts +43 -0
- package/dist-package/adapters/final-cut/typescript/src/shadow-mutation.d.ts +51 -0
- package/dist-package/adapters/final-cut/typescript/src/sqlite-experiment.d.ts +156 -0
- package/dist-package/adapters/final-cut/typescript/src/sqlite-inspection.d.ts +134 -0
- package/dist-package/adapters/final-cut/typescript/src/sqlite-materialization.d.ts +110 -0
- package/dist-package/adapters/final-cut/typescript/src/sqlite-wal-observation.d.ts +132 -0
- package/dist-package/adapters/final-cut/typescript/src/timeline-ir-fcpxml.d.ts +61 -0
- package/dist-package/adapters/final-cut/typescript/src/timeline-ir-fcpxml.js +28 -4
- package/dist-package/adapters/final-cut/typescript/src/unattended-editing.d.ts +54 -0
- package/dist-package/adapters/headless/typescript/src/audio-output.d.ts +3 -0
- package/dist-package/adapters/headless/typescript/src/ffmpeg-media-probe.d.ts +11 -0
- package/dist-package/adapters/headless/typescript/src/ffmpeg-media-probe.js +26 -2
- package/dist-package/adapters/headless/typescript/src/ffmpeg-renderer.d.ts +27 -0
- package/dist-package/adapters/headless/typescript/src/ffmpeg-renderer.js +7 -2
- package/dist-package/adapters/headless/typescript/src/ffmpeg-storyboard.d.ts +28 -0
- package/dist-package/adapters/headless/typescript/src/ffmpeg-storyboard.js +120 -0
- package/dist-package/adapters/headless/typescript/src/ffmpeg-verifier.d.ts +15 -0
- package/dist-package/adapters/headless/typescript/src/index.d.ts +4 -0
- package/dist-package/adapters/headless/typescript/src/index.js +1 -0
- package/dist-package/apps/cli/src/dev-doctor.d.ts +25 -0
- package/dist-package/apps/cli/src/headless-projects.d.ts +3 -0
- package/dist-package/apps/cli/src/main.d.ts +10 -0
- package/dist-package/apps/mcp-server/runtime/ffmpeg-audio-backend.py +129 -0
- package/dist-package/apps/mcp-server/runtime/whisper-speech-backend.py +92 -2
- package/dist-package/apps/mcp-server/src/build-alignment.d.ts +10 -0
- package/dist-package/apps/mcp-server/src/build-identity.d.ts +7 -0
- package/dist-package/apps/mcp-server/src/build-identity.json +2 -2
- package/dist-package/apps/mcp-server/src/canonical-native-snapshot.d.ts +8 -0
- package/dist-package/apps/mcp-server/src/final-cut-runtime-config.d.ts +5 -0
- package/dist-package/apps/mcp-server/src/headless-project-snapshot.d.ts +3 -0
- package/dist-package/apps/mcp-server/src/headless-sessions.d.ts +89 -0
- package/dist-package/apps/mcp-server/src/main.d.ts +1 -0
- package/dist-package/apps/mcp-server/src/main.js +2 -1
- package/dist-package/apps/mcp-server/src/materialization-jobs.d.ts +204 -0
- package/dist-package/apps/mcp-server/src/readback-policy.d.ts +18 -0
- package/dist-package/apps/mcp-server/src/routing.d.ts +90 -0
- package/dist-package/apps/mcp-server/src/server.d.ts +75 -0
- package/dist-package/apps/mcp-server/src/server.js +93 -9
- package/dist-package/apps/mcp-server/src/tools/skills/catalog.d.ts +19 -0
- package/dist-package/apps/mcp-server/src/tools/skills/metadata.d.ts +37 -0
- package/dist-package/apps/mcp-server/src/tools/skills/register.d.ts +11 -0
- package/dist-package/apps/mcp-server/src/version.d.ts +4 -0
- package/dist-package/packages/headless-application/src/external-edit.d.ts +30 -0
- package/dist-package/packages/headless-application/src/external-edit.js +72 -0
- package/dist-package/packages/headless-application/src/headless-projects.d.ts +259 -0
- package/dist-package/packages/headless-application/src/headless-projects.js +15 -2
- package/dist-package/packages/headless-application/src/index.d.ts +2 -0
- package/dist-package/packages/headless-application/src/index.js +1 -0
- package/dist-package/packages/runtime/src/application/duration-policy-service.d.ts +4 -0
- package/dist-package/packages/runtime/src/application/local-media.d.ts +46 -0
- package/dist-package/packages/runtime/src/application/media-analysis-service.d.ts +40 -0
- package/dist-package/packages/runtime/src/application/media-analysis-service.js +105 -15
- package/dist-package/packages/runtime/src/application/project-service.d.ts +35 -0
- package/dist-package/packages/runtime/src/application/project-store.d.ts +56 -0
- package/dist-package/packages/runtime/src/application/project-transactions.d.ts +51 -0
- package/dist-package/packages/runtime/src/application/runtime-options.d.ts +15 -0
- package/dist-package/packages/runtime/src/application/semantic-media-index-store.d.ts +28 -0
- package/dist-package/packages/runtime/src/application/transaction-store.d.ts +10 -0
- package/dist-package/packages/runtime/src/audio/analysis.d.ts +3 -0
- package/dist-package/packages/runtime/src/audio/analysis.js +95 -0
- package/dist-package/packages/runtime/src/audio/dialogue-normalization.d.ts +47 -0
- package/dist-package/packages/runtime/src/audio/noise-reduction.d.ts +34 -0
- package/dist-package/packages/runtime/src/capabilities.d.ts +45 -0
- package/dist-package/packages/runtime/src/color-correction.d.ts +33 -0
- package/dist-package/packages/runtime/src/context/context-engine.d.ts +28 -0
- package/dist-package/packages/runtime/src/context/context-service.d.ts +20 -0
- package/dist-package/packages/runtime/src/context/project-catalog.d.ts +12 -0
- package/dist-package/packages/runtime/src/context/revision.d.ts +2 -0
- package/dist-package/packages/runtime/src/domain/capabilities.d.ts +170 -0
- package/dist-package/packages/runtime/src/domain/context.d.ts +179 -0
- package/dist-package/packages/runtime/src/domain/diff.d.ts +104 -0
- package/dist-package/packages/runtime/src/domain/duration.d.ts +63 -0
- package/dist-package/packages/runtime/src/domain/editing.d.ts +227 -0
- package/dist-package/packages/runtime/src/domain/incremental-sync.d.ts +67 -0
- package/dist-package/packages/runtime/src/domain/index.d.ts +14 -0
- package/dist-package/packages/runtime/src/domain/media.d.ts +406 -0
- package/dist-package/packages/runtime/src/domain/ports.d.ts +62 -0
- package/dist-package/packages/runtime/src/domain/primitives.d.ts +21 -0
- package/dist-package/packages/runtime/src/domain/project.d.ts +119 -0
- package/dist-package/packages/runtime/src/domain/rough-cut.d.ts +27 -0
- package/dist-package/packages/runtime/src/domain/skills.d.ts +145 -0
- package/dist-package/packages/runtime/src/domain/timeline-target.d.ts +57 -0
- package/dist-package/packages/runtime/src/domain/timeline-target.js +19 -1
- package/dist-package/packages/runtime/src/domain/types.d.ts +5 -0
- package/dist-package/packages/runtime/src/domain/verification.d.ts +92 -0
- package/dist-package/packages/runtime/src/editing/dialogue-normalization-service.d.ts +18 -0
- package/dist-package/packages/runtime/src/editing/duration-policy.d.ts +3 -0
- package/dist-package/packages/runtime/src/editing/edit-service.d.ts +44 -0
- package/dist-package/packages/runtime/src/editing/filler-removal-service.d.ts +23 -0
- package/dist-package/packages/runtime/src/editing/intent.d.ts +97 -0
- package/dist-package/packages/runtime/src/editing/music-service.d.ts +9 -0
- package/dist-package/packages/runtime/src/index.d.ts +32 -0
- package/dist-package/packages/runtime/src/index.js +1 -0
- package/dist-package/packages/runtime/src/planning/rough-cut.d.ts +3 -0
- package/dist-package/packages/runtime/src/render/render-and-verify.d.ts +71 -0
- package/dist-package/packages/runtime/src/render/render-contract.d.ts +96 -0
- package/dist-package/packages/runtime/src/runtime.d.ts +85 -0
- package/dist-package/packages/runtime/src/skills/builtin.d.ts +2 -0
- package/dist-package/packages/runtime/src/skills/index.d.ts +3 -0
- package/dist-package/packages/runtime/src/skills/registry.d.ts +10 -0
- package/dist-package/packages/runtime/src/skills/requirements.d.ts +38 -0
- package/dist-package/packages/runtime/src/skills/runtime.d.ts +38 -0
- package/dist-package/packages/runtime/src/speech/analysis.d.ts +18 -0
- package/dist-package/packages/runtime/src/speech/analysis.js +67 -0
- package/dist-package/packages/runtime/src/speech/filler-detector.d.ts +49 -0
- package/dist-package/packages/runtime/src/speech/filler-removal.d.ts +37 -0
- package/dist-package/packages/runtime/src/speech/mapping.d.ts +56 -0
- package/dist-package/packages/runtime/src/speech/mapping.js +27 -4
- package/dist-package/packages/runtime/src/speech/safe-cut-resolver.d.ts +52 -0
- package/dist-package/packages/runtime/src/timeline/drift-reconciliation.d.ts +42 -0
- package/dist-package/packages/runtime/src/timeline/editing-session.d.ts +271 -0
- package/dist-package/packages/runtime/src/timeline/editing-session.js +32 -2
- package/dist-package/packages/runtime/src/timeline/fast-observation.d.ts +77 -0
- package/dist-package/packages/runtime/src/timeline/rational-time.d.ts +11 -0
- package/dist-package/packages/runtime/src/timeline/reorder-preview.d.ts +32 -0
- package/dist-package/packages/runtime/src/timeline/reorder-preview.js +202 -0
- package/dist-package/packages/runtime/src/timeline/snapshot-diff.d.ts +3 -0
- package/dist-package/packages/runtime/src/timeline/snapshot-diff.js +1 -0
- package/dist-package/packages/runtime/src/timeline/snapshot-digest.d.ts +3 -0
- package/dist-package/packages/runtime/src/timeline/snapshot-digest.js +1 -1
- package/dist-package/packages/runtime/src/verification/verification.d.ts +6 -0
- package/dist-package/packages/testkit/src/fixture-analyzers.d.ts +37 -0
- package/dist-package/packages/testkit/src/in-memory-editor.d.ts +55 -0
- package/dist-package/packages/testkit/src/index.d.ts +4 -0
- package/dist-package/packages/testkit/src/sender-lifecycle-fixture.d.ts +47 -0
- package/dist-package/packages/testkit/src/skill-fixtures.d.ts +3 -0
- package/package.json +17 -12
|
@@ -109,6 +109,9 @@ export class FfmpegTimelineRenderer {
|
|
|
109
109
|
}
|
|
110
110
|
async function prepareRenderModel(plan) {
|
|
111
111
|
const timeline = structuredClone(plan.timeline);
|
|
112
|
+
if (timeline.resources.some((resource) => resource.sourceRange && BigInt(resource.sourceRange.start.value) !== 0n)) {
|
|
113
|
+
throw new FfmpegRenderError("HEADLESS_RENDER_UNSUPPORTED", "nonzero source origins are not yet supported");
|
|
114
|
+
}
|
|
112
115
|
const sequence = timeline.sequence;
|
|
113
116
|
const occurrences = sequence.occurrences
|
|
114
117
|
.filter(isPrimaryVideoOccurrence)
|
|
@@ -470,6 +473,8 @@ function supportsLocalMedia(timeline) {
|
|
|
470
473
|
function supportsStructuralEdits(timeline) {
|
|
471
474
|
const primaryOccurrences = timeline.sequence.occurrences.filter(isPrimaryVideoOccurrence);
|
|
472
475
|
return timeline.sequence.storyElements.length === 0
|
|
476
|
+
&& (timeline.sequence.timecodeStart === undefined || /^-?0+$/.test(timeline.sequence.timecodeStart.value))
|
|
477
|
+
&& (timeline.sequence.frameGridOrigin === undefined || /^-?0+$/.test(timeline.sequence.frameGridOrigin.value))
|
|
473
478
|
&& timeline.sequence.markers.length === 0
|
|
474
479
|
&& timeline.sequence.captions.length === 0
|
|
475
480
|
&& primaryOccurrences.length > 0
|
|
@@ -565,10 +570,10 @@ function clamp(value, minimum, maximum) {
|
|
|
565
570
|
function formatNumber(value) {
|
|
566
571
|
return Number(value.toFixed(6)).toString();
|
|
567
572
|
}
|
|
568
|
-
function escapeFilterValue(value) {
|
|
573
|
+
export function escapeFilterValue(value) {
|
|
569
574
|
return value.replaceAll("\\", "\\\\").replaceAll("'", "'\\''").replaceAll(":", "\\:").replaceAll(",", "\\,").replaceAll("[", "\\[").replaceAll("]", "\\]").replaceAll("\n", "\\n");
|
|
570
575
|
}
|
|
571
|
-
function resolveFontFile(preferred) {
|
|
576
|
+
export function resolveFontFile(preferred) {
|
|
572
577
|
const candidates = [
|
|
573
578
|
preferred,
|
|
574
579
|
"/System/Library/Fonts/HelveticaNeue.ttc",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TimelineIr } from "../../../../packages/runtime/src/index.js";
|
|
2
|
+
type Sample = {
|
|
3
|
+
kind: "shot" | "title";
|
|
4
|
+
id: string;
|
|
5
|
+
occurrenceId: string;
|
|
6
|
+
mediaId: string;
|
|
7
|
+
sourceDigest: string;
|
|
8
|
+
timelineSeconds: number;
|
|
9
|
+
sourceSeconds: number;
|
|
10
|
+
};
|
|
11
|
+
/** Renders a bounded set of individual frames, without writing a movie or changing sources. */
|
|
12
|
+
export declare class FfmpegStoryboardRenderer {
|
|
13
|
+
private readonly options;
|
|
14
|
+
constructor(options?: {
|
|
15
|
+
ffmpegPath?: string;
|
|
16
|
+
temporaryDirectory?: string;
|
|
17
|
+
});
|
|
18
|
+
render(timeline: TimelineIr, dimensions: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}, signal?: AbortSignal): Promise<{
|
|
22
|
+
data: string;
|
|
23
|
+
mimeType: "image/png";
|
|
24
|
+
samples: Sample[];
|
|
25
|
+
limitations: string[];
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { createReadStream } from "node:fs";
|
|
4
|
+
import { lstat, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { join, resolve } from "node:path";
|
|
7
|
+
import { promisify } from "node:util";
|
|
8
|
+
import { escapeFilterValue, resolveFontFile } from "./ffmpeg-renderer.js";
|
|
9
|
+
const run = promisify(execFile);
|
|
10
|
+
const MAX_SAMPLES = 12;
|
|
11
|
+
const MAX_WIDTH = 640;
|
|
12
|
+
const MAX_HEIGHT = 360;
|
|
13
|
+
/** Renders a bounded set of individual frames, without writing a movie or changing sources. */
|
|
14
|
+
export class FfmpegStoryboardRenderer {
|
|
15
|
+
options;
|
|
16
|
+
constructor(options = {}) {
|
|
17
|
+
this.options = options;
|
|
18
|
+
}
|
|
19
|
+
async render(timeline, dimensions, signal) {
|
|
20
|
+
signal?.throwIfAborted();
|
|
21
|
+
const sequence = timeline.sequence;
|
|
22
|
+
if (sequence.transitions?.length || sequence.storyElements.length || sequence.captions.length || sequence.occurrences.some((item) => item.track === 0 && (item.transform || item.enabled === false))) {
|
|
23
|
+
throw new Error("HEADLESS_STORYBOARD_UNSUPPORTED: transitions, gaps, disabled clips and transforms cannot be sampled faithfully");
|
|
24
|
+
}
|
|
25
|
+
const clips = sequence.occurrences.filter((item) => item.track === 0 && (!item.role || item.role === "video")).sort((a, b) => seconds(a.startTime) - seconds(b.startTime));
|
|
26
|
+
const titles = sequence.titles ?? [];
|
|
27
|
+
if (!clips.length || clips.length + titles.length > MAX_SAMPLES)
|
|
28
|
+
throw new Error(`HEADLESS_STORYBOARD_LIMIT: expected 1 to ${MAX_SAMPLES} total shots and titles`);
|
|
29
|
+
if (sequence.occurrences.some((item) => item.track === 0 && item.role && item.role !== "video") || clips.some((item, index) => Math.abs(seconds(item.startTime) - (index ? seconds(clips[index - 1].startTime) + seconds(clips[index - 1].durationTime) : 0)) > 1e-7))
|
|
30
|
+
throw new Error("HEADLESS_STORYBOARD_UNSUPPORTED: primary clips must form a contiguous storyline");
|
|
31
|
+
if (sequence.occurrences.some((item) => item.track !== 0 && item.role !== "audio" && item.role !== "music"))
|
|
32
|
+
throw new Error("HEADLESS_STORYBOARD_UNSUPPORTED: visual overlays cannot be sampled faithfully");
|
|
33
|
+
const frameDuration = seconds(sequence.frameDuration);
|
|
34
|
+
const scale = Math.min(MAX_WIDTH / dimensions.width, MAX_HEIGHT / dimensions.height);
|
|
35
|
+
const width = Math.max(2, Math.floor(dimensions.width * scale / 2) * 2);
|
|
36
|
+
const height = Math.max(2, Math.floor(dimensions.height * scale / 2) * 2);
|
|
37
|
+
const resources = new Map(timeline.resources.map((resource) => [resource.id, resource]));
|
|
38
|
+
const samples = [];
|
|
39
|
+
const add = (kind, id, time) => {
|
|
40
|
+
const clip = clips.find((item) => time >= seconds(item.startTime) - 1e-8 && time < seconds(item.startTime) + seconds(item.durationTime) - 1e-8);
|
|
41
|
+
const resource = clip?.mediaId ? resources.get(clip.mediaId) : undefined;
|
|
42
|
+
if (!clip || !resource?.source || resource.sourceKind !== "local-file" || !resource.sourceDigest)
|
|
43
|
+
throw new Error("HEADLESS_STORYBOARD_UNSUPPORTED: sample has no registered video source");
|
|
44
|
+
samples.push({ kind, id, occurrenceId: clip.id, mediaId: resource.id, sourceDigest: resource.sourceDigest, timelineSeconds: time, sourceSeconds: seconds(clip.sourceStartTime ?? { value: "0", timescale: "1" }) + time - seconds(clip.startTime) });
|
|
45
|
+
};
|
|
46
|
+
for (const clip of clips)
|
|
47
|
+
add("shot", clip.id, seconds(clip.startTime));
|
|
48
|
+
for (const title of titles) {
|
|
49
|
+
const midpoint = seconds(title.startTime) + seconds(title.durationTime) / 2;
|
|
50
|
+
const sampleTime = Math.floor((midpoint + 1e-8) / frameDuration) * frameDuration;
|
|
51
|
+
if (sampleTime < seconds(title.startTime) || sampleTime >= seconds(title.startTime) + seconds(title.durationTime)) {
|
|
52
|
+
throw new Error("HEADLESS_STORYBOARD_UNSUPPORTED: title midpoint has no sample on the sequence frame grid");
|
|
53
|
+
}
|
|
54
|
+
add("title", title.id, sampleTime);
|
|
55
|
+
}
|
|
56
|
+
samples.sort((a, b) => a.timelineSeconds - b.timelineSeconds || a.kind.localeCompare(b.kind));
|
|
57
|
+
const identities = new Map();
|
|
58
|
+
for (const sample of samples) {
|
|
59
|
+
const resource = resources.get(sample.mediaId);
|
|
60
|
+
identities.set(resolve(resource.source), sample.sourceDigest);
|
|
61
|
+
}
|
|
62
|
+
const checkSources = async () => {
|
|
63
|
+
for (const [path, expected] of identities) {
|
|
64
|
+
signal?.throwIfAborted();
|
|
65
|
+
const info = await lstat(path);
|
|
66
|
+
if (!info.isFile() || info.isSymbolicLink() || await digest(path, signal) !== expected)
|
|
67
|
+
throw new Error("HEADLESS_STORYBOARD_SOURCE_CHANGED: source identity does not match registered media");
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
await checkSources();
|
|
71
|
+
const dir = await mkdtemp(join(this.options.temporaryDirectory ?? tmpdir(), "framekit-storyboard-"));
|
|
72
|
+
try {
|
|
73
|
+
const frames = [];
|
|
74
|
+
for (const [index, sample] of samples.entries()) {
|
|
75
|
+
signal?.throwIfAborted();
|
|
76
|
+
const resource = resources.get(sample.mediaId);
|
|
77
|
+
// The render provider's drawtext filter includes both endpoints.
|
|
78
|
+
const activeTitles = titles.filter((title) => sample.timelineSeconds >= seconds(title.startTime) && sample.timelineSeconds <= seconds(title.startTime) + seconds(title.durationTime));
|
|
79
|
+
const filters = [`scale=${width}:${height}:force_original_aspect_ratio=disable`];
|
|
80
|
+
for (const [titleIndex, title] of activeTitles.entries()) {
|
|
81
|
+
if (title.style || title.position)
|
|
82
|
+
throw new Error("HEADLESS_STORYBOARD_UNSUPPORTED: styled titles are not supported");
|
|
83
|
+
const filename = `title-${index}-${titleIndex}.txt`;
|
|
84
|
+
await writeFile(join(dir, filename), title.text, "utf8");
|
|
85
|
+
const fontSize = Math.max(1, Math.round(32 * scale));
|
|
86
|
+
const font = resolveFontFile(process.env.FRAMEKIT_RENDER_FONT);
|
|
87
|
+
filters.push(`drawtext=${font ? `fontfile='${escapeFilterValue(font)}':` : ""}textfile='${filename}':expansion=none:fontcolor=white:fontsize=${fontSize}:x=(w-text_w)/2:y=(h-text_h)/2`);
|
|
88
|
+
}
|
|
89
|
+
const frame = join(dir, `${index}.png`);
|
|
90
|
+
await run(this.options.ffmpegPath ?? process.env.FFMPEG_BIN ?? "ffmpeg", ["-hide_banner", "-loglevel", "error", "-nostdin", "-ss", String(sample.sourceSeconds), "-i", resolve(resource.source), "-vf", filters.join(","), "-frames:v", "1", "-threads", "1", "-y", frame], { cwd: dir, signal, timeout: 30000, maxBuffer: 1024 * 1024 });
|
|
91
|
+
frames.push(frame);
|
|
92
|
+
}
|
|
93
|
+
const columns = Math.min(3, frames.length);
|
|
94
|
+
const rows = Math.ceil(frames.length / columns);
|
|
95
|
+
const sheet = join(dir, "sheet.png");
|
|
96
|
+
const input = frames.flatMap((frame) => ["-i", frame]);
|
|
97
|
+
const layout = frames.map((_, index) => `${(index % columns) * width}_${Math.floor(index / columns) * height}`).join("|");
|
|
98
|
+
const filter = frames.length === 1 ? "[0:v]null[out]" : `${frames.map((_, index) => `[${index}:v]`).join("")}xstack=inputs=${frames.length}:layout=${layout}:fill=black[out]`;
|
|
99
|
+
await run(this.options.ffmpegPath ?? process.env.FFMPEG_BIN ?? "ffmpeg", ["-hide_banner", "-loglevel", "error", "-nostdin", ...input, "-filter_complex", filter, "-map", "[out]", "-frames:v", "1", "-threads", "1", "-y", sheet], { cwd: dir, signal, timeout: 30000, maxBuffer: 1024 * 1024 });
|
|
100
|
+
const bytes = await readFile(sheet);
|
|
101
|
+
if (bytes.length > 8 * 1024 * 1024)
|
|
102
|
+
throw new Error("HEADLESS_STORYBOARD_LIMIT: contact sheet exceeds 8 MiB");
|
|
103
|
+
await checkSources();
|
|
104
|
+
signal?.throwIfAborted();
|
|
105
|
+
return { data: bytes.toString("base64"), mimeType: "image/png", samples, limitations: [`${width}x${height} pixels per sample; ${columns} columns and ${rows} rows in sample order`, "Only shot starts and title midpoints are sampled; motion, audio and unsampled frames are not represented.", "Source frames are sought independently; source and output frame-rate conversion can select different nearby frames."] };
|
|
106
|
+
}
|
|
107
|
+
finally {
|
|
108
|
+
await rm(dir, { recursive: true, force: true });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function seconds(value) {
|
|
113
|
+
return Number(value.value) / Number(value.timescale);
|
|
114
|
+
}
|
|
115
|
+
async function digest(path, signal) {
|
|
116
|
+
const hash = createHash("sha256");
|
|
117
|
+
for await (const chunk of createReadStream(path, { signal }))
|
|
118
|
+
hash.update(chunk);
|
|
119
|
+
return hash.digest("hex");
|
|
120
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FramekitRenderPlan, FramekitRenderProviderResult, FramekitRenderVerificationResult, FramekitRenderArtifactVerifier } from "../../../../packages/runtime/src/index.js";
|
|
2
|
+
export interface FfmpegRenderVerifierOptions {
|
|
3
|
+
ffprobePath?: string;
|
|
4
|
+
durationToleranceSeconds?: number;
|
|
5
|
+
env?: NodeJS.ProcessEnv;
|
|
6
|
+
}
|
|
7
|
+
/** Independently verifies the committed output; it does not trust provider metadata. */
|
|
8
|
+
export declare class FfmpegRenderVerifier implements FramekitRenderArtifactVerifier {
|
|
9
|
+
private readonly ffprobePath;
|
|
10
|
+
private readonly durationToleranceSeconds?;
|
|
11
|
+
private readonly environment;
|
|
12
|
+
constructor(options?: FfmpegRenderVerifierOptions);
|
|
13
|
+
verify(plan: FramekitRenderPlan, result: FramekitRenderProviderResult): Promise<FramekitRenderVerificationResult>;
|
|
14
|
+
private probe;
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type DevDoctorProfile = "fixture" | "headless" | "native";
|
|
2
|
+
export type DevDoctorStatus = "pass" | "fail" | "unavailable";
|
|
3
|
+
export interface DevDoctorCheck {
|
|
4
|
+
name: string;
|
|
5
|
+
requirement: "required" | "optional";
|
|
6
|
+
status: DevDoctorStatus;
|
|
7
|
+
message: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DevDoctorReport {
|
|
11
|
+
profile: DevDoctorProfile;
|
|
12
|
+
ready: boolean;
|
|
13
|
+
checks: DevDoctorCheck[];
|
|
14
|
+
}
|
|
15
|
+
export interface CollectDevDoctorOptions {
|
|
16
|
+
profile: DevDoctorProfile;
|
|
17
|
+
rootDirectory: string;
|
|
18
|
+
environment?: NodeJS.ProcessEnv;
|
|
19
|
+
homeDirectory?: string;
|
|
20
|
+
nodeVersion?: string;
|
|
21
|
+
platform?: NodeJS.Platform;
|
|
22
|
+
runCommand?: (command: string, args: string[]) => Promise<string>;
|
|
23
|
+
isPathWritable?: (path: string) => Promise<boolean>;
|
|
24
|
+
}
|
|
25
|
+
export declare function collectDevDoctorReport(options: CollectDevDoctorOptions): Promise<DevDoctorReport>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type HeadlessProjectServiceOptions, type HeadlessProjectWorkflow } from "../../../packages/headless-application/src/index.js";
|
|
2
|
+
/** Creates the shared headless workflow for CLI-owned operations. */
|
|
3
|
+
export declare function createCliHeadlessProjectService(options: HeadlessProjectServiceOptions): HeadlessProjectWorkflow;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { FinalCutConnectionManager } from "../../../adapters/final-cut/typescript/src/index.js";
|
|
3
|
+
type StatusOutput = Pick<NodeJS.WriteStream, "write">;
|
|
4
|
+
export interface McpStartupDependencies {
|
|
5
|
+
connectDevelopmentExtension?: (args: string[], output: StatusOutput) => Promise<ReturnType<FinalCutConnectionManager["getStatus"]>>;
|
|
6
|
+
spawnChild?: typeof spawn;
|
|
7
|
+
stderr?: StatusOutput;
|
|
8
|
+
}
|
|
9
|
+
export declare function runMcp(args: string[], dependencies?: McpStartupDependencies): Promise<void>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Measure source audio through Framekit's optional JSON command protocol."""
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
import math
|
|
6
|
+
import os
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
import re
|
|
9
|
+
import subprocess
|
|
10
|
+
import sys
|
|
11
|
+
import tempfile
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def fail(code: str, message: str) -> None:
|
|
15
|
+
print(f"{code}: {message}", file=sys.stderr)
|
|
16
|
+
raise SystemExit(78)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def number(value: object) -> float:
|
|
20
|
+
if isinstance(value, bool) or not isinstance(value, (int, float)) or not math.isfinite(value):
|
|
21
|
+
fail("AUDIO_REQUEST_INVALID", "range coordinates must be finite numbers")
|
|
22
|
+
return float(value)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def run(args: list[str], code: str) -> subprocess.CompletedProcess:
|
|
26
|
+
try:
|
|
27
|
+
return subprocess.run(args, capture_output=True, text=True, check=True, timeout=45,
|
|
28
|
+
env={**os.environ, "LC_ALL": "C"})
|
|
29
|
+
except (OSError, subprocess.SubprocessError):
|
|
30
|
+
fail(code, "required local media tool failed or exceeded its deadline")
|
|
31
|
+
raise AssertionError("unreachable")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def sample_coordinate(seconds: float, rate: int, start: bool) -> int:
|
|
35
|
+
samples = seconds * rate
|
|
36
|
+
if not math.isfinite(samples) or samples > 2**53 - 1:
|
|
37
|
+
fail("AUDIO_REQUEST_INVALID", "range exceeds supported sample coordinates")
|
|
38
|
+
nearest = round(samples)
|
|
39
|
+
inward = nearest / rate >= seconds if start else nearest / rate <= seconds
|
|
40
|
+
if abs(samples - nearest) < 1e-7 and inward:
|
|
41
|
+
return nearest
|
|
42
|
+
return math.ceil(samples) if start else math.floor(samples)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def main() -> None:
|
|
46
|
+
try:
|
|
47
|
+
request = json.load(sys.stdin)
|
|
48
|
+
except (ValueError, TypeError):
|
|
49
|
+
fail("AUDIO_REQUEST_INVALID", "expected one JSON request")
|
|
50
|
+
if not isinstance(request, dict) or not isinstance(request.get("media"), dict):
|
|
51
|
+
fail("AUDIO_REQUEST_INVALID", "media is required")
|
|
52
|
+
if request.get("occurrenceId") is not None:
|
|
53
|
+
fail("AUDIO_SCOPE_UNAVAILABLE", "this backend measures source audio, not an occurrence or editor output")
|
|
54
|
+
requested = request.get("range")
|
|
55
|
+
if requested is not None:
|
|
56
|
+
if not isinstance(requested, dict):
|
|
57
|
+
fail("AUDIO_REQUEST_INVALID", "range must be an object")
|
|
58
|
+
start, end = number(requested.get("start")), number(requested.get("end"))
|
|
59
|
+
if start < 0 or end <= start:
|
|
60
|
+
fail("AUDIO_REQUEST_INVALID", "range must be nonnegative and positive in duration")
|
|
61
|
+
source = request["media"].get("source")
|
|
62
|
+
if not isinstance(source, str) or not os.path.isfile(source):
|
|
63
|
+
fail("AUDIO_SOURCE_UNAVAILABLE", "a readable local source file is required")
|
|
64
|
+
probe = run(["ffprobe", "-v", "error", "-select_streams", "a", "-show_streams", "-show_format", "-of", "json", source],
|
|
65
|
+
"AUDIO_SOURCE_UNAVAILABLE")
|
|
66
|
+
try:
|
|
67
|
+
metadata = json.loads(probe.stdout)
|
|
68
|
+
streams = metadata["streams"]
|
|
69
|
+
if not isinstance(streams, list) or len(streams) != 1:
|
|
70
|
+
raise ValueError("ambiguous audio streams")
|
|
71
|
+
audio = streams[0]
|
|
72
|
+
rate, channels = int(audio["sample_rate"]), audio["channels"]
|
|
73
|
+
if audio.get("codec_type") != "audio" or rate <= 0 or isinstance(channels, bool) or channels not in (1, 2):
|
|
74
|
+
raise ValueError("unsupported format")
|
|
75
|
+
offset = float(audio.get("start_time", 0))
|
|
76
|
+
if not math.isfinite(offset) or abs(offset) > 1e-9:
|
|
77
|
+
raise ValueError("source offset is not supported")
|
|
78
|
+
layout = audio.get("channel_layout")
|
|
79
|
+
if layout is not None and layout not in ("mono" if channels == 1 else "stereo", "unknown"):
|
|
80
|
+
raise ValueError("unsupported channel layout")
|
|
81
|
+
if requested is None:
|
|
82
|
+
start = 0.0
|
|
83
|
+
end = float(audio.get("duration", metadata.get("format", {}).get("duration")))
|
|
84
|
+
if not math.isfinite(end) or end <= 0:
|
|
85
|
+
raise ValueError("unknown source duration")
|
|
86
|
+
except (ValueError, TypeError, KeyError):
|
|
87
|
+
fail("AUDIO_SOURCE_UNAVAILABLE", "expected one mono/stereo audio stream with supported source timing")
|
|
88
|
+
first, last = sample_coordinate(start, rate, True), sample_coordinate(end, rate, False)
|
|
89
|
+
count = last - first
|
|
90
|
+
if count / rate < 0.4:
|
|
91
|
+
fail("AUDIO_MEASUREMENT_UNAVAILABLE", "at least 400 ms of sample-aligned signal is required")
|
|
92
|
+
with tempfile.TemporaryDirectory(prefix="framekit-source-meter-") as temporary:
|
|
93
|
+
pcm = Path(temporary) / "source.f32le"
|
|
94
|
+
run(["ffmpeg", "-hide_banner", "-nostdin", "-loglevel", "error", "-i", source,
|
|
95
|
+
"-map", "0:a:0", "-vn", "-af", f"atrim=start_sample={first}:end_sample={last},asetpts=PTS-STARTPTS",
|
|
96
|
+
"-ar", str(rate), "-ac", str(channels), "-c:a", "pcm_f32le", "-f", "f32le", "-y", str(pcm)],
|
|
97
|
+
"AUDIO_MEASUREMENT_UNAVAILABLE")
|
|
98
|
+
if pcm.stat().st_size != count * channels * 4:
|
|
99
|
+
fail("AUDIO_MEASUREMENT_UNAVAILABLE", "decoded samples do not cover the requested source interval")
|
|
100
|
+
measured = run(["ffmpeg", "-hide_banner", "-nostdin", "-loglevel", "info", "-f", "f32le",
|
|
101
|
+
"-ar", str(rate), "-ac", str(channels), "-i", str(pcm), "-af",
|
|
102
|
+
"silencedetect=noise=-60dB:d=0.1,ebur128=peak=true:framelog=verbose", "-f", "null", "-"],
|
|
103
|
+
"AUDIO_MEASUREMENT_UNAVAILABLE").stderr
|
|
104
|
+
summary = measured[measured.rfind("Summary:"):]
|
|
105
|
+
try:
|
|
106
|
+
integrated = float(re.search(r"Integrated loudness:\s+I:\s+(\S+)\s+LUFS", summary)[1])
|
|
107
|
+
peak = float(re.search(r"True peak:\s+Peak:\s+(\S+)\s+dBFS", summary)[1])
|
|
108
|
+
silence = sum(float(value) * 1000 for value in re.findall(r"silence_duration:\s*(\S+)", measured))
|
|
109
|
+
if not all(math.isfinite(value) for value in (integrated, peak, silence)) or integrated <= -70 or not 0 <= silence <= count / rate * 1000 + 1:
|
|
110
|
+
raise ValueError("unavailable metrics")
|
|
111
|
+
except (ValueError, TypeError):
|
|
112
|
+
fail("AUDIO_MEASUREMENT_UNAVAILABLE", "signal is silent, below the loudness gate or lacks a valid measurement summary")
|
|
113
|
+
result = {
|
|
114
|
+
"signalScope": "source", "integratedLufs": integrated, "truePeakDb": peak, "silenceMs": silence,
|
|
115
|
+
"sourceTimebase": {"value": "1", "timescale": str(rate)},
|
|
116
|
+
"signalFormat": {"sampleRate": rate, "channels": channels},
|
|
117
|
+
"requestedRange": {"start": start, "end": end},
|
|
118
|
+
"measuredRange": {"start": first / rate, "end": last / rate,
|
|
119
|
+
"startTime": {"value": str(first), "timescale": str(rate)},
|
|
120
|
+
"durationTime": {"value": str(count), "timescale": str(rate)}},
|
|
121
|
+
"analyzedDurationSeconds": count / rate,
|
|
122
|
+
}
|
|
123
|
+
if layout in ("mono", "stereo"):
|
|
124
|
+
result["signalFormat"]["channelLayout"] = layout
|
|
125
|
+
print(json.dumps(result, separators=(",", ":"), allow_nan=False))
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
if __name__ == "__main__":
|
|
129
|
+
main()
|
|
@@ -7,10 +7,12 @@ the model with FRAMEKIT_WHISPER_MODEL.
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
import importlib
|
|
10
|
+
import hashlib
|
|
10
11
|
import json
|
|
11
12
|
import math
|
|
12
13
|
import os
|
|
13
14
|
import sys
|
|
15
|
+
import subprocess
|
|
14
16
|
from typing import Any
|
|
15
17
|
|
|
16
18
|
|
|
@@ -151,6 +153,70 @@ def normalized_words(result: dict[str, Any], requested: dict[str, Any] | None) -
|
|
|
151
153
|
return entries
|
|
152
154
|
|
|
153
155
|
|
|
156
|
+
class VadFailure(Exception):
|
|
157
|
+
def __init__(self, code: str):
|
|
158
|
+
self.code = code
|
|
159
|
+
super().__init__(code)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def analyze_vad(source: str, media: dict[str, Any], requested: dict[str, Any] | None) -> dict[str, Any]:
|
|
163
|
+
"""Run a pinned local detector; ASR timestamps are never activity evidence."""
|
|
164
|
+
model_path = os.environ.get("FRAMEKIT_SILERO_VAD_MODEL", "").strip()
|
|
165
|
+
expected = os.environ.get("FRAMEKIT_SILERO_VAD_SHA256", "").strip().lower()
|
|
166
|
+
if not model_path or len(expected) != 64 or any(c not in "0123456789abcdef" for c in expected):
|
|
167
|
+
raise VadFailure("SILERO_VAD_SETUP_REQUIRED")
|
|
168
|
+
try:
|
|
169
|
+
with open(model_path, "rb") as model_file:
|
|
170
|
+
initial = hashlib.sha256(model_file.read()).hexdigest()
|
|
171
|
+
if initial != expected:
|
|
172
|
+
raise VadFailure("SILERO_VAD_MODEL_MISMATCH")
|
|
173
|
+
torch = importlib.import_module("torch")
|
|
174
|
+
detector = importlib.import_module("silero_vad")
|
|
175
|
+
torch.set_num_threads(1)
|
|
176
|
+
model = torch.jit.load(model_path, map_location="cpu")
|
|
177
|
+
model.eval()
|
|
178
|
+
decoded = subprocess.run(["ffmpeg", "-hide_banner", "-nostdin", "-loglevel", "error", "-i", source,
|
|
179
|
+
"-map", "0:a:0", "-ar", "16000", "-ac", "1", "-f", "f32le", "-"],
|
|
180
|
+
capture_output=True, check=True, timeout=45).stdout
|
|
181
|
+
if not decoded or len(decoded) % 4:
|
|
182
|
+
raise VadFailure("SILERO_VAD_SOURCE_INCOMPLETE")
|
|
183
|
+
audio = torch.frombuffer(bytearray(decoded), dtype=torch.float32).clone()
|
|
184
|
+
count = audio.numel()
|
|
185
|
+
start = requested["start"] if requested is not None else 0
|
|
186
|
+
end = requested["end"] if requested is not None else media.get("duration", count / 16000)
|
|
187
|
+
if isinstance(end, bool) or not isinstance(end, (int, float)) or not math.isfinite(end) or end > count / 16000 + 1e-9:
|
|
188
|
+
raise VadFailure("SILERO_VAD_SOURCE_INCOMPLETE")
|
|
189
|
+
first, last = math.ceil(start * 16000), math.floor(end * 16000)
|
|
190
|
+
if first < 0 or last <= first:
|
|
191
|
+
raise VadFailure("SILERO_VAD_SOURCE_INCOMPLETE")
|
|
192
|
+
intervals = detector.get_speech_timestamps(audio, model, sampling_rate=16000, threshold=0.5,
|
|
193
|
+
min_speech_duration_ms=250, min_silence_duration_ms=100,
|
|
194
|
+
speech_pad_ms=30, return_seconds=False)
|
|
195
|
+
if not isinstance(intervals, list):
|
|
196
|
+
raise VadFailure("SILERO_VAD_OUTPUT_INVALID")
|
|
197
|
+
segments = []
|
|
198
|
+
previous = 0
|
|
199
|
+
for interval in intervals:
|
|
200
|
+
if not isinstance(interval, dict):
|
|
201
|
+
raise VadFailure("SILERO_VAD_OUTPUT_INVALID")
|
|
202
|
+
a, b = interval.get("start"), interval.get("end")
|
|
203
|
+
if type(a) is not int or type(b) is not int or a < previous or b <= a or b > count:
|
|
204
|
+
raise VadFailure("SILERO_VAD_OUTPUT_INVALID")
|
|
205
|
+
previous = b
|
|
206
|
+
left, right = max(first, a), min(last, b)
|
|
207
|
+
if right > left:
|
|
208
|
+
segments.append({"start": left / 16000, "end": right / 16000, "kind": "speech"})
|
|
209
|
+
with open(model_path, "rb") as model_file:
|
|
210
|
+
if hashlib.sha256(model_file.read()).hexdigest() != initial:
|
|
211
|
+
raise VadFailure("SILERO_VAD_MODEL_MISMATCH")
|
|
212
|
+
return {"vadSegments": segments, "observedRange": {"start": first / 16000, "end": last / 16000},
|
|
213
|
+
"requestedRange": {"start": start, "end": end}}
|
|
214
|
+
except VadFailure:
|
|
215
|
+
raise
|
|
216
|
+
except Exception: # Optional detector failures must not suppress available ASR.
|
|
217
|
+
raise VadFailure("SILERO_VAD_ANALYZER_FAILED") from None
|
|
218
|
+
|
|
219
|
+
|
|
154
220
|
def main() -> None:
|
|
155
221
|
request = read_request()
|
|
156
222
|
media = required_record(request.get("media"), "media")
|
|
@@ -168,12 +234,36 @@ def main() -> None:
|
|
|
168
234
|
if start < 0 or end <= start:
|
|
169
235
|
fail(65, "WHISPER_REQUEST_INVALID: range boundaries are invalid")
|
|
170
236
|
|
|
237
|
+
vad = None
|
|
238
|
+
vad_failure = None
|
|
239
|
+
required_vad = os.environ.get("FRAMEKIT_SPEECH_REQUIRE_VAD") == "1"
|
|
240
|
+
if os.environ.get("FRAMEKIT_SILERO_VAD_MODEL") or required_vad:
|
|
241
|
+
try:
|
|
242
|
+
vad = analyze_vad(source, media, requested)
|
|
243
|
+
except VadFailure as error:
|
|
244
|
+
if required_vad:
|
|
245
|
+
fail(78, error.code + ": required detector unavailable; check its local model pin and dependencies")
|
|
246
|
+
vad_failure = error.code
|
|
171
247
|
module_label, module = load_backend()
|
|
172
248
|
result = transcribe(module_label, module, source)
|
|
173
249
|
output = {
|
|
174
|
-
"words": normalized_words(result, requested),
|
|
175
|
-
|
|
250
|
+
"words": normalized_words(result, vad["observedRange"] if vad is not None else requested),
|
|
251
|
+
# Both supported Whisper implementations decode input at 16 kHz;
|
|
252
|
+
# detector availability does not change the transcription clock.
|
|
253
|
+
"sourceTimebase": {"value": "1", "timescale": "16000"},
|
|
176
254
|
}
|
|
255
|
+
if vad is not None:
|
|
256
|
+
output.update(vad)
|
|
257
|
+
output["schemaVersion"] = 1
|
|
258
|
+
if "mediaId" in media:
|
|
259
|
+
output.update(mediaId=media["mediaId"], sourceIdentity=media)
|
|
260
|
+
if "revision" in request:
|
|
261
|
+
output["revision"] = request["revision"]
|
|
262
|
+
version = os.environ.get("FRAMEKIT_SPEECH_ANALYZER_VERSION", "").strip()
|
|
263
|
+
if version:
|
|
264
|
+
output["provider"] = {"id": "command.speech", "provider": "command", "version": version}
|
|
265
|
+
if vad_failure is not None:
|
|
266
|
+
output["vadUnavailableReason"] = vad_failure
|
|
177
267
|
print(json.dumps(output, separators=(",", ":")))
|
|
178
268
|
|
|
179
269
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FramekitBuildFingerprint } from "./version.js";
|
|
2
|
+
export type BuildAlignmentStatus = "matched" | "missing" | "mismatched";
|
|
3
|
+
export interface BuildAlignmentReport {
|
|
4
|
+
status: BuildAlignmentStatus;
|
|
5
|
+
target: FramekitBuildFingerprint;
|
|
6
|
+
runtime: FramekitBuildFingerprint;
|
|
7
|
+
extension?: FramekitBuildFingerprint;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function assessBuildAlignment(runtime: FramekitBuildFingerprint, extension: FramekitBuildFingerprint | undefined, targetCommit?: string): BuildAlignmentReport;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface PackageBuildIdentity {
|
|
2
|
+
schemaVersion: 1;
|
|
3
|
+
version: string;
|
|
4
|
+
commit: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function createPackageBuildIdentity(version: string, commit: string): PackageBuildIdentity;
|
|
7
|
+
export declare function parsePackageBuildIdentity(value: unknown, expectedVersion: string): PackageBuildIdentity | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EditorLiveState, ProjectSnapshot } from "../../../packages/runtime/src/index.js";
|
|
2
|
+
export interface CanonicalNativeSnapshotTarget {
|
|
3
|
+
projectId: string;
|
|
4
|
+
sequenceId: string;
|
|
5
|
+
projectName: string;
|
|
6
|
+
sequenceName: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function createCanonicalNativeSnapshotReader(readLiveState: () => Promise<EditorLiveState>, readSnapshot: (target: CanonicalNativeSnapshotTarget) => Promise<ProjectSnapshot>): () => Promise<ProjectSnapshot>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { EditingSession, type ContextRevision, type EditingSessionDocument, type TimelineIr, type TimelineIrEditOperation, type TimelineIrProvider } from "../../../packages/runtime/src/index.js";
|
|
2
|
+
export interface SessionSqliteObservationProvider {
|
|
3
|
+
inspect(path: string): Promise<{
|
|
4
|
+
status: "partial";
|
|
5
|
+
observation: {
|
|
6
|
+
backend: string;
|
|
7
|
+
databaseKind: "flexolibrary" | "fcpevent" | "unknown";
|
|
8
|
+
digest: string;
|
|
9
|
+
schemaVersion: number;
|
|
10
|
+
revision: {
|
|
11
|
+
timestamp: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
} | {
|
|
15
|
+
status: "error" | "unavailable";
|
|
16
|
+
error: {
|
|
17
|
+
code: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export interface StoredEditingSession {
|
|
23
|
+
sessionId: string;
|
|
24
|
+
document: EditingSessionDocument;
|
|
25
|
+
}
|
|
26
|
+
export interface EditingSessionProviderChange {
|
|
27
|
+
from: ContextRevision;
|
|
28
|
+
to: ContextRevision;
|
|
29
|
+
}
|
|
30
|
+
export interface EditingSessionChangeSource {
|
|
31
|
+
changesSince(revision: ContextRevision): Promise<EditingSessionProviderChange>;
|
|
32
|
+
}
|
|
33
|
+
export declare function createCanonicalSessionChangeSource(readCurrent: () => Promise<Pick<TimelineIr, "revision">>): EditingSessionChangeSource;
|
|
34
|
+
export declare class EditingSessionRepository {
|
|
35
|
+
private readonly directory;
|
|
36
|
+
private readonly changeSource?;
|
|
37
|
+
constructor(directory: string, changeSource?: EditingSessionChangeSource | undefined);
|
|
38
|
+
create(input: {
|
|
39
|
+
sessionId?: string;
|
|
40
|
+
base: TimelineIr;
|
|
41
|
+
provider?: TimelineIrProvider;
|
|
42
|
+
}): Promise<StoredEditingSession>;
|
|
43
|
+
inspect(sessionId: string): Promise<StoredEditingSession>;
|
|
44
|
+
preview(sessionId: string, operations: TimelineIrEditOperation[], expectedRevision?: ContextRevision): Promise<import("../../../packages/runtime/src/index.js").TimelineIrPreview>;
|
|
45
|
+
execute(sessionId: string, operations: TimelineIrEditOperation[], expectedRevision?: ContextRevision): Promise<StoredEditingSession>;
|
|
46
|
+
status(sessionId: string): Promise<{
|
|
47
|
+
sessionId: string;
|
|
48
|
+
state: import("../../../packages/runtime/src/index.js").EditingSessionState;
|
|
49
|
+
provider?: TimelineIrProvider | undefined;
|
|
50
|
+
baseRevision: ContextRevision;
|
|
51
|
+
desiredRevision: ContextRevision;
|
|
52
|
+
observation?: import("../../../packages/runtime/src/index.js").EditingSessionObservation | undefined;
|
|
53
|
+
readyToMaterialize: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
reconcile(sessionId: string, provider: TimelineIrProvider, providerState: TimelineIr): Promise<{
|
|
56
|
+
sessionId: string;
|
|
57
|
+
document: EditingSessionDocument;
|
|
58
|
+
reconciliation: import("../../../packages/runtime/src/index.js").TimelineReconciliationResult;
|
|
59
|
+
}>;
|
|
60
|
+
observe(sessionId: string, sourcePath: string, provider: SessionSqliteObservationProvider): Promise<{
|
|
61
|
+
sessionId: string;
|
|
62
|
+
document: EditingSessionDocument;
|
|
63
|
+
observation: {
|
|
64
|
+
backend: string;
|
|
65
|
+
sourceId: string;
|
|
66
|
+
databaseKind: "fcpevent" | "flexolibrary" | "unknown";
|
|
67
|
+
digest: string;
|
|
68
|
+
schemaVersion: number;
|
|
69
|
+
observedAt: string;
|
|
70
|
+
canonical: false;
|
|
71
|
+
coverageComplete: false;
|
|
72
|
+
};
|
|
73
|
+
change: "changed" | "observed" | "unchanged";
|
|
74
|
+
}>;
|
|
75
|
+
refresh(sessionId: string): Promise<{
|
|
76
|
+
sessionId: string;
|
|
77
|
+
document: EditingSessionDocument;
|
|
78
|
+
providerRevision: ContextRevision;
|
|
79
|
+
change: "changed" | "unchanged";
|
|
80
|
+
}>;
|
|
81
|
+
loadForMaterialization(sessionId: string): Promise<EditingSession>;
|
|
82
|
+
hasChangeSource(): boolean;
|
|
83
|
+
checkpoint(sessionId: string, session: EditingSession): Promise<StoredEditingSession>;
|
|
84
|
+
private load;
|
|
85
|
+
private refreshLoaded;
|
|
86
|
+
private save;
|
|
87
|
+
private assertMissing;
|
|
88
|
+
private path;
|
|
89
|
+
}
|