dsh-mineru 0.1.13 → 0.1.15
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 +46 -3
- package/README.md +105 -11
- package/README.zh.md +76 -10
- package/RELEASE.md +2 -1
- package/lib/anchors.js +522 -0
- package/lib/artifacts.js +20 -0
- package/lib/chunk-merge.js +80 -0
- package/lib/client.js +27 -13
- package/lib/config.js +14 -11
- package/lib/http.js +15 -4
- package/lib/mineru-client.js +59 -6
- package/lib/page-ranges.js +204 -0
- package/lib/pdf-pages.js +151 -0
- package/lib/run-state.js +114 -0
- package/lib/skill.js +1 -1
- package/lib/tools.js +679 -26
- package/lib/types/client.d.ts +1 -1
- package/lib/types/index.d.ts +2 -0
- package/package.json +21 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,9 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to **dsh-mineru** are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/), and versioning follows [Semantic Versioning](https://semver.org/lang/zh-CN/). 版本号唯一来源是 `package.json`。
|
|
4
4
|
|
|
5
|
-
## [
|
|
5
|
+
## [0.1.15] - 2026-10-24
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- DSH `0.2.0-rc.1` is no longer silently skipped by the host compatibility gate: the six `@deepseek-ai/dsh-*` peers now declare `^0.1.5-rc.1 || ^0.2.0-rc.1` (previously `|| ^0.2.0-rc.2`), so every version from `0.2.0-rc.1` through the `0.2.x` line passes `evaluatePluginCompatibility`, while `0.3.0` prereleases stay excluded. Fixes #20.
|
|
10
|
+
|
|
11
|
+
## [0.1.14] - 2026-10-24
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Accept DSH `0.2.0-rc.2` through the actual runtime compatibility gate: all six `@deepseek-ai/dsh-*` peers now declare `^0.1.5-rc.1 || ^0.2.0-rc.2`. Preserve the legacy settings path, and pin development host packages to `0.2.0-rc.2` so regressions run against the target runtime rather than only mocked services.
|
|
16
|
+
- Validate live settings on the schema-derived settings path as well as the custom HTTP path. Numeric ranges, integer steps, language values, credential reference names and artifact directory names now reject invalid writes before persistence, including writes made through the native settings service.
|
|
17
|
+
- Restrict `/plugin/mineru/credential` writes to the configured `tokenCredential`. A request naming another reference is rejected instead of overwriting or deleting an unrelated credential; malformed credential bodies and array config patches return `400`.
|
|
18
|
+
- Register the browser's bilingual dictionaries only once. DSH rejects duplicate namespace/locale registrations, which previously skipped language binding and the locale watcher. Update browser declarations to use the current Cordis context instead of the removed `dsh-client-runtime` package.
|
|
19
|
+
- Keep JSON-request cancellation and timeouts active through response-body reads, and reject an already-cancelled call before sending it. Receiving headers alone no longer disables the deadline on a stalled response.
|
|
20
|
+
- Settings card (Web): the extra formats (docx/html/latex) checkboxes now read any persisted shape — an array, a scalar, or a string list — instead of treating every non-array value as "nothing checked", so a card saved on any host shows what is actually configured. The unsaved-changes indicator is now computed by diffing the current form against the server baseline read at load, not by a write flag, so touching a checkbox is no longer enough to light "有未保存的更改", and saving resets it even when the host echoes the same values back. Fixes #22.
|
|
21
|
+
|
|
22
|
+
### Development
|
|
23
|
+
|
|
24
|
+
- Add settings-card unit tests (`tests/settings-card.spec.js`): the shipped `client.js` bundle is sliced at its marked settings-view helper and executed in a sandbox, pinning the formats-normalization and dirty-flag contracts for the fix above.
|
|
25
|
+
- Add settings round-trip tests against the real 0.2.0-rc.2 host (`tests/settings-roundtrip.spec.js`): full and empty `extraFormats` patches persist and read back byte-identically through the settings service.
|
|
26
|
+
|
|
27
|
+
- Add real-runtime compatibility tests (`npm run test:compat`): package admission without exemptions, Loader activation, progressive tool visibility and disposal, settings persistence and stale-write conflicts, credential rotation and redaction, validation failures, and parsing through the real tool runtime with fetch-level simulated MinerU responses.
|
|
28
|
+
- Upgrade Vitest from `3.x` to patched `4.1.11+` and regenerate the lockfile against the target SDK. Development tests use supported Node.js 20.19+, 22.12+ or 24+ releases (24 recommended); the plugin runtime requirement remains Node.js 18+.
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- Automatic chunking for oversized precision requests: when one request would ask for more than 200 pages (a workspace PDF larger than that, or a `pageRanges` selection over 200 pages), `mineru_parse` splits it into sequential `page_ranges` chunks, submits and polls them one by one, and merges the outcome into the layout a single request produces — no new parameter, and no local PDF rewrite (the file is uploaded once, only the requested range changes per request). `full.md` is concatenated with one provenance line per chunk, `content_list.json` is merged with `page_idx` mapped back to the original document (the API renumbers it from 0 for every requested subset), `images/` is the union of all chunks, and `layout.json` / `<uuid>_model.json` stay per chunk under `chunks/chunk-<n>/` because they are page-indexed arrays. `run.json` and the tool result's new `chunkCount` / `chunks` fields report each chunk's page range, `batchId`, state and duration; a failed chunk reports its page range in the error.
|
|
33
|
+
- `lib/page-ranges.js` (split planning, negative-index resolution), `lib/chunk-merge.js` (subset-index remapping, `full.md` stitching) and `lib/pdf-pages.js` (local page-tree count: `/Type /Pages` `/Count`, `/Type /Page` leaves, deflate object streams) — pure modules, with vitest coverage and a fake-client test of the whole split-and-merge path.
|
|
34
|
+
- `mineru_parse` (and `mineru_batch_parse` / `mineru_task`) accept an optional `anchor` boolean, default `false`. With `anchor: true` a precision result additionally gets a `document.md` next to `full.md`: every block of `content_list.json` in order, preceded by one `<!-- pN bK -->` anchor, where `pN` is the page in the original document (1-based, mapped through `requestedPages[page_idx]` so discrete `pageRanges` such as `"2,4-6"` and chunked requests stay correct) and `bK` is the block's position inside that page. Text blocks render their text (a cloud heading level becomes the matching Markdown heading), tables render as caption plus `table_body`, images as ``, and blocks the cloud marked `[Unreadable]` — or left empty — keep their anchor instead of disappearing. The option is purely additive: `full.md`, `content_list.json` and `layout.json` keep their current shape, an Agent-API result (no `content_list.json`) only produces a warning, and the new file shows up in the artifact list.
|
|
35
|
+
- `tests/anchors.spec.js` (synthetic `content_list` fixtures) pins the anchor contract: 1-based pages, per-page block counters, page-internal ordering, discrete and negative `pageRanges`, table/image/heading/unreadable rendering, and the `p?` fallback; `tests/anchors-tool.spec.js` covers the `anchor: true` wiring (file written next to `full.md`, listed as an artifact, absent when the option is off, warning-only under the Agent API).
|
|
36
|
+
- Chunk-level resume + billing protection for oversized precision parses (`lib/run-state.js`): each chunk is snapshotted as soon as its result zip is extracted — a `.complete.json` marker is written last, and the downloaded `result.zip` is kept while the run is unfinished so an already-paid result is salvageable — and `run.json` is persisted after every chunk with a composite cache key (source sha256 + requested page spec + model + OCR + language) and per-chunk state. Re-running the same instruction aligns chunks by their page spec: a finished chunk is reused from its snapshot (zero network), a done chunk with an incomplete snapshot is re-downloaded through the original batch (poll + download, never re-uploaded), and only a cloud-failed chunk is re-submitted. A finished run is reused with no network calls; changing the model / page selection yields a fresh run. `tests/chunk-resume.spec.js` runs a real client against a fetch-level fake cloud and asserts the exact submit/upload/download accounting.
|
|
37
|
+
- Zero-quota end-to-end test assets (tests only, no runtime change): a **fetch-level fake cloud** (`tests/helpers/fake-cloud.js`) — replace global `fetch` and the real `MineruClient` runs its whole submit → signed upload → poll → download → unzip → merge path with no network. It keeps one batch per request in a Map (pages derived from `page_ranges`), exposes `calls = { submit, upload, poll, download }` so tests pin one upload/download per chunk with no silent re-upload, and injects poll counts, per-page-range failures, a missing `content_list.json`, malformed entry names, corrupt archives and custom content lists. `tests/helpers/zip.js` hand-builds valid ZIPs and a minimal parseable PDF. `tests/zero-quota-e2e.spec.js` (7 tests) covers a single request, a 250-page two-chunk merge with continuous p1–p250 anchors, a failed chunk, path-traversal / truncated archives and a missing content list. A real MinerU `content_list.json` (6-page public-domain sample; provenance in `tests/fixtures/real-bcgm-6p/NOTICE.md`) is replayed to a byte-identical `document.md`, guarding the anchor/page rendering against drift. Addresses #10.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- The tokenless Agent API is never split automatically: it is rate-limited per caller IP, so one call fanned out into a dozen requests would exhaust the caller's quota. Its `-30003` message now says so and points at Precision (where PDFs do split) or a manual `pageRange`.
|
|
42
|
+
- URL sources and formats whose page count cannot be read locally (docx/pptx/…) keep the single-request behaviour, and their `-60006` failure now names the reason no split happened. A single request — including one with an explicit `pageRanges` — keeps the cloud's own `page_idx`, exactly as before.
|
|
43
|
+
- A precision upload that settles as `failed` now raises the server's own reason (mapped `err_code`, else `err_msg`) as `MINERU_PARSE_FAILED`, the way `waitTask` already did, instead of the collector reporting a bare `state=failed`.
|
|
44
|
+
- A chunked parse no longer deletes its run directory on failure: it persists `status: partial` when at least one chunk finished (the completed chunks and snapshots are kept), else `status: failed`, then reports the error; re-running resumes in place and redoes only failed chunks. Single-request runs still clean up their directory on failure, exactly as before.
|
|
45
|
+
- Docs: bilingual README (page limits, `pageRanges`, long-PDF section, error table), the bundled `mineru-tools` skill content, and the AGENTS.md file map.
|
|
46
|
+
|
|
47
|
+
### Security
|
|
48
|
+
|
|
49
|
+
- Disclose that content leaves the machine: every parse (both Precision and Agent modes) uploads the full source file to a remote MinerU service and downloads the result, with no fully offline mode. The `package.json` description now states this (the one line visible in the plugin list / Settings), and both READMEs carry a top-of-page warning plus a new "Data flow / 数据流向" table — which operations leave the machine, the endpoints (`https://mineru.net`, `https://cdn-mineru.openxlab.org.cn`), token needs, and that no "local-only" mode exists. Addresses #6.
|
|
8
50
|
|
|
9
51
|
## [0.1.13] - 2026-09-25
|
|
10
52
|
|
|
@@ -108,7 +150,8 @@ All notable changes to **dsh-mineru** are documented here. The format follows [K
|
|
|
108
150
|
- 限流感知(令牌桶 + 429 退避 + 每日限额);
|
|
109
151
|
- Artifact 落地与 Web 界面(设置卡片、工具结果卡片、HMAC 签名预览)。
|
|
110
152
|
|
|
111
|
-
[0.1.
|
|
153
|
+
[0.1.14]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.14
|
|
154
|
+
[0.1.13]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.13
|
|
112
155
|
[0.1.12]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.12
|
|
113
156
|
[0.1.11]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.11
|
|
114
157
|
[0.1.10]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.10
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# dsh-mineru
|
|
2
2
|
|
|
3
3
|
[](LICENSE)
|
|
4
|
-
[](https://github.com/Lee-Hilex/dsh-mineru/releases)
|
|
5
|
+
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
6
6
|
[](https://mineru.net/apiManage/docs)
|
|
7
7
|
|
|
8
8
|
> Repository: <https://github.com/Lee-Hilex/dsh-mineru> · npm: [`dsh-mineru`](https://www.npmjs.com/package/dsh-mineru) · [Changelog](CHANGELOG.md)
|
|
@@ -11,6 +11,8 @@ English | [简体中文](README.zh.md)
|
|
|
11
11
|
|
|
12
12
|
**dsh-mineru** is a **MinerU-powered multimodal document parsing plugin** for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh): turn PDF, Word, PPT, Excel, HTML, and images into **structured Markdown**. Configure a MinerU token to use the 🎯 Precision API, or leave it blank and use the ⚡ Agent API (tokenless, IP rate-limited).
|
|
13
13
|
|
|
14
|
+
> ⚠️ **Data leaves this machine**: every parse uploads your file to MinerU's remote service — there is **no fully offline mode**. Do not use it for confidential / case material that must stay on-premises. See [Security model](#security-model).
|
|
15
|
+
|
|
14
16
|
## Contents
|
|
15
17
|
|
|
16
18
|
- [Overview](#overview) · [Quick start](#quick-start) · [Two API modes](#two-api-modes) · [Tools](#tools) · [Results & artifacts](#results--artifacts) · [Configuration](#configuration) · [Usage tips](#usage-tips) · [Web UI](#web-ui) · [Rate limits & reliability](#rate-limits--reliability) · [Error code reference](#error-code-reference) · [Security model](#security-model) · [FAQ](#faq) · [Development & publishing](#development--publishing) · [Contributing](#contributing) · [License](#license)
|
|
@@ -43,6 +45,7 @@ Typical use cases:
|
|
|
43
45
|
|
|
44
46
|
### Highlights
|
|
45
47
|
|
|
48
|
+
- **DSH 0.2.0-rc.2 compatibility** — tested with the real Loader, settings service and tool runtime; the `0.1.5-rc.x` peer range and legacy settings path are retained;
|
|
46
49
|
- **Dual API modes, auto-selected** — chooses Precision or Agent parsing based on whether a token is configured; can be overridden per call;
|
|
47
50
|
- **Progressive tool exposure** — only the tiny `mineru_activate` bootstrap is visible until the agent activates the full toolset, saving context;
|
|
48
51
|
- **Drag-and-drop uploads** — drop a file into the chat; its path lands in the composer draft so text-only models can process documents;
|
|
@@ -54,7 +57,7 @@ Typical use cases:
|
|
|
54
57
|
|
|
55
58
|
### Step 1: Install
|
|
56
59
|
|
|
57
|
-
> **Note**: Requires
|
|
60
|
+
> **Note**: Requires DeepSeek Harness `0.2.0-rc.1` or newer on the `0.2.0` line, or a compatible `0.1.5-rc.x` installation, with the `dsh` CLI available. On the `0.2.0` line, use plugin `0.1.15` or later: `0.1.14` covers only `0.2.0-rc.2+`, `0.1.13` only the older host range. If npm still serves `0.1.13`, install a source-built tarball below.
|
|
58
61
|
|
|
59
62
|
**From npm (recommended)**
|
|
60
63
|
|
|
@@ -68,13 +71,16 @@ dsh plugin --profile headless add dsh-mineru # Headless profile
|
|
|
68
71
|
```bash
|
|
69
72
|
git clone git@github.com:Lee-Hilex/dsh-mineru.git
|
|
70
73
|
cd dsh-mineru
|
|
71
|
-
npm
|
|
74
|
+
npm ci # development: Node.js 24 recommended; no build step
|
|
75
|
+
npm test # includes real DSH 0.2.0-rc.2 integration tests
|
|
72
76
|
npm pack # produces dsh-mineru-<version>.tgz
|
|
73
77
|
dsh plugin --profile web add ./dsh-mineru-<version>.tgz
|
|
74
78
|
```
|
|
75
79
|
|
|
76
80
|
Run `npm pack` again and re-install after changing the source. Local installs must use the tarball (`pnpm link:` installs resolve `@deepseek-ai` peers outside the profile).
|
|
77
81
|
|
|
82
|
+
For the desktop profile, use `dsh plugin --profile desktop add ./dsh-mineru-0.1.14.tgz`. Compatible package metadata passes the runtime gate without an `allow-version` exemption. `npm run test:compat` runs only the real-runtime compatibility checks; MinerU responses are simulated, so the tests upload no documents and consume no API quota.
|
|
83
|
+
|
|
78
84
|
### Step 2: Verify the install
|
|
79
85
|
|
|
80
86
|
```bash
|
|
@@ -125,8 +131,8 @@ Headless and Web share the same tool semantics; you can also type `/mineru-tools
|
|
|
125
131
|
| Endpoints | `/api/v4/extract/task`, `/api/v4/file-urls/batch`, `/api/v4/extract/task/batch` | `/api/v1/agent/parse/url`, `/api/v1/agent/parse/file` |
|
|
126
132
|
| Models | `pipeline` / `vlm` (default) / `MinerU-HTML` | fixed lightweight pipeline |
|
|
127
133
|
| Size limit | ≤ 200 MB | ≤ 10 MB |
|
|
128
|
-
| Page limit | ≤ 200 pages | ≤ 20 pages |
|
|
129
|
-
| Batch parsing | ✅ (URLs ≤ 200/batch, local uploads ≤ 50/batch, auto-
|
|
134
|
+
| Page limit | ≤ 200 pages per request (workspace PDFs over it are split automatically) | ≤ 20 pages (never split) |
|
|
135
|
+
| Batch parsing | ✅ (URLs ≤ 200/batch, local uploads ≤ 50/batch, auto-batched) | ❌ single file only |
|
|
130
136
|
| Output | Zip: `full.md` + `content_list.json` + `layout.json` + images (+ optional docx/html/latex) | Markdown only |
|
|
131
137
|
| Best for | Long docs, scans, formulas/tables, batch jobs, HTML | Quick reads, small files, temporary use |
|
|
132
138
|
|
|
@@ -163,14 +169,86 @@ Parses a **workspace file path** or **http(s) URL** into structured Markdown.
|
|
|
163
169
|
| `enableTable` | | Table recognition, default `true` |
|
|
164
170
|
| `enableFormula` | | Formula recognition, default `true` |
|
|
165
171
|
| `isOcr` | | Force OCR for scans, default `false` |
|
|
166
|
-
| `pageRanges` | | Precision page ranges, comma-separated: `"2,4-6"`; negative pages supported: `"2--2"` (2nd from last) |
|
|
172
|
+
| `pageRanges` | | Precision page ranges, comma-separated: `"2,4-6"`; negative pages supported: `"2--2"` (2nd from last). Omit for the whole document; a workspace PDF over the 200-page cap is split automatically |
|
|
167
173
|
| `pageRange` | | Agent page range, `from-to` or single page: `"1-10"` |
|
|
168
174
|
| `extraFormats` | | Extra export formats (Precision only): `docx` / `html` / `latex` |
|
|
169
175
|
| `dataId` | | Business data ID (optional, ≤ 128 chars) |
|
|
170
176
|
| `timeoutMs` | | Whole-operation timeout incl. polling; defaults to plugin config (10 min) |
|
|
171
177
|
| `output` | | Result directory base name; defaults to the source file name |
|
|
178
|
+
| `anchor` | | Also write `document.md`, a page-anchored copy of the result (one `<!-- pN bK -->` per block); default `false` — see [Page-anchored Markdown](#page-anchored-markdown-anchor) |
|
|
179
|
+
|
|
180
|
+
**Result highlights**: `ok`, the `api`/`modelVersion` used, `taskId`, duration, `runDir`, a truncated Markdown preview, the artifact list (with signed preview links on Web), and — with `anchor: true` — an `anchor` summary naming the `document.md` that was written.
|
|
181
|
+
|
|
182
|
+
### Page-anchored Markdown (`anchor`)
|
|
183
|
+
|
|
184
|
+
`full.md` is prose: nothing in it says which page a sentence came from, so a
|
|
185
|
+
claim drawn from a scan cannot be cited back to a page. `anchor: true` adds a
|
|
186
|
+
`document.md` that carries that information as an HTML comment per block:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
<!-- p12 b3 -->
|
|
190
|
+
君子务本,本立而道生。
|
|
191
|
+
|
|
192
|
+
<!-- p12 b4 -->
|
|
193
|
+

|
|
194
|
+
|
|
195
|
+
<!-- p13 b1 -->
|
|
196
|
+
**表一 孔门弟子年表**
|
|
197
|
+
<table><tr><td>姓名</td><td>字</td><td>生年</td></tr>…</table>
|
|
198
|
+
```
|
|
172
199
|
|
|
173
|
-
|
|
200
|
+
- `pN` is the **physical page position in this file** (1-based, cover and front
|
|
201
|
+
matter included) — not the page number printed on the page. The cloud
|
|
202
|
+
renumbers the pages you asked for, so with `pageRanges: "2,4-6"` the anchors
|
|
203
|
+
are `p2, p4, p5, p6` — the mapping is `requestedPages[page_idx]`, not a fixed
|
|
204
|
+
offset;
|
|
205
|
+
- `bK` is the K-th block **of that page** in `content_list.json` order. Page
|
|
206
|
+
headers, footers and page numbers stay out of the body but still occupy their
|
|
207
|
+
number, so `bK` can have gaps (e.g. `b1, b2, b4`) — that is deliberate: `bK`
|
|
208
|
+
always names the same record in `content_list.json`;
|
|
209
|
+
- text blocks render their text, a cloud heading level becomes the matching
|
|
210
|
+
Markdown heading, tables render as their caption plus `table_body`, images as
|
|
211
|
+
``;
|
|
212
|
+
- a block the cloud marked `[Unreadable]` keeps its anchor and shows
|
|
213
|
+
`[Unreadable]`; a block with empty text keeps its anchor too;
|
|
214
|
+
- the precision API is the only mode that returns `content_list.json`, so
|
|
215
|
+
`anchor: true` under the Agent API returns a warning and no `document.md`
|
|
216
|
+
instead of failing.
|
|
217
|
+
|
|
218
|
+
The number printed on a page is a *printed* page number, and it need not match
|
|
219
|
+
the physical order: front matter numbered with Roman numerals, or a document
|
|
220
|
+
that keeps the page numbers of the journal it came from, shifts every later
|
|
221
|
+
page. When the result carries readable `page_number` blocks the renderer
|
|
222
|
+
compares them with the physical order on a best-effort basis, records each
|
|
223
|
+
page's `printed − physical` difference in the `pageNumbers` field of the
|
|
224
|
+
`anchor` summary (`{ detected, total, offsets }`, `offsets` sorted and
|
|
225
|
+
de-duplicated), and reports a single constant non-zero difference as one
|
|
226
|
+
warning line (messages are Chinese, like the rest of the renderer's warnings):
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
anchor.pageNumbers = { "detected": 4, "total": 4, "offsets": [3] }
|
|
230
|
+
anchor.warnings = ["印刷页码与物理页序整体相差 +3(前言用罗马数字,或用析出文献保留原刊页码,都会造成整体偏移);锚点仍用物理页序,可用页码映射声明两者的对应关系"]
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Several different differences are reported as such and need checking page by
|
|
234
|
+
page. Nothing is reported when the two agree (every offset `0`) or when no
|
|
235
|
+
printed number could be read. The check only reads the blocks: the anchors are
|
|
236
|
+
never changed by it.
|
|
237
|
+
|
|
238
|
+
Without `pageRanges` the pages are numbered from 1 in request order. With a
|
|
239
|
+
negative range (`"2--2"`) the cloud does not tell us the document length, so the
|
|
240
|
+
anchors fall back to the first page you asked for and the result carries a
|
|
241
|
+
warning telling you to check them.
|
|
242
|
+
|
|
243
|
+
**Long PDFs — automatic chunking**: when one precision request would ask for more than 200 pages (a workspace PDF larger than that, or a `pageRanges` selection over 200 pages), the plugin splits it into sequential `page_ranges` chunks itself, submits and polls them one by one, and merges the outcome into the layout a single request produces. No extra parameter, and no local PDF rewrite: the file is uploaded once, only the requested range changes per request.
|
|
244
|
+
|
|
245
|
+
- `full.md` — concatenated in page order, with one `<!-- chunk i/n: pages … -->` line before each chunk;
|
|
246
|
+
- `content_list.json` — merged, with `page_idx` mapped back to the original document (the API renumbers it from 0 for every requested subset);
|
|
247
|
+
- `images/` — the union of all chunks (names are content hashes, so they cannot collide);
|
|
248
|
+
- `layout.json` / `<uuid>_model.json` — kept per chunk under `chunks/chunk-<n>/`, because they are page-indexed arrays that a merge would break;
|
|
249
|
+
- `run.json` — per-chunk page range, `batchId`, state and duration; the tool result carries the same list as `chunkCount` / `chunks`.
|
|
250
|
+
|
|
251
|
+
Boundaries: splitting needs the page count **locally**, so it covers workspace PDFs in precision mode only. URL sources, non-PDF formats (the host cannot read docx/pptx page counts) and the tokenless Agent API keep their previous behaviour, and their page-limit error names the reason no split happened. The Agent API is deliberately never split: it is rate-limited per caller IP, so fanning one call out into a dozen requests would exhaust the caller's quota — use Precision, or segment it yourself. `timeoutMs` applies to each chunk. Only a merged multi-chunk result renumbers pages; a single request (including one with an explicit `pageRanges`) keeps the cloud's own `page_idx`, exactly as before.
|
|
174
252
|
|
|
175
253
|
### `mineru_batch_parse` — batch parsing (Precision only)
|
|
176
254
|
|
|
@@ -181,6 +259,7 @@ Parses many documents in one call; **local paths and URLs can be mixed**, submis
|
|
|
181
259
|
| `sources` | ✅ | Mixed list of file paths / URLs |
|
|
182
260
|
| `outputPrefix` | | Result directory base name, default `batch` |
|
|
183
261
|
| `dataIdPrefix` | | Business data ID prefix; a sequence number is appended per item (optional) |
|
|
262
|
+
| `anchor` | | Same as `mineru_parse`: write a `document.md` per document (default `false`) |
|
|
184
263
|
| others | | Same shared options as `mineru_parse` (except `mode` — this tool is Precision-only) |
|
|
185
264
|
|
|
186
265
|
**Chunking rules**: local files ≤ 50 per batch, URLs ≤ 200 per batch, ≤ 1000 total per call; exceeding these errors with a hint to split the call.
|
|
@@ -198,6 +277,7 @@ Parses many documents in one call; **local paths and URLs can be mixed**, submis
|
|
|
198
277
|
| `wait` | | Poll until the task finishes, default `false` (query once) |
|
|
199
278
|
| `collect` | | Download the result into an Artifact when done, default `true` |
|
|
200
279
|
| `output` | | Result directory base name, default `task` |
|
|
280
|
+
| `anchor` | | Also write `document.md` when collecting (default `false`) |
|
|
201
281
|
| `timeoutMs` | | Timeout for `wait` mode |
|
|
202
282
|
|
|
203
283
|
**Typical scenario**: `mineru_parse` timed out on a large PDF → tell the agent "collect the result for taskId=xxx with mineru_task".
|
|
@@ -214,6 +294,7 @@ All results land in **`<workspace>/.dsh-mineru/artifacts/<run>/`** (`<workspace>
|
|
|
214
294
|
.dsh-mineru/artifacts/<run>/
|
|
215
295
|
├── full.md # Structured Markdown (both modes)
|
|
216
296
|
├── run.json # Run metadata (source, API, model, duration, …)
|
|
297
|
+
├── document.md # Page-anchored Markdown (Precision + anchor: true only)
|
|
217
298
|
├── *_content_list.json # Structured content list (Precision only)
|
|
218
299
|
├── layout.json # Layout data (Precision only)
|
|
219
300
|
├── *_model.json # Raw model output (Precision only)
|
|
@@ -223,6 +304,7 @@ All results land in **`<workspace>/.dsh-mineru/artifacts/<run>/`** (`<workspace>
|
|
|
223
304
|
```
|
|
224
305
|
|
|
225
306
|
- Tool results carry a **bounded Markdown preview** (first 12 KB by default); read the full text from `full.md` with the `read` tool;
|
|
307
|
+
- `document.md` is **opt-in** (`anchor: true`) and purely additional: `full.md`, `content_list.json` and `layout.json` keep exactly the shape they have today, so nothing changes for users who do not pass `anchor`;
|
|
226
308
|
- **Web UI**: artifacts get HMAC-signed preview URLs (24 h lifetime by default) — click to view/download; tool-result cards open files directly;
|
|
227
309
|
- **Headless**: use the absolute paths returned by the tool.
|
|
228
310
|
|
|
@@ -306,8 +388,8 @@ The token is resolved once per operation — **a rotation applies to the very ne
|
|
|
306
388
|
|
|
307
389
|
- **Drag-and-drop**: drop a file into the chat — it is saved to the session workspace and its **path is filled into the composer draft (never auto-sent)**; add your request and send. This bypasses the native image-attachment channel that text-only models reject;
|
|
308
390
|
- **URL caveat**: MinerU fetches the URL server-side — **it cannot reach blocked sites** (github.com, AWS, etc.). Download such documents locally first and pass a path;
|
|
309
|
-
- **Page ranges**: Precision uses `pageRanges` (`"2,4-6"`; `"2--2"` = 2nd from last); Agent uses `pageRange` (`"1-10"`);
|
|
310
|
-
- **Long documents**:
|
|
391
|
+
- **Page ranges**: Precision uses `pageRanges` (`"2,4-6"`; `"2--2"` = 2nd from last); Agent uses `pageRange` (`"1-10"`). A workspace PDF that would exceed 200 pages per request is split automatically;
|
|
392
|
+
- **Long documents**: in Precision mode a workspace PDF over 200 pages is split automatically — no manual `pageRanges` juggling; you can still pass `pageRanges` to parse only a part. The `vlm` model handles formulas and complex layouts best;
|
|
311
393
|
- **Timeout recovery**: a timeout is not a failure — the task keeps running server-side; collect it later with `mineru_task` + `taskId`;
|
|
312
394
|
- **HTML documents**: Precision only, and the `MinerU-HTML` model is forced automatically;
|
|
313
395
|
- **HTML daily quota**: HTML submissions have a separate official cap (max 100/day).
|
|
@@ -341,7 +423,7 @@ Plugin behavior:
|
|
|
341
423
|
| --- | --- | --- |
|
|
342
424
|
| `A0202` / `A0211` | Token invalid / expired | Update the MinerU token in Settings |
|
|
343
425
|
| `-60005` / `-30001` | File too large (200 MB / 10 MB) | Compress or split the file |
|
|
344
|
-
| `-60006` / `-30003` | Too many pages (200 / 20) |
|
|
426
|
+
| `-60006` / `-30003` | Too many pages (200 / 20) | Workspace PDFs are split automatically; for anything else the message names why no split happened — segment manually with `pageRanges` / `pageRange` |
|
|
345
427
|
| `-60018` | Daily quota exhausted | Try again tomorrow; check `dailySubmitLimit` |
|
|
346
428
|
| `429` | Too many requests | Retry later or lower concurrency |
|
|
347
429
|
| `MINERU_TOKEN_REQUIRED` | Token-required operation without a token | Configure a token or use Agent mode |
|
|
@@ -352,6 +434,18 @@ Every error is mapped to an **actionable message** instead of a raw code.
|
|
|
352
434
|
|
|
353
435
|
## Security model
|
|
354
436
|
|
|
437
|
+
### Data flow (where your content goes)
|
|
438
|
+
|
|
439
|
+
**This plugin is not offline.** Both API modes send the full source file to a remote MinerU service, then download the parsed result — nothing is parsed on this machine.
|
|
440
|
+
|
|
441
|
+
| Operation | Leaves the machine? | Endpoint | Token |
|
|
442
|
+
| --- | --- | --- | --- |
|
|
443
|
+
| Precision parse / batch / task collect | Yes — file uploaded, result zip downloaded | `https://mineru.net` (result CDN: `https://cdn-mineru.openxlab.org.cn`) | Required |
|
|
444
|
+
| Agent lightweight parse | Yes — file uploaded, Markdown downloaded | MinerU Agent API | None (IP rate-limited) |
|
|
445
|
+
| Activation / settings / local preview | No file content leaves (only the token test makes one authenticated API call) | — | — |
|
|
446
|
+
|
|
447
|
+
There is **no "local-only" mode**: MinerU runs server-side. For material that cannot leave the machine, use a fully local toolchain (local PDF conversion + offline OCR + local template rendering).
|
|
448
|
+
|
|
355
449
|
- **Path isolation**: input paths resolve against the session workspace; files outside it cannot be read;
|
|
356
450
|
- **ZIP unpacking guards**: rejects absolute paths, `..` traversal, encrypted entries, and ZIP64, with entry-count and byte caps, and verifies CRC32 on every extracted entry;
|
|
357
451
|
- **Artifact boundary**: written only under `<workspace>/.dsh-mineru`; preview URLs are HMAC-signed with expiry and re-validated on every read;
|
package/README.zh.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# dsh-mineru
|
|
2
2
|
|
|
3
3
|
[](LICENSE)
|
|
4
|
-
[](https://github.com/Lee-Hilex/dsh-mineru/releases)
|
|
5
|
+
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
6
6
|
[](https://mineru.net/apiManage/docs)
|
|
7
7
|
|
|
8
8
|
> 仓库: <https://github.com/Lee-Hilex/dsh-mineru> · npm: [`dsh-mineru`](https://www.npmjs.com/package/dsh-mineru) · [更新日志](CHANGELOG.md)
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
**dsh-mineru** 是 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(简称 dsh)的 **MinerU 多模态文档解析插件**:把 PDF、Word、PPT、Excel、HTML 和图片一键转成**结构化 Markdown**。**配置了 MinerU Token 走 🎯 精准解析 API;不配 Token 也能用 ⚡ Agent 轻量解析 API(免登录,IP 限频)。**
|
|
13
13
|
|
|
14
|
+
> ⚠️ **内容会出网**:每次解析都会把文件上传到 MinerU 远端服务,**无完全离线模式**;涉密 / 涉案 / 不得出网的材料请勿使用。详见 [安全模型](#安全模型)。
|
|
15
|
+
|
|
14
16
|
## 目录
|
|
15
17
|
|
|
16
18
|
- [简介](#简介) · [快速开始](#快速开始) · [两种 API 模式](#两种-api-模式) · [工具详解](#工具详解) · [解析结果与 Artifacts](#解析结果与-artifacts) · [配置参考](#配置参考) · [使用技巧](#使用技巧) · [Web 界面](#web-界面) · [限流与可靠性](#限流与可靠性) · [错误码速查](#错误码速查) · [安全模型](#安全模型) · [常见问题 FAQ](#常见问题-faq) · [开发与发布](#开发与发布) · [贡献](#贡献) · [许可](#许可)
|
|
@@ -43,6 +45,7 @@ dsh-mineru 把 [MinerU](https://mineru.net)(OpenDataLab 出品的高精度文
|
|
|
43
45
|
|
|
44
46
|
### 核心能力
|
|
45
47
|
|
|
48
|
+
- **适配 DSH 0.2.0-rc.2** — 使用真实 Loader、设置服务和工具运行时验证,同时保留 `0.1.5-rc.x` 的 peer 范围与旧设置接口;
|
|
46
49
|
- **双 API 自动切换** — 按是否配置 Token 自动选择精准解析或轻量解析,也可手动指定;
|
|
47
50
|
- **渐进式工具曝光** — 平时只挂一个极小的 `mineru_activate` 引导工具,激活后才挂载完整工具集,省上下文;
|
|
48
51
|
- **拖拽上传** — 文件直接拖进聊天窗口,路径自动填入输入框,纯文本模型也能处理文档;
|
|
@@ -54,7 +57,7 @@ dsh-mineru 把 [MinerU](https://mineru.net)(OpenDataLab 出品的高精度文
|
|
|
54
57
|
|
|
55
58
|
### 第 1 步:安装
|
|
56
59
|
|
|
57
|
-
> **Note**: 需要已安装 DeepSeek Harness
|
|
60
|
+
> **Note**: 需要已安装 DeepSeek Harness `0.2.0-rc.1` 或更新(`0.2.0` 线),或兼容的 `0.1.5-rc.x`,且 `dsh` 命令可用。`0.2.0` 线请使用插件 `0.1.15` 或更高版本;`0.1.14` 仅覆盖 `0.2.0-rc.2+`,`0.1.13` 仅声明旧宿主版本范围。若 npm 仍提供 `0.1.13`,请按下文从源码打包安装。
|
|
58
61
|
|
|
59
62
|
**从 npm 安装(推荐)**
|
|
60
63
|
|
|
@@ -68,13 +71,16 @@ dsh plugin --profile headless add dsh-mineru # 无头(Headless)模式使
|
|
|
68
71
|
```bash
|
|
69
72
|
git clone git@github.com:Lee-Hilex/dsh-mineru.git
|
|
70
73
|
cd dsh-mineru
|
|
71
|
-
npm
|
|
74
|
+
npm ci # 开发测试推荐 Node.js 24;本包无需 build
|
|
75
|
+
npm test # 包含真实 DSH 0.2.0-rc.2 集成测试
|
|
72
76
|
npm pack # 产出 dsh-mineru-<version>.tgz
|
|
73
77
|
dsh plugin --profile web add ./dsh-mineru-<version>.tgz
|
|
74
78
|
```
|
|
75
79
|
|
|
76
80
|
修改源码后重新 `npm pack` 并重装即可。注意本地安装请用 tgz(`pnpm link:` 安装会使 `@deepseek-ai` 依赖解析脱离 profile)。
|
|
77
81
|
|
|
82
|
+
桌面端 profile 使用 `dsh plugin --profile desktop add ./dsh-mineru-0.1.14.tgz`。兼容声明可直接通过宿主版本检查,无需 `allow-version` 豁免。`npm run test:compat` 仅运行真实宿主兼容测试;MinerU 响应采用模拟服务,测试不会上传文档或消耗 API 额度。
|
|
83
|
+
|
|
78
84
|
### 第 2 步:验证安装
|
|
79
85
|
|
|
80
86
|
```bash
|
|
@@ -125,7 +131,7 @@ Headless 与 Web 共用同一套工具语义;也可以在会话中输入 `/min
|
|
|
125
131
|
| 接口 | `/api/v4/extract/task`、`/api/v4/file-urls/batch`、`/api/v4/extract/task/batch` | `/api/v1/agent/parse/url`、`/api/v1/agent/parse/file` |
|
|
126
132
|
| 模型 | `pipeline` / `vlm`(默认)/ `MinerU-HTML` | 固定轻量 pipeline 模型 |
|
|
127
133
|
| 大小限制 | ≤ 200 MB | ≤ 10 MB |
|
|
128
|
-
| 页数限制 | ≤ 200
|
|
134
|
+
| 页数限制 | 单次请求 ≤ 200 页(工作区 PDF 超出时自动分片) | ≤ 20 页(不自动分片) |
|
|
129
135
|
| 批量解析 | ✅(URL 每批 ≤200,本地上传每批 ≤50,自动分批) | ❌ 仅单文件 |
|
|
130
136
|
| 输出 | Zip:`full.md` + `content_list.json` + `layout.json` + 图片(可加 docx/html/latex) | 仅 Markdown |
|
|
131
137
|
| 适用场景 | 长文档、扫描件、公式表格、批量、HTML | 快速粗读、小文件、临时使用 |
|
|
@@ -163,14 +169,58 @@ Headless 与 Web 共用同一套工具语义;也可以在会话中输入 `/min
|
|
|
163
169
|
| `enableTable` | | 表格识别,默认 `true` |
|
|
164
170
|
| `enableFormula` | | 公式识别,默认 `true` |
|
|
165
171
|
| `isOcr` | | 强制 OCR(扫描件),默认 `false` |
|
|
166
|
-
| `pageRanges` | | 精准解析页码范围,逗号分隔,如 `"2,4-6"`;支持倒数页 `"2--2"`(倒数第 2
|
|
172
|
+
| `pageRanges` | | 精准解析页码范围,逗号分隔,如 `"2,4-6"`;支持倒数页 `"2--2"`(倒数第 2 页)。不传表示整份文档;工作区 PDF 超过 200 页上限时自动分片 |
|
|
167
173
|
| `pageRange` | | Agent 解析页码范围,仅 `from-to` 或单页,如 `"1-10"` |
|
|
168
174
|
| `extraFormats` | | 额外导出格式(仅精准解析):`docx` / `html` / `latex` |
|
|
169
175
|
| `dataId` | | 业务数据 ID(可选,≤128 字符) |
|
|
170
176
|
| `timeoutMs` | | 整个操作(含轮询)超时,默认取插件配置(10 分钟) |
|
|
171
177
|
| `output` | | 结果目录基名,默认取源文件名 |
|
|
178
|
+
| `anchor` | | 额外产出一份带页级块锚点的 `document.md`(每块一行 `<!-- pN bK -->`),默认 `false`;详见 [页级块锚点产物](#页级块锚点产物anchor) |
|
|
179
|
+
|
|
180
|
+
**返回要点**:`ok`、所用 `api`/`modelVersion`、`taskId`、耗时、`runDir` 结果目录、截断的 Markdown 预览、Artifact 列表(Web 含签名预览链接);带 `anchor: true` 时另附 `anchor` 摘要,指明写出的 `document.md`。
|
|
181
|
+
|
|
182
|
+
### 页级块锚点产物(`anchor`)
|
|
183
|
+
|
|
184
|
+
`full.md` 是连续正文,正文里没有任何信息能说明某句话来自哪一页,扫描件的结论因此无法回溯到页码。`anchor: true` 额外写一份 `document.md`,用每块前的一行 HTML 注释带上这个信息:
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
<!-- p12 b3 -->
|
|
188
|
+
君子务本,本立而道生。
|
|
189
|
+
|
|
190
|
+
<!-- p12 b4 -->
|
|
191
|
+

|
|
192
|
+
|
|
193
|
+
<!-- p13 b1 -->
|
|
194
|
+
**表一 孔门弟子年表**
|
|
195
|
+
<table><tr><td>姓名</td><td>字</td><td>生年</td></tr>…</table>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
- `pN` 是**这份文件的物理页序**(1 基,含封面与前言),不是书本或期刊页面上印的印刷页码。云端对请求的页会重新编号,所以 `pageRanges: "2,4-6"` 下锚点就是 `p2, p4, p5, p6`——映射口径是 `requestedPages[page_idx]`,不是固定偏移;
|
|
199
|
+
- `bK` 是该块在**本页内**按 `content_list.json` 顺序的序号。页眉、页脚、页码不进正文但仍占号,所以 `bK` 可能不连续(如 `b1, b2, b4`)——这是有意的:`bK` 始终指向 `content_list.json` 里同一条记录;
|
|
200
|
+
- 文本块渲染正文;云端给了标题层级时映射成对应的 Markdown 标题;表格渲染为标题 + `table_body`;图片渲染为 ``;
|
|
201
|
+
- 云端标为 `[Unreadable]` 的块保留锚点并显示 `[Unreadable]`;正文为空的块同样保留锚点;
|
|
202
|
+
- 只有精准解析 API 的结果含 `content_list.json`,因此在 Agent 轻量解析下传 `anchor: true` 会返回一条提示而不产出 `document.md`,不会让整次解析失败。
|
|
203
|
+
|
|
204
|
+
页面上印的是**印刷页码**,它和物理页序未必一致:前言用罗马数字编号,或析出文献保留原刊页码,都会让正文页码整体偏移。结果包里带可识别的 `page_number` 块时,渲染会拿它做一次尽力而为的自检,把每页的「印刷页码 − 物理页序」记进锚点摘要的 `pageNumbers` 字段(`{ detected, total, offsets }`,`offsets` 去重后升序),偏移恒为一套非零值时给出一行提示:
|
|
172
205
|
|
|
173
|
-
|
|
206
|
+
```
|
|
207
|
+
anchor.pageNumbers = { "detected": 4, "total": 4, "offsets": [3] }
|
|
208
|
+
anchor.warnings = ["印刷页码与物理页序整体相差 +3(前言用罗马数字,或用析出文献保留原刊页码,都会造成整体偏移);锚点仍用物理页序,可用页码映射声明两者的对应关系"]
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
偏移不止一套时提示「多套偏移」,需要逐页核对。两者一致(偏移全为 `0`)或一页都没识别到时不提示;自检只读不写,锚点本身不受影响。
|
|
212
|
+
|
|
213
|
+
不带 `pageRanges` 时按请求顺序从第 1 页起编号。使用倒数页码范围(如 `"2--2"`)时云端不会给出文档总页数,锚点会退化为「按你请求的第一个页码起算」,并在结果里明确提示需要人工核对。
|
|
214
|
+
|
|
215
|
+
**长 PDF 自动分片**:当一次精准解析请求会要超过 200 页时(整份工作区 PDF 超过 200 页,或 `pageRanges` 选出的页数超过 200 页),插件自动按顺序切成若干 `page_ranges` 分片,逐片提交与轮询,最后合并成与单次请求一致的产物布局。不需要新参数,也不在本地拆 PDF:同一份文件只上传一次,每次只改请求的页码范围。
|
|
216
|
+
|
|
217
|
+
- `full.md`:按页序拼接,每片前有一行 `<!-- chunk i/n: pages … -->` 注释;
|
|
218
|
+
- `content_list.json`:合并结果,`page_idx` 已映射回原文档页码(云端对每次请求的子集都会从 0 重新编号);
|
|
219
|
+
- `images/`:所有分片图片的并集(按内容哈希命名,不会冲突);
|
|
220
|
+
- `layout.json` / `<uuid>_model.json`:按页数组组织,合并会破坏结构,按片保留在 `chunks/chunk-<n>/` 下;
|
|
221
|
+
- `run.json`:分片记录(每片的页码范围、`batchId`、状态、耗时);工具返回值里的 `chunkCount` / `chunks` 是同一份清单。
|
|
222
|
+
|
|
223
|
+
边界:分片需要**本地**知道页数,所以只对精准解析模式下的工作区 PDF 生效。URL 源、非 PDF 格式(本地读不出 docx/pptx 的页数)与免 Token 的 Agent 轻量解析 API 保持原有行为——它们撞到页数上限时,错误信息会说明为什么没有自动分片。Agent 轻量解析 API 按 IP 限流,故意不做自动分片:一次调用被拆成十几片会把额度打爆,请改用精准解析或自行分段。`timeoutMs` 对每片分别生效。只有多片合并的结果才归一页码;单次请求(含显式传 `pageRanges`)保持云端原样,与既有行为一致。
|
|
174
224
|
|
|
175
225
|
### `mineru_batch_parse` —— 批量解析(仅精准解析)
|
|
176
226
|
|
|
@@ -181,6 +231,7 @@ Headless 与 Web 共用同一套工具语义;也可以在会话中输入 `/min
|
|
|
181
231
|
| `sources` | ✅ | 文件路径 / URL 混合列表 |
|
|
182
232
|
| `outputPrefix` | | 结果目录基名,默认 `batch` |
|
|
183
233
|
| `dataIdPrefix` | | 业务数据 ID 前缀,每项自动追加序号(可选) |
|
|
234
|
+
| `anchor` | | 同 `mineru_parse`:为每个文档各写一份 `document.md`(默认 `false`) |
|
|
184
235
|
| 其余 | | 同 `mineru_parse` 的公共选项(`mode` 除外——本工具强制精准解析) |
|
|
185
236
|
|
|
186
237
|
**分批规则**:本地文件每批 ≤ 50 个、URL 每批 ≤ 200 个、单次调用总共 ≤ 1000 个;超出会报错并提示拆分调用。
|
|
@@ -198,6 +249,7 @@ Headless 与 Web 共用同一套工具语义;也可以在会话中输入 `/min
|
|
|
198
249
|
| `wait` | | 是否轮询等待任务完成,默认 `false`(只查一次) |
|
|
199
250
|
| `collect` | | 任务完成时是否下载结果落地为 Artifact,默认 `true` |
|
|
200
251
|
| `output` | | 收集结果目录基名,默认 `task` |
|
|
252
|
+
| `anchor` | | 收集结果时是否额外写一份 `document.md`(默认 `false`) |
|
|
201
253
|
| `timeoutMs` | | `wait` 模式下的超时 |
|
|
202
254
|
|
|
203
255
|
**典型场景**:解析大 PDF 时 `mineru_parse` 超时了 → 告诉 Agent「用 mineru_task 继续收集 taskId=xxx 的结果」。
|
|
@@ -214,6 +266,7 @@ Headless 与 Web 共用同一套工具语义;也可以在会话中输入 `/min
|
|
|
214
266
|
.dsh-mineru/artifacts/<run>/
|
|
215
267
|
├── full.md # 结构化 Markdown 主结果(两模式都有)
|
|
216
268
|
├── run.json # 本次解析元数据(来源、API、模型、耗时等)
|
|
269
|
+
├── document.md # 页级块锚点 Markdown(仅精准解析 + anchor: true)
|
|
217
270
|
├── *_content_list.json # 内容结构化清单(仅精准解析)
|
|
218
271
|
├── layout.json # 版面布局数据(仅精准解析)
|
|
219
272
|
├── *_model.json # 模型原始输出(仅精准解析)
|
|
@@ -223,6 +276,7 @@ Headless 与 Web 共用同一套工具语义;也可以在会话中输入 `/min
|
|
|
223
276
|
```
|
|
224
277
|
|
|
225
278
|
- 工具结果里附**限长 Markdown 预览**(默认前 12 KB),完整内容请用 `read` 工具读取 `full.md`;
|
|
279
|
+
- `document.md` 是**可选增量**(`anchor: true` 才产出):`full.md`、`content_list.json`、`layout.json` 的形态与现在完全一致,不用 `anchor` 的用户感知不到任何变化;
|
|
226
280
|
- **Web 界面**:Artifact 带 HMAC 签名预览链接(默认有效期 24 小时),点开即可看/下载;工具结果卡片可直接打开文件;
|
|
227
281
|
- **Headless**:直接使用返回的绝对路径。
|
|
228
282
|
|
|
@@ -306,8 +360,8 @@ Token 每次操作实时解析——**轮换后下一次调用立即生效,无
|
|
|
306
360
|
|
|
307
361
|
- **拖拽上传**:把文件拖进聊天窗口即可——文件自动保存到会话工作区,**路径填入输入框草稿(不自动发送)**,你补一句需求再发送。这绕开了纯文本模型不支持的图片附件通道;
|
|
308
362
|
- **URL 注意**:MinerU 服务端会去抓取该 URL——**无法访问被墙站点**(如 github.com、aws 等)。这类文档请先下载到本地再传路径;
|
|
309
|
-
- **页码范围**:精准解析用 `pageRanges`(`"2,4-6"`,`"2--2"` 表示倒数第 2 页);Agent 用 `pageRange`(`"1-10"
|
|
310
|
-
-
|
|
363
|
+
- **页码范围**:精准解析用 `pageRanges`(`"2,4-6"`,`"2--2"` 表示倒数第 2 页);Agent 用 `pageRange`(`"1-10"`)。工作区 PDF 单次请求超过 200 页时会自动分片;
|
|
364
|
+
- **长文档**:精准解析模式下工作区 PDF 超过 200 页会自动分片并合并,不必手工分段;也可以传 `pageRanges` 只解析一部分。`vlm` 模型对公式/复杂版面效果最好;
|
|
311
365
|
- **超时恢复**:解析超时不等于失败——任务还在服务端跑,用 `mineru_task` + `taskId` 继续收集;
|
|
312
366
|
- **HTML 文档**:仅精准解析支持,且自动强制 `MinerU-HTML` 模型(无需手动指定);
|
|
313
367
|
- **HTML 文件每日限额**:官方对 HTML 提交有单独限制(最多 100 个/天)。
|
|
@@ -341,7 +395,7 @@ Token 每次操作实时解析——**轮换后下一次调用立即生效,无
|
|
|
341
395
|
| --- | --- | --- |
|
|
342
396
|
| `A0202` / `A0211` | Token 错误 / 过期 | 在设置中更新 MinerU Token |
|
|
343
397
|
| `-60005` / `-30001` | 文件超限(200 MB / 10 MB) | 压缩或拆分文件 |
|
|
344
|
-
| `-60006` / `-30003` | 页数超限(200 页 / 20 页) |
|
|
398
|
+
| `-60006` / `-30003` | 页数超限(200 页 / 20 页) | 工作区 PDF 会自动分片;其它来源的错误信息会说明未自动分片的原因——用 `pageRanges` / `pageRange` 手动分段 |
|
|
345
399
|
| `-60018` | 当日配额已满 | 明天再试,或检查 `dailySubmitLimit` |
|
|
346
400
|
| `429` | 请求过于频繁 | 稍后重试或降低并发 |
|
|
347
401
|
| `MINERU_TOKEN_REQUIRED` | 需要 Token 的操作未配 Token | 配置 Token 或改用 Agent 模式 |
|
|
@@ -352,6 +406,18 @@ Token 每次操作实时解析——**轮换后下一次调用立即生效,无
|
|
|
352
406
|
|
|
353
407
|
## 安全模型
|
|
354
408
|
|
|
409
|
+
### 数据流向(内容去了哪里)
|
|
410
|
+
|
|
411
|
+
**本插件不是离线工具。** 两种 API 模式都会把完整源文件发送到 MinerU 远端服务,再把解析结果下载回本机——本地不做任何解析。
|
|
412
|
+
|
|
413
|
+
| 操作 | 是否出网 | 端点 | Token |
|
|
414
|
+
| --- | --- | --- | --- |
|
|
415
|
+
| 精准解析 / 批量 / task 收集 | 是——上传文件、下载结果 zip | `https://mineru.net`(结果 CDN:`https://cdn-mineru.openxlab.org.cn`) | 必需 |
|
|
416
|
+
| Agent 轻量解析 | 是——上传文件、下载 Markdown | MinerU Agent API | 无需(IP 限频) |
|
|
417
|
+
| 激活 / 设置 / 本地预览 | 文件内容不出网(仅 Token 自检会发起一次已认证 API 调用) | — | — |
|
|
418
|
+
|
|
419
|
+
**不存在"仅本地"模式**:MinerU 在服务端运行。不得出网的材料请使用完全本地的处理链(本地转 PDF + 离线 OCR + 本地模板渲染)。
|
|
420
|
+
|
|
355
421
|
- **路径隔离**:输入路径以会话工作区为根解析,不能读取工作区外文件;
|
|
356
422
|
- **ZIP 解包防护**:拒绝绝对路径、`..` 穿越、加密条目与 ZIP64,带条目数量/体积上限,每个解出的条目都校验 CRC32;
|
|
357
423
|
- **Artifact 边界**:只写入 `<workspace>/.dsh-mineru`;预览 URL 为 HMAC 签名 + 过期时间,每次读取重新校验;
|
package/RELEASE.md
CHANGED
|
@@ -38,7 +38,8 @@ npm pack --pack-destination D:\Users\Lee\Desktop\dsh
|
|
|
38
38
|
- [ ] `lib/client.js` 必须以 `window.__ModuleLoader__.load` 开头注册(宿主会拒绝"加载但未注册"的 client bundle):
|
|
39
39
|
`tar -xOf dsh-mineru-<version>.tgz package/lib/client.js | head -c 32` 应含 `__ModuleLoader__`
|
|
40
40
|
- [ ] `lib/client.js` 中不得出现裸的 `--dsw-alias-brand-primary`(深色模式白底白字事故,见 Issue #3);只允许 `--dsw-alias-brand-primary-new-colorprimary-new-color`
|
|
41
|
-
- [ ] tgz 内 `package.json` 的 `version` 与发布版本一致;6 个 `@deepseek-ai/dsh-*` peer 为 `^0.1.5-rc.1
|
|
41
|
+
- [ ] tgz 内 `package.json` 的 `version` 与发布版本一致;6 个 `@deepseek-ai/dsh-*` peer 为 `^0.1.5-rc.1 || ^0.2.0-rc.1`(覆盖 0.2.0-rc.1 起的 0.2 线)
|
|
42
|
+
- [ ] `npm run test:compat` 通过真实 DSH `0.2.0-rc.2` 宿主检查,不配置 `allow-version` 豁免
|
|
42
43
|
- [ ] 本地安装验证(可选但推荐):
|
|
43
44
|
|
|
44
45
|
```powershell
|