dsh-mineru 0.1.7 → 0.1.9

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 CHANGED
@@ -4,7 +4,22 @@ All notable changes to **dsh-mineru** are documented here. The format follows [K
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
- - 无(当前为最新发布版本 0.1.7)
7
+ - 无(当前为最新发布版本 0.1.9)
8
+
9
+ ## [0.1.9] - 2026-08-16
10
+
11
+ ### Docs
12
+
13
+ - 快速开始章节按官方插件 README 规范重构:安装拆分为「从 npm 安装(推荐)」与「从源码构建」双通道;新增第 2 步 `dsh --profile web --dump-config` 验证安装;新增 headless 冒烟测试示例;前置条件改为 Note 提示(中英两版同步)。
14
+
15
+ ## [0.1.8] - 2026-08-16
16
+
17
+ ### Docs
18
+
19
+ - 重写双语 README 为详细版:新增三步快速开始、工具完整参数表、22 项配置参考、错误码速查与 FAQ(中英两版结构对称)。
20
+ - 新增 `CHANGELOG.md`(Keep a Changelog)与 `RELEASE.md`(发布 SOP 清单)。
21
+ - `CONTRIBUTING.md` 补充提交规范:commit message 描述一律使用英文。
22
+ - `package.json` `files` 字段加入 `CHANGELOG.md` / `RELEASE.md`。
8
23
 
9
24
  ## [0.1.7] - 2026-08-16
10
25
 
@@ -49,6 +64,8 @@ All notable changes to **dsh-mineru** are documented here. The format follows [K
49
64
  - 限流感知(令牌桶 + 429 退避 + 每日限额);
50
65
  - Artifact 落地与 Web 界面(设置卡片、工具结果卡片、HMAC 签名预览)。
51
66
 
67
+ [0.1.9]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.9
68
+ [0.1.8]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.8
52
69
  [0.1.7]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.7
53
70
  [0.1.6]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.6
54
71
  [0.1.5]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.5
package/CONTRIBUTING.md CHANGED
@@ -20,9 +20,9 @@ Web profile 重启可复用 `D:\Users\Lee\Desktop\dsh\.dsh-restart\restart.ps1`
20
20
 
21
21
  注意:本地路径直装(pnpm link)会使 @deepseek-ai 依赖解析脱离 profile,请用 tgz 安装。
22
22
 
23
- ## 提交规范
23
+ ## 提交规范 (Commit conventions)
24
24
 
25
- - 提交信息格式:`<type>: <描述>[, 版本 X.Y.Z]`,`type` 取 `feat` / `fix` / `docs` / `refactor` / `chore`。
25
+ - 提交信息格式:`<type>: <英文描述>[, 版本 X.Y.Z]`,`type` 取 `feat` / `fix` / `docs` / `refactor` / `chore`;**描述一律用英文**(如 `fix: drag-drop fills composer draft instead of auto-send`)。
26
26
  - 文档变更(README / CHANGELOG / CONTRIBUTING / RELEASE)与代码变更**必须同一次提交**,不要分开发。
27
27
 
28
28
  ## 发布流程
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # dsh-mineru
2
2
 
3
3
  [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4
- [![version](https://img.shields.io/badge/version-0.1.7-blue)](https://github.com/Lee-Hilex/dsh-mineru/releases)
4
+ [![version](https://img.shields.io/badge/version-0.1.9-blue)](https://github.com/Lee-Hilex/dsh-mineru/releases)
5
5
  [![dsh](https://img.shields.io/badge/DeepSeek%20Harness-0.1.0--rc.6%2B-4d6bfe)](https://github.com/deepseek-ai/deepseek-harness)
6
6
  [![MinerU](https://img.shields.io/badge/MinerU-API-4d6bfe)](https://mineru.net/apiManage/docs)
7
7
 
@@ -9,139 +9,397 @@
9
9
 
10
10
  English | [简体中文](README.zh.md)
11
11
 
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
+
12
14
  ## Contents
13
15
 
14
- - [Highlights](#highlights) · [Install](#install) · [Two API modes](#two-api-modes) · [Tools](#tools) · [Configure](#configure) · [Rate limits & reliability](#rate-limits--reliability) · [Web UI](#web-ui) · [Security model](#security-model) · [Development](#development) · [Publishing](#publishing) · [Contributing](#contributing) · [License](#license)
16
+ - [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)
17
+
18
+ ## Overview
19
+
20
+ ### What is this?
21
+
22
+ dsh-mineru plugs [MinerU](https://mineru.net) (OpenDataLab's high-precision document parsing engine) into the DeepSeek Harness agent ecosystem, letting **text-only models "read" documents**: the model receives structured Markdown (tables, formulas, and images preserved) instead of binary files it cannot open.
23
+
24
+ Typical use cases:
25
+
26
+ - Read papers / contracts / reports: parse a PDF, then ask the agent to summarize or extract data;
27
+ - Batch-processing documents: parse dozens of files in one call, each producing Markdown;
28
+ - OCR for images / screenshots: scanned pages and web screenshots become searchable text;
29
+ - Formulas & tables: math formulas in papers and Excel tables survive with full structure.
30
+
31
+ ### Supported file formats
32
+
33
+ | Format | Precision API (token required) | Agent API (tokenless) |
34
+ | --- | --- | --- |
35
+ | PDF | ✅ | ✅ |
36
+ | Word (`.doc` / `.docx`) | ✅ | ✅ (`.docx` only) |
37
+ | PPT (`.ppt` / `.pptx`) | ✅ | ✅ (`.pptx` only) |
38
+ | Excel (`.xls` / `.xlsx`) | ✅ | ✅ (`.xlsx` only) |
39
+ | HTML (`.html` / `.htm`) | ✅ (forces MinerU-HTML model) | ❌ |
40
+ | Images (`.png` `.jpg` `.jpeg` `.jp2` `.webp` `.gif` `.bmp`) | ✅ | ✅ |
41
+
42
+ > Note: the Agent API does not support `.doc` / `.ppt` / `.xls` (legacy Office formats) or HTML — use the Precision API (token required) for those.
15
43
 
16
- **dsh-mineru** brings [MinerU](https://mineru.net)-powered multimodal, full-format document parsing to [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): PDF, Word, PowerPoint, Excel, HTML, and images all become structured Markdown. Provide a MinerU token to use the Precision API, or leave it blank to use the tokenless Agent API.
44
+ ### Highlights
17
45
 
18
- ## Highlights
46
+ - **Dual API modes, auto-selected** — chooses Precision or Agent parsing based on whether a token is configured; can be overridden per call;
47
+ - **Progressive tool exposure** — only the tiny `mineru_activate` bootstrap is visible until the agent activates the full toolset, saving context;
48
+ - **Drag-and-drop uploads** — drop a file into the chat; its path lands in the composer draft so text-only models can process documents;
49
+ - **Auto-chunked batch parsing** — submit hundreds of files/URLs at once; batching respects official limits automatically;
50
+ - **Rate-limit aware** — built-in token buckets, daily caps, 429 backoff, and actionable messages for every error code;
51
+ - **Artifact-backed results** — parsed output lands in the workspace as files with signed preview links in the Web UI.
19
52
 
20
- - **Dual API modes, auto-selected** — with a token the plugin uses the Precision API (up to 200 MB / 200 pages, models `pipeline`/`vlm`/`MinerU-HTML`, Zip output with `full.md` + JSON + optional docx/html/latex); without a token it uses the Agent API (up to 10 MB / 20 pages, Markdown-only, no sign-in).
21
- - **Four tools, progressive exposure** — `mineru_parse`, `mineru_batch_parse` (auto-chunked batches), `mineru_task` (resume after timeout), plus the `mineru-tools` skill; only the tiny `mineru_activate` bootstrap is visible until the agent activates the toolset.
22
- - **Drag-and-drop uploads that work with text-only models** — drop PDFs/Office documents/images into the chat; files land in the session workspace and their paths are filled into the composer draft (never auto-sent) — you add your own request and press send, bypassing the native image-attachment channel that text-only models reject.
23
- - **Rate-limit aware** — built-in token buckets (40 submits/min, 900 queries/min), daily submit accounting, `Retry-After` backoff on HTTP 429, and actionable messages for every MinerU error code.
24
- - **Artifacts & Web UI** — results are extracted under `<workspace>/.dsh-mineru/artifacts/` with HMAC-signed preview URLs, a dedicated Web Settings card (write-only token, collapsible advanced section, busy/result feedback), and custom tool-result cards.
53
+ ## Quick start
25
54
 
26
- ## Install
55
+ ### Step 1: Install
27
56
 
28
- Prerequisites: DeepSeek Harness `0.1.0-rc.6` (or a compatible `0.1.x`), and `pnpm` available to `dsh plugin`.
57
+ > **Note**: Requires an existing DeepSeek Harness installation (`0.1.0-rc.6` or a compatible `0.1.x`) with the `dsh` CLI available.
29
58
 
59
+ **From npm (recommended)**
60
+
61
+ ```bash
62
+ dsh plugin --profile web add dsh-mineru # Web profile
63
+ dsh plugin --profile headless add dsh-mineru # Headless profile
30
64
  ```
31
- dsh plugin --profile web add dsh-mineru
32
- dsh plugin --profile headless add dsh-mineru
65
+
66
+ **Build from source** (development / preview latest changes)
67
+
68
+ ```bash
69
+ git clone git@github.com:Lee-Hilex/dsh-mineru.git
70
+ cd dsh-mineru
71
+ npm install # installs peer deps (no build step for this package)
72
+ npm pack # produces dsh-mineru-<version>.tgz
73
+ dsh plugin --profile web add ./dsh-mineru-<version>.tgz
33
74
  ```
34
75
 
35
- Restart a running Web profile, then open **Settings → Plugins → MinerU 解析** to configure the token and parsing options. In a conversation, type `/mineru-tools` or let the agent load the `mineru-tools` skill. Web and Headless share the same tool semantics.
76
+ 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
+
78
+ ### Step 2: Verify the install
79
+
80
+ ```bash
81
+ dsh --profile web --dump-config | grep -A 2 "id: mineru"
82
+ ```
36
83
 
37
- For a local build, install from the packed tarball (see [CONTRIBUTING.md](CONTRIBUTING.md)):
84
+ Expected output (a `# ==` comment line plus your plugin row):
38
85
 
39
86
  ```
40
- dsh plugin --profile web add <path>/dsh-mineru-<version>.tgz
87
+ # == dsh-mineru
88
+ - id: mineru
89
+ name: dsh-mineru
41
90
  ```
42
91
 
92
+ Then restart a running Web profile (`dsh web`) and open **Settings → Plugins → MinerU 解析**.
93
+
94
+ ### Step 3: Configure (optional)
95
+
96
+ **No token needed to get started** — the plugin automatically falls back to the tokenless Agent API. Add a token to unlock the full feature set (Precision API, batch parsing, HTML, more formats):
97
+
98
+ - **Web UI**: Settings → Plugins → **MinerU 解析** → paste the token into the write-only field (blank keeps the existing value);
99
+ - **Headless / CLI**: put `MINERU_API_TOKEN: <token>` in `$DSH_HOME/.credentials.yaml`, or export the `MINERU_API_TOKEN` environment variable.
100
+
101
+ The token is resolved once per operation — **rotations take effect on the very next call without a restart**. Get a token by registering at <https://mineru.net> (API management page).
102
+
103
+ ### Step 4: Use it
104
+
105
+ **Web UI** (drag-and-drop friendly):
106
+
107
+ 1. **Drag** a PDF/Word/image into the chat — the file is saved to the session workspace and its path is filled into the composer draft (never auto-sent);
108
+ 2. Add your request, e.g. "Parse this PDF to Markdown and summarize the key points";
109
+ 3. Send. The agent activates the toolset and calls `mineru_parse`; results come back as files you can preview.
110
+
111
+ **URL parsing**: just tell the agent "parse this document: https://example.com/paper.pdf".
112
+
113
+ **Headless smoke test**: one-off tasks run on the headless profile:
114
+
115
+ ```bash
116
+ dsh --profile headless "Parse C:/docs/sample.pdf to Markdown and summarize the first 3 paragraphs"
117
+ ```
118
+
119
+ Headless and Web share the same tool semantics; you can also type `/mineru-tools` in a conversation to load the usage skill.
120
+
43
121
  ## Two API modes
44
122
 
45
- | | Precision API (token required) | Agent API (tokenless) |
123
+ | | 🎯 Precision API (token required) | ⚡ Agent API (tokenless) |
46
124
  | --- | --- | --- |
47
125
  | 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` |
48
126
  | Models | `pipeline` / `vlm` (default) / `MinerU-HTML` | fixed lightweight pipeline |
49
- | Limits | ≤ 200 MB, ≤ 200 pages | ≤ 10 MB, ≤ 20 pages |
50
- | Batch | yes (URLs ≤ 200/batch, local uploads ≤ 50/batch, auto-chunked) | no, single file |
51
- | Output | Zip: `full.md` + `*_content_list.json` + `layout.json` + images (+ optional docx/html/latex) | Markdown only |
127
+ | Size limit | ≤ 200 MB | ≤ 10 MB |
128
+ | Page limit | ≤ 200 pages | ≤ 20 pages |
129
+ | Batch parsing | ✅ (URLs ≤ 200/batch, local uploads ≤ 50/batch, auto-chunked) | ❌ single file only |
130
+ | Output | Zip: `full.md` + `content_list.json` + `layout.json` + images (+ optional docx/html/latex) | Markdown only |
131
+ | Best for | Long docs, scans, formulas/tables, batch jobs, HTML | Quick reads, small files, temporary use |
132
+
133
+ **Mode selection** (`mode` parameter or config):
52
134
 
53
- Mode resolution: `mode=auto` (default) selects by token presence; `mode=precision` forces the Precision API (fails loudly without a token); `mode=agent` forces the Agent API. HTML files are Precision-only and automatically force `MinerU-HTML`.
135
+ - `auto` (default) — Precision when a token is configured, Agent otherwise;
136
+ - `precision` — force Precision; errors loudly when no token is configured;
137
+ - `agent` — force Agent.
138
+
139
+ To see which API the current session is actually using: call `mineru_activate` once — the `api` field in its result tells you (`precision` or `agent`).
54
140
 
55
141
  ## Tools
56
142
 
57
- | Tool | Description |
143
+ By default the toolset is **progressively exposed**: only the `mineru_activate` bootstrap is registered at first. One call unlocks the other three tools, and `mineru_activate` then hides itself for that session.
144
+
145
+ ### `mineru_activate` — activation bootstrap
146
+
147
+ | Item | Description |
58
148
  | --- | --- |
59
- | `mineru_activate` | Bootstrap tool (visible in progressive mode): one call unlocks the rest of the toolset for the session, then hides itself. |
60
- | `mineru_parse` | Parse one document: a workspace file path or an http(s) URL. Signature upload, async polling, results written as Artifacts. |
61
- | `mineru_batch_parse` | Precision-API batch parsing: a mixed list of local paths and URLs, auto-chunked (≤ 50 files / ≤ 200 URLs per batch, ≤ 1000 per call), per-item results. |
62
- | `mineru_task` | Query and optionally collect an already-submitted task (`taskId` + `api`) — resume a timed-out parse without resubmitting. |
149
+ | Purpose | Unlocks `mineru_parse` / `mineru_batch_parse` / `mineru_task` and loads the `mineru-tools` skill |
150
+ | Parameters | none |
151
+ | Returns | A status summary: effective API mode, token configured or not, per-API limits |
152
+
153
+ ### `mineru_parse` — parse a single document
154
+
155
+ Parses a **workspace file path** or **http(s) URL** into structured Markdown.
156
+
157
+ | Parameter | Required | Description |
158
+ | --- | --- | --- |
159
+ | `source` | ✅ | Workspace file path, or full http(s) URL |
160
+ | `mode` | | `auto` (default) / `precision` / `agent` |
161
+ | `modelVersion` | | Precision model: `pipeline` / `vlm` (default, recommended) / `MinerU-HTML` (forced automatically for HTML sources) |
162
+ | `language` | | Document language pack, default `ch` — see [Configuration](#configuration) |
163
+ | `enableTable` | | Table recognition, default `true` |
164
+ | `enableFormula` | | Formula recognition, default `true` |
165
+ | `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) |
167
+ | `pageRange` | | Agent page range, `from-to` or single page: `"1-10"` |
168
+ | `extraFormats` | | Extra export formats (Precision only): `docx` / `html` / `latex` |
169
+ | `dataId` | | Business data ID (optional, ≤ 128 chars) |
170
+ | `timeoutMs` | | Whole-operation timeout incl. polling; defaults to plugin config (10 min) |
171
+ | `output` | | Result directory base name; defaults to the source file name |
172
+
173
+ **Result highlights**: `ok`, the `api`/`modelVersion` used, `taskId`, duration, `runDir`, a truncated Markdown preview, and the artifact list (with signed preview links on Web).
174
+
175
+ ### `mineru_batch_parse` — batch parsing (Precision only)
176
+
177
+ Parses many documents in one call; **local paths and URLs can be mixed**, submissions are auto-chunked within official limits, and per-item success/failure is reported.
178
+
179
+ | Parameter | Required | Description |
180
+ | --- | --- | --- |
181
+ | `sources` | ✅ | Mixed list of file paths / URLs |
182
+ | `outputPrefix` | | Result directory base name, default `batch` |
183
+ | `dataIdPrefix` | | Business data ID prefix; a sequence number is appended per item (optional) |
184
+ | others | | Same shared options as `mineru_parse` (except `mode` — this tool is Precision-only) |
185
+
186
+ **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.
63
187
 
64
- All results land under `<workspace>/.dsh-mineru/artifacts/<run>/`: for the Precision API this is the fully unpacked Zip (`full.md` etc.), for the Agent API it is `full.md`; a `run.json` metadata file is always included. Tool results carry a bounded Markdown preview, the task id, duration, and the artifact list (with signed preview links). The Web tool cards open/preview files directly; Headless agents reuse the absolute paths.
188
+ **Result highlights**: success/failure counts, `batchId`s, per-item results (each success includes its `full.md` directory), and error messages for failures.
65
189
 
66
- ## Configure
190
+ ### `mineru_task` — task query & result collection
67
191
 
68
- Configuration resolves in three layers: schema defaults ← composition layer (the `mineru` row config in a profile patch) ← the user settings document (written through the Web Settings card).
192
+ **A timed-out parse is never lost**: use the `taskId` + `api` returned by `mineru_parse` to query progress and collect results later — no resubmission needed.
69
193
 
194
+ | Parameter | Required | Description |
195
+ | --- | --- | --- |
196
+ | `taskId` | ✅ | The task_id returned when the task was submitted |
197
+ | `api` | ✅ | Which API owns the task: `precision` or `agent` |
198
+ | `wait` | | Poll until the task finishes, default `false` (query once) |
199
+ | `collect` | | Download the result into an Artifact when done, default `true` |
200
+ | `output` | | Result directory base name, default `task` |
201
+ | `timeoutMs` | | Timeout for `wait` mode |
202
+
203
+ **Typical scenario**: `mineru_parse` timed out on a large PDF → tell the agent "collect the result for taskId=xxx with mineru_task".
204
+
205
+ ### `mineru-tools` skill
206
+
207
+ The plugin ships a skill of the same name. Type `/mineru-tools` in a conversation or ask the agent to load it via the `skill` tool: it contains the full agent-facing manual — tool list, dual-API comparison, usage notes, and official limits.
208
+
209
+ ## Results & artifacts
210
+
211
+ All results land in **`<workspace>/.dsh-mineru/artifacts/<run>/`** (`<workspace>` is the session workspace, `<run>` a fresh directory per parse):
212
+
213
+ ```
214
+ .dsh-mineru/artifacts/<run>/
215
+ ├── full.md # Structured Markdown (both modes)
216
+ ├── run.json # Run metadata (source, API, model, duration, …)
217
+ ├── *_content_list.json # Structured content list (Precision only)
218
+ ├── layout.json # Layout data (Precision only)
219
+ ├── *_model.json # Raw model output (Precision only)
220
+ ├── *_origin.pdf # Server-side original file (Precision only)
221
+ ├── images/ # Embedded images (Precision only)
222
+ └── result.zip # Raw server result package (Precision only)
70
223
  ```
224
+
225
+ - Tool results carry a **bounded Markdown preview** (first 12 KB by default); read the full text from `full.md` with the `read` tool;
226
+ - **Web UI**: artifacts get HMAC-signed preview URLs (24 h lifetime by default) — click to view/download; tool-result cards open files directly;
227
+ - **Headless**: use the absolute paths returned by the tool.
228
+
229
+ Batch parses keep each document in its own subdirectory: `<run>/<file-name>/full.md`.
230
+
231
+ ## Configuration
232
+
233
+ Configuration resolves in three layers, later wins: **schema defaults ← composition layer (the `mineru` row config in a profile patch) ← user settings (written through the Web Settings card)**.
234
+
235
+ ```yaml
236
+ # Composition-layer example (cordis.patch.yml or a profile patch)
71
237
  - id: mineru
72
238
  config:
73
- mode: auto # auto | precision | agent
74
- modelVersion: vlm # pipeline | vlm | MinerU-HTML
75
- language: ch
76
- enableTable: true
77
- enableFormula: true
78
- isOcr: false
79
- extraFormats: [] # docx | html | latex (Precision API)
80
- exposeMode: progressive # progressive: mineru_activate bootstrap; always: register everything globally
81
- timeoutMs: 600000
82
- pollIntervalMs: 3000
83
- inlineMarkdownBytes: 12000
84
- submitRatePerMin: 40
85
- pollRatePerMin: 900
86
- dailySubmitLimit: 5000
87
- artifactRootName: .dsh-mineru
239
+ mode: auto # auto | precision | agent
240
+ modelVersion: vlm # pipeline | vlm | MinerU-HTML
241
+ language: ch # document language pack
242
+ enableTable: true # table recognition
243
+ enableFormula: true # formula recognition
244
+ isOcr: false # force OCR
245
+ extraFormats: [] # docx | html | latex (Precision only)
246
+ exposeMode: progressive # progressive: bootstrap activation; always: register everything globally
247
+ timeoutMs: 600000 # whole-operation timeout (ms)
248
+ pollIntervalMs: 3000 # result poll interval (ms)
249
+ inlineMarkdownBytes: 12000 # inline preview bytes in tool results
250
+ submitRatePerMin: 40 # submission rate cap (per minute)
251
+ pollRatePerMin: 900 # query rate cap (per minute)
252
+ dailySubmitLimit: 5000 # daily submission cap
253
+ artifactRootName: .dsh-mineru # artifact root directory name
88
254
  ```
89
255
 
256
+ ### Full option reference
257
+
258
+ | Option | Default | Description |
259
+ | --- | --- | --- |
260
+ | `mode` | `auto` | API mode: `auto` (by token presence) / `precision` / `agent` |
261
+ | `modelVersion` | `vlm` | Precision model: `pipeline` / `vlm` / `MinerU-HTML` (forced for HTML sources) |
262
+ | `language` | `ch` | Document language pack (see below) |
263
+ | `enableTable` | `true` | Table recognition |
264
+ | `enableFormula` | `true` | Formula recognition |
265
+ | `isOcr` | `false` | Force OCR for scans |
266
+ | `extraFormats` | `[]` | Extra export formats (Precision only): `docx` / `html` / `latex` |
267
+ | `exposeMode` | `progressive` | `progressive`: bootstrap + per-agent activation; `always`: register all tools globally |
268
+ | `timeoutMs` | `600000` | Whole-operation timeout incl. polling; range 10 s – 1 h |
269
+ | `pollIntervalMs` | `3000` | Result poll interval; range 500 – 60000 ms |
270
+ | `pollJitterMs` | `500` | Per-query poll jitter so requests do not line up |
271
+ | `maxFileBytes` | `0` | Local file byte cap; `0` = per-mode API limits (200 MB / 10 MB) |
272
+ | `inlineMarkdownBytes` | `12000` | Markdown preview bytes returned inline with tool results |
273
+ | `artifactUrlTtlSec` | `86400` | Signed preview URL lifetime (s); range 60 s – 30 days |
274
+ | `submitRatePerMin` | `40` | Submission rate cap (official: 50/min) |
275
+ | `pollRatePerMin` | `900` | Result-query rate cap (official: 1000/min) |
276
+ | `dailySubmitLimit` | `5000` | Daily submission cap (official: 5000/day) |
277
+ | `tokenCredential` | `MINERU_API_TOKEN` | DSH credential reference name (a reference, never the secret) |
278
+ | `apiBaseUrl` | `https://mineru.net` | MinerU API base URL |
279
+ | `artifactRootName` | `.dsh-mineru` | Artifact root directory name (single segment) |
280
+ | `userAgent` | `dsh-mineru/<version>` | Request User-Agent |
281
+
90
282
  ### Token (DSH Credentials)
91
283
 
92
- The configuration stores only the **credential reference name** (default `MINERU_API_TOKEN`); the token value lives in the credentials layer:
284
+ The configuration stores only the **credential reference name** (default `MINERU_API_TOKEN`); the token value lives in the credentials layer. Any of three ways:
93
285
 
94
- - Web Settings: the token field is write-only — blank keeps the existing value, 清除 removes it;
95
- - Headless / CLI: put `MINERU_API_TOKEN: <token>` in `$DSH_HOME/.credentials.yaml`, or export `MINERU_API_TOKEN`.
286
+ 1. **Web Settings card**: the token field is write-only — blank keeps the existing value, 清除 removes it;
287
+ 2. **Headless / CLI**: put `MINERU_API_TOKEN: <token>` in `$DSH_HOME/.credentials.yaml`;
288
+ 3. **Environment variable**: export `MINERU_API_TOKEN`.
96
289
 
97
- The token is resolved once per operation, so a rotation applies to the very next call without a restart. Logs, errors, and Settings responses never contain the secret.
290
+ The token is resolved once per operation — **a rotation applies to the very next call without a restart**. Logs, errors, and Settings responses **never contain the secret**.
98
291
 
99
292
  ### language values
100
293
 
101
- `ch` (Chinese + English, default), `ch_server`, `en`, `japan`, `korean`, `chinese_cht`, `ta`, `te`, `ka`, `el`, `th`, `latin`, `arabic`, `cyrillic`, `east_slavic`, `devanagari`.
294
+ | Value | Meaning | Value | Meaning |
295
+ | --- | --- | --- | --- |
296
+ | `ch` | Chinese + English (default) | `ch_server` | Chinese (server-side) |
297
+ | `en` | English | `japan` | Japanese |
298
+ | `korean` | Korean | `chinese_cht` | Traditional Chinese |
299
+ | `latin` | Latin script | `arabic` | Arabic |
300
+ | `cyrillic` | Cyrillic script | `east_slavic` | East Slavic |
301
+ | `devanagari` | Devanagari | `th` | Thai |
302
+ | `ta` | Tamil | `te` | Telugu |
303
+ | `ka` | Georgian | `el` | Greek |
304
+
305
+ ## Usage tips
306
+
307
+ - **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
+ - **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**: prefer Precision + `pageRanges` in chunks; the `vlm` model handles formulas and complex layouts best;
311
+ - **Timeout recovery**: a timeout is not a failure — the task keeps running server-side; collect it later with `mineru_task` + `taskId`;
312
+ - **HTML documents**: Precision only, and the `MinerU-HTML` model is forced automatically;
313
+ - **HTML daily quota**: HTML submissions have a separate official cap (max 100/day).
314
+
315
+ ## Web UI
316
+
317
+ - **Settings → Plugins → MinerU 解析**: write-only token, mode, model, language, table/formula/OCR switches, extra formats, plus a collapsible **Advanced** section (timeouts/polling/rate limits, API base URL, credential reference, artifact root name). Every action shows immediate feedback (busy states and result messages); saves are revision-fenced (409 conflict → reload and retry);
318
+ - **Test buttons**: 测试 Token submits the official one-page demo PDF to verify the key (≈ 1 page of quota); 测试 Agent API verifies the tokenless channel (IP rate-limited);
319
+ - **Tool cards**: results of the three parsing tools render as dedicated cards — mode badge, duration, task id, artifact chips (open / preview), bounded preview, per-item batch outcomes.
102
320
 
103
321
  ## Rate limits & reliability
104
322
 
105
- - Client-side token buckets: 40 submissions/min by default (official: 50), 900 result queries/min (official: 1000), and a daily cap of 5000 (official) that fails fast locally.
106
- - HTTP 429 honors `Retry-After` with automatic backoff and retry.
107
- - Polling carries random jitter; on timeout the task is not lost — collect it later with `mineru_task` using the `taskId`.
108
- - Error codes map to actionable messages (A0202/A0211 token problems, -60005/-60006 size/pages, -30001~-30003 Agent limits, -60018 daily quota, and more).
323
+ **Official MinerU limits** (the plugin enforces local equivalents and backoff; requests beyond the limits are rejected with HTTP 429):
109
324
 
110
- ## Web UI
325
+ | Dimension | Official limit | Plugin local default |
326
+ | --- | --- | --- |
327
+ | Submissions | 50 files/min | 40/min |
328
+ | Daily submissions | 5000 files/day/user (HTML: max 100/day) | 5000 (fails fast locally) |
329
+ | Result queries | 1000/min | 900/min |
330
+
331
+ Plugin behavior:
332
+
333
+ - Built-in **token buckets** (separate for submit/query) — local requests queue instead of hammering the API;
334
+ - HTTP 429 honors `Retry-After` with **automatic backoff and retry**;
335
+ - Polling carries random jitter (`pollJitterMs`) so requests do not line up;
336
+ - On whole-operation timeout (`timeoutMs`) the task is not lost — collect it later with `mineru_task` + `taskId`.
337
+
338
+ ## Error code reference
111
339
 
112
- - **Settings → Plugins → MinerU 解析**: write-only token, mode/model/language, recognition switches, extra formats, plus a collapsible **Advanced** section (timeouts, rate limits, endpoint, credential reference, artifact root). Every action shows immediate feedback (busy states and result messages); saves are revision-fenced (409 conflict → reload and retry); 测试 Token submits the official one-page demo PDF to verify the key (about 1 page of quota); 测试 Agent API verifies the tokenless channel (IP rate-limited).
113
- - **Tool cards**: `mineru_parse` / `mineru_batch_parse` / `mineru_task` results render as dedicated cards with the mode badge, duration, task id, artifact chips (open / preview), a bounded preview, and per-item batch outcomes.
340
+ | Code | Meaning | What to do |
341
+ | --- | --- | --- |
342
+ | `A0202` / `A0211` | Token invalid / expired | Update the MinerU token in Settings |
343
+ | `-60005` / `-30001` | File too large (200 MB / 10 MB) | Compress or split the file |
344
+ | `-60006` / `-30003` | Too many pages (200 / 20) | Split with `pageRanges` / `pageRange` |
345
+ | `-60018` | Daily quota exhausted | Try again tomorrow; check `dailySubmitLimit` |
346
+ | `429` | Too many requests | Retry later or lower concurrency |
347
+ | `MINERU_TOKEN_REQUIRED` | Token-required operation without a token | Configure a token or use Agent mode |
348
+ | `MINERU_UNSUPPORTED_TYPE` | Format unsupported by the current API | Switch format or API mode |
349
+ | `MINERU_BATCH_TOO_LARGE` | Batch exceeds 1000 items | Split into multiple calls |
350
+
351
+ Every error is mapped to an **actionable message** instead of a raw code.
114
352
 
115
353
  ## Security model
116
354
 
117
- - Input paths resolve against the session workspace; ZIP unpacking rejects absolute paths, `..` traversal, encrypted entries, and ZIP64, with entry-count and byte caps, and verifies CRC32 on every extracted entry.
118
- - Artifacts are written only under `<workspace>/.dsh-mineru`; preview URLs are HMAC-signed with expiry and re-validated on every read.
119
- - Web routes accept same-origin requests only; HTML/SVG artifacts are served as attachments with `nosniff`.
120
- - All network work honors the tool-call abort signal (cancel/timeout stops uploads, polling, and downloads).
355
+ - **Path isolation**: input paths resolve against the session workspace; files outside it cannot be read;
356
+ - **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
+ - **Artifact boundary**: written only under `<workspace>/.dsh-mineru`; preview URLs are HMAC-signed with expiry and re-validated on every read;
358
+ - **Web routes**: same-origin only; HTML/SVG artifacts are served as attachments with `nosniff`;
359
+ - **Cancellable**: all network work honors the tool-call abort signal — cancel/timeout stops uploads, polling, and downloads;
360
+ - **Secrets never leave the vault**: the token lives only in the credentials layer; logs/errors/Settings responses never carry it.
121
361
 
122
- ## Development
362
+ ## FAQ
123
363
 
124
- The package needs no build step: `lib/` ships loadable ESM and `lib/client.js` is the packed browser bundle (`dsh.client` → the `./client` export).
364
+ **Q: Can I use it without a token?**
365
+ Yes. It falls back to the tokenless Agent API (≤ 10 MB, ≤ 20 pages, Markdown only) — fine for quick reads.
125
366
 
126
- ```
127
- node --check lib/*.js # syntax check
128
- npm pack # pack a local tarball
129
- ```
367
+ **Q: Why is only `mineru_activate` in my tool list?**
368
+ That is progressive exposure by design. Call `mineru_activate` once and the other three tools unlock; or set `exposeMode: always` to register everything globally.
130
369
 
131
- Local path installs must use the tarball (pnpm `link:` installs resolve `@deepseek-ai` peers outside the profile); see [CONTRIBUTING.md](CONTRIBUTING.md) for the full loop.
370
+ **Q: My parse timed out — is the file lost?**
371
+ No. The task keeps running on MinerU's servers; use `mineru_task` (`taskId` + `api`) anytime to query progress and collect the result without resubmitting.
132
372
 
133
- ## Publishing
373
+ **Q: Why didn't the parse start after I dropped a file?**
374
+ Drag-and-drop only fills the path into the composer draft (to avoid accidental sends). Add your request and press send; the agent then starts parsing.
134
375
 
376
+ **Q: A0202 / A0211 errors?**
377
+ The token is invalid or expired. Re-enter it in Settings → Plugins → MinerU 解析 (a blank save keeps the old value).
378
+
379
+ **Q: Can I parse HTML pages?**
380
+ Yes, but Precision API only (token required), and the MinerU-HTML model is forced. Note the server cannot reach blocked URLs.
381
+
382
+ **Q: How do I batch-parse?**
383
+ Use `mineru_batch_parse` with a list of paths/URLs — auto-chunked (local ≤ 50/batch, URLs ≤ 200/batch, ≤ 1000 per call).
384
+
385
+ **Q: What's the difference between the Agent and Precision results?**
386
+ Agent produces Markdown only. Precision additionally yields `content_list.json`, `layout.json`, `model.json`, embedded images, optional docx/html/latex exports, and table/formula recognition controls.
387
+
388
+ ## Development & publishing
389
+
390
+ No build step: `lib/` ships loadable ESM and `lib/client.js` is the packed browser bundle.
391
+
392
+ ```bash
393
+ node --check lib/*.js # syntax check
394
+ npm pack # pack a local tarball
135
395
  ```
136
- npm pack
137
- npm publish # requires npm login
138
- dsh plugin --profile web add dsh-mineru # user install after publishing
139
- ```
396
+
397
+ For a new release, follow the checklist in [RELEASE.md](RELEASE.md) (bump version → update CHANGELOG and both READMEs → pack & verify → tag & push → `npm publish`); see [CONTRIBUTING.md](CONTRIBUTING.md) for the full development loop.
140
398
 
141
399
  ## Contributing
142
400
 
143
- Issues and pull requests are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md). Please never paste a MinerU token into an issue.
401
+ Issues and pull requests are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md). Please **never paste a MinerU token** into an issue.
144
402
 
145
403
  ## License
146
404
 
147
- [MIT](LICENSE). MinerU is provided by OpenDataLab; its official docs ([API](https://mineru.net/apiManage/docs), [rate limits](https://mineru.net/apiManage/limit)) remain authoritative.
405
+ [MIT](LICENSE). MinerU is provided by [OpenDataLab](https://opendatalab.com); its official docs ([API](https://mineru.net/apiManage/docs), [rate limits](https://mineru.net/apiManage/limit)) remain authoritative.
package/README.zh.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # dsh-mineru
2
2
 
3
3
  [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4
- [![version](https://img.shields.io/badge/version-0.1.7-blue)](https://github.com/Lee-Hilex/dsh-mineru/releases)
4
+ [![version](https://img.shields.io/badge/version-0.1.9-blue)](https://github.com/Lee-Hilex/dsh-mineru/releases)
5
5
  [![dsh](https://img.shields.io/badge/DeepSeek%20Harness-0.1.0--rc.6%2B-4d6bfe)](https://github.com/deepseek-ai/deepseek-harness)
6
6
  [![MinerU](https://img.shields.io/badge/MinerU-API-4d6bfe)](https://mineru.net/apiManage/docs)
7
7
 
@@ -9,139 +9,397 @@
9
9
 
10
10
  [English](README.md) | 简体中文
11
11
 
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
+
12
14
  ## 目录
13
15
 
14
- - [特性一览](#特性一览) · [安装](#安装) · [两种 API 模式](#两种-api-模式) · [工具](#工具) · [配置](#配置) · [限流与可靠性](#限流与可靠性) · [Web 界面](#web-界面) · [安全模型](#安全模型) · [开发](#开发) · [发布](#发布) · [贡献](#贡献) · [许可](#许可)
16
+ - [简介](#简介) · [快速开始](#快速开始) · [两种 API 模式](#两种-api-模式) · [工具详解](#工具详解) · [解析结果与 Artifacts](#解析结果与-artifacts) · [配置参考](#配置参考) · [使用技巧](#使用技巧) · [Web 界面](#web-界面) · [限流与可靠性](#限流与可靠性) · [错误码速查](#错误码速查) · [安全模型](#安全模型) · [常见问题 FAQ](#常见问题-faq) · [开发与发布](#开发与发布) · [贡献](#贡献) · [许可](#许可)
17
+
18
+ ## 简介
19
+
20
+ ### 这是什么?
21
+
22
+ dsh-mineru 把 [MinerU](https://mineru.net)(OpenDataLab 出品的高精度文档解析引擎)接入 DeepSeek Harness 的 Agent 生态,让**纯文本模型也能"看懂"文档**:模型拿到的是结构化 Markdown(含表格、公式、图片),而不是打不开的二进制文件。
23
+
24
+ 典型场景:
25
+
26
+ - 读论文 / 合同 / 报告:让 Agent 解析 PDF 后总结要点、提取数据;
27
+ - 批量整理资料:一次解析几十份文档,逐项产出 Markdown;
28
+ - 图片 / 截图转文字:OCR 扫描件、网页截图转可检索文本;
29
+ - 公式与表格还原:论文中的数学公式、Excel 表格结构完整保留。
30
+
31
+ ### 支持的文件格式
32
+
33
+ | 格式 | 精准解析 API(需 Token) | Agent 轻量 API(免 Token) |
34
+ | --- | --- | --- |
35
+ | PDF | ✅ | ✅ |
36
+ | Word(`.doc` / `.docx`) | ✅ | ✅(仅 `.docx`) |
37
+ | PPT(`.ppt` / `.pptx`) | ✅ | ✅(仅 `.pptx`) |
38
+ | Excel(`.xls` / `.xlsx`) | ✅ | ✅(仅 `.xlsx`) |
39
+ | HTML(`.html` / `.htm`) | ✅(自动强制 MinerU-HTML 模型) | ❌ |
40
+ | 图片(`.png` `.jpg` `.jpeg` `.jp2` `.webp` `.gif` `.bmp`) | ✅ | ✅ |
41
+
42
+ > 注:Agent 轻量 API 不支持 `.doc` / `.ppt` / `.xls`(旧版 Office 格式)与 HTML,遇到这类文件请改用精准解析(需 Token)。
15
43
 
16
- **dsh-mineru** 给 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 提供基于 [MinerU](https://mineru.net) 的多模态全格式文档解析能力:PDF、Word、PowerPoint、Excel、HTML、图片 → 结构化 Markdown。**填写 MinerU Token 走 🎯 精准解析 API;Token 留空走 ⚡ Agent 轻量解析 API(免登录,IP 限频)。**
44
+ ### 核心能力
17
45
 
18
- ## 特性一览
46
+ - **双 API 自动切换** — 按是否配置 Token 自动选择精准解析或轻量解析,也可手动指定;
47
+ - **渐进式工具曝光** — 平时只挂一个极小的 `mineru_activate` 引导工具,激活后才挂载完整工具集,省上下文;
48
+ - **拖拽上传** — 文件直接拖进聊天窗口,路径自动填入输入框,纯文本模型也能处理文档;
49
+ - **自动分批批量解析** — 一次提交上百个文件/URL,自动按官方限额分批;
50
+ - **限流感知** — 内置令牌桶、每日限额、429 退避重试,错误码全部翻译成可操作提示;
51
+ - **结果落地为 Artifact** — 解析结果写入工作区文件,Web 界面可预览/打开,带签名链接。
19
52
 
20
- - **双 API 模式自动选择** — 有 Token 用精准解析 API(≤200MB、≤200 页,模型 `pipeline`/`vlm`/`MinerU-HTML`,Zip 输出 `full.md` + JSON + 可选 docx/html/latex);无 Token 用 Agent 轻量解析 API(≤10MB、≤20 页,仅 Markdown,免登录)。
21
- - **四个工具、渐进式曝光** — `mineru_parse`、`mineru_batch_parse`(自动分批)、`mineru_task`(超时续收),外加 `mineru-tools` 技能;平时只有极小的 `mineru_activate` 引导工具可见,激活后才挂载完整工具集。
22
- - **拖拽上传,纯文本模型也能用** — 把 PDF/Office 文档/图片直接拖进聊天窗口:文件先落到会话工作区,其路径会**填入输入框草稿(不自动发送)**,由你补充需求后自行发送,完全绕开纯文本模型会拒绝的原生图片附件通道。
23
- - **限流感知** — 内置令牌桶(提交 40 次/分钟、查询 900 次/分钟)、每日提交计数、HTTP 429 按 `Retry-After` 退避重试、全部错误码映射为可操作提示。
24
- - **Artifact 与 Web 界面** — 结果解包到 `<workspace>/.dsh-mineru/artifacts/`,附带 HMAC 签名预览链接;Web 设置有专属卡片(Token 只写、高级设置折叠、操作即时反馈)与专属工具结果卡片。
53
+ ## 快速开始
25
54
 
26
- ## 安装
55
+ ### 第 1 步:安装
27
56
 
28
- 前置:DeepSeek Harness `0.1.0-rc.6`(或兼容的 `0.1.x`)、`pnpm` 可用。
57
+ > **Note**: 需要已安装 DeepSeek Harness(`0.1.0-rc.6` 或兼容的 `0.1.x`),且 `dsh` 命令可用。
29
58
 
59
+ **从 npm 安装(推荐)**
60
+
61
+ ```bash
62
+ dsh plugin --profile web add dsh-mineru # Web 界面使用
63
+ dsh plugin --profile headless add dsh-mineru # 无头(Headless)模式使用
30
64
  ```
31
- dsh plugin --profile web add dsh-mineru
32
- dsh plugin --profile headless add dsh-mineru
65
+
66
+ **从源码构建**(开发 / 预览最新改动)
67
+
68
+ ```bash
69
+ git clone git@github.com:Lee-Hilex/dsh-mineru.git
70
+ cd dsh-mineru
71
+ npm install # 安装 peer 依赖(本包无构建步骤,无需 build)
72
+ npm pack # 产出 dsh-mineru-<version>.tgz
73
+ dsh plugin --profile web add ./dsh-mineru-<version>.tgz
33
74
  ```
34
75
 
35
- 重启 Web profile 后,在 **设置 → 插件 → MinerU 解析** 中配置 Token 与解析选项;在会话中输入 `/mineru-tools` 或让 Agent 调用 `skill` 工具加载 `mineru-tools` 技能。Headless 与 Web 共用同一套工具语义。
76
+ 修改源码后重新 `npm pack` 并重装即可。注意本地安装请用 tgz(`pnpm link:` 安装会使 `@deepseek-ai` 依赖解析脱离 profile)。
36
77
 
37
- 本地开发版请用打包后的 tgz 安装(见 [CONTRIBUTING.md](CONTRIBUTING.md)):
78
+ ### 第 2 步:验证安装
38
79
 
80
+ ```bash
81
+ dsh --profile web --dump-config | grep -A 2 "id: mineru"
39
82
  ```
40
- dsh plugin --profile web add <路径>/dsh-mineru-<version>.tgz
83
+
84
+ 期望输出(`# ==` 注释行 + 你的插件行):
85
+
86
+ ```
87
+ # == dsh-mineru
88
+ - id: mineru
89
+ name: dsh-mineru
90
+ ```
91
+
92
+ 然后重启 Web profile(`dsh web`),在 **设置 → 插件 → MinerU 解析** 中即可看到本插件。
93
+
94
+ ### 第 3 步:配置(可选)
95
+
96
+ **不配 Token 也能用**(自动走 Agent 轻量解析)。配 Token 可以解锁完整能力(精准解析 + 批量 + HTML + 更多格式):
97
+
98
+ - **Web 界面**:设置 → 插件 → **MinerU 解析** → 在 Token 输入框粘贴 Token(只写不读,留空保留现有值);
99
+ - **Headless / 命令行**:在 `$DSH_HOME/.credentials.yaml` 写入 `MINERU_API_TOKEN: <你的Token>`,或设置环境变量 `MINERU_API_TOKEN`。
100
+
101
+ Token 每次调用时实时解析,**轮换后无需重启立即生效**。Token 去哪领:<https://mineru.net> 注册后到 API 管理页面获取。
102
+
103
+ ### 第 4 步:开始使用
104
+
105
+ **Web 界面**(推荐方式,支持拖拽):
106
+
107
+ 1. 把 PDF/Word/图片直接**拖进聊天窗口** —— 文件会自动保存到会话工作区,路径填入输入框(不会自动发送);
108
+ 2. 在输入框补一句需求,比如「把这份 PDF 解析成 Markdown,然后总结一下重点」;
109
+ 3. 发送。Agent 会自动激活工具并调用 `mineru_parse`,解析结果以文件形式返回,可点击预览。
110
+
111
+ **URL 解析**:直接告诉 Agent「解析这个网页/文档:https://example.com/paper.pdf」即可。
112
+
113
+ **Headless 快速验证(冒烟测试)**:一次性任务走 headless profile:
114
+
115
+ ```bash
116
+ dsh --profile headless "把 C:/docs/sample.pdf 解析成 Markdown,并总结前 3 段"
41
117
  ```
42
118
 
119
+ Headless 与 Web 共用同一套工具语义;也可以在会话中输入 `/mineru-tools` 加载使用说明技能。
120
+
43
121
  ## 两种 API 模式
44
122
 
45
123
  | 维度 | 🎯 精准解析 API(需 Token) | ⚡ Agent 轻量解析 API(免 Token) |
46
124
  | --- | --- | --- |
47
125
  | 接口 | `/api/v4/extract/task`、`/api/v4/file-urls/batch`、`/api/v4/extract/task/batch` | `/api/v1/agent/parse/url`、`/api/v1/agent/parse/file` |
48
- | 模型 | `pipeline` / `vlm`(默认)/ `MinerU-HTML` | 固定 pipeline 轻量模型 |
49
- | 限制 | ≤200MB、≤200 页 | ≤10MB、≤20 页 |
50
- | 批量 | ✅(URL 每批 ≤200、本地上传每批 ≤50,自动分批) | ❌ 单文件 |
51
- | 输出 | Zip:`full.md` + `*_content_list.json` + `layout.json` + 图片(可加 docx/html/latex) | 仅 Markdown |
126
+ | 模型 | `pipeline` / `vlm`(默认)/ `MinerU-HTML` | 固定轻量 pipeline 模型 |
127
+ | 大小限制 | ≤ 200 MB | ≤ 10 MB |
128
+ | 页数限制 | ≤ 200 页 | ≤ 20 页 |
129
+ | 批量解析 | ✅(URL 每批 ≤200,本地上传每批 ≤50,自动分批) | ❌ 仅单文件 |
130
+ | 输出 | Zip:`full.md` + `content_list.json` + `layout.json` + 图片(可加 docx/html/latex) | 仅 Markdown |
131
+ | 适用场景 | 长文档、扫描件、公式表格、批量、HTML | 快速粗读、小文件、临时使用 |
52
132
 
53
- 模式解析:`mode=auto`(默认)按 Token 是否配置自动选择;`mode=precision` 强制精准解析(无 Token 直接报错);`mode=agent` 强制轻量解析。HTML 文件仅精准解析支持,并自动强制 `MinerU-HTML` 模型。
133
+ **模式选择**(`mode` 参数或配置项):
54
134
 
55
- ## 工具
135
+ - `auto`(默认)— 有 Token 走精准解析,没 Token 走 Agent 轻量;
136
+ - `precision` — 强制精准解析,没配 Token 会直接报错提示;
137
+ - `agent` — 强制 Agent 轻量解析。
56
138
 
57
- | 工具 | 说明 |
139
+ 想知道当前会话实际走的哪个 API:调用一次 `mineru_activate`,返回结果里的 `api` 字段会明确告诉你(`precision` 或 `agent`)。
140
+
141
+ ## 工具详解
142
+
143
+ 安装后,工具集默认**渐进式曝光**:一开始只有 `mineru_activate` 一个引导工具,调用一次即解锁其余三个工具,随后 `mineru_activate` 对本会话自动隐藏。
144
+
145
+ ### `mineru_activate` —— 激活引导
146
+
147
+ | 项 | 说明 |
58
148
  | --- | --- |
59
- | `mineru_activate` | 引导工具(progressive 模式可见):一次调用解锁其余工具,之后对本会话隐藏 |
60
- | `mineru_parse` | 解析单个文档:工作区文件路径或 http(s) URL;签名上传、异步轮询、结果落地为 Artifact |
61
- | `mineru_batch_parse` | 精准解析批量解析:本地路径与 URL 混合列表,自动分批(每批 ≤50 文件 / ≤200 URL,单次 ≤1000),逐项报告成败 |
62
- | `mineru_task` | 查询 / 收集已提交任务(`taskId` + `api`)——超时后恢复收集,无需重复提交 |
149
+ | 用途 | 解锁 `mineru_parse` / `mineru_batch_parse` / `mineru_task` 并加载 `mineru-tools` 技能 |
150
+ | 参数 | 无 |
151
+ | 返回 | 当前生效的 API 模式、是否已配 Token、各 API 限制等现状摘要 |
152
+
153
+ ### `mineru_parse` —— 解析单个文档
154
+
155
+ 将**工作区文件路径**或 **http(s) URL** 解析为结构化 Markdown。
156
+
157
+ | 参数 | 必填 | 说明 |
158
+ | --- | --- | --- |
159
+ | `source` | ✅ | 工作区文件路径,或完整 http(s) URL |
160
+ | `mode` | | `auto`(默认)/ `precision` / `agent` |
161
+ | `modelVersion` | | 精准解析模型:`pipeline` / `vlm`(默认,推荐)/ `MinerU-HTML`(HTML 源自动强制) |
162
+ | `language` | | 文档语言包,默认 `ch`(中英),见 [language 取值](#配置参考) |
163
+ | `enableTable` | | 表格识别,默认 `true` |
164
+ | `enableFormula` | | 公式识别,默认 `true` |
165
+ | `isOcr` | | 强制 OCR(扫描件),默认 `false` |
166
+ | `pageRanges` | | 精准解析页码范围,逗号分隔,如 `"2,4-6"`;支持倒数页 `"2--2"`(倒数第 2 页) |
167
+ | `pageRange` | | Agent 解析页码范围,仅 `from-to` 或单页,如 `"1-10"` |
168
+ | `extraFormats` | | 额外导出格式(仅精准解析):`docx` / `html` / `latex` |
169
+ | `dataId` | | 业务数据 ID(可选,≤128 字符) |
170
+ | `timeoutMs` | | 整个操作(含轮询)超时,默认取插件配置(10 分钟) |
171
+ | `output` | | 结果目录基名,默认取源文件名 |
172
+
173
+ **返回要点**:`ok`、所用 `api`/`modelVersion`、`taskId`、耗时、`runDir` 结果目录、截断的 Markdown 预览、Artifact 列表(Web 含签名预览链接)。
174
+
175
+ ### `mineru_batch_parse` —— 批量解析(仅精准解析)
176
+
177
+ 一次解析多个文档,**本地文件路径与 URL 可混用**,自动分批提交(官方限额内),逐项报告成功/失败。
178
+
179
+ | 参数 | 必填 | 说明 |
180
+ | --- | --- | --- |
181
+ | `sources` | ✅ | 文件路径 / URL 混合列表 |
182
+ | `outputPrefix` | | 结果目录基名,默认 `batch` |
183
+ | `dataIdPrefix` | | 业务数据 ID 前缀,每项自动追加序号(可选) |
184
+ | 其余 | | 同 `mineru_parse` 的公共选项(`mode` 除外——本工具强制精准解析) |
63
185
 
64
- 所有解析结果写入 `<workspace>/.dsh-mineru/artifacts/<run>/`:精准解析为完整解包的 Zip(`full.md` 等),Agent 模式为 `full.md`;另有 `run.json` 元数据。工具结果包含限长的 Markdown 预览、任务 ID、耗时与 Artifact 列表(含签名预览链接)。Web 界面的工具卡片可直接打开/预览文件;Headless 直接复用列表中的绝对路径。
186
+ **分批规则**:本地文件每批 ≤ 50 个、URL 每批 ≤ 200 个、单次调用总共 ≤ 1000 个;超出会报错并提示拆分调用。
65
187
 
66
- ## 配置
188
+ **返回要点**:成功/失败计数、各 `batchId`、逐项结果(每个成功项包含其 `full.md` 所在目录),失败项附错误信息。
67
189
 
68
- 配置分三层:schema 默认值 ← 组合层(profile patch 中的 `mineru` 行 config)← 用户设置(Web 设置卡片写入)。
190
+ ### `mineru_task` —— 任务查询与结果收集
191
+
192
+ 解析**超时后不丢任务**:凭 `mineru_parse` 返回的 `taskId` + `api` 继续查询进度、收集结果,无需重新提交。
193
+
194
+ | 参数 | 必填 | 说明 |
195
+ | --- | --- | --- |
196
+ | `taskId` | ✅ | 提交任务时返回的 task_id |
197
+ | `api` | ✅ | 任务所属:`precision` 或 `agent` |
198
+ | `wait` | | 是否轮询等待任务完成,默认 `false`(只查一次) |
199
+ | `collect` | | 任务完成时是否下载结果落地为 Artifact,默认 `true` |
200
+ | `output` | | 收集结果目录基名,默认 `task` |
201
+ | `timeoutMs` | | `wait` 模式下的超时 |
202
+
203
+ **典型场景**:解析大 PDF 时 `mineru_parse` 超时了 → 告诉 Agent「用 mineru_task 继续收集 taskId=xxx 的结果」。
204
+
205
+ ### `mineru-tools` 技能
206
+
207
+ 插件自带同名技能:会话中输入 `/mineru-tools` 或让 Agent 调用 `skill` 工具加载,即可获得工具清单、双 API 对比、使用要点与官方限制的完整说明(Agent 视角的使用手册)。
208
+
209
+ ## 解析结果与 Artifacts
210
+
211
+ 所有解析结果写入 **`<workspace>/.dsh-mineru/artifacts/<run>/`**(`<workspace>` 为当前会话工作区,`<run>` 为每次解析的独立目录):
69
212
 
70
213
  ```
214
+ .dsh-mineru/artifacts/<run>/
215
+ ├── full.md # 结构化 Markdown 主结果(两模式都有)
216
+ ├── run.json # 本次解析元数据(来源、API、模型、耗时等)
217
+ ├── *_content_list.json # 内容结构化清单(仅精准解析)
218
+ ├── layout.json # 版面布局数据(仅精准解析)
219
+ ├── *_model.json # 模型原始输出(仅精准解析)
220
+ ├── *_origin.pdf # 服务端转换的原始文件(仅精准解析)
221
+ ├── images/ # 文档内嵌图片(仅精准解析)
222
+ └── result.zip # 服务端原始结果包(仅精准解析)
223
+ ```
224
+
225
+ - 工具结果里附**限长 Markdown 预览**(默认前 12 KB),完整内容请用 `read` 工具读取 `full.md`;
226
+ - **Web 界面**:Artifact 带 HMAC 签名预览链接(默认有效期 24 小时),点开即可看/下载;工具结果卡片可直接打开文件;
227
+ - **Headless**:直接使用返回的绝对路径。
228
+
229
+ 批量解析时每个文档在独立子目录:`<run>/<文件名>/full.md`。
230
+
231
+ ## 配置参考
232
+
233
+ 配置分三层解析:**schema 默认值 ← 组合层(profile patch 中的 `mineru` 行 config)← 用户设置(Web 设置卡片写入)**,后一层覆盖前一层。
234
+
235
+ ```yaml
236
+ # 组合层配置示例(cordis.patch.yml 或 profile patch)
71
237
  - id: mineru
72
238
  config:
73
- mode: auto # auto | precision | agent
74
- modelVersion: vlm # pipeline | vlm | MinerU-HTML
75
- language: ch
76
- enableTable: true
77
- enableFormula: true
78
- isOcr: false
79
- extraFormats: [] # docx | html | latex (精准解析)
80
- exposeMode: progressive # progressive: mineru_activate 引导; always: 全局注册
81
- timeoutMs: 600000
82
- pollIntervalMs: 3000
83
- inlineMarkdownBytes: 12000
84
- submitRatePerMin: 40
85
- pollRatePerMin: 900
86
- dailySubmitLimit: 5000
87
- artifactRootName: .dsh-mineru
239
+ mode: auto # auto | precision | agent
240
+ modelVersion: vlm # pipeline | vlm | MinerU-HTML
241
+ language: ch # 文档语言包
242
+ enableTable: true # 表格识别
243
+ enableFormula: true # 公式识别
244
+ isOcr: false # 强制 OCR
245
+ extraFormats: [] # docx | html | latex(仅精准解析)
246
+ exposeMode: progressive # progressive: 引导激活; always: 全局注册全部工具
247
+ timeoutMs: 600000 # 整体超时(毫秒)
248
+ pollIntervalMs: 3000 # 结果轮询间隔(毫秒)
249
+ inlineMarkdownBytes: 12000 # 工具结果内联预览字节数
250
+ submitRatePerMin: 40 # 提交限速(次/分钟)
251
+ pollRatePerMin: 900 # 查询限速(次/分钟)
252
+ dailySubmitLimit: 5000 # 每日提交限额
253
+ artifactRootName: .dsh-mineru # Artifact 根目录名
88
254
  ```
89
255
 
90
- ### Token(DSH Credentials)
256
+ ### 完整配置项
91
257
 
92
- 配置只保存**凭据引用名**(默认 `MINERU_API_TOKEN`),Token 值只存在于凭据层:
258
+ | 配置项 | 默认值 | 说明 |
259
+ | --- | --- | --- |
260
+ | `mode` | `auto` | API 模式:`auto`(按 Token 自动)/ `precision` / `agent` |
261
+ | `modelVersion` | `vlm` | 精准解析模型:`pipeline` / `vlm` / `MinerU-HTML`(HTML 源自动强制) |
262
+ | `language` | `ch` | 文档语言包(见下表) |
263
+ | `enableTable` | `true` | 表格识别开关 |
264
+ | `enableFormula` | `true` | 公式识别开关 |
265
+ | `isOcr` | `false` | 强制 OCR(扫描件) |
266
+ | `extraFormats` | `[]` | 额外导出格式(仅精准解析):`docx` / `html` / `latex` |
267
+ | `exposeMode` | `progressive` | `progressive`:引导激活;`always`:全局注册全部工具 |
268
+ | `timeoutMs` | `600000` | 整个操作(含轮询)超时,范围 10 s ~ 1 h |
269
+ | `pollIntervalMs` | `3000` | 结果轮询间隔,范围 500 ~ 60000 ms |
270
+ | `pollJitterMs` | `500` | 轮询随机抖动,避免请求整齐划一 |
271
+ | `maxFileBytes` | `0` | 本地文件大小上限;`0` = 按 API 模式限额(200 MB / 10 MB) |
272
+ | `inlineMarkdownBytes` | `12000` | 工具结果内联的 Markdown 预览字节数 |
273
+ | `artifactUrlTtlSec` | `86400` | 签名预览链接有效期(秒),范围 60 s ~ 30 天 |
274
+ | `submitRatePerMin` | `40` | 提交限速(官方上限 50/分钟) |
275
+ | `pollRatePerMin` | `900` | 查询限速(官方上限 1000/分钟) |
276
+ | `dailySubmitLimit` | `5000` | 每日提交限额(官方上限 5000/天) |
277
+ | `tokenCredential` | `MINERU_API_TOKEN` | DSH 凭据引用名(只存引用,不存密钥) |
278
+ | `apiBaseUrl` | `https://mineru.net` | MinerU API 地址 |
279
+ | `artifactRootName` | `.dsh-mineru` | Artifact 根目录名(单层目录名) |
280
+ | `userAgent` | `dsh-mineru/<版本>` | 请求 User-Agent |
281
+
282
+ ### Token 与凭据
283
+
284
+ 配置中**只保存凭据引用名**(默认 `MINERU_API_TOKEN`),Token 值存放在 dsh 凭据层,三种方式任选:
285
+
286
+ 1. **Web 设置卡片**:Token 输入框只写不读——留空保留现有值,点「清除」删除;
287
+ 2. **Headless / 命令行**:`$DSH_HOME/.credentials.yaml` 写入 `MINERU_API_TOKEN: <token>`;
288
+ 3. **环境变量**:设置 `MINERU_API_TOKEN`。
289
+
290
+ Token 每次操作实时解析——**轮换后下一次调用立即生效,无需重启**。日志、错误与设置响应**永不携带密钥**。
93
291
 
94
- - Web 设置卡片:Token 输入框只写不读,留空保留现有值,`清除` 删除;
95
- - Headless / 命令行:`$DSH_HOME/.credentials.yaml` 中写入 `MINERU_API_TOKEN: <token>`,或用环境变量 `MINERU_API_TOKEN`。
292
+ ### language 取值
96
293
 
97
- Token 在每次操作时实时解析——轮换后下一次调用立即生效,无需重启。日志、错误与设置响应永不携带密钥。
294
+ | 值 | 说明 | 值 | 说明 |
295
+ | --- | --- | --- | --- |
296
+ | `ch` | 中英(默认) | `ch_server` | 中文(服务端) |
297
+ | `en` | 英文 | `japan` | 日文 |
298
+ | `korean` | 韩文 | `chinese_cht` | 繁体中文 |
299
+ | `latin` | 拉丁语系 | `arabic` | 阿拉伯语 |
300
+ | `cyrillic` | 西里尔语系 | `east_slavic` | 东斯拉夫语系 |
301
+ | `devanagari` | 天城文 | `th` | 泰文 |
302
+ | `ta` | 泰米尔文 | `te` | 泰卢固文 |
303
+ | `ka` | 格鲁吉亚文 | `el` | 希腊文 |
304
+
305
+ ## 使用技巧
306
+
307
+ - **拖拽上传**:把文件拖进聊天窗口即可——文件自动保存到会话工作区,**路径填入输入框草稿(不自动发送)**,你补一句需求再发送。这绕开了纯文本模型不支持的图片附件通道;
308
+ - **URL 注意**:MinerU 服务端会去抓取该 URL——**无法访问被墙站点**(如 github.com、aws 等)。这类文档请先下载到本地再传路径;
309
+ - **页码范围**:精准解析用 `pageRanges`(`"2,4-6"`,`"2--2"` 表示倒数第 2 页);Agent 用 `pageRange`(`"1-10"`);
310
+ - **长文档**:优先精准解析 + `pageRanges` 分段处理;`vlm` 模型对公式/复杂版面效果最好;
311
+ - **超时恢复**:解析超时不等于失败——任务还在服务端跑,用 `mineru_task` + `taskId` 继续收集;
312
+ - **HTML 文档**:仅精准解析支持,且自动强制 `MinerU-HTML` 模型(无需手动指定);
313
+ - **HTML 文件每日限额**:官方对 HTML 提交有单独限制(最多 100 个/天)。
98
314
 
99
- ### language 取值
315
+ ## Web 界面
100
316
 
101
- `ch`(中英,默认)、`ch_server`、`en`、`japan`、`korean`、`chinese_cht`、`ta`、`te`、`ka`、`el`、`th`、`latin`、`arabic`、`cyrillic`、`east_slavic`、`devanagari`。
317
+ - **设置 → 插件 → MinerU 解析**:Token(只写)、模式、模型、语言、表格/公式/OCR 开关、额外导出格式,以及可折叠的**高级设置**(超时/轮询/限速/限额、API 地址、凭据引用名、Artifact 根目录名)。每个操作都有即时反馈(忙碌状态与结果消息);保存带修订冲突检测(409 冲突 → 重新加载后重试);
318
+ - **测试按钮**:「测试 Token」提交官方一页示例 PDF 验证密钥(约消耗 1 页额度);「测试 Agent API」验证免登录通道(受 IP 限频);
319
+ - **工具卡片**:三个解析工具的结果以专属卡片呈现——模式徽章、耗时、任务 ID、Artifact 列表(点击打开 / 链接预览)、限长预览、逐项批量结果。
102
320
 
103
321
  ## 限流与可靠性
104
322
 
105
- - 客户端内置令牌桶:提交默认 40 个/分钟(官方 50)、查询 900 次/分钟(官方 1000)、每日 5000 个(官方限额,本地提前报错);
106
- - 命中 HTTP 429 时按 `Retry-After` 退避并自动重试;
107
- - 轮询带随机抖动;整体超时后不丢任务——用 `mineru_task` 凭 `taskId` 继续收集;
108
- - 错误码全部映射为可操作的中文提示(A0202/A0211 Token、-60005/-60006 尺寸/页数、-30001~-30003 Agent 限制、-60018 配额等)。
323
+ **MinerU 官方限流**(插件已内置本地限速与退避,超限的请求会被服务端以 HTTP 429 拒绝):
109
324
 
110
- ## Web 界面
325
+ | 维度 | 官方限额 | 插件本地默认 |
326
+ | --- | --- | --- |
327
+ | 提交 | 50 个文件/分钟 | 40 个/分钟 |
328
+ | 每日提交 | 5000 个文件/天/用户(HTML 最多 100 个/天) | 5000(本地提前报错) |
329
+ | 结果查询 | 1000 次/分钟 | 900 次/分钟 |
330
+
331
+ 插件行为:
332
+
333
+ - 内置**令牌桶**限速(提交/查询分开),超限的本地请求排队而不是打爆 API;
334
+ - 命中 HTTP 429 时按 `Retry-After` **退避自动重试**;
335
+ - 轮询带随机抖动(`pollJitterMs`),避免请求整齐划一触发风控;
336
+ - 整体超时(`timeoutMs`)后任务不丢——用 `mineru_task` 凭 `taskId` 继续收集。
111
337
 
112
- - **设置 → 插件 → MinerU 解析**:Token(只写)、模式、模型、语言、识别开关、额外格式,以及可折叠的 **高级设置**(超时/限速/限额、API 地址、凭据引用名、Artifact 根目录名)。每个操作都有即时反馈(忙碌状态与结果消息);保存带修订冲突检测(409 → 重新加载后重试);`测试 Token` 提交官方一页示例 PDF 验证密钥(约消耗 1 页额度);`测试 Agent API` 验证免登录通道(受 IP 限频)。
113
- - **工具卡片**:`mineru_parse` / `mineru_batch_parse` / `mineru_task` 的结果以专属卡片呈现:模式徽章、耗时、任务 ID、Artifact 列表(点击打开 / 链接预览)、限长预览、逐项批量结果。
338
+ ## 错误码速查
339
+
340
+ | 错误码 | 含义 | 处理方式 |
341
+ | --- | --- | --- |
342
+ | `A0202` / `A0211` | Token 错误 / 过期 | 在设置中更新 MinerU Token |
343
+ | `-60005` / `-30001` | 文件超限(200 MB / 10 MB) | 压缩或拆分文件 |
344
+ | `-60006` / `-30003` | 页数超限(200 页 / 20 页) | 用 `pageRanges` / `pageRange` 分段 |
345
+ | `-60018` | 当日配额已满 | 明天再试,或检查 `dailySubmitLimit` |
346
+ | `429` | 请求过于频繁 | 稍后重试或降低并发 |
347
+ | `MINERU_TOKEN_REQUIRED` | 需要 Token 的操作未配 Token | 配置 Token 或改用 Agent 模式 |
348
+ | `MINERU_UNSUPPORTED_TYPE` | 该格式不被当前 API 支持 | 换格式或换 API 模式 |
349
+ | `MINERU_BATCH_TOO_LARGE` | 单次批量超过 1000 个 | 拆分后多次调用 |
350
+
351
+ 所有错误都会映射为**可操作的中文提示**,而不是原始错误码。
114
352
 
115
353
  ## 安全模型
116
354
 
117
- - 输入路径以会话工作区为根解析;ZIP 解包拒绝绝对路径、`..` 穿越、加密与 ZIP64,并带数量/体积上限,解出的每个条目都校验 CRC32;
118
- - Artifact 只写入 `<workspace>/.dsh-mineru`,预览 URL 为 HMAC 签名 + 过期时间,每次读取重新校验;
119
- - Web 路由仅接受同源请求;HTML/SVG 等 Artifact 以附件方式下发(`nosniff`);
120
- - 所有网络请求可被工具取消信号中止(会话取消/超时即停止上传、轮询与下载)。
355
+ - **路径隔离**:输入路径以会话工作区为根解析,不能读取工作区外文件;
356
+ - **ZIP 解包防护**:拒绝绝对路径、`..` 穿越、加密条目与 ZIP64,带条目数量/体积上限,每个解出的条目都校验 CRC32;
357
+ - **Artifact 边界**:只写入 `<workspace>/.dsh-mineru`;预览 URL 为 HMAC 签名 + 过期时间,每次读取重新校验;
358
+ - **Web 路由**:仅接受同源请求;HTML/SVG 等 Artifact 以附件方式下发(`nosniff`);
359
+ - **可取消**:所有网络请求响应工具取消信号——会话取消/超时会立即停止上传、轮询与下载;
360
+ - **密钥不出库**:Token 只存在于凭据层,日志/错误/设置响应永不携带。
121
361
 
122
- ## 开发
362
+ ## 常见问题 FAQ
123
363
 
124
- 本包不依赖构建步骤:`lib/` 为可直接加载的 ESM,`lib/client.js` 为打包形态的浏览器 bundle(`dsh.client` → `./client` 导出)。
364
+ **Q:不配 Token 能用吗?**
365
+ 能。自动走 Agent 轻量解析 API(≤10 MB、≤20 页、仅 Markdown、免登录),适合快速粗读。
125
366
 
126
- ```
127
- node --check lib/*.js # 语法检查
128
- npm pack # 打包本地 tgz
129
- ```
367
+ **Q:为什么工具列表里只有 `mineru_activate`?**
368
+ 这是渐进式曝光设计。调用一次 `mineru_activate`,其余三个工具立即解锁;或者把配置项 `exposeMode` 改为 `always` 全局注册。
130
369
 
131
- 本地路径安装请用 tgz(pnpm `link:` 安装会使 `@deepseek-ai` 依赖解析脱离 profile);完整开发循环见 [CONTRIBUTING.md](CONTRIBUTING.md)。
370
+ **Q:解析超时了,文件会不会丢?**
371
+ 不会。任务在 MinerU 服务端继续执行,用 `mineru_task`(`taskId` + `api`)随时查询进度并收集结果,无需重新提交。
132
372
 
133
- ## 发布
373
+ **Q:拖拽文件后为什么没有自动解析?**
374
+ 拖拽只把文件路径填入输入框草稿(防误发送),需要你补充需求后手动发送,Agent 才会开始解析。
134
375
 
376
+ **Q:报错 A0202 / A0211 怎么办?**
377
+ Token 无效或过期。在「设置 → 插件 → MinerU 解析」重新填写 Token(留空再点保存不会覆盖旧值)。
378
+
379
+ **Q:HTML 网页能解析吗?**
380
+ 能,但仅精准解析 API 支持(需 Token),且自动使用 MinerU-HTML 模型。注意服务端抓不到被墙的 URL。
381
+
382
+ **Q:怎么批量解析?**
383
+ 用 `mineru_batch_parse`,把文件路径/URL 列成列表即可,自动分批(本地 ≤50/批、URL ≤200/批、单次 ≤1000)。
384
+
385
+ **Q:Agent 轻量解析和精准解析结果有什么差别?**
386
+ 轻量解析只出 Markdown;精准解析额外产出 `content_list.json`、`layout.json`、`model.json`、内嵌图片,还可加导出 docx/html/latex,且支持表格/公式识别参数。
387
+
388
+ ## 开发与发布
389
+
390
+ 本包**无构建步骤**:`lib/` 为可直接加载的 ESM,`lib/client.js` 为打包形态的浏览器 bundle。
391
+
392
+ ```bash
393
+ node --check lib/*.js # 语法检查
394
+ npm pack # 打包本地 tgz
135
395
  ```
136
- npm pack
137
- npm publish # 需先 npm login
138
- dsh plugin --profile web add dsh-mineru # 发布后用户安装
139
- ```
396
+
397
+ 新版本发布请严格按 [RELEASE.md](RELEASE.md) 清单执行(升版本号 → 更新 CHANGELOG 与双语 README → 打包验证 → 打 tag 推送 → `npm publish`),完整开发循环见 [CONTRIBUTING.md](CONTRIBUTING.md)。
140
398
 
141
399
  ## 贡献
142
400
 
143
- 欢迎 Issue 与 PR,见 [CONTRIBUTING.md](CONTRIBUTING.md)。报告问题时请勿贴出 MinerU Token。
401
+ 欢迎 Issue 与 PR,见 [CONTRIBUTING.md](CONTRIBUTING.md)。报告问题时请**勿粘贴 MinerU Token**。
144
402
 
145
403
  ## 许可
146
404
 
147
- [MIT](LICENSE)。MinerU 由 OpenDataLab 提供,其官方文档([API 文档](https://mineru.net/apiManage/docs)、[限流策略](https://mineru.net/apiManage/limit))为权威依据。
405
+ [MIT](LICENSE)。MinerU 由 [OpenDataLab](https://opendatalab.com) 提供,其官方文档([API 文档](https://mineru.net/apiManage/docs)、[限流策略](https://mineru.net/apiManage/limit))为权威依据。
package/RELEASE.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  - 遵循 [SemVer](https://semver.org/lang/zh-CN/):`major.minor.patch`。
8
8
  - **唯一来源:`package.json` 的 `version` 字段**。`lib/` 内的 `'0.1.0'` 仅为 fallback,不要修改。
9
- - Git tag 格式:`v<version>`(如 `v0.1.7`)。
9
+ - Git tag 格式:`v<version>`(如 `v0.1.8`)。
10
10
 
11
11
  ## 发布清单
12
12
 
@@ -45,7 +45,7 @@ dsh plugin --profile web add D:\Users\Lee\Desktop\dsh\dsh-mineru-<version>.tgz
45
45
 
46
46
  ```powershell
47
47
  git add -A
48
- git commit -m "docs: 发布 v<version>(CHANGELOG + 双语 README 同步)"
48
+ git commit -m "docs: release v<version> (CHANGELOG + bilingual README sync)"
49
49
  git tag v<version>
50
50
  git push origin main --tags
51
51
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mineru",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "dsh-mineru: MinerU 文档解析插件 for DeepSeek Harness — 多模态全格式 (PDF/Word/PPT/Excel/HTML/图片) → 结构化 Markdown. 填 Token 走精准解析 API, 留空走 Agent 轻量解析 API.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",