dsh-ppt 0.25.0 → 0.27.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 (48) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.en.md +14 -13
  3. package/README.md +14 -13
  4. package/docs/DATA.md +2 -2
  5. package/docs/REFERENCE.en.md +8 -8
  6. package/docs/REFERENCE.zh.md +8 -8
  7. package/docs/USAGE.en.md +12 -7
  8. package/docs/USAGE.md +12 -7
  9. package/docs/VALIDATION.md +8 -0
  10. package/docs/WORKBENCH.md +4 -4
  11. package/docs/assets/intro/workflow-en-dark.svg +1 -1
  12. package/docs/assets/intro/workflow-en-light.svg +1 -1
  13. package/docs/assets/intro/workflow-en-mobile-dark.svg +1 -1
  14. package/docs/assets/intro/workflow-en-mobile-light.svg +1 -1
  15. package/docs/assets/intro/workflow-zh-dark.svg +1 -1
  16. package/docs/assets/intro/workflow-zh-light.svg +1 -1
  17. package/docs/assets/intro/workflow-zh-mobile-dark.svg +1 -1
  18. package/docs/assets/intro/workflow-zh-mobile-light.svg +1 -1
  19. package/lib/client.js +312 -84
  20. package/lib/ecosystem.d.ts +73 -0
  21. package/lib/ecosystem.js +1352 -0
  22. package/lib/execution.d.ts +6 -1
  23. package/lib/execution.js +77 -4
  24. package/lib/tools.js +133 -1
  25. package/lib/types.d.ts +121 -1
  26. package/lib/workbench-language.js +4 -0
  27. package/lib/workbench.d.ts +2 -0
  28. package/lib/workbench.js +397 -10
  29. package/package.json +1 -1
  30. package/skills/dsh-ppt/SKILL.md +6 -6
  31. package/skills/dsh-ppt/package.json +1 -1
  32. package/skills/dsh-ppt/references/advanced.md +10 -5
  33. package/skills/dsh-ppt/references/syntax.md +1 -0
  34. package/skills/dsh-ppt/scripts/build-deck.mjs +53 -10
  35. package/skills/dsh-ppt/scripts/deck-absorb.mjs +114 -1
  36. package/skills/dsh-ppt/scripts/deck-advanced.mjs +153 -25
  37. package/skills/dsh-ppt/scripts/deck-chrome.mjs +1814 -0
  38. package/skills/dsh-ppt/scripts/deck-core.mjs +122 -6
  39. package/skills/dsh-ppt/scripts/deck-covers.mjs +804 -0
  40. package/skills/dsh-ppt/scripts/deck-delivery.mjs +636 -41
  41. package/skills/dsh-ppt/scripts/deck-diagrams.mjs +2842 -0
  42. package/skills/dsh-ppt/scripts/deck-director.mjs +167 -4
  43. package/skills/dsh-ppt/scripts/deck-icons.mjs +469 -0
  44. package/skills/dsh-ppt/scripts/deck-layouts.mjs +816 -5177
  45. package/skills/dsh-ppt/scripts/deck-media.mjs +159 -15
  46. package/skills/dsh-ppt/scripts/deck-mermaid.mjs +2737 -0
  47. package/skills/dsh-ppt/scripts/deck-office.mjs +1541 -0
  48. package/skills/dsh-ppt/scripts/deck-taste.mjs +347 -0
@@ -1,5 +1,5 @@
1
1
  import type { ResolvedPptConfig } from './config.js';
2
- import type { DeckEngine, PptAbsorbResult, PptCreateResult, PptThemesResult } from './types.js';
2
+ import type { DeckEngine, PptAbsorbResult, PptCiteResult, PptCreateResult, PptRemotionResult, PptThemesResult } from './types.js';
3
3
  /** The Harness execution fields used by this plugin; optional for direct callers. */
4
4
  export interface PptExecution {
5
5
  readonly signal?: AbortSignal;
@@ -29,4 +29,9 @@ export declare function createPptExecutors(config: ResolvedPptConfig, loadEngine
29
29
  render(rawArgs: unknown, exec?: PptExecution): Promise<import("./types.js").PptRenderResult>;
30
30
  data(rawArgs: unknown, exec?: PptExecution): Promise<PptCreateResult | Record<string, any>>;
31
31
  importPptx(rawArgs: unknown, exec?: PptExecution): Promise<PptCreateResult>;
32
+ fromOffice(rawArgs: unknown, exec?: PptExecution): Promise<PptCreateResult>;
33
+ cite(rawArgs: unknown, exec?: PptExecution): Promise<PptCiteResult & {
34
+ jsonPath?: string;
35
+ }>;
36
+ remotion(rawArgs: unknown, exec?: PptExecution): Promise<PptRemotionResult>;
32
37
  };
package/lib/execution.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { homedir } from 'node:os';
3
3
  import { dirname, join, resolve } from 'node:path';
4
+ import { attachCitationsToDeck, exportRemotionBundle } from './ecosystem.js';
4
5
  let enginePromise = null;
5
6
  export function getEngine() {
6
7
  if (enginePromise === null) {
@@ -50,17 +51,18 @@ export function createPptExecutors(config, loadEngine = getEngine) {
50
51
  const engine = await loadEngine();
51
52
  exec?.signal?.throwIfAborted();
52
53
  const themes = engine.listThemes(lang);
54
+ const cwd = exec?.agent?.session.header.cwd ?? process.cwd();
55
+ const tasteRecipes = typeof engine.listAllTasteRecipes === 'function' ? engine.listAllTasteRecipes(cwd) : undefined;
53
56
  if (args.preview === true) {
54
- const cwd = exec?.agent?.session.header.cwd ?? process.cwd();
55
57
  const requested = typeof args.outputDir === 'string' && args.outputDir.trim() !== '' ? args.outputDir.trim() : config.outputDir || '.';
56
58
  const preview = engine.buildThemePreview({
57
59
  outputDir: resolve(cwd, requested),
58
60
  lang,
59
61
  overwrite: args.overwrite === true,
60
62
  });
61
- return { ok: true, themes, preview };
63
+ return { ok: true, themes, ...(tasteRecipes ? { tasteRecipes } : {}), preview };
62
64
  }
63
- return { ok: true, themes };
65
+ return { ok: true, themes, ...(tasteRecipes ? { tasteRecipes } : {}) };
64
66
  },
65
67
  async create(rawArgs, exec) {
66
68
  exec?.signal?.throwIfAborted();
@@ -80,7 +82,8 @@ export function createPptExecutors(config, loadEngine = getEngine) {
80
82
  title: args.title.trim(),
81
83
  content: typeof args.content === 'string' ? args.content : '',
82
84
  slides: hasSlides ? args.slides : undefined,
83
- theme: typeof args.theme === 'string' && args.theme.trim() !== '' ? args.theme.trim() : (config.defaultTheme || (typeof engine.absorbPptx === 'function' ? 'auto' : undefined)),
85
+ theme: typeof args.theme === 'string' && args.theme.trim() !== '' ? args.theme.trim() : (args.taste ? undefined : (config.defaultTheme || (typeof engine.absorbPptx === 'function' ? 'auto' : undefined))),
86
+ ...(args.taste ? { taste: args.taste } : {}),
84
87
  persona: typeof args.persona === 'string' && args.persona.trim() !== '' ? args.persona.trim() : undefined,
85
88
  referencePptx: typeof args.referencePptx === 'string' && args.referencePptx.trim() !== '' ? args.referencePptx.trim() : undefined,
86
89
  cloneStructure: typeof args.cloneStructure === 'boolean' ? args.cloneStructure : undefined,
@@ -93,6 +96,7 @@ export function createPptExecutors(config, loadEngine = getEngine) {
93
96
  maxSlides: config.maxSlides,
94
97
  template: args.template,
95
98
  brand: args.brand,
99
+ ...(typeof args.targetMinutes === 'number' && Number.isFinite(args.targetMinutes) ? { targetMinutes: args.targetMinutes } : {}),
96
100
  dataModel: args.dataModel,
97
101
  cwd,
98
102
  signal: exec?.signal,
@@ -110,6 +114,8 @@ export function createPptExecutors(config, loadEngine = getEngine) {
110
114
  return engine.absorbPptx({
111
115
  pptxPath: args.pptxPath.trim(),
112
116
  extractLogo: args.extractLogo !== false,
117
+ ...(typeof args.saveTasteAs === 'string' && args.saveTasteAs.trim() ? { saveTasteAs: args.saveTasteAs.trim() } : {}),
118
+ ...(typeof args.tasteName === 'string' && args.tasteName.trim() ? { tasteName: args.tasteName.trim() } : {}),
113
119
  cwd,
114
120
  signal: exec?.signal,
115
121
  });
@@ -184,5 +190,72 @@ export function createPptExecutors(config, loadEngine = getEngine) {
184
190
  signal: exec?.signal,
185
191
  });
186
192
  },
193
+ async fromOffice(rawArgs, exec) {
194
+ exec?.signal?.throwIfAborted();
195
+ const args = asRecord(rawArgs);
196
+ if (typeof args.filePath !== 'string' || args.filePath.trim() === '') {
197
+ throw new Error('dsh-ppt:filePath 不能为空');
198
+ }
199
+ const engine = await loadEngine();
200
+ exec?.signal?.throwIfAborted();
201
+ if (typeof engine.importOfficeDeck !== 'function') {
202
+ throw new Error('dsh-ppt:当前引擎版本暂不支持导入 Excel / Word 文档');
203
+ }
204
+ const cwd = exec?.agent?.session.header.cwd ?? process.cwd();
205
+ const rawOut = typeof args.outputDir === 'string' && args.outputDir.trim() !== '' ? args.outputDir.trim() : config.outputDir;
206
+ const resolvedOut = resolve(cwd, rawOut || '.');
207
+ return engine.importOfficeDeck({
208
+ filePath: args.filePath.trim(),
209
+ cwd,
210
+ outDir: resolvedOut,
211
+ outputDir: resolvedOut,
212
+ ...(typeof args.fileName === 'string' && args.fileName.trim() !== '' ? { fileName: args.fileName.trim() } : {}),
213
+ theme: typeof args.theme === 'string' && args.theme.trim() !== '' ? args.theme.trim() : (config.defaultTheme || 'auto'),
214
+ persona: typeof args.persona === 'string' && args.persona.trim() !== '' ? args.persona.trim() : 'auto',
215
+ ...(typeof args.chromeStyle === 'string' && args.chromeStyle.trim() !== '' ? { chromeStyle: args.chromeStyle.trim() } : {}),
216
+ ...(typeof args.targetMinutes === 'number' && Number.isFinite(args.targetMinutes) ? { targetMinutes: args.targetMinutes } : {}),
217
+ lang: typeof args.lang === 'string' && args.lang.trim() !== '' ? args.lang.trim() : (config.defaultLang || undefined),
218
+ overwrite: args.overwrite === true,
219
+ signal: exec?.signal,
220
+ });
221
+ },
222
+ async cite(rawArgs, exec) {
223
+ exec?.signal?.throwIfAborted();
224
+ const args = asRecord(rawArgs);
225
+ if (typeof args.deckPath !== 'string' || args.deckPath.trim() === '') {
226
+ throw new Error('dsh-ppt:deckPath 不能为空');
227
+ }
228
+ const engine = await loadEngine();
229
+ exec?.signal?.throwIfAborted();
230
+ const cwd = exec?.agent?.session.header.cwd ?? process.cwd();
231
+ const result = await attachCitationsToDeck({
232
+ ...args,
233
+ deckPath: args.deckPath.trim(),
234
+ cwd,
235
+ signal: exec?.signal,
236
+ engine,
237
+ });
238
+ return {
239
+ ...result,
240
+ ...(result.deck?.jsonPath ? { jsonPath: result.deck.jsonPath } : {}),
241
+ };
242
+ },
243
+ async remotion(rawArgs, exec) {
244
+ exec?.signal?.throwIfAborted();
245
+ const args = asRecord(rawArgs);
246
+ if (typeof args.deckPath !== 'string' || args.deckPath.trim() === '') {
247
+ throw new Error('dsh-ppt:deckPath 不能为空');
248
+ }
249
+ const engine = await loadEngine();
250
+ exec?.signal?.throwIfAborted();
251
+ const cwd = exec?.agent?.session.header.cwd ?? process.cwd();
252
+ return exportRemotionBundle({
253
+ ...args,
254
+ deckPath: args.deckPath.trim(),
255
+ cwd,
256
+ signal: exec?.signal,
257
+ engine,
258
+ });
259
+ },
187
260
  };
188
261
  }
package/lib/tools.js CHANGED
@@ -157,6 +157,23 @@ function renderPreview(value) {
157
157
  (value.missingFonts?.length ? '\n请先替换为环境和目标机器可用字体,重新生成并渲染检查;解决前不能声称已验收。' : '') +
158
158
  '\n请查看实际画面,确认文字、图片和图表后再交付。原可编辑 PPTX 保留。');
159
159
  }
160
+ function renderCite(value) {
161
+ if (value.matchedCount === 0) {
162
+ return oneText('dsh-cite 引文链接:未匹配到 [@citeKey] / [doi:...] 标记或指定文献' +
163
+ (value.missingKeys.length ? '(未找到:' + value.missingKeys.join(', ') + ')' : '') +
164
+ ',未修改工程文件。');
165
+ }
166
+ return oneText('dsh-cite 已链接 ' + value.matchedCount + ' 条已核验文献(' + value.citedKeys.join(', ') + ')' +
167
+ (value.referencesSlideIndex ? ',已同步更新第 ' + value.referencesSlideIndex + ' 页参考文献' : '') +
168
+ (value.missingKeys.length ? ';未匹配键:' + value.missingKeys.join(', ') : '') +
169
+ (value.deck ? '。\n最新修订号:' + value.deck.revision + ' · PPTX:' + value.deck.pptxPath : '。'));
170
+ }
171
+ function renderRemotion(value) {
172
+ return oneText('dsh-remotion 视频分镜工程已导出至:' + value.outputDir + '\n' +
173
+ '分镜清单:' + value.storyboardPath + '\n' +
174
+ '规格:' + value.slideCount + ' 页 · ' + value.fps + ' fps · 共 ' + value.totalFrames + ' 帧(约 ' + value.totalSeconds + ' 秒)\n' +
175
+ '进入目录运行 npm install && npm run preview 或 npm run render 即可预览与渲染 MP4。');
176
+ }
160
177
  const imageObjectProperties = {
161
178
  src: { type: 'string', description: 'Local PNG/JPEG path relative to the session cwd, or image data URI. Embedded into all output files.' },
162
179
  alt: { type: 'string' }, fit: { type: 'string', enum: ['contain', 'cover'] }, caption: { type: 'string' },
@@ -185,6 +202,30 @@ const chartSchema = { type: ['object', 'null'], properties: {
185
202
  { type: 'string', enum: ['max', 'last', 'none'] },
186
203
  ],
187
204
  },
205
+ spotlight: { type: 'boolean', description: 'Automatically dim non-focal bars and highlight the leading value.' },
206
+ showGrowthCallout: { type: 'boolean', description: 'Render McKinsey-style first-to-last growth callout arc and badge.' },
207
+ referenceLine: {
208
+ type: 'object',
209
+ properties: {
210
+ value: { type: 'number' },
211
+ label: { type: 'string' },
212
+ color: { type: 'string' },
213
+ },
214
+ required: ['value'],
215
+ additionalProperties: false,
216
+ description: 'Dashed benchmark/target reference line across the chart plot.',
217
+ },
218
+ callout: {
219
+ type: 'object',
220
+ properties: {
221
+ label: { type: 'string' },
222
+ fromIndex: { type: 'integer' },
223
+ toIndex: { type: 'integer' },
224
+ },
225
+ required: ['label'],
226
+ additionalProperties: false,
227
+ description: 'Explicit executive growth/bridge annotation badge linking two categories.',
228
+ },
188
229
  showValues: { type: 'boolean' },
189
230
  totalIndices: { type: 'array', items: { type: 'integer' }, description: '0-based category indices treated as totals in waterfall charts.' },
190
231
  }, additionalProperties: false };
@@ -202,6 +243,27 @@ const brandProperties = {
202
243
  { type: 'null' },
203
244
  ],
204
245
  },
246
+ cardMaterial: {
247
+ description: 'Surface materiality: solid | frameless | glass | editorial-rule (or null to clear during edit).',
248
+ oneOf: [
249
+ { type: 'string', enum: ['solid', 'frameless', 'glass', 'editorial-rule'] },
250
+ { type: 'null' },
251
+ ],
252
+ },
253
+ iconMode: {
254
+ description: 'Native vector icon mode on cards/KPIs: off | explicit | auto (or null to clear).',
255
+ oneOf: [
256
+ { type: 'string', enum: ['off', 'explicit', 'auto'] },
257
+ { type: 'null' },
258
+ ],
259
+ },
260
+ taste: {
261
+ description: 'Curated Taste Recipe ID (mckinsey-partner | apple-keynote-dark | apple-keynote-light | swiss-editorial | linear-craft | ft-data-journal | nature-academic | oriental-zen) or saved workspace recipe ID.',
262
+ oneOf: [
263
+ { type: 'string' },
264
+ { type: 'null' },
265
+ ],
266
+ },
205
267
  };
206
268
  const slideItemSchema = {
207
269
  type: 'object',
@@ -218,6 +280,7 @@ const slideItemSchema = {
218
280
  milestone: { type: 'boolean' },
219
281
  role: { type: 'string', description: 'Role/title badge for org/team cards.' },
220
282
  conversion: { type: 'string', description: 'Stage conversion rate badge for funnel/flywheel process steps.' },
283
+ icon: { type: 'string', description: 'Native vector icon name (e.g. rocket, shield, cpu, trending-up, coins, cloud, bot, spark, target, users, or "auto").' },
221
284
  status: { type: 'string', enum: ['positive', 'negative', 'warning', 'neutral', 'accent'] },
222
285
  tone: { type: 'string', enum: ['positive', 'negative', 'warning', 'neutral', 'accent'] },
223
286
  },
@@ -233,6 +296,7 @@ const slideLayouts = [
233
296
  'bento', 'pillars', 'exec-summary', 'timeline', 'steps', 'layers', 'funnel', 'chevron', 'value-chain',
234
297
  'issue-action', 'before-after', 'matrix-2x2', 'kpi-grid', 'scorecard',
235
298
  'formula-callout', 'takeaways', 'gallery-grid', 'ablation-compare', 'roadmap', 'swimlane', 'team',
299
+ 'mermaid', 'flowchart', 'sequence',
236
300
  ];
237
301
  const templateIds = [
238
302
  'weekly', 'defense', 'project', 'pitch',
@@ -244,13 +308,16 @@ const templateIds = [
244
308
  const tableStyles = ['consulting', 'booktabs', 'minimal', 'banded', 'harvey'];
245
309
  const slideProperties = {
246
310
  layout: { type: 'string', enum: slideLayouts },
247
- variant: { type: 'string', description: 'Layout sub-variant, e.g. pillars|bento|exec-summary (cards), versus|before-after|do-dont|issue-action (comparison), steps|timeline|layers|funnel|flywheel (process), quarters|months|weeks|swimlane (gantt), layered|platform (architecture), concentric (tam), tree|team (org), grid|hero-left|banner (kpi), framed|split-bleed (image-left/right), chart-left|chart-right (chart-split).' },
311
+ variant: { type: 'string', description: 'Layout sub-variant, e.g. keynote-glow|editorial-grid|architectural|split-bleed (cover), agenda (section), spotlight|frameless|grid (kpi), pillars|bento|bento-hero|frameless|exec-summary (cards), versus|before-after|do-dont|issue-action (comparison), steps|timeline|layers|funnel|flywheel (process), quarters|months|weeks|swimlane (gantt), layered|platform (architecture), concentric (tam), tree|team (org), framed|split-bleed (image-left/right), chart-left|chart-right (chart-split).' },
248
312
  chrome: { type: 'string', enum: ALLOWED_CHROME_STYLES, description: 'Optional per-slide master chrome skeleton override.' },
313
+ cardMaterial: { type: 'string', enum: ['solid', 'frameless', 'glass', 'editorial-rule'], description: 'Optional per-slide card surface materiality.' },
314
+ iconMode: { type: 'string', enum: ['off', 'explicit', 'auto'], description: 'Optional per-slide native vector icon badge mode.' },
249
315
  title: { type: 'string' }, subtitle: { type: 'string' }, kicker: { type: 'string' },
250
316
  takeaway: { type: 'string', description: 'Bottom key-takeaway synthesis banner.' },
251
317
  source: { type: 'string', description: 'Bottom-left data/citation source line.' },
252
318
  text: { type: 'string' },
253
319
  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
+ mermaid: { type: 'string', description: 'Mermaid flowchart or sequenceDiagram code compiled into native editable PowerPoint shapes & attached connectors in PPTX and SVG in HTML.' },
254
321
  notes: { type: 'string' },
255
322
  start: { type: 'number' }, span: { type: 'number' },
256
323
  activeIndex: { type: 'integer' },
@@ -321,6 +388,8 @@ export function buildPptTools(config) {
321
388
  parameters: compileParameters({
322
389
  pptxPath: { type: 'string', required: true, description: 'Local reference .pptx path, relative to session cwd or absolute. Read-only.' },
323
390
  extractLogo: { type: 'boolean', description: 'Extract embedded master/cover logo as a PNG/JPEG data URI into sanitizedBrand.logo when present (default true).' },
391
+ 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
+ tasteName: { type: 'string', description: 'Optional display name when saving the absorbed StyleRecipe.' },
324
393
  }),
325
394
  output: {
326
395
  schema: { type: 'object', additionalProperties: true },
@@ -335,6 +404,7 @@ export function buildPptTools(config) {
335
404
  title: { type: 'string', required: true, description: 'Deck title (used for the cover and file names).' },
336
405
  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.' },
337
406
  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
+ 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.' },
338
408
  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.' },
339
409
  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.' },
340
410
  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).' },
@@ -344,6 +414,7 @@ export function buildPptTools(config) {
344
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.' },
345
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.' },
346
416
  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
+ targetMinutes: { type: 'number', description: 'Optional target speaking duration in minutes for pace budgeting.' },
347
418
  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.' },
348
419
  outputDir: { type: 'string', description: 'Directory to write the files into. Default: session working directory (or the plugin outputDir config).' },
349
420
  fileName: { type: 'string', description: 'Base file name for the three artifacts. Default: sanitized deck title.' },
@@ -373,8 +444,13 @@ export function buildPptTools(config) {
373
444
  remove: { type: 'array', items: { type: ['integer', 'string'] }, description: 'Remove selected slides by their original 1-based page number or stable ID. At least one page must remain. A slide cannot be copied and removed in the same edit.' },
374
445
  append: { type: 'array', items: { type: 'object', properties: slideProperties, additionalProperties: false }, description: 'Append 1–5 new structured slides at the end of the deck in one undoable operation.' },
375
446
  theme: { type: 'string', description: 'Optional built-in theme id (' + ALLOWED_THEME_IDS.join(' / ') + ') to restyle the entire project atomically (undoable).' },
447
+ taste: {
448
+ type: ['string', 'null'],
449
+ description: 'Apply a Curated or Absorbed Taste Recipe ID (mckinsey-partner | apple-keynote-dark | apple-keynote-light | swiss-editorial | linear-craft | ft-data-journal | nature-academic | oriental-zen) to restyle covers, materiality, rhythm & charts atomically, or null to clear.',
450
+ },
376
451
  referencePptx: { type: 'string', description: 'Optional local reference .pptx path to absorb sanitized palette/fonts/logo and chrome skeleton onto this project (undoable).' },
377
452
  brand: { type: ['object', 'null'], properties: brandProperties, additionalProperties: false, description: 'Merge shared branding. null clears all branding. Empty footer clears footer; logo:null clears logo.' },
453
+ targetMinutes: { type: ['number', 'null'], description: 'Optional target speaking duration in minutes for pace budgeting (null clears).' },
378
454
  }),
379
455
  output: { schema: createResultSchema, render: (_args, value) => renderCreate(value) },
380
456
  execute: executors.edit,
@@ -440,5 +516,61 @@ export function buildPptTools(config) {
440
516
  },
441
517
  execute: executors.importPptx,
442
518
  },
519
+ {
520
+ name: 'ppt_from_office',
521
+ description: 'Import an Excel workbook (.xlsx), CSV/TSV dataset, or Word document (.docx) directly into a polished, multi-slide dsh-ppt presentation (HTML, editable PPTX, and JSON project) using deterministic data-to-visual profiling (Sankey, Gantt, Marimekko, Waterfall, combo charts, tables, and structured narrative slides). 中文:直吞本地 .xlsx / .csv / .tsv / .docx 文档并智能拆分为高颜值多页演示文稿三件套。',
522
+ parameters: compileParameters({
523
+ filePath: { type: 'string', required: true, description: 'Local .xlsx, .csv, .tsv, or .docx file path, relative to session cwd or absolute.' },
524
+ outputDir: { type: 'string', description: 'Directory to write the generated files into. Default: session working directory (or the plugin outputDir config).' },
525
+ fileName: { type: 'string', description: 'Base file name for the three artifacts. Default: derived from source file or title.' },
526
+ theme: { type: 'string', description: 'Target built-in theme id (or "auto", default "auto").' },
527
+ persona: { type: 'string', enum: ['auto', 'consulting', 'tech-pitch', 'academic', 'gov-exec', 'education', 'editorial'], description: 'Optional scenario/audience persona for Auto-Director choreography. Default auto.' },
528
+ chromeStyle: { type: 'string', enum: ALLOWED_CHROME_STYLES, description: 'Optional master chrome skeleton override: ' + ALLOWED_CHROME_STYLES.join(' | ') + '.' },
529
+ targetMinutes: { type: 'number', description: 'Optional target speaking duration in minutes for pace budgeting.' },
530
+ lang: { type: 'string', description: 'UI language: zh (default), en, or bilingual.' },
531
+ overwrite: { type: 'boolean', description: 'Replace existing same-name output files. Default false.' },
532
+ }),
533
+ output: {
534
+ schema: createResultSchema,
535
+ render: (_args, value) => renderCreate(value),
536
+ },
537
+ execute: executors.fromOffice,
538
+ },
539
+ {
540
+ name: 'ppt_cite',
541
+ description: 'Attach verified academic citations from a dsh-cite library (.json/.jsonl), BibTeX (.bib) file, or inline BibTeX/DOIs to a dsh-ppt project. Resolves [@citeKey] and [doi:...] markers into slide.source footers and appends or updates a formatted References slide without inventing metadata. 中文:对接 dsh-cite 文献库或 BibTeX/DOI,自动将 [@citeKey] / [doi:...] 解析写入页脚并生成或更新标准参考文献页。',
542
+ parameters: compileParameters({
543
+ deckPath: { type: 'string', required: true, description: 'Path to a dsh-ppt .json project, relative to session cwd or absolute.' },
544
+ citePath: { type: 'string', description: 'Optional path to dsh-cite library.json, .jsonl, or .bib file. Auto-discovers workspace or ~/.dsh/data/dsh-cite/library.json if omitted.' },
545
+ bibtex: { type: 'string', description: 'Optional inline BibTeX entries.' },
546
+ dois: { type: 'array', items: { type: 'string' }, description: 'Optional verified DOI strings to resolve and cite.' },
547
+ citeKeys: { type: 'array', items: { type: 'string' }, description: 'Optional explicit citeKeys or DOIs to attach as citations.' },
548
+ style: { type: 'string', enum: ['gb-t-7714', 'apa', 'mla', 'chicago'], description: 'Bibliography formatting style: gb-t-7714 (default), apa, mla, or chicago.' },
549
+ appendReferences: { type: 'boolean', description: 'Append or update a References slide (default true).' },
550
+ expectedRevision: { type: 'integer', description: 'Use revision returned by ppt_create/ppt_check to prevent overwriting another edit.' },
551
+ saveAs: { type: 'boolean', description: 'Save a new uniquely named copy instead of updating in place.' },
552
+ }),
553
+ output: {
554
+ schema: { type: 'object', additionalProperties: true },
555
+ render: (_args, value) => renderCite(value),
556
+ },
557
+ execute: executors.cite,
558
+ },
559
+ {
560
+ name: 'ppt_remotion',
561
+ description: 'Export a dsh-ppt project into a ready-to-render Remotion (dsh-remotion) animated video storyboard package (remotion-storyboard.json, src/DeckVideo.tsx, src/slides-data.json, src/index.ts, package.json, README.md) with 30fps pace-budgeted durations, spring entrances, KPI count-up, progressive bars, and synchronized speaker-note captions. 中文:将演示文稿导出为可直接渲染的 Remotion 视频分镜工程包(含 30fps 时长预算、KPI 数字递增、进度条生长动画与同步字幕)。',
562
+ parameters: compileParameters({
563
+ deckPath: { type: 'string', required: true, description: 'Path to a dsh-ppt .json project, relative to session cwd or absolute.' },
564
+ outputDir: { type: 'string', description: 'Directory to write the Remotion package into. Default: <deck>-remotion next to deckPath.' },
565
+ format: { type: 'string', enum: ['landscape', 'portrait', 'square'], description: 'Video aspect ratio: landscape (1920x1080, default), portrait (1080x1920), or square (1080x1080).' },
566
+ fps: { type: 'integer', description: 'Frames per second (24, 30, or 60; default 30).' },
567
+ overwrite: { type: 'boolean', description: 'Overwrite existing files in outputDir (default false).' },
568
+ }),
569
+ output: {
570
+ schema: { type: 'object', additionalProperties: true },
571
+ render: (_args, value) => renderRemotion(value),
572
+ },
573
+ execute: executors.remotion,
574
+ },
443
575
  ];
444
576
  }
package/lib/types.d.ts CHANGED
@@ -1,9 +1,41 @@
1
1
  /** dsh-ppt 的公共类型。 */
2
2
  export type PptThemeId = 'swiss' | 'velvet' | 'data' | 'soft' | 'bold' | 'consulting' | 'cobalt-cream' | 'exec-jilan' | 'exec-palace' | 'academic' | 'editorial-forest' | 'cartesian' | 'course-sage' | 'linear-dark' | 'keynote-light' | 'financial-ft' | 'medical-clean' | 'luxury-noir' | 'bcg-emerald' | 'economist-brief' | 'venture-daylight' | 'stripe-craft' | 'aurora-stage' | 'obsidian-amber';
3
3
  export type PptChromeStyle = 'consulting-classic' | 'keynote-spatial' | 'editorial-folio' | 'saas-bento' | 'academic-minimal' | 'gov-ceremonial';
4
+ export type PptCardMaterial = 'solid' | 'frameless' | 'glass' | 'editorial-rule';
5
+ export type PptIconMode = 'off' | 'explicit' | 'auto';
6
+ export type PptTasteRecipeId = 'mckinsey-partner' | 'apple-keynote-dark' | 'apple-keynote-light' | 'swiss-editorial' | 'linear-craft' | 'ft-data-journal' | 'nature-academic' | 'oriental-zen';
7
+ export interface PptTasteRecipe {
8
+ id: string;
9
+ name: string;
10
+ enName?: string;
11
+ school?: string;
12
+ description?: string;
13
+ enDescription?: string;
14
+ theme?: string;
15
+ chromeStyle?: PptChromeStyle | string;
16
+ tableStyle?: PptTableStyle | string;
17
+ cardMaterial: PptCardMaterial;
18
+ coverVariant: string;
19
+ sectionVariant?: string;
20
+ kpiVariant?: string;
21
+ cardsVariant?: string;
22
+ iconMode?: PptIconMode;
23
+ iconBadgeStyle?: 'soft' | 'ring' | 'bare' | 'solid';
24
+ chartSpotlight?: boolean;
25
+ chartGrowthCallout?: boolean;
26
+ density?: 'airy' | 'balanced' | 'compact';
27
+ typeScaleRatio?: number;
28
+ whitespaceRatio?: number;
29
+ rhythmScore?: number;
30
+ brand?: PptBrand;
31
+ swatches?: string[];
32
+ builtin?: boolean;
33
+ sourceFile?: string;
34
+ absorbedAt?: string;
35
+ }
4
36
  export type PptPersonaId = 'auto' | 'consulting' | 'tech-pitch' | 'academic' | 'gov-exec' | 'education' | 'editorial';
5
37
  export type PptLanguage = 'zh' | 'en' | 'bilingual';
6
- export type PptSlideLayout = 'cover' | 'agenda' | 'section' | 'bullets' | 'statement' | 'quote' | 'kpi' | 'cards' | 'comparison' | 'matrix' | 'process' | 'callout' | 'gantt' | 'architecture' | 'harvey' | 'tam' | 'org' | 'marimekko' | 'sankey' | 'swot' | 'table' | 'closing' | 'image' | 'image-left' | 'image-right' | 'chart' | 'chart-split' | 'gallery' | 'waterfall' | 'flywheel' | 'bento' | 'pillars' | 'exec-summary' | 'timeline' | 'steps' | 'layers' | 'funnel' | 'chevron' | 'value-chain' | 'issue-action' | 'before-after' | 'matrix-2x2' | 'kpi-grid' | 'scorecard' | 'formula-callout' | 'takeaways' | 'gallery-grid' | 'ablation-compare' | 'roadmap' | 'swimlane' | 'team';
38
+ export type PptSlideLayout = 'cover' | 'agenda' | 'section' | 'bullets' | 'statement' | 'quote' | 'kpi' | 'cards' | 'comparison' | 'matrix' | 'process' | 'callout' | 'gantt' | 'architecture' | 'harvey' | 'tam' | 'org' | 'marimekko' | 'sankey' | 'swot' | 'table' | 'closing' | 'image' | 'image-left' | 'image-right' | 'chart' | 'chart-split' | 'gallery' | 'waterfall' | 'flywheel' | 'bento' | 'pillars' | 'exec-summary' | 'timeline' | 'steps' | 'layers' | 'funnel' | 'chevron' | 'value-chain' | 'issue-action' | 'before-after' | 'matrix-2x2' | 'kpi-grid' | 'scorecard' | 'formula-callout' | 'takeaways' | 'gallery-grid' | 'ablation-compare' | 'roadmap' | 'swimlane' | 'team' | 'mermaid' | 'flowchart' | 'sequence';
7
39
  export type PptTemplateId = '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';
8
40
  export type PptTableStyle = 'consulting' | 'booktabs' | 'minimal' | 'banded' | 'harvey';
9
41
  export interface PptImageSpec {
@@ -28,6 +60,7 @@ export interface PptSlideItem {
28
60
  milestone?: boolean;
29
61
  role?: string;
30
62
  conversion?: string;
63
+ icon?: string;
31
64
  status?: 'positive' | 'negative' | 'warning' | 'neutral' | 'accent';
32
65
  tone?: 'positive' | 'negative' | 'warning' | 'neutral' | 'accent';
33
66
  }
@@ -45,6 +78,18 @@ export interface PptChartSpec {
45
78
  caption?: string;
46
79
  source?: string;
47
80
  highlight?: number | number[] | 'max' | 'last' | 'none';
81
+ spotlight?: boolean;
82
+ showGrowthCallout?: boolean;
83
+ referenceLine?: {
84
+ value: number;
85
+ label?: string;
86
+ color?: string;
87
+ };
88
+ callout?: {
89
+ label: string;
90
+ fromIndex?: number;
91
+ toIndex?: number;
92
+ };
48
93
  showValues?: boolean;
49
94
  totalIndices?: number[];
50
95
  }
@@ -61,6 +106,10 @@ export interface PptBrand {
61
106
  logo?: string | null;
62
107
  footer?: string;
63
108
  chromeStyle?: PptChromeStyle | string | null;
109
+ cardMaterial?: PptCardMaterial | null;
110
+ iconMode?: PptIconMode | null;
111
+ taste?: PptTasteRecipeId | string | null;
112
+ tasteRecipe?: PptTasteRecipe | null;
64
113
  }
65
114
  export interface PptQualityIssue {
66
115
  slide: number;
@@ -122,8 +171,10 @@ export interface PptEditArgs {
122
171
  remove?: Array<number | string>;
123
172
  append?: PptSlideSpec[];
124
173
  theme?: string;
174
+ taste?: PptTasteRecipeId | string | PptTasteRecipe | null;
125
175
  referencePptx?: string;
126
176
  brand?: PptBrand | null;
177
+ targetMinutes?: number | null;
127
178
  expectedRevision?: number;
128
179
  saveAs?: boolean;
129
180
  }
@@ -173,6 +224,8 @@ export interface PptSlideSpec {
173
224
  layout?: PptSlideLayout;
174
225
  variant?: string;
175
226
  chrome?: PptChromeStyle | string;
227
+ cardMaterial?: PptCardMaterial;
228
+ iconMode?: PptIconMode;
176
229
  title?: string;
177
230
  subtitle?: string;
178
231
  kicker?: string;
@@ -180,6 +233,7 @@ export interface PptSlideSpec {
180
233
  source?: string;
181
234
  text?: string;
182
235
  formula?: string;
236
+ mermaid?: string;
183
237
  bullets?: string[];
184
238
  items?: PptSlideItem[];
185
239
  cards?: PptSlideItem[];
@@ -225,6 +279,7 @@ export interface PptCreateArgs {
225
279
  /** 结构化幻灯片(高级用法,与 content 二选一)。 */
226
280
  slides?: PptSlideSpec[];
227
281
  theme?: string;
282
+ taste?: PptTasteRecipeId | string | PptTasteRecipe;
228
283
  persona?: PptPersonaId | string;
229
284
  referencePptx?: string;
230
285
  cloneStructure?: boolean;
@@ -238,6 +293,8 @@ export interface PptCreateArgs {
238
293
  overwrite?: boolean;
239
294
  template?: PptTemplateId | string;
240
295
  brand?: PptBrand;
296
+ /** Optional target speaking duration in minutes for pace budgeting. */
297
+ targetMinutes?: number;
241
298
  /** Optional explicit source facts, assumptions and safe arithmetic; bind slides with {{metricId}}. */
242
299
  dataModel?: PptDataModel;
243
300
  }
@@ -267,6 +324,7 @@ export interface PptThemePreviewResult {
267
324
  export interface PptThemesResult {
268
325
  ok: boolean;
269
326
  themes: PptThemeInfo[];
327
+ tasteRecipes?: PptTasteRecipe[];
270
328
  /** 传 preview: true 时返回:主题对比页 + 每套主题的 SVG 色板卡。 */
271
329
  preview?: PptThemePreviewResult;
272
330
  }
@@ -275,6 +333,8 @@ export interface PptAbsorbArgs {
275
333
  bytes?: Uint8Array | Buffer;
276
334
  cwd?: string;
277
335
  extractLogo?: boolean;
336
+ saveTasteAs?: string;
337
+ tasteName?: string;
278
338
  signal?: AbortSignal;
279
339
  }
280
340
  export interface PptAbsorbSkeleton {
@@ -310,6 +370,8 @@ export interface PptAbsorbResult {
310
370
  recommendedChrome?: PptChromeStyle | string;
311
371
  recommendedTableStyle?: PptTableStyle | string;
312
372
  narrativeProfile?: Record<string, unknown>;
373
+ styleRecipe?: PptTasteRecipe;
374
+ savedTastePath?: string;
313
375
  slideSkeleton?: PptAbsorbSlideSkeleton[];
314
376
  layoutSummary?: Record<string, unknown>;
315
377
  }
@@ -323,6 +385,55 @@ export interface PptImportArgs {
323
385
  modernize?: boolean;
324
386
  preserveSourceTheme?: boolean;
325
387
  }
388
+ export interface PptFromOfficeArgs {
389
+ filePath: string;
390
+ outputDir?: string;
391
+ fileName?: string;
392
+ theme?: string;
393
+ persona?: PptPersonaId | string;
394
+ chromeStyle?: PptChromeStyle | string;
395
+ targetMinutes?: number;
396
+ lang?: string;
397
+ overwrite?: boolean;
398
+ }
399
+ export type PptCitationStyle = 'gb-t-7714' | 'apa' | 'mla' | 'chicago';
400
+ export interface PptCiteArgs {
401
+ deckPath: string;
402
+ citePath?: string;
403
+ bibtex?: string;
404
+ dois?: string[];
405
+ citeKeys?: string[];
406
+ style?: PptCitationStyle;
407
+ appendReferences?: boolean;
408
+ expectedRevision?: number;
409
+ saveAs?: boolean;
410
+ }
411
+ export interface PptCiteResult {
412
+ ok: boolean;
413
+ matchedCount: number;
414
+ citedKeys: string[];
415
+ missingKeys: string[];
416
+ sourcePath?: string;
417
+ referencesSlideIndex?: number;
418
+ deck?: PptCreateResult;
419
+ }
420
+ export interface PptRemotionArgs {
421
+ deckPath: string;
422
+ outputDir?: string;
423
+ format?: 'landscape' | 'portrait' | 'square';
424
+ fps?: number;
425
+ overwrite?: boolean;
426
+ }
427
+ export interface PptRemotionResult {
428
+ ok: boolean;
429
+ outputDir: string;
430
+ storyboardPath: string;
431
+ files: string[];
432
+ fps: number;
433
+ totalFrames: number;
434
+ totalSeconds: number;
435
+ slideCount: number;
436
+ }
326
437
  export interface PptCreateResult {
327
438
  ok: boolean;
328
439
  title: string;
@@ -353,6 +464,7 @@ export interface PptCreateResult {
353
464
  export interface DeckEngine {
354
465
  absorbPptx(options: Record<string, unknown>): Promise<PptAbsorbResult>;
355
466
  importPptxDeck(options: Record<string, unknown>): Promise<PptCreateResult>;
467
+ importOfficeDeck?(options: Record<string, unknown>): Promise<PptCreateResult>;
356
468
  repairDeckVisual(options: Record<string, unknown>): Promise<PptCreateResult>;
357
469
  readRenderReceipt(pptxPath: string, receiptPath: string): PptRenderResult;
358
470
  previewDeckData(options: Record<string, unknown>): Record<string, any>;
@@ -360,6 +472,8 @@ export interface DeckEngine {
360
472
  dataReport(manifest: any): string;
361
473
  dataNotes(manifest: any, slide: any): string;
362
474
  renderHandoutMarkdown?(manifest: any, lang?: string): string;
475
+ renderOnePagerHtml?(manifest: any, lang?: string): string;
476
+ computePaceBudget?(manifest: any, targetMinutes?: number): Record<string, any>;
363
477
  buildDeckAsync?(options: Record<string, unknown>): Promise<PptCreateResult>;
364
478
  listTemplates(lang?: string): unknown[];
365
479
  editDeck(options: Record<string, unknown>): Promise<PptCreateResult>;
@@ -371,6 +485,12 @@ export interface DeckEngine {
371
485
  buildThemePreview(options: Record<string, unknown>): PptThemePreviewResult;
372
486
  listThemes(lang?: string): PptThemeInfo[];
373
487
  listMasterPresets?(lang?: string): unknown[];
488
+ listAllTasteRecipes?(cwd?: string): PptTasteRecipe[];
489
+ saveWorkspaceTasteRecipe?(recipe: PptTasteRecipe, cwd?: string): {
490
+ path: string;
491
+ recipe: PptTasteRecipe;
492
+ totalSaved: number;
493
+ };
374
494
  resolveTheme(input: unknown): Record<string, unknown>;
375
495
  resolveLanguage(input: unknown): Record<string, unknown>;
376
496
  }
@@ -34,6 +34,10 @@ const messages = {
34
34
  '图片必须从面板上传,不能读取其他本地文件': 'Upload the image from this panel. Other local file paths cannot be read.',
35
35
  '图片说明或适应方式无效': 'The image description or fit setting is invalid.',
36
36
  '不支持此文件类型': 'This file type is unsupported.',
37
+ '当前引擎版本暂不支持导入 Excel / Word 文档': 'Office document import (.xlsx/.csv/.docx) is unavailable in the current engine.',
38
+ '请选择 24 MiB 以内的 .xlsx、.csv、.tsv 或 .docx 文件': 'Choose an .xlsx, .csv, .tsv, or .docx file up to 24 MiB.',
39
+ '目标演讲时长需为 1–240 分钟的数字': 'Target speaking duration must be between 1 and 240 minutes.',
40
+ 'Mermaid 代码无效或超过 16,000 字符': 'Mermaid diagram code is invalid or exceeds 16,000 characters.',
37
41
  '请先渲染当前版本的 PPTX': 'Render the current PPTX version first.',
38
42
  '页码无效': 'The slide number is invalid.',
39
43
  '渲染图片已变化,请重新渲染当前 PPTX': 'The rendered image changed. Render the current PPTX again.',
@@ -37,6 +37,8 @@ export declare class PptWorkbench {
37
37
  private itemsPatch;
38
38
  private patch;
39
39
  private pptxBytes;
40
+ private officeBytes;
41
+ private flagshipDemoSlides;
40
42
  action(body: Record<string, unknown>, signal?: AbortSignal): Promise<unknown>;
41
43
  fetchDownload(request: Request): Promise<Response>;
42
44
  fetch(request: Request): Promise<Response>;