dsh-office-tools 0.1.0 → 0.2.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/README.md +27 -3
- package/README.zh.md +27 -3
- package/dsh.plugin.json +1 -1
- package/lib/index.js +44564 -43469
- package/lib/index.js.map +4 -4
- package/lib/types/index.d.ts +18 -1
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Seven model-facing Office file tools for DeepSeek Harness, running entirely in the plugin host half.
|
|
4
4
|
|
|
5
|
-
[](https://github.com/kw78/dsh-office-tools/actions/workflows/ci.yml) [](LICENSE) [](https://awesome-dsh-plugin.com)
|
|
5
|
+
[](https://www.npmjs.com/package/dsh-office-tools) [](https://github.com/kw78/dsh-office-tools/actions/workflows/ci.yml) [](LICENSE) [](https://awesome-dsh-plugin.com)
|
|
6
6
|
|
|
7
7
|
> Install: `dsh plugin --profile web add github:kw78/dsh-office-tools`
|
|
8
8
|
|
|
@@ -20,7 +20,7 @@ Seven model-facing Office file tools for DeepSeek Harness, running entirely in t
|
|
|
20
20
|
|
|
21
21
|
The plugin follows the standard DSH host-plugin contract:
|
|
22
22
|
|
|
23
|
-
- It exports `name` / `inject` / `apply`; `inject = ['tools']` is its only runtime service dependency (`@deepseek-ai/dsh-tools`).
|
|
23
|
+
- It exports `name` / `inject` / `apply` / `Config`; `inject = ['tools']` is its only runtime service dependency (`@deepseek-ai/dsh-tools`).
|
|
24
24
|
- `apply(ctx)` wraps every `ctx.tools.register(defineTool({...}))` in `ctx.effect(...)` so Cordis disposes the registrations with the plugin fiber.
|
|
25
25
|
- `defineTool` declares model-visible `parameters`, a validated canonical `output.schema`, and a pure `output.render` text projection.
|
|
26
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.
|
|
@@ -39,13 +39,36 @@ Artifacts: `lib/index.js` (ESM host bundle with Office libraries inlined; `@deep
|
|
|
39
39
|
## Install
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
+
# npm (recommended)
|
|
43
|
+
dsh plugin --profile web add dsh-office-tools
|
|
44
|
+
|
|
45
|
+
# GitHub source
|
|
42
46
|
dsh plugin --profile web add github:kw78/dsh-office-tools
|
|
43
|
-
|
|
47
|
+
|
|
48
|
+
# local checkout
|
|
44
49
|
dsh plugin --profile web add /path/to/dsh-office-tools
|
|
45
50
|
```
|
|
46
51
|
|
|
47
52
|
Restart the DSH server after installation. The seven tools appear in the next prompt assembly.
|
|
48
53
|
|
|
54
|
+
## Configuration
|
|
55
|
+
|
|
56
|
+
The plugin declares a schemastery `Config` the Loader validates at load time. One option exists today:
|
|
57
|
+
|
|
58
|
+
| Option | Type | Default | Effect |
|
|
59
|
+
|---|---|---|---|
|
|
60
|
+
| `enablePptTools` | boolean | `true` | Register `ppt_create` / `ppt_read`. Set to `false` to load this plugin for Word/Excel only. |
|
|
61
|
+
|
|
62
|
+
`enablePptTools: false` exists for coexistence: dedicated presentation plugins such as dsh-ppt also register a `ppt_create`, and DSH refuses duplicate tool names at startup (`tool "ppt_create" is already registered`). Disable the PPT pair here and let the dedicated plugin own presentations:
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
65
|
+
# profile cordis.patch.yml
|
|
66
|
+
- insert:
|
|
67
|
+
- id: dsh-office-tools
|
|
68
|
+
config:
|
|
69
|
+
enablePptTools: false
|
|
70
|
+
```
|
|
71
|
+
|
|
49
72
|
## Community indexes
|
|
50
73
|
|
|
51
74
|
- Registration blocks for awesome-dsh-plugin / dsh-market are in [docs/hub-registration.md](docs/hub-registration.md).
|
|
@@ -57,3 +80,4 @@ Restart the DSH server after installation. The seven tools appear in the next pr
|
|
|
57
80
|
- Reads are capped at 50 MiB; text/cell results are bounded and mark `truncated`.
|
|
58
81
|
- Creates/updates are bounded by row and cell limits and refuse overwrites by default.
|
|
59
82
|
- No LibreOffice/PowerPoint/Word subprocess is spawned; formats are generated and parsed with pure-JS libraries.
|
|
83
|
+
- SheetJS is pinned to the 0.20.3 tarball from the official CDN (<https://cdn.sheetjs.com>): npm stopped at 0.18.5, which carries CVE-2023-30533 (prototype pollution) and CVE-2024-22363 (ReDoS). The library is inlined into `lib/index.js` at build time and never resolved at runtime, so installs of the published plugin do not touch the CDN.
|
package/README.zh.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
为 DeepSeek Harness 提供 7 个模型可调用的 Office 文件工具,全部运行在 host 半。
|
|
4
4
|
|
|
5
|
-
[](https://github.com/kw78/dsh-office-tools/actions/workflows/ci.yml) [](LICENSE) [](https://awesome-dsh-plugin.com)
|
|
5
|
+
[](https://www.npmjs.com/package/dsh-office-tools) [](https://github.com/kw78/dsh-office-tools/actions/workflows/ci.yml) [](LICENSE) [](https://awesome-dsh-plugin.com)
|
|
6
6
|
|
|
7
7
|
> 安装:`dsh plugin --profile web add github:kw78/dsh-office-tools`
|
|
8
8
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
插件遵循 DSH 标准 host 插件契约:
|
|
22
22
|
|
|
23
|
-
- 模块导出 `name` / `inject` / `apply`;本插件 `inject = ['tools']`,唯一运行时依赖是 `ctx.tools`(`@deepseek-ai/dsh-tools`)。
|
|
23
|
+
- 模块导出 `name` / `inject` / `apply` / `Config`;本插件 `inject = ['tools']`,唯一运行时依赖是 `ctx.tools`(`@deepseek-ai/dsh-tools`)。
|
|
24
24
|
- `apply(ctx)` 中用 `ctx.effect(() => ...)` 包裹 `ctx.tools.register(defineTool({...}))`,Cordis fiber 卸载时自动 dispose。
|
|
25
25
|
- `defineTool` 统一声明 `parameters`(模型可见 JSON Schema)、`output.schema`(强制校验的规范 JSON 值)与 `output.render`(模型看到的文本投影)。
|
|
26
26
|
- 每个 `execute(args, exec)` 从 `exec.agent.session.header.cwd` 取会话工作目录;相对路径按该目录解析,绝对路径只接受仍位于工作目录内的路径,并对最近存在的祖先做 `realpath` 校验防止符号链接逃逸。
|
|
@@ -39,13 +39,36 @@ pnpm run check # typecheck + tests + build
|
|
|
39
39
|
## 安装
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
+
# npm(推荐)
|
|
43
|
+
dsh plugin --profile web add dsh-office-tools
|
|
44
|
+
|
|
45
|
+
# GitHub 源码
|
|
42
46
|
dsh plugin --profile web add github:kw78/dsh-office-tools
|
|
43
|
-
|
|
47
|
+
|
|
48
|
+
# 本地目录
|
|
44
49
|
dsh plugin --profile web add /path/to/dsh-office-tools
|
|
45
50
|
```
|
|
46
51
|
|
|
47
52
|
安装后重启 DSH 服务。模型下一次组装提示词时即可看到 7 个工具。
|
|
48
53
|
|
|
54
|
+
## 配置
|
|
55
|
+
|
|
56
|
+
插件通过 schemastery 声明 `Config`,由 Loader 在加载时校验。当前只有一个选项:
|
|
57
|
+
|
|
58
|
+
| 选项 | 类型 | 默认值 | 作用 |
|
|
59
|
+
|---|---|---|---|
|
|
60
|
+
| `enablePptTools` | boolean | `true` | 注册 `ppt_create` / `ppt_read`。设为 `false` 时本插件只提供 Word/Excel 工具。 |
|
|
61
|
+
|
|
62
|
+
`enablePptTools: false` 为共存而生:dsh-ppt 等专注演示文稿的插件同样会注册 `ppt_create`,而 DSH 在启动时拒绝同名工具(`tool "ppt_create" is already registered`)。关掉本插件的 PPT 工具对,把演示文稿交给专用插件:
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
65
|
+
# profile 的 cordis.patch.yml
|
|
66
|
+
- insert:
|
|
67
|
+
- id: dsh-office-tools
|
|
68
|
+
config:
|
|
69
|
+
enablePptTools: false
|
|
70
|
+
```
|
|
71
|
+
|
|
49
72
|
## 社区索引
|
|
50
73
|
|
|
51
74
|
- awesome-dsh-plugin / dsh-market 的登记块见 [docs/hub-registration.md](docs/hub-registration.md)。
|
|
@@ -57,3 +80,4 @@ dsh plugin --profile web add /path/to/dsh-office-tools
|
|
|
57
80
|
- 读取文件上限 50 MiB,文本/单元格结果有上限并标记 `truncated`。
|
|
58
81
|
- 创建/更新有行数、单元格数上限,且默认不覆盖已有文件。
|
|
59
82
|
- 不调用 LibreOffice / PowerPoint / Word 等外部进程,所有格式均通过纯 JS 库生成/解析。
|
|
83
|
+
- SheetJS 固定为官方 CDN(<https://cdn.sheetjs.com>)的 0.20.3 tarball:npm 停留在 0.18.5,该版本携带 CVE-2023-30533(原型污染)与 CVE-2024-22363(ReDoS)。该库在构建时内联进 `lib/index.js`、运行时从不解析,因此安装已发布的插件不需要访问 CDN。
|
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-office-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"description": "Office tools for the model: create, read, and update Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) files inside the session workspace.",
|
|
6
6
|
"engines": {
|