@xiaohhhh1/canvas-agent 0.4.83 → 0.4.84

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.
@@ -2,7 +2,8 @@ export declare const FLOW_C_CONTENT_STRATEGY_VERSION = "flow-c-content-strategy-
2
2
  export declare const FLOW_C_GENERATED_MONTAGE_VERSION = "flow-c-generated-montage-v1";
3
3
  export declare const FLOW_C_GENERATED_MONTAGE_STYLE = "generated-montage";
4
4
  export declare const FLOW_C_GENERATED_MONTAGE_VERSION_UNSUPPORTED = "FLOW_C_GENERATED_MONTAGE_VERSION_UNSUPPORTED";
5
- export declare const FLOW_C_VOICE_PACING_REPAIR_MIN_WORDS_PER_SECOND = 3;
5
+ export declare const FLOW_C_VOICE_PACING_QUICK_WORDS_PER_SECOND = 3;
6
+ export declare const FLOW_C_VOICE_PACING_REPAIR_MIN_WORDS_PER_SECOND = 4;
6
7
  export declare const FLOW_C_VOICE_PACING_REPAIR_MIN_EXCESS_WORDS = 3;
7
8
  export type FlowCContentStrategy = {
8
9
  contractVersion: typeof FLOW_C_CONTENT_STRATEGY_VERSION;
@@ -42,6 +43,7 @@ export type FlowCContentAdvisory = {
42
43
  };
43
44
  export type FlowCVoicePacingRepairIssue = Required<Pick<FlowCContentAdvisory, "ordinal" | "segment" | "shot" | "wordCount" | "suggestedMaxWords" | "durationSeconds">> & {
44
45
  code: "voice_pacing";
46
+ endShot?: number;
45
47
  };
46
48
  /** Explicit styles are capability-versioned; an unknown pair must never silently fall back. */
47
49
  export declare function flowCGeneratedMontage(value: unknown): boolean;
@@ -66,7 +68,8 @@ export declare function flowCContentAdvisories(jobs: unknown, strategy: FlowCCon
66
68
  /**
67
69
  * A deliberately narrower pre-delivery repair trigger than the public pacing
68
70
  * advisory. It only covers explicit English/Spanish text that is both very fast
69
- * and materially over the normal two-words-per-second writing budget.
71
+ * and materially over a quick three-words-per-second writing budget. Normal
72
+ * quick speech remains advisory, and visual cuts never become speech deadlines.
70
73
  */
71
74
  export declare function flowCVoicePacingRepairIssues(jobs: unknown, options?: {
72
75
  targetLanguage?: unknown;
@@ -2,7 +2,9 @@ export const FLOW_C_CONTENT_STRATEGY_VERSION = "flow-c-content-strategy-v1";
2
2
  export const FLOW_C_GENERATED_MONTAGE_VERSION = "flow-c-generated-montage-v1";
3
3
  export const FLOW_C_GENERATED_MONTAGE_STYLE = "generated-montage";
4
4
  export const FLOW_C_GENERATED_MONTAGE_VERSION_UNSUPPORTED = "FLOW_C_GENERATED_MONTAGE_VERSION_UNSUPPORTED";
5
- export const FLOW_C_VOICE_PACING_REPAIR_MIN_WORDS_PER_SECOND = 3;
5
+ // Editorial estimates, not a certification of spoken-audio intelligibility.
6
+ export const FLOW_C_VOICE_PACING_QUICK_WORDS_PER_SECOND = 3;
7
+ export const FLOW_C_VOICE_PACING_REPAIR_MIN_WORDS_PER_SECOND = 4;
6
8
  export const FLOW_C_VOICE_PACING_REPAIR_MIN_EXCESS_WORDS = 3;
7
9
  function object(value) {
8
10
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -29,6 +31,31 @@ function voicePacingMeasurement(value, durationSeconds, targetLanguage) {
29
31
  const wordCount = (voice.match(/[\p{L}\p{N}]+(?:['’][\p{L}\p{N}]+)*/gu) || []).length;
30
32
  return { wordCount, suggestedMaxWords: Math.floor(seconds * 2), durationSeconds: seconds };
31
33
  }
34
+ /** A camera cut does not end narration; only pool adjacent explicitly voiced shots. */
35
+ function continuousVoicePacingRuns(shots, targetLanguage) {
36
+ const runs = [];
37
+ let previousEnd = Number.NaN;
38
+ for (const [index, shot] of shots.entries()) {
39
+ const start = Number(shot.startSeconds);
40
+ const end = Number(shot.endSeconds);
41
+ const pacing = voicePacingMeasurement(shot.voiceover, end - start, targetLanguage);
42
+ if (!pacing) {
43
+ previousEnd = Number.NaN;
44
+ continue;
45
+ }
46
+ const current = runs.at(-1);
47
+ if (current && Number.isFinite(start) && Math.abs(start - previousEnd) < 0.001) {
48
+ current.endShot = index + 1;
49
+ current.wordCount += pacing.wordCount;
50
+ current.durationSeconds += pacing.durationSeconds;
51
+ }
52
+ else {
53
+ runs.push({ shot: index + 1, endShot: index + 1, wordCount: pacing.wordCount, durationSeconds: pacing.durationSeconds });
54
+ }
55
+ previousEnd = end;
56
+ }
57
+ return runs;
58
+ }
32
59
  /** Explicit styles are capability-versioned; an unknown pair must never silently fall back. */
33
60
  export function flowCGeneratedMontage(value) {
34
61
  const input = object(value);
@@ -51,7 +78,7 @@ export function flowCContentWritingReviewPrompt(strategy, options) {
51
78
  return `同回合按“框架 → 可见因果 → 当地口播 → 逐句对照”完成创作与自审,不增加模型调用或输出字段:
52
79
  - 框架:creativeBrief 与用户框架 ordinal ${JSON.stringify(frameworkOrdinals)} 优先;保留其角色、开头、事件顺序、核心情节、锁定对白和结尾,只补留白,不为追求差异改掉已经合适的创意。
53
80
  - 可见因果:先把一个有商品事实或参考图依据的动作、镜头内可见结果和核心购买理由连起来;evidence 只描述同镜真正看见的依据,不把生成表演冒充实测,也不从“有动作+有结果”自动推断未经提供的因果。
54
- - 当地口播:只按显式 targetLanguage/targetLocale、creatorVoiceStyle 与 ctaStyle 写自然口语语序和常用短句,不从国家推断语言、族群或口音,不逐字翻译、不生造俚语。用户锁定对白即使偏密或证据不足也不得静默删除、换义或改写;先给承载锁定对白的镜头足够秒数,必要时合并相邻同动作镜头、压缩无声过渡,再安排其它非锁定台词,绝不能把锁定对白塞进过短镜头或用加速掩盖。锁定对白已经占用可说完的时长时,其余可选口播默认 none;未解决处保留给非阻断提示。
81
+ - 当地口播:只按显式 targetLanguage/targetLocale、creatorVoiceStyle 与 ctaStyle 写自然口语语序和常用短句,不从国家推断语言、族群或口音,不逐字翻译、不生造俚语。用户锁定对白即使偏密或证据不足也不得静默删除、换义或改写;先给承载锁定对白的镜头足够秒数,必要时合并相邻同动作镜头、压缩无声过渡,再安排其它非锁定台词。允许偶尔偏密和适度加快语速,只要吐字清楚、符合画面、不夸张赶话;一句话可在同段相邻有声镜头间连续说完。锁定对白已经占用可说完的时长时,其余可选口播默认 none;未解决处保留给非阻断提示。
55
82
  - 逐句对照:逐镜核对每个非 none 的 voiceover 片段与该镜 visual/evidence 及已知商品事实;商品事实句必须有同镜可见依据,处境、情绪或 CTA 不必伪装成产品证明但必须符合正在发生的画面。最后核对末镜实际动作、visual 末尾收尾短句与 endingState.endingFrame 精确同锚点;这里只做结构性自审,不声称靠词面规则完成语义验收。`;
56
83
  }
57
84
  /** Rules for the separately selected generated-montage content style. */
@@ -64,7 +91,7 @@ export function flowCGeneratedMontagePrompt(ordinals, segmentSeconds = 10) {
64
91
  - 围绕一个由当前商品事实支持的核心购买理由,选择抓眼但真实可执行的使用、细节、多个适用画面或可见结果镜头;每次切镜带来新的有用观察,不做无关美图轮播,也不强制编痛点剧情、完整人物故事或为了差异放弃好创意。
65
92
  - 跨镜、跨全片的人物、服装和场景一致性不是目标或验收门槛;用户框架明确指定角色/场景时仍严格尊重。每个单镜动作须自然,若一个动作明确跨相邻镜继续则保持该动作的手部、商品与物理状态连续;人物或地点变化时在下一 shot.visual 明写 HARD CUT,切后可直接进入新示例,但所有镜头的 SKU、颜色、结构、材质、数量、包装和表面文字图案始终不变。
66
93
  - 仍是每个局部 0–${segmentSeconds} 秒、1–8 个 shots。${longDurationLabel}后一段 openingState 精确继承上一段 endingState 只是技术开场交接;紧接着可以明写 HARD CUT 进入新人物或新场景,不要求让上一段人物/场景贯穿下一段,也不得为连续剧情浪费本段秒数。
67
- - 一句自然口播可以跨镜延续,但每镜 voiceover 只保存该镜实际说出的完整词组/分句;按该镜真实时长留呼吸,不能把整句塞进一秒镜头再借后续静默时长冲抵。每个 ${segmentSeconds} 秒段都以自然完整的句法边界收尾,不把半个词、未完短语或待补 CTA 留给另一次模型调用。
94
+ - 一句自然口播可以跨镜延续,但每镜 voiceover 只保存该镜实际说出的完整词组/分句;镜头切换不强制口播停顿,相邻有声镜头按连续口播整体留呼吸,允许偶尔偏密和适度加快语速。明确标为 none 的镜头保留静默,不把整句塞进一秒镜头再假定后续静默仍在说话。每个 ${segmentSeconds} 秒段都以自然完整的句法边界收尾,不把半个词、未完短语或待补 CTA 留给另一次模型调用。
68
95
  - 这些规则只改变当前已选脚本的内容表达;不新增候选或模型阶段,不改严格输出 schema、首帧/分镜媒体依赖、收费、队列、重试或归档。`;
69
96
  }
70
97
  /** Missing/unknown versions keep historical tasks on their exact original prompt. */
@@ -171,7 +198,8 @@ export function flowCContentAdvisories(jobs, strategy, options = {}) {
171
198
  /**
172
199
  * A deliberately narrower pre-delivery repair trigger than the public pacing
173
200
  * advisory. It only covers explicit English/Spanish text that is both very fast
174
- * and materially over the normal two-words-per-second writing budget.
201
+ * and materially over a quick three-words-per-second writing budget. Normal
202
+ * quick speech remains advisory, and visual cuts never become speech deadlines.
175
203
  */
176
204
  export function flowCVoicePacingRepairIssues(jobs, options = {}) {
177
205
  if (!Array.isArray(jobs))
@@ -184,11 +212,11 @@ export function flowCVoicePacingRepairIssues(jobs, options = {}) {
184
212
  const segments = Array.isArray(job.segments) ? job.segments : job.segment ? [job.segment] : [];
185
213
  for (const [segmentIndex, segmentValue] of segments.entries()) {
186
214
  const shots = Array.isArray(object(segmentValue).shots) ? object(segmentValue).shots.map(object) : [];
187
- for (const [shotIndex, shot] of shots.entries()) {
188
- const pacing = voicePacingMeasurement(shot.voiceover, Number(shot.endSeconds) - Number(shot.startSeconds), options.targetLanguage);
189
- if (!pacing || pacing.wordCount / pacing.durationSeconds < FLOW_C_VOICE_PACING_REPAIR_MIN_WORDS_PER_SECOND || pacing.wordCount - pacing.suggestedMaxWords < FLOW_C_VOICE_PACING_REPAIR_MIN_EXCESS_WORDS)
215
+ for (const run of continuousVoicePacingRuns(shots, options.targetLanguage)) {
216
+ const suggestedMaxWords = Math.floor(run.durationSeconds * FLOW_C_VOICE_PACING_QUICK_WORDS_PER_SECOND);
217
+ if (run.wordCount / run.durationSeconds <= FLOW_C_VOICE_PACING_REPAIR_MIN_WORDS_PER_SECOND || run.wordCount - suggestedMaxWords < FLOW_C_VOICE_PACING_REPAIR_MIN_EXCESS_WORDS)
190
218
  continue;
191
- issues.push({ ordinal: Number(job.ordinal), code: "voice_pacing", segment: segmentIndex + 1, shot: shotIndex + 1, ...pacing });
219
+ issues.push({ ordinal: Number(job.ordinal), code: "voice_pacing", segment: segmentIndex + 1, ...run, suggestedMaxWords });
192
220
  }
193
221
  }
194
222
  }
@@ -238,10 +266,10 @@ export function flowCVoicePacingRepairPrompt(jobs, options = {}) {
238
266
  const frameworkOrdinals = [...new Set((Array.isArray(options.frameworkOrdinals) ? options.frameworkOrdinals : []).map(Number).filter((ordinal) => issueOrdinals.includes(ordinal)))];
239
267
  const segmentSeconds = options.segmentSeconds === 15 ? 15 : 10;
240
268
  const payload = values.filter((value) => issueOrdinals.includes(Number(object(value).ordinal))).map(flowCVoicePacingRepairScaffold);
241
- return `这是 Flow C 首次回传前唯一一次、仅针对 ordinal ${JSON.stringify(issueOrdinals)} 的短镜口播定向修复。目标口播语言保持为 ${text(options.targetLanguage, 160) || "原稿的显式目标语言"}。只返回下方完整 strict jobs,不调用工具、不创建媒体、不输出分析或新增字段。
269
+ return `这是 Flow C 首次回传前唯一一次、仅针对 ordinal ${JSON.stringify(issueOrdinals)} 的极端过密口播定向修复。普通偏密与适度快语速只作提示,无需修复。目标口播语言保持为 ${text(options.targetLanguage, 160) || "原稿的显式目标语言"}。只返回下方完整 strict jobs,不调用工具、不创建媒体、不输出分析或新增字段。
242
270
  - 只允许修改每个 shot.voiceover;逐字复制其它所有字段,包括 ordinal/productIndex/sellingFormId、voiceProfile、openingState、segment/segments 数量、voiceCue、shots 数量和顺序、startSeconds/endSeconds、visual、onScreenText、evidence、soundBgm、emotionalNote 与 endingState。不得改画面、时轴、商品、事实、用户框架、所选结构、分段承接或末帧。
243
- - 保留原口播的核心购买理由、画面对应事实、语气、CTA 意图和目标语言。先把模型自行增加的赘词压成能自然说完的短句,再按完整词组或自然分句重分配到展示相关动作的镜头;不得截断单词、留下未完句、提高语速或把超载片段简单改成 none。若一个原本有口播的局部 ${segmentSeconds} 秒段修后完全静默,视为失败。
244
- - 英语/西语逐镜以约 2 词/秒为写作目标并留呼吸;当前硬修复命中位置:${JSON.stringify(issues.map(({ ordinal, segment, shot, wordCount, suggestedMaxWords, durationSeconds }) => ({ ordinal, segment, shot, wordCount, suggestedMaxWords, durationSeconds })))}。不能用同段其它静默镜头抵消当前短镜超载。
271
+ - 保留原口播的核心购买理由、画面对应事实、语气、CTA 意图和目标语言。先把模型自行增加的赘词压成能自然说完的短句,再按完整词组或自然分句重分配到展示相关动作的镜头;允许适度快语速但必须清晰,不能夸张赶话、截断单词、留下未完句或把超载片段简单改成 none。若一个原本有口播的局部 ${segmentSeconds} 秒段修后完全静默,视为失败。
272
+ - 英语/西语以约 2–3 词/秒作为自然到轻快表达的参考,不是固定配额;连续有声镜头整体超过 4 词/秒且明显超出轻快预算才进入此次修复。当前命中范围(shot 至 endShot):${JSON.stringify(issues.map(({ ordinal, segment, shot, endShot, wordCount, suggestedMaxWords, durationSeconds }) => ({ ordinal, segment, shot, endShot, wordCount, suggestedMaxWords, durationSeconds })))}。镜头切换不强制口播停顿;允许同段相邻有声镜头之间自然延续,不能把明确静默镜头或下一独立段的时长计入口播预算。
245
273
  - 用户逐字框架 ordinal ${JSON.stringify(frameworkOrdinals)}:所有原口播文字与顺序必须保持,不能删、换词或压缩,只能在同一局部 ${segmentSeconds} 秒段内按完整自然短语重新分配到语义相关、时长足够的镜头;无法容纳就原样返回,让 Agent 明确交给人工处理。
246
274
  - 其它 ordinal 可以压缩模型自增措辞,但不能通过删除整段口播来消除告警。每个 ${segmentSeconds} 秒段仍须在自然句法边界收尾,segmentVoiceovers 与渲染 script 将由 Agent 从最终逐镜 voiceover 确定性重建。
247
275
  待修复的已校验原稿:${JSON.stringify({ jobs: payload })}`;
@@ -260,9 +288,7 @@ export function flowCContentMethodPrompt(strategy, options) {
260
288
  const ordinaryOrdinals = options.ordinals.filter((ordinal) => !montageOrdinals.includes(ordinal));
261
289
  const segmentSeconds = options.segmentSeconds === 15 ? 15 : 10;
262
290
  const longDurationLabel = segmentSeconds === 15 ? "30秒双段" : "20/30秒";
263
- const segmentPacingRule = segmentSeconds === 15
264
- ? "整段15秒按自然语速留足动作与呼吸,可以更少,不是最低字数要求"
265
- : "整段10秒约12–20词只是起点,可以更少,不是最低字数要求";
291
+ const segmentPacingRule = `整段${segmentSeconds}秒按自然或轻快语速留足动作与呼吸,可以更少,不是最低字数要求`;
266
292
  const scenarioRule = montageOrdinals.length
267
293
  ? `1. 本条“先明确谁在生活节点遇到麻烦/需求”的剧情组织只适用于其余普通脚本 ordinal ${JSON.stringify(ordinaryOrdinals)};原创混剪 ordinal ${JSON.stringify(montageOrdinals)} 不强制痛点、麻烦、待解决问题或人物反转,可以从商品事实支持的好结果、真实使用动作或可见细节直接开场。普通脚本再选择地点里的动作坐标与必要可见物件;两类都用现有 shot.visual 写出具体微场景,不用“某人在家里”或泛气氛替代。人物是普通创作者/情景角色;真实身份、经历、用户证言、专家或权威背书只能来自明确提供的事实。缺非关键创意细节时用保守日常设定软适配,不追问、不拒绝、不编新事实。`
268
294
  : "1. 先明确谁在什么生活节点遇到什么具体麻烦/需求,再选择地点里的动作坐标与必要可见物件;用现有 shot.visual 写出微场景,不用“某人在家里”或泛气氛替代。人物是普通创作者/情景角色;真实身份、经历、用户证言、专家或权威背书只能来自明确提供的事实。缺非关键创意细节时用保守日常设定软适配,不追问、不拒绝、不编新事实。";
@@ -275,7 +301,7 @@ ${writingReview}
275
301
  ${scenarioRule}
276
302
  ${openingRule}
277
303
  3. 分开检查叙事段落逻辑、每镜目的与口播呼吸节奏:段落负责铺垫/证明/收束,镜头负责展示动作与证据,一句口播不必切一镜、一镜也不必念完一段。保留选中蓝图的因果顺序、节拍与镜头能量;仍为每段局部0–${segmentSeconds}秒、1–8镜,${longDurationLabel}连续关系和三种媒体共同内容契约不变。
278
- 4. 自检上方已定稿的目标语言的自然短句,不再按镜头补新台词。逐镜按实际时长 endSeconds − startSeconds 检查,先为关键动作/可见结果留静默与呼吸。仅英语、西语等通常按空格分词的语言,以写作起点粗估约2词/秒,动作/结果镜头更少:1.5秒约2–3词,不塞完整8词问句;2秒约3–4词,不塞10词CTA;2.6秒约4–5词,不塞13词整句。${segmentPacingRule};全段词数够少也不能把口播挤在一两个短镜头,不能借其它静默镜头的时长冲抵当前镜头超载。若用户锁定对白需要更多时间,先延长承载它的镜头并压缩无声过渡或合并相邻同动作镜头;不得改写锁定词,也不得先把它塞进短镜头再用后续静默冲抵。锁定对白分配妥当后才可加入其它口播,剩余时长不足就让其它镜头保持 none。不能套用到中文、日语等其它语言,不套统一英语词数或固定八秒模板。这是同轮软预算,不是语言验收拒绝条件或新重写环节;只在用户锁定内容之外收窄意图、缩短句子,不得提高语速硬塞。voiceProfile.speakingRate/pauseHabit 与 voiceCue 要符合实际可说完的语速,不得标成 unhurried/慢速却塞满台词,也不能用 brisk 掩盖超载;emotionalNote 只写镜头目的/情绪转折。不输出计算、推理或预算报告。
304
+ 4. 自检上方已定稿的目标语言的自然短句,不再按镜头补新台词。逐镜按实际时长 endSeconds − startSeconds 检查,先为关键动作/可见结果留静默与呼吸;镜头切换不强制口播停顿,相邻有声镜头可连续说完一句。仅英语、西语等通常按空格分词的语言,约2–3词/秒是自然到轻快表达的写作参考,允许偶尔偏密和适度加快语速,只要清楚、符合画面、没有夸张赶话。${segmentPacingRule}。不要只因为某个短镜的词数较高而重写或打断整批;只对连续有声范围仍超过4词/秒且明显超量的极端情况收窄模型自增赘句。明确标为 none 的镜头和下一独立段不能计入口播时长。若用户锁定对白需要更多时间,先延长承载它的镜头并压缩无声过渡或合并相邻同动作镜头;不得改写锁定词。锁定对白分配妥当后才可加入其它口播,剩余时长不足就让其它镜头保持 none。不能套用到中文、日语等其它语言,不套统一英语词数或固定八秒模板。这是同轮软预算,不是语言验收拒绝条件或新重写环节;口播与画面脚本在同一次返回中完成。voiceProfile.speakingRate/pauseHabit 与 voiceCue 要如实写明 natural brisk-but-clear 等实际语速,不得标成 unhurried/慢速却塞满台词;emotionalNote 只写镜头目的/情绪转折。不输出计算、推理或预算报告。
279
305
  5. contentDirection 只细化既有蓝图可替换的人物、微场景、措辞和执行槽位,不改变商品身份、纹理文字、能力证据、0–${segmentSeconds}秒分段或媒体制作方式。creativeBrief 始终最高优先;用户框架 ordinal ${JSON.stringify(options.frameworkOrdinals)} 的开头、事件顺序、核心剧情和结尾不可被方向卡/避重覆盖,只能在其留白处具体化。
280
306
  返回前按以上内容要求自检,修正能在本次写作中修正的空泛描述。自检不是新验收闸门;只输出原严格 schema 的既有字段,不输出推理、自检报告、contentDirection 或其它新增字段。\n`;
281
307
  }
@@ -12,7 +12,7 @@ export declare const FLOW_C_VOICE_PACING_REVIEW_REQUIRED = "FLOW_C_VOICE_PACING_
12
12
  export declare const FLOW_C_LEGACY_DIRECT_CONTRACT_VERSION = "flow-c-template-direct-v2";
13
13
  export declare const FLOW_C_PRODUCT_PROFILE_DIRECT_CONTRACT_VERSION = "flow-c-product-profile-direct-v1";
14
14
  export declare const FLOW_C_CREATIVE_SOURCE_DIRECT_CONTRACT_VERSION = "flow-c-creative-source-direct-v1";
15
- type ScriptStatus = "queued" | "running" | "complete" | "error" | "expired";
15
+ type ScriptStatus = "queued" | "running" | "complete" | "review" | "error" | "expired";
16
16
  type DownloadStatus = "waiting" | "running" | "complete" | "error" | "expired";
17
17
  type ScriptRecord = {
18
18
  id: string;
@@ -36,6 +36,12 @@ type ScriptRecord = {
36
36
  candidateRevision: string;
37
37
  attempts: number;
38
38
  }>;
39
+ /** Only these failed revisions are excluded from automatic waves; clean siblings keep running. */
40
+ voicePacingReviewHolds?: Array<{
41
+ ordinal: number;
42
+ candidateRevision: string;
43
+ reason: string;
44
+ }>;
39
45
  contentStrategy?: FlowCContentStrategy;
40
46
  contentSummaries?: FlowCContentSummary[];
41
47
  contentAdvisories?: FlowCContentAdvisory[];
@@ -228,6 +234,8 @@ export declare class WorkflowManager {
228
234
  status: ScriptStatus;
229
235
  requestedCount: number;
230
236
  received: number;
237
+ reviewOrdinals: number[];
238
+ reviewCount: number;
231
239
  threadId: string | undefined;
232
240
  chunkSize: number | null;
233
241
  activeChunks: number;
@@ -245,6 +253,8 @@ export declare class WorkflowManager {
245
253
  status: ScriptStatus;
246
254
  requestedCount: number;
247
255
  received: number;
256
+ reviewOrdinals: number[];
257
+ reviewCount: number;
248
258
  threadId: string | undefined;
249
259
  chunkSize: number | null;
250
260
  activeChunks: number;
@@ -262,6 +272,8 @@ export declare class WorkflowManager {
262
272
  status: ScriptStatus;
263
273
  requestedCount: number;
264
274
  received: number;
275
+ reviewOrdinals: number[];
276
+ reviewCount: number;
265
277
  threadId: string | undefined;
266
278
  chunkSize: number | null;
267
279
  activeChunks: number;
@@ -409,6 +421,7 @@ export declare class WorkflowManager {
409
421
  * restart or response loss can never replay an overcrowded draft as accepted.
410
422
  */
411
423
  private repairVoicePacingJobs;
424
+ private holdVoicePacingReview;
412
425
  private runVoicePacingRepairTurn;
413
426
  /** Nonblocking, text-free diagnostics for newly generated policy scripts only. */
414
427
  private noteScriptContentAdvisories;
@@ -447,7 +460,7 @@ export declare function terminalScriptChunkFailure<T extends {
447
460
  terminal?: boolean;
448
461
  terminalKind?: ScriptChunkResult["terminalKind"];
449
462
  affectedOrdinals?: number[];
450
- }>(results: T[], receivedOrdinals?: number[]): T | undefined;
463
+ }>(results: T[], receivedOrdinals?: number[]): T;
451
464
  export declare function scriptCreativeReplanOrdinals(results: unknown[]): number[];
452
465
  /** Keep a mixed reset signal after an exact-duplicate rewrite finishes. */
453
466
  export declare function preserveScriptRecoveryReplans(result: ScriptChunkResult, error: unknown): ScriptChunkResult;
@@ -81,6 +81,7 @@ export class WorkflowManager {
81
81
  pendingScriptJobs: previous?.pendingScriptJobs || [],
82
82
  ...(previous?.voicePacingReviewJobs ? { voicePacingReviewJobs: previous.voicePacingReviewJobs } : {}),
83
83
  ...(previous?.voicePacingRepairAttempts ? { voicePacingRepairAttempts: previous.voicePacingRepairAttempts } : {}),
84
+ ...(previous?.voicePacingReviewHolds ? { voicePacingReviewHolds: previous.voicePacingReviewHolds } : {}),
84
85
  ...(previous?.contentAdvisories ? { contentAdvisories: previous.contentAdvisories } : {}),
85
86
  lastFailure: previous?.lastFailure,
86
87
  priorityAt: now(),
@@ -142,6 +143,7 @@ export class WorkflowManager {
142
143
  if (!record.voicePacingReviewJobs.length)
143
144
  delete record.voicePacingReviewJobs;
144
145
  pruneVoicePacingRepairAttempts(record);
146
+ reconcileVoicePacingReviewHolds(record, task);
145
147
  record.expiresAt = task.expires_at;
146
148
  record.updatedAt = now();
147
149
  this.save();
@@ -177,6 +179,7 @@ export class WorkflowManager {
177
179
  if (!record.voicePacingReviewJobs.length)
178
180
  delete record.voicePacingReviewJobs;
179
181
  pruneVoicePacingRepairAttempts(record);
182
+ reconcileVoicePacingReviewHolds(record);
180
183
  record.status = data.status === "ready" ? "complete" : "running";
181
184
  record.message = data.status === "ready"
182
185
  ? flowCContentStrategy(record.contentStrategy) ? `全部 ${record.requestedCount} 条脚本已回传(内容语义仍需审阅)` : `全部 ${record.requestedCount} 条高质量脚本已回传`
@@ -222,7 +225,7 @@ export class WorkflowManager {
222
225
  activeScripts: workers.active,
223
226
  scriptConcurrencyLimit: workers.limit,
224
227
  queuedScripts: records.filter((record) => record.status === "queued" || record.status === "running").length,
225
- blockedScripts: records.filter((record) => record.status === "error").length,
228
+ blockedScripts: records.filter((record) => record.status === "error" || record.status === "review").length,
226
229
  };
227
230
  }
228
231
  startDownloadDirectorySelection() {
@@ -353,10 +356,14 @@ export class WorkflowManager {
353
356
  const creativeReplanAttempts = new Map();
354
357
  while (record.receivedOrdinals.length < task.requested_count) {
355
358
  task = await this.scriptTask(id);
359
+ const settledOrdinals = [...record.receivedOrdinals, ...voicePacingHeldOrdinals(record)];
360
+ if (!missingOrdinals(task.requested_count, settledOrdinals).length)
361
+ break;
356
362
  const selectedBefore = selectedCandidateOrdinals(task);
357
- const wave = nextScriptPipelineWave(task, record.receivedOrdinals, durationSeconds, chunkSizes[chunkSizeIndex], candidateChunkSize);
363
+ const wave = nextScriptPipelineWave(task, settledOrdinals, durationSeconds, chunkSizes[chunkSizeIndex], candidateChunkSize);
358
364
  if (wave.stage === "candidate") {
359
365
  const receivedBefore = record.receivedOrdinals.length;
366
+ const heldBefore = voicePacingHeldOrdinals(record).length;
360
367
  record.message = `本机 Codex 正在选择下一小批创意(${selectedBefore.length}/${task.requested_count});选好后立即写对应脚本`;
361
368
  record.activeChunks = 0;
362
369
  record.updatedAt = now();
@@ -375,10 +382,8 @@ export class WorkflowManager {
375
382
  }));
376
383
  const results = pipelineResults.flat();
377
384
  task = await this.scriptTask(id);
378
- const terminalFailure = terminalScriptChunkFailure(results, this.scriptRecord(id).receivedOrdinals);
385
+ const terminalFailure = terminalScriptChunkFailure(results.filter((result) => result.terminalKind !== "review"), this.scriptRecord(id).receivedOrdinals);
379
386
  if (terminalFailure) {
380
- if (terminalFailure.terminalKind === "review")
381
- throw new Error(terminalFailure.error);
382
387
  if (terminalFailure.terminalKind === "delivery")
383
388
  throw new Error(terminalFailure.error);
384
389
  if (terminalFailure.terminalKind === "transport")
@@ -408,7 +413,7 @@ export class WorkflowManager {
408
413
  }
409
414
  if (record.receivedOrdinals.length > receivedBefore)
410
415
  chunkSizeIndex = 0;
411
- if (selectedCandidateOrdinals(task).length > selectedBefore.length) {
416
+ if (selectedCandidateOrdinals(task).length > selectedBefore.length || voicePacingHeldOrdinals(record).length > heldBefore) {
412
417
  candidateChunkSize = 2;
413
418
  continue;
414
419
  }
@@ -420,6 +425,7 @@ export class WorkflowManager {
420
425
  throw new Error(`创意候选阶段已隔离到单条仍失败(${lastError}),请点击重试`);
421
426
  }
422
427
  const before = record.receivedOrdinals.length;
428
+ const heldBefore = voicePacingHeldOrdinals(record).length;
423
429
  const chunkSize = chunkSizes[chunkSizeIndex];
424
430
  record.chunkSize = chunkSize;
425
431
  record.attempts += wave.chunks.length;
@@ -428,10 +434,8 @@ export class WorkflowManager {
428
434
  this.save();
429
435
  const results = await Promise.all(wave.chunks.map((ordinals) => this.runScriptChunk(id, task, ordinals, workspace.workspacePath)));
430
436
  task = await this.scriptTask(id);
431
- const terminalFailure = terminalScriptChunkFailure(results, this.scriptRecord(id).receivedOrdinals);
437
+ const terminalFailure = terminalScriptChunkFailure(results.filter((result) => result.terminalKind !== "review"), this.scriptRecord(id).receivedOrdinals);
432
438
  if (terminalFailure) {
433
- if (terminalFailure.terminalKind === "review")
434
- throw new Error(terminalFailure.error);
435
439
  if (terminalFailure.terminalKind === "delivery")
436
440
  throw new Error(terminalFailure.error);
437
441
  if (terminalFailure.terminalKind === "transport")
@@ -459,7 +463,7 @@ export class WorkflowManager {
459
463
  chunkSizeIndex = 0;
460
464
  continue;
461
465
  }
462
- const progressed = record.receivedOrdinals.length > before;
466
+ const progressed = record.receivedOrdinals.length > before || voicePacingHeldOrdinals(record).length > heldBefore;
463
467
  if (progressed) {
464
468
  chunkSizeIndex = 0;
465
469
  continue;
@@ -479,6 +483,10 @@ export class WorkflowManager {
479
483
  record.status = "complete";
480
484
  record.message = flowCContentStrategy(task.creative_strategy) ? `全部 ${task.requested_count} 条脚本已回传(内容语义仍需审阅)` : `全部 ${task.requested_count} 条高质量脚本已回传`;
481
485
  }
486
+ else if (voicePacingHeldOrdinals(record).length && !missingOrdinals(task.requested_count, [...record.receivedOrdinals, ...voicePacingHeldOrdinals(record)]).length) {
487
+ record.status = "review";
488
+ record.message = `已回传 ${record.receivedOrdinals.length}/${task.requested_count} 条;第 ${voicePacingHeldOrdinals(record).join("、")} 条口播仍明显超出可用时长,已单独保留待调整,其余脚本已处理完成。手动重试只处理这些未回传稿,已回传稿保持不变`;
489
+ }
482
490
  else
483
491
  throw new Error(`中心校验尚未通过(${record.receivedOrdinals.length}/${task.requested_count} 条),请点击重试`);
484
492
  }
@@ -663,6 +671,16 @@ export class WorkflowManager {
663
671
  const candidate = selectedForRecovery.get(job.ordinal);
664
672
  return String(job.expectedCandidateRevision || "") === String(candidate?.candidateRevision || "");
665
673
  });
674
+ // A newer pacing policy may accept an untouched old draft. Deliver
675
+ // that exact draft rather than regenerating its script or speech.
676
+ const acceptedStoredReview = storedReview.filter((job) => !flowCVoicePacingRepairIssues([job], { targetLanguage }).length);
677
+ if (acceptedStoredReview.length) {
678
+ this.noteScriptContentAdvisories(id, task, acceptedStoredReview);
679
+ await this.submitGeneratedScriptJobs(id, acceptedStoredReview);
680
+ ordinals = ordinals.filter((ordinal) => !this.scriptRecord(id).receivedOrdinals.includes(ordinal));
681
+ if (!ordinals.length)
682
+ return { terminal: false };
683
+ }
666
684
  const repairableStoredReview = storedReview.filter((job) => flowCVoicePacingRepairIssues([job], { targetLanguage }).length > 0);
667
685
  if (repairableStoredReview.length) {
668
686
  const reviewResult = await this.repairVoicePacingJobs(id, task, repairableStoredReview, cwd);
@@ -842,7 +860,7 @@ export class WorkflowManager {
842
860
  const eligible = current.filter((job) => voicePacingRepairAttemptCount(record, job) < FLOW_C_VOICE_PACING_REPAIR_MAX_ATTEMPTS);
843
861
  const exhausted = current.filter((job) => !eligible.includes(job));
844
862
  if (!eligible.length)
845
- return voicePacingReviewFailure(exhausted.map((job) => job.ordinal), "本机已记录本次自动修复机会,后台恢复不会再次调用模型");
863
+ return this.holdVoicePacingReview(id, exhausted.map((job) => job.ordinal), "本机已记录本次自动修复机会,后台恢复不会再次调用模型");
846
864
  const localization = compactTaskLocalization(task);
847
865
  const targetLanguage = localization.targetLanguage || task.target_language || localization.targetLocale;
848
866
  const selected = selectedCandidatesForOrdinals(task, eligible.map((job) => job.ordinal));
@@ -863,23 +881,23 @@ export class WorkflowManager {
863
881
  catch (error) {
864
882
  const received = this.scriptRecord(id).receivedOrdinals;
865
883
  const missing = [...exhausted.map((job) => job.ordinal), ...ordinals].filter((ordinal) => !received.includes(ordinal));
866
- return missing.length ? voicePacingReviewFailure(missing, error instanceof Error ? error.message : "口播修复回合异常") : { terminal: false };
884
+ return missing.length ? this.holdVoicePacingReview(id, missing, error instanceof Error ? error.message : "口播修复回合异常") : { terminal: false };
867
885
  }
868
886
  this.emitScriptStage(id, ordinals, "voice_repair", result.timings.queueWaitMs + result.timings.threadStartMs + result.timings.modelMs);
869
887
  const missingAfterTurn = [...exhausted.map((job) => job.ordinal), ...ordinals].filter((ordinal) => !this.scriptRecord(id).receivedOrdinals.includes(ordinal));
870
888
  if (!missingAfterTurn.length)
871
889
  return { terminal: false };
872
890
  if (!result.ok)
873
- return voicePacingReviewFailure(missingAfterTurn, result.error || "Codex 未返回口播修复稿");
891
+ return this.holdVoicePacingReview(id, missingAfterTurn, result.error || "Codex 未返回口播修复稿");
874
892
  if (!result.text)
875
- return voicePacingReviewFailure(missingAfterTurn, "Codex 未返回口播修复稿");
893
+ return this.holdVoicePacingReview(id, missingAfterTurn, "Codex 未返回口播修复稿");
876
894
  let candidates;
877
895
  try {
878
896
  candidates = parseFlowCScriptOutput(result.text, ordinals, segmentSeconds);
879
897
  }
880
898
  catch (error) {
881
899
  const missing = missingAfterTurn.filter((ordinal) => !this.scriptRecord(id).receivedOrdinals.includes(ordinal));
882
- return missing.length ? voicePacingReviewFailure(missing, error instanceof Error ? error.message : "口播修复稿未通过结构校验") : { terminal: false };
900
+ return missing.length ? this.holdVoicePacingReview(id, missing, error instanceof Error ? error.message : "口播修复稿未通过结构校验") : { terminal: false };
883
901
  }
884
902
  const byOrdinal = new Map(candidates.map((job) => [job.ordinal, job]));
885
903
  const accepted = [];
@@ -894,7 +912,7 @@ export class WorkflowManager {
894
912
  const repaired = applyFlowCVoicePacingRepair(original, candidate, frameworkOrdinals.includes(original.ordinal), segmentSeconds);
895
913
  const remaining = flowCVoicePacingRepairIssues([repaired], { targetLanguage });
896
914
  if (remaining.length) {
897
- failed.set(original.ordinal, `仍有 ${remaining.length} 个明显过密短镜`);
915
+ failed.set(original.ordinal, `仍有 ${remaining.length} 处极端过密口播`);
898
916
  continue;
899
917
  }
900
918
  accepted.push(repaired);
@@ -903,6 +921,10 @@ export class WorkflowManager {
903
921
  failed.set(original.ordinal, error instanceof Error ? error.message : "修复稿改变了受保护字段");
904
922
  }
905
923
  }
924
+ // Persist failed siblings before any repaired sibling's POST. A lost
925
+ // response must retain both the exact deliverable and isolated reviews.
926
+ if (failed.size)
927
+ this.holdVoicePacingReview(id, [...failed.keys()], [...failed.entries()].map(([ordinal, reason]) => `ordinal ${ordinal}: ${reason}`).join(";"));
906
928
  const stillMissing = accepted.filter((job) => !this.scriptRecord(id).receivedOrdinals.includes(job.ordinal));
907
929
  if (stillMissing.length) {
908
930
  this.noteScriptContentAdvisories(id, task, stillMissing);
@@ -911,9 +933,25 @@ export class WorkflowManager {
911
933
  for (const ordinal of this.scriptRecord(id).receivedOrdinals)
912
934
  failed.delete(ordinal);
913
935
  if (failed.size)
914
- return voicePacingReviewFailure([...failed.keys()], [...failed.entries()].map(([ordinal, reason]) => `ordinal ${ordinal}: ${reason}`).join(";"));
936
+ return this.holdVoicePacingReview(id, [...failed.keys()], [...failed.entries()].map(([ordinal, reason]) => `ordinal ${ordinal}: ${reason}`).join(";"));
915
937
  return { terminal: false };
916
938
  }
939
+ holdVoicePacingReview(id, ordinals, reason) {
940
+ const record = this.scriptRecord(id);
941
+ const missing = ordinals.filter((ordinal) => !record.receivedOrdinals.includes(ordinal));
942
+ if (!missing.length)
943
+ return { terminal: false };
944
+ const holds = new Map((record.voicePacingReviewHolds || []).map((hold) => [hold.ordinal, hold]));
945
+ for (const job of record.voicePacingReviewJobs || []) {
946
+ if (missing.includes(job.ordinal))
947
+ holds.set(job.ordinal, { ordinal: job.ordinal, candidateRevision: voicePacingCandidateRevision(job), reason });
948
+ }
949
+ record.voicePacingReviewHolds = [...holds.values()].sort((left, right) => left.ordinal - right.ordinal);
950
+ record.message = `第 ${missing.join("、")} 条口播需单独调整,已保留原稿;继续处理其余脚本(已回传 ${record.receivedOrdinals.length}/${record.requestedCount} 条)`;
951
+ record.updatedAt = now();
952
+ this.save();
953
+ return voicePacingReviewFailure(missing, reason);
954
+ }
917
955
  runVoicePacingRepairTurn(id, prompt, cwd, durationSeconds, count, segmentSeconds) {
918
956
  return runCodexWorkflowTurn(prompt, this.emit, {
919
957
  cwd,
@@ -1141,6 +1179,30 @@ function pruneVoicePacingRepairAttempts(record) {
1141
1179
  }
1142
1180
  function resetVoicePacingRepairAttempts(record) {
1143
1181
  delete record.voicePacingRepairAttempts;
1182
+ delete record.voicePacingReviewHolds;
1183
+ }
1184
+ function voicePacingHeldOrdinals(record) {
1185
+ return [...new Set((record.voicePacingReviewHolds || []).map((hold) => hold.ordinal).filter((ordinal) => !record.receivedOrdinals.includes(ordinal)))].sort((left, right) => left - right);
1186
+ }
1187
+ /** ACK and exact pending delivery always win; holds belong to one candidate revision. */
1188
+ function reconcileVoicePacingReviewHolds(record, task) {
1189
+ if (!record.voicePacingReviewHolds)
1190
+ return;
1191
+ const selected = task ? selectedCandidatesForOrdinals(task, record.voicePacingReviewHolds.map((hold) => hold.ordinal)) : undefined;
1192
+ const localization = task ? compactTaskLocalization(task) : undefined;
1193
+ const targetLanguage = localization?.targetLanguage || task?.target_language || localization?.targetLocale;
1194
+ record.voicePacingReviewHolds = record.voicePacingReviewHolds.filter((hold) => {
1195
+ if (record.receivedOrdinals.includes(hold.ordinal) || record.pendingScriptJobs?.some((job) => job.ordinal === hold.ordinal))
1196
+ return false;
1197
+ const original = record.voicePacingReviewJobs?.find((job) => job.ordinal === hold.ordinal && voicePacingCandidateRevision(job) === hold.candidateRevision);
1198
+ if (!original)
1199
+ return false;
1200
+ if (selected && String(selected.get(hold.ordinal)?.candidateRevision || "") !== hold.candidateRevision)
1201
+ return false;
1202
+ return !task || flowCVoicePacingRepairIssues([original], { targetLanguage }).length > 0;
1203
+ });
1204
+ if (!record.voicePacingReviewHolds.length)
1205
+ delete record.voicePacingReviewHolds;
1144
1206
  }
1145
1207
  function pacingSegments(value) {
1146
1208
  const job = pacingObject(value);
@@ -1224,7 +1286,7 @@ export function applyFlowCVoicePacingRepair(originalValue, candidateValue, prese
1224
1286
  function voicePacingReviewFailure(ordinals, reason) {
1225
1287
  const scoped = [...new Set(ordinals.map(Number).filter((ordinal) => Number.isInteger(ordinal) && ordinal > 0))].sort((left, right) => left - right);
1226
1288
  return {
1227
- error: `${FLOW_C_VOICE_PACING_REVIEW_REQUIRED}: ordinal ${scoped.join(", ")} 的短镜口播在唯一一次定向修复后仍未安全落入镜头时长;原稿仅保存在本机待审区,未作为可重传稿提交。${reason}。请人工审阅,或确认逐字框架可调整后手动重试`,
1289
+ error: `${FLOW_C_VOICE_PACING_REVIEW_REQUIRED}: ordinal ${scoped.join(", ")} 的口播在唯一一次定向调整后仍需单独检查;原稿保存在本机待审区,其余脚本继续处理。${reason}。可调整后手动重试,已回传稿保持不变`,
1228
1290
  terminal: true,
1229
1291
  terminalKind: "review",
1230
1292
  affectedOrdinals: scoped,
@@ -1236,12 +1298,15 @@ export function terminalScriptChunkError(results) {
1236
1298
  }
1237
1299
  export function terminalScriptChunkFailure(results, receivedOrdinals = []) {
1238
1300
  const received = new Set(receivedOrdinals.map(Number).filter(Number.isInteger));
1239
- return results.find((result) => {
1301
+ const failures = results.filter((result) => {
1240
1302
  if (!result.terminal)
1241
1303
  return false;
1242
1304
  const affected = Array.isArray(result.affectedOrdinals) ? result.affectedOrdinals.map(Number).filter((ordinal) => Number.isInteger(ordinal) && ordinal > 0) : [];
1243
1305
  return !affected.length || affected.some((ordinal) => !received.has(ordinal));
1244
1306
  });
1307
+ // An isolated review must not hide a sibling's genuine delivery/transport
1308
+ // failure when nested revision or rewrite results are aggregated.
1309
+ return failures.find((result) => result.terminalKind !== "review") || failures[0];
1245
1310
  }
1246
1311
  export function scriptCreativeReplanOrdinals(results) {
1247
1312
  return [...new Set(results.flatMap((result) => (result && typeof result === "object" ? result.replanOrdinals || [] : [])).filter((ordinal) => Number.isInteger(ordinal) && ordinal > 0))].sort((left, right) => left - right);
@@ -1432,7 +1497,7 @@ ${durationRules}
1432
1497
  写作要求:
1433
1498
  1. visualHook、conflict、escalation/turn、productIntervention、visibleProof、purchaseReason、callbackMotivation 与所有 shots 必须执行选中卡的 visualPremise、firstFrame、spectacleEscalation、productProofAction、purchaseReason、truthBoundary 以及七项视觉执行字段;保留所选蓝图的因果时间线、节拍比例、镜头/剪辑节奏、动作压力、证明方式和购买逻辑,只替换当前商品、人物、场景与当地口播槽位,不得稀释构图或换成普通模板。爆款来源的旧商品身份/动作必须替换;形式卡只提供抽象创意结构,绝不能反向改变现有首帧、分段、${videoModelName}或参考图制作方式。形式库中的工厂、仓库、街访、使用者体验、主理人、探店、补货、对比、促销和耐用形式都可以用 AI 人物与场景正常演绎;缺少现实素材或事实证据不是脚本失败条件,必须按 executionBlueprint.executionAdaptation 保留所选形式,同时不把演绎的角色、地点、订单、库存、销量、价格、身份或经历写成已核验的现实事实。若 productAdaptation.templateMatch.actionCompatibility 的 openingAction、proofAction 或 spectacleAction 为 false,对应 productAdaptation 的 firstFrame、productProofAction 或 spectacleEscalation 对商品动作内容具有绝对优先级,必须删除其旧商品动作,不得折中混用。productProofAction 必须同时写清一个商品图或执行档案能支持的可见动作及其镜头内可见结果;purchaseReason 只解释该结果为何值得目标用户购买,不能变成泛泛 CTA。
1434
1499
  2. 严格执行 executionBlueprints 中的 sourceDurationSeconds → targetDurationSeconds 和 retimingMode:expand 只增加有用的证明停留、使用语境与购买理由,compress 只压缩重复、冗余铺垫和转场,same 保持原节拍比例;三种模式都必须保留 Hook、证明和购买因果,禁止整体拉伸、截断或机械加速。
1435
- 3. 每条生成一份稳定 voiceProfile;每段只写简短 voiceCue。口播必须使用${targetVoiceLanguage},并执行 creatorVoiceStyle/ctaStyle;未提供 creatorVoiceStyle 时使用当地 TikTok 带货创作者真实会说的口吻。${contentStrategy || generatedMontageOrdinals.length > 0 ? `不是逐字翻译。Hook → Body/visible proof → Close 是画面叙事结构,不等于口播结构;镜头数量不等于台词数量。先基于已经确定的画面,为每个局部${segmentSeconds}秒拟一份按实际镜头时长能自然说完的很短当地口播:用户锁定对白先以原词计入并优先给承载镜头足够秒数,不得删改;除此之外整段只留1–2个必要短句。再按完整词组或自然分句分配到真正展示相关动作/判断的镜头,允许一句在连续相关 cuts 间自然延续,但每镜 voiceover 只存该镜实际说出的片段,不逐镜复述 visual。镜头时长不足时先删除模型自行增加的赘句,不追加语速、不填满有声镜;其它镜头默认 voiceover="none",只在 soundBgm 保留动作现场声。结尾的一个简短自然 CTA 并入上述已定短句;若锁定对白占满可用口播时长就不再追加 CTA。用户锁定的对白、原框架和目标语言优先;上述拟稿与分配在同一次写作内完成,不输出中间声音轨。` : '不是逐字翻译,整条内容按 Hook → Body/visible proof → Close 组织,短句口语化且与当前镜头可见动作同步,结尾只给一个简短自然 CTA。'}只使用少量可信的 localSceneProfile/audienceContext 日常细节;presenterContext 没填写时使用普通创作者,不得把国家代码、语言或地区自动等同于人物族群。商品事实没有提供时不得编造价格、折扣、销量、库存或稀缺性。商品标题只用于理解商品类型与事实,所有输出不得主动写出或念出品牌名、品牌广告语、包装文案,也不得要求模型把品牌字样变得更清晰;商品外观与已有标识的位置、比例、颜色和版式只服从第1张产品参考图。TikTok/TikTok Shop 只用于定义这条写作规则,不得把平台名写入 voiceover、onScreenText、visual、soundBgm、emotionalNote、openingState、endingState 或任何会进入故事板/视频的导演字段。导演说明统一用简洁制作英文;这里只做写作指令,不做语言检测字段。
1500
+ 3. 每条生成一份稳定 voiceProfile;每段只写简短 voiceCue。口播必须使用${targetVoiceLanguage},并执行 creatorVoiceStyle/ctaStyle;未提供 creatorVoiceStyle 时使用当地 TikTok 带货创作者真实会说的口吻。${contentStrategy || generatedMontageOrdinals.length > 0 ? `不是逐字翻译。Hook → Body/visible proof → Close 是画面叙事结构,不等于口播结构;镜头数量不等于台词数量。先基于已经确定的画面,为每个局部${segmentSeconds}秒拟一份按实际镜头时长能自然说完的很短当地口播:用户锁定对白先以原词计入并优先给承载镜头足够秒数,不得删改;除此之外整段只留1–2个必要短句。再按完整词组或自然分句分配到真正展示相关动作/判断的镜头,允许一句在连续相关 cuts 间自然延续,但每镜 voiceover 只存该镜实际说出的片段,不逐镜复述 visual。允许符合当地带货口吻的自然偏快语速,偶尔密一点无需重写;不要夸张急促、吞字或失去可懂度。连续相关镜头可承接同一句口播;只有明显超出实际可用时长时才删除模型自行增加的赘句,不为填满有声镜硬塞台词;其它镜头默认 voiceover="none",只在 soundBgm 保留动作现场声。结尾的一个简短自然 CTA 并入上述已定短句;若锁定对白占满可用口播时长就不再追加 CTA。用户锁定的对白、原框架和目标语言优先;上述拟稿与分配在同一次写作内完成,不输出中间声音轨。` : '不是逐字翻译,整条内容按 Hook → Body/visible proof → Close 组织,短句口语化且与当前镜头可见动作同步,结尾只给一个简短自然 CTA。'}只使用少量可信的 localSceneProfile/audienceContext 日常细节;presenterContext 没填写时使用普通创作者,不得把国家代码、语言或地区自动等同于人物族群。商品事实没有提供时不得编造价格、折扣、销量、库存或稀缺性。商品标题只用于理解商品类型与事实,所有输出不得主动写出或念出品牌名、品牌广告语、包装文案,也不得要求模型把品牌字样变得更清晰;商品外观与已有标识的位置、比例、颜色和版式只服从第1张产品参考图。TikTok/TikTok Shop 只用于定义这条写作规则,不得把平台名写入 voiceover、onScreenText、visual、soundBgm、emotionalNote、openingState、endingState 或任何会进入故事板/视频的导演字段。导演说明统一用简洁制作英文;这里只做写作指令,不做语言检测字段。
1436
1501
  4. 每段永远是独立 0–${segmentSeconds} 秒,含 1–8 个按剧情需要决定的 ${contentStrategy ? `shots。每镜 voiceover 字段必须存在,但不等于必须有台词:只填上一步分配给该镜的原句,其余填非空静默标记 "none",绝不让配音念出 none;每镜同时给出准确 onScreenText、evidence、soundBgm、emotionalNote,并提供每段 endingState。先写末镜实际动作,再在末镜 visual 最后用一个短句明确第${segmentSeconds}秒的最终画面;endingState.endingFrame 逐字复用这个收尾短句,其余 endingState 字段也只描述同一瞬间,不另编姿势或动作。已走出画面的人不能仍在画内回头,已经落地的脚不能又悬在半空,已经完成的动作不能仍写为待完成;确已完成且无续接动作时 unfinishedAction 写 none。下一段首镜从这个真实终点继续,不重置人物、物体或动作;最终一段也要检查,不能只保证跨段字段相等` : 'shots、准确 voiceover、onScreenText、evidence、soundBgm、emotionalNote 与 endingState'};模型不要输出 continuity 或 continuityMode。
1437
1502
  5. shot.visual 要直接写出主体位置、景别、光线、材质、动作峰值和当地自然环境,并保留真实皮肤、细发、布料/商品微纹理和实景混合光;禁止塑料蜡感、静态举产品、品牌广告片或电视购物。允许执行所选形式的 AI 工厂/仓库/零售/人物场景,但不得声称它们是该商家真实工厂、产地、生产档案、订单、库存、销量、实名客户证言或线下价格。
1438
1503
  6. 多段视频的后一段剧情承接前段 endingState,但每段仍只使用自己的局部 0–${segmentSeconds} 秒执行内容。
@@ -1710,7 +1775,7 @@ export function nextScriptPipelineWave(task, receivedOrdinals, durationSeconds,
1710
1775
  if (scriptReady.length) {
1711
1776
  return { stage: "script", chunks: flowCScriptChunks(durationSeconds, scriptReady, scriptChunkSize).slice(0, concurrency) };
1712
1777
  }
1713
- const candidateMissing = missingOrdinals(task.requested_count, selected);
1778
+ const candidateMissing = missingOrdinals(task.requested_count, [...selected, ...receivedOrdinals]);
1714
1779
  return { stage: "candidate", chunks: chunkNumbers(candidateMissing, candidateChunkSize).slice(0, concurrency) };
1715
1780
  }
1716
1781
  export function immediateScriptOrdinals(task, receivedOrdinals, candidateOrdinals) {
@@ -1762,7 +1827,8 @@ function productIndexForOrdinal(productQuantities, ordinal) {
1762
1827
  return -1;
1763
1828
  }
1764
1829
  function publicScript(record) {
1765
- return { id: record.id, status: record.status, requestedCount: record.requestedCount, received: record.receivedOrdinals.length, threadId: record.threadId, chunkSize: record.chunkSize || null, activeChunks: Number(record.activeChunks || 0), message: record.message, expiresAt: record.expiresAt, updatedAt: record.updatedAt, ...(record.contentAdvisories ? { contentReview: { blocking: false, semanticAcceptance: "not-evaluated", advisories: record.contentAdvisories } } : {}) };
1830
+ const reviewOrdinals = voicePacingHeldOrdinals(record);
1831
+ return { id: record.id, status: record.status, requestedCount: record.requestedCount, received: record.receivedOrdinals.length, reviewOrdinals, reviewCount: reviewOrdinals.length, threadId: record.threadId, chunkSize: record.chunkSize || null, activeChunks: Number(record.activeChunks || 0), message: record.message, expiresAt: record.expiresAt, updatedAt: record.updatedAt, ...(record.contentAdvisories ? { contentReview: { blocking: false, semanticAcceptance: "not-evaluated", advisories: record.contentAdvisories } } : {}) };
1766
1832
  }
1767
1833
  function publicDownload(record) {
1768
1834
  return { batchId: record.batchId, status: record.status, downloaded: record.downloadedOrdinals.length, market: record.market, message: record.message, expiresAt: record.expiresAt, updatedAt: record.updatedAt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiaohhhh1/canvas-agent",
3
- "version": "0.4.83",
3
+ "version": "0.4.84",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",