Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

🔖 Checkpoint: Edit /workspaces/claude-code-flow/src/cli/simple-commands/hive-mind/session-manager.js

rUv1c07221e4a87
diff --git a/.claude/checkpoints/1754356538.json b/.claude/checkpoints/1754356538.json
new file mode 100644
index 0000000000..382307231c
--- /dev/null
+++ b/.claude/checkpoints/1754356538.json
@@ -0,0 +1 @@
+{"branch": "checkpoint/pre-edit-20250805-011538", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/hive-mind/session-manager.js", "timestamp": "2025-08-05T01:15:38Z", "type": "pre-edit", "original_branch": "alpha-85"}
diff --git a/.claude/checkpoints/1754356540.json b/.claude/checkpoints/1754356540.json
new file mode 100644
index 0000000000..cf19fbcee6
--- /dev/null
+++ b/.claude/checkpoints/1754356540.json
@@ -0,0 +1 @@
+{"tag": "checkpoint-20250805-011540", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/hive-mind/session-manager.js", "timestamp": "2025-08-05T01:15:40Z", "type": "post-edit", "branch": "alpha-85", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/task-metrics.json | 6 +++--- .claude/checkpoints/1754356527.json | 1 + .claude/checkpoints/task-1754356527.json | 1 + claude-flow-wiki | 0 src/cli/simple-commands/hive-mind/session-manager.js | 10 +++++----- 6 files changed, 11 insertions(+), 9 deletions(-) "}
diff --git a/src/cli/simple-commands/hive-mind/session-manager.js b/src/cli/simple-commands/hive-mind/session-manager.js
index 86f0ccc0c2..b43b6ee9a1 100644
--- a/src/cli/simple-commands/hive-mind/session-manager.js
+++ b/src/cli/simple-commands/hive-mind/session-manager.js
@@ -42,7 +42,11 @@ export class HiveMindSessionManager {
}
this.db = await createDatabase(this.dbPath);
- this.initializeSchema();
+ if (this.db) {
+ this.initializeSchema();
+ } else {
+ throw new Error('Failed to create database instance');
+ }
} catch (error) {
console.error('Failed to create SQLite database:', error.message);
console.warn('Falling back to in-memory session storage');
@@ -94,6 +98,10 @@ To enable persistence, see: https://github.com/ruvnet/claude-code-flow/docs/wind
* Initialize database schema for sessions
*/
initializeSchema() {
+ if (!this.db) {
+ console.error('Database not initialized');
+ return;
+ }
// Create the base schema
this.db.exec(`
CREATE TABLE IF NOT EXISTS sessions (
@@ -141,6 +149,10 @@ To enable persistence, see: https://github.com/ruvnet/claude-code-flow/docs/wind
* Run database migrations
*/
runMigrations() {
+ if (!this.db) {
+ console.error('Database not initialized for migrations');
+ return;
+ }
try {
// Check if parent_pid column exists
const columns = this.db.prepare('PRAGMA table_info(sessions)').all();
@@ -651,7 +663,18 @@ To enable persistence, see: https://github.com/ruvnet/claude-code-flow/docs/wind
/**
* Get session logs
*/
- getSessionLogs(sessionId, limit = 100, offset = 0) {
+ async getSessionLogs(sessionId, limit = 100, offset = 0) {
+ await this.ensureInitialized();
+
+ if (this.isInMemory) {
+ // Use in-memory storage
+ const logs = this.memoryStore.logs.get(sessionId) || [];
+ return logs.slice(offset, offset + limit).map((log) => ({
+ ...log,
+ data: log.data ? sessionSerializer.deserializeLogData(log.data) : null,
+ }));
+ }
+
const stmt = this.db.prepare(`
SELECT * FROM session_logs
WHERE session_id = ?