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.
- package/CHANGELOG.md +22 -0
- package/README.en.md +14 -13
- package/README.md +14 -13
- package/docs/DATA.md +2 -2
- package/docs/REFERENCE.en.md +8 -8
- package/docs/REFERENCE.zh.md +8 -8
- package/docs/USAGE.en.md +12 -7
- package/docs/USAGE.md +12 -7
- package/docs/VALIDATION.md +8 -0
- package/docs/WORKBENCH.md +4 -4
- package/docs/assets/intro/workflow-en-dark.svg +1 -1
- package/docs/assets/intro/workflow-en-light.svg +1 -1
- package/docs/assets/intro/workflow-en-mobile-dark.svg +1 -1
- package/docs/assets/intro/workflow-en-mobile-light.svg +1 -1
- package/docs/assets/intro/workflow-zh-dark.svg +1 -1
- package/docs/assets/intro/workflow-zh-light.svg +1 -1
- package/docs/assets/intro/workflow-zh-mobile-dark.svg +1 -1
- package/docs/assets/intro/workflow-zh-mobile-light.svg +1 -1
- package/lib/client.js +312 -84
- package/lib/ecosystem.d.ts +73 -0
- package/lib/ecosystem.js +1352 -0
- package/lib/execution.d.ts +6 -1
- package/lib/execution.js +77 -4
- package/lib/tools.js +133 -1
- package/lib/types.d.ts +121 -1
- package/lib/workbench-language.js +4 -0
- package/lib/workbench.d.ts +2 -0
- package/lib/workbench.js +397 -10
- package/package.json +1 -1
- package/skills/dsh-ppt/SKILL.md +6 -6
- package/skills/dsh-ppt/package.json +1 -1
- package/skills/dsh-ppt/references/advanced.md +10 -5
- package/skills/dsh-ppt/references/syntax.md +1 -0
- package/skills/dsh-ppt/scripts/build-deck.mjs +53 -10
- package/skills/dsh-ppt/scripts/deck-absorb.mjs +114 -1
- package/skills/dsh-ppt/scripts/deck-advanced.mjs +153 -25
- package/skills/dsh-ppt/scripts/deck-chrome.mjs +1814 -0
- package/skills/dsh-ppt/scripts/deck-core.mjs +122 -6
- package/skills/dsh-ppt/scripts/deck-covers.mjs +804 -0
- package/skills/dsh-ppt/scripts/deck-delivery.mjs +636 -41
- package/skills/dsh-ppt/scripts/deck-diagrams.mjs +2842 -0
- package/skills/dsh-ppt/scripts/deck-director.mjs +167 -4
- package/skills/dsh-ppt/scripts/deck-icons.mjs +469 -0
- package/skills/dsh-ppt/scripts/deck-layouts.mjs +816 -5177
- package/skills/dsh-ppt/scripts/deck-media.mjs +159 -15
- package/skills/dsh-ppt/scripts/deck-mermaid.mjs +2737 -0
- package/skills/dsh-ppt/scripts/deck-office.mjs +1541 -0
- package/skills/dsh-ppt/scripts/deck-taste.mjs +347 -0
package/lib/workbench.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import { createHash, randomUUID } from 'node:crypto';
|
|
3
3
|
import { appendFileSync, existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
|
-
import { basename, dirname, join, resolve } from 'node:path';
|
|
5
|
+
import { basename, dirname, extname, join, resolve } from 'node:path';
|
|
6
6
|
import { getEngine } from './execution.js';
|
|
7
|
+
import { buildRemotionBundleFiles, computePaceBudgetFallback, renderOnePagerHtmlFallback } from './ecosystem.js';
|
|
7
8
|
import { bilingualQuality, englishWorkbenchMessage } from './workbench-language.js';
|
|
8
9
|
import { zipSync, strToU8 } from 'fflate';
|
|
9
10
|
import { PptCoaching } from './coaching.js';
|
|
@@ -21,13 +22,16 @@ const ALLOWED_LAYOUTS = new Set([
|
|
|
21
22
|
'marimekko', 'sankey', 'swot',
|
|
22
23
|
'table', 'closing', 'image', 'image-left', 'image-right', 'chart', 'chart-split',
|
|
23
24
|
'waterfall', 'gallery', 'flywheel', 'chevron', 'value-chain',
|
|
25
|
+
'mermaid', 'flowchart', 'sequence',
|
|
24
26
|
]);
|
|
25
27
|
const ALLOWED_TABLE_STYLES = new Set(['consulting', 'booktabs', 'minimal', 'banded', 'harvey']);
|
|
26
28
|
const ALLOWED_DENSITIES = new Set(['compact', 'balanced', 'airy']);
|
|
27
29
|
const ALLOWED_ITEM_STATUS = new Set(['neutral', 'accent', 'positive', 'negative', 'warning']);
|
|
28
30
|
const ALLOWED_CHROME_STYLES = new Set(['consulting-classic', 'keynote-spatial', 'editorial-folio', 'saas-bento', 'academic-minimal', 'gov-ceremonial']);
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
+
const ALLOWED_CARD_MATERIALS = new Set(['solid', 'frameless', 'glass', 'editorial-rule']);
|
|
32
|
+
const ALLOWED_ICON_MODES = new Set(['off', 'explicit', 'auto']);
|
|
33
|
+
const ITEM_KEYS = new Set(['tag', 'badge', 'title', 'text', 'body', 'value', 'unit', 'delta', 'start', 'span', 'milestone', 'role', 'conversion', 'icon', 'status', 'tone', 'bullets']);
|
|
34
|
+
const BRAND_KEYS = new Set(['name', 'primaryColor', 'secondaryColor', 'backgroundColor', 'textColor', 'fontFamily', 'headingFont', 'coverMode', 'coverBg', 'logo', 'footer', 'chromeStyle', 'cardMaterial', 'iconMode', 'taste']);
|
|
31
35
|
const VISUAL_KEYS = new Set(['titleSize', 'bodySize', 'chartLabelSize', 'density', 'tableStyle', 'chrome']);
|
|
32
36
|
/** Sharing keeps the offline deck, but omits the control for a project not in the ZIP. */
|
|
33
37
|
function shareHtml(bytes) {
|
|
@@ -293,6 +297,26 @@ function starterSlide(archetype, language) {
|
|
|
293
297
|
if (kind === 'closing') {
|
|
294
298
|
return { layout: 'closing', title: en ? 'Thank You · Next Steps' : '感谢聆听 · 下一步行动', subtitle: en ? 'Confirm pilot scope this week and review initial metrics next Friday.' : '本周内确认试点范围,下周五同步首轮评估结果。' };
|
|
295
299
|
}
|
|
300
|
+
if (kind === 'mermaid' || kind === 'flowchart') {
|
|
301
|
+
return {
|
|
302
|
+
layout: 'mermaid',
|
|
303
|
+
variant: 'flowchart',
|
|
304
|
+
title: en ? 'End-to-end automated pipeline flow' : '端到端自动化构建与流转架构',
|
|
305
|
+
mermaid: en
|
|
306
|
+
? 'flowchart LR\n A([Inputs]) --> B{Auto-Director}\n B -->|Data| C[Sankey & KPI]\n B -->|Docs| D[24+ Layouts]\n C --> E[(HTML & PPTX)]\n D --> E'
|
|
307
|
+
: 'flowchart LR\n A([多源输入]) --> B{智能导演}\n B -->|数据表| C[桑基与指标卡]\n B -->|文稿| D[24+ 版式]\n C --> E[(同源交付)]\n D --> E',
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
if (kind === 'sequence') {
|
|
311
|
+
return {
|
|
312
|
+
layout: 'mermaid',
|
|
313
|
+
variant: 'sequence',
|
|
314
|
+
title: en ? 'Agent & workbench synchronization sequence' : '智能编排与工作台协同交互时序',
|
|
315
|
+
mermaid: en
|
|
316
|
+
? 'sequenceDiagram\n participant User\n participant Studio\n participant Engine\n User->>Studio: Upload .xlsx / .docx\n Studio->>Engine: Profile & choreograph\n Engine-->>User: HTML + Native PPTX'
|
|
317
|
+
: 'sequenceDiagram\n participant 用户\n participant 工作台\n participant 引擎\n 用户->>工作台: 上传 .xlsx / .docx\n 工作台->>引擎: 智能剖析与编排\n 引擎-->>用户: HTML + 原生 PPTX',
|
|
318
|
+
};
|
|
319
|
+
}
|
|
296
320
|
return {
|
|
297
321
|
layout: 'bullets',
|
|
298
322
|
title: en ? 'New slide key takeaway' : '请填写本页核心结论句',
|
|
@@ -420,8 +444,33 @@ export class PptWorkbench {
|
|
|
420
444
|
const langCode = manifest.language === 'en' ? 'en' : 'zh';
|
|
421
445
|
const themes = typeof engine.listThemes === 'function' ? engine.listThemes(langCode) : [];
|
|
422
446
|
const presets = typeof engine.listMasterPresets === 'function' ? engine.listMasterPresets(langCode) : [];
|
|
447
|
+
const tasteRecipes = typeof engine.listAllTasteRecipes === 'function' ? engine.listAllTasteRecipes(dirname(entry.path)) : [];
|
|
448
|
+
const rawPace = typeof engine.computePaceBudget === 'function'
|
|
449
|
+
? engine.computePaceBudget(manifest, manifest.targetMinutes)
|
|
450
|
+
: computePaceBudgetFallback(manifest, manifest.targetMinutes);
|
|
451
|
+
const overrunSlides = Array.isArray(rawPace?.overrunSlides)
|
|
452
|
+
? rawPace.overrunSlides
|
|
453
|
+
: Array.isArray(rawPace?.overBudgetSlides)
|
|
454
|
+
? rawPace.overBudgetSlides
|
|
455
|
+
: [];
|
|
456
|
+
const overBudget = typeof rawPace?.overBudget === 'boolean'
|
|
457
|
+
? rawPace.overBudget
|
|
458
|
+
: rawPace?.status === 'over-budget' || overrunSlides.length > 0;
|
|
459
|
+
const deltaMinutes = typeof rawPace?.deltaMinutes === 'number'
|
|
460
|
+
? rawPace.deltaMinutes
|
|
461
|
+
: typeof rawPace?.deltaSeconds === 'number'
|
|
462
|
+
? Math.round((rawPace.deltaSeconds / 60) * 10) / 10
|
|
463
|
+
: 0;
|
|
464
|
+
const paceBudget = {
|
|
465
|
+
...rawPace,
|
|
466
|
+
slideCount: typeof rawPace?.slideCount === 'number' ? rawPace.slideCount : (Array.isArray(manifest.slides) ? manifest.slides.length : 0),
|
|
467
|
+
overBudget,
|
|
468
|
+
overrunSlides,
|
|
469
|
+
deltaMinutes,
|
|
470
|
+
};
|
|
423
471
|
return { ok: true, project: { ...entry, deckId: manifest.deckId, revision: manifest.revision, theme: manifest.theme ?? 'data',
|
|
424
|
-
|
|
472
|
+
taste: manifest.taste ?? null,
|
|
473
|
+
brand: manifest.brand ?? null, targetMinutes: manifest.targetMinutes ?? null, paceBudget, themes, presets, tasteRecipes, slides: manifest.slides,
|
|
425
474
|
undoAvailable: manifest.history.length, quality: check, html, dataModel: manifest.dataModel ?? null,
|
|
426
475
|
assets: Object.fromEntries(Object.entries(manifest.assets ?? {}).map(([key, value]) => [key, { data: value.data, mime: value.mime }])),
|
|
427
476
|
render: currentRender ? { pageCount: currentRender.pngPaths.length, missingFonts: currentRender.missingFonts ?? [] } : null } };
|
|
@@ -489,6 +538,33 @@ export class PptWorkbench {
|
|
|
489
538
|
throw new Error('母版骨架名称无效 / Invalid chrome skeleton style');
|
|
490
539
|
out.chromeStyle = item;
|
|
491
540
|
}
|
|
541
|
+
else if (key === 'cardMaterial') {
|
|
542
|
+
if (item === null || item === '') {
|
|
543
|
+
out.cardMaterial = null;
|
|
544
|
+
continue;
|
|
545
|
+
}
|
|
546
|
+
if (typeof item !== 'string' || !ALLOWED_CARD_MATERIALS.has(item))
|
|
547
|
+
throw new Error('卡片材质名称无效 / Invalid cardMaterial');
|
|
548
|
+
out.cardMaterial = item;
|
|
549
|
+
}
|
|
550
|
+
else if (key === 'iconMode') {
|
|
551
|
+
if (item === null || item === '') {
|
|
552
|
+
out.iconMode = null;
|
|
553
|
+
continue;
|
|
554
|
+
}
|
|
555
|
+
if (typeof item !== 'string' || !ALLOWED_ICON_MODES.has(item))
|
|
556
|
+
throw new Error('图标模式无效 / Invalid iconMode');
|
|
557
|
+
out.iconMode = item;
|
|
558
|
+
}
|
|
559
|
+
else if (key === 'taste') {
|
|
560
|
+
if (item === null || item === '') {
|
|
561
|
+
out.taste = null;
|
|
562
|
+
continue;
|
|
563
|
+
}
|
|
564
|
+
if (typeof item !== 'string' || item.length > 64)
|
|
565
|
+
throw new Error('品味配方 ID 无效');
|
|
566
|
+
out.taste = item.trim();
|
|
567
|
+
}
|
|
492
568
|
}
|
|
493
569
|
return out;
|
|
494
570
|
}
|
|
@@ -550,6 +626,7 @@ export class PptWorkbench {
|
|
|
550
626
|
const milestone = raw.milestone;
|
|
551
627
|
const role = raw.role;
|
|
552
628
|
const conversion = raw.conversion;
|
|
629
|
+
const icon = raw.icon;
|
|
553
630
|
if (start !== undefined && (typeof start !== 'number' || !Number.isFinite(start) || start < 0 || start > 999))
|
|
554
631
|
throw new Error('结构化卡片内容无效');
|
|
555
632
|
if (span !== undefined && (typeof span !== 'number' || !Number.isFinite(span) || span < 0 || span > 999))
|
|
@@ -560,6 +637,8 @@ export class PptWorkbench {
|
|
|
560
637
|
throw new Error('结构化卡片内容无效');
|
|
561
638
|
if (conversion !== undefined && (typeof conversion !== 'string' || conversion.length > 120))
|
|
562
639
|
throw new Error('结构化卡片内容无效');
|
|
640
|
+
if (icon !== undefined && (typeof icon !== 'string' || icon.length > 48))
|
|
641
|
+
throw new Error('结构化卡片内容无效');
|
|
563
642
|
if (typeof start === 'number')
|
|
564
643
|
clean.start = start;
|
|
565
644
|
if (typeof span === 'number')
|
|
@@ -570,6 +649,8 @@ export class PptWorkbench {
|
|
|
570
649
|
clean.role = role.trim();
|
|
571
650
|
if (typeof conversion === 'string' && conversion.trim())
|
|
572
651
|
clean.conversion = conversion.trim();
|
|
652
|
+
if (typeof icon === 'string' && icon.trim())
|
|
653
|
+
clean.icon = icon.trim();
|
|
573
654
|
return clean;
|
|
574
655
|
});
|
|
575
656
|
}
|
|
@@ -586,6 +667,11 @@ export class PptWorkbench {
|
|
|
586
667
|
throw new Error('文字字段过长或无效');
|
|
587
668
|
result[key] = item;
|
|
588
669
|
}
|
|
670
|
+
else if (key === 'mermaid') {
|
|
671
|
+
if (typeof item !== 'string' || item.length > 16000)
|
|
672
|
+
throw new Error('Mermaid 代码无效或超过 16,000 字符');
|
|
673
|
+
result.mermaid = item;
|
|
674
|
+
}
|
|
589
675
|
else if (key === 'bullets') {
|
|
590
676
|
if (!Array.isArray(item) || item.length > 50 || item.some(v => typeof v !== 'string' || v.length > 2000))
|
|
591
677
|
throw new Error('要点内容无效');
|
|
@@ -606,6 +692,16 @@ export class PptWorkbench {
|
|
|
606
692
|
throw new Error('母版骨架名称无效 / Invalid chrome skeleton style');
|
|
607
693
|
result.chrome = item ? item : undefined;
|
|
608
694
|
}
|
|
695
|
+
else if (key === 'cardMaterial') {
|
|
696
|
+
if (item !== null && item !== '' && (typeof item !== 'string' || !ALLOWED_CARD_MATERIALS.has(item)))
|
|
697
|
+
throw new Error('卡片材质名称无效 / Invalid cardMaterial');
|
|
698
|
+
result.cardMaterial = item ? item : undefined;
|
|
699
|
+
}
|
|
700
|
+
else if (key === 'iconMode') {
|
|
701
|
+
if (item !== null && item !== '' && (typeof item !== 'string' || !ALLOWED_ICON_MODES.has(item)))
|
|
702
|
+
throw new Error('图标模式无效 / Invalid iconMode');
|
|
703
|
+
result.iconMode = item ? item : undefined;
|
|
704
|
+
}
|
|
609
705
|
else if (key === 'tableStyle') {
|
|
610
706
|
if (item !== null && item !== '' && (typeof item !== 'string' || !ALLOWED_TABLE_STYLES.has(item)))
|
|
611
707
|
throw new Error('表格样式无效');
|
|
@@ -698,6 +794,144 @@ export class PptWorkbench {
|
|
|
698
794
|
}
|
|
699
795
|
return new Uint8Array(bytes);
|
|
700
796
|
}
|
|
797
|
+
officeBytes(raw, fileName) {
|
|
798
|
+
const name = typeof fileName === 'string' ? fileName.trim() : '';
|
|
799
|
+
const match = /\.(xlsx|csv|tsv|docx)$/i.exec(name);
|
|
800
|
+
if (!match || typeof raw !== 'string' || raw.length < 4) {
|
|
801
|
+
throw new Error('请选择 24 MiB 以内的 .xlsx、.csv、.tsv 或 .docx 文件');
|
|
802
|
+
}
|
|
803
|
+
const ext = '.' + match[1].toLowerCase();
|
|
804
|
+
const clean = raw.replace(/^data:[^;,]+(?:;[^;,]+)*;base64,/, '').replace(/\s+/g, '');
|
|
805
|
+
if (!clean || clean.length > 34_000_000 || clean.length % 4 === 1 || !/^[A-Za-z0-9+/]+={0,2}$/.test(clean)) {
|
|
806
|
+
throw new Error('请选择 24 MiB 以内的 .xlsx、.csv、.tsv 或 .docx 文件');
|
|
807
|
+
}
|
|
808
|
+
const bytes = Buffer.from(clean, 'base64');
|
|
809
|
+
if (bytes.byteLength === 0 || bytes.byteLength > ABSORB_PPTX_LIMIT) {
|
|
810
|
+
throw new Error('请选择 24 MiB 以内的 .xlsx、.csv、.tsv 或 .docx 文件');
|
|
811
|
+
}
|
|
812
|
+
if ((ext === '.xlsx' || ext === '.docx') && (bytes.byteLength < 100 || bytes[0] !== 0x50 || bytes[1] !== 0x4b)) {
|
|
813
|
+
throw new Error('请选择 24 MiB 以内的 .xlsx、.csv、.tsv 或 .docx 文件');
|
|
814
|
+
}
|
|
815
|
+
return { bytes: new Uint8Array(bytes), ext };
|
|
816
|
+
}
|
|
817
|
+
flagshipDemoSlides(lang, includeMermaid) {
|
|
818
|
+
const en = lang === 'en';
|
|
819
|
+
const slides = [
|
|
820
|
+
{
|
|
821
|
+
layout: 'cover',
|
|
822
|
+
kicker: en ? 'FLAGSHIP SHOWCASE · 0.25' : '旗舰功能全景示例 · 0.25',
|
|
823
|
+
title: en ? 'Enterprise AI Delivery & Financial Telemetry' : '企业级智能交付平台:效能跃迁与经营全景',
|
|
824
|
+
subtitle: en ? 'Native PPTX + Interactive HTML + Verified Data & Diagrams' : '同源构建可编辑 PPTX · 交互放映 · 原生公式与专业图示',
|
|
825
|
+
notes: en
|
|
826
|
+
? 'Welcome everyone. In the next eight minutes we will walk through our flagship delivery telemetry, system architecture, quarterly roadmap, and capital efficiency.'
|
|
827
|
+
: '各位领导同事好,接下来用八分钟为大家汇报本季度企业级智能交付平台的核心成效、系统架构、路线图与资金流向全景。',
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
layout: 'kpi',
|
|
831
|
+
variant: 'grid',
|
|
832
|
+
kicker: 'EXECUTIVE SUMMARY',
|
|
833
|
+
title: en ? 'Headline metrics surpassed annual targets ahead of schedule' : '三大核心指标提前达成全年基准并实现正向复利',
|
|
834
|
+
items: [
|
|
835
|
+
{ tag: 'ARR', value: '1.85', unit: en ? 'B' : '亿', delta: en ? '+42% YoY' : '同比 +42%', title: en ? 'Annual Recurring Revenue' : '年度经常性收入', status: 'positive' },
|
|
836
|
+
{ tag: 'NRR', value: '118%', delta: en ? '+6 pts' : '提升 6 pct', title: en ? 'Net Dollar Retention' : '核心客户净收入留存', status: 'accent' },
|
|
837
|
+
{ tag: 'CYCLE', value: '5', unit: en ? 'days' : '天', delta: en ? '-64% lead time' : '交付周期缩短 64%', title: en ? 'End-to-End Delivery' : '端到端平均交付周期', status: 'positive' },
|
|
838
|
+
],
|
|
839
|
+
takeaway: en ? 'Platform standardization drove 42% revenue expansion while cutting deployment lead time by 64%.' : '标准化工程底座驱动营收同比增长 42%,同时将客户上线周期从 14 天压缩至 5 天。',
|
|
840
|
+
source: en ? 'Source: Q4 Audited Financial & Ops Ledger' : '数据来源:Q4 经核验财务与交付运营台账',
|
|
841
|
+
notes: en ? 'First, look at our headline KPIs: ARR reached 1.85 billion with 42 percent year-over-year growth and 118 percent net retention.' : '首先看核心经营指标:年度经常性收入突破 1.85 亿,同比增长 42%,净收入留存达 118%。',
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
layout: 'architecture',
|
|
845
|
+
variant: 'layered',
|
|
846
|
+
kicker: 'SYSTEM ARCHITECTURE',
|
|
847
|
+
title: en ? 'Three-tier deterministic engine guarantees zero-drift multi-format output' : '三层确定性构建架构保障多端同源交付零漂移',
|
|
848
|
+
items: [
|
|
849
|
+
{ tag: en ? 'Experience' : '交互与工作台', title: en ? 'Studio & Presenter Console' : '工作台预览与双屏提词台', bullets: en ? ['Click-to-focus editing', 'Dual-screen P / Laser L'] : ['点击画布直达编辑', 'P 键双屏提词 / L 激光笔'] },
|
|
850
|
+
{ tag: en ? 'Orchestration' : '智能编排层', title: en ? 'Director, Mermaid & Office Bridge' : '导演引擎 · Office 直吞 · 文献桥接', bullets: en ? ['XLSX/DOCX profiling', 'dsh-cite & Remotion'] : ['Excel/Word 自动成稿', 'dsh-cite 文献与视频分镜'] },
|
|
851
|
+
{ tag: en ? 'Foundation' : '原生底层', title: en ? 'Dual-Target OOXML & HTML Compiler' : 'OOXML 原生图形与离线 HTML 编译器', bullets: en ? ['Native <m:oMath> & charts', 'WCAG >= 4.5:1 guard'] : ['原生公式与可编辑图表', 'WCAG >= 4.5:1 对比度门禁'] },
|
|
852
|
+
{ tag: en ? 'Cross-cutting' : '安全合规', title: en ? 'Zero-Exfiltration & Atomic Undo' : '离线安全沙箱与 20 步原子撤销', status: 'accent', bullets: en ? ['Zero external network', 'Revision-guarded store'] : ['零外链纯净交付', '修订号防并发覆盖'] },
|
|
853
|
+
],
|
|
854
|
+
notes: en ? 'Our architecture separates experience, orchestration, and deterministic OOXML emission so edits stay synchronized across HTML and PowerPoint.' : '系统采用交互层、编排层与原生编译器三层解耦设计,任何微调均可原子级同步至 HTML 与 PPTX。',
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
layout: 'gantt',
|
|
858
|
+
variant: 'quarters',
|
|
859
|
+
kicker: 'DELIVERY ROADMAP',
|
|
860
|
+
title: en ? 'Four-quarter rollout moves from core engine to full ecosystem' : '全年四季度路线图:从底层双模引擎迈向全生态闭环',
|
|
861
|
+
columns: ['Q1', 'Q2', 'Q3', 'Q4'],
|
|
862
|
+
items: [
|
|
863
|
+
{ tag: en ? 'Core' : '核心底座', title: en ? 'Native charts & 24 curated themes' : '原生可编辑图表与 24 套大师主题', start: 0, span: 1.5, status: 'accent' },
|
|
864
|
+
{ tag: en ? 'Import' : '文档翻新', title: en ? 'Round-trip .pptx & Excel/Word ingestion' : 'PPTX 双向导回与 Excel/Word 直吞', start: 1, span: 1.5, status: 'positive' },
|
|
865
|
+
{ tag: en ? 'Ecosystem' : '生态协同', title: en ? 'dsh-cite bibliography & Remotion video pack' : 'dsh-cite 学术文献与 Remotion 视频分镜', start: 2, span: 1.5, status: 'accent' },
|
|
866
|
+
{ tag: en ? 'GA' : '全量验收', title: en ? 'v0.25 Enterprise Flagship Release' : 'v0.25 旗舰版全面验收发布', start: 3, span: 0, milestone: true, status: 'warning' },
|
|
867
|
+
],
|
|
868
|
+
notes: en ? 'On the timeline, Q1 and Q2 established native charts and Office ingestion, while Q3 and Q4 completed ecosystem bridges.' : '从推进节奏看,上半年夯实了原生图表与文档解析能力,下半年打通了文献与视频分镜全生态。',
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
layout: 'sankey',
|
|
872
|
+
kicker: 'CAPITAL FLOW',
|
|
873
|
+
title: en ? 'Revenue-to-operating-income flow shows 34.5% operating leverage' : '总营收至营业利润全链路流向拆解展现 34.5% 经营杠杆',
|
|
874
|
+
items: en
|
|
875
|
+
? [
|
|
876
|
+
{ tag: 'Total Revenue', title: 'Gross Profit', value: '68.5', unit: 'M', status: 'positive' },
|
|
877
|
+
{ tag: 'Total Revenue', title: 'Cost of Revenue', value: '31.5', unit: 'M', status: 'neutral' },
|
|
878
|
+
{ tag: 'Gross Profit', title: 'R&D Investment', value: '22.0', unit: 'M', status: 'accent' },
|
|
879
|
+
{ tag: 'Gross Profit', title: 'Sales & Ops', value: '12.0', unit: 'M', status: 'warning' },
|
|
880
|
+
{ tag: 'Gross Profit', title: 'Operating Income', value: '34.5', unit: 'M', status: 'positive' },
|
|
881
|
+
]
|
|
882
|
+
: [
|
|
883
|
+
{ tag: '总营收', title: '毛利润', value: '68.5', unit: '百万', status: 'positive' },
|
|
884
|
+
{ tag: '总营收', title: '交付成本', value: '31.5', unit: '百万', status: 'neutral' },
|
|
885
|
+
{ tag: '毛利润', title: '研发投入', value: '22.0', unit: '百万', status: 'accent' },
|
|
886
|
+
{ tag: '毛利润', title: '市场与运营', value: '12.0', unit: '百万', status: 'warning' },
|
|
887
|
+
{ tag: '毛利润', title: '营业利润', value: '34.5', unit: '百万', status: 'positive' },
|
|
888
|
+
],
|
|
889
|
+
takeaway: en ? 'Strong gross margin (68.5%) funds sustained R&D while yielding 34.5% operating profit.' : '68.5% 的高毛利空间支撑了 22% 的研发强度,并沉淀出 34.5% 的健康营业利润。',
|
|
890
|
+
notes: en ? 'This Sankey diagram traces every dollar from top-line revenue through gross profit into R&D, operations, and operating income.' : '这张桑基图清晰展示了从总营收扣除交付成本后,毛利润在研发、运营与营业利润之间的精确分配。',
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
layout: 'marimekko',
|
|
894
|
+
kicker: 'MARKET LANDSCAPE',
|
|
895
|
+
title: en ? 'Segment sizing & share show leadership across high-value verticals' : '细分市场规模与份额矩阵凸显高价值赛道领先身位',
|
|
896
|
+
rows: en
|
|
897
|
+
? [['Vendor / Segment', 'Enterprise (45B)', 'Financial (32B)', 'Industrial (23B)'], ['Flagship', '44%', '38%', '31%'], ['Vendor B', '32%', '36%', '34%'], ['Others', '24%', '26%', '35%']]
|
|
898
|
+
: [['厂商 / 赛道', '政企数字化 (450亿)', '金融信创 (320亿)', '工业智造 (230亿)'], ['本平台', '44%', '38%', '31%'], ['厂商 B', '32%', '36%', '34%'], ['其他', '24%', '26%', '35%']],
|
|
899
|
+
notes: en ? 'Across the three major verticals sized proportionally by column width, we lead in both Enterprise and Financial sectors.' : '不等宽市场图按各赛道体量比例切分列宽,我们在政企数字化与金融信创两大核心市场份额稳居第一。',
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
layout: 'callout',
|
|
903
|
+
variant: 'formula',
|
|
904
|
+
kicker: 'QUANTITATIVE OBJECTIVE',
|
|
905
|
+
title: en ? 'Regularized scoring objective balances accuracy and visual sparsity' : '量化目标函数:以原生 Office 公式精确表达准确率与稀疏正则项',
|
|
906
|
+
formula: '\\mathcal{L}(\\theta) = \\frac{1}{N}\\sum_{i=1}^{N} \\left(y_i - \\hat{y}_i(\\theta)\\right)^2 + \\lambda \\|\\theta\\|_2^2',
|
|
907
|
+
text: en
|
|
908
|
+
? 'Compiled into native PowerPoint Office Math (OMML) equations and HTML MathML — directly editable in Word/PowerPoint equation tools.'
|
|
909
|
+
: '同时编译为 PowerPoint 原生 Office Math (OMML) 公式对象与 HTML MathML,在 Office 公式编辑器中可直接双击修改。',
|
|
910
|
+
notes: en ? 'Notice the equation is rendered natively as Office Math rather than a static bitmap.' : '页面中的公式为原生 Office Math 对象,而非静态截图,导出后可无损放大与二次编辑。',
|
|
911
|
+
},
|
|
912
|
+
];
|
|
913
|
+
if (includeMermaid) {
|
|
914
|
+
slides.push({
|
|
915
|
+
layout: 'mermaid',
|
|
916
|
+
variant: 'flowchart',
|
|
917
|
+
kicker: 'NATIVE MERMAID FLOW',
|
|
918
|
+
title: en ? 'Mermaid diagram compiles into editable PowerPoint shapes & connectors' : 'Mermaid 流程图直接编译为可拖拽连接的原生 PPT 矢量形状',
|
|
919
|
+
mermaid: en
|
|
920
|
+
? 'flowchart LR\n A([Raw Sources]) --> B{Auto-Director}\n B -->|Excel / CSV| C[Charts & Sankey]\n B -->|Markdown / DOCX| D[24+ Layouts]\n C --> E[(Editable PPTX)]\n D --> E'
|
|
921
|
+
: 'flowchart LR\n A([多源材料输入]) --> B{智能导演引擎}\n B -->|Excel / CSV| C[桑基与原生图表]\n B -->|Word / 大纲| D[24+ 专业版式]\n C --> E[(原生可编辑 PPTX)]\n D --> E',
|
|
922
|
+
takeaway: en ? 'Moving any node box in PowerPoint automatically keeps attached <p:cxnSp> connectors linked.' : '在 PowerPoint 中拖动任意节点方框,相连的矢量连接线会自动跟随联动。',
|
|
923
|
+
notes: en ? 'This flowchart is generated directly from Mermaid syntax into native PowerPoint shapes and attached connectors.' : '该流程图由 Mermaid 语法直接编译为原生 PPT 形状与绑定连接器,非静态贴图。',
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
slides.push({
|
|
927
|
+
layout: 'closing',
|
|
928
|
+
kicker: 'NEXT STEPS',
|
|
929
|
+
title: en ? 'Ready to customize, export One-Pager, or render Video Storyboard' : '即刻体验:编辑本页、导出高管一页纸或生成 Remotion 视频分镜',
|
|
930
|
+
subtitle: en ? 'Try clicking any text on the canvas, switching themes in Style Studio, or pressing P in standalone HTML.' : '点击左侧画布文字即可定位修改,也可前往“风格与母版”一键换肤,或点击“下载成品”导出多种交付物。',
|
|
931
|
+
notes: en ? 'Thank you! Feel free to explore editing, Style Studio, One-Pager HTML, and Remotion video export.' : '感谢体验旗舰示例工程!欢迎继续试用页面编辑、换肤、高管一页纸与 Remotion 视频导出。',
|
|
932
|
+
});
|
|
933
|
+
return slides;
|
|
934
|
+
}
|
|
701
935
|
async action(body, signal) {
|
|
702
936
|
signal?.throwIfAborted();
|
|
703
937
|
if (body.operation === 'list')
|
|
@@ -710,6 +944,7 @@ export class PptWorkbench {
|
|
|
710
944
|
ok: true,
|
|
711
945
|
themes: typeof engine.listThemes === 'function' ? engine.listThemes(langCode) : [],
|
|
712
946
|
presets: typeof engine.listMasterPresets === 'function' ? engine.listMasterPresets(langCode) : [],
|
|
947
|
+
tasteRecipes: typeof engine.listAllTasteRecipes === 'function' ? engine.listAllTasteRecipes(dirname(this.catalogPath)) : [],
|
|
713
948
|
templates: typeof engine.listTemplates === 'function' ? engine.listTemplates(langCode) : [],
|
|
714
949
|
};
|
|
715
950
|
}
|
|
@@ -792,6 +1027,85 @@ export class PptWorkbench {
|
|
|
792
1027
|
rmSync(tmpRefPath, { force: true });
|
|
793
1028
|
}
|
|
794
1029
|
}
|
|
1030
|
+
if (body.operation === 'create-demo') {
|
|
1031
|
+
if (['referencePptx', 'pptxPath', 'path', 'outputDir', 'filePath'].some(k => Object.hasOwn(body, k))) {
|
|
1032
|
+
throw new Error('图片必须从面板上传,不能读取其他本地文件');
|
|
1033
|
+
}
|
|
1034
|
+
const lang = body.lang === 'en' || body.lang === 'bilingual' ? body.lang : 'zh';
|
|
1035
|
+
const theme = typeof body.theme === 'string' && body.theme.trim() ? this.themeId(body.theme) : 'consulting';
|
|
1036
|
+
const engine = await this.loadEngine();
|
|
1037
|
+
signal?.throwIfAborted();
|
|
1038
|
+
const decksDir = join(dirname(this.catalogPath), 'workbench-decks');
|
|
1039
|
+
mkdirSync(decksDir, { recursive: true });
|
|
1040
|
+
const hasMermaidModule = existsSync(new URL('../skills/dsh-ppt/scripts/deck-mermaid.mjs', import.meta.url));
|
|
1041
|
+
const demoSlides = this.flagshipDemoSlides(lang, hasMermaidModule);
|
|
1042
|
+
const demoTitle = lang === 'en' ? 'DSH-PPT Flagship Showcase Deck' : 'DSH-PPT 旗舰能力全景示例';
|
|
1043
|
+
const created = await (engine.buildDeckAsync ?? engine.buildDeck)({
|
|
1044
|
+
title: demoTitle,
|
|
1045
|
+
slides: demoSlides,
|
|
1046
|
+
theme,
|
|
1047
|
+
lang,
|
|
1048
|
+
targetMinutes: 8,
|
|
1049
|
+
outputDir: decksDir,
|
|
1050
|
+
cwd: decksDir,
|
|
1051
|
+
signal,
|
|
1052
|
+
});
|
|
1053
|
+
await this.remember(created, {});
|
|
1054
|
+
return { ...await this.view(digest(created.jsonPath)), created: true, demo: true };
|
|
1055
|
+
}
|
|
1056
|
+
if (body.operation === 'import-office') {
|
|
1057
|
+
if (['filePath', 'pptxPath', 'path', 'outputDir', 'targetProjectDir', 'referencePptx'].some(k => Object.hasOwn(body, k))) {
|
|
1058
|
+
throw new Error('图片必须从面板上传,不能读取其他本地文件');
|
|
1059
|
+
}
|
|
1060
|
+
const { bytes, ext } = this.officeBytes(body.data, body.fileName);
|
|
1061
|
+
const engine = await this.loadEngine();
|
|
1062
|
+
signal?.throwIfAborted();
|
|
1063
|
+
if (typeof engine.importOfficeDeck !== 'function') {
|
|
1064
|
+
throw new Error('当前引擎版本暂不支持导入 Excel / Word 文档');
|
|
1065
|
+
}
|
|
1066
|
+
const theme = typeof body.theme === 'string' && body.theme.trim() ? (body.theme.trim() === 'auto' ? 'auto' : this.themeId(body.theme)) : 'auto';
|
|
1067
|
+
const lang = body.lang === 'en' || body.lang === 'bilingual' ? body.lang : 'zh';
|
|
1068
|
+
let chromeStyle;
|
|
1069
|
+
if (body.chromeStyle !== undefined && body.chromeStyle !== null && body.chromeStyle !== '') {
|
|
1070
|
+
if (typeof body.chromeStyle !== 'string' || !ALLOWED_CHROME_STYLES.has(body.chromeStyle)) {
|
|
1071
|
+
throw new Error('母版骨架名称无效 / Invalid chrome skeleton style');
|
|
1072
|
+
}
|
|
1073
|
+
chromeStyle = body.chromeStyle;
|
|
1074
|
+
}
|
|
1075
|
+
let targetMinutes;
|
|
1076
|
+
if (body.targetMinutes !== undefined && body.targetMinutes !== null && body.targetMinutes !== '') {
|
|
1077
|
+
const mins = Number(body.targetMinutes);
|
|
1078
|
+
if (!Number.isFinite(mins) || mins < 1 || mins > 240)
|
|
1079
|
+
throw new Error('目标演讲时长需为 1–240 分钟的数字');
|
|
1080
|
+
targetMinutes = mins;
|
|
1081
|
+
}
|
|
1082
|
+
const decksDir = join(dirname(this.catalogPath), 'workbench-decks');
|
|
1083
|
+
mkdirSync(decksDir, { recursive: true });
|
|
1084
|
+
const tmpOfficePath = join(decksDir, '.office-' + randomUUID() + ext);
|
|
1085
|
+
writeFileSync(tmpOfficePath, bytes);
|
|
1086
|
+
try {
|
|
1087
|
+
const cleanBase = typeof body.fileName === 'string'
|
|
1088
|
+
? basename(body.fileName.trim(), extname(body.fileName.trim())).replace(/[^\p{L}\p{N}._-]+/gu, '-').replace(/^-+|-+$/g, '').slice(0, 80)
|
|
1089
|
+
: '';
|
|
1090
|
+
const imported = await engine.importOfficeDeck({
|
|
1091
|
+
filePath: tmpOfficePath,
|
|
1092
|
+
cwd: decksDir,
|
|
1093
|
+
outDir: decksDir,
|
|
1094
|
+
outputDir: decksDir,
|
|
1095
|
+
...(cleanBase ? { fileName: cleanBase } : {}),
|
|
1096
|
+
theme,
|
|
1097
|
+
lang,
|
|
1098
|
+
...(chromeStyle ? { chromeStyle } : {}),
|
|
1099
|
+
...(targetMinutes !== undefined ? { targetMinutes } : {}),
|
|
1100
|
+
signal,
|
|
1101
|
+
});
|
|
1102
|
+
await this.remember(imported, {});
|
|
1103
|
+
return { ...await this.view(digest(imported.jsonPath)), imported: true, created: true };
|
|
1104
|
+
}
|
|
1105
|
+
finally {
|
|
1106
|
+
rmSync(tmpOfficePath, { force: true });
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
795
1109
|
if (body.operation === 'import-pptx') {
|
|
796
1110
|
if (['pptxPath', 'path', 'outputDir', 'targetProjectDir', 'referencePptx'].some(k => Object.hasOwn(body, k))) {
|
|
797
1111
|
throw new Error('图片必须从面板上传,不能读取其他本地文件');
|
|
@@ -913,6 +1227,7 @@ export class PptWorkbench {
|
|
|
913
1227
|
recommendedChrome: absorbed?.recommendedChrome ?? null,
|
|
914
1228
|
recommendedTableStyle: absorbed?.recommendedTableStyle ?? null,
|
|
915
1229
|
narrativeProfile: absorbed?.narrativeProfile ?? null,
|
|
1230
|
+
styleRecipe: absorbed?.styleRecipe ?? null,
|
|
916
1231
|
warnings: absorbed?.warnings ?? [],
|
|
917
1232
|
slideSkeleton: absorbed?.slideSkeleton ?? null,
|
|
918
1233
|
layoutSummary: absorbed?.layoutSummary ?? null,
|
|
@@ -920,7 +1235,7 @@ export class PptWorkbench {
|
|
|
920
1235
|
};
|
|
921
1236
|
}
|
|
922
1237
|
if (body.operation === 'download') {
|
|
923
|
-
if (!['html', 'pptx', 'json', 'handout'].includes(String(body.kind)))
|
|
1238
|
+
if (!['html', 'pptx', 'json', 'handout', 'onepager', 'remotion'].includes(String(body.kind)))
|
|
924
1239
|
throw new Error('不支持此文件类型');
|
|
925
1240
|
if (body.kind === 'handout') {
|
|
926
1241
|
const handoutPath = files.json.slice(0, -5) + '.handout.md';
|
|
@@ -929,6 +1244,27 @@ export class PptWorkbench {
|
|
|
929
1244
|
const md = typeof engine.renderHandoutMarkdown === 'function' ? engine.renderHandoutMarkdown(manifest, manifest.language) : speakerNotes(manifest);
|
|
930
1245
|
return { ok: true, name: basename(entry.path, '.json') + '.handout.md', data: Buffer.from(md, 'utf8').toString('base64') };
|
|
931
1246
|
}
|
|
1247
|
+
if (body.kind === 'onepager') {
|
|
1248
|
+
const html = typeof engine.renderOnePagerHtml === 'function'
|
|
1249
|
+
? engine.renderOnePagerHtml(manifest, manifest.language)
|
|
1250
|
+
: renderOnePagerHtmlFallback(manifest, manifest.language);
|
|
1251
|
+
return { ok: true, name: basename(entry.path, '.json') + '-onepager.html', data: Buffer.from(html, 'utf8').toString('base64') };
|
|
1252
|
+
}
|
|
1253
|
+
if (body.kind === 'remotion') {
|
|
1254
|
+
const themeObj = typeof engine.resolveTheme === 'function' ? engine.resolveTheme(manifest.theme) : undefined;
|
|
1255
|
+
const pace = typeof engine.computePaceBudget === 'function'
|
|
1256
|
+
? engine.computePaceBudget(manifest, manifest.targetMinutes)
|
|
1257
|
+
: computePaceBudgetFallback(manifest, manifest.targetMinutes);
|
|
1258
|
+
const bundle = buildRemotionBundleFiles(manifest, {
|
|
1259
|
+
fps: 30,
|
|
1260
|
+
format: 'landscape',
|
|
1261
|
+
themeTokens: (themeObj?.palette ?? {}),
|
|
1262
|
+
paceBudget: pace,
|
|
1263
|
+
});
|
|
1264
|
+
const zipEntries = Object.fromEntries(Object.entries(bundle.files).map(([k, v]) => [k, strToU8(v)]));
|
|
1265
|
+
const zipped = zipSync(zipEntries, { level: 0 });
|
|
1266
|
+
return { ok: true, name: basename(entry.path, '.json') + '-remotion.zip', data: Buffer.from(zipped).toString('base64') };
|
|
1267
|
+
}
|
|
932
1268
|
const path = files[body.kind];
|
|
933
1269
|
return { ok: true, name: basename(path), data: ordinaryFile(path).toString('base64') };
|
|
934
1270
|
}
|
|
@@ -1001,12 +1337,41 @@ export class PptWorkbench {
|
|
|
1001
1337
|
throw new Error('页面不存在');
|
|
1002
1338
|
if (Object.hasOwn(body, 'referencePptx'))
|
|
1003
1339
|
throw new Error('图片必须从面板上传,不能读取其他本地文件');
|
|
1340
|
+
let targetMinutesPatch = {};
|
|
1341
|
+
if (body.targetMinutes !== undefined) {
|
|
1342
|
+
if (body.targetMinutes === null || body.targetMinutes === '') {
|
|
1343
|
+
targetMinutesPatch = { targetMinutes: null };
|
|
1344
|
+
}
|
|
1345
|
+
else {
|
|
1346
|
+
const mins = Number(body.targetMinutes);
|
|
1347
|
+
if (!Number.isFinite(mins) || mins < 1 || mins > 240)
|
|
1348
|
+
throw new Error('目标演讲时长需为 1–240 分钟的数字');
|
|
1349
|
+
targetMinutesPatch = { targetMinutes: mins };
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
let tastePatch = {};
|
|
1353
|
+
if (body.taste !== undefined) {
|
|
1354
|
+
if (body.taste === null || body.taste === '') {
|
|
1355
|
+
tastePatch = { taste: null };
|
|
1356
|
+
}
|
|
1357
|
+
else if (typeof body.taste === 'string' && /^[a-z0-9\u4e00-\u9fff-]{1,64}$/i.test(body.taste.trim())) {
|
|
1358
|
+
tastePatch = { taste: body.taste.trim() };
|
|
1359
|
+
}
|
|
1360
|
+
else if (body.taste && typeof body.taste === 'object' && !Array.isArray(body.taste)) {
|
|
1361
|
+
tastePatch = { taste: body.taste };
|
|
1362
|
+
}
|
|
1363
|
+
else {
|
|
1364
|
+
throw new Error('品味配方参数无效');
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1004
1367
|
const args = { deckPath: entry.path, expectedRevision: body.expectedRevision, signal,
|
|
1005
1368
|
saveAs: body.saveAs === true,
|
|
1006
1369
|
...(body.slide === undefined ? {} : { edits: [{ slide: body.slide, patch: this.patch(body.patch) }] }),
|
|
1007
1370
|
...(body.order === undefined ? {} : { order: body.order }),
|
|
1008
1371
|
...(body.theme === undefined ? {} : { theme: this.themeId(body.theme) }),
|
|
1009
|
-
...(body.brand === undefined ? {} : { brand: this.brandPatch(body.brand) })
|
|
1372
|
+
...(body.brand === undefined ? {} : { brand: this.brandPatch(body.brand) }),
|
|
1373
|
+
...tastePatch,
|
|
1374
|
+
...targetMinutesPatch };
|
|
1010
1375
|
const result = await engine.editDeck(args);
|
|
1011
1376
|
await this.remember(result, args);
|
|
1012
1377
|
return { ...await this.view(digest(result.jsonPath)), changed: result.changed };
|
|
@@ -1046,7 +1411,7 @@ export class PptWorkbench {
|
|
|
1046
1411
|
return denied;
|
|
1047
1412
|
try {
|
|
1048
1413
|
const params = new URL(request.url).searchParams, kind = params.get('kind');
|
|
1049
|
-
if (!['html', 'pptx', 'json', 'bundle', 'share', 'notes', 'handout', 'coaching', 'data', 'visual'].includes(String(kind)))
|
|
1414
|
+
if (!['html', 'pptx', 'json', 'bundle', 'share', 'notes', 'handout', 'onepager', 'remotion', 'coaching', 'data', 'visual'].includes(String(kind)))
|
|
1050
1415
|
return fail(400, '不支持此文件类型');
|
|
1051
1416
|
const { entry, manifest, files, engine } = await this.project(params.get('id'));
|
|
1052
1417
|
if (String(manifest.revision) !== params.get('revision'))
|
|
@@ -1081,6 +1446,28 @@ export class PptWorkbench {
|
|
|
1081
1446
|
name = basename(entry.path, '.json') + '.handout.md';
|
|
1082
1447
|
}
|
|
1083
1448
|
}
|
|
1449
|
+
else if (kind === 'onepager') {
|
|
1450
|
+
const html = typeof engine.renderOnePagerHtml === 'function'
|
|
1451
|
+
? engine.renderOnePagerHtml(manifest, manifest.language)
|
|
1452
|
+
: renderOnePagerHtmlFallback(manifest, manifest.language);
|
|
1453
|
+
bytes = strToU8(html);
|
|
1454
|
+
name = basename(entry.path, '.json') + '-onepager.html';
|
|
1455
|
+
}
|
|
1456
|
+
else if (kind === 'remotion') {
|
|
1457
|
+
const themeObj = typeof engine.resolveTheme === 'function' ? engine.resolveTheme(manifest.theme) : undefined;
|
|
1458
|
+
const pace = typeof engine.computePaceBudget === 'function'
|
|
1459
|
+
? engine.computePaceBudget(manifest, manifest.targetMinutes)
|
|
1460
|
+
: computePaceBudgetFallback(manifest, manifest.targetMinutes);
|
|
1461
|
+
const bundle = buildRemotionBundleFiles(manifest, {
|
|
1462
|
+
fps: 30,
|
|
1463
|
+
format: 'landscape',
|
|
1464
|
+
themeTokens: (themeObj?.palette ?? {}),
|
|
1465
|
+
paceBudget: pace,
|
|
1466
|
+
});
|
|
1467
|
+
const zipEntries = Object.fromEntries(Object.entries(bundle.files).map(([k, v]) => [k, strToU8(v)]));
|
|
1468
|
+
bytes = zipSync(zipEntries, { level: 0 });
|
|
1469
|
+
name = basename(entry.path, '.json') + '-remotion.zip';
|
|
1470
|
+
}
|
|
1084
1471
|
else if (kind === 'bundle' || kind === 'share') {
|
|
1085
1472
|
const entries = {};
|
|
1086
1473
|
let total = 0;
|
|
@@ -1118,11 +1505,11 @@ export class PptWorkbench {
|
|
|
1118
1505
|
request.signal.throwIfAborted();
|
|
1119
1506
|
if ((await this.project(entry.id)).manifest.revision !== manifest.revision)
|
|
1120
1507
|
return fail(409, '项目已被修改,请重新打开后下载');
|
|
1121
|
-
const archive = kind === 'bundle' || kind === 'share';
|
|
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';
|
|
1508
|
+
const archive = kind === 'bundle' || kind === 'share' || kind === 'remotion';
|
|
1509
|
+
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' || kind === 'onepager') ? 'text/html; charset=utf-8' : 'application/json; charset=utf-8';
|
|
1123
1510
|
return new Response(new Uint8Array(bytes), { headers: {
|
|
1124
1511
|
'content-type': type, 'cache-control': 'no-store', 'x-content-type-options': 'nosniff',
|
|
1125
|
-
'content-disposition': `attachment; filename="presentation.${archive ? 'zip' : ['notes', 'handout', 'coaching', 'data', 'visual'].includes(String(kind)) ? 'md' : kind}"; filename*=UTF-8''${encodeURIComponent(name)}`,
|
|
1512
|
+
'content-disposition': `attachment; filename="presentation.${archive ? 'zip' : ['notes', 'handout', 'coaching', 'data', 'visual'].includes(String(kind)) ? 'md' : kind === 'onepager' ? 'html' : kind}"; filename*=UTF-8''${encodeURIComponent(name)}`,
|
|
1126
1513
|
} });
|
|
1127
1514
|
}
|
|
1128
1515
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ppt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "DeepSeek Harness 演示文稿生成与编辑工作台:输入材料即可导出离线 HTML 放映、可编辑 PPTX 与工程包,支持按页编辑、数据推演与预审演练,以及原生清透 / 米白纸感 / Claude 暖书卷 / 8-Bit 像素 / 晴空薄荷五套明亮工作台主题。欢迎提交 issues 和 PR。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
package/skills/dsh-ppt/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dsh-ppt
|
|
3
|
-
description: "Turn one sentence, a Markdown document, structured slides, or
|
|
3
|
+
description: "Turn one sentence, a Markdown document, structured slides, Office files (.xlsx/.csv/.docx), or a benchmark .pptx into a world-class presentation deck: standalone HTML web slideshow (with Dual-Screen Presenter Console & Executive One-Pager) + 100% native-editable PPTX (with 8 Curated Taste Recipes, 4 poster covers, 61 native <a:custGeom> vector icons, glass/frameless/editorial materiality, native <m:oMath> formulas, Mermaid flowcharts/sequences, Marimekko, Sankey, Porter Value Chain, SWOT) + project manifest + Speaker Handout. Features Zero-Question Scenario Auto-Direction (theme: auto), 24 curated themes, 8 Taste Recipes & benchmark .pptx aesthetic DNA learning (.dsh-ppt/taste-recipes.json), 6 Master Chrome Skeletons, 29+ native-editable layouts, 20 industry blueprints, 13 publication-grade charts with spotlight/referenceLine/growth callouts, and bilingual ZH/EN support. 中文:把一句话、文档、表格或标杆 PPTX 变成大师级演示文稿,内置 8 套大师品味配方(Taste Recipes)、4 套海报级封面、61 枚原生矢量图标、玻璃/无框/双发丝材质、Mermaid/公式/桑基/Mekko 等 29+ 版式与标杆 PPTX 审美 DNA 持久化复用。"
|
|
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
|
---
|
|
@@ -20,8 +20,8 @@ allowed-tools: "Bash, Read, Write, Edit"
|
|
|
20
20
|
1. **零追问场景定调(Zero-Question Auto-Director)**:用户说“帮我做个汇报 PPT”时,**不要反问一堆设计参数**。直接根据内容语义识别六大画像(商业咨询、政务述职、学术答辩、科技路演、教育讲义、人文品牌),传 `theme: 'auto'` 或显式匹配 24 套大师主题(含 `bcg-emerald`、`economist-brief`、`venture-daylight`、`stripe-craft`、`aurora-stage`、`obsidian-amber`、`keynote-light`、`financial-ft`、`medical-clean`、`luxury-noir`)。**明亮投影优先**:会议室汇报、政企述职、学术答辩、教学课件一律优先选用 16 套浅底主题(通用默认 `consulting` 蔚蓝战略),绝不在常规办公场景盲目套用纯黑赛博风 `data`!并按场景自动匹配 **6 套差异化母版骨架(`chromeStyle`:`consulting-classic` / `keynote-spatial` / `editorial-folio` / `saas-bento` / `academic-minimal` / `gov-ceremonial`)**,彻底告别「一套模板换颜色」。
|
|
21
21
|
2. **结论先行(Action Titles)**:除封面、目录与章节页外,每页标题必须是**完整的结论判断句**(如「异步评审将工程师周均例会耗时压缩 75%」),严禁使用「项目背景」「数据分析」「周末到馆人次」等空洞名词标签。
|
|
22
22
|
3. **版式节奏与反要点墙(Anti-Bullet-Wall)**:优先传**结构化 `slides`**(或使用 `::: kpi / cards / comparison / process / chevron / matrix / callout / gantt / architecture / harvey / tam / org` 指令)充分利用 **24+ 套原生版式与专业图示**。**整套文稿严禁连续超过 2 页使用普通 `bullets` 要点列表**;8 页以上文稿须有节奏地交替视觉密度(指标用 `kpi`、端到端价值链用 `chevron`、排期用 `gantt`、系统分层用 `architecture`、竞品能力用 `harvey`、市场空间用 `tam`、组织团队用 `org`、并列支柱用 `cards[pillars/bento]`、痛点整改用 `comparison[issue-action]`、演进/闭环用 `process[timeline/steps/flywheel/funnel]`、四象限用 `matrix`、数据配洞察用 `chart-split`、学术对比用 `table[booktabs]` 三线表)。
|
|
23
|
-
4. **出版级图表与三线表**:单系列图表自动隐藏冗余图例,使用 `highlight: 'max' | 'last'`
|
|
24
|
-
5. **双轨深层吸收优质 PPT
|
|
23
|
+
4. **出版级图表与三线表**:单系列图表自动隐藏冗余图例,使用 `spotlight: true` / `highlight: 'max' | 'last'` 突出焦点色柱、其余灰阶退后,按需叠加 `referenceLine` 基准虚线与 `showGrowthCallout: true` 麦肯锡增长飞线批注,左下角附 `source` 数据来源;学术与严谨数据对比使用无竖线的 `booktabs` 三线表。
|
|
24
|
+
5. **双轨深层吸收优质 PPT 与 8 套大师品味配方(Taste Recipes)**:无外部模板时直接按场景选用内置 **8 套大师审美配方**(`taste: 'mckinsey-partner' | 'apple-keynote-dark' | 'apple-keynote-light' | 'swiss-editorial' | 'linear-craft' | 'ft-data-journal' | 'nature-academic' | 'oriental-zen'`),协同驱动 4 套海报封面(`keynote-glow` / `editorial-grid` / `architectural` / `split-bleed`)、`section[agenda]` 实时章节进度、4 种卡片材质(`solid` / `frameless` / `glass` / `editorial-rule`)、`kpi[spotlight]` / `cards[bento-hero]` 非对称主次布局与 **61 枚原生 `<a:custGeom>` 矢量图标**;用户提供标杆 `.pptx` 时调 `ppt_absorb`(传 `saveTasteAs` / CLI `--save-taste`)提取留白率/材质/字阶比/节奏分生成 `styleRecipe` 持久化至 `.dsh-ppt/taste-recipes.json`,后续新稿直接用 `taste: "<savedId>"` 复用,或传 `referencePptx` + `cloneStructure: true` 直接映射逐页版式序列与母版骨架!
|
|
25
25
|
|
|
26
26
|
## 执行纪律(每次都要遵守)
|
|
27
27
|
|
|
@@ -39,10 +39,10 @@ allowed-tools: "Bash, Read, Write, Edit"
|
|
|
39
39
|
- **重要 CLI 差异**:跨 harness 直接运行 `build-deck.mjs` 时,裸 CLI 缺省 `--theme` 为兼容旧脚本仍回退 `data`,因此 **CLI 调用请务必显式传 `--theme auto` 或具体场景主题 ID(如 `--theme consulting` / `--theme exec-jilan`)**!
|
|
40
40
|
4. **Build 生成**:先读 `references/syntax.md`(用到图表/多图/外源母版/编辑时读 `references/advanced.md`)。
|
|
41
41
|
- **推荐方式(DSH 内)**:调 `ppt_create`,优先传结构化 `slides`(精确控制 **24 种原生版式**含 `gantt / architecture / harvey / tam / org / kpi / cards / comparison / matrix / process / chart-split / table[booktabs] / callout`),或传带 `:::` 指令与 `**加粗引导词**:说明` 的 Markdown `content`。
|
|
42
|
-
- **跨 harness CLI**:`node <skill-dir>/scripts/build-deck.mjs --title "标题" --slides @slides.json --theme auto --lang zh --out dist
|
|
42
|
+
- **跨 harness CLI**:`node <skill-dir>/scripts/build-deck.mjs --title "标题" --slides @slides.json --theme auto --lang zh --out dist`(直吞 Excel/CSV/Word 可用 `--from-office report.xlsx --theme auto --target-minutes 10 --one-pager --out dist`;吸收参考模板并克隆结构可加 `--reference-pptx ref.pptx --clone-structure`;显式骨架用 `--chrome academic-minimal`;仅提取风格用 `--absorb ref.pptx`)。
|
|
43
43
|
- 动效默认 `motion: 'on'`(HTML 页间淡入 + PPTX 要点点击逐条出现);严肃政企公文、学术打印或归档传 `motion: 'off'`。
|
|
44
|
-
5. **Verify 校验与看图修正**:调 `ppt_check` 检查结构、字数密度、WCAG 对比度与 `SLOP-01..10` 审美告警。若安装了 `@deepseek-ai/libreoffice-kit`,调 `ppt_render` 生成逐页 PNG/PDF 并附 `renderReceipt` 复检,逐张用看图工具核查画面(0 缺字、0 溢出、0 遮挡、0
|
|
45
|
-
6. **Deliver 交付**:向用户提供 `.html`、`.pptx`、`.json
|
|
44
|
+
5. **Verify 校验与看图修正**:调 `ppt_check` 检查结构、字数密度、WCAG 对比度与 `SLOP-01..10` 审美告警。若安装了 `@deepseek-ai/libreoffice-kit`,调 `ppt_render` 生成逐页 PNG/PDF 并附 `renderReceipt` 复检,逐张用看图工具核查画面(0 缺字、0 溢出、0 遮挡、0 冗余图例)。微调文字、切换主题、更新 `mermaid` 或调整 `targetMinutes` 配速预算用 `ppt_edit`(带 `expectedRevision`),需要时 `ppt_undo`。静态估算、渲染成功与视觉验收必须分开如实陈述。
|
|
45
|
+
6. **Deliver 交付**:向用户提供 `.html`、`.pptx`、`.json`(默认严格保持三件套,仅在传 `--handout` / `--one-pager` 时同步落盘 `.handout.md` / `.onepager.html`)绝对路径,说明 HTML 快捷键(`← →` 翻页 · **`P` 开启双屏演讲者提词台含逐页配速预算** · **`L` 开启虚拟激光笔** · `F` 全屏 · `G` 总览 · `S` 顶部备注 · `Ctrl/Cmd+P` 打印)及检查面板内置「下载讲义 (.md)」与「下载一页纸战报 (.html)」(支持 A4 打印与长图战报切换)离线导出;说明 PPTX 100% 原生可编辑特性(含 `<m:oMath>` 原生公式、Marimekko、桑基流向图、波特价值链、SWOT、Mermaid 原生流程图/时序图、三线表与图表工作簿),以及支持 `ppt_import` / `--sync-pptx` 从 Office 改稿回导同步工程、`ppt_from_office` / `--from-office` 直吞 `.xlsx/.csv/.tsv/.docx`。
|
|
46
46
|
|
|
47
47
|
## 按需装载索引
|
|
48
48
|
|