Skip to content
dsh.fish
Bundle

dsh-book-reader

DSH 读书工作台:PDF 阅读(react-pdf-viewer)+ 选中发对话 + 黄色高亮标注 + 持久化

Source
davidwellscn-maker
License
MIT
Updated
Updated 6 days ago

Readme

# 📚 dsh-book-reader

DSH(DeepSeek Harness)读书工作台插件——第一期 MVP。

## ✨ 功能

- **📚 读书 tab**:better-sidebar 侧边栏新增「+」→「📚 读书」,内嵌 PDF 阅读器
- **PDF 阅读**:react-pdf-viewer 渲染(翻页 / 缩放 / 页码显示),打开任意 `.pdf` 也会走本阅读器
- **💛 高亮标注**:选中文字 → 浮动按钮「💛 高亮」→ 可选批注 → 保存;点高亮删除
- **📤 发到对话**:选中文字 →「📤 发到对话」→ 自动追加进输入框(带路径 + PDF 页码引用)
- **💾 持久化**:标注存到书目录 `.book-reader/annotations.json`,重启不丢
- **🔍 自检**:tab 顶部状态条实时显示插件加载 / 路由连通状态

## 🛠️ 技术栈

| 组件 | 说明 |
|---|---|
| `@react-pdf-viewer/core` + `highlight` + `page-navigation` + `zoom` | 开源 PDF 渲染/高亮(Apache-2.0) |
| `dsh-better-sidebar` | 侧边栏服务(registerTab / registerFileViewer) |
| Host 路由 | `/reader/api`(标注读写)、`/reader/worker`(pdf.js worker) |

## 🏗️ 开发

```bash
pnpm install        # 装依赖(用 workspace 内 store/cache)
pnpm build          # 产出 lib/(host + client + worker)
pnpm typecheck      # TS 类型检查
```

## 📦 安装到 DSH

```bash
# ① GitHub 仓库安装
dsh plugin --profile desktop add github:davidwellscn-maker/dsh-book-reader

# ② npm 安装(发布后)
dsh plugin --profile desktop add dsh-book-reader@latest

# ③ 本地打包安装
pnpm pack && dsh plugin --profile desktop add dsh-book-reader-*.tgz
```

装完**完全重启 DSH Desktop**(⌘Q 退出再打开)——Host 端新路由需要重启加载。

> 📦 换机迁移与分发指引见 [docs/换机迁移与分发指南.md](docs/换机迁移与分发指南.md)

## 🗂️ 数据位置

- 标注:`<书目录>/.book-reader/annotations.json`
- 默认书籍:`/Users/mac/Desktop/DSP/学习/AI-Agents-in-Depth-zh-CN.pdf`

## 📌 路线图

- [x] 第一期:PDF 阅读 + 高亮 + 发对话 + 持久化(2026-08-18 应用内验证通过)
- [ ] 第二期:书本相关对话自动笔记总结(session/event + ctx.llm)
- [ ] 第三期:阅读进度(章节勾选 / 进度条 / 复习清单)

## 📄 License

MIT

Install

dsh plugin --profile web add github:davidwellscn-maker/dsh-book-reader

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source