dsh-yanfield 0.0.0-stage → 0.1.2

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/LICENSE ADDED
@@ -0,0 +1,79 @@
1
+ Copyright (c) 2026 ZzimaR
2
+
3
+ Required Notice: Copyright ZzimaR (https://github.com/ZzimaR/Yanfield)
4
+
5
+ # PolyForm Noncommercial License 1.0.0
6
+
7
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
8
+
9
+ ## Acceptance
10
+
11
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
12
+
13
+ ## Copyright License
14
+
15
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
16
+
17
+ ## Distribution License
18
+
19
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
20
+
21
+ ## Notices
22
+
23
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
24
+
25
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
26
+
27
+ ## Changes and New Works License
28
+
29
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
30
+
31
+ ## Patent License
32
+
33
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
34
+
35
+ ## Noncommercial Purposes
36
+
37
+ Any noncommercial purpose is a permitted purpose.
38
+
39
+ ## Personal Uses
40
+
41
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observation, without any anticipated commercial application, is use for a permitted purpose.
42
+
43
+ ## Noncommercial Organizations
44
+
45
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
46
+
47
+ ## Fair Use
48
+
49
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
50
+
51
+ ## No Other Rights
52
+
53
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
54
+
55
+ ## Patent Defense
56
+
57
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
58
+
59
+ ## Violations
60
+
61
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
62
+
63
+ ## No Liability
64
+
65
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
66
+
67
+ ## Definitions
68
+
69
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
70
+
71
+ **You** refers to the individual or entity agreeing to these terms.
72
+
73
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
74
+
75
+ **Your licenses** are all the licenses granted to you for the software under these terms.
76
+
77
+ **Use** means anything you do with the software requiring one of your licenses.
78
+
79
+ **Trademark** means trademarks, service marks, and similar rights.
package/README.en.md ADDED
@@ -0,0 +1,207 @@
1
+ <div align="center">
2
+
3
+ <img src="icon.svg" alt="Yanfield: a vermilion field grid and an ink drop on a rice-paper tile" width="88" height="88">
4
+
5
+ # Yanfield 砚田
6
+
7
+ **A long-form writing desk inside DeepSeek Harness.**
8
+
9
+ Manuscript, outline, world notes and an AI assistant on one desk.<br>
10
+ Your book stays local, the model is the DeepSeek you already configured, and every AI edit is reviewed by you.
11
+
12
+ [![DSH version](https://img.shields.io/badge/DSH-%E2%89%A5%200.2.1--rc.5%20%3C%200.3.0-4f7864?style=flat-square)](#install)
13
+ [![Node for builds](https://img.shields.io/badge/Node-%E2%89%A5%2022.19-4f7864?style=flat-square)](https://nodejs.org)
14
+ [![Version](https://img.shields.io/github/v/release/ZzimaR/dsh-yanfield?label=version&style=flat-square)](https://github.com/ZzimaR/dsh-yanfield/releases/latest)
15
+ [![license](https://img.shields.io/badge/license-PolyForm%20Noncommercial-a97f2b?style=flat-square)](LICENSE)
16
+
17
+ [Install](#install) · [First run](#first-run) · [Features](#features) · [AI and cost](#ai-and-cost) · [Screenshots](#screenshots) · [Data and backup](#data-and-backup) · [Troubleshooting](#troubleshooting) · [Development](#development) · [中文](README.md)
18
+
19
+ </div>
20
+
21
+ > [!NOTE]
22
+ > Yanfield is still being polished; UI and behavior will keep changing. Bugs and ideas are welcome in [Issues](https://github.com/ZzimaR/dsh-yanfield/issues) — the Bug report / Feature request forms (with environment and steps) get fixed faster. Pull requests are welcome too.
23
+
24
+ [![Yanfield inside DeepSeek Harness: open the bookshelf from the host sidebar, switch between outline and notes, preview AI context, and review a prose edit](docs/screenshots/yanfield-in-dsh.gif)](docs/screenshots/yanfield-in-dsh.gif)
25
+
26
+ 24-second walkthrough of a sample novel in DSH. The review uses a prepared example edit. The interface and captions are in Chinese.
27
+
28
+ <p align="center"><sub>Three-column writing desk · sample manuscript · click for full size</sub></p>
29
+
30
+ ## What this plugin is
31
+
32
+ Yanfield is a **DeepSeek Harness plugin**, not a standalone app. After installation a 「砚田」 entry appears in the Harness sidebar; opening it gives you a long-form writing desk rendered inside the panel.
33
+
34
+ - **Writing desk** — novels / volumes / chapters, three columns (outline · prose · AI), autosave, word counts, focus mode, adjustable typography, and two themes (rice-paper light, night-sail dark).
35
+ - **Notes at hand** — chapter blueprints, characters, world settings, foreshadowing and story archives live in the left rail, edited in place without leaving the page.
36
+ - **AI proposes, you decide** — the assistant reads your notes, works in several steps, and proposes prose and note changes; prose is reviewed paragraph by paragraph (green insertions, red deletions) and only what you keep is written into the manuscript.
37
+ - **Local first** — manuscript, notes and conversations live in a local SQLite file; the model comes from the DeepSeek service you already configured in Harness, so there is no second API key to manage.
38
+
39
+ ## Install
40
+
41
+ Requires DeepSeek Harness `>=0.2.1-rc.5 <0.3.0`. Choose the command for your profile to install the prebuilt package from [npm](https://www.npmjs.com/package/dsh-yanfield).
42
+
43
+ ```bash
44
+ # Web
45
+ dsh plugin --profile web add dsh-yanfield
46
+
47
+ # Desktop
48
+ dsh plugin --profile desktop add dsh-yanfield
49
+ ```
50
+
51
+ Then **quit Harness completely and start it again** — a page refresh is not enough, because the plugin ships host-side code.
52
+
53
+ For offline installation, download `dsh-yanfield.tgz` from [GitHub Releases](https://github.com/ZzimaR/dsh-yanfield/releases/latest) and run `dsh plugin --profile <profile> add "<local archive path>"`.
54
+
55
+ How to confirm it worked:
56
+
57
+ 1. a 「砚田」 entry appears in the left sidebar;
58
+ 2. Check the version and build time in `砚田 → Settings → About`. The build time comes from the bundle.
59
+
60
+ To update, run `dsh plugin --profile <profile> add dsh-yanfield@latest` in the same profile and restart Harness. To roll back, replace `@latest` with the desired version, such as `@0.1.1`. This also switches an existing GitHub install to npm.
61
+
62
+ ## First run
63
+
64
+ 1. Open 「砚田」 from the sidebar and click **New novel** on the shelf (title, genre, cover color, one-line pitch).
65
+ 2. Open the novel and click **Write** to enter the three-column desk.
66
+ 3. Type into the AI box on the right, e.g. "make the first paragraph more vivid, only the first paragraph", "draft a blueprint for the next chapter", "create a character card for Zhou Wan".
67
+ 4. Prose edits open in a review view: keep or revert each paragraph, then press **Confirm review** — only kept paragraphs are written. Note changes are confirmed item by item in the task card.
68
+
69
+ Where the model comes from (`Settings → Model services`):
70
+
71
+ | Route | What you need | Notes |
72
+ | --- | --- | --- |
73
+ | DSH account sign-in | Signed in to DeepSeek inside Harness | Recommended, zero setup, balance readable |
74
+ | Official API key | `DEEPSEEK_API_KEY` | Pay per token; can also be stored on Harness' model page |
75
+ | Offline demo | Nothing | Template text only, for trying the UI; cannot really edit |
76
+
77
+ Both real routes can be switched in Settings; an unavailable route explains why (not signed in / no key).
78
+
79
+ ## Features
80
+
81
+ ![Shelf](docs/screenshots/library.png)
82
+
83
+ **Writing**
84
+
85
+ - Novel / volume / chapter tree with word counts and status; create, reorder, navigate
86
+ - Autosave with adjustable delay plus manual save; live word, paragraph and reading-time stats
87
+ - Typography controls: serif or sans, size, weight, line height, letter spacing, paragraph spacing, margins, max line width
88
+ - Focus mode, typewriter mode, writing goal and daily target
89
+ - `Alt + 1` collapse the outline, `Alt + J` focus the AI box, `Ctrl / ⌘ + K` quick jump, `Ctrl / ⌘ + F` find in chapter
90
+
91
+ **Notes**
92
+
93
+ - Three-level outline: book / volume / chapter blueprints (goal, conflict, scene beats, hooks)
94
+ - Character cards, world settings, foreshadowing, story archive (chapter summary, character states, setting changes, timeline, unresolved conflicts)
95
+ - Settings stay hidden from the AI until their reveal chapter; turning off "AI visibility" hides them even from explicit `@` references
96
+ - TXT import (chapter titles detected, preview before writing), Markdown / TXT export
97
+
98
+ **AI assistant**
99
+
100
+ - One conversation handles continuation, rewriting, card creation, note edits and blueprint drafting, with skill presets, style presets and a customizable persona
101
+ - `@` to reference chapters, characters, settings, foreshadowing and archives; context budget and per-section preview
102
+ - Progress steps keep their order, the current step updates in place, and autoscroll pauses while you read back
103
+ - Prose changes are reviewed inline (green insertions, red deletions); note changes are compared field by field
104
+ - After writing, the assistant proposes note candidates backed by the text — it only fills blanks, never overwrites your facts
105
+ - Save frequently used instructions as prompt presets; the toolbar AI menu collects quick tasks
106
+
107
+ ![Reviewing prose: green insertions, red deletions, keep or revert paragraph by paragraph](docs/screenshots/review-light.png)
108
+
109
+ ## AI and cost
110
+
111
+ - **Models** — by default the DeepSeek account already signed in to Harness; you can switch to an official API key. Both routes live in `Settings → Model services` with availability and reasons.
112
+ - **Catalogue** — `deepseek-flash` (DeepSeek-V4.1-Flash, text and images) and `deepseek-v4-pro` (DeepSeek-V4-Pro, text only), roughly 1M tokens of context each; new models registered in Harness are synced automatically.
113
+ - **Balance** — the 「余额」 button under the composer queries the signed-in DSH account, no key needed.
114
+ - **Cost** — the footer shows *today's* cumulative estimate, not a single task. Unit prices come from a built-in DeepSeek price table and switch between peak and off-peak by Beijing time (peak: weekdays 09:00–12:00 and 14:00–18:00; everything else, including weekends and public holidays, is off-peak at half price). **Estimates only — the DeepSeek bill is authoritative.**
115
+ - **Built-in thrift** — decision rounds skip deep thinking, short polishes drop a tier, small edits skip the note-organising pass, and oversized tool results are truncated with paging hints. A single-paragraph polish usually costs a few cents of a yuan; a blueprint task about a dime.
116
+
117
+ ## Screenshots
118
+
119
+ | Shelf | Dark writing desk |
120
+ | --- | --- |
121
+ | [![Shelf: novel cards with cover colors](docs/screenshots/library.png)](docs/screenshots/library.png) | [![Writing desk in the night-sail theme](docs/screenshots/workspace-dark.png)](docs/screenshots/workspace-dark.png) |
122
+
123
+ More: [model services](docs/screenshots/settings-models.png) · [screenshot notes](docs/screenshots/README.md)
124
+
125
+ ## Data and backup
126
+
127
+ - Manuscripts live in `$DSH_HOME/yanfield/yanfield.db` (plus `-wal` / `-shm`). `Settings → Data` shows the real path and can open the folder.
128
+ - Set `YANFIELD_DB_PATH` to select a database file. If the profile's `cordis.patch.yml` sets the plugin's `dataDir`, its `yanfield.db` takes precedence.
129
+ - Backup: quit Harness first, then copy the whole directory (copying SQLite while it runs can give an inconsistent snapshot).
130
+ - Removing the plugin does not delete your manuscript; the database stays where it is.
131
+
132
+ ## Troubleshooting
133
+
134
+ <details>
135
+ <summary>No 「砚田」 entry in the sidebar</summary>
136
+
137
+ Make sure you fully quit and restarted Harness (a page refresh is not enough), then check `Settings → Plugins` that `dsh-yanfield` is enabled and at the version you just installed.
138
+ </details>
139
+
140
+ <details>
141
+ <summary>"no API key" / model unavailable</summary>
142
+
143
+ The active route is the official API key route but no key is stored. Switch the route back to "DeepSeek account" in `砚田 → Settings → Model services`, or store `DEEPSEEK_API_KEY` on Harness' model page.
144
+ </details>
145
+
146
+ <details>
147
+ <summary>Balance shows a dash or says not signed in</summary>
148
+
149
+ Balance comes from the DeepSeek account signed in to Harness. Sign in there first, then press "Query balance" again.
150
+ </details>
151
+
152
+ <details>
153
+ <summary>Cost always says unknown</summary>
154
+
155
+ That request returned no usage (for example it was interrupted), or the model is not in the built-in price table and no unit price is configured in `Settings → AI and context`. Fill in the three prices to get an estimate.
156
+ </details>
157
+
158
+ <details>
159
+ <summary>Where is my manuscript / how do I move it</summary>
160
+
161
+ See "Data and backup" above. Copy the whole database directory to the new machine; if the path stays the same, nothing else is needed.
162
+ </details>
163
+
164
+ <details>
165
+ <summary>Uninstall</summary>
166
+
167
+ ```bash
168
+ dsh plugin --profile desktop remove dsh-yanfield
169
+ ```
170
+
171
+ Then restart Harness. Your manuscript is not deleted.
172
+ </details>
173
+
174
+ ## Development
175
+
176
+ Requires Node.js ≥ 22.19 (build and checks only; the runtime comes from Harness).
177
+
178
+ ```bash
179
+ npm ci # install build dependencies from package-lock.json
180
+ npm test # build dist/, check the manifest and run smoke tests
181
+ ```
182
+
183
+ ```bash
184
+ client/ plugin half: Shadow DOM mount, slot registration, style entry
185
+ src/host.ts host half: REST/SSE routes under /yanfield, model and account bridge
186
+ vendor/yanfield/ the desk itself (React components, domain logic, SQLite access)
187
+ scripts/ build, check, smoke, reinstall
188
+ docs/ features, AI and cost, architecture, development, FAQ
189
+ ```
190
+
191
+ See [development](docs/en/development.md) for the build chain and local testing, [architecture](docs/en/architecture.md) for the data model, [features](docs/en/features.md) for the full list, [AI and cost](docs/en/ai-and-cost.md) for model details, and [FAQ](docs/en/faq.md) for troubleshooting.
192
+
193
+ 中文文档:[README.md](README.md) · [docs/](docs/features.md)
194
+
195
+ ## Roadmap
196
+
197
+ - **v0.1.x (current)**: writing desk, notes system, AI review and cost visibility;
198
+ - **Next**: chapter snapshots and rollback, EPUB export, richer writing stats;
199
+ - **Later**: knowledge-graph view, model comparison, collaborative review.
200
+
201
+ ## Credits
202
+
203
+ The interface and domain logic come from [Yanfield](https://github.com/ZzimaR/Yanfield). This repository is its DeepSeek Harness plugin edition: models come from Harness, the theme follows the Harness light/dark setting, and multi-provider support is replaced by the two DeepSeek routes (DSH account / official API key).
204
+
205
+ ## License
206
+
207
+ [PolyForm Noncommercial 1.0.0](LICENSE): use, study, modify and share freely; no commercial use. Novels written with it belong to their author.
package/README.md CHANGED
@@ -1,3 +1,207 @@
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" alt="砚田:宣纸方块上的朱红田字格与一笔墨点" width="88" height="88">
4
+
5
+ # 砚田 Yanfield
6
+
7
+ **DeepSeek Harness 里的长篇写作台。**
8
+
9
+ 正文、大纲、设定与 AI 助手,在同一张书桌上。<br>
10
+ 书稿留在本地,模型用你已配好的 DeepSeek,AI 的改动由你逐段审阅。
11
+
12
+ [![DSH 版本](https://img.shields.io/badge/DSH-%E2%89%A5%200.2.1--rc.5%20%3C%200.3.0-4f7864?style=flat-square)](#安装)
13
+ [![构建用 Node](https://img.shields.io/badge/Node-%E2%89%A5%2022.19-4f7864?style=flat-square)](https://nodejs.org)
14
+ [![版本](https://img.shields.io/github/v/release/ZzimaR/dsh-yanfield?label=version&style=flat-square)](https://github.com/ZzimaR/dsh-yanfield/releases/latest)
15
+ [![许可](https://img.shields.io/badge/license-PolyForm%20Noncommercial-a97f2b?style=flat-square)](LICENSE)
16
+
17
+ [安装](#安装) · [第一次使用](#第一次使用) · [功能](#功能) · [AI 与费用](#ai-与费用) · [截图](#截图) · [数据与备份](#数据与备份) · [排障](#排障) · [开发](#开发) · [English](README.en.md)
18
+
19
+ </div>
20
+
21
+ > [!NOTE]
22
+ > 砚田还在打磨中,界面与行为会继续调整。遇到问题、有想法,欢迎在 [Issues](https://github.com/ZzimaR/dsh-yanfield/issues) 里说——用「Bug 报告 / 功能建议」模板带上环境与复现步骤会快很多;也欢迎直接提 PR。
23
+
24
+ [![砚田在 DeepSeek Harness 中的操作演示:从宿主侧栏进入书架,切换章纲与档案,预览 AI 上下文并审阅正文改动](docs/screenshots/yanfield-in-dsh.gif)](docs/screenshots/yanfield-in-dsh.gif)
25
+
26
+ 约 24 秒。画面来自 DSH 中的隔离示例作品,审阅环节使用预置的示例改动。
27
+
28
+ <p align="center"><sub>三栏写作台 · 示例书稿 · 点击图片查看原图</sub></p>
29
+
30
+ ## 这个插件做什么
31
+
32
+ 砚田是一个 **DeepSeek Harness 插件**,不是独立应用:安装后 Harness 左侧导航会出现「砚田」,点开就是一个跑在面板里的长篇写作台。
33
+
34
+ - **写作台**:作品 / 卷 / 章三级结构,三栏布局(目录 · 正文 · AI),自动保存、字数统计、专注模式、排版可调、宣纸 / 夜航双主题。
35
+ - **资料随写随查**:章纲、设定、角色、伏笔、故事档案都在左栏,浮窗就地编辑,不离开正文。
36
+ - **AI 改稿,作者做主**:AI 读资料、多步执行,提出正文与资料改动;正文逐段对比(绿色新增、红色删除),你决定保留哪几段,确认后才写进书稿。
37
+ - **本地优先**:书稿、设定、对话都在本机 SQLite 里;模型走 Harness 已经配好的 DeepSeek,不需要再填一遍 Key。
38
+
39
+ ## 安装
40
+
41
+ 需要 DeepSeek Harness `>=0.2.1-rc.5 <0.3.0`。按你启动的 profile 选择下面一条命令,安装 [npm](https://www.npmjs.com/package/dsh-yanfield) 上的预构建包。
42
+
43
+ ```bash
44
+ # Web 版
45
+ dsh plugin --profile web add dsh-yanfield
46
+
47
+ # 桌面版
48
+ dsh plugin --profile desktop add dsh-yanfield
49
+ ```
50
+
51
+ 安装完成后**完全退出 Harness 再重新打开**(只刷新页面不够:插件含宿主侧代码,需要重启进程)。
52
+
53
+ 如果需要离线安装,可以从 [GitHub Releases](https://github.com/ZzimaR/dsh-yanfield/releases/latest) 下载 `dsh-yanfield.tgz`,再运行 `dsh plugin --profile <profile> add "<本地安装包路径>"`。
54
+
55
+ 确认装好:
56
+
57
+ 1. 左侧导航出现「砚田」;
58
+ 2. 打开 `砚田 → 设置 → 关于`,核对版本和构建时间。构建时间是产物生成时间。
59
+
60
+ 更新时用同一个 profile 执行 `dsh plugin --profile <profile> add dsh-yanfield@latest`,然后重启 Harness。回退可把 `@latest` 换成目标版本,例如 `@0.1.1`。之前用 GitHub 地址安装的用户也可以用这个命令切到 npm。
61
+
62
+ ## 第一次使用
63
+
64
+ 1. 点左侧「砚田」,在书架页 **新建作品**(书名、类型、封面底色、一句话简介)。
65
+ 2. 进入作品后点 **写作**,就来到三栏写作台:左栏目录 / 章纲 / 设定 / 档案,中间正文,右侧 AI 助手。
66
+ 3. 右侧输入框直接说需求即可,例如「把第一段改得更有画面感,只改第一段」「为下一章写一份章纲」「给周晚建一张角色卡」。
67
+ 4. AI 提出的正文改动会在正文区打开审阅:逐段「保留 / 还原」,点「确认审阅结果」后只写入保留的段落;资料改动在任务卡里逐项确认。
68
+
69
+ 模型来源(`设置 → 模型服务`):
70
+
71
+ | 方式 | 需要什么 | 说明 |
72
+ | --- | --- | --- |
73
+ | DSH 账号登录 | 在 Harness 里登录 DeepSeek | 推荐,零配置;余额可直接查 |
74
+ | 官方 API Key | `DEEPSEEK_API_KEY` | 按量计费;也可在 DSH 的模型服务页填写 |
75
+ | 离线演示 | 不需要 | 只有模板文本,用于试用界面,不能真正改稿 |
76
+
77
+ 两种真实路由可以在设置页一键切换,未就绪的那条会写明原因(没登录 / 没填 Key)。
78
+
79
+ ## 功能
80
+
81
+ ![书架](docs/screenshots/library.png)
82
+
83
+ **写作**
84
+
85
+ - 作品 / 卷 / 章三级结构;新建卷、新建章、拖拽排序,章节树显示字数与状态
86
+ - 正文自动保存(延迟可调)+ 手动保存;字数、段落、阅读时间实时统计
87
+ - 排版可调:衬线 / 黑体、字号、字重、行高、字间距、段落间距、页边距、最大行宽
88
+ - 专注模式(隐藏侧栏)、打字机模式(光标居中)、写作目标与每日字数
89
+ - `Alt + 1` 收起 / 打开目录,`Alt + J` 聚焦 AI 输入框,`Ctrl / ⌘ + K` 快速跳转,`Ctrl / ⌘ + F` 页内查找
90
+
91
+ **资料**
92
+
93
+ - 总纲 / 卷纲 / 章纲三级大纲(目标、冲突、场景节拍、钩子)
94
+ - 角色卡、世界观、伏笔、故事档案(本章摘要、人物状态、设定变动、时间线、待确认冲突)
95
+ - 设定在揭示章节前默认对 AI 隐藏;关掉「AI 可见性」后即使 `@` 引用也读不到
96
+ - TXT 导入(识别「第 N 章」等标题自动拆章,预览后写入)、Markdown / TXT 导出
97
+
98
+ **AI 助手**
99
+
100
+ - 一个对话里完成续写、改稿、建卡、改设定、理章纲;带技能预设、文风选择与可自定义人设
101
+ - `@` 引用章节、角色、设定、伏笔、档案;上下文预算与分节预览可调
102
+ - 关键进展按顺序保留,当前步骤原地更新;上翻阅读时暂停自动滚动
103
+ - 正文改动在正文区逐段审阅(绿色新增 / 红色删除),资料改动按字段对比
104
+ - 写完正文自动整理「有原文依据」的资料候选,只补空白、不覆盖你写的事实
105
+ - 支持把常用指令存成提示词预设;工具栏「AI 助手」菜单收纳快捷任务
106
+
107
+ ![正文审阅:绿色新增、红色删除,逐段决定保留或还原](docs/screenshots/review-light.png)
108
+
109
+ ## AI 与费用
110
+
111
+ - **模型**:默认用 Harness 里已登录的 DeepSeek 账号;也可以切到官方 API Key。两条路由都在 `设置 → 模型服务` 里,显示可用状态与未就绪原因。
112
+ - **模型目录**:`deepseek-flash`(DeepSeek-V4.1-Flash,支持文本与图像)与 `deepseek-v4-pro`(DeepSeek-V4-Pro,纯文本),上下文各约 100 万 token;Harness 新增模型时会自动同步进选择器。
113
+ - **余额**:输入框底部的「余额」直接查 DSH 已登录账号的余额,不需要填 Key。
114
+ - **费用**:底部「今日 N tok · 预估 ¥X」是**今日累计**的估算,不是单次任务;单价由插件内置的 DeepSeek 官方价目表提供,按北京时间自动区分高峰与空闲(高峰为工作日 9:00–12:00、14:00–18:00,其余时段与法定节假日按空闲计,空闲价是高峰价的一半)。**估算仅供参考,账单以 DeepSeek 官方为准。**
115
+ - **省费的默认行为**:决策轮不做深度思考;小段润色、选区改写自动降档;改动很小时不触发「资料整理」;工具回执超过一定长度会截断并提示分页。一次单段润色通常几分钱,章纲任务一毛上下。
116
+
117
+ ## 截图
118
+
119
+ | 书架 | 深色写作台 |
120
+ | --- | --- |
121
+ | [![书架:作品卡片与封面底色](docs/screenshots/library.png)](docs/screenshots/library.png) | [![夜航主题下的写作台](docs/screenshots/workspace-dark.png)](docs/screenshots/workspace-dark.png) |
122
+
123
+ 更多:[模型服务设置](docs/screenshots/settings-models.png) · [截图说明](docs/screenshots/README.md)
124
+
125
+ ## 数据与备份
126
+
127
+ - 书稿默认在 `$DSH_HOME/yanfield/yanfield.db`(含 `-wal` / `-shm` 附属文件)。`设置 → 数据` 会显示实际路径并能一键打开所在文件夹。
128
+ - 用环境变量 `YANFIELD_DB_PATH` 可指定数据库文件。若 profile 的 `cordis.patch.yml` 配置了插件的 `dataDir`,优先使用该目录里的 `yanfield.db`。
129
+ - 备份:先退出 Harness,再复制整个目录(运行中直接复制 SQLite 可能拿到不一致的快照)。
130
+ - 卸载插件不会删除书稿;数据库仍在上面那个路径里。
131
+
132
+ ## 排障
133
+
134
+ <details>
135
+ <summary>左侧没有「砚田」</summary>
136
+
137
+ 先确认是完全退出 Harness 后重开的(不是刷新页面),再看 `设置 → 插件` 里 `dsh-yanfield` 是否已启用、版本是否为刚装的那次。
138
+ </details>
139
+
140
+ <details>
141
+ <summary>发消息报 no API key / 模型不可用</summary>
142
+
143
+ 当前路由选到了「官方 API Key」但还没有填 Key。到 `砚田 → 设置 → 模型服务` 把模型路由切回「DeepSeek 账号登录」,或在 Harness 的模型服务页填入 `DEEPSEEK_API_KEY`。
144
+ </details>
145
+
146
+ <details>
147
+ <summary>余额显示「—」或提示未登录</summary>
148
+
149
+ 余额来自 DSH 已登录的 DeepSeek 账号。先在 Harness 里登录 DeepSeek 账号,再回来点一下「查询余额」。
150
+ </details>
151
+
152
+ <details>
153
+ <summary>费用一直是「费用未知」</summary>
154
+
155
+ 说明这次调用没有返回 usage(比如请求中断),或者模型不在内置价目表里、你也没有在 `设置 → AI 与上下文` 里填单价。填上三档单价后会显示预估值。
156
+ </details>
157
+
158
+ <details>
159
+ <summary>书稿在哪 / 换电脑怎么迁</summary>
160
+
161
+ 见上面「数据与备份」。换机器时把整个数据库目录一起拷过去即可,路径不变就不需要额外配置。
162
+ </details>
163
+
164
+ <details>
165
+ <summary>怎么卸载</summary>
166
+
167
+ ```bash
168
+ dsh plugin --profile desktop remove dsh-yanfield
169
+ ```
170
+
171
+ 然后重启 Harness。书稿不会被删除。
172
+ </details>
173
+
174
+ ## 开发
175
+
176
+ 需要 Node.js ≥ 22.19(构建与自检用;运行时由 Harness 提供)。
177
+
178
+ ```bash
179
+ npm ci # 按 package-lock.json 安装构建依赖
180
+ npm test # 构建 dist/,再运行清单检查与冒烟测试
181
+ ```
182
+
183
+ ```bash
184
+ client/ 插件半区:Shadow DOM 挂载、插槽注册、样式入口
185
+ src/host.ts 宿主半区:/yanfield 下的 REST/SSE 路由、模型与账号桥接
186
+ vendor/yanfield/ 写作台本体(React 组件、领域逻辑、SQLite 访问)
187
+ scripts/ 构建、自检、冒烟、重装
188
+ docs/ 功能、AI 与费用、架构、开发、常见问题
189
+ ```
190
+
191
+ 从本地源码安装到隔离 profile 的步骤见 [本地联调](docs/development.md#五本地联调)。架构与数据模型见 [架构说明](docs/architecture.md),功能清单见 [功能说明](docs/features.md),AI 接入和费用见 [AI 与费用](docs/ai-and-cost.md),排障见 [常见问题](docs/faq.md)。
192
+
193
+ English docs: [README.en.md](README.en.md) · [docs/en/](docs/en/features.md)
194
+
195
+ ## 路线图
196
+
197
+ - **v0.1.x(当前)**:三栏写作台、资料系统、AI 审阅与费用可视化;
198
+ - **下一步**:章节版本快照与回滚、EPUB 导出、更细的写作统计;
199
+ - **更远**:知识图谱视图、多模型对比、协作审阅。
200
+
201
+ ## 致谢
202
+
203
+ 界面与领域逻辑来自 [砚田 Yanfield](https://github.com/ZzimaR/Yanfield)。本仓库是它的 DeepSeek Harness 插件化版本:模型改走 Harness 已配置的服务,主题跟随 Harness 明暗切换,多服务商适配改为「DSH 账号 / 官方 API Key」两条路由。
204
+
205
+ ## 许可
206
+
207
+ [PolyForm Noncommercial 1.0.0](LICENSE):可以自用、学习、修改和分享,不得商用。用它写出来的小说,版权归作者。
@@ -0,0 +1,5 @@
1
+ # dsh-yanfield:一个包同时提供 Host 半区与浏览器半区。
2
+ # name 必须等于 package.json 的 name,市场才会把它当成可安装的 loader 行。
3
+ - insert:
4
+ - id: yanfield
5
+ name: dsh-yanfield