@morshoto/framekit 0.2.2 → 0.2.3
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 +25 -0
- package/dist-package/adapters/headless/typescript/src/ffmpeg-renderer.js +5 -0
- package/dist-package/adapters/headless/typescript/src/ffmpeg-verifier.d.ts +15 -0
- package/dist-package/adapters/headless/typescript/src/index.d.ts +3 -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/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 +77 -7
- 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 +233 -0
- package/dist-package/packages/headless-application/src/headless-projects.js +1 -1
- 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
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { ContextRevision } from "../../../../packages/runtime/src/index.js";
|
|
2
|
+
export declare const FINAL_CUT_SQLITE_INSPECTION_BACKEND: "final-cut-sqlite-read-only";
|
|
3
|
+
export declare const FINAL_CUT_SQLITE_INSPECTION_TIMEOUT_MS = 30000;
|
|
4
|
+
export type FinalCutSqliteDatabaseKind = "flexolibrary" | "fcpevent" | "unknown";
|
|
5
|
+
export type FinalCutSqliteCoverage = "exact" | "partial" | "unknown";
|
|
6
|
+
export type FinalCutSqliteInspectionIssueCode = "FINAL_CUT_SQLITE_FIELD_UNAVAILABLE" | "FINAL_CUT_SQLITE_INSPECTION_UNAVAILABLE" | "FINAL_CUT_SQLITE_OPAQUE_PAYLOAD" | "FINAL_CUT_SQLITE_RESPONSE_INVALID" | "FINAL_CUT_SQLITE_REVISION_UNAVAILABLE";
|
|
7
|
+
export interface FinalCutSqliteInspectionIssue {
|
|
8
|
+
code: FinalCutSqliteInspectionIssueCode;
|
|
9
|
+
message: string;
|
|
10
|
+
path?: string;
|
|
11
|
+
retryable: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface FinalCutSqliteTableColumn {
|
|
14
|
+
name: string;
|
|
15
|
+
type: string;
|
|
16
|
+
primaryKey: number;
|
|
17
|
+
}
|
|
18
|
+
export interface FinalCutSqliteTable {
|
|
19
|
+
name: string;
|
|
20
|
+
sql: string;
|
|
21
|
+
columns: FinalCutSqliteTableColumn[];
|
|
22
|
+
rowCount?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface FinalCutSqliteCollectionTypeCount {
|
|
25
|
+
type: string;
|
|
26
|
+
count: number;
|
|
27
|
+
}
|
|
28
|
+
export interface FinalCutSqliteCollectionRow {
|
|
29
|
+
primaryKey: number;
|
|
30
|
+
type: string;
|
|
31
|
+
identifier?: string;
|
|
32
|
+
optimisticVersion?: number;
|
|
33
|
+
catalogId?: number;
|
|
34
|
+
metadataId?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface FinalCutSqliteMetadataRow {
|
|
37
|
+
primaryKey: number;
|
|
38
|
+
collectionId?: number;
|
|
39
|
+
identifier?: string;
|
|
40
|
+
bytes: number;
|
|
41
|
+
archive?: string;
|
|
42
|
+
}
|
|
43
|
+
/** JSON emitted by the read-only sqlite3 query. It intentionally excludes BLOB contents. */
|
|
44
|
+
export interface FinalCutSqliteInspectionPayload {
|
|
45
|
+
version: 1;
|
|
46
|
+
schemaVersion: number;
|
|
47
|
+
userVersion: number;
|
|
48
|
+
tables: FinalCutSqliteTable[];
|
|
49
|
+
rowCounts: Record<string, number>;
|
|
50
|
+
collectionTypes: FinalCutSqliteCollectionTypeCount[];
|
|
51
|
+
collectionRows: FinalCutSqliteCollectionRow[];
|
|
52
|
+
metadataRows: FinalCutSqliteMetadataRow[];
|
|
53
|
+
}
|
|
54
|
+
export interface FinalCutSqliteCoverageReport {
|
|
55
|
+
complete: false;
|
|
56
|
+
projectIdentity: FinalCutSqliteCoverage;
|
|
57
|
+
sequenceIdentity: FinalCutSqliteCoverage;
|
|
58
|
+
clipOccurrences: FinalCutSqliteCoverage;
|
|
59
|
+
mediaIdentity: FinalCutSqliteCoverage;
|
|
60
|
+
rationalTiming: FinalCutSqliteCoverage;
|
|
61
|
+
roles: FinalCutSqliteCoverage;
|
|
62
|
+
storylineRelationships: FinalCutSqliteCoverage;
|
|
63
|
+
markersCaptions: FinalCutSqliteCoverage;
|
|
64
|
+
revision: FinalCutSqliteCoverage;
|
|
65
|
+
}
|
|
66
|
+
/** A source-bound storage observation, never a canonical ProjectSnapshot. */
|
|
67
|
+
export interface FinalCutSqliteObservation extends FinalCutSqliteInspectionPayload {
|
|
68
|
+
backend: typeof FINAL_CUT_SQLITE_INSPECTION_BACKEND;
|
|
69
|
+
sourcePath: string;
|
|
70
|
+
databaseKind: FinalCutSqliteDatabaseKind;
|
|
71
|
+
digest: string;
|
|
72
|
+
revision: ContextRevision;
|
|
73
|
+
canonical: false;
|
|
74
|
+
coverage: FinalCutSqliteCoverageReport;
|
|
75
|
+
}
|
|
76
|
+
export type FinalCutSqliteInspectionResult = {
|
|
77
|
+
status: "partial";
|
|
78
|
+
observation: FinalCutSqliteObservation;
|
|
79
|
+
issues: FinalCutSqliteInspectionIssue[];
|
|
80
|
+
} | {
|
|
81
|
+
status: "unavailable" | "error";
|
|
82
|
+
error: FinalCutSqliteInspectionError;
|
|
83
|
+
};
|
|
84
|
+
export interface FinalCutSqliteInspectionError {
|
|
85
|
+
code: FinalCutSqliteInspectionIssueCode;
|
|
86
|
+
message: string;
|
|
87
|
+
retryable: boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface FinalCutSqliteInspectionProviderOptions {
|
|
90
|
+
sqliteCommand?: string;
|
|
91
|
+
executor?: (databasePath: string, query: string, timeoutMs: number) => Promise<string>;
|
|
92
|
+
digest?: (databasePath: string) => Promise<string>;
|
|
93
|
+
timestamp?: () => string;
|
|
94
|
+
}
|
|
95
|
+
export declare class FinalCutSqliteInspectionProviderError extends Error {
|
|
96
|
+
readonly failure: FinalCutSqliteInspectionError;
|
|
97
|
+
readonly code: FinalCutSqliteInspectionIssueCode;
|
|
98
|
+
readonly retryable: boolean;
|
|
99
|
+
constructor(failure: FinalCutSqliteInspectionError);
|
|
100
|
+
toJSON(): FinalCutSqliteInspectionError;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Read-only inspection of Final Cut's Core Data SQLite stores.
|
|
104
|
+
*
|
|
105
|
+
* The provider intentionally returns an observation rather than ProjectSnapshot:
|
|
106
|
+
* the current schema exposes useful object/type/version hints, while the
|
|
107
|
+
* timeline payload lives in undocumented archived BLOBs.
|
|
108
|
+
*/
|
|
109
|
+
export declare class FinalCutSqliteInspectionProvider {
|
|
110
|
+
readonly backend: "final-cut-sqlite-read-only";
|
|
111
|
+
private readonly executor;
|
|
112
|
+
private readonly digest;
|
|
113
|
+
private readonly timestamp;
|
|
114
|
+
constructor(options?: FinalCutSqliteInspectionProviderOptions);
|
|
115
|
+
inspect(databasePath: string): Promise<FinalCutSqliteInspectionResult>;
|
|
116
|
+
readObservation(databasePath: string): Promise<FinalCutSqliteObservation>;
|
|
117
|
+
}
|
|
118
|
+
/** Build the only SQL sent to a Final Cut store; it is schema/data read-only. */
|
|
119
|
+
export declare function buildFinalCutSqliteInspectionQuery(): string;
|
|
120
|
+
export declare function parseFinalCutSqliteInspectionResponse(input: string | unknown): {
|
|
121
|
+
status: "partial";
|
|
122
|
+
payload: FinalCutSqliteInspectionPayload;
|
|
123
|
+
issues: FinalCutSqliteInspectionIssue[];
|
|
124
|
+
} | {
|
|
125
|
+
status: "error";
|
|
126
|
+
error: FinalCutSqliteInspectionError;
|
|
127
|
+
};
|
|
128
|
+
export interface FinalCutSqliteObservationComparison {
|
|
129
|
+
status: "unchanged" | "changed";
|
|
130
|
+
previousDigest: string;
|
|
131
|
+
currentDigest: string;
|
|
132
|
+
reasons: string[];
|
|
133
|
+
}
|
|
134
|
+
export declare function compareFinalCutSqliteObservations(previous: FinalCutSqliteObservation, current: FinalCutSqliteObservation): FinalCutSqliteObservationComparison;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { TimelineIr } from "../../../../packages/runtime/src/index.js";
|
|
2
|
+
import { type FinalCutKeyedArchiveJsonDecoder, type FinalCutSchemaFingerprint } from "./sqlite-experiment.js";
|
|
3
|
+
/** An encoder is supplied only after it has been proven against Final Cut output. */
|
|
4
|
+
export type FinalCutKeyedArchiveEncoder = (archive: unknown) => Promise<Uint8Array>;
|
|
5
|
+
export interface FinalCutArchiveRoundTripProof {
|
|
6
|
+
originalDigest: string;
|
|
7
|
+
encodedDigest: string;
|
|
8
|
+
byteIdentical: true;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Phase 5 gate. This never invents an NSKeyedArchiver encoder: the caller must
|
|
12
|
+
* provide one and the bytes must be exactly identical for this proof to pass.
|
|
13
|
+
*/
|
|
14
|
+
export declare function proveFinalCutArchiveByteRoundTrip(payload: Uint8Array, decoder: FinalCutKeyedArchiveJsonDecoder, encoder: FinalCutKeyedArchiveEncoder): Promise<FinalCutArchiveRoundTripProof>;
|
|
15
|
+
export interface FinalCutGraphAllocationEvidence {
|
|
16
|
+
existingCollectionPrimaryKeys: number[];
|
|
17
|
+
existingMetadataPrimaryKeys: number[];
|
|
18
|
+
existingCatalogPrimaryKeys: number[];
|
|
19
|
+
existingIdentifiers: string[];
|
|
20
|
+
primaryKeyMaxByEntity: Record<string, {
|
|
21
|
+
entity: number;
|
|
22
|
+
max: number;
|
|
23
|
+
}>;
|
|
24
|
+
catalogEntity: number;
|
|
25
|
+
metadataEntity: number;
|
|
26
|
+
}
|
|
27
|
+
export interface FinalCutVersionedGraphNode {
|
|
28
|
+
logicalId: string;
|
|
29
|
+
kind: "project" | "sequence" | "resource" | "occurrence" | "story-element" | "marker" | "caption";
|
|
30
|
+
entity: number;
|
|
31
|
+
primaryKey: number;
|
|
32
|
+
optimisticVersion: 1;
|
|
33
|
+
identifier: string;
|
|
34
|
+
name: string;
|
|
35
|
+
catalogPrimaryKey: number;
|
|
36
|
+
catalogIdentifier: string;
|
|
37
|
+
metadataPrimaryKey: number;
|
|
38
|
+
metadataIdentifier: string;
|
|
39
|
+
archive: Uint8Array;
|
|
40
|
+
}
|
|
41
|
+
export interface FinalCutVersionedGraphEdge {
|
|
42
|
+
parentPrimaryKey: number;
|
|
43
|
+
childPrimaryKey: number;
|
|
44
|
+
}
|
|
45
|
+
export interface FinalCutVersionedGraphPrimaryKeyUpdate {
|
|
46
|
+
entity: number;
|
|
47
|
+
expectedMax: number;
|
|
48
|
+
nextMax: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A typed, insert-only graph recipe. It contains no caller-provided SQL. The
|
|
52
|
+
* shadow executor turns this shape into the small allowlisted transaction.
|
|
53
|
+
*/
|
|
54
|
+
export interface FinalCutVersionedGraphRecipe {
|
|
55
|
+
kind: "versioned-project-materialization";
|
|
56
|
+
fingerprint: FinalCutSchemaFingerprint;
|
|
57
|
+
timelineDigest: string;
|
|
58
|
+
projectUid: string;
|
|
59
|
+
sequenceUid: string;
|
|
60
|
+
nodes: FinalCutVersionedGraphNode[];
|
|
61
|
+
edges: FinalCutVersionedGraphEdge[];
|
|
62
|
+
primaryKeyUpdates: FinalCutVersionedGraphPrimaryKeyUpdate[];
|
|
63
|
+
catalogEntity: number;
|
|
64
|
+
metadataEntity: number;
|
|
65
|
+
}
|
|
66
|
+
export interface CompileFinalCutVersionedGraphRequest {
|
|
67
|
+
timeline: TimelineIr;
|
|
68
|
+
fingerprint: FinalCutSchemaFingerprint;
|
|
69
|
+
existing: FinalCutGraphAllocationEvidence;
|
|
70
|
+
projectUid: string;
|
|
71
|
+
sequenceUid: string;
|
|
72
|
+
archiveEncoder: (node: {
|
|
73
|
+
logicalId: string;
|
|
74
|
+
kind: FinalCutVersionedGraphNode["kind"];
|
|
75
|
+
name: string;
|
|
76
|
+
}) => Promise<Uint8Array>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Phase 6 compiler. IDs are allocated from observed maxima and identifiers are
|
|
80
|
+
* deterministic, content-bound, and collision checked. Existing names are not
|
|
81
|
+
* update targets; every node is an insert into a new versioned graph.
|
|
82
|
+
*/
|
|
83
|
+
export declare function compileFinalCutVersionedGraphRecipe(request: CompileFinalCutVersionedGraphRequest): Promise<FinalCutVersionedGraphRecipe>;
|
|
84
|
+
/** Build the only SQL accepted for a versioned graph recipe. */
|
|
85
|
+
export declare function buildFinalCutVersionedGraphSql(recipe: FinalCutVersionedGraphRecipe): {
|
|
86
|
+
sql: string;
|
|
87
|
+
expectedCasUpdates: number;
|
|
88
|
+
};
|
|
89
|
+
export interface FinalCutNativeVerificationTarget {
|
|
90
|
+
projectUid: string;
|
|
91
|
+
sequenceUid: string;
|
|
92
|
+
}
|
|
93
|
+
export interface FinalCutNativeVerificationReadback {
|
|
94
|
+
target: FinalCutNativeVerificationTarget;
|
|
95
|
+
timeline: TimelineIr;
|
|
96
|
+
}
|
|
97
|
+
export type FinalCutNativeVerificationResult = {
|
|
98
|
+
status: "native_completed";
|
|
99
|
+
target: FinalCutNativeVerificationTarget;
|
|
100
|
+
desiredDigest: string;
|
|
101
|
+
readbackDigest: string;
|
|
102
|
+
} | {
|
|
103
|
+
status: "not_completed";
|
|
104
|
+
reason: string;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Phase 8 gate. Reopen and export are injected headed operations; a digest or
|
|
108
|
+
* target mismatch can never be reported as native completion.
|
|
109
|
+
*/
|
|
110
|
+
export declare function verifyFinalCutNativeReopen(target: FinalCutNativeVerificationTarget, desired: TimelineIr, reopen: () => Promise<void>, exportTarget: (target: FinalCutNativeVerificationTarget) => Promise<FinalCutNativeVerificationReadback>): Promise<FinalCutNativeVerificationResult>;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { ContextRevision } from "../../../../packages/runtime/src/index.js";
|
|
2
|
+
import { type FastTimelineObservation } from "../../../../packages/runtime/src/index.js";
|
|
3
|
+
import { FinalCutSqliteInspectionProvider, type FinalCutSqliteCollectionRow, type FinalCutSqliteMetadataRow, type FinalCutSqliteObservation } from "./sqlite-inspection.js";
|
|
4
|
+
export declare const FINAL_CUT_SQLITE_WAL_BACKEND: "final-cut-sqlite-wal-read-only";
|
|
5
|
+
export declare const FINAL_CUT_SQLITE_WAL_SCHEMA_VERSION: 1;
|
|
6
|
+
export interface FinalCutSqliteObservationTarget {
|
|
7
|
+
projectId: string;
|
|
8
|
+
sequenceId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FinalCutSqliteMaterializationProvenance {
|
|
11
|
+
framekitRevision: ContextRevision;
|
|
12
|
+
artifactDigest: string;
|
|
13
|
+
target: FinalCutSqliteObservationTarget;
|
|
14
|
+
}
|
|
15
|
+
export interface FinalCutSqliteStorageFingerprint {
|
|
16
|
+
path: string;
|
|
17
|
+
present: boolean;
|
|
18
|
+
bytes?: number;
|
|
19
|
+
digest?: string;
|
|
20
|
+
modifiedAt?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface FinalCutSqliteWalObservation {
|
|
23
|
+
schemaVersion: typeof FINAL_CUT_SQLITE_WAL_SCHEMA_VERSION;
|
|
24
|
+
backend: typeof FINAL_CUT_SQLITE_WAL_BACKEND;
|
|
25
|
+
canonical: false;
|
|
26
|
+
target: FinalCutSqliteObservationTarget;
|
|
27
|
+
provenance: FinalCutSqliteMaterializationProvenance;
|
|
28
|
+
finalCutVersion: string;
|
|
29
|
+
database: FinalCutSqliteObservation;
|
|
30
|
+
storage: {
|
|
31
|
+
database: FinalCutSqliteStorageFingerprint;
|
|
32
|
+
wal: FinalCutSqliteStorageFingerprint;
|
|
33
|
+
shm: FinalCutSqliteStorageFingerprint;
|
|
34
|
+
capturedAt: string;
|
|
35
|
+
freshness: "storage-observed";
|
|
36
|
+
};
|
|
37
|
+
coverage: {
|
|
38
|
+
storage: "observed";
|
|
39
|
+
structuralRows: "partial";
|
|
40
|
+
archivedPayloads: "opaque";
|
|
41
|
+
semanticOperation: "not-observable";
|
|
42
|
+
editorFreshness: "unknown";
|
|
43
|
+
canonicalTimeline: "unavailable";
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export type FinalCutSqliteWalObservationResult = {
|
|
47
|
+
status: "observed";
|
|
48
|
+
observation: FinalCutSqliteWalObservation;
|
|
49
|
+
issues: string[];
|
|
50
|
+
} | {
|
|
51
|
+
status: "unavailable" | "error";
|
|
52
|
+
error: {
|
|
53
|
+
code: string;
|
|
54
|
+
message: string;
|
|
55
|
+
retryable: boolean;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export interface FinalCutSqliteWalObservationProviderOptions {
|
|
59
|
+
inspectionProvider?: Pick<FinalCutSqliteInspectionProvider, "inspect">;
|
|
60
|
+
readFile?: (path: string) => Promise<Uint8Array>;
|
|
61
|
+
statFile?: (path: string) => Promise<{
|
|
62
|
+
size: number;
|
|
63
|
+
mtimeMs: number;
|
|
64
|
+
}>;
|
|
65
|
+
timestamp?: () => string;
|
|
66
|
+
}
|
|
67
|
+
export interface FinalCutSqliteWalCaptureRequest {
|
|
68
|
+
databasePath: string;
|
|
69
|
+
walPath?: string;
|
|
70
|
+
shmPath?: string;
|
|
71
|
+
target: FinalCutSqliteObservationTarget;
|
|
72
|
+
provenance: FinalCutSqliteMaterializationProvenance;
|
|
73
|
+
finalCutVersion: string;
|
|
74
|
+
}
|
|
75
|
+
/** Read-only DB/WAL/SHM observation. This provider never opens a writable SQLite handle. */
|
|
76
|
+
export declare class FinalCutSqliteWalObservationProvider {
|
|
77
|
+
private readonly inspectionProvider;
|
|
78
|
+
private readonly readFile;
|
|
79
|
+
private readonly statFile;
|
|
80
|
+
private readonly timestamp;
|
|
81
|
+
constructor(options?: FinalCutSqliteWalObservationProviderOptions);
|
|
82
|
+
capture(request: FinalCutSqliteWalCaptureRequest): Promise<FinalCutSqliteWalObservationResult>;
|
|
83
|
+
private fingerprint;
|
|
84
|
+
}
|
|
85
|
+
export type FinalCutSqliteRowDelta<T> = {
|
|
86
|
+
added: T[];
|
|
87
|
+
removed: T[];
|
|
88
|
+
modified: Array<{
|
|
89
|
+
before: T;
|
|
90
|
+
after: T;
|
|
91
|
+
}>;
|
|
92
|
+
};
|
|
93
|
+
export type FinalCutSqliteDeltaStatus = "unchanged" | "changed" | "ambiguous";
|
|
94
|
+
export interface FinalCutSqliteWalDelta {
|
|
95
|
+
schemaVersion: typeof FINAL_CUT_SQLITE_WAL_SCHEMA_VERSION;
|
|
96
|
+
status: FinalCutSqliteDeltaStatus;
|
|
97
|
+
canonical: false;
|
|
98
|
+
target: FinalCutSqliteObservationTarget;
|
|
99
|
+
from: {
|
|
100
|
+
revision: ContextRevision;
|
|
101
|
+
storage: FinalCutSqliteWalObservation["storage"];
|
|
102
|
+
};
|
|
103
|
+
to: {
|
|
104
|
+
revision: ContextRevision;
|
|
105
|
+
storage: FinalCutSqliteWalObservation["storage"];
|
|
106
|
+
};
|
|
107
|
+
collections: FinalCutSqliteRowDelta<FinalCutSqliteCollectionRow>;
|
|
108
|
+
metadata: FinalCutSqliteRowDelta<FinalCutSqliteMetadataRow>;
|
|
109
|
+
storage: {
|
|
110
|
+
database: "unchanged" | "changed";
|
|
111
|
+
wal: "absent" | "unchanged" | "changed";
|
|
112
|
+
shm: "absent" | "unchanged" | "changed";
|
|
113
|
+
};
|
|
114
|
+
coverage: Omit<FinalCutSqliteWalObservation["coverage"], "semanticOperation"> & {
|
|
115
|
+
semanticOperation: "not-observable" | "ambiguous";
|
|
116
|
+
};
|
|
117
|
+
recommendation: "no-change-observed" | "canonical-resync-required";
|
|
118
|
+
reasons: string[];
|
|
119
|
+
}
|
|
120
|
+
export declare function diffFinalCutSqliteWalObservations(previous: FinalCutSqliteWalObservation, current: FinalCutSqliteWalObservation): FinalCutSqliteWalDelta;
|
|
121
|
+
/** Convert SQLite/WAL evidence into the provider-neutral envelope without inventing Timeline IR. */
|
|
122
|
+
export declare function normalizeFinalCutSqliteWalObservation(observation: FinalCutSqliteWalObservation): FastTimelineObservation;
|
|
123
|
+
export type FinalCutSqliteControlledOperation = "trim-start" | "trim-end" | "move" | "delete" | "reorder" | "add-existing-source" | "repeated-occurrence" | "connected-clip" | "marker" | "project-rename";
|
|
124
|
+
export type FinalCutSqliteOperationCoverage = "proven" | "partial" | "ambiguous" | "not-observable";
|
|
125
|
+
export interface FinalCutSqliteOperationCapability {
|
|
126
|
+
operation: FinalCutSqliteControlledOperation;
|
|
127
|
+
coverage: FinalCutSqliteOperationCoverage;
|
|
128
|
+
evidence: "fixture-matrix";
|
|
129
|
+
canonical: false;
|
|
130
|
+
reason: string;
|
|
131
|
+
}
|
|
132
|
+
export declare const FINAL_CUT_SQLITE_OPERATION_MATRIX: readonly FinalCutSqliteOperationCapability[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { TimelineIr } from "../../../../packages/runtime/src/index.js";
|
|
2
|
+
export declare const FRAMEKIT_FCPXML_VERSION: "1.11";
|
|
3
|
+
/** Stable Final Cut identities required for target-bound publication. */
|
|
4
|
+
export interface FinalCutTargetIdentity {
|
|
5
|
+
libraryUid: string;
|
|
6
|
+
eventUid: string;
|
|
7
|
+
projectUid: string;
|
|
8
|
+
sequenceUid: string;
|
|
9
|
+
}
|
|
10
|
+
/** The provider identity that owns the destination project and sequence. */
|
|
11
|
+
export interface TimelineIrToFcpxmlTarget extends FinalCutTargetIdentity {
|
|
12
|
+
provider: "final-cut";
|
|
13
|
+
eventName?: string;
|
|
14
|
+
/** Reusing an existing project is opt-in; versioned is the safe default. */
|
|
15
|
+
materialization?: "versioned" | "reuse-existing";
|
|
16
|
+
}
|
|
17
|
+
export interface TimelineIrToFcpxmlOptions {
|
|
18
|
+
target: TimelineIrToFcpxmlTarget;
|
|
19
|
+
version?: typeof FRAMEKIT_FCPXML_VERSION;
|
|
20
|
+
}
|
|
21
|
+
export interface TimelineIrMaterializationCoverage {
|
|
22
|
+
exact: string[];
|
|
23
|
+
degraded: string[];
|
|
24
|
+
unsupported: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface TimelineIrMaterializationProvenance {
|
|
27
|
+
source: "framekit-timeline-ir";
|
|
28
|
+
schemaVersion: 1;
|
|
29
|
+
projectId: string;
|
|
30
|
+
sequenceId: string;
|
|
31
|
+
revision: TimelineIr["revision"];
|
|
32
|
+
timelineDigest: string;
|
|
33
|
+
target: FinalCutTargetIdentity;
|
|
34
|
+
destination: {
|
|
35
|
+
projectUid: string;
|
|
36
|
+
sequenceUid: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface TimelineIrToFcpxmlResult {
|
|
40
|
+
format: "fcpxml";
|
|
41
|
+
version: typeof FRAMEKIT_FCPXML_VERSION;
|
|
42
|
+
xml: string;
|
|
43
|
+
digest: string;
|
|
44
|
+
target: TimelineIrToFcpxmlTarget;
|
|
45
|
+
destination: {
|
|
46
|
+
mode: "versioned" | "reuse-existing";
|
|
47
|
+
projectUid: string;
|
|
48
|
+
sequenceUid: string;
|
|
49
|
+
projectName: string;
|
|
50
|
+
sequenceName: string;
|
|
51
|
+
};
|
|
52
|
+
resourceIds: Record<string, string>;
|
|
53
|
+
coverage: TimelineIrMaterializationCoverage;
|
|
54
|
+
provenance: TimelineIrMaterializationProvenance;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Compiles a complete provider-neutral Timeline IR into a new FCPXML
|
|
58
|
+
* document. The target binding is mandatory because names are not stable
|
|
59
|
+
* enough to identify a Final Cut destination.
|
|
60
|
+
*/
|
|
61
|
+
export declare function compileTimelineIrToFcpxml(timeline: TimelineIr, options: TimelineIrToFcpxmlOptions): TimelineIrToFcpxmlResult;
|
|
@@ -13,6 +13,12 @@ const BASIC_TITLE_EFFECT_UID = ".../Titles.localized/Bumper:Opener.localized/Bas
|
|
|
13
13
|
*/
|
|
14
14
|
export function compileTimelineIrToFcpxml(timeline, options) {
|
|
15
15
|
validateTimelineIr(timeline);
|
|
16
|
+
if (timeline.sequence.timecodeStart && parseExactRational(timeline.sequence.timecodeStart).value !== 0n) {
|
|
17
|
+
throw new Error("FCPXML_UNSUPPORTED_TIMELINE_FEATURE: nonzero timecode origin requires verified frame-grid handling");
|
|
18
|
+
}
|
|
19
|
+
if (timeline.sequence.frameGridOrigin && parseExactRational(timeline.sequence.frameGridOrigin).value !== 0n) {
|
|
20
|
+
throw new Error("FCPXML_UNSUPPORTED_TIMELINE_FEATURE: nonzero frame-grid origin requires verified handling");
|
|
21
|
+
}
|
|
16
22
|
const version = options.version ?? FRAMEKIT_FCPXML_VERSION;
|
|
17
23
|
if (version !== FRAMEKIT_FCPXML_VERSION) {
|
|
18
24
|
throw new Error(`FCPXML_VERSION_UNSUPPORTED: ${String(version)}`);
|
|
@@ -27,6 +33,19 @@ export function compileTimelineIrToFcpxml(timeline, options) {
|
|
|
27
33
|
const resourceNames = uniqueResourceNames(timeline);
|
|
28
34
|
const resources = [...timeline.resources].sort((left, right) => left.id.localeCompare(right.id));
|
|
29
35
|
const elements = alignRenderableElements(renderableElements(timeline, resourceIds), timeline.sequence.frameDuration, new Set(resources.filter(({ mediaKind }) => mediaKind === "audio").map(({ id }) => resourceIds.get(id))));
|
|
36
|
+
const sourceBounds = new Map(resources.filter((resource) => resource.sourceRange).map((resource) => [resourceIds.get(resource.id), resource.sourceRange]));
|
|
37
|
+
for (const element of elements) {
|
|
38
|
+
if (element.kind !== "asset-clip" || !element.resourceId)
|
|
39
|
+
continue;
|
|
40
|
+
const range = sourceBounds.get(element.resourceId);
|
|
41
|
+
if (!range)
|
|
42
|
+
continue;
|
|
43
|
+
const start = element.sourceStartTime ?? { value: "0", timescale: "1" };
|
|
44
|
+
const end = addExactTimes(start, element.durationTime);
|
|
45
|
+
if (compareExactTimes(start, range.start) < 0 || compareExactTimes(end, addExactTimes(range.start, range.duration)) > 0) {
|
|
46
|
+
throw new Error(`FCPXML_SOURCE_RANGE_OUT_OF_BOUNDS: frame rounding moved ${element.id} outside its source range`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
30
49
|
const elementIds = new Set();
|
|
31
50
|
for (const element of elements) {
|
|
32
51
|
if (elementIds.has(element.id))
|
|
@@ -59,7 +78,7 @@ export function compileTimelineIrToFcpxml(timeline, options) {
|
|
|
59
78
|
" <library>",
|
|
60
79
|
` <event uid="${xmlEscape(options.target.eventUid)}" name="${xmlEscape(options.target.eventName ?? "Framekit Event")}">`,
|
|
61
80
|
` <project uid="${xmlEscape(destination.projectUid)}" name="${xmlEscape(destination.projectName)}">`,
|
|
62
|
-
` <sequence format="${formatId}" duration="${formatRational(timeline.sequence.durationTime, "sequence.durationTime")}">`,
|
|
81
|
+
` <sequence format="${formatId}" duration="${formatRational(timeline.sequence.durationTime, "sequence.durationTime")}"${timeline.sequence.timecodeStart ? ` tcStart="${formatRational(timeline.sequence.timecodeStart, "sequence.timecodeStart")}"` : ""}>`,
|
|
63
82
|
" <spine>",
|
|
64
83
|
...renderElements(elements),
|
|
65
84
|
" </spine>",
|
|
@@ -311,9 +330,11 @@ function renderResource(resource, id, name) {
|
|
|
311
330
|
const metadata = resource.metadata;
|
|
312
331
|
const video = metadata?.streams.find((stream) => stream.kind === "video");
|
|
313
332
|
const audio = metadata?.streams.find((stream) => stream.kind === "audio");
|
|
314
|
-
const timingAttributes =
|
|
315
|
-
? ` start="
|
|
316
|
-
:
|
|
333
|
+
const timingAttributes = resource.sourceRange
|
|
334
|
+
? ` start="${formatRational(resource.sourceRange.start, `resource ${resource.id}.sourceRange.start`)}" duration="${formatRational(resource.sourceRange.duration, `resource ${resource.id}.sourceRange.duration`)}"`
|
|
335
|
+
: metadata
|
|
336
|
+
? ` start="0s" duration="${formatRational(metadata.durationTime, `resource ${resource.id}.durationTime`)}"`
|
|
337
|
+
: "";
|
|
317
338
|
const formatAttribute = video?.width && video.height && video.frameRate
|
|
318
339
|
? ` format="format-${id}"`
|
|
319
340
|
: resource.mediaKind === "audio"
|
|
@@ -667,6 +688,9 @@ function parseExactRational(value) {
|
|
|
667
688
|
return { value: BigInt(value.value), timescale };
|
|
668
689
|
}
|
|
669
690
|
function xmlEscape(value) {
|
|
691
|
+
if (/[^\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}]/u.test(value)) {
|
|
692
|
+
throw new Error("FCPXML_INVALID: text contains an illegal XML character");
|
|
693
|
+
}
|
|
670
694
|
return value
|
|
671
695
|
.replaceAll("&", "&")
|
|
672
696
|
.replaceAll("<", "<")
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { EditingSessionState, TimelineIr, TimelineIrEditOperation, TimelineReconciliationResult } from "../../../../packages/runtime/src/index.js";
|
|
2
|
+
import { type FinalCutSqliteObservation } from "./sqlite-inspection.js";
|
|
3
|
+
import { type TimelineIrToFcpxmlResult, type TimelineIrToFcpxmlTarget } from "./timeline-ir-fcpxml.js";
|
|
4
|
+
import { type FinalCutFcpxmlExperimentResult, type FinalCutFcpxmlExperimentObservation } from "./fcpxml-console-experiment.js";
|
|
5
|
+
export type UnattendedEditingEnvironment = Omit<FinalCutFcpxmlExperimentObservation, "artifact">;
|
|
6
|
+
export interface UnattendedEditingWorkflowOptions {
|
|
7
|
+
base: TimelineIr;
|
|
8
|
+
providerState: TimelineIr;
|
|
9
|
+
operations: TimelineIrEditOperation[];
|
|
10
|
+
target: TimelineIrToFcpxmlTarget;
|
|
11
|
+
environment: UnattendedEditingEnvironment;
|
|
12
|
+
sqlite?: {
|
|
13
|
+
before?: FinalCutSqliteObservation;
|
|
14
|
+
after?: FinalCutSqliteObservation;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export type UnattendedEditingStatus = "artifact-verified" | "artifact-verified-native-blocked" | "conflicted" | "stale";
|
|
18
|
+
export type UnattendedSqliteEvidence = {
|
|
19
|
+
status: "not-provided";
|
|
20
|
+
canonical: false;
|
|
21
|
+
} | {
|
|
22
|
+
status: "observed";
|
|
23
|
+
canonical: false;
|
|
24
|
+
digest: string;
|
|
25
|
+
coverageComplete: false;
|
|
26
|
+
} | {
|
|
27
|
+
status: "unchanged" | "changed";
|
|
28
|
+
canonical: false;
|
|
29
|
+
previousDigest: string;
|
|
30
|
+
currentDigest: string;
|
|
31
|
+
reasons: string[];
|
|
32
|
+
};
|
|
33
|
+
export interface UnattendedEditingWorkflowResult {
|
|
34
|
+
status: UnattendedEditingStatus;
|
|
35
|
+
session: {
|
|
36
|
+
state: EditingSessionState;
|
|
37
|
+
base: TimelineIr;
|
|
38
|
+
desired: TimelineIr;
|
|
39
|
+
serialized: string;
|
|
40
|
+
};
|
|
41
|
+
reconciliation?: TimelineReconciliationResult;
|
|
42
|
+
sqlite: UnattendedSqliteEvidence;
|
|
43
|
+
artifact?: TimelineIrToFcpxmlResult;
|
|
44
|
+
experiment?: FinalCutFcpxmlExperimentResult;
|
|
45
|
+
mutationAttempted: false;
|
|
46
|
+
overwritten: false;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Runs the safe, unattended portion of an edit. It can read a storage
|
|
50
|
+
* observation, rebase a session against provider state, and produce a new
|
|
51
|
+
* FCPXML artifact. It never calls Final Cut, imports an artifact, or writes a
|
|
52
|
+
* destination file.
|
|
53
|
+
*/
|
|
54
|
+
export declare function runUnattendedEditingWorkflow(options: UnattendedEditingWorkflowOptions): UnattendedEditingWorkflowResult;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LocalMediaMetadataProbe, TimelineIrMediaMetadata } from "../../../../packages/runtime/src/index.js";
|
|
2
|
+
export interface FfmpegMediaMetadataProbeOptions {
|
|
3
|
+
ffprobePath?: string;
|
|
4
|
+
env?: NodeJS.ProcessEnv;
|
|
5
|
+
}
|
|
6
|
+
export declare class FfmpegMediaMetadataProbe implements LocalMediaMetadataProbe {
|
|
7
|
+
private readonly ffprobePath;
|
|
8
|
+
private readonly environment;
|
|
9
|
+
constructor(options?: FfmpegMediaMetadataProbeOptions);
|
|
10
|
+
probe(sourcePath: string): Promise<TimelineIrMediaMetadata>;
|
|
11
|
+
}
|
|
@@ -15,8 +15,8 @@ export class FfmpegMediaMetadataProbe {
|
|
|
15
15
|
throw new Error(`HEADLESS_MEDIA_INVALID: source is not a regular file: ${sourcePath}`);
|
|
16
16
|
const result = await execFileAsync(this.ffprobePath, [
|
|
17
17
|
"-v", "error",
|
|
18
|
-
"-show_entries", "stream=codec_type,codec_name,width,height,r_frame_rate,sample_rate,channels",
|
|
19
|
-
"-show_entries", "format=duration",
|
|
18
|
+
"-show_entries", "stream=codec_type,codec_name,width,height,r_frame_rate,sample_rate,channels,time_base,start_pts,duration_ts",
|
|
19
|
+
"-show_entries", "format=duration,start_time",
|
|
20
20
|
"-of", "json",
|
|
21
21
|
sourcePath,
|
|
22
22
|
], { env: this.environment, maxBuffer: 2 * 1024 * 1024 });
|
|
@@ -33,6 +33,7 @@ export class FfmpegMediaMetadataProbe {
|
|
|
33
33
|
...(stream.width !== undefined ? { width: stream.width } : {}),
|
|
34
34
|
...(stream.height !== undefined ? { height: stream.height } : {}),
|
|
35
35
|
...(stream.r_frame_rate ? { frameRate: parseRate(stream.r_frame_rate) } : {}),
|
|
36
|
+
...(stream.codec_type === "video" && streamBounds(stream, parsed.format?.start_time) ? { sourceRange: streamBounds(stream, parsed.format?.start_time) } : {}),
|
|
36
37
|
...(stream.sample_rate ? { sampleRate: Number(stream.sample_rate) } : {}),
|
|
37
38
|
...(stream.channels !== undefined ? { channels: stream.channels } : {}),
|
|
38
39
|
}];
|
|
@@ -60,3 +61,26 @@ function gcd(left, right) {
|
|
|
60
61
|
}
|
|
61
62
|
return left || 1n;
|
|
62
63
|
}
|
|
64
|
+
function streamBounds(stream, formatStart) {
|
|
65
|
+
if (!stream.time_base || !/^\d+\/\d+$/.test(stream.time_base) || !Number.isSafeInteger(stream.start_pts) || !Number.isSafeInteger(stream.duration_ts) || stream.duration_ts <= 0 || !formatStart || !/^-?\d+(?:\.\d+)?$/.test(formatStart))
|
|
66
|
+
return undefined;
|
|
67
|
+
const [baseValue, baseScale] = stream.time_base.split("/").map(BigInt);
|
|
68
|
+
if (baseValue <= 0n || baseScale <= 0n)
|
|
69
|
+
return undefined;
|
|
70
|
+
const [whole, fraction = ""] = formatStart.replace("-", "").split(".");
|
|
71
|
+
const scale = 10n ** BigInt(fraction.length);
|
|
72
|
+
const origin = (formatStart.startsWith("-") ? -1n : 1n) * (BigInt(whole) * scale + BigInt(fraction || "0"));
|
|
73
|
+
let startValue = BigInt(stream.start_pts) * baseValue * scale - origin * baseScale;
|
|
74
|
+
const startScale = baseScale * scale;
|
|
75
|
+
// ffprobe formats the container origin at microsecond precision. Treat an
|
|
76
|
+
// offset within half a microsecond as zero, in either rounding direction.
|
|
77
|
+
const magnitude = startValue < 0n ? -startValue : startValue;
|
|
78
|
+
if (magnitude * 2000000n <= startScale)
|
|
79
|
+
startValue = 0n;
|
|
80
|
+
if (startValue < 0n)
|
|
81
|
+
return undefined;
|
|
82
|
+
const startDivisor = gcd(startValue < 0n ? -startValue : startValue, startScale);
|
|
83
|
+
const durationValue = BigInt(stream.duration_ts) * baseValue;
|
|
84
|
+
const durationDivisor = gcd(durationValue, baseScale);
|
|
85
|
+
return { start: { value: String(startValue / startDivisor), timescale: String(startScale / startDivisor) }, duration: { value: String(durationValue / durationDivisor), timescale: String(baseScale / durationDivisor) } };
|
|
86
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type FramekitRenderCapabilityReport, type FramekitRenderPlan, type FramekitRenderProvider, type FramekitRenderProviderResult, type FramekitRenderRequest } from "../../../../packages/runtime/src/index.js";
|
|
2
|
+
export interface FfmpegTimelineRendererOptions {
|
|
3
|
+
ffmpegPath?: string;
|
|
4
|
+
version?: string;
|
|
5
|
+
env?: NodeJS.ProcessEnv;
|
|
6
|
+
}
|
|
7
|
+
export type FfmpegRenderErrorCode = "HEADLESS_RENDER_UNAVAILABLE" | "HEADLESS_RENDER_UNSUPPORTED" | "HEADLESS_RENDER_MEDIA_MISSING" | "HEADLESS_RENDER_MEDIA_CHANGED" | "HEADLESS_RENDER_OUTPUT_EXISTS" | "HEADLESS_RENDER_OUTPUT_INVALID" | "HEADLESS_RENDER_PLAN_MISMATCH" | "HEADLESS_RENDER_FAILED";
|
|
8
|
+
export declare class FfmpegRenderError extends Error {
|
|
9
|
+
readonly code: FfmpegRenderErrorCode;
|
|
10
|
+
constructor(code: FfmpegRenderErrorCode, message: string);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The first provider-neutral concrete renderer. It consumes only a validated
|
|
14
|
+
* Timeline IR render plan and treats local source files as immutable inputs.
|
|
15
|
+
*/
|
|
16
|
+
export declare class FfmpegTimelineRenderer implements FramekitRenderProvider {
|
|
17
|
+
readonly id = "ffmpeg-headless";
|
|
18
|
+
readonly version: string;
|
|
19
|
+
private readonly ffmpegPath;
|
|
20
|
+
private readonly environment;
|
|
21
|
+
private readonly fontFile?;
|
|
22
|
+
constructor(options?: FfmpegTimelineRendererOptions);
|
|
23
|
+
capabilities(request: FramekitRenderRequest): FramekitRenderCapabilityReport;
|
|
24
|
+
render(plan: FramekitRenderPlan): Promise<FramekitRenderProviderResult>;
|
|
25
|
+
}
|
|
@@ -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
|