dsh-plain-talk 0.1.13 → 0.1.15
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 +55 -0
- package/README.en.md +44 -26
- package/README.md +44 -26
- package/dsh/check.js +325 -250
- package/dsh/index.js +503 -479
- package/dsh/rules.js +51 -23
- package/dsh/styles.js +209 -0
- package/dsh/vocab-cli.js +196 -0
- package/dsh/vocab-policy.js +586 -0
- package/dsh/vocab-selftest.mjs +90 -0
- package/package.json +55 -56
- package/dsh/vocab.js +0 -229
- package/test/REPORT.md +0 -64
- package/test/bench-result.json +0 -281
- package/test/bench.mjs +0 -172
- package/test/determinism.mjs +0 -21
- package/test/noise.json +0 -58
- package/test/noise.mjs +0 -77
- package/test/rules-v4.mjs +0 -36
- package/test/rules-v4.txt +0 -36
- package/test/selftest.mjs +0 -59
- package/test/v4-check.json +0 -98
- package/test/v4check.mjs +0 -63
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
|
+
### 词汇库行为与安全(本轮修订)
|
|
2
|
+
|
|
3
|
+
- 存储只有一处实现:`dsh/vocab-policy.js`;删除无引用的 `dsh/vocab.js`,`dsh/index.js` 不再自己读写词库。
|
|
4
|
+
- 写入加锁(`.lock`)、重读、只改自己动过的词、原子替换;陈旧锁 15 秒回收;损坏或版本过新一律拒绝覆盖。
|
|
5
|
+
- 迁移保数据:v1 的 `terms` 只降级为观察,v2 的 `observations`/`decisions`/`preferences` 原样保留,迁移前只备份一次。
|
|
6
|
+
- 授权判定按短句生效:否定、疑问、举例、引用、代码块都不算确认;跨轮不继承;“解释一下”不改长期偏好。
|
|
7
|
+
- 类别偏好只接受项目名,领域类说法明确拒绝并说明原因。
|
|
8
|
+
- 待解释记录改为进程内按轮次,轮结束或取消即清除;关闭开关时不注入、不记录、不改长期设置。
|
|
9
|
+
- 注入有预算,超预算先裁未知词再裁已知词,本轮解释要求不裁;同一术语只出现一次。
|
|
10
|
+
- 观察层不再进入提示词:提示词只读确认层和本轮待解释层;中文后缀启发式已删除(它把「和不用解释清单中」这类短语当术语)。
|
|
11
|
+
- 「解释」类问句改为检查动词前是否紧贴否定词(不/没/别/未/无),避免从「不用解释X」里抠出假术语,同时不误杀「另外解释一下 X」。
|
|
12
|
+
- 检查器:反引号后的括号说明与中文括号说明算已解释;位置句里写明发现、报错、根因时不再要求引文;行内反引号不算证据,围栏代码块仍算。
|
|
13
|
+
- 文档同步:README 中英词汇章节重写为四层模型与实际授权规则,并标注两项尚未验证的场景。
|
|
14
|
+
|
|
15
|
+
## 0.1.15
|
|
16
|
+
|
|
17
|
+
### 修复:词汇库自动学习污染
|
|
18
|
+
|
|
19
|
+
- 词汇库改为单一存储(`dsh/vocab-policy.js`),消除两套实现共用同一个文件、互相覆盖的问题。
|
|
20
|
+
- 三层分离:观察记录(你打过的词)、确认(你亲口说过懂 / 要解释)、待解释(本轮调研)。只有确认层能改变措辞。
|
|
21
|
+
- 用户消息里的词不再自动变成"已知";文件名、路径、URL、提交哈希、会话号、实验代号不进入词汇库。
|
|
22
|
+
- "调研 X"结束后不再把 X 升级为已知,只在本轮要求解释,轮结束清除。
|
|
23
|
+
- 用户主动问"X 是什么 / 解释一下 X"时覆盖历史的免解释设置。
|
|
24
|
+
- `plain_talk_vocab` 新增 `status`、`explain`;`add` 需要用户原话授权,Agent 自行确认会被拒绝并说明原因。
|
|
25
|
+
- 新增类别级偏好:`preference` 可把「专业词汇 / 常识词汇 / 项目名」整类设为需要或不需要解释,同样需要用户原话授权;具体词的确认优先。
|
|
26
|
+
- `list` 新增 `scope: observed`,可以查看观察到的词(只做统计,不影响解释)。
|
|
27
|
+
- 旧词汇库在首次写入前自动迁移:旧条目全部降级为观察记录,确认层从空开始;保留 `plain-talk-vocab.json.bak-v1.json`;迁移幂等。
|
|
28
|
+
- 词汇库改为每个 DSH profile 一份(`profiles/<profile>/plain-talk-vocab.json`),首次使用自动接续旧的共享文件并留 `.legacy-shared.json` 备份。
|
|
29
|
+
- 每次写入前重读文件,多窗口并发写不会用旧快照覆盖别人刚写入的确认。
|
|
30
|
+
|
|
31
|
+
### 修复:插件关闭后的残留行为
|
|
32
|
+
|
|
33
|
+
- 关闭后不再记录观察、不再写词汇库、不再注入词汇上下文;规则段此前已按会话开关返回空串。
|
|
34
|
+
- 工具仍可手动调用(用于查看和整理词汇),但不构成自动行为。
|
|
35
|
+
|
|
36
|
+
### 修复:检查器与规则冲突
|
|
37
|
+
|
|
38
|
+
- 检查器不再按字数、行数、列表条数判定质量(默认无上限,只在调用方显式设阈值时提示)。
|
|
39
|
+
- 删除"长回复必须给下一步"的检查。
|
|
40
|
+
- 回指词、会话号 / 子代理 / 工具名、只给位置没给发现:从"必须改"降为"建议改";用户明确要求内部信息时应当照给。
|
|
41
|
+
- 反引号内的术语现在会被检出(此前被整体跳过);代码块内的标识符仍不逐个检查。
|
|
42
|
+
- 术语说明接受括号、前置说明("……的实验 EXP-7")和"是指 / 也就是"等后续短句,不再只认括号。
|
|
43
|
+
- 语言判断只看用户最近一条请求,不再用历史累计比例。
|
|
44
|
+
|
|
45
|
+
### 其他
|
|
46
|
+
|
|
47
|
+
- 删除全部固定长度 / 条数上限(300 字、12 行、最多 5 条)。
|
|
48
|
+
- 简洁重新定义为减少理解成本,而非字少;不得为简短删掉验证依据、限制条件或失败原因。
|
|
49
|
+
- 报告顺序:做了什么、没做到什么、用户怎么自己确认;下一步改为可选。
|
|
50
|
+
- 禁止元评论:不再输出"措辞略显生硬"这类点评,直接给成品。
|
|
51
|
+
- 术语分档:同行直接用,外行先讲它是什么再谈取舍;用户确认过的词不再解释。
|
|
52
|
+
- `package.json` 的 `files` 不再包含 `test/`,避免把本地实验脚本和日志打进 npm 包。
|
|
53
|
+
评估判据分三层(test/verdict.cjs):验收只看 comp(报告要素)的非劣性;err/warn 作护栏,只在区间确认显著退化时否决,不要求证明非劣;篇幅与注水只作诊断,不参与判定。分析单元改为「题」,重复先平均,每维报差值与 95% 置信区间。
|
|
54
|
+
当前评估只算冒烟测试:题库是 test/assess.mjs 里手写的 12 道题,不是从真实请求抽样的样本,区间不外推,也不能当发版验收依据。验收指标另行设计。
|
|
1
55
|
## 0.1.13
|
|
2
56
|
|
|
3
57
|
- 取消字数硬上限:按用户确认改为「写到把事说清为止,别为短漏关键步骤,也别为长注水」。
|
|
58
|
+
- 自检触发条件从「超过 12 行」改为「内容明显偏长」,避免残留长度门槛。
|
|
4
59
|
- 信息不足时先要材料、不猜;只有存在能自己跑的替代做法时才给命令。
|
|
5
60
|
- 清单改为一条一件事,避免用分号把多件事挤进一行。
|
|
6
61
|
- 结论仍要求在第一行。
|
package/README.en.md
CHANGED
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
<img alt="dsh-plugin" src="https://img.shields.io/badge/dsh--plugin-ready-478CBF?style=flat-square&logo=deepseek&logoColor=white">
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
|
-
A reply-shaping plugin for DeepSeek Harness: a "Plain talk" switch in the composer. When on, replies lead with the conclusion,
|
|
17
|
+
A reply-shaping plugin for DeepSeek Harness: a "Plain talk" switch in the composer. When on, replies lead with the conclusion, let length follow the task, give a conclusion plus location for citations, gloss a code with one plain sentence the first time it appears, and remember only the words you explicitly confirmed.
|
|
18
18
|
|
|
19
19
|
## What it does
|
|
20
20
|
|
|
21
21
|
* **Conclusion first**: the first line is the answer or the verdict; no restating the question, no "let me take a look".
|
|
22
|
-
* **
|
|
23
|
-
* **Self-contained**: no "as mentioned above / earlier / last round"; a code (EXP-7, DEV-1K, run-3)
|
|
24
|
-
* **Readable citations**:
|
|
25
|
-
* **Vocabulary**: words you
|
|
22
|
+
* **Length follows the task**: one line when one line does it, longer when the steps, evidence, or caveats need room. No line or character cap, and never drop verification details to look short.
|
|
23
|
+
* **Self-contained**: no "as mentioned above / earlier / last round"; a code (EXP-7, DEV-1K, run-3) gets one plain sentence the first time it appears.
|
|
24
|
+
* **Readable citations**: give the conclusion and the exact location; paste the quoted lines when the user needs to check the source.
|
|
25
|
+
* **Vocabulary memory**: only a term you explicitly confirmed stops being explained; words you typed, pasted reports and file names are observations only. "Research X" still explains X this turn.
|
|
26
26
|
|
|
27
27
|
## Results
|
|
28
28
|
|
|
@@ -76,31 +76,49 @@ Restart DSH after installing.
|
|
|
76
76
|
3. State is written to `$DSH_HOME/plain-talk.json` and survives a restart.
|
|
77
77
|
4. To make new sessions start on: set `PLAIN_TALK_DEFAULT=on` in the launch environment.
|
|
78
78
|
|
|
79
|
-
## Vocabulary
|
|
80
|
-
|
|
81
|
-
`$DSH_HOME/plain-talk-vocab.json
|
|
82
|
-
|
|
83
|
-
|
|
|
84
|
-
|-|-|-|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
79
|
+
## Vocabulary
|
|
80
|
+
|
|
81
|
+
`$DSH_HOME/profiles/<profile>/plain-talk-vocab.json` — one file per DSH profile, shared across sessions. Four layers with different authority:
|
|
82
|
+
|
|
83
|
+
|Layer|What it holds|Affects wording|
|
|
84
|
+
|-|-|-|
|
|
85
|
+
|Observations `observations`|Words you typed; statistics only|**No**, never|
|
|
86
|
+
|Decisions `decisions`|Your explicit "I know this / no need to explain" or "always explain"|**Yes** — the only long-lived layer|
|
|
87
|
+
|Pending `pending`|Terms mentioned this turn that need explaining once|This turn only; cleared on turn end or cancel|
|
|
88
|
+
|Category preference `preferences`|Per-category default; project names only|Yes, but a per-term decision wins|
|
|
89
|
+
|
|
90
|
+
**Authorization rules** (each maps to a case in `test/regressions.mjs`):
|
|
91
|
+
|
|
92
|
+
- Only the current turn's messages count. Last turn's "I know this" does not carry over — say it again if you mean it.
|
|
93
|
+
- Negation and questions apply within the same clause: "Docker I know, Redis I don't" records Docker only.
|
|
94
|
+
- Examples, quotations, code snippets and terms merely used in a task are not confirmations.
|
|
95
|
+
- "Explain X" applies to this turn only; it never flips the long-term preference. Say "always explain X from now on" for that.
|
|
96
|
+
- No guessing: "I think", "probably" and inferred seniority are not confirmations.
|
|
97
|
+
- Category preferences accept project names only. Requests like "plainly explain computer-science concepts" are rejected with a stated reason.
|
|
98
|
+
|
|
99
|
+
**Switch semantics:** when the toggle is off the plugin injects nothing, records no observations and changes no long-term settings — including the current turn's one-off explain requests. Explicit tool calls you issue still work, because they are your own instruction.
|
|
100
|
+
|
|
101
|
+
Entry points: tool `plain_talk_vocab` and CLI `node dsh/vocab-cli.js status|list|set|remove|which|render`.
|
|
102
|
+
|
|
103
|
+
**Write safety:** each write takes a lock (`plain-talk-vocab.json.lock`), re-reads the file, changes only its own terms, then replaces atomically; a crashed process leaves a stale lock that is reclaimed after 15 seconds. Corrupt files and files newer than the supported version are refused rather than overwritten; read-only views degrade to an empty store.
|
|
104
|
+
|
|
105
|
+
**Migration:** older files are backed up to `plain-talk-vocab.json.bak-v1.json` first (once; if that path is occupied the write is refused), then migrated:
|
|
106
|
+
|
|
107
|
+
- v1 `terms` (old auto-learning) all become observations; the decision layer starts empty.
|
|
108
|
+
- v2 `observations` / `decisions` / `preferences` are preserved as-is.
|
|
109
|
+
- `pending` is turn-scoped and dropped.
|
|
110
|
+
- Migration is idempotent. The legacy shared file `$DSH_HOME/plain-talk-vocab.json` is no longer copied into a profile automatically; run `node dsh/vocab-cli.js migrate` under the target profile if you want it.
|
|
111
|
+
|
|
112
|
+
**Not verified yet:** per-profile data isolation after a DSH restart, and concurrency in a real multi-process GUI. Only file-level and simulated-context checks exist so far.
|
|
113
|
+
|
|
96
114
|
## Self-check tool
|
|
97
115
|
|
|
98
|
-
`plain_talk_check` takes a draft and returns
|
|
116
|
+
`plain_talk_check` takes a draft and returns an advisory list:
|
|
99
117
|
|
|
100
|
-
*
|
|
101
|
-
*
|
|
118
|
+
* Suggestions: back-references, session ids / subagents / tool names, a location with no finding, unexplained codes, opening pleasantries, closing requests for more work, a Chinese user receiving an all-English reply.
|
|
119
|
+
* Never judged: reply length, list count, whether a next step exists, whether a term is "professional", whether a particular "previously" really crosses turns.
|
|
102
120
|
|
|
103
|
-
|
|
121
|
+
It does not gate length and it is not the judge. The rules ask for one check before a report or a code/config change, not for short answers.
|
|
104
122
|
|
|
105
123
|
## How it works
|
|
106
124
|
|
package/README.md
CHANGED
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
<img alt="dsh-plugin" src="https://img.shields.io/badge/dsh--plugin-ready-478CBF?style=flat-square&logo=deepseek&logoColor=white">
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
|
-
DeepSeek Harness
|
|
17
|
+
DeepSeek Harness 的回复优化插件:输入框里一个「说人话」开关。打开后,回复先给结论、篇幅按任务需要、引用给结论和位置、代号第一次出现时用一句人话说明,并且只记住你亲口确认过的词。
|
|
18
18
|
|
|
19
19
|
## 它做什么
|
|
20
20
|
|
|
21
21
|
* **结论先行**:第一行就是答案或判定,不复述问题,不写"我来看看"。
|
|
22
|
-
|
|
23
|
-
* **自包含**:不用"上述 / 前面 / 上一轮";代号(EXP-7、DEV-1K、run-3
|
|
24
|
-
*
|
|
25
|
-
*
|
|
22
|
+
**篇幅跟任务走**:能一句说清就一句,步骤多就写长;不设字数或行数上限,也不为短删掉验证依据。
|
|
23
|
+
* **自包含**:不用"上述 / 前面 / 上一轮";代号(EXP-7、DEV-1K、run-3)第一次出现时用一句话说明它是什么。
|
|
24
|
+
* **引用可读**:给结论和准确位置;用户要核对原文时再贴那几行。
|
|
25
|
+
* **词汇记忆**:只有你明确说过"我懂了 / 以后不用解释"的词才会停止解释;你打过的词、粘贴的报告、文件名都只算观察,不会改变措辞。"调研 X"本轮照样解释 X。
|
|
26
26
|
|
|
27
27
|
## 效果
|
|
28
28
|
|
|
@@ -76,31 +76,49 @@ dsh plugin --profile desktop add ./dsh-plain-talk
|
|
|
76
76
|
3. 状态写在 `$DSH_HOME/plain-talk.json`,重启后保持。
|
|
77
77
|
4. 想让新会话默认开启:启动环境里设 `PLAIN_TALK_DEFAULT=on`。
|
|
78
78
|
|
|
79
|
-
## 词汇清单
|
|
80
|
-
|
|
81
|
-
`$DSH_HOME/plain-talk-vocab.json
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|-|-|-|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
79
|
+
## 词汇清单
|
|
80
|
+
|
|
81
|
+
`$DSH_HOME/profiles/<profile>/plain-talk-vocab.json`,每个 DSH profile 一份,跨会话共享。里面分四层,权限完全不同:
|
|
82
|
+
|
|
83
|
+
|层|记什么|会不会改变措辞|
|
|
84
|
+
|-|-|-|
|
|
85
|
+
|观察 `observations`|你打过的词,只做统计|**不会**,永远不影响解释|
|
|
86
|
+
|确认 `decisions`|你明确说过"我懂了 / 以后不用解释"或"以后每次都解释"|**会**,这是唯一长期生效的一层|
|
|
87
|
+
|待解释 `pending`|本轮提到、需要解释一次的术语|本轮会,轮结束或取消即清除|
|
|
88
|
+
|类别偏好 `preferences`|按类别设的默认,目前只支持项目名|会,但具体词上的确认优先|
|
|
89
|
+
|
|
90
|
+
**授权规则**(每条都能对上 `test/regressions.mjs` 的用例):
|
|
91
|
+
|
|
92
|
+
- 只认你当轮消息里写的话。上一轮的"我懂"不延续到这一轮,要授权就在新消息里再说一次。
|
|
93
|
+
- 否定和疑问只在同一短句内生效:"Docker 我懂,Redis 不懂"只记住 Docker,不会把 Redis 记成已知。
|
|
94
|
+
- 举例、引用、反引号里的示例、任务里顺带提到的词,都不算确认。"帮我改 Kubernetes 配置"不会让 Kubernetes 变成已知。
|
|
95
|
+
- "解释一下 X"只影响本轮,不改长期偏好;要长期解释得说"以后每次都解释 X"。
|
|
96
|
+
- 不认猜测:说"我猜""应该是"不算确认;插件也不会按你的职业或用量替你推断。
|
|
97
|
+
- 类别偏好目前只支持项目名(project)。"计算机相关的概念默认简单解释"这类说法会被明确拒绝并说明原因,不会静默忽略。
|
|
98
|
+
|
|
99
|
+
**开关语义:** 关闭时三件事都不做——不注入任何段落、不记录观察、不改长期设置;本轮的一次性解释请求也不保存。你仍然可以显式调用工具加词或改设置,因为那是你亲口下的指令。
|
|
100
|
+
|
|
101
|
+
维护入口:工具 `plain_talk_vocab`(`list` / `status` / `add` / `explain` / `remove` / `classify` / `preference` / `context`),或命令行 `node dsh/vocab-cli.js status|list|set|remove|which|render`。
|
|
102
|
+
|
|
103
|
+
**写入安全:** 每次写入加锁(`plain-talk-vocab.json.lock`)、重读文件后只改自己动过的词、原子替换、写完释放;进程崩溃留下的陈旧锁超过 15 秒会被回收。文件损坏或版本高于当前支持的版本时拒绝覆盖,只读展示降级为空词库。
|
|
104
|
+
|
|
105
|
+
**迁移:** 版本低于当前时先备份成 `plain-talk-vocab.json.bak-v1.json`(只备一次;备份路径被占用则拒绝写入),再迁移:
|
|
106
|
+
|
|
107
|
+
- v1 的 `terms`(旧自动学习记录)全部降级为观察记录,确认层从空开始。
|
|
108
|
+
- v2 已有的 `observations` / `decisions` / `preferences` 原样保留,不会因为迁移丢数据。
|
|
109
|
+
- `pending` 只在当轮有效,迁移时丢弃。
|
|
110
|
+
- 迁移幂等,可重复执行。旧版共享文件 `$DSH_HOME/plain-talk-vocab.json` 不再自动复制进 profile;需要时用 `node dsh/vocab-cli.js migrate` 在目标 profile 下显式迁移。
|
|
111
|
+
|
|
112
|
+
**尚未验证:** profile 数据隔离(重启 DSH 后是否严格按 profile 分开读写)和真实多进程 GUI 场景下的并发表现,目前只有文件级与模拟上下文验证。
|
|
113
|
+
|
|
96
114
|
## 自检工具
|
|
97
115
|
|
|
98
|
-
`plain_talk_check`
|
|
116
|
+
`plain_talk_check` 接收一条草稿,返回问题清单,全部是建议:
|
|
99
117
|
|
|
100
|
-
*
|
|
101
|
-
*
|
|
118
|
+
* 建议改:回指词、会话号 / 子代理 / 工具名、只给位置没给发现、未解释代号、开头寒暄、结尾征询、中文用户却整段英文。
|
|
119
|
+
* 不判断:回复长短、列表条数、有没有下一步、术语是否专业、某个"此前"是否真的越界。
|
|
102
120
|
|
|
103
|
-
|
|
121
|
+
它不判长度、不当裁判。规则只要求在交报告或改了代码/配置后自检一次,简单回答不用调。
|
|
104
122
|
|
|
105
123
|
## 工作原理
|
|
106
124
|
|