From 47612bc14e45f2380da936b700fb3f6904514e56 Mon Sep 17 00:00:00 2001 From: rUv Date: Mon, 28 Jul 2025 18:59:08 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Alpha.74:=20SQLite=20&=20Async/A?= =?UTF-8?q?wait=20Fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ TECHNICAL FIXES - Fixed SQLite loading in sqlite-wrapper.js - now properly loads better-sqlite3 - Fixed async/await in hive-mind sessions command - no more forEach errors - Fixed async/await in session-manager getActiveSessionsWithProcessInfo - Reordered SQLite loading to try CommonJS require first (more reliable) 🔧 VERSION UPDATES - package.json: 2.0.0-alpha.74 - bin/claude-flow: 2.0.0-alpha.74 - src/cli/help-text.js: 2.0.0-alpha.74 - Updated help text to reflect alpha.74 fixes 🐛 BUGS FIXED - 'sessions.forEach is not a function' error resolved - SQLite not available fallback fixed - now properly uses persistent storage - Hive-mind sessions command now displays all active sessions correctly 🎯 Key Achievement: Hive-mind persistence and reliability improvements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- bin/claude-flow | 2 +- claude-flow-wiki | 2 +- package.json | 2 +- src/cli/help-text.js | 4 +-- src/cli/simple-commands/hive-mind.js | 2 +- .../hive-mind/session-manager.js | 4 +-- src/memory/sqlite-wrapper.js | 33 ++++++++----------- 7 files changed, 22 insertions(+), 27 deletions(-) diff --git a/bin/claude-flow b/bin/claude-flow index ee567af4ed..0cf2f5603c 100755 --- a/bin/claude-flow +++ b/bin/claude-flow @@ -1,7 +1,7 @@ #!/bin/sh # Claude-Flow Smart Dispatcher - Detects and uses the best available runtime -VERSION="2.0.0-alpha.73" +VERSION="2.0.0-alpha.74" # Determine the correct path based on how the script is invoked if [ -L "$0" ]; then diff --git a/claude-flow-wiki b/claude-flow-wiki index 86fa2a5876..6c8650f78d 160000 --- a/claude-flow-wiki +++ b/claude-flow-wiki @@ -1 +1 @@ -Subproject commit 86fa2a5876939e7a4f4fd2d61eeba7e1d746516e +Subproject commit 6c8650f78d10ca8eb7815265cf8eb3cf1ebf7da9 diff --git a/package.json b/package.json index 7bd4eaa9bb..15a27aaf65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "claude-flow", - "version": "2.0.0-alpha.73", + "version": "2.0.0-alpha.74", "description": "Enterprise-grade AI agent orchestration with ruv-swarm integration (Alpha Release)", "main": "cli.mjs", "bin": { diff --git a/src/cli/help-text.js b/src/cli/help-text.js index d7c07fb9bc..273bae669a 100644 --- a/src/cli/help-text.js +++ b/src/cli/help-text.js @@ -5,14 +5,14 @@ import { HelpFormatter } from './help-formatter.js'; -export const VERSION = '2.0.0-alpha.73'; +export const VERSION = '2.0.0-alpha.74'; export const MAIN_HELP = ` 🌊 Claude-Flow v${VERSION} - Enterprise-Grade AI Agent Orchestration Platform 🎯 ENTERPRISE FEATURES: Complete ruv-swarm integration with 87 MCP tools, neural networking, and production-ready infrastructure 🐝 NEW: Advanced Hive Mind System with Queen-led coordination, collective intelligence, and unlimited scaling -⚡ ALPHA 73: Complete 64-agent system with swarm coordination, enhanced CLAUDE.md integration, and optimized init system +⚡ ALPHA 74: Fixed SQLite loading & hive-mind sessions, async/await corrections for better reliability USAGE: claude-flow [options] diff --git a/src/cli/simple-commands/hive-mind.js b/src/cli/simple-commands/hive-mind.js index de33ee8d9c..8880cc2a48 100644 --- a/src/cli/simple-commands/hive-mind.js +++ b/src/cli/simple-commands/hive-mind.js @@ -2420,7 +2420,7 @@ function getWorkerTypeInstructions(workerType) { async function showSessions(flags) { try { const sessionManager = new HiveMindSessionManager(); - const sessions = sessionManager.getActiveSessions(); + const sessions = await sessionManager.getActiveSessions(); if (sessions.length === 0) { console.log(chalk.gray('No active or paused sessions found')); diff --git a/src/cli/simple-commands/hive-mind/session-manager.js b/src/cli/simple-commands/hive-mind/session-manager.js index 888f283302..f227218f13 100644 --- a/src/cli/simple-commands/hive-mind/session-manager.js +++ b/src/cli/simple-commands/hive-mind/session-manager.js @@ -925,8 +925,8 @@ To enable persistence, see: https://github.com/ruvnet/claude-code-flow/docs/wind /** * Get active sessions with process information */ - getActiveSessionsWithProcessInfo() { - const sessions = this.getActiveSessions(); + async getActiveSessionsWithProcessInfo() { + const sessions = await this.getActiveSessions(); // Add process info to each session return sessions.map((session) => { diff --git a/src/memory/sqlite-wrapper.js b/src/memory/sqlite-wrapper.js index 6962c14de7..f1fd9fbb47 100644 --- a/src/memory/sqlite-wrapper.js +++ b/src/memory/sqlite-wrapper.js @@ -17,27 +17,22 @@ let loadError = null; /** * Try to load better-sqlite3 with comprehensive error handling */ -function tryLoadSQLite() { +async function tryLoadSQLite() { try { - // Try ES module import - const module = import('better-sqlite3'); - return module.then(m => { - Database = m.default; + // Try CommonJS require first (more reliable in Node.js) + const require = createRequire(import.meta.url); + Database = require('better-sqlite3'); + sqliteAvailable = true; + return true; + } catch (requireErr) { + // Fallback to ES module import + try { + const module = await import('better-sqlite3'); + Database = module.default; sqliteAvailable = true; return true; - }).catch(err => { - loadError = err; - return false; - }); - } catch (err) { - // Fallback to CommonJS require - try { - const require = createRequire(import.meta.url); - Database = require('better-sqlite3'); - sqliteAvailable = true; - return Promise.resolve(true); - } catch (requireErr) { - loadError = requireErr; + } catch (importErr) { + loadError = importErr; // Check for specific Windows errors if (requireErr.message.includes('was compiled against a different Node.js version') || @@ -72,7 +67,7 @@ function tryLoadSQLite() { `); } - return Promise.resolve(false); + return false; } } }