@ssamurias/dsh-fish 1.1.6 → 1.1.8

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 (107) hide show
  1. package/AGENTS.md +19 -4
  2. package/CHANGELOG.md +79 -4923
  3. package/README.md +42 -23
  4. package/docs/README.md +16 -0
  5. package/docs/releases/CHANGELOG.md +5055 -0
  6. package/docs/releases/README.md +54 -0
  7. package/docs/releases/RELEASE-NOTES-1.1.7.md +76 -0
  8. package/docs/releases/RELEASE-NOTES-1.1.8.md +94 -0
  9. package/lib/at.js +5 -3
  10. package/lib/backup.js +5 -3
  11. package/lib/capture.js +46 -0
  12. package/lib/client.js +100 -12
  13. package/lib/comment.js +18 -10
  14. package/lib/compact.js +122 -18
  15. package/lib/decisions.js +1 -0
  16. package/lib/derive.js +250 -45
  17. package/lib/desk.js +5 -2
  18. package/lib/didclaim.js +363 -0
  19. package/lib/events.js +4 -4
  20. package/lib/foreignline.js +96 -0
  21. package/lib/handoff.js +4 -2
  22. package/lib/health.js +4 -0
  23. package/lib/hear.js +11 -1
  24. package/lib/herpeople.js +3 -2
  25. package/lib/herperson.js +34 -18
  26. package/lib/inbox.js +23 -7
  27. package/lib/index.js +1 -1
  28. package/lib/loadgate.js +48 -0
  29. package/lib/mapserve.js +45 -6
  30. package/lib/markup.js +349 -6
  31. package/lib/memorymap-html.js +1 -1
  32. package/lib/memorymap.js +96 -17
  33. package/lib/observe-bili.js +89 -16
  34. package/lib/observe-config.js +67 -4
  35. package/lib/observe-home.js +4 -1
  36. package/lib/observe-http.js +4 -0
  37. package/lib/observe.js +3 -2
  38. package/lib/people.js +78 -2
  39. package/lib/peopledoc.js +2 -2
  40. package/lib/persona.js +27 -7
  41. package/lib/photoanchor.js +172 -0
  42. package/lib/proactive.js +7 -2
  43. package/lib/pronoun.js +62 -3
  44. package/lib/pronounask.js +8 -4
  45. package/lib/quality.js +5 -0
  46. package/lib/recall-query.js +282 -0
  47. package/lib/recall.js +125 -16
  48. package/lib/redact.js +27 -0
  49. package/lib/report.js +8 -1
  50. package/lib/restrict.js +40 -2
  51. package/lib/say.js +66 -15
  52. package/lib/scheduler.js +67 -17
  53. package/lib/schema.js +51 -2
  54. package/lib/scrub.js +146 -15
  55. package/lib/selfdoc.js +12 -4
  56. package/lib/settings.js +21 -1
  57. package/lib/turnexport.js +53 -3
  58. package/lib/turns.js +103 -29
  59. package/lib/types.d.ts +1 -1
  60. package/lib/wiki.js +34 -6
  61. package/lib/works.js +5 -0
  62. package/media/feedback-qr.jpg +0 -0
  63. package/package.json +1 -2
  64. package/tools/README.md +79 -11
  65. package/tools/claim-report.mjs +97 -0
  66. package/tools/recall-bench.mjs +31 -3
  67. package/tools/recall-cases-100.freeze.json +15 -0
  68. package/tools/recall-cases-100.json +196 -0
  69. package/tools/recall-cases-user.json +313 -0
  70. package/tools/recall-cases.json +1 -1
  71. package/tools/recall-compare.mjs +169 -0
  72. package/tools/recall-eval.mjs +142 -0
  73. /package/{RELEASE-NOTES-0.8.0.md → docs/releases/RELEASE-NOTES-0.8.0.md} +0 -0
  74. /package/{RELEASE-NOTES-0.8.1.md → docs/releases/RELEASE-NOTES-0.8.1.md} +0 -0
  75. /package/{RELEASE-NOTES-0.8.2.md → docs/releases/RELEASE-NOTES-0.8.2.md} +0 -0
  76. /package/{RELEASE-NOTES-0.8.3.md → docs/releases/RELEASE-NOTES-0.8.3.md} +0 -0
  77. /package/{RELEASE-NOTES-0.8.4.md → docs/releases/RELEASE-NOTES-0.8.4.md} +0 -0
  78. /package/{RELEASE-NOTES-0.8.5.md → docs/releases/RELEASE-NOTES-0.8.5.md} +0 -0
  79. /package/{RELEASE-NOTES-0.8.6.md → docs/releases/RELEASE-NOTES-0.8.6.md} +0 -0
  80. /package/{RELEASE-NOTES-0.8.7.md → docs/releases/RELEASE-NOTES-0.8.7.md} +0 -0
  81. /package/{RELEASE-NOTES-0.8.8.md → docs/releases/RELEASE-NOTES-0.8.8.md} +0 -0
  82. /package/{RELEASE-NOTES-0.9.0.md → docs/releases/RELEASE-NOTES-0.9.0.md} +0 -0
  83. /package/{RELEASE-NOTES-0.9.1.md → docs/releases/RELEASE-NOTES-0.9.1.md} +0 -0
  84. /package/{RELEASE-NOTES-0.9.2.md → docs/releases/RELEASE-NOTES-0.9.2.md} +0 -0
  85. /package/{RELEASE-NOTES-0.9.3.md → docs/releases/RELEASE-NOTES-0.9.3.md} +0 -0
  86. /package/{RELEASE-NOTES-0.9.5.md → docs/releases/RELEASE-NOTES-0.9.5.md} +0 -0
  87. /package/{RELEASE-NOTES-0.9.6.md → docs/releases/RELEASE-NOTES-0.9.6.md} +0 -0
  88. /package/{RELEASE-NOTES-0.9.7.md → docs/releases/RELEASE-NOTES-0.9.7.md} +0 -0
  89. /package/{RELEASE-NOTES-0.9.8.md → docs/releases/RELEASE-NOTES-0.9.8.md} +0 -0
  90. /package/{RELEASE-NOTES-0.9.9.md → docs/releases/RELEASE-NOTES-0.9.9.md} +0 -0
  91. /package/{RELEASE-NOTES-1.0.0.md → docs/releases/RELEASE-NOTES-1.0.0.md} +0 -0
  92. /package/{RELEASE-NOTES-1.0.1.md → docs/releases/RELEASE-NOTES-1.0.1.md} +0 -0
  93. /package/{RELEASE-NOTES-1.0.2.md → docs/releases/RELEASE-NOTES-1.0.2.md} +0 -0
  94. /package/{RELEASE-NOTES-1.0.3.md → docs/releases/RELEASE-NOTES-1.0.3.md} +0 -0
  95. /package/{RELEASE-NOTES-1.0.4.md → docs/releases/RELEASE-NOTES-1.0.4.md} +0 -0
  96. /package/{RELEASE-NOTES-1.0.5.md → docs/releases/RELEASE-NOTES-1.0.5.md} +0 -0
  97. /package/{RELEASE-NOTES-1.0.6.md → docs/releases/RELEASE-NOTES-1.0.6.md} +0 -0
  98. /package/{RELEASE-NOTES-1.0.7.md → docs/releases/RELEASE-NOTES-1.0.7.md} +0 -0
  99. /package/{RELEASE-NOTES-1.0.8.md → docs/releases/RELEASE-NOTES-1.0.8.md} +0 -0
  100. /package/{RELEASE-NOTES-1.0.9.md → docs/releases/RELEASE-NOTES-1.0.9.md} +0 -0
  101. /package/{RELEASE-NOTES-1.1.0.md → docs/releases/RELEASE-NOTES-1.1.0.md} +0 -0
  102. /package/{RELEASE-NOTES-1.1.1.md → docs/releases/RELEASE-NOTES-1.1.1.md} +0 -0
  103. /package/{RELEASE-NOTES-1.1.2.md → docs/releases/RELEASE-NOTES-1.1.2.md} +0 -0
  104. /package/{RELEASE-NOTES-1.1.3.md → docs/releases/RELEASE-NOTES-1.1.3.md} +0 -0
  105. /package/{RELEASE-NOTES-1.1.4.md → docs/releases/RELEASE-NOTES-1.1.4.md} +0 -0
  106. /package/{RELEASE-NOTES-1.1.5.md → docs/releases/RELEASE-NOTES-1.1.5.md} +0 -0
  107. /package/{RELEASE-NOTES-1.1.6.md → docs/releases/RELEASE-NOTES-1.1.6.md} +0 -0
package/lib/memorymap.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * 叶子从中轴斜岔出去,四种扇区固定在四个 90° 象限里。
11
11
  * 位置是稳定的——同样的数据画两次长得一样,第二次打开还认得哪块是哪块。
12
12
  */
13
- import { deriveSelf } from './derive.js'
13
+ import { deriveSelf, similarity, nameForDisplay } from './derive.js'
14
14
  import { buildStances } from './stance.js'
15
15
 
16
16
  /**
@@ -80,10 +80,42 @@ export function buildViewData(events, model, stances, now = Date.now()) {
80
80
  // ── 收集节点
81
81
  const nodes = []
82
82
  const edgeMap = new Map()
83
+
84
+ // 2026-12-03(外部报告):同一件事说了两遍,图上会并排长出两个点。
85
+ // 真机 60 条判断里有 3 组 5 对相似度 ≥0.9(两句完全相同、一句是另一句的前缀变体)。
86
+ // 派生层不改她的判断(那会动她的记忆),只在**视图**上并片:最早那条当代表,
87
+ // mentions / verified 累加,其余 id 记在 mergedIds 里,所有边改指向代表。
88
+ const BELIEF_MERGE_SIM = 0.9
89
+ const beliefAlias = new Map()
90
+ const mergedBeliefs = new Map()
91
+ {
92
+ const rankedById = new Map((model.ranked || []).map((r) => [String(r.id), r]))
93
+ const reps = []
94
+ const history = [...(model.beliefsHistory || [])]
95
+ .sort((a, b) => (Date.parse(a.since) || 0) - (Date.parse(b.since) || 0))
96
+ for (const b of history) {
97
+ const text = String(b.text ?? '').trim()
98
+ if (!text) continue
99
+ const rep = reps.find((r) => similarity(text, r.text) >= BELIEF_MERGE_SIM)
100
+ if (!rep) { reps.push({ id: String(b.id), text }); continue }
101
+ beliefAlias.set(String(b.id), rep.id)
102
+ const ref = rankedById.get(String(b.id)) || b
103
+ const agg = mergedBeliefs.get(rep.id) || { count: 1, mentions: 0, verified: 0, ids: [rep.id] }
104
+ agg.count += 1
105
+ agg.mentions += Number(ref.mentions || 0)
106
+ agg.verified += Number(ref.verified || 0)
107
+ agg.ids.push(String(b.id))
108
+ mergedBeliefs.set(rep.id, agg)
109
+ }
110
+ }
111
+ const canonId = (id) => beliefAlias.get(String(id)) ?? String(id)
112
+
83
113
  const addEdge = (a, b, kind) => {
84
114
  if (!a || !b || a === b) return
85
- const k = a < b ? a + '|' + b + '|' + kind : b + '|' + a + '|' + kind
86
- if (!edgeMap.has(k)) edgeMap.set(k, { a: a < b ? a : b, b: a < b ? b : a, kind })
115
+ const ca = canonId(a), cb = canonId(b)
116
+ if (ca === cb) return
117
+ const k = ca < cb ? ca + '|' + cb + '|' + kind : cb + '|' + ca + '|' + kind
118
+ if (!edgeMap.has(k)) edgeMap.set(k, { a: ca < cb ? ca : cb, b: ca < cb ? cb : ca, kind })
87
119
  }
88
120
 
89
121
  const beliefIds = new Set((model.beliefs || []).map((b) => b.id))
@@ -92,8 +124,11 @@ export function buildViewData(events, model, stances, now = Date.now()) {
92
124
 
93
125
  // 1. 判断(含被推翻的旧句)
94
126
  for (const b of model.beliefsHistory || []) {
127
+ // 同一件事的重复句已经在上面并进了代表片,不再单独长点。
128
+ if (beliefAlias.has(String(b.id))) continue
95
129
  const t = Date.parse(b.since) || 0
96
130
  const ref = (model.ranked || []).find((r) => r.id === b.id) || b
131
+ const agg = mergedBeliefs.get(String(b.id))
97
132
  nodes.push({
98
133
  id: b.id, kind: 'belief',
99
134
  text: b.text, at: t,
@@ -104,13 +139,21 @@ export function buildViewData(events, model, stances, now = Date.now()) {
104
139
  // who 现在可能是 {id,name} 这样的对象(S1「谁说的」之后):面板直接印会出一个
105
140
  // [object Object]。这里就折成名字,别把这个坑留给渲染层。
106
141
  who: whoName(b.who),
107
- mentions: Number(ref.mentions || 0),
108
- verified: Number(ref.verified || 0),
109
- solid: solidIds.has(b.id),
142
+ mentions: Number(ref.mentions || 0) + Number(agg?.mentions || 0),
143
+ verified: Number(ref.verified || 0) + Number(agg?.verified || 0),
144
+ // 并片之后,牢度/在用/最后一次想起都按「这一片」里最亮的那个算:
145
+ // 只看代表 id 的话,别名是实心或还活着时,代表点会被画成空心/已归档。
146
+ solid: solidIds.has(b.id) || (agg?.ids || []).some((id) => solidIds.has(id)),
110
147
  stale: Boolean(ref.stale),
111
148
  // 最后一次被想起的时间——「快忘了」要按观察时刻现算,不能读死的 stale 布尔
112
- lastTouch: Number(ref.lastTouchedAt || 0),
113
- active: beliefIds.has(b.id),
149
+ lastTouch: Math.max(Number(ref.lastTouchedAt || 0), ...(agg?.ids || []).map((id) => {
150
+ const hit = (model.ranked || []).find((r) => r.id === id)
151
+ return Number(hit?.lastTouchedAt || 0)
152
+ })),
153
+ active: beliefIds.has(b.id) || (agg?.ids || []).some((id) => beliefIds.has(id)),
154
+ // 并了几片(>1 时图上可以标一个数,让人知道这里不是漏画)
155
+ merged: agg?.count || 1,
156
+ mergedIds: agg?.ids || [],
114
157
  })
115
158
  // 两条判断互相矛盾(derive 的 clash:同一周内、方向相反)——这是唯一一种
116
159
  // 「她自己跟自己过不去」的边,画面上要能一眼看见。
@@ -121,7 +164,9 @@ export function buildViewData(events, model, stances, now = Date.now()) {
121
164
  for (const v of model.voices || []) {
122
165
  nodes.push({
123
166
  id: v.id, kind: 'heard', text: v.text, at: Date.parse(v.at) || 0,
124
- from: v.bvid ? `BV ${v.bvid}` : '', echoed: Boolean(v.echoed),
167
+ // 先说这话的是谁,其次才是它在哪条视频下(bvid 只做兜底)。
168
+ // 2026-12-03:voice 事件带 who 之后,评论区的字也能连到那个人。
169
+ from: whoName(v.who) || (v.bvid ? `BV ${v.bvid}` : ''), echoed: Boolean(v.echoed),
125
170
  })
126
171
  }
127
172
  for (const e of events.filter((x) => x.type === 'heard')) {
@@ -129,12 +174,15 @@ export function buildViewData(events, model, stances, now = Date.now()) {
129
174
  nodes.push({ id: e.id, kind: 'heard', text: e.text, at: at(e), from: whoName(e.who) })
130
175
  }
131
176
 
132
- // 3. 人物(界面上不写主人的真名——公开版不该把用户的名字烙进图里)
177
+ // 3. 人物(2026-12-01 用户 m01252:不预设「主人」——她怎么叫{T},节点就写什么;
178
+ // 还没有称呼时写「你」。改名不回写旧名字:`model.people` 的 name 取最近一次生效的称呼)
133
179
  for (const p of model.people || []) {
134
180
  const pid = 'person:' + (p.id || p.name)
181
+ // 2026-12-03(外部报告):`model.name` 可能是低置信猜出来的残段(真机上是单字「用」),
182
+ // 直接印就等于把她对他的称呼写歪;拿不出手时退回「你」。
135
183
  nodes.push({
136
184
  id: pid, kind: 'person',
137
- text: p.id === 'owner' ? '主人' : (p.name || '一个人'),
185
+ text: p.id === 'owner' ? nameForDisplay(p.name, '你') : (p.name || '一个人'),
138
186
  at: p.firstAt || t0,
139
187
  judged: Number(p.judged || 0),
140
188
  judgmentIds: p.judgmentIds || [],
@@ -148,20 +196,25 @@ export function buildViewData(events, model, stances, now = Date.now()) {
148
196
  // since 可能是 ISO 字符串(buildStances 直接给的):不转成毫秒的话,
149
197
  // 后面按时间算半径会得到 NaN,节点就静默消失了——HUD 上数得到、图上没有。
150
198
  const since = typeof s.since === 'number' ? s.since : (Date.parse(s.since) || now)
199
+ // 2026-12-03(外部报告):buildStances 输出的是 `members`(判断 id 数组),
200
+ // 这里原来读 `s.group`,于是立场节点全是孤点、卫星边一条也没有。两个名字都认,
201
+ // 老数据(若有 group)不至于断掉。
202
+ const members = Array.isArray(s.members) ? s.members : (Array.isArray(s.group) ? s.group : [])
151
203
  nodes.push({
152
204
  id, kind: 'stance', text: s.text || s.title || '', at: since,
153
- kindOf: s.kind || '', group: s.group || [],
205
+ kindOf: s.kind || '', group: members,
154
206
  })
155
- for (const m of s.group || []) {
207
+ for (const m of members) {
156
208
  const mid = typeof m === 'string' ? m : m && m.id
157
209
  if (mid) addEdge(id, mid, 'stance')
158
210
  }
159
211
  }
160
212
 
161
213
  // 5. 原话:所有 utterance(其中已是判断的复用,其余标记为未认领)
162
- const beliefNodeIds = new Set(nodes.filter((n) => n.kind === 'belief').map((n) => n.id))
214
+ // 并片之后,被并掉的那几条也不再以「原话」身份单独长点——它们已经算进代表片。
215
+ const beliefNodeIds = new Set((model.beliefsHistory || []).map((b) => String(b.id)))
163
216
  for (const e of events.filter((x) => x.type === 'utterance')) {
164
- if (beliefNodeIds.has(e.id)) continue
217
+ if (beliefNodeIds.has(String(e.id))) continue
165
218
  nodes.push({
166
219
  id: e.id, kind: 'said', text: e.text, at: at(e),
167
220
  confidence: Number(e.confidence ?? 0.5),
@@ -187,6 +240,25 @@ export function buildViewData(events, model, stances, now = Date.now()) {
187
240
  const bid = matByBvid.get(v.bvid)
188
241
  if (bid) addEdge(v.id, bid, 'about')
189
242
  }
243
+ // 2026-12-01(用户 m01484,A+C 的 C):听来的话连到人。
244
+ // 以前人物节点只有「判断」这一种边,`voice` / `heard` 只是带一行 `from` 的孤立点——
245
+ // 她在群里听来的、在评论区读到的,明明记在某个人名下,星图上却看不出和谁有关。
246
+ // 只在名字能唯一对上时连(人物名来自 `model.people`,同名的那一行本来就不猜)。
247
+ {
248
+ const byPersonName = new Map()
249
+ for (const p of model.people || []) {
250
+ const name = String(p?.name ?? '').trim()
251
+ if (!name) continue
252
+ const pid = 'person:' + (p.id || p.name)
253
+ // 同名多个人时不猜(与 people.js 的「同名不猜」同一条取舍)。
254
+ byPersonName.set(name, byPersonName.has(name) ? '' : pid)
255
+ }
256
+ for (const n of nodes) {
257
+ if (n.kind !== 'heard' || !n.from) continue
258
+ const pid = byPersonName.get(String(n.from).trim())
259
+ if (pid) addEdge(n.id, pid, 'hearsay')
260
+ }
261
+ }
190
262
  // 同 topic / 同 who
191
263
  const byTopic = new Map(), byWho = new Map()
192
264
  for (const n of nodes.filter((x) => x.kind === 'belief')) {
@@ -338,6 +410,8 @@ export function buildViewData(events, model, stances, now = Date.now()) {
338
410
  // ── 统计
339
411
  const counts = {}
340
412
  for (const n of nodes) counts[n.kind] = (counts[n.kind] || 0) + 1
413
+ // 并掉的片数(视图层合并,不是删数据):图上判断点少了这么多,但一条都没丢。
414
+ counts.merged = [...mergedBeliefs.values()].reduce((n, g) => n + (g.count - 1), 0)
341
415
 
342
416
  // ── 横轴曲线:一条线 = 一条判断的命
343
417
  // 出生(第一次说出口)→ 被想起时的起伏 → 被改写/被推翻时的转折。
@@ -352,19 +426,24 @@ export function buildViewData(events, model, stances, now = Date.now()) {
352
426
 
353
427
  const tracks = []
354
428
  for (const b of model.beliefsHistory || []) {
429
+ // 并进代表片的那几条不再各画一条曲线:图上只有一个点,曲线也要只有一条。
430
+ if (beliefAlias.has(String(b.id))) continue
355
431
  const born = Date.parse(b.since)
356
432
  if (!Number.isFinite(born)) continue
433
+ const agg = mergedBeliefs.get(String(b.id))
434
+ const mentions = Number(b.mentions || 0) + Number(agg?.mentions || 0)
435
+ const isSolid = solidIds.has(b.id) || (agg?.ids || []).some((id) => solidIds.has(id))
357
436
  const pivots = (reviseAt.get(b.id) || []).filter(Number.isFinite).sort((a, c) => a - c)
358
437
  const base = typeof b.confidence === 'number' ? b.confidence : 0.6
359
438
  const pts = [[born, Math.max(0.06, base * 0.5)]]
360
- const recalls = Math.min(6, b.mentions || 0)
439
+ const recalls = Math.min(6, mentions)
361
440
  for (let i = 1; i <= recalls; i++) {
362
441
  pts.push([born + (now - born) * (i / (recalls + 1)), Math.min(0.92, base * 0.5 + 0.08 * i)])
363
442
  }
364
443
  for (const p of pivots) pts.push([p, Math.min(0.95, base + 0.15)])
365
444
  const tail = b.verdict === 'refuted' ? 0.04 : b.verdict === 'refined' ? base * 0.75 : Math.min(0.98, base + 0.2)
366
445
  pts.push([pivots.length ? Math.max(pivots[pivots.length - 1], now - 86400000) : now, tail])
367
- tracks.push({ id: b.id, text: String(b.text || ''), solid: solidIds.has(b.id), verdict: b.verdict || null, pts })
446
+ tracks.push({ id: b.id, text: String(b.text || ''), solid: isSolid, verdict: b.verdict || null, pts })
368
447
  }
369
448
 
370
449
  const view = {
@@ -33,6 +33,42 @@ import { send, sentTooLarge, readBody } from './observe-http.js'
33
33
  const BILI_STATE_TTL_MS = 60_000
34
34
  let biliStateCache = { key: '', at: 0, body: /** @type {any} */ (null) }
35
35
 
36
+ /**
37
+ * 2026-12-02(外部报告:1.1.6 观测台里 `/bili/state` 一次 4~8 秒、`/comment` 一次 8~15 秒,
38
+ * 越晚越慢,宿主单线程被占着、她的会话跟着发顿)。
39
+ *
40
+ * 这两个接口都是「打开页面顺手问一句」,答案晚一分钟也没关系。三件事把它们钉住:
41
+ * ① 失败的答案也缓存 30 秒——B 站连不上时不缓存,页面每刷新一次就再卡一次;
42
+ * ② 同一个键同时只打一趟 B 站(single-flight)——几处并行请求不再各打各的;
43
+ * ③ 评论扫描每轮最多 9 秒,超时就交上一份结果,不把这一轮挂死。
44
+ */
45
+ const BILI_STATE_FAIL_TTL_MS = 30_000
46
+ let biliStateFail = { key: '', at: 0, body: /** @type {any} */ (null) }
47
+ let biliStateInflight = { key: '', p: /** @type {Promise<any> | null} */ (null) }
48
+
49
+ const REPLIES_TTL_MS = 60_000
50
+ const REPLIES_BUDGET_MS = 9_000
51
+ let repliesCache = { key: '', at: 0, list: /** @type {any[]} */ ([]) }
52
+ let repliesInflight = { key: '', p: /** @type {Promise<any[] | null> | null} */ (null) }
53
+
54
+ /**
55
+ * 评论扫描的结果还够不够新。抽出来直接测,不用起 HTTP 服务。
56
+ */
57
+ export function repliesFresh(entry, key, now, ttl = REPLIES_TTL_MS) {
58
+ return Boolean(entry) && entry.key === key && Boolean(entry.list) && now - entry.at < ttl
59
+ }
60
+
61
+ function withBudget(p, ms) {
62
+ return Promise.race([
63
+ p,
64
+ new Promise((resolve) => {
65
+ // setTimeout 在浏览器 lib 里被标成 number,Node 里才是带 unref 的 Timeout
66
+ const timer = /** @type {any} */ (setTimeout(() => resolve(null), ms))
67
+ timer.unref?.()
68
+ }),
69
+ ])
70
+ }
71
+
36
72
  /** 缓存键:同一个家 + 同一份 cookie 才算同一条答案。 */
37
73
  function biliStateKey(root, cookie) {
38
74
  return `${root}|${String(cookie ?? '').slice(-16)}`
@@ -157,23 +193,43 @@ export function buildBiliRoutes(env) {
157
193
  if (!fresh && biliStateFresh(biliStateCache, key, Date.now())) {
158
194
  return send(res, 200, { ...biliStateCache.body, cached: true })
159
195
  }
160
- /** 只有「查到了」才记:没连上不缓存,下一次还能重试。 */
161
- const remember = (body) => {
162
- biliStateCache = { key, at: Date.now(), body }
163
- return send(res, 200, body)
196
+ if (!fresh && biliStateFail.key === key && Date.now() - biliStateFail.at < BILI_STATE_FAIL_TTL_MS) {
197
+ return send(res, 200, { ...biliStateFail.body, cached: true })
164
198
  }
165
- try {
166
- const c = createClient({ cookie: ow.cookie, log: () => {} })
167
- const me = /** @type {any} */ (await c.me())
168
- if (!me?.isLogin) {
169
- return remember({ ok: false, state: 'expired', note: 'B 站登录已过期,需要重新登录。', why: me?.why ?? '' })
199
+ // 同一个键已经有一趟在问,跟着等它,不再打第二趟(2026-12-02)
200
+ if (biliStateInflight.p && biliStateInflight.key === key) {
201
+ try {
202
+ return send(res, 200, await biliStateInflight.p)
203
+ } catch {
204
+ return send(res, 200, { ok: false, state: 'error', note: '没连上 B 站:还在查,先等这一趟。' })
170
205
  }
171
- return remember({ ok: true, state: 'ok', name: String(me.uname ?? ''), mid: String(me.mid ?? ''), canWrite: Boolean(me.canWrite) })
172
- } catch (err) {
173
- const msg = String(/** @type {any} */ (err)?.message ?? err)
174
- logLine('warn', ['登录态:查状态时没连上 B 站', msg.slice(0, 160)], root)
175
- return send(res, 200, { ok: false, state: 'error', note: `没连上 B 站:${msg.slice(0, 60)}` })
176
206
  }
207
+ /** 只有「查到了」才记好答案:登录过期是稳定状态,也记;连不上记短期,下次还能重试。 */
208
+ const ask = async () => {
209
+ try {
210
+ const c = createClient({ cookie: ow.cookie, log: () => {} })
211
+ const me = /** @type {any} */ (await c.me())
212
+ if (!me?.isLogin) {
213
+ const body = { ok: false, state: 'expired', note: 'B 站登录已过期,需要重新登录。', why: me?.why ?? '' }
214
+ biliStateCache = { key, at: Date.now(), body }
215
+ return body
216
+ }
217
+ const body = { ok: true, state: 'ok', name: String(me.uname ?? ''), mid: String(me.mid ?? ''), canWrite: Boolean(me.canWrite) }
218
+ biliStateCache = { key, at: Date.now(), body }
219
+ return body
220
+ } catch (err) {
221
+ const msg = String(/** @type {any} */ (err)?.message ?? err)
222
+ logLine('warn', ['登录态:查状态时没连上 B 站', msg.slice(0, 160)], root)
223
+ const body = { ok: false, state: 'error', note: `没连上 B 站:${msg.slice(0, 60)}` }
224
+ biliStateFail = { key, at: Date.now(), body }
225
+ return body
226
+ }
227
+ }
228
+ const p = ask()
229
+ biliStateInflight = { key, p }
230
+ const body = await p.catch((err) => ({ ok: false, state: 'error', note: `没连上 B 站:${String(err?.message ?? err).slice(0, 60)}` }))
231
+ biliStateInflight = { key: '', p: null }
232
+ return send(res, 200, body)
177
233
  }],
178
234
 
179
235
  ['/bili/qr', async (req, res) => {
@@ -328,7 +384,24 @@ export function buildBiliRoutes(env) {
328
384
  /** @type {any[]} */
329
385
  let replies = []
330
386
  if (c.enabled === true && online) {
331
- replies = await scanReplies({ root, events, dateKey: dk }).catch(() => [])
387
+ const key = `${root}|${dk}`
388
+ if (repliesFresh(repliesCache, key, Date.now())) {
389
+ replies = repliesCache.list
390
+ } else if (repliesInflight.p && repliesInflight.key === key) {
391
+ replies = (await repliesInflight.p) ?? repliesCache.list
392
+ } else {
393
+ const cookie = (await readOwner(root).catch(() => null))?.cookie ?? ''
394
+ const client = createClient({ cookie, timeoutMs: 6_000, log: () => {} })
395
+ const p = withBudget(scanReplies({ root, events, dateKey: dk, client }), REPLIES_BUDGET_MS)
396
+ .then((list) => {
397
+ if (Array.isArray(list)) repliesCache = { key, at: Date.now(), list }
398
+ return Array.isArray(list) ? list : repliesCache.list
399
+ })
400
+ .catch(() => repliesCache.list)
401
+ repliesInflight = { key, p }
402
+ replies = await p
403
+ repliesInflight = { key: '', p: null }
404
+ }
332
405
  }
333
406
  send(res, 200, {
334
407
  enabled: c.enabled === true,
@@ -355,7 +428,7 @@ export function buildBiliRoutes(env) {
355
428
  send(res, 200, {
356
429
  enabled: a.enabled === true,
357
430
  online: biliOn(config),
358
- repliedToOthers: repliedToOthers(events),
431
+ repliedToOthers: repliedToOthers(events, dateKey()),
359
432
  usedToday: mentionsToday(events, dateKey()),
360
433
  perDayMax: Number(a.perDayMax ?? 20),
361
434
  })
@@ -57,6 +57,15 @@ export function buildConfigRoutes(env) {
57
57
  try { patch = JSON.parse(body || '{}') } catch { return send(res, 400, { error: 'body 不是合法 JSON' }) }
58
58
  const strictTools = patch.strictTools === true
59
59
  delete patch.strictTools
60
+ // 收缩确认(issue #191 第九节,2026-12-02)。白名单是**整份替换**的放行名单,
61
+ // 少写一个名字就等于少放行一件工具。报告人那台机器一天里两次把 48 项提交成
62
+ // 玩具列表(想试某个名字认不认),两条会话当场失语、连 bash 都调不动,而它们
63
+ // 自己查不出原因——所以「真子集」这一种提交必须由调用方显式认一次。
64
+ //
65
+ // 认的方式是加 `allowShrink: 'confirm'`:设置页在用户**亲手删掉**某几个名字时带上它,
66
+ // 外部脚本拿一份小列表试形状不会带——那正是要挡住的那一下。
67
+ const allowShrink = patch.allowShrink === 'confirm'
68
+ delete patch.allowShrink
60
69
  // 白名单:只允许改"环境",不允许任何指向她本人的键(test/p5.test.mjs 反查这张表)
61
70
  const allowed = ['growthDays', 'wakesPerDay', 'window', 'windows', 'daily', 'diary', 'absenceAfterDays', 'avoid', 'browse', 'bili', 'video', 'comment', 'at', 'people', 'notify', 'chat', 'rooms', 'memory', 'tools', 'observe', 'ui', 'proactive', 'drive', 'interest', 'dream', 'works', 'owner', 'self', 'backup', 'cloud', 'bridge']
62
71
  const bad = Object.keys(patch).filter((k) => !allowed.includes(k))
@@ -118,20 +127,74 @@ export function buildConfigRoutes(env) {
118
127
  }
119
128
  }
120
129
  const before = await loadConfig(root).catch(() => null)
130
+ // 「少了的那几个里,哪些是这台机器上真有的工具」。两处都要用(挡回判据、留账判据),
131
+ // 所以先算一次:盘上留着的旧名字不算她的手,丢了不算收缩,也不该在日志里喊「少了」。
132
+ const knownNow = knownToolNames(ctx)
133
+ const knownNowSet = Array.isArray(knownNow) && knownNow.length ? new Set(knownNow.map(String)) : null
134
+ // ---- 收缩保护(issue #191 第九节,2026-12-02)----
135
+ // 判据只看**集合**,不看顺序、不看条数:提交的名单里少了盘上原有的任何一个名字,
136
+ // 就算一次收缩。真子集(少了东西又没多出来)最典型——报告人两次事故都是这种形状。
137
+ //
138
+ // 两种情况不算收缩:
139
+ // · 少了的那几个**本来就不是这台机器上的工具**(盘上留着的旧名字、或是这次被
140
+ // sanitize 丢掉的坏名字)——丢的是一行废字,不是一只手。2026-10-31 的 issue #14
141
+ // 那条用例要求这种提交必须能存进去,不能因此 409;
142
+ // · 提交的就是盘上那份(设置页自动保存每次整表回传,不能天天 409)。
143
+ if (patch.tools && patch.tools.allow !== undefined && !allowShrink) {
144
+ const prevAllow = (Array.isArray(before?.config?.tools?.allow) ? before.config.tools.allow : []).map(String)
145
+ const nextList = patch.tools.allow.map(String)
146
+ const nextSet = new Set(nextList)
147
+ const droppedSet = new Set(droppedTools.map(String))
148
+ const knownSet = knownNowSet
149
+ const gone = prevAllow.filter((n) => !nextSet.has(n) && !droppedSet.has(n) && (!knownSet || knownSet.has(n)))
150
+ if (gone.length) {
151
+ logLine('error', [
152
+ '白名单要收缩,已挡回(没有写盘、也没有换刀):',
153
+ `少了 ${gone.length} 项:${gone.join('、')}`,
154
+ `${prevAllow.length} → ${nextList.length}`,
155
+ '要真删,请带 allowShrink:"confirm" 再提交一次;设置页里亲手删名字会自动带上。',
156
+ ], root)
157
+ return send(res, 409, {
158
+ error: `这次提交会把白名单从 ${prevAllow.length} 项缩到 ${nextList.length} 项(少了:${gone.join('、')})。没有保存。确实要删,请带 allowShrink:"confirm" 再提交一次。`,
159
+ shrinking: true,
160
+ removed: gone,
161
+ before: prevAllow.length,
162
+ after: nextList.length,
163
+ })
164
+ }
165
+ }
121
166
  const next = await updateConfig(patch, root)
122
167
  const beforeAllow = JSON.stringify(before?.config?.tools?.allow ?? [])
123
168
  const nextAllow = JSON.stringify(next?.tools?.allow ?? [])
169
+ // 真的删掉了哪些(D3,issue #191 第九节):带 confirm 放行的那一次也要留下
170
+ // 一条**能事后查的**账。白名单缩水是「她突然少了半只手」这类事故的唯一线索,
171
+ // 过去只记一条 info、而且只有总数——两天后翻日志看不出少了什么。
172
+ let shrankFrom = 0
173
+ let shrankGone = []
174
+ {
175
+ const prev = (Array.isArray(before?.config?.tools?.allow) ? before.config.tools.allow : []).map(String)
176
+ const now = new Set((Array.isArray(next?.tools?.allow) ? next.tools.allow : []).map(String))
177
+ shrankGone = prev.filter((n) => !now.has(n) && (!knownNowSet || knownNowSet.has(n)))
178
+ if (shrankGone.length) shrankFrom = prev.length
179
+ }
124
180
  let toolsLive = null
125
181
  if (beforeAllow !== nextAllow) {
126
182
  try {
127
183
  const r = /** @type {any} */ (refreshToolRestrict({ extra: next?.tools?.allow ?? [] }))
128
184
  toolsLive = { ok: r?.ok === true, deferred: r?.deferred?.length ?? 0 }
129
- logLine('info', [
130
- 'tools.allow 已当场生效',
131
- `allow=${(next?.tools?.allow ?? []).join(',') || '(空)'}`,
185
+ const shrunk = shrankGone.length > 0
186
+ const parts = shrunk
187
+ ? [
188
+ '白名单被收缩(已按 confirm 放行):',
189
+ `${shrankFrom} → ${(next?.tools?.allow ?? []).length}`,
190
+ `少了 ${shrankGone.join('、')}`,
191
+ ]
192
+ : ['tools.allow 已当场生效', `allow=${(next?.tools?.allow ?? []).join(',') || '(空)'}`]
193
+ logLine(shrunk ? 'error' : 'info', [
194
+ ...parts,
132
195
  `换刀=${r?.applied?.length ?? 0}`,
133
196
  r?.deferred?.length ? `延后=${r.deferred.length}` : '',
134
- ], root)
197
+ ].filter(Boolean), root)
135
198
  } catch (err) {
136
199
  logLine('warn', ['白名单热更新没成(下次新建会话照样生效):', String(/** @type {any} */ (err)?.message ?? err).slice(0, 200)], root)
137
200
  }
@@ -74,6 +74,8 @@ export function createBridgeHandlers(env) {
74
74
  title: body.title,
75
75
  guest: body.guest,
76
76
  owner: body.owner,
77
+ // 2026-12-03(用户 m04727):桥标明「这条是他转来的」,只影响标记与渲染。
78
+ relay: body.relay,
77
79
  log: flog('info'),
78
80
  })
79
81
  send(res, 200, r)
@@ -183,7 +185,8 @@ export function buildHomeRoutes(env, bridgeHandlers) {
183
185
  const url = new URL(req.url ?? '/', 'http://x')
184
186
  const limit = Math.min(500, Number(url.searchParams.get('limit') ?? 200) || 200)
185
187
  const box = await readInbox(root, { limit })
186
- await writeInboxFile(root, { limit: 60 }).catch(() => null)
188
+ // 2026-12-02(issue #184 第四条):把刚读到的这份传进去,别再读一遍事件流。
189
+ await writeInboxFile(root, { limit: 60, box }).catch(() => null)
187
190
  send(res, 200, box)
188
191
  }],
189
192
 
@@ -9,6 +9,7 @@
9
9
  import { spawn } from 'node:child_process'
10
10
  import { looksMojibake } from './guard.js'
11
11
  import { logLine } from './log.js'
12
+ import { enterLoad, leaveLoad } from './loadgate.js'
12
13
 
13
14
  export const PREFIX = '/dsh-fish'
14
15
 
@@ -223,6 +224,8 @@ export function makeGuarded(ctx, root, opts = {}) {
223
224
  }
224
225
  // 只量 handler 自己:信任校验是被挡掉的请求,和「这一页慢」是两件事。
225
226
  const t0 = Date.now()
227
+ // 有人在等的时候,后台的重活(稳定指标)让路——见 lib/loadgate.js。
228
+ enterLoad()
226
229
  try {
227
230
  await handler(req, res)
228
231
  } catch (err) {
@@ -235,6 +238,7 @@ export function makeGuarded(ctx, root, opts = {}) {
235
238
  ], root)
236
239
  send(res, code, { error: String(/** @type {any} */ (err)?.message ?? err) })
237
240
  } finally {
241
+ leaveLoad()
238
242
  const ms = Date.now() - t0
239
243
  if (ms >= slowMs) {
240
244
  logLine('warn', ['route slow', `${req?.method ?? ''} ${req?.url ?? ''}`.trim(), { ms }], root)
package/lib/observe.js CHANGED
@@ -179,10 +179,11 @@ export function registerObserve(ctx, deps = {}) {
179
179
  ...buildDataRoutes(env),
180
180
  ...buildOutingRoutes(env),
181
181
  ['/memory-map', async (_req, res) => {
182
- // 页面本身在独立端口上,这里只把地址告诉前端
182
+ // 页面本身在独立端口上,这里只把地址告诉前端。地址里带着这次启动的口令
183
+ // (lib/mapserve.js),只从这条栅栏后面的路由交出去,也不许被缓存。
183
184
  const url = mapUrl()
184
185
  try {
185
- res.writeHead(url ? 200 : 503, { 'content-type': 'application/json; charset=utf-8' })
186
+ res.writeHead(url ? 200 : 503, { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store' })
186
187
  res.end(JSON.stringify(url ? { url } : { error: '记忆图没起来' }))
187
188
  } catch { /* ignore */ }
188
189
  }],
package/lib/people.js CHANGED
@@ -132,7 +132,9 @@ function atMs(v) {
132
132
  * 从事件流算出「她认识哪些人」。
133
133
  *
134
134
  * @param {object[]} events 事件流(`readEvents(root).events`)
135
- * @param {{ now?: number, max?: number, ownerNames?: string[] }} [opts]
135
+ * @param {{ now?: number, max?: number, ownerNames?: string[], audit?: Array }} [opts]
136
+ * `audit` 是可选的收集器:传一个数组进来,归属上「看着别扭」的条会 push 进去
137
+ * (记忆体检只读展示用,不改变任何挂法)。
136
138
  * @returns {Array<{id:string,name:string,nameOnly:boolean,firstAt:number,lastAt:number,
137
139
  * times:number,nightTimes:number,spanDays:number,judgmentIds:string[],judged:number,
138
140
  * judgments:Array<{id:string,at:number,text:string,guess:boolean,verdict:string|null}>,
@@ -140,7 +142,7 @@ function atMs(v) {
140
142
  * said:Array<{at:number,text:string}>,
141
143
  * didTo:Array<{at:number,text:string}>}>}
142
144
  */
143
- export function peopleOf(events = [], { max = PEOPLE_MAX, ownerNames = [] } = {}) {
145
+ export function peopleOf(events = [], { max = PEOPLE_MAX, ownerNames = [], audit = null } = {}) {
144
146
  const list = Array.isArray(events) ? events : []
145
147
  const byId = new Map()
146
148
  for (const e of list) {
@@ -290,6 +292,25 @@ export function peopleOf(events = [], { max = PEOPLE_MAX, ownerNames = [] } = {}
290
292
  const set = byName.get(String(name ?? '').trim())
291
293
  return set && set.size === 1 ? [...set][0] : ''
292
294
  }
295
+ /**
296
+ * 一段话里点名了哪些人,**连同命中的那个叫法**(取最长的那个)。
297
+ *
298
+ * 2026-12-01(用户 m01484):单字名(「猫」「鱼」)和普通词天然分不开——「猫粮」「鱼丸」
299
+ * 都会命中。下面的两处判断按叫法长度分档:两个字以上才算「点名」,单字只当弱线索。
300
+ *
301
+ * @returns {Map<string, string>} id → 命中的叫法
302
+ */
303
+ const namedHits = (s) => {
304
+ const out = new Map()
305
+ for (const [name, set] of byName) {
306
+ if (!name || !s.includes(name)) continue
307
+ for (const id of set) {
308
+ const prev = out.get(id) || ''
309
+ if (name.length > prev.length) out.set(id, name)
310
+ }
311
+ }
312
+ return out
313
+ }
293
314
  for (const p of people.values()) if (p.name) addName(p.name, p.id)
294
315
  // 登记时添的小名也走同一张表:`person_alias` 的别名绑在具体 id 上,不设全局别名表。
295
316
  for (const { pid, alias } of aliasPairs) {
@@ -341,6 +362,33 @@ export function peopleOf(events = [], { max = PEOPLE_MAX, ownerNames = [] } = {}
341
362
  let id = ''
342
363
  const about = fold(normalizePid(e?.about))
343
364
  if (about && people.has(about)) id = about
365
+ // 2026-12-01(用户转来真机截图):`about` 排第一、又不看正文,填错一次就静默挂错人。
366
+ // 起因是 `her_person` 记下人之后的回执写着「以后写判断时 about 填 p_…」,她当成通用要求,
367
+ // 于是讲主人的判断也填了那位朋友的编号——星图上就长出七根连错的线。
368
+ //
369
+ // 窄闸:正文里**点名了另一个**认识的人、而**没点 `about` 这个人**时,不信 `about`,
370
+ // 清空后照下面的 `who` / `topic` / `refs` 重算。撑不住的时候宁可不挂(漏挂看得见,
371
+ // 挂错看不见)。正文一个名字都没提、或同时提了两个人时不拦——那种时候 `about`
372
+ // 仍是唯一能说清是哪一个的信息。
373
+ //
374
+ // 2026-12-01(用户 m01484):单字名不参与这道闸。「猫粮」「鱼丸」这种词天天都有,
375
+ // 拿单字名当「点名」只会把正确的 `about` 误清掉——那次「猫今天很黏人」就因为
376
+ // 这个整条判断脱了钩。两个字以上的名字才算点名。
377
+ if (id) {
378
+ const named = [...namedHits(text)].filter(([, n]) => n.length >= 2).map(([pid]) => pid)
379
+ if (named.length === 1 && named[0] !== id) id = ''
380
+ }
381
+ // 2026-12-01(用户 m01484):单字名和普通词分不开,`about` 在它附近最不可靠。
382
+ // 正文点到单字名、而 `who` / `topic` 明确指向另一个人时,让那两样压过 `about`——
383
+ // 「我给猫倒猫粮」至少还能靠 topic 挂到猫身上,而不是挂到 `about` 里那位。
384
+ // 只在 `about` 指向的不是这个单字名的人时生效(他就是猫的时候没有歧义)。
385
+ if (id) {
386
+ const single = [...namedHits(text)].some(([, n]) => n.length === 1)
387
+ if (single && String(people.get(id)?.name ?? '').length >= 2) {
388
+ const alt = fold(personKeyOf(e?.who)) || nameId(String(e?.topic ?? '').trim())
389
+ if (alt && alt !== id && people.has(alt)) id = alt
390
+ }
391
+ }
344
392
  if (!id) {
345
393
  const whoKey = personKeyOf(e?.who)
346
394
  if (whoKey) id = fold(whoKey)
@@ -377,6 +425,34 @@ export function peopleOf(events = [], { max = PEOPLE_MAX, ownerNames = [] } = {}
377
425
  }
378
426
  if (id === OWNER && !people.has(id)) person(OWNER)
379
427
  if (!id || !people.has(id)) continue
428
+ // 2026-12-01(用户 m01484):记忆体检要一份「归属看着别扭」的只读清单。
429
+ // 只收**已经挂在这个人身上**的——被窄闸改挂过的那些,图上已经不在原处,不用再报。
430
+ // 不判断对错、不改任何挂法,`audit` 是调用方传进来的收集器。
431
+ if (Array.isArray(audit) && about && people.has(about) && id === about) {
432
+ const aboutName = String(people.get(about)?.name ?? '')
433
+ const otherName = (pid) => String(people.get(pid)?.name ?? pid)
434
+ const whoKey = fold(personKeyOf(e?.who))
435
+ if (whoKey && whoKey !== about && people.has(whoKey)) {
436
+ audit.push({
437
+ id: String(e.id ?? ''), text: text.slice(0, 80), person: aboutName || otherName(about),
438
+ other: otherName(whoKey), why: 'about 指的是这个人,但这句话的 who 是另一个人',
439
+ })
440
+ }
441
+ const topicId = nameId(String(e?.topic ?? '').trim())
442
+ if (topicId && topicId !== about) {
443
+ audit.push({
444
+ id: String(e.id ?? ''), text: text.slice(0, 80), person: aboutName || otherName(about),
445
+ other: otherName(topicId), why: 'about 指的是这个人,topic 写的却是另一个人',
446
+ })
447
+ }
448
+ const hits = [...namedHits(text)].filter(([, n]) => n.length >= 2).map(([pid]) => pid)
449
+ if (hits.length && !hits.includes(about) && aboutName && !text.includes(aboutName)) {
450
+ audit.push({
451
+ id: String(e.id ?? ''), text: text.slice(0, 80), person: aboutName,
452
+ other: otherName(hits[0]), why: '正文点名了另一个人,没点 about 指的这个人',
453
+ })
454
+ }
455
+ }
380
456
  ownerOf.set(String(e.id ?? ''), id)
381
457
  people.get(id).judgments.push({
382
458
  id: String(e.id ?? ''),
package/lib/peopledoc.js CHANGED
@@ -21,7 +21,7 @@ import { paths, readEvents, rootDir, writeAtomic } from './store.js'
21
21
  import { loadConfig } from './settings.js'
22
22
  import { deriveSelf } from './derive.js'
23
23
  import { renderPerson } from './people.js'
24
- import { pronounOf } from './pronoun.js'
24
+ import { ownerWordOf } from './pronoun.js'
25
25
 
26
26
  /** 这份抄本的落盘位置。名字刻意不叫 `AGENTS.md`——宿主会读那个名字并注入对话。 */
27
27
  export function peopleDocPath(root = rootDir()) {
@@ -71,7 +71,7 @@ export async function writePeopleDocFrom(root, model, config, { log } = {}) {
71
71
  try {
72
72
  const others = config?.people?.others?.enabled === true
73
73
  // 抄本里的称呼用设置里的那一个(他 / 她 / TA),与身份文档同源。
74
- const text = renderPeopleDoc(model, { pronoun: pronounOf(config), others })
74
+ const text = renderPeopleDoc(model, { pronoun: ownerWordOf(config), others }) // 明写了 owner.slotName 就填它
75
75
  let prev = null
76
76
  try {
77
77
  prev = await fs.readFile(file, 'utf8')