@tpsdev-ai/flair-mcp 0.46.0 → 0.47.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.
Files changed (2) hide show
  1. package/dist/continuity.js +30 -16
  2. package/package.json +2 -2
@@ -316,17 +316,29 @@ export function buildJournalRow(agentId, state, plan, now = new Date()) {
316
316
  createdAt: now.toISOString(),
317
317
  };
318
318
  }
319
- function searchConditions(agentId, extra, limit) {
320
- return {
321
- operator: "and",
322
- conditions: [
323
- { search_attribute: "agentId", search_type: "equals", search_value: agentId },
324
- { search_attribute: "durability", search_type: "equals", search_value: "ephemeral" },
325
- ...extra,
326
- ],
327
- get_attributes: ["*"],
328
- limit,
329
- };
319
+ /**
320
+ * Fetch this agent's own ephemeral rows through the SUPPORTED read surface —
321
+ * `GET /Memory?agentId=<id>` (the same verb the REM nightly runner's snapshot
322
+ * step uses) — then filter client-side.
323
+ *
324
+ * This replaces the original `POST /Memory/search_by_conditions` read
325
+ * (flair#1257 slice 3 fix): search_by_conditions is an ops-API operation, and
326
+ * the Memory resource exposes no REST handler for that path — the POST 405s
327
+ * ("does not have a post method... /Memory/search_by_conditions"), verified
328
+ * against a real Harper in test/integration/continuity-rem-promotion-1257.
329
+ * Because discoverResume fails open by design, that 405 didn't error — it
330
+ * silently made EVERY resume come back empty (no hint, ever): the fail-open
331
+ * masked a dead read path, exactly the "unrun check looks like a pass" shape.
332
+ *
333
+ * The client-side filters mirror what the old conditions asked the server
334
+ * for: own agentId (the GET's query param is NOT an owner filter — the read
335
+ * scope returns other agents' non-private rows too; journal rows are private
336
+ * so only our own arrive, but the filter must not lean on that) and
337
+ * durability "ephemeral".
338
+ */
339
+ async function fetchOwnEphemeralRows(client, agentId) {
340
+ const raw = await client.request("GET", `/Memory?agentId=${encodeURIComponent(agentId)}`);
341
+ return rowsFrom(raw).filter((r) => r.agentId === agentId && r.durability === "ephemeral");
330
342
  }
331
343
  function rowsFrom(result) {
332
344
  if (Array.isArray(result))
@@ -397,15 +409,17 @@ function seqOrder(a, b) {
397
409
  export async function discoverResume(client, agentId, pointer, now = new Date()) {
398
410
  try {
399
411
  if (pointer) {
400
- const body = searchConditions(agentId, [{ search_attribute: "tags", search_type: "contains", search_value: continuityTag(pointer.sessionId) }], RESUME_SEARCH_LIMIT);
401
- const rows = rowsFrom(await client.request("POST", "/Memory/search_by_conditions", body)).filter((r) => isLive(r, now));
412
+ const priorTag = continuityTag(pointer.sessionId);
413
+ const rows = (await fetchOwnEphemeralRows(client, agentId))
414
+ .filter((r) => Array.isArray(r.tags) && r.tags.includes(priorTag))
415
+ .filter((r) => isLive(r, now));
402
416
  const entries = rows.map(toEntry).sort(seqOrder).slice(0, RESUME_SEARCH_LIMIT);
403
417
  return { entries, sessionId: entries.length > 0 ? pointer.sessionId : null };
404
418
  }
405
- const body = searchConditions(agentId, [], FALLBACK_SEARCH_LIMIT);
406
- const rows = rowsFrom(await client.request("POST", "/Memory/search_by_conditions", body))
419
+ const rows = (await fetchOwnEphemeralRows(client, agentId))
407
420
  .filter((r) => isLive(r, now))
408
- .filter((r) => continuitySessionOf(r) !== null);
421
+ .filter((r) => continuitySessionOf(r) !== null)
422
+ .slice(0, FALLBACK_SEARCH_LIMIT);
409
423
  const groups = new Map();
410
424
  for (const row of rows) {
411
425
  const entry = toEntry(row);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tpsdev-ai/flair-mcp",
3
- "version": "0.46.0",
3
+ "version": "0.47.0",
4
4
  "description": "MCP server for Flair — persistent memory for Claude Code, Cursor, and any MCP client.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@modelcontextprotocol/sdk": "1.27.1",
31
- "@tpsdev-ai/flair-client": "0.46.0",
31
+ "@tpsdev-ai/flair-client": "0.47.0",
32
32
  "zod": "4.3.6"
33
33
  },
34
34
  "license": "Apache-2.0",