dsh-ppt 0.34.0 → 0.35.0

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.
@@ -39,7 +39,22 @@ import {
39
39
  renderExemplarPromptGuide,
40
40
  } from './deck-exemplars.mjs'
41
41
  import { upgradeWeakDeck, resequenceSlidesToExemplar, selfRepairDeck, synthesizeActionTitle } from './deck-upgrader.mjs'
42
- import { normalizeEvidenceLedger, applyEvidenceLedgerToSlides, auditEvidenceAndSourcing, buildResearchPlan } from './deck-evidence.mjs'
42
+ import {
43
+ normalizeEvidenceLedger,
44
+ applyEvidenceLedgerToSlides,
45
+ auditEvidenceAndSourcing,
46
+ buildResearchPlan,
47
+ AUTHORITATIVE_DOMAINS,
48
+ NOISE_DOMAINS,
49
+ detectResearchDomain,
50
+ buildAuthoritativeQueryPack,
51
+ classifySourceAuthority,
52
+ buildHybridEnrichmentPlan,
53
+ mergeHybridEvidence,
54
+ } from './deck-evidence.mjs'
55
+ import { renderDeckWorkbookXlsx, renderDeckReportDocx, renderDeckMemoMarkdown, renderQaPrepMarkdown } from './deck-export.mjs'
56
+ import { slideBankPathFor, loadSlideBank, saveSlideToBank, listSlideBank, removeBankSlide, mergeDecks } from './deck-compose.mjs'
57
+ import { extractTranslationBundle, applyTranslationBundle } from './deck-i18n.mjs'
43
58
  import { computeMapModel, computeIsometricModel, generateVisualBrief, normalizeImageBrief } from './deck-infographics.mjs'
44
59
  import {
45
60
  normalizeBrandKit,
@@ -58,7 +73,7 @@ export { absorbPptx } from './deck-absorb.mjs'
58
73
  export { extractPptxSlides } from './deck-import.mjs'
59
74
  export { renderHandoutMarkdown, computePaceBudget, renderOnePagerHtml, renderSubtitlesSrt, renderSubtitlesVtt } from './deck-delivery.mjs'
60
75
  export { REMIX_PRESETS, REMIX_PRESET_IDS, remixSlides, renderSocialCarouselHtml } from './deck-remix.mjs'
61
- export { extractOfficeSource, importOfficeDeck } from './deck-office.mjs'
76
+ export { extractOfficeSource, importOfficeDeck, inspectLocalImage, inspectImageBytes, inspectOfficePack } from './deck-office.mjs'
62
77
  export { inferThemeFromContent, optimizeVisualRhythm } from './deck-director.mjs'
63
78
  export { listAllTasteRecipes, listCuratedTasteRecipes, loadWorkspaceTasteRecipes, saveWorkspaceTasteRecipe, resolveTasteRecipe } from './deck-taste.mjs'
64
79
  export {
@@ -76,7 +91,23 @@ export {
76
91
  renderExemplarPromptGuide,
77
92
  } from './deck-exemplars.mjs'
78
93
  export { upgradeWeakDeck, resequenceSlidesToExemplar, selfRepairDeck, synthesizeActionTitle } from './deck-upgrader.mjs'
79
- export { normalizeEvidenceLedger, applyEvidenceLedgerToSlides, auditEvidenceAndSourcing, buildResearchPlan } from './deck-evidence.mjs'
94
+ export {
95
+ normalizeEvidenceLedger,
96
+ applyEvidenceLedgerToSlides,
97
+ auditEvidenceAndSourcing,
98
+ buildResearchPlan,
99
+ AUTHORITATIVE_DOMAINS,
100
+ NOISE_DOMAINS,
101
+ detectResearchDomain,
102
+ buildAuthoritativeQueryPack,
103
+ classifySourceAuthority,
104
+ buildHybridEnrichmentPlan,
105
+ mergeHybridEvidence,
106
+ } from './deck-evidence.mjs'
107
+ export { renderDeckWorkbookXlsx, renderDeckReportDocx, renderDeckMemoMarkdown, renderQaPrepMarkdown } from './deck-export.mjs'
108
+ export { slideBankPathFor, loadSlideBank, saveSlideToBank, listSlideBank, removeBankSlide, mergeDecks } from './deck-compose.mjs'
109
+ export { extractTranslationBundle, applyTranslationBundle } from './deck-i18n.mjs'
110
+ export { EXEC_CHART_LAYOUTS, computeIssueTreeModel, computeTreemapModel, computeGaugeModel, computePricingModel } from './deck-charts-exec.mjs'
80
111
  export { computeMapModel, computeIsometricModel, generateVisualBrief, normalizeImageBrief } from './deck-infographics.mjs'
81
112
  export {
82
113
  normalizeBrandKit,
@@ -298,7 +329,7 @@ function validateRawSlides(slides) {
298
329
  }
299
330
 
300
331
  function snapshot(manifest) {
301
- return clone(Object.fromEntries(['title', 'theme', 'language', 'motion', 'slides', 'brand', 'brandKit', 'template', 'dataModel', 'evidence', 'targetMinutes', 'taste'].filter(k => manifest[k] !== undefined).map(k => [k, manifest[k]])))
332
+ return clone(Object.fromEntries(['title', 'theme', 'language', 'motion', 'motionProfile', 'slides', 'brand', 'brandKit', 'template', 'dataModel', 'evidence', 'targetMinutes', 'taste'].filter(k => manifest[k] !== undefined).map(k => [k, manifest[k]])))
302
333
  }
303
334
 
304
335
  function collectAssets(manifest) {
@@ -367,8 +398,10 @@ export function checkManifest(manifest) {
367
398
  issue(i, 'template-unfilled', '模板中还有待填写内容', '提供实际事实、依据和行动,填完后重新检查')
368
399
  }
369
400
  if (slide.layout === 'table') {
370
- if ((slide.rows?.[0]?.length ?? 0) > 6) issue(i, 'small-font', '表格超过 6 列,使用较小字号,小屏放映可能难以阅读', '减少列数或把重点数据改成图表,导出后检查可读性')
371
- if (slide.rows?.some(row => row.some(c => textWidth(c) > 18))) issue(i, 'table-density', '表格单元格文字较长,可能换行拥挤', '精简单元格或减少列数')
401
+ const colCount = slide.rows?.[0]?.length ?? 0
402
+ if (colCount > 6) issue(i, 'small-font', '表格超过 6 列,使用较小字号,小屏放映可能难以阅读', '减少列数或把重点数据改成图表,导出后检查可读性')
403
+ const cellLimit = colCount <= 4 && slide.tableStyle === 'booktabs' ? 24 : 18
404
+ if (slide.rows?.some(row => row.some(c => textWidth(c) > cellLimit))) issue(i, 'table-density', '表格单元格文字较长,可能换行拥挤', '精简单元格或减少列数')
372
405
  }
373
406
  const boxes = MEDIA_LAYOUTS.has(slide.layout) ? mediaBoxes(slide.layout, slide.variant, slide) : null
374
407
  if (Array.isArray(boxes?.gallery) && Array.isArray(slide.images) && slide.images.length > 1) {
@@ -567,6 +600,34 @@ function documentBytes(manifest) {
567
600
  if (Buffer.byteLength(text) > MAX_DOCUMENT) fail('JSON 工程含历史超过 64 MiB,请缩减图片或清理历史后另存工程')
568
601
  return text
569
602
  }
603
+ const ALLOWED_EXPORT_KINDS = new Set(['xlsx', 'docx', 'qa-prep', 'memo', 'social-carousel', 'subtitles', 'handout', 'one-pager', 'i18n'])
604
+
605
+ function parseExportOptions(options = {}) {
606
+ const list = Array.isArray(options.exports)
607
+ ? options.exports.map(x => String(x ?? '').trim().toLowerCase()).filter(Boolean)
608
+ : []
609
+ for (const kind of list) {
610
+ if (!ALLOWED_EXPORT_KINDS.has(kind)) {
611
+ fail('未知导出格式 exports:' + kind + '(支持 ' + [...ALLOWED_EXPORT_KINDS].join(' / ') + ')')
612
+ }
613
+ }
614
+ const set = new Set(list)
615
+ return {
616
+ writeHandout: options.handout === true || set.has('handout'),
617
+ writeOnePager: options.onePager === true || set.has('one-pager'),
618
+ writeCarousel: Boolean(options.socialCarousel) || set.has('social-carousel'),
619
+ carouselRatio: options.socialCarousel === '1:1' ? '1:1' : '4:5',
620
+ writeSubtitles: Boolean(options.subtitles) || set.has('subtitles'),
621
+ subtitlesFormat: options.subtitles === 'vtt' ? 'vtt' : 'srt',
622
+ writeXlsx: set.has('xlsx'),
623
+ writeDocx: set.has('docx'),
624
+ writeMemo: set.has('memo'),
625
+ writeQaPrep: set.has('qa-prep'),
626
+ writeI18n: set.has('i18n'),
627
+ hasAnyExtra: set.size > 0 || options.handout === true || options.onePager === true || Boolean(options.socialCarousel) || Boolean(options.subtitles),
628
+ }
629
+ }
630
+
570
631
  function result(manifest, paths, writeHandout = false, writeOnePager = false, extra = {}) {
571
632
  const base = paths.json.slice(0, -5)
572
633
  const handoutPath = base + '.handout.md'
@@ -574,6 +635,11 @@ function result(manifest, paths, writeHandout = false, writeOnePager = false, ex
574
635
  const carouselPath = base + '.carousel.html'
575
636
  const subtitlesExt = extra.subtitlesFormat === 'vtt' ? '.vtt' : '.srt'
576
637
  const subtitlesPath = base + subtitlesExt
638
+ const xlsxPath = base + '.xlsx'
639
+ const docxPath = base + '.docx'
640
+ const memoPath = base + '.memo.md'
641
+ const qaPrepPath = base + '.qa-prep.md'
642
+ const i18nPath = base + '.i18n.json'
577
643
  const paceBudget = computePaceBudget(manifest)
578
644
  return { ok: true, title: manifest.title, theme: manifest.theme, language: manifest.language,
579
645
  slideCount: manifest.slides.length, deckId: manifest.deckId, revision: manifest.revision,
@@ -587,7 +653,12 @@ function result(manifest, paths, writeHandout = false, writeOnePager = false, ex
587
653
  ...(writeHandout ? { handoutPath } : {}),
588
654
  ...(writeOnePager ? { onePagerPath } : {}),
589
655
  ...(extra.writeCarousel ? { carouselPath } : {}),
590
- ...(extra.writeSubtitles ? { subtitlesPath } : {}) }
656
+ ...(extra.writeSubtitles ? { subtitlesPath } : {}),
657
+ ...(extra.writeXlsx ? { xlsxPath } : {}),
658
+ ...(extra.writeDocx ? { docxPath } : {}),
659
+ ...(extra.writeMemo ? { memoPath } : {}),
660
+ ...(extra.writeQaPrep ? { qaPrepPath } : {}),
661
+ ...(extra.writeI18n ? { i18nPath } : {}) }
591
662
  }
592
663
  function pathsFor(jsonPath) {
593
664
  const base = jsonPath.slice(0, -5)
@@ -651,6 +722,21 @@ function commit(paths, data, writeHandout = false, writeOnePager = false, extra
651
722
  : renderSubtitlesSrt(data.manifest, data.language.id)
652
723
  artifacts.push({ path: subtitlesPath, data: subData, encoding: 'utf8' })
653
724
  }
725
+ if (extra.writeXlsx) {
726
+ artifacts.push({ path: base + '.xlsx', data: renderDeckWorkbookXlsx(data.manifest) })
727
+ }
728
+ if (extra.writeDocx) {
729
+ artifacts.push({ path: base + '.docx', data: renderDeckReportDocx(data.manifest, data.language.id) })
730
+ }
731
+ if (extra.writeMemo) {
732
+ artifacts.push({ path: base + '.memo.md', data: renderDeckMemoMarkdown(data.manifest, data.language.id), encoding: 'utf8' })
733
+ }
734
+ if (extra.writeQaPrep) {
735
+ artifacts.push({ path: base + '.qa-prep.md', data: renderQaPrepMarkdown(data.manifest, data.language.id), encoding: 'utf8' })
736
+ }
737
+ if (extra.writeI18n) {
738
+ artifacts.push({ path: base + '.i18n.json', data: JSON.stringify(extractTranslationBundle(data.manifest), null, 2) + '\n', encoding: 'utf8' })
739
+ }
654
740
  commitDeckArtifacts(artifacts)
655
741
  }
656
742
 
@@ -746,6 +832,9 @@ function mapSlidesToAbsorbedSkeleton(slides, slideSkeleton, langId) {
746
832
 
747
833
  export async function buildDeckAsync(options = {}) {
748
834
  abort(options.signal)
835
+ if (Array.isArray(options.mergeSources) && options.mergeSources.length > 0) {
836
+ return mergeDecks({ ...options, sources: options.mergeSources })
837
+ }
749
838
  validateRawSlides(options.slides)
750
839
  const cwd = resolve(options.cwd || '.')
751
840
  const scenario = options.template ? findScenarioTemplate(options.template) : undefined
@@ -862,7 +951,10 @@ export async function buildDeckAsync(options = {}) {
862
951
  normalized.deck.slides = optimizeVisualRhythm(normalized.deck.slides, resolvedTaste)
863
952
  }
864
953
 
865
- const evidence = normalizeEvidenceLedger(options.evidence)
954
+ const evidence = normalizeEvidenceLedger(options.evidence, {
955
+ preferredSources: activeBrandKit?.preferredSources,
956
+ blockedDomains: activeBrandKit?.blockedDomains,
957
+ })
866
958
  if (evidence.length > 0) {
867
959
  const appliedEvidence = applyEvidenceLedgerToSlides(normalized.deck.slides, evidence, {
868
960
  lang: langId,
@@ -916,6 +1008,8 @@ export async function buildDeckAsync(options = {}) {
916
1008
  ...(activeBrandKit.watermark ? { watermark: activeBrandKit.watermark } : {}),
917
1009
  ...(activeBrandKit.brand?.primaryColor ? { brand: { primaryColor: activeBrandKit.brand.primaryColor } } : {}),
918
1010
  ...(Array.isArray(activeBrandKit.forbiddenTerms) && activeBrandKit.forbiddenTerms.length > 0 ? { forbiddenTerms: activeBrandKit.forbiddenTerms } : {}),
1011
+ ...(Array.isArray(activeBrandKit.preferredSources) && activeBrandKit.preferredSources.length > 0 ? { preferredSources: activeBrandKit.preferredSources } : {}),
1012
+ ...(Array.isArray(activeBrandKit.blockedDomains) && activeBrandKit.blockedDomains.length > 0 ? { blockedDomains: activeBrandKit.blockedDomains } : {}),
919
1013
  }
920
1014
  : undefined
921
1015
 
@@ -935,6 +1029,7 @@ export async function buildDeckAsync(options = {}) {
935
1029
  theme: normalized.theme.id,
936
1030
  language: normalized.language.id,
937
1031
  motion: normalized.motion,
1032
+ ...(normalized.motionProfile ? { motionProfile: normalized.motionProfile } : {}),
938
1033
  ...(resolvedTaste ? { taste: listCuratedTasteRecipes().some(r => r.id === resolvedTaste.id) ? resolvedTaste.id : resolvedTaste } : {}),
939
1034
  ...(resolvedExemplar ? { exemplar: resolvedExemplar.id } : {}),
940
1035
  ...(targetMinutesRaw !== undefined ? { targetMinutes: targetMinutesRaw } : {}),
@@ -980,16 +1075,9 @@ export async function buildDeckAsync(options = {}) {
980
1075
  // Resolve collisions after asynchronous rendering; an earlier call may have committed meanwhile.
981
1076
  const file = resolveDeckFileName(normalized.outputDir, normalized.fileName, normalized.overwrite)
982
1077
  const paths = pathsFor(resolve(normalized.outputDir, file + '.json'))
983
- const writeHandout = options.handout === true
984
- const writeOnePager = options.onePager === true
985
- const extraOpts = {
986
- writeCarousel: Boolean(options.socialCarousel),
987
- carouselRatio: options.socialCarousel === '1:1' ? '1:1' : '4:5',
988
- writeSubtitles: Boolean(options.subtitles),
989
- subtitlesFormat: options.subtitles === 'vtt' ? 'vtt' : 'srt',
990
- }
991
- withLock(paths.json, () => { abort(options.signal); commit(paths, data, writeHandout, writeOnePager, extraOpts) })
992
- const builtResult = result(activeManifest, paths, writeHandout, writeOnePager, extraOpts)
1078
+ const exp = parseExportOptions(options)
1079
+ withLock(paths.json, () => { abort(options.signal); commit(paths, data, exp.writeHandout, exp.writeOnePager, exp) })
1080
+ const builtResult = result(activeManifest, paths, exp.writeHandout, exp.writeOnePager, exp)
993
1081
  return upgradeReport ? { ...builtResult, upgradeReport } : builtResult
994
1082
  }
995
1083
 
@@ -1032,7 +1120,7 @@ export function readDeckProject(options = {}) {
1032
1120
  function expected(manifest, revision) {
1033
1121
  if (revision !== undefined && (!Number.isInteger(revision) || revision !== manifest.revision)) fail(`修订号冲突:当前 revision=${manifest.revision},请重新读取工程后修改`)
1034
1122
  }
1035
- async function saveRevision(state, next, signal, saveAs = false, preserveUndo = false, saveAsSuffix = '-dsh') {
1123
+ async function saveRevision(state, next, signal, saveAs = false, preserveUndo = false, saveAsSuffix = '-dsh', expOpts = {}) {
1036
1124
  if (!saveAs) { const problem = artifactProblem(state.manifest, pathsFor(state.path)); if (problem) fail(problem) }
1037
1125
  next.version = DECK_VERSION; next.schemaVersion = 1; next.revision = state.manifest.revision + 1
1038
1126
  if (saveAs) { next.deckId = randomUUID(); next.revision = 0; next.history = preserveUndo ? [snapshot(state.manifest)] : [] }
@@ -1047,9 +1135,9 @@ async function saveRevision(state, next, signal, saveAs = false, preserveUndo =
1047
1135
  } else {
1048
1136
  const problem = artifactProblem(state.manifest, paths); if (problem) fail(problem)
1049
1137
  }
1050
- commit(paths, data)
1138
+ commit(paths, data, expOpts.writeHandout === true, expOpts.writeOnePager === true, expOpts)
1051
1139
  })
1052
- return result(next, paths)
1140
+ return result(next, paths, expOpts.writeHandout === true, expOpts.writeOnePager === true, expOpts)
1053
1141
  }
1054
1142
 
1055
1143
  export async function remixDeck(options = {}) {
@@ -1077,6 +1165,7 @@ export async function editDeck(options = {}) {
1077
1165
  const state = readDocument(options.deckPath, options.cwd), current = state.manifest
1078
1166
  expected(current, options.expectedRevision)
1079
1167
  const next = clone(current)
1168
+ const expOpts = parseExportOptions(options)
1080
1169
  if (!Array.isArray(options.edits) || !options.edits.length) {
1081
1170
  if (
1082
1171
  options.brand === undefined &&
@@ -1089,14 +1178,18 @@ export async function editDeck(options = {}) {
1089
1178
  options.append === undefined &&
1090
1179
  options.targetMinutes === undefined &&
1091
1180
  options.remixPreset === undefined &&
1181
+ options.motionProfile === undefined &&
1182
+ options.saveToBank === undefined &&
1183
+ options.translations === undefined &&
1184
+ !expOpts.hasAnyExtra &&
1092
1185
  options.saveAs !== true
1093
1186
  ) {
1094
- fail('请提供 edits、theme、taste、referencePptx、order、duplicate、remove、append、targetMinutes、remixPreset 或 brand')
1187
+ fail('请提供 edits、theme、taste、referencePptx、order、duplicate、remove、append、targetMinutes、remixPreset、motionProfile、saveToBank、translations、exports 或 brand')
1095
1188
  }
1096
1189
  }
1097
1190
  const used = new Set()
1098
1191
  const allowed = new Set([
1099
- 'layout', 'variant', 'chrome', 'cardMaterial', 'iconMode', 'coverPattern', 'imageBrief', 'title', 'subtitle', 'kicker', 'takeaway', 'source', 'evidenceIds',
1192
+ 'layout', 'variant', 'chrome', 'cardMaterial', 'iconMode', 'reveal', 'coverPattern', 'imageBrief', 'title', 'subtitle', 'kicker', 'takeaway', 'source', 'evidenceIds',
1100
1193
  'text', 'formula', 'mermaid', 'code', 'language', 'filename', 'url', 'xLabel', 'yLabel', 'activeIndex', 'tableStyle',
1101
1194
  'bullets', 'items', 'cards', 'metrics', 'columns', 'steps', 'quadrants', 'rows', 'notes', 'image', 'images', 'chart', 'visual',
1102
1195
  ])
@@ -1242,6 +1335,39 @@ export async function editDeck(options = {}) {
1242
1335
  ...(options.brand?.logo === null ? { logo: undefined, logoAssetId: undefined } : {}) }, next.assets, cwd)
1243
1336
  if (next.brand && Object.keys(next.brand).length === 0) delete next.brand
1244
1337
  }
1338
+ if (options.motionProfile !== undefined) {
1339
+ if (options.motionProfile === null || options.motionProfile === '') {
1340
+ delete next.motionProfile
1341
+ } else {
1342
+ const mp = String(options.motionProfile).trim().toLowerCase()
1343
+ if (!['subtle', 'executive', 'keynote'].includes(mp)) fail('motionProfile 仅支持 subtle / executive / keynote')
1344
+ next.motionProfile = mp
1345
+ }
1346
+ }
1347
+
1348
+ let savedBankEntry
1349
+ if (options.saveToBank !== undefined && options.saveToBank !== null) {
1350
+ const bankSpec = typeof options.saveToBank === 'number' || typeof options.saveToBank === 'string'
1351
+ ? { slide: options.saveToBank }
1352
+ : options.saveToBank
1353
+ savedBankEntry = saveSlideToBank(cwd, next, bankSpec.slide, {
1354
+ bankId: bankSpec.bankId,
1355
+ name: bankSpec.name,
1356
+ tags: bankSpec.tags,
1357
+ })
1358
+ }
1359
+
1360
+ if (options.translations !== undefined && options.translations !== null) {
1361
+ const mode = (options.bilingualMode === true || options.bilingualMode === 'bilingual') ? 'bilingual' : 'replace'
1362
+ const translated = applyTranslationBundle(next, options.translations, {
1363
+ mode,
1364
+ targetLang: options.targetLang,
1365
+ })
1366
+ next.title = translated.title
1367
+ next.language = translated.language
1368
+ next.slides = translated.slides
1369
+ }
1370
+
1245
1371
  let remixReport
1246
1372
  let saveAsFlag = options.saveAs === true
1247
1373
  let saveAsSuffix = '-dsh'
@@ -1255,10 +1381,24 @@ export async function editDeck(options = {}) {
1255
1381
  saveAsSuffix = '-' + remixed.preset.id
1256
1382
  }
1257
1383
  }
1258
- if (!saveAsFlag && JSON.stringify(snapshot(next)) === JSON.stringify(snapshot(current))) return { ...result(current, pathsFor(state.path)), changed: false }
1259
- next.history = [...next.history, snapshot(current)].slice(-MAX_HISTORY)
1260
- const saved = await saveRevision(state, next, options.signal, saveAsFlag, options.preserveUndo === true || Boolean(remixReport), saveAsSuffix)
1261
- return { ...saved, changed: true, ...(remixReport ? { remixReport } : {}) }
1384
+ const unchangedContent = JSON.stringify(snapshot(next)) === JSON.stringify(snapshot(current))
1385
+ if (!saveAsFlag && unchangedContent && !expOpts.hasAnyExtra) {
1386
+ return {
1387
+ ...result(current, pathsFor(state.path)),
1388
+ changed: false,
1389
+ ...(savedBankEntry ? { savedBankEntry } : {}),
1390
+ }
1391
+ }
1392
+ if (!unchangedContent) {
1393
+ next.history = [...next.history, snapshot(current)].slice(-MAX_HISTORY)
1394
+ }
1395
+ const saved = await saveRevision(state, next, options.signal, saveAsFlag, options.preserveUndo === true || Boolean(remixReport), saveAsSuffix, expOpts)
1396
+ return {
1397
+ ...saved,
1398
+ changed: !unchangedContent || saveAsFlag || expOpts.hasAnyExtra,
1399
+ ...(remixReport ? { remixReport } : {}),
1400
+ ...(savedBankEntry ? { savedBankEntry } : {}),
1401
+ }
1262
1402
  }
1263
1403
 
1264
1404
  /** An AI-selected, bounded formatting vocabulary; always an undoable new copy. */
@@ -1281,7 +1421,7 @@ export async function undoDeck(options = {}) {
1281
1421
  expected(state.manifest, options.expectedRevision)
1282
1422
  if (!state.manifest.history.length) fail('该工程没有可撤销的修改')
1283
1423
  const next = clone(state.manifest), prior = next.history.pop()
1284
- for (const key of ['brand', 'brandKit', 'template', 'dataModel', 'targetMinutes', 'taste']) delete next[key]
1424
+ for (const key of ['brand', 'brandKit', 'template', 'dataModel', 'targetMinutes', 'taste', 'motionProfile']) delete next[key]
1285
1425
  Object.assign(next, prior)
1286
1426
  return saveRevision(state, next, options.signal)
1287
1427
  }
@@ -1308,13 +1448,42 @@ export async function updateDeckData(options = {}) {
1308
1448
 
1309
1449
  export function checkDeck(options = {}) {
1310
1450
  abort(options.signal)
1311
- const { manifest, path } = readDocument(options.deckPath, options.cwd)
1451
+ const cwd = resolve(options.cwd || '.')
1452
+ const { manifest, path } = readDocument(options.deckPath, cwd)
1312
1453
  const quality = checkManifest(manifest), problem = artifactProblem(manifest, pathsFor(path))
1313
1454
  if (problem) {
1314
1455
  quality.issues.push({ slide: 0, severity: 'error', code: 'artifact-conflict', message: problem, suggestion: '保留原成品,使用 saveAs:true 或面板「另存副本」。副本不包含 Office 手工修改。' })
1315
1456
  quality.errorCount++; quality.ok = false
1316
1457
  }
1458
+ let stakeholderFeedback
1459
+ if (options.feedbackPath !== undefined && options.feedbackPath !== null && String(options.feedbackPath).trim() !== '') {
1460
+ const fbFile = resolve(cwd, String(options.feedbackPath).trim())
1461
+ let parsedFb
1462
+ try { parsedFb = JSON.parse(readFileSync(fbFile, 'utf8')) } catch { fail('无法读取审阅反馈文件 feedbackPath:' + fbFile) }
1463
+ const rawList = Array.isArray(parsedFb) ? parsedFb : (Array.isArray(parsedFb?.comments) ? parsedFb.comments : [])
1464
+ stakeholderFeedback = rawList
1465
+ .filter(c => c && typeof c === 'object' && String(c.text || '').trim())
1466
+ .map((c, idx) => ({
1467
+ id: String(c.id || `fb-${idx + 1}`),
1468
+ slide: Number.isInteger(c.slide) && c.slide >= 1 ? Math.min(manifest.slides.length, c.slide) : 1,
1469
+ author: String(c.author || 'Reviewer').slice(0, 60),
1470
+ text: String(c.text).replace(/\s+/g, ' ').trim().slice(0, 400),
1471
+ createdAt: c.createdAt ? String(c.createdAt) : '',
1472
+ }))
1473
+ for (const c of stakeholderFeedback) {
1474
+ quality.issues.push({
1475
+ slide: c.slide,
1476
+ slideId: manifest.slides[c.slide - 1]?.id,
1477
+ severity: 'warning',
1478
+ code: 'stakeholder-feedback',
1479
+ message: `[审阅批注 · ${c.author}] ${c.text}`,
1480
+ suggestion: '请根据审阅人意见调用 ppt_edit 修改对应页面并复核',
1481
+ })
1482
+ quality.warningCount += 1
1483
+ }
1484
+ }
1317
1485
  return { ...quality, deckPath: path, deckId: manifest.deckId, revision: manifest.revision,
1486
+ ...(stakeholderFeedback ? { stakeholderFeedback } : {}),
1318
1487
  verification: { static: 'checked', pptxRender: 'not-verified', visual: 'not-verified' },
1319
1488
  undoAvailable: manifest.history.length, slides: manifest.slides.map((s, i) => ({ slide: i + 1, id: s.id, title: s.title, layout: s.layout })) }
1320
1489
  }
@@ -56,6 +56,15 @@ export function normalizeBrandKit(raw) {
56
56
  .filter((t) => t.length >= 2),
57
57
  )].slice(0, MAX_FORBIDDEN_TERMS)
58
58
 
59
+ const normalizeSourceList = (arr) => [...new Set(
60
+ (Array.isArray(arr) ? arr : [])
61
+ .map((s) => cleanStr(s, 96).replace(/^https?:\/\//i, '').replace(/\/.*$/, '').toLowerCase())
62
+ .filter((s) => s.length >= 2),
63
+ )].slice(0, MAX_FORBIDDEN_TERMS)
64
+
65
+ const preferredSources = normalizeSourceList(raw.preferredSources)
66
+ const blockedDomains = normalizeSourceList(raw.blockedDomains)
67
+
59
68
  let mandatoryClosing
60
69
  if (raw.mandatoryClosing && typeof raw.mandatoryClosing === 'object' && !Array.isArray(raw.mandatoryClosing)) {
61
70
  const mcTitle = cleanStr(raw.mandatoryClosing.title, 120)
@@ -78,6 +87,8 @@ export function normalizeBrandKit(raw) {
78
87
  ...(Object.keys(brand).length > 0 ? { brand } : {}),
79
88
  ...(watermark ? { watermark } : {}),
80
89
  ...(forbiddenTerms.length > 0 ? { forbiddenTerms } : {}),
90
+ ...(preferredSources.length > 0 ? { preferredSources } : {}),
91
+ ...(blockedDomains.length > 0 ? { blockedDomains } : {}),
81
92
  ...(mandatoryClosing ? { mandatoryClosing } : {}),
82
93
  updatedAt: raw.updatedAt || new Date().toISOString(),
83
94
  }
@@ -121,6 +132,8 @@ export function buildBrandKitFromAbsorbed(absorbed, options = {}) {
121
132
  },
122
133
  ...(options.watermark ? { watermark: options.watermark } : {}),
123
134
  ...(Array.isArray(options.forbiddenTerms) ? { forbiddenTerms: options.forbiddenTerms } : {}),
135
+ ...(Array.isArray(options.preferredSources) ? { preferredSources: options.preferredSources } : {}),
136
+ ...(Array.isArray(options.blockedDomains) ? { blockedDomains: options.blockedDomains } : {}),
124
137
  ...(options.mandatoryClosing ? { mandatoryClosing: options.mandatoryClosing } : {}),
125
138
  })
126
139
  }