@ninkch/dsh-infinite-canvas 0.19.16 → 0.19.17

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.
Files changed (3) hide show
  1. package/client.js +288 -92
  2. package/index.js +129 -18
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -1157,6 +1157,12 @@ function revealCanvasInRight() {
1157
1157
  'updateInstalledHint': '重启 Harness 后生效(网页部分刷新页面即可)',
1158
1158
  'updateFailGuide': '自动安装未成功,请在 DSH 插件管理 中升级',
1159
1159
  'updatePolicySkipped': '(已按你的点击跳过 24 小时新版本冷却期)',
1160
+ 'updateSrcTitle': '更新源',
1161
+ 'updateSrcAuto': '自动检测',
1162
+ 'updateSrcOfficial': 'npm 官方源',
1163
+ 'updateSrcChina': '中国大陆镜像源',
1164
+ 'updateSrcNow': '当前源',
1165
+ 'updateSrcSet': '更新源已切换',
1160
1166
  'dataRootLabel': '数据根目录',
1161
1167
  'dataRootPlaceholder': '如 D:\\canvas-data',
1162
1168
  'dataRootHint': '资产与视频按项目落盘到该目录(不再占用 C 盘 IndexedDB)。留空 = 浏览器 IndexedDB。',
@@ -2087,6 +2093,12 @@ function revealCanvasInRight() {
2087
2093
  'updateInstalledHint': 'restart Harness to take effect (refresh the page for the web part)',
2088
2094
  'updateFailGuide': 'Auto-install failed — please upgrade via the DSH Plugin Manager',
2089
2095
  'updatePolicySkipped': '(skipped the 24-hour release cool-down at your click)',
2096
+ 'updateSrcTitle': 'Update source',
2097
+ 'updateSrcAuto': 'Auto-detect',
2098
+ 'updateSrcOfficial': 'npm official',
2099
+ 'updateSrcChina': 'China mainland mirror',
2100
+ 'updateSrcNow': 'Active source',
2101
+ 'updateSrcSet': 'Update source changed',
2090
2102
  'dataRootLabel': 'Data root',
2091
2103
  'dataRootPlaceholder': 'e.g. D:\\canvas-data',
2092
2104
  'dataRootHint': 'Assets and videos are stored per project under this folder (no more C: IndexedDB). Empty = browser IndexedDB.',
@@ -2757,6 +2769,8 @@ body[data-ds-dark-theme] .dshic-inline-input{border-color:var(--dsw-alias-border
2757
2769
  .dshic-edge.kind-image{stroke:var(--dsw-alias-brand-primary);}
2758
2770
  .dshic-edge.kind-video{stroke:var(--dsw-alias-state-success-primary);}
2759
2771
  .dshic-edge.is-selected{stroke-width:3.5;filter:drop-shadow(0 0 3px color-mix(in srgb,var(--dsw-alias-brand-primary) 60%,transparent));}
2772
+ /* 选中节点的连线高亮:亮绿 + 双层外发光(固定高对比色,选中态不随主题变化) */
2773
+ .dshic-edge.is-node-linked{stroke:#2fe08a;stroke-width:2.6;filter:drop-shadow(0 0 3px rgba(47,224,138,.95)) drop-shadow(0 0 9px rgba(47,224,138,.5));}
2760
2774
  .dshic-edge-hit{fill:none;stroke:transparent;stroke-width:14;pointer-events:stroke;cursor:pointer;}
2761
2775
  .dshic-edge-temp{fill:none;stroke:var(--dsw-alias-label-secondary);stroke-width:2;stroke-dasharray:6 5;pointer-events:none;}
2762
2776
  /* ── 节点卡片(原型 .node):圆角 14 / 1px --line2 边框 / 柔和投影 ── */
@@ -3725,7 +3739,7 @@ body[data-ds-dark-theme] .dshic-pick-item.is-on{background:color-mix(in srgb,var
3725
3739
  // ============================================================
3726
3740
  const LS_BIBLE = 'dsh-ic:bible:';
3727
3741
  const LS_BIBLE_SYNC = 'dsh-ic:biblesync:';
3728
- function emptyBible() { return { worldview: '', style: '', characters: [], scenes: [], props: [] }; }
3742
+ function emptyBible() { return { worldview: '', style: '', styleAnchor: '', characters: [], scenes: [], props: [] }; }
3729
3743
  function loadBible(pid) {
3730
3744
  if (!pid) return emptyBible();
3731
3745
  const b = lsGet(LS_BIBLE + pid, null);
@@ -3733,6 +3747,7 @@ body[data-ds-dark-theme] .dshic-pick-item.is-on{background:color-mix(in srgb,var
3733
3747
  return {
3734
3748
  worldview: b.worldview || '',
3735
3749
  style: b.style || '',
3750
+ styleAnchor: b.styleAnchor || '',
3736
3751
  characters: Array.isArray(b.characters) ? b.characters : [],
3737
3752
  scenes: Array.isArray(b.scenes) ? b.scenes : [],
3738
3753
  props: Array.isArray(b.props) ? b.props : [],
@@ -3929,7 +3944,7 @@ body[data-ds-dark-theme] .dshic-pick-item.is-on{background:color-mix(in srgb,var
3929
3944
  return `${entityLabelOf(e.kind)} ${e.name}:${desc}${voiceLine}`;
3930
3945
  });
3931
3946
  return [
3932
- (bible.style || '').trim() ? (zh ? '风格:' : 'Style: ') + bible.style.trim() : '',
3947
+ bibleStyleAnchor(bible) ? (zh ? '风格:' : 'Style: ') + bibleStyleAnchor(bible) : '',
3933
3948
  bind ? (zh ? '参考图 → ' : 'Refs -> ') + bind : '',
3934
3949
  stripMentionMarks(prompt),
3935
3950
  entLines.length ? (zh ? '设定集:' : 'Series bible: ') + entLines.join(';') : '',
@@ -3975,6 +3990,17 @@ body[data-ds-dark-theme] .dshic-pick-item.is-on{background:color-mix(in srgb,var
3975
3990
  return [].concat(b.characters || [], b.scenes || [], b.props || [])
3976
3991
  .map((x) => (x && x.name ? String(x.name).trim() : '')).filter(Boolean);
3977
3992
  }
3993
+ /** 设定集风格锚(一句话,全片视觉总锚):优先 styleAnchor 字段(AI 更新设定集时同步产出),
3994
+ * 缺省取 style 第一句(按句末标点语义分句,整句保留,绝不字数截断)。
3995
+ * 分工:style 全文进剧本/分镜 LLM 消化成逐镜色调;图片/视频请求只带锚。 */
3996
+ function bibleStyleAnchor(bible) {
3997
+ const raw = String((bible && (bible.styleAnchor || bible.style_anchor)) || '').trim();
3998
+ if (raw) return raw;
3999
+ const style = String((bible && bible.style) || '').trim();
4000
+ if (!style) return '';
4001
+ const m = /^[^。;!?.!?]*[。;!?.!?]?/.exec(style);
4002
+ return (m && m[0].trim()) || style;
4003
+ }
3978
4004
 
3979
4005
  // ---------- 分镜衔接(续帧接力 / 段落调度 / 接缝校验)----------
3980
4006
  // 为什么需要它:每段视频是**独立采样**的,模型不知道上一段最后发生了什么。分镜只写"本镜拍什么"、
@@ -4553,7 +4579,7 @@ body[data-ds-dark-theme] .dshic-pick-item.is-on{background:color-mix(in srgb,var
4553
4579
  });
4554
4580
  // ④ 逐镜描述(画面 + 运镜 + 台词 + 音效)
4555
4581
  outs.push('detailed_description:');
4556
- const style = String((bible && bible.style) || '').trim();
4582
+ const style = bibleStyleAnchor(bible);
4557
4583
  if (style) outs.push((zh ? '风格:' : 'Style: ') + style);
4558
4584
  const hasDialogue = list.some((s) => (s.dialogue || []).some((d) => String((d && d.line) || '').trim()));
4559
4585
  if (hasDialogue) {
@@ -4649,7 +4675,7 @@ body[data-ds-dark-theme] .dshic-pick-item.is-on{background:color-mix(in srgb,var
4649
4675
  const seg = ap ? ap[1] : raw.replace(/声音[::][^。;\n]*/g, '').trim();
4650
4676
  return seg.replace(/\s+/g, ' ').trim();
4651
4677
  })();
4652
- const style = String((bible && bible.style) || '').trim() || (zh ? '写实电影感' : 'realistic cinematic');
4678
+ const style = bibleStyleAnchor(bible) || (zh ? '写实电影感' : 'realistic cinematic');
4653
4679
  const lookLine = look ? look : (zh ? '(设定集未提供外观描述:按名称与常识绘制,保持朴素克制)' : '(no appearance notes in the bible: keep it plain and coherent)');
4654
4680
  if (kind === 'scene') {
4655
4681
  return zh
@@ -6220,6 +6246,7 @@ function queueThumb(assetId) {
6220
6246
  seedance: { label: '火山方舟 · Seedance(豆包视频)', base: 'https://ark.cn-beijing.volces.com/api/v3/contents/generations/tasks', keyPh: 'ARK API Key', note: 'Base URL 填方舟提交端点或 /api/v3 均可;模型 id 如 doubao-seedance-2-0-260128' },
6221
6247
  kling: { label: '快手可灵 Kling', base: 'https://api.klingai.com', keyPh: 'AK:SK(冒号分隔)', note: 'Key 填 AK:SK,代码自动签 JWT;国际站把 Base URL 改为 api-singapore.klingai.com;时长按官方 5/10s 取整' },
6222
6248
  wan: { label: '阿里通义万相 Wan(DashScope)', base: 'https://dashscope.aliyuncs.com', note: '异步任务制;国际站把 Base URL 改为 dashscope-intl.aliyuncs.com;图生视频走 img_url' },
6249
+ sanbao: { label: '三宝影像工坊(Sanbao 多参考)', base: 'https://sanbaobeauty.com', keyPh: 'sk-sanbao-…', note: '任务制 /openapi/v1/videos;本地素材 dataURL 直传(全模型 media_inputs 含 data_url,已实测);报图片格式错误自动用扩展参数 {"uploadKey":"sk-sanbao-…"} 指定的专用 key 上传 /openapi/v1/uploads/raw 转公网 URL 后重试一次;resolution 小写(480p/720p/1080p/2k);reference 固定 all(可扩展参数覆盖);参考图上限按模型:wan/kling 系 10、hailuo/SD2.0 系 9、SD2.5 系 30,音频 3–10' },
6223
6250
  minimax: { label: 'MiniMax 海螺视频(V1 协议)', base: 'https://api.minimaxi.com', note: '异步任务制;时长按官方 6/10s 取整;首帧图支持 base64' },
6224
6251
  minimaxv2: { label: 'MiniMax H3 · V2 协议(优云智算 / 官方)', base: 'https://cp.compshare.cn', keyPh: 'sk-ml-…', note: 'V2 协议自动适配:优云智算走 /minimax/v2,官方(api.minimax.io/.cn)走 /v2;content[] 多模态(首帧/尾帧/参考图≤9/视频≤3/音频≤3),原生音频,分辨率 480P/768P/1080P/2K/4K(大小写敏感),时长 4-30s;use_context_ir / mute_audio 等走扩展参数' },
6225
6252
  vidu: { label: '生数科技 Vidu', base: 'https://api.vidu.com', note: '图片支持 base64;时长按官方 4/8s 取整' },
@@ -6304,6 +6331,84 @@ function queueThumb(assetId) {
6304
6331
  if (WAN_STATUS_FAIL.includes(st)) return { state: 'fail', error: wanErrorOf(j) || st };
6305
6332
  return { state: 'wait' }; // unknown/pending/running 及一切未知状态 = 继续轮询
6306
6333
  }
6334
+ // —— 三宝影像工坊(Sanbao):任务制多参考(/openapi/v1/videos)——
6335
+ /** 三宝视频请求体(纯函数供回归断言):本地素材 dataURL 直传(全模型 media_inputs 含 data_url,
6336
+ * 2026-10-31 实测格式校验通过)。首帧+参考图同传时首帧降级为首张参考图(沿用全站互斥口径);
6337
+ * 参考音频走 audios[{tag,url}];reference 固定 all(多参考全能模式,可扩展参数覆盖)。
6338
+ * frameDataUrl/refDataUrls 取值 dataURL 或公网 URL 皆可——上传兜底重试共用同一构造器。 */
6339
+ function buildSanbaoVideoBody(base, media) {
6340
+ const b = base || {};
6341
+ const m = media || {};
6342
+ const frame = String(m.frameDataUrl || '');
6343
+ const refs = (Array.isArray(m.refDataUrls) ? m.refDataUrls : []).map(String).filter(Boolean);
6344
+ const audios = (Array.isArray(m.audioDataUrls) ? m.audioDataUrls : []).map(String).filter(Boolean);
6345
+ const out = {
6346
+ model: String(b.model || ''),
6347
+ prompt: String(b.prompt || ''),
6348
+ ratio: String(b.ratio || '16:9'),
6349
+ resolution: String(b.resolution || '720p').toLowerCase(), // 模型表枚举是小写:480p/720p/1080p/2k
6350
+ duration: Math.round(Number(b.duration)) || 5,
6351
+ reference: 'all',
6352
+ };
6353
+ const images = (frame ? [frame] : []).concat(refs);
6354
+ if (images.length) out.images = images;
6355
+ if (audios.length) out.audios = audios.map((url, i) => ({ tag: '音频' + (i + 1), url }));
6356
+ return out;
6357
+ }
6358
+ /** 三宝任务 id:查询响应包在 data 里(data.id),创建响应顶层 id 兼容。 */
6359
+ function sanbaoTaskIdOf(j) {
6360
+ if (!j || typeof j !== 'object') return null;
6361
+ const d = (j.data && typeof j.data === 'object') ? j.data : null;
6362
+ return (d && (d.id || d.task_id)) || j.id || j.task_id || null;
6363
+ }
6364
+ function sanbaoStatusOf(j) {
6365
+ if (!j || typeof j !== 'object') return '';
6366
+ const d = (j.data && typeof j.data === 'object') ? j.data : null;
6367
+ return String((d && (d.status ?? d.task_status)) ?? j.status ?? '').trim().toLowerCase();
6368
+ }
6369
+ function sanbaoVideoUrlOf(j) {
6370
+ if (!j || typeof j !== 'object') return '';
6371
+ const d = (j.data && typeof j.data === 'object') ? j.data : null;
6372
+ return [d && (d.video_url || d.download_url || d.url), j.video_url, j.download_url]
6373
+ .find((u) => typeof u === 'string' && /^https?:/.test(u)) || '';
6374
+ }
6375
+ function sanbaoErrorOf(j) {
6376
+ const d = (j && j.data && typeof j.data === 'object') ? j.data : null;
6377
+ return String((d && d.error) || (j && j.error) || '');
6378
+ }
6379
+ /** 三宝轮询判定:queued/processing 及未知状态 = 继续;succeeded → video_url/download_url;failed → error。 */
6380
+ function sanbaoPollState(j) {
6381
+ const st = sanbaoStatusOf(j);
6382
+ if (st === 'succeeded') {
6383
+ const url = sanbaoVideoUrlOf(j);
6384
+ return url ? { state: 'done', url } : { state: 'fail', error: '成功但无视频地址' };
6385
+ }
6386
+ if (st === 'failed') return { state: 'fail', error: sanbaoErrorOf(j) || st };
6387
+ return { state: 'wait' };
6388
+ }
6389
+ /** 三宝图片字段兜底触发:只认「图片/素材/格式/URL」类错误。
6390
+ * 余额(402/余额不足/credits)、鉴权(401/api key)、限流(429/频繁)、账号限制(403)绝不重试。 */
6391
+ function needsSanbaoMediaRetry(errText) {
6392
+ const t = String(errText || '');
6393
+ if (!t) return false;
6394
+ if (/余额不足|积分不足|insufficient_credits|api\s*key|unauthorized|forbidden|请求过于频繁|rate\s*limit|401|402|403|429/i.test(t)) return false;
6395
+ return /图片|图像|image|素材|格式|url|链接/i.test(t);
6396
+ }
6397
+ /** 三宝素材上传(原始二进制体,非 multipart):返回 file.url 公网地址。
6398
+ * 用专用 uploadKey(扩展参数指定,缺省回退主 key);fetchViaProxy 的 bodyRaw 直传 Blob。 */
6399
+ async function sanbaoUploadRaw(base, uploadKey, blob, kind) {
6400
+ const type = (blob && blob.type) || (kind === 'audio' ? 'audio/mpeg' : kind === 'video' ? 'video/mp4' : 'image/jpeg');
6401
+ const ext = String(type.split('/')[1] || 'bin').replace(/[^a-z0-9]/gi, '') || 'bin';
6402
+ const r = await fetchViaProxy(base + '/openapi/v1/uploads/raw?kind=' + kind + '&fileName=ref.' + ext, {
6403
+ headers: { 'Content-Type': type, Authorization: 'Bearer ' + (uploadKey || '') },
6404
+ bodyRaw: blob, bodyContentType: type, timeoutMs: 120000, label: 'Sanbao 素材上传',
6405
+ });
6406
+ if (!r.ok) throw new Error('Sanbao 素材上传 HTTP ' + r.status + ':' + String(r.text || '').slice(0, 200));
6407
+ let j = null; try { j = JSON.parse(r.text); } catch { throw new Error('Sanbao 素材上传响应非 JSON:' + String(r.text || '').slice(0, 200)); }
6408
+ const url = j && j.file && j.file.url;
6409
+ if (!/^https?:/.test(String(url || ''))) throw new Error('Sanbao 素材上传未返回 file.url');
6410
+ return url;
6411
+ }
6307
6412
  /** 读取生成视频的真实尺寸与时长(用于「厂商是否忽略了参数」的可见校验)。 */
6308
6413
  function probeVideoMeta(blob) {
6309
6414
  return new Promise((resolve) => {
@@ -6343,6 +6448,7 @@ function queueThumb(assetId) {
6343
6448
  // URL 特征兜底:URL 也是用户显式配置的一部分(旧配置 vendor 字段为空时走这里,
6344
6449
  // 设置卡片渲染时会按此回填 vendor,之后恒走显式值)。
6345
6450
  if (url.includes('dashscope')) return 'wan';
6451
+ if (url.includes('sanbaobeauty')) return 'sanbao';
6346
6452
  if (url.includes('klingai')) return 'kling';
6347
6453
  if (url.includes('minimax')) return 'minimax';
6348
6454
  if (url.includes('vidu')) return 'vidu';
@@ -6476,6 +6582,62 @@ function queueThumb(assetId) {
6476
6582
  });
6477
6583
  return await downloadVideo(url, {});
6478
6584
  },
6585
+ // —— 三宝影像工坊 Sanbao:任务制多参考(/openapi/v1/videos),本地图 dataURL 直传,格式错误自动上传转 URL 重试 ——
6586
+ async sanbao(prompt, frameBlob, s, o) {
6587
+ const base = vendorBase(s.url, VIDEO_VENDORS.sanbao.base);
6588
+ const headers = { 'Content-Type': 'application/json', Authorization: 'Bearer ' + (s.apiKey || '') };
6589
+ const rawRefs = o.hardFrame ? [] : (o.refs || []).slice(0, 9);
6590
+ let text = prompt;
6591
+ if (frameBlob && rawRefs.length) text = videoRefNote(o.refNames) + '\n' + prompt;
6592
+ const baseSpec = { model: s.model || '', prompt: text, ratio: o.ratio, resolution: o.resolution || '720p', duration: o.duration };
6593
+ // 第一发:本地素材 dataURL 直传(全模型 media_inputs 含 data_url,2026-10-31 实测格式校验通过)
6594
+ const body = buildSanbaoVideoBody(baseSpec, {
6595
+ frameDataUrl: frameBlob ? await blobToDataUrlScaled(frameBlob) : '',
6596
+ refDataUrls: await Promise.all(rawRefs.map((b) => blobToDataUrlScaled(b))),
6597
+ audioDataUrls: await Promise.all((o.audioRefs || []).slice(0, 3).map((b) => blobToDataUrl(b))),
6598
+ });
6599
+ // 扩展参数:逃生舱;uploadKey 专用上传 key 只用于 /uploads/raw,绝不进任务请求体
6600
+ let uploadKey = s.apiKey || '';
6601
+ try {
6602
+ const ex = parseExtraParams(s.extra);
6603
+ if (ex) {
6604
+ if (ex.uploadKey) uploadKey = String(ex.uploadKey);
6605
+ const rest = { ...ex }; delete rest.uploadKey;
6606
+ Object.assign(body, rest);
6607
+ }
6608
+ } catch (e) { throw new Error('三宝扩展参数配置有误:' + ((e && e.message) || e)); }
6609
+ const submit = (b, label) => fetchViaProxy(base + '/openapi/v1/videos', { headers, body: b, timeoutMs: 120000, label });
6610
+ let r1 = await submit(body, 'Sanbao 提交');
6611
+ // 兜底:图片/素材格式或 URL 类错误 → 用专用 uploadKey 把本地素材传 /uploads/raw 转公网 URL 后重试一次
6612
+ // (余额/鉴权/限流/账号限制类错误绝不重试——needsSanbaoMediaRetry 排除)
6613
+ if (!r1.ok && needsSanbaoMediaRetry(r1.text) && (frameBlob || rawRefs.length || (o.audioRefs || []).length)) {
6614
+ try {
6615
+ const frameUrl = frameBlob ? await sanbaoUploadRaw(base, uploadKey, frameBlob, 'image') : '';
6616
+ const refUrls = [];
6617
+ for (const b of rawRefs) refUrls.push(await sanbaoUploadRaw(base, uploadKey, b, 'image'));
6618
+ const audioUrls = [];
6619
+ for (const b of (o.audioRefs || []).slice(0, 3)) audioUrls.push(await sanbaoUploadRaw(base, uploadKey, b, 'audio'));
6620
+ const body2 = buildSanbaoVideoBody(baseSpec, { frameDataUrl: frameUrl, refDataUrls: refUrls, audioDataUrls: audioUrls });
6621
+ const ex2 = parseExtraParams(s.extra);
6622
+ if (ex2) { const rest2 = { ...ex2 }; delete rest2.uploadKey; Object.assign(body2, rest2); }
6623
+ r1 = await submit(body2, 'Sanbao 提交(素材转URL重试)');
6624
+ } catch (e) {
6625
+ throw new Error('Sanbao 提交 HTTP ' + r1.status + ':' + r1.text.slice(0, 200) + ';[素材上传重试] ' + ((e && e.message) || e));
6626
+ }
6627
+ }
6628
+ if (!r1.ok) throw new Error('Sanbao 提交 HTTP ' + r1.status + ' @ ' + base + ':' + r1.text.slice(0, 300));
6629
+ let j1 = null; try { j1 = JSON.parse(r1.text); } catch { throw new Error('Sanbao 响应非 JSON:' + r1.text.slice(0, 200)); }
6630
+ const tid = sanbaoTaskIdOf(j1);
6631
+ if (!tid) throw new Error('Sanbao 响应中没有任务 id:' + r1.text.slice(0, 200));
6632
+ if (o.onTask) { try { o.onTask(tid, base + '/openapi/v1/videos/' + encodeURIComponent(tid)); } catch { /* 持久化失败不影响生成 */ } }
6633
+ const url = await vendorPoll('Sanbao', 8000, async () => {
6634
+ const r = await fetchViaProxy(base + '/openapi/v1/videos/' + encodeURIComponent(tid), { method: 'GET', headers: { Authorization: 'Bearer ' + (s.apiKey || '') }, timeoutMs: 60000, label: 'Sanbao 查询' });
6635
+ if (!r || !r.ok) return { state: 'wait' };
6636
+ let j = null; try { j = JSON.parse(r.text); } catch { return { state: 'wait' }; }
6637
+ return sanbaoPollState(j);
6638
+ });
6639
+ return await downloadVideo(url, {});
6640
+ },
6479
6641
  // —— MiniMax 海螺:异步 task_id + query 接口 ——
6480
6642
  async minimax(prompt, frameBlob, s, o) {
6481
6643
  const base = vendorBase(s.url, VIDEO_VENDORS.minimax.base);
@@ -6766,6 +6928,8 @@ function queueThumb(assetId) {
6766
6928
  * 超出上限会被截断——必须显式告警(o.warn → 节点 genWarn),绝不静默丢素材。 */
6767
6929
  const VIDEO_REF_CAPS = {
6768
6930
  wan: { img: 10 },
6931
+ // 三宝:按最保守通用模型(hailuo/SD2.0 系 9 图 3 音频;wan/kling 系 10 图、SD2.5 系 30 图,见厂商 note)
6932
+ sanbao: { img: 9, audio: 3 },
6769
6933
  minimaxv2: { img: 9, audio: 3 },
6770
6934
  openai: { img: 8 },
6771
6935
  seedance: { img: 8 },
@@ -7918,6 +8082,23 @@ function queueThumb(assetId) {
7918
8082
  // 有新版本 → 横幅 + "去升级";点击后由 Host 在所属 profile 内
7919
8083
  // pnpm add 精确版本(绝不自动重启/刷新);旧 Host / 开发态 / 失败 → 回退为纯引导
7920
8084
  // ============================================================
8085
+ /** 从 Host 读取更新源配置(覆盖值 + 自动探测结果;旧 Host 无此 RPC → 静默隐藏选择器)。 */
8086
+ async function fetchUpdateRegistry() {
8087
+ try {
8088
+ const r = await hostRpc('updateGetRegistry');
8089
+ update((s) => { s.updateRegistry = r.override || 'auto'; s.updateRegistryResolved = r.resolved || null; });
8090
+ } catch { /* 旧 Host:radio 仍显示,仅无当前源展示 */ }
8091
+ }
8092
+ /** 切换更新源(auto=按网络环境自动探测;official/china=手动覆盖)。写 Host config 并回读生效源。 */
8093
+ async function setUpdateSource(val) {
8094
+ update((s) => { s.updateRegistry = val; });
8095
+ try {
8096
+ const r = await hostRpc('updateSetRegistry', { override: val });
8097
+ update((s) => { s.updateRegistry = r.override || val; s.updateRegistryResolved = r.resolved || null; });
8098
+ toast(T('updateSrcSet') + (r.resolved ? ':' + (r.resolved === 'china' ? T('updateSrcChina') : T('updateSrcOfficial')) : ''));
8099
+ } catch { /* 旧 Host 无此 RPC:UI 状态已记录,仅生效源未知 */ }
8100
+ }
8101
+ const srcLabel = (kind) => (kind === 'china' ? T('updateSrcChina') : kind === 'official' ? T('updateSrcOfficial') : T('updateSrcAuto'));
7921
8102
  async function checkUpdate(silent) {
7922
8103
  update((s) => { s.updateInfo = null; s.updateChecking = true; s.updateMsg = null; });
7923
8104
  try {
@@ -7939,7 +8120,8 @@ function queueThumb(assetId) {
7939
8120
  const res = await hostRpc('updateInstall');
7940
8121
  if (res && res.ok && res.changed) {
7941
8122
  const relaxed = res.policyRelaxed ? ' ' + T('updatePolicySkipped') : '';
7942
- update((s) => { s.updateBusy = false; s.updateMsg = T('updateInstalled') + ' v' + res.version + ' — ' + T('updateInstalledHint') + relaxed; });
8123
+ const srcTxt = res.registryKind ? '(' + T('updateSrcNow') + ':' + srcLabel(res.registryKind) + ')' : '';
8124
+ update((s) => { s.updateBusy = false; s.updateMsg = T('updateInstalled') + ' v' + res.version + srcTxt + ' — ' + T('updateInstalledHint') + relaxed; });
7943
8125
  } else if (res && res.ok) {
7944
8126
  update((s) => { s.updateBusy = false; s.updateMsg = T('updateUpToDate') + (res.version ? ' v' + res.version : ''); });
7945
8127
  } else {
@@ -8631,6 +8813,7 @@ function queueThumb(assetId) {
8631
8813
  '- **【动作层次·硬性】timeBeats 是本镜的三个时间节拍(数组,按时间顺序)**:把"一个动作"拆成 **起势 → 发力 → 落点** 三拍,每拍写**可见的**身体/道具状态,如 ["0s 右手抬到一半、指节收紧","1.2s 手继续抬到胸口、肩线前压","3s 停在信封贴住心口、雨珠从指缝滑落"]。**只写一个节拍 = 模型只会演一个姿势(用户实测:动作极简、只会平移)**;凡 ≥2s 的镜头必须写满 3 拍,≤1s 的快切镜可以只写 1 拍。**每一拍都必须能拍出来,不写"他感到/他意识到"**;',
8632
8814
  '- **camera 是本镜的机位/焦段/运镜三件套**(不是只写"推近/平移"):写成「景别 + 焦段光圈 + 运镜起点→终点」,如「中近景 50mm f/2.0,从腰高缓推至面部,匀速、到面部前 0.2 秒减速停住」。**禁止只写"推近/拉远/平移"这类空模板**(那是用户看到的"只会平移"的直接来源);**一镜只能有一个主运镜**,要两个就拆镜;',
8633
8815
  '- **vfx 是本镜必须可见的物理特效/细节**(不写就没有,模型不会自己加):按题材点名 1–3 项——雨丝斜打 / 尘粒在光柱中浮动 / 雪片近大远小 / 逆光镜头光斑 / 路灯钠黄溢光 / 闪电瞬时照亮 / 衣角被风掀起 / 水面涟漪扩散 / 纸张翻飞 / 轻微手持晃动 / 运动模糊拖影 / 烟雾弥漫 / 蒸汽升腾。写**可拍摄的物理现象**,不写"画面很唯美"这类空话;**每场至少 3 镜要有 vfx**;',
8816
+ '- **【色调·逐镜显式】把本镜色调写进 visual(主色/色温/明暗对比,按影调色彩命题取值,如「钠黄主光、青绿补色、高对比」)——色调是逐镜的画面事实,不得只写"电影感/有质感"这类空话**;',
8634
8817
  '- characters/scene/props 使用剧本与设定集中的名称(不带 @),便于匹配资产;无道具给空数组;',
8635
8818
  '- **dialogue 是本镜的角色台词**:把剧本中落在这一镜的对白逐行搬进来({"role":"角色名","line":"台词原文"}),台词必须**逐字来自剧本**、不新写不改写;本镜无台词给空数组;一镜尽量只放一个角色的台词(单说话人镜头利于声音参考提取);',
8636
8819
  '- **【音话同步·硬性】有台词的镜头必须让说话角色在画面内开口说话**:景别用近景/中近景,脸部朝向可见(正面或 3/4 侧脸),禁止背对镜头、脸部被遮挡、人物出画;visual 或 motion 里必须写明「开口说话、口型清晰可见」;台词**绝不能**处理成画外音/旁白(否则成片里人嘴是闭的、声音飘在背景里);若某句台词在剧本里说话人无法入画,就把这句台词安排到能看见他说话的那一镜;',
@@ -8666,6 +8849,7 @@ function queueThumb(assetId) {
8666
8849
  '- **[ACTION LAYERING - HARD] timeBeats is this shot\'s three time beats (array, in order)**: split "one action" into **wind-up -> drive -> settle**, each beat describing a VISIBLE body/prop state, e.g. ["0s right hand half-way up, knuckles tightening","1.2s hand reaches the chest, shoulder line pressing forward","3s it settles over the envelope, a raindrop sliding off the fingers"]. **A single beat means the model performs a single pose (measured user feedback: minimal motion, pan-only)**; any shot >=2s must carry 3 beats, rapid cuts <=1s may carry 1. **Every beat must be filmable - never "he feels / he realizes"**;',
8667
8850
  '- **camera = body/lens/move for this shot** (not just "push in / pan"): write "shot size + focal length & aperture + move start->end", e.g. "medium close-up 50mm f/2.0, slow push from waist height to the face, constant speed, decelerating to a stop 0.2s before the face". **Never use empty template verbs like push in / pull out / pan alone** (that is exactly what produces the "pan-only" result); **one primary camera move per shot** - if you need two, split the shot;',
8668
8851
  '- **vfx = physical effects/details that must be visible in this shot** (if unwritten they simply do not exist; the model will not add them): name 1-3 per shot by genre - slanted rain / dust motes floating in a light shaft / snowflakes near-to-far / backlit lens flare / sodium-vapour streetlamp spill / lightning flash lighting the set / coat hem lifted by wind / ripples spreading on water / paper sheets tumbling / subtle handheld shake / motion-blur trails / drifting smoke / rising steam. Write **filmable physical phenomena**, never "a beautiful frame"; **at least 3 shots per scene must carry vfx**;',
8852
+ '- **[TONE - PER SHOT] write this shot\'s dominant colour / colour temperature / contrast into visual per the look\'s colour thesis (e.g. "sodium-amber key, teal fill, high contrast") - tone is a per-shot fact, never just "cinematic"**;',
8669
8853
  '- characters/scene/props arrays must use plain names from the script and series bible (no @) so assets match; empty props array if none;',
8670
8854
  '- **dialogue = the character lines that fall in this shot**, moved verbatim from the script ({"role":"Name","line":"exact line"}); never rewrite lines; empty array if none; keep one speaker per shot when possible (helps voice-reference extraction);',
8671
8855
  '- **[LIP-SYNC - HARD] any shot carrying dialogue must show the speaker TALKING ON SCREEN**: use a close-up / medium close-up with the face visible (frontal or 3/4), never back-to-camera, never obscured, never off-frame; state "speaks on screen, mouth clearly visible" in visual or motion; dialogue must NEVER become voice-over/narration (otherwise the final cut has a closed mouth with the voice floating in the background); if a line cannot be on camera in the script, move that line to the shot where the speaker is visible;',
@@ -12816,7 +13000,7 @@ function queueThumb(assetId) {
12816
13000
  * 尾部的「人物:/场景/道具:」清单从最后一场剥离(资产生产参考,不属于场景正文)。 */
12817
13001
  function parseScriptScenes(output) {
12818
13002
  const text = String(output || '').replace(/\r\n/g, '\n');
12819
- const head = /^\s*(?:【\s*场\s*\d+[^】]*】|【?\s*场\s*\d+\s*】?\s*[::、..]|场\s*\d+\s*[::、..]|#{1,4}\s*场?\s*\d+|SCENE\s*\d+\b)/i;
13003
+ const head = /^\s*(?:【\s*场\s*\d+[^】]*】|【?\s*场\s*\d+\s*】?\s*[::、..]|场\s*\d+\s*[::、..]|#{1,4}\s*场\s*\d+|SCENE\s*\d+\b)/i;
12820
13004
  const scenes = [];
12821
13005
  let cur = null;
12822
13006
  for (const line of text.split('\n')) {
@@ -12828,10 +13012,28 @@ function queueThumb(assetId) {
12828
13012
  }
12829
13013
  }
12830
13014
  if (cur && cur.text.trim()) scenes.push(cur);
13015
+ // 片尾清单剥离:只剥「真正的片尾清单」——最后一场的**末尾**是纯清单行块
13016
+ // (人物/角色/场景/道具/地点 行 + 空行 + (终)/完 终止符)一直延续到文本结尾,
13017
+ // 且块内真的含「人物/角色」清单行,才剥离。场内的「人物:」行(每场格式的常见写法)
13018
+ // 不是片尾清单,绝不剥离(旧正则从场内首个「人物:」一路吞到结尾,曾把最后一场正文全部丢掉)。
12831
13019
  if (scenes.length) {
12832
13020
  const last = scenes[scenes.length - 1];
12833
- const i = last.text.search(/\n(?:人物|角色)\s*[::][\s\S]*$/);
12834
- if (i >= 0) last.text = last.text.slice(0, i) + '\n';
13021
+ const lines = last.text.split('\n');
13022
+ const isList = (l) => /^\s*(?:(?:人物|角色|地点|场景|道具)\s*[::]|场景\s*\/\s*道具\s*[::])/.test(l);
13023
+ const isMeta = (l) => /^\s*$/.test(l) || /^\s*(?:(终)|完|——\s*完\s*——)\s*$/.test(l);
13024
+ let i = lines.length - 1;
13025
+ let sawList = false;
13026
+ for (; i >= 1; i--) {
13027
+ if (isList(lines[i])) { sawList = true; continue; }
13028
+ if (isMeta(lines[i])) continue;
13029
+ break;
13030
+ }
13031
+ if (sawList && i >= 1) {
13032
+ // 剥离从块的第一个清单行开始:块内排在清单行之前的终止符/空行(如「(终)」)保留在正文里
13033
+ let firstList = i + 1;
13034
+ while (firstList < lines.length && !isList(lines[firstList])) firstList++;
13035
+ last.text = lines.slice(0, firstList).join('\n') + '\n';
13036
+ }
12835
13037
  }
12836
13038
  return scenes.filter((s) => s.text.trim());
12837
13039
  }
@@ -13443,6 +13645,8 @@ function queueThumb(assetId) {
13443
13645
  S.graph.edges.map((e) => {
13444
13646
  const kind = edgeKind(e);
13445
13647
  const sel = S.selEdge === e.id;
13648
+ // 选中节点的所有入边/出边 → 亮绿外发光(边自身被选中时已有 is-selected,互斥不叠加)
13649
+ const linked = !sel && (S.sel.has(e.fromNode) || S.sel.has(e.toNode));
13446
13650
  const g = edgeGeom(e);
13447
13651
  return h('g', { key: e.id, className: 'dshic-edge-g' },
13448
13652
  h('path', {
@@ -13451,7 +13655,7 @@ function queueThumb(assetId) {
13451
13655
  }),
13452
13656
  h('path', {
13453
13657
  ref: (el) => { if (el) edgePathEls.set(e.id, el); else edgePathEls.delete(e.id); },
13454
- d: g.d, className: cls('dshic-edge', 'kind-' + kind, sel && 'is-selected'),
13658
+ d: g.d, className: cls('dshic-edge', 'kind-' + kind, sel && 'is-selected', linked && 'is-node-linked'),
13455
13659
  }),
13456
13660
  // 悬停中点显示删除按钮(Toonflow 式)
13457
13661
  h('g', {
@@ -14144,20 +14348,21 @@ function queueThumb(assetId) {
14144
14348
  ].join('\n');
14145
14349
  }
14146
14350
 
14147
- /** 提示词侧的「镜头语言锁」:只带风格参数与负向词,不污染结构化格式。 */
14148
14351
  /**
14149
- * 图片 / 视频提示词的「风格增强块」。
14352
+ * 图片 / 视频提示词的「风格锁」(注入分工契约)。
14150
14353
  *
14151
- * 这是整条链路最容易掉队的一环:剧本与分镜走的是 AI 生成(拿到完整切片),
14152
- * 但图片与视频是「拼装提示词」——如果只带风格参数与负向词,影调的成像/材质/光学、
14153
- * 规格的节奏、题材的场面颗粒就全丢了,于是第一镜对、后面越走越偏。
14354
+ * 分工:导演的运镜手法/镜头语言/细色调在分镜层由 LLM 消化成逐镜 camera/motion/visual
14355
+ * 字段(随结构化正文进请求);技能卡切片只进剧本/分镜的系统提示当教材,绝不原文进
14356
+ * 生成请求——视频编码器有效窗口只有几百 token,教材长文会稀释正文。
14154
14357
  *
14155
14358
  * 按生成能力取切片:
14156
- * kind='prompt' —— 图片与视频。风格参数 + 影调(成像/光比/色彩/介质/光学/材质/特效)
14157
- * + 规格(ASL 与负向词)+ 题材的「常见场面颗粒」+ 三份负向词
14158
- * kind='assets' —— 角色/场景/道具设定图。影调的成像与色彩(不含叙事与剪辑)
14359
+ * 图片(medium='image')—— 紧凑锁:镜头风格 bits + 色彩/影调(截断)+ 场面材料(260B)
14360
+ * + 负向词(700B 总预算);设定图额外带材质响应。
14361
+ * 视频(kind='prompt')—— 总控锁 ≤1.2KB:影调美学短语(成像底层摘要)+ 交付规格
14362
+ * (单镜时长口径)+ 负向词 ≤6 条。全片风格锚(styleAnchor/
14363
+ * style 首句)在正文「风格:」行,逐镜事实以正文为准。
14159
14364
  *
14160
- * 不内联:叙事方法、剪辑节奏、人物表演(这些只对剧本/分镜有意义)。
14365
+ * 不内联(叙事方法、剪辑节奏、运镜词典、题材颗粒长文……):只对剧本/分镜有意义。
14161
14366
  */
14162
14367
  /**
14163
14368
  * 图片生成专用的紧凑风格锁。
@@ -14171,16 +14376,16 @@ function queueThumb(assetId) {
14171
14376
  async function buildImageLockText(P, manifest, profile, k) {
14172
14377
  const parts = [];
14173
14378
  const push = (label, body) => { const b = String(body || '').trim(); if (b) parts.push(label + '\n' + b); };
14174
- /** 按句末标点截断,避免切出半句。 */
14379
+ /** 按句末标点截断,避免切出半句;UTF-8 字节数手算(部分测试沙箱没有 TextEncoder)。 */
14175
14380
  const cap = (text, maxBytes) => {
14176
14381
  const t = String(text || '').replace(/\s+/g, ' ').trim();
14177
14382
  if (!t) return '';
14178
- const enc = new TextEncoder();
14179
- if (enc.encode(t).length <= maxBytes) return t;
14383
+ const bLen = (s) => { let n = 0; for (const ch of String(s)) { const c = ch.codePointAt(0); n += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; } return n; };
14384
+ if (bLen(t) <= maxBytes) return t;
14180
14385
  const heads = t.split(/(?<=[。;;!?])/);
14181
14386
  let out = '';
14182
14387
  for (const h of heads) {
14183
- if (enc.encode(out + h).length > maxBytes) break;
14388
+ if (bLen(out + h) > maxBytes) break;
14184
14389
  out += h;
14185
14390
  }
14186
14391
  return (out || t.slice(0, maxBytes)).trim();
@@ -14265,7 +14470,7 @@ function queueThumb(assetId) {
14265
14470
  }
14266
14471
 
14267
14472
  if (!parts.length) return '';
14268
- return '[画面风格锁] 以下决定画面成色(与正文冲突时以本块为准):' + EOL + parts.join(EOL);
14473
+ return '[画面风格锁] 以下决定画面成色(与正文冲突时以本块为准):\n' + parts.join('\n');
14269
14474
  }
14270
14475
 
14271
14476
  async function buildShotLockText(kind, opts) {
@@ -14287,58 +14492,34 @@ function queueThumb(assetId) {
14287
14492
  const b = String(body || '').trim();
14288
14493
  if (b) parts.push(label + '\n' + b);
14289
14494
  };
14290
- // 负向词跨四层全局收集:单卡内去重不够——导演/题材/规格/影调经常重复同类禁令,
14291
- // 重复注入会稀释权重。统一去重后再给总预算,防止异常卡把视频请求撑成负向词文本墙。
14292
- const negs = [];
14293
- const seenNeg = new Set();
14294
- const addNegs = (phrases) => {
14295
- for (const raw of (phrases || [])) {
14296
- const s = String(raw || '').trim();
14297
- if (s && !seenNeg.has(s.toLowerCase())) { seenNeg.add(s.toLowerCase()); negs.push(s); }
14495
+ // 按句末标点压缩(不切半句):总控锁里唯一允许的压缩方式
14496
+ const capZh = (text, maxBytes) => {
14497
+ const t = String(text || '').replace(/\s+/g, ' ').trim();
14498
+ if (!t) return '';
14499
+ // UTF-8 字节数手算(不依赖 TextEncoder——部分测试沙箱没有该构造器)
14500
+ const bLen = (s) => { let n = 0; for (const ch of String(s)) { const c = ch.codePointAt(0); n += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; } return n; };
14501
+ if (bLen(t) <= maxBytes) return t;
14502
+ const heads = t.split(/(?<=[。;;!?])/);
14503
+ let out = '';
14504
+ for (const h of heads) {
14505
+ if (bLen(out + h) > maxBytes) break;
14506
+ out += h;
14298
14507
  }
14508
+ return (out || t.slice(0, maxBytes)).trim();
14299
14509
  };
14300
-
14301
- // ① 导演透镜:风格参数 YAML(机读、可核对)+ 灯光与色彩(成型规则)
14302
- const lensEntry = profile.lens ? (manifest.lenses || []).find((x) => x.id === profile.lens) : null;
14303
- if (lensEntry) {
14304
- const md = await readPackCard('lens', lensEntry.file);
14305
- if (md) {
14306
- const y = P.yamlBlock(md);
14307
- if (y) push('本片风格参数(逐条执行,不得改动数值):', y);
14308
- const light = P.pickSections(md, k);
14309
- if (light) push('导演的光线与色彩规则:', light);
14310
- }
14311
- }
14312
-
14313
- // ② 影调质感:按能力切片(prompt 取成像/光比/色彩/介质/光学/材质/特效;assets 取成像与色彩)
14510
+ // —— 总控锁 v2(注入分工):导演的运镜手法/镜头语言/细色调已在分镜层被 LLM 消化成
14511
+ // 每镜 camera/motion/visual 字段(随结构化正文进请求),这里不再倒教材——视频编码器
14512
+ // 有效窗口只有几百 token,长锁会稀释正文。锁只保留全片级总控元素,总量 ≤1.2KB。——
14513
+ // ① 影调美学短语:影调卡「成像底层」摘要——全片质感的总控兜底(逐镜色调已写进 visual)
14314
14514
  const lookEntry = profile.look ? (manifest.looks || []).find((x) => x.id === profile.look) : null;
14315
14515
  if (lookEntry) {
14316
14516
  const md = await readPackCard('look', lookEntry.file);
14317
14517
  if (md) {
14318
- const body = P.pickSections(md, k);
14319
- if (body) push('影调与材质(画面必须长成这样):', body);
14518
+ const essence = P.sectionText(md, '成像底层') || P.sectionText(md, '质感基线') || '';
14519
+ if (essence) push('影调质感:', capZh(essence, 200));
14320
14520
  }
14321
14521
  }
14322
-
14323
- // ③ 题材:只取「常见场面颗粒」(可拍摄的物件/动作/空间),这是提示词最需要的具体材料
14324
- for (const gid of (profile.genres || [])) {
14325
- const ge = (manifest.genres || []).find((x) => x.id === gid) || null;
14326
- const ie = ge ? null : (manifest.industries || []).find((x) => x.id === gid);
14327
- const entry = ge || ie;
14328
- if (!entry) continue;
14329
- const md = await readPackCard(ge ? 'genre' : 'industry', entry.file);
14330
- if (!md) continue;
14331
- const granules = P.sectionText(md, '常见场面颗粒') || P.sectionText(md, '参考镜头') || P.sectionText(md, '视觉母题');
14332
- if (granules) push((ge ? '题材的场面颗粒' : '行业视觉母题') + '(' + entry.name + '):', granules);
14333
- // 题材的「禁止漂移」是画面层约束(能出现什么物件、不能出现什么年代错误、不许用什么代替故事),
14334
- // 以前只在 script 切片里出现、进不了 prompt,等于题材对成片没有约束力。这里补上。
14335
- const forbid = P.sectionText(md, '禁止漂移');
14336
- if (forbid) push('本题材的画面禁项(' + entry.name + ',必须排除):', forbid);
14337
- // 题材级负向词与其它层合并,统一去重后在块尾注入
14338
- addNegs(P.negativePhrases(md));
14339
- }
14340
-
14341
- // ④ 规格:节奏与负向词(画幅不在这里定,由视频节点选)
14522
+ // ② 交付规格:单镜时长口径(规格卡)
14342
14523
  const formEntry = profile.form ? (manifest.forms || []).find((x) => x.id === profile.form) : null;
14343
14524
  if (formEntry) {
14344
14525
  const md = await readPackCard('form', formEntry.file);
@@ -14347,38 +14528,37 @@ function queueThumb(assetId) {
14347
14528
  const bits = [];
14348
14529
  if (spec.asl_floor_s) bits.push('单镜不短于 ' + spec.asl_floor_s + 's');
14349
14530
  if (spec.asl_target_s) bits.push('平均镜长 ' + spec.asl_target_s + 's');
14350
- if (bits.length) push('交付规格(' + formEntry.name + '):', bits.join(';'));
14351
- addNegs(P.negativePhrases(md));
14531
+ if (bits.length) push('交付规格:', bits.join(';'));
14352
14532
  }
14353
14533
  }
14354
-
14355
- // ⑤ 透镜与影调负向词:和题材/规格合并,块尾统一注入
14356
- for (const layer of ['lens', 'look']) {
14357
- const id = layer === 'lens' ? profile.lens : profile.look;
14358
- const entry = id ? (manifest[layer === 'lens' ? 'lenses' : 'looks'] || []).find((x) => x.id === id) : null;
14534
+ // ③ 负向词:四层合并去重后只内联前 6 条——内联负向词会与正向争夺注意力(稀释规则),
14535
+ // 只点名最可能出现的风险类;有独立负向词字段的厂商应改走字段(runner 侧,后续接通)
14536
+ const negs = [];
14537
+ const seenNeg = new Set();
14538
+ const addNegs = (phrases) => {
14539
+ for (const raw of (phrases || [])) {
14540
+ const s = String(raw || '').trim();
14541
+ if (s && !seenNeg.has(s.toLowerCase())) { seenNeg.add(s.toLowerCase()); negs.push(s); }
14542
+ }
14543
+ };
14544
+ for (const [layer, id] of [['lens', profile.lens], ['look', profile.look], ['form', profile.form]]) {
14545
+ if (!id) continue;
14546
+ const entry = (manifest[layer === 'lens' ? 'lenses' : layer === 'look' ? 'looks' : 'forms'] || []).find((x) => x.id === id);
14359
14547
  if (!entry) continue;
14360
14548
  const md = await readPackCard(layer, entry.file);
14361
- if (!md) continue;
14362
- addNegs(P.negativePhrases(md));
14549
+ if (md) addNegs(P.negativePhrases(md));
14363
14550
  }
14364
-
14365
- if (negs.length) {
14366
- // 预算按 UTF-8 字节计算(pack.js 的 utf8Bytes 与浏览器/Node 同口径);逗号分隔符也计入。
14367
- // 超过预算的尾部短语直接截掉,不做半句截断——截半条负向词可能反转语义。
14368
- const kept = [];
14369
- let bytes = 0;
14370
- for (const s of negs) {
14371
- const need = P.utf8Bytes(s) + (kept.length ? 2 : 0);
14372
- if (!need || bytes + need > 2400) continue;
14373
- kept.push(s);
14374
- bytes += need;
14375
- }
14376
- if (kept.length) push('全局负向词(必须排除):', kept.join(', '));
14551
+ for (const gid of (profile.genres || [])) {
14552
+ const ge = (manifest.genres || []).find((x) => x.id === gid);
14553
+ if (!ge) continue;
14554
+ const md = await readPackCard('genre', ge.file);
14555
+ if (md) addNegs(P.negativePhrases(md));
14377
14556
  }
14557
+ if (negs.length) push('必须排除:', negs.slice(0, 6).join(', '));
14378
14558
 
14379
14559
  if (!parts.length) return '';
14380
- const head = '[风格增强锁] 以下分块直接决定画面成败,与提示词正文冲突时以本块为准:';
14381
- return head + '\n' + parts.join('\n\n');
14560
+ const head = '[全片风格锚] 以下为全片级总控;逐镜画面与动作以正文为准:';
14561
+ return head + '\n' + parts.join('\n');
14382
14562
  }
14383
14563
 
14384
14564
  async function loadModelIndex() {
@@ -18752,6 +18932,7 @@ const DIRECTOR_KEY_HELP = [
18752
18932
  const next = {
18753
18933
  worldview: String(obj.worldview || cur.worldview || '').trim(),
18754
18934
  style: String(obj.style || cur.style || '').trim(),
18935
+ styleAnchor: String(obj.styleAnchor !== undefined ? obj.styleAnchor : (cur.styleAnchor || '')).trim(),
18755
18936
  characters: merge(cur.characters, list(obj.characters)),
18756
18937
  scenes: merge(cur.scenes, list(obj.scenes)),
18757
18938
  props: merge(cur.props, list(obj.props)),
@@ -19584,6 +19765,17 @@ const DIRECTOR_KEY_HELP = [
19584
19765
  onPointerDown: (e) => e.stopPropagation(),
19585
19766
  onClick: applyUpdate,
19586
19767
  }, Ic('download', 11), T('updateGo')),
19768
+ // 更新源:自动检测(按网络环境)/ 手动覆盖官方源或大陆镜像源(如图选择的 radio 形态)
19769
+ h('span', { style: { display: 'flex', alignItems: 'center', gap: 6, fontSize: 11, opacity: 0.95 }, onPointerDown: (e) => e.stopPropagation() },
19770
+ T('updateSrcTitle') + ':',
19771
+ ...[['auto', 'updateSrcAuto'], ['official', 'updateSrcOfficial'], ['china', 'updateSrcChina']].map(([val, key]) =>
19772
+ h('label', { key: val, style: { display: 'flex', alignItems: 'center', gap: 3, cursor: 'pointer' } },
19773
+ h('input', { type: 'radio', name: 'dshic-update-src', checked: (S.updateRegistry || 'auto') === val, disabled: !!S.updateBusy, onChange: () => setUpdateSource(val) }),
19774
+ T(key))),
19775
+ S.updateRegistryResolved
19776
+ ? h('span', { style: { opacity: 0.75 } }, '(' + T('updateSrcNow') + ':' + (S.updateRegistryResolved === 'china' ? T('updateSrcChina') : T('updateSrcOfficial')) + ')')
19777
+ : null,
19778
+ ),
19587
19779
  h('a', {
19588
19780
  href: 'https://github.com/NINKCH/dsh-infinite_canvas/releases', target: '_blank', rel: 'noreferrer',
19589
19781
  style: { color: 'inherit', opacity: 0.8, fontSize: 11 },
@@ -19985,6 +20177,8 @@ const DIRECTOR_KEY_HELP = [
19985
20177
  probeCraft();
19986
20178
  // 检查更新(Host RPC;Host 旧版未带此方法时静默)
19987
20179
  checkUpdate(true);
20180
+ // 更新源配置(自动探测/手动覆盖;旧 Host 无此 RPC 时静默降级为仅展示)
20181
+ fetchUpdateRegistry();
19988
20182
  // 数据根目录(Host 旧版静默降级为 IndexedDB 模式);就绪后把本地遗留 blob 搬进服务端(v1 旧布局由 Host 侧自动迁移)
19989
20183
  refreshDataRoot().then(() => migrateLegacyAssets('boot')).catch(() => { /* 静默 */ });
19990
20184
  // 对话 ↔ 画布同步(启动一次 + 3s 轮询;旧 Host 自动停轮询)
@@ -20182,13 +20376,15 @@ const DIRECTOR_KEY_HELP = [
20182
20376
  expandStoryboard,
20183
20377
  // 纯函数出口:资产设定图提示词生成器(不依赖 DOM,可直接断言)
20184
20378
  buildAssetSheetPrompt, assetSheetNodeSpec,
20379
+ // 纯函数出口:剧本 → 场景切分(供 scripts/test-script-scenes.mjs 断言分场与片尾清单剥离)
20380
+ parseScriptScenes,
20185
20381
  };
20186
20382
  // IC-01:下载侧扩展名判定的纯函数出口(供 scripts/test-download-ext.mjs 直接断言)
20187
20383
  window.__DSH_IC_MEDIA__ = { extForDownload };
20188
20384
  // IC-04:参考图上传三件套的纯函数出口(供 scripts/test-image-upload.mjs 直接断言)
20189
20385
  window.__DSH_IC_IMGREF__ = { rawImageDims, sniffImageEncoding, registerReferenceAsset };
20190
20386
  // IC-03:视频厂商识别/前缀归一化的纯函数出口(供 scripts/test-vendor-detect.mjs 直接断言)
20191
- window.__DSH_IC_VENDOR__ = { detectVideoVendor, gatewayPrefixFor, wanEndpoints, vendorBase, VIDEO_REF_CAPS, needsSimpleMediaRetry, buildSimpleMediaRetryBody, wanTaskIdOf, wanStatusOf, wanPollState };
20387
+ window.__DSH_IC_VENDOR__ = { detectVideoVendor, gatewayPrefixFor, wanEndpoints, vendorBase, VIDEO_REF_CAPS, needsSimpleMediaRetry, buildSimpleMediaRetryBody, wanTaskIdOf, wanStatusOf, wanPollState, buildSanbaoVideoBody, sanbaoTaskIdOf, sanbaoPollState, needsSanbaoMediaRetry, bibleStyleAnchor };
20192
20388
  // 按镜头切段(分段生成本身就是最容易出错的地方):规划器 + 强弱模型分流 + 节点段区间解析
20193
20389
  // 供 scripts/test-segment-plan.mjs 直接断言
20194
20390
  window.__DSH_IC_SEGMENT__ = { planShotSegments, isCutPoint, segmentNeedsHardFrame, videoSegmentOf, shotContinuityPlan };
package/index.js CHANGED
@@ -29,8 +29,15 @@ try {
29
29
 
30
30
  // 更新检查的唯一信息源 = npm registry latest(与安装方式无关:
31
31
  // npm 在线安装 / 本地 link 开发态 / 其它方式,一律走同一条逻辑)。
32
- const NPM_LATEST_URL = 'https://registry.npmjs.org/' + encodeURIComponent('@ninkch/dsh-infinite-canvas') + '/latest';
32
+ // 双源:官方权威 + 中国大陆镜像(registry.npmmirror.com)。按网络环境自动选源
33
+ // (探测缓存 24h),用户可在更新横幅手动覆盖(config.updateRegistry = 'auto' | 'official' | 'china')。
33
34
  const PKG_NAME = '@ninkch/dsh-infinite-canvas';
35
+ const NPM_LATEST_PATH = '/' + encodeURIComponent(PKG_NAME) + '/latest';
36
+ const NPM_REGISTRIES = {
37
+ official: 'https://registry.npmjs.org',
38
+ china: 'https://registry.npmmirror.com',
39
+ };
40
+ const REGISTRY_CACHE_TTL_MS = 24 * 60 * 60 * 1000;
34
41
 
35
42
  // ---------- 安装形态探测(用于"点击即更新") ----------
36
43
  // 受管安装 = 本副本位于某个 DSH profile 的 node_modules 下(向上找带 dsh.profile.bundles 的 package.json)。
@@ -68,16 +75,22 @@ function findPnpm() {
68
75
  }
69
76
 
70
77
  /** 在 profile 目录执行 pnpm add <spec> --save-exact。opts.relaxReleaseAge → 跳过 24h 新版本冷却期。 */
78
+ /** 组装 pnpm add 参数(纯函数供回归):registry 只认白名单值——
79
+ * URL 是外部输入时绝不进命令行(防注入面),非白名单一律不带参数(回落机器默认配置)。 */
80
+ function pnpmAddArgs(pnpm, spec, opts = {}) {
81
+ const relax = opts.relaxReleaseAge ? ['--config.minimum-release-age=0'] : [];
82
+ const reg = NPM_REGISTRIES[opts.registry] ? ['--registry', NPM_REGISTRIES[opts.registry]] : [];
83
+ const tail = ['add', spec, '--save-exact', ...relax, ...reg];
84
+ return pnpm.kind === 'script' ? ['--expose-internals', pnpm.script, ...tail] : tail;
85
+ }
86
+
71
87
  function runPnpmAdd(pnpm, spec, opts = {}) {
72
88
  return new Promise((resolve) => {
73
89
  const started = Date.now();
74
90
  const stdout = [];
75
91
  const stderr = [];
76
92
  let child;
77
- const relax = opts.relaxReleaseAge ? ['--config.minimum-release-age=0'] : [];
78
- const args = pnpm.kind === 'script'
79
- ? ['--expose-internals', pnpm.script, 'add', spec, '--save-exact', ...relax]
80
- : ['add', spec, '--save-exact', ...relax];
93
+ const args = pnpmAddArgs(pnpm, spec, opts);
81
94
  try {
82
95
  child = pnpm.kind === 'script'
83
96
  ? spawn(pnpm.node, args, { cwd: PROFILE_DIR, windowsHide: true, env: { ...process.env, ELECTRON_RUN_AS_NODE: '1' } })
@@ -930,6 +943,8 @@ function normalizeBible(raw) {
930
943
  return {
931
944
  worldview: String(b.worldview || '').slice(0, 8000),
932
945
  style: String(b.style || '').slice(0, 2000),
946
+ // 风格锚(一句话全片视觉总锚):AI 更新设定集时与 style 同时产出;生成请求只带锚,style 全文进分镜消化
947
+ styleAnchor: String(b.styleAnchor || '').slice(0, 200),
933
948
  characters: arr(b.characters),
934
949
  scenes: arr(b.scenes),
935
950
  props: arr(b.props),
@@ -1999,6 +2014,7 @@ async function canvasUpdateBible(args) {
1999
2014
  const next = {
2000
2015
  worldview: inc.worldview !== undefined ? String(inc.worldview) : cur.worldview,
2001
2016
  style: inc.style !== undefined ? String(inc.style) : cur.style,
2017
+ styleAnchor: inc.styleAnchor !== undefined ? String(inc.styleAnchor) : cur.styleAnchor,
2002
2018
  characters: mergeList(cur.characters, inc.characters),
2003
2019
  scenes: mergeList(cur.scenes, inc.scenes),
2004
2020
  props: mergeList(cur.props, inc.props),
@@ -2706,9 +2722,10 @@ function canvasConnect(args) {
2706
2722
  };
2707
2723
  }
2708
2724
 
2709
- /** 读取 npm registry 上 latest dist-tag 的版本号。 */
2710
- async function npmLatestVersion() {
2711
- const res = await fetch(NPM_LATEST_URL, {
2725
+ /** 读取 npm registry 上 latest dist-tag 的版本号(kind: 'official' | 'china',双源白名单)。 */
2726
+ async function npmLatestVersion(kind) {
2727
+ const base = NPM_REGISTRIES[kind] || NPM_REGISTRIES.official;
2728
+ const res = await fetch(base + NPM_LATEST_PATH, {
2712
2729
  headers: { accept: 'application/json' },
2713
2730
  signal: AbortSignal.timeout(15000),
2714
2731
  });
@@ -2721,6 +2738,69 @@ async function npmLatestVersion() {
2721
2738
  return v;
2722
2739
  }
2723
2740
 
2741
+ /** 探测双源可用性(并发,3s 超时):探测路径就是实际要拉取的 packument——比 /-/ping 更贴近真实链路。 */
2742
+ async function probeRegistries() {
2743
+ const probeOne = async (kind) => {
2744
+ const t0 = Date.now();
2745
+ try {
2746
+ const res = await fetch(NPM_REGISTRIES[kind] + NPM_LATEST_PATH, { headers: { accept: 'application/json' }, signal: AbortSignal.timeout(3000) });
2747
+ return { ok: !!res.ok, ms: Date.now() - t0 };
2748
+ } catch { return { ok: false, ms: Date.now() - t0 }; }
2749
+ };
2750
+ const [official, china] = await Promise.all([probeOne('official'), probeOne('china')]);
2751
+ return { official, china };
2752
+ }
2753
+
2754
+ /** 选源纯函数(表驱动回归):手动覆盖显式优先;auto 按探测结果——
2755
+ * 官方可达 → 官方(非大陆/代理良好,权威源优先);官方不可达而镜像可达 → 镜像(大陆直连形态);
2756
+ * 双可达 → 官方(保守,镜像同步有分钟级延迟);双不可达 → 官方(维持现状行为与报错)。 */
2757
+ function pickUpdateRegistry(override, probe) {
2758
+ if (override === 'china') return 'china';
2759
+ if (override === 'official') return 'official';
2760
+ const off = probe && probe.official;
2761
+ const cn = probe && probe.china;
2762
+ if (off && off.ok) return 'official';
2763
+ if (cn && cn.ok) return 'china';
2764
+ return 'official';
2765
+ }
2766
+
2767
+ /** 自动探测缓存是否仍有效:24h TTL 且源必须是白名单值(防 config 被手改成任意字符串)。 */
2768
+ function registryCacheValid(cache, now) {
2769
+ if (!cache) return false;
2770
+ if (cache.resolved !== 'official' && cache.resolved !== 'china') return false;
2771
+ const at = Number(cache.at);
2772
+ if (!Number.isFinite(at) || at <= 0) return false;
2773
+ return now - at < REGISTRY_CACHE_TTL_MS;
2774
+ }
2775
+
2776
+ /** 解析本次更新应使用的源:手动覆盖优先;auto 读 24h 缓存,过期/缺失则探测并写回缓存。 */
2777
+ async function resolveUpdateRegistry() {
2778
+ const cfg = readIcConfig();
2779
+ const override = cfg.updateRegistry === 'china' || cfg.updateRegistry === 'official' ? cfg.updateRegistry : 'auto';
2780
+ if (override !== 'auto') return { kind: override, override: true };
2781
+ const cache = cfg.updateRegistryResolved && Number(cfg.updateRegistryAt) > 0
2782
+ ? { resolved: cfg.updateRegistryResolved, at: Number(cfg.updateRegistryAt) }
2783
+ : null;
2784
+ if (registryCacheValid(cache, Date.now())) return { kind: cache.resolved, cached: true };
2785
+ const kind = pickUpdateRegistry('auto', await probeRegistries());
2786
+ try {
2787
+ writeIcConfig({ ...readIcConfig(), updateRegistry: 'auto', updateRegistryResolved: kind, updateRegistryAt: Date.now() });
2788
+ } catch { /* 写缓存失败不阻断更新 */ }
2789
+ return { kind, probed: true };
2790
+ }
2791
+
2792
+ /** 按偏好源取 latest,失败自动换备源一次(探测再准也有抖动,兜底保证不卡更新)。 */
2793
+ async function npmLatestVersionAny(preferred) {
2794
+ const order = preferred === 'china' ? ['china', 'official'] : ['official', 'china'];
2795
+ let lastErr = null;
2796
+ for (const kind of order) {
2797
+ try {
2798
+ return { kind, version: await npmLatestVersion(kind) };
2799
+ } catch (e) { lastErr = e; }
2800
+ }
2801
+ throw lastErr;
2802
+ }
2803
+
2724
2804
  /**
2725
2805
  * 语义化版本比较:a<b → -1,a>b → 1,相等 → 0,**无法解析 → null(未知,不能当成"相等")**。
2726
2806
  * prerelease 按 semver 规则逐段比较:数字段按数值(rc.10 > rc.9),数字段优先于字母段。
@@ -2770,14 +2850,17 @@ function readLocalVersion() {
2770
2850
  */
2771
2851
  async function updateCheck() {
2772
2852
  const runningVersion = readLocalVersion();
2773
- const remoteVersion = await npmLatestVersion();
2853
+ const reg = await resolveUpdateRegistry();
2854
+ const r = await npmLatestVersionAny(reg.kind);
2855
+ const remoteVersion = r.version;
2774
2856
  const cmp = cmpVer(runningVersion, remoteVersion);
2857
+ const base = { registryKind: r.kind, registry: NPM_REGISTRIES[r.kind], registryFallback: r.kind !== reg.kind };
2775
2858
  if (cmp === null) {
2776
2859
  // 版本号无法解析(本地被改成非规范三段等):如实报"未知",绝不谎称已是最新
2777
- return { source: 'npm', runningVersion, remoteVersion, behind: 0, upToDate: false, unknown: true, note: '版本号无法解析,无法判断是否需要更新' };
2860
+ return { source: 'npm', ...base, runningVersion, remoteVersion, behind: 0, upToDate: false, unknown: true, note: '版本号无法解析,无法判断是否需要更新' };
2778
2861
  }
2779
2862
  const behind = cmp < 0 ? 1 : 0;
2780
- return { source: 'npm', runningVersion, remoteVersion, behind, upToDate: behind === 0 };
2863
+ return { source: 'npm', ...base, runningVersion, remoteVersion, behind, upToDate: behind === 0 };
2781
2864
  }
2782
2865
 
2783
2866
  /**
@@ -2789,7 +2872,10 @@ async function updateCheck() {
2789
2872
  */
2790
2873
  async function updateInstall() {
2791
2874
  const runningVersion = readLocalVersion();
2792
- const latest = await npmLatestVersion();
2875
+ const reg = await resolveUpdateRegistry();
2876
+ const order = reg.kind === 'china' ? ['china', 'official'] : ['official', 'china'];
2877
+ const r = await npmLatestVersionAny(order[0]);
2878
+ const latest = r.version;
2793
2879
  const cmp = cmpVer(runningVersion, latest);
2794
2880
  if (cmp === null) {
2795
2881
  // 无法比较时不能假装"已是最新"(按钮会显示成功但什么都没装)→ 回退为引导
@@ -2803,12 +2889,20 @@ async function updateInstall() {
2803
2889
  }
2804
2890
  const pnpm = findPnpm();
2805
2891
  const spec = PKG_NAME + '@' + latest;
2806
- let res = await runPnpmAdd(pnpm, spec);
2892
+ let usedRegistry = order[0];
2807
2893
  let policyRelaxed = false;
2894
+ let registryFallback = false;
2895
+ let res = await runPnpmAdd(pnpm, spec, { registry: usedRegistry });
2808
2896
  if (!res.ok && /MINIMUM_RELEASE_AGE_VIOLATION/.test((res.stdout || '') + (res.stderr || ''))) {
2809
2897
  // pnpm 11 供应链保护对 24h 内新发布间歇性拦截;用户点击已是明确同意 → 放宽重试一次
2810
2898
  policyRelaxed = true;
2811
- res = await runPnpmAdd(pnpm, spec, { relaxReleaseAge: true });
2899
+ res = await runPnpmAdd(pnpm, spec, { relaxReleaseAge: true, registry: usedRegistry });
2900
+ }
2901
+ if (!res.ok) {
2902
+ // 备源兜底:探测选错的源不会卡死更新——自动换另一源重试一次
2903
+ registryFallback = true;
2904
+ usedRegistry = order[1];
2905
+ res = await runPnpmAdd(pnpm, spec, { registry: usedRegistry, relaxReleaseAge: policyRelaxed });
2812
2906
  }
2813
2907
  const output = ((res.stdout || '') + '\n' + (res.stderr || '')).trim().slice(-1500);
2814
2908
  if (!res.ok) {
@@ -2821,13 +2915,13 @@ async function updateInstall() {
2821
2915
  try {
2822
2916
  installed = JSON.parse(readFileSync(path.join(PROFILE_DIR, 'node_modules', ...PKG_NAME.split('/'), 'package.json'), 'utf8')).version || latest;
2823
2917
  } catch { /* 保留 latest */ }
2824
- return { ok: true, changed: true, version: installed, output, policyRelaxed };
2918
+ return { ok: true, changed: true, version: installed, output, policyRelaxed, registryKind: usedRegistry, registry: NPM_REGISTRIES[usedRegistry], registryFallback };
2825
2919
  }
2826
2920
 
2827
2921
  export const inject = ['webServer', 'tools'];
2828
2922
 
2829
2923
  // 仅供诊断 / 自动化测试(不属于 RPC 面,运行时行为不受影响)
2830
- export const _internals = { THUMB_MAX_SIDE, thumbRelOf, isDerivedMedia, updateCheck, updateInstall, npmLatestVersion, cmpVer, findPnpm, getProfileDir: () => PROFILE_DIR, getVersion: () => VERSION, dataRoot, setDataRoot, dataRootMigrate, dataRootImport, ensureProjectFolder, physicalRel, mirrorProjectToDataRoot, writeAssetIndex, removeAssetIndexEntry, readDataRootMeta, removeDataRootProject, sqlDeleteProjectRows, deletedProjectIds, addDeletedProjectId, clearDeletedProjectId, fetchProxyForward, storyboardConsistencyWarnings, readAssetIndexNames, safeJoin, mimeOf, pipeFile, getIcConfigPath: () => CONFIG_PATH, canvasCreateProject, canvasWriteNode, canvasConnect, canvasDeleteProject, canvasDeleteNode, canvasRunNode, canvasNodeStatus, canvasGetBible, canvasUpdateBible, canvasCreateNode, canvasOpen, canvasesList, canvasCreate, canvasRename, canvasDelete, canvasDocId, isCanvasDocId, splitCanvasDocId, normalizeCanvasId, canvasRegistry, sanitizeCanvases, readCanvasDoc, writeCanvasDoc, deleteCanvasDocsForProject, projectsList, projectsPut, projectsGet, projectsDelete, projectsSync, sqliteAvailable: () => !!SQLITE, getDb, closeDb, dbAssetsList, dbAssetsGet, dbAssetNames, dbAssetCreate, dbAssetUpdate, dbAssetDelete, objectAbsFor, ftsReconcile, readDocOrNull, docExists, sqlActive, rpcMethods: () => _rpcMethods, canvasUpdateNode, canvasGenerateNode };
2924
+ export const _internals = { THUMB_MAX_SIDE, thumbRelOf, isDerivedMedia, updateCheck, updateInstall, npmLatestVersion, cmpVer, findPnpm, NPM_REGISTRIES, pickUpdateRegistry, registryCacheValid, pnpmAddArgs, getProfileDir: () => PROFILE_DIR, getVersion: () => VERSION, dataRoot, setDataRoot, dataRootMigrate, dataRootImport, ensureProjectFolder, physicalRel, mirrorProjectToDataRoot, writeAssetIndex, removeAssetIndexEntry, readDataRootMeta, removeDataRootProject, sqlDeleteProjectRows, deletedProjectIds, addDeletedProjectId, clearDeletedProjectId, fetchProxyForward, storyboardConsistencyWarnings, readAssetIndexNames, safeJoin, mimeOf, pipeFile, getIcConfigPath: () => CONFIG_PATH, canvasCreateProject, canvasWriteNode, canvasConnect, canvasDeleteProject, canvasDeleteNode, canvasRunNode, canvasNodeStatus, canvasGetBible, canvasUpdateBible, canvasCreateNode, canvasOpen, canvasesList, canvasCreate, canvasRename, canvasDelete, canvasDocId, isCanvasDocId, splitCanvasDocId, normalizeCanvasId, canvasRegistry, sanitizeCanvases, readCanvasDoc, writeCanvasDoc, deleteCanvasDocsForProject, projectsList, projectsPut, projectsGet, projectsDelete, projectsSync, sqliteAvailable: () => !!SQLITE, getDb, closeDb, dbAssetsList, dbAssetsGet, dbAssetNames, dbAssetCreate, dbAssetUpdate, dbAssetDelete, objectAbsFor, ftsReconcile, readDocOrNull, docExists, sqlActive, rpcMethods: () => _rpcMethods, canvasUpdateNode, canvasGenerateNode };
2831
2925
 
2832
2926
  function resolveModel(providers, want) {
2833
2927
  const byProvider = want && want.provider
@@ -2994,6 +3088,22 @@ export function apply(ctx) {
2994
3088
  async llmComplete(args) { return complete(args); },
2995
3089
  async updateCheck() { return updateCheck(); },
2996
3090
  async updateInstall() { return updateInstall(); },
3091
+ async updateGetRegistry() {
3092
+ const cfg = readIcConfig();
3093
+ const override = cfg.updateRegistry === 'china' || cfg.updateRegistry === 'official' ? cfg.updateRegistry : 'auto';
3094
+ return { override, resolved: cfg.updateRegistryResolved || null, cachedAt: cfg.updateRegistryAt || null, registries: NPM_REGISTRIES };
3095
+ },
3096
+ async updateSetRegistry(args) {
3097
+ const v = String((args && args.override) || 'auto');
3098
+ if (v !== 'auto' && v !== 'official' && v !== 'china') throw new Error('updateRegistry 只接受 auto / official / china');
3099
+ const cfg = readIcConfig();
3100
+ cfg.updateRegistry = v;
3101
+ // 覆盖变化后清掉自动探测缓存:显式覆盖不需要缓存;切回 auto 时重新探测
3102
+ delete cfg.updateRegistryResolved;
3103
+ delete cfg.updateRegistryAt;
3104
+ writeIcConfig(cfg);
3105
+ return { override: v, resolved: null };
3106
+ },
2997
3107
  async dataRootGet() {
2998
3108
  const root = dataRoot();
2999
3109
  let exists = false;
@@ -3703,7 +3813,7 @@ export function apply(ctx) {
3703
3813
  });
3704
3814
  reg({
3705
3815
  name: 'canvas_update_bible',
3706
- description: '写入项目设定集(世界观/核心设定、风格基调、角色/场景/道具)。默认按名称合并:同名更新、不存在则追加;mode="replace" 时条目整体替换。【设定集先行】先把世界观/风格/角色/场景/道具写进设定集,再生成剧本与参考图,保证跨镜跨集一致。',
3816
+ description: '写入项目设定集(世界观/核心设定、风格基调、角色/场景/道具)。默认按名称合并:同名更新、不存在则追加;mode="replace" 时条目整体替换。【设定集先行】先把世界观/风格/角色/场景/道具写进设定集,再生成剧本与参考图,保证跨镜跨集一致。写/改 style 时必须同时产出 styleAnchor(一句话 ≤40 字的全片视觉总锚;细节在 style,锚进生成请求总控)。',
3707
3817
  parameters: {
3708
3818
  type: 'object',
3709
3819
  properties: {
@@ -3714,7 +3824,8 @@ export function apply(ctx) {
3714
3824
  description: '设定集内容(只传要改的字段)',
3715
3825
  properties: {
3716
3826
  worldview: { type: 'string', description: '世界观/核心设定(题材、年代、核心规则、主线暗线)' },
3717
- style: { type: 'string', description: '风格基调(画风、年代、色调、质感)' },
3827
+ style: { type: 'string', description: '风格基调(画风、年代、色调、质感,可多句细节)' },
3828
+ styleAnchor: { type: 'string', description: '风格锚:一句话(≤40 字)全片视觉总锚,与 style 同时产出——style 写细节,锚进图片/视频生成请求的总控' },
3718
3829
  characters: { type: 'array', items: { type: 'object', properties: { name: { type: 'string' }, desc: { type: 'string' } }, required: ['name'] }, description: '角色设定(名称 + 外观/性格描述)' },
3719
3830
  scenes: { type: 'array', items: { type: 'object', properties: { name: { type: 'string' }, desc: { type: 'string' } }, required: ['name'] }, description: '场景设定' },
3720
3831
  props: { type: 'array', items: { type: 'object', properties: { name: { type: 'string' }, desc: { type: 'string' } }, required: ['name'] }, description: '道具设定' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninkch/dsh-infinite-canvas",
3
- "version": "0.19.16",
3
+ "version": "0.19.17",
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",