dsh-office-tools 0.1.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 +59 -0
- package/README.zh.md +59 -0
- package/cordis.patch.yml +6 -0
- package/dsh.plugin.json +21 -0
- package/lib/index.js +88724 -0
- package/lib/index.js.map +7 -0
- package/lib/types/index.d.ts +19 -0
- package/lib/types/paths.d.ts +56 -0
- package/lib/types/tools/excel.d.ts +8 -0
- package/lib/types/tools/ppt.d.ts +8 -0
- package/lib/types/tools/shared.d.ts +48 -0
- package/lib/types/tools/word.d.ts +6 -0
- package/package.json +106 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kw78
|
|
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
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# dsh-office-tools
|
|
2
|
+
|
|
3
|
+
Seven model-facing Office file tools for DeepSeek Harness, running entirely in the plugin host half.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/kw78/dsh-office-tools/actions/workflows/ci.yml) [](LICENSE) [](https://awesome-dsh-plugin.com)
|
|
6
|
+
|
|
7
|
+
> Install: `dsh plugin --profile web add github:kw78/dsh-office-tools`
|
|
8
|
+
|
|
9
|
+
| Tool | Purpose | Library |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `word_create` | Create `.docx` (title, paragraphs, bullets, one table) | `docx` |
|
|
12
|
+
| `word_read` | Extract plain text from `.docx` | `mammoth` |
|
|
13
|
+
| `excel_create` | Create a multi-sheet `.xlsx` from scalar cell grids | SheetJS (`xlsx`) |
|
|
14
|
+
| `excel_read` | Read one or all sheets as scalar rows | SheetJS |
|
|
15
|
+
| `excel_update` | Replace/create whole sheets, or write cells by A1 address | SheetJS |
|
|
16
|
+
| `ppt_create` | Create a 16:9 `.pptx` (title slide, titles, paragraphs, bullets, notes, PNG/JPG/GIF images) | `pptxgenjs` |
|
|
17
|
+
| `ppt_read` | Extract per-slide paragraph text, speaker notes, and image counts | `jszip` |
|
|
18
|
+
|
|
19
|
+
## Harness integration
|
|
20
|
+
|
|
21
|
+
The plugin follows the standard DSH host-plugin contract:
|
|
22
|
+
|
|
23
|
+
- It exports `name` / `inject` / `apply`; `inject = ['tools']` is its only runtime service dependency (`@deepseek-ai/dsh-tools`).
|
|
24
|
+
- `apply(ctx)` wraps every `ctx.tools.register(defineTool({...}))` in `ctx.effect(...)` so Cordis disposes the registrations with the plugin fiber.
|
|
25
|
+
- `defineTool` declares model-visible `parameters`, a validated canonical `output.schema`, and a pure `output.render` text projection.
|
|
26
|
+
- `execute(args, exec)` resolves every path against `exec.agent.session.header.cwd`; relative paths stay in the session workspace and absolute paths are accepted only when still inside it. A `realpath` check on the nearest existing ancestor closes the symlink escape hatch.
|
|
27
|
+
- Image files must live inside the session workspace (`.png/.jpg/.jpeg/.gif`, 20 MiB each); explicit inch coordinates `x/y/w/h` are supported, or omit them for automatic placement below the text.
|
|
28
|
+
- Writes go through a same-directory temp file + `rename`; `overwrite` defaults to `false`.
|
|
29
|
+
|
|
30
|
+
## Build
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm install
|
|
34
|
+
pnpm run check # typecheck + tests + build
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Artifacts: `lib/index.js` (ESM host bundle with Office libraries inlined; `@deepseek-ai/*` and `cordis` stay external) and `lib/types/**/*.d.ts`.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
dsh plugin --profile web add github:kw78/dsh-office-tools
|
|
43
|
+
# or from a local checkout:
|
|
44
|
+
dsh plugin --profile web add /path/to/dsh-office-tools
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Restart the DSH server after installation. The seven tools appear in the next prompt assembly.
|
|
48
|
+
|
|
49
|
+
## Community indexes
|
|
50
|
+
|
|
51
|
+
- Registration blocks for awesome-dsh-plugin / dsh-market are in [docs/hub-registration.md](docs/hub-registration.md).
|
|
52
|
+
- Recommended repository topics: `dsh`, `dsh-plugin`, `deepseek-harness`, `office`.
|
|
53
|
+
|
|
54
|
+
## Safety
|
|
55
|
+
|
|
56
|
+
- All file access is confined to the calling agent's session workspace.
|
|
57
|
+
- Reads are capped at 50 MiB; text/cell results are bounded and mark `truncated`.
|
|
58
|
+
- Creates/updates are bounded by row and cell limits and refuse overwrites by default.
|
|
59
|
+
- No LibreOffice/PowerPoint/Word subprocess is spawned; formats are generated and parsed with pure-JS libraries.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# dsh-office-tools
|
|
2
|
+
|
|
3
|
+
为 DeepSeek Harness 提供 7 个模型可调用的 Office 文件工具,全部运行在 host 半。
|
|
4
|
+
|
|
5
|
+
[](https://github.com/kw78/dsh-office-tools/actions/workflows/ci.yml) [](LICENSE) [](https://awesome-dsh-plugin.com)
|
|
6
|
+
|
|
7
|
+
> 安装:`dsh plugin --profile web add github:kw78/dsh-office-tools`
|
|
8
|
+
|
|
9
|
+
| 工具 | 作用 | 依赖 |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `word_create` | 创建 `.docx`(标题、段落、项目符号、一个表格) | `docx` |
|
|
12
|
+
| `word_read` | 提取 `.docx` 纯文本 | `mammoth` |
|
|
13
|
+
| `excel_create` | 创建多 sheet 的 `.xlsx`(标量单元格网格) | SheetJS (`xlsx`) |
|
|
14
|
+
| `excel_read` | 读取一个或全部 sheet,返回标量行 | SheetJS |
|
|
15
|
+
| `excel_update` | 就地替换/新建整张 sheet,或按 A1 地址写单元格 | SheetJS |
|
|
16
|
+
| `ppt_create` | 创建 16:9 `.pptx`(标题页、标题、段落、项目符号、备注、PNG/JPG/GIF 图片) | `pptxgenjs` |
|
|
17
|
+
| `ppt_read` | 按页提取 `.pptx` 段落文本、演讲者备注与图片数量 | `jszip` |
|
|
18
|
+
|
|
19
|
+
## 框架接入方式
|
|
20
|
+
|
|
21
|
+
插件遵循 DSH 标准 host 插件契约:
|
|
22
|
+
|
|
23
|
+
- 模块导出 `name` / `inject` / `apply`;本插件 `inject = ['tools']`,唯一运行时依赖是 `ctx.tools`(`@deepseek-ai/dsh-tools`)。
|
|
24
|
+
- `apply(ctx)` 中用 `ctx.effect(() => ...)` 包裹 `ctx.tools.register(defineTool({...}))`,Cordis fiber 卸载时自动 dispose。
|
|
25
|
+
- `defineTool` 统一声明 `parameters`(模型可见 JSON Schema)、`output.schema`(强制校验的规范 JSON 值)与 `output.render`(模型看到的文本投影)。
|
|
26
|
+
- 每个 `execute(args, exec)` 从 `exec.agent.session.header.cwd` 取会话工作目录;相对路径按该目录解析,绝对路径只接受仍位于工作目录内的路径,并对最近存在的祖先做 `realpath` 校验防止符号链接逃逸。
|
|
27
|
+
- 图片文件必须位于会话工作目录内(`.png/.jpg/.jpeg/.gif`,单张上限 20 MiB);可显式指定英寸坐标 `x/y/w/h`,省略时自动放在文本下方。
|
|
28
|
+
- 写文件采用同目录临时文件 + `rename` 原子落盘;`overwrite` 默认 `false`,防止误覆盖。
|
|
29
|
+
|
|
30
|
+
## 构建
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm install
|
|
34
|
+
pnpm run check # typecheck + tests + build
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
构建产物:`lib/index.js`(host ESM,Office 依赖内联,`@deepseek-ai/*`/`cordis` 保持 external)与 `lib/types/**/*.d.ts`。
|
|
38
|
+
|
|
39
|
+
## 安装
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
dsh plugin --profile web add github:kw78/dsh-office-tools
|
|
43
|
+
# 或本地目录:
|
|
44
|
+
dsh plugin --profile web add /path/to/dsh-office-tools
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
安装后重启 DSH 服务。模型下一次组装提示词时即可看到 7 个工具。
|
|
48
|
+
|
|
49
|
+
## 社区索引
|
|
50
|
+
|
|
51
|
+
- awesome-dsh-plugin / dsh-market 的登记块见 [docs/hub-registration.md](docs/hub-registration.md)。
|
|
52
|
+
- 仓库 topics 建议:`dsh`、`dsh-plugin`、`deepseek-harness`、`office`。
|
|
53
|
+
|
|
54
|
+
## 安全边界
|
|
55
|
+
|
|
56
|
+
- 所有读写都限制在发起调用的 agent 的会话工作目录内。
|
|
57
|
+
- 读取文件上限 50 MiB,文本/单元格结果有上限并标记 `truncated`。
|
|
58
|
+
- 创建/更新有行数、单元格数上限,且默认不覆盖已有文件。
|
|
59
|
+
- 不调用 LibreOffice / PowerPoint / Word 等外部进程,所有格式均通过纯 JS 库生成/解析。
|
package/cordis.patch.yml
ADDED
package/dsh.plugin.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "dsh-office-tools",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "lib/index.js",
|
|
5
|
+
"description": "Office tools for the model: create, read, and update Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) files inside the session workspace.",
|
|
6
|
+
"engines": {
|
|
7
|
+
"dsh": ">=0.0.1"
|
|
8
|
+
},
|
|
9
|
+
"contributes": {
|
|
10
|
+
"tools": [
|
|
11
|
+
"word_create",
|
|
12
|
+
"word_read",
|
|
13
|
+
"excel_create",
|
|
14
|
+
"excel_read",
|
|
15
|
+
"excel_update",
|
|
16
|
+
"ppt_create",
|
|
17
|
+
"ppt_read"
|
|
18
|
+
],
|
|
19
|
+
"skills": []
|
|
20
|
+
}
|
|
21
|
+
}
|