dsh-mineru 0.1.7

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 ADDED
@@ -0,0 +1,56 @@
1
+ # Changelog
2
+
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
+
5
+ ## [Unreleased]
6
+
7
+ - 无(当前为最新发布版本 0.1.7)
8
+
9
+ ## [0.1.7] - 2026-08-16
10
+
11
+ ### Fixed
12
+
13
+ - 拖拽上传改为**填入输入框草稿(不自动发送)**:文件落到会话工作区后,其路径填入输入框,由用户补充需求后自行发送,完全绕开纯文本模型会拒绝的原生图片附件通道。
14
+ - 清除拖拽残留的全屏遮罩(拖拽结束或取消后遮罩层不再残留)。
15
+
16
+ ## [0.1.6] - 2026-08-16
17
+
18
+ ### Docs
19
+
20
+ - 双语 README:`README.md`(默认英文)+ `README.zh.md`(简体中文)。
21
+ - 统一仓库 / npm / MinerU 链接与介绍结构。
22
+
23
+ ## [0.1.5] - 2026-08-16
24
+
25
+ ### Fixed
26
+
27
+ - P3–P8 自检问题批量修复:
28
+ - `presentCall` 未定义(工具调用上下文缺失时崩溃);
29
+ - 批量解析自动分批(每批 ≤50 文件 / ≤200 URL,单次 ≤1000);
30
+ - 错误码映射补齐(A0202/A0211、-60005/-60006、-30001~-30003、-60018 等全部映射为可操作提示);
31
+ - ZIP 解包 CRC 校验与截断防护;
32
+ - 上传同名文件冲突处理;
33
+ - 版本号改为单一来源(`package.json`)。
34
+
35
+ ## [0.1.4] - 2026-08-16
36
+
37
+ ### Fixed
38
+
39
+ - 工具结果序列化失败(`value is not lossless JSON`);
40
+ - `mineru-tools` skill 加载失败(`source must be a string`)。
41
+
42
+ ## [0.1.2] - 2026-08-16
43
+
44
+ ### Added
45
+
46
+ - 首个可用版本:MinerU 多模态文档解析插件 for DeepSeek Harness。
47
+ - 双 API 模式:精准解析 API(需 Token)/ Agent 轻量解析 API(免 Token);
48
+ - 工具:`mineru_parse`、`mineru_batch_parse`、`mineru_task`、`mineru_activate`(progressive 引导)与 `mineru-tools` 技能;
49
+ - 限流感知(令牌桶 + 429 退避 + 每日限额);
50
+ - Artifact 落地与 Web 界面(设置卡片、工具结果卡片、HMAC 签名预览)。
51
+
52
+ [0.1.7]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.7
53
+ [0.1.6]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.6
54
+ [0.1.5]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.5
55
+ [0.1.4]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.4
56
+ [0.1.2]: https://github.com/Lee-Hilex/dsh-mineru/releases/tag/v0.1.2
@@ -0,0 +1,30 @@
1
+ [English](README.md) · [简体中文](README.zh.md) · [更新日志](CHANGELOG.md) · [发布 SOP](RELEASE.md)
2
+
3
+ # 贡献指南 (Contributing)
4
+
5
+ 欢迎提交 Issue 与 Pull Request。开始前请阅读:
6
+
7
+ - **Bug 报告**:在 [Issues](https://github.com/Lee-Hilex/dsh-mineru/issues) 中描述复现步骤、DSH 版本(`dsh --version`)、插件版本与相关日志;请勿在 Issue 中贴出 MinerU Token。
8
+ - **功能建议**:说明使用场景与期望行为,优先讨论再实现。
9
+ - **PR**:基于 `main` 分支,保持 `lib/` 下为可直接加载的 ESM 与打包形态的 `lib/client.js`;提交前运行 `node --check lib/*.js` 并在本地 profile 安装验证(见 README)。
10
+
11
+ ## 本地开发循环
12
+
13
+ ```
14
+ npm pack --pack-destination <目录> # 打包 tgz
15
+ dsh plugin --profile web add <目录>/dsh-mineru-<version>.tgz # 安装进 profile
16
+ # 重启 web profile 后验证; 修改代码后需重新打包并升版本号再安装
17
+ ```
18
+
19
+ Web profile 重启可复用 `D:\Users\Lee\Desktop\dsh\.dsh-restart\restart.ps1`(杀 3080 端口旧进程并重启)。
20
+
21
+ 注意:本地路径直装(pnpm link)会使 @deepseek-ai 依赖解析脱离 profile,请用 tgz 安装。
22
+
23
+ ## 提交规范
24
+
25
+ - 提交信息格式:`<type>: <描述>[, 版本 X.Y.Z]`,`type` 取 `feat` / `fix` / `docs` / `refactor` / `chore`。
26
+ - 文档变更(README / CHANGELOG / CONTRIBUTING / RELEASE)与代码变更**必须同一次提交**,不要分开发。
27
+
28
+ ## 发布流程
29
+
30
+ 新版本发布请严格按 [RELEASE.md](RELEASE.md) 清单执行:升版本号(唯一来源 `package.json`)→ 更新 CHANGELOG 与双语 README → `npm pack` → 本地验证 → 打 tag 推送 → `npm publish`。
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-mineru contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,147 @@
1
+ # dsh-mineru
2
+
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)
5
+ [![dsh](https://img.shields.io/badge/DeepSeek%20Harness-0.1.0--rc.6%2B-4d6bfe)](https://github.com/deepseek-ai/deepseek-harness)
6
+ [![MinerU](https://img.shields.io/badge/MinerU-API-4d6bfe)](https://mineru.net/apiManage/docs)
7
+
8
+ > Repository: <https://github.com/Lee-Hilex/dsh-mineru> · npm: [`dsh-mineru`](https://www.npmjs.com/package/dsh-mineru) · [Changelog](CHANGELOG.md)
9
+
10
+ English | [简体中文](README.zh.md)
11
+
12
+ ## Contents
13
+
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)
15
+
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.
17
+
18
+ ## Highlights
19
+
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.
25
+
26
+ ## Install
27
+
28
+ Prerequisites: DeepSeek Harness `0.1.0-rc.6` (or a compatible `0.1.x`), and `pnpm` available to `dsh plugin`.
29
+
30
+ ```
31
+ dsh plugin --profile web add dsh-mineru
32
+ dsh plugin --profile headless add dsh-mineru
33
+ ```
34
+
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.
36
+
37
+ For a local build, install from the packed tarball (see [CONTRIBUTING.md](CONTRIBUTING.md)):
38
+
39
+ ```
40
+ dsh plugin --profile web add <path>/dsh-mineru-<version>.tgz
41
+ ```
42
+
43
+ ## Two API modes
44
+
45
+ | | Precision API (token required) | Agent API (tokenless) |
46
+ | --- | --- | --- |
47
+ | 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
+ | 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 |
52
+
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`.
54
+
55
+ ## Tools
56
+
57
+ | Tool | Description |
58
+ | --- | --- |
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. |
63
+
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.
65
+
66
+ ## Configure
67
+
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).
69
+
70
+ ```
71
+ - id: mineru
72
+ 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
88
+ ```
89
+
90
+ ### Token (DSH Credentials)
91
+
92
+ The configuration stores only the **credential reference name** (default `MINERU_API_TOKEN`); the token value lives in the credentials layer:
93
+
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`.
96
+
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.
98
+
99
+ ### language values
100
+
101
+ `ch` (Chinese + English, default), `ch_server`, `en`, `japan`, `korean`, `chinese_cht`, `ta`, `te`, `ka`, `el`, `th`, `latin`, `arabic`, `cyrillic`, `east_slavic`, `devanagari`.
102
+
103
+ ## Rate limits & reliability
104
+
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).
109
+
110
+ ## Web UI
111
+
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.
114
+
115
+ ## Security model
116
+
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).
121
+
122
+ ## Development
123
+
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).
125
+
126
+ ```
127
+ node --check lib/*.js # syntax check
128
+ npm pack # pack a local tarball
129
+ ```
130
+
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.
132
+
133
+ ## Publishing
134
+
135
+ ```
136
+ npm pack
137
+ npm publish # requires npm login
138
+ dsh plugin --profile web add dsh-mineru # user install after publishing
139
+ ```
140
+
141
+ ## Contributing
142
+
143
+ Issues and pull requests are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md). Please never paste a MinerU token into an issue.
144
+
145
+ ## License
146
+
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.
package/README.zh.md ADDED
@@ -0,0 +1,147 @@
1
+ # dsh-mineru
2
+
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)
5
+ [![dsh](https://img.shields.io/badge/DeepSeek%20Harness-0.1.0--rc.6%2B-4d6bfe)](https://github.com/deepseek-ai/deepseek-harness)
6
+ [![MinerU](https://img.shields.io/badge/MinerU-API-4d6bfe)](https://mineru.net/apiManage/docs)
7
+
8
+ > 仓库: <https://github.com/Lee-Hilex/dsh-mineru> · npm: [`dsh-mineru`](https://www.npmjs.com/package/dsh-mineru) · [更新日志](CHANGELOG.md)
9
+
10
+ [English](README.md) | 简体中文
11
+
12
+ ## 目录
13
+
14
+ - [特性一览](#特性一览) · [安装](#安装) · [两种 API 模式](#两种-api-模式) · [工具](#工具) · [配置](#配置) · [限流与可靠性](#限流与可靠性) · [Web 界面](#web-界面) · [安全模型](#安全模型) · [开发](#开发) · [发布](#发布) · [贡献](#贡献) · [许可](#许可)
15
+
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 限频)。**
17
+
18
+ ## 特性一览
19
+
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 只写、高级设置折叠、操作即时反馈)与专属工具结果卡片。
25
+
26
+ ## 安装
27
+
28
+ 前置:DeepSeek Harness `0.1.0-rc.6`(或兼容的 `0.1.x`)、`pnpm` 可用。
29
+
30
+ ```
31
+ dsh plugin --profile web add dsh-mineru
32
+ dsh plugin --profile headless add dsh-mineru
33
+ ```
34
+
35
+ 重启 Web profile 后,在 **设置 → 插件 → MinerU 解析** 中配置 Token 与解析选项;在会话中输入 `/mineru-tools` 或让 Agent 调用 `skill` 工具加载 `mineru-tools` 技能。Headless 与 Web 共用同一套工具语义。
36
+
37
+ 本地开发版请用打包后的 tgz 安装(见 [CONTRIBUTING.md](CONTRIBUTING.md)):
38
+
39
+ ```
40
+ dsh plugin --profile web add <路径>/dsh-mineru-<version>.tgz
41
+ ```
42
+
43
+ ## 两种 API 模式
44
+
45
+ | 维度 | 🎯 精准解析 API(需 Token) | ⚡ Agent 轻量解析 API(免 Token) |
46
+ | --- | --- | --- |
47
+ | 接口 | `/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 |
52
+
53
+ 模式解析:`mode=auto`(默认)按 Token 是否配置自动选择;`mode=precision` 强制精准解析(无 Token 直接报错);`mode=agent` 强制轻量解析。HTML 文件仅精准解析支持,并自动强制 `MinerU-HTML` 模型。
54
+
55
+ ## 工具
56
+
57
+ | 工具 | 说明 |
58
+ | --- | --- |
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`)——超时后恢复收集,无需重复提交 |
63
+
64
+ 所有解析结果写入 `<workspace>/.dsh-mineru/artifacts/<run>/`:精准解析为完整解包的 Zip(`full.md` 等),Agent 模式为 `full.md`;另有 `run.json` 元数据。工具结果包含限长的 Markdown 预览、任务 ID、耗时与 Artifact 列表(含签名预览链接)。Web 界面的工具卡片可直接打开/预览文件;Headless 直接复用列表中的绝对路径。
65
+
66
+ ## 配置
67
+
68
+ 配置分三层:schema 默认值 ← 组合层(profile patch 中的 `mineru` 行 config)← 用户设置(Web 设置卡片写入)。
69
+
70
+ ```
71
+ - id: mineru
72
+ 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
88
+ ```
89
+
90
+ ### Token(DSH Credentials)
91
+
92
+ 配置只保存**凭据引用名**(默认 `MINERU_API_TOKEN`),Token 值只存在于凭据层:
93
+
94
+ - Web 设置卡片:Token 输入框只写不读,留空保留现有值,`清除` 删除;
95
+ - Headless / 命令行:`$DSH_HOME/.credentials.yaml` 中写入 `MINERU_API_TOKEN: <token>`,或用环境变量 `MINERU_API_TOKEN`。
96
+
97
+ Token 在每次操作时实时解析——轮换后下一次调用立即生效,无需重启。日志、错误与设置响应永不携带密钥。
98
+
99
+ ### language 取值
100
+
101
+ `ch`(中英,默认)、`ch_server`、`en`、`japan`、`korean`、`chinese_cht`、`ta`、`te`、`ka`、`el`、`th`、`latin`、`arabic`、`cyrillic`、`east_slavic`、`devanagari`。
102
+
103
+ ## 限流与可靠性
104
+
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 配额等)。
109
+
110
+ ## Web 界面
111
+
112
+ - **设置 → 插件 → MinerU 解析**:Token(只写)、模式、模型、语言、识别开关、额外格式,以及可折叠的 **高级设置**(超时/限速/限额、API 地址、凭据引用名、Artifact 根目录名)。每个操作都有即时反馈(忙碌状态与结果消息);保存带修订冲突检测(409 → 重新加载后重试);`测试 Token` 提交官方一页示例 PDF 验证密钥(约消耗 1 页额度);`测试 Agent API` 验证免登录通道(受 IP 限频)。
113
+ - **工具卡片**:`mineru_parse` / `mineru_batch_parse` / `mineru_task` 的结果以专属卡片呈现:模式徽章、耗时、任务 ID、Artifact 列表(点击打开 / 链接预览)、限长预览、逐项批量结果。
114
+
115
+ ## 安全模型
116
+
117
+ - 输入路径以会话工作区为根解析;ZIP 解包拒绝绝对路径、`..` 穿越、加密与 ZIP64,并带数量/体积上限,解出的每个条目都校验 CRC32;
118
+ - Artifact 只写入 `<workspace>/.dsh-mineru`,预览 URL 为 HMAC 签名 + 过期时间,每次读取重新校验;
119
+ - Web 路由仅接受同源请求;HTML/SVG 等 Artifact 以附件方式下发(`nosniff`);
120
+ - 所有网络请求可被工具取消信号中止(会话取消/超时即停止上传、轮询与下载)。
121
+
122
+ ## 开发
123
+
124
+ 本包不依赖构建步骤:`lib/` 为可直接加载的 ESM,`lib/client.js` 为打包形态的浏览器 bundle(`dsh.client` → `./client` 导出)。
125
+
126
+ ```
127
+ node --check lib/*.js # 语法检查
128
+ npm pack # 打包本地 tgz
129
+ ```
130
+
131
+ 本地路径安装请用 tgz(pnpm `link:` 安装会使 `@deepseek-ai` 依赖解析脱离 profile);完整开发循环见 [CONTRIBUTING.md](CONTRIBUTING.md)。
132
+
133
+ ## 发布
134
+
135
+ ```
136
+ npm pack
137
+ npm publish # 需先 npm login
138
+ dsh plugin --profile web add dsh-mineru # 发布后用户安装
139
+ ```
140
+
141
+ ## 贡献
142
+
143
+ 欢迎 Issue 与 PR,见 [CONTRIBUTING.md](CONTRIBUTING.md)。报告问题时请勿贴出 MinerU Token。
144
+
145
+ ## 许可
146
+
147
+ [MIT](LICENSE)。MinerU 由 OpenDataLab 提供,其官方文档([API 文档](https://mineru.net/apiManage/docs)、[限流策略](https://mineru.net/apiManage/limit))为权威依据。
package/RELEASE.md ADDED
@@ -0,0 +1,87 @@
1
+ # 发布 SOP(Release Checklist)
2
+
3
+ 发布 dsh-mineru 新版本的完整清单。**每次发布都必须逐项核对**,尤其是第 4、5 步——代码与文档必须同步发布,不允许只改代码。
4
+
5
+ ## 版本号规则
6
+
7
+ - 遵循 [SemVer](https://semver.org/lang/zh-CN/):`major.minor.patch`。
8
+ - **唯一来源:`package.json` 的 `version` 字段**。`lib/` 内的 `'0.1.0'` 仅为 fallback,不要修改。
9
+ - Git tag 格式:`v<version>`(如 `v0.1.7`)。
10
+
11
+ ## 发布清单
12
+
13
+ ### 1. 代码准备(用户 / dsh 侧)
14
+
15
+ - [ ] 功能/修复已完成,`node --check lib/*.js` 全部通过
16
+ - [ ] 版本号已升(`package.json` → `npm version patch|minor|major` 或手动改)
17
+
18
+ ### 2. 文档同步(本会话职责)
19
+
20
+ - [ ] `CHANGELOG.md` 增加 `[Unreleased]` 条目(保持 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 风格)
21
+ - [ ] `README.md`(英文)+ `README.zh.md`(简体中文)**同步更新**:
22
+ - [ ] 版本徽章 `version-X.Y.Z-blue`
23
+ - [ ] 功能特点列表(新增/变更/移除的描述)
24
+ - [ ] 配置示例、工具表、限流数值等任何与代码相关的描述
25
+ - [ ] 安装示例(若涉及)
26
+ - [ ] 中英两版描述保持一致(术语可不同,事实必须相同)
27
+
28
+ ### 3. 本地打包验证
29
+
30
+ ```powershell
31
+ # 在仓库目录执行:
32
+ npm pack --pack-destination D:\Users\Lee\Desktop\dsh
33
+ ```
34
+
35
+ - [ ] 生成 `dsh-mineru-<version>.tgz` 到 `D:\Users\Lee\Desktop\dsh\`
36
+ - [ ] tgz 内容核对:`lib/`、`cordis.patch.yml`、`README.md`、`README.zh.md`、`CHANGELOG.md`、`CONTRIBUTING.md`、`LICENSE`、`package.json`(`npm pack --dry-run` 可预览清单)
37
+ - [ ] 本地安装验证(可选但推荐):
38
+
39
+ ```powershell
40
+ dsh plugin --profile web add D:\Users\Lee\Desktop\dsh\dsh-mineru-<version>.tgz
41
+ # 重启 web profile 后冒烟:mineru_activate → mineru_parse
42
+ ```
43
+
44
+ ### 4. 提交与打 tag(Git)
45
+
46
+ ```powershell
47
+ git add -A
48
+ git commit -m "docs: 发布 v<version>(CHANGELOG + 双语 README 同步)"
49
+ git tag v<version>
50
+ git push origin main --tags
51
+ ```
52
+
53
+ - [ ] 提交包含**代码 + 全部文档**(用 `git diff --stat` 检查三个文件:`README.md`、`README.zh.md`、`CHANGELOG.md` 都在)
54
+ - [ ] tag 已推送(`git ls-remote --tags origin` 可验证)
55
+
56
+ ### 5. 发布到 npm
57
+
58
+ ```powershell
59
+ npm whoami # 未登录先执行 npm login
60
+ npm publish
61
+ ```
62
+
63
+ - [ ] 发布前已 `npm login`(一次登录长期有效)
64
+ - [ ] 发布后验证:`npm view dsh-mineru version` 返回最新版本号
65
+ - [ ] 若发布失败(如包名被占),**不要硬推**——与用户确认是否改包名,并同步修改 README / package.json / 记忆
66
+
67
+ ### 6. GitHub 仓库元数据(可选,一次性)
68
+
69
+ - [ ] repo `description` 与 `topics` 保持最新(`api.github.com` PATCH 或 Settings 手动设置)
70
+
71
+ ## 快速命令(一条龙)
72
+
73
+ ```powershell
74
+ cd D:\Users\Lee\Desktop\dsh\dsh-mineru
75
+ node --check lib/*.js
76
+ npm pack --pack-destination D:\Users\Lee\Desktop\dsh
77
+ git add -A && git commit -m "docs: 发布 v<version>"
78
+ git tag v<version> && git push origin main --tags
79
+ npm publish
80
+ ```
81
+
82
+ ## 注意事项
83
+
84
+ - **本地路径安装必须用 tgz**:pnpm `link:` 安装会使 `@deepseek-ai` 依赖解析脱离 profile。
85
+ - **不要在 Issue 里贴 MinerU Token**。
86
+ - npm 包名与仓库名一致(`dsh-mineru`),发布前确认该包名未被占用。
87
+ - 完整贡献规范见 [CONTRIBUTING.md](CONTRIBUTING.md)。
@@ -0,0 +1,8 @@
1
+ # dsh-mineru bundle patch: one host plugin row that also carries the Web client
2
+ # half (package.json's dsh.client points at exports["./client"]). The row owns
3
+ # tools, the mineru-tools skill, the "mineru" settings namespace, DSH Credential
4
+ # resolution, and (Web only) /plugin/mineru HTTP routes.
5
+ - insert:
6
+ - id: mineru
7
+ name: 'dsh-mineru'
8
+ config: {}