@ninkch/dsh-infinite-canvas 0.20.4 → 0.20.5

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.
@@ -231,5 +231,5 @@ Maintain [身份/服装/地点/光向]. Avoid [与本镜真实风险匹配的失
231
231
  ## 七、诚实边界
232
232
 
233
233
  - 本套件的方法论是**通用手法**,不复制任何具体作品的镜头、台词、角色或情节。透镜名只作为内部选择标签,交付物里**绝不出现导演名**——一律翻译成可执行参数(焦段、光比、ASL、色板、负向词)。
234
- - **不承诺逐帧还原参考视频的动作**。具体武打招式要靠 3D 导演台骨骼动画或实拍参考,文字提示词硬凑招式必然出糊动作。详见 `moves/fight-rhythm.md` 的「生成时的明确边界」。
234
+ - **不承诺逐帧还原参考视频的动作时序**。但打斗**可以**用文字写出可演的发力链:打斗分镜必须写可见身体发力 + 对手回应 + 物理结果(禁招式名/概括词),动作词表见 `moves/fight-rhythm.md`;更高质感走发力关键帧图生视频或 3D 导演台首帧。
235
235
  - 题材卡的置信度标注的是「该卡的机制在本套件内被多处交叉印证的程度」,**不代表市场表现、测量结果或任何统计结论**。
@@ -8,6 +8,9 @@ kind: moves
8
8
 
9
9
  打斗不是"更快地打架",是**用镜头组织给观众建立重量感**。观众记住的从来不是招式,是某一下砸下去之后身体停住的那两帧。
10
10
 
11
+ 打斗分镜还有一条**因果硬规则**(与镜头组织同等重要):**出招 → 对手接招/防御/闪避/受击 → 反击或追击 → 攻守转换 → 位移/空间变化 → 下一轮**。每次主要攻击都必须引发对手可见的回应,禁止站桩接招;每次攻击必须指向具体对手(写明锁定部位与轨迹方向);接触必须写清受力与破坏;跨镜的攻势延续靠每镜 tail 里的「|战斗态:…」传递。**禁止招式名与概括词**("回风落雁式""释放技能""能量爆炸""华丽连招")——只写可见的身体发力链 + 对手回应 + 物理结果。
12
+
13
+
11
14
  ## 实测基线
12
15
 
13
16
  对一段 10 秒 / 300 帧的实拍打斗做了逐镜切分,读数如下——把这些数字当基准,不要凭感觉:
@@ -69,9 +72,11 @@ kind: moves
69
72
 
70
73
  **这一段必须读懂,它决定了成品质量。**
71
74
 
72
- 本卡只提供**镜头节奏与景别组织手法**,不承诺逐帧还原参考视频里的具体武打动作。
75
+ 本卡提供**镜头节奏与景别组织手法 + 攻防因果链**。动作要"真",靠的是把打斗拆成**可见的身体发力链**,而不是靠招式名词。
76
+
77
+ - **不写招式名**("回风落雁式""居合三段突")——模型不知道怎么演名字。**但必须写可见发力链**:起始姿态/重心 → 肢体顺序(腰胯先拧、后腿蹬地、手臂后送)→ 接触 → 受力反馈 → 收势。例如不写"一记凌厉的侧踢",写"重心压到左腿、右腿贴地横扫到髋高、@对手@ 双臂交叠上架仍被扫得后撤半步"。
78
+ - **动作词表直接取用**(源自 3D 导演台骨骼姿势的关节力学,可见且可演):侧身沉肩重心压后腿;腰胯先拧后腿蹬地发力;单臂斜上架掌面外翻上身侧倾卸力;髋部后坐上身后仰;前腿蹬直上身前压冲刺;深蹲转体贴地横扫;单膝下沉持械直下压;抬头挺胸双臂外展蓄力;上身后折双臂散开撤步卸力;全身放倒四肢摊开。打斗镜的 motion/timeBeats 从这些**可见身体状态**里取词,不再写"挥了一下"。
79
+ - **概括词禁令**:"释放技能/发动攻击/能量爆炸/高速连击"这类词模型只能演成糊动作或平移。写成画面事实:谁、哪个部位、朝哪个方向、把什么推向哪里、对方身体如何回应。
80
+ - **仍然诚实的一条**:本卡不承诺逐帧还原任何实拍片段的动作时序。要真实动作质感,两条升级路依然有效:① 打斗镜先出**发力关键帧设定图 → 图生视频(hard 首帧)**;② 3D 导演台骨骼动画摆出真实关节角度后截图作首帧/参考。但"文字写不出打斗"是旧口径,已废弃——**写足发力链 + 回应 + 物理结果,模型就能演出打斗**。
81
+ - 打斗分镜里,把文字用在**该写的地方**:景别、机位、时长、光向、服装色块、攻防因果(attack/reaction/impact/攻守归属)、打击后的身体状态("停在半跪,右手撑地,头抬起看向对方")。
73
82
 
74
- - 具体招式(怎么出拳、怎么格挡、身体重心怎么转移)**不能靠文字提示词硬凑**。用文字描述武打动作,模型只能给出"挥了一下"的糊动作,这是必然结果,不是参数没调好。
75
- - 要真实动作,走两条路:① **3D 导演台的骨骼动画**(有真实关节角度与时间曲线);② 拿实拍或动捕参考做视频参考输入。
76
- - 打斗分镜里,把文字用在**该写的地方**:景别、机位、时长、光向、服装色块、打击后的身体状态("停在半跪,右手撑地,头抬起看向对方")。这些都可执行。
77
- - 反过来,**不要写**:"一记凌厉的侧踢接转身肘击" 这种招式描述——模型会给你一段谁也没看懂的肢体运动。
package/client.js CHANGED
@@ -458,6 +458,10 @@ function revealCanvasInRight() {
458
458
  'segMaxHint': '单次生成的最大秒数(按厂商上限填,MiniMax 这类弱衔接模型建议 6–10 秒)',
459
459
  'targetDurationLabel': '分镜总时长',
460
460
  'targetDurationAuto': '按镜头节奏自动',
461
+ 'combatModeLabel': '打斗判定:命中打斗的场才注入战斗契约与打斗节奏(on=本场强制按打斗,off=强制不注入,auto=按剧本检测)',
462
+ 'combatAuto': '打斗·自动',
463
+ 'combatOn': '打斗·开',
464
+ 'combatOff': '打斗·关',
461
465
  'customValuePh': '自定义后回车',
462
466
  'customCountPh': '自定义 1–100 镜',
463
467
  'customSegMaxPh': '自定义 1–300 秒',
@@ -1465,6 +1469,10 @@ function revealCanvasInRight() {
1465
1469
  'segMaxHint': 'Max seconds per generation (match the vendor limit; for weak-continuity models like MiniMax use 6-10s)',
1466
1470
  'targetDurationLabel': 'Storyboard total duration',
1467
1471
  'targetDurationAuto': 'Auto by shot pacing',
1472
+ 'combatModeLabel': 'Combat gating: only scenes detected as real combat inject the combat contract & fight-rhythm card (on = force combat for this scene, off = force none, auto = detect from script)',
1473
+ 'combatAuto': 'Combat · Auto',
1474
+ 'combatOn': 'Combat · On',
1475
+ 'combatOff': 'Combat · Off',
1468
1476
  'customValuePh': 'Custom, press Enter',
1469
1477
  'customCountPh': 'Custom 1-100 shots',
1470
1478
  'customSegMaxPh': 'Custom 1-300 seconds',
@@ -6963,17 +6971,29 @@ function queueThumb(assetId) {
6963
6971
  if (!j || typeof j !== 'object') return '';
6964
6972
  return String(j.status ?? (j.data && j.data.status) ?? '').trim().toLowerCase();
6965
6973
  }
6966
- /** 6789 结果地址(纯函数):优先绝对地址(download_url → video_url → content/output.video_url →
6967
- * data.video_url),file 为相对路径(/v1/videos/{id}/content)时原样返回(调用方拼 origin)。
6968
- * 空串视为「未提供」(站方成功响应里 file/download_url 可为 '')。 */
6974
+ /** 6789 结果地址(纯函数):new-api 系中转站的字段谱系很宽,按站方官方 VideoTaskResponse
6975
+ * 与常见兼容形状全量覆盖——metadata.url(官方主字段)→ download_url → video_url/url →
6976
+ * content/output/result 包装 → data 包装 → 数组形状(output[]/data[])→ file(相对路径
6977
+ * 或绝对地址)。空串/缺失一律视为「未提供」(由轮询层与 /content 兜底处理,绝不在此判死)。 */
6969
6978
  function api6789VideoUrlOf(j) {
6970
6979
  if (!j || typeof j !== 'object') return '';
6971
6980
  const d = (j.data && typeof j.data === 'object') ? j.data : {};
6972
- const cands = [j.download_url, j.video_url, d.download_url, d.video_url,
6973
- j.content && j.content.video_url, j.output && j.output.video_url];
6981
+ const md = (j.metadata && typeof j.metadata === 'object') ? j.metadata : (d.metadata && typeof d.metadata === 'object' ? d.metadata : {});
6982
+ const firstOf = (v) => (Array.isArray(v) && v.length && typeof v[0] === 'object' ? v[0] : null);
6983
+ const out0 = firstOf(j.output) || (typeof j.output === 'object' && !Array.isArray(j.output) ? j.output : null);
6984
+ const data0 = firstOf(j.data);
6985
+ const cands = [
6986
+ md.url, md.video_url, md.download_url, // new-api 官方:metadata.url
6987
+ j.download_url, j.video_url, j.url, j.videoUrl, j.result_url,
6988
+ d.download_url, d.video_url, d.url,
6989
+ j.content && (j.content.video_url || j.content.url),
6990
+ out0 && (out0.url || out0.video_url), // output 对象或 output[0]
6991
+ j.result && (j.result.url || j.result.video_url),
6992
+ data0 && (data0.url || data0.video_url), // data 数组首项
6993
+ ];
6974
6994
  const abs = cands.find((u) => typeof u === 'string' && /^https?:/i.test(u));
6975
6995
  if (abs) return abs;
6976
- const file = [j.file, d.file].find((u) => typeof u === 'string' && u.startsWith('/'));
6996
+ const file = [j.file, d.file].find((u) => typeof u === 'string' && (u.startsWith('/') || /^https?:/i.test(u)));
6977
6997
  return file || '';
6978
6998
  }
6979
6999
  /** 6789 失败原因(纯函数):error → fail_reason → message → data.error。 */
@@ -6984,13 +7004,14 @@ function queueThumb(assetId) {
6984
7004
  if (!v) return '';
6985
7005
  return (typeof v === 'string' ? v : JSON.stringify(v)).slice(0, 300);
6986
7006
  }
6987
- /** 6789 轮询判定(纯函数):queued/running 及未知状态 = 继续;成功集合取地址;
6988
- * 失败集合报错。与站方文档枚举一致(含 cancelled/canceled/expired)。 */
7007
+ /** 6789 轮询判定(纯函数):queued/running/in_progress 及未知状态 = 继续等待(new-api 官方
7008
+ * 用 in_progress);成功集合取地址——**有地址才 done,无地址继续等**(部分中转站 completed
7009
+ * 后才异步转存出 metadata.url,立即判死会丢掉刚成功的任务);失败集合报错。 */
6989
7010
  function api6789PollState(j) {
6990
7011
  const st = api6789StatusOf(j);
6991
7012
  if (['succeeded', 'completed', 'success'].includes(st)) {
6992
7013
  const url = api6789VideoUrlOf(j);
6993
- return url ? { state: 'done', url } : { state: 'fail', error: '任务成功但响应中没有视频地址' };
7014
+ return url ? { state: 'done', url } : { state: 'wait' };
6994
7015
  }
6995
7016
  if (['failed', 'error', 'cancelled', 'canceled', 'expired'].includes(st)) {
6996
7017
  return { state: 'fail', error: api6789ErrorOf(j) || st };
@@ -7312,10 +7333,23 @@ function queueThumb(assetId) {
7312
7333
  if (!r || !r.ok) return null;
7313
7334
  try { return JSON.parse(r.text); } catch { return null; }
7314
7335
  };
7315
- // 站方建议每 5s 查询一次;画布最长轮询 30 分钟(任务 id 已挂节点,超时可凭 id 回查)
7336
+ // 站方建议每 5s 查询一次;画布最长轮询 30 分钟(任务 id 已挂节点,超时可凭 id 回查)。
7337
+ // 查询层兼容 new-api 官方枚举(in_progress)与各站变体;成功但无地址继续等(转存延迟)。
7338
+ const pollStartAt = Date.now();
7339
+ const contentUrl = base + '/v1/videos/' + encodeURIComponent(tid) + '/content';
7316
7340
  const url = await vendorPoll('6789', 5000, async () => {
7317
7341
  const j = await queryTask('6789 查询');
7318
- return j ? api6789PollState(j) : { state: 'wait' };
7342
+ if (!j) return { state: 'wait' };
7343
+ const st = api6789PollState(j);
7344
+ if (st.state === 'done') return st;
7345
+ // 任务已终态成功但响应始终没给地址 → 放弃轮询,走 /content 代理下载兜底
7346
+ // (站方文档:/content 在查询无 video_url 时代理返回视频流;409 video_not_ready 可重试)。
7347
+ const statusNow = api6789StatusOf(j);
7348
+ if (['succeeded', 'completed', 'success'].includes(statusNow) && Date.now() - (pollStartAt + 20000) > 0) {
7349
+ try { console.info('[IC] 6789 task ' + tid + ' succeeded without a URL in the response — falling back to /content download'); } catch { /* 忽略 */ }
7350
+ return { state: 'done', url: contentUrl };
7351
+ }
7352
+ return st;
7319
7353
  });
7320
7354
  // 任务成功 ≠ 文件可下载:CDN 就绪窗口内重试(10 分钟、每 30s 一次,与三宝同款口径)。
7321
7355
  // file 相对路径 → 拼 origin 且带 Bearer 下载;绝对地址裸 GET、401/403 自动带鉴权重试;
@@ -9526,6 +9560,10 @@ function queueThumb(assetId) {
9526
9560
  const bible = bibleBlock(loadBible(S.activeId));
9527
9561
  const zh = effLang() !== 'en';
9528
9562
  const contOn = !(opts && opts.cont === false); // 分镜衔接开关(默认开)
9563
+ // 按场打斗检测(用户定稿口径:真实有打斗才注入,绝不按题材整表灌):
9564
+ // 三态覆盖 data.combatMode(auto/on/off,默认 auto);on/off 用户显式覆盖优先于检测。
9565
+ const combatMode = String((opts && opts.combatMode) || 'auto').toLowerCase();
9566
+ const combat = detectCombatScene(scriptText, { mode: combatMode });
9529
9567
  // 分镜总时长(issue:下拉硬约束):targetDuration > 0 = 用户手动设定的**本分镜节点总时长**,
9530
9568
  // 严格 =X 秒——不论切 5 镜还是 50 镜,所有镜头 duration 之和必须等于 X;技能只管按节奏谱系
9531
9569
  // 把 X 分配到各镜(快冲突 0.3-0.8s / 对白 2-4s / 情绪长镜 ≥5s),装不下压每镜时长而非删戏。
@@ -9587,7 +9625,7 @@ function queueThumb(assetId) {
9587
9625
  '- **按情绪选景别**:孤独/绝望/宏大危机=远景;对峙/动作/关系建立=全景;对话/试探/信息交换=中景;震惊/怀疑/内心动摇=近景;崩溃/嘶吼/情绪爆发=特写;关键细节/道具揭示=大特写——冲突用全景、揭秘转近景、爆发给特写、反转可拉远,景别变化本身在讲情绪;',
9588
9626
  '- **快切镜头(<1.5s)的 visual/motion 要极短**(一个动作、一句画内信息),信息量大的镜头才配长时长——时长与内容量必须匹配;',
9589
9627
  '- 只输出 JSON,不要输出任何其他内容。',
9590
- ].concat(FX_RULES, contOn ? [
9628
+ ].concat(FX_RULES, combat.hit ? [combatContractAddendum(zh)] : [], contOn ? [
9591
9629
  '',
9592
9630
  '**【分镜衔接·硬性】成片是分段生成的,每段模型看不到上一段画面——衔接只能靠写在分镜里的"接点"。除末镜外,每镜都必须写 tail 与 cam:**',
9593
9631
  '- **tail(接点尾态)**:本镜**最后一刻**的状态,一行写清——人物姿势停在哪个动作的中途、朝向、视线落点、手持物位置、位置关系(如「右手抬到胸口一半,视线仍锁在 @陈拾@ 脸上,@糯糯@ 停在他左后方半步」「已侧身转到 3/4 面,还没完全转身面对对方」)。**必须是"动作进行中"的状态,不能写成"已经完成/站定/看向"**——切点停在静止定格,下一镜就没有动作可接,接缝必然暴露;',
@@ -9627,7 +9665,7 @@ function queueThumb(assetId) {
9627
9665
  '- **Pick the shot size by emotion**: loneliness/despair/grand crisis = wide; confrontation/action/relationship = full; dialogue/probing/info exchange = medium; shock/suspicion/inner shake = close-up; breakdown/screaming/emotional burst = extreme close-up; key detail/prop reveal = big close-up — conflicts play wide, reveals move close, bursts go extreme, reversals can pull wide; the changing distance itself tells the emotion;',
9628
9666
  '- **Rapid cuts (<1.5s) get minimal visual/motion** (one action, one piece of in-frame information); long durations are earned by information density — duration must match content;',
9629
9667
  '- Output JSON only.',
9630
- ].concat(FX_RULES, contOn ? [
9668
+ ].concat(FX_RULES, combat.hit ? [combatContractAddendum(zh)] : [], contOn ? [
9631
9669
  '',
9632
9670
  '**[CONTINUITY - HARD] the film is generated in segments and each segment cannot see the previous one, so the "hand-off point" must be written into the storyboard. Every shot except the last MUST carry tail and cam:**',
9633
9671
  '- **tail (hand-off tail state)**: the state at the LAST instant of this shot, in one line - where the posture stops mid-motion, facing, gaze target, hand/prop position, blocking (e.g. "right hand half-way up to the chest, eyes still locked on @Chen@, @Nuonuo@ half a step behind his left shoulder"). It MUST be a mid-motion state, never a settled/completed pose: a cut on a static freeze leaves nothing for the next shot to continue, which is exactly what makes the seam visible;',
@@ -9762,6 +9800,14 @@ function queueThumb(assetId) {
9762
9800
  camera: String(s.camera || '').trim().slice(0, 160),
9763
9801
  vfx: String(s.vfx || '').trim().slice(0, 160),
9764
9802
  negative: String(s.negative || '').trim().slice(0, 200),
9803
+ // 战斗因果字段(打斗镜专用,全部可选):逐镜存分镜数据,编译与衔接链透传——
9804
+ // attack/reaction/impact/initiative/nextCombat,tail 追加「|战斗态:…」段。
9805
+ // 与 timeBeats 同一「没写就是空、绝不臆造」口径;宿主 index.js 三处映射同步放行。
9806
+ attack: String(s.attack || '').trim().slice(0, 160),
9807
+ reaction: String(s.reaction || '').trim().slice(0, 160),
9808
+ impact: String(s.impact || '').trim().slice(0, 160),
9809
+ initiative: String(s.initiative || '').trim().slice(0, 80),
9810
+ nextCombat: String(s.nextCombat || '').trim().slice(0, 80),
9765
9811
  characters: Array.isArray(s.characters) ? s.characters.map(String).slice(0, 6) : [],
9766
9812
  scene: String(s.scene || ''),
9767
9813
  props: Array.isArray(s.props) ? s.props.map(String).slice(0, 6) : [],
@@ -10713,6 +10759,10 @@ function queueThumb(assetId) {
10713
10759
  if (cam) parts.push((zh ? '机位/焦段/运镜' : 'Camera/lens/move') + ':' + cam);
10714
10760
  const vfx = String(s.vfx || '').trim();
10715
10761
  if (vfx) parts.push((zh ? '特效(必须可见)' : 'VFX (must be visible)') + ':' + vfx);
10762
+ // 打斗因果块(V3.1 嫁接):打斗镜把「攻击指向/对手回应/受力破坏/攻守归属」编进视频
10763
+ // 提示词——分段生成时模型看不到别的段,因果只能靠写在提示词里。空字段不注入。
10764
+ const cct = combatCausalityText(s, zh);
10765
+ if (cct) parts.push(cct);
10716
10766
  const dls = (s.dialogue || []).map((d) => String(d && d.role || '').trim() + ':' + String(d && d.line || '').trim()).filter((x) => x.replace(':', '').trim());
10717
10767
  if (dls.length) {
10718
10768
  parts.push(zh
@@ -10927,7 +10977,7 @@ function queueThumb(assetId) {
10927
10977
  try {
10928
10978
  const prev = prevSceneTail(n); // 场 N-1 的尾镜 → 作为本场第 1 镜的硬性承接约束
10929
10979
  const targetDur = Math.max(0, Math.round(Number(n.data.targetDuration) * 10) / 10) || 0;
10930
- const shots = await aiStoryboardShots(st, n.data.requirement, Number(n.data.count) || 0, n.data.model, (kind, d) => aiStreamAppend(n.id, kind, d), prev, { cont: n.data.cont !== false, targetDuration: targetDur });
10980
+ const shots = await aiStoryboardShots(st, n.data.requirement, Number(n.data.count) || 0, n.data.model, (kind, d) => aiStreamAppend(n.id, kind, d), prev, { cont: n.data.cont !== false, targetDuration: targetDur, combatMode: String(n.data.combatMode || 'auto') });
10931
10981
  // 总时长机械归位(issue:下拉硬约束的执行侧保底):模型 Σ≠X 时按比例缩放各镜 duration,
10932
10982
  // 末镜吸收舍入残差 → Σ 恰等于 X。只缩放时长,绝不动内容字段;自动档(targetDur=0)零操作。
10933
10983
  if (targetDur && shots.length) {
@@ -10960,6 +11010,13 @@ function queueThumb(assetId) {
10960
11010
  if (shots.length > MAX_STORYBOARD_SHOTS) {
10961
11011
  warnings.push(T('warnShotsOverCapacity').replace('{n}', String(shots.length)));
10962
11012
  }
11013
+ // 打斗镜几何最小校验(用户定稿:只告警不拦截——防误杀):朝向矛盾/无回应攻击/缺战斗态 tail。
11014
+ // combatMode!=='off' 时生效;与一致性告警同一 warnings 表面,用户在节点上直接可见。
11015
+ if (String(n.data.combatMode || 'auto') !== 'off') {
11016
+ for (const sh of shots) {
11017
+ for (const w of validateCombatGeometry(sh, zh)) warnings.push(w);
11018
+ }
11019
+ }
10963
11020
  update((s) => {
10964
11021
  const nd = s.graph.nodes[n.id];
10965
11022
  if (nd) { nd.data.shots = shots; nd.data.aiStatus = 'idle'; nd.data.warnings = warnings; nd.data.status = 'done'; nd.data.error = null; nd.data.contFrom = prev ? prev.label : null; }
@@ -13396,6 +13453,17 @@ function queueThumb(assetId) {
13396
13453
  customLabel: (v) => String(v) + 's', customPlaceholder: T('customSegMaxPh'),
13397
13454
  })
13398
13455
  : null,
13456
+ isStoryboard
13457
+ ? h(PopupSelect, {
13458
+ value: String(n.data.combatMode || 'auto'), width: 88, title: T('combatModeLabel'),
13459
+ options: [
13460
+ { value: 'auto', label: T('combatAuto') },
13461
+ { value: 'on', label: T('combatOn') },
13462
+ { value: 'off', label: T('combatOff') },
13463
+ ],
13464
+ onChange: (v) => setData('combatMode', v),
13465
+ })
13466
+ : null,
13399
13467
  (isImage || isVideo || isFinalCut)
13400
13468
  ? h(PopupSelect, { value: n.data.ratio || '16:9', options: ratioOpts, onChange: onRatio, width: 74, title: T('ratioLabel') })
13401
13469
  : null,
@@ -15607,12 +15675,151 @@ function queueThumb(assetId) {
15607
15675
  notify();
15608
15676
  }
15609
15677
 
15610
- /** 动作/冲突强度高的题材 → 分镜链路额外带「打斗节奏」卡(与 Host 侧 skill-pack.js 同一份清单)。 */
15611
- const FIGHT_RHYTHM_GENRES = new Set([
15612
- 'action-mission', 'wuxia', 'gunstandoff', 'adventure', 'crime-police', 'hk-retro',
15613
- 'wasteland-chase', 'mo-lei-tau', 'revenge-face-slap', 'multi-thread-caper',
15614
- 'neon-dystopia', 'rebirth-transmigration',
15615
- ]);
15678
+ // ============================================================
15679
+ // 战斗语义(打斗分镜因果链):嫁接自 _refs/LucianAIGC-打斗skill-V3.1。
15680
+ //
15681
+ // 为什么:画布的连续性管道(tail → prevTail → 衔接块 → 首帧锚定)只传「画面尾态」,
15682
+ // 打斗的攻势归属/受击结果/攻守转换不随镜传递 → 各打各的、站桩接招、打完就散。
15683
+ // V3.1 的流畅来自显式战斗因果状态链(出招→接招→反击→攻守转换→位移)+ 逐镜结束状态。
15684
+ // 本模块把「战斗态」补进同一管道:tail 追加|战斗态段,衔接链自动跨镜、跨生成段传递。
15685
+ //
15686
+ // 注入口径(用户定稿):只在**真实有打斗的场**注入——按场自动检测 + 三态覆盖
15687
+ // (auto/on/off),绝不按题材整表灌;非打斗项目零变化。
15688
+ // 与宿主侧 combat-semantics.js 必须逐字同构(漂移守卫:scripts/test-combat-semantics.mjs)。
15689
+ // ============================================================
15690
+ /** 打斗动作语义词表:把 3D 导演台 BONE_POSES 打斗段(assets/director/engine.js,12 式)
15691
+ * 的关节力学翻译成「可见身体发力词」。模型演不出招式名、只能演姿势——给它可见的
15692
+ * 身体状态词,motion/timeBeats 才有真动作可写(打斗机械/平移的直接解药)。
15693
+ * id 与 3D 姿势 id 对齐(回归测试断言两表一致)。 */
15694
+ const COMBAT_ACTION_LEXICON = [
15695
+ { id: 'spear_ready', zh: '侧身沉肩、重心压到后腿、双手前后持械', en: 'side-on stance, shoulders sunk, weight on the back leg, weapon held fore-aft' },
15696
+ { id: 'spear_thrust', zh: '腰胯先拧、后腿蹬地发力把双手推出、前腿落成弓步', en: 'hips twist first, back leg drives the arms forward, front leg lands in a bow stance' },
15697
+ { id: 'palm_block', zh: '单臂斜上架、掌面外翻、上身侧倾把力卸向体侧', en: 'one arm angles up, palm turned out, torso tilts to shed the force sideways' },
15698
+ { id: 'dodge_lean', zh: '髋部后坐、上身后仰避开来势、双手收回护身', en: 'hips sit back, upper body leans away from the strike, hands pull in to guard' },
15699
+ { id: 'dash_forward', zh: '前腿蹬直、上身前压、双臂前后摆开冲刺', en: 'front leg extends, torso presses forward, arms swing in opposition while dashing' },
15700
+ { id: 'grit_advance', zh: '上身前探、双臂收紧、下颌压低逼近', en: 'torso leans in, arms tighten, jaw drops while closing in' },
15701
+ { id: 'low_sweep', zh: '深蹲转体、持械手贴地横扫、另一手撑地', en: 'deep-squat pivot, weapon hand sweeps low along the ground, other hand plants on the floor' },
15702
+ { id: 'spear_ground', zh: '单膝下沉、持械手直下压、上身俯冲', en: 'one knee sinks, weapon hand drives straight down, torso dives' },
15703
+ { id: 'crouch_low', zh: '单膝跪地、上身压到近地、持械手垂落收势', en: 'kneeling, torso pressed near the ground, weapon hand settling low' },
15704
+ { id: 'ult_charge', zh: '抬头挺胸、双臂外展上举、重心拔起蓄力', en: 'chest open, both arms spread and raised, weight rising as power gathers' },
15705
+ { id: 'hit_recoil', zh: '上身后折、双臂散开、后脚撤半步卸力', en: 'upper body folds back, arms fly open, rear foot steps back to absorb the hit' },
15706
+ { id: 'knockdown', zh: '全身放倒、四肢摊开、重心彻底失守', en: 'body laid flat, limbs sprawled, balance fully broken' },
15707
+ ];
15708
+ /** 按场打斗检测(纯函数):命中词 = 明确动作谓语(不是氛围词);排除 = 对白行 /
15709
+ * 回忆·讲述语境(命中词前 6 字含过去式/叙事标记);mode: auto=按文本,on=强制开,
15710
+ * off=强制关(用户显式覆盖优先于检测)。只看本场剧本文本,绝不看题材标签。 */
15711
+ function detectCombatScene(text, opts) {
15712
+ const o = opts || {};
15713
+ const mode = String(o.mode || o.combatMode || 'auto').toLowerCase();
15714
+ if (mode === 'on') return { hit: true, matched: [], mode: 'on' };
15715
+ if (mode === 'off') return { hit: false, matched: [], mode: 'off' };
15716
+ const t = String(text || '');
15717
+ if (!t.trim()) return { hit: false, matched: [], mode: 'auto' };
15718
+ const HIT = new RegExp([
15719
+ '出招', '过招', '交手', '开打', '对打', '搏杀', '厮杀', '互殴', '挥拳', '出拳', '出腿',
15720
+ '肘击', '膝撞', '挥刀', '拔刀', '挥剑', '出剑', '劈', '砍', '斩', '刺出', '突刺', '横扫',
15721
+ '扫堂腿', '鞭腿', '摆拳', '勾拳', '直拳', '抡', '格挡', '招架', '挡开', '架开', '闪避',
15722
+ '躲开', '闪身', '翻滚', '侧身避开', '击中', '命中', '打中', '一拳', '一掌', '一剑', '一刀',
15723
+ '一枪', '受击', '挨打', '被打', '击退', '击飞', '打飞', '撂倒', '打倒', '击倒', '摔倒',
15724
+ '摔出', '撞飞', '撞碎', '掀翻', '锁喉', '擒拿', '反关节', '压制', '按倒', '反击', '还击',
15725
+ '回击', '追击', '对轰', '火并', '枪战', '交火', '开枪', '射击', '扫射', '暗器', '箭矢',
15726
+ '刀光', '剑气', '掌风', '拳风', '破甲', '贯穿', '震飞', '踹', '砸向',
15727
+ ].join('|'), 'g');
15728
+ const DIALOGUE = /说道|说:|说道:|喊道|念道|心里想|暗想|旁白|字幕|歌词/;
15729
+ const PAST = /(曾|当年|想起|回忆|听说|讲述|史料|新闻|棋局|牌局|谈判|演习|训练|梦里|梦中|传说|故事里|电影里)/;
15730
+ const lines = t.split(/\n|。|;|;|!|?|!|\?/);
15731
+ const matched = [];
15732
+ for (const ln of lines) {
15733
+ if (!ln || DIALOGUE.test(ln)) continue;
15734
+ const ms = ln.match(HIT) || [];
15735
+ for (const w of ms) {
15736
+ const i = ln.indexOf(w);
15737
+ if (PAST.test(ln.slice(Math.max(0, i - 6), i))) continue;
15738
+ matched.push(w);
15739
+ break;
15740
+ }
15741
+ if (matched.length >= 6) break;
15742
+ }
15743
+ return { hit: matched.length > 0, matched, mode: 'auto' };
15744
+ }
15745
+ /** 打斗镜判定(纯函数):任一战斗字段非空即为打斗镜。字段全部可选、逐镜存分镜数据,
15746
+ * 与 timeBeats/camera/vfx 同一「没写就是空、绝不臆造」口径。 */
15747
+ function shotIsCombat(s) {
15748
+ const sh = s || {};
15749
+ return ['attack', 'reaction', 'impact', 'initiative', 'nextCombat'].some((k) => String(sh[k] || '').trim());
15750
+ }
15751
+ /** 分镜契约战斗扩展块(纯函数):命中打斗的场才注入。核心三件事:
15752
+ * ① 战斗字段语义(attack/reaction/impact/initiative/nextCombat + tail 追加战斗态);
15753
+ * ② 攻防硬规则(攻击必指向对手、对手必可见回应、受力与破坏有因果、禁招式名/概括词);
15754
+ * ③ 动作词表(3D 姿势反哺的可见发力词,让 motion/timeBeats 有真动作可写)。 */
15755
+ function combatContractAddendum(zh) {
15756
+ if (!zh) {
15757
+ return [
15758
+ '',
15759
+ '**[COMBAT STORYBOARD - HARD] this script contains real combat. Shots may carry combat fields (all optional; leave them empty on non-combat shots, never invent):**',
15760
+ '- **attack**: "attacker -> target, locked body part, trajectory", e.g. "@Li@->@Shen@, locked on chest/shoulder, spear thrust from lower-left to upper-right" - an attack MUST point at a concrete opponent on screen;',
15761
+ '- **reaction (required when attack exists)**: the opponent\'s visible block/dodge/hit action - never a statue receiving a blow, never just "blocked it";',
15762
+ '- **impact**: contact part, force direction, knockback/imbalance and environmental damage;',
15763
+ '- **initiative**: who holds the attack and who turns to counter at the end of this shot;',
15764
+ '- **nextCombat**: the next shot\'s combat intent, echoing the tail\'s combat state;',
15765
+ '- **tail gains a combat state**: write "picture tail state | combat state: who holds the attack, where the weapon/effect is, the hit party\'s state, damage residue" - cross-shot momentum rides entirely on this;',
15766
+ '- **timeBeats on combat shots use attack-defense beats**: strike -> opponent receives/counters -> counter or displacement (each beat a visible body state);',
15767
+ '- **action lexicon (visible body force, take directly):** ' + COMBAT_ACTION_LEXICON.map((x) => x.en).join('; ') + ';',
15768
+ '- **never**: move names ("Crouching Tiger style"), summary verbs ("releases a skill / launches an attack / energy explodes"), unexplained teleports, glide drifting, statue trading; write visible body-force chains + opponent response + physical results;',
15769
+ '- for materialized-technique shots write vfx as a picture that could be a keyframe still; when expanding prefer keyframe-then-video (hard first frame).',
15770
+ ];
15771
+ }
15772
+ return [
15773
+ '',
15774
+ '**【打斗分镜·战斗因果(本剧本命中打斗,以下为硬规则)】分镜镜头可携带战斗字段(全部可选;非打斗镜一律留空,绝不臆造):**',
15775
+ '- **attack(攻击)**:「攻击者→目标,锁定部位,轨迹方向」,如「@李寒@→@沈铁@,锁定胸肩,自左下向右上横枪突刺」——**攻击必须指向画面里的具体对手**,写明轨迹与锁定部位;',
15776
+ '- **reaction(对手回应;有 attack 必写)**:对手的可见防御/闪避/受击动作(如「@沈铁@ 单臂斜上架、掌面外翻、上身侧倾卸力」)——**禁止站桩接招、禁止只写「挡下了」**;',
15777
+ '- **impact(接触与受力)**:接触部位、受力方向、击退/失衡与环境破坏(如「枪尖擦肩、沈铁后撤半步、身后木栏断裂」);',
15778
+ '- **initiative(攻守归属)**:本镜结束时谁持攻、谁转入反击;',
15779
+ '- **nextCombat(下一镜战斗意图)**:如「@沈铁@ 借卸力之势低身横扫」——与 tail 的战斗态呼应;',
15780
+ '- **tail 追加战斗态**:接点尾态写成「画面尾态|战斗态:攻势在谁、武器/技能位于何处、受击者状态、破坏残留」——**跨镜攻势全靠它传递**;',
15781
+ '- **timeBeats 打斗镜用攻防三拍**:出招 → 对手接招/受击 → 反击或位移(每拍写可见身体状态);',
15782
+ '- **动作词表(可见身体发力,直接取用)**:' + COMBAT_ACTION_LEXICON.map((x) => x.zh).join(';') + ';',
15783
+ '- **禁止**:招式名(「回风落雁式」)、概括词(「释放技能/发动攻击/能量爆炸/华丽连招」)、无因瞬移、滑步漂移、站桩对轰;写**可见的身体发力链 + 对手回应 + 物理结果**;',
15784
+ '- 具象化招式镜(能量成形/武器光效)的 vfx 写成可直接出设定图的画面,铺开时优先「先出关键帧设定图 → 图生视频(hard 首帧)」。',
15785
+ ];
15786
+ }
15787
+ /** 逐镜因果句(纯函数):视频提示词编译时追加到打斗镜。只拼存在的字段;空镜返回 ''。 */
15788
+ function combatCausalityText(s, zh) {
15789
+ const sh = s || {};
15790
+ if (!shotIsCombat(sh)) return '';
15791
+ const g = (k) => String(sh[k] || '').trim();
15792
+ const bits = [];
15793
+ if (zh) {
15794
+ if (g('attack')) bits.push('攻击(必须朝向该对手):' + g('attack'));
15795
+ if (g('reaction')) bits.push('对手回应(必须演出):' + g('reaction'));
15796
+ if (g('impact')) bits.push('接触与受力:' + g('impact'));
15797
+ if (g('initiative')) bits.push('攻守归属:' + g('initiative'));
15798
+ if (g('nextCombat')) bits.push('下一镜从该攻势继续:' + g('nextCombat'));
15799
+ return bits.length ? '【打斗因果】' + bits.join(';') : '';
15800
+ }
15801
+ if (g('attack')) bits.push('attack (must point at that opponent): ' + g('attack'));
15802
+ if (g('reaction')) bits.push('opponent response (must be performed): ' + g('reaction'));
15803
+ if (g('impact')) bits.push('contact & force: ' + g('impact'));
15804
+ if (g('initiative')) bits.push('initiative: ' + g('initiative'));
15805
+ if (g('nextCombat')) bits.push('next shot continues from this momentum: ' + g('nextCombat'));
15806
+ return bits.length ? '[COMBAT CAUSALITY] ' + bits.join('; ') : '';
15807
+ }
15808
+ /** 打斗镜几何最小校验(纯函数):只做四条机械可判的检查,失败产生**可见告警**,
15809
+ * 绝不拦截生成(防误杀)。返回告警字符串数组。 */
15810
+ function validateCombatGeometry(s, zh) {
15811
+ const sh = s || {};
15812
+ const out = [];
15813
+ const g = (k) => String(sh[k] || '').trim();
15814
+ const pre = String(sh.title || '').trim() ? String(sh.title).trim() + ' · ' : '';
15815
+ if (!shotIsCombat(sh)) return out;
15816
+ if (g('attack') && !g('reaction')) out.push(zh ? pre + '有攻击但无对手回应:每次攻击必须写对手的可见防御/闪避/受击(禁站桩)' : pre + 'attack without reaction: every attack needs a visible response (no statues)');
15817
+ if (g('attack') && !/→|@/.test(g('attack'))) out.push(zh ? pre + '攻击未指向具体对手(缺少 @对手名@ 或 →)' : pre + 'attack lacks an explicit target (@name@ or ->)');
15818
+ const vis = String(sh.visual || '');
15819
+ if (/背对|背面|背影/.test(vis) && /表情|眼神|眼眸|面容|脸上的|嘴角/.test(vis)) out.push(zh ? pre + '可见性矛盾:背对镜头却写了表情/眼神' : pre + 'visibility conflict: back to camera yet describing facial expression');
15820
+ if (g('attack') && g('tail') && !/战斗态|combat state/i.test(g('tail'))) out.push(zh ? pre + 'tail 建议补「|战斗态:…」(跨镜攻势靠它传递)' : pre + 'tail should append "| combat state: ..." (cross-shot momentum rides on it)');
15821
+ return out;
15822
+ }
15616
15823
 
15617
15824
  /**
15618
15825
  * 组装某生成能力下的注入切片文本。返回 { text, bytes };任一层缺失则跳过。
@@ -15648,10 +15855,12 @@ function queueThumb(assetId) {
15648
15855
  }
15649
15856
  if (profile.form) await push('form', (manifest.forms || []).find((x) => x.id === profile.form));
15650
15857
  if (profile.look) await push('look', (manifest.looks || []).find((x) => x.id === profile.look));
15651
- // 运镜词典跟着分镜与提示词走;打斗节奏只在分镜且选了动作/冲突类题材时注入(它讲的是打斗场面的镜头组织)
15858
+ // 运镜词典跟着分镜与提示词走;打斗节奏只在分镜且**按场检测命中打斗**时注入
15859
+ // (2026-11 定稿:题材不再参与判定;combatMode 三态与 Host skill-pack.js 同口径)。
15860
+ // 画布自生成走 aiStoryboardShots 的 combat.hit 判定,不在本函数重复检测——
15861
+ // 这里只服务「预览面板」(buildSkillPackText,无 sceneText 上下文)→ 保持不判定。
15652
15862
  if (kind === 'storyboard' || kind === 'prompt') {
15653
15863
  const mids = ['camera-moves'];
15654
- if (kind === 'storyboard' && (profile.genres || []).some((g) => FIGHT_RHYTHM_GENRES.has(g))) mids.push('fight-rhythm');
15655
15864
  for (const mid of mids) {
15656
15865
  const mv = (manifest.moves || []).find((x) => x.id === mid);
15657
15866
  if (mv) await push('moves', { ...mv, oneliner: mv.oneliner || '' });
@@ -22491,7 +22700,7 @@ const DIRECTOR_KEY_HELP = [
22491
22700
  window.__DSH_IC_VENDOR__ = { detectVideoVendor, gatewayPrefixFor, wanEndpoints, vendorBase, VIDEO_REF_CAPS, needsSimpleMediaRetry, buildSimpleMediaRetryBody, wanTaskIdOf, wanStatusOf, wanPollState, buildSanbaoVideoBody, sanbaoTaskIdOf, sanbaoPollState, needsSanbaoMediaRetry, retryableDownloadError, downloadVideoWithRetry, SANBAO_DOWNLOAD_RETRY_MS, SANBAO_DOWNLOAD_RETRY_STEP_MS, buildSanbaoImageBody, sanbaoImageResultOf, sanbaoImagePollState, bibleStyleAnchor, build6789VideoBody, api6789SizeOf, api6789ImageCap, api6789TaskIdOf, api6789StatusOf, api6789VideoUrlOf, api6789ErrorOf, api6789PollState, needs6789MediaHint };
22492
22701
  // 按镜头切段(分段生成本身就是最容易出错的地方):规划器 + 强弱模型分流 + 节点段区间解析
22493
22702
  // 供 scripts/test-segment-plan.mjs 直接断言
22494
- window.__DSH_IC_SEGMENT__ = { planShotSegments, isCutPoint, segmentNeedsHardFrame, videoSegmentOf, shotContinuityPlan };
22703
+ window.__DSH_IC_SEGMENT__ = { planShotSegments, isCutPoint, segmentNeedsHardFrame, videoSegmentOf, shotContinuityPlan, detectCombatScene, shotIsCombat, combatContractAddendum, combatCausalityText, validateCombatGeometry, COMBAT_ACTION_LEXICON };
22495
22704
  window.__DSH_IC_STORYBOARD_PROMPT__ = { buildStoryboardVideoPrompt };
22496
22705
  // 视频请求组装(0.20.2):run 与「请求预览」的单一事实源——
22497
22706
  // assembleVideoRequest(组装+校验门)/ previewVideoInputs(预览轻量 inputs)/ videoRequestContext(决策基座)
@@ -0,0 +1,147 @@
1
+ /**
2
+ * @ninkch/dsh-infinite-canvas — 战斗语义纯函数(宿主侧权威,0.20.5)
3
+ *
4
+ * 与 client.js 里的同名函数**逐字同构**(漂移守卫:scripts/test-combat-semantics.mjs
5
+ * 用 vm 加载真实 client.js,把 window.__DSH_IC_SEGMENT__ 的导出与本模块在同一组
6
+ * fixtures 上断言输出一致——两端漂移 = 按场检测/契约块/因果句口径分叉,测试红必须人工对齐)。
7
+ *
8
+ * 为什么有本文件:canvas_skill_pack(对话侧)在 Host 进程里拼切片,够不着 client.js
9
+ * 的内部函数——按场打斗检测、契约块、词表必须有一份宿主可 import 的权威实现。
10
+ * 零 npm 依赖、零 DOM 依赖,Node 直接跑。
11
+ *
12
+ * 来源:_refs/LucianAIGC-打斗skill-V3.1 的战斗因果状态链(出招→接招→反击→攻守转换)
13
+ * 嫁接到画布 tail→prevTail→衔接块管道;动作词表反哺自 assets/director/engine.js
14
+ * BONE_POSES 打斗段 12 式的关节力学语义。
15
+ * 注入口径(用户定稿):只在真实有打斗的场注入,按场检测 + 三态覆盖,绝不按题材整表灌。
16
+ */
17
+
18
+ /** 打斗动作语义词表:把 3D 导演台 BONE_POSES 打斗段(assets/director/engine.js,12 式)
19
+ * 的关节力学翻译成「可见身体发力词」。id 与 3D 姿势 id 对齐(回归断言两表一致)。 */
20
+ export const COMBAT_ACTION_LEXICON = [
21
+ { id: 'spear_ready', zh: '侧身沉肩、重心压到后腿、双手前后持械', en: 'side-on stance, shoulders sunk, weight on the back leg, weapon held fore-aft' },
22
+ { id: 'spear_thrust', zh: '腰胯先拧、后腿蹬地发力把双手推出、前腿落成弓步', en: 'hips twist first, back leg drives the arms forward, front leg lands in a bow stance' },
23
+ { id: 'palm_block', zh: '单臂斜上架、掌面外翻、上身侧倾把力卸向体侧', en: 'one arm angles up, palm turned out, torso tilts to shed the force sideways' },
24
+ { id: 'dodge_lean', zh: '髋部后坐、上身后仰避开来势、双手收回护身', en: 'hips sit back, upper body leans away from the strike, hands pull in to guard' },
25
+ { id: 'dash_forward', zh: '前腿蹬直、上身前压、双臂前后摆开冲刺', en: 'front leg extends, torso presses forward, arms swing in opposition while dashing' },
26
+ { id: 'grit_advance', zh: '上身前探、双臂收紧、下颌压低逼近', en: 'torso leans in, arms tighten, jaw drops while closing in' },
27
+ { id: 'low_sweep', zh: '深蹲转体、持械手贴地横扫、另一手撑地', en: 'deep-squat pivot, weapon hand sweeps low along the ground, other hand plants on the floor' },
28
+ { id: 'spear_ground', zh: '单膝下沉、持械手直下压、上身俯冲', en: 'one knee sinks, weapon hand drives straight down, torso dives' },
29
+ { id: 'crouch_low', zh: '单膝跪地、上身压到近地、持械手垂落收势', en: 'kneeling, torso pressed near the ground, weapon hand settling low' },
30
+ { id: 'ult_charge', zh: '抬头挺胸、双臂外展上举、重心拔起蓄力', en: 'chest open, both arms spread and raised, weight rising as power gathers' },
31
+ { id: 'hit_recoil', zh: '上身后折、双臂散开、后脚撤半步卸力', en: 'upper body folds back, arms fly open, rear foot steps back to absorb the hit' },
32
+ { id: 'knockdown', zh: '全身放倒、四肢摊开、重心彻底失守', en: 'body laid flat, limbs sprawled, balance fully broken' },
33
+ ];
34
+
35
+ /** 按场打斗检测(纯函数):命中词 = 明确动作谓语;对白行与回忆/讲述语境排除;
36
+ * mode: auto=按文本判定,on=强制开,off=强制关(用户显式覆盖优先于检测)。 */
37
+ export function detectCombatScene(text, opts) {
38
+ const o = opts || {};
39
+ const mode = String(o.mode || o.combatMode || 'auto').toLowerCase();
40
+ if (mode === 'on') return { hit: true, matched: [], mode: 'on' };
41
+ if (mode === 'off') return { hit: false, matched: [], mode: 'off' };
42
+ const t = String(text || '');
43
+ if (!t.trim()) return { hit: false, matched: [], mode: 'auto' };
44
+ const HIT = new RegExp([
45
+ '出招', '过招', '交手', '开打', '对打', '搏杀', '厮杀', '互殴', '挥拳', '出拳', '出腿',
46
+ '肘击', '膝撞', '挥刀', '拔刀', '挥剑', '出剑', '劈', '砍', '斩', '刺出', '突刺', '横扫',
47
+ '扫堂腿', '鞭腿', '摆拳', '勾拳', '直拳', '抡', '格挡', '招架', '挡开', '架开', '闪避',
48
+ '躲开', '闪身', '翻滚', '侧身避开', '击中', '命中', '打中', '一拳', '一掌', '一剑', '一刀',
49
+ '一枪', '受击', '挨打', '被打', '击退', '击飞', '打飞', '撂倒', '打倒', '击倒', '摔倒',
50
+ '摔出', '撞飞', '撞碎', '掀翻', '锁喉', '擒拿', '反关节', '压制', '按倒', '反击', '还击',
51
+ '回击', '追击', '对轰', '火并', '枪战', '交火', '开枪', '射击', '扫射', '暗器', '箭矢',
52
+ '刀光', '剑气', '掌风', '拳风', '破甲', '贯穿', '震飞', '踹', '砸向',
53
+ ].join('|'), 'g');
54
+ const DIALOGUE = /说道|说:|说道:|喊道|念道|心里想|暗想|旁白|字幕|歌词/;
55
+ const PAST = /(曾|当年|想起|回忆|听说|讲述|史料|新闻|棋局|牌局|谈判|演习|训练|梦里|梦中|传说|故事里|电影里)/;
56
+ const lines = t.split(/\n|。|;|;|!|?|!|\?/);
57
+ const matched = [];
58
+ for (const ln of lines) {
59
+ if (!ln || DIALOGUE.test(ln)) continue;
60
+ const ms = ln.match(HIT) || [];
61
+ for (const w of ms) {
62
+ const i = ln.indexOf(w);
63
+ if (PAST.test(ln.slice(Math.max(0, i - 6), i))) continue;
64
+ matched.push(w);
65
+ break;
66
+ }
67
+ if (matched.length >= 6) break;
68
+ }
69
+ return { hit: matched.length > 0, matched, mode: 'auto' };
70
+ }
71
+
72
+ /** 打斗镜判定(纯函数):任一战斗字段非空即为打斗镜。 */
73
+ export function shotIsCombat(s) {
74
+ const sh = s || {};
75
+ return ['attack', 'reaction', 'impact', 'initiative', 'nextCombat'].some((k) => String(sh[k] || '').trim());
76
+ }
77
+
78
+ /** 分镜契约战斗扩展块(纯函数):命中打斗的场才注入。 */
79
+ export function combatContractAddendum(zh) {
80
+ if (!zh) {
81
+ return [
82
+ '',
83
+ '**[COMBAT STORYBOARD - HARD] this script contains real combat. Shots may carry combat fields (all optional; leave them empty on non-combat shots, never invent):**',
84
+ '- **attack**: "attacker -> target, locked body part, trajectory", e.g. "@Li@->@Shen@, locked on chest/shoulder, spear thrust from lower-left to upper-right" - an attack MUST point at a concrete opponent on screen;',
85
+ '- **reaction (required when attack exists)**: the opponent\'s visible block/dodge/hit action - never a statue receiving a blow, never just "blocked it";',
86
+ '- **impact**: contact part, force direction, knockback/imbalance and environmental damage;',
87
+ '- **initiative**: who holds the attack and who turns to counter at the end of this shot;',
88
+ '- **nextCombat**: the next shot\'s combat intent, echoing the tail\'s combat state;',
89
+ '- **tail gains a combat state**: write "picture tail state | combat state: who holds the attack, where the weapon/effect is, the hit party\'s state, damage residue" - cross-shot momentum rides entirely on this;',
90
+ '- **timeBeats on combat shots use attack-defense beats**: strike -> opponent receives/counters -> counter or displacement (each beat a visible body state);',
91
+ '- **action lexicon (visible body force, take directly):** ' + COMBAT_ACTION_LEXICON.map((x) => x.en).join('; ') + ';',
92
+ '- **never**: move names ("Crouching Tiger style"), summary verbs ("releases a skill / launches an attack / energy explodes"), unexplained teleports, glide drifting, statue trading; write visible body-force chains + opponent response + physical results;',
93
+ '- for materialized-technique shots write vfx as a picture that could be a keyframe still; when expanding prefer keyframe-then-video (hard first frame).',
94
+ ];
95
+ }
96
+ return [
97
+ '',
98
+ '**【打斗分镜·战斗因果(本剧本命中打斗,以下为硬规则)】分镜镜头可携带战斗字段(全部可选;非打斗镜一律留空,绝不臆造):**',
99
+ '- **attack(攻击)**:「攻击者→目标,锁定部位,轨迹方向」,如「@李寒@→@沈铁@,锁定胸肩,自左下向右上横枪突刺」——**攻击必须指向画面里的具体对手**,写明轨迹与锁定部位;',
100
+ '- **reaction(对手回应;有 attack 必写)**:对手的可见防御/闪避/受击动作(如「@沈铁@ 单臂斜上架、掌面外翻、上身侧倾卸力」)——**禁止站桩接招、禁止只写「挡下了」**;',
101
+ '- **impact(接触与受力)**:接触部位、受力方向、击退/失衡与环境破坏(如「枪尖擦肩、沈铁后撤半步、身后木栏断裂」);',
102
+ '- **initiative(攻守归属)**:本镜结束时谁持攻、谁转入反击;',
103
+ '- **nextCombat(下一镜战斗意图)**:如「@沈铁@ 借卸力之势低身横扫」——与 tail 的战斗态呼应;',
104
+ '- **tail 追加战斗态**:接点尾态写成「画面尾态|战斗态:攻势在谁、武器/技能位于何处、受击者状态、破坏残留」——**跨镜攻势全靠它传递**;',
105
+ '- **timeBeats 打斗镜用攻防三拍**:出招 → 对手接招/受击 → 反击或位移(每拍写可见身体状态);',
106
+ '- **动作词表(可见身体发力,直接取用)**:' + COMBAT_ACTION_LEXICON.map((x) => x.zh).join(';') + ';',
107
+ '- **禁止**:招式名(「回风落雁式」)、概括词(「释放技能/发动攻击/能量爆炸/华丽连招」)、无因瞬移、滑步漂移、站桩对轰;写**可见的身体发力链 + 对手回应 + 物理结果**;',
108
+ '- 具象化招式镜(能量成形/武器光效)的 vfx 写成可直接出设定图的画面,铺开时优先「先出关键帧设定图 → 图生视频(hard 首帧)」。',
109
+ ];
110
+ }
111
+
112
+ /** 逐镜因果句(纯函数):视频提示词编译时追加到打斗镜。只拼存在的字段;空镜返回 ''。 */
113
+ export function combatCausalityText(s, zh) {
114
+ const sh = s || {};
115
+ if (!shotIsCombat(sh)) return '';
116
+ const g = (k) => String(sh[k] || '').trim();
117
+ const bits = [];
118
+ if (zh) {
119
+ if (g('attack')) bits.push('攻击(必须朝向该对手):' + g('attack'));
120
+ if (g('reaction')) bits.push('对手回应(必须演出):' + g('reaction'));
121
+ if (g('impact')) bits.push('接触与受力:' + g('impact'));
122
+ if (g('initiative')) bits.push('攻守归属:' + g('initiative'));
123
+ if (g('nextCombat')) bits.push('下一镜从该攻势继续:' + g('nextCombat'));
124
+ return bits.length ? '【打斗因果】' + bits.join(';') : '';
125
+ }
126
+ if (g('attack')) bits.push('attack (must point at that opponent): ' + g('attack'));
127
+ if (g('reaction')) bits.push('opponent response (must be performed): ' + g('reaction'));
128
+ if (g('impact')) bits.push('contact & force: ' + g('impact'));
129
+ if (g('initiative')) bits.push('initiative: ' + g('initiative'));
130
+ if (g('nextCombat')) bits.push('next shot continues from this momentum: ' + g('nextCombat'));
131
+ return bits.length ? '[COMBAT CAUSALITY] ' + bits.join('; ') : '';
132
+ }
133
+
134
+ /** 打斗镜几何最小校验(纯函数):机械可判的四条检查,失败产生可见告警,绝不拦截生成。 */
135
+ export function validateCombatGeometry(s, zh) {
136
+ const sh = s || {};
137
+ const out = [];
138
+ const g = (k) => String(sh[k] || '').trim();
139
+ const pre = String(sh.title || '').trim() ? String(sh.title).trim() + ' · ' : '';
140
+ if (!shotIsCombat(sh)) return out;
141
+ if (g('attack') && !g('reaction')) out.push(zh ? pre + '有攻击但无对手回应:每次攻击必须写对手的可见防御/闪避/受击(禁站桩)' : pre + 'attack without reaction: every attack needs a visible response (no statues)');
142
+ if (g('attack') && !/→|@/.test(g('attack'))) out.push(zh ? pre + '攻击未指向具体对手(缺少 @对手名@ 或 →)' : pre + 'attack lacks an explicit target (@name@ or ->)');
143
+ const vis = String(sh.visual || '');
144
+ if (/背对|背面|背影/.test(vis) && /表情|眼神|眼眸|面容|脸上的|嘴角/.test(vis)) out.push(zh ? pre + '可见性矛盾:背对镜头却写了表情/眼神' : pre + 'visibility conflict: back to camera yet describing facial expression');
145
+ if (g('attack') && g('tail') && !/战斗态|combat state/i.test(g('tail'))) out.push(zh ? pre + 'tail 建议补「|战斗态:…」(跨镜攻势靠它传递)' : pre + 'tail should append "| combat state: ..." (cross-shot momentum rides on it)');
146
+ return out;
147
+ }
package/cordis.patch.yml CHANGED
@@ -106,6 +106,11 @@
106
106
  name: '@deepseek-ai/dsh-tool-skill'
107
107
  - id: media-studio-skills
108
108
  name: '@ninkch/dsh-infinite-canvas/skills'
109
+ # 【2026-11-11 修复】本行已永久禁用:主包在 profile bundle 层挂载后,preset 再挂
110
+ # 同包子路径 = 同一物理包重复激活 → media-studio 预设「加载失败」(broken)。
111
+ # director-workshop 技能已改由 bundle 层 registerCanvasSkill 注册(index.js),
112
+ # 本行保留仅为避免旧 profile 补丁残留时的兼容占位,不得重新启用。
113
+ disabled: true
109
114
  config: {}
110
115
  - id: command-goal
111
116
  name: '@deepseek-ai/dsh-command-goal'
@@ -157,8 +162,10 @@
157
162
  config:
158
163
  - id: tool-subagent-control
159
164
  name: '@deepseek-ai/dsh-tool-subagent-control'
160
- - id: tool-subagent-list-agents
161
- name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
165
+ # 【2026-11-11 修复】主入口已统一注册 send_message / interrupt_agent / list_agents
166
+ # 三个工具(0.2.2-rc.1 exports 只有 ./ ),旧的 ./list-agents 子路径行
167
+ # (tool-subagent-list-agents)解析不到模块 → auditRows 报 never started →
168
+ # 整个预设 broken。本注释替代已删除的那一行,勿再添加子路径行。
162
169
  - id: tool-subagent
163
170
  name: '@deepseek-ai/dsh-tool-subagent'
164
171
  config:
package/index.js CHANGED
@@ -2082,6 +2082,11 @@ function nextNodePos(doc, type, connectFromId, size) {
2082
2082
  // canvas-studio=操作硬约束;canvas-craft=剧本/分镜/提示词创作方法论;canvas-layout=节点布局纪律;
2083
2083
  // canvas-director=导演透镜/题材/规格/影调/运镜(创作控制层,按生成能力切片注入)
2084
2084
  const SKILL_NAMES = ['canvas-studio', 'canvas-craft', 'canvas-layout', 'canvas-director'];
2085
+ /** 随包分发的引导技能(skills/<name>/SKILL.md):原由 preset 里 @ninkch/dsh-infinite-canvas/skills
2086
+ * 行挂载——2026-11-11 诊断:主包已在 profile bundle 层挂载,preset 再挂同包子路径 = 同一物理包
2087
+ * 重复激活(老版 dsh-studio-mode 头注释警告的「重复挂载 → 预设加载失败」)→ media-studio
2088
+ * 预设 broken。改为 bundle 层与四件套一起注册,preset 不再需要独立技能行。 */
2089
+ const WORKSHOP_SKILL_NAMES = ['director-workshop'];
2085
2090
  // = @deepseek-ai/dsh-skill 的 BUNDLED_SKILL_RANK(避免 import DSH 包;registry 要求 rank 必须是有限数字)
2086
2091
  const SKILL_RANK = 600;
2087
2092
  /** 解析 SKILL.md 的 YAML frontmatter(仅需 description 与正文)。 */
@@ -2098,6 +2103,7 @@ function registerCanvasSkill(ctx, disposers) {
2098
2103
  const skills = ctx.get('skills');
2099
2104
  if (!skills || typeof skills.registerProvider !== 'function') return false;
2100
2105
  const candidates = [];
2106
+ // 四件套:assets/<name>/SKILL.md
2101
2107
  for (const name of SKILL_NAMES) {
2102
2108
  const assetPath = path.join(HERE, 'assets', name, 'SKILL.md');
2103
2109
  if (!existsSync(assetPath)) continue;
@@ -2114,6 +2120,23 @@ function registerCanvasSkill(ctx, disposers) {
2114
2120
  locator: assetPath,
2115
2121
  });
2116
2122
  }
2123
+ // 导演工作坊:skills/<name>/SKILL.md(原 preset 层挂载,现并入同一 provider;见 WORKSHOP_SKILL_NAMES 注释)
2124
+ for (const name of WORKSHOP_SKILL_NAMES) {
2125
+ const assetPath = path.join(HERE, 'skills', name, 'SKILL.md');
2126
+ if (!existsSync(assetPath)) continue;
2127
+ const { description } = parseSkillMd(readFileSync(assetPath, 'utf8'));
2128
+ if (!description) continue;
2129
+ candidates.push({
2130
+ name,
2131
+ description,
2132
+ invocation: { modelInvocable: true, userInvocable: true },
2133
+ provider: 'dsh-infinite-canvas',
2134
+ source: 'bundled',
2135
+ rank: SKILL_RANK,
2136
+ resourceBase: { kind: 'directory', path: path.dirname(assetPath) },
2137
+ locator: assetPath,
2138
+ });
2139
+ }
2117
2140
  if (!candidates.length) return false;
2118
2141
  const provider = {
2119
2142
  name: 'dsh-infinite-canvas',
@@ -2208,6 +2231,12 @@ function canvasWriteNode(args) {
2208
2231
  camera: String((s && s.camera) || '').trim().slice(0, 200),
2209
2232
  vfx: String((s && s.vfx) || '').trim().slice(0, 160),
2210
2233
  negative: String((s && s.negative) || '').trim().slice(0, 200),
2234
+ // 战斗因果字段(打斗镜专用,全部可选)同规则透传
2235
+ attack: String((s && s.attack) || '').trim().slice(0, 160),
2236
+ reaction: String((s && s.reaction) || '').trim().slice(0, 160),
2237
+ impact: String((s && s.impact) || '').trim().slice(0, 160),
2238
+ initiative: String((s && s.initiative) || '').trim().slice(0, 80),
2239
+ nextCombat: String((s && s.nextCombat) || '').trim().slice(0, 80),
2211
2240
  }));
2212
2241
  node.data.aiStatus = 'idle';
2213
2242
  node.data.aiError = null;
@@ -3046,6 +3075,12 @@ async function canvasNodeStatus(args) {
3046
3075
  camera: String((s && s.camera) || '').slice(0, 200),
3047
3076
  vfx: String((s && s.vfx) || '').slice(0, 160),
3048
3077
  negative: String((s && s.negative) || '').slice(0, 200),
3078
+ // 战斗因果字段(打斗镜专用,全部可选):node_status 必须透出,否则对话侧读回再写回时会丢失
3079
+ attack: String((s && s.attack) || '').slice(0, 160),
3080
+ reaction: String((s && s.reaction) || '').slice(0, 160),
3081
+ impact: String((s && s.impact) || '').slice(0, 160),
3082
+ initiative: String((s && s.initiative) || '').slice(0, 80),
3083
+ nextCombat: String((s && s.nextCombat) || '').slice(0, 80),
3049
3084
  }))
3050
3085
  : undefined;
3051
3086
  const d = n.data || {};
@@ -3093,6 +3128,11 @@ async function canvasNodeStatus(args) {
3093
3128
  resolution: d.resolution || null,
3094
3129
  frameMode: d.frameMode || null,
3095
3130
  count: d.count == null ? null : Number(d.count),
3131
+ // 分镜节点参数(0.20.5 对话侧读面补注册):总时长硬约束与打斗判定三态——
3132
+ // update_node 白名单里有写面、这里必须有读面,否则对话侧读不回、shots 整表替换场景丢语义
3133
+ targetDuration: d.targetDuration == null ? null : Number(d.targetDuration),
3134
+ combatMode: d.combatMode || null,
3135
+ cont: d.cont === false ? false : true,
3096
3136
  imageModel: d.imageModel || null,
3097
3137
  videoModel: d.videoModel || null,
3098
3138
  model: d.model || null,
@@ -3117,7 +3157,7 @@ async function canvasNodeStatus(args) {
3117
3157
  };
3118
3158
  }
3119
3159
  /** 可被 canvas_update_node 修改的节点字段白名单(结构字段 id/type/x/y/w/h/data 一律不可写)。 */
3120
- const NODE_PATCH_FIELDS = ['prompt', 'idea', 'output', 'text', 'script', 'requirement', 'label', 'ratio', 'size', 'duration', 'resolution', 'frameMode', 'count', 'imageModel', 'videoModel', 'model', 'cont'];
3160
+ const NODE_PATCH_FIELDS = ['prompt', 'idea', 'output', 'text', 'script', 'requirement', 'label', 'ratio', 'size', 'duration', 'resolution', 'frameMode', 'count', 'imageModel', 'videoModel', 'model', 'cont', 'targetDuration', 'combatMode'];
3121
3161
  /** 更新已有节点的字段:对话侧"改提示词 / 改参数"的唯一入口(此前只能删节点重建)。 */
3122
3162
  function canvasUpdateNode(args) {
3123
3163
  const pid = String((args && args.projectId) || '');
@@ -3146,6 +3186,14 @@ function canvasUpdateNode(args) {
3146
3186
  v = String(v == null ? '' : v).slice(0, 40);
3147
3187
  } else if (k === 'cont') {
3148
3188
  v = !(v === false || v === 'false' || v === 0 || v === '0'); // 分镜衔接开关:默认开
3189
+ } else if (k === 'targetDuration') {
3190
+ // 分镜总时长(秒,一位小数):0/空 = 自动档(按镜头节奏)。与客户端 setData('targetDuration') 同口径。
3191
+ const num = Math.round(Number(v) * 10) / 10;
3192
+ if (!Number.isFinite(num) || num < 0 || num > 300) throw new Error('targetDuration 需要非负数(0=自动档,上限 300s),收到:' + JSON.stringify(v));
3193
+ v = num || null;
3194
+ } else if (k === 'combatMode') {
3195
+ // 打斗判定三态覆盖:auto=按场检测(缺省)/ on=本场强制按打斗注入 / off=强制不注入
3196
+ v = ['auto', 'on', 'off'].includes(String(v).toLowerCase()) ? String(v).toLowerCase() : 'auto';
3149
3197
  } else {
3150
3198
  v = String(v == null ? '' : v);
3151
3199
  }
@@ -3173,6 +3221,10 @@ function canvasUpdateNode(args) {
3173
3221
  for (const k2 of ['tail', 'cam', 'start', 'seg']) {
3174
3222
  if (!out[k2] && old[k2]) out[k2] = old[k2];
3175
3223
  }
3224
+ // 战斗因果字段同规则兜底:旧镜带战斗态而新值没给时按镜序保留(与衔接字段同款,防整表替换冲掉)
3225
+ for (const k2 of ['attack', 'reaction', 'impact', 'initiative', 'nextCombat']) {
3226
+ if (!String(out[k2] || '').trim() && old[k2]) out[k2] = old[k2];
3227
+ }
3176
3228
  return out;
3177
3229
  });
3178
3230
  n.data.shots = arr;
@@ -5219,7 +5271,7 @@ export function apply(ctx) {
5219
5271
  additionalProperties: false,
5220
5272
  },
5221
5273
  output: {
5222
- schema: { type: 'object', properties: { ok: { type: 'boolean' }, text: { type: 'string' }, type: { type: 'string' }, status: { type: 'string' }, x: { type: 'number' }, y: { type: 'number' }, w: { type: 'number' }, h: { type: 'number' }, assetId: { type: 'string' }, prompt: { type: 'string' }, ratio: { type: 'string' }, size: { type: 'string' }, duration: { type: 'number' }, resolution: { type: 'string' }, frameMode: { type: 'string' }, imageModel: { type: 'string' }, videoModel: { type: 'string' }, genWarn: { type: 'string' }, chainFrom: { type: 'string' }, seam: { type: 'object', properties: { ok: { type: 'boolean' }, sim: { type: 'number' }, thr: { type: 'number' }, note: { type: 'string' } } }, tailPickAssetId: { type: 'string' }, historyAssetIds: { type: 'array', items: { type: 'string' } }, warnings: { type: 'array', items: { type: 'string' } }, shots: { type: 'array', items: { type: 'object', properties: { index: { type: 'number' }, title: { type: 'string' }, duration: { type: 'number' }, visual: { type: 'string' }, motion: { type: 'string' }, tail: { type: 'string' }, cam: { type: 'string' }, start: { type: 'string' }, seg: { type: 'string' }, characters: { type: 'array', items: { type: 'string' } }, scene: { type: 'string' }, props: { type: 'array', items: { type: 'string' } }, timeBeats: { type: 'array', items: { type: 'string' } }, camera: { type: 'string' }, vfx: { type: 'string' }, negative: { type: 'string' } } } } }, required: ['ok', 'text'] },
5274
+ schema: { type: 'object', properties: { ok: { type: 'boolean' }, text: { type: 'string' }, type: { type: 'string' }, status: { type: 'string' }, x: { type: 'number' }, y: { type: 'number' }, w: { type: 'number' }, h: { type: 'number' }, assetId: { type: 'string' }, prompt: { type: 'string' }, ratio: { type: 'string' }, size: { type: 'string' }, duration: { type: 'number' }, resolution: { type: 'string' }, frameMode: { type: 'string' }, imageModel: { type: 'string' }, videoModel: { type: 'string' }, count: { type: 'number' }, targetDuration: { type: 'number', description: '分镜总时长硬约束(秒;缺省 = 自动档)' }, combatMode: { type: 'string', enum: ['auto', 'on', 'off'], description: '打斗判定:auto=按场检测 / on=强制打斗 / off=强制非打斗' }, cont: { type: 'boolean', description: '分镜衔接开关(默认 true)' }, genWarn: { type: 'string' }, chainFrom: { type: 'string' }, seam: { type: 'object', properties: { ok: { type: 'boolean' }, sim: { type: 'number' }, thr: { type: 'number' }, note: { type: 'string' } } }, tailPickAssetId: { type: 'string' }, historyAssetIds: { type: 'array', items: { type: 'string' } }, warnings: { type: 'array', items: { type: 'string' } }, shots: { type: 'array', items: { type: 'object', properties: { index: { type: 'number' }, title: { type: 'string' }, duration: { type: 'number' }, visual: { type: 'string' }, motion: { type: 'string' }, tail: { type: 'string' }, cam: { type: 'string' }, start: { type: 'string' }, seg: { type: 'string' }, characters: { type: 'array', items: { type: 'string' } }, scene: { type: 'string' }, props: { type: 'array', items: { type: 'string' } }, timeBeats: { type: 'array', items: { type: 'string' } }, camera: { type: 'string' }, vfx: { type: 'string' }, negative: { type: 'string' }, attack: { type: 'string' }, reaction: { type: 'string' }, impact: { type: 'string' }, initiative: { type: 'string' }, nextCombat: { type: 'string' } } } } }, required: ['ok', 'text'] },
5223
5275
  render: (args, value) => [{ type: 'text', text: String(value.text || '') }],
5224
5276
  },
5225
5277
  timeoutMs: 30000,
@@ -5263,6 +5315,10 @@ export function apply(ctx) {
5263
5315
  if (s.resolution) params.push('分辨率 ' + s.resolution);
5264
5316
  if (s.frameMode) params.push('衔接 ' + s.frameMode);
5265
5317
  if (s.count != null && s.count > 0) params.push('镜头数 ' + s.count);
5318
+ // 分镜节点参数(对话侧读面):总时长硬约束 / 打斗判定 / 衔接开关
5319
+ if (s.targetDuration != null && s.targetDuration > 0) params.push('总时长硬约束 ' + s.targetDuration + 's');
5320
+ if (s.targetDuration == null) params.push('总时长自动');
5321
+ if (s.combatMode) params.push('打斗判定 ' + s.combatMode);
5266
5322
  if (s.imageModel) params.push('图片模型 ' + s.imageModel);
5267
5323
  if (s.videoModel) params.push('视频模型 ' + s.videoModel);
5268
5324
  if (params.length) lines.push('生成参数: ' + params.join(' · '));
@@ -5278,6 +5334,10 @@ export function apply(ctx) {
5278
5334
  prompt: s.prompt || undefined, ratio: s.ratio || undefined, size: s.size || undefined,
5279
5335
  duration: s.duration == null ? undefined : s.duration, resolution: s.resolution || undefined,
5280
5336
  frameMode: s.frameMode || undefined, imageModel: s.imageModel || undefined, videoModel: s.videoModel || undefined,
5337
+ count: s.count == null ? undefined : s.count,
5338
+ targetDuration: s.targetDuration == null ? undefined : s.targetDuration,
5339
+ combatMode: s.combatMode || undefined,
5340
+ cont: s.cont,
5281
5341
  genWarn: s.genWarn || undefined,
5282
5342
  chainFrom: s.chainFrom || undefined, seam: s.seam || undefined,
5283
5343
  tailPickAssetId: s.tailPickAssetId || undefined,
@@ -5289,7 +5349,7 @@ export function apply(ctx) {
5289
5349
  });
5290
5350
  reg({
5291
5351
  name: 'canvas_update_node',
5292
- description: '修改无限画布上**已有节点**的字段(改提示词、改比例/清晰度/时长/分辨率等参数)——"改节点"的唯一入口,改完不必删节点重建。可改字段:prompt(图片/视频节点的对话框提示词)、idea/output(剧本节点)、text(文本节点的正文)、script/requirement(分镜表的剧本来源与额外要求)、shots(分镜镜头清单,JSON 数组)、label(节点名)、ratio、size、duration、resolution、frameMode、count、imageModel、videoModel、model、cont(分镜表「分镜衔接」开关,默认 true;关掉后拆镜不写衔接字段、视频不自动续帧)。结构字段(id/type/坐标/宽高)不可改。改完用 canvas_generate_node 触发生成。**这是迭代生成的主路径**:用户对某张图/某段视频不满意("重来/换一版/不像")时,改 prompt 后重生成即可,**绝不删掉节点再新建一个**——同一角色/场景/镜的节点永远只有一个,删了重建会丢连线、位置与历史。**前提**:先用 canvas_node_status 读到当前内容,再只传要改的字段。**注意 shots 是整表替换**:只改一镜也要先把 canvas_node_status 返回的全部 shots 取回、改完再整体传回;否则其它镜的 tail/cam/seg 会被冲掉(服务端会按镜序兜底保留,但不要依赖它)。',
5352
+ description: '修改无限画布上**已有节点**的字段(改提示词、改比例/清晰度/时长/分辨率等参数)——"改节点"的唯一入口,改完不必删节点重建。可改字段:prompt(图片/视频节点的对话框提示词)、idea/output(剧本节点)、text(文本节点的正文)、script/requirement(分镜表的剧本来源与额外要求)、shots(分镜镜头清单,JSON 数组)、label(节点名)、ratio、size、duration、resolution、frameMode、count、imageModel、videoModel、model、cont(分镜表「分镜衔接」开关,默认 true;关掉后拆镜不写衔接字段、视频不自动续帧)、targetDuration(分镜**总时长硬约束**秒数,0/不传 = 自动档按镜头节奏;设置后所有镜头 duration 之和严格等于该值)、combatMode(打斗判定三态:auto=按本场剧本自动检测(缺省)/ on=本场强制按打斗注入战斗契约 / off=强制不注入——只影响分镜生成的注入口径)。结构字段(id/type/坐标/宽高)不可改。改完用 canvas_generate_node 触发生成。**这是迭代生成的主路径**:用户对某张图/某段视频不满意("重来/换一版/不像")时,改 prompt 后重生成即可,**绝不删掉节点再新建一个**——同一角色/场景/镜的节点永远只有一个,删了重建会丢连线、位置与历史。**前提**:先用 canvas_node_status 读到当前内容,再只传要改的字段。**注意 shots 是整表替换**:只改一镜也要先把 canvas_node_status 返回的全部 shots 取回、改完再整体传回(含每镜的 tail/cam/start/seg/timeBeats/camera/vfx/negative 与打斗字段 attack/reaction/impact/initiative/nextCombat);否则其它镜的衔接与战斗字段会被冲掉(服务端会按镜序兜底保留,但不要依赖它)。',
5293
5353
  parameters: {
5294
5354
  type: 'object',
5295
5355
  properties: {
@@ -5954,6 +6014,8 @@ export function apply(ctx) {
5954
6014
  genres: { type: 'array', items: { type: 'string' }, description: '可选:临时覆盖题材 id 数组(叙事题材与行业题材都可)' },
5955
6015
  form: { type: 'string', description: '可选:临时覆盖规格 id' },
5956
6016
  look: { type: 'string', description: '可选:临时覆盖影调 id;传空串表示跟随导演' },
6017
+ sceneText: { type: 'string', description: '可选(仅 kind=storyboard 有意义):本场剧本文本——战斗注入按场检测用,命中打斗才带「打斗节奏」卡;不传则不判定、绝不由题材猜测' },
6018
+ combatMode: { type: 'string', enum: ['auto', 'on', 'off'], description: '可选:打斗判定覆盖——auto=按 sceneText 检测(缺省),on=本场强制按打斗注入,off=强制不注入' },
5957
6019
  set: { type: 'boolean', description: '可选:true = 把本次生效的配置写进项目(之后画布自生成也用同一套)' },
5958
6020
  },
5959
6021
  required: ['projectId'],
@@ -5978,7 +6040,10 @@ export function apply(ctx) {
5978
6040
  if (!['script', 'storyboard', 'prompt', 'assets'].includes(kind)) {
5979
6041
  throw new Error('kind 必须是 script / storyboard / prompt / assets,收到:' + kind);
5980
6042
  }
5981
- const built = await buildSkillPack({ kind, profile: merged, hereDir: HERE, zh: true });
6043
+ const built = await buildSkillPack({
6044
+ kind, profile: merged, hereDir: HERE, zh: true,
6045
+ ...(kind === 'storyboard' && args.combatMode !== undefined ? { sceneText: String(args.sceneText || ''), combatMode: String(args.combatMode || 'auto') } : {}),
6046
+ });
5982
6047
  if (args.set) {
5983
6048
  doc.skillProfile = merged;
5984
6049
  doc.skillUpdatedAt = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninkch/dsh-infinite-canvas",
3
- "version": "0.20.4",
3
+ "version": "0.20.5",
4
4
  "description": "无限画布(Infinite Canvas)for DeepSeek Harness:节点式创作工作室(剧本/分镜/生成/成片),内置「媒体创作」预设模式(导演第一视角 + 引导工作坊)。Version-agnostic: reads the live catalog from the installed package at load time.",
5
5
  "keywords": [
6
6
  "dsh",
@@ -57,6 +57,7 @@
57
57
  "skill-pack.js",
58
58
  "skill-pack-loader.js",
59
59
  "index-core-skill-profile.js",
60
+ "combat-semantics.js",
60
61
  "assets/canvas-director/**",
61
62
  "skills.js",
62
63
  "skills/**"
package/skill-pack.js CHANGED
@@ -8,24 +8,19 @@ import {
8
8
  getPackModule, packInventory, readCard, readMove, findEntry, allowedIds, readManifestRaw,
9
9
  } from './skill-pack-loader.js';
10
10
  import { normalizeSkillProfile } from './index-core-skill-profile.js';
11
+ import { detectCombatScene } from './combat-semantics.js';
11
12
 
12
13
  /** moves 永远随 storyboard/prompt 走(运镜是这两类生成的必需品)。 */
13
14
  const MOVES_FOR_KIND = {
14
15
  script: [],
15
- // 分镜要调度动作,运镜必备;打斗节奏卡只在动作/冲突类题材下跟随注入(悬疑/日常等非动作题材
16
- // 带它 = 4.9KB 纯浪费且稀释正文)。提示词只需运镜。
16
+ // 分镜要调度动作,运镜必备;打斗节奏卡只在**按场检测命中打斗**时跟随注入
17
+ // (2026-11 定稿:题材不再参与判定——选了 wuxia 的文戏场不注入,没选动作题材
18
+ // 但剧本明确打斗的场仍注入。combatMode on/off 用户显式覆盖优先于检测)。
17
19
  storyboard: ['camera-moves'],
18
20
  prompt: ['camera-moves'],
19
21
  assets: [],
20
22
  };
21
23
 
22
- /** 动作/冲突强度高的题材 → 分镜链路额外带「打斗节奏」卡(它讲的是打斗/追逐场面的镜头组织)。 */
23
- const FIGHT_RHYTHM_GENRES = new Set([
24
- 'action-mission', 'wuxia', 'gunstandoff', 'adventure', 'crime-police', 'hk-retro',
25
- 'wasteland-chase', 'mo-lei-tau', 'revenge-face-slap', 'multi-thread-caper',
26
- 'neon-dystopia', 'rebirth-transmigration',
27
- ]);
28
-
29
24
  /**
30
25
  * 构建某生成能力下的注入文本。
31
26
  * @param {object} opts
@@ -33,6 +28,9 @@ const FIGHT_RHYTHM_GENRES = new Set([
33
28
  * @param {object} opts.profile 技能配置(已归一或原始,函数内部会再归一)
34
29
  * @param {string} opts.hereDir 插件根目录
35
30
  * @param {boolean} opts.zh 中文
31
+ * @param {string} [opts.sceneText] 本场剧本文本(storyboard + combatMode 给出时才参与打斗判定)
32
+ * @param {string} [opts.combatMode] auto=按 sceneText 检测 / on=强制打斗 / off=强制非打斗;
33
+ * 不传 = 不判定、永不注入 fight-rhythm(老调用方行为不变)
36
34
  * @returns {Promise<{text:string,bytes:number,used:Array,profile:object,inventory:object}>}
37
35
  */
38
36
  export async function buildSkillPack(opts) {
@@ -78,9 +76,11 @@ export async function buildSkillPack(opts) {
78
76
  // 否则四层全空的项目也会被塞进 5KB 运镜词典 —— 违反「未配置不注入」(老项目零变化)。
79
77
  if (items.length) {
80
78
  const moves = [...(MOVES_FOR_KIND[kind] || [])];
81
- // 打斗节奏:仅分镜链路 + 选了动作/冲突类题材时追加(它是打斗场面的镜头组织教材)
82
- if (kind === 'storyboard' && (profile.genres || []).some((g) => FIGHT_RHYTHM_GENRES.has(g))) {
83
- moves.push('fight-rhythm');
79
+ // 打斗节奏:仅分镜链路 + **按场检测命中打斗**(combatMode on=强制开 / off=强制关 /
80
+ // auto=看 sceneText)。对话侧拿不到本场文本时不判定(不臆造)——老调用方行为不变。
81
+ if (kind === 'storyboard' && o.combatMode !== undefined) {
82
+ const c = detectCombatScene(String(o.sceneText || ''), { mode: o.combatMode });
83
+ if (c.hit) moves.push('fight-rhythm');
84
84
  }
85
85
  for (const mid of moves) {
86
86
  const mv = (inv.moves || []).find((x) => x.id === mid);