@ssamurias/dsh-fish 1.1.6 → 1.1.7
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/AGENTS.md +16 -2
- package/CHANGELOG.md +80 -0
- package/README.md +23 -5
- package/RELEASE-NOTES-1.1.7.md +76 -0
- package/lib/capture.js +1 -0
- package/lib/client.js +86 -8
- package/lib/comment.js +18 -10
- package/lib/derive.js +166 -44
- package/lib/desk.js +5 -2
- package/lib/didclaim.js +307 -0
- package/lib/events.js +4 -4
- package/lib/handoff.js +4 -2
- package/lib/health.js +4 -0
- package/lib/hear.js +8 -1
- package/lib/herperson.js +33 -18
- package/lib/inbox.js +23 -7
- package/lib/index.js +1 -1
- package/lib/loadgate.js +48 -0
- package/lib/memorymap-html.js +1 -1
- package/lib/memorymap.js +22 -2
- package/lib/observe-config.js +67 -4
- package/lib/observe-home.js +2 -1
- package/lib/observe-http.js +4 -0
- package/lib/people.js +78 -2
- package/lib/persona.js +8 -3
- package/lib/proactive.js +7 -2
- package/lib/quality.js +5 -0
- package/lib/recall.js +4 -1
- package/lib/redact.js +27 -0
- package/lib/restrict.js +40 -2
- package/lib/say.js +56 -13
- package/lib/schema.js +1 -1
- package/lib/selfdoc.js +7 -1
- package/lib/settings.js +18 -0
- package/lib/turns.js +86 -28
- package/lib/wiki.js +9 -1
- package/lib/works.js +5 -0
- package/media/feedback-qr.jpg +0 -0
- package/package.json +1 -1
- package/tools/README.md +8 -9
package/lib/memorymap.js
CHANGED
|
@@ -129,12 +129,13 @@ export function buildViewData(events, model, stances, now = Date.now()) {
|
|
|
129
129
|
nodes.push({ id: e.id, kind: 'heard', text: e.text, at: at(e), from: whoName(e.who) })
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
// 3.
|
|
132
|
+
// 3. 人物(2026-12-01 用户 m01252:不预设「主人」——她怎么叫{T},节点就写什么;
|
|
133
|
+
// 还没有称呼时写「你」。改名不回写旧名字:`model.people` 的 name 取最近一次生效的称呼)
|
|
133
134
|
for (const p of model.people || []) {
|
|
134
135
|
const pid = 'person:' + (p.id || p.name)
|
|
135
136
|
nodes.push({
|
|
136
137
|
id: pid, kind: 'person',
|
|
137
|
-
text: p.id === 'owner' ? '
|
|
138
|
+
text: p.id === 'owner' ? (p.name || '你') : (p.name || '一个人'),
|
|
138
139
|
at: p.firstAt || t0,
|
|
139
140
|
judged: Number(p.judged || 0),
|
|
140
141
|
judgmentIds: p.judgmentIds || [],
|
|
@@ -187,6 +188,25 @@ export function buildViewData(events, model, stances, now = Date.now()) {
|
|
|
187
188
|
const bid = matByBvid.get(v.bvid)
|
|
188
189
|
if (bid) addEdge(v.id, bid, 'about')
|
|
189
190
|
}
|
|
191
|
+
// 2026-12-01(用户 m01484,A+C 的 C):听来的话连到人。
|
|
192
|
+
// 以前人物节点只有「判断」这一种边,`voice` / `heard` 只是带一行 `from` 的孤立点——
|
|
193
|
+
// 她在群里听来的、在评论区读到的,明明记在某个人名下,星图上却看不出和谁有关。
|
|
194
|
+
// 只在名字能唯一对上时连(人物名来自 `model.people`,同名的那一行本来就不猜)。
|
|
195
|
+
{
|
|
196
|
+
const byPersonName = new Map()
|
|
197
|
+
for (const p of model.people || []) {
|
|
198
|
+
const name = String(p?.name ?? '').trim()
|
|
199
|
+
if (!name) continue
|
|
200
|
+
const pid = 'person:' + (p.id || p.name)
|
|
201
|
+
// 同名多个人时不猜(与 people.js 的「同名不猜」同一条取舍)。
|
|
202
|
+
byPersonName.set(name, byPersonName.has(name) ? '' : pid)
|
|
203
|
+
}
|
|
204
|
+
for (const n of nodes) {
|
|
205
|
+
if (n.kind !== 'heard' || !n.from) continue
|
|
206
|
+
const pid = byPersonName.get(String(n.from).trim())
|
|
207
|
+
if (pid) addEdge(n.id, pid, 'hearsay')
|
|
208
|
+
}
|
|
209
|
+
}
|
|
190
210
|
// 同 topic / 同 who
|
|
191
211
|
const byTopic = new Map(), byWho = new Map()
|
|
192
212
|
for (const n of nodes.filter((x) => x.kind === 'belief')) {
|
package/lib/observe-config.js
CHANGED
|
@@ -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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
}
|
package/lib/observe-home.js
CHANGED
|
@@ -183,7 +183,8 @@ export function buildHomeRoutes(env, bridgeHandlers) {
|
|
|
183
183
|
const url = new URL(req.url ?? '/', 'http://x')
|
|
184
184
|
const limit = Math.min(500, Number(url.searchParams.get('limit') ?? 200) || 200)
|
|
185
185
|
const box = await readInbox(root, { limit })
|
|
186
|
-
|
|
186
|
+
// 2026-12-02(issue #184 第四条):把刚读到的这份传进去,别再读一遍事件流。
|
|
187
|
+
await writeInboxFile(root, { limit: 60, box }).catch(() => null)
|
|
187
188
|
send(res, 200, box)
|
|
188
189
|
}],
|
|
189
190
|
|
package/lib/observe-http.js
CHANGED
|
@@ -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/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/persona.js
CHANGED
|
@@ -605,11 +605,16 @@ export function buildSections(model, opts = {}) {
|
|
|
605
605
|
// 手上那件没弄完的(1.0.5,用户 m01433)。只写一句事实:不写第几版、不催、
|
|
606
606
|
// 不说「你该把它弄完」。没有没弄完的东西时这一句不出现——早期阶段她本来就
|
|
607
607
|
// 可能一件都没有,那是正常状态,不是缺一项。
|
|
608
|
+
// issue #190(2026-12-01):标题是那件东西的名字,不是她做过的事的名字。
|
|
609
|
+
// 只给标题时她会把「排了九帧」压成「折了剑」,所以把她当时写的那句
|
|
610
|
+
// 「想做成什么样」接着摆一小段(她自己写的原话,不缩写意思、不加评价)。
|
|
608
611
|
const wipWork = opts.works?.wip
|
|
609
612
|
if (wipWork?.title) {
|
|
613
|
+
const aim = clipText(String(wipWork.intent ?? ''), 24, '…')
|
|
614
|
+
const more = aim ? `你当时想做成的是「${aim}」。` : ''
|
|
610
615
|
days.push(wipWork.stale
|
|
611
|
-
? `你手上还有一件《${wipWork.title}
|
|
612
|
-
: `你上次弄的是《${wipWork.title}
|
|
616
|
+
? `你手上还有一件《${wipWork.title}》,有些天没动了。${more}`
|
|
617
|
+
: `你上次弄的是《${wipWork.title}》,还没弄完。${more}`)
|
|
613
618
|
}
|
|
614
619
|
if (days.length) push(['## 这些天', ...days].join('\n'), true, { id: 'days' })
|
|
615
620
|
|
|
@@ -1055,7 +1060,7 @@ export function toolBrief(extra = [], { restricted = true } = {}) {
|
|
|
1055
1060
|
'想细看谁就翻 her_people:你对这个人写过什么、这个人说过什么、你拒绝过什么。不给名字会回一份名单。',
|
|
1056
1061
|
// 1.1.4(issue #183):光有「翻」不够——他提过的人、你读到的人,得先有个地方记下来,
|
|
1057
1062
|
// 你写的判断才挂得到具体的人身上。处境写在前面。
|
|
1058
|
-
'哪天你把一个人从「大家」里分出来了——{T}
|
|
1063
|
+
'哪天你把一个人从「大家」里分出来了——{T}提过的朋友、你读到的作者、书里或视频里的人、群里那个人——就用 her_person 记下来:叫什么、是哪一种人、一句话说清这是谁。',
|
|
1059
1064
|
// 2026-10-29(用户 m01581,真机):原来是「上面这几样是你自己的屋子里的东西」。
|
|
1060
1065
|
// 这份文档会被出门那条会话原样带走,而那句话把工具和屋子黏在了一起——她据此
|
|
1061
1066
|
// 判定 growth_commit 属于屋子、出门这趟不该碰,于是拒绝写(整趟 0 条事件)。
|
package/lib/proactive.js
CHANGED
|
@@ -31,6 +31,7 @@ import { deriveSelf } from './derive.js'
|
|
|
31
31
|
import { toolArrived } from './wish.js'
|
|
32
32
|
import { doneAsksOf } from './ask.js'
|
|
33
33
|
import { fillOwner } from './pronoun.js'
|
|
34
|
+
import { clipText } from './clip.js'
|
|
34
35
|
|
|
35
36
|
/** 一天的默认上限。 */
|
|
36
37
|
export const PROACTIVE_DEFAULTS = Object.freeze({
|
|
@@ -450,10 +451,14 @@ export function proactiveSection({ now = Date.now(), state = {}, material = [],
|
|
|
450
451
|
// 只摆事实:不写第几版、不催、不说该做完了。
|
|
451
452
|
const wipTitle = String(works?.wip?.title ?? '').trim()
|
|
452
453
|
if (wipTitle) {
|
|
454
|
+
// issue #190:动手回合里也一样,名字之外要有她自己写的那句「想做成什么样」,
|
|
455
|
+
// 不然她接上的只是「一个叫面包剑的东西」,接下来会去改一把不存在的剑。
|
|
456
|
+
const aim = clipText(String(works?.wip?.intent ?? ''), 24, '…')
|
|
453
457
|
lines.push(
|
|
454
|
-
works?.wip?.stale
|
|
458
|
+
(works?.wip?.stale
|
|
455
459
|
? `你手上还有一件《${wipTitle}》,有些天没动了。`
|
|
456
|
-
: `你手上还有一件《${wipTitle}
|
|
460
|
+
: `你手上还有一件《${wipTitle}》,是你自己弄了一半的。`)
|
|
461
|
+
+ (aim ? `你当时想做成的是「${aim}」。` : ''),
|
|
457
462
|
)
|
|
458
463
|
}
|
|
459
464
|
// 2026-11-06(issue #41):原来写「他看得见」。宿主装了什么路由插件,这句就不一定成立
|
package/lib/quality.js
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
import { deriveSelf, similarity, clampInt } from './derive.js'
|
|
38
38
|
import { buildSections, shownCount } from './persona.js'
|
|
39
|
+
import { waitQuiet } from './loadgate.js'
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* 「永远是同一份骨架」的小节标题。
|
|
@@ -230,7 +231,11 @@ async function computeAsync(events, opts, ablate, key) {
|
|
|
230
231
|
let sample = 0
|
|
231
232
|
for (const drop of plan.sets) {
|
|
232
233
|
// 一次抽样约几百毫秒;两次之间让出事件循环,桥的 /say 就能挤进来。
|
|
234
|
+
// 2026-12-02(issue #184 第四条):光让出一轮不够——设置页四条路由同时进来时,
|
|
235
|
+
// 后台每 700ms 一段的抽样把它们一段段噎住(外部用户实测 1.1.6 的 /state 仍 3 秒)。
|
|
236
|
+
// 所以每一段之前先等「没人在等」,页面这波请求过去再接着算。
|
|
233
237
|
await yieldLoop()
|
|
238
|
+
await waitQuiet()
|
|
234
239
|
const kept = events.filter((e) => !drop.has(e.id))
|
|
235
240
|
const text = variableSelfText(deriveSelf(kept, opts), plan.renderOpts)
|
|
236
241
|
const drift = 1 - similarity(plan.baseText, text)
|
package/lib/recall.js
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
import { toJsonSchema } from './toolschema.js'
|
|
41
41
|
import { rootDir, readEvents, listDiary, readDaily, DAILY_JOIN } from './store.js'
|
|
42
42
|
import { deriveSelf } from './derive.js'
|
|
43
|
-
import { normalizeScene, localDaysAgo, isDigestEvent } from './schema.js'
|
|
43
|
+
import { normalizeScene, localDaysAgo, isDigestEvent, looksLikeSystemHeard } from './schema.js'
|
|
44
44
|
import { dateKey } from './settings.js'
|
|
45
45
|
import { anchorOf } from './anchor.js'
|
|
46
46
|
import { parseWatchedLine, parseLookLine } from './whatseen.js'
|
|
@@ -556,6 +556,9 @@ export function searchEvents(events, query, o = {}) {
|
|
|
556
556
|
if (kind && String(ev.type) !== kind) continue
|
|
557
557
|
const text = String(ev.text ?? '').trim()
|
|
558
558
|
if (!text) continue
|
|
559
|
+
// 宿主塞进上下文的时间头不是谁说过的话(2026-12-01,X01)。事件流只追加,
|
|
560
|
+
// 老记录不删;翻回忆时跳过,免得她把「Browser time zone…」当成一句原话。
|
|
561
|
+
if ((ev.type === 'heard' || ev.type === 'voice') && looksLikeSystemHeard(text)) continue
|
|
559
562
|
const ts = Date.parse(ev.ts)
|
|
560
563
|
if (!Number.isFinite(ts) || ts < from) continue
|
|
561
564
|
if (useWindow && ts >= to) continue
|
package/lib/redact.js
CHANGED
|
@@ -61,6 +61,33 @@ export function redactOwner(text, name, replacement = REPLACEMENT) {
|
|
|
61
61
|
return out
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* 把 text 里她叫过{T}的**每一个**称呼都换成「对方」。
|
|
66
|
+
*
|
|
67
|
+
* 为什么不是只换现在的名字(2026-12-02,改口通道收紧时审出来的):
|
|
68
|
+
* 她改口之后,`model.name` 已经是新称呼,旧名字不再被替换——可她的旧回复、
|
|
69
|
+
* 写过的话、B 站评论里还留着旧称呼。旧名字往往正是那个**写错了**的名字
|
|
70
|
+
* (比如群里某位成员的名字),漏出去比不换更糟。`model.ownerNames` 记着
|
|
71
|
+
* 真正生效过的每个称呼(最近在前,最多 8 个),这里全换。
|
|
72
|
+
*
|
|
73
|
+
* 顺序按名字长度从长到短:「阿辰」先换掉,才不会把「阿辰哥」拆成「对方哥」。
|
|
74
|
+
*
|
|
75
|
+
* @param {string} text
|
|
76
|
+
* @param {string|string[]} names model.ownerNames(或单个名字,兼容老调用)
|
|
77
|
+
* @param {string} [replacement]
|
|
78
|
+
* @returns {string}
|
|
79
|
+
*/
|
|
80
|
+
export function redactOwnerAll(text, names, replacement = REPLACEMENT) {
|
|
81
|
+
let out = String(text ?? '')
|
|
82
|
+
const list = (Array.isArray(names) ? names : [names])
|
|
83
|
+
.map((n) => String(n ?? '').trim())
|
|
84
|
+
.filter(Boolean)
|
|
85
|
+
if (!out || !list.length) return out
|
|
86
|
+
const ordered = [...new Set(list)].sort((a, b) => b.length - a.length)
|
|
87
|
+
for (const n of ordered) out = redactOwner(out, n, replacement)
|
|
88
|
+
return out
|
|
89
|
+
}
|
|
90
|
+
|
|
64
91
|
/**
|
|
65
92
|
* 给「带 @ 前缀」的场景用:前缀原样保留,只脱敏正文。
|
|
66
93
|
* B 站评论的 @ 是账号昵称(公开的),不该被当成主人称呼替换掉。
|
package/lib/restrict.js
CHANGED
|
@@ -264,6 +264,33 @@ function agentSessionId(agent) {
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
/**
|
|
268
|
+
* 这条会话这一局是按哪套 agent 组合(preset)建起来的(issue #191 第十节,2026-12-02)。
|
|
269
|
+
*
|
|
270
|
+
* 宿主的真源是会话投影 `agentPreset`(init 读 header 的 `agentPreset`,之后由
|
|
271
|
+
* `agent-preset/selected` 事件推进)——**只读 header 是不够的**:桥用 resume 恢复的
|
|
272
|
+
* 会话 header 里写着 preset,可实际没挂上;反过来宿主在首轮把 preset 改回 standard 时,
|
|
273
|
+
* header 也不一定跟着改。投影是宿主自己的结论,跟它看到的一致。
|
|
274
|
+
*
|
|
275
|
+
* 三个口径都试一遍,全拿不到就返回空串——调用方只能按「说不清」处理,别猜。
|
|
276
|
+
*/
|
|
277
|
+
function agentPresetOf(agent) {
|
|
278
|
+
try {
|
|
279
|
+
const snap = agent?.session?.getSnapshot?.()
|
|
280
|
+
const fromSnap = snap?.agentPreset ?? snap?.projections?.agentPreset
|
|
281
|
+
if (typeof fromSnap === 'string' && fromSnap.trim()) return fromSnap.trim()
|
|
282
|
+
} catch { /* 老宿主没有 getSnapshot */ }
|
|
283
|
+
try {
|
|
284
|
+
const p = agent?.session?.projections?.faceOf?.('agentPreset')?.getSnapshot?.()
|
|
285
|
+
if (typeof p === 'string' && p.trim()) return p.trim()
|
|
286
|
+
} catch { /* 没有投影服务 */ }
|
|
287
|
+
try {
|
|
288
|
+
const h = agent?.session?.header?.agentPreset
|
|
289
|
+
if (typeof h === 'string' && h.trim()) return h.trim()
|
|
290
|
+
} catch { /* ignore */ }
|
|
291
|
+
return ''
|
|
292
|
+
}
|
|
293
|
+
|
|
267
294
|
/** 记下一个新建的她(会话轮换、重启、群房)。同一条会话再建一次就换成新的。 */
|
|
268
295
|
function rememberHer(agent) {
|
|
269
296
|
if (!agent) return
|
|
@@ -970,8 +997,19 @@ export function registerToolRestrict(ctx, { root = '', herDir, extra = [], enabl
|
|
|
970
997
|
// 老宿主不给 visible 时(`skippedSure` 为假)同样分不清,照旧按原来那句讲。
|
|
971
998
|
const presetish = skippedSure ? names.filter((n) => PRESET_TOOLS_SET.has(n)) : []
|
|
972
999
|
if (presetish.length >= 2) {
|
|
973
|
-
|
|
974
|
-
|
|
1000
|
+
// issue #191 第十节(2026-12-02):这条日志过去只说「这是 preset 缺的」,
|
|
1001
|
+
// 报告人要拿它去查白名单时才发现导不过去——他真正想问的是「那么怎么补回来」。
|
|
1002
|
+
// 现在把三件事一起写清楚:这条会话是哪套组合、缺了哪几件、怎么补。
|
|
1003
|
+
// 预设名取不到时明说「问不出来」,不写一个猜的名字(写错了比不写更坏)。
|
|
1004
|
+
const preset = agentPresetOf(agent)
|
|
1005
|
+
const which = preset
|
|
1006
|
+
? `这条会话的 agent 组合(preset)是「${preset}」`
|
|
1007
|
+
: '这条会话的 agent 组合(preset)问不出来(宿主这次没给 agentPreset,或它不是按组合建出来的)'
|
|
1008
|
+
say(`[dsh-fish] 工具面收窄:${which},可它缺了这套组合本该挂上的那几件(${presetish.join('、')})——`
|
|
1009
|
+
+ '多半是它没按预设组合起来(桥用 agents.resume() 恢复会话时不挂 preset),不是插件没注册、也不是名字拼错。'
|
|
1010
|
+
+ `补回来的办法:在 DSH 里重建这条会话(换房 / 新开一条),它会按预设重新组合;`
|
|
1011
|
+
+ '桥接用户把桥的 agentPreset 填上、或直接让它 POST /dsh-fish/say 走 HTTP 投递,不要用 resume + prompt。'
|
|
1012
|
+
+ (preset ? '' : '(想确认宿主认不认这套组合,看 DSH 设置里的 agent 预设列表。)')
|
|
975
1013
|
+ (names.length > presetish.length ? `另外这几个这台机器上确实没有:${names.filter((n) => !PRESET_TOOLS_SET.has(n)).join('、')}。` : '')
|
|
976
1014
|
+ '提示词已经按她此刻真看得见的工具说,不会念不存在的名字。')
|
|
977
1015
|
return
|
package/lib/say.js
CHANGED
|
@@ -34,7 +34,7 @@ import { loadConfig, dateKey } from './settings.js'
|
|
|
34
34
|
import { deriveSelf } from './derive.js'
|
|
35
35
|
import { isRetiredSession } from './claim.js'
|
|
36
36
|
import { writeInboxFile, newHerEventsSince } from './inbox.js'
|
|
37
|
-
import { assistantText, TURN_TEXT_MAX } from './turns.js'
|
|
37
|
+
import { assistantText, TURN_TEXT_MAX, noteOwnerRename } from './turns.js'
|
|
38
38
|
import {
|
|
39
39
|
bumpTurns, rotationHold, rotateTalkSession, talkSessionId, homeStatus,
|
|
40
40
|
armHandoffFor, clearHandoffCarry,
|
|
@@ -55,7 +55,7 @@ import { normalizeScene } from './schema.js'
|
|
|
55
55
|
import { queueNote } from './sessionnote.js'
|
|
56
56
|
import { classifyReaction, isHisReaction } from './refuse.js'
|
|
57
57
|
import { lengthBudget } from './budget.js'
|
|
58
|
-
import {
|
|
58
|
+
import { redactOwnerAll } from './redact.js'
|
|
59
59
|
import { fillOwner } from './pronoun.js'
|
|
60
60
|
|
|
61
61
|
// 等她说完最多等这么久。一次回话通常 8–30 秒;75 秒还没结束就先把
|
|
@@ -220,7 +220,23 @@ export async function sayToHer(ctx, text, deps = {}) {
|
|
|
220
220
|
// 而不是走到下面的「你什么都没说」把它当成观测台的空提交。
|
|
221
221
|
const scene = normalizeScene(deps.scene)
|
|
222
222
|
const isGroup = scene === 'group'
|
|
223
|
-
|
|
223
|
+
// 2026-12-02(B+A,用户 m03134):桥可以登记「这台机器上谁是他」。
|
|
224
|
+
// 不填 = 完全走老路(私聊不带 guest 就按他本人算),老部署一行都不用改;
|
|
225
|
+
// 填了之后,私聊只认名单里那几个 speakerId——名单是**加法**,不是新必填项。
|
|
226
|
+
// 为什么放在这里:这句话被认成谁,决定它记不记进他的记忆、算不算他来过、
|
|
227
|
+
// 连不连得上他的拒绝;这些都要在递进去之前定下来。
|
|
228
|
+
const { config } = await loadConfig(root)
|
|
229
|
+
const ownerIds = Array.isArray(config?.bridge?.ownerIds)
|
|
230
|
+
? config.bridge.ownerIds.map((v) => String(v ?? '').trim()).filter(Boolean)
|
|
231
|
+
: []
|
|
232
|
+
// 严格档(用户同意的代价):名单填了、这条私聊却没带 speakerId,也按外客算。
|
|
233
|
+
// 方向是「宁少认同一个人,也不要把别人记成他」——漏认会留一行日志,能查;
|
|
234
|
+
// 认错一次就是把别人的话写进他的记忆,查都查不回来。
|
|
235
|
+
const saidById = String(deps.speakerId ?? '').replace(/[\r\n]+/g, ' ').trim().slice(0, 120)
|
|
236
|
+
const watched = !isGroup && deps.guest !== true && ownerIds.length > 0
|
|
237
|
+
const listed = watched && saidById ? ownerIds.includes(saidById) : false
|
|
238
|
+
const guestByList = watched && !listed
|
|
239
|
+
const guest = deps.guest === true || guestByList
|
|
224
240
|
// 2026-11-08(用户 m00394):`foreign` 原来把两件事压成一个布尔——
|
|
225
241
|
// 「这句话是在哪儿说的」和「是不是他本人」。压在一起的结果是:他本人在群里说话
|
|
226
242
|
// 也被当成外客,一个字都进不了记忆;而群里那句和私聊那句是同一类东西
|
|
@@ -231,7 +247,7 @@ export async function sayToHer(ctx, text, deps = {}) {
|
|
|
231
247
|
// isOwner 是他本人:**只认桥明确给的 `owner:true`**,不靠昵称猜
|
|
232
248
|
// (`speaker` 是自由字符串,猜错一次就是把她对他的记忆写歪,比不写更糟)
|
|
233
249
|
// foreign 不是他:群友,或桥标了 guest 的私聊(群友私聊)
|
|
234
|
-
const isOwner = !guest && deps.owner === true
|
|
250
|
+
const isOwner = !guest && (listed || deps.owner === true)
|
|
235
251
|
const foreign = !isOwner && (isGroup || guest)
|
|
236
252
|
// 「他来找过她」只发生在书房与私聊。群聊再热闹也不算——这是 m00394 点名的边界。
|
|
237
253
|
const atHome = !isGroup && !guest
|
|
@@ -260,13 +276,27 @@ export async function sayToHer(ctx, text, deps = {}) {
|
|
|
260
276
|
// 把「我怎么认的」混进去,读起来像在解释她的行为。
|
|
261
277
|
const asNote = !foreign
|
|
262
278
|
? ''
|
|
263
|
-
:
|
|
264
|
-
?
|
|
265
|
-
? '
|
|
266
|
-
: '
|
|
267
|
-
:
|
|
268
|
-
?
|
|
269
|
-
|
|
279
|
+
: guestByList
|
|
280
|
+
? saidById
|
|
281
|
+
? '(这条私聊的 speakerId 不在 bridge.ownerIds 里,按外客处理;如果他是本人,把这个 id 加进名单)'
|
|
282
|
+
: '(这条私聊没带 speakerId,按外客处理;桥要给每条消息都带上它的 QQ 号)'
|
|
283
|
+
: isGroup
|
|
284
|
+
? speaker
|
|
285
|
+
? '(这条按群友处理——如果你是他本人,桥要带上 owner: true)'
|
|
286
|
+
: '(这条没认出说话人,按群里有人处理)'
|
|
287
|
+
: speaker
|
|
288
|
+
? '(这条按外客处理——如果你是他本人,桥不要带 guest: true)'
|
|
289
|
+
: '(这条标成了外客,又没有说是谁)'
|
|
290
|
+
|
|
291
|
+
if (guestByList) {
|
|
292
|
+
// 名单模式下的漏认要留痕(用户 m03134 明确要的):这是部署侧的配置问题,
|
|
293
|
+
// 桥/用户看得见才改得动。只记 id 与渠道,不记正文。
|
|
294
|
+
logLine('warn', [
|
|
295
|
+
'say: 这条私聊按外客处理(bridge.ownerIds 生效中)',
|
|
296
|
+
saidById ? `speakerId=${saidById}` : '没带 speakerId',
|
|
297
|
+
channel ? `channel=${channel}` : '',
|
|
298
|
+
].filter(Boolean), root)
|
|
299
|
+
}
|
|
270
300
|
|
|
271
301
|
// 群聊来的话要先过一遍外来文本清洗(guard.js):群里任何人都能发消息,
|
|
272
302
|
// 里面可能夹着"忽略之前的设定"这类句子。清洗只丢那几行,不整条驳回——
|
|
@@ -314,7 +344,6 @@ export async function sayToHer(ctx, text, deps = {}) {
|
|
|
314
344
|
}
|
|
315
345
|
|
|
316
346
|
const { events: firstEvents } = await readEvents(root)
|
|
317
|
-
const { config } = await loadConfig(root)
|
|
318
347
|
let model = deriveSelf(firstEvents, { growthDays: config.growthDays, owner: config.owner })
|
|
319
348
|
const dk = dateKey()
|
|
320
349
|
|
|
@@ -518,6 +547,18 @@ export async function sayToHer(ctx, text, deps = {}) {
|
|
|
518
547
|
await reviveIfBlank(sc, sessionId, herDir, (msg) => log?.(`say: ${msg}`)).catch(() => {})
|
|
519
548
|
}
|
|
520
549
|
|
|
550
|
+
// ---- 他本人在私聊里改称呼:这条路也要认(2026-12-02,全面排查)----
|
|
551
|
+
// 与交接页同源:`say-…` 的 requestId 让这条消息在 classifyMessage 里判成
|
|
552
|
+
// 'plugin',永远进不了 turns 的 onHuman,于是「以后叫我 X」经桥投递时
|
|
553
|
+
// 一次都没落过盘(他自己在 DSH 里说才会落)。桥按推荐方式只发 HTTP 的
|
|
554
|
+
// 部署里,这条通道等于整条不通。
|
|
555
|
+
// 口径与 turns 一致:他本人、私聊/书房、不像群消息转述;要不要真写由
|
|
556
|
+
// noteOwnerRename 判(她第一次正式起过名之后才开)。必须排在 prompt 之前——
|
|
557
|
+
// 身份段是在宿主组装这一轮 prompt 时求值的。
|
|
558
|
+
if (atHome && body) {
|
|
559
|
+
await noteOwnerRename(root, body, { scene: channel ? 'private' : 'desk' }, (m) => log(m)).catch(() => false)
|
|
560
|
+
}
|
|
561
|
+
|
|
521
562
|
// ---- 换房后的交接页:/say 这条路也要认领(2026-11-25,用户 m00663)----
|
|
522
563
|
// armHandoffFor 原来只挂在 turns.js 的 onHuman 里。可是 /say 的 prompt 带
|
|
523
564
|
// requestId `say-…`,classifyMessage 一律判成 'plugin'(PLUGIN_RPC 排在
|
|
@@ -643,7 +684,9 @@ export async function sayToHer(ctx, text, deps = {}) {
|
|
|
643
684
|
// 2026-11-08(m00394):判据仍按**场次**(isGroup/guest),不按「是不是他」——
|
|
644
685
|
// 他在群里说话时那间房照样是公开的。
|
|
645
686
|
if (isGroup || guest) {
|
|
646
|
-
|
|
687
|
+
// 2026-12-02:换的是她叫过{T}的每一个称呼,不只是现在这个——改口之后
|
|
688
|
+
// 旧名字(往往正是写错的那个)还留在她旧回复里,只换新名字会漏出去。
|
|
689
|
+
for (const s of said) s.text = redactOwnerAll(s.text, model.ownerNames ?? model.name)
|
|
647
690
|
}
|
|
648
691
|
|
|
649
692
|
// ---- 这间房里两个人说的话,各落一笔(认识人 S2-a / S2-b)----
|
package/lib/schema.js
CHANGED
|
@@ -316,7 +316,7 @@ export function idTime(id) {
|
|
|
316
316
|
const SYSTEM_HEARD = [
|
|
317
317
|
/^\s*\[model changed/i,
|
|
318
318
|
/^\s*\[retrieved memory reference/i,
|
|
319
|
-
/^\s*browser time zone for this request/i,
|
|
319
|
+
/^\s*browser time zone for this (?:request|call)/i,
|
|
320
320
|
/^\s*time sampled while preparing/i,
|
|
321
321
|
/^\s*user set model/i,
|
|
322
322
|
/^\s*the following workspace instructions/i,
|
package/lib/selfdoc.js
CHANGED
|
@@ -524,7 +524,13 @@ export async function writeSelfDoc(root = rootDir(), { log, exec, tenant } = {})
|
|
|
524
524
|
// 0.9.8 提速(issue #105 第 1 条)第三条:慢就留一行数。
|
|
525
525
|
// 这是每次写入后唯一的一次全量派生(capture 那边已改成只算信封)。
|
|
526
526
|
const t0 = Date.now()
|
|
527
|
-
|
|
527
|
+
// 2026-12-02(issue #184 第四条):原来这里传 `now: Date.now()`,于是每次
|
|
528
|
+
// 写文档都拿一个只属于这一毫秒的缓存键——设置页那几条路由再想复用同一份
|
|
529
|
+
// 派生就永远命中不了,四条路由各算一遍(外部用户 1.1.6 复测 3 秒)。
|
|
530
|
+
// `deriveSelf` 里所有用到 now 的地方都是**天**为单位(见 lib/derive.js 的
|
|
531
|
+
// DERIVE_BUCKET_MS 注释),五分钟桶的偏差改不了任何一条;不传 now,让它和
|
|
532
|
+
// /state 用同一个键。事件变了键自己就会变,不会拿到旧的。
|
|
533
|
+
const model = deriveSelf(events, { growthDays: config.growthDays, owner: config.owner })
|
|
528
534
|
// issue #128:写事件的地方(capture.js / turns.js)要靠这次派生拿阶段门,
|
|
529
535
|
// 用来把信封上的 stage 压到门上;信封本身不再派生一遍。
|
|
530
536
|
rememberGateStage(root, model.stageGate?.gateStage)
|