dsh-memento 0.4.2 → 0.4.3

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/types.d.ts CHANGED
@@ -1,237 +1,238 @@
1
- // types.d.ts — dsh-memento 类型契约(声明合并)。
2
- //
3
- // 本插件入口是纯 ESM JavaScript;类型契约集中在本文件:
4
- // - `declare module '@deepseek-ai/cordis'`:ctx.memory 服务(F1,三角色 seam 的
5
- // Service Definition 面)。
6
- // - `declare module '@deepseek-ai/dsh-session'`:memory/* 会话事件词汇(F7)。
7
- // 注意 rc.6 尚无插件事件注册面(KNOWN_SESSION_EVENT_TYPES 不含 memory/*,
8
- // 且 Session.append 无法标记 ignorable),运行时按已知集合自适应派发——
9
- // 未被 harness 收录时跳过 append,审计由审批审计对 + 插件审计表承担;
10
- // 词汇与载荷形状在本文件定死,harness 收录后即自动启用。
11
-
12
- export type MemoryTrack = 'user' | 'agent'
13
-
14
- export type MemoryScope = 'user-global' | 'workspace'
15
-
16
- export type MemoryWritePolicy = 'ask' | 'auto' | 'off'
17
-
18
- export type MemoryAction = 'add' | 'replace' | 'remove' | 'consolidate' | 'query' | 'seed'
19
-
20
- /** 落盘条目(审计/会话事件的载荷形状)。 */
21
- export interface MemoryEntry {
22
- /** 条目 id(本插件生成,UUID v4,跨会话稳定)。 */
23
- id: string
24
- /** 轨道:user=用户画像,agent=环境事实/约定/教训。 */
25
- track: MemoryTrack
26
- /** 作用域:user-global 跨工作区,workspace 按会话 cwd。 */
27
- scope: MemoryScope
28
- /** workspace 条目的规范化 cwd 键;user-global 条目为空串。 */
29
- workspaceKey: string
30
- /** 规范化 agentPreset 键;'' = 共享层(所有 preset 可见)。 */
31
- agentKey: string
32
- /** 条目文本(预算计数字符 = JS 字符串长度)。 */
33
- text: string
34
- /** 来源标注(dsh-memento / memory-tool / claude 等)。 */
35
- source: string
36
- /** 短标签(协议 v1:最多 16 个、每个 ≤32 字符;顺序 = 首次出现序)。 */
37
- tags: string[]
38
- /** 条目版本(协议 v1:新条目 = 1;每次 replace 自增)。 */
39
- version: number
40
- /** 创建时间(epoch ms)。 */
41
- createdAt: number
42
- /** 最近更新时间(epoch ms)。 */
43
- updatedAt: number
44
- /** 最近召回时间(epoch ms);从未命中为 null。 */
45
- lastRecalled: number | null
46
- /** 召回次数(query 排序用:高频即重要)。 */
47
- recallCount: number
48
- /** 最近一次写它的会话 id;无则 null。 */
49
- sessionId: string | null
50
- }
51
-
52
- /** 写入输入(add/seed 用)。 */
53
- export interface MemoryEntryInput {
54
- track: MemoryTrack
55
- scope: MemoryScope
56
- text: string
57
- source?: string
58
- /** 显式 workspaceKey;省略时取写方会话 cwd。 */
59
- workspaceKey?: string
60
- /** 显式 agentKey;省略时取写方会话 agentPreset。 */
61
- agentKey?: string
62
- /** 短标签(协议 v1 条目规范;缺省 = 无标签)。 */
63
- tags?: string[]
64
- }
65
-
66
- /** 会话最小形状(插件只读这些面;字段宽类型以兼容真实 Session/Agent)。 */
67
- export interface MemorySessionLike {
68
- id?: unknown
69
- header?: { cwd?: unknown; agentPreset?: unknown }
70
- append?: (type: string, data: unknown) => unknown
71
- }
72
-
73
- /** 审批服务最小形状(插件消费的 seam 面)。 */
74
- export interface MemoryApprovalLike {
75
- request(req: { agent?: unknown; toolName?: string; reason?: string; callId?: unknown; signal?: AbortSignal }): Promise<string>
76
- overrideOf?(session: unknown): string | undefined
77
- config?: { policy?: string }
78
- }
79
-
80
- /** 写上下文:审批路由与审计归属所必需。agent 缺失时写失败封闭。 */
81
- export interface MemoryWriteContext {
82
- /** 发起写的 agent(其 session 承载审批审计对)。 */
83
- agent: { session?: MemorySessionLike | null } | null | undefined
84
- /** 发起写的工具 callId(供 UI answerer 挂靠已流式化的工具调用)。 */
85
- callId?: unknown
86
- /** 取消信号:中止即 cancelled,不写任何东西。 */
87
- signal?: AbortSignal
88
- /** 可选自定义审批传输(turn 外命令路径注入;payload 携带完整写载荷)。 */
89
- gate?: (payload: { action: string; track: string; scope: string; text: string; count?: number }, write: MemoryWriteContext) => Promise<string>
90
- }
91
-
92
- /** query 结果。 */
93
- export interface MemoryQueryResult {
94
- entries: MemoryEntry[]
95
- total: number
96
- truncated: boolean
97
- }
98
-
99
- /** 预算行。 */
100
- export interface MemoryBudgetRow {
101
- track: MemoryTrack
102
- scope: MemoryScope
103
- used: number
104
- limit: number
105
- }
106
-
107
- /** 写成功后的用量(模型据此整合/删除后重试)。 */
108
- export interface MemoryUsage {
109
- track: MemoryTrack
110
- scope: MemoryScope
111
- used: number
112
- limit: number
113
- }
114
-
115
- /** ctx.memory 服务:写方法内部强制过审批门,读方法无审批。 */
116
- export interface MemoryService {
117
- /** 模型可见文案与命令输出的语言(Config.language,'en' | 'zh')。 */
118
- language: 'en' | 'zh'
119
-
120
- /** 每轨每层当前用量与上限。 */
121
- budgets(): MemoryBudgetRow[]
122
-
123
- /** 子串查询(无审批);带 sessionId 时记 recalled 审计,带 session 时按已知事件类型自适应派发 memory/recalled。
124
- * opts.agentKey 给定时按会话可见集过滤(共享层 + 指定 agent 键);缺省不过滤(管理面全量视图)。 */
125
- query(filter?: { track?: MemoryTrack; scope?: MemoryScope; text?: string; limit?: number }, opts?: { sessionId?: string; session?: MemorySessionLike | null; agentKey?: string }): MemoryQueryResult
126
-
127
- /** 新增条目(审批门 + 预算门)。 */
128
- add(input: MemoryEntryInput, write: MemoryWriteContext): Promise<{ entry: MemoryEntry; usage: MemoryUsage }>
129
-
130
- /** 按唯一子串替换(审批门 + 预算门;零/多命中报错)。写定位 = 会话可见集:
131
- * agentKey/workspaceKey 显式给定则覆盖写方会话的推导值。审批载荷携带将被改写的旧条目全文。 */
132
- replace(input: { track: MemoryTrack; scope: MemoryScope; match: string; text: string; source?: string; agentKey?: string; workspaceKey?: string; tags?: string[] }, write: MemoryWriteContext): Promise<{ previous: MemoryEntry; entry: MemoryEntry; usage: MemoryUsage }>
133
-
134
- /** 按唯一子串删除(审批门;零/多命中报错)。写定位 = 会话可见集;审批载荷携带将被删除的条目全文。 */
135
- remove(input: { track: MemoryTrack; scope: MemoryScope; match: string; agentKey?: string; workspaceKey?: string }, write: MemoryWriteContext): Promise<{ entry: MemoryEntry; usage: MemoryUsage }>
136
-
137
- /** 整合多条为一条(一次审批 + Provider 单事务原子执行;零/多命中或超预算响亮失败)。 */
138
- consolidate(input: { track: MemoryTrack; scope: MemoryScope; matches: string[]; text: string; source?: string; workspaceKey?: string; agentKey?: string; tags?: string[] }, write: MemoryWriteContext): Promise<{ removed: MemoryEntry[]; entry: MemoryEntry; usage: MemoryUsage }>
139
-
140
- /** 批量种子(一次 ask 审批整批;任一条超预算整批拒绝)。 */
141
- seed(inputs: MemoryEntryInput[], write: MemoryWriteContext): Promise<{ added: number; entries: MemoryEntry[] }>
142
- }
143
-
144
- /** 适配器描述(/memory adapters 与接入指南展示面)。 */
145
- export interface MemoryAdapterDescriptor {
146
- /** 唯一适配器 id(小写 kebab-case)。 */
147
- id: string
148
- /** 人类可读名称。 */
149
- name: string
150
- /** 一句话说明转换方向与适用格式。 */
151
- description: string
152
- /** 适配器自身版本。 */
153
- version: string
154
- /** 可导入的外部格式标签。 */
155
- importFormats: string[]
156
- /** 导出产出的外部格式标签。 */
157
- exportFormat: string
158
- }
159
-
160
- /** 适配器契约(第三方记忆插件实现面):外部格式 ⇄ 协议条目。 */
161
- export interface MemoryAdapter extends MemoryAdapterDescriptor {
162
- /** 外部载荷 → 协议条目输入(只转换,绝不调模型抽取)。 */
163
- adapt(payload: unknown): { entries: MemoryEntryInput[] }
164
- /** 协议条目 → 外部载荷(JSON 安全,只读转换)。 */
165
- export(entries: MemoryEntry[]): unknown
166
- }
167
-
168
- /** ctx.memoryAdapters 服务(dsh-memory-protocol v1 适配器注册表)。 */
169
- export interface MemoryAdaptersService {
170
- /** 注册适配器(返回 disposer;id 冲突响亮失败)。 */
171
- register(adapter: MemoryAdapter): () => void
172
- /** 已注册适配器描述(按 id 排序)。 */
173
- list(): MemoryAdapterDescriptor[]
174
- /** 外部载荷 → 协议条目输入(未知 id / 非法载荷结构化报错)。 */
175
- adapt(adapterId: string, payload: unknown): { entries: MemoryEntryInput[] }
176
- /** 协议条目 → 外部格式载荷(只读)。 */
177
- export(adapterId: string, entries: MemoryEntry[]): unknown
178
- }
179
-
180
- declare module '@deepseek-ai/cordis' {
181
- interface Context {
182
- /** dsh-memento 记忆服务(本插件提供;其它插件可读写同一 store)。 */
183
- memory: MemoryService
184
- /** dsh-memory-protocol v1 适配器注册表(本插件提供;第三方记忆插件注册自己的适配器)。 */
185
- memoryAdapters: MemoryAdaptersService
186
- /** 审批 seam(本插件消费的最小面;由 DSH interaction 能力提供)。 */
187
- approval: MemoryApprovalLike
188
- }
189
- interface Events {
190
- /** 审批 waterfall(本插件 answerer 挂链)。 */
191
- 'approval/request'(req: unknown, next: () => Promise<string>): Promise<string>
192
- /** 可选服务就绪通知(withService 用)。 */
193
- 'internal/service'(name: string): void
194
- /** 会话事件桥(auto-capture 等观察面用)。 */
195
- 'session/event'(session: unknown, event: unknown): void
196
- }
197
- }
198
-
199
- declare module '@deepseek-ai/dsh-session' {
200
- interface SessionEventMap {
201
- /**
202
- * 一条记忆条目已落盘(审批通过后的写成功)。日志只读事件,非 surface;
203
- * 审计链 = approval/asked + approval/decided + 本事件 + 插件审计表。
204
- * rc.6 无插件事件注册面时运行时跳过 append(见 types.d.ts 头注)。
205
- */
206
- 'memory/added': {
207
- entry: MemoryEntry
208
- source: string
209
- sessionId: string
210
- }
211
- /** 一条记忆条目被 replace 改写(previous 为改写前内容)。 */
212
- 'memory/updated': {
213
- previous: MemoryEntry
214
- entry: MemoryEntry
215
- source: string
216
- sessionId: string
217
- }
218
- /** 一条记忆条目被 remove 删除。 */
219
- 'memory/removed': {
220
- entry: MemoryEntry
221
- source: string
222
- sessionId: string
223
- }
224
- /** 一次 query 召回(记录过滤条件与命中数)。 */
225
- 'memory/recalled': {
226
- query: string
227
- matches: number
228
- sessionId: string
229
- }
230
- /** 会话启动时注入的冻结快照(text 与模型所见 systemPrompt 段逐字一致,S2)。 */
231
- 'memory/snapshot': {
232
- text: string
233
- workspaceKey: string
234
- at: number
235
- }
236
- }
237
- }
1
+ // types.d.ts — dsh-memento 类型契约(声明合并)。
2
+ //
3
+ // 本插件入口是纯 ESM JavaScript;类型契约集中在本文件:
4
+ // - `declare module '@deepseek-ai/cordis'`:ctx.memory 服务(F1,三角色 seam 的
5
+ // Service Definition 面)。
6
+ // - `declare module '@deepseek-ai/dsh-session'`:memory/* 会话事件词汇(F7)。
7
+ // rc.8 复核(2026-08-21):harness 仍无插件事件注册面
8
+ // (KNOWN_SESSION_EVENT_TYPES 不含 memory/*,Session.append 写入面也仍不接受
9
+ // ignorable 标记),运行时按已知集合自适应派发——未被 harness 收录时跳过
10
+ // append,审计由审批审计对 + 插件审计表承担;词汇与载荷形状在本文件定死,
11
+ // harness 收录后即自动启用。
12
+
13
+ export type MemoryTrack = 'user' | 'agent'
14
+
15
+ export type MemoryScope = 'user-global' | 'workspace'
16
+
17
+ export type MemoryWritePolicy = 'ask' | 'auto' | 'off'
18
+
19
+ export type MemoryAction = 'add' | 'replace' | 'remove' | 'consolidate' | 'query' | 'seed'
20
+
21
+ /** 落盘条目(审计/会话事件的载荷形状)。 */
22
+ export interface MemoryEntry {
23
+ /** 条目 id(本插件生成,UUID v4,跨会话稳定)。 */
24
+ id: string
25
+ /** 轨道:user=用户画像,agent=环境事实/约定/教训。 */
26
+ track: MemoryTrack
27
+ /** 作用域:user-global 跨工作区,workspace 按会话 cwd。 */
28
+ scope: MemoryScope
29
+ /** workspace 条目的规范化 cwd 键;user-global 条目为空串。 */
30
+ workspaceKey: string
31
+ /** 规范化 agentPreset 键;'' = 共享层(所有 preset 可见)。 */
32
+ agentKey: string
33
+ /** 条目文本(预算计数字符 = JS 字符串长度)。 */
34
+ text: string
35
+ /** 来源标注(dsh-memento / memory-tool / claude 等)。 */
36
+ source: string
37
+ /** 短标签(协议 v1:最多 16 个、每个 ≤32 字符;顺序 = 首次出现序)。 */
38
+ tags: string[]
39
+ /** 条目版本(协议 v1:新条目 = 1;每次 replace 自增)。 */
40
+ version: number
41
+ /** 创建时间(epoch ms)。 */
42
+ createdAt: number
43
+ /** 最近更新时间(epoch ms)。 */
44
+ updatedAt: number
45
+ /** 最近召回时间(epoch ms);从未命中为 null。 */
46
+ lastRecalled: number | null
47
+ /** 召回次数(query 排序用:高频即重要)。 */
48
+ recallCount: number
49
+ /** 最近一次写它的会话 id;无则 null。 */
50
+ sessionId: string | null
51
+ }
52
+
53
+ /** 写入输入(add/seed 用)。 */
54
+ export interface MemoryEntryInput {
55
+ track: MemoryTrack
56
+ scope: MemoryScope
57
+ text: string
58
+ source?: string
59
+ /** 显式 workspaceKey;省略时取写方会话 cwd。 */
60
+ workspaceKey?: string
61
+ /** 显式 agentKey;省略时取写方会话 agentPreset。 */
62
+ agentKey?: string
63
+ /** 短标签(协议 v1 条目规范;缺省 = 无标签)。 */
64
+ tags?: string[]
65
+ }
66
+
67
+ /** 会话最小形状(插件只读这些面;字段宽类型以兼容真实 Session/Agent)。 */
68
+ export interface MemorySessionLike {
69
+ id?: unknown
70
+ header?: { cwd?: unknown; agentPreset?: unknown }
71
+ append?: (type: string, data: unknown) => unknown
72
+ }
73
+
74
+ /** 审批服务最小形状(插件消费的 seam 面)。 */
75
+ export interface MemoryApprovalLike {
76
+ request(req: { agent?: unknown; toolName?: string; reason?: string; callId?: unknown; signal?: AbortSignal }): Promise<string>
77
+ overrideOf?(session: unknown): string | undefined
78
+ config?: { policy?: string }
79
+ }
80
+
81
+ /** 写上下文:审批路由与审计归属所必需。agent 缺失时写失败封闭。 */
82
+ export interface MemoryWriteContext {
83
+ /** 发起写的 agent(其 session 承载审批审计对)。 */
84
+ agent: { session?: MemorySessionLike | null } | null | undefined
85
+ /** 发起写的工具 callId(供 UI answerer 挂靠已流式化的工具调用)。 */
86
+ callId?: unknown
87
+ /** 取消信号:中止即 cancelled,不写任何东西。 */
88
+ signal?: AbortSignal
89
+ /** 可选自定义审批传输(turn 外命令路径注入;payload 携带完整写载荷)。 */
90
+ gate?: (payload: { action: string; track: string; scope: string; text: string; count?: number }, write: MemoryWriteContext) => Promise<string>
91
+ }
92
+
93
+ /** query 结果。 */
94
+ export interface MemoryQueryResult {
95
+ entries: MemoryEntry[]
96
+ total: number
97
+ truncated: boolean
98
+ }
99
+
100
+ /** 预算行。 */
101
+ export interface MemoryBudgetRow {
102
+ track: MemoryTrack
103
+ scope: MemoryScope
104
+ used: number
105
+ limit: number
106
+ }
107
+
108
+ /** 写成功后的用量(模型据此整合/删除后重试)。 */
109
+ export interface MemoryUsage {
110
+ track: MemoryTrack
111
+ scope: MemoryScope
112
+ used: number
113
+ limit: number
114
+ }
115
+
116
+ /** ctx.memory 服务:写方法内部强制过审批门,读方法无审批。 */
117
+ export interface MemoryService {
118
+ /** 模型可见文案与命令输出的语言(Config.language,'en' | 'zh')。 */
119
+ language: 'en' | 'zh'
120
+
121
+ /** 每轨每层当前用量与上限。 */
122
+ budgets(): MemoryBudgetRow[]
123
+
124
+ /** 子串查询(无审批);带 sessionId 时记 recalled 审计,带 session 时按已知事件类型自适应派发 memory/recalled。
125
+ * opts.agentKey 给定时按会话可见集过滤(共享层 + 指定 agent 键);缺省不过滤(管理面全量视图)。 */
126
+ query(filter?: { track?: MemoryTrack; scope?: MemoryScope; text?: string; limit?: number }, opts?: { sessionId?: string; session?: MemorySessionLike | null; agentKey?: string }): MemoryQueryResult
127
+
128
+ /** 新增条目(审批门 + 预算门)。 */
129
+ add(input: MemoryEntryInput, write: MemoryWriteContext): Promise<{ entry: MemoryEntry; usage: MemoryUsage }>
130
+
131
+ /** 按唯一子串替换(审批门 + 预算门;零/多命中报错)。写定位 = 会话可见集:
132
+ * agentKey/workspaceKey 显式给定则覆盖写方会话的推导值。审批载荷携带将被改写的旧条目全文。 */
133
+ replace(input: { track: MemoryTrack; scope: MemoryScope; match: string; text: string; source?: string; agentKey?: string; workspaceKey?: string; tags?: string[] }, write: MemoryWriteContext): Promise<{ previous: MemoryEntry; entry: MemoryEntry; usage: MemoryUsage }>
134
+
135
+ /** 按唯一子串删除(审批门;零/多命中报错)。写定位 = 会话可见集;审批载荷携带将被删除的条目全文。 */
136
+ remove(input: { track: MemoryTrack; scope: MemoryScope; match: string; agentKey?: string; workspaceKey?: string }, write: MemoryWriteContext): Promise<{ entry: MemoryEntry; usage: MemoryUsage }>
137
+
138
+ /** 整合多条为一条(一次审批 + Provider 单事务原子执行;零/多命中或超预算响亮失败)。 */
139
+ consolidate(input: { track: MemoryTrack; scope: MemoryScope; matches: string[]; text: string; source?: string; workspaceKey?: string; agentKey?: string; tags?: string[] }, write: MemoryWriteContext): Promise<{ removed: MemoryEntry[]; entry: MemoryEntry; usage: MemoryUsage }>
140
+
141
+ /** 批量种子(一次 ask 审批整批;任一条超预算整批拒绝)。 */
142
+ seed(inputs: MemoryEntryInput[], write: MemoryWriteContext): Promise<{ added: number; entries: MemoryEntry[] }>
143
+ }
144
+
145
+ /** 适配器描述(/memory adapters 与接入指南展示面)。 */
146
+ export interface MemoryAdapterDescriptor {
147
+ /** 唯一适配器 id(小写 kebab-case)。 */
148
+ id: string
149
+ /** 人类可读名称。 */
150
+ name: string
151
+ /** 一句话说明转换方向与适用格式。 */
152
+ description: string
153
+ /** 适配器自身版本。 */
154
+ version: string
155
+ /** 可导入的外部格式标签。 */
156
+ importFormats: string[]
157
+ /** 导出产出的外部格式标签。 */
158
+ exportFormat: string
159
+ }
160
+
161
+ /** 适配器契约(第三方记忆插件实现面):外部格式 ⇄ 协议条目。 */
162
+ export interface MemoryAdapter extends MemoryAdapterDescriptor {
163
+ /** 外部载荷 → 协议条目输入(只转换,绝不调模型抽取)。 */
164
+ adapt(payload: unknown): { entries: MemoryEntryInput[] }
165
+ /** 协议条目 → 外部载荷(JSON 安全,只读转换)。 */
166
+ export(entries: MemoryEntry[]): unknown
167
+ }
168
+
169
+ /** ctx.memoryAdapters 服务(dsh-memory-protocol v1 适配器注册表)。 */
170
+ export interface MemoryAdaptersService {
171
+ /** 注册适配器(返回 disposer;id 冲突响亮失败)。 */
172
+ register(adapter: MemoryAdapter): () => void
173
+ /** 已注册适配器描述(按 id 排序)。 */
174
+ list(): MemoryAdapterDescriptor[]
175
+ /** 外部载荷 → 协议条目输入(未知 id / 非法载荷结构化报错)。 */
176
+ adapt(adapterId: string, payload: unknown): { entries: MemoryEntryInput[] }
177
+ /** 协议条目 → 外部格式载荷(只读)。 */
178
+ export(adapterId: string, entries: MemoryEntry[]): unknown
179
+ }
180
+
181
+ declare module '@deepseek-ai/cordis' {
182
+ interface Context {
183
+ /** dsh-memento 记忆服务(本插件提供;其它插件可读写同一 store)。 */
184
+ memory: MemoryService
185
+ /** dsh-memory-protocol v1 适配器注册表(本插件提供;第三方记忆插件注册自己的适配器)。 */
186
+ memoryAdapters: MemoryAdaptersService
187
+ /** 审批 seam(本插件消费的最小面;由 DSH interaction 能力提供)。 */
188
+ approval: MemoryApprovalLike
189
+ }
190
+ interface Events {
191
+ /** 审批 waterfall(本插件 answerer 挂链)。 */
192
+ 'approval/request'(req: unknown, next: () => Promise<string>): Promise<string>
193
+ /** 可选服务就绪通知(withService 用)。 */
194
+ 'internal/service'(name: string): void
195
+ /** 会话事件桥(auto-capture 等观察面用)。 */
196
+ 'session/event'(session: unknown, event: unknown): void
197
+ }
198
+ }
199
+
200
+ declare module '@deepseek-ai/dsh-session' {
201
+ interface SessionEventMap {
202
+ /**
203
+ * 一条记忆条目已落盘(审批通过后的写成功)。日志只读事件,非 surface;
204
+ * 审计链 = approval/asked + approval/decided + 本事件 + 插件审计表。
205
+ * rc.8 无插件事件注册面时运行时跳过 append(见 types.d.ts 头注)。
206
+ */
207
+ 'memory/added': {
208
+ entry: MemoryEntry
209
+ source: string
210
+ sessionId: string
211
+ }
212
+ /** 一条记忆条目被 replace 改写(previous 为改写前内容)。 */
213
+ 'memory/updated': {
214
+ previous: MemoryEntry
215
+ entry: MemoryEntry
216
+ source: string
217
+ sessionId: string
218
+ }
219
+ /** 一条记忆条目被 remove 删除。 */
220
+ 'memory/removed': {
221
+ entry: MemoryEntry
222
+ source: string
223
+ sessionId: string
224
+ }
225
+ /** 一次 query 召回(记录过滤条件与命中数)。 */
226
+ 'memory/recalled': {
227
+ query: string
228
+ matches: number
229
+ sessionId: string
230
+ }
231
+ /** 会话启动时注入的冻结快照(text 与模型所见 systemPrompt 段逐字一致,S2)。 */
232
+ 'memory/snapshot': {
233
+ text: string
234
+ workspaceKey: string
235
+ at: number
236
+ }
237
+ }
238
+ }