# dsh-knowledge v0.5.2 — Unicode 文本安全、设置页恢复与依赖安全更新 0.5.2 修复知识库文本裁剪引发的上游 JSON 解析错误、DSH 本地模型设置页的注入异常,并更新本地文本模型运行时与安全审计策略。 ## Unicode 文本安全(#51) - 证据裁剪、文档读取、续读和来源标签保留 emoji 等字符的 UTF-16 代理对,避免截断产生孤立代理项。 - 检索注入、知识库工具输出、使用提示及 embedding/rerank 输入中的既有孤立代理项替换为 `U+FFFD`,避免 DeepSeek 等上游拒绝请求。 - 保留有效字符、存储原文和 UTF-16 字符偏移,不改变检索候选顺序。新增覆盖上下文、工具、嵌入和重排路径的回归测试。 ## 恢复本地模型设置与目录操作(#47) - 按需查询可选的 `remote.session` 命名空间,修复 DSH 注入门禁导致的本地模型设置页异常。 - 目录操作在调用时解析宿主能力,兼容服务的晚注册、替换与旧版接口,避免缓存失效的回调。 - 保留取消选择后的原路径、手动输入及旧版目录操作回退。 ## 本地运行时与依赖安全(#49) - 本地 embedding/rerank 升级到 Transformers.js **4.3.1** / ONNX Runtime **1.30.0**;OCR 保留独立运行时。 - 锁定依赖中的 sharp **0.35.5**,修复三项高危安全告警,并移除全部旧审计豁免。生产审计拒绝任何高危/严重告警及不完整或失败的审计结果。 - 旧运行时的 embedding/rerank 就绪记录失效,已下载的模型权重继续保留,可在设置页重新进行健康验证。 ## 升级说明 - 从 **0.5.1** 升级无需数据库迁移、重新索引或迁移知识库文档。 - 更新后请在设置中重新验证本地 embedding/rerank 模型的健康状态;无需仅因本次运行时更新而重新下载已有权重。 - 已被孤立代理项污染的历史会话不会自动修复。如旧会话仍报 JSON 解析错误,请新建会话,或单独修复受影响的历史消息。 - 现有 DSH profile 可能保留旧依赖解析结果;仓库锁文件不会覆盖 profile 的锁文件。升级后请确认实际安装的所有 sharp 实例均为 **0.35.5 或更高版本**。 - 托管 MinerU 仍为实验性功能;本次发布不扩大其验证范围。 ## 验证 发布准备通过 `release:check`:版本与构建策略校验、生产依赖审计、类型检查、**579 项测试(43 个文件)**、检索基准、构建、发布包校验以及四类 worker 协议冒烟测试。检索基准全部门槛通过,未出现预算超限。 修复提交的 CI 已覆盖 Node.js **22.19 / 24 / 26** 及 Ubuntu、Windows、macOS 的原生依赖/安装检查。真实桌面目录弹窗和可选真实模型、MinerU 推理仍属于单独验收范围。 ## English summary - **Unicode safety (#51):** preserve surrogate pairs at evidence, document-read, continuation and source-label boundaries. Replace existing lone surrogates with `U+FFFD` in model-facing knowledge text and embedding/rerank inputs while retaining stored text and UTF-16 offsets. - **Settings recovery (#47):** query optional `remote.session` capabilities at use time, avoiding inject-gate failures and stale directory callbacks after late registration or service replacement. - **Dependency security (#49):** use Transformers.js 4.3.1 / ONNX Runtime 1.30.0 for local text models, lock sharp 0.35.5 and remove all audit exceptions. Reject every high/critical production advisory and incomplete audit output. OCR retains its separate runtime. - **Upgrade:** no database migration or reindexing. Retain model weights and revalidate local embedding/rerank readiness in Settings. Repair previously poisoned sessions separately and verify sharp resolutions in existing DSH profiles. - **Validation:** the release preflight covers 579 tests in 43 files, typecheck, retrieval benchmarks, build/package checks, production audit and all four worker protocol smokes. CI for the fixes passed across Node 22.19/24/26 and Linux/Windows/macOS; optional real-model and MinerU inference remain separate. 感谢 [@InfiniteScope](https://github.com/InfiniteScope) 提交 Unicode 修复。 相关修复:[PR #50](https://github.com/Soren-ABT/dsh-knowledge/pull/50)、[PR #52](https://github.com/Soren-ABT/dsh-knowledge/pull/52)。完整变更:[v0.5.1…v0.5.2](https://github.com/Soren-ABT/dsh-knowledge/compare/v0.5.1...v0.5.2)。