claude-flow 3.53.0 → 3.54.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.
Files changed (39) hide show
  1. package/.claude/helpers/hook-handler.cjs +88 -6
  2. package/.claude/helpers/intelligence.cjs +104 -2
  3. package/README.md +141 -44
  4. package/package.json +3 -2
  5. package/v3/@claude-flow/cli/README.md +141 -44
  6. package/v3/@claude-flow/cli/catalog-manifest.json +2 -2
  7. package/v3/@claude-flow/cli/dist/src/blocking-stdio.d.ts +11 -0
  8. package/v3/@claude-flow/cli/dist/src/blocking-stdio.js +23 -0
  9. package/v3/@claude-flow/cli/dist/src/commands/memory.js +9 -1
  10. package/v3/@claude-flow/cli/dist/src/commands/session.js +11 -37
  11. package/v3/@claude-flow/cli/dist/src/index.js +3 -0
  12. package/v3/@claude-flow/cli/dist/src/init/executor.js +1 -0
  13. package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +65 -3
  14. package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +13 -1
  15. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +1 -1
  16. package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.js +4 -1
  17. package/v3/@claude-flow/cli/dist/src/memory/embedding-q8.d.ts +19 -0
  18. package/v3/@claude-flow/cli/dist/src/memory/embedding-q8.js +38 -0
  19. package/v3/@claude-flow/cli/dist/src/memory/graph-edge-writer.js +3 -2
  20. package/v3/@claude-flow/cli/dist/src/memory/lucene-bm25.js +11 -19
  21. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.d.ts +8 -0
  22. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +21 -2
  23. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +5 -0
  24. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +12 -5
  25. package/v3/@claude-flow/cli/dist/src/memory/shared-sqlite.d.ts +7 -0
  26. package/v3/@claude-flow/cli/dist/src/memory/shared-sqlite.js +45 -0
  27. package/v3/@claude-flow/cli/dist/src/mods/probe.d.ts +7 -0
  28. package/v3/@claude-flow/cli/dist/src/mods/probe.js +29 -1
  29. package/v3/@claude-flow/cli/dist/src/production/monitoring.d.ts +2 -0
  30. package/v3/@claude-flow/cli/dist/src/production/monitoring.js +8 -3
  31. package/v3/@claude-flow/cli/dist/src/production/rate-limiter.js +8 -5
  32. package/v3/@claude-flow/cli/dist/src/production/retry.js +2 -0
  33. package/v3/@claude-flow/cli/dist/src/services/git-workspace-identity.js +20 -3
  34. package/v3/@claude-flow/cli/dist/src/services/worker-queue.d.ts +1 -0
  35. package/v3/@claude-flow/cli/dist/src/services/worker-queue.js +9 -1
  36. package/v3/@claude-flow/cli/package.json +2 -2
  37. package/v3/@claude-flow/shared/dist/events/event-store.js +5 -2
  38. package/v3/@claude-flow/shared/dist/events/event-store.test.js +20 -0
  39. package/v3/@claude-flow/shared/package.json +1 -1
@@ -162,6 +162,7 @@ export class WorkerQueue extends EventEmitter {
162
162
  workerId;
163
163
  heartbeatTimer;
164
164
  processingTasks = new Set();
165
+ retryTimers = new Set();
165
166
  isShuttingDown = false;
166
167
  maxConcurrent = 1;
167
168
  initialized = false;
@@ -286,10 +287,13 @@ export class WorkerQueue extends EventEmitter {
286
287
  this.store.setTask(taskId, task);
287
288
  // Re-queue with delay (exponential backoff)
288
289
  const delay = Math.min(30000, 1000 * Math.pow(2, task.retryCount));
289
- setTimeout(() => {
290
+ // Tracked so shutdown() can release it
291
+ const timer = setTimeout(() => {
292
+ this.retryTimers.delete(timer);
290
293
  const queueName = this.getQueueName(task.workerType);
291
294
  this.store.pushToQueue(queueName, taskId, PRIORITY_SCORES[task.priority]);
292
295
  }, delay);
296
+ this.retryTimers.add(timer);
293
297
  this.emit('taskRetrying', { taskId, retryCount: task.retryCount, delay });
294
298
  }
295
299
  else {
@@ -469,6 +473,10 @@ export class WorkerQueue extends EventEmitter {
469
473
  for (const taskId of this.processingTasks) {
470
474
  await this.fail(taskId, 'Worker shutdown', false);
471
475
  }
476
+ // Release scheduled retry timers (they would hold the process open)
477
+ for (const timer of this.retryTimers)
478
+ clearTimeout(timer);
479
+ this.retryTimers.clear();
472
480
  // Stop store cleanup
473
481
  this.store.stopCleanup();
474
482
  await this.unregisterWorker();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.53.0",
3
+ "version": "3.54.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",
@@ -104,7 +104,7 @@
104
104
  "@claude-flow/neural": "3.0.0",
105
105
  "@claude-flow/plugin-agent-federation": "1.0.0",
106
106
  "@claude-flow/security": "3.0.1",
107
- "@claude-flow/shared": "3.0.0",
107
+ "@claude-flow/shared": "3.0.1",
108
108
  "@iarna/toml": "^2.2.5",
109
109
  "@noble/ed25519": "2.3.0",
110
110
  "@ruvector/rabitq-wasm": "0.1.0",
@@ -281,9 +281,12 @@ export class EventStore extends EventEmitter {
281
281
  async getSnapshot(aggregateId) {
282
282
  this.ensureInitialized();
283
283
  const stmt = this.db.prepare('SELECT * FROM snapshots WHERE aggregate_id = ? ORDER BY version DESC LIMIT 1');
284
- const row = stmt.getAsObject([aggregateId]);
284
+ stmt.bind([aggregateId]);
285
+ // sql.js getAsObject() yields undefined-valued column keys when no row matched,
286
+ // so step first and treat absence explicitly.
287
+ const row = stmt.step() ? stmt.getAsObject() : null;
285
288
  stmt.free();
286
- if (!row || Object.keys(row).length === 0) {
289
+ if (!row) {
287
290
  return null;
288
291
  }
289
292
  return {
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import { describe, it, expect, beforeEach, afterEach } from 'vitest';
8
8
  import { EventStore } from './event-store.js';
9
+ import { StateReconstructor, TaskAggregate } from './state-reconstructor.js';
9
10
  import { AgentStateProjection, TaskHistoryProjection, MemoryIndexProjection } from './projections.js';
10
11
  import { createAgentSpawnedEvent, createAgentStartedEvent, createAgentTaskAssignedEvent, createAgentTaskCompletedEvent, createTaskCreatedEvent, createTaskStartedEvent, createTaskCompletedEvent, createMemoryStoredEvent, createMemoryRetrievedEvent, createMemoryDeletedEvent, } from './domain-events.js';
11
12
  describe('EventStore', () => {
@@ -157,6 +158,25 @@ describe('EventStore', () => {
157
158
  const retrieved = await eventStore.getSnapshot('agent-1');
158
159
  expect(retrieved?.version).toBe(10);
159
160
  });
161
+ it('should return null when no snapshot exists for the aggregate', async () => {
162
+ await expect(eventStore.getSnapshot('missing')).resolves.toBeNull();
163
+ });
164
+ it('should return null for an unknown aggregate when other snapshots exist', async () => {
165
+ await eventStore.saveSnapshot({
166
+ aggregateId: 'agent-1',
167
+ aggregateType: 'agent',
168
+ version: 1,
169
+ state: {},
170
+ timestamp: Date.now(),
171
+ });
172
+ await expect(eventStore.getSnapshot('other')).resolves.toBeNull();
173
+ });
174
+ it('should reconstruct from the event log when no snapshot exists', async () => {
175
+ await eventStore.append(createTaskCreatedEvent('task-1', 'impl', 'Write code', 'desc', 'normal', []));
176
+ const reconstructor = new StateReconstructor(eventStore);
177
+ const task = await reconstructor.reconstruct('task-1', (id) => new TaskAggregate(id));
178
+ expect(task.version).toBe(1);
179
+ });
160
180
  });
161
181
  describe('Statistics', () => {
162
182
  it('should provide event store statistics', async () => {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/shared",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "type": "module",
5
5
  "description": "Shared module - common types, events, utilities, core interfaces",
6
6
  "main": "dist/index.js",