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
refactor: keep speech timing as author evidence
kashorin142a74e2d5a8
diff --git a/docs/quickstart/generation.md b/docs/quickstart/generation.mdindex 90c58025..9a5a1839 100644--- a/docs/quickstart/generation.md+++ b/docs/quickstart/generation.md@@ -55,7 +55,7 @@ A generated take's length is the author's decision, written as a literal on theit. Measure the line first, then write the number:```bash-hypit measure main.svml --segment hook --language en --pace normal --min 4 --max 15 --rounding round+hypit measure main.svml --segment hook --language en --pace normal --rounding round# 7s```@@ -67,7 +67,7 @@ hypit measure main.svml --segment hook --language en --pace normal --min 4 --max`hypit measure` counts pronunciation units of the Segment's speech at a delivery policy — `language`,`pace` (`slow = 4.2`, `normal = 4.6`, `fast = 5.0` syllables per second for English) or a numeric-`rate`, `min`, `max` and `rounding` — with no external call. Nothing in the graph computes a duration,+`rate` and `rounding` — with no external call. Nothing in the graph computes a duration,so `hypit plan` is complete before a Build starts. The same policy, written on`estimated:SemanticTake` or as an SVS Recipe it names (see[SVS Stylesheets](./styles.md#speech-estimation)), weights a Segment's words across preview media.@@ -187,9 +187,9 @@ installed Hypit Distribution from project source.Read the[`@hypit/seedance-kits` guide](https://github.com/hypit-ai/hypit/blob/main/packages/seedance-kits/README.md)and the [selected Kit source](https://github.com/hypit-ai/hypit/tree/main/packages/seedance-kits/kits)-before authoring. Use an official Kit whenever its format matches. Keep generation instructions and-dynamic prompt slots in English; preserve the authored language only for dialogue that must be-spoken verbatim. Write a freeform English prompt only when none of the seven Kits applies.+before choosing one. A Kit is useful when its shot assumptions and wording serve the intended+performance. You can also write prompt Text directly or author a project Kit. Choose the prompt+language for the selected model, keeping dialogue in the language it should be spoken.```svml<import as="text" from="@hypit/text@1"/>diff --git a/docs/quickstart/styles.md b/docs/quickstart/styles.mdindex 0a38d87f..308e8f8f 100644--- a/docs/quickstart/styles.md+++ b/docs/quickstart/styles.md@@ -246,8 +246,6 @@ Parameters for deterministic speech duration estimation.speech.normal {language: en;pace: normal;- min: 4;- max: 15;rounding: round;}```@@ -257,14 +255,12 @@ speech.normal {| `language` | Language code (e.g. `en`) || `pace` | Speaking pace: `slow`, `normal`, `fast` || `rate` | Positive pronunciation units per second; mutually exclusive with `pace` |-| `min` | Minimum duration in seconds |-| `max` | Maximum duration in seconds || `rounding` | Rounding mode: `none`, `round`, `ceil` |The English named presets resolve to `4.2`, `4.6`, and `5.0` syllables persecond. Use a numeric `rate` in place of `pace` when the project needs acontinuous author-controlled value.-Every property is explicit: `language`, `min`, `max`, `rounding`, and exactly+Every property is explicit: `language`, `rounding`, and exactlyone of `pace` or `rate` are required. The Estimate package supplies no hidden policy defaults.Referenced by `estimated:SemanticTake` via the `policy` attribute, and used by `hypit measure`@@ -404,8 +400,6 @@ A complete `recipes.svs` file for a four-take talking-head project:speech.normal {language: en;pace: normal;- min: 4;- max: 15;rounding: round;}diff --git a/docs/zh/quickstart/generation.md b/docs/zh/quickstart/generation.mdindex 1d608196..9a9ffc80 100644--- a/docs/zh/quickstart/generation.md+++ b/docs/zh/quickstart/generation.md@@ -53,7 +53,7 @@ description: 声明媒体资源并使用 Seedance 生成视频。生成片段的长度由作者决定,直接写在需要它的元素上。先量稿子,再写数字:```bash-hypit measure main.svml --segment hook --language en --pace normal --min 4 --max 15 --rounding round+hypit measure main.svml --segment hook --language en --pace normal --rounding round# 7s```@@ -63,7 +63,7 @@ hypit measure main.svml --segment hook --language en --pace normal --min 4 --max</seedance:ReferenceVideo>```-`hypit measure` 按口播策略——`language`、`pace`(英语 `slow = 4.2`、`normal = 4.6`、`fast = 5.0` 音节/秒)或数值 `rate`、`min`、`max`、`rounding`——统计 Segment 台词的读音单位,不调用任何外部服务。图里没有任何东西在计算时长,所以 `hypit plan` 在 Build 开始前就是完整的。同一套策略写在 `estimated:SemanticTake` 上或它引用的 SVS Recipe 里(参见 [SVS 样式表](./styles.md#speech-estimation)),用于把 Segment 的词按音节权重铺到预览媒体上。+`hypit measure` 按口播策略——`language`、`pace`(英语 `slow = 4.2`、`normal = 4.6`、`fast = 5.0` 音节/秒)或数值 `rate`、`rounding`——统计 Segment 台词的读音单位,不调用任何外部服务。图里没有任何东西在计算时长,所以 `hypit plan` 在 Build 开始前就是完整的。同一套策略写在 `estimated:SemanticTake` 上或它引用的 SVS Recipe 里(参见 [SVS 样式表](./styles.md#speech-estimation)),用于把 Segment 的词按音节权重铺到预览媒体上。## text:Value@@ -165,7 +165,7 @@ Endpoint,不会改变作者图。创作前阅读[`@hypit/seedance-kits` 指南](https://github.com/hypit-ai/hypit/blob/main/packages/seedance-kits/README.md)-和 [所选 Kit 源文件](https://github.com/hypit-ai/hypit/tree/main/packages/seedance-kits/kits)。格式匹配时优先使用官方 Kit。生成指令与动态 prompt slot 必须使用英语;只有需要逐字说出的对白保留作者原语言。七个 Kit 都不适用时,才编写自由格式的英语 prompt。+和 [所选 Kit 源文件](https://github.com/hypit-ai/hypit/tree/main/packages/seedance-kits/kits),判断它的镜头假设和措辞是否适合当前表演。也可以直接编写 prompt Text,或创作项目自己的 Kit。提示词语言按所选模型决定,对白使用实际需要说出的语言。```svml<import as="text" from="@hypit/text@1"/>diff --git a/docs/zh/quickstart/styles.md b/docs/zh/quickstart/styles.mdindex fcd4b99c..d94cff1e 100644--- a/docs/zh/quickstart/styles.md+++ b/docs/zh/quickstart/styles.md@@ -241,8 +241,6 @@ text.title {speech.normal {language: en;pace: normal;- min: 4;- max: 15;rounding: round;}```@@ -252,11 +250,9 @@ speech.normal {| `language` | 语言代码(如 `en`) || `pace` | 语速:`slow`、`normal`、`fast` || `rate` | 正数的每秒读音单位数;不能和 `pace` 同时使用 |-| `min` | 最小时长(秒) |-| `max` | 最大时长(秒) || `rounding` | 取整模式:`none`、`round`、`ceil` |-英语三个具名档位分别解析为每秒 `4.2`、`4.6`、`5.0` 个音节。项目需要连续可调值时,用数值 `rate` 代替 `pace`。所有属性都必须显式提供:`language`、`min`、`max`、`rounding`,并且在 `pace` 与+英语三个具名档位分别解析为每秒 `4.2`、`4.6`、`5.0` 个音节。项目需要连续可调值时,用数值 `rate` 代替 `pace`。所有属性都必须显式提供:`language`、`rounding`,并且在 `pace` 与`rate` 中恰好选择一个。Estimate 包不会补充隐藏策略默认值。通过 `estimated:SemanticTake` 的 `policy` 属性引用;作者写字面量时长之前用 `hypit measure` 量稿,用的也是同一套策略:@@ -379,8 +375,6 @@ Caption Recipe 不再重复家族、字重或字形。CJK 与 Emoji 即使由多speech.normal {language: en;pace: normal;- min: 4;- max: 15;rounding: round;}diff --git a/examples/interview/README.md b/examples/interview/README.mdindex b3ab6974..f8873a69 100644--- a/examples/interview/README.md+++ b/examples/interview/README.md@@ -29,9 +29,9 @@ photographic image prompt stands in for this purpose-made graphic artwork.```bashhypit check reference.svrun-hypit measure reference.svml --segment manifest-rule --language en --pace fast --min 4 --max 15 --rounding ceil-hypit measure reference.svml --segment real-estate-rule --language en --pace fast --min 4 --max 15 --rounding ceil-hypit measure reference.svml --segment bitcoin-rule --language en --pace fast --min 4 --max 15 --rounding ceil+hypit measure reference.svml --segment manifest-rule --language en --pace fast --rounding ceil+hypit measure reference.svml --segment real-estate-rule --language en --pace fast --rounding ceil+hypit measure reference.svml --segment bitcoin-rule --language en --pace fast --rounding ceilhypit plan reference.svrun --runtime ./hypit.runtime.json```diff --git a/examples/minimal-author-package/packages/example-component/preview/recipes.svs b/examples/minimal-author-package/packages/example-component/preview/recipes.svsindex 74d90f0f..4471c8a8 100644--- a/examples/minimal-author-package/packages/example-component/preview/recipes.svs+++ b/examples/minimal-author-package/packages/example-component/preview/recipes.svs@@ -3,6 +3,6 @@<sheet version="1">film.vertical { background: #09090B; }speech.visual { fit: cover; }- speech.normal { language: en; pace: normal; min: 4; max: 30; rounding: round; }+ speech.normal { language: en; pace: normal; rounding: round; }media.aroll { video: primary-moving; audio: default; span-authority: video; }</sheet>diff --git a/examples/podcast/README.md b/examples/podcast/README.mdindex e729c812..9c2b3f4d 100644--- a/examples/podcast/README.md+++ b/examples/podcast/README.md@@ -56,9 +56,9 @@ are generated; normalization, alignment, Caption and Film composition are explic```bashhypit check reference.svrun-hypit measure reference.svml --segment opening-question --language en --pace fast --min 4 --max 15 --rounding ceil-hypit measure reference.svml --segment daily-creatine --language en --pace fast --min 4 --max 15 --rounding ceil-hypit measure reference.svml --segment arms-are-asking --language en --pace fast --min 4 --max 15 --rounding ceil+hypit measure reference.svml --segment opening-question --language en --pace fast --rounding ceil+hypit measure reference.svml --segment daily-creatine --language en --pace fast --rounding ceil+hypit measure reference.svml --segment arms-are-asking --language en --pace fast --rounding ceilhypit plan reference.svrun --runtime ./hypit.runtime.json```diff --git a/examples/podcast/recipes.svs b/examples/podcast/recipes.svsindex 1fe7d17c..46079464 100644--- a/examples/podcast/recipes.svs+++ b/examples/podcast/recipes.svs@@ -66,8 +66,6 @@speech.preview {language: en;pace: normal;- min: 1;- max: 30;rounding: none;}diff --git a/examples/ranking-football/README.md b/examples/ranking-football/README.mdindex a2568d5c..af664623 100644--- a/examples/ranking-football/README.md+++ b/examples/ranking-football/README.md@@ -28,8 +28,8 @@ With a configured Runtime and installed Distribution, run from this directory:```bashhypit check reference.svrun-hypit measure reference.svml --segment ronaldo --language en --pace fast --min 4 --max 15 --rounding ceil-hypit measure reference.svml --segment messi --language en --pace fast --min 4 --max 15 --rounding ceil+hypit measure reference.svml --segment ronaldo --language en --pace fast --rounding ceil+hypit measure reference.svml --segment messi --language en --pace fast --rounding ceilhypit plan reference.svrun --runtime ./hypit.runtime.json```diff --git a/examples/ranking-football/reference-banana-from-swap/reference-banana-from-swap.svml b/examples/ranking-football/reference-banana-from-swap/reference-banana-from-swap.svmlindex 6147a7fa..0b18ade3 100644--- a/examples/ranking-football/reference-banana-from-swap/reference-banana-from-swap.svml+++ b/examples/ranking-football/reference-banana-from-swap/reference-banana-from-swap.svml@@ -209,10 +209,10 @@video="primary-moving" audio="none" span-authority="video" clock={clock}/><estimated:SemanticTake id="ronaldo-preview" narrative={story}segment={story.segment.ronaldo} media={ronaldo-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><estimated:SemanticTake id="messi-preview" narrative={story}segment={story.segment.messi} media={messi-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><speech:Track id="speech" visual-frame={speech-frame}visual-appearance={recipes.speech.visual} visual-z="0">diff --git a/examples/ranking-football/reference-banana/reference-banana.svml b/examples/ranking-football/reference-banana/reference-banana.svmlindex 6147a7fa..0b18ade3 100644--- a/examples/ranking-football/reference-banana/reference-banana.svml+++ b/examples/ranking-football/reference-banana/reference-banana.svml@@ -209,10 +209,10 @@video="primary-moving" audio="none" span-authority="video" clock={clock}/><estimated:SemanticTake id="ronaldo-preview" narrative={story}segment={story.segment.ronaldo} media={ronaldo-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><estimated:SemanticTake id="messi-preview" narrative={story}segment={story.segment.messi} media={messi-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><speech:Track id="speech" visual-frame={speech-frame}visual-appearance={recipes.speech.visual} visual-z="0">diff --git a/examples/ranking-football/reference-gpt.svml b/examples/ranking-football/reference-gpt.svmlindex eff17186..21a6cd1a 100644--- a/examples/ranking-football/reference-gpt.svml+++ b/examples/ranking-football/reference-gpt.svml@@ -211,10 +211,10 @@video="primary-moving" audio="none" span-authority="video" clock={clock}/><estimated:SemanticTake id="ronaldo-preview" narrative={story}segment={story.segment.ronaldo} media={ronaldo-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><estimated:SemanticTake id="messi-preview" narrative={story}segment={story.segment.messi} media={messi-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><speech:Track id="speech" visual-frame={speech-frame}visual-appearance={recipes.speech.visual} visual-z="0">diff --git a/examples/ranking-football/swap-effect-banana-reference-sync/swap-effect-banana-reference-sync.svml b/examples/ranking-football/swap-effect-banana-reference-sync/swap-effect-banana-reference-sync.svmlindex 257eace9..1abc65a9 100644--- a/examples/ranking-football/swap-effect-banana-reference-sync/swap-effect-banana-reference-sync.svml+++ b/examples/ranking-football/swap-effect-banana-reference-sync/swap-effect-banana-reference-sync.svml@@ -209,10 +209,10 @@video="primary-moving" audio="none" span-authority="video" clock={clock}/><estimated:SemanticTake id="ronaldo-preview" narrative={story}segment={story.segment.ronaldo} media={ronaldo-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><estimated:SemanticTake id="messi-preview" narrative={story}segment={story.segment.messi} media={messi-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><speech:Track id="speech" visual-frame={speech-frame}visual-appearance={recipes.speech.visual} visual-z="0">diff --git a/examples/ranking-football/swap-effect-banana/swap-effect-banana.svml b/examples/ranking-football/swap-effect-banana/swap-effect-banana.svmlindex 31bfec03..f08d4dd5 100644--- a/examples/ranking-football/swap-effect-banana/swap-effect-banana.svml+++ b/examples/ranking-football/swap-effect-banana/swap-effect-banana.svml@@ -188,10 +188,10 @@video="primary-moving" audio="none" span-authority="video" clock={clock}/><estimated:SemanticTake id="messi-preview" narrative={story}segment={story.segment.messi} media={messi-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><estimated:SemanticTake id="ronaldo-preview" narrative={story}segment={story.segment.ronaldo} media={ronaldo-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><speech:Track id="speech" visual-frame={speech-frame}visual-appearance={recipes.speech.visual} visual-z="0">diff --git a/examples/ranking-football/swap-effect.svml b/examples/ranking-football/swap-effect.svmlindex 360d1605..f68420cf 100644--- a/examples/ranking-football/swap-effect.svml+++ b/examples/ranking-football/swap-effect.svml@@ -188,10 +188,10 @@video="primary-moving" audio="none" span-authority="video" clock={clock}/><estimated:SemanticTake id="messi-preview" narrative={story}segment={story.segment.messi} media={messi-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><estimated:SemanticTake id="ronaldo-preview" narrative={story}segment={story.segment.ronaldo} media={ronaldo-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><speech:Track id="speech" visual-frame={speech-frame}visual-appearance={recipes.speech.visual} visual-z="0">diff --git a/examples/ranking-football/swap-host.svml b/examples/ranking-football/swap-host.svmlindex 8f8b7013..834e4663 100644--- a/examples/ranking-football/swap-host.svml+++ b/examples/ranking-football/swap-host.svml@@ -209,10 +209,10 @@video="primary-moving" audio="none" span-authority="video" clock={clock}/><estimated:SemanticTake id="ronaldo-preview" narrative={story}segment={story.segment.ronaldo} media={ronaldo-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><estimated:SemanticTake id="messi-preview" narrative={story}segment={story.segment.messi} media={messi-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><speech:Track id="speech" visual-frame={speech-frame}visual-appearance={recipes.speech.visual} visual-z="0">diff --git a/examples/ranking-football/swap-topic.svml b/examples/ranking-football/swap-topic.svmlindex e446a650..0bfa0a36 100644--- a/examples/ranking-football/swap-topic.svml+++ b/examples/ranking-football/swap-topic.svml@@ -231,10 +231,10 @@video="primary-moving" audio="none" span-authority="video" clock={clock}/><estimated:SemanticTake id="elon-preview" narrative={story}segment={story.segment.elon} media={elon-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><estimated:SemanticTake id="sam-preview" narrative={story}segment={story.segment.sam} media={sam-preview-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/><speech:Track id="speech" visual-frame={speech-frame}visual-appearance={recipes.speech.visual} visual-z="0">diff --git a/packages/estimate/README.md b/packages/estimate/README.mdindex 20ed2697..13b4d840 100644--- a/packages/estimate/README.md+++ b/packages/estimate/README.md@@ -6,20 +6,24 @@ A duration is the author's decision, written as a literal on the element that ne`<seedance:TextVideo … duration="8"/>`, `<media:StillVideo … duration="6"/>`. This package is how theauthor arrives at that number before writing it. It counts pronunciation units of a Text with alanguage-aware delivery density (English dictionary words use CMUdict; unknown words use a-deterministic spelling fallback), then applies explicit bounds and rounding. The Text remains+deterministic spelling fallback), then applies optional padding and the selected rounding. The Text remainsauthoritative: the estimator never invents how numbers, names or acronyms are pronounced.```bash-hypit measure main.svml --segment opening --language en --pace normal --min 4 --max 15 --rounding round-hypit measure --text "Video editing begins with meaning." --language en --pace normal+hypit measure main.svml --segment opening --language en --pace normal+hypit measure --text "Video editing begins with meaning." --language en --pace normal --rounding ceil```The English pace presets are `slow = 4.2`, `normal = 4.6` and `fast = 5.0` syllables per second; apositive numeric `rate` replaces `pace`. `round` selects the nearest whole second, `ceil` anever-shorter one, `none` keeps the fraction.+The estimate reports the time the wording needs at that delivery. Use it to decide whether a passage+needs merging, fuller wording, tightening, or splitting, then choose the request duration with the+selected model's supported values in mind.+The one graph value this package declares is `SpeechEstimatePolicy`: the same language, pace or rate,-bounds and rounding, written as attributes or an SVS Recipe on `<estimated:SemanticTake>`, which+rounding and optional padding, written as attributes or an SVS Recipe on `<estimated:SemanticTake>`, whichweights a Segment's Tokens across preview media by pronunciation units. Nothing here runs inside aBuild; a Build plan is complete before it starts because every duration is already a literal.diff --git a/packages/estimate/src/manifest.ts b/packages/estimate/src/manifest.tsindex 530b25e2..814e9122 100644--- a/packages/estimate/src/manifest.ts+++ b/packages/estimate/src/manifest.ts@@ -18,8 +18,6 @@ export const speechEstimatePolicySchema: ValueSchema = {language: { schema: { kind: "string", enum: ["auto", "en", "zh", "ja", "es"] } },pace: { schema: { kind: "string", enum: ["slow", "normal", "fast"] }, optional: true },rate: { schema: { kind: "number", minimum: 0.000001 }, optional: true },- minimumSec: { schema: number },- maximumSec: { schema: number },rounding: { schema: { kind: "string", enum: ["none", "round", "ceil"] } },paddingSec: { schema: number, optional: true },},diff --git a/packages/estimate/src/policy.ts b/packages/estimate/src/policy.tsindex f9e887f1..1c2e57ed 100644--- a/packages/estimate/src/policy.ts+++ b/packages/estimate/src/policy.ts@@ -8,7 +8,7 @@ import type {SpeechEstimateRounding,} from "./types.js";-const POLICY_PROPERTIES = ["language", "pace", "rate", "min", "max", "rounding", "padding"] as const;+const POLICY_PROPERTIES = ["language", "pace", "rate", "rounding", "padding"] as const;/** The property names an estimate policy is written with, in an SVS Recipe or as element attributes. */export const speechEstimatePolicyProperties: readonly string[] = POLICY_PROPERTIES;@@ -20,7 +20,7 @@ function policyFrom(const allowed = new Set<string>(POLICY_PROPERTIES);const unknown = Object.keys(properties).filter((name) => !allowed.has(name));if (unknown.length > 0) throw new Error(`${subject} contains unknown property ${unknown[0]}`);- const missing = ["language", "min", "max", "rounding"].filter((name) => properties[name] === undefined);+ const missing = ["language", "rounding"].filter((name) => properties[name] === undefined);if (missing.length > 0) throw new Error(`${subject} requires ${missing.join(", ")}`);const string = (name: string): string => {const value = properties[name];@@ -44,8 +44,6 @@ function policyFrom(}const common = {language: string("language") as SpeechEstimateLanguage,- minimumSec: finite("min"),- maximumSec: finite("max"),rounding: string("rounding") as SpeechEstimateRounding,...(properties.padding !== undefined ? { paddingSec: finite("padding") } : {}),} as const;diff --git a/packages/estimate/src/program.ts b/packages/estimate/src/program.tsindex 36019e6d..3bb3ed5e 100644--- a/packages/estimate/src/program.ts+++ b/packages/estimate/src/program.ts@@ -143,11 +143,6 @@ export function assertSpeechEstimatePolicy(value: SpeechEstimatePolicy): void {|| (hasPace && !(["slow", "normal", "fast"] as const).includes(value.pace))|| (hasRate && (!Number.isFinite(value.rate) || value.rate <= 0))|| !(["none", "round", "ceil"] as const).includes(value.rounding)- || !Number.isFinite(value.minimumSec)- || value.minimumSec < 0- || !Number.isFinite(value.maximumSec)- || value.maximumSec <= 0- || value.minimumSec > value.maximumSec|| (value.paddingSec !== undefined && (!Number.isFinite(value.paddingSec) || value.paddingSec < 0))) {throw new Error("SpeechEstimatePolicy is invalid");@@ -186,8 +181,8 @@ export function estimateSpeechDuration(const units = countSpeechEstimateUnits(text.value, language);if (units < 1) throw new Error("Speech Text contains no countable speech units");const raw = units / resolveSpeechEstimateRate(policy, language) + (policy.paddingSec ?? 0);- const firstClamp = Math.min(policy.maximumSec, Math.max(policy.minimumSec, raw));- const durationSec = Math.min(policy.maximumSec, Math.max(policy.minimumSec, rounded(firstClamp, policy.rounding)));+ const durationSec = rounded(raw, policy.rounding);+ if (durationSec === 0) throw new Error("Speech estimate rounds to zero seconds; use rounding none or ceil.");const duration = sealSpeechDuration(durationSec);assertSpeechDurationIdentity(duration);return duration;diff --git a/packages/estimate/src/types.ts b/packages/estimate/src/types.tsindex 8b4e69a5..60333973 100644--- a/packages/estimate/src/types.ts+++ b/packages/estimate/src/types.ts@@ -5,8 +5,6 @@ export type SpeechEstimateRounding = "none" | "round" | "ceil";type SpeechEstimatePolicyBase = {readonly language: SpeechEstimateLanguage;- readonly minimumSec: number;- readonly maximumSec: number;readonly rounding: SpeechEstimateRounding;readonly paddingSec?: number;};diff --git a/packages/estimate/test/estimate.test.ts b/packages/estimate/test/estimate.test.tsindex a40083cb..8a8f887b 100644--- a/packages/estimate/test/estimate.test.ts+++ b/packages/estimate/test/estimate.test.ts@@ -13,8 +13,6 @@ import {const normal = sealSpeechEstimatePolicy({language: "en",pace: "normal",- minimumSec: 4,- maximumSec: 15,rounding: "round",});@@ -41,8 +39,6 @@ test("English pace presets occupy adjacent integer durations", () => {sealSpeechEstimatePolicy({language: normal.language,pace,- minimumSec: normal.minimumSec,- maximumSec: normal.maximumSec,rounding: normal.rounding,}),);@@ -54,20 +50,16 @@ test("a numeric rate gives SVS a continuous author-controlled pace", () => {const result = estimateSpeechDuration(source, sealSpeechEstimatePolicy({language: normal.language,rate: 4.75,- minimumSec: normal.minimumSec,- maximumSec: normal.maximumSec,rounding: normal.rounding,}));assert.equal(result, 10);});-test("optional padding extends speech before bounds and rounding", () => {+test("optional padding extends speech before rounding", () => {const source = sealText(Array.from({ length: 23 }, () => "day").join(" "));const policy = sealSpeechEstimatePolicy({language: "en",pace: "normal",- minimumSec: 1,- maximumSec: 30,rounding: "none",paddingSec: 1,});@@ -78,8 +70,6 @@ test("optional padding extends speech before bounds and rounding", () => {properties: {language: "en",pace: "normal",- min: 1,- max: 30,rounding: "none",padding: 1,},@@ -90,22 +80,27 @@ test("optional padding extends speech before bounds and rounding", () => {test("a policy written as attributes reads the same values a Recipe would", () => {const policy = speechEstimatePolicyFromAttributes(- { language: "en", rate: "4.75", min: "4", max: "15", rounding: "round" },+ { language: "en", rate: "4.75", rounding: "round" },"estimated:SemanticTake",);assert.equal(policy.rate, 4.75);- assert.equal(policy.maximumSec, 15);assert.throws(- () => speechEstimatePolicyFromAttributes({ language: "en", pace: "normal", rate: "4.75", min: "4", max: "15", rounding: "round" }, "x"),+ () => speechEstimatePolicyFromAttributes({ language: "en", pace: "normal", rate: "4.75", rounding: "round" }, "x"),/exactly one/u,);- assert.throws(() => speechEstimatePolicyFromAttributes({ rate: "4.75" }, "x"), /requires language, min, max, rounding/u);+ assert.throws(() => speechEstimatePolicyFromAttributes({ rate: "4.75" }, "x"), /requires language, rounding/u);});-test("the minimum applies before rounding and the maximum applies after rounding", () => {- assert.equal(estimateSpeechDuration(sealText("Hello."), normal), 4);- const bounded = sealSpeechEstimatePolicy({ ...normal, maximumSec: 4.5 });- assert.equal(estimateSpeechDuration(sealText("This sentence intentionally contains far more spoken syllables than the selected model duration allows."), bounded), 4.5);+test("short and long passages retain their estimated duration", () => {+ const exact = sealSpeechEstimatePolicy({ ...normal, rounding: "none" });+ assert.equal(estimateSpeechDuration(sealText("Hello."), exact), 2 / 4.6);+ const long = sealText(Array.from({ length: 460 }, () => "day").join(" "));+ assert.equal(estimateSpeechDuration(long, normal), 100);+});++test("rounding a short passage to zero reports how to retain a positive duration", () => {+ assert.throws(() => estimateSpeechDuration(sealText("Hello."), normal), /rounds to zero.*none or ceil/u);+ assert.equal(estimateSpeechDuration(sealText("Hello."), { ...normal, rounding: "ceil" }), 1);});test("an SVS Recipe configures one reusable estimate policy without becoming executable", () => {@@ -114,14 +109,11 @@ test("an SVS Recipe configures one reusable estimate policy without becoming exeproperties: {language: "en",rate: 4.75,- min: 4,- max: 15,rounding: "round",},});assert.equal(policy.language, "en");assert.equal(policy.rate, 4.75);- assert.equal(policy.maximumSec, 15);assert.throws(() => speechEstimatePolicyFromRecipe({path: "speech.ambiguous",properties: { pace: "normal", rate: 4.6 },diff --git a/packages/semantic-take-estimate/README.md b/packages/semantic-take-estimate/README.mdindex 0829802b..faad4958 100644--- a/packages/semantic-take-estimate/README.md+++ b/packages/semantic-take-estimate/README.md@@ -19,7 +19,7 @@ leaving a fixed-length estimate at the beginning.```svml<estimated:SemanticTake id="opening-estimated" narrative={story}segment={story.segment.opening} media={opening-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>+ language="en" pace="normal" rounding="round"/>```The delivery policy is the element's own: write it inline as above, or name an SVS Recipe with@@ -54,7 +54,7 @@ The package also registers `@hypit/semantic-take-estimate@1#semantic-take` as a| `policy` | `@hypit/estimate@1#SpeechEstimatePolicy` |Its export is `take`, an ordinary SemanticTake. The policy is a typed value with `language`,-`pace` or `rate`, `minimumSec`, `maximumSec`, `rounding` and optional `paddingSec`.+`pace` or `rate`, `rounding` and optional `paddingSec`.The Author Surface publishes its authored policy as `<id>.policy`. For an Author entry containingthe `opening-estimated` declaration above, a Run can use:diff --git a/packages/semantic-take-estimate/src/manifest.ts b/packages/semantic-take-estimate/src/manifest.tsindex c0bc1d20..d73642f5 100644--- a/packages/semantic-take-estimate/src/manifest.ts+++ b/packages/semantic-take-estimate/src/manifest.ts@@ -29,14 +29,12 @@ export const semanticTakeEstimateMarkupSurfaces = [{{ name: "media", kind: "reference", required: true, accepts: [mediaTypes.synchronized],summary: "Selects the already normalized SynchronizedMedia whose exact frame domain receives the estimate." },{ name: "policy", kind: "reference", required: false, accepts: [svsRecipeType],- summary: "Selects an SVS Recipe carrying the delivery policy (language, pace or rate, min, max, rounding), in place of the inline attributes.",+ summary: "Selects an SVS Recipe carrying the delivery policy (language, pace or rate, rounding), in place of the inline attributes.",recipe: [{ name: "language", required: true, summary: "Selects the counting rules the Segment is read with, or detects them.", values: ["auto", "en", "zh", "ja", "es"] },{ name: "pace", required: false, summary: "Selects a named delivery density.", values: ["slow", "normal", "fast"] },{ name: "rate", required: false, summary: "Sets the delivery density in pronunciation units per second, in place of pace." },- { name: "min", required: true, summary: "Sets the shortest duration in seconds the estimate may assume." },- { name: "max", required: true, summary: "Sets the longest duration in seconds the estimate may assume." },- { name: "rounding", required: true, summary: "Selects how a bounded duration is rounded.", values: ["none", "round", "ceil"] },+ { name: "rounding", required: true, summary: "Selects how an estimated duration is rounded.", values: ["none", "round", "ceil"] },] },{ name: "language", kind: "literal", required: false, values: ["auto", "en", "zh", "ja", "es"],summary: "Selects the counting rules the Segment is read with, or detects them from its Text." },@@ -44,12 +42,8 @@ export const semanticTakeEstimateMarkupSurfaces = [{summary: "Selects a named delivery density for the chosen language." },{ name: "rate", kind: "literal", required: false,summary: "Sets the delivery density in pronunciation units per second, in place of pace." },- { name: "min", kind: "literal", required: false,- summary: "Sets the shortest duration in seconds the estimate may assume." },- { name: "max", kind: "literal", required: false,- summary: "Sets the longest duration in seconds the estimate may assume." },{ name: "rounding", kind: "literal", required: false, values: ["none", "round", "ceil"],- summary: "Selects how a bounded duration is rounded." },+ summary: "Selects how an estimated duration is rounded." },],ports: [{ name: "take", type: speechTypes.semanticTake,@@ -59,7 +53,7 @@ export const semanticTakeEstimateMarkupSurfaces = [{],example: `<estimated:SemanticTake id="opening-estimated" narrative={story}segment={story.segment.opening} media={opening-media.media}- language="en" pace="normal" min="4" max="15" rounding="round"/>`,+ language="en" pace="normal" rounding="round"/>`,notes: ["The policy is the element's own: write it inline or name an SVS Recipe with policy; never both.","This package does not measure audio and never claims WhisperX or other acoustic evidence.",diff --git a/packages/semantic-take-estimate/test/semantic-take-estimate.test.ts b/packages/semantic-take-estimate/test/semantic-take-estimate.test.tsindex 9151bdc2..431385b3 100644--- a/packages/semantic-take-estimate/test/semantic-take-estimate.test.ts+++ b/packages/semantic-take-estimate/test/semantic-take-estimate.test.ts@@ -54,8 +54,6 @@ const media = sealSynchronizedMedia({const policy = sealSpeechEstimatePolicy({language: "en",pace: "normal",- minimumSec: 1,- maximumSec: 30,rounding: "none",});diff --git a/packages/video-cli/README.md b/packages/video-cli/README.mdindex 2f1be95e..e5faf8bb 100644--- a/packages/video-cli/README.md+++ b/packages/video-cli/README.md@@ -39,7 +39,7 @@ file the caller chose:```bashhypit observe <media…> --instruction <text|file> --prompt <text|file> --to notes/frame.mdhypit transcribe reference.mp4 --to notes/reference.transcript.json [--language en|zh|es]-hypit measure main.svml --segment hook --language en --pace normal --min 4 --max 15 --rounding round+hypit measure main.svml --segment hook --language en --pace normal --rounding round````observe` uses the Profile's Gemini Endpoint and `transcribe` its `whisperx-alignment` Endpoint (afterdiff --git a/packages/video-cli/src/creation.ts b/packages/video-cli/src/creation.tsindex eef1d448..2f7f91d8 100644--- a/packages/video-cli/src/creation.ts+++ b/packages/video-cli/src/creation.ts@@ -440,10 +440,10 @@ async function segmentSpeech(source: string, segment: string, projectRoot: strin/*** Measure a script before writing a duration: pronunciation units of the words, at the delivery- * policy the author chooses, bounded and rounded the way the author chooses. Pure local work.+ * policy and rounding the author chooses. Pure local work.*/async function measure(argv: readonly string[], io: CliIo, environment: CreationEnvironment): Promise<void> {- const parsed = parseArguments(argv, ["--text", "--segment", "--language", "--pace", "--rate", "--min", "--max", "--rounding", "--padding", "--workspace"]);+ const parsed = parseArguments(argv, ["--text", "--segment", "--language", "--pace", "--rate", "--rounding", "--padding", "--workspace"]);const inlineText = parsed.options.get("--text");const segment = parsed.options.get("--segment");assert((inlineText === undefined) !== (parsed.positionals.length === 0 && segment === undefined) || (inlineText !== undefined && parsed.positionals.length === 0),@@ -470,8 +470,6 @@ async function measure(argv: readonly string[], io: CliIo, environment: Creationconst policy = speechEstimatePolicyFromAttributes({language: parsed.options.get("--language") ?? "auto",...(rate === undefined ? { pace: pace ?? "normal" } : { rate }),- min: parsed.options.get("--min") ?? "1",- max: parsed.options.get("--max") ?? "60",rounding: parsed.options.get("--rounding") ?? "none",...(parsed.options.get("--padding") === undefined ? {} : { padding: parsed.options.get("--padding") }),}, "hypit measure");@@ -489,10 +487,9 @@ async function measure(argv: readonly string[], io: CliIo, environment: Creation};if (parsed.json) { io.write(`${JSON.stringify(view, null, 2)}\n`); return; }const delivery = policy.rate === undefined ? `${policy.pace} pace` : `${policy.rate} units/s`;- const bounds = `min ${policy.minimumSec}, max ${policy.maximumSec}, ${policy.rounding}`;- io.write(`${seconds}s\n\n ${units} pronunciation units · ${language} · ${delivery} · ${bounds}\n`+ io.write(`${seconds}s\n\n ${units} pronunciation units · ${language} · ${delivery} · rounding ${policy.rounding}\n`+ ` ${"segment" in where ? `${where.segment} in ${where.source}` : `${text.length} characters`}\n`- + ` Write it as the literal, e.g. duration="${Number.isInteger(seconds) ? seconds : Math.ceil(seconds)}"; a model wants whole seconds inside its range.\n`);+ + " Choose the request duration from this estimate, the intended performance, and the selected model's supported values.\n");}// ---------------------------------------------------------------------------------------------------@@ -523,12 +520,12 @@ export function writeCreationHelp(io: CliIo, topic?: CreationCommand): void {"Measure a script before writing a duration. Pure local work; no Runtime Profile, no request.",""," hypit measure <source.svml> --segment <id> [--language auto|en|zh|ja|es] [--pace slow|normal|fast | --rate <units/s>]",- " [--min <s>] [--max <s>] [--rounding none|round|ceil] [--padding <s>]",+ " [--rounding none|round|ceil] [--padding <s>]"," [--workspace <project>]"," hypit measure --text <text|file> [same options]","",- "Prints the seconds the words take at that delivery, so the author writes them as the literal",- "duration on the Seedance take or StillVideo that carries the line.",+ "Prints the estimated seconds at that delivery. Use them to shape the passage and choose a",+ "literal duration for the intended performance and selected model.",],};const chosen = topic === undefined ? creationCommands : [topic];diff --git a/packages/video-cli/test/creation.test.ts b/packages/video-cli/test/creation.test.tsindex 8b6764a0..7e853861 100644--- a/packages/video-cli/test/creation.test.ts+++ b/packages/video-cli/test/creation.test.ts@@ -124,7 +124,7 @@ test("measure prints the seconds a line takes so the author can write the literaconst out = capture();await runCreationCli(["measure", "--text", "Video editing begins with meaning, not a pile of clips on a timeline.",- "--language", "en", "--pace", "normal", "--min", "4", "--max", "15", "--rounding", "round", "--json",+ "--language", "en", "--pace", "normal", "--rounding", "round", "--json",], out.io, noHost);const view = JSON.parse(out.text()) as { readonly seconds: number; readonly units: number; readonly language: string };assert.equal(view.units, 20);@@ -134,7 +134,13 @@ test("measure prints the seconds a line takes so the author can write the literaconst human = capture();await runCreationCli(["measure", "--text", "hello world"], human.io, noHost);assert.match(human.text(), /^\d+(\.\d+)?s\n/u);- assert.match(human.text(), /duration="/u);+ assert.match(human.text(), /Choose the request duration/u);++ for (const [text, seconds] of [["Hello.", 2 / 4.6], [Array.from({ length: 460 }, () => "day").join(" "), 100]] as const) {+ const measured = capture();+ await runCreationCli(["measure", "--text", text, "--language", "en", "--rounding", "none", "--json"], measured.io, noHost);+ assert.ok(Math.abs(JSON.parse(measured.text()).seconds - seconds) < 1e-9);+ }await assert.rejects(runCreationCli(["measure"], capture().io, noHost), /--text|--segment/u);} finally {