@tpsdev-ai/pi-flair 0.9.0 → 0.10.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,+BAA+B,CAAC;AAEpF,OAAO,EAA2B,KAAK,iBAAiB,EAAwB,MAAM,yBAAyB,CAAC;AAIhH,UAAU,YAAa,SAAQ,iBAAiB;IAC9C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAkFD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoBpE;AAQD,MAAM,CAAC,OAAO,WAAW,EAAE,EAAE,YAAY,QAyMxC;AAID,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,SAAS,SAAO,GACf,OAAO,CAAC,MAAM,CAAC,CAIjB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,+BAA+B,CAAC;AAEpF,OAAO,EAA2B,KAAK,iBAAiB,EAAwB,MAAM,yBAAyB,CAAC;AAIhH,UAAU,YAAa,SAAQ,iBAAiB;IAC9C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAkFD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoBpE;AAQD,MAAM,CAAC,OAAO,WAAW,EAAE,EAAE,YAAY,QAqNxC;AAID,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,SAAS,SAAO,GACf,OAAO,CAAC,MAAM,CAAC,CAIjB"}
package/dist/index.js CHANGED
@@ -196,12 +196,24 @@ export default function (pi) {
196
196
  dedup: true,
197
197
  dedupThreshold: 0.95,
198
198
  });
199
- // Check if dedup returned an existing memory
200
- const agentId = getAgentId(config, ctx);
201
- const generatedPrefix = `${agentId}-`;
202
- const wasDeduped = result.id && !result.id.startsWith(generatedPrefix);
199
+ // Dedup signal: use the explicit `deduped` flag that flair-client
200
+ // sets on the returned record. The previous prefix-match check
201
+ // (`!result.id.startsWith(`${agentId}-`)`) was unreliable — when
202
+ // a dedup hit returned an existing memory from the SAME agent,
203
+ // both IDs start with the same prefix and the check silently
204
+ // returned the success path, dropping the new content. Same fix
205
+ // class as #358 (P0 silent data loss) applied to flair-mcp;
206
+ // pi-flair was missed. See flair#449 (filed by a Claude Code
207
+ // session that hit this exact failure).
208
+ const wasDeduped = result.deduped === true;
203
209
  if (wasDeduped) {
204
- return { content: [{ type: "text", text: `Similar memory already exists (id: ${result.id}): ${result.content?.slice(0, 200)}` }], details: {} };
210
+ return {
211
+ content: [{
212
+ type: "text",
213
+ text: `Similar memory already exists (id: ${result.id}): ${result.content?.slice(0, 200)}\n(no new entry written)`,
214
+ }],
215
+ details: { deduplicated: true, mergedWith: result.id },
216
+ };
205
217
  }
206
218
  const preview = content.length > 120 ? content.slice(0, 120) + "..." : content;
207
219
  const tagStr = params.tags?.length ? params.tags.join(", ") : "none";
@@ -212,7 +224,7 @@ export default function (pi) {
212
224
  `Tags: ${tagStr}`,
213
225
  `Durability: ${durability}`,
214
226
  ].join("\n");
215
- return { content: [{ type: "text", text }], details: {} };
227
+ return { content: [{ type: "text", text }], details: { deduplicated: false, id: result.id } };
216
228
  }
217
229
  catch (err) {
218
230
  return errorResult(err, flair.url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tpsdev-ai/pi-flair",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Flair memory extension for pi — persistent memory access from within pi sessions",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "node": ">=18"
22
22
  },
23
23
  "dependencies": {
24
- "@tpsdev-ai/flair-client": "0.9.0",
24
+ "@tpsdev-ai/flair-client": "0.10.0",
25
25
  "@sinclair/typebox": "0.34.48"
26
26
  },
27
27
  "license": "Apache-2.0",