dsh-ppt 0.23.1 → 0.24.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.
@@ -1,5 +1,5 @@
1
1
  import type { ResolvedPptConfig } from './config.js';
2
- import type { DeckEngine, PptAbsorbResult, PptThemesResult } from './types.js';
2
+ import type { DeckEngine, PptAbsorbResult, PptCreateResult, 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;
@@ -17,15 +17,16 @@ export declare function getEngine(): Promise<DeckEngine>;
17
17
  /** Build executors with a shared engine loader; resolve paths separately for each call. */
18
18
  export declare function createPptExecutors(config: ResolvedPptConfig, loadEngine?: () => Promise<DeckEngine>): {
19
19
  themes(rawArgs: unknown, exec?: PptExecution): Promise<PptThemesResult>;
20
- create(rawArgs: unknown, exec?: PptExecution): Promise<import("./types.js").PptCreateResult>;
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
23
  ok: boolean;
24
24
  templates: unknown[];
25
25
  }>;
26
- edit(rawArgs: unknown, exec?: PptExecution): Promise<import("./types.js").PptCreateResult>;
27
- undo(rawArgs: unknown, exec?: PptExecution): Promise<import("./types.js").PptCreateResult>;
26
+ edit(rawArgs: unknown, exec?: PptExecution): Promise<PptCreateResult>;
27
+ undo(rawArgs: unknown, exec?: PptExecution): Promise<PptCreateResult>;
28
28
  check(rawArgs: unknown, exec?: PptExecution): Promise<import("./types.js").PptQualityResult | import("./types.js").PptCheckResult>;
29
29
  render(rawArgs: unknown, exec?: PptExecution): Promise<import("./types.js").PptRenderResult>;
30
- data(rawArgs: unknown, exec?: PptExecution): Promise<import("./types.js").PptCreateResult | Record<string, any>>;
30
+ data(rawArgs: unknown, exec?: PptExecution): Promise<PptCreateResult | Record<string, any>>;
31
+ importPptx(rawArgs: unknown, exec?: PptExecution): Promise<PptCreateResult>;
31
32
  };
package/lib/execution.js CHANGED
@@ -1,4 +1,6 @@
1
- import { resolve } from 'node:path';
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
3
+ import { dirname, join, resolve } from 'node:path';
2
4
  let enginePromise = null;
3
5
  export function getEngine() {
4
6
  if (enginePromise === null) {
@@ -14,6 +16,30 @@ export function getEngine() {
14
16
  function asRecord(value) {
15
17
  return value !== null && typeof value === 'object' && !Array.isArray(value) ? value : {};
16
18
  }
19
+ function resolveImportTarget(rawProjectId, cwd) {
20
+ const value = rawProjectId.trim();
21
+ if (/^[0-9a-f]{64}$/.test(value)) {
22
+ const catalogPath = join(process.env.DSH_HOME || join(homedir(), '.dsh'), 'plugins', 'dsh-ppt', 'projects.jsonl');
23
+ if (existsSync(catalogPath)) {
24
+ let matchedPath;
25
+ for (const line of readFileSync(catalogPath, 'utf8').split('\n')) {
26
+ try {
27
+ const row = JSON.parse(line);
28
+ if (row?.id === value && typeof row?.path === 'string' && row.path.endsWith('.json'))
29
+ matchedPath = row.path;
30
+ }
31
+ catch { /* ignore malformed trailing line */ }
32
+ }
33
+ if (matchedPath)
34
+ return { targetProjectDir: dirname(matchedPath), targetDeckPath: matchedPath };
35
+ }
36
+ throw new Error('dsh-ppt:未在工作台索引中找到该 projectId,请传入工程 .json 路径或目录');
37
+ }
38
+ const abs = resolve(cwd, value);
39
+ if (value.toLowerCase().endsWith('.json'))
40
+ return { targetProjectDir: dirname(abs), targetDeckPath: abs };
41
+ return { targetProjectDir: abs };
42
+ }
17
43
  /** Build executors with a shared engine loader; resolve paths separately for each call. */
18
44
  export function createPptExecutors(config, loadEngine = getEngine) {
19
45
  return {
@@ -129,5 +155,34 @@ export function createPptExecutors(config, loadEngine = getEngine) {
129
155
  return engine.updateDeckData(options);
130
156
  throw new Error('dsh-ppt:action 需为 preview 或 apply / Use preview or apply');
131
157
  },
158
+ async importPptx(rawArgs, exec) {
159
+ exec?.signal?.throwIfAborted();
160
+ const args = asRecord(rawArgs);
161
+ if (typeof args.pptxPath !== 'string' || args.pptxPath.trim() === '') {
162
+ throw new Error('dsh-ppt:pptxPath 不能为空');
163
+ }
164
+ const engine = await loadEngine();
165
+ exec?.signal?.throwIfAborted();
166
+ const cwd = exec?.agent?.session.header.cwd ?? process.cwd();
167
+ const rawOut = typeof args.outputDir === 'string' && args.outputDir.trim() !== '' ? args.outputDir.trim() : config.outputDir;
168
+ const resolvedOut = resolve(cwd, rawOut || '.');
169
+ const target = typeof args.projectId === 'string' && args.projectId.trim() !== ''
170
+ ? resolveImportTarget(args.projectId, cwd)
171
+ : undefined;
172
+ return engine.importPptxDeck({
173
+ pptxPath: args.pptxPath.trim(),
174
+ cwd,
175
+ outDir: resolvedOut,
176
+ outputDir: resolvedOut,
177
+ ...(target ? { targetProjectDir: target.targetProjectDir, ...(target.targetDeckPath ? { deckPath: target.targetDeckPath } : {}) } : {}),
178
+ ...(typeof args.projectId === 'string' && args.projectId.trim() !== '' ? { projectId: args.projectId.trim() } : {}),
179
+ theme: typeof args.theme === 'string' && args.theme.trim() !== '' ? args.theme.trim() : (config.defaultTheme || 'auto'),
180
+ persona: typeof args.persona === 'string' && args.persona.trim() !== '' ? args.persona.trim() : 'auto',
181
+ ...(typeof args.chromeStyle === 'string' && args.chromeStyle.trim() !== '' ? { chromeStyle: args.chromeStyle.trim() } : {}),
182
+ modernize: args.modernize !== false,
183
+ preserveSourceTheme: args.preserveSourceTheme === true,
184
+ signal: exec?.signal,
185
+ });
186
+ },
132
187
  };
133
188
  }
package/lib/tools.js CHANGED
@@ -86,12 +86,14 @@ const createResultSchema = {
86
86
  html: { type: 'string' },
87
87
  pptx: { type: 'string' },
88
88
  json: { type: 'string' },
89
+ handout: { type: 'string' },
89
90
  },
90
91
  additionalProperties: true,
91
92
  },
92
93
  htmlPath: { type: 'string' },
93
94
  pptxPath: { type: 'string' },
94
95
  jsonPath: { type: 'string' },
96
+ handoutPath: { type: 'string' },
95
97
  },
96
98
  additionalProperties: true,
97
99
  };
@@ -130,6 +132,7 @@ function renderCreate(value) {
130
132
  '打开演示文稿:' + value.htmlPath + '\n' +
131
133
  '可直接修改的 PPTX:' + value.pptxPath + '\n' +
132
134
  '可继续编辑的项目:' + value.jsonPath + '\n' +
135
+ (value.handoutPath ? '演讲讲义:' + value.handoutPath + '\n' : '') +
133
136
  'HTML 双击即可放映;可点击上一页/下一页、输入页码,以及“检查与导出”定位问题或下载 PPTX。PPTX 可用 PowerPoint / WPS / Keynote 直接编辑。' +
134
137
  (value.revision !== undefined ? '\n修订号:' + value.revision + ';可撤销修改:' + value.undoAvailable + '。用 ppt_edit 修改指定页,ppt_undo 撤销。' : '') +
135
138
  (value.quality ? '\n\n' + qualityText(value.quality) : ''));
@@ -224,6 +227,7 @@ const slideLayouts = [
224
227
  'cover', 'agenda', 'section', 'bullets', 'statement', 'quote',
225
228
  'kpi', 'cards', 'comparison', 'matrix', 'process', 'callout',
226
229
  'gantt', 'architecture', 'harvey', 'tam', 'org',
230
+ 'marimekko', 'sankey', 'swot',
227
231
  'table', 'closing', 'image', 'image-left', 'image-right',
228
232
  'chart', 'chart-split', 'gallery', 'waterfall', 'flywheel',
229
233
  'bento', 'pillars', 'exec-summary', 'timeline', 'steps', 'layers', 'funnel', 'chevron', 'value-chain',
@@ -245,7 +249,9 @@ const slideProperties = {
245
249
  title: { type: 'string' }, subtitle: { type: 'string' }, kicker: { type: 'string' },
246
250
  takeaway: { type: 'string', description: 'Bottom key-takeaway synthesis banner.' },
247
251
  source: { type: 'string', description: 'Bottom-left data/citation source line.' },
248
- text: { type: 'string' }, notes: { type: 'string' },
252
+ text: { type: 'string' },
253
+ 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").' },
254
+ notes: { type: 'string' },
249
255
  start: { type: 'number' }, span: { type: 'number' },
250
256
  activeIndex: { type: 'integer' },
251
257
  tableStyle: { type: 'string', enum: tableStyles },
@@ -415,5 +421,24 @@ export function buildPptTools(config) {
415
421
  output: { schema: { type: 'object', additionalProperties: true }, render: (_args, value) => renderPreview(value) },
416
422
  execute: executors.render,
417
423
  },
424
+ {
425
+ name: 'ppt_import',
426
+ description: 'Import an external .pptx file into an editable dsh-ppt project (HTML, modernized or source-themed PPTX, project JSON, and speaker handout), or sync Office-edited .pptx content back into an existing project with undo history. 中文:导入外部 .pptx 一键翻新生成可编辑 dsh-ppt 工程,或将 Office 修改稿导回既有工程更新(支持撤销)。',
427
+ parameters: compileParameters({
428
+ pptxPath: { type: 'string', required: true, description: 'Local .pptx file path, relative to session cwd or absolute.' },
429
+ projectId: { type: 'string', description: 'Optional existing dsh-ppt project .json path, project folder, or workbench project ID. If provided, syncs Office-edited .pptx content back into that project with undo support; if omitted, creates a brand-new editable project.' },
430
+ outputDir: { type: 'string', description: 'Directory to write newly imported project files into when projectId is omitted. Default: session working directory (or the plugin outputDir config).' },
431
+ theme: { type: 'string', description: 'Target built-in theme id (or "auto", default "auto") when modernizing an imported .pptx.' },
432
+ persona: { type: 'string', enum: ['auto', 'consulting', 'tech-pitch', 'academic', 'gov-exec', 'education', 'editorial'], description: 'Optional scenario/audience persona for Auto-Director refurbishment. Default auto.' },
433
+ chromeStyle: { type: 'string', enum: ALLOWED_CHROME_STYLES, description: 'Optional master chrome skeleton override: ' + ALLOWED_CHROME_STYLES.join(' | ') + '.' },
434
+ modernize: { type: 'boolean', description: 'Refurbish layouts, typography, and WCAG contrast into dsh-ppt archetypes (default true).' },
435
+ preserveSourceTheme: { type: 'boolean', description: 'Preserve sanitized palette, fonts, and logo absorbed from the source .pptx instead of switching to a new theme (default false).' },
436
+ }),
437
+ output: {
438
+ schema: createResultSchema,
439
+ render: (_args, value) => renderCreate(value),
440
+ },
441
+ execute: executors.importPptx,
442
+ },
418
443
  ];
419
444
  }
package/lib/types.d.ts CHANGED
@@ -3,7 +3,7 @@ export type PptThemeId = 'swiss' | 'velvet' | 'data' | 'soft' | 'bold' | 'consul
3
3
  export type PptChromeStyle = 'consulting-classic' | 'keynote-spatial' | 'editorial-folio' | 'saas-bento' | 'academic-minimal' | 'gov-ceremonial';
4
4
  export type PptPersonaId = 'auto' | 'consulting' | 'tech-pitch' | 'academic' | 'gov-exec' | 'education' | 'editorial';
5
5
  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' | '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';
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';
7
7
  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
8
  export type PptTableStyle = 'consulting' | 'booktabs' | 'minimal' | 'banded' | 'harvey';
9
9
  export interface PptImageSpec {
@@ -179,6 +179,7 @@ export interface PptSlideSpec {
179
179
  takeaway?: string;
180
180
  source?: string;
181
181
  text?: string;
182
+ formula?: string;
182
183
  bullets?: string[];
183
184
  items?: PptSlideItem[];
184
185
  cards?: PptSlideItem[];
@@ -312,6 +313,16 @@ export interface PptAbsorbResult {
312
313
  slideSkeleton?: PptAbsorbSlideSkeleton[];
313
314
  layoutSummary?: Record<string, unknown>;
314
315
  }
316
+ export interface PptImportArgs {
317
+ pptxPath: string;
318
+ projectId?: string;
319
+ outputDir?: string;
320
+ theme?: string;
321
+ persona?: PptPersonaId | string;
322
+ chromeStyle?: PptChromeStyle | string;
323
+ modernize?: boolean;
324
+ preserveSourceTheme?: boolean;
325
+ }
315
326
  export interface PptCreateResult {
316
327
  ok: boolean;
317
328
  title: string;
@@ -323,26 +334,32 @@ export interface PptCreateResult {
323
334
  html: string;
324
335
  pptx: string;
325
336
  json: string;
337
+ handout?: string;
326
338
  };
327
339
  htmlPath: string;
328
340
  pptxPath: string;
329
341
  jsonPath: string;
342
+ handoutPath?: string;
330
343
  deckId?: string;
331
344
  revision?: number;
332
345
  undoAvailable?: number;
333
346
  deliveryStatus?: 'draft' | 'ready-for-review';
347
+ importedFrom?: string;
348
+ syncedProject?: boolean;
334
349
  quality?: PptQualityResult;
335
350
  verification?: PptVerification;
336
351
  }
337
352
  /** Shared generator and optional renderer exposed to the plugin. */
338
353
  export interface DeckEngine {
339
354
  absorbPptx(options: Record<string, unknown>): Promise<PptAbsorbResult>;
355
+ importPptxDeck(options: Record<string, unknown>): Promise<PptCreateResult>;
340
356
  repairDeckVisual(options: Record<string, unknown>): Promise<PptCreateResult>;
341
357
  readRenderReceipt(pptxPath: string, receiptPath: string): PptRenderResult;
342
358
  previewDeckData(options: Record<string, unknown>): Record<string, any>;
343
359
  updateDeckData(options: Record<string, unknown>): Promise<PptCreateResult>;
344
360
  dataReport(manifest: any): string;
345
361
  dataNotes(manifest: any, slide: any): string;
362
+ renderHandoutMarkdown?(manifest: any, lang?: string): string;
346
363
  buildDeckAsync?(options: Record<string, unknown>): Promise<PptCreateResult>;
347
364
  listTemplates(lang?: string): unknown[];
348
365
  editDeck(options: Record<string, unknown>): Promise<PptCreateResult>;
@@ -28,6 +28,7 @@ const messages = {
28
28
  '请输入演示文稿标题(1–200 字符)': 'Enter a presentation title (1–200 characters).',
29
29
  '大纲正文超过 200,000 字符上限,请精简后重试': 'The outline exceeds 200,000 characters. Shorten it and try again.',
30
30
  '当前引擎版本暂不支持参考 PPTX 吸收': 'Reference PPTX style extraction is unavailable in the current engine.',
31
+ '当前引擎版本暂不支持导入 PPTX': 'PPTX import is unavailable in the current engine.',
31
32
  '页数已达 120 页上限,无法继续新增页面': 'The presentation already has 120 slides and cannot add more.',
32
33
  '请选择 PNG 或 JPEG 图片': 'Choose a PNG or JPEG image.',
33
34
  '图片必须从面板上传,不能读取其他本地文件': 'Upload the image from this panel. Other local file paths cannot be read.',
package/lib/workbench.js CHANGED
@@ -18,6 +18,7 @@ const ALLOWED_LAYOUTS = new Set([
18
18
  'cover', 'agenda', 'section', 'bullets', 'statement', 'quote',
19
19
  'kpi', 'cards', 'comparison', 'matrix', 'process', 'callout',
20
20
  'gantt', 'architecture', 'harvey', 'tam', 'org',
21
+ 'marimekko', 'sankey', 'swot',
21
22
  'table', 'closing', 'image', 'image-left', 'image-right', 'chart', 'chart-split',
22
23
  'waterfall', 'gallery', 'flywheel', 'chevron', 'value-chain',
23
24
  ]);
@@ -108,7 +109,7 @@ function starterSlide(archetype, language) {
108
109
  ],
109
110
  };
110
111
  }
111
- if (kind === 'chevron' || kind === 'value-chain') {
112
+ if (kind === 'chevron') {
112
113
  return {
113
114
  layout: 'process',
114
115
  variant: 'chevron',
@@ -121,6 +122,69 @@ function starterSlide(archetype, language) {
121
122
  ],
122
123
  };
123
124
  }
125
+ if (kind === 'value-chain') {
126
+ return {
127
+ layout: 'value-chain',
128
+ title: en ? 'Porter value chain drives sustainable margin expansion' : '波特价值链:辅助底座赋能基本活动持续扩大利润空间',
129
+ items: [
130
+ { tag: en ? 'Support' : '辅助活动', title: en ? 'Firm Infrastructure & Governance' : '企业基础设施与敏捷治理', text: en ? 'Unified metrics, compliance, and cross-org alignment.' : '统一经营口径、合规风控与跨部门资源协同。' },
131
+ { tag: en ? 'Support' : '辅助活动', title: en ? 'R&D & Technology Platform' : '技术研发与数字化中台', text: en ? 'AI workflow engine, automated QA, and telemetry.' : '智能编排引擎、自动化测试与全链路可观测。' },
132
+ { tag: en ? 'Primary' : '基本活动', title: en ? 'Inbound Supply' : '需求洞察与准入', text: en ? 'High-intent capture' : '聚焦高价值需求', status: 'neutral' },
133
+ { tag: en ? 'Primary' : '基本活动', title: en ? 'Core Operations' : '标准化交付', text: en ? 'Automated build' : '同源构建零返工', status: 'accent' },
134
+ { tag: en ? 'Primary' : '基本活动', title: en ? 'Go-to-Market' : '市场拓展与转化', text: en ? 'Benchmark rollout' : '标杆样板规模复制', status: 'accent' },
135
+ { tag: en ? 'Primary' : '基本活动', title: en ? 'Service & Retention' : '全周期运营复购', text: en ? '118% net retention' : '驱动高净留存增长', status: 'positive' },
136
+ ],
137
+ };
138
+ }
139
+ if (kind === 'marimekko') {
140
+ return {
141
+ layout: 'marimekko',
142
+ title: en ? 'Market sizing & share across key verticals (Marimekko)' : '细分赛道规模与竞争份额分布(不等宽市场图)',
143
+ rows: en
144
+ ? [['Player / Segment', 'Enterprise (45B)', 'Financial (32B)', 'Industrial (23B)'], ['Ours', '42%', '35%', '28%'], ['Vendor B', '33%', '40%', '32%'], ['Others', '25%', '25%', '40%']]
145
+ : [['厂商 / 赛道', '华东政务 (450亿)', '金融信创 (320亿)', '工业制造 (230亿)'], ['本方案', '42%', '35%', '28%'], ['厂商 B', '33%', '40%', '32%'], ['其他', '25%', '25%', '40%']],
146
+ };
147
+ }
148
+ if (kind === 'sankey') {
149
+ return {
150
+ layout: 'sankey',
151
+ title: en ? 'Revenue-to-operating-income flow attribution (Sankey)' : '总营收至营业利润全链路流向拆解(桑基图)',
152
+ items: en
153
+ ? [
154
+ { tag: 'Total Revenue', title: 'Gross Profit', value: '68.5', unit: 'B', status: 'positive' },
155
+ { tag: 'Total Revenue', title: 'Cost of Revenue', value: '31.5', unit: 'B', status: 'neutral' },
156
+ { tag: 'Gross Profit', title: 'R&D Investment', value: '22.0', unit: 'B', status: 'accent' },
157
+ { tag: 'Gross Profit', title: 'Sales & Ops', value: '12.0', unit: 'B', status: 'warning' },
158
+ { tag: 'Gross Profit', title: 'Operating Income', value: '34.5', unit: 'B', status: 'positive' },
159
+ ]
160
+ : [
161
+ { tag: '总营收', title: '毛利润', value: '68.5', unit: '亿', status: 'positive' },
162
+ { tag: '总营收', title: '营业成本', value: '31.5', unit: '亿', status: 'neutral' },
163
+ { tag: '毛利润', title: '研发投入', value: '22.0', unit: '亿', status: 'accent' },
164
+ { tag: '毛利润', title: '营销与管理', value: '12.0', unit: '亿', status: 'warning' },
165
+ { tag: '毛利润', title: '营业利润', value: '34.5', unit: '亿', status: 'positive' },
166
+ ],
167
+ };
168
+ }
169
+ if (kind === 'swot') {
170
+ return {
171
+ layout: 'swot',
172
+ title: en ? 'SWOT strategic matrix and positioning anchor' : 'SWOT 战略矩阵与破局定位锚点',
173
+ items: en
174
+ ? [
175
+ { tag: 'S · Strengths', title: 'Core moat', bullets: ['HTML & native OOXML parity', 'Zero-dep deterministic layout'], status: 'positive' },
176
+ { tag: 'W · Weaknesses', title: 'Current gaps', bullets: ['Custom legacy templates need mapping', 'Optional render engine setup'], status: 'warning' },
177
+ { tag: 'O · Opportunities', title: 'Market tailwinds', bullets: ['Enterprise slide automation demand', 'Legacy .pptx refurbishment market'], status: 'accent' },
178
+ { tag: 'T · Threats', title: 'External risks', bullets: ['Strict brand compliance lock-in', 'Browser sandbox constraints'], status: 'negative' },
179
+ ]
180
+ : [
181
+ { tag: 'S · 核心优势', title: '技术与交付壁垒', bullets: ['HTML 与原生 OOXML 双向同源', '零外部运行时依赖确定性排版'], status: 'positive' },
182
+ { tag: 'W · 关键短板', title: '待补齐环节', bullets: ['复杂存量模板首次梳理需微调', '高清渲染核验依赖可选引擎'], status: 'warning' },
183
+ { tag: 'O · 外部机遇', title: '行业增长空间', bullets: ['政企与咨询智能制图需求爆发', '老旧 PPTX 一键翻新刚需'], status: 'accent' },
184
+ { tag: 'T · 潜在威胁', title: '外部风险挑战', bullets: ['客户既有母版规范约束多', '内网离线受限环境部署门槛'], status: 'negative' },
185
+ ],
186
+ };
187
+ }
124
188
  if (kind === 'process') {
125
189
  return {
126
190
  layout: 'process',
@@ -517,7 +581,7 @@ export class PptWorkbench {
517
581
  throw new Error('结构化卡片内容无效');
518
582
  const result = {};
519
583
  for (const [key, item] of Object.entries(raw)) {
520
- if (['title', 'subtitle', 'kicker', 'takeaway', 'source', 'text', 'notes'].includes(key)) {
584
+ if (['title', 'subtitle', 'kicker', 'takeaway', 'source', 'text', 'formula', 'notes'].includes(key)) {
521
585
  if (typeof item !== 'string' || item.length > 8000)
522
586
  throw new Error('文字字段过长或无效');
523
587
  result[key] = item;
@@ -728,6 +792,74 @@ export class PptWorkbench {
728
792
  rmSync(tmpRefPath, { force: true });
729
793
  }
730
794
  }
795
+ if (body.operation === 'import-pptx') {
796
+ if (['pptxPath', 'path', 'outputDir', 'targetProjectDir', 'referencePptx'].some(k => Object.hasOwn(body, k))) {
797
+ throw new Error('图片必须从面板上传,不能读取其他本地文件');
798
+ }
799
+ const bytes = this.pptxBytes(body.data);
800
+ const engine = await this.loadEngine();
801
+ signal?.throwIfAborted();
802
+ if (typeof engine.importPptxDeck !== 'function')
803
+ throw new Error('当前引擎版本暂不支持导入 PPTX');
804
+ const theme = typeof body.theme === 'string' && body.theme.trim() ? (body.theme.trim() === 'auto' ? 'auto' : this.themeId(body.theme)) : 'auto';
805
+ const modernize = body.modernize !== false;
806
+ const preserveSourceTheme = body.preserveSourceTheme === true;
807
+ let chromeStyle;
808
+ if (body.chromeStyle !== undefined && body.chromeStyle !== null && body.chromeStyle !== '') {
809
+ if (typeof body.chromeStyle !== 'string' || !ALLOWED_CHROME_STYLES.has(body.chromeStyle)) {
810
+ throw new Error('母版骨架名称无效 / Invalid chrome skeleton style');
811
+ }
812
+ chromeStyle = body.chromeStyle;
813
+ }
814
+ if (body.id !== undefined && body.id !== null && body.id !== '') {
815
+ const { entry, manifest } = await this.project(body.id);
816
+ this.revision(body, manifest);
817
+ const projectDir = dirname(entry.path);
818
+ const tmpImportPath = join(projectDir, '.import-' + randomUUID() + '.pptx');
819
+ writeFileSync(tmpImportPath, bytes);
820
+ try {
821
+ const synced = await engine.importPptxDeck({
822
+ bytes,
823
+ pptxPath: tmpImportPath,
824
+ targetProjectDir: projectDir,
825
+ deckPath: entry.path,
826
+ theme,
827
+ ...(chromeStyle ? { chromeStyle } : {}),
828
+ modernize,
829
+ preserveSourceTheme,
830
+ signal,
831
+ });
832
+ await this.remember(synced, {});
833
+ return { ...await this.view(digest(synced.jsonPath || entry.path)), imported: true, syncedProject: true };
834
+ }
835
+ finally {
836
+ rmSync(tmpImportPath, { force: true });
837
+ }
838
+ }
839
+ const decksDir = join(dirname(this.catalogPath), 'workbench-decks');
840
+ mkdirSync(decksDir, { recursive: true });
841
+ const tmpImportPath = join(decksDir, '.import-' + randomUUID() + '.pptx');
842
+ writeFileSync(tmpImportPath, bytes);
843
+ try {
844
+ const imported = await engine.importPptxDeck({
845
+ bytes,
846
+ pptxPath: tmpImportPath,
847
+ outDir: decksDir,
848
+ outputDir: decksDir,
849
+ cwd: decksDir,
850
+ theme,
851
+ ...(chromeStyle ? { chromeStyle } : {}),
852
+ modernize,
853
+ preserveSourceTheme,
854
+ signal,
855
+ });
856
+ await this.remember(imported, {});
857
+ return { ...await this.view(digest(imported.jsonPath)), imported: true, created: true };
858
+ }
859
+ finally {
860
+ rmSync(tmpImportPath, { force: true });
861
+ }
862
+ }
731
863
  if (body.operation === 'open')
732
864
  return this.view(body.id);
733
865
  const { entry, engine, manifest, files } = await this.project(body.id);
@@ -788,8 +920,15 @@ export class PptWorkbench {
788
920
  };
789
921
  }
790
922
  if (body.operation === 'download') {
791
- if (!['html', 'pptx', 'json'].includes(String(body.kind)))
923
+ if (!['html', 'pptx', 'json', 'handout'].includes(String(body.kind)))
792
924
  throw new Error('不支持此文件类型');
925
+ if (body.kind === 'handout') {
926
+ const handoutPath = files.json.slice(0, -5) + '.handout.md';
927
+ if (existsSync(handoutPath))
928
+ return { ok: true, name: basename(handoutPath), data: ordinaryFile(handoutPath).toString('base64') };
929
+ const md = typeof engine.renderHandoutMarkdown === 'function' ? engine.renderHandoutMarkdown(manifest, manifest.language) : speakerNotes(manifest);
930
+ return { ok: true, name: basename(entry.path, '.json') + '.handout.md', data: Buffer.from(md, 'utf8').toString('base64') };
931
+ }
793
932
  const path = files[body.kind];
794
933
  return { ok: true, name: basename(path), data: ordinaryFile(path).toString('base64') };
795
934
  }
@@ -907,7 +1046,7 @@ export class PptWorkbench {
907
1046
  return denied;
908
1047
  try {
909
1048
  const params = new URL(request.url).searchParams, kind = params.get('kind');
910
- if (!['html', 'pptx', 'json', 'bundle', 'share', 'notes', 'coaching', 'data', 'visual'].includes(String(kind)))
1049
+ if (!['html', 'pptx', 'json', 'bundle', 'share', 'notes', 'handout', 'coaching', 'data', 'visual'].includes(String(kind)))
911
1050
  return fail(400, '不支持此文件类型');
912
1051
  const { entry, manifest, files, engine } = await this.project(params.get('id'));
913
1052
  if (String(manifest.revision) !== params.get('revision'))
@@ -930,6 +1069,18 @@ export class PptWorkbench {
930
1069
  bytes = strToU8(speakerNotes({ ...manifest, slides: manifest.slides.map((slide) => ({ ...slide, notes: engine.dataNotes(manifest, slide) })) }));
931
1070
  name = basename(entry.path, '.json') + '-speaker-notes.md';
932
1071
  }
1072
+ else if (kind === 'handout') {
1073
+ const handoutPath = entry.path.slice(0, -5) + '.handout.md';
1074
+ if (existsSync(handoutPath)) {
1075
+ bytes = ordinaryFile(handoutPath);
1076
+ name = basename(handoutPath);
1077
+ }
1078
+ else {
1079
+ const md = typeof engine.renderHandoutMarkdown === 'function' ? engine.renderHandoutMarkdown(manifest, manifest.language) : speakerNotes(manifest);
1080
+ bytes = strToU8(md);
1081
+ name = basename(entry.path, '.json') + '.handout.md';
1082
+ }
1083
+ }
933
1084
  else if (kind === 'bundle' || kind === 'share') {
934
1085
  const entries = {};
935
1086
  let total = 0;
@@ -968,10 +1119,10 @@ export class PptWorkbench {
968
1119
  if ((await this.project(entry.id)).manifest.revision !== manifest.revision)
969
1120
  return fail(409, '项目已被修改,请重新打开后下载');
970
1121
  const archive = kind === 'bundle' || kind === 'share';
971
- const type = ['notes', 'coaching', 'data', 'visual'].includes(String(kind)) ? 'text/markdown; charset=utf-8' : archive ? 'application/zip' : kind === 'pptx' ? 'application/vnd.openxmlformats-officedocument.presentationml.presentation' : kind === 'html' ? 'text/html; charset=utf-8' : 'application/json; charset=utf-8';
1122
+ const type = ['notes', 'handout', 'coaching', 'data', 'visual'].includes(String(kind)) ? 'text/markdown; charset=utf-8' : archive ? 'application/zip' : kind === 'pptx' ? 'application/vnd.openxmlformats-officedocument.presentationml.presentation' : kind === 'html' ? 'text/html; charset=utf-8' : 'application/json; charset=utf-8';
972
1123
  return new Response(new Uint8Array(bytes), { headers: {
973
1124
  'content-type': type, 'cache-control': 'no-store', 'x-content-type-options': 'nosniff',
974
- 'content-disposition': `attachment; filename="presentation.${archive ? 'zip' : ['notes', 'coaching', 'data', 'visual'].includes(String(kind)) ? 'md' : kind}"; filename*=UTF-8''${encodeURIComponent(name)}`,
1125
+ 'content-disposition': `attachment; filename="presentation.${archive ? 'zip' : ['notes', 'handout', 'coaching', 'data', 'visual'].includes(String(kind)) ? 'md' : kind}"; filename*=UTF-8''${encodeURIComponent(name)}`,
975
1126
  } });
976
1127
  }
977
1128
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ppt",
3
- "version": "0.23.1",
3
+ "version": "0.24.0",
4
4
  "description": "DeepSeek Harness 演示文稿生成与编辑工作台:输入材料即可导出离线 HTML 放映、可编辑 PPTX 与工程包,支持按页编辑、数据推演与预审演练,以及原生清透 / 米白纸感 / Claude 暖书卷 / 8-Bit 像素 / 晴空薄荷五套明亮工作台主题。欢迎提交 issues 和 PR。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: dsh-ppt
3
- description: "Turn one sentence, a Markdown document, structured slides, or a reference .pptx into a world-class presentation deck: standalone HTML web slideshow + 100% native-editable PPTX + project manifest. Features Zero-Question Scenario Auto-Direction (theme: auto), 24 curated themes (16 daylight projector-safe + 8 dark elevation), 8 world-class reference presets, 6 distinct Master Chrome Skeletons, 24+ native-editable layouts & pro diagrams (Value-Chain Chevrons, Gantt, Architecture, Harvey Matrix, TAM Concentric, Org Tree, Bento, KPI, 2x2 Matrix, Timeline/Process/Flywheel, Booktabs 3-line tables, Chart-Split), 20 industry blueprints, 13 Economist/FT-grade charts (including vector Waterfall), deep external .pptx skeleton & group-shape absorption (ppt_absorb / referencePptx / cloneStructure), data provenance, and bilingual ZH/EN support. 中文:把一句话、文档、数据或参考 PPTX 变成大师级演示文稿(独立 HTML 放映 + 100% 原生可编辑 PPTX),内置零追问智能审美导演、24 套明暗主题、8 套名家范本预设、6 套母版骨架、价值链五边形箭头等 24+ 种原生版式与专业图示、20 套行业蓝图、13 类出版级图表与外部 PPTX 深度吸收。"
3
+ description: "Turn one sentence, a Markdown document, structured slides, or an existing/reference .pptx into a world-class presentation deck: standalone HTML web slideshow (with Dual-Screen Presenter Console & Laser Pointer) + 100% native-editable PPTX (with native <m:oMath> formulas, Marimekko, Sankey, Porter Value Chain, SWOT) + project manifest + Speaker Handout (.handout.md). Features Zero-Question Scenario Auto-Direction (theme: auto), 24 curated themes, 8 reference presets, 6 Master Chrome Skeletons, 27+ native-editable layouts & pro diagrams, 20 industry blueprints, 13 Economist/FT-grade charts, deep external .pptx content import & Office round-trip sync (ppt_import / --import-pptx / --sync-pptx), data provenance, and bilingual ZH/EN support. 中文:把一句话、文档、数据或已有/参考 PPTX 变成大师级演示文稿(独立 HTML 双屏提词台放映 + 100% 原生可编辑 PPTX + 演讲讲义),内置零追问智能导演、24 套主题、6 套母版骨架、Marimekko/桑基图/波特价值链/SWOT/原生数学公式 <m:oMath> 等 27+ 版式、外部 PPTX 全量导入翻新与 Office 双向回导同步。"
4
4
  compatibility: "Node ^22.19.0 or >=24.0.0. Images/charts/PPTX absorption use @office-kit/pptx@0.21.0; optional data models use jsep@1.4.0 and csv-parse@6.1.0. Optional PNG/PDF renderer: @deepseek-ai/libreoffice-kit@0.2.3 (bundled by DSH 0.2.2+; 0.1.5 also supported). Cross-harness: copy the full directory and run npm install --ignore-scripts there."
5
5
  allowed-tools: "Bash, Read, Write, Edit"
6
6
  ---
@@ -27,7 +27,7 @@ allowed-tools: "Bash, Read, Write, Edit"
27
27
 
28
28
  - **默认零额外模型开销直接交付**:不自动触发 AI 预审、模拟答辩或视觉看图修复。用户可在 DSH 设置页主动开启可选 AI 预审/答辩或「视觉检查与修复」(支持最高 24 页全量审查与 12 种无损版式/字号修复);AI 演练不等于事实核验,不编造实验、数据或引用;采纳建议默认另存副本,原件保留。模型失败、截断、停止或未检查页面必须如实说明,不能声称视觉通过。
29
29
  - **数字溯源与推演纪律**:需要解释数字来源或现场滑块推演时,提供 `dataModel` 并在 `slides`(含 `items`、`takeaway`、`source`、`chart`)绑定 `{{metricId}}`;先读 `references/data.md`。`source` 必须对应真实材料行或单元格,假设用 `kind: 'input'` 标注,禁止虚构来源。修改数据先 `ppt_data(action: 'preview')`,展示差异并获确认后带凭证 `apply`(默认 `saveAs: true`)。
30
- - **工程安全与版本锁**:修改已有工程先 `ppt_check` 获取当前 `revision` 与页面 ID。外部手工改过的 HTML/PPTX 或缺少校验记录的旧工程不可覆盖;告知用户 `saveAs: true` 仅从 JSON 另存新副本,Office 手工修改不会回导。严禁绕过校验或篡改摘要。仅吸收外部 `.pptx` 的视觉风格(`ppt_absorb` / `referencePptx`),不直接就地编辑任意外部 `.pptx` 正文。
30
+ - **工程安全与版本锁**:修改已有工程先 `ppt_check` 获取当前 `revision` 与页面 ID。外部手工改过的 HTML/PPTX 或缺少校验记录的旧工程不可被 `ppt_edit` 静默覆盖;若用户在 PowerPoint / WPS 中修改了 `.pptx` 并希望同步回工程,请使用 **`ppt_import`(传 `projectId`)或 CLI `--sync-pptx`**,自动在 `.history/` 留存快照并用 `ppt_undo` 可逆回导;需要全新翻新外部 `.pptx` 时使用 `ppt_import`(CLI `--import-pptx`)。风格提取仍可使用只读 `ppt_absorb` / `referencePptx`。
31
31
  - **字体与跨平台零缺字**:正文最小字号硬底线 `13.5pt`,超长内容必须拆页而非强行缩字。若 `ppt_render` 报告 `missingFonts` 非空,必须替换为环境与接收方可用字体(Windows `Microsoft YaHei`、macOS `PingFang SC`/`Songti SC`、Linux `Noto Sans/Serif CJK SC`),重新生成并逐页复核;未解决前不得声称已验收。CLI 与工具报错信息统一为中文。
32
32
  - **语言分工**:`lang`(`zh | en | bilingual`)仅控制播放器界面与默认标签;正文与双语表达由你在写作阶段完成。
33
33
 
@@ -42,7 +42,7 @@ allowed-tools: "Bash, Read, Write, Edit"
42
42
  - **跨 harness CLI**:`node <skill-dir>/scripts/build-deck.mjs --title "标题" --slides @slides.json --theme auto --lang zh --out dist`(吸收参考模板并克隆结构可加 `--reference-pptx ref.pptx --clone-structure`;显式骨架用 `--chrome academic-minimal`;仅提取风格用 `--absorb ref.pptx`)。
43
43
  - 动效默认 `motion: 'on'`(HTML 页间淡入 + PPTX 要点点击逐条出现);严肃政企公文、学术打印或归档传 `motion: 'off'`。
44
44
  5. **Verify 校验与看图修正**:调 `ppt_check` 检查结构、字数密度、WCAG 对比度与 `SLOP-01..10` 审美告警。若安装了 `@deepseek-ai/libreoffice-kit`,调 `ppt_render` 生成逐页 PNG/PDF 并附 `renderReceipt` 复检,逐张用看图工具核查画面(0 缺字、0 溢出、0 遮挡、0 冗余图例)。微调文字、切换主题或版式用 `ppt_edit`(带 `expectedRevision`),需要时 `ppt_undo`。静态估算、渲染成功与视觉验收必须分开如实陈述。
45
- 6. **Deliver 交付**:向用户提供 `.html`、`.pptx`、`.json` 三个绝对路径,说明 HTML 快捷键(`← →` 翻页 · `F` 全屏 · `G` 总览 · `S` 演讲者备注 · `P` 打印)及 PPTX 100% 原生可编辑特性(形状、卡片、三线表、图表工作簿、瀑布桥与备注均可在 PowerPoint / WPS / Keynote 直接编辑);提示 DSH 工作台支持「风格与母版(Style Studio)」一键换肤、拖拽吸收 `.pptx` 与单页版式切换。
45
+ 6. **Deliver 交付**:向用户提供 `.html`、`.pptx`、`.json`(以及可选 `--handout` 生成的 `.handout.md`)绝对路径,说明 HTML 快捷键(`← →` 翻页 · **`P` 开启双屏演讲者提词台** · **`L` 开启虚拟激光笔** · `F` 全屏 · `G` 总览 · `S` 顶部备注 · `Ctrl/Cmd+P` 打印)及检查面板内置「下载讲义 (.md)」离线导出;说明 PPTX 100% 原生可编辑特性(含 `<m:oMath>` 原生公式、Marimekko、桑基流向图、波特价值链、SWOT、三线表与图表工作簿),以及支持 `ppt_import` / `--sync-pptx` 从 Office 改稿回导同步工程。
46
46
 
47
47
  ## 按需装载索引
48
48
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ppt-skill",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "description": "Standalone dsh-ppt skill dependencies for image/chart export",
@@ -64,25 +64,33 @@ Agent 先提炼真实内容与数据结论,再通过结构化参数生成可
64
64
 
65
65
  ---
66
66
 
67
- ## 四、外部参考 `.pptx` 深层骨架吸收与品牌定制(`ppt_absorb` & `brand`)
67
+ ## 四、外部 `.pptx` 风格吸收、全量导入翻新与 Office 双向同步(`ppt_absorb` / `ppt_import`)
68
68
 
69
69
  1. **提取外部 `.pptx` 母版风格与骨架(`ppt_absorb`)**:
70
70
  - 调用:`ppt_absorb { pptxPath: "corp-template.pptx" }`(CLI:`--absorb corp-template.pptx`)。
71
71
  - 纯离线读取主题 12 色槽(含 DrawingML `lumMod / lumOff / tint / shade / satMod` 子变换解析)、西文与东亚字体族、母版背景、内嵌 Logo、母版骨架特征(`extractedSkeleton: { cornerStyle, hasTopBanner, hasSideSpine, masterShapeCount }`)、推荐母版骨架(`recommendedChrome`)与逐页版式推演(`slideSkeleton[]`),经 `sanitizeAbsorbedTheme()` 自动完成 WCAG 对比度净化与刺眼大红底降级。
72
- 2. **一键套用参考 `.pptx` 与结构克隆(`referencePptx` & `cloneStructure`)**:
72
+ 2. **外部 `.pptx` 全量内容导入与老旧 PPT 一键翻新(`ppt_import` / `--import-pptx`)**:
73
+ - 调用:`ppt_import { pptxPath: "legacy.pptx", theme: "auto", modernize: true }`(CLI:`--import-pptx legacy.pptx --theme auto --out dist`;保留原品牌色与 Logo 可加 `preserveSourceTheme: true` / `--preserve-theme`)。
74
+ - 自动解析每页真实内容:标题、Kicker、副标题、正文与要点(保留粗体引导词为 `**bold**`)、原生表格(`<a:tbl>`)、原生图表(`ppt/charts/chart*.xml` `<c:cat>/<c:val>` 保留为可编辑图表)、嵌入位图(PNG/JPEG/WebP 安全导出至 `assets/imported-sN-M.<ext>`)及演讲者备注(自动剥离页码占位符),并智能映射为 `dsh-ppt` 原生版式,输出完整可放映 HTML(含按 `P` 启动的双屏演讲者提词台、按 `L` 激光笔与讲义下载)、可编辑 PPTX 与 JSON 工程。
75
+ 3. **Office 改稿双向回导同步(`ppt_import` + `projectId` / `--sync-pptx`)**:
76
+ - 在 PowerPoint / WPS 微调 `.pptx` 后,传 `projectId`(CLI:`--sync-pptx edited.pptx --edit dist/deck.json` 或 `--target-project dist`)即可将最新文字、表格、图表、图片与备注导回工程;同步前自动把原 `project.json` 快照写入 `.history/` 并压入撤回栈(`ppt_undo` 可完整恢复),同时保留原主题、品牌与匹配的数据溯源。
77
+ 4. **一键套用参考 `.pptx` 与结构克隆(`referencePptx` & `cloneStructure`)**:
73
78
  - 在 `ppt_create` 或 `ppt_edit` 中直接传 `referencePptx: "corp-template.pptx"`(CLI:`--reference-pptx corp.pptx`),自动将该模板净化后的色板、字体与母版 Logo 应用到整套文稿。
74
79
  - 若同时传 `cloneStructure: true`(CLI:`--clone-structure`),将把 `recommendedChrome` 写入 `brand.chromeStyle`,并把 Markdown 正文页面直接映射到吸收出的 `slideSkeleton` 版式序列!
75
- 3. **显式共享品牌(`brand`)**:
80
+ 5. **显式共享品牌(`brand`)**:
76
81
  - `brand: { name: "星尘科技", primaryColor: "#0057B8", backgroundColor: "#FFFFFF", textColor: "#0F172A", chromeStyle: "consulting-classic", fontFamily: "Microsoft YaHei", logo: "assets/logo.png", footer: "战略规划部 · 内部资料" }`。
77
82
  - 引擎通过 `deriveBrandedTheme()` 自动重算表面层级、淡网格线与次级墨色,杜绝浅底黑网格线冲突。
78
83
 
79
84
  ---
80
85
 
81
- ## 五、按页编辑、整套换肤、追加页面与撤销(`ppt_edit` & `ppt_undo`)
86
+ ## 五、双屏演讲者提词台、演讲讲义、按页编辑与撤销
87
+
88
+ - **双屏演讲者提词台(独立 HTML 放映内置)**:按 **`P`** 或点击 `#presenter-toggle` 打开双屏控制窗口(通过 `BroadcastChannel` + `postMessage` 双向实时同步),支持当前页与下一页预览、大字号提词器(`A+ / A-` 缩放,无手写备注时自动回退为 `takeaway` 与要点提示)、正计时与目标配速倒计时、缩略图条快速跳页,以及按 **`L`** 在观众主屏同步投射虚拟激光笔!
89
+ - **演讲讲义导出(`<slug>.handout.md`)**:HTML 检查面板内置「下载讲义 (.md)」按钮(客户端离线生成下载);CLI 传 `--handout`(或 API `handout: true`)可同时落盘 `<slug>.handout.md`,包含演示概览、预计总时长、每页核心指标/表格/要点与逐页演讲手稿。
82
90
 
83
91
  1. **先查后改**:调 `ppt_check { deckPath: "report.json" }` 获取当前 `revision` 与稳定页面 `id`。
84
92
  2. **原子编辑(`ppt_edit`)**:
85
- - **单页局部补丁 `edits`**:支持修改 `title, subtitle, kicker, takeaway, source, layout, variant, chrome, tableStyle, bullets, items, columns, rows, image, images, chart, notes, visual`(`slide` 传 1 起始页码或稳定 ID)。
93
+ - **单页局部补丁 `edits`**:支持修改 `title, subtitle, kicker, takeaway, source, formula, layout, variant, chrome, tableStyle, bullets, items, columns, rows, image, images, chart, notes, visual`(`slide` 传 1 起始页码或稳定 ID)。
86
94
  - **整套换肤与品牌更新**:顶层可传 `theme: "exec-jilan"`、`referencePptx: "ref.pptx"` 或 `brand`(`brand: null` 清空品牌,`logo: null` 清空 Logo)。
87
95
  - **追加、复制、排序与删除**:`append: [slide1, ...]`(单次追加 1–5 页新页面)、`duplicate: [2]`、`remove: [4]`、`order: [id1, id2, ...]`(包含全部原始页面 ID 各一次;执行顺序:先编辑/排序,再复制/删除/追加,最终保留 1–120 页)。
88
96
  - 每次修改原子重写 HTML / PPTX / JSON,失败自动回滚,保留最近 20 步历史。
@@ -115,6 +123,12 @@ node scripts/build-deck.mjs --title "学术答辩" --slides @slides.json --chrom
115
123
  # 仅解析并查看外部 PPTX 的净化色板、字体与版式摘要
116
124
  node scripts/build-deck.mjs --absorb corp.pptx
117
125
 
126
+ # 全量导入旧 PPTX 并一键翻新(支持 --preserve-theme 与 --handout)
127
+ node scripts/build-deck.mjs --import-pptx legacy.pptx --theme auto --handout --out dist
128
+
129
+ # 将 Office 修改后的 PPTX 导回已有工程(自动快照至 .history/ 支持撤销)
130
+ node scripts/build-deck.mjs --sync-pptx dist/deck.pptx --edit dist/deck.json
131
+
118
132
  # 编辑、撤销、静态检查与渲染收据核验
119
133
  node scripts/build-deck.mjs --edit dist/deck.json --edits @edits.json --revision 0
120
134
  node scripts/build-deck.mjs --undo dist/deck.json --revision 1
@@ -68,7 +68,7 @@
68
68
  - `input`:汇报现场可通过滑块调节的敏感性假设(必须如实标注 `note` 说明假设性质)。
69
69
  - `formula`:由前两者推导出的确定性算术结果。
70
70
  2. **全字段 `{{metricId}}` 占位绑定**:
71
- - 文本类绑定:支持在 `title`、`subtitle`、`kicker`、`bullets[]`、**`items[]`(含 `gantt / tam / architecture / org / kpi / cards` 的 `tag / value / title / text / delta / bullets`)**、**`columns[]`(`gantt` 时间列)**、**`takeaway`**、**`source`**、`rows[][]`(含 `table` 与 `harvey` 矩阵)与 `notes` 中嵌入一个或多个 `{{metricId}}`(保留内联 `**加粗**` 富文本样式,HTML 放映中渲染为可点击溯源与实时联动更新的数字徽章)。
71
+ - 文本类绑定:支持在 `title`、`subtitle`、`kicker`、`formula`、`bullets[]`、**`items[]`(含 `gantt / tam / architecture / org / kpi / cards / marimekko / sankey / swot / value-chain` 的 `tag / value / title / text / delta / bullets`)**、**`columns[]`(`gantt` 时间列)**、**`takeaway`**、**`source`**、`rows[][]`(含 `table`、`harvey` 与 `marimekko` 矩阵)与 `notes` 中嵌入一个或多个 `{{metricId}}`(保留内联 `**加粗**` 富文本样式,HTML 放映中渲染为可点击溯源与实时联动更新的数字徽章)。
72
72
  - 图表数值绑定:`chart.series[i].values` 中的绑定项必须是完整独立的 `"{{metricId}}"` 字符串(计算与绘图仍使用未舍入的精确原始数值,支持全部 13 类图表及矢量 `waterfall` 实时重绘)。
73
73
  - 格式约定:百分比在模型中以比例存储(`30%` 存为 `0.3`);`format.style` 支持 `'number'`(默认)或 `'percent'`,`digits` 为 `0–6` 位小数,可选 `unit`。指标 ID 以字母开头,仅含字母与数字,最长 48 字符。
74
74