@claude-flow/cli 3.38.16 → 3.38.17

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
- 3.38.16
1
+ 3.38.17
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest": {
3
- "version": "3.38.16",
3
+ "version": "3.38.17",
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": "tCBMWmBF0zwHs1qr6DI4NOA8sRANDvRz6ppOd2gnArv90A+CHGz8cxWRcPmomaBltVq9Vf5hHGp9E9pJcF43Ag==",
11
+ "signature": "SnoY7oCUMCVY/5J08WhgssI7rMxRtY60uNt/pW7HhMe8d43JfaUBSAazjQ31EOuE4/UWLBvx5ibHDjLiyZhADg==",
12
12
  "algorithm": "ed25519"
13
13
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "generation": 5,
4
- "generatedAt": "2026-08-21T15:22:29.624Z",
5
- "gitSha": "5234333c",
4
+ "generatedAt": "2026-08-22T16:21:38.576Z",
5
+ "gitSha": "b5b12a75",
6
6
  "catalog": {
7
7
  "agents": 165,
8
8
  "tools": 397,
@@ -506,6 +506,134 @@ async function checkMemoryStructuralIntegrity() {
506
506
  catch { /* best-effort */ }
507
507
  }
508
508
  }
509
+ // #2968 option 1 — read-only doctor check for the active SQLite driver.
510
+ //
511
+ // Native better-sqlite3 (durable, WAL-capable) can silently degrade to the
512
+ // sql.js WASM fallback (non-durable — `wal_checkpoint` calls are rejected
513
+ // and the write is lost) when a postinstall script is skipped. `memory
514
+ // store` still printed "Data stored successfully" before the persistWarning
515
+ // fix in #2983/3.38.1 (see memory-store-persist-warning-2968.test.ts); this
516
+ // check gives a standing, read-only signal so the driver split is visible
517
+ // any time doctor runs, independent of any single store call.
518
+ //
519
+ // Table count in the on-disk memory.db is the cheap, reliable signal from
520
+ // the issue report: the native driver's schema produces 47 tables, the
521
+ // sql.js fallback's produces only 10. Deliberately does NOT change install
522
+ // behavior (that's option 2 from #2968, explicitly out of scope here) —
523
+ // this only reports, it never repairs.
524
+ const MEMORY_DRIVER_NATIVE_TABLE_FLOOR = 20; // roughly midpoint of sql.js's ~10 and native's ~47
525
+ async function checkMemoryPersistenceDriver() {
526
+ const NAME = 'Memory Persistence Driver';
527
+ const dbPath = await resolveMemoryDbPath();
528
+ if (!dbPath) {
529
+ return {
530
+ name: NAME,
531
+ status: 'warn',
532
+ message: 'no memory.db found (see Memory Database Presence above) — driver check skipped',
533
+ };
534
+ }
535
+ if (isMemoryDbEncryptedAtRest(dbPath)) {
536
+ return {
537
+ name: NAME,
538
+ status: 'warn',
539
+ message: `${dbPath} — RFE1-encrypted at rest; driver check can't run without decrypting (expected, not corruption)`,
540
+ };
541
+ }
542
+ let Database;
543
+ try {
544
+ Database = (await import('better-sqlite3')).default;
545
+ }
546
+ catch {
547
+ Database = null;
548
+ }
549
+ let tableCount = null;
550
+ let nativeUnavailableReason = null;
551
+ let nativeOpenOtherError = null;
552
+ if (Database) {
553
+ let db;
554
+ try {
555
+ db = new Database(dbPath, { readonly: true, fileMustExist: true });
556
+ }
557
+ catch (e) {
558
+ if (isNativeSqliteBindingUnavailable(e)) {
559
+ nativeUnavailableReason = (e.message || String(e)).split(/\r?\n/, 1)[0];
560
+ }
561
+ else {
562
+ nativeOpenOtherError = e.message || String(e);
563
+ }
564
+ db = null;
565
+ }
566
+ if (db) {
567
+ try {
568
+ const row = db.prepare("SELECT count(*) AS c FROM sqlite_master WHERE type='table'").get();
569
+ tableCount = Number(row?.c ?? 0);
570
+ }
571
+ catch {
572
+ // leave null — Memory Integrity above already reports open/query failures
573
+ }
574
+ finally {
575
+ try {
576
+ db.close();
577
+ }
578
+ catch { /* best-effort */ }
579
+ }
580
+ }
581
+ }
582
+ else {
583
+ nativeUnavailableReason = 'better-sqlite3 not installed';
584
+ }
585
+ // Fall back to sql.js purely to report table count when the native path
586
+ // couldn't — informational only, never used to claim durability.
587
+ if (tableCount === null && (nativeUnavailableReason || nativeOpenOtherError)) {
588
+ const sdb = await tryOpenSqlJs(dbPath);
589
+ if (sdb) {
590
+ try {
591
+ const res = sdb.exec("SELECT count(*) FROM sqlite_master WHERE type='table'");
592
+ tableCount = Number(res[0]?.values?.[0]?.[0] ?? 0);
593
+ }
594
+ catch {
595
+ // leave null
596
+ }
597
+ finally {
598
+ try {
599
+ sdb.close();
600
+ }
601
+ catch { /* best-effort */ }
602
+ }
603
+ }
604
+ }
605
+ const tableSummary = tableCount === null
606
+ ? 'table count unavailable'
607
+ : `${tableCount} tables (native schema ~47, sql.js-fallback schema ~10 — #2968)`;
608
+ if (nativeUnavailableReason) {
609
+ return {
610
+ name: NAME,
611
+ status: 'warn',
612
+ message: `${dbPath} — active driver: sql.js (WASM fallback, non-durable) — native better-sqlite3 binding unavailable: ${nativeUnavailableReason} — wal_checkpoint calls silently no-op, writes may not persist across processes (#2968/#2867/#2219) [${tableSummary}]`,
613
+ fix: 'reinstall with npm install scripts enabled, or run `npm rebuild better-sqlite3`; then rerun this check',
614
+ };
615
+ }
616
+ if (nativeOpenOtherError) {
617
+ return {
618
+ name: NAME,
619
+ status: 'warn',
620
+ message: `${dbPath} — native better-sqlite3 module loadable, but could not open this database (${nativeOpenOtherError}) — see Memory Integrity above for the corruption/encryption diagnosis [${tableSummary}]`,
621
+ };
622
+ }
623
+ if (tableCount !== null && tableCount < MEMORY_DRIVER_NATIVE_TABLE_FLOOR) {
624
+ return {
625
+ name: NAME,
626
+ status: 'warn',
627
+ message: `${dbPath} — active driver: native better-sqlite3, but this database has only ${tableCount} tables — that matches the sql.js-fallback schema shape (~10), not the native schema (~47); it was likely created before the native binding became available, and durable writes made before then may be missing`,
628
+ fix: 'back up .swarm/memory.db then `claude-flow memory init --force` to rebuild under the native driver',
629
+ };
630
+ }
631
+ return {
632
+ name: NAME,
633
+ status: 'pass',
634
+ message: `${dbPath} — active driver: native better-sqlite3 (durable, WAL-capable) [${tableSummary}]`,
635
+ };
636
+ }
509
637
  // Check 1 (--component memory, deep path) — #2737 part 2 strengthens this:
510
638
  // prefer native better-sqlite3 PRAGMA integrity_check (adds index↔table
511
639
  // cross-checking + UNIQUE verification that quick_check above deliberately
@@ -2220,6 +2348,7 @@ export const doctorCommand = {
2220
2348
  checkDaemonStatus,
2221
2349
  checkMemoryDatabase,
2222
2350
  checkMemoryStructuralIntegrity, // #2737 — bounded, native quick_check on every default run
2351
+ checkMemoryPersistenceDriver, // #2968 — native better-sqlite3 vs sql.js fallback, read-only
2223
2352
  checkLearningBridge, // #2545 — can the auto-memory hook actually load @claude-flow/memory?
2224
2353
  checkApiKeys,
2225
2354
  checkMcpServers,
@@ -2257,6 +2386,7 @@ export const doctorCommand = {
2257
2386
  'memory': [
2258
2387
  checkMemoryDatabase, // existing: exists + statable (unchanged)
2259
2388
  checkMemoryIntegrity, // #2677 check 1: sql.js open + PRAGMA integrity_check
2389
+ checkMemoryPersistenceDriver, // #2968: native better-sqlite3 vs sql.js fallback
2260
2390
  checkMemoryContent, // #2677 check 2: memory_entries content coverage
2261
2391
  checkMemoryEmbeddingCoverage, // #2677 check 3: vector coverage on populated rows
2262
2392
  checkMemoryReflexionCoverage, // #2677 check 6: episodes are retrievable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.38.16",
3
+ "version": "3.38.17",
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",