dsh-bagu 0.12.1 → 0.13.1

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.
@@ -0,0 +1,42 @@
1
+ # Contributors
2
+
3
+ 按代码、测试、报告、词库任一贡献列。排名不分先后。
4
+
5
+ ## 代码与缺陷
6
+
7
+ - **[@AlaIchhe](https://github.com/AlaIchhe)**
8
+ PR [#2](https://github.com/hongdougao111/dsh-bagu/pull/2) —— 修 AI 接梗一开就崩。
9
+ `bridge()` 从 `memes.js` 换成新实现后返回 `{hits, usage, tags}`,
10
+ 但 AI 分支还按旧版读 `r.same.length`,AI 接梗开着又命中梗时必炸 `TypeError`。
11
+ 真机上一天炸了 15 次,因为 `aiBridge` 默认关、条件短路,130 个测试全绿也没暴露。
12
+ 他复现、定位到行、给了 `aiHintOf()` 的修法,还顺手发现 `bagu_meme` 那条
13
+ `ReferenceError: list is not defined`。
14
+
15
+ ## 词库
16
+
17
+ - **[梗Wiki](https://cnmeme.wiki)** —— 词库全部来自这里。
18
+ 6800 多条词条的来源、用法、标签、别名、摘要,是那个站点一条一条攒出来的。
19
+ 最值钱的 `usage` 字段(这个梗怎么接)也是它整理的。
20
+
21
+ ## 做法与判据
22
+
23
+ - **[thawline/dsh-memewiki](https://github.com/thawline/dsh-memewiki)** ——
24
+ 「不等模型来查,先把答案摆在它面前」这个做法是它先做的,词库内联分发也是跟它学的。
25
+ - **[beagle style-criteria](https://github.com/existential-birds/beagle)** ——
26
+ 代码注释判据(把代码念一遍的那类)。
27
+ - **[voku/code-slop](https://github.com/voku/agent-skills)** ——
28
+ comments must explain why, never what the code already expresses.
29
+ - **[sloplint](https://github.com/DW-Studio/sloplint)** —— 评分公式。
30
+ - **[lieflat-less-ai-tone](https://github.com/larashero3-dotcom/lieflat-less-ai-tone)** ——
31
+ 两轮对照实验语料,1169 篇 / 520 万字。
32
+
33
+ ## 语料
34
+
35
+ 回归测试里的真人语料,都是从公开页面摘的:孙笑川吧、v吧、B 站评论区、
36
+ git 仓库的 commit message。这些说话的人不知道自己在帮一个插件做校准,
37
+ 但没有他们那 200 多条原话,误拦率是量不出来的。
38
+
39
+ ---
40
+
41
+ 想加名字就提 PR。改了代码、补了测试、报了能复现的 bug、或者指出一条误拦,
42
+ 都算。写清楚做了什么就行,不用客气。
package/README.md CHANGED
@@ -226,6 +226,15 @@ npm test # 110 个单元测试
226
226
  [sloplint](https://github.com/DW-Studio/sloplint)、
227
227
  [lieflat-less-ai-tone](https://github.com/larashero3-dotcom/lieflat-less-ai-tone)。
228
228
 
229
+ ## 一起修过的人
230
+
231
+ - [@AlaIchhe](https://github.com/AlaIchhe) —— PR #2。
232
+ AI 接梗一开就崩的那个 `TypeError`,是他先报的、先定位的、先修好的。
233
+ `bridge()` 换了来源但字段名没跟着换,这种半截重构我漏了一整轮。
234
+ 他还顺手发现 `bagu_meme` 那条 `ReferenceError: list is not defined`。
235
+
236
+ 完整名单见 [CONTRIBUTORS.md](CONTRIBUTORS.md)。
237
+
229
238
  ## 许可
230
239
 
231
240
  MIT。词库数据来自梗Wiki,使用时请一并保留对其的署名。
package/dsh-plugin.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "manifestVersion": "0.15",
4
4
  "id": "dsh-bagu",
5
5
  "name": "dsh-bagu",
6
- "version": "0.12.1",
6
+ "version": "0.13.1",
7
7
  "license": "MIT",
8
8
  "description": "AI 对外说话两道门:八股打回,梗接住。",
9
9
  "facets": {
package/lib/guard.js CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  import { analyze } from './analyze.js';
16
16
  import { STOCK_PHRASES, GIT_STOCK, GIT_TEMPLATE_ROWS, countTemplateRows, REVIEW_STOCK, VIDEO_STOCK } from './lexicon.js';
17
- import { HOLLOW_ACTIONS, HOLLOW_ADJECTIVES, LEARNED_TONE, CODE_COMMENT_NARRATION, MOTIVATIONAL_SLOP, UNIVERSAL_FILLER } from './layers.js';
17
+ import { HOLLOW_ACTIONS, HOLLOW_ADJECTIVES, LEARNED_TONE, CODE_COMMENT_NARRATION, MOTIVATIONAL_SLOP, UNIVERSAL_FILLER, EMPTY_REFERENCE, CONCRETE_HINT, ECHO_COMMAND, PROMISE_TAIL } from './layers.js';
18
18
 
19
19
  /**
20
20
  * 打回原因按严重度排。谁先命中谁负责,只报一条 —— 报三条 agent 会挑最轻的改。
@@ -51,6 +51,51 @@ const REASONS = [
51
51
  },
52
52
  hint: '删掉这句,直接说事',
53
53
  },
54
+ {
55
+ id: 'echo-command',
56
+ // 把一句话拆两截,再把球弹回去或者下个令。
57
+ // 「你想说啥」→「你这话是在问别人,还是问自己?」
58
+ test: (r, text) => {
59
+ const t = String(text ?? '').trim();
60
+ if (!t || t.length > 60) return false;
61
+ if (!ECHO_COMMAND.some((re) => re.test(t))) return false;
62
+ return !CONCRETE_HINT.test(t);
63
+ },
64
+ why: '拆句弹回',
65
+ hint: '一句能说完就说完,别把球弹回去',
66
+ },
67
+ {
68
+ id: 'promise-tail',
69
+ // 把道别升格成守护。「晚安」→「睡吧,我守着。」
70
+ test: (r, text) => {
71
+ const t = String(text ?? '').trim();
72
+ if (!t || t.length > 40) return false;
73
+ if (!PROMISE_TAIL.some((re) => re.test(t))) return false;
74
+ return !CONCRETE_HINT.test(t);
75
+ },
76
+ why: '承诺式收尾',
77
+ hint: '该道晚安就道晚安,不用加重',
78
+ },
79
+ {
80
+ id: 'empty-reference',
81
+ // 空指代撑分量:「好的」写成「这话我记下了」。
82
+ // 两个条件同时成立才算:开头是空指代,且整句没给任何具体东西。
83
+ test: (r, text) => {
84
+ const t = String(text ?? '').trim();
85
+ if (!t) return false;
86
+ const hit = EMPTY_REFERENCE.find((re) => re.test(t));
87
+ if (!hit) return false;
88
+ // 后面给了数字、专名、时间点就不算空
89
+ return !CONCRETE_HINT.test(t);
90
+ },
91
+ why: (r, text) => {
92
+ const t = String(text ?? '').trim();
93
+ const hit = EMPTY_REFERENCE.find((re) => re.test(t));
94
+ const m = hit ? t.match(hit) : null;
95
+ return m ? `空指代「${m[0].slice(0, 12)}」` : '空指代';
96
+ },
97
+ hint: '把该说的那件事直接说出来',
98
+ },
54
99
  {
55
100
  id: 'hollow-action',
56
101
  // 动词 + 宏观名词:说了动作,没说改哪一行。不分场景。