@ninkch/dsh-infinite-canvas 0.20.3 → 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.
- package/assets/canvas-director/SKILL.md +1 -1
- package/assets/canvas-director/moves/fight-rhythm.md +10 -5
- package/client.js +571 -38
- package/combat-semantics.js +147 -0
- package/cordis.patch.yml +9 -2
- package/index.js +72 -7
- package/package.json +2 -1
- package/production.js +2 -2
- package/shot-segments.js +1 -1
- package/skill-pack.js +12 -12
|
@@ -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
|
-
|
|
161
|
-
|
|
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;
|
|
@@ -4064,7 +4116,7 @@ export function apply(ctx) {
|
|
|
4064
4116
|
const boards = [];
|
|
4065
4117
|
let prevBoard = null;
|
|
4066
4118
|
// 0.20.2 T5 防线②:分镜产出后的场时长校验。切段算法与 client.js 同源(shot-segments.js),
|
|
4067
|
-
// 上限同式取分镜表节点 data.
|
|
4119
|
+
// 上限同式取分镜表节点 data.targetDuration(0.20.3 起下拉即总时长语义;缺省 15,不另立常量)。判据:切段段数 >1
|
|
4068
4120
|
//(该场要拆多次生成才装得下)或任一单镜 duration 超上限 → 场超时长。
|
|
4069
4121
|
const shotDurOf = (s) => Math.max(0.3, Math.round((Number(s && s.duration) || 3) * 10) / 10);
|
|
4070
4122
|
const durCheck = (shots, cap) => {
|
|
@@ -4103,7 +4155,7 @@ export function apply(ctx) {
|
|
|
4103
4155
|
const sbDoc = readToolDoc({ projectId: pid, canvasId: cid });
|
|
4104
4156
|
const sbNode0 = sbDoc.nodes[sb.nodeId];
|
|
4105
4157
|
origReq = String((sbNode0 && sbNode0.data && sbNode0.data.requirement) || '');
|
|
4106
|
-
segMax = Number(sbNode0 && sbNode0.data && sbNode0.data.
|
|
4158
|
+
segMax = Number(sbNode0 && sbNode0.data && sbNode0.data.targetDuration) || 15;
|
|
4107
4159
|
} catch { /* 读不到按空处理 */ }
|
|
4108
4160
|
let sbSt = await canvasExec(pid, cid, sb.nodeId, { timeoutMs: 10 * 60 * 1000 });
|
|
4109
4161
|
let gate = PROD.gateStoryboard(sbSt.shots);
|
|
@@ -4229,7 +4281,7 @@ export function apply(ctx) {
|
|
|
4229
4281
|
const sb = boards[i];
|
|
4230
4282
|
run.paidPhase = 'video ' + (i + 1) + '/' + boards.length;
|
|
4231
4283
|
const shots = Array.isArray(sb.data && sb.data.shots) ? sb.data.shots : [];
|
|
4232
|
-
const segMax = Number(sb.data && sb.data.
|
|
4284
|
+
const segMax = Number(sb.data && sb.data.targetDuration) || 15;
|
|
4233
4285
|
const plan = planShotSegments(shots, { maxSeconds: segMax });
|
|
4234
4286
|
// 客户端兜底同款(production.quote 同式):切段为空但表里有镜头 → 整表按一段
|
|
4235
4287
|
const segs = plan.segments.length ? plan.segments
|
|
@@ -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
|
|
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({
|
|
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.
|
|
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/production.js
CHANGED
|
@@ -238,7 +238,7 @@ export function createProduction(deps) {
|
|
|
238
238
|
* 角色/场景/道具 实体数),顶层 refImagesTotal;跨场共享实体只计一次(与执行侧
|
|
239
239
|
* run 级 Map 同序先到先得,归属第一场)。已有参考资产(readAssetIndexNames 边界匹配)的不计。
|
|
240
240
|
* 切段口径与客户端执行完全同源:同一个 planShotSegments(shot-segments.js,client.js 的逐字移植),
|
|
241
|
-
* maxSeconds 同样取分镜表节点 data.
|
|
241
|
+
* maxSeconds 同样取分镜表节点 data.targetDuration(0.20.3 起下拉即总时长语义;缺省 15,client.js StoryboardNodeBody 同式)。
|
|
242
242
|
* 单价由调用方传入(画布设置里的单价,未配置则不给金额,只给调用次数与秒数)。
|
|
243
243
|
*/
|
|
244
244
|
function quote(pid, cid, unitPricePerSecond) {
|
|
@@ -258,7 +258,7 @@ export function createProduction(deps) {
|
|
|
258
258
|
const secs = shots.reduce((a, s) => a + (Number(s && s.duration) || 0), 0);
|
|
259
259
|
totalSeconds += secs;
|
|
260
260
|
const hasVideo = videoNodes.some((v) => (doc.edges || []).some((e) => e.fromNode === n.id && e.toNode === v.id));
|
|
261
|
-
const maxSeconds = Number(n.data.
|
|
261
|
+
const maxSeconds = Number(n.data.targetDuration) || 15;
|
|
262
262
|
// 已有视频的表不产生新调用;待生成的表按切段算法数段(与客户端 expandStoryboard 同式同默认)
|
|
263
263
|
let calls = 0;
|
|
264
264
|
let refImages = 0;
|
package/shot-segments.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - planShotSegments ← client.js L4389-4514
|
|
9
9
|
*
|
|
10
10
|
* 为什么必须逐字:真实视频调用次数由客户端切段决定(client.js expandStoryboard /
|
|
11
|
-
* StoryboardNodeBody 都以 `planShotSegments(shots, { maxSeconds: Number(n.data.
|
|
11
|
+
* StoryboardNodeBody 都以 `planShotSegments(shots, { maxSeconds: Number(n.data.targetDuration) || 15 })`
|
|
12
12
|
* 的结果为准——一个分镜表 ≠ 一次生成)。宿主预算单(production.js quote)按这里的输出
|
|
13
13
|
* 估算 videoCalls;任何语义简化都会让预算再次失真(#8:显示 4 次、实际 14 次)。
|
|
14
14
|
*
|
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
|
-
//
|
|
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
|
-
|
|
83
|
-
|
|
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);
|