@capyclaw/ppt-workbench 0.0.0-stage → 2.4.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/LICENSE +21 -0
- package/README.md +126 -3
- package/THIRD_PARTY_NOTICES.md +21 -0
- package/contract/ppt-contract.json +1529 -0
- package/cordis.patch.yml +25 -0
- package/core/audit.js +500 -0
- package/core/chart.js +199 -0
- package/core/color.js +80 -0
- package/core/deck-layout.js +195 -0
- package/core/formula.js +80 -0
- package/core/hfmath/hershey.js +1763 -0
- package/core/hfmath/index.js +1176 -0
- package/core/hfmath/stretch.js +41 -0
- package/core/hfmath/symbols.js +408 -0
- package/core/ops/browser.js +28 -0
- package/core/ops/chart.js +64 -0
- package/core/ops/deck.js +21 -0
- package/core/ops/dispatcher.js +2 -0
- package/core/ops/element.js +55 -0
- package/core/ops/history.js +11 -0
- package/core/ops/import.js +95 -0
- package/core/ops/index.js +39 -0
- package/core/ops/playback.js +9 -0
- package/core/ops/recolor.js +33 -0
- package/core/ops/slide.js +66 -0
- package/core/ops/table.js +85 -0
- package/core/ops/text.js +35 -0
- package/core/ops/view.js +13 -0
- package/core/ops.js +12 -0
- package/core/quick.js +52 -0
- package/core/shape-library.js +122 -0
- package/core/table.js +178 -0
- package/core/text.js +200 -0
- package/editor/app.js +5366 -0
- package/editor/heartbeat-worker.js +116 -0
- package/editor/index.html +89 -0
- package/editor/ppt-full-app.js +376 -0
- package/lib/host.mjs +98 -0
- package/package.json +51 -4
- package/server/audit.mjs +2 -0
- package/server/bridge-client.mjs +174 -0
- package/server/constants.mjs +20 -0
- package/server/contract-snapshots.mjs +62 -0
- package/server/contract.mjs +24 -0
- package/server/deck-layout.mjs +2 -0
- package/server/http-utils.mjs +2 -0
- package/server/infra/http.mjs +113 -0
- package/server/infra/runtime/context.mjs +128 -0
- package/server/infra/store/blob-store.mjs +109 -0
- package/server/infra/tuning.mjs +82 -0
- package/server/infra/util/fs-lock.mjs +132 -0
- package/server/infra/workspace/manager.mjs +657 -0
- package/server/mcp/dispatch.mjs +2 -0
- package/server/mcp/handler.mjs +2 -0
- package/server/mcp/instructions.mjs +40 -0
- package/server/mcp-http.mjs +3 -0
- package/server/ppt-shim.mjs +156 -0
- package/server/relay.mjs +245 -0
- package/server/routes/assets.mjs +2 -0
- package/server/routes/bridge.mjs +47 -0
- package/server/routes/editor.mjs +9 -0
- package/server/routes/import.mjs +258 -0
- package/server/routes/mcp.mjs +17 -0
- package/server/runtime/recovery.mjs +9 -0
- package/server/runtime/watch.mjs +17 -0
- package/server/shared/SHARED_MANIFEST.json +47 -0
- package/server/shared/asset-service.mjs +217 -0
- package/server/shared/editor-host.mjs +125 -0
- package/server/shared/kit/editor/lease.mjs +139 -0
- package/server/shared/kit/service/api.mjs +45 -0
- package/server/shared/kit/service/http.mjs +113 -0
- package/server/shared/kit/service/mcp-http.mjs +142 -0
- package/server/shared/kit/service/single-instance.mjs +72 -0
- package/server/shared/kit/tools/validate.mjs +115 -0
- package/server/shared/kit/tuning.mjs +82 -0
- package/server/shared/kit/util/fs-lock.mjs +132 -0
- package/server/shared/service-host.mjs +511 -0
- package/server/shared/state-service.mjs +249 -0
- package/server/shared/tool-host.mjs +341 -0
- package/server/shared/tuning.mjs +63 -0
- package/server/single-instance.mjs +2 -0
- package/server/store/backends/file-backend.mjs +13 -0
- package/server/store/checkpoints.mjs +28 -0
- package/server/store/doc.mjs +52 -0
- package/server/store/index.mjs +34 -0
- package/server/store/journal.mjs +9 -0
- package/server/store/lease.mjs +2 -0
- package/server/store/sanitize.mjs +32 -0
- package/server/store.mjs +2 -0
- package/server/tools/capabilities/apply.mjs +33 -0
- package/server/tools/capabilities/audit.mjs +24 -0
- package/server/tools/capabilities/chart.mjs +83 -0
- package/server/tools/capabilities/compose.mjs +97 -0
- package/server/tools/capabilities/contract.mjs +34 -0
- package/server/tools/capabilities/deck.mjs +27 -0
- package/server/tools/capabilities/element.mjs +67 -0
- package/server/tools/capabilities/export.mjs +95 -0
- package/server/tools/capabilities/formula.mjs +72 -0
- package/server/tools/capabilities/history.mjs +29 -0
- package/server/tools/capabilities/image.mjs +152 -0
- package/server/tools/capabilities/imagesearch.mjs +152 -0
- package/server/tools/capabilities/import.mjs +180 -0
- package/server/tools/capabilities/index.mjs +58 -0
- package/server/tools/capabilities/line.mjs +58 -0
- package/server/tools/capabilities/notes.mjs +33 -0
- package/server/tools/capabilities/present.mjs +34 -0
- package/server/tools/capabilities/recolor.mjs +60 -0
- package/server/tools/capabilities/screenshot.mjs +86 -0
- package/server/tools/capabilities/shape.mjs +64 -0
- package/server/tools/capabilities/slide.mjs +81 -0
- package/server/tools/capabilities/style.mjs +48 -0
- package/server/tools/capabilities/table.mjs +127 -0
- package/server/tools/capabilities/task.mjs +52 -0
- package/server/tools/capabilities/text.mjs +82 -0
- package/server/tools/domains/color.mjs +4 -0
- package/server/tools/domains/image.mjs +49 -0
- package/server/tools/domains/index.mjs +7 -0
- package/server/tools/domains/pptx-export.mjs +566 -0
- package/server/tools/domains/recolor.mjs +25 -0
- package/server/tools/domains/remote-image.mjs +291 -0
- package/server/tools/domains/slide.mjs +21 -0
- package/server/tools/domains/text-style.mjs +11 -0
- package/server/tools/domains/tooling.mjs +13 -0
- package/server/tools/index.mjs +14 -0
- package/server/tools/kernel/define.mjs +5 -0
- package/server/tools/kernel/ports.mjs +42 -0
- package/server/tools/kernel/registry.mjs +17 -0
- package/server/tools.mjs +18 -0
- package/server/tuning.mjs +86 -0
- package/server/validate.mjs +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CapyClaw
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,126 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# dsh-ppt-workbench(PPT 工作台运行时)
|
|
2
|
+
|
|
3
|
+
DeepSeek Harness 插件:PPTist 运行时 + 工具面。**普通用户请装 `dsh-ppt-suite`**;
|
|
4
|
+
本包是套件里的运行时子包,也可单独安装用于调试。
|
|
5
|
+
|
|
6
|
+
- **27 个 `mcp__ppt__*` 工具**:导入 PPTX(`ppt_import_pptx`,编辑器原生转换)/ 导出 PPTX(`ppt_export_pptx`,pptxgenjs)/ 图表(`ppt_chart`)/ 表格(`ppt_table`)/ 数学公式(`ppt_formula`)/ 形状库(`ppt_shape`)/ 线条(`ppt_line`)/ 演讲备注(`ppt_notes`)/ 契约探测(`ppt_capabilities`)/ 读 deck / **确定性审计(`ppt_audit`)** / 改文字样式 /
|
|
7
|
+
一键换色 / 元素页管理 / 插图(自动压缩+自校验)/ 简洁版式成稿(`ppt_deck`)/ 放映 / 撤销重做 / 截图。
|
|
8
|
+
- **浏览器实时编辑器**:`http://127.0.0.1:39311/`(本机 relay 托管,装完即有)。
|
|
9
|
+
agent 的每一步修改实时出现在页面里;可本地快捷指令、导出 PPTX、放映。
|
|
10
|
+
- **本机桥**(127.0.0.1:39311):agent(MCP)与编辑器之间的指令/回执/镜像/
|
|
11
|
+
截图通道。**不依赖任何桌面系统**,一条 dsh 会话 + 一个浏览器标签页即可工作。
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
前置:本机装有 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(dsh ≥ 0.2)
|
|
16
|
+
与 pnpm(插件安装经 pnpm 拉包)。插件本体**零构建脚本**;运行时依赖只有
|
|
17
|
+
`dsh-document-workbench` 与纯 JS 的 `pptxgenjs`(PPTX 导出),安装不会触发
|
|
18
|
+
构建脚本审批。
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# 推荐:通过套件安装(同时获得 workbench + skills)
|
|
22
|
+
dsh plugin --profile <你的profile> install /path/to/dsh-ppt-suite
|
|
23
|
+
|
|
24
|
+
# 只调试运行时:单独安装本包
|
|
25
|
+
dsh plugin --profile <你的profile> install /path/to/dsh-ppt-workbench
|
|
26
|
+
|
|
27
|
+
# 也可以走 Web 界面:侧边栏「插件」页 → 安装 → 填本地路径 / git 地址
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
装好后(无 HMR 的 profile 需重启会话),工具组 `mcp__ppt__*` 出现在 agent
|
|
31
|
+
工具清单里;同时本机 39311 端口的桥随之就绪(由插件内置宿主在进程内拉起,
|
|
32
|
+
dsh 关闭时自动停止)。
|
|
33
|
+
|
|
34
|
+
## 使用
|
|
35
|
+
|
|
36
|
+
1. 浏览器打开 **http://127.0.0.1:39311/** —— 页面显示即可用(打开即连接,无需任何操作)。
|
|
37
|
+
2. 在 dsh 会话里直接说需求,例如:
|
|
38
|
+
- 「用都市蓝调做一套 Q4 销售规划的 PPT,封面写 XXX」
|
|
39
|
+
- 「把背景改成天蓝色」「第 2 页标题换成 X」「加一页介绍 Y」「整体换成深色系」
|
|
40
|
+
- 「插入这张图」(聊天里贴图,用 `ppt_image` 附件通道)
|
|
41
|
+
3. agent 的改动实时出现在编辑器页;说「看一下效果」会用 `ppt_screenshot`
|
|
42
|
+
回传全页拼图。
|
|
43
|
+
4. 收尾在编辑器页点「导出 PPTX」。
|
|
44
|
+
|
|
45
|
+
多开标签页时后打开者自动成为活动页(内部租约仲裁,静默切换,无任何提示)。
|
|
46
|
+
|
|
47
|
+
## 运行时架构(三件)
|
|
48
|
+
|
|
49
|
+
| 件 | 位置 | 说明 |
|
|
50
|
+
|----|------|------|
|
|
51
|
+
| 宿主插件 | `lib/host.mjs` | cordis 入口:进程内拉起 relay,disposer 随插件停用关闭 |
|
|
52
|
+
| relay 组合根 | `server/relay.mjs` | 只保留 PPT 业务装配;端口/锁/复用/健康/指标/静态由 `dsh-service-host` 提供 |
|
|
53
|
+
| 公共插件快照 | `server/shared/*` | `dsh-service-host` / `dsh-tool-host` / `dsh-state-service` / `dsh-asset-service` / `dsh-editor-host`;仅独立运行时回退,state 快照只服务 file backend |
|
|
54
|
+
| 路由 | `server/routes/*` | assets / mcp / editor 走公共插件;bridge 是 PPT 专属协议 |
|
|
55
|
+
| 存储 | `server/store/*` | `doc/lease/sanitize` 是 PPT 业务;journal/checkpoint/file backend 使用 vendored 的 state-service 库代码,不依赖 `ctx.state` |
|
|
56
|
+
| MCP 协议 | `server/mcp/*` | 协议壳/分派来自 `dsh-tool-host`;instructions 只放 PPT 文案 |
|
|
57
|
+
| 工具面 | `server/tools/*` | 构建期从 `src/mcp/tools` 拷贝:kernel + domains + 15 个 capability |
|
|
58
|
+
| 领域核心 | `core/*` | 构建期从 `src/core` 拷贝:ops 域、color、text、layout、audit |
|
|
59
|
+
| 编辑器 | `editor/` | PPTist 运行时(打补丁版)+ 工作循环(自动连接/长轮询/应用/回执/镜像/自截图) |
|
|
60
|
+
|
|
61
|
+
工具实现(`server/tools.mjs`)由上游工程 `ppt-bridge/src/mcp/` 构建期拷贝——
|
|
62
|
+
**不要手改包内拷贝**,改上游后重跑 `node scripts/build-plugin.mjs`。
|
|
63
|
+
能力清单与扩展方式见仓库 `docs/ARCHITECTURE.md` / `docs/EXTENDING.md`。
|
|
64
|
+
|
|
65
|
+
配套包:
|
|
66
|
+
|
|
67
|
+
- `dsh-ppt-skill-*`:8 个单 skill 包,每个独立版本、独立评测;
|
|
68
|
+
- `dsh-ppt-suite`:组合入口,普通用户只装它。
|
|
69
|
+
|
|
70
|
+
## 契约(2.2)
|
|
71
|
+
|
|
72
|
+
- `ppt_capabilities` 返回 `contractVersion`、`packageVersion`、`toolCount`、
|
|
73
|
+
工具清单(name/kind/since/capability)、`features`、`capabilities`(id/title/tags/tools)
|
|
74
|
+
和 `editorUrl`。
|
|
75
|
+
- `contract/ppt-contract.json` 是构建时快照;工具/能力清单由
|
|
76
|
+
`src/mcp/tools/capabilities/*` 经 registry 派生,`src/mcp/contract.mjs` 只保留版本与报告格式。
|
|
77
|
+
- 工具名/参数/返回结构发生不兼容变化 → contract major +1;8 个 skill 包的 major 必须同步。
|
|
78
|
+
- `dsh-ppt-skill-*` 不 import 本包代码,只通过 `ppt_capabilities` 检查兼容性。
|
|
79
|
+
|
|
80
|
+
## 运行时接口
|
|
81
|
+
|
|
82
|
+
- `GET /healthz`:版本、contract、端口、deck 页数、编辑器连接、seq/state、uptime。
|
|
83
|
+
- `GET /metrics`:Prometheus 文本指标(up/uptime/slides/seq/editor_connected/memory)。
|
|
84
|
+
- `GET /ui`:页面级命令队列(present/select/exit-present)。
|
|
85
|
+
- `GET /task/status`、`/task/checkpoints`、`POST /task/checkpoint`:任务进度与命名 checkpoint。
|
|
86
|
+
- MCP 调用会先按 `inputSchema` 校验参数;非法参数返回 `isError`,不再进实现。
|
|
87
|
+
- 编辑器顶栏:状态点、临时提示、本地快捷指令、导出 PPTX / 保存 JSON / 放映。
|
|
88
|
+
- 服务只绑定 `127.0.0.1`,并带 `nosniff` / `no-referrer` / `no-store` 响应头。
|
|
89
|
+
|
|
90
|
+
## 持久化与恢复
|
|
91
|
+
|
|
92
|
+
- `~/.dsh-ppt-bridge/state.json`:deck 权威状态,原子落盘。
|
|
93
|
+
- `~/.dsh-ppt-bridge/journal.jsonl`:每次 push/applied/checkpoint 的追加日志,2MB 自动轮转。
|
|
94
|
+
- `~/.dsh-ppt-bridge/checkpoints/`:`ppt_task checkpoint` 保存的 deck 快照。
|
|
95
|
+
- 启动时若 `seq > applied_seq`,自动重放未完成批次。
|
|
96
|
+
|
|
97
|
+
## 端口与发现
|
|
98
|
+
|
|
99
|
+
- 首选端口 **39311**(patch 里的 MCP URL 是静态常量)。被占时:若占用者
|
|
100
|
+
是本桥旧实例则直接复用;否则向后扫描最多 50 个端口,实际地址写入
|
|
101
|
+
`~/.dsh-ppt-bridge/bridge.json`(编辑器同源无感;此时 MCP 需重启会话后
|
|
102
|
+
由新 relay 占用 39311)。
|
|
103
|
+
- 想换端口/目录:在 profile patch 里覆写 `ppt-workbench-host` 行的
|
|
104
|
+
`config: { port, hostDir }`。
|
|
105
|
+
- 想按 profile 选择能力:加 `config: { capabilities: ['text', 'image', ...] }`;
|
|
106
|
+
`dependsOn` 会自动带上依赖能力,缺省为全部 15 个。
|
|
107
|
+
|
|
108
|
+
## 也可脱离 dsh 独立运行(调试/演示)
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
node server/relay.mjs [--port 39311] # 桥 + 编辑器 + MCP 一并拉起
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## 已知约束
|
|
115
|
+
|
|
116
|
+
- MCP 固定连 `http://127.0.0.1:39311/mcp`;39311 被外部应用长期抢占时工具
|
|
117
|
+
不可用(工具结果会提示),属可接受降级。
|
|
118
|
+
- `ppt_image` 的聊天附件按 `$DSH_HOME/attachments/v1/objects` 解析;跨机器
|
|
119
|
+
贴图请重新粘贴。
|
|
120
|
+
- 默认走内置 clean 简洁版式,不依赖外部样式;更换新版 PPTist 后重跑
|
|
121
|
+
`build-plugin.mjs` 即可。
|
|
122
|
+
|
|
123
|
+
## 许可
|
|
124
|
+
|
|
125
|
+
AGPL-3.0-or-later。编辑器运行时基于 [PPTist](https://github.com/pipipi-pikachu/PPTist)
|
|
126
|
+
(AGPL-3.0),详见 `THIRD_PARTY_NOTICES.md`。
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 第三方组件说明(THIRD PARTY NOTICES)
|
|
2
|
+
|
|
3
|
+
## PPTist
|
|
4
|
+
|
|
5
|
+
- 来源:https://github.com/pipipi-pikachu/PPTist
|
|
6
|
+
- 许可:GNU Affero General Public License v3.0(AGPL-3.0-or-later)
|
|
7
|
+
- 本包 `editor/ppt-full-app.js` 是 PPTist 的编译产物,未做源码修改。
|
|
8
|
+
- 依 AGPL-3.0 第 13 条,本包整体按 AGPL-3.0-or-later 分发;如获得本包的
|
|
9
|
+
交互副本,你可依该许可证获取上述 PPTist 对应源代码。
|
|
10
|
+
|
|
11
|
+
## 其余代码
|
|
12
|
+
|
|
13
|
+
`lib/`、`server/`、`editor/index.html`、`editor/app.js` 为本工程自研
|
|
14
|
+
(构建产物 `editor/app.js` 源码见上游 `ppt-bridge/src/editor/` 与
|
|
15
|
+
`ppt-bridge/src/core/`),同样按 AGPL-3.0-or-later 分发。
|
|
16
|
+
|
|
17
|
+
## hfmath
|
|
18
|
+
|
|
19
|
+
- 公式渲染引擎(src/core/hfmath/):fork 自 https://github.com/LingDong-/hfmath (MIT),
|
|
20
|
+
采用 PPTist 项目 https://github.com/pipipi-pikachu/PPTist (AGPL-3.0)的扩展版并转译为 JavaScript。
|
|
21
|
+
- Hershey 单线字体数据(src/core/hfmath/hershey.js)来自 hfmath。
|