dsh-pdf-mineru 0.0.14 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/README.md +20 -7
- package/lib/client.js +1356 -552
- package/lib/client.js.map +1 -1
- package/lib/index.js +189 -53
- package/lib/pdfjs-worker.mjs +457 -0
- package/lib/types/client/DisclosureCard.d.ts +15 -0
- package/lib/types/client/NumericInput.d.ts +3 -1
- package/lib/types/client/StorageOperations.d.ts +3 -1
- package/lib/types/client/icons.d.ts +17 -0
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/client/sections/AdvancedSections.d.ts +3 -1
- package/lib/types/service/mineru-service.d.ts +1 -0
- package/lib/types/service/page-renderer.d.ts +3 -2
- package/lib/types/service/pdfjs-backend.d.ts +5 -0
- package/lib/types/service/result-presenter.d.ts +3 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Added eight accessible settings cards with configuration summaries, expand/collapse-all controls, native keyboard-navigable Provider selection, and bilingual labels. Collapsed panels remain mounted to preserve form drafts.
|
|
8
|
+
- Added browser regressions for keyboard navigation, disclosure state, draft preservation, load-error recovery, immutable security limits, dark/light themes, and narrow-pane overflow, plus bilingual dictionary coverage.
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Redesigned the MinerU settings page with DSH theme-aware cards, lightweight SVG icons, clearer action hierarchy, and progressive disclosure for advanced configuration. Narrow settings panes use compact layouts, and reduced-motion preferences are respected.
|
|
13
|
+
- Refreshed setup instructions and the settings preview to match the current configuration page. Existing Provider, credential, numeric validation, storage-maintenance, reader cursor v3, and index v2 contracts remain unchanged.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Show configuration load failures with an explicit retry action instead of leaving the page in an ambiguous loading state.
|
|
18
|
+
- Display restart-only security limits as disabled controls rather than accepting edits that the running host cannot save. Preserve explicit preview/confirmation boundaries for destructive maintenance operations.
|
|
19
|
+
|
|
20
|
+
## 0.0.15
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Added a local PDF.js 6.3.289 + @napi-rs/canvas 1.0.9 subprocess fallback for original-page rendering. Normal installation includes renderer dependencies and package-local font/CMap/WASM resources; no system Poppler installation is required on supported native platforms.
|
|
25
|
+
- Added explicit original-page renderer identity to result types, strict tool output schemas, Native text and presentation metadata; physical page-count provenance distinguishes pdfinfo from pdfjs.
|
|
26
|
+
- Added deterministic backend-selection regressions, isolated PDF.js worker tests, full-tool offline auto/fallback smoke modes and an installed-package smoke from an unrelated working directory.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Keep Poppler preferred; fall back only when an executable is missing or explicitly unavailable in the execution environment, never for PDF failures, page/hash validation, cancellation, timeout or resource limits.
|
|
31
|
+
- Both backends share one checked snapshot, concurrency slot and total deadline. PDF.js parsing and Canvas allocation run only in a fixed child process with bounded output and local package resources; cancellation waits for process reaping before cleanup.
|
|
32
|
+
- Ship the unbundled PDF.js subprocess entry explicitly and keep native/PDF runtime dependencies external to host/client bundles. Document native-platform installation conditions, resource controls and fidelity differences without claiming OS sandbox isolation or pixel equivalence.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- Preserve cancellation and the shared deadline when temporary cleanup completes late; cleanup failures cannot replace an already determined primary error.
|
|
37
|
+
- Distinguish Poppler output I/O failures and abnormal process termination from invalid PDFs without retrying another backend.
|
|
38
|
+
- Reject truncated/corrupt PNG containers with bounded chunk, checksum and end-marker validation before attachment delivery.
|
|
39
|
+
|
|
40
|
+
Reader cursor v3, index v2, Provider contracts and parsed cache formats remain unchanged.
|
|
41
|
+
|
|
3
42
|
## 0.0.14
|
|
4
43
|
|
|
5
44
|
This release includes the bounded-reader work recorded under 0.0.13; the previous published release is 0.0.12.
|
package/README.md
CHANGED
|
@@ -54,9 +54,21 @@ dsh plugin --profile web add dsh-pdf-mineru
|
|
|
54
54
|
|
|
55
55
|
> 本地开发或测试源码时,可使用:`dsh plugin --profile web add link:/absolute/path/to/dsh-pdf-mineru`
|
|
56
56
|
|
|
57
|
+
### 本地原页渲染的安装条件
|
|
58
|
+
|
|
59
|
+
正常安装插件会安装固定版本的 [pdfjs-dist 6.3.289](https://www.npmjs.com/package/pdfjs-dist/v/6.3.289)(Apache-2.0)和 [@napi-rs/canvas 1.0.9](https://www.npmjs.com/package/@napi-rs/canvas/v/1.0.9)(MIT)。在支持的平台且未禁用平台可选依赖时,**无需系统安装 Poppler 即可使用原有原页接口**;字体、CMap、WASM 都从安装包本地加载,无 CDN。
|
|
60
|
+
|
|
61
|
+
这并非“纯 JavaScript、无原生依赖”:Canvas 使用预编译 Skia/N-API 平台二进制,包管理器通过 optionalDependencies 选择平台包,无安装期编译脚本。上游提供 Linux x64/arm64(glibc、musl)、Linux armv7(glibc)、Linux riscv64(glibc)、macOS x64/arm64、Windows x64/arm64 和 Android arm64 包;仍要求匹配的系统 ABI/运行库和本插件 Node 版本;Canvas上游文档要求glibc ≥2.18、Linux arm64为Cortex-A57或更新、armv7为Cortex-A7或更新,Node自身的系统要求仍须同时满足。实际验收平台为 Linux x64 glibc(Node 22.19.0 与26.8.2的独立生产安装包),其它平台有上游二进制不等于本仓库逐一验收。不要使用会删掉平台包的 --no-optional 安装选项。两后端均不可用时会提示安装 Poppler,或在支持平台重新安装插件及其平台可选依赖;不会使普通文本阅读失效。
|
|
62
|
+
|
|
63
|
+
PDF.js 包解压约34.8 MB,Canvas JS 约0.13 MB,Linux x64 glibc 二进制约34.8 MB(十进制,其他平台不同),这是安装依赖体积,不是插件 tarball 体积。PDF.js 的 Node 要求覆盖本插件现有 Node.js `^22.19.0 || >=24.0.0` 范围。
|
|
64
|
+
|
|
65
|
+
只对依赖/执行环境不可用自动切换:损坏、加密、解析失败、页码越界、源摘要不匹配、取消、资源超限或超时不会通过换后端重试。后端间可能存在字体、抗锯齿、透明度和裁切保真差异,不承诺像素相同;详见[阅读指南](docs/model-reading.md)。
|
|
66
|
+
|
|
57
67
|
### 2. 配置与连接
|
|
58
68
|
|
|
59
|
-
打开 DSH 界面中的 **Settings →
|
|
69
|
+
打开 DSH 界面中的 **Settings → MinerU**,根据您的使用场景选择 Provider。设置页按卡片分组,高级配置按需展开;修改后点击 **Save Configuration / 保存配置** 生效。连接测试使用当前草稿,缓存清理仍需先预览再确认。
|
|
70
|
+
|
|
71
|
+
0.1.0 的设置页包含 Provider、解析默认值、存储与缓存、轮询、重试、输出限制、安全上限和存储维护八张卡片。支持全部展开/折叠,折叠不会丢失表单草稿;启动时固定的安全上限只读展示,需修改宿主配置并重启。界面沿用 DSH 深浅色主题,并支持键盘导航和紧凑布局。
|
|
60
72
|
|
|
61
73
|
<p align="center">
|
|
62
74
|
<img src="./docs/assets/mineru-settings-preview.webp" width="780" alt="dsh-pdf-mineru 在 DSH Settings 中的设置界面">
|
|
@@ -117,8 +129,8 @@ Agent 会自动根据文档长度和指令意图,智能选择同步返回或
|
|
|
117
129
|
|
|
118
130
|
- 默认响应预算12,000个UTF-16单元、正文每块最多8,000;JSON和Native文本各最多48,000字节。默认不重复返回缓存路径;导出用focus: artifacts。
|
|
119
131
|
- `inline_images` 首次省略默认true,续读省略继承,显式布尔值覆盖;模型能力和图像预算始终构成上限。
|
|
120
|
-
- **0.0.14
|
|
121
|
-
-
|
|
132
|
+
- **0.0.14起使用v3游标,0.1.0保持该协议及索引v2;旧v1/v2游标需重新开始,解析缓存无需迁移。** 续读不会在缓存丢失时偷偷重新上传。
|
|
133
|
+
- 原页模式优先使用 PATH 中的 Poppler(pdfinfo/pdftoppm),命令缺失或明确不可执行时自动回退到 PDF.js + Node Canvas 子进程;仍需图像模型、附件服务及大于0的图像预算。结果以 `renderer: "poppler" | "pdfjs"` 标明后端,不会上传PDF或要求模型重新调用。它是本地有界执行,不是OS级隔离沙箱。
|
|
122
134
|
|
|
123
135
|
字段语义、完整示例、来源/索引版本、预算、安全边界、错误恢复和离线验收见 **[PDF阅读指南](docs/model-reading.md)**。更新插件后需要让宿主重新加载工具定义;只构建源码或刷新Web页面不等于后端已重载。
|
|
124
136
|
|
|
@@ -182,7 +194,7 @@ flowchart LR
|
|
|
182
194
|
|
|
183
195
|
## 🛠️ 设置与配置参考
|
|
184
196
|
|
|
185
|
-
推荐直接在 **DSH Web GUI (Settings →
|
|
197
|
+
推荐直接在 **DSH Web GUI (Settings → MinerU)** 中进行可视化调整。若需要直接编辑配置文件(`cordis.patch.yml`),可参考以下常用配置:
|
|
186
198
|
|
|
187
199
|
<details>
|
|
188
200
|
<summary><strong>📋 点击展开:YAML 配置示例</strong></summary>
|
|
@@ -274,7 +286,7 @@ limits:
|
|
|
274
286
|
<summary><strong>Q: 解析结果保存在哪里?如何清理缓存?</strong></summary>
|
|
275
287
|
|
|
276
288
|
解析结果按源文件内容、解析语义及 Provider 兼容标识寻址,默认存放在 `$DSH_HOME/cache/pdf-mineru/results/`。启用缓存复用时,后续阅读可复用已发布结果;同进程并发请求合并,但不同进程仍可能分别提交上游解析,不保证跨进程只计费一次。`storage.cacheEnabled=false` 仅禁用解析前的缓存复用,结果仍会不可变发布,不等同于清空缓存或强制覆盖已有结果。
|
|
277
|
-
您可以在 **Settings →
|
|
289
|
+
您可以在 **Settings → MinerU** 的运维区域中:
|
|
278
290
|
- 点击 **Verify Cache** 检查缓存完整性;
|
|
279
291
|
- 点击 **Clear Cache** 预览,再显式确认清除。破坏性维护在存在活跃读取或解析时拒绝执行,不会为了清理而取消它们。
|
|
280
292
|
</details>
|
|
@@ -305,8 +317,9 @@ pnpm run build
|
|
|
305
317
|
# 4. 在运行中的 DSH Web 中验证前端设置组件
|
|
306
318
|
pnpm run verify:gui
|
|
307
319
|
|
|
308
|
-
# 5.
|
|
309
|
-
pnpm run smoke:reader-local -- /path/to/sample.pdf 1
|
|
320
|
+
# 5. (可选)本地原页验证,无上传;第二条用空PATH验证PDF.js自动回退
|
|
321
|
+
pnpm run smoke:reader-local -- /path/to/sample.pdf 1 --backend=auto
|
|
322
|
+
pnpm run smoke:reader-local -- /path/to/sample.pdf 1 .vitest-cache/pdfjs --backend=pdfjs
|
|
310
323
|
|
|
311
324
|
# 6. (显式选择)使用真实 Token 运行在线解析,会上传文档
|
|
312
325
|
MINERU_API_KEY=<token> pnpm run smoke:official-v4 -- /path/to/sample.pdf
|