@morshoto/framekit 0.1.18 → 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/README.md +17 -12
- 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/background-materialization.js +8 -2
- 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-guard.js +275 -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 +571 -78
- package/dist-package/adapters/final-cut/typescript/src/connection.d.ts +103 -0
- package/dist-package/adapters/final-cut/typescript/src/connection.js +6 -1
- package/dist-package/adapters/final-cut/typescript/src/disposable-native.d.ts +90 -0
- package/dist-package/adapters/final-cut/typescript/src/disposable-native.js +6 -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/experimental.js +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 +28 -9
- package/dist-package/adapters/final-cut/typescript/src/index.d.ts +22 -0
- package/dist-package/adapters/final-cut/typescript/src/index.js +1 -7
- 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 +35 -2
- 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-recovery-inspection.js +175 -0
- package/dist-package/adapters/final-cut/typescript/src/native-session.d.ts +130 -0
- package/dist-package/adapters/final-cut/typescript/src/native-session.js +11 -6
- package/dist-package/adapters/final-cut/typescript/src/native.d.ts +828 -0
- package/dist-package/adapters/final-cut/typescript/src/native.js +475 -189
- 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 +19 -2
- package/dist-package/adapters/final-cut/typescript/src/publisher.d.ts +215 -0
- package/dist-package/adapters/final-cut/typescript/src/publisher.js +255 -14
- package/dist-package/adapters/final-cut/typescript/src/session.d.ts +43 -0
- package/dist-package/adapters/final-cut/typescript/src/session.js +43 -13
- 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 +31 -5
- 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/audio-output.js +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 +37 -14
- package/dist-package/adapters/headless/typescript/src/ffmpeg-verifier.d.ts +15 -0
- package/dist-package/adapters/headless/typescript/src/ffmpeg-verifier.js +9 -4
- 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/dev-doctor.js +198 -0
- package/dist-package/apps/cli/src/headless-projects.d.ts +3 -0
- package/dist-package/apps/cli/src/headless-projects.js +5 -0
- package/dist-package/apps/cli/src/main.d.ts +10 -0
- package/dist-package/apps/cli/src/main.js +42 -0
- package/dist-package/apps/mcp-server/runtime/ffmpeg-audio-backend.py +129 -0
- package/dist-package/apps/mcp-server/runtime/speech-analyzer-wrapper.mjs +54 -0
- package/dist-package/apps/mcp-server/runtime/whisper-speech-backend.py +271 -0
- 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/canonical-native-snapshot.js +18 -0
- package/dist-package/apps/mcp-server/src/final-cut-runtime-config.d.ts +5 -0
- package/dist-package/apps/mcp-server/src/final-cut-runtime-config.js +3 -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 +24 -19
- package/dist-package/apps/mcp-server/src/materialization-jobs.d.ts +204 -0
- package/dist-package/apps/mcp-server/src/materialization-jobs.js +143 -10
- 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/routing.js +2 -0
- package/dist-package/apps/mcp-server/src/server.d.ts +75 -0
- package/dist-package/apps/mcp-server/src/server.js +813 -158
- package/dist-package/apps/mcp-server/src/tools/skills/catalog.d.ts +19 -0
- package/dist-package/apps/mcp-server/src/tools/skills/catalog.js +142 -0
- package/dist-package/apps/mcp-server/src/tools/skills/metadata.d.ts +37 -0
- package/dist-package/apps/mcp-server/src/tools/skills/metadata.js +71 -0
- package/dist-package/apps/mcp-server/src/tools/skills/register.d.ts +11 -0
- package/dist-package/apps/mcp-server/src/tools/skills/register.js +101 -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/{apps/mcp-server → packages/headless-application}/src/headless-projects.js +392 -59
- package/dist-package/packages/headless-application/src/index.d.ts +2 -0
- package/dist-package/packages/headless-application/src/index.js +2 -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-service.js +5 -1
- package/dist-package/packages/runtime/src/application/project-store.d.ts +56 -0
- package/dist-package/packages/runtime/src/application/project-store.js +13 -36
- 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/application/transaction-store.js +1 -1
- 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/capabilities.js +1 -1
- 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-engine.js +22 -16
- package/dist-package/packages/runtime/src/context/context-service.d.ts +20 -0
- package/dist-package/packages/runtime/src/context/context-service.js +2 -2
- 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/edit-service.js +76 -10
- 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 +2 -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/runtime.js +16 -7
- 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 +48 -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/in-memory-editor.js +3 -3
- package/dist-package/packages/testkit/src/index.d.ts +4 -0
- package/dist-package/packages/testkit/src/index.js +1 -0
- package/dist-package/packages/testkit/src/sender-lifecycle-fixture.d.ts +47 -0
- package/dist-package/packages/testkit/src/sender-lifecycle-fixture.js +192 -0
- package/dist-package/packages/testkit/src/skill-fixtures.d.ts +3 -0
- package/package.json +41 -14
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { RuntimeCapabilities } from "./capabilities.js";
|
|
2
|
+
import type { ContextRevision, TimeRange } from "./primitives.js";
|
|
3
|
+
import type { ProjectSnapshot } from "./project.js";
|
|
4
|
+
import type { WorkflowOperation } from "./editing.js";
|
|
5
|
+
import type { TimelineDiff } from "./diff.js";
|
|
6
|
+
import type { VerificationPolicy, VerificationReport } from "./verification.js";
|
|
7
|
+
import type { VerificationCheck } from "./verification.js";
|
|
8
|
+
import type { EditTransaction } from "./editing.js";
|
|
9
|
+
import type { AudioMeasurement, NoiseMeasurement, SpeechAnalysis } from "./media.js";
|
|
10
|
+
/** Version of the editor-independent Skill contract. */
|
|
11
|
+
export declare const SKILL_CONTRACT_VERSION: 1;
|
|
12
|
+
/** The ordered phases shared by every Skill implementation. */
|
|
13
|
+
export declare const SKILL_LIFECYCLE: readonly ["discover", "resolve", "plan", "preview", "execute", "verify", "accept", "rollback"];
|
|
14
|
+
export type SkillLifecyclePhase = (typeof SKILL_LIFECYCLE)[number];
|
|
15
|
+
export type SkillSchema = {
|
|
16
|
+
type: "string";
|
|
17
|
+
description?: string;
|
|
18
|
+
enum?: string[];
|
|
19
|
+
minLength?: number;
|
|
20
|
+
} | {
|
|
21
|
+
type: "number";
|
|
22
|
+
description?: string;
|
|
23
|
+
minimum?: number;
|
|
24
|
+
maximum?: number;
|
|
25
|
+
} | {
|
|
26
|
+
type: "integer";
|
|
27
|
+
description?: string;
|
|
28
|
+
minimum?: number;
|
|
29
|
+
maximum?: number;
|
|
30
|
+
} | {
|
|
31
|
+
type: "boolean";
|
|
32
|
+
description?: string;
|
|
33
|
+
} | {
|
|
34
|
+
type: "array";
|
|
35
|
+
description?: string;
|
|
36
|
+
items: SkillSchema;
|
|
37
|
+
minItems?: number;
|
|
38
|
+
} | {
|
|
39
|
+
type: "object";
|
|
40
|
+
description?: string;
|
|
41
|
+
properties: Record<string, SkillSchema>;
|
|
42
|
+
required?: string[];
|
|
43
|
+
additionalProperties?: boolean;
|
|
44
|
+
};
|
|
45
|
+
/** A transport-neutral input schema carried by a Skill manifest. */
|
|
46
|
+
export interface SkillInputSchema {
|
|
47
|
+
type: "object";
|
|
48
|
+
properties: Record<string, SkillSchema>;
|
|
49
|
+
required?: string[];
|
|
50
|
+
additionalProperties?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export type EditorSkillCapability = "projectRead" | "timelineSnapshotRead" | "timelineWrite" | "timelineArtifactWrite" | "readAfterWrite" | "rollback" | "assetDiscovery" | "liveStateRead" | "playheadWrite" | "frameCapture" | "artifactPublish" | "projectCatalogRead" | "projectSelection" | "compositeTransactions" | "videoExport" | "mediaImport" | "mediaPlacement" | "pictureInPicture" | "titlePlacement" | "clipMove" | "clipReplace" | "clipRemoval" | "transitionPlacement" | "audioAttachment" | "audioMixing" | "noiseReduction" | "colorCorrection";
|
|
53
|
+
export type AnalyzerSkillCapability = "speechTranscribe" | "speechVad" | "audioLoudness" | "audioNoise" | "visualTrack" | "metadataDescribe";
|
|
54
|
+
/** Semantic operation names are deliberately independent of editor commands. */
|
|
55
|
+
export declare const SKILL_OPERATIONS: readonly ["rename-clip", "trim-clip", "set-gain", "reduce-noise", "set-color-correction", "ripple-delete", "add-marker", "media.import", "timeline.media.add", "timeline.picture-in-picture.add", "timeline.audio.fades", "timeline.title.add", "timeline.media.move", "timeline.media.replace", "timeline.media.remove", "timeline.transition.add", "timeline.audio.attach", "timeline.audio.mix", "timeline.mask.add"];
|
|
56
|
+
export type SkillOperation = (typeof SKILL_OPERATIONS)[number];
|
|
57
|
+
export type SkillRequirement = {
|
|
58
|
+
type: "allOf";
|
|
59
|
+
requirements: SkillRequirement[];
|
|
60
|
+
} | {
|
|
61
|
+
type: "anyOf";
|
|
62
|
+
requirements: SkillRequirement[];
|
|
63
|
+
} | {
|
|
64
|
+
type: "editor";
|
|
65
|
+
capability: EditorSkillCapability;
|
|
66
|
+
} | {
|
|
67
|
+
type: "analyzer";
|
|
68
|
+
capability: AnalyzerSkillCapability;
|
|
69
|
+
} | {
|
|
70
|
+
type: "operation";
|
|
71
|
+
operation: SkillOperation;
|
|
72
|
+
};
|
|
73
|
+
export interface SkillManifest {
|
|
74
|
+
contractVersion: typeof SKILL_CONTRACT_VERSION;
|
|
75
|
+
id: string;
|
|
76
|
+
version: string;
|
|
77
|
+
title: string;
|
|
78
|
+
description: string;
|
|
79
|
+
inputSchema: SkillInputSchema;
|
|
80
|
+
/** Version-pinned values used when the input omits optional policy fields. */
|
|
81
|
+
defaults?: Record<string, unknown>;
|
|
82
|
+
requirements: SkillRequirement;
|
|
83
|
+
verification?: VerificationPolicy;
|
|
84
|
+
}
|
|
85
|
+
export type SkillPlanDecision = "APPLY" | "NO_OP" | "SKIP";
|
|
86
|
+
export interface SkillPlanningContext {
|
|
87
|
+
/** The snapshot is read-only input to a handler; it is not an adapter. */
|
|
88
|
+
project: ProjectSnapshot;
|
|
89
|
+
capabilities: RuntimeCapabilities;
|
|
90
|
+
baseRevision: ContextRevision;
|
|
91
|
+
analyzeSpeech?: (mediaId: string, range?: TimeRange) => Promise<SpeechAnalysis>;
|
|
92
|
+
measureAudio?: (mediaId: string, occurrenceId: string) => Promise<AudioMeasurement>;
|
|
93
|
+
measureNoise?: (mediaId: string, occurrenceId: string) => Promise<NoiseMeasurement>;
|
|
94
|
+
}
|
|
95
|
+
export interface SkillPlan {
|
|
96
|
+
id: string;
|
|
97
|
+
skillId: string;
|
|
98
|
+
skillVersion: string;
|
|
99
|
+
baseRevision: ContextRevision;
|
|
100
|
+
normalizedInput: Record<string, unknown>;
|
|
101
|
+
operations: WorkflowOperation[];
|
|
102
|
+
affectedRanges: TimeRange[];
|
|
103
|
+
warnings: string[];
|
|
104
|
+
decision?: SkillPlanDecision;
|
|
105
|
+
verification?: VerificationPolicy;
|
|
106
|
+
details?: Record<string, unknown>;
|
|
107
|
+
}
|
|
108
|
+
export interface SkillPreview {
|
|
109
|
+
previewToken: string;
|
|
110
|
+
plan: SkillPlan;
|
|
111
|
+
expectedDiff?: TimelineDiff;
|
|
112
|
+
expiresAt: string;
|
|
113
|
+
}
|
|
114
|
+
export type SkillExecutionStatus = "VERIFIED" | "ROLLED_BACK" | "FAILED" | "SKIPPED";
|
|
115
|
+
export interface SkillRollbackResult {
|
|
116
|
+
attempted: boolean;
|
|
117
|
+
succeeded: boolean;
|
|
118
|
+
transactionIds: string[];
|
|
119
|
+
reason?: string;
|
|
120
|
+
}
|
|
121
|
+
export interface SkillExecution {
|
|
122
|
+
status: SkillExecutionStatus;
|
|
123
|
+
plan: Pick<SkillPlan, "id" | "skillId" | "skillVersion" | "baseRevision">;
|
|
124
|
+
transactionIds: string[];
|
|
125
|
+
diff?: TimelineDiff;
|
|
126
|
+
verification?: VerificationReport;
|
|
127
|
+
details?: Record<string, unknown>;
|
|
128
|
+
rollback: SkillRollbackResult;
|
|
129
|
+
}
|
|
130
|
+
export interface SkillVerificationContext {
|
|
131
|
+
plan: SkillPlan;
|
|
132
|
+
expectedDiff?: TimelineDiff;
|
|
133
|
+
transaction: EditTransaction;
|
|
134
|
+
measureAudio?: (mediaId: string, occurrenceId: string) => Promise<AudioMeasurement>;
|
|
135
|
+
}
|
|
136
|
+
export interface SkillHandler<Input extends Record<string, unknown> = Record<string, unknown>> {
|
|
137
|
+
normalize(input: unknown): Promise<Input> | Input;
|
|
138
|
+
plan(context: SkillPlanningContext, input: Input): Promise<Omit<SkillPlan, "id" | "skillId" | "skillVersion" | "baseRevision" | "normalizedInput">> | Omit<SkillPlan, "id" | "skillId" | "skillVersion" | "baseRevision" | "normalizedInput">;
|
|
139
|
+
verify?(context: SkillVerificationContext): Promise<VerificationCheck[]> | VerificationCheck[];
|
|
140
|
+
}
|
|
141
|
+
/** Metadata and executable behavior are separate so manifests remain inspectable. */
|
|
142
|
+
export interface SkillDefinition<Input extends Record<string, unknown> = Record<string, unknown>> {
|
|
143
|
+
manifest: SkillManifest;
|
|
144
|
+
handler: SkillHandler<Input>;
|
|
145
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ContextRevision, RationalTime } from "./primitives.js";
|
|
2
|
+
import type { Clip, ProjectSnapshot } from "./project.js";
|
|
3
|
+
/** A rational range addressed on one timeline. */
|
|
4
|
+
export interface TimelineTargetRange {
|
|
5
|
+
start: RationalTime;
|
|
6
|
+
end: RationalTime;
|
|
7
|
+
}
|
|
8
|
+
/** The immutable identity and coordinates captured for one timeline occurrence. */
|
|
9
|
+
export interface TimelineOccurrenceTarget {
|
|
10
|
+
id: string;
|
|
11
|
+
mediaId?: string;
|
|
12
|
+
sourceStartTime?: RationalTime;
|
|
13
|
+
startTime: RationalTime;
|
|
14
|
+
durationTime: RationalTime;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Stable addressing shared by background and headed providers.
|
|
18
|
+
*
|
|
19
|
+
* A native UI handle is intentionally not part of this contract. Providers may
|
|
20
|
+
* derive a short-lived handle internally, but must bind it to this scope,
|
|
21
|
+
* revision, identity, and exact frame grid before a write.
|
|
22
|
+
*/
|
|
23
|
+
export interface TimelineTarget {
|
|
24
|
+
projectId: string;
|
|
25
|
+
sequenceId: string;
|
|
26
|
+
revision: ContextRevision;
|
|
27
|
+
timelineStartTime: RationalTime;
|
|
28
|
+
/** Present only when the captured snapshot explicitly supplied its frame-grid origin. */
|
|
29
|
+
frameGridOriginObserved?: true;
|
|
30
|
+
frameDuration: RationalTime;
|
|
31
|
+
mediaId?: string;
|
|
32
|
+
occurrence?: TimelineOccurrenceTarget;
|
|
33
|
+
range?: TimelineTargetRange;
|
|
34
|
+
}
|
|
35
|
+
export interface TimelineTargetSelection {
|
|
36
|
+
occurrenceId?: string;
|
|
37
|
+
mediaId?: string;
|
|
38
|
+
range?: TimelineTargetRange;
|
|
39
|
+
}
|
|
40
|
+
export interface TimelineTargetResolution {
|
|
41
|
+
target: TimelineTarget;
|
|
42
|
+
occurrence?: Clip;
|
|
43
|
+
}
|
|
44
|
+
/** Capture a target from a canonical snapshot without deriving identity from names or indexes. */
|
|
45
|
+
export declare function createTimelineTarget(snapshot: ProjectSnapshot, selection?: TimelineTargetSelection): TimelineTarget;
|
|
46
|
+
/** Resolve and validate an explicit target against the current canonical snapshot. */
|
|
47
|
+
export declare function resolveTimelineTarget(snapshot: ProjectSnapshot, target: TimelineTarget): TimelineTargetResolution;
|
|
48
|
+
/**
|
|
49
|
+
* Verify that a post-write snapshot still addresses the same target.
|
|
50
|
+
* Coordinates may change for trim and move; occurrence and media identity may
|
|
51
|
+
* not change unless the operation explicitly removes the occurrence.
|
|
52
|
+
*/
|
|
53
|
+
export declare function assertTimelineTargetReadAfterWrite(target: TimelineTarget, before: ProjectSnapshot, after: ProjectSnapshot, options?: {
|
|
54
|
+
allowOccurrenceRemoval?: boolean;
|
|
55
|
+
}): void;
|
|
56
|
+
/** Validate the shape of a target before any provider-specific resolution. */
|
|
57
|
+
export declare function assertValidTimelineTarget(target: TimelineTarget): void;
|
|
@@ -8,7 +8,8 @@ export function createTimelineTarget(snapshot, selection = {}) {
|
|
|
8
8
|
projectId: snapshot.projectId,
|
|
9
9
|
sequenceId: snapshot.timeline.id,
|
|
10
10
|
revision: structuredClone(snapshot.revision),
|
|
11
|
-
timelineStartTime: { value: "0", timescale: "1" },
|
|
11
|
+
timelineStartTime: structuredClone(snapshot.timeline.frameGridOrigin ?? { value: "0", timescale: "1" }),
|
|
12
|
+
...(snapshot.timeline.frameGridOrigin !== undefined ? { frameGridOriginObserved: true } : {}),
|
|
12
13
|
frameDuration: structuredClone(frameDuration),
|
|
13
14
|
...(selection.mediaId !== undefined ? { mediaId: selection.mediaId } : {}),
|
|
14
15
|
...(selection.range ? { range: structuredClone(selection.range) } : {}),
|
|
@@ -42,6 +43,7 @@ export function resolveTimelineTarget(snapshot, target) {
|
|
|
42
43
|
if (!sameRational(target.frameDuration, snapshot.timeline.frameDuration)) {
|
|
43
44
|
throw new Error("FRAME_ALIGNMENT_REQUIRED: target frame duration does not match current timeline");
|
|
44
45
|
}
|
|
46
|
+
assertMatchingFrameGridOrigin(snapshot, target);
|
|
45
47
|
validateTargetCoordinates(snapshot, target);
|
|
46
48
|
const occurrence = target.occurrence
|
|
47
49
|
? findUniqueOccurrence(snapshot, target.occurrence.id)
|
|
@@ -64,6 +66,10 @@ export function assertTimelineTargetReadAfterWrite(target, before, after, option
|
|
|
64
66
|
if (after.projectId !== target.projectId || after.timeline.id !== target.sequenceId) {
|
|
65
67
|
throw new Error("TARGET_MISMATCH: read-after-write snapshot changed the addressed timeline");
|
|
66
68
|
}
|
|
69
|
+
if (!after.timeline.frameDuration || !sameRational(target.frameDuration, after.timeline.frameDuration)) {
|
|
70
|
+
throw new Error("FRAME_ALIGNMENT_REQUIRED: read-after-write frame duration changed or is unavailable");
|
|
71
|
+
}
|
|
72
|
+
assertMatchingFrameGridOrigin(after, target);
|
|
67
73
|
if (!target.occurrence)
|
|
68
74
|
return;
|
|
69
75
|
const matches = findOccurrences(after, target.occurrence.id);
|
|
@@ -79,6 +85,15 @@ export function assertTimelineTargetReadAfterWrite(target, before, after, option
|
|
|
79
85
|
throw new Error(`TARGET_MISMATCH: read-after-write changed media for occurrence ${target.occurrence.id}`);
|
|
80
86
|
}
|
|
81
87
|
}
|
|
88
|
+
function assertMatchingFrameGridOrigin(snapshot, target) {
|
|
89
|
+
if ((target.frameGridOriginObserved === true) !== (snapshot.timeline.frameGridOrigin !== undefined)) {
|
|
90
|
+
throw new Error("FRAME_ALIGNMENT_REQUIRED: target frame-grid origin evidence changed or is unavailable");
|
|
91
|
+
}
|
|
92
|
+
const origin = snapshot.timeline.frameGridOrigin ?? { value: "0", timescale: "1" };
|
|
93
|
+
if (!sameRational(target.timelineStartTime, origin)) {
|
|
94
|
+
throw new Error("FRAME_ALIGNMENT_REQUIRED: target frame-grid origin does not match current timeline");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
82
97
|
/** Validate the shape of a target before any provider-specific resolution. */
|
|
83
98
|
export function assertValidTimelineTarget(target) {
|
|
84
99
|
requireNonEmpty(target.projectId, "projectId");
|
|
@@ -89,6 +104,9 @@ export function assertValidTimelineTarget(target) {
|
|
|
89
104
|
}
|
|
90
105
|
requireNonEmpty(target.revision.timestamp, "revision.timestamp");
|
|
91
106
|
parseRational(target.timelineStartTime, "INVALID_TIMELINE_TARGET: timelineStartTime");
|
|
107
|
+
if (target.frameGridOriginObserved !== undefined && target.frameGridOriginObserved !== true) {
|
|
108
|
+
throw new Error("INVALID_TIMELINE_TARGET: frameGridOriginObserved must be true when present");
|
|
109
|
+
}
|
|
92
110
|
const frame = parseRational(target.frameDuration, "INVALID_TIMELINE_TARGET: frameDuration");
|
|
93
111
|
if (frame.value <= 0n)
|
|
94
112
|
throw new Error("INVALID_TIMELINE_TARGET: frameDuration must be positive");
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { EditTransaction } from "./editing.js";
|
|
2
|
+
import type { EditTarget } from "./editing.js";
|
|
3
|
+
import type { ColorCorrection } from "./project.js";
|
|
4
|
+
export interface AudioAudibilityAssertion {
|
|
5
|
+
type: "audio-audibility";
|
|
6
|
+
mediaId: string;
|
|
7
|
+
minAudibleSamples?: number;
|
|
8
|
+
maxSilenceMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface AudioCoverageAssertion {
|
|
11
|
+
type: "audio-coverage";
|
|
12
|
+
mediaId: string;
|
|
13
|
+
start: number;
|
|
14
|
+
duration: number;
|
|
15
|
+
toleranceSeconds?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface AudioLoudnessAssertion {
|
|
18
|
+
type: "audio-loudness";
|
|
19
|
+
mediaId: string;
|
|
20
|
+
occurrenceId?: string;
|
|
21
|
+
targetLufs: number;
|
|
22
|
+
toleranceDb?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface AudioNoiseAssertion {
|
|
25
|
+
type: "audio-noise";
|
|
26
|
+
mediaId: string;
|
|
27
|
+
maxNoiseFloorDb: number;
|
|
28
|
+
minConfidence?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface AudioSourceAssertion {
|
|
31
|
+
type: "audio-source";
|
|
32
|
+
mediaId: string;
|
|
33
|
+
sourceDigest?: string;
|
|
34
|
+
source?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface VisualContentAssertion {
|
|
37
|
+
type: "visual-content";
|
|
38
|
+
mediaId: string;
|
|
39
|
+
label: string;
|
|
40
|
+
labelKind?: "scene" | "subject";
|
|
41
|
+
minConfidence?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface DurationAssertion {
|
|
44
|
+
type: "duration";
|
|
45
|
+
target: "timeline";
|
|
46
|
+
expectedSeconds: number;
|
|
47
|
+
toleranceSeconds?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface StreamAssertion {
|
|
50
|
+
type: "stream";
|
|
51
|
+
target: "audio" | "video";
|
|
52
|
+
expected: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface StructureAssertion {
|
|
55
|
+
type: "structure";
|
|
56
|
+
requirement: "media-present" | "occurrence-present" | "operation-present";
|
|
57
|
+
mediaId?: string;
|
|
58
|
+
occurrenceId?: string;
|
|
59
|
+
operationType?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface ColorCorrectionAssertion {
|
|
62
|
+
type: "color-correction";
|
|
63
|
+
clipId: string;
|
|
64
|
+
expected: ColorCorrection;
|
|
65
|
+
}
|
|
66
|
+
export type VerificationAssertion = AudioAudibilityAssertion | AudioCoverageAssertion | AudioLoudnessAssertion | AudioNoiseAssertion | AudioSourceAssertion | VisualContentAssertion | DurationAssertion | StreamAssertion | StructureAssertion | ColorCorrectionAssertion;
|
|
67
|
+
export interface VerificationPolicy {
|
|
68
|
+
requireExpectedChange?: boolean;
|
|
69
|
+
maxTruePeakDb?: number;
|
|
70
|
+
requireSpeechContinuity?: boolean;
|
|
71
|
+
targetLufs?: number;
|
|
72
|
+
loudnessToleranceDb?: number;
|
|
73
|
+
assertions?: VerificationAssertion[];
|
|
74
|
+
}
|
|
75
|
+
export type VerificationCheckStatus = "passed" | "failed" | "unavailable";
|
|
76
|
+
export interface VerificationCheck {
|
|
77
|
+
name: string;
|
|
78
|
+
passed: boolean;
|
|
79
|
+
detail: string;
|
|
80
|
+
status?: VerificationCheckStatus;
|
|
81
|
+
expected?: unknown;
|
|
82
|
+
observed?: unknown;
|
|
83
|
+
reason?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface VerificationReport {
|
|
86
|
+
passed: boolean;
|
|
87
|
+
checks: VerificationCheck[];
|
|
88
|
+
target?: EditTarget;
|
|
89
|
+
}
|
|
90
|
+
export interface VerificationEngine {
|
|
91
|
+
verify(transaction: EditTransaction, policy: VerificationPolicy): Promise<VerificationReport>;
|
|
92
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DialogueNormalizationPreview, DialogueNormalizationRequest } from "../audio/dialogue-normalization.js";
|
|
2
|
+
import type { EditTransaction } from "../domain/editing.js";
|
|
3
|
+
import { MediaAnalysisService } from "../application/media-analysis-service.js";
|
|
4
|
+
import { ProjectService } from "../application/project-service.js";
|
|
5
|
+
import { EditService } from "./edit-service.js";
|
|
6
|
+
import type { EditorPort } from "../domain/ports.js";
|
|
7
|
+
export declare class DialogueNormalizationService {
|
|
8
|
+
private readonly adapter;
|
|
9
|
+
private readonly project;
|
|
10
|
+
private readonly analysis;
|
|
11
|
+
private readonly edits;
|
|
12
|
+
private readonly previews;
|
|
13
|
+
constructor(adapter: EditorPort, project: ProjectService, analysis: MediaAnalysisService, edits: EditService);
|
|
14
|
+
preview(request: DialogueNormalizationRequest): Promise<DialogueNormalizationPreview>;
|
|
15
|
+
execute(previewToken: string): Promise<EditTransaction>;
|
|
16
|
+
private assertCapabilities;
|
|
17
|
+
private rollbackAfterMeasurementFailure;
|
|
18
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { EditorPort } from "../domain/ports.js";
|
|
2
|
+
import type { ArtifactEditTargetInput, CompositeEditPreview, CompositeEditRequest, EditOperation, EditTransaction, EditorTimelineEditTargetInput } from "../domain/editing.js";
|
|
3
|
+
import type { ProjectSnapshot } from "../domain/project.js";
|
|
4
|
+
import type { TimelineDiff } from "../domain/diff.js";
|
|
5
|
+
import type { VerificationEngine, VerificationPolicy } from "../domain/verification.js";
|
|
6
|
+
import { MediaAnalysisService } from "../application/media-analysis-service.js";
|
|
7
|
+
import { ProjectService } from "../application/project-service.js";
|
|
8
|
+
import type { RuntimeOptions } from "../application/runtime-options.js";
|
|
9
|
+
import type { TransactionStore } from "../application/transaction-store.js";
|
|
10
|
+
export declare class EditService {
|
|
11
|
+
private readonly adapter;
|
|
12
|
+
private readonly project;
|
|
13
|
+
private readonly analysis;
|
|
14
|
+
private readonly verificationEngine;
|
|
15
|
+
private readonly options;
|
|
16
|
+
private readonly transactions;
|
|
17
|
+
private readonly editPreviews;
|
|
18
|
+
constructor(adapter: EditorPort, project: ProjectService, analysis: MediaAnalysisService, verificationEngine: VerificationEngine, options: RuntimeOptions, transactions: TransactionStore);
|
|
19
|
+
edit(operation: EditOperation, policy?: VerificationPolicy): Promise<EditTransaction>;
|
|
20
|
+
editArtifact(targetInput: ArtifactEditTargetInput, operation: EditOperation, policy?: VerificationPolicy): Promise<EditTransaction>;
|
|
21
|
+
editTimeline(targetInput: EditorTimelineEditTargetInput, operation: EditOperation, policy?: VerificationPolicy): Promise<EditTransaction>;
|
|
22
|
+
private editWithTarget;
|
|
23
|
+
previewEdit(request: CompositeEditRequest): Promise<CompositeEditPreview>;
|
|
24
|
+
previewArtifactEdit(targetInput: ArtifactEditTargetInput, request: CompositeEditRequest): Promise<CompositeEditPreview>;
|
|
25
|
+
previewTimelineEdit(targetInput: EditorTimelineEditTargetInput, request: CompositeEditRequest): Promise<CompositeEditPreview>;
|
|
26
|
+
private previewEditWithTarget;
|
|
27
|
+
executeEdit(previewToken: string, policy?: VerificationPolicy): Promise<EditTransaction>;
|
|
28
|
+
getDiff(transactionId: string): TimelineDiff;
|
|
29
|
+
getTransaction(transactionId: string): EditTransaction;
|
|
30
|
+
verifyTransaction(transactionId: string): Promise<NonNullable<EditTransaction["verification"]>>;
|
|
31
|
+
private reanalyzeForVerification;
|
|
32
|
+
undo(transactionId: string): Promise<ProjectSnapshot>;
|
|
33
|
+
private assertRestored;
|
|
34
|
+
private assertCompositeCapabilities;
|
|
35
|
+
private defaultTarget;
|
|
36
|
+
private artifactTarget;
|
|
37
|
+
private artifactDescriptor;
|
|
38
|
+
private readArtifactDigest;
|
|
39
|
+
private timelineTarget;
|
|
40
|
+
private assertTarget;
|
|
41
|
+
private assertSurfaceCapability;
|
|
42
|
+
private now;
|
|
43
|
+
private pruneEditPreviews;
|
|
44
|
+
}
|
|
@@ -4,7 +4,7 @@ import { diffSnapshots } from "../timeline/snapshot-diff.js";
|
|
|
4
4
|
import { canonicalSnapshotDigest } from "../timeline/snapshot-digest.js";
|
|
5
5
|
import { assertValidMaskConfiguration } from "../domain/editing.js";
|
|
6
6
|
import { sameRevision } from "../context/revision.js";
|
|
7
|
-
import { parseRational } from "../timeline/rational-time.js";
|
|
7
|
+
import { addRationalTimes, parseRational } from "../timeline/rational-time.js";
|
|
8
8
|
import { assertValidVerificationPolicy } from "../verification/verification.js";
|
|
9
9
|
export class EditService {
|
|
10
10
|
adapter;
|
|
@@ -203,7 +203,8 @@ export class EditService {
|
|
|
203
203
|
}
|
|
204
204
|
this.assertTarget(preview.target, before);
|
|
205
205
|
preview.operations.forEach(assertValidWorkflowOperation);
|
|
206
|
-
await this.
|
|
206
|
+
const executionCapabilities = (await this.adapter.getCapabilities()).editor;
|
|
207
|
+
await this.assertCompositeCapabilities(preview.operations, preview.target.kind, executionCapabilities);
|
|
207
208
|
if (!this.adapter.applyTransaction) {
|
|
208
209
|
throw new Error("CAPABILITY_UNAVAILABLE: editor composite transaction execution");
|
|
209
210
|
}
|
|
@@ -243,7 +244,12 @@ export class EditService {
|
|
|
243
244
|
verificationPolicy,
|
|
244
245
|
status: "APPLIED",
|
|
245
246
|
};
|
|
246
|
-
const
|
|
247
|
+
const markerOperation = preview.operations.length === 1 && preview.operations[0]?.type === "add-marker"
|
|
248
|
+
&& preview.target.kind === "editor.timeline"
|
|
249
|
+
&& executionCapabilities.markerIdentityMode === "editor-assigned"
|
|
250
|
+
&& executionCapabilities.semanticOperations?.["add-marker"] === true
|
|
251
|
+
? preview.operations[0] : undefined;
|
|
252
|
+
const authorizedDiffCheck = sameDiffContent(transaction.diff, preview.expectedDiff, markerOperation?.marker.id, before.timeline.markers.map((marker) => marker.id))
|
|
247
253
|
? undefined
|
|
248
254
|
: {
|
|
249
255
|
name: "authorized-diff",
|
|
@@ -477,18 +483,78 @@ function postWriteAnalysisRequirements(policy) {
|
|
|
477
483
|
visual: assertions.some((assertion) => assertion.type === "visual-content"),
|
|
478
484
|
};
|
|
479
485
|
}
|
|
480
|
-
function sameDiffContent(left, right) {
|
|
486
|
+
function sameDiffContent(left, right, requestedMarkerId, existingMarkerIds = []) {
|
|
487
|
+
const actual = structuredClone(left);
|
|
488
|
+
const expectedMarker = right.markerChanges[0];
|
|
489
|
+
const actualMarker = actual.markerChanges[0];
|
|
490
|
+
const expectedChange = right.changes.filter((change) => change.scope === "marker");
|
|
491
|
+
const actualChange = actual.changes.filter((change) => change.scope === "marker");
|
|
492
|
+
if (requestedMarkerId && right.markerChanges.length === 1 && actual.markerChanges.length === 1
|
|
493
|
+
&& expectedMarker?.type === "MARKER_ADDED" && actualMarker?.type === "MARKER_ADDED"
|
|
494
|
+
&& expectedMarker.itemId === requestedMarkerId && expectedMarker.marker.id === requestedMarkerId
|
|
495
|
+
&& expectedMarker.after?.id === requestedMarkerId && !expectedMarker.before
|
|
496
|
+
&& actualMarker.itemId && actualMarker.marker.id === actualMarker.itemId && actualMarker.after?.id === actualMarker.itemId && !actualMarker.before
|
|
497
|
+
&& !existingMarkerIds.includes(requestedMarkerId) && !existingMarkerIds.includes(actualMarker.itemId)
|
|
498
|
+
&& expectedChange.length === 1 && actualChange.length === 1
|
|
499
|
+
&& expectedChange[0]?.type === "MARKER_ADDED" && expectedChange[0].itemId === requestedMarkerId && expectedChange[0].after?.id === requestedMarkerId
|
|
500
|
+
&& actualChange[0]?.type === "MARKER_ADDED" && actualChange[0].itemId === actualMarker.itemId && actualChange[0].after?.id === actualMarker.itemId) {
|
|
501
|
+
actualMarker.itemId = requestedMarkerId;
|
|
502
|
+
actualMarker.marker.id = requestedMarkerId;
|
|
503
|
+
actualMarker.after.id = requestedMarkerId;
|
|
504
|
+
actualChange[0].itemId = requestedMarkerId;
|
|
505
|
+
actualChange[0].after.id = requestedMarkerId;
|
|
506
|
+
}
|
|
481
507
|
const comparable = (diff) => {
|
|
482
|
-
const
|
|
508
|
+
const normalized = structuredClone(diff);
|
|
509
|
+
const normalize = (value) => addRationalTimes(value, { value: "0", timescale: "1" }, "INVALID_PROJECT_STATE");
|
|
510
|
+
const normalizeItem = (value) => {
|
|
511
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
512
|
+
return;
|
|
513
|
+
const item = value;
|
|
514
|
+
for (const key of ["startTime", "durationTime", "sourceStartTime"]) {
|
|
515
|
+
if (item[key] !== undefined)
|
|
516
|
+
item[key] = normalize(item[key]);
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
for (const change of [...normalized.added, ...normalized.removed, ...normalized.modified]) {
|
|
520
|
+
normalizeItem(change.before);
|
|
521
|
+
normalizeItem(change.after);
|
|
522
|
+
}
|
|
523
|
+
for (const change of [...normalized.markerChanges, ...normalized.captionChanges, ...normalized.storyElementChanges]) {
|
|
524
|
+
normalizeItem(change.before);
|
|
525
|
+
normalizeItem(change.after);
|
|
526
|
+
if ("marker" in change)
|
|
527
|
+
normalizeItem(change.marker);
|
|
528
|
+
if ("caption" in change)
|
|
529
|
+
normalizeItem(change.caption);
|
|
530
|
+
if ("element" in change)
|
|
531
|
+
normalizeItem(change.element);
|
|
532
|
+
}
|
|
533
|
+
for (const change of normalized.changes) {
|
|
534
|
+
if (change.scope !== "media") {
|
|
535
|
+
normalizeItem(change.before);
|
|
536
|
+
normalizeItem(change.after);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
for (const range of normalized.affectedRanges)
|
|
540
|
+
normalizeItem(range);
|
|
541
|
+
normalized.durationDeltaTime = normalize(normalized.durationDeltaTime);
|
|
542
|
+
if (normalized.playheadChange?.before)
|
|
543
|
+
normalized.playheadChange.before = normalize(normalized.playheadChange.before);
|
|
544
|
+
if (normalized.playheadChange?.after)
|
|
545
|
+
normalized.playheadChange.after = normalize(normalized.playheadChange.after);
|
|
546
|
+
const { from: _from, to: _to, provenance, ...content } = normalized;
|
|
483
547
|
return {
|
|
484
|
-
target: provenance ? {
|
|
485
|
-
projectId: provenance.projectId,
|
|
486
|
-
sequenceId: provenance.sequenceId,
|
|
487
|
-
} : undefined,
|
|
548
|
+
target: provenance ? { projectId: provenance.projectId, sequenceId: provenance.sequenceId } : undefined,
|
|
488
549
|
...content,
|
|
489
550
|
};
|
|
490
551
|
};
|
|
491
|
-
|
|
552
|
+
try {
|
|
553
|
+
return JSON.stringify(comparable(actual)) === JSON.stringify(comparable(right));
|
|
554
|
+
}
|
|
555
|
+
catch {
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
492
558
|
}
|
|
493
559
|
function assertValidWorkflowOperation(operation) {
|
|
494
560
|
if (operation.type === "timeline.mask.add") {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EditorPort } from "../domain/ports.js";
|
|
2
|
+
import type { EditTransaction } from "../domain/editing.js";
|
|
3
|
+
import type { VerificationEngine } from "../domain/verification.js";
|
|
4
|
+
import type { FillerRemovalPreview, FillerRemovalRequest } from "../speech/filler-removal.js";
|
|
5
|
+
import { ProjectService } from "../application/project-service.js";
|
|
6
|
+
import type { RuntimeOptions } from "../application/runtime-options.js";
|
|
7
|
+
import type { TransactionStore } from "../application/transaction-store.js";
|
|
8
|
+
export declare class FillerRemovalService {
|
|
9
|
+
private readonly adapter;
|
|
10
|
+
private readonly project;
|
|
11
|
+
private readonly verificationEngine;
|
|
12
|
+
private readonly options;
|
|
13
|
+
private readonly transactions;
|
|
14
|
+
private readonly previews;
|
|
15
|
+
constructor(adapter: EditorPort, project: ProjectService, verificationEngine: VerificationEngine, options: RuntimeOptions, transactions: TransactionStore);
|
|
16
|
+
previewFillerRemoval(request: FillerRemovalRequest): Promise<FillerRemovalPreview>;
|
|
17
|
+
executeFillerRemoval(previewToken: string): Promise<EditTransaction>;
|
|
18
|
+
private assertCapabilities;
|
|
19
|
+
private assertRestored;
|
|
20
|
+
private reanalyzeFillerTargets;
|
|
21
|
+
private now;
|
|
22
|
+
private prunePreviews;
|
|
23
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { RationalTime } from "../domain/primitives.js";
|
|
2
|
+
export type EditingIntentOperation = {
|
|
3
|
+
type: "trim_to_duration";
|
|
4
|
+
duration: RationalTime;
|
|
5
|
+
} | {
|
|
6
|
+
type: "blade_at_playhead";
|
|
7
|
+
playheadTime: RationalTime;
|
|
8
|
+
} | {
|
|
9
|
+
type: "delete_range";
|
|
10
|
+
range: {
|
|
11
|
+
start: RationalTime;
|
|
12
|
+
end: RationalTime;
|
|
13
|
+
};
|
|
14
|
+
} | {
|
|
15
|
+
type: "media_import";
|
|
16
|
+
path: string;
|
|
17
|
+
targetProject: "active";
|
|
18
|
+
} | {
|
|
19
|
+
type: "media_select";
|
|
20
|
+
mediaHandle: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: "media_append_selected";
|
|
23
|
+
targetProject: "active";
|
|
24
|
+
placement: "append";
|
|
25
|
+
} | {
|
|
26
|
+
type: "media_append";
|
|
27
|
+
mediaHandle: string;
|
|
28
|
+
targetProject: "active";
|
|
29
|
+
placement: "append";
|
|
30
|
+
} | {
|
|
31
|
+
type: "media_insert";
|
|
32
|
+
mediaHandle: string;
|
|
33
|
+
targetProject: "active";
|
|
34
|
+
placement: "insert";
|
|
35
|
+
} | {
|
|
36
|
+
type: "media_import_then_append";
|
|
37
|
+
path: string;
|
|
38
|
+
targetProject: "active";
|
|
39
|
+
placement: "append";
|
|
40
|
+
};
|
|
41
|
+
export type EditingIntentAffectedRange = {
|
|
42
|
+
kind: "tail";
|
|
43
|
+
start: RationalTime;
|
|
44
|
+
end: "sequence-end";
|
|
45
|
+
} | {
|
|
46
|
+
kind: "playhead";
|
|
47
|
+
at: RationalTime;
|
|
48
|
+
} | {
|
|
49
|
+
kind: "range";
|
|
50
|
+
start: RationalTime;
|
|
51
|
+
end: RationalTime;
|
|
52
|
+
};
|
|
53
|
+
export type EditingIntentResolution = {
|
|
54
|
+
status: "resolved";
|
|
55
|
+
destructive: true;
|
|
56
|
+
previewRequired: true;
|
|
57
|
+
previewTool: "editor.native.trim-to-duration.preview" | "editor.native.blade.preview" | "editor.native.delete-range.preview";
|
|
58
|
+
operation: EditingIntentOperation;
|
|
59
|
+
affectedRange: EditingIntentAffectedRange;
|
|
60
|
+
} | {
|
|
61
|
+
status: "resolved";
|
|
62
|
+
destructive: boolean;
|
|
63
|
+
previewRequired: boolean;
|
|
64
|
+
previewTool?: MediaPreviewTool;
|
|
65
|
+
executeTool?: MediaExecuteTool;
|
|
66
|
+
operation: MediaEditingIntentOperation;
|
|
67
|
+
requiredCapabilities: string[];
|
|
68
|
+
requiredParameters: MediaIntentParameter[];
|
|
69
|
+
workflow: string[];
|
|
70
|
+
} | {
|
|
71
|
+
status: "capability_unavailable";
|
|
72
|
+
destructive: boolean;
|
|
73
|
+
previewRequired: false;
|
|
74
|
+
question: string;
|
|
75
|
+
options: MediaEditingIntentOperation["type"][];
|
|
76
|
+
requiredCapabilities: string[];
|
|
77
|
+
missingCapabilities: string[];
|
|
78
|
+
} | {
|
|
79
|
+
status: "clarification_required";
|
|
80
|
+
destructive: boolean;
|
|
81
|
+
previewRequired: false;
|
|
82
|
+
question: string;
|
|
83
|
+
options: EditingIntentOperation["type"][];
|
|
84
|
+
};
|
|
85
|
+
type MediaEditingIntentOperation = Extract<EditingIntentOperation, {
|
|
86
|
+
type: `media_${string}`;
|
|
87
|
+
}>;
|
|
88
|
+
type MediaPreviewTool = "editor.native.media.append.preview" | "editor.native.media.append.selected.preview" | "editor.native.media.insert.preview";
|
|
89
|
+
type MediaExecuteTool = "editor.native.media.append.execute" | "editor.native.media.append.selected.execute" | "editor.native.media.insert.execute";
|
|
90
|
+
type MediaIntentParameter = "path" | "mediaHandle" | "project" | "placement";
|
|
91
|
+
export interface EditingIntentResolutionContext {
|
|
92
|
+
/** When present, native media intent resolution fails closed for unavailable capabilities. */
|
|
93
|
+
availableCapabilities: Readonly<Record<string, boolean>>;
|
|
94
|
+
}
|
|
95
|
+
/** Resolve only the explicit destructive language supported by Framekit. */
|
|
96
|
+
export declare function resolveEditingIntent(request: string, context?: EditingIntentResolutionContext): EditingIntentResolution;
|
|
97
|
+
export {};
|