dsh-pdf-mineru 0.1.0 → 0.1.3

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
@@ -1,5 +1,47 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.3
4
+
5
+ ### Changed
6
+
7
+ - Require DSH >= 0.1.7-rc.2 in engines and runtime peers; pin development SDK packages and workspace release-age exclusions to DSH 0.1.7-rc.2.
8
+ - Align integration tests, package manifests, and loopback RPC comments with DSH 0.1.7-rc.2.
9
+
10
+ Provider/config/cache formats, cursor v3, index v2, native jobs, and plugin configuration UI are unchanged; existing parsed caches require no migration.
11
+
12
+ ## 0.1.2
13
+
14
+ ### Added
15
+
16
+ - Report bounded, invocation-local parse phases through the native JobHandle progress surface, with a 48,000-byte model job output limit. Cache hits skip the waiting phase; progress never includes provider refs or sensitive request data.
17
+ - Add integration regressions against the published 0.1.7-rc.1 LocalJobRegistry for owner isolation, controller admission, consume-once final results, progress and kill/owner/plugin teardown, plus TypeScript/Python PTC schema projections.
18
+ - Add GUI boot diagnostics and an explicit browser-fixture-only unrelated-plugin exclusion option without changing the running host profile.
19
+
20
+ ### Changed
21
+
22
+ - Move the custom MinerU configuration page from the global Settings navigation to its Plugins bundle detail via the public `plugins.bundle.config` slot keyed by `dsh-pdf-mineru`. Preserve draft state, explicit saves, credential handling and maintenance confirmations; align client dependencies and GUI navigation checks with the plugin manager contract.
23
+ - Require DSH >= 0.1.7-rc.1 in engines and runtime peers; pin development SDK packages to that release, align Cordis/Schemastery versions, and replace the retired code-runtime dependency with ptc-runtime.
24
+ - Use SessionId job ownership and JobOutcome.result for both success summaries and failures. Keep lifecycle, output consumption, notification/wakeup and archive admission in the host registry; cancellation still stops only the current shared-operation waiter.
25
+ - Read attachment references from the current first-class tool-role message surface instead of the removed nested tool-result block protocol. Exact reference handoff and visible-session-only access are unchanged.
26
+ - Replace local Client slot/context type shims with published Locale, Connection, Remote and renderer/slot contracts. Preserve explicit draft saving, maintenance confirmation and channel-local loopback restrictions alongside native operator-Peer authentication.
27
+
28
+ ### Fixed
29
+
30
+ - Fix activation on DSH 0.1.7-rc.1 after removal of settings.register: consume Loader Config volatile references and published SettingsForms types, with automatic forms disabled for the custom draft/confirmation page.
31
+ - Save complete live fields to the actual profile entry id, preserving ordinary restart-only fields and explicit defaults over inherited profile values. Validate the complete domain config before persistence; avoid settings writes during activation.
32
+ - Cover activation, live updates without remount, profile persistence/restart, invalid-write rejection and inherited-default overrides using the published SettingsForms, ConfigEditor and Loader.
33
+
34
+ Provider/config/cache formats, cursor v3, index v2 and local page rendering are unchanged; existing parsed caches require no migration.
35
+
36
+ ## 0.1.1
37
+
38
+ ### Added
39
+
40
+ - Accept `attachment_id` as an alternative to `file_path` in `read_pdf` content, cursor and page requests and in `async_parse_pdf`. Both source fields are optional in schemas; exactly one is required at runtime, and callers should retain the same source selector on continuation; existing cursor identity validation is unchanged.
41
+ - Resolve full SHA-256 content IDs or unique 8–64 hexadecimal digest prefixes (optionally `sha256:`-prefixed) from current-session visible file and nested tool-result refs. Reject ambiguous matches and pass the exact matched ref to DSH `fileHostPath`; compacted-out refs are not searched.
42
+
43
+ DSH retains ownership of stored files. Hosts without local-path capability return `UNSUPPORTED_OPTION`; no stream materialization, new integrity checks, storage migration or Provider changes are introduced.
44
+
3
45
  ## 0.1.0
4
46
 
5
47
  ### Added
@@ -276,4 +318,4 @@ No canonical request, CacheKey, ProviderJobRef, or result manifest schema versio
276
318
 
277
319
  ## 0.0.1
278
320
 
279
- - Initial npm release with provider-independent tools, self-hosted v2 and official v4 adapters, session Jobs, immutable global results, request coalescing, restart recovery, safe ZIP extraction, and Provider-aware settings.
321
+ - Initial npm release with provider-independent tools, self-hosted v2 and official v4 adapters, session Jobs, immutable global results, request coalescing, restart recovery, safe ZIP extraction, and Provider-aware settings.
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  <a href="https://awesome-dsh-plugin.com"><img src="https://awesome-dsh-plugin.com/badge.svg" alt="Awesome DSH Plugin"></a>
13
13
  <a href="https://www.npmjs.com/package/dsh-pdf-mineru"><img src="https://img.shields.io/npm/v/dsh-pdf-mineru?style=flat-square&amp;label=npm&amp;color=CB3837" alt="npm version"></a>
14
14
  <a href="./package.json"><img src="https://img.shields.io/badge/Node.js-%3E%3D22.19.0-339933?style=flat-square&amp;logo=nodedotjs&amp;logoColor=white" alt="Node.js 22.19.0 or newer"></a>
15
- <img src="https://img.shields.io/badge/DSH-%3E%3D0.1.5--rc.2%20(RC%20only)-111827?style=flat-square" alt="DSH >=0.1.5-rc.2 (RC only)">
15
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.1.7--rc.2%20(RC%20only)-111827?style=flat-square" alt="DSH >=0.1.7-rc.2 (RC only)">
16
16
  <img src="https://img.shields.io/badge/MinerU-Official%20v4%20%7C%20Self--hosted%20v2-2563EB?style=flat-square" alt="MinerU v2 and v4">
17
17
  <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-2EA44F?style=flat-square" alt="MIT License"></a>
18
18
  </p>
@@ -38,11 +38,13 @@
38
38
  ### 0. 环境要求与版本兼容说明
39
39
 
40
40
  > ⚠️ **重要版本声明与环境要求**:
41
- > - **最低支持的 DSH 版本**:`>= 0.1.5-rc.2`。
41
+ > - **最低支持的 DSH 版本**:`>= 0.1.7-rc.2`。
42
42
  > - **仅支持 RC 版本**:本插件**只会对 DeepSeek Harness 的 RC(Release Candidate)版本及后续正式发布版本进行官方支持**。由于早期 `alpha` 测试版本包含较多实验性且剧烈变动的内部 API,本插件不再对 `alpha` 等非稳定测试版本提供兼容与维护支持。
43
43
  > - **运行环境要求**:Node.js `^22.19.0 || >=24.0.0`,包管理器推荐 `pnpm@11+`。
44
44
 
45
- 本次适配从插件 `0.0.12` 起以 DSH `v0.1.5-rc.2` 为基线。升级前请先升级宿主;现有 Provider 配置、缓存格式与工具参数无需因本次 DSH 适配而迁移。Web 设置与维护 RPC 仅在 `connection` 和 `webServer` 同时可用时注册;无 WebServer 的宿主仍可使用两个模型工具,但不提供这些 HTTP RPC。
45
+ 插件 `0.1.3` 起以 DSH `v0.1.7-rc.2` 为基线。升级前请先升级宿主;现有 Provider 配置、缓存格式与工具参数无需因本次 DSH 适配而迁移。Web 设置与维护 RPC 仅在 `connection` 和 `webServer` 同时可用时注册;无 WebServer 的宿主仍可使用两个模型工具,但不提供这些 HTTP RPC。
46
+
47
+ 后台任务使用 0.1.7 的 SessionId 归属与原生 JobRegistry:阶段进度显示为 `preparing`、`waiting-for-parse`、`reading-result`、`summarizing`,不是页数或百分比;缓存命中跳过等待阶段。完成摘要通过原生任务结果交付,通知、空闲唤醒、输出消费与会话归档准入由 DSH 负责。宿主必须为该会话装配任务控制器(如 `tool-jobs`),否则启动会在解析前拒绝。`job_kill` 仍只取消本次等待,不中止其他调用共用的解析生产者。
46
48
 
47
49
  ### 1. 安装插件
48
50
 
@@ -66,14 +68,18 @@ PDF.js 包解压约34.8 MB,Canvas JS 约0.13 MB,Linux x64 glibc 二进制约
66
68
 
67
69
  ### 2. 配置与连接
68
70
 
69
- 打开 DSH 界面中的 **Settings → MinerU**,根据您的使用场景选择 Provider。设置页按卡片分组,高级配置按需展开;修改后点击 **Save Configuration / 保存配置** 生效。连接测试使用当前草稿,缓存清理仍需先预览再确认。
71
+ 打开 DSH 界面中的 **Plugins / 插件 → dsh-pdf-mineru**,根据您的使用场景选择 Provider。配置页位于插件 bundle 详情中,不再单独出现在全局 Settings 导航。设置页按卡片分组,高级配置按需展开;修改后点击 **Save Configuration / 保存配置** 生效。连接测试使用当前草稿,缓存清理仍需先预览再确认。
72
+
73
+ 配置由 DSH Loader 的 Config 与 profile patch 管理;可热更新字段使用 `Volatile.get()`,保存后影响后续调用。插件关闭原生自动生成表单,保留显式草稿保存。Provider-based v1 配置在内存中规范化,启动不写回配置;旧 `settings.yaml` 的导入由 DSH 负责。
70
74
 
71
- 0.1.0 的设置页包含 Provider、解析默认值、存储与缓存、轮询、重试、输出限制、安全上限和存储维护八张卡片。支持全部展开/折叠,折叠不会丢失表单草稿;启动时固定的安全上限只读展示,需修改宿主配置并重启。界面沿用 DSH 深浅色主题,并支持键盘导航和紧凑布局。
75
+ 设置页包含 Provider、解析默认值、存储与缓存、轮询、重试、输出限制、安全上限和存储维护八张卡片。支持全部展开/折叠,折叠不会丢失表单草稿;启动时固定的安全上限只读展示,需修改宿主配置并重启。界面沿用 DSH 深浅色主题,并支持键盘导航和紧凑布局。
72
76
 
73
77
  <p align="center">
74
- <img src="./docs/assets/mineru-settings-preview.webp" width="780" alt="dsh-pdf-mineru 在 DSH Settings 中的设置界面">
78
+ <img src="./docs/assets/mineru-settings-preview.webp" width="780" alt="MinerU 配置卡片预览(旧版导航,当前入口为 Plugins → dsh-pdf-mineru)">
75
79
  </p>
76
80
 
81
+ > 上图展示配置卡片;旧版 Settings 导航仅供参考,当前请从 **Plugins / 插件 → dsh-pdf-mineru** 打开。
82
+
77
83
  #### 方案 A:使用 MinerU 官方云(推荐,免部署)
78
84
  1. 前往 [MinerU 官网](https://mineru.net) 注册并获取 API Token。
79
85
  2. 在终端配置环境变量(或通过 DSH 凭据服务管理):
@@ -122,26 +128,33 @@ Agent 会自动根据文档长度和指令意图,智能选择同步返回或
122
128
 
123
129
  1. 用 `focus: "toc"` 看目录,或用 `query: "图 7"` 字面检索。空格有意义,“图7”与“图 7”不同。
124
130
  2. 用返回的 `block_id` 精读完整块,或用物理页码与focus选择内容。标题块不代表整节。
125
- 3. `content_status: "partial"` 时,以同一file_path和原样cursor继续,不重复pages/focus/block_id/query;结束时cursor为null。
131
+ 3. `content_status: "partial"` 时,以同一来源选择器(`file_path` 或 `attachment_id`)和原样cursor继续,不重复pages/focus/block_id/query;结束时cursor为null。
126
132
  4. 对关键公式、数值和图表,用 `view: "page"` 回看原页;可传source_sha256作为expected_sha256。
127
133
 
128
134
  **complete只表示所选解析文本交付完成,不保证OCR正确或图像全部展示。** 检查当前块的diagnostics、公式verification_hints及visuals;metadata_shortened表示元数据因预算未完整列出。
129
135
 
130
136
  - 默认响应预算12,000个UTF-16单元、正文每块最多8,000;JSON和Native文本各最多48,000字节。默认不重复返回缓存路径;导出用focus: artifacts。
131
137
  - `inline_images` 首次省略默认true,续读省略继承,显式布尔值覆盖;模型能力和图像预算始终构成上限。
132
- - **0.0.14起使用v3游标,0.1.0保持该协议及索引v2;旧v1/v2游标需重新开始,解析缓存无需迁移。** 续读不会在缓存丢失时偷偷重新上传。
138
+ - **0.0.14起使用v3游标,0.1.1保持该协议及索引v2;旧v1/v2游标需重新开始,解析缓存无需迁移。** 续读不会在缓存丢失时偷偷重新上传。
133
139
  - 原页模式优先使用 PATH 中的 Poppler(pdfinfo/pdftoppm),命令缺失或明确不可执行时自动回退到 PDF.js + Node Canvas 子进程;仍需图像模型、附件服务及大于0的图像预算。结果以 `renderer: "poppler" | "pdfjs"` 标明后端,不会上传PDF或要求模型重新调用。它是本地有界执行,不是OS级隔离沙箱。
134
140
 
135
141
  字段语义、完整示例、来源/索引版本、预算、安全边界、错误恢复和离线验收见 **[PDF阅读指南](docs/model-reading.md)**。更新插件后需要让宿主重新加载工具定义;只构建源码或刷新Web页面不等于后端已重载。
136
142
 
143
+ ### 文件来源
144
+
145
+ `read_pdf` 的正文、续读、原页模式及 `async_parse_pdf` 都保留 `file_path`,也可改用互斥的 `attachment_id`,例如 `{"attachment_id":"<当前附件的完整内容ID>","focus":"toc"}`。两个来源字段在 schema 中均可选,但每次调用运行时必须且只能提供一个;调用方续读应保留同一选择器;游标仍按既有结果/投影身份校验,不新增选择器字符串绑定。
146
+
147
+ 附件 ID 可为完整 `sha256:` 加 64 位十六进制摘要,或 8–64 位摘要前缀(可带 `sha256:`)。只匹配当前会话可见消息中的文件引用(包括独立的 `role: "tool"` 工具结果消息);已压缩移出的引用不可见。多个不同内容 ID 匹配时拒绝,需提供更长前缀或完整 ID;不会猜测路径或搜索全局附件库。附件仍由 DSH 管理;宿主不提供本地路径能力时返回 `UNSUPPORTED_OPTION`,插件不会将附件流落盘。Provider、缓存和既有完整性校验不变。
148
+
137
149
  ### 常用解析参数(均可通过自然语言告知 Agent)
138
150
 
139
151
  | 参数 | 类型 | 适用工具 | 作用说明 |
140
152
  | --- | --- | --- | --- |
141
- | `file_path` | `string` | 全部 | 待解析/读取的本地文件路径(必填) |
153
+ | `file_path` | `string` | 全部 | 本地文件路径;与 `attachment_id` 必须且只能选一个 |
154
+ | `attachment_id` | `string` | 全部 | 当前会话可见文件附件的完整内容 ID 或唯一摘要前缀(8–64 位十六进制,可带 `sha256:`) |
142
155
  | `pages` | `number` / `string` / `number[]` | `read_pdf` | 1-based 页码选择,支持单页(如 `3`)、数组(如 `[1, 2, 5]`)或范围字符串(如 `"1-3, 5"`) |
143
156
  | `focus` | `string` / `string[]` | `read_pdf` | `all`(默认)、`text`、`table`、`image`、`toc` 或 `artifacts` |
144
- | `cursor` | `string` | `read_pdf` | 原样传回上一条部分阅读响应的 token;与 `pages`/`focus`/`block_id`/`query` 互斥,仍须传同一 `file_path` |
157
+ | `cursor` | `string` | `read_pdf` | 原样传回上一条部分阅读响应的 token;与 `pages`/`focus`/`block_id`/`query` 互斥,仍须传同一来源选择器(`file_path` 或 `attachment_id`) |
145
158
  | `block_id` | `string` | `read_pdf` | 原样使用此前返回的稳定块 ID;与 `query`、`cursor` 互斥 |
146
159
  | `query` | `string` | `read_pdf` | 1–256 字符、不区分大小写的字面检索;返回上下文摘要与块 ID,再用 `block_id` 读全文 |
147
160
  | `view` | `"content"` / `"page"` | `read_pdf` | 默认解析文本;page 模式只接受一页 `pages`,本地渲染原页,不调用 Provider |
@@ -194,7 +207,7 @@ flowchart LR
194
207
 
195
208
  ## 🛠️ 设置与配置参考
196
209
 
197
- 推荐直接在 **DSH Web GUI (Settings → MinerU)** 中进行可视化调整。若需要直接编辑配置文件(`cordis.patch.yml`),可参考以下常用配置:
210
+ 推荐直接在 **DSH Web GUI (Plugins / 插件 → dsh-pdf-mineru)** 中进行可视化调整。若需要直接编辑配置文件(`cordis.patch.yml`),可参考以下常用配置:
198
211
 
199
212
  <details>
200
213
  <summary><strong>📋 点击展开:YAML 配置示例</strong></summary>
@@ -286,7 +299,7 @@ limits:
286
299
  <summary><strong>Q: 解析结果保存在哪里?如何清理缓存?</strong></summary>
287
300
 
288
301
  解析结果按源文件内容、解析语义及 Provider 兼容标识寻址,默认存放在 `$DSH_HOME/cache/pdf-mineru/results/`。启用缓存复用时,后续阅读可复用已发布结果;同进程并发请求合并,但不同进程仍可能分别提交上游解析,不保证跨进程只计费一次。`storage.cacheEnabled=false` 仅禁用解析前的缓存复用,结果仍会不可变发布,不等同于清空缓存或强制覆盖已有结果。
289
- 您可以在 **Settings → MinerU** 的运维区域中:
302
+ 您可以在 **Plugins / 插件 → dsh-pdf-mineru** 的运维区域中:
290
303
  - 点击 **Verify Cache** 检查缓存完整性;
291
304
  - 点击 **Clear Cache** 预览,再显式确认清除。破坏性维护在存在活跃读取或解析时拒绝执行,不会为了清理而取消它们。
292
305
  </details>
@@ -316,6 +329,8 @@ pnpm run build
316
329
 
317
330
  # 4. 在运行中的 DSH Web 中验证前端设置组件
318
331
  pnpm run verify:gui
332
+ # 若无关插件阻止 Web shell 启动,可显式限定浏览器 fixture 的排除列表(不修改宿主配置):
333
+ # DSH_GUI_EXCLUDE_PLUGINS=<unrelated-plugin-id> pnpm run verify:gui
319
334
 
320
335
  # 5. (可选)本地原页验证,无上传;第二条用空PATH验证PDF.js自动回退
321
336
  pnpm run smoke:reader-local -- /path/to/sample.pdf 1 --backend=auto
@@ -325,6 +340,8 @@ pnpm run smoke:reader-local -- /path/to/sample.pdf 1 .vitest-cache/pdfjs --backe
325
340
  MINERU_API_KEY=<token> pnpm run smoke:official-v4 -- /path/to/sample.pdf
326
341
  ```
327
342
 
343
+ GUI 验证在现有 Web 地址中注入当前构建,使用浏览器内的配置/凭据/插件清单 fixture,并隔离该测试浏览器的 HMR graph;不修改真实配置、凭据或缓存,也不代表已更新宿主安装的插件。
344
+
328
345
  > 文档入口:[PDF阅读指南](docs/model-reading.md) · [版本记录](CHANGELOG.md)。已完成的阶段性开发报告不作为当前使用契约维护,历史信息可从Git记录查阅。
329
346
 
330
347
  > 想要深入了解插件的架构设计、数据模型、并发请求合并、安全解包与存储隔离机制?请查阅 **[ARCHITECTURE.md](./ARCHITECTURE.md)**。
package/lib/client.js CHANGED
@@ -2841,16 +2841,13 @@ window.__ModuleLoader__.load({
2841
2841
  }), "dsh-pdf-mineru: dictionaries");
2842
2842
  const connection = ctx.get("connection");
2843
2843
  if (connection === void 0) throw new Error("dsh-pdf-mineru: connection service is unavailable");
2844
- const t = ctx.locale.bind(NS);
2845
2844
  const injected = () => ({
2846
2845
  rpc: connection.rpc,
2847
2846
  credentials: ctx.remote.credentials
2848
2847
  });
2849
- ctx.slots.inject("settings.section", () => ctx.slots.register({
2850
- name: "settings.section",
2851
- id: NS,
2852
- order: 40,
2853
- label: () => t("nav"),
2848
+ ctx.slots.inject("plugins.bundle.config", () => ctx.slots.register({
2849
+ name: "plugins.bundle.config",
2850
+ key: "dsh-pdf-mineru",
2854
2851
  locale: NS,
2855
2852
  inject: injected
2856
2853
  }, SettingsPage));