Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
feat: activate speech alignment
kashorin02e8678dbe11
diff --git a/examples/talking-film-golden/README.md b/examples/talking-film-golden/README.mdindex da9a8481..103308b3 100644--- a/examples/talking-film-golden/README.md+++ b/examples/talking-film-golden/README.md@@ -75,7 +75,7 @@ Candidates and Operations.| `seedance:Prompt` | `@svml/seedance` | package-private immutable direction value | missing || `seedance:Speech model="mini"` | `@svml/seedance` | explicit Seedance Mini Need returning one speech clip Product | missing || `speech:Spine` | `@svml/speech` | ordered clips -> one `SpeechBasis`, then ordinary projections | basis and four locked projection facets implemented; author assembly missing |-| `whisperx:Alignment` | `@svml/whisperx` | 48k speech master -> explicit 16k evidence Need -> WhisperX -> provider-neutral `@svml/speech-align` -> Map | Graph Fragment, local media projection and local Provider adapter implemented; Surface/sidecar packaging missing |+| `whisperx:Alignment` | `@svml/whisperx` | 48k speech master -> explicit 16k evidence Need -> WhisperX -> provider-neutral `@svml/speech-align` -> Map | Graph Fragment, locked deterministic components, local media projection and local Provider/service implemented; Surface missing || `seedance:Video model="mini"` | `@svml/seedance` | explicit Seedance Mini video Need | missing || `broll:Track` | `@svml/broll` | semantic windows + media + recipe -> peer Visual/Audio Tracks | Program/lowering implemented; Surface missing || `caption:Track` | `@svml/caption-gemini` | timed projection + Gemini cue grouping + role recipe -> VisualTrack | base timing/lowering implemented; Gemini/role Surface missing |diff --git a/packages/prelude-video/README.md b/packages/prelude-video/README.mdindex e449a660..6afef682 100644--- a/packages/prelude-video/README.md+++ b/packages/prelude-video/README.md@@ -5,9 +5,10 @@ Manifests, the SVS Frontend, official Text Surfaces and the deterministic computowned by those modules. Compiler and Runtime Hosts grant those facets independently. The packagehas no Provider, credential, store, queue, network or rendering authority.-The aggregate now carries the complete `@svml/speech-take` Manifest and its four deterministic-Product projections. A physical package-lock test proves that this dependency is discovered from-the installed package closure rather than from a CLI or Runtime registration list.+The aggregate now carries the complete `@svml/speech-take` and `@svml/speech-align` Manifests,+including four deterministic Product projections and the provider-neutral timing locator. A+physical package-lock test proves that both dependencies are discovered from the installed package+closure rather than from a CLI or Runtime registration list.The CLI depends only on this replaceable prelude rather than enumerating Script, Film orHyperFrames packages itself.diff --git a/packages/prelude-video/package.json b/packages/prelude-video/package.jsonindex fa61c40c..2e84bf9d 100644--- a/packages/prelude-video/package.json+++ b/packages/prelude-video/package.json@@ -16,6 +16,7 @@"@svml/hyperframes-render": "workspace:*","@svml/media-pipeline": "workspace:*","@svml/script": "workspace:*",+ "@svml/speech-align": "workspace:*","@svml/speech-take": "workspace:*","@svml/svs": "workspace:*"},diff --git a/packages/prelude-video/src/index.ts b/packages/prelude-video/src/index.tsindex beba6a94..c20ab11c 100644--- a/packages/prelude-video/src/index.ts+++ b/packages/prelude-video/src/index.ts@@ -30,6 +30,10 @@ import {scriptModuleRef,scriptSurfaceImplementationDigest,} from "@svml/script";+import {+ speechAlignComponent,+ speechAlignManifest,+} from "@svml/speech-align";import {speechTakeComponent,speechTakeManifest,@@ -45,6 +49,7 @@ export const svmlPackage: NodePackageActivation = {{ manifest: svsManifest },{ manifest: hyperframesManifest },{ manifest: mediaPipelineManifest },+ { manifest: speechAlignManifest },{ manifest: speechTakeManifest },{ manifest: filmManifest, specifiers: ["@svml/film", "@svml/film@1"] },{@@ -56,6 +61,7 @@ export const svmlPackage: NodePackageActivation = {components: [...videoContractsComponents,mediaPipelineComponent,+ speechAlignComponent,speechTakeComponent,hyperframesComponent,hyperframesRenderComponent,diff --git a/packages/prelude-video/test/activation.test.ts b/packages/prelude-video/test/activation.test.tsindex 48647604..3971f3e7 100644--- a/packages/prelude-video/test/activation.test.ts+++ b/packages/prelude-video/test/activation.test.ts@@ -14,6 +14,10 @@ import {nodePackageComponents,writeNodePackageLock,} from "@svml/package-loader-node";+import {+ speechAlignComponent,+ speechAlignManifest,+} from "@svml/speech-align";import {speechTakeComponent,speechTakeManifest,@@ -34,17 +38,32 @@ test("the official prelude activates SpeechTake compute without teaching the Hos);});-test("the installed official package lock physically contains SpeechTake compute", async () => {+test("the official prelude activates Speech Align compute without teaching the Host its name", () => {+ const components = nodePackageComponents([svmlPackage]);+ assert.equal(+ svmlPackage.modules?.some((module) => module.manifest === speechAlignManifest),+ true,+ );+ assert.equal(components.includes(speechAlignComponent), true);+ assert.deepEqual(+ speechAlignComponent.producers.map((facet) => facet.producer.name),+ ["locate-speech"],+ );+});++test("the installed official package lock physically contains deterministic speech compute", async () => {const directory = await mkdtemp(join(tmpdir(), "svml-prelude-lock-"));const lockPath = join(directory, "svml.packages.lock");const installedRoot = fileURLToPath(new URL("../../cli/", import.meta.url));try {const lock = await createNodePackageLock(["@svml/prelude-video"], installedRoot);assert.equal(lock.artifacts.some((artifact) => artifact.name === "@svml/speech-take"), true);+ assert.equal(lock.artifacts.some((artifact) => artifact.name === "@svml/speech-align"), true);await writeNodePackageLock(lockPath, lock);const packages = await loadNodePackages(lockPath, installedRoot);const components = nodePackageComponents(packages);assert.equal(components.some((component) => component.name === "@svml/speech-take"), true);+ assert.equal(components.some((component) => component.name === "@svml/speech-align"), true);} finally {await rm(directory, { recursive: true, force: true });}diff --git a/packages/speech-align/README.md b/packages/speech-align/README.mdindex c7804753..49ef7653 100644--- a/packages/speech-align/README.md+++ b/packages/speech-align/README.md@@ -17,5 +17,11 @@ The locator accepts Narrative, SpeechAudioBasis and AlignedTranscriptEvidence toEvidence unless its Basis, audio Artifact and ProgramSpace digests match exactly, even when anotheraudio file has the same duration and Segment ids.+`speechAlignComponent` exposes the locator as one enumerable deterministic Producer facet. Its+identity is checked against `speechAlignManifest`, enters the installed implementation package+lock and executes through the host-neutral compute port. The package depends only on public video+contracts and protocol utilities; it has no Core, Driver, Provider, Artifact, queue or credential+authority.+Caption display is outside this package. `@svml/caption` composes the resulting complete speechmap with Script's authored Caption Projection and keeps presentation estimates local to the track.diff --git a/packages/speech-align/package.json b/packages/speech-align/package.jsonindex f350801c..906b70e2 100644--- a/packages/speech-align/package.json+++ b/packages/speech-align/package.json@@ -7,8 +7,8 @@".": "./src/index.ts"},"dependencies": {+ "@svml/component-kit": "workspace:*","@svml/contracts": "workspace:*",- "@svml/core": "workspace:*","@svml/protocol": "workspace:*"},"devDependencies": {diff --git a/packages/speech-align/src/component.ts b/packages/speech-align/src/component.tsnew file mode 100644index 00000000..d858ef19--- /dev/null+++ b/packages/speech-align/src/component.ts@@ -0,0 +1,41 @@+import type { ComponentPackage } from "@svml/component-kit";+import type {+ AlignedTranscriptEvidence,+ Narrative,+ SpeechAudioBasis,+} from "@svml/contracts";+import type { StoredValue } from "@svml/protocol";+import { canonicalize } from "@svml/protocol";++import {+ locateSpeechTiming,+ speechLocatorDigest,+} from "./locate.js";+import { speechAlignProducers } from "./manifest.js";++function inline<T>(value: StoredValue | undefined, subject: string): T {+ if (value?.kind !== "inline") throw new Error(`${subject} must be inline`);+ return value.value as T;+}++/** Provider-neutral deterministic alignment; acoustic measurement remains an explicit upstream Need. */+export const speechAlignComponent = {+ name: "@svml/speech-align",+ producers: [{+ producer: speechAlignProducers.locate,+ implementationDigest: speechLocatorDigest,+ handler: ({ inputs }) => ({+ outputs: {+ map: {+ kind: "inline",+ value: canonicalize(locateSpeechTiming(+ inline<Narrative>(inputs.narrative?.value, "Narrative"),+ inline<SpeechAudioBasis>(inputs.audio?.value, "SpeechAudioBasis"),+ inline<AlignedTranscriptEvidence>(inputs.evidence?.value, "AlignedTranscriptEvidence"),+ )),+ },+ },+ needs: {},+ }),+ }],+} satisfies ComponentPackage;diff --git a/packages/speech-align/src/index.ts b/packages/speech-align/src/index.tsindex cc48dd9c..fa912da8 100644--- a/packages/speech-align/src/index.ts+++ b/packages/speech-align/src/index.ts@@ -1,4 +1,5 @@export { alignWordGroups } from "./align.js";+export { speechAlignComponent } from "./component.js";export { SpeechAlignmentError } from "./error.js";export { locateSpeechTiming, speechLocatorDigest } from "./locate.js";export { speechAlignManifest, speechAlignModuleRef, speechAlignProducers } from "./manifest.js";diff --git a/packages/speech-align/src/locate.ts b/packages/speech-align/src/locate.tsindex d023263e..8e1e6007 100644--- a/packages/speech-align/src/locate.ts+++ b/packages/speech-align/src/locate.ts@@ -1,4 +1,4 @@-import { digestOf, isDigest } from "@svml/core";+import { digestOf, isDigest } from "@svml/protocol";import type {AlignedTranscriptEvidence,AlignedTranscriptSegment,diff --git a/packages/speech-align/test/speech-align.test.ts b/packages/speech-align/test/speech-align.test.tsindex d9e03c92..df5c4b45 100644--- a/packages/speech-align/test/speech-align.test.ts+++ b/packages/speech-align/test/speech-align.test.ts@@ -7,11 +7,13 @@ import {sealSpeechBasis,} from "@svml/contracts";import type { Narrative, SpeechAudioBasis, SpeechBasis } from "@svml/contracts";-import { digestOf } from "@svml/core";+import { digestOf } from "@svml/protocol";import { parseScript } from "@svml/script";import {SpeechAlignmentError,locateSpeechTiming,+ speechAlignComponent,+ speechAlignManifest,} from "@svml/speech-align";import type {AlignedTranscriptEvidence,@@ -127,6 +129,19 @@ function characters(}));}+test("the component enumerates the exact Manifest-declared locator", () => {+ assert.deepEqual(+ speechAlignComponent.producers.map((facet) => ({+ name: facet.producer.name,+ digest: facet.implementationDigest,+ })),+ speechAlignManifest.producers.map((producer) => ({+ name: producer.name,+ digest: producer.implementation.digest,+ })),+ );+});+test("exact transcript words cover every Script and Segment anchor", () => {const narrative = parseScript("exact.svml", "<line>Hello world.</line>");const map = locate(narrative, {diff --git a/packages/speech-program/test/video-pipeline.test.ts b/packages/speech-program/test/video-pipeline.test.tsindex 60dc15e5..b1d4736a 100644--- a/packages/speech-program/test/video-pipeline.test.ts+++ b/packages/speech-program/test/video-pipeline.test.ts@@ -1,7 +1,10 @@import assert from "node:assert/strict";import test from "node:test";-import { registerTypeValidatorFacets } from "@svml/component-kit";+import {+ registerProducerFacets,+ registerTypeValidatorFacets,+} from "@svml/component-kit";import {captionImplementationDigest,captionProducers,@@ -17,7 +20,6 @@ import {sealVisualTrack,} from "@svml/contracts";import type {- AlignedTranscriptEvidence,CompleteSemanticMap,Narrative,SpeechAudioBasis,@@ -39,7 +41,10 @@ import {resolveRealization,sealRealizationOverlay,} from "@svml/realization";-import { locateSpeechTiming, speechAlignProducers, speechLocatorDigest } from "@svml/speech-align";+import {+ speechAlignComponent,+ speechAlignProducers,+} from "@svml/speech-align";import {mediaPipelineCapabilities,mediaPipelineImplementationDigests,@@ -121,7 +126,6 @@ test("the Speech Program pipeline resumes without repeating paid calls", async (evidenceAudioRequest: 0,whisperRequest: 0,whisperNormalize: 0,- locate: 0,caption: 0,};@@ -274,18 +278,7 @@ test("the Speech Program pipeline resumes without repeating paid calls", async ();return { outputs: { evidence: { kind: "inline", value: evidence } }, needs: {} };});- host.registerProducer(speechAlignProducers.locate, speechLocatorDigest, ({ inputs }) => {- calls.locate += 1;- assert.equal(inputs.narrative?.value.kind, "inline");- assert.equal(inputs.audio?.value.kind, "inline");- assert.equal(inputs.evidence?.value.kind, "inline");- const map = locateSpeechTiming(- inlineValue<Narrative>(inputs.narrative.value.value),- inlineValue<SpeechAudioBasis>(inputs.audio.value.value),- inlineValue<AlignedTranscriptEvidence>(inputs.evidence.value.value),- );- return { outputs: { map: { kind: "inline", value: map } }, needs: {} };- });+ registerProducerFacets(host, speechAlignComponent.producers);host.registerProducer(captionProducers.temporalize, captionImplementationDigest, ({ inputs }) => {calls.caption += 1;assert.equal(inputs.narrative?.value.kind, "inline");@@ -479,7 +472,6 @@ test("the Speech Program pipeline resumes without repeating paid calls", async (evidenceAudioRequest: 1,whisperRequest: 1,whisperNormalize: 1,- locate: 1,caption: 1,});assert.deepEqual(completed.state.receipts.map((receipt) => receipt.fulfiller), [diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 28f932fd..59710fc8 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -470,6 +470,9 @@ importers:'@svml/script':specifier: workspace:*version: link:../script+ '@svml/speech-align':+ specifier: workspace:*+ version: link:../speech-align'@svml/speech-take':specifier: workspace:*version: link:../speech-take@@ -700,12 +703,12 @@ importers:packages/speech-align:dependencies:+ '@svml/component-kit':+ specifier: workspace:*+ version: link:../component-kit'@svml/contracts':specifier: workspace:*version: link:../contracts- '@svml/core':- specifier: workspace:*- version: link:../core'@svml/protocol':specifier: workspace:*version: link:../protocol