dsh-prime-memory 0.18.5 → 0.18.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.
@@ -3,7 +3,6 @@ import { RECEIPTS_QUERY_LIMIT_MAX, dimensionOf, toReceiptView } from '../store/r
3
3
  import { listConflictPairs, renderConflictResolution, renderConflicts, resolveConflictPair } from '../conflict-service.js';
4
4
  import { WING_CATALOG, WING_FALLBACK, normPersistence, normScope, resolveRecordScope } from '../types.js';
5
5
  import { scopeFilterOf, workspaceIdOf } from '../workspace.js';
6
- import { annotateOrphanCandidates, confirmReview, mergeRoom, nextReview, pendingReviewCount, renameRoom, skipReview, } from '../room-review.js';
7
6
  import { GRAPH_STATUS_LABELS } from '../prompts/graph-projection.js';
8
7
  import { redactSecrets } from '../util/redact.js';
9
8
  const OFF_NOTICE = '本会话的记忆档位为"关闭":该会话对记忆系统完全隐身,不读取也不写入记忆。';
@@ -31,9 +30,7 @@ function applyManualRedaction(record, cfg, logger) {
31
30
  }
32
31
  export function registerMemoryTools(ctx, cfg, stores, logger, modes, live,
33
32
  /** 反刍控制器(可选:未装配时 ruminate 工具返回未启用提示)。 */
34
- ruminate,
35
- /** Room 注册表(分类管理 beta.4;缺省 = memory_room_admin 返回未装配提示)。 */
36
- roomRegistry) {
33
+ ruminate) {
37
34
  if (!cfg.tools)
38
35
  return;
39
36
  /**
@@ -133,6 +130,7 @@ roomRegistry) {
133
130
  items: {
134
131
  type: 'object',
135
132
  properties: {
133
+ id: { type: 'string', description: 'L1 record_id:可写入槽位 refs 或喂给 memory_receipts' },
136
134
  content: { type: 'string' },
137
135
  type: { type: 'string' },
138
136
  scene_name: { type: 'string' },
@@ -171,145 +169,6 @@ roomRegistry) {
171
169
  };
172
170
  },
173
171
  }));
174
- // ── memory_room_admin: Room 粒度目录治理(分类管理 beta.4;beta.5 起 merge/rename/retire 已注册) ──
175
- // list 免预算零风险;merge/rename/retire 走 dryRun 预览→实跑,执行前自动备份,完成入队场景重算。
176
- ctx.tools.register(defineTool({
177
- name: 'memory_room_admin',
178
- description: 'Room 分类管理(目录粒度)。action="list" 列出注册表条目与自生长 Room 计数;' +
179
- 'action="register" 预注册一个 Room(高权限;两级制——大类上限 200,小类用「大类/小类」细分不占额度,如 dsh-plugin/merge;' +
180
- 'action="merge" 合并两个 Room(高权限;dryRun 默认 true 只返预览,实跑改写全部匹配记录的 tags 并入队场景重算,执行前自动备份);' +
181
- 'action="rename" 改名(= merge 1:1 + 注册表改名);action="retire" 退役一个注册 Room(高权限;存量记录不动)。' +
182
- 'merge/rename 与反刍并发会相互覆盖,请在反刍空闲时执行。',
183
- parameters: {
184
- action: { type: 'string', required: true, description: 'list | register(高权限) | merge(高权限) | rename(高权限) | retire(高权限)' },
185
- slug: { type: 'string', description: 'register 的 Room slug(小写字母数字连字符)' },
186
- label: { type: 'string', description: 'register 的人类可读名(可选,可中文)' },
187
- description: { type: 'string', description: 'register 的归类说明(可选;喂给标注器帮助归类)' },
188
- from: { type: 'string', description: 'merge/rename 的源 Room slug' },
189
- to: { type: 'string', description: 'merge/rename 的目标 Room slug' },
190
- dryRun: { type: 'string', description: 'merge/rename:默认 true 只返预览;"false" 才实际执行' },
191
- },
192
- output: {
193
- schema: {
194
- type: 'object',
195
- properties: {
196
- notice: { type: 'string' },
197
- rooms: { type: 'string' },
198
- slug: { type: 'string' },
199
- created: { type: 'boolean' },
200
- },
201
- additionalProperties: false,
202
- },
203
- render: (_args, value) => [{ type: 'text', text: value.notice ?? JSON.stringify(value) }],
204
- },
205
- execute: async (args) => {
206
- const action = String(args.action ?? '');
207
- if (action === 'list') {
208
- if (!roomRegistry)
209
- return { notice: 'Room 注册表未装配(需要插件重载以初始化)。' };
210
- const registry = roomRegistry.list();
211
- const counts = stores.l1.listRooms();
212
- const countOf = (slug) => counts.find((r) => r.room === slug)?.count ?? 0;
213
- const regLines = registry.map((e) => `- ${e.slug}${e.label ? `(${e.label})` : ''} [${e.source}/${e.status}] 现有 ${countOf(e.slug)} 条${e.description ? ` — ${e.description}` : ''}`);
214
- const grownOnly = counts.filter((r) => !registry.some((e) => e.slug === r.room));
215
- return {
216
- notice: `注册表 ${registry.length} 条(上限 200),自生长未注册 ${grownOnly.length} 个。\n` +
217
- (regLines.join('\n') || '(注册表为空——用 action=register 预注册)') +
218
- `\n自生长未注册:${grownOnly.map((r) => `${r.room}(${r.count})`).join(", ") || "无"}`,
219
- rooms: `${registry.length}+${grownOnly.length}`,
220
- };
221
- }
222
- if (action === 'register') {
223
- if (!roomRegistry)
224
- return { notice: 'Room 注册表未装配(需要插件重载以初始化)。' };
225
- if (!live.get().memoryMutate)
226
- return { notice: MUTATE_OFF_NOTICE };
227
- const slug = String(args.slug ?? '').trim();
228
- try {
229
- const r = await roomRegistry.register({
230
- slug,
231
- label: typeof args.label === 'string' ? args.label : undefined,
232
- description: typeof args.description === 'string' ? args.description : undefined,
233
- });
234
- return {
235
- notice: r.created
236
- ? `已预注册 Room:${r.entry.slug}${r.entry.label ? `(${r.entry.label})` : ''}。候选标注器将优先把相关记忆挂到它上面。`
237
- : `Room 已存在:${r.entry.slug}(本次只补全了缺失的 label/description)。`,
238
- slug: r.entry.slug,
239
- created: r.created,
240
- };
241
- }
242
- catch (err) {
243
- return { notice: `注册失败: ${err instanceof Error ? err.message : String(err)}` };
244
- }
245
- }
246
- if (action === 'update') {
247
- if (!roomRegistry)
248
- return { notice: 'Room 注册表未装配(需要插件重载以初始化)。' };
249
- if (!live.get().memoryMutate)
250
- return { notice: MUTATE_OFF_NOTICE };
251
- const slug = String(args.slug ?? '').trim();
252
- if (!slug)
253
- return { notice: 'update 需要 slug。' };
254
- try {
255
- const ok = await roomRegistry.update(slug, {
256
- label: typeof args.label === 'string' ? args.label : undefined,
257
- description: typeof args.description === 'string' ? args.description : undefined,
258
- });
259
- return { notice: ok ? `已更新:${slug}(显示名/归类说明)。` : `无变化:${slug} 未找到或未提供非空字段。`, slug };
260
- }
261
- catch (err) {
262
- return { notice: `更新失败: ${err instanceof Error ? err.message : String(err)}` };
263
- }
264
- }
265
- if (action === 'merge' || action === 'rename') {
266
- if (!roomRegistry)
267
- return { notice: 'Room 注册表未装配(需要插件重载以初始化)。' };
268
- if (!live.get().memoryMutate)
269
- return { notice: MUTATE_OFF_NOTICE };
270
- const from = String(args.from ?? '').trim();
271
- const to = String(args.to ?? '').trim();
272
- if (!from || !to)
273
- return { notice: 'merge/rename 需要 from 与 to 两个 slug。' };
274
- const dryRun = String(args.dryRun ?? 'true').toLowerCase() !== 'false';
275
- try {
276
- const fn = action === 'merge' ? mergeRoom : renameRoom;
277
- const r = await fn({ l1: stores.l1, registry: roomRegistry, logger }, from, to, { dryRun });
278
- if (r.dryRun) {
279
- return {
280
- notice: `[dryRun 预览] ${from} → ${to}:影响 ${r.affected} 条${r.hasMore ? '(超过单次上限,需续跑)' : ''}。` +
281
- `样例:${r.preview.join(', ') || '无'}。确认无误后以 dryRun="false" 执行(执行前自动备份,重写含已退场行,完成后自动入队场景重算)。`,
282
- affected: r.affected,
283
- };
284
- }
285
- return {
286
- notice: `${action === 'merge' ? '合并' : '改名'}完成:${from} → ${to},重写 ${r.applied} 条` +
287
- `(备份:${r.backupFile ?? '无'})。`,
288
- applied: r.applied,
289
- id: to,
290
- };
291
- }
292
- catch (err) {
293
- return { notice: `${action} 失败: ${err instanceof Error ? err.message : String(err)}` };
294
- }
295
- }
296
- if (action === 'retire') {
297
- if (!roomRegistry)
298
- return { notice: 'Room 注册表未装配(需要插件重载以初始化)。' };
299
- if (!live.get().memoryMutate)
300
- return { notice: MUTATE_OFF_NOTICE };
301
- const slug = String(args.slug ?? '').trim();
302
- try {
303
- const ok = await roomRegistry.setStatus(slug, 'retired');
304
- return { notice: ok ? `已退役 Room:${slug}(存量记录的 tags 不动,仅词表不再推荐)。` : `未找到注册条目:${slug}(自生长 Room 无需退役,会随 tags 自然消失)。`, slug };
305
- }
306
- catch (err) {
307
- return { notice: `退役失败: ${err instanceof Error ? err.message : String(err)}` };
308
- }
309
- }
310
- return { notice: `非法 action:${action}(允许 list/register/merge/rename/retire)。` };
311
- },
312
- }));
313
172
  // ── conversation_search: L0 原始对话 ──
314
173
  ctx.tools.register(defineTool({
315
174
  name: 'conversation_search',
@@ -906,87 +765,6 @@ roomRegistry) {
906
765
  },
907
766
  }));
908
767
  // ── 反刍状态查询(查看当前反刍进度) ──
909
- // ── memory_room_review:孤儿记忆的 Room 候选逐个复查(agent 长尾治理)──────
910
- // next/annotate 只读或预算内标注(无需门);confirm/skip 改写 metadata,
911
- // confirm 吃 live.memoryMutate 高权限门(与 memory_delete 同款)。
912
- ctx.tools.register(defineTool({
913
- name: 'memory_room_review',
914
- description: '孤儿记忆(无 Room 绑定)的逐个复查:action="next" 取下一条待复查记录(带系统预标记的候选 Room 与现有词表,agent 依据记录内容判定);' +
915
- 'action="confirm" 按 id 把 1-3 个 Room slug 写入该记忆(高权限);action="skip" 跳过(不再进队列);' +
916
- 'action="annotate" 立即对一批孤儿做候选预标记(平时由反刍自动推进)。建议长会话空闲时逐个过,保持分类收敛——优先挂靠现有 Room。',
917
- parameters: {
918
- action: { type: 'string', required: true, description: 'next(取下一条)| confirm(确认写入)| skip(跳过)| annotate(批量预标记)' },
919
- id: { type: 'string', description: 'confirm/skip 的目标记录 id(action=next 返回的 id)' },
920
- rooms: { type: 'string', description: 'confirm 的 Room slug 列表(逗号分隔,1-3 个,小写字母数字连字符;可含词表外新 slug)' },
921
- },
922
- output: {
923
- schema: {
924
- type: 'object',
925
- properties: {
926
- notice: { type: 'string' },
927
- id: { type: 'string' },
928
- content: { type: 'string' },
929
- candidates: { type: 'string' },
930
- roomCatalog: { type: 'string' },
931
- remaining: { type: 'number' },
932
- confirmedTags: { type: 'string' },
933
- annotated: { type: 'number' },
934
- deferred: { type: 'number' },
935
- },
936
- additionalProperties: false,
937
- },
938
- render: (_args, value) => [{ type: 'text', text: value.notice ?? JSON.stringify(value) }],
939
- },
940
- execute: async (args) => {
941
- const action = String(args.action ?? '');
942
- const io = { l1: stores.l1, logger };
943
- if (action === 'next') {
944
- const item = nextReview(io.l1);
945
- if (!item)
946
- return { notice: '没有待复查的孤儿记忆(roomCandidates 队列为空)。可用 action=annotate 先做一轮候选预标记。' };
947
- return {
948
- id: item.id,
949
- content: item.content,
950
- candidates: item.candidates.join(', '),
951
- roomCatalog: item.roomCatalog.map((r) => `${r.room}(${r.count})`).join(', '),
952
- remaining: item.remaining,
953
- };
954
- }
955
- if (action === 'annotate') {
956
- const r = await annotateOrphanCandidates(ctx, cfg, { ...io, registry: roomRegistry }, 40);
957
- return {
958
- notice: `候选预标记完成:选中 ${r.selected} 条,产候选 ${r.candidates} 条,写 pending ${r.written} 条。用 action=next 逐个复查。`,
959
- annotated: r.candidates,
960
- deferred: r.selected - r.written,
961
- };
962
- }
963
- if (action === 'confirm') {
964
- if (!live.get().memoryMutate)
965
- return { notice: MUTATE_OFF_NOTICE };
966
- const id = String(args.id ?? '').trim();
967
- if (!id)
968
- return { notice: 'confirm 需要 id(action=next 返回的 id)。' };
969
- const rooms = String(args.rooms ?? '')
970
- .split(/[,,、]/)
971
- .map((x) => x.trim())
972
- .filter(Boolean);
973
- if (rooms.length === 0)
974
- return { notice: 'confirm 需要 rooms(逗号分隔的 1-3 个 Room slug)。' };
975
- const r = confirmReview(io.l1, id, rooms);
976
- if (!r)
977
- return { notice: `确认失败:id=${id} 不存在、已被确认过、或 rooms 全部非法(需 1-3 个合法 slug)。` };
978
- return { notice: `已挂到 Room:${r.tags.join(', ')}(面板下一次刷新即可见)。`, confirmedTags: r.tags.join(', '), id };
979
- }
980
- if (action === 'skip') {
981
- const id = String(args.id ?? '').trim();
982
- if (!id)
983
- return { notice: 'skip 需要 id。' };
984
- const ok = skipReview(io.l1, id);
985
- return { notice: ok ? `已跳过 ${id}(不再进复查队列)。` : `跳过失败:id=${id} 不存在。`, id };
986
- }
987
- return { notice: `非法 action:${action}(允许 next/confirm/skip/annotate)。剩余待复查 ${pendingReviewCount(stores.l1)} 条。` };
988
- },
989
- }));
990
768
  ctx.tools.register(defineTool({
991
769
  name: 'memory_ruminate_status',
992
770
  description: '查询当前记忆反刍的状态与进度(是否运行中、当前阶段、已完成/总会话数等)。\n\n注意:在 DSH Web GUI 的对话中无法直接调用此工具,因为模型可调用工具列表不包含 ruminate_status。如需查询进度,请在记忆库面板的蒸馏面板查看。',
package/dist/types.d.ts CHANGED
@@ -41,10 +41,6 @@ export interface RoomCount {
41
41
  room: string;
42
42
  /** 该 Room 下的记录数(与 `wingL1Counts()` 同口径:含 retired 行)。 */
43
43
  count: number;
44
- /** 来源标示(rooms-get 端点层合并注册表后附带;'grown' = 自生长,可缺省)。 */
45
- source?: 'pre-registered' | 'grown';
46
- /** 人类可读名(注册表条目才有;面板 chip 可用 label 展示)。 */
47
- label?: string;
48
44
  }
49
45
  /** 记录族标签推断:work_* 前缀 → work,其余(含 auto 档兜底)→ chat。 */
50
46
  export declare function familyForType(type: string): MemoryFamily;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-prime-memory",
3
- "version": "0.18.5",
3
+ "version": "0.18.7",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public",
@@ -77,6 +77,7 @@
77
77
  "author": "drscrewdriver <597093681@qq.com>",
78
78
  "license": "MIT",
79
79
  "dependencies": {
80
+ "@deepseek-ai/cosmokit": "~1.8.5",
80
81
  "@node-rs/jieba": "^2.0.2",
81
82
  "sqlite-vec": "^0.1.7-alpha.2",
82
83
  "undici": "^7.29.0"
@@ -1,196 +0,0 @@
1
- /**
2
- * 孤儿记忆的 Room 候选预标记 + agent 逐个复查(长尾治理)。
3
- *
4
- * 背景:Room 由 metadata.tags 自生长,但 tags 只在反刍 relabel 段随 wing 补打
5
- * 顺带产出(每轮 ≤40 条、且只覆盖本轮补 wing 的记录)——「有 wing 无 tags」与
6
- * 「预算用尽被 deferred」的记录成为无 Room 绑定的孤儿,且标注器不参考现有
7
- * Room 词表,产出碎片化新 slug(81 个 Room 大多 1 条的成因)。
8
- *
9
- * 两段式:
10
- * 1. **预标记(annotateOrphanCandidates)**:抽取活跃孤儿,LLM 对照**现有 Room
11
- * 词表**产出候选(优先挂靠现有 Room,≤2 个新 slug 兜底),写
12
- * `metadata.roomCandidates` + `roomReview:'pending'`——不动 tags、不进
13
- * Room、不进召回,只是"待确认的建议"。
14
- * 2. **逐个复查(memory_room_review 工具)**:agent 取下一条待复查记录
15
- * (带候选 + 现有 Room 词表),确认后 confirm 写入 tags(进 Room,高权限
16
- * 门控),或 skip 跳过。确认/跳过都是显式动作,预标记本身零行为面。
17
- *
18
- * 存储即 metadata 保留键(与 relabel 写 tags 同款 patchMetadata 合并纪律,
19
- * 写前重读):`roomCandidates` / `roomReview:'pending'|'confirmed'|'skipped'`。
20
- * 两键不在 rooms 聚合(rooms 只读 $.tags)、不在快照哈希投影关注的治理列——
21
- * 与既有 metadata 键同层,无 schema 变更。
22
- */
23
- import type { Context } from '@deepseek-ai/cordis';
24
- import type { MemoryConfig } from './config.js';
25
- import type { MemoryLogger, MemoryRecord } from './types.js';
26
- export declare const ROOM_CANDIDATES_KEY = "roomCandidates";
27
- export declare const ROOM_REVIEW_KEY = "roomReview";
28
- export type RoomReviewState = 'pending' | 'confirmed' | 'skipped';
29
- /** 复查与候选操作对 L1 的最小依赖面(便于测试注入)。 */
30
- export interface RoomReviewStore {
31
- list(opts: {
32
- untagged?: boolean;
33
- retired?: boolean;
34
- limit: number;
35
- offset: number;
36
- }): {
37
- items: MemoryRecord[];
38
- total: number;
39
- };
40
- getByIds(ids: readonly string[]): MemoryRecord[];
41
- patchMetadata(id: string, metadata: Record<string, unknown>): boolean;
42
- listRooms(): Array<{
43
- room: string;
44
- count: number;
45
- }>;
46
- /** 确认写 tags 后失效 Room 计数缓存(30s TTL)。 */
47
- invalidateRooms(): void;
48
- }
49
- /** merge/rename 的 store 面(RoomReviewStore + 游标重写与备份;L1Store 已实现)。 */
50
- export interface RoomMergeStore extends RoomReviewStore {
51
- listByTagAll(tag: string, cap?: number): MemoryRecord[];
52
- backupTagRecords(tag: string): {
53
- file: string;
54
- count: number;
55
- };
56
- rewriteTag(from: string, to: string, cap?: number): {
57
- rewritten: number;
58
- scanned: number;
59
- families: string[];
60
- scenes: string[];
61
- hasMore: boolean;
62
- };
63
- }
64
- /** Room 注册表最小面(merge 收尾;RoomRegistryStore 已满足)。 */
65
- export interface RoomRegistryMerge {
66
- markMerged(fromSlug: string, toSlug: string): Promise<boolean>;
67
- renameSlug(oldSlug: string, newSlug: string): Promise<boolean>;
68
- /** rename 收尾恢复先前状态用(active 条目改名后不掉出标注词表)。 */
69
- bySlug?(slug: string): {
70
- status: 'active' | 'retired';
71
- } | undefined;
72
- setStatus?(slug: string, status: 'active' | 'retired'): Promise<boolean>;
73
- }
74
- export interface RoomCandidate {
75
- id: string;
76
- rooms: string[];
77
- }
78
- /** 解析标注器输出的逐条候选(容错:id 配对失败丢弃;isTag 校验;目录内优先,≤3)。 */
79
- export declare function parseRoomCandidateItems(parsed: ReadonlyArray<{
80
- id: string;
81
- rooms: readonly string[];
82
- }>, ids: ReadonlyArray<string>, roomCatalog: ReadonlyArray<{
83
- room: string;
84
- count: number;
85
- }>): RoomCandidate[];
86
- /** 候选标注系统 prompt:喂现有 Room 词表(带计数),优先挂靠、少量新建兜底。 */
87
- export declare function roomCandidateSystemPrompt(roomCatalog: ReadonlyArray<{
88
- room: string;
89
- count: number;
90
- }>): string;
91
- /** 候选标注器:一批孤儿记录 → 候选 Room(优先现有词表;失败返回空,调用方零改动)。 */
92
- export declare function roomCandidateChunk(ctx: Context, cfg: MemoryConfig, logger: MemoryLogger, chunk: MemoryRecord[], roomCatalog: ReadonlyArray<{
93
- room: string;
94
- count: number;
95
- }>): Promise<Array<{
96
- id: string;
97
- rooms: string[];
98
- }>>;
99
- export interface OrphanAnnotateIO {
100
- l1: RoomReviewStore;
101
- logger: MemoryLogger;
102
- /** Room 注册表(可选:未装配 = 词表只用自生长聚合,无注册条目)。 */
103
- registry?: {
104
- listActive(): Array<{
105
- slug: string;
106
- label?: string;
107
- description?: string;
108
- }>;
109
- };
110
- }
111
- /**
112
- * 预标记消费器:活跃孤儿(≤limit 条)批量产候选并写 pending。
113
- * 写前重读合并(与 relabel 同纪律);失败单条跳过、原记录零改动。
114
- */
115
- export interface OrphanAnnotateOverrides {
116
- /** 测试注入口:替换 LLM 候选标注器(默认走真实 callLLM 路径);第二参为合并词表。 */
117
- chunkAnnotator?: (chunk: MemoryRecord[], catalog: ReadonlyArray<{
118
- room: string;
119
- count: number;
120
- label?: string;
121
- description?: string;
122
- }>) => Promise<Array<{
123
- id: string;
124
- rooms: string[];
125
- }>>;
126
- }
127
- export declare function annotateOrphanCandidates(ctx: Context, cfg: MemoryConfig, io: OrphanAnnotateIO, limit?: number, overrides?: OrphanAnnotateOverrides): Promise<{
128
- selected: number;
129
- candidates: number;
130
- written: number;
131
- }>;
132
- export interface MergeRoomResult {
133
- dryRun: boolean;
134
- /** 影响条数(dryRun=预览数;实跑=实际重写数)。 */
135
- affected: number;
136
- preview: string[];
137
- applied: number;
138
- hasMore: boolean;
139
- backupFile?: string;
140
- /** 实跑时回传:受影响的族与场景(调用方入队 recluster 'room-merge')。 */
141
- families?: string[];
142
- scenes?: string[];
143
- }
144
- /**
145
- * Room merge/rename 编排(破坏性动作,分类管理 beta.5):
146
- * - dryRun(缺省 true):只统计 affected + 前 6 条预览,**零写入**;
147
- * - 实跑:执行前备份(matching rows → rooms-merge-backups/)→ 游标重写
148
- * (写前重读-合并-写回,其余 metadata 键保全)→ 注册表 markMerged/renameSlug
149
- * → 返回受影响 (family, scene) 供调用方入队 recluster('room-merge');
150
- * - 单飞:并发 merge 直接抛错;与 relabel/ruminate 的时间错开由调用方保证。
151
- * 抛错语义:非法参数/注册表冲突直接抛(调用方转 notice)。
152
- */
153
- export declare function mergeRoom(io: {
154
- l1: RoomMergeStore;
155
- registry: RoomRegistryMerge;
156
- logger: MemoryLogger;
157
- }, from: string, to: string, opts?: {
158
- dryRun?: boolean;
159
- cap?: number;
160
- }): Promise<MergeRoomResult>;
161
- /** rename = merge 1:1 + 注册表改名(冲突时抛错提示走 merge)。
162
- * 归类语义:改名**不是退役**——merge 编排的 markMerged 会把旧条目置 retired,
163
- * 这里在改名后恢复其先前状态(active 条目改名后仍 active,不掉出标注词表)。 */
164
- export declare function renameRoom(io: {
165
- l1: RoomMergeStore;
166
- registry: RoomRegistryMerge;
167
- logger: MemoryLogger;
168
- }, from: string, to: string, opts?: {
169
- dryRun?: boolean;
170
- cap?: number;
171
- }): Promise<MergeRoomResult>;
172
- /** 下一条待复查(供 agent 逐个过):记录摘要 + 候选 + 现有 Room 词表 + 剩余数。 */
173
- export declare function nextReview(l1: RoomReviewStore): {
174
- id: string;
175
- content: string;
176
- type: string;
177
- sceneName: string;
178
- candidates: string[];
179
- roomCatalog: Array<{
180
- room: string;
181
- count: number;
182
- }>;
183
- remaining: number;
184
- } | null;
185
- /** 待复查剩余数(面板/工具兜底信息)。 */
186
- export declare function pendingReviewCount(l1: RoomReviewStore): number;
187
- /**
188
- * 确认复查结果:候选(或 agent 改写的)写入 metadata.tags(**进 Room**),
189
- * 清候选、标 confirmed。**高权限门控由调用方执行**(与 memory_delete 同款)。
190
- * 返回写入的 tags;id 不存在/状态非法返回 null。
191
- */
192
- export declare function confirmReview(l1: RoomReviewStore, id: string, rooms: readonly string[]): {
193
- tags: string[];
194
- } | null;
195
- /** 跳过:标 skipped(不再进 pending 队列)。已 confirmed 的记录不受 skip 影响(挂了 Room 的不算长尾)。 */
196
- export declare function skipReview(l1: RoomReviewStore, id: string): boolean;