@ninkch/dsh-infinite-canvas 0.20.0 → 0.20.1

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/client.js CHANGED
@@ -3654,7 +3654,10 @@ body[data-ds-dark-theme] .dshic-pick-item.is-on{background:color-mix(in srgb,var
3654
3654
  for (const p of settings.imageProviders || []) {
3655
3655
  for (const m of (p.models || [])) {
3656
3656
  if (!m || !m.id || !String(m.model || '').trim()) continue;
3657
- out.push({ ref: p.id + '|' + m.id, providerId: p.id, providerName: p.name || p.id, modelId: m.id, model: String(m.model).trim(), baseUrl: p.baseUrl || '', apiKey: p.apiKey || '', extra: p.extra || '', size: p.size || '', responseFormat: p.responseFormat || '', mode: p.mode || 'generations' });
3657
+ // viaImageGen/imageGenProvider 必须透传:生成侧靠它路由到 dsh-image-gen 的 /studio;
3658
+ // 丢字段 → useBridge 判 false → 走 apiImage → baseUrl 空 → 「未配置图片 API」(桥接必炸)
3659
+ const via = !!(p.viaImageGen || m.viaImageGen);
3660
+ out.push({ ref: p.id + '|' + m.id, providerId: p.id, providerName: p.name || p.id, modelId: m.id, model: String(m.model).trim(), baseUrl: p.baseUrl || '', apiKey: p.apiKey || '', extra: p.extra || '', size: p.size || '', responseFormat: p.responseFormat || '', mode: p.mode || 'generations', ...(via ? { viaImageGen: true, imageGenProvider: m.viaImageGen || p.imageGenProvider || '' } : {}) });
3658
3661
  }
3659
3662
  }
3660
3663
  return out;
@@ -14931,6 +14934,13 @@ function queueThumb(assetId) {
14931
14934
  notify();
14932
14935
  }
14933
14936
 
14937
+ /** 动作/冲突强度高的题材 → 分镜链路额外带「打斗节奏」卡(与 Host 侧 skill-pack.js 同一份清单)。 */
14938
+ const FIGHT_RHYTHM_GENRES = new Set([
14939
+ 'action-mission', 'wuxia', 'gunstandoff', 'adventure', 'crime-police', 'hk-retro',
14940
+ 'wasteland-chase', 'mo-lei-tau', 'revenge-face-slap', 'multi-thread-caper',
14941
+ 'neon-dystopia', 'rebirth-transmigration',
14942
+ ]);
14943
+
14934
14944
  /**
14935
14945
  * 组装某生成能力下的注入切片文本。返回 { text, bytes };任一层缺失则跳过。
14936
14946
  * kind = script | storyboard | prompt | assets
@@ -14965,9 +14975,11 @@ function queueThumb(assetId) {
14965
14975
  }
14966
14976
  if (profile.form) await push('form', (manifest.forms || []).find((x) => x.id === profile.form));
14967
14977
  if (profile.look) await push('look', (manifest.looks || []).find((x) => x.id === profile.look));
14968
- // 运镜词典跟着分镜与提示词走;打斗节奏只在分镜(它讲的是镜头组织手法)
14978
+ // 运镜词典跟着分镜与提示词走;打斗节奏只在分镜且选了动作/冲突类题材时注入(它讲的是打斗场面的镜头组织)
14969
14979
  if (kind === 'storyboard' || kind === 'prompt') {
14970
- for (const mid of (kind === 'storyboard' ? ['camera-moves', 'fight-rhythm'] : ['camera-moves'])) {
14980
+ const mids = ['camera-moves'];
14981
+ if (kind === 'storyboard' && (profile.genres || []).some((g) => FIGHT_RHYTHM_GENRES.has(g))) mids.push('fight-rhythm');
14982
+ for (const mid of mids) {
14971
14983
  const mv = (manifest.moves || []).find((x) => x.id === mid);
14972
14984
  if (mv) await push('moves', { ...mv, oneliner: mv.oneliner || '' });
14973
14985
  }
@@ -19864,11 +19876,13 @@ const DIRECTOR_KEY_HELP = [
19864
19876
 
19865
19877
  /** 设定条目 ↔ 资产绑定对话框:从当前项目的资产库里多选图片/音频/视频。 */
19866
19878
  /** 绑定对话框的资产行:组件化以便用 useAssetUrl 显示缩略图。 */
19867
- /** 桥接卡(0.20.0):开关 + 配置状态;开启时把 dsh-image-gen 的模型同步进图片模型下拉(节点直接可选)。 */
19879
+ /** 桥接卡(0.20.0):开关 + 配置状态;开启时把 dsh-image-gen 的模型同步进图片模型下拉(节点直接可选)。
19880
+ * 状态行只反映 image-gen 侧配置状态(与开关解耦);开关只管模型同步。同步无变化不写盘。 */
19868
19881
  function ImageGenBridgeCard() {
19869
19882
  const [st, setSt] = useState({ missing: false, configured: false });
19870
19883
  const [enabled, setEnabled] = useState(!!(loadSettings().imageGen || {}).enabled);
19871
- /** 把 studio describe 的已配置服务商/模型写进 settings.imageProviders 的桥接条目;关闭/未配置时移除。 */
19884
+ /** 把 studio describe 的已配置服务商/模型写进 settings.imageProviders 的桥接条目;关闭/未配置时移除。
19885
+ * 返回 { models, changed }:changed=false 时不写盘(设置页每次挂载都探测,写盘会触发 notify 重渲染)。 */
19872
19886
  const syncBridgeModels = (desc, on) => {
19873
19887
  const s0 = loadSettings();
19874
19888
  const list = (s0.imageProviders || []).filter((p) => p.id !== 'image-gen-bridge');
@@ -19883,23 +19897,24 @@ const DIRECTOR_KEY_HELP = [
19883
19897
  if (models.length) {
19884
19898
  list.unshift({ id: 'image-gen-bridge', name: '桥接dsh-image-gen', baseUrl: '', apiKey: '', viaImageGen: true, models });
19885
19899
  }
19886
- s0.imageProviders = list;
19887
- saveSettings(s0);
19888
- return models.length;
19900
+ const noChange = JSON.stringify(s0.imageProviders || []) === JSON.stringify(list);
19901
+ if (!noChange) { s0.imageProviders = list; saveSettings(s0); }
19902
+ return { models: models.length, changed: !noChange };
19889
19903
  };
19890
19904
  useEffect(() => {
19891
19905
  let alive = true;
19892
19906
  (async () => {
19893
- const on = !!(loadSettings().imageGen || {}).enabled;
19894
19907
  try {
19895
19908
  const r = await fetch('/plugins/dsh-image-gen/studio', { headers: { accept: 'application/json' } });
19896
19909
  if (!r.ok) throw new Error('HTTP ' + r.status);
19897
19910
  const j = await r.json();
19898
19911
  const conf = (j.providers || []).filter((p) => p && p.configured);
19899
- const modelsN = syncBridgeModels(j, on);
19900
- if (alive) setSt({ missing: false, configured: on && conf.length > 0 && modelsN > 0 });
19912
+ const on = !!(loadSettings().imageGen || {}).enabled;
19913
+ syncBridgeModels(j, on);
19914
+ if (alive) setSt({ missing: false, configured: conf.length > 0 });
19901
19915
  } catch {
19902
- syncBridgeModels(null, false);
19916
+ const on = !!(loadSettings().imageGen || {}).enabled;
19917
+ syncBridgeModels(null, on);
19903
19918
  if (alive) setSt({ missing: true, configured: false });
19904
19919
  }
19905
19920
  })();
@@ -19917,8 +19932,8 @@ const DIRECTOR_KEY_HELP = [
19917
19932
  const r = await fetch('/plugins/dsh-image-gen/studio', { headers: { accept: 'application/json' } });
19918
19933
  const j = r.ok ? await r.json() : null;
19919
19934
  const conf = j ? (j.providers || []).filter((p) => p && p.configured) : [];
19920
- const modelsN = syncBridgeModels(j, v && conf.length > 0);
19921
- setSt({ missing: !r.ok, configured: v && conf.length > 0 && modelsN > 0 });
19935
+ syncBridgeModels(j, v && conf.length > 0);
19936
+ setSt({ missing: !r.ok, configured: conf.length > 0 });
19922
19937
  } catch { syncBridgeModels(null, false); setSt({ missing: true, configured: false }); }
19923
19938
  })();
19924
19939
  };
@@ -21932,6 +21947,7 @@ const DIRECTOR_KEY_HELP = [
21932
21947
  // 设置迁移的测试缝隙
21933
21948
  window.__DSH_IC_SETTINGS__ = {
21934
21949
  DEFAULT_SETTINGS, loadSettings, saveSettings,
21950
+ flattenImageModels, resolveImageModelCfg,
21935
21951
  buildExpertContext,
21936
21952
  };
21937
21953
  // 创作上下文注入的测试缝隙(供 scripts/test-skill-inject.mjs 断言)
package/index.js CHANGED
@@ -3859,7 +3859,17 @@ export function apply(ctx) {
3859
3859
  'A案:' + JSON.stringify(pitchA).slice(0, 800) + '\nB案:' + JSON.stringify(pitchB).slice(0, 800), true);
3860
3860
  // ④ 监制决策
3861
3861
  run.phase = 'decide';
3862
- const dec = await autoRoomStep(run, '监制', BASE + '\n你是监制。择一或融合,给出决策与理由,并把世界观/风格/角色/场景/道具写成设定集草案(描述要可生成:年龄/发型/服装/材质/光线)。',
3862
+ // 技能遵循度:监制轮带上项目技能包配置(renderProfile 头),决策/设定集不得与项目技能配置脱节——
3863
+ // 未配置技能包的项目如实说「未配置」,行为不变。
3864
+ let skillLine = '';
3865
+ try {
3866
+ const doc0 = readDoc(pid);
3867
+ const inv0 = packInventory(HERE);
3868
+ const prof0 = normalizeSkillProfile(doc0.skillProfile, allowedIds(inv0));
3869
+ skillLine = '\n【项目技能包配置·决策须与之一致】' + renderProfile(prof0, inv0, true)
3870
+ + '\n题材/影调/规格按上述配置取材;brief 的剧情创意仍优先,配置只约束风格与世界观口径。';
3871
+ } catch { /* 项目文档读不到时跳过(与未配置同等对待) */ }
3872
+ const dec = await autoRoomStep(run, '监制', BASE + skillLine + '\n你是监制。择一或融合,给出决策与理由,并把世界观/风格/角色/场景/道具写成设定集草案(描述要可生成:年龄/发型/服装/材质/光线)。',
3863
3873
  ctxUser + '\nA案:' + JSON.stringify(pitchA).slice(0, 800) + '\nB案:' + JSON.stringify(pitchB).slice(0, 800) + '\n互评:' + JSON.stringify(crit).slice(0, 800) +
3864
3874
  '\n输出 {"decision":"A|B|merge","rationale":"…","logline":"…","beats":["…"],"scriptIdea":"(写给剧本节点的创作提示词,含两条叙事硬约束:每场结尾因果钩子、每场至少一个冲突点)","bible":{"worldview":"…","style":"…","characters":[{"name":"…","desc":"…"}],"scenes":[{"name":"…","desc":"…"}],"props":[{"name":"…","desc":"…"}]}}', true);
3865
3875
  // ⑤ 落盘:讨论记录节点 + 设定集 + 剧本 idea
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninkch/dsh-infinite-canvas",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
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",
package/skill-pack.js CHANGED
@@ -12,12 +12,20 @@ import { normalizeSkillProfile } from './index-core-skill-profile.js';
12
12
  /** moves 永远随 storyboard/prompt 走(运镜是这两类生成的必需品)。 */
13
13
  const MOVES_FOR_KIND = {
14
14
  script: [],
15
- // 分镜要调度动作,运镜 + 打斗节奏两张卡都带;提示词只需运镜。
16
- storyboard: ['camera-moves', 'fight-rhythm'],
15
+ // 分镜要调度动作,运镜必备;打斗节奏卡只在动作/冲突类题材下跟随注入(悬疑/日常等非动作题材
16
+ // 带它 = 4.9KB 纯浪费且稀释正文)。提示词只需运镜。
17
+ storyboard: ['camera-moves'],
17
18
  prompt: ['camera-moves'],
18
19
  assets: [],
19
20
  };
20
21
 
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
+
21
29
  /**
22
30
  * 构建某生成能力下的注入文本。
23
31
  * @param {object} opts
@@ -69,7 +77,12 @@ export async function buildSkillPack(opts) {
69
77
  // 运镜只在「已经有层卡命中」时才跟随注入。
70
78
  // 否则四层全空的项目也会被塞进 5KB 运镜词典 —— 违反「未配置不注入」(老项目零变化)。
71
79
  if (items.length) {
72
- for (const mid of (MOVES_FOR_KIND[kind] || [])) {
80
+ 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');
84
+ }
85
+ for (const mid of moves) {
73
86
  const mv = (inv.moves || []).find((x) => x.id === mid);
74
87
  if (!mv) continue;
75
88
  const md = readMove(hereDir, mv.file);