dsh-english-reader 0.0.0-stage → 0.2.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.
Files changed (87) hide show
  1. package/AGENTS.md +102 -0
  2. package/LICENSE +21 -0
  3. package/README.en.md +239 -0
  4. package/README.md +229 -2
  5. package/client.js +5058 -0
  6. package/cordis.patch.yml +4 -0
  7. package/docs/DETAIL.md +201 -0
  8. package/docs/DETAIL.zh.md +163 -0
  9. package/docs/TESTING.md +153 -0
  10. package/docs/TESTING.zh.md +184 -0
  11. package/docs/modules/00-loading/README.md +60 -0
  12. package/docs/modules/00-loading/bundle-manifest.md +55 -0
  13. package/docs/modules/00-loading/client-registration.md +55 -0
  14. package/docs/modules/00-loading/host-entry.md +44 -0
  15. package/docs/modules/00-loading/locale-resources.md +42 -0
  16. package/docs/modules/00-loading/self-update.md +51 -0
  17. package/docs/modules/10-panel/README.md +70 -0
  18. package/docs/modules/10-panel/copy.md +45 -0
  19. package/docs/modules/10-panel/host-sync.md +58 -0
  20. package/docs/modules/10-panel/panel-shell.md +55 -0
  21. package/docs/modules/10-panel/playback.md +57 -0
  22. package/docs/modules/10-panel/shared-store.md +51 -0
  23. package/docs/modules/10-panel/styles.md +47 -0
  24. package/docs/modules/10-panel/text-pipeline.md +51 -0
  25. package/docs/modules/10-panel/views.md +60 -0
  26. package/docs/modules/10-panel/word-alignment.md +48 -0
  27. package/docs/modules/10-panel/word-card.md +47 -0
  28. package/docs/modules/20-routes/README.md +80 -0
  29. package/docs/modules/20-routes/dictionary-routes.md +56 -0
  30. package/docs/modules/20-routes/library-routes.md +65 -0
  31. package/docs/modules/20-routes/model-routes.md +54 -0
  32. package/docs/modules/20-routes/route-table.md +53 -0
  33. package/docs/modules/20-routes/speech-routes.md +63 -0
  34. package/docs/modules/20-routes/translate-routes.md +55 -0
  35. package/docs/modules/30-store/README.md +66 -0
  36. package/docs/modules/30-store/library-file.md +59 -0
  37. package/docs/modules/30-store/merge-rules.md +60 -0
  38. package/docs/modules/30-store/paths-and-limits.md +58 -0
  39. package/docs/modules/30-store/revision.md +58 -0
  40. package/docs/modules/30-store/secrets.md +57 -0
  41. package/docs/modules/40-speech/README.md +73 -0
  42. package/docs/modules/40-speech/clip-cache.md +54 -0
  43. package/docs/modules/40-speech/custom-endpoints.md +67 -0
  44. package/docs/modules/40-speech/edge-engine.md +57 -0
  45. package/docs/modules/40-speech/engine-install.md +63 -0
  46. package/docs/modules/40-speech/kokoro-engine.md +62 -0
  47. package/docs/modules/40-speech/local-model.md +64 -0
  48. package/docs/modules/40-speech/synthesis-entry.md +62 -0
  49. package/docs/modules/40-speech/worker-protocol.md +65 -0
  50. package/docs/modules/50-dictionary/README.md +67 -0
  51. package/docs/modules/50-dictionary/chinese-dictionary.md +54 -0
  52. package/docs/modules/50-dictionary/english-dictionaries.md +62 -0
  53. package/docs/modules/50-dictionary/model-dictionary.md +57 -0
  54. package/docs/modules/50-dictionary/model-route.md +58 -0
  55. package/docs/modules/50-dictionary/model-translate.md +55 -0
  56. package/docs/modules/50-dictionary/translate-providers.md +56 -0
  57. package/docs/modules/60-tool/README.md +66 -0
  58. package/docs/modules/60-tool/dialogue-actions.md +64 -0
  59. package/docs/modules/60-tool/settings-actions.md +66 -0
  60. package/docs/modules/60-tool/tool-definition.md +64 -0
  61. package/docs/modules/60-tool/word-actions.md +68 -0
  62. package/docs/modules/70-testing/README.md +89 -0
  63. package/docs/modules/70-testing/contract-tests.md +59 -0
  64. package/docs/modules/70-testing/harness.md +76 -0
  65. package/docs/modules/70-testing/install-contract.md +49 -0
  66. package/docs/modules/70-testing/panel-tests.md +67 -0
  67. package/docs/modules/70-testing/unit-and-host.md +67 -0
  68. package/docs/modules/README.md +56 -0
  69. package/docs/reader-2.png +0 -0
  70. package/docs/words-2.png +0 -0
  71. package/host/constants.js +108 -0
  72. package/host/dictionary.js +321 -0
  73. package/host/engine.js +297 -0
  74. package/host/files.js +249 -0
  75. package/host/model.js +30 -0
  76. package/host/routes.js +1084 -0
  77. package/host/speech.js +611 -0
  78. package/host/tool.js +834 -0
  79. package/host/translate.js +197 -0
  80. package/host/uninstall.js +120 -0
  81. package/host/update.js +132 -0
  82. package/icon.svg +18 -0
  83. package/index.js +30 -0
  84. package/locale/en.json +7 -0
  85. package/locale/zh.json +7 -0
  86. package/package.json +71 -4
  87. package/worker.mjs +388 -0
package/AGENTS.md ADDED
@@ -0,0 +1,102 @@
1
+ # AGENTS.md — dsh-english-reader 维护入口
2
+
3
+ 这是一份**目录**,不是手册。DSH 会把仓库根目录的 `AGENTS.md` 作为会话指令读入,所以它必须短:细节全在 [`docs/modules/`](./docs/modules/README.md)。
4
+
5
+ ## 这是什么
6
+
7
+ 一个 DSH 插件,装起来以后在右侧栏给中文用户朗读英文文章/对话,并带一个可共享的单词库。它由**两个半边**组成,写同一份数据:
8
+
9
+ - **浏览器半边** `client.js`(4,853 行,单 `__ModuleLoader__` 工厂,无构建步骤);
10
+ - **宿主半边** `index.js` → `host/*.js`(16 条 HTTP 路由 + 一个模型工具 + 一个语音子进程 `worker.mjs`)。
11
+
12
+ 三处入口:右侧栏页签、左侧栏整页视图、输入框上方的小按钮。用户数据在宿主 `$DSH_HOME/dsh-english-reader/library.json`,界面状态在本机 `localStorage`。
13
+
14
+ ## 五分钟上手
15
+
16
+ ```bash
17
+ npm install # react / react-dom / jsdom
18
+ timeout 300 node --test test/ # 全量,约 3 秒,148 项
19
+ node --test test/panel.dict.test.mjs # 单文件
20
+ node --test --test-name-pattern "gloss" test/ # 单用例
21
+ ```
22
+
23
+ - 改完想让 DSH 吃到新代码:用 `plugin_manager` 把 `include:english-reader` 关掉再打开;**客户端改动还要刷新页面**(bundle 由浏览器缓存)。
24
+ - 浏览器复核流程与历史 bug 清单:`docs/TESTING.zh.md`。
25
+ - 行为承诺(用户视角)在 `docs/DETAIL.zh.md`;本目录的模块文档解释**代码怎么做到**。
26
+
27
+ ## 任务 → 读什么
28
+
29
+ | 我要改 / 想知道 | 先读 |
30
+ | --- | --- |
31
+ | 插件的两个半边怎么被加载、怎么注册 | [00-loading](./docs/modules/00-loading/README.md) |
32
+ | 加一条界面文案、改按钮文字 | [10-panel/copy](./docs/modules/10-panel/copy.md) + `locale/*.json`(插件列表文案) |
33
+ | 断句、文章/对话判定、标题 | [10-panel/text-pipeline](./docs/modules/10-panel/text-pipeline.md) |
34
+ | 逐词高亮、语音 marks 对不齐 | [10-panel/word-alignment](./docs/modules/10-panel/word-alignment.md) |
35
+ | 归类被覆盖、墓碑、旧数据迁移 | [10-panel/shared-store](./docs/modules/10-panel/shared-store.md) + [30-store/merge-rules](./docs/modules/30-store/merge-rules.md) |
36
+ | 面板不刷新、同步延迟、保存回环 | [10-panel/host-sync](./docs/modules/10-panel/host-sync.md) + [20-routes/library-routes](./docs/modules/20-routes/library-routes.md) |
37
+ | 播放:缓存、跳句、换音色重读 | [10-panel/playback](./docs/modules/10-panel/playback.md) |
38
+ | 右键词卡、查词顺序、收藏开关 | [10-panel/word-card](./docs/modules/10-panel/word-card.md) |
39
+ | 加一个页面或一个控件 | [10-panel/views](./docs/modules/10-panel/views.md) + [10-panel/panel-shell](./docs/modules/10-panel/panel-shell.md) |
40
+ | 样式、图标、主题变量 | [10-panel/styles](./docs/modules/10-panel/styles.md) |
41
+ | 加/改一条宿主路由 | [20-routes/route-table](./docs/modules/20-routes/route-table.md) |
42
+ | 库文件读写、原子写、版本指纹 | [30-store](./docs/modules/30-store/README.md) |
43
+ | 语音引擎、worker 协议、本地模型下载 | [40-speech](./docs/modules/40-speech/README.md) |
44
+ | 词典源(iciba / WordNet / Collins) | [50-dictionary](./docs/modules/50-dictionary/README.md) |
45
+ | 翻译来源、模型翻译 | [50-dictionary/translate-providers](./docs/modules/50-dictionary/translate-providers.md) |
46
+ | `english_reader` 工具的动作 | [60-tool](./docs/modules/60-tool/README.md) |
47
+ | 写测试、跑测试、为什么有这些用例 | [70-testing](./docs/modules/70-testing/README.md) + `docs/TESTING.zh.md` |
48
+ | 插件自己更新、插件页没有更新按钮 | [00-loading/self-update](./docs/modules/00-loading/self-update.md) |
49
+ | 插件装不上、本地引擎缺失、安装期依赖报错 | [70-testing/install-contract](./docs/modules/70-testing/install-contract.md) + README 的安装与排错段 |
50
+
51
+ ## 模块地图
52
+
53
+ | 前缀 | 大模块 | 一句话 |
54
+ | --- | --- | --- |
55
+ | `00` | [装载与契约](./docs/modules/00-loading/README.md) | 清单、入口、5 处客户端注册 |
56
+ | `10` | [面板(浏览器半边)](./docs/modules/10-panel/README.md) | 文案、解析、三个 hook、14 个视图 |
57
+ | `20` | [宿主路由](./docs/modules/20-routes/README.md) | 16 条路由,前端调用落到哪个函数 |
58
+ | `30` | [存储与合并](./docs/modules/30-store/README.md) | 一份 `library.json`,两个写者 |
59
+ | `40` | [语音](./docs/modules/40-speech/README.md) | Edge 在线 / Kokoro 本地,都在子进程 |
60
+ | `50` | [词典与翻译](./docs/modules/50-dictionary/README.md) | 4 个词典源、5 个翻译源 |
61
+ | `60` | [模型工具](./docs/modules/60-tool/README.md) | `english_reader` 的 17 个动作 |
62
+ | `70` | [测试与验收](./docs/modules/70-testing/README.md) | 五层用例 + 静态契约扫描 |
63
+
64
+ ## 硬约束(破坏其中一条就别提交)
65
+
66
+ 1. **`client.js` 没有构建步骤**:它是单文件单工厂,`import`/`export` 都会被浏览器直接拒绝。能拆的只有函数,不是文件。
67
+ 2. **`ReaderBody` 不能自己调 hook**:它被当普通函数调用(为了错误边界),新状态请放进三个 hook 之一。
68
+ 3. **宿主 `tools` 是软依赖**:`mountTool` 必须继续在 `ctx.inject(['tools'], …)` 里注册,没有工具注册表时插件仍要能加载。
69
+ 4. **归类由 `folderAt` 决定,删除写成墓碑**:宿主 `mergeStore` 与浏览器 `mergeStates` 是同一套规则,改一边必须改另一边。
70
+ 5. **密钥只在宿主**:`sources.json`、`dictionary.json` 是 0600,前端永远只拿到「有没有」。
71
+ 6. **语音子进程路径是 `../worker.mjs`**:拆分后写错过一次,结果是每句都 502。
72
+ 7. **`POST /store` 的 `changed` 必须诚实**:宿主纠正过一次保存就要说 `changed: true`,否则浏览器会一直显示一个别人没有的库。
73
+ 8. **文案有两处**:界面文案在 `client.js` 的 `DICT`,插件列表文案在 `locale/*.json`,key 两端必须一致。
74
+ 9. **测试必须绿**,而且新逻辑要有一条「回退它就变红」的用例;只跑 jsdom 不算验证过浏览器。
75
+ 10. **改代码必须改文档**:本文件保持目录地位,细节写进对应小模块文档。
76
+ 11. **本地引擎是可选的 peer**:`kokoro-js` 只能待在 `peerDependencies` + `peerDependenciesMeta.optional`,不能回到 `dependencies`,也不能放 `optionalDependencies`(后者仍会被默认安装)。它带入的 `onnxruntime-node` 在 CUDA 13 上装不上,默认安装必须只有 `msedge-tts`;缺引擎时 worker 回 `engine-missing`;用户点「下载」时由 `host/engine.js` 确认后按需安装(`test/install.test.mjs` 与 `host.test.mjs` 守着)。卸载由 `host/uninstall.js` 事后收走 `models/` 与 `kokoro-js`,库/来源/词典设置必须保留。
77
+
78
+ ## 一次改动的流程
79
+
80
+ 1. 用上面的表定位到**小模块文档**,读「不变量」与「改这里时」两节。
81
+ 2. 顺着「相邻模块」看一遍上下游(尤其跨半边的:`10-panel` ↔ `30-store`)。
82
+ 3. 改代码,同时加一条会失败的新用例;`timeout 300 node --test test/` 全绿。
83
+ 4. 回写文档:更新受影响的「职责/不变量/位置」,并跑 `node --test test/docs.test.mjs`(链接、引用符号、必需小节)。
84
+
85
+ ## 文档规则
86
+
87
+ - 小模块文档固定 7 节:职责 / 位置 / 输入 → 输出 / 不变量 / 相邻模块 / 改这里时 / 读代码顺序。
88
+ - 大模块 README 固定 6 节:一句话 / 代码入口 / 小模块索引 / 数据流 / 常见改动 / 风险与历史坑。
89
+ - **只引用 `文件` :: `符号`,不写行号**——行号会漂,符号名可以 grep,契约用例会检查它是否存在。
90
+ - 单篇小模块 ≤ 90 行;本文件 ≤ 350 行(用例检查)。
91
+ - 新增一个小模块:建文件 → 登记进大模块 README 的索引 → 跑文档用例。
92
+
93
+ ## 术语
94
+
95
+ | 词 | 意思 |
96
+ | --- | --- |
97
+ | 两个半边 | 浏览器 `client.js` 与宿主 `index.js`+`host/*`,写同一份库 |
98
+ | `folderAt` | 「最后一次移动归类」的时间戳,合并时由它决定条目在哪个夹子 |
99
+ | 墓碑 | `removed: [{kind, id, at}]`,删除的传播方式;比它旧的副本不能复活 |
100
+ | marks | 语音引擎逐词回调的边界时间,用来做句内高亮 |
101
+ | 半边/小模块 | 本文件用的两个粒度:大模块(一层职责)与不可拆小模块(一篇文档) |
102
+ | 版本指纹 | `revisionOf(库)`,十来个字节,面板据此判断「宿主变了没有」 |
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 KNtnx
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.en.md ADDED
@@ -0,0 +1,239 @@
1
+ <div align="center">
2
+
3
+ <img src="icon.svg" width="64" alt="dsh-english-reader"/>
4
+
5
+ # dsh-english-reader
6
+
7
+ **Read English aloud inside DeepSeek Harness: paste a passage, follow sentence by sentence, resume exactly where you stopped.**
8
+
9
+ A right-sidebar tab, or a full-width panel of its own. Word-level highlighting, sentence translation, Microsoft Edge and local Kokoro engines, plus your own TTS API.
10
+
11
+ [中文](README.md) · [English](README.en.md)
12
+
13
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="License"></a>
14
+ <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/powered_by-dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white" alt="powered by dsh"></a>
15
+
16
+ </div>
17
+
18
+ ## Why
19
+
20
+ Reading English long-form splits your attention: the audio is on sentence 12 while your eyes are on sentence 30, and coming back loses both.
21
+
22
+ This plugin ties "what is spoken" to "what is read": sentence-level seeking, word-level highlighting, persisted progress. Close the panel, restart Harness — you land on the same sentence.
23
+
24
+ It handles both shapes: a hard-wrapped **article** is joined into sentences instead of being split mid-thought, and a labelled **dialogue** (`Emma: Hi` / `Daniel: Hello`) is detected and read by two alternating voices.
25
+
26
+ <p align="center">
27
+ <img src="docs/reader-2.png" width="880" alt="Dialogue reading: alternating speakers, the current line highlighted, English and its translation paired, settings on the right"/>
28
+ </p>
29
+
30
+ <br clear="all">
31
+
32
+ ## Features
33
+
34
+ - **Two entry points**: a right-sidebar tab, or a full-width side panel (no composer in the way).
35
+ - **Sentence playback with resume**: click any sentence to start there; progress is persisted.
36
+ - **Word-level highlight**: Edge reports **real word timestamps**, so the current word tracks the audio. The local engine estimates.
37
+ - **Sentence translation**: any model you already configured in Harness (pick provider, then model), or one of two keyless services: Google and Volcengine.
38
+ - **Article vs dialogue**: hard wraps are joined, paragraphs split on blank lines, two voices only when two speakers are actually detected.
39
+ - **Dialogue library**: keep many texts, rename, pin, delete; each row shows "sentence n of m".
40
+ - **Loop and continuous playback**: looping one sentence and "continue to the next" are separate switches; turn the second off and playback stops on the sentence.
41
+ - **Right-click a word**: only the sentence being read splits into words; hovering outlines them, right-click opens the definition.
42
+ - **Chinese and English dictionaries**: Chinese meanings grouped by part of speech (简明-style), English definitions with examples; choose both, English only, or Chinese only.
43
+ - **Saved words**: save from the card, reach the list from the header, and expand an entry in place with its examples and source sentence.
44
+ - **Reading width and type size**: narrow / medium / wide / custom, three type presets plus an exact pixel size, shared by the reader, the library and the saved words.
45
+
46
+ The settings card has four collapsible sections; only the engine starts open, and the ones you expand are remembered. Open what you need and the card stays inside the window.
47
+
48
+ ## Install
49
+
50
+ **From GitHub (recommended)**
51
+
52
+ In DSH **Plugins → Add plugin**, enter:
53
+
54
+ ```
55
+ github:KNtnx/dsh-english-reader
56
+ ```
57
+
58
+ Or on the command line:
59
+
60
+ ```bash
61
+ dsh plugin --profile web add github:KNtnx/dsh-english-reader
62
+ ```
63
+
64
+ **From a local checkout**
65
+
66
+ ```bash
67
+ git clone https://github.com/KNtnx/dsh-english-reader.git
68
+ dsh plugin --profile web add link:./dsh-english-reader
69
+ ```
70
+
71
+ Replace `web` with your profile (Desktop builds usually use `desktop`), then restart `dsh web`.
72
+
73
+ > The Edge voices work as soon as the plugin is installed. To use the local model, press **Download and use** on the local-model card or in the add-source dialog: the panel first explains what will run, then installs the local engine (about 120 MB, once) and downloads the model (about 89 MB). Cancelling installs nothing.
74
+ >
75
+ > The local engine `kokoro-js` is an **optional peer**, so the plugin install itself stays a few megabytes and never runs the CUDA probe that always fails on CUDA 13. If the install fails (offline, restricted network), the panel shows why and the manual command below still works.
76
+
77
+ ## Speech sources
78
+
79
+ Edge is built in; everything else is a source you add. Each can be renamed, edited and removed on its own.
80
+
81
+ | Source | Needs | Notes |
82
+ | --- | --- | --- |
83
+ | Microsoft Edge (online) | nothing | Neural voices, needs a network. Its word boundaries drive the highlight. |
84
+ | Local model (Kokoro-82M) | about 120 MB engine + 89 MB model | **Download and use** installs the engine and then the model; you can also point it at a folder you already have (with `config.json` and `onnx/`). Edge-only users install nothing extra. |
85
+ | Custom TTS API | endpoint, protocol, model, key | Three protocols: OpenAI-compatible `/audio/speech`, Alibaba DashScope native, Azure Speech (SSML). The domain alone is enough — paths are probed and remembered. |
86
+
87
+ **Why the protocol is required**: one vendor's endpoints do not share a path or a body. Alibaba's OpenAI-compatible prefix serves chat and embeddings only; speech lives at the native `api/v1/services/audio/tts/SpeechSynthesizer` and returns a download URL.
88
+
89
+ **Keys never reach the browser**: the panel only sees `hasKey: true`. Source records live in `$DSH_HOME/dsh-english-reader/sources.json` (mode `0600`), and the host attaches the key for connection tests, model lists and voice lists.
90
+
91
+ ## Dictionaries
92
+
93
+ Three independent settings:
94
+
95
+ **Show**: Both / English / Chinese — what the card prints
96
+
97
+ **Chinese source**: iciba (free) / your model
98
+
99
+ **English source**: WordNet (free) / Wiktionary (free) / Collins (needs a key) / your model
100
+
101
+ Choosing the model source expands **that slot's own provider and model right beneath it**, so the two languages can use different models. Only the languages being shown are queried, so English-only mode never spends a Chinese lookup.
102
+
103
+ | Source | Language | Needs | Notes |
104
+ | --- | --- | --- | --- |
105
+ | iciba | Chinese | nothing | Grouped by part of speech; phrases work too |
106
+ | WordNet (Datamuse) | English | nothing | Full-sentence definitions with clear part-of-speech tags |
107
+ | Wiktionary | English | nothing | Backup beyond WordNet |
108
+ | Collins | English | **your own API key** | Official API; the key lives on the host in `$DSH_HOME/dsh-english-reader/dictionary.json` (mode `0600`) and the browser only learns whether one exists |
109
+ | Your model | both | your DSH model | Collins-style sentences, IPA, Chinese gloss and an example |
110
+
111
+ The model writes complete sentences (`To regulate an activity means to control it by means of official rules.`) rather than synonym lists. **Each word is generated once**, cached per `word|source|model`, so switching language, source or model never pays twice. Translation is only used when neither source has an entry.
112
+
113
+ Lookups are limited to the sentence being read, so a long article never pays for per-word nodes.
114
+
115
+ ## Saved words
116
+
117
+ - Click a row to **expand it in place**: Chinese by part of speech, English definitions with examples, then the sentence it came from.
118
+ - The expansion **follows the current dictionary**: switching source or shown language re-resolves it instead of freezing the answer it was saved with.
119
+ - Only the **word and its sentence** are stored; the definitions come from the dictionary or the cache, so one word reads from WordNet in English mode and from iciba in Chinese mode.
120
+ - Three speakers: the word, each English example, and the source sentence. A word saved from the lookup card has no sentence, so that speaker is greyed out.
121
+ - Both the saved-words page and the library return to the open dialogue in one click, and both share the reader's width and size controls.
122
+ - **Shared across conversations**: the library, the reading positions and the saved words live on the host (`library.json`), not in one browser's storage, so every conversation and every browser opens the same list.
123
+
124
+ <p align="center">
125
+ <img src="docs/words-2.png" width="640" alt="Saved words: revive expanded, Chinese senses by part of speech, English definitions with examples and speakers, the source sentence at the end"/>
126
+ </p>
127
+
128
+ ## The model tool (`english_reader`)
129
+
130
+ A conversation can read and edit this library without you opening the panel: list the words
131
+ and dialogues, filter them by folder, add words, retitle or delete a dialogue, switch the
132
+ dictionary — all through one tool.
133
+
134
+ - **File by name**: `folder` takes a name (`25.12.1`) and makes it when it is new; `folderId`
135
+ takes one from `list_folders`, and a wrong id is an error that lists the folders there are.
136
+ - **Batches**: `add_words`, `move_words` and `remove_words` take a list, so filing ten words
137
+ is one call rather than ten.
138
+ - **One change per call**, reads apart from writes, so a listing tells the id before it is
139
+ needed.
140
+ - **A filing survives a merge**: where an entry lives is settled by the moment it was last
141
+ moved, so a browser, a second panel and a tool call writing the same file cannot undo each
142
+ other's folders.
143
+ - **No reload needed**: an open panel checks the host's revision every two seconds (and not
144
+ at all while hidden), so what a tool just wrote appears by itself.
145
+
146
+ ## Translation sources
147
+
148
+ | Source | Needs | Notes |
149
+ | --- | --- | --- |
150
+ | Harness model | a configured provider and model | Reuses what Harness already has; the best quality |
151
+ | Google | nothing | Keyless `translate.googleapis.com` |
152
+ | Volcengine | nothing | Keyless web endpoint; reads more naturally in Chinese |
153
+
154
+ A translation is tagged with the source and model that produced it, so switching source (or model) re-translates and replaces the lines on screen instead of leaving the previous source's version in place.
155
+
156
+ ## Privacy
157
+
158
+ - Text is synthesized only by the engine you pick: the local model stays offline, Edge and custom APIs send the sentence to that vendor.
159
+ - A lookup sends only the word you right-clicked to the dictionary source, never the whole text.
160
+ - API keys stay on the host and are never sent to the browser or written to browser storage.
161
+ - Local models, source records and the dialogue library live under `$DSH_HOME/dsh-english-reader/` and are not uploaded.
162
+ - Translation and speech requests are made from the host, never from the panel.
163
+
164
+ ### Uninstalling
165
+
166
+ Removing the plugin removes the code only. Your data is still there on reinstall:
167
+
168
+ | What | After removal | Where |
169
+ | --- | --- | --- |
170
+ | Words, dialogues, folders, tombstones | **kept** | `$DSH_HOME/dsh-english-reader/library.json` |
171
+ | Speech sources and keys, dictionary settings | **kept** | `sources.json`, `dictionary.json` in the same folder |
172
+ | The local model (about 113 MB) | **deleted** | `models/`, downloaded again when asked |
173
+ | The engine packages (`kokoro-js` and its tree, about 120 MB) | **deleted** | the profile's `node_modules`, reinstalled by the next download |
174
+
175
+ The model and the engine are installed on demand, so they leave with the plugin within a minute of removal; the library and the keys are user data and never move. To keep a copy, copy `$DSH_HOME/dsh-english-reader/` somewhere first.
176
+
177
+ ## Troubleshooting
178
+
179
+ | Symptom | Fix |
180
+ | --- | --- |
181
+ | Blank panel | Check the browser console; usually the client bundle did not load — restart `dsh web` |
182
+ | "Local engine not installed" | Press **Install engine and download** on the local-model card; the panel explains and installs it. If that fails, use the manual command under "The local engine and install scripts" |
183
+ | Local model stuck at "not downloaded" | Press Download and wait for 100%; models live in `$DSH_HOME/dsh-english-reader/models/` |
184
+ | Custom API returns 400 / 401 | Use **Test** in the editor — it names the path and the original response. 401 means the vendor rejected the key |
185
+ | A voice is ignored | Some vendors silently fall back on unknown voices; try a source that reports errors |
186
+ | Word highlight does not move | Only Edge reports word timestamps; other sources estimate from length |
187
+ | A lookup always says nothing was found | Dictionaries need a network; check the dictionary setting first, and note that an unusual phrase falls back to translation |
188
+ | A saved word says "none" for its sentence | Words saved from the dictionary card have no source sentence, by design |
189
+ | The panel is blank again | The render error boundary prints the stack; send it over instead of a screenshot |
190
+
191
+ ### The local engine and install scripts
192
+
193
+ The local engine `kokoro-js` is an optional peer and is not installed with the plugin. Pressing **Download and use** first explains that it will run:
194
+
195
+ ```bash
196
+ pnpm add --ignore-scripts kokoro-js@^1.2.1
197
+ ```
198
+
199
+ Once confirmed, the plugin runs it in the background (about 120 MB, once) and then downloads the model (about 89 MB). `--ignore-scripts` skips `onnxruntime-node`'s installer, which only fetches the CUDA acceleration libraries — the CPU binaries needed for inference already ship inside the package.
200
+
201
+ If the install fails, the panel shows why and you can run the same command in the profile directory, then restart `dsh web`. A `link:` install uses `npm install --ignore-scripts --no-save` in the plugin directory instead.
202
+
203
+ After the engine is present, a later plain `pnpm install` can still stop with `ERR_PNPM_IGNORED_BUILDS` until the build scripts of `onnxruntime-node`, `sharp` and `protobufjs` are decided (a pending approval, not a crash). The plugin writes `false` for `onnxruntime-node` and `sharp` when it installs the engine; if an upstream bump makes them pending again, do not approve `onnxruntime-node` — on CUDA 13 that script always fails and pnpm then removes the package:
204
+
205
+ ```yaml
206
+ allowBuilds:
207
+ msedge-tts@2.1.1: true
208
+ protobufjs@7.6.6: true
209
+ onnxruntime-node@1.21.0: false
210
+ sharp@0.34.5: false
211
+ ```
212
+
213
+ ## Development
214
+
215
+ **Read [AGENTS.md](AGENTS.md) before changing code.** It is a routing table: it points at the eight module docs and 46 sub-module docs under `docs/modules/`, one per thing you might want to change. Read that page's invariants, change the code, then write the doc back.
216
+
217
+ ```bash
218
+ npm install # once: react, react-dom and jsdom are devDependencies
219
+ npm test # the whole suite, about a second
220
+ node --check index.js client.js worker.mjs
221
+ dsh plugin --profile web add link:$(pwd)
222
+ ```
223
+
224
+ The tests mount the real panel in jsdom and click it, because every bug that got
225
+ through a manual check lived in state written by two interactions at once. What
226
+ is covered, what is deliberately not (layout, audio, real networks), and how to
227
+ add a test for a reported bug are in [docs/TESTING.md](docs/TESTING.md) (browser procedure: [docs/TESTING.zh.md](docs/TESTING.zh.md)).
228
+
229
+ ```
230
+ package.json plugin manifest (dsh.bundle.patch + dsh.client)
231
+ cordis.patch.yml host row insertion
232
+ index.js host: routes, source storage, four translators, two TTS protocol families
233
+ worker.mjs child process: Edge and Kokoro engines, word-boundary parsing
234
+ client.js browser: reader panel, settings card, add-source dialog, word highlight
235
+ ```
236
+
237
+ ## License
238
+
239
+ MIT, except where stated otherwise. See [LICENSE](LICENSE).
package/README.md CHANGED
@@ -1,3 +1,230 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <img src="icon.svg" width="64" alt="dsh-english-reader"/>
4
+
5
+ # dsh-english-reader
6
+
7
+ **在 DeepSeek Harness 里朗读英语:粘贴一段文字,逐句跟读,随时从上次停下的地方继续。**
8
+
9
+ 右侧栏一个标签页,或侧栏一个整页面板。逐词高亮、逐句翻译、Edge 在线与本地 Kokoro 两种引擎,还能接你自己的 TTS API。
10
+
11
+ [中文](README.md) · [English](README.en.md)
12
+
13
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="License"></a>
14
+ <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/powered_by-dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white" alt="powered by dsh"></a>
15
+
16
+ </div>
17
+
18
+ ## 为什么需要它
19
+
20
+ 读英语长文时,语音合成和阅读位置是两件事:播放器在读第 12 句,你的眼睛在第 30 句,切换回来就找不着了。
21
+
22
+ 这个插件把「念到哪」和「看到哪」绑在一起:句子级定位、词级高亮、进度持久化。关掉面板、重启 Harness,回来还是那一句。
23
+
24
+ 他同时照顾两件事:**文章和对话**。粘贴一篇硬换行的文章不会被拆成乱句;粘贴 `Emma: Hi` / `Daniel: Hello` 这样的对话,会自动识别两个说话人并用两套音色轮流读。
25
+
26
+ <p align="center">
27
+ <img src="docs/reader-2.png" width="880" alt="对话阅读:角色 E 与 D 交替,当前句高亮,英文与译文成对,右侧为朗读设置"/>
28
+ </p>
29
+
30
+ <br clear="all">
31
+
32
+ ## 功能
33
+
34
+ - **两种打开方式**:右侧栏标签页,或侧栏整页面板(全宽,无输入框打扰)。
35
+ - **逐句朗读 + 断点续读**:点任意一句从那里念;进度写进存储,重开即恢复。
36
+ - **逐词高亮**:Edge 引擎报告**真实词时间戳**,当前词随语音走;本地引擎按时长估算。
37
+ - **逐句翻译**:三种来源任选——DSH 已配置的模型、免密钥的 Google、免密钥的火山翻译;译文用衬线体、次级色,与原文区分。
38
+ - **文章 / 对话自动判别**:硬换行合并成句,段落按空行切分;识别到两个人名才用双音色。
39
+ - **对话库**:保存多篇文本,可重命名、置顶、删除,列表里显示「第几句 / 共几句」。
40
+ - **连读与循环**:单句循环和「连读下一句」各自独立,关掉连读就一句一停,停在原处。
41
+ - **右键查词**:只有正在朗读的那一句把单词拆成词级;悬停出现淡框,右键弹出释义。
42
+ - **中英 / 英英 / 模型词典**:中文按词性分行,英文来自 WordNet,也可以让 DSH 模型自己写(柯林斯式整句释义)。
43
+ - **单词收藏**:词卡可收藏,头部入口进入「我的单词」,点一行在原地展开词条、例句和收藏时的原句。
44
+ - **阅读宽度与字号**:窄 / 中 / 宽 / 自定义,字号小 / 中 / 大 + 自定义 px;阅读页、对话库、我的单词三处共用。
45
+
46
+ 设置卡片分四块,可折叠,只默认展开「引擎」,你展开过的会记住;一次只展开需要的部分,卡片不会撑出屏幕。
47
+
48
+ ## 安装
49
+
50
+ **方式一:从 GitHub 安装(推荐)**
51
+
52
+ 在 DSH 的 **插件 → 添加插件** 里填:
53
+
54
+ ```
55
+ github:KNtnx/dsh-english-reader
56
+ ```
57
+
58
+ 或命令行:
59
+
60
+ ```bash
61
+ dsh plugin --profile web add github:KNtnx/dsh-english-reader
62
+ ```
63
+
64
+ **方式二:本地目录**
65
+
66
+ ```bash
67
+ git clone https://github.com/KNtnx/dsh-english-reader.git
68
+ dsh plugin --profile web add link:./dsh-english-reader
69
+ ```
70
+
71
+ 把 `web` 换成你实际的 profile(Desktop 版通常是 `desktop`)。安装完重启 `dsh web`。
72
+
73
+ > 装好插件后 Edge 语音即可用。要用本地模型:在本地模型卡片或「添加来源」里点「下载并使用」;第一次会先说明将执行什么,确认后插件自己安装本地引擎(约 120 MB,只装一次),装好再下载约 89 MB 的模型。取消不会安装任何东西。
74
+ >
75
+ > 本地引擎 `kokoro-js` 是**可选 peer**,默认不随插件安装,所以插件安装本身只有几 MB,也不会去跑那个在 CUDA 13 上必然失败的 CUDA 探测脚本。安装失败(离线、受限网络等)时面板会显示原因,也可以按「排错」手动执行命令。
76
+
77
+ ## 语音来源
78
+
79
+ 内置 Edge,其余来源由你添加(侧栏面板 → 添加来源)。每个来源可以命名、编辑设置、单独删除。
80
+
81
+ | 来源 | 需要 | 说明 |
82
+ | --- | --- | --- |
83
+ | 微软 Edge(在线) | 什么都不用 | 神经音色,需要联网,文本发送到微软。首选的「逐词高亮」体验来自它。 |
84
+ | 本地模型(Kokoro-82M) | 约 120 MB 引擎 + 89 MB 模型 | 点「下载并使用」后由插件安装引擎并下载模型;也可指向你已有的模型目录(含 `config.json` 与 `onnx/`)。只用 Edge 的用户不用安装。 |
85
+ | 自定义 TTS API | 地址、协议、模型、密钥 | 三种协议:OpenAI 兼容 `/audio/speech`、阿里云百炼原生接口、Azure 语音(SSML)。只填域名即可,路径会自动探测并记住。 |
86
+
87
+ **为什么协议是必选项**:同一家服务的不同接口路径和请求体完全不同。阿里云百炼的 OpenAI 兼容前缀只支持对话与向量,语音合成走原生的 `api/v1/services/audio/tts/SpeechSynthesizer`,返回的还是音频下载地址。协议决定发什么请求。
88
+
89
+ **密钥不出宿主**:面板只能读到 `hasKey: true`,读不到明文。语音来源存在 `sources.json`,柯林斯密钥存在 `dictionary.json`(都在 `$DSH_HOME/dsh-english-reader/`,权限 `0600`);测试连接、拉列表、查词典都由宿主代取密钥。
90
+
91
+ ## 词典
92
+
93
+ 三个独立选项,互不影响:
94
+
95
+ **显示**:中英 / 英英 / 中文 —— 决定卡片里露出哪几种释义
96
+
97
+ **中文来源**:iciba(免费)/ 使用模型
98
+
99
+ **英英来源**:WordNet(免费)/ Wiktionary(免费)/ 柯林斯(需密钥)/ 使用模型
100
+
101
+ 选「使用模型」时,**对应的供应商与模型就在它下面展开**,两种语言可以指定不同的模型。只查询正在显示的语言,所以「英英」模式不会多花一次中文查询。
102
+
103
+ | 来源 | 语言 | 需要 | 说明 |
104
+ | --- | --- | --- | --- |
105
+ | iciba | 中文 | 无 | 按词性分行,词组同样可查 |
106
+ | WordNet(Datamuse) | 英文 | 无 | 完整句子释义,词性标记清晰 |
107
+ | Wiktionary | 英文 | 无 | WordNet 之外的备份 |
108
+ | 柯林斯 | 英文 | **自己的 API key** | 官方接口;密钥存在宿主机 `$DSH_HOME/dsh-english-reader/dictionary.json`(权限 `0600`),浏览器只能读到「已保存」 |
109
+ | 使用模型 | 中英 | DSH 模型 | 柯林斯式整句释义 + IPA + 中文 + 例句 |
110
+
111
+ 模型写出的释义是完整句子(例如 `To regulate an activity means to control it by means of official rules.`),而不是同义词堆砌。**每个词的模型释义只生成一次**,结果按 `单词|来源|模型` 缓存,切换显示语言、来源或模型都不会重复消耗额度;两个来源都没有词条时(多为生僻词组),才回落到翻译来源。
112
+
113
+ 查词只对**当前朗读句**开放:其余句子是纯文本,长文的渲染开销不随句数增长。
114
+
115
+ ## 我的单词
116
+
117
+ - 点一行**就地展开**:中文按词性分行,英文释义带例句,末尾附收藏时的原句。
118
+ - 展开的内容**跟随当前词典**:换来源或换显示语言,展开区立刻重新解析,不会停留在收藏时的旧释义。
119
+ - 收藏只记录**单词和原句**,释义来自词典或缓存——所以同一个词在「英英」下看是 WordNet,在「中文」下看是 iciba。
120
+ - 三个喇叭:单词、词条例句、原句各一个;从字典卡片搜来的词没有原句,那个喇叭是灰的。
121
+ - 「我的单词」和「对话库」都可一键返回当前对话;两页共用阅读页的宽度与字号设置。
122
+ - **跨会话共享**:对话库、朗读位置和收藏的单词存在宿主(`library.json`)里,不是某个浏览器的本地存储——所以每个对话、每个浏览器打开都是同一份。
123
+
124
+ <p align="center">
125
+ <img src="docs/words-2.png" width="640" alt="我的单词:展开 revive,中文按词性分行,英文释义带例句与小喇叭,末尾标注原句"/>
126
+ </p>
127
+
128
+ ## 模型工具(`english_reader`)
129
+
130
+ 对话里的模型可以直接读写这份库,不需要你打开面板:查有哪些词和文章、按夹子筛选、加词、改标题、删词、换词典,都走同一个工具。
131
+
132
+ - **按名字归类**:`folder` 收夹名(如 `25.12.1`),没有就顺手建出来;`folderId` 收 `list_folders` 给的 id,给错会报错并列出已有的夹子。
133
+ - **批量**:`add_words` / `move_words` / `remove_words` 一次处理一批词,十个词是一次调用,不是十次。
134
+ - **一次只改一件事**:读(`list_words`、`list_folders`、`list_dialogues`、`get_settings`、`define_word`)与写(`add_*`、`move_*`、`rename_dialogue`、`delete_dialogue`、`set_dictionary`、`normalize_words`)分开,写之前先列一次就知道 id。
135
+ - **归类不会被覆盖**:夹子归属由「谁最后一次移动」的时间戳决定,浏览器、另一个面板、工具三方写同一份文件也不会互相抹掉。
136
+ - **改完立刻生效**:面板每两秒问一次宿主的版本号(隐藏时暂停),工具刚写进去的词会自己出现在列表里,不用刷新页面。
137
+
138
+ ## 翻译来源
139
+
140
+ | 来源 | 需要 | 说明 |
141
+ | --- | --- | --- |
142
+ | DSH 自带模型 | 选择供应商与模型 | 用你在 Harness 里已经配置好的模型,译文质量最好 |
143
+ | Google | 无 | 免密钥的 `translate.googleapis.com` |
144
+ | 火山翻译 | 无 | 免密钥的网页接口,中文语感更自然 |
145
+
146
+ 译文跟着**来源**走:每条译文都记着是哪个来源、哪个模型生成的,换来源(或换模型)会立刻重新翻译并替换屏幕上的译文,不会继续显示旧来源的版本。
147
+
148
+ ## 隐私
149
+
150
+ - 文本只在你选择的引擎上合成:本地模型完全离线,Edge 与自定义 API 会把句子发给对应服务商。
151
+ - 查词时只有你查的那个单词会发给词典来源(iciba / Wiktionary),不会上传整篇文本。
152
+ - API 密钥只存宿主,不以任何形式下发到浏览器,也不写进前端存储。
153
+ - 本机模型、来源配置与对话库分别在 `$DSH_HOME/dsh-english-reader/models/`、`sources.json` 与 `library.json`,不上传。
154
+ - 翻译与语音请求只从宿主发起,面板不直连第三方。
155
+
156
+ ### 卸载
157
+
158
+ 删掉插件只删代码。重装以后你的数据还在:
159
+
160
+ | 内容 | 卸载后 | 位置 |
161
+ | --- | --- | --- |
162
+ | 单词、对话、夹子、删除记录 | **保留** | `$DSH_HOME/dsh-english-reader/library.json` |
163
+ | 语音来源与密钥、词典设置 | **保留** | 同目录的 `sources.json`、`dictionary.json` |
164
+ | 本地模型(约 113 MB) | **删除** | `models/`,需要时重新下载 |
165
+ | 语音引擎包(`kokoro-js` 等,约 120 MB) | **删除** | profile 的 `node_modules`,下次点「下载」时重装 |
166
+
167
+ 模型与引擎包是插件按需装的,卸载后一分钟内被收走;库和密钥是用户数据,永远不动。想在卸载前留一份,把整个 `$DSH_HOME/dsh-english-reader/` 复制出去即可。
168
+
169
+ ## 排错
170
+
171
+ | 现象 | 处理 |
172
+ | --- | --- |
173
+ | 面板一片空白 | 打开浏览器控制台看报错;多半是插件客户端没加载,重启 `dsh web` |
174
+ | 「本地引擎未安装」 | 点本地模型卡片里的「安装引擎并下载」,确认后由插件安装;失败时看下面「本地引擎与构建脚本」的手动命令 |
175
+ | 本地模型一直「未下载」 | 点「下载」等进度到 100%;模型在 `$DSH_HOME/dsh-english-reader/models/` |
176
+ | 自定义 API 报 400 / 401 | 先在编辑窗口点「测试连接」,它会显示具体路径与原始响应;401 表示密钥被服务商拒绝 |
177
+ | 音色填了却不生效 | 换一个能连通的来源再试;部分服务商对未知音色是静默回退而不是报错 |
178
+ | 逐词高亮不动 | 只有 Edge 引擎报告词时间戳,其余来源按字符长度估算 |
179
+ | 查词一直「没查到」 | 词典需要联网;先在设置里确认字典档位,词组查不到是正常的,会走翻译来源 |
180
+ | 收藏的单词原文显示「无」 | 从字典卡片搜索收藏的词没有来源句,这是预期行为 |
181
+
182
+ ### 本地引擎与构建脚本
183
+
184
+ 本地引擎 `kokoro-js` 是可选 peer,默认不随插件安装。点「下载并使用」时,面板会先说明将执行:
185
+
186
+ ```bash
187
+ pnpm add --ignore-scripts kokoro-js@^1.2.1
188
+ ```
189
+
190
+ 确认后由插件在后台执行(约 120 MB,只装一次),完成后自动继续下载约 89 MB 的模型。`--ignore-scripts` 跳过 `onnxruntime-node` 的安装脚本——它只负责下载 CUDA 加速库,CPU 推理需要的二进制本来就在包里。
191
+
192
+ 安装失败时,面板会显示原因;可以打开终端在 profile 目录手动执行同一条命令后重启 `dsh web`。`link:` 安装的插件会改用插件目录里的 `npm install --ignore-scripts --no-save`。
193
+
194
+ 引擎装好后,普通 `pnpm install` 仍可能因 `onnxruntime-node`、`sharp`、`protobufjs` 的构建脚本未表态而以 `ERR_PNPM_IGNORED_BUILDS` 停下(是「待批准」,不是崩溃)。插件安装成功后会尽力把 `onnxruntime-node`、`sharp` 写成 `false`;如果上游升级版本后它们又变成待批准,不要批准 `onnxruntime-node`——这个脚本在 CUDA 13 上必然失败,pnpm 随即把包丢掉:
195
+
196
+ ```yaml
197
+ allowBuilds:
198
+ msedge-tts@2.1.1: true
199
+ protobufjs@7.6.6: true
200
+ onnxruntime-node@1.21.0: false
201
+ sharp@0.34.5: false
202
+ ```
203
+
204
+ ## 开发
205
+
206
+ **要改代码先读 [AGENTS.md](AGENTS.md)**:那是一份目录,按「我要改什么 → 读哪篇」指向 `docs/modules/` 下的八个大模块与 46 篇小模块文档。改之前读那篇的「不变量」,改完回写它。
207
+
208
+ ```bash
209
+ npm install # 一次:react、react-dom、jsdom 是开发依赖
210
+ npm test # 全部测试,约一秒
211
+ node --check index.js client.js worker.mjs
212
+ dsh plugin --profile web add link:$(pwd)
213
+ ```
214
+
215
+ 测试会在 jsdom 里挂载真正的面板并点击真正的控件——之前漏掉的问题,几乎都是两个操作同时写同一份状态。覆盖了什么、故意没覆盖什么(排版、音频、真实网络),以及遇到 bug 时怎么写测试,见 [测试流程(含浏览器复核)](docs/TESTING.zh.md) 与 [docs/TESTING.md](docs/TESTING.md)。
216
+
217
+ ```
218
+ package.json 插件清单(dsh.bundle.patch + dsh.client)
219
+ cordis.patch.yml 宿主行插入
220
+ index.js 宿主:路由、来源存储、四种翻译、两族 TTS 协议
221
+ worker.mjs 子进程:Edge 与 Kokoro 引擎,词边界解析
222
+ client.js 浏览器:阅读面板、设置卡片、添加来源对话框、词高亮
223
+ locale/ 插件市场展示文案
224
+ docs/DETAIL.md 插件详情页(英文)
225
+ docs/DETAIL.zh.md 插件详情页(中文)
226
+ ```
227
+
228
+ ## License
229
+
230
+ 除特别说明外,本仓库以 [MIT](LICENSE) 授权。