claude-flow 3.5.54 → 3.5.56

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.
@@ -157,51 +157,12 @@ export const performanceTools = [
157
157
  deep: { type: 'boolean', description: 'Deep analysis' },
158
158
  },
159
159
  },
160
- handler: async (input) => {
161
- const deep = input.deep;
162
- const bottlenecks = [
163
- {
164
- component: 'memory',
165
- severity: 'medium',
166
- metric: 'heap_usage',
167
- current: 78,
168
- threshold: 80,
169
- impact: 'May cause GC pressure',
170
- suggestion: 'Consider increasing heap size or optimizing memory usage',
171
- },
172
- {
173
- component: 'neural',
174
- severity: 'low',
175
- metric: 'inference_latency',
176
- current: 45,
177
- threshold: 100,
178
- impact: 'Within acceptable range',
179
- suggestion: 'Enable Flash Attention for further optimization',
180
- },
181
- ];
182
- if (deep) {
183
- bottlenecks.push({
184
- component: 'database',
185
- severity: 'low',
186
- metric: 'query_time',
187
- current: 15,
188
- threshold: 50,
189
- impact: 'Queries performing well',
190
- suggestion: 'Consider adding indexes for frequently accessed patterns',
191
- });
192
- }
193
- const criticalCount = bottlenecks.filter(b => b.severity === 'critical').length;
194
- const warningCount = bottlenecks.filter(b => b.severity === 'medium').length;
160
+ handler: async (_input) => {
195
161
  return {
196
- status: criticalCount > 0 ? 'critical' : warningCount > 0 ? 'warning' : 'healthy',
197
- bottlenecks,
198
- summary: {
199
- total: bottlenecks.length,
200
- critical: criticalCount,
201
- warning: warningCount,
202
- info: bottlenecks.filter(b => b.severity === 'low').length,
203
- },
204
- analyzedAt: new Date().toISOString(),
162
+ success: true,
163
+ _stub: true,
164
+ message: 'Bottleneck detection not yet implemented. Use system_metrics for real CPU/memory data.',
165
+ bottlenecks: [],
205
166
  };
206
167
  },
207
168
  },
@@ -340,32 +301,12 @@ export const performanceTools = [
340
301
  sampleRate: { type: 'number', description: 'Sampling rate' },
341
302
  },
342
303
  },
343
- handler: async (input) => {
344
- const target = input.target || 'all';
345
- const duration = input.duration || 5;
346
- // Simulate profiling
347
- await new Promise(resolve => setTimeout(resolve, 100));
304
+ handler: async (_input) => {
348
305
  return {
349
- target,
350
- duration: `${duration}s`,
351
- samples: Math.floor(duration * 100),
352
- hotspots: [
353
- { function: 'vectorSearch', time: '35%', calls: 1500 },
354
- { function: 'embedText', time: '25%', calls: 800 },
355
- { function: 'agentCoordinate', time: '15%', calls: 200 },
356
- { function: 'memoryStore', time: '10%', calls: 500 },
357
- { function: 'other', time: '15%', calls: 3000 },
358
- ],
359
- memory: {
360
- peakHeap: '256MB',
361
- avgHeap: '180MB',
362
- gcPauses: 5,
363
- gcTime: '50ms',
364
- },
365
- recommendations: [
366
- 'vectorSearch: Consider batch processing for bulk operations',
367
- 'embedText: Enable caching for repeated queries',
368
- ],
306
+ success: true,
307
+ _stub: true,
308
+ message: 'Profiling not yet implemented. Use performance_benchmark for real micro-benchmarks.',
309
+ hotspots: [],
369
310
  };
370
311
  },
371
312
  },
@@ -380,48 +321,12 @@ export const performanceTools = [
380
321
  aggressive: { type: 'boolean', description: 'Apply aggressive optimizations' },
381
322
  },
382
323
  },
383
- handler: async (input) => {
384
- const target = input.target || 'all';
385
- const aggressive = input.aggressive;
386
- const optimizations = {
387
- memory: [
388
- 'Enabled Int8 quantization (3.92x compression)',
389
- 'Activated gradient checkpointing',
390
- 'Configured memory pooling',
391
- ],
392
- latency: [
393
- 'Enabled response caching (95% hit rate)',
394
- 'Activated batch processing',
395
- 'Configured connection pooling',
396
- ],
397
- throughput: [
398
- 'Enabled parallel processing',
399
- 'Configured worker pool (4 workers)',
400
- 'Activated request pipelining',
401
- ],
402
- };
403
- const applied = [];
404
- if (target === 'all') {
405
- Object.values(optimizations).forEach(opts => applied.push(...opts));
406
- }
407
- else {
408
- applied.push(...(optimizations[target] || []));
409
- }
410
- if (aggressive) {
411
- applied.push('Enabled aggressive GC');
412
- applied.push('Activated speculative execution');
413
- }
324
+ handler: async (_input) => {
414
325
  return {
415
- target,
416
- aggressive,
417
- applied,
418
- improvements: {
419
- memory: '-50%',
420
- latency: '-40%',
421
- throughput: '+60%',
422
- },
423
- status: 'optimized',
424
- timestamp: new Date().toISOString(),
326
+ success: true,
327
+ _stub: true,
328
+ message: 'Automatic optimization not yet implemented. No changes were made.',
329
+ optimizations: [],
425
330
  };
426
331
  },
427
332
  },
@@ -171,12 +171,34 @@ export const sessionTools = [
171
171
  }
172
172
  }
173
173
  if (session) {
174
- // Restore data to respective stores
174
+ // Restore data to respective stores (legacy JSON for backward compat)
175
175
  if (session.data?.memory) {
176
176
  const memoryDir = join(getProjectCwd(), STORAGE_DIR, 'memory');
177
177
  if (!existsSync(memoryDir))
178
178
  mkdirSync(memoryDir, { recursive: true });
179
179
  writeFileSync(join(memoryDir, 'store.json'), JSON.stringify(session.data.memory, null, 2), 'utf-8');
180
+ // Also populate active sql.js SQLite database so memory-tools can find entries
181
+ try {
182
+ const { storeEntry } = await import('../memory/memory-initializer.js');
183
+ const memoryData = session.data.memory;
184
+ if (memoryData.entries) {
185
+ for (const entry of Object.values(memoryData.entries)) {
186
+ const key = entry.key || entry.id || '';
187
+ const value = entry.value || entry.content || '';
188
+ if (key && value) {
189
+ await storeEntry({
190
+ key,
191
+ value,
192
+ namespace: entry.namespace || 'restored',
193
+ upsert: true,
194
+ });
195
+ }
196
+ }
197
+ }
198
+ }
199
+ catch {
200
+ // Legacy JSON restore is the fallback -- sql.js import may not be available
201
+ }
180
202
  }
181
203
  if (session.data?.tasks) {
182
204
  const taskDir = join(getProjectCwd(), STORAGE_DIR, 'tasks');
@@ -92,9 +92,9 @@ export const systemTools = [
92
92
  version: PKG_VERSION,
93
93
  components: {
94
94
  swarm: { status: 'running', health: metrics.health },
95
- memory: { status: 'running', health: 0.95 },
96
- neural: { status: 'running', health: 0.90 },
97
- mcp: { status: 'running', health: 1.0 },
95
+ memory: { status: 'unknown', _note: 'Health not measured — use system_health for real checks' },
96
+ neural: { status: 'unknown', _note: 'Health not measured — use system_health for real checks' },
97
+ mcp: { status: 'unknown', _note: 'Health not measured — use system_health for real checks' },
98
98
  },
99
99
  lastCheck: new Date().toISOString(),
100
100
  };
@@ -194,43 +194,89 @@ export const systemTools = [
194
194
  handler: async (input) => {
195
195
  const metrics = loadMetrics();
196
196
  const checks = [];
197
- // Core checks
197
+ const projectCwd = getProjectCwd();
198
+ // Memory DB check — verify the store file exists
199
+ {
200
+ const t0 = performance.now();
201
+ const memoryDbPath = join(projectCwd, '.claude-flow', 'memory', 'store.json');
202
+ const memoryExists = existsSync(memoryDbPath);
203
+ const elapsed = performance.now() - t0;
204
+ checks.push({
205
+ name: 'memory',
206
+ status: memoryExists ? 'healthy' : 'degraded',
207
+ latency: Math.round(elapsed * 100) / 100,
208
+ message: memoryExists ? undefined : 'Memory store not found — run memory init',
209
+ });
210
+ }
211
+ // Config check — verify config file exists
212
+ {
213
+ const t0 = performance.now();
214
+ const configPath = join(projectCwd, '.claude-flow', 'config.json');
215
+ const altConfigPath = join(projectCwd, 'claude-flow.config.json');
216
+ const configExists = existsSync(configPath) || existsSync(altConfigPath);
217
+ const elapsed = performance.now() - t0;
218
+ checks.push({
219
+ name: 'config',
220
+ status: configExists ? 'healthy' : 'degraded',
221
+ latency: Math.round(elapsed * 100) / 100,
222
+ message: configExists ? undefined : 'Config file not found — run init',
223
+ });
224
+ }
225
+ // MCP check — this process is the MCP server if stdin is piped
226
+ {
227
+ const isStdio = !process.stdin.isTTY;
228
+ checks.push({
229
+ name: 'mcp',
230
+ status: isStdio ? 'healthy' : 'unknown',
231
+ message: isStdio ? 'MCP stdio server running (this process)' : 'Not running as MCP server',
232
+ });
233
+ }
234
+ // Swarm — cannot verify real connectivity, report unknown
198
235
  checks.push({
199
236
  name: 'swarm',
200
- status: 'healthy',
201
- latency: 5 + Math.random() * 10,
202
- });
203
- checks.push({
204
- name: 'memory',
205
- status: 'healthy',
206
- latency: 2 + Math.random() * 5,
207
- });
208
- checks.push({
209
- name: 'mcp',
210
- status: 'healthy',
211
- latency: 1 + Math.random() * 3,
237
+ status: 'unknown',
238
+ message: 'Swarm connectivity not monitored — check coordination store manually',
212
239
  });
240
+ // Neural — cannot verify, report unknown
213
241
  checks.push({
214
242
  name: 'neural',
215
- status: metrics.health >= 0.7 ? 'healthy' : 'degraded',
216
- latency: 10 + Math.random() * 20,
243
+ status: 'unknown',
244
+ message: 'Neural network health not monitored',
217
245
  });
218
246
  if (input.deep) {
219
- checks.push({
220
- name: 'disk',
221
- status: 'healthy',
222
- latency: 50 + Math.random() * 100,
223
- });
247
+ // Disk check — real free space check via os module
248
+ {
249
+ const t0 = performance.now();
250
+ const freeMem = os.freemem();
251
+ const totalMem = os.totalmem();
252
+ const elapsed = performance.now() - t0;
253
+ // Use memory as a proxy; real disk check would need statvfs
254
+ checks.push({
255
+ name: 'disk',
256
+ status: 'unknown',
257
+ latency: Math.round(elapsed * 100) / 100,
258
+ message: 'Disk space check not implemented — use os-level tools',
259
+ });
260
+ }
261
+ // Network — cannot verify without making a request
224
262
  checks.push({
225
263
  name: 'network',
226
- status: 'healthy',
227
- latency: 20 + Math.random() * 30,
228
- });
229
- checks.push({
230
- name: 'database',
231
- status: 'healthy',
232
- latency: 15 + Math.random() * 25,
264
+ status: 'unknown',
265
+ message: 'Network connectivity not monitored',
233
266
  });
267
+ // Database — check if coordination store exists
268
+ {
269
+ const t0 = performance.now();
270
+ const coordPath = join(projectCwd, '.claude-flow', 'coordination', 'store.json');
271
+ const dbExists = existsSync(coordPath);
272
+ const elapsed = performance.now() - t0;
273
+ checks.push({
274
+ name: 'database',
275
+ status: dbExists ? 'healthy' : 'unknown',
276
+ latency: Math.round(elapsed * 100) / 100,
277
+ message: dbExists ? undefined : 'Coordination store not found',
278
+ });
279
+ }
234
280
  }
235
281
  const healthy = checks.filter(c => c.status === 'healthy').length;
236
282
  const total = checks.length;
@@ -205,7 +205,7 @@ export const taskTools = [
205
205
  saveTaskStore(store);
206
206
  // Sync assigned agents back to idle and increment taskCount
207
207
  if (task.assignedTo.length > 0) {
208
- const agentStorePath = join(getProjectCwd(), STORAGE_DIR, 'agents.json');
208
+ const agentStorePath = join(getProjectCwd(), STORAGE_DIR, 'agents', 'store.json');
209
209
  try {
210
210
  let agentStore = { agents: {} };
211
211
  if (existsSync(agentStorePath)) {
@@ -309,7 +309,7 @@ export const taskTools = [
309
309
  }
310
310
  const previouslyAssigned = [...task.assignedTo];
311
311
  // Load agent store to sync worker state
312
- const agentStorePath = join(getProjectCwd(), STORAGE_DIR, 'agents.json');
312
+ const agentStorePath = join(getProjectCwd(), STORAGE_DIR, 'agents', 'store.json');
313
313
  let agentStore = { agents: {} };
314
314
  try {
315
315
  if (existsSync(agentStorePath)) {
@@ -354,7 +354,7 @@ export const taskTools = [
354
354
  }
355
355
  saveTaskStore(store);
356
356
  // Save agent store
357
- const agentDir = join(getProjectCwd(), STORAGE_DIR);
357
+ const agentDir = join(getProjectCwd(), STORAGE_DIR, 'agents');
358
358
  if (!existsSync(agentDir)) {
359
359
  mkdirSync(agentDir, { recursive: true });
360
360
  }
@@ -217,30 +217,25 @@ export const workflowTools = [
217
217
  workflow.status = 'running';
218
218
  workflow.startedAt = new Date().toISOString();
219
219
  workflow.currentStep = input.startFromStep || 0;
220
- // Execute steps (in real implementation, this would be async/event-driven)
220
+ // Set steps to pending actual execution requires agent assignment via task tools
221
221
  const results = [];
222
222
  for (let i = workflow.currentStep; i < workflow.steps.length; i++) {
223
223
  const step = workflow.steps[i];
224
- step.status = 'running';
225
- step.startedAt = new Date().toISOString();
226
- // For now, mark as completed (real implementation would execute actual tasks)
227
- step.status = 'completed';
228
- step.completedAt = new Date().toISOString();
229
- step.result = { executed: true, stepType: step.type };
230
- results.push({ stepId: step.stepId, status: step.status });
231
- workflow.currentStep = i + 1;
224
+ step.status = 'pending';
225
+ results.push({
226
+ stepId: step.stepId,
227
+ status: step.status,
228
+ _note: 'Workflow execution tracks state. Actual step execution requires agent assignment via task tools.',
229
+ });
232
230
  }
233
- workflow.status = 'completed';
234
- workflow.completedAt = new Date().toISOString();
235
231
  saveWorkflowStore(store);
236
232
  return {
237
233
  workflowId,
238
234
  status: workflow.status,
239
- stepsExecuted: results.length,
235
+ totalSteps: results.length,
240
236
  results,
241
237
  startedAt: workflow.startedAt,
242
- completedAt: workflow.completedAt,
243
- duration: new Date(workflow.completedAt).getTime() - new Date(workflow.startedAt).getTime(),
238
+ _note: 'Workflow is now running. Steps are in pending state and must be executed via task tools.',
244
239
  };
245
240
  },
246
241
  },
@@ -387,27 +382,21 @@ export const workflowTools = [
387
382
  }
388
383
  workflow.status = 'running';
389
384
  saveWorkflowStore(store);
390
- // Continue execution from current step
391
- const results = [];
392
- for (let i = workflow.currentStep; i < workflow.steps.length; i++) {
393
- const step = workflow.steps[i];
394
- step.status = 'running';
395
- step.startedAt = new Date().toISOString();
396
- step.status = 'completed';
397
- step.completedAt = new Date().toISOString();
398
- step.result = { executed: true };
399
- results.push({ stepId: step.stepId, status: step.status });
400
- workflow.currentStep = i + 1;
401
- }
402
- workflow.status = 'completed';
403
- workflow.completedAt = new Date().toISOString();
404
- saveWorkflowStore(store);
385
+ // Report current step states — do not auto-complete them
386
+ const stepStates = workflow.steps.map(step => ({
387
+ stepId: step.stepId,
388
+ name: step.name,
389
+ status: step.status,
390
+ }));
391
+ const remainingSteps = workflow.steps.length - workflow.currentStep;
405
392
  return {
406
393
  workflowId,
407
394
  status: workflow.status,
408
395
  resumed: true,
409
- stepsExecuted: results.length,
410
- completedAt: workflow.completedAt,
396
+ currentStep: workflow.currentStep,
397
+ remainingSteps,
398
+ steps: stepStates,
399
+ _note: 'Workflow resumed. Steps remain in their current state and must be executed via task tools.',
411
400
  };
412
401
  },
413
402
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.5.54",
3
+ "version": "3.5.56",
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",