dsh-ppt 0.27.2 → 0.29.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.en.md +23 -22
  3. package/README.md +23 -22
  4. package/docs/USAGE.en.md +2 -0
  5. package/docs/USAGE.md +2 -0
  6. package/docs/VALIDATION.md +8 -0
  7. package/docs/assets/intro/workflow-en-dark.svg +1 -1
  8. package/docs/assets/intro/workflow-en-light.svg +1 -1
  9. package/docs/assets/intro/workflow-en-mobile-dark.svg +1 -1
  10. package/docs/assets/intro/workflow-en-mobile-light.svg +1 -1
  11. package/docs/assets/intro/workflow-zh-dark.svg +1 -1
  12. package/docs/assets/intro/workflow-zh-light.svg +1 -1
  13. package/docs/assets/intro/workflow-zh-mobile-dark.svg +1 -1
  14. package/docs/assets/intro/workflow-zh-mobile-light.svg +1 -1
  15. package/lib/client.js +283 -33
  16. package/lib/execution.d.ts +7 -0
  17. package/lib/execution.js +47 -6
  18. package/lib/tools.js +62 -12
  19. package/lib/types.d.ts +51 -4
  20. package/lib/workbench.js +185 -9
  21. package/package.json +1 -1
  22. package/skills/dsh-ppt/SKILL.md +4 -2
  23. package/skills/dsh-ppt/package.json +1 -1
  24. package/skills/dsh-ppt/references/exemplars.md +116 -0
  25. package/skills/dsh-ppt/scripts/build-deck.mjs +20 -1
  26. package/skills/dsh-ppt/scripts/deck-absorb.mjs +27 -3
  27. package/skills/dsh-ppt/scripts/deck-advanced.mjs +107 -24
  28. package/skills/dsh-ppt/scripts/deck-charts-pro.mjs +1004 -0
  29. package/skills/dsh-ppt/scripts/deck-chrome.mjs +27 -6
  30. package/skills/dsh-ppt/scripts/deck-core.mjs +96 -3
  31. package/skills/dsh-ppt/scripts/deck-covers.mjs +157 -3
  32. package/skills/dsh-ppt/scripts/deck-exemplars.mjs +548 -0
  33. package/skills/dsh-ppt/scripts/deck-layouts.mjs +90 -2
  34. package/skills/dsh-ppt/scripts/deck-showcase.mjs +729 -0
  35. package/skills/dsh-ppt/scripts/deck-upgrader.mjs +618 -0
@@ -20,6 +20,13 @@ export declare function createPptExecutors(config: ResolvedPptConfig, loadEngine
20
20
  create(rawArgs: unknown, exec?: PptExecution): Promise<PptCreateResult>;
21
21
  absorb(rawArgs: unknown, exec?: PptExecution): Promise<PptAbsorbResult>;
22
22
  templates(rawArgs: unknown, exec?: PptExecution): Promise<{
23
+ exemplar: import("./types.js").PptExemplarSummary;
24
+ promptGuide: string;
25
+ exemplars?: import("./types.js").PptExemplarSummary[] | undefined;
26
+ ok: boolean;
27
+ templates: unknown[];
28
+ } | {
29
+ exemplars?: import("./types.js").PptExemplarSummary[] | undefined;
23
30
  ok: boolean;
24
31
  templates: unknown[];
25
32
  }>;
package/lib/execution.js CHANGED
@@ -1,4 +1,4 @@
1
- import { existsSync, readFileSync } from 'node:fs';
1
+ import { existsSync, readFileSync, statSync } from 'node:fs';
2
2
  import { homedir } from 'node:os';
3
3
  import { dirname, join, resolve } from 'node:path';
4
4
  import { attachCitationsToDeck, exportRemotionBundle } from './ecosystem.js';
@@ -82,8 +82,10 @@ export function createPptExecutors(config, loadEngine = getEngine) {
82
82
  title: args.title.trim(),
83
83
  content: typeof args.content === 'string' ? args.content : '',
84
84
  slides: hasSlides ? args.slides : undefined,
85
- theme: typeof args.theme === 'string' && args.theme.trim() !== '' ? args.theme.trim() : (args.taste ? undefined : (config.defaultTheme || (typeof engine.absorbPptx === 'function' ? 'auto' : undefined))),
85
+ theme: typeof args.theme === 'string' && args.theme.trim() !== '' ? args.theme.trim() : ((args.taste || args.exemplar) ? undefined : (config.defaultTheme || (typeof engine.absorbPptx === 'function' ? 'auto' : undefined))),
86
86
  ...(args.taste ? { taste: args.taste } : {}),
87
+ ...(typeof args.exemplar === 'string' && args.exemplar.trim() !== '' ? { exemplar: args.exemplar.trim() } : {}),
88
+ ...(typeof args.autoUpgrade === 'boolean' ? { autoUpgrade: args.autoUpgrade } : {}),
87
89
  persona: typeof args.persona === 'string' && args.persona.trim() !== '' ? args.persona.trim() : undefined,
88
90
  referencePptx: typeof args.referencePptx === 'string' && args.referencePptx.trim() !== '' ? args.referencePptx.trim() : undefined,
89
91
  cloneStructure: typeof args.cloneStructure === 'boolean' ? args.cloneStructure : undefined,
@@ -105,17 +107,41 @@ export function createPptExecutors(config, loadEngine = getEngine) {
105
107
  async absorb(rawArgs, exec) {
106
108
  exec?.signal?.throwIfAborted();
107
109
  const args = asRecord(rawArgs);
108
- if (typeof args.pptxPath !== 'string' || args.pptxPath.trim() === '') {
109
- throw new Error('dsh-ppt:pptxPath 不能为空');
110
+ const explicitCorpusDir = typeof args.corpusDir === 'string' && args.corpusDir.trim() !== '' ? args.corpusDir.trim() : '';
111
+ const pptxPath = typeof args.pptxPath === 'string' && args.pptxPath.trim() !== '' ? args.pptxPath.trim() : '';
112
+ if (!explicitCorpusDir && !pptxPath) {
113
+ throw new Error('dsh-ppt:pptxPath 不能为空(批量吸收目录也可直接传入目录路径或 corpusDir)');
110
114
  }
111
115
  const engine = await loadEngine();
112
116
  exec?.signal?.throwIfAborted();
113
117
  const cwd = exec?.agent?.session.header.cwd ?? process.cwd();
118
+ let corpusDir = explicitCorpusDir;
119
+ if (!corpusDir && pptxPath) {
120
+ const candidate = resolve(cwd, pptxPath);
121
+ try {
122
+ if (existsSync(candidate) && statSync(candidate).isDirectory())
123
+ corpusDir = pptxPath;
124
+ }
125
+ catch { /* fall through to single-file absorb */ }
126
+ }
127
+ if (corpusDir) {
128
+ if (typeof engine.ingestExemplarCorpus !== 'function') {
129
+ throw new Error('dsh-ppt:当前引擎版本暂不支持批量吸收目录语料');
130
+ }
131
+ return engine.ingestExemplarCorpus({
132
+ dirPath: corpusDir,
133
+ cwd,
134
+ ...(typeof args.limit === 'number' && Number.isFinite(args.limit) ? { limit: args.limit } : {}),
135
+ signal: exec?.signal,
136
+ });
137
+ }
114
138
  return engine.absorbPptx({
115
- pptxPath: args.pptxPath.trim(),
139
+ pptxPath,
116
140
  extractLogo: args.extractLogo !== false,
117
141
  ...(typeof args.saveTasteAs === 'string' && args.saveTasteAs.trim() ? { saveTasteAs: args.saveTasteAs.trim() } : {}),
118
142
  ...(typeof args.tasteName === 'string' && args.tasteName.trim() ? { tasteName: args.tasteName.trim() } : {}),
143
+ ...(typeof args.saveExemplarAs === 'string' && args.saveExemplarAs.trim() ? { saveExemplarAs: args.saveExemplarAs.trim() } : {}),
144
+ ...(typeof args.exemplarName === 'string' && args.exemplarName.trim() ? { exemplarName: args.exemplarName.trim() } : {}),
119
145
  cwd,
120
146
  signal: exec?.signal,
121
147
  });
@@ -125,7 +151,22 @@ export function createPptExecutors(config, loadEngine = getEngine) {
125
151
  const args = asRecord(rawArgs);
126
152
  const engine = await loadEngine();
127
153
  exec?.signal?.throwIfAborted();
128
- return { ok: true, templates: engine.listTemplates(typeof args.lang === 'string' ? args.lang : config.defaultLang || 'zh') };
154
+ const lang = typeof args.lang === 'string' && args.lang.trim() ? args.lang.trim() : config.defaultLang || 'zh';
155
+ const cwd = exec?.agent?.session.header.cwd ?? process.cwd();
156
+ const templates = engine.listTemplates(lang);
157
+ const workspaceExemplars = typeof engine.loadWorkspaceExemplars === 'function' ? engine.loadWorkspaceExemplars(cwd) : {};
158
+ const exemplars = typeof engine.listCuratedExemplars === 'function' ? engine.listCuratedExemplars(workspaceExemplars) : undefined;
159
+ const exemplarId = typeof args.exemplarId === 'string' ? args.exemplarId.trim() : '';
160
+ if (exemplarId && typeof engine.resolveExemplar === 'function') {
161
+ const exemplar = engine.resolveExemplar(exemplarId, workspaceExemplars);
162
+ if (!exemplar) {
163
+ const ids = (exemplars || []).map(item => item.id).join(', ');
164
+ throw new Error('dsh-ppt:未找到标杆范本 ' + exemplarId + (ids ? '(可用:' + ids + ')' : ''));
165
+ }
166
+ const promptGuide = typeof engine.renderExemplarPromptGuide === 'function' ? engine.renderExemplarPromptGuide(exemplar, lang) : '';
167
+ return { ok: true, templates, ...(exemplars ? { exemplars } : {}), exemplar, promptGuide };
168
+ }
169
+ return { ok: true, templates, ...(exemplars ? { exemplars } : {}) };
129
170
  },
130
171
  async edit(rawArgs, exec) {
131
172
  exec?.signal?.throwIfAborted();
package/lib/tools.js CHANGED
@@ -112,28 +112,45 @@ function renderThemes(value) {
112
112
  return oneText(summary + '\n\n想要并排对比:ppt_themes { preview: true, outputDir: "..." } 会生成 themes-preview.html 和每套主题的 SVG 色板卡。');
113
113
  }
114
114
  function renderAbsorb(value) {
115
+ if (value.dirPath && typeof value.ingestedCount === 'number') {
116
+ const items = Array.isArray(value.exemplars) ? value.exemplars : [];
117
+ const lines = [
118
+ 'dsh-ppt 已批量扫描并吸收优质 PPTX 语料目录:' + value.dirPath + '(扫描 ' + (value.scanned ?? 0) + ' 份,成功吸收 ' + value.ingestedCount + ' 份' + (value.failedCount ? ',跳过 ' + value.failedCount + ' 份' : '') + ')',
119
+ ...items.slice(0, 12).map((item) => `- ${item.id}(${item.file}):${item.slotCount} 页槽位 | 主题 ${item.theme} | 骨架 ${item.chromeStyle}${item.rhythmScore !== null && item.rhythmScore !== undefined ? ` | 节奏分 ${item.rhythmScore}` : ''}`),
120
+ ...(items.length > 12 ? ['…其余范本已写入工作区 .dsh-ppt/exemplars.json'] : []),
121
+ ...(items[0]?.id ? ['可直接调用 ppt_templates { exemplarId: ' + JSON.stringify(items[0].id) + ' } 查看逐页槽位契约,或 ppt_create { title: "...", content: "...", exemplar: ' + JSON.stringify(items[0].id) + ' } 一键按范本出稿。'] : []),
122
+ ];
123
+ return oneText(lines.join('\n'));
124
+ }
115
125
  const brand = value.sanitizedBrand ?? {};
116
126
  const profile = value.narrativeProfile;
117
127
  const parts = [
118
- 'dsh-ppt 已解析参考演示文稿' + (value.pptxPath ? ':' + value.pptxPath : '') + '(共 ' + value.slideCount + ' 页)',
119
- '推荐内置主题:' + value.recommendedTheme + (value.recommendedChrome ? ' | 推荐母版骨架:' + value.recommendedChrome : '') + (value.recommendedTableStyle ? ' | 推荐表格规范:' + value.recommendedTableStyle : ''),
128
+ 'dsh-ppt 已解析参考演示文稿' + (value.pptxPath ? ':' + value.pptxPath : '') + '(共 ' + (value.slideCount ?? 0) + ' 页)',
129
+ '推荐内置主题:' + (value.recommendedTheme || 'consulting') + (value.recommendedChrome ? ' | 推荐母版骨架:' + value.recommendedChrome : '') + (value.recommendedTableStyle ? ' | 推荐表格规范:' + value.recommendedTableStyle : ''),
120
130
  '净化后品牌色板:主色 ' + (brand.primaryColor || '—') + (brand.secondaryColor ? ' | 辅色 ' + brand.secondaryColor : '') + ' | 背景 ' + (brand.backgroundColor || '—') + ' | 文字 ' + (brand.textColor || '—') +
121
131
  (brand.fontFamily ? ' | 正文字体 ' + brand.fontFamily : '') + (brand.headingFont ? ' | 标题字体 ' + brand.headingFont : '') +
122
132
  (brand.coverMode === 'inverted-accent' ? ' | 深色反白封面 (' + (brand.coverBg || brand.primaryColor || '') + ')' : '') +
123
133
  (brand.chromeStyle ? ' | 骨架 ' + brand.chromeStyle : '') + (brand.logo ? ' | 已提取母版 Logo' : ''),
124
134
  ...(value.slideSkeleton?.length ? ['提取页面骨架:' + value.slideSkeleton.slice(0, 8).map(s => `P${s.slideNumber}:${s.inferredLayout}${s.variant ? `[${s.variant}]` : ''}`).join(' → ') + (value.slideSkeleton.length > 8 ? ' …' : '')] : []),
125
135
  ...(typeof profile?.diagramRatio === 'number' ? ['专业图示页占比:' + Math.round(Number(profile.diagramRatio) * 100) + '%'] : []),
136
+ ...(value.savedTastePath ? ['已持久化审美配方:' + value.savedTastePath] : []),
137
+ ...(value.savedExemplarPath ? ['已持久化标杆范本契约:' + value.savedExemplarPath + (value.exemplar?.id ? '(exemplar: "' + value.exemplar.id + '")' : '')] : []),
126
138
  '可直接调用 ppt_create { title: "...", content: "...", referencePptx: ' + JSON.stringify(value.pptxPath || '<参考文件.pptx>') + ', cloneStructure: true } 自动套用净化后的色板、母版骨架与版式序列。',
127
139
  ];
128
140
  return oneText(parts.join('\n'));
129
141
  }
130
142
  function renderCreate(value) {
143
+ const up = value.upgradeReport;
144
+ const upgradeLine = up && (Number(up.promotedCount || 0) > 0 || Number(up.splitCount || 0) > 0 || Number(up.rescuedTitles || 0) > 0 || Number(up.brokenStreaks || 0) > 0)
145
+ ? '\n智能升维补偿:版式升维 ' + (up.promotedCount ?? 0) + ' 页 · 拆分长文本墙 ' + (up.splitCount ?? 0) + ' 页 · 打断单调连页 ' + (up.brokenStreaks ?? 0) + ' 处 · 提炼结论标题 ' + (up.rescuedTitles ?? 0) + ' 页' + (value.exemplar ? '(范本契约:' + value.exemplar + ')' : '')
146
+ : (value.exemplar ? '\n标杆范本契约:' + value.exemplar : '');
131
147
  return oneText('dsh-ppt 已生成 ' + value.slideCount + ' 页' + (value.deliveryStatus === 'draft' ? '草稿(还有待填写内容,不能作为成品交付)' : '演示文稿') + '(主题 ' + value.theme + ',语言 ' + value.language + '):\n' +
132
148
  '打开演示文稿:' + value.htmlPath + '\n' +
133
149
  '可直接修改的 PPTX:' + value.pptxPath + '\n' +
134
150
  '可继续编辑的项目:' + value.jsonPath + '\n' +
135
151
  (value.handoutPath ? '演讲讲义:' + value.handoutPath + '\n' : '') +
136
152
  'HTML 双击即可放映;可点击上一页/下一页、输入页码,以及“检查与导出”定位问题或下载 PPTX。PPTX 可用 PowerPoint / WPS / Keynote 直接编辑。' +
153
+ upgradeLine +
137
154
  (value.revision !== undefined ? '\n修订号:' + value.revision + ';可撤销修改:' + value.undoAvailable + '。用 ppt_edit 修改指定页,ppt_undo 撤销。' : '') +
138
155
  (value.quality ? '\n\n' + qualityText(value.quality) : ''));
139
156
  }
@@ -281,6 +298,12 @@ const slideItemSchema = {
281
298
  role: { type: 'string', description: 'Role/title badge for org/team cards.' },
282
299
  conversion: { type: 'string', description: 'Stage conversion rate badge for funnel/flywheel process steps.' },
283
300
  icon: { type: 'string', description: 'Native vector icon name (e.g. rocket, shield, cpu, trending-up, coins, cloud, bot, spark, target, users, or "auto").' },
301
+ avatar: { type: 'string', description: 'Optional monogram or portrait label for team cards.' },
302
+ x: { type: 'number', description: 'Horizontal coordinate (0-100) for quadrant/bubble-matrix items.' },
303
+ y: { type: 'number', description: 'Vertical coordinate (0-100) for quadrant/bubble-matrix items.' },
304
+ size: { type: 'number', description: 'Relative bubble size weight for quadrant/bubble-matrix items.' },
305
+ before: { type: 'number', description: 'Baseline/before numeric value for dumbbell/slope comparison items.' },
306
+ after: { type: 'number', description: 'Target/after numeric value for dumbbell/slope comparison items.' },
284
307
  status: { type: 'string', enum: ['positive', 'negative', 'warning', 'neutral', 'accent'] },
285
308
  tone: { type: 'string', enum: ['positive', 'negative', 'warning', 'neutral', 'accent'] },
286
309
  },
@@ -291,6 +314,8 @@ const slideLayouts = [
291
314
  'kpi', 'cards', 'comparison', 'matrix', 'process', 'callout',
292
315
  'gantt', 'architecture', 'harvey', 'tam', 'org',
293
316
  'marimekko', 'sankey', 'swot',
317
+ 'mockup', 'code', 'quadrant', 'radar', 'dumbbell', 'heatmap',
318
+ 'device', 'browser', 'mobile', 'snippet', 'bubble-matrix', 'magic-quadrant', 'spider', 'slope', 'heat-matrix',
294
319
  'table', 'closing', 'image', 'image-left', 'image-right',
295
320
  'chart', 'chart-split', 'gallery', 'waterfall', 'flywheel',
296
321
  'bento', 'pillars', 'exec-summary', 'timeline', 'steps', 'layers', 'funnel', 'chevron', 'value-chain',
@@ -318,17 +343,24 @@ const slideProperties = {
318
343
  text: { type: 'string' },
319
344
  formula: { type: 'string', description: 'LaTeX math expression rendered as native Office Math (<m:oMath>) in PPTX and MathML in HTML (e.g. on callout slides with variant: "formula").' },
320
345
  mermaid: { type: 'string', description: 'Mermaid flowchart or sequenceDiagram code compiled into native editable PowerPoint shapes & attached connectors in PPTX and SVG in HTML.' },
346
+ code: { type: 'string', description: 'Source code snippet for code slides with multi-color syntax highlighting in HTML and native Consolas OOXML runs in PPTX.' },
347
+ language: { type: 'string', description: 'Programming language tag for code slides (e.g. typescript, python, sql, bash, go, rust, json, yaml).' },
348
+ filename: { type: 'string', description: 'Optional file path or window title for code/mockup slides.' },
349
+ url: { type: 'string', description: 'Optional browser URL displayed inside mockup[browser] address bar.' },
350
+ coverPattern: { type: 'string', enum: ['dots', 'grid', 'rings'], description: 'Optional subtle geometric vector backdrop pattern on cover slides.' },
351
+ xLabel: { type: 'string', description: 'Horizontal axis label for quadrant/bubble-matrix slides.' },
352
+ yLabel: { type: 'string', description: 'Vertical axis label for quadrant/bubble-matrix slides.' },
321
353
  notes: { type: 'string' },
322
354
  start: { type: 'number' }, span: { type: 'number' },
323
355
  activeIndex: { type: 'integer' },
324
356
  tableStyle: { type: 'string', enum: tableStyles },
325
357
  bullets: { type: 'array', items: { type: 'string' } },
326
- items: { type: 'array', items: slideItemSchema, description: 'Structured sub-elements for kpi, cards, comparison, matrix, process, callout, gantt, architecture, tam, org, or chart-split.' },
358
+ items: { type: 'array', items: slideItemSchema, description: 'Structured sub-elements for kpi, cards, comparison, matrix, process, callout, gantt, architecture, tam, org, mockup, code, quadrant, radar, dumbbell, or chart-split.' },
327
359
  cards: { type: 'array', items: slideItemSchema },
328
360
  metrics: { type: 'array', items: slideItemSchema },
329
361
  columns: { type: 'array', items: { oneOf: [{ type: 'string' }, slideItemSchema] }, description: 'Time-header labels (string[]) for gantt slides, or column items (object[]) as an items alias.' },
330
362
  steps: { type: 'array', items: slideItemSchema },
331
- quadrants: { type: 'array', items: slideItemSchema },
363
+ quadrants: { type: 'array', items: { oneOf: [{ type: 'string' }, slideItemSchema] }, description: '4 corner labels (string[4]) for quadrant bubble charts, or 4 item objects for 2x2 matrix.' },
332
364
  rows: { type: 'array', items: { type: 'array', items: { type: ['string', 'number'] } } },
333
365
  image: imageSchema,
334
366
  images: { type: 'array', items: { oneOf: [{ type: 'object', properties: imageObjectProperties, additionalProperties: false }, { type: 'string' }] } },
@@ -384,12 +416,16 @@ export function buildPptTools(config) {
384
416
  },
385
417
  {
386
418
  name: 'ppt_absorb',
387
- description: 'Inspect a local reference .pptx file (read-only, offline via @office-kit/pptx) to absorb its theme palette (including lumMod/tint/shade modifiers), Latin/East-Asian fonts, master logo, chrome skeleton geometry (extractedSkeleton, recommendedChrome), and per-slide layout sequence (slideSkeleton[]), returning WCAG-sanitized brand & semantic tokens for ppt_create. 中文:只读深度解析本地参考 .pptx 母版骨架、修饰色值、字体、Logo 与逐页版式序列,自动执行 WCAG 净化后供 ppt_create (referencePptx / cloneStructure) 或 ppt_edit 直接吸收复用。',
419
+ description: 'Inspect a local reference .pptx file OR batch-ingest a whole folder of curated/GitHub/corporate .pptx decks (corpusDir) offline via @office-kit/pptx. Extracts theme palette, fonts, master logo, chrome skeleton geometry, deep Taste Recipe, and reusable Slot-Filling Exemplar contracts (saved to .dsh-ppt/exemplars.json and .dsh-ppt/taste-recipes.json). 中文:只读深度吸收单份参考 .pptx 或批量投喂整个优质 .pptx 目录(corpusDir),自动过滤隐藏说明页、完成 WCAG 对比度净化,并沉淀为可复用的标杆范本契约与审美配方。',
388
420
  parameters: compileParameters({
389
- pptxPath: { type: 'string', required: true, description: 'Local reference .pptx path, relative to session cwd or absolute. Read-only.' },
421
+ pptxPath: { type: 'string', required: true, description: 'Local reference .pptx file path OR local directory of .pptx files to batch-ingest (relative to session cwd or absolute; read-only).' },
422
+ corpusDir: { type: 'string', description: 'Optional explicit directory path of curated/GitHub/corporate .pptx files to batch-ingest into .dsh-ppt/exemplars.json & .dsh-ppt/taste-recipes.json (you may also pass a directory directly via pptxPath).' },
423
+ limit: { type: 'integer', description: 'Max number of .pptx files to ingest when batch-ingesting a directory (default 20, max 40).' },
390
424
  extractLogo: { type: 'boolean', description: 'Extract embedded master/cover logo as a PNG/JPEG data URI into sanitizedBrand.logo when present (default true).' },
391
425
  saveTasteAs: { type: 'string', description: 'Optional ID to save the absorbed deep aesthetic StyleRecipe into workspace .dsh-ppt/taste-recipes.json for one-click reuse via taste.' },
392
426
  tasteName: { type: 'string', description: 'Optional display name when saving the absorbed StyleRecipe.' },
427
+ saveExemplarAs: { type: 'string', description: 'Optional ID to save the absorbed slide skeleton & brand DNA as a reusable Slot-Filling Exemplar in workspace .dsh-ppt/exemplars.json (reusable via exemplar).' },
428
+ exemplarName: { type: 'string', description: 'Optional display name when saving the absorbed Exemplar.' },
393
429
  }),
394
430
  output: {
395
431
  schema: { type: 'object', additionalProperties: true },
@@ -399,20 +435,22 @@ export function buildPptTools(config) {
399
435
  },
400
436
  {
401
437
  name: 'ppt_create',
402
- description: 'Generate a standalone HTML slideshow, editable 16:9 PPTX and JSON project from prepared Markdown or structured slides. Supports 24 themes, 6 distinct master chrome skeletons, Scenario Auto-Director (theme: "auto"), 24+ native editable layouts & pro diagrams (KPI, Bento/pillar cards, comparison, 2x2 matrix, process/timeline/flywheel/chevron, gantt roadmaps, layered architecture, Harvey-ball matrices, concentric TAM/SAM/SOM, org/team charts, academic booktabs 3-line tables, chart-split, waterfall bridges), 20 industry blueprints, deep reference .pptx skeleton absorption (cloneStructure), and shared branding. 中文:先组织事实与内容,再生成可直接放映和继续编辑的三件套;内置 24 套大师主题、6 套差异化母版骨架、24+ 种原生可编辑版式与专业图示、20 套行业蓝图、13 类出版级图表与外部 PPTX 深度骨架吸收。',
438
+ description: 'Generate a standalone HTML slideshow, editable 16:9 PPTX and JSON project from prepared Markdown or structured slides. Supports 24 themes, 6 master chrome skeletons, 8 Curated Gold Exemplars (exemplar: mckinsey-strategy | sequoia-pitch | stripe-product-launch | quarterly-exec-review | tech-arch-rfc | academic-defense | enterprise-proposal | gov-institutional + workspace absorbed exemplars), Deterministic Weak-LLM Compensator & Anti-Slop Upgrader (autoUpgrade), 30+ native editable layouts & pro diagrams (KPI, Bento, mockup, syntax-highlighted code, Magic Quadrant, radar, dumbbell, heatmap, Marimekko, Sankey, SWOT, Porter value chain, Gantt, architecture, Harvey balls, TAM, org, Mermaid, booktabs), and deep .pptx absorption. 中文:先按标杆范本(exemplar)槽位组织内容或传入粗纲,由确定性升维器自动打破纯文字墙与平庸标题,输出可直接放映与编辑的三件套。',
403
439
  parameters: compileParameters({
404
440
  title: { type: 'string', required: true, description: 'Deck title (used for the cover and file names).' },
405
441
  content: { type: 'string', description: 'Markdown content: # cover title, ## slides, -/* bullets (supports **bold** lead-ins), | ... | tables, > quotes, > [!TAKEAWAY] bottom summary bar, ::: kpi|cards|comparison|process|matrix|callout|gantt|architecture|harvey|tam|org blocks, and <!-- 备注: ... --> speaker notes. Required unless slides or template is provided.' },
406
442
  theme: { type: 'string', description: 'Visual theme id: auto (default: Scenario Auto-Director picks optimal theme & chrome) or ' + ALLOWED_THEME_IDS.join(' / ') + '. See ppt_themes.' },
407
443
  taste: { type: 'string', description: 'Curated Aesthetic Taste Recipe ID (mckinsey-partner | apple-keynote-dark | apple-keynote-light | swiss-editorial | linear-craft | ft-data-journal | nature-academic | oriental-zen) or a workspace-absorbed custom recipe ID.' },
444
+ exemplar: { type: 'string', description: 'Curated Gold Exemplar ID (mckinsey-strategy | sequoia-pitch | stripe-product-launch | quarterly-exec-review | tech-arch-rfc | academic-defense | enterprise-proposal | gov-institutional) or workspace-absorbed exemplar ID from .dsh-ppt/exemplars.json. Inherits optimal theme/taste and projects slides onto proven visual cadence.' },
445
+ autoUpgrade: { type: 'boolean', description: 'Run deterministic Weak-LLM Compensator & Anti-Slop Upgrader (promotes buried metrics/before-after/radar/quadrant/heatmap/code/mockup, auto-splits >6-bullet walls, breaks monotonous bullet streaks, rescues generic titles & bare closings). Default true; set false to preserve raw slides verbatim.' },
408
446
  persona: { type: 'string', enum: ['auto', 'consulting', 'tech-pitch', 'academic', 'gov-exec', 'education', 'editorial'], description: 'Optional scenario/audience persona for Auto-Art-Direction, layout rhythm promotion, and table/chart styling. Default auto.' },
409
447
  referencePptx: { type: 'string', description: 'Optional local reference .pptx path; absorbs its sanitized palette, CJK/Latin fonts, chrome skeleton, and master logo before applying explicit brand overrides.' },
410
448
  cloneStructure: { type: 'boolean', description: 'When referencePptx is provided, align generated slide archetypes and master chrome skeleton with the absorbed reference slideSkeleton[] where compatible (default false).' },
411
449
  smartLayout: { type: 'boolean', description: 'Enable or disable automatic multi-archetype Markdown layout promotion on >=4-section decks. Default true in async tool mode.' },
412
450
  lang: { type: 'string', description: 'UI language of the generated player: zh (default), en, or bilingual. Content language is whatever you write.' },
413
451
  motion: { type: 'string', enum: ['on', 'off'], description: 'Slide transitions plus bullet entrance animations: on (default) or off for a fully static deck.' },
414
- slides: { type: 'array', items: { type: 'object', properties: slideProperties, additionalProperties: true }, description: 'Structured slides across 24 native layouts & pro diagrams (cover, agenda, section, bullets, kpi, cards, comparison, matrix, process, callout, gantt, architecture, harvey, tam, org, statement, quote, table, chart, chart-split, waterfall, image, image-left, image-right, closing) with items[], columns[], takeaway, source, chrome, tableStyle (consulting|booktabs|minimal|banded|harvey), local images, and 13 chart kinds.' },
415
- template: { type: 'string', enum: templateIds, description: 'Industry blueprint from ppt_templates (16 blueprints). Provide finished content/slides following its outline; template alone creates an unfilled draft.' },
452
+ slides: { type: 'array', items: { type: 'object', properties: slideProperties, additionalProperties: true }, description: 'Structured slides across 30+ native layouts & pro diagrams (cover, agenda, section, bullets, kpi, cards, comparison, matrix, process, callout, gantt, architecture, harvey, tam, org, marimekko, sankey, swot, value-chain, mockup, code, quadrant, radar, dumbbell, heatmap, mermaid, statement, quote, table, chart, chart-split, waterfall, image, image-left, image-right, closing) with items[], columns[], takeaway, source, chrome, tableStyle (consulting|booktabs|minimal|banded|harvey), local images, and 13 chart kinds.' },
453
+ template: { type: 'string', enum: templateIds, description: 'Industry blueprint from ppt_templates (20 blueprints). Provide finished content/slides following its outline; template alone creates an unfilled draft.' },
416
454
  brand: { type: 'object', properties: brandProperties, additionalProperties: false, description: 'Shared brand: #RRGGBB primary/background/text colors, fontFamily, logo, footer, and chromeStyle (' + ALLOWED_CHROME_STYLES.join('|') + '). Applied to HTML and PPTX.' },
417
455
  targetMinutes: { type: 'number', description: 'Optional target speaking duration in minutes for pace budgeting.' },
418
456
  dataModel: { type: 'object', properties: { schemaVersion: { type: 'integer', enum: [1] }, sources: { type: 'array', items: { type: 'object', properties: sourceProperties, required: ['id'] } }, metrics: { type: 'array', items: { type: 'object', properties: metricProperties, required: ['id', 'kind'] } } }, additionalProperties: false, description: 'Optional explicit lineage and what-if model. Use with structured slides containing {{metricId}} in text/items/takeaway/tables or an exact token as chart values. Source facts reference a real cell or text line; assumptions require value/min/max/step. Formulas compute derived metrics. HTML offers live sliders; PPTX includes confirmed static values, formulas and assumptions in speaker notes. Leave absent for ordinary finished decks.' },
@@ -428,9 +466,21 @@ export function buildPptTools(config) {
428
466
  },
429
467
  {
430
468
  name: 'ppt_templates',
431
- description: 'List all 20 industry scenario blueprints (weekly, defense, project, pitch, consulting, keynote, gov-report, workshop, architecture-review, financial-earnings, medical-case, postmortem, marketing-campaign, promotion-review, legal-compliance, creative-lookbook, quarterly-okr, product-prd, vc-daylight, industry-research) with recommended themes, chrome skeletons, and multi-archetype slide outlines. 中文:查看全部 20 套行业场景蓝图(含推荐主题、母版骨架与专业图示大纲),组织真实内容后再调用 ppt_create 交付成品。',
432
- parameters: compileParameters({ lang: { type: 'string', description: 'zh / en / bilingual, default zh.' } }),
433
- output: { schema: { type: 'object', additionalProperties: true }, render: (_args, value) => oneText(JSON.stringify(value, null, 2)) },
469
+ description: 'List all 20 industry scenario blueprints AND 8 Curated Gold Exemplars (+ any workspace-absorbed .pptx exemplars). Pass exemplarId to retrieve the exact per-slide Slot-Filling Contract and gold Action-Title examples so any model can deterministically fill a publication-grade deck without inventing layout design from scratch. 中文:查看 20 套行业蓝图与 8 套内置标杆范本(含工作区吸收范本);传入 exemplarId 直接获取逐页槽位填空契约与满分标题示范,显著提升中弱模型成稿稳定性。',
470
+ parameters: compileParameters({
471
+ lang: { type: 'string', description: 'zh / en / bilingual, default zh.' },
472
+ exemplarId: { type: 'string', description: 'Optional curated or workspace exemplar ID (e.g. mckinsey-strategy, sequoia-pitch, stripe-product-launch, quarterly-exec-review, tech-arch-rfc, academic-defense, enterprise-proposal, gov-institutional) to return its exact per-slide slot-filling contract & promptGuide.' },
473
+ }),
474
+ output: {
475
+ schema: { type: 'object', additionalProperties: true },
476
+ render: (_args, value) => {
477
+ const rec = (value && typeof value === 'object') ? value : {};
478
+ if (typeof rec.promptGuide === 'string' && rec.promptGuide.trim()) {
479
+ return oneText(rec.promptGuide + '\n\n' + JSON.stringify({ exemplar: rec.exemplar }, null, 2));
480
+ }
481
+ return oneText(JSON.stringify(value, null, 2));
482
+ },
483
+ },
434
484
  execute: executors.templates,
435
485
  },
436
486
  {
package/lib/types.d.ts CHANGED
@@ -280,6 +280,10 @@ export interface PptCreateArgs {
280
280
  slides?: PptSlideSpec[];
281
281
  theme?: string;
282
282
  taste?: PptTasteRecipeId | string | PptTasteRecipe;
283
+ /** Curated exemplar ID (8 built-in) or workspace absorbed exemplar ID for slot-filling & auto-upgrade. */
284
+ exemplar?: string;
285
+ /** Deterministic weak-LLM compensator & anti-slop upgrader (default true in async mode; set false to keep raw slides verbatim). */
286
+ autoUpgrade?: boolean;
283
287
  persona?: PptPersonaId | string;
284
288
  referencePptx?: string;
285
289
  cloneStructure?: boolean;
@@ -330,13 +334,33 @@ export interface PptThemesResult {
330
334
  }
331
335
  export interface PptAbsorbArgs {
332
336
  pptxPath?: string;
337
+ corpusDir?: string;
338
+ limit?: number;
333
339
  bytes?: Uint8Array | Buffer;
334
340
  cwd?: string;
335
341
  extractLogo?: boolean;
336
342
  saveTasteAs?: string;
337
343
  tasteName?: string;
344
+ saveExemplarAs?: string;
345
+ exemplarName?: string;
338
346
  signal?: AbortSignal;
339
347
  }
348
+ export interface PptExemplarSummary {
349
+ id: string;
350
+ name: string;
351
+ enName?: string;
352
+ persona?: string;
353
+ theme?: string;
354
+ taste?: string;
355
+ chromeStyle?: string;
356
+ slideCount: number;
357
+ description?: string;
358
+ enDescription?: string;
359
+ source?: 'curated' | 'workspace';
360
+ sourceFile?: string;
361
+ layoutCadence?: string[];
362
+ slots?: Array<Record<string, unknown>>;
363
+ }
340
364
  export interface PptAbsorbSkeleton {
341
365
  cornerStyle?: string;
342
366
  hasTopBanner?: boolean;
@@ -353,7 +377,16 @@ export interface PptAbsorbSlideSkeleton {
353
377
  export interface PptAbsorbResult {
354
378
  ok: boolean;
355
379
  pptxPath?: string;
356
- slideCount: number;
380
+ dirPath?: string;
381
+ scanned?: number;
382
+ ingestedCount?: number;
383
+ failedCount?: number;
384
+ exemplars?: Array<Record<string, unknown>>;
385
+ failed?: Array<{
386
+ file: string;
387
+ error: string;
388
+ }>;
389
+ slideCount?: number;
357
390
  slideSize?: {
358
391
  width: number;
359
392
  height: number;
@@ -364,14 +397,16 @@ export interface PptAbsorbResult {
364
397
  extractedPalette?: Record<string, string>;
365
398
  extractedFonts?: Record<string, string>;
366
399
  extractedSkeleton?: PptAbsorbSkeleton;
367
- sanitizedBrand: PptBrand;
368
- sanitizedTokens: Record<string, unknown>;
369
- recommendedTheme: string;
400
+ sanitizedBrand?: PptBrand;
401
+ sanitizedTokens?: Record<string, unknown>;
402
+ recommendedTheme?: string;
370
403
  recommendedChrome?: PptChromeStyle | string;
371
404
  recommendedTableStyle?: PptTableStyle | string;
372
405
  narrativeProfile?: Record<string, unknown>;
373
406
  styleRecipe?: PptTasteRecipe;
374
407
  savedTastePath?: string;
408
+ savedExemplarPath?: string;
409
+ exemplar?: PptExemplarSummary;
375
410
  slideSkeleton?: PptAbsorbSlideSkeleton[];
376
411
  layoutSummary?: Record<string, unknown>;
377
412
  }
@@ -457,12 +492,24 @@ export interface PptCreateResult {
457
492
  deliveryStatus?: 'draft' | 'ready-for-review';
458
493
  importedFrom?: string;
459
494
  syncedProject?: boolean;
495
+ exemplar?: string;
496
+ upgradeReport?: Record<string, unknown>;
460
497
  quality?: PptQualityResult;
461
498
  verification?: PptVerification;
462
499
  }
463
500
  /** Shared generator and optional renderer exposed to the plugin. */
464
501
  export interface DeckEngine {
465
502
  absorbPptx(options: Record<string, unknown>): Promise<PptAbsorbResult>;
503
+ ingestExemplarCorpus?(options: Record<string, unknown>): Promise<PptAbsorbResult>;
504
+ listCuratedExemplars?(workspaceExemplars?: Record<string, unknown>): PptExemplarSummary[];
505
+ loadWorkspaceExemplars?(cwd?: string): Record<string, PptExemplarSummary>;
506
+ saveWorkspaceExemplar?(cwd: string, exemplar: Record<string, unknown>): {
507
+ exemplar: PptExemplarSummary;
508
+ path: string;
509
+ };
510
+ resolveExemplar?(idOrObj: unknown, workspaceExemplars?: Record<string, unknown>): PptExemplarSummary | null;
511
+ renderExemplarPromptGuide?(exemplar: unknown, lang?: string): string;
512
+ extractExemplarFromAbsorbed?(absorbed: unknown, options?: Record<string, unknown>): Record<string, unknown>;
466
513
  importPptxDeck(options: Record<string, unknown>): Promise<PptCreateResult>;
467
514
  importOfficeDeck?(options: Record<string, unknown>): Promise<PptCreateResult>;
468
515
  repairDeckVisual(options: Record<string, unknown>): Promise<PptCreateResult>;