@claude-flow/cli 3.38.0 → 3.38.1

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,6 +1,6 @@
1
1
  {
2
2
  "manifest": {
3
- "version": "3.38.0",
3
+ "version": "3.38.1",
4
4
  "files": {
5
5
  "auto-memory-hook.mjs": "85fe05c757421c52137c0bc8545a0896bab6b4714538c2a11d1d0835bfcc8c1c",
6
6
  "hook-handler.cjs": "dae295fb9ae2626b89899c19a20cc911541af82b52d2eeb9b214d618b96e9a86",
@@ -8,6 +8,6 @@
8
8
  "statusline.cjs": "0457fe53f8cd2c56458ff178392536a5868efd1a573665fa43bc01d2d95ca677"
9
9
  }
10
10
  },
11
- "signature": "KDmhF8M4Fz1bTODUCbObwx77UqNUnPWCiF/k/TrpKlga0vFmu0Ax1k/JAPKLi5LmVvtZBpl1NWKm+SHnavP+Cg==",
11
+ "signature": "TN6Fpt7mR59UgYj2KM7wxDSHnm16eeq2BlouGa8YAxI+ZbrePbCpIUfUMNhED5vSbEPJhRvbiMnfO5JsYI8CBA==",
12
12
  "algorithm": "ed25519"
13
13
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "generation": 4,
4
- "generatedAt": "2026-08-11T22:42:24.276Z",
5
- "gitSha": "6b01dc5a",
4
+ "generatedAt": "2026-08-12T14:05:18.962Z",
5
+ "gitSha": "b8c37da8",
6
6
  "catalog": {
7
7
  "agents": 164,
8
8
  "tools": 397,
@@ -214,7 +214,15 @@ const storeCommand = {
214
214
  ]
215
215
  });
216
216
  output.writeln();
217
- output.printSuccess('Data stored successfully');
217
+ if (result.persistWarning) {
218
+ // #2968: the write ran, but the checkpoint signal indicates it may
219
+ // not have reached disk (sql.js fallback driver) — do not print an
220
+ // unconditional green success for a write that might vanish.
221
+ output.printWarning(`Data stored, but persistence is not guaranteed: ${result.persistWarning}`);
222
+ }
223
+ else {
224
+ output.printSuccess('Data stored successfully');
225
+ }
218
226
  return { success: true, data: { ...storeData, id: result.id, embedding: result.embedding, provenanceType: provenance || 'unknown' } };
219
227
  }
220
228
  catch (error) {
@@ -67,6 +67,13 @@ export declare function bridgeStoreEntry(options: {
67
67
  cached?: boolean;
68
68
  attested?: boolean;
69
69
  error?: string;
70
+ /** #2968: set when the post-write checkpoint failed in a way that
71
+ * indicates this connection may not durably persist writes at all
72
+ * (the sql.js fallback driver, engaged when better-sqlite3's native
73
+ * binding is missing). The write above still ran and `success` is
74
+ * still true — this is advisory, not a failure — but callers should
75
+ * surface it instead of only printing an unconditional success message. */
76
+ persistWarning?: string;
70
77
  } | null>;
71
78
  /**
72
79
  * Search entries via AgentDB v3.
@@ -897,12 +897,27 @@ export async function bridgeStoreEntry(options) {
897
897
  // `sqlite3` vector count) then see a stale/empty main DB file and report
898
898
  // "0 vectors" / empty search. A PASSIVE checkpoint flushes committed pages
899
899
  // into the main file without blocking writers. Best-effort, never fatal.
900
+ let persistWarning;
900
901
  try {
901
902
  if (typeof ctx.db.pragma === 'function') {
902
903
  ctx.db.pragma('wal_checkpoint(PASSIVE)');
903
904
  }
904
905
  }
905
- catch { /* non-WAL, busy, or unsupported — non-fatal */ }
906
+ catch (checkpointErr) {
907
+ // #2968: on the sql.js fallback driver (engaged when better-sqlite3's
908
+ // native binding never got built — e.g. a skipped optionalDependency
909
+ // postinstall), this PRAGMA isn't implemented and throws "Invalid
910
+ // PRAGMA command". sql.js has no WAL journal to checkpoint at all, so
911
+ // this specific failure is the strongest signal available here that
912
+ // the insert above may exist only in this process's in-memory image
913
+ // and never reach disk — not the ordinary "non-WAL, busy, or
914
+ // unsupported" case the old blanket catch assumed. Surface it rather
915
+ // than swallow it silently; other pragma failures stay non-fatal.
916
+ const msg = checkpointErr instanceof Error ? checkpointErr.message : String(checkpointErr);
917
+ if (/Invalid PRAGMA/i.test(msg)) {
918
+ persistWarning = `sql.js fallback driver in use — this write may not be durably persisted to disk (${msg}). Install better-sqlite3's native binding to restore durable writes (see issue #2968: npm rebuild better-sqlite3, or reinstall with install scripts enabled).`;
919
+ }
920
+ }
906
921
  // Phase 2: Write-through to TieredCache
907
922
  const safeNs = String(namespace).replace(/:/g, '_');
908
923
  const safeKey = String(key).replace(/:/g, '_');
@@ -918,6 +933,7 @@ export async function bridgeStoreEntry(options) {
918
933
  guarded: true,
919
934
  cached: true,
920
935
  attested: true,
936
+ ...(persistWarning ? { persistWarning } : {}),
921
937
  };
922
938
  }
923
939
  catch (err) {
@@ -995,10 +1011,17 @@ export async function bridgeSearchEntries(options) {
995
1011
  const whereExtra = filters.length > 0 ? `AND ${filters.join(' AND ')}` : '';
996
1012
  let rows;
997
1013
  try {
1014
+ // #2982/#2976: this pre-rank SELECT truncates the corpus to 1000 rows
1015
+ // before BM25/embedding scoring runs. Without ORDER BY, SQLite returns
1016
+ // rows in arbitrary storage order (effectively oldest-inserted-first at
1017
+ // scale), so on any corpus over 1000 entries the newest — and often
1018
+ // most relevant — rows never reach scoring at all. bridgeListEntries()
1019
+ // already orders by updated_at DESC for the same reason; mirror it here.
998
1020
  const stmt = ctx.db.prepare(`
999
1021
  SELECT id, key, namespace, content, embedding, provenance_type
1000
1022
  FROM memory_entries
1001
1023
  WHERE ${ACTIVE_MEMORY_ROW_SQL} ${whereExtra}
1024
+ ORDER BY updated_at DESC
1002
1025
  LIMIT 1000
1003
1026
  `);
1004
1027
  rows = filterParams.length > 0 ? stmt.all(...filterParams) : stmt.all();
@@ -1506,10 +1529,14 @@ export async function bridgeSearchHNSW(queryEmbedding, options, dbPath) {
1506
1529
  : '';
1507
1530
  let rows;
1508
1531
  try {
1532
+ // #2982/#2976: same unordered pre-rank truncation as bridgeSearchEntries
1533
+ // above — without ORDER BY, a corpus over 10000 rows silently drops
1534
+ // its newest entries before cosine scoring ever runs.
1509
1535
  const stmt = ctx.db.prepare(`
1510
1536
  SELECT id, key, namespace, content, embedding
1511
1537
  FROM memory_entries
1512
1538
  WHERE status = 'active' AND embedding IS NOT NULL ${nsFilter}
1539
+ ORDER BY updated_at DESC
1513
1540
  LIMIT 10000
1514
1541
  `);
1515
1542
  rows = nsFilter
@@ -448,6 +448,9 @@ export declare function storeEntry(options: {
448
448
  model: string;
449
449
  };
450
450
  error?: string;
451
+ /** #2968: set when the bridge's checkpoint failed in a way indicating
452
+ * this write may not be durably persisted (sql.js fallback driver). */
453
+ persistWarning?: string;
451
454
  }>;
452
455
  /**
453
456
  * Search entries using sql.js with vector similarity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.38.0",
3
+ "version": "3.38.1",
4
4
  "type": "module",
5
5
  "description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",