dsh-pdf-mineru 0.0.1 → 0.0.4
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 +53 -0
- package/README.md +274 -50
- package/cordis.patch.yml +4 -0
- package/lib/client.js +924 -1110
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +445 -198
- package/lib/index.js +3164 -3090
- package/package.json +25 -19
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.0.4
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- MinerU API keys can now be stored and managed through the DSH credentials service while configuration retains only credential references.
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Official v4 health checks now recognize MinerU's current `-60012` missing-task probe sentinel while continuing to reject unrelated business errors.
|
|
12
|
+
- Persisted user settings are resolved before the storage root is fixed, preserving Provider and parsing configuration across rebuilds, reinstalls, upgrades, and process reloads.
|
|
13
|
+
- Configuration saves can no longer report success after changing only in-memory state; every successful save now completes through the settings persistence scope.
|
|
14
|
+
|
|
15
|
+
## 0.0.3
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Async parsing now registers native DSH `mineru-N` background jobs with owner isolation, completion delivery, `job_output`, and `job_kill`; plugin `mj_` session Jobs were removed.
|
|
20
|
+
- Synchronous parsing returns immutable results directly without creating a Job. `mineru_get_parse_status` and `mineru_get_parse_result` were removed in favor of generic DSH job controls.
|
|
21
|
+
- The default cache root is now `$DSH_HOME/cache/pdf-mineru`; existing `$DSH_HOME/dsh-pdf-mineru/v1` data is not migrated automatically.
|
|
22
|
+
- Shared operation shutdown now waits for background provider runners before the storage process lock is released.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- Multi-file document parsing support across tools and provider adapters.
|
|
27
|
+
- GitHub Actions workflow for automated npm publishing on tagged releases.
|
|
28
|
+
- Bounded, abort-aware retries for idempotent Provider GET operations and official presigned PUT uploads.
|
|
29
|
+
- Retry-After handling, exponential backoff with jitter, live retry settings, and typed structured diagnostics.
|
|
30
|
+
- An opt-in official v4 smoke command that executes the built `mineru_parse_document` tool chain.
|
|
31
|
+
- Loopback storage statistics, read-only integrity scanning, bounded quarantine management, and fail-closed GC preview.
|
|
32
|
+
- Storage operations in the settings UI with dry-run cleanup and explicit deletion confirmation.
|
|
33
|
+
- A preview-first, confirmation-gated cache clear operation that evicts all safely scanned published results while no SharedOperation or storage reader is active.
|
|
34
|
+
|
|
35
|
+
### Notes
|
|
36
|
+
|
|
37
|
+
- Published result inspection now has a strict non-mutating path and rejects symlinked or undeclared tree entries.
|
|
38
|
+
- The GUI verifier injects the current workspace bundle into an isolated existing-shell boot graph and covers desktop/mobile maintenance workflows.
|
|
39
|
+
- CSS module names always start with a valid identifier prefix.
|
|
40
|
+
|
|
41
|
+
### Security
|
|
42
|
+
|
|
43
|
+
- Official batch-allocation POST and self-hosted multipart POST are never automatically retried.
|
|
44
|
+
- Retry diagnostics no longer carry free-form upstream error strings, URLs, headers, bodies, credentials, or local paths.
|
|
45
|
+
- Quarantine isolation accepts only complete staging-operation or content-addressed result directories.
|
|
46
|
+
- Maintenance scans read manifests with bounded limits and no longer depend on plugin Job references.
|
|
47
|
+
- Destructive maintenance remains loopback-only and confirmation-gated. GC remains preview-only; explicit cache clearing fails closed for active SharedOperations, storage readers, incomplete scans, and unsafe result trees.
|
|
48
|
+
|
|
49
|
+
No canonical request, CacheKey, ProviderJobRef, or result manifest schema version changed.
|
|
50
|
+
|
|
51
|
+
## 0.0.1
|
|
52
|
+
|
|
53
|
+
- Initial npm release with provider-independent tools, self-hosted v2 and official v4 adapters, session Jobs, immutable global results, request coalescing, restart recovery, safe ZIP extraction, and Provider-aware settings.
|
package/README.md
CHANGED
|
@@ -1,35 +1,178 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# dsh-pdf-mineru
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
**让 DeepSeek Harness 以统一方式使用 MinerU 解析文档**
|
|
6
|
+
|
|
7
|
+
自托管 MinerU v2 与官方云 v4,共用同一套模型工具、原生后台任务和不可变结果缓存。
|
|
8
|
+
|
|
9
|
+
<p>
|
|
10
|
+
<a href="https://www.npmjs.com/package/dsh-pdf-mineru"><img src="https://img.shields.io/npm/v/dsh-pdf-mineru?style=flat-square&label=npm&color=CB3837" alt="npm version"></a>
|
|
11
|
+
<a href="./package.json"><img src="https://img.shields.io/badge/Node.js-%3E%3D18-339933?style=flat-square&logo=nodedotjs&logoColor=white" alt="Node.js 18 or newer"></a>
|
|
12
|
+
<img src="https://img.shields.io/badge/DSH-native%20jobs-111827?style=flat-square" alt="DSH native jobs">
|
|
13
|
+
<img src="https://img.shields.io/badge/MinerU-v2%20%7C%20v4-2563EB?style=flat-square" alt="MinerU v2 and v4">
|
|
14
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-2EA44F?style=flat-square" alt="MIT License"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
[快速开始](#快速开始) · [核心能力](#核心能力) · [模型工具](#模型工具) · [Provider](#provider-对照) · [配置](#配置) · [安全与存储](#安全与存储) · [开发](#开发与验证)
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<img src="./docs/assets/mineru-settings-preview.png" width="800" alt="dsh-pdf-mineru 在 DSH Settings 中的 Provider 与解析默认值界面">
|
|
23
|
+
</p>
|
|
24
|
+
<p align="center"><sub>Provider 与解析默认值的可视化配置;同一页面还提供缓存、重试、安全限制和存储运维。</sub></p>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
一个插件,两个 Provider,三项模型工具。模型不需要理解上游的 task ID、batch ID、预签名上传地址、状态 URL 或 ZIP 结构,只需要选择同步直返或 DSH 原生后台任务。
|
|
4
29
|
|
|
5
|
-
|
|
30
|
+
> [!NOTE]
|
|
31
|
+
> 本项目是独立维护的 DSH 社区插件。Provider 只负责适配 MinerU 上游协议,DSH Job、缓存、安全边界和工具输出由插件统一管理。
|
|
6
32
|
|
|
7
|
-
|
|
8
|
-
- 官方 v4:`POST /file-urls/batch`、裸 PUT 上传、`GET /extract-results/batch/{batch_id}`、安全 ZIP 收集。
|
|
9
|
-
- 会话 Job:每次提交创建独立 `job_id`,只能由创建它的 DSH Session 查询。
|
|
10
|
-
- 全局结果缓存:按源 SHA-256、规范解析语义、产物集合、Provider compatibility key 和 schema 版本寻址。
|
|
11
|
-
- 单进程请求合并:相同 CacheKey 只提交一次上游解析,每个会话仍保留独立 Job;单个等待者取消不取消 producer。
|
|
12
|
-
- 持久恢复:上游接受任务后立即持久化不含秘密的 ProviderJobRef,重启后可继续轮询和收集。
|
|
13
|
-
- staging、完整校验、原子 rename 发布、损坏缓存隔离和 storageRoot 进程锁。
|
|
33
|
+
## 快速开始
|
|
14
34
|
|
|
15
|
-
|
|
35
|
+
### 1. 安装
|
|
16
36
|
|
|
17
|
-
|
|
37
|
+
DeepSeek Harness 的 Web profile 可以直接安装 npm 包:
|
|
18
38
|
|
|
19
39
|
```sh
|
|
20
40
|
dsh plugin --profile web add dsh-pdf-mineru
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
本地开发或测试 checkout:
|
|
21
44
|
|
|
22
|
-
|
|
45
|
+
```sh
|
|
23
46
|
dsh plugin --profile web add link:/absolute/path/to/dsh-pdf-mineru
|
|
24
47
|
```
|
|
25
48
|
|
|
26
|
-
|
|
49
|
+
> [!TIP]
|
|
50
|
+
> 使用 pnpm 10+ 从源码安装时,需要在 profile 的 `pnpm-workspace.yaml` 中显式允许所需构建脚本。
|
|
51
|
+
|
|
52
|
+
### 2. 连接 MinerU
|
|
53
|
+
|
|
54
|
+
打开 **Settings → MinerU**,选择活动 Provider:
|
|
55
|
+
|
|
56
|
+
- **Self-hosted v2**:默认连接 `http://localhost:18000`,本地 HTTP 需要显式启用 `Allow Insecure HTTP`。
|
|
57
|
+
- **Official v4**:默认连接 `https://mineru.net/api/v4`,并通过 DSH Credential 或环境变量提供 Token。
|
|
58
|
+
|
|
59
|
+
官方云最小凭据配置:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
export MINERU_API_KEY="your-token"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
在 Settings 中将 **API Key Env Var** 保持为 `MINERU_API_KEY`,点击 **Test Active Provider** 验证连通性与鉴权。
|
|
66
|
+
|
|
67
|
+
### 3. 交给 Agent
|
|
68
|
+
|
|
69
|
+
直接描述需要解析的本地文档和期望产物,例如:
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
请用 MinerU 解析 /absolute/path/to/paper.pdf,保留 Markdown、图片和 content list。
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
长文档或不希望阻塞当前回合时:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
把 /absolute/path/to/report.pdf 作为 MinerU 后台任务解析,完成后读取结果。
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Agent 会根据任务选择 `mineru_parse_document` 或 `mineru_submit_parse_job`。异步任务由 DSH 通用的 `job_output`、`job_list` 和 `job_kill` 管理。
|
|
82
|
+
|
|
83
|
+
## 核心能力
|
|
84
|
+
|
|
85
|
+
<table>
|
|
86
|
+
<tr>
|
|
87
|
+
<td width="50%" valign="top"><strong>DSH 原生后台任务</strong><br><br>异步解析注册为 `mineru-N` Job。DSH 负责 owner 隔离、完成通知、结果读取和取消,插件不维护第二套会话 Job。</td>
|
|
88
|
+
<td width="50%" valign="top"><strong>同步直接返回结果</strong><br><br>`mineru_parse_document` 直接返回 Markdown preview、immutable manifest 和产物路径,不创建插件 Job。</td>
|
|
89
|
+
</tr>
|
|
90
|
+
<tr>
|
|
91
|
+
<td width="50%" valign="top"><strong>双 Provider 统一接口</strong><br><br>同一套 `pipeline` / `vlm` 语义适配自托管 FastAPI v2 和 MinerU 官方云 v4,协议字段不会进入模型上下文。</td>
|
|
92
|
+
<td width="50%" valign="top"><strong>不可变内容寻址缓存</strong><br><br>源文件 SHA-256、解析语义、产物集合、Provider compatibility key 和 schema 版本共同决定 CacheKey。</td>
|
|
93
|
+
</tr>
|
|
94
|
+
<tr>
|
|
95
|
+
<td width="50%" valign="top"><strong>并发请求合并</strong><br><br>同一进程内,相同 CacheKey 只产生一个上游解析。单个等待者超时或取消不会破坏其他调用共享的 producer。</td>
|
|
96
|
+
<td width="50%" valign="top"><strong>受控发布与运维</strong><br><br>产物经过 staging 校验和同文件系统原子 rename 后发布;Settings 提供统计、完整性扫描、GC preview、缓存清理和 quarantine 管理。</td>
|
|
97
|
+
</tr>
|
|
98
|
+
</table>
|
|
99
|
+
|
|
100
|
+
## 模型工具
|
|
101
|
+
|
|
102
|
+
插件只暴露三项 MinerU 工具:
|
|
103
|
+
|
|
104
|
+
| 工具 | 行为 | 返回值 |
|
|
105
|
+
| --- | --- | --- |
|
|
106
|
+
| `mineru_health` | 探测活动 Provider 的连通性、鉴权、协议版本和可用队列信息 | 结构化健康状态 |
|
|
107
|
+
| `mineru_parse_document` | 同步等待解析;超时只结束当前等待,不终止共享 producer | immutable result、Markdown preview、manifest 与产物路径 |
|
|
108
|
+
| `mineru_submit_parse_job` | 注册原生 DSH 后台任务并立即返回 | `mineru-N`,最终输出由通用 Job 工具读取 |
|
|
109
|
+
|
|
110
|
+
### 解析参数
|
|
111
|
+
|
|
112
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
113
|
+
| --- | --- | --- | --- |
|
|
114
|
+
| `file_paths` | `string[]` | 必填 | 本地文档路径。支持批量数组,默认安全上限为 1,可通过 `limits.maxFilesPerRequest` 调整 |
|
|
115
|
+
| `model` | `pipeline` / `vlm` | Settings 默认值 | 统一解析模型 |
|
|
116
|
+
| `ocr` | `boolean` | `false` | 对全部页面强制 OCR |
|
|
117
|
+
| `language` | `string` | `ch` | MinerU 语言提示代码 |
|
|
118
|
+
| `formula` | `boolean` | `true` | 识别数学公式 |
|
|
119
|
+
| `table` | `boolean` | `true` | 识别表格结构 |
|
|
120
|
+
| `pages` | `string` | 全部页面 | 1-based 页码范围,例如 `1-10,15` |
|
|
121
|
+
| `artifacts` | `string[]` | `["markdown"]` | `markdown`、`layout`、`model-output`、`content-list`、`images` |
|
|
122
|
+
| `poll_timeout_ms` | `integer` | `600000` | 仅同步工具使用;限制本次等待时间 |
|
|
123
|
+
|
|
124
|
+
Markdown 始终包含在规范化产物集合中。大段 preview 会按配置截断,完整产物仍保存在 result manifest 指向的路径中。
|
|
125
|
+
|
|
126
|
+
## 工作方式
|
|
127
|
+
|
|
128
|
+
```mermaid
|
|
129
|
+
flowchart LR
|
|
130
|
+
Agent[DSH Agent] --> Health[mineru_health]
|
|
131
|
+
Agent --> Sync[mineru_parse_document]
|
|
132
|
+
Agent --> Async[mineru_submit_parse_job]
|
|
133
|
+
|
|
134
|
+
Async --> Jobs[DSH JobRegistry]
|
|
135
|
+
Jobs --> Service[MinerUService]
|
|
136
|
+
Sync --> Service
|
|
137
|
+
Health --> Providers[ProviderRegistry]
|
|
138
|
+
|
|
139
|
+
Service --> Cache{Result cache}
|
|
140
|
+
Cache -->|hit| Result[Immutable result]
|
|
141
|
+
Cache -->|miss| Shared[SharedOperationRegistry]
|
|
142
|
+
Shared --> Providers
|
|
143
|
+
Providers --> V2[Self-hosted v2]
|
|
144
|
+
Providers --> V4[Official v4]
|
|
145
|
+
V2 --> Staging[Validated staging]
|
|
146
|
+
V4 --> Staging
|
|
147
|
+
Staging --> Publish[Atomic publish]
|
|
148
|
+
Publish --> Result
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
- **RequestNormalizer** 规范参数、页码范围和产物集合,并流式计算源文件 SHA-256。
|
|
152
|
+
- **ResultRepository** 校验并读取不可变结果;源文件绝对路径不会写入规范请求或 manifest。
|
|
153
|
+
- **SharedOperationRegistry** 只在当前进程内合并相同请求,不提供跨进程协调。
|
|
154
|
+
- **ProviderRegistry** 在一次操作生命周期内固定 Provider 配置,避免任务中途切换后端。
|
|
155
|
+
|
|
156
|
+
## Provider 对照
|
|
157
|
+
|
|
158
|
+
| | Self-hosted MinerU v2 | Official MinerU v4 |
|
|
159
|
+
| --- | --- | --- |
|
|
160
|
+
| Provider ID | `self-hosted-v2` | `official-v4` |
|
|
161
|
+
| 提交方式 | 流式 multipart `POST /tasks` | 申请预签名地址后执行裸 `PUT` |
|
|
162
|
+
| 状态与结果 | 轮询任务并收集 JSON | 轮询 batch,下载并安全解包 ZIP |
|
|
163
|
+
| 模型 | 通过 `modelMap` 显式映射 `pipeline` / `vlm` | 原生 `pipeline` / `vlm` |
|
|
164
|
+
| parse method | `auto`、`ocr`、`txt` | `auto`、`ocr`;`txt` 会明确失败 |
|
|
165
|
+
| HTTP | 本地部署可显式允许 HTTP | 强制 HTTPS |
|
|
166
|
+
| 上游限制 | 取决于服务端配置与插件安全限制 | 单文件不超过 200 MB、200 页 |
|
|
167
|
+
|
|
168
|
+
Provider 不注册工具、不访问 DSH Session、不决定存储路径,也不生成模型文案。它只负责上游协议转换、轮询与产物收集。
|
|
27
169
|
|
|
28
170
|
## 配置
|
|
29
171
|
|
|
30
|
-
|
|
172
|
+
推荐通过 **Settings → MinerU** 编辑配置。Provider、解析默认值、轮询、重试和输出限制对新任务实时生效;`storageRoot` 变更需要重启插件进程。
|
|
31
173
|
|
|
32
|
-
|
|
174
|
+
<details>
|
|
175
|
+
<summary><strong>Self-hosted v2 最小配置</strong></summary>
|
|
33
176
|
|
|
34
177
|
```yaml
|
|
35
178
|
schemaVersion: 1
|
|
@@ -51,11 +194,18 @@ defaults:
|
|
|
51
194
|
formula: true
|
|
52
195
|
table: true
|
|
53
196
|
artifacts: [markdown]
|
|
197
|
+
retry:
|
|
198
|
+
maxAttempts: 3
|
|
199
|
+
baseDelayMs: 500
|
|
200
|
+
maxDelayMs: 10000
|
|
54
201
|
```
|
|
55
202
|
|
|
56
|
-
`modelMap`
|
|
203
|
+
`modelMap` 不会猜测或静默降级。可将统一的 `vlm` 显式映射到 `hybrid-engine`、`vlm-engine` 或服务端实际提供的后端名称。
|
|
204
|
+
|
|
205
|
+
</details>
|
|
57
206
|
|
|
58
|
-
|
|
207
|
+
<details>
|
|
208
|
+
<summary><strong>Official v4 最小配置</strong></summary>
|
|
59
209
|
|
|
60
210
|
```yaml
|
|
61
211
|
schemaVersion: 1
|
|
@@ -77,46 +227,117 @@ defaults:
|
|
|
77
227
|
artifacts: [markdown]
|
|
78
228
|
```
|
|
79
229
|
|
|
80
|
-
|
|
230
|
+
Official v4 无法表达自托管专用的 `parseMethod: txt`。插件会返回明确错误,不会将其等同于 `ocr: false`。
|
|
231
|
+
|
|
232
|
+
</details>
|
|
233
|
+
|
|
234
|
+
<details>
|
|
235
|
+
<summary><strong>完整运行限制与存储配置</strong></summary>
|
|
236
|
+
|
|
237
|
+
```yaml
|
|
238
|
+
storage:
|
|
239
|
+
storageRoot: /absolute/path/to/dsh/cache/pdf-mineru
|
|
240
|
+
cacheEnabled: true
|
|
241
|
+
retainSources: false
|
|
242
|
+
stagingTtlMs: 86400000
|
|
243
|
+
|
|
244
|
+
polling:
|
|
245
|
+
pollIntervalMs: 2000
|
|
246
|
+
pollTimeoutMs: 600000
|
|
247
|
+
requestTimeoutMs: 60000
|
|
248
|
+
operationTimeoutMs: 3600000
|
|
249
|
+
|
|
250
|
+
retry:
|
|
251
|
+
maxAttempts: 3
|
|
252
|
+
baseDelayMs: 500
|
|
253
|
+
maxDelayMs: 10000
|
|
254
|
+
|
|
255
|
+
output:
|
|
256
|
+
maxInlineChars: 200000
|
|
257
|
+
|
|
258
|
+
limits:
|
|
259
|
+
maxFilesPerRequest: 1
|
|
260
|
+
maxFileBytes: 209715200
|
|
261
|
+
maxApiResponseBytes: 8388608
|
|
262
|
+
maxZipDownloadBytes: 536870912
|
|
263
|
+
maxZipEntries: 10000
|
|
264
|
+
maxZipEntryBytes: 268435456
|
|
265
|
+
maxZipTotalBytes: 2147483648
|
|
266
|
+
maxZipCompressionRatio: 200
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
`storageRoot` 必须使用绝对路径。默认值为 `$DSH_HOME/cache/pdf-mineru`;未设置 `DSH_HOME` 时使用 `~/.dsh/cache/pdf-mineru`。
|
|
270
|
+
|
|
271
|
+
</details>
|
|
81
272
|
|
|
82
|
-
|
|
273
|
+
配置只保存 Credential reference,例如 `MINERU_API_KEY`。每次 Provider 调用时,插件先从 DSH Credential Service 解析,再回退到同名环境变量;Token 值不会写入配置或缓存。
|
|
83
274
|
|
|
84
|
-
|
|
275
|
+
## 安全与存储
|
|
276
|
+
|
|
277
|
+
### 内容寻址结果
|
|
85
278
|
|
|
86
279
|
```text
|
|
87
|
-
|
|
88
|
-
results/sha256/<prefix>/<cache-key>/manifest.json
|
|
89
|
-
staging/<operation-id>/
|
|
90
|
-
quarantine/<timestamp_reason_id>/
|
|
91
|
-
.process.lock
|
|
280
|
+
$DSH_HOME/cache/pdf-mineru/
|
|
281
|
+
├── results/sha256/<prefix>/<cache-key>/manifest.json
|
|
282
|
+
├── staging/<operation-id>/
|
|
283
|
+
├── quarantine/<timestamp_reason_id>/
|
|
284
|
+
└── .process.lock
|
|
92
285
|
```
|
|
93
286
|
|
|
94
|
-
|
|
287
|
+
- 已发布结果按单文件保存且不可修改,批量请求按文件 fan-out。
|
|
288
|
+
- staging 通过校验后只允许同文件系统原子 rename;`EXDEV` 不会退化为复制。
|
|
289
|
+
- 一个 `storageRoot` 同时只能由一个 DSH 进程持有。
|
|
290
|
+
- DSH JobRegistry 与 SharedOperation 是进程内状态;不可变结果在进程或 Session 结束后仍可复用。
|
|
95
291
|
|
|
96
|
-
|
|
292
|
+
<details>
|
|
293
|
+
<summary><strong>网络与凭据边界</strong></summary>
|
|
97
294
|
|
|
98
|
-
|
|
295
|
+
- Credential 每次 Provider 调用解析,不缓存、不持久化 Token 值。
|
|
296
|
+
- 携带鉴权的 API 请求使用 `redirect: error`。
|
|
297
|
+
- Official v4 预签名 PUT 使用独立请求构造器和显式空 headers,不携带 Authorization 或默认头。
|
|
298
|
+
- CDN 结果下载不携带 API Token,并禁止重定向。
|
|
299
|
+
- 仅幂等 GET 和可重新打开源文件流的官方 PUT 使用有界重试;批次申请 POST 和自托管 multipart POST 不自动重放。
|
|
300
|
+
- 结构化诊断只保留 operation、Provider、阶段、状态、耗时、字节和重试计数等类型化字段,不记录 URL、headers、body、Credential 或本地路径。
|
|
301
|
+
|
|
302
|
+
</details>
|
|
303
|
+
|
|
304
|
+
<details>
|
|
305
|
+
<summary><strong>Official v4 ZIP 边界</strong></summary>
|
|
306
|
+
|
|
307
|
+
ZIP 中央目录会先经过元数据和资源限制检查,再逐 entry 流式写入 staging。插件拒绝:
|
|
308
|
+
|
|
309
|
+
- 绝对路径、`..`、NUL、反斜杠和驱动器路径;
|
|
310
|
+
- 符号链接、非普通条目和加密条目;
|
|
311
|
+
- 超出 entry 数、单 entry 字节、总解压字节或压缩比限制的归档。
|
|
312
|
+
|
|
313
|
+
整个归档和大 entry 不会被一次性累积到内存中。
|
|
99
314
|
|
|
100
|
-
|
|
315
|
+
</details>
|
|
101
316
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
- `mineru_get_parse_status`:返回统一 Job 状态和逐文件状态。
|
|
105
|
-
- `mineru_get_parse_result`:返回受限 Markdown preview、manifest 路径和产物路径。
|
|
106
|
-
- `mineru_parse_document`:submit、等待、result 的组合工具;等待超时保留 Job,可稍后继续查询。
|
|
317
|
+
<details>
|
|
318
|
+
<summary><strong>可视化存储运维</strong></summary>
|
|
107
319
|
|
|
108
|
-
|
|
320
|
+
Settings 中的存储操作均为按需执行,不会在后台自动扫描磁盘:
|
|
109
321
|
|
|
110
|
-
|
|
322
|
+
- **Refresh Statistics**:统计 results、staging 和 quarantine。
|
|
323
|
+
- **Verify Cache**:默认只读检查 manifest 和声明的产物。
|
|
324
|
+
- **Preview GC**:只生成候选预览,不删除已发布结果。
|
|
325
|
+
- **Clear Cache**:预览后需要二次确认;存在活动 SharedOperation、存储 reader、扫描截断或不安全目录时 fail closed。
|
|
326
|
+
- **List Quarantine**:列出隔离项;清理默认 dry-run,实际删除需要明确选择和二次确认。
|
|
111
327
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
328
|
+
维护 RPC 只注册在 loopback 连接上,不作为模型工具暴露。
|
|
329
|
+
|
|
330
|
+
</details>
|
|
331
|
+
|
|
332
|
+
> [!IMPORTANT]
|
|
333
|
+
> 同步等待超时或 `job_kill` 只停止该调用的等待。若同一 SharedOperation 仍被其他调用依赖,上游 producer 会继续执行并发布缓存结果。
|
|
334
|
+
|
|
335
|
+
## 兼容性说明
|
|
336
|
+
|
|
337
|
+
- 当前只接受 Provider-based canonical config,不兼容旧 flat config。
|
|
338
|
+
- `mineru_get_parse_status` 和 `mineru_get_parse_result` 已移除;异步任务使用 DSH 通用 Job 工具。
|
|
339
|
+
- 默认缓存根目录为 `$DSH_HOME/cache/pdf-mineru`,旧目录不会自动迁移。
|
|
340
|
+
- 缓存不会在不同 DSH 实例之间自动共享;跨进程请求也不会合并。
|
|
120
341
|
|
|
121
342
|
## 开发与验证
|
|
122
343
|
|
|
@@ -128,15 +349,18 @@ pnpm run build
|
|
|
128
349
|
git diff --check
|
|
129
350
|
|
|
130
351
|
# 在已运行的 DSH Web shell 中隔离加载当前 client bundle
|
|
131
|
-
|
|
352
|
+
pnpm run verify:gui
|
|
353
|
+
|
|
354
|
+
# 显式执行 Official v4 真实链路 smoke
|
|
355
|
+
MINERU_API_KEY=<token> pnpm run smoke:official-v4 -- /absolute/path/sample.pdf
|
|
132
356
|
```
|
|
133
357
|
|
|
134
|
-
|
|
358
|
+
默认测试使用 mock HTTP 和本地 ZIP fixture,不需要真实 Token。`smoke:official-v4` 必须显式提供真实 Token 和 PDF,不进入默认测试。
|
|
135
359
|
|
|
136
|
-
|
|
360
|
+
更深入的领域模型、缓存键、并发语义和安全约束见 [ARCHITECTURE.md](./ARCHITECTURE.md)。
|
|
137
361
|
|
|
138
|
-
|
|
362
|
+
## 许可证与致谢
|
|
139
363
|
|
|
140
|
-
|
|
364
|
+
本项目使用 [MIT License](./LICENSE) 开源。
|
|
141
365
|
|
|
142
|
-
感谢 [Huanlin/dsh-plugin-mineru](https://github.com/HuanLinOTO/dsh-plugin-mineru)
|
|
366
|
+
感谢 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 提供插件运行时,感谢 [MinerU](https://github.com/opendatalab/MinerU) 提供文档解析能力,也感谢 [Huanlin/dsh-plugin-mineru](https://github.com/HuanLinOTO/dsh-plugin-mineru) 带来的早期实现灵感。
|