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
docs: rebaseline unreleased language as v1
kashorin896d7b432195
diff --git a/README.md b/README.mdindex 6fab20d7..d6c4d77c 100644--- a/README.md+++ b/README.md@@ -24,14 +24,14 @@ not enter the source language.The repository contains a strict TypeScript compiler and an intentionally smallstdlib. The deterministic slice is working end to end:-- frozen Script Surface with dialogue, speech and caption projections;+- an early Script parser with dialogue, speech and caption projections;- closed, possibly disconnected Selection sets and zero-width Moments;- `.svc` content modules and typed `.svs` parameter classes;- stable Plan identities, separate execution digests and a verified `svml.lock`;- isolated `.svk` component lowering with scoped CSS and a JSON-only ABI;- typed `.svk` ports, parameters and recursive child-content schemas;- manifest-enforced temporal `one` / `each` / `set` consumption;-- a Speech Spine compatibility component, media/presentation mapping, ranking, B-roll,+- a temporary Speech Spine prototype, media/presentation mapping, ranking, B-roll,captions, text and audio;- frame-exact Located IR, Canvas/Timeline views and HyperFrames HTML.@@ -42,12 +42,13 @@ falls back to a provider call. Direct existing `Image`, `Video` and `Audio` valuwork as usual. This keeps the first end-to-end reference deterministic whilepreserving the eventual capability boundary.-The executable prototype still implements frozen Script Surface v1: one globally-monotonic Speech Spine alignment with shared adjacent Segment cuts. The architecture-draft and Script Surface v2 draft specify the next boundary: a replaceable Basis-Component, an importable Locator Component that outputs SemanticMap, and `2M + 2N`-independent Segment/word endpoint identities. The repository does not claim that-migration is implemented.+SVML has not been publicly released, so the repository does not preserve the early+prototype as a compatibility contract. The sole v1 target is the architecture draft+and Script Surface v1: a replaceable Basis Component, an imported Locator Component,+and `2M + 2N` independent Segment/word endpoint identities. The executable prototype+still uses shared adjacent Segment cuts and a temporary `speech-spine`; it is an+incomplete implementation scheduled for direct replacement, not an older language+version that v1 must support.## Commands@@ -76,7 +77,7 @@ pnpm svml render build/index.html --out build/video.mp4````--artifacts` is needed only when the reachable Plan contains capability Components.-`fmt` currently canonicalizes only the frozen Script body and refuses any rewrite+`fmt` currently canonicalizes only the prototype Script body and refuses any rewritewhose reparsed semantic IR differs.`canvas` requires no timing or provider result. `estimate` deterministicallycreates provisional syllable-based alignment; `timeline` and `compile` consume@@ -88,7 +89,7 @@ SemanticMap digests are not all part of the executable lock path.## Reference implementation[`examples/regen-ranking/regen-ranking.svml`](examples/regen-ranking/regen-ranking.svml)-reconstructs a real production video containing the Speech Spine compatibility component,+reconstructs a real production video using the temporary Speech Spine prototype,a five-item ranking track, five B-roll items, captions, title, music and sound effects. The media filesare intentionally gitignored; their production provenance and frozen assertionsare recorded in@@ -100,11 +101,11 @@ speech program (0.46% duration error); it remains preview evidence, not measuredalignment.[`examples/flat-track-launch/flat-track-launch.svml`](examples/flat-track-launch/flat-track-launch.svml)-is the readable fixture for the next architecture boundary: separate Basis and-Locator Components, Script Surface v2, continuous A-roll Present changes, B-roll+is the readable fixture for the v1 architecture target: separate Basis and+Locator Components, Script Surface v1, continuous A-roll Present changes, B-rolltransition audio, disconnected caption selections, absolute z and Film as the sole-`Track[]` consumer. It is a draft fixture, not yet accepted by the executable v1-compiler.+`Track[]` consumer. It is a draft fixture not yet accepted by the early compiler+prototype.[`examples/composite-speech-program/minimal.svml`](examples/composite-speech-program/minimal.svml)and its adjacent `speech-program.svk` define the proposed `composite-v1` author@@ -115,15 +116,13 @@ data consumed by one assembler, and the Component has no ambient document access## Specification-- [Script Surface v1](spec/script-surface-v1.md) — the frozen, human-readable- source language for narrative, text projections, selections, and moments.-- [Script Surface v2 draft](spec/script-surface-v2-draft.md) — the syntax-preserving- independent Segment endpoint and `2M + 2N` migration.+- [Script Surface v1](spec/script-surface-v1.md) — the sole draft target for the+ human-readable Script, including independent Segment endpoints and `2M + 2N`.- [Source Architecture Draft](spec/source-architecture-draft.md) — the currentdraft for `.svk` components, `.svs` parameter sheets, `.svc` content modules,Script-dependent generation, five public output boundaries, `composite-v1`, flatTracks, and a Composition root.-- [Compiler prototype record](docs/compiler-prototype-v1.md) — implemented+- [Compiler prototype record](docs/compiler-prototype.md) — implementedboundaries, real-video evidence and remaining work.- [External Runtime Host Architecture Draft](docs/runtime-host-architecture-draft.md)— portable runtime, Artifact, Effect/Receipt, Worker, queue, provider anddiff --git a/examples/composite-speech-program/README.md b/examples/composite-speech-program/README.mdindex 890b7e58..b8e0a439 100644--- a/examples/composite-speech-program/README.md+++ b/examples/composite-speech-program/README.md@@ -33,10 +33,10 @@ not select a language-level family or mode. `after` names a stable Segment id, athe following Segment comes from source order. A join cannot declare both `gap`and `overlap`.-An implementation may retain `speech-spine` as a compatibility facade for V1-authors. It remains an ordinary imported Composite, never a compiler keyword or a-required singleton. Alternative Locators use explicit low-level wiring or another-Composite instead of extending a closed `locator="..."` enum.+The v1 stdlib publishes `speech-program` as its chosen author surface. It remains+an ordinary imported Composite, never a compiler keyword or a required singleton.+Alternative Locators use explicit low-level wiring or another Composite instead+of extending a closed `locator="..."` enum.The bracket expression in `ports.script.segment[item.id]` is a stable id-keyedlookup, not a positional array lookup. The `for` iterates only over finite childrendiff --git a/examples/composite-speech-program/minimal.svml b/examples/composite-speech-program/minimal.svmlindex f2783a8e..02a13028 100644--- a/examples/composite-speech-program/minimal.svml+++ b/examples/composite-speech-program/minimal.svml@@ -1,15 +1,15 @@<!--Proposed composite-v1 author surface. The current compiler does not implement- this profile or Script Surface v2 yet.+ this profile or the complete Script Surface v1 yet.-->-<svml version="2">+<svml version="1"><import from="./speech-program.svk"/><import from="@svml/std/media-track.svk"/><import from="@svml/std/film.svk"/><import as="house" from="./house.svs"/>- <script version="2">+ <script><segment id="intro"><HOST> Hello, this is SVML.</segment>diff --git a/examples/flat-track-launch/README.md b/examples/flat-track-launch/README.mdindex 4d0265b5..9940f1ec 100644--- a/examples/flat-track-launch/README.md+++ b/examples/flat-track-launch/README.md@@ -1,10 +1,10 @@# Flat Track Launch architecture fixtureThis source is the readable fixture for the unimplemented Source Architecture-Draft. It deliberately exercises contracts that the current v1 compiler does not+Draft. It deliberately exercises v1 contracts that the early compiler does notyet accept:-- Script Surface v2 independent Segment endpoints (`2M + 2N`);+- Script Surface v1 independent Segment endpoints (`2M + 2N`);- a Basis Component that overlaps adjacent Segment media;- an imported Locator Component that produces the selected ExactSemanticMap;- one ProgramBasis and one absolute ProgramSpace;diff --git a/examples/flat-track-launch/flat-track-launch.svml b/examples/flat-track-launch/flat-track-launch.svmlindex 5aa021ad..22bccfbb 100644--- a/examples/flat-track-launch/flat-track-launch.svml+++ b/examples/flat-track-launch/flat-track-launch.svml@@ -1,10 +1,10 @@<!--Architecture fixture for Source Architecture Draft.- It is intentionally not accepted by the current Script Surface v1 prototype.+ It is intentionally not accepted by the current early compiler prototype.-->-<svml version="2">+<svml version="1">- <import from="@svml/std/crossfade-speech.svk"/>+ <import from="@svml/std/speech-assemble.svk"/><import from="@svml/std/speech-locator.svk"/><import from="@svml/std/media-track.svk"/><import from="@svml/std/broll-track.svk"/>@@ -16,7 +16,7 @@<import as="house" from="./launch.svs"/>- <script version="2">+ <script>@whole@prelude@@ -51,7 +51,7 @@source maps, program audio and a program-bound visual facet. The LocatorComponent separately binds this Script's 2M + 2N identities to the basis.-->- <crossfade-speech id="voice" overlap="500ms">+ <speech-assemble id="voice" defaultJoin="cut"><segmentid="prelude"script={script.segment.prelude}@@ -70,7 +70,21 @@source={host-long}sourceWindow="30s .. 50s"/>- </crossfade-speech>++ <join+ after="prelude"+ overlap="500ms"+ audio="crossfade"+ visual="dissolve"+ />++ <join+ after="intro"+ overlap="500ms"+ audio="crossfade"+ visual="dissolve"+ />+ </speech-assemble><!--SemanticMap is the fifth SVK output role. A simple speech-locator may exposediff --git a/spec/script-surface-v1.md b/spec/script-surface-v1.mdindex 01179c9c..5f579bf7 100644--- a/spec/script-surface-v1.md+++ b/spec/script-surface-v1.md@@ -1,16 +1,16 @@# SVML Script Surface v1-> **Surface frozen; implementation pending.**+> **Draft; not frozen.**>-> 本规范冻结 SVML 稿子区的 v1 源语言。Script 是后端无关的语义源,不声明-> 某个画布、节点注册表或渲染器已经实现这些规则。实现只有在通过本文的+> SVML 尚未公开发布,不存在需要兼容的旧语言版本。本文直接定义首个公开目标+> Script Surface v1;仓库中的早期原型不是规范合同。实现只有在通过本文的> parser、projection、source-map 和 temporal golden fixtures 后,才可声称-> 支持 Script Surface v1。+> 支持 SVML v1。-SVML 是语义视频源语言,不是像素渲染格式。本文只冻结它最高频、最需要保持+SVML 是语义视频源语言,不是像素渲染格式。本文只定义它最高频、最需要保持可读性的稿子区 `<script>`;画布、节点、样式、生成参数和其他 Program 区域的-外层文档结构另行设计。冻结之后,新增语义应首先组合本文已有构造;确需改变-正文语法时必须发布新的 Script Surface 版本,不能静默扩写 v1。+外层文档结构另行设计。v1 发布后,新增语义应首先组合本文已有构造;确需改变+正文语法时再发布新版本,不能因为早期原型行为而削弱当前 v1。## 一页合同@@ -18,7 +18,7 @@ SVML 是语义视频源语言,不是像素渲染格式。本文只冻结它最| 构造 | 只负责 | 不负责 ||---|---|---|-| `Segment` | 有序的媒体/口播块和结构切点 | 自动 Selection、时长、静音 |+| `Segment` | 有序的媒体/口播块和独立结构端点 | 自动 Selection、时长、静音 || `Role Cue` | `dialogue` 导出时的“谁说了什么”文本前缀 | speaker 实体、音色、字段路由 || `Dual Text` | 显示文字与实际读音不同 | TTS 厂商参数、样式、动作 || `Selection` | 一个或多个显式闭合的语义时间区间 | 消费者声明、绝对秒数 |@@ -80,7 +80,7 @@ Meet Hypit.````silence` 只是 Selection 的名字,不会自动让音频静音。它完整选择了空-Segment 的两个结构切点;真正的静音或素材行为由外部 Program 决定。+Segment 的两个独立结构端点;真正的静音或素材行为由外部 Program 决定。`pop` 是一个默认吸右的 Moment,解析到 `laughed` 的起音;它同样不进入任何文本投影。@@ -107,8 +107,9 @@ Segment 的两个结构切点;真正的静音或素材行为由外部 Program结果或 `<script>` 外的 Program。- Segment 不自动声明同名 Selection。选择一个、三个或任意多个 Segment,都必须显式写闭合 Selection。-- 相邻 Segment 共享一个切点。因此 `m` 个 Segment 始终贡献 `m + 1` 个- 具有稳定身份的结构切点。+- 每个 Segment 独立拥有 `start` 与 `end` 两个稳定 identity;相邻 Segment+ 不共享结构端点 identity。两个 identity 可以在硬切时落到同一 ProgramPoint,+ 也可以因 overlap 或 gap 落到不同点,但不能合并身份。例如选择三个连续 Segment:@@ -228,10 +229,10 @@ Selection 是区间声明,不是供下游自行拼接的两个公开锚点:| 端点写法 | 吸附方向 | 典型含义 ||---|---|---|-| `@id` | 右 | 从右侧词首或右侧结构切点开始 |-| `~@id` | 左 | 向外扩到左侧词尾或左侧结构切点 |-| `@/id` | 左 | 在左侧词尾或左侧结构切点结束 |-| `@/id~` | 右 | 向外扩到右侧词首或右侧结构切点 |+| `@id` | 右 | 从右侧词首或右侧结构端点开始 |+| `~@id` | 左 | 向外扩到左侧词尾或左侧结构端点 |+| `@/id` | 左 | 在左侧词尾或左侧结构端点结束 |+| `@/id~` | 右 | 向外扩到右侧词首或右侧结构端点 |例子:@@ -296,24 +297,71 @@ Slot 绑定、Dual Text speech 投影和 NFC 归一化之后,v1 使用规范边界,可以在新的 timing profile / Script Surface 版本中复用相同的Selection/Moment 类型;v1 不应为尚不存在的精度引入新正文符号。-若 speech 中有 `n` 个 token、Script 中有 `m` 个 Segment,Temporal Anchor-Map 恰有:+若 Script 有 `N` 个 Segment,第 `k` 个 Segment 有 `mₖ` 个 speech token,且+`M = Σmₖ`,Semantic Anchor Index 恰有:```text-2n + m + 1+Σ(2mₖ + 2) = 2M + 2N```-个稳定身份:每个 token 的词首/词尾各一个,加上 `m + 1` 个唯一结构切点。-这些身份即使最终解析到同一帧也不能合并。+个稳定身份。每个 Segment 内的局部顺序是:-同一份 SelectionSet 可先在 Estimate Anchor Map 上得到预览区间,再在-Evidence Anchor Map 上得到精确区间。Script 本身不含秒数、帧号或采样点。+```text+segment[k].start+token[k,1].start+token[k,1].end+...+token[k,mₖ].start+token[k,mₖ].end+segment[k].end+```++Program 起点和终点属于 ProgramBasis,不额外进入 Semantic Anchor Index。空+Segment 仍有独立 start/end,即使二者最终重合;任意不同 identity 即使最终+落到同一帧也不能合并。++Locator 必须提交覆盖全部 `2M + 2N` identity 的总映射:++```text+SemanticAnchorIdentity → ProgramPoint(basisDigest)+```++完整性与精度正交:每个点都必须存在,同时可以标记为 `estimated`、`derived`+或 `measured`。消费者不得补点、移动点或从相邻 occurrence 借点。每个 Segment+内部必须非降序:++```text+segment.start ≤ token₁.start ≤ token₁.end ≤ ... ≤ segment.end+```++按源码相邻的 Segment `A`、`B` 还必须保持:++```text+A.start ≤ B.start+A.end ≤ B.end+```++这允许硬切、重叠与留白,同时禁止一个 Locator 把后写的整个 Segment 静默排到+前写 Segment 之前:++```text+hard cut A.end == B.start+overlap B.start < A.end+gap B.start > A.end+```++若未来需要真正重排或并行 speech,应发布显式的非线性叙事模型;v1 不让普通+Range 在不同 Locator 下反向或消失。++同一份 SelectionSet 可先在 `EstimatedSemanticMap` 上得到预览区间,再在+`ExactSemanticMap` 上得到成片区间。两者使用完全相同的 identity、不同的精度+类型。Script 本身不含秒数、帧号或采样点。Script Surface 不绑定帧率、采样率或渲染器。后端一旦选择物理时钟,必须只量化一次并让所有消费者复用同一整数边界;后端时钟变化不改变本语言表面。-对齐、结构切点或帧量化可能使某个 occurrence 最终成为零长或反向区间。-消费者先应用自己的 projection,再只丢弃该非正区间 occurrence;不得移动-Selection 端点、借用相邻 occurrence 或替作者补范围。+对齐、结构端点、projection 或帧量化可能使某个 occurrence 最终成为零长或+反向区间。实现必须产生明确诊断,不能静默丢弃、移动 Selection 端点、借用+相邻 occurrence 或替作者补范围。## 5. Moment@@ -328,8 +376,8 @@ Moment 是完整的点声明,不是省略了 close 的 Selection:| 写法 | 吸附方向 | 典型含义 ||---|---|---|-| `@id!` | 右 | 右侧词首或右侧结构切点 |-| `~@id!` | 左 | 左侧词尾或左侧结构切点 |+| `@id!` | 右 | 右侧词首或右侧结构端点 |+| `~@id!` | 左 | 左侧词尾或左侧结构端点 |默认右吸覆盖“与某个词一起开始”的高频情况:@@ -343,8 +391,9 @@ I just @pop! laughed my ass out.I laughed ~@pop! and left.```-`pop` 解析到 `laughed` 的收音。位于两个 Segment 之间时,左右候选是对应-方向上的共享结构切点。+`pop` 解析到 `laughed` 的收音。位于两个 Segment 之间时,左候选是前一+Segment 的 `end`,右候选是后一 Segment 的 `start`;两者可以同点,也可以因+overlap 或 gap 落在不同点。规范规则:@@ -359,10 +408,10 @@ I laughed ~@pop! and left.temporal syntax,不能退化为正文。- Moment 与 Selection marker 可出现在相同位置,包括 Segment 之间和Dual Text 的 speech 侧,但均不得切入 v1 speech token。-- Moment 只选择 Temporal Anchor Map 中已有的一个候选点,不新增 anchor- identity;因此 `2n + m + 1` 的精确计数不因 Moment 数量改变。-- MomentSet 与 SelectionSet 复用同一份 Estimate/Evidence Anchor Map 和- 一次性帧量化;区别只在最终载体是 `Point[]` 而不是 `Range[]`。+- Moment 只选择 Semantic Anchor Index 中已有的一个候选点,不新增 anchor+ identity;因此 `2M + 2N` 的精确计数不因 Moment 数量改变。+- MomentSet 与 SelectionSet 复用同一份 Estimated/Exact SemanticMap 和一次性+ 帧量化;区别只在最终载体是 `Point[]` 而不是 `Range[]`。消费端保持两个互不相混的类型:@@ -463,7 +512,7 @@ temporal marker、Role Cue 或结构标签内部。注释可出现在 atom 之解析结果至少保留:-- Segment 的顺序、id 和结构边界;+- Segment 的顺序、id 和独立 start/end identity;- 每个 Segment 的有序 spoken turn,以及各 turn 的可选 Role Cue;- plain / Dual Text / Slot atom 及其源码范围;- caption atom 到一个或多个 speech token 的显式映射;@@ -533,7 +582,7 @@ Caption 的多样式、region、cue segmentation、annotation、mute 和 layout一个实现只有同时满足以下证据,才能声明支持 Script Surface v1:-1. 冻结本文全部正例、反例、投影和 source-map golden fixtures;+1. 本文全部正例、反例、投影和 source-map golden fixtures;2. parser、formatter、Narrative IR 与三投影不依赖 provider 或渲染器;3. SelectionSet 支持闭合、交叉、非连通 occurrence 与左右 affinity;4. MomentSet 支持 `@id!` / `~@id!`、单/多 occurrence 与 `at` 类型闸;@@ -541,3 +590,6 @@ Caption 的多样式、region、cue segmentation、annotation、mute 和 layout6. Slot 采用 parse-first、literal-only binding,不能注入语法;7. 未知版本、未知保留语法、混合 temporal type 与 partial dual atom 全部fail closed。+8. `2M + 2N` identity 的规范序列化、digest、完整 Map 与相邻 Segment 双单调+ 约束都有 golden fixtures;硬切、overlap、gap、空 Segment 和端点重合均被+ 覆盖。