oh-memos-mcp 3.1.3 → 3.1.4

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.
@@ -69,8 +69,19 @@ export declare function renderVerbatimSections(verbatim: string | null, siblings
69
69
  /**
70
70
  * 在候选集里找与 target 同源的其他碎片。
71
71
  *
72
- * 排除 target 自身,也排除没有原文的节点。顺序按候选集原顺序,由调用方决定
73
- * 候选集怎么排(后端返回顺序通常已按 created_at)。
72
+ * 排除三类:target 自身、没有原文的节点、**scheduler 管理的短期副本**。
73
+ *
74
+ * ## 为什么必须滤层级
75
+ *
76
+ * 后端对每条抽取结果写两个节点:一个 `WorkingMemory` 短期副本 + 一个
77
+ * `LongTermMemory`(或 `UserMemory`)持久节点,`key` 与 `created_at` 逐字相同。
78
+ * 不滤的话同源列表里每个 key 成对出现 —— 实测一条被切成 6 段的记忆列出了 12 条同源。
79
+ *
80
+ * 这不是新决策,是 3.1.0 已经做过的决定(`memory-tier.ts`)。`search` 与
81
+ * `list_v2` 早已在滤,`findSiblings` 是 3.1.2 新增的路径 —— 又漏了一处。
82
+ * **新写的检索路径必须继承既有的分层过滤决定**,这是同一形态的第五次。
83
+ *
84
+ * 顺序按候选集原顺序,由调用方决定候选集怎么排(后端通常已按 updated_at 倒序)。
74
85
  */
75
- export declare function findSiblings(target: MemoryNode | undefined | null, candidates: readonly (MemoryNode | undefined | null)[], limit?: number): SiblingRef[];
86
+ export declare function findSiblings(target: MemoryNode | undefined | null, candidates: readonly (MemoryNode | undefined | null)[], limit?: number, env?: NodeJS.ProcessEnv): SiblingRef[];
76
87
  //# sourceMappingURL=verbatim-source.d.ts.map
@@ -34,6 +34,7 @@
34
34
  *
35
35
  * 设计讨论见 docs/design/memory-retrieval-optimization.md。
36
36
  */
37
+ import { isEphemeralTier, showsEphemeralTier } from "./memory-tier.js";
37
38
  /**
38
39
  * 取一条 source 的 content —— **同一个字段有两种线上形态**。
39
40
  *
@@ -119,13 +120,25 @@ export function renderVerbatimSections(verbatim, siblings, summary) {
119
120
  /**
120
121
  * 在候选集里找与 target 同源的其他碎片。
121
122
  *
122
- * 排除 target 自身,也排除没有原文的节点。顺序按候选集原顺序,由调用方决定
123
- * 候选集怎么排(后端返回顺序通常已按 created_at)。
123
+ * 排除三类:target 自身、没有原文的节点、**scheduler 管理的短期副本**。
124
+ *
125
+ * ## 为什么必须滤层级
126
+ *
127
+ * 后端对每条抽取结果写两个节点:一个 `WorkingMemory` 短期副本 + 一个
128
+ * `LongTermMemory`(或 `UserMemory`)持久节点,`key` 与 `created_at` 逐字相同。
129
+ * 不滤的话同源列表里每个 key 成对出现 —— 实测一条被切成 6 段的记忆列出了 12 条同源。
130
+ *
131
+ * 这不是新决策,是 3.1.0 已经做过的决定(`memory-tier.ts`)。`search` 与
132
+ * `list_v2` 早已在滤,`findSiblings` 是 3.1.2 新增的路径 —— 又漏了一处。
133
+ * **新写的检索路径必须继承既有的分层过滤决定**,这是同一形态的第五次。
134
+ *
135
+ * 顺序按候选集原顺序,由调用方决定候选集怎么排(后端通常已按 updated_at 倒序)。
124
136
  */
125
- export function findSiblings(target, candidates, limit = 12) {
137
+ export function findSiblings(target, candidates, limit = 12, env = process.env) {
126
138
  const fp = sourceFingerprint(target);
127
139
  if (fp === null)
128
140
  return [];
141
+ const showEphemeral = showsEphemeralTier(env);
129
142
  const targetId = String(target?.id ?? "");
130
143
  const out = [];
131
144
  const seen = new Set();
@@ -137,6 +150,9 @@ export function findSiblings(target, candidates, limit = 12) {
137
150
  continue;
138
151
  if (sourceFingerprint(node) !== fp)
139
152
  continue;
153
+ // 逃生开关打开时不滤 —— 与 filterEphemeralTier 的语义保持一致。
154
+ if (!showEphemeral && isEphemeralTier(node?.metadata))
155
+ continue;
140
156
  seen.add(id);
141
157
  const meta = (node?.metadata ?? {});
142
158
  const key = String(meta.key ?? "").trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-memos-mcp",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "MCP Server for oh-memos — Intelligent Memory Management (Node.js, no Python required)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",