PPT animation studio · DSH plugin
A DeepSeek Harness plugin that builds PowerPoint decks and writes real animation and transition XML into them. Every effect body, direction variant and slide transition is captured from PowerPoint itself, so the result is what PowerPoint would have written by hand.
把一个请求变成「生成 + 配动画 + 配切换 + 回读校验」的闭环:动画 XML 不是手写的,而是让 PowerPoint 自己写一遍、把它的输出抄进模板库。

为什么这样做
手写 <p:timing> 能凑出结构,但效果体(animEffect、animScale、animRot、animMotion)的细节决定了 PowerPoint 认不认。于是这个项目的做法是:
- 用 COM 驱动 PowerPoint,对 160 个 effect id、每个方向、每个切换各生成一页;
- 抽出每页的
<p:timing>/<p:transition>,去掉 id 与目标形状,编译成模板库; - 插件只做三件事:重排时间节点 id、分配
grpId、按请求写时长/延迟/方向/修饰。
采样过程中发现、且没有文档写明的规则:同一形状的第二个动画必须递增 grpId(否则会被合并——实测两个 0.6s 的 pulse 变成一条 1.2s);段落构建共用一个 grpId 并标记 build="p"。
能力
| 维度 | 说明 |
|---|---|
| 生成 | 8 种版式(封面 / 章节 / 要点 / KPI / 步骤 / 卡片 / 引言 / 结尾),深色渐变主题,形状全部命名可寻址 |
| 动画 | 94 个效果:入场、强调、退出,以及 40 条命名运动路径 |
| 方向 | 12 个效果的方向变体(上/下/左/右/水平/垂直/顺逆时针),不支持的组合直接报错而不是被 PowerPoint 静默改写 |
| 段落 | byParagraph 把文本框按段落拆成一组效果 |
| 路径 | 自定义 2–64 个点的 [x, y] 轨迹 |
| 修饰 | repeat、autoReverse、smoothStart、smoothEnd |
| 时序 | auto / click / with / after,逐效果时长与延迟 |
| 切换 | 150 个 PpEntryEffect 切换,含时长与「单击/定时推进」 |
| 校验 | ppt_animation_inspect 回读时序树与切换 |

工具
| 工具 | 作用 |
|---|---|
ppt_build_deck |
从幻灯片 spec 生成 .pptx,可同时写动画与切换,返回每页形状名清单 |
ppt_animate |
往任意 .pptx 写动画时间轴 |
ppt_transition |
设置 / 修改 / 移除幻灯片切换 |
ppt_animation_inspect |
回读:每页切换 + 按播放顺序的每条动画 |
安装
插件是一个标准 DSH bundle,装在当前 profile 里、对所有会话生效,除本仓库代码外没有别的依赖(不需要 Office)。
前置条件
| 需要 | 说明 |
|---|---|
| DeepSeek Harness | 需要带 Web GUI 与 plugin_manager 的构建 |
| 本仓库代码 | 见「一、获取代码」;安装时指向仓库里的包目录 |
| PowerPoint(可选) | 只有 tools/verify.ps1 的 COM 复核、以及重新采样模板时需要(Windows)。生成与配置动画不需要 Office |
| 权限 | install_bundle 需要 danger-full-access,或对该次操作批准 |
一、获取代码
git clone https://github.com/acleverfreebird/dsh-ppt-animation.git
cd dsh-ppt-animation
没有 git 就在 GitHub 页面 Code → Download ZIP 解压。装好后目录长这样:
dsh-ppt-animation/
└─ packages/ppt-animation/ ← 安装时选这一层
├─ package.json ← 声明 dsh.bundle.patch
├─ cordis.patch.yml
├─ index.js lib/ assets/
└─ locale/ docs/ icon.svg
二、安装(两种方式,选一种)
A. 图形界面
- 打开 DSH Web GUI;
- 左侧 Plugins → 添加插件(Add plugin);
- 选择
dsh-ppt-animation/packages/ppt-animation目录 —— 不是仓库根目录; - 在 Plugins 列表确认出现「PPT 动画工作室 / PPT animation studio」,状态为启用。
B. 交给 Agent 装
plugin_manager({ action: "install_bundle", target: "D:/path/to/dsh-ppt-animation/packages/ppt-animation" })
target必须是包目录的绝对路径(Windows 用正斜杠或双反斜杠都可以);- 成功时返回里带
"application": "applied",失败则带diagnostic与日志路径; - 想确认装到了哪个 profile:
$env:DSH_PROFILE_DIR(例如C:\Users\<你>\.dsh\profiles\desktop)。
三、验证安装
Plugins 页面:点开「PPT 动画工作室」应能看到标题、简介、图标和详情页(
docs/DETAIL.md的内容);新开一个会话:工具集在会话开始时解析,旧会话里不会凭空多出工具。新会话应能用
ppt_build_deck/ppt_animate/ppt_transition/ppt_animation_inspect;试跑回读,随便给一个 pptx:
ppt_animation_inspect({ path: "你的文件.pptx" })能返回每页切换与动画列表,说明整条链路通了。
(可选)确认代码自身健康:
npm run check # 语法 npm test # 生成 + 回读,纯 Node,不需要 PowerPoint
四、更新到新版本
cd dsh-ppt-animation
git pull
然后移除并重新添加该插件(或 remove_bundle → install_bundle)。
原因:本地目录安装是链接式的,已加载的模块不会因为文件变化自动重新求值;重新安装才会加载新一代模块。
五、卸载
Plugins 页面里移除,或:
plugin_manager({ action: "remove_bundle", target: "@local/dsh-ppt-animation" })
六、故障排查
| 现象 | 处理 |
|---|---|
插件行 application: failed |
看返回里的 diagnostic;完整日志在 <DSH_PROFILE_DIR>/.plugin-manager/logs/<operation>/pnpm.log |
| 装完但工具调不到 | 工具在会话开始时解析:新开会话再试 |
提示 already-installed |
换版本必须先 remove_bundle 再 install_bundle |
| 提示权限不足 / 需要批准 | 把会话切到完全权限,或在批准弹窗里放行该次安装 |
verify.ps1 被执行策略拦住 |
pwsh -ExecutionPolicy Bypass -File tools/verify.ps1 -File .\你的文件.pptx |
| 在 macOS / Linux 上想用 | 插件本身跨平台(ZIP 与 OOXML 全在 Node 里实现);只有 tools/*.ps1、采样和 COM 复核是 Windows + PowerPoint 专属 |
| 生成的 deck 打不开 | 先 npm test 复现;把 out/ 下的产物和 ppt_animation_inspect 的输出一起提交 issue |
用法
{
"path": "deck.pptx",
"slides": [{
"slide": 3,
"steps": [
{ "shapes": ["title"], "effect": "fade", "trigger": "auto", "duration": 0.5 },
{ "shapes": ["divider"], "effect": "wipe", "direction": "left", "trigger": "with", "duration": 0.5 },
{ "shapes": ["bullet-1"], "effect": "fly-in", "direction": "left", "byParagraph": true, "trigger": "click", "duration": 0.45 },
{ "shapes": ["badge"], "path": [[0, 0], [0.08, -0.04], [0.16, 0.02]], "duration": 0.9 },
{ "shapes": ["seal"], "effect": "zoom", "repeat": "2", "autoReverse": true }
]
}]
}
trigger: "auto" 让这一段在翻页时自动播放,所以幻灯片不会以空白开场;后面的 click 仍然等你按键。演示稿就是这样配的:10 页只需要 9 次点击,而要点头两页、章节页、结尾页完全自动。
切换:
{ "path": "deck.pptx", "slides": [
{ "slide": 2, "type": "push-up", "duration": 1.1 },
{ "slide": 8, "type": "fade-smoothly", "duration": 1.2, "advance": "after", "afterSeconds": 3 }
] }
验证
演示稿 PPT动画引擎.pptx(10 页,89 条动画、10 个切换)由插件自身生成并配置。验证不靠自述,而是让 PowerPoint 打开、逐条读回:
pwsh -File tools/verify.ps1 -File .\PPT动画引擎.pptx -OutDir out\png
它输出 MainSequence 里每条动画的 EffectType / TriggerType / Duration / Paragraph / EffectParameters.Direction / Timing.Accelerate,以及每页的 SlideShowTransition.EntryEffect,并可 -SaveCopyTo 做往返对比。最新报告已随仓库提交:docs/verify-final.json。
当前结果:openOk=True,89 条动画(其中 2 条段落构建、28 条带方向、10 页首条均为 auto 随翻页播放),10 个切换(fade / push-up / fade-smoothly),共需 9 次点击,无修复提示。

仓库结构
packages/ppt-animation/ 插件包:index.js + lib/* + assets/{base.pptx,effects.json,directions.json,transitions.json}
tools/oracle.ps1 驱动 PowerPoint 为 160 个 effect id 各生成一页
tools/oracle-directions.ps1 采样每个方向变体
tools/oracle-transitions.ps1 采样 150 个切换
tools/extract_oracle.py 抽出每页的 <p:timing>
tools/make_effects.py 编译效果模板库
tools/make_directions.py 编译方向变体库
tools/make_transitions.py 编译切换库
tools/verify.ps1 COM 复核 + 导出 PNG(可选往返保存)
tools/rebuild.mjs 用插件代码从 deck-spec.json 重建演示稿
tools/smoke.mjs 库级冒烟测试(纯 Node,不需要 PowerPoint)
tools/smoke-v2.mjs v2 能力冒烟测试(方向/段落/路径/修饰/切换)
docs/superpowers/specs/ 设计说明
oracle/ 与 out/ 是可再生产物,不入库;模板库(三个 JSON)入库,装好即可用,不需要装 Office。
已知限制
- Morph 切换不可用:本机 PowerPoint 16.0 会在保存时丢弃
<p14:morph>(已实测),因此没有把它放进库里,而不是假装支持。 - 自定义路径会写在
path-left预设上,动画窗格显示的名字是「Left」,但轨迹是指定的点;PowerPoint 往返保存后轨迹保持不变。 - 只支持按段落构建,没有按词/按字母;只有 12 个效果支持方向。
ppt_animate是整页替换,不做追加合并。
许可
MIT,见 LICENSE。
No comments yet. Be the first to write one.