claude-flow 2.7.19 → 2.7.21

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.
@@ -95,7 +95,12 @@ export async function initializeReasoningBank() {
95
95
  * - confidence -> confidence score
96
96
  */
97
97
  export async function storeMemory(key, value, options = {}) {
98
- await ensureInitialized();
98
+ const initialized = await ensureInitialized();
99
+
100
+ // If initialization failed, throw with clear message
101
+ if (!initialized) {
102
+ throw new Error('ReasoningBank not available (better-sqlite3 missing). Use JSON mode instead.');
103
+ }
99
104
 
100
105
  try {
101
106
  const memoryId = options.id || uuidv4();
@@ -159,7 +164,12 @@ export async function queryMemories(searchQuery, options = {}) {
159
164
  return cached;
160
165
  }
161
166
 
162
- await ensureInitialized();
167
+ const initialized = await ensureInitialized();
168
+
169
+ // If initialization failed, return empty results
170
+ if (!initialized) {
171
+ return [];
172
+ }
163
173
  const limit = options.limit || 10;
164
174
  // Accept both 'namespace' and 'domain' for compatibility
165
175
  const namespace = options.namespace || options.domain || 'default';
@@ -247,7 +257,12 @@ export async function queryMemories(searchQuery, options = {}) {
247
257
  * List all memories (using Node.js backend database query)
248
258
  */
249
259
  export async function listMemories(options = {}) {
250
- await ensureInitialized();
260
+ const initialized = await ensureInitialized();
261
+
262
+ // If initialization failed, return empty list
263
+ if (!initialized) {
264
+ return [];
265
+ }
251
266
  const limit = options.limit || 10;
252
267
  const namespace = options.namespace;
253
268
 
@@ -284,7 +299,18 @@ export async function listMemories(options = {}) {
284
299
  * Get ReasoningBank statistics (Node.js backend)
285
300
  */
286
301
  export async function getStatus() {
287
- await ensureInitialized();
302
+ const initialized = await ensureInitialized();
303
+
304
+ // If initialization failed, return error status
305
+ if (!initialized) {
306
+ return {
307
+ total_memories: 0,
308
+ total_categories: 0,
309
+ storage_backend: 'Unavailable',
310
+ error: 'ReasoningBank initialization failed (better-sqlite3 not available)',
311
+ fallback_available: true
312
+ };
313
+ }
288
314
 
289
315
  try {
290
316
  const db = ReasoningBank.db.getDb();