claude-flow 3.5.58 → 3.5.60

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "3.5.58",
3
+ "version": "3.5.60",
4
4
  "description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -62,8 +62,8 @@
62
62
  "@claude-flow/plugin-gastown-bridge": "^0.1.3",
63
63
  "@ruvector/attention": "^0.1.3",
64
64
  "@ruvector/core": "^0.1.30",
65
- "@ruvector/router": "^0.1.27",
66
- "@ruvector/router-linux-x64-gnu": "^0.1.27",
65
+ "@ruvector/router": "^0.1.30",
66
+ "@ruvector/router-linux-x64-gnu": "^0.1.30",
67
67
  "@ruvector/sona": "^0.1.5",
68
68
  "agentdb": "^3.0.0-alpha.9",
69
69
  "agentic-flow": "^2.0.7"
@@ -198,30 +198,59 @@ function getModelName() {
198
198
  return 'Claude Code';
199
199
  }
200
200
 
201
- // Get learning stats from memory database (pure stat calls)
201
+ // Get learning stats from real data sources (no heuristics)
202
202
  function getLearningStats() {
203
- const memoryPaths = [
204
- path.join(CWD, '.swarm', 'memory.db'),
205
- path.join(CWD, '.claude-flow', 'memory.db'),
206
- path.join(CWD, '.claude', 'memory.db'),
207
- path.join(CWD, 'data', 'memory.db'),
208
- path.join(CWD, '.agentdb', 'memory.db'),
209
- ];
203
+ let patterns = 0;
204
+ let sessions = 0;
210
205
 
211
- for (const dbPath of memoryPaths) {
212
- const stat = safeStat(dbPath);
213
- if (stat) {
214
- const sizeKB = stat.size / 1024;
215
- const patterns = Math.floor(sizeKB / 2);
216
- return {
217
- patterns,
218
- sessions: Math.max(1, Math.floor(patterns / 10)),
219
- };
206
+ // 1. Count real patterns from intelligence pattern store
207
+ const patternStorePath = path.join(CWD, '.claude-flow', 'data', 'patterns.json');
208
+ try {
209
+ if (fs.existsSync(patternStorePath)) {
210
+ const data = JSON.parse(fs.readFileSync(patternStorePath, 'utf-8'));
211
+ if (Array.isArray(data)) patterns = data.length;
212
+ else if (data && data.patterns) patterns = Array.isArray(data.patterns) ? data.patterns.length : Object.keys(data.patterns).length;
213
+ }
214
+ } catch { /* ignore */ }
215
+
216
+ // 2. Count patterns from auto-memory-store (real entries, not file size)
217
+ if (patterns === 0) {
218
+ const autoStorePath = path.join(CWD, '.claude-flow', 'data', 'auto-memory-store.json');
219
+ try {
220
+ if (fs.existsSync(autoStorePath)) {
221
+ const data = JSON.parse(fs.readFileSync(autoStorePath, 'utf-8'));
222
+ if (Array.isArray(data)) patterns = data.length;
223
+ else if (data && data.entries) patterns = data.entries.length;
224
+ }
225
+ } catch { /* ignore */ }
226
+ }
227
+
228
+ // 3. Count patterns from memory.db using row count (sqlite header bytes 28-31)
229
+ if (patterns === 0) {
230
+ const memoryPaths = [
231
+ path.join(CWD, '.claude-flow', 'memory.db'),
232
+ path.join(CWD, 'data', 'memory.db'),
233
+ path.join(CWD, '.swarm', 'memory.db'),
234
+ ];
235
+ for (const dbPath of memoryPaths) {
236
+ try {
237
+ if (fs.existsSync(dbPath)) {
238
+ // Read SQLite header: page count at offset 28 (4 bytes big-endian)
239
+ const fd = fs.openSync(dbPath, 'r');
240
+ const buf = Buffer.alloc(4);
241
+ fs.readSync(fd, buf, 0, 4, 28);
242
+ fs.closeSync(fd);
243
+ const pageCount = buf.readUInt32BE(0);
244
+ // Each page typically holds ~10-50 rows; use page count as conservative estimate
245
+ // But report 0 if DB exists but has only schema pages (< 3)
246
+ patterns = pageCount > 2 ? pageCount - 2 : 0;
247
+ break;
248
+ }
249
+ } catch { /* ignore */ }
220
250
  }
221
251
  }
222
252
 
223
- // Check session files count
224
- let sessions = 0;
253
+ // 4. Count real session files
225
254
  try {
226
255
  const sessDir = path.join(CWD, '.claude', 'sessions');
227
256
  if (fs.existsSync(sessDir)) {
@@ -229,7 +258,17 @@ function getLearningStats() {
229
258
  }
230
259
  } catch { /* ignore */ }
231
260
 
232
- return { patterns: 0, sessions };
261
+ // 5. Count session files from claude-flow
262
+ if (sessions === 0) {
263
+ try {
264
+ const cfSessDir = path.join(CWD, '.claude-flow', 'sessions');
265
+ if (fs.existsSync(cfSessDir)) {
266
+ sessions = fs.readdirSync(cfSessDir).filter(f => f.endsWith('.json')).length;
267
+ }
268
+ } catch { /* ignore */ }
269
+ }
270
+
271
+ return { patterns, sessions };
233
272
  }
234
273
 
235
274
  // V3 progress from metrics files (pure file reads)
@@ -241,12 +280,12 @@ function getV3Progress() {
241
280
  let dddProgress = dddData ? (dddData.progress || 0) : 0;
242
281
  let domainsCompleted = Math.min(5, Math.floor(dddProgress / 20));
243
282
 
283
+ // Only derive DDD progress from real ddd-progress.json or real pattern data
284
+ // Don't inflate domains from pattern count — 0 means no DDD work tracked
244
285
  if (dddProgress === 0 && learning.patterns > 0) {
245
- if (learning.patterns >= 500) domainsCompleted = 5;
246
- else if (learning.patterns >= 200) domainsCompleted = 4;
247
- else if (learning.patterns >= 100) domainsCompleted = 3;
248
- else if (learning.patterns >= 50) domainsCompleted = 2;
249
- else if (learning.patterns >= 10) domainsCompleted = 1;
286
+ // Conservative: only count domains if we have substantial real pattern data
287
+ // Each domain requires ~100 real stored patterns to claim completion
288
+ domainsCompleted = Math.min(5, Math.floor(learning.patterns / 100));
250
289
  dddProgress = Math.floor((domainsCompleted / totalDomains) * 100);
251
290
  }
252
291
 
@@ -338,28 +377,18 @@ function getSystemMetrics() {
338
377
  if (learningData && learningData.intelligence && learningData.intelligence.score !== undefined) {
339
378
  intelligencePct = Math.min(100, Math.floor(learningData.intelligence.score));
340
379
  } else {
380
+ // Use real data only — patterns from actual store, vectors from actual DB
341
381
  const fromPatterns = learning.patterns > 0 ? Math.min(100, Math.floor(learning.patterns / 20)) : 0;
342
382
  const fromVectors = agentdb.vectorCount > 0 ? Math.min(100, Math.floor(agentdb.vectorCount / 20)) : 0;
343
383
  intelligencePct = Math.max(fromPatterns, fromVectors);
344
384
  }
345
-
346
- // Maturity fallback (pure fs checks, no git exec)
347
- if (intelligencePct === 0) {
348
- let score = 0;
349
- if (fs.existsSync(path.join(CWD, '.claude'))) score += 15;
350
- const srcDirs = ['src', 'lib', 'app', 'packages', 'v3'];
351
- for (const d of srcDirs) { if (fs.existsSync(path.join(CWD, d))) { score += 15; break; } }
352
- const testDirs = ['tests', 'test', '__tests__', 'spec'];
353
- for (const d of testDirs) { if (fs.existsSync(path.join(CWD, d))) { score += 10; break; } }
354
- const cfgFiles = ['package.json', 'tsconfig.json', 'pyproject.toml', 'Cargo.toml', 'go.mod'];
355
- for (const f of cfgFiles) { if (fs.existsSync(path.join(CWD, f))) { score += 5; break; } }
356
- intelligencePct = Math.min(100, score);
357
- }
385
+ // No fake fallback — 0% means no real learning data exists
358
386
 
359
387
  if (learningData && learningData.sessions && learningData.sessions.total !== undefined) {
360
388
  contextPct = Math.min(100, learningData.sessions.total * 5);
361
389
  } else {
362
- contextPct = Math.min(100, Math.floor(learning.sessions * 5));
390
+ // Real session count only — no heuristic derivation from patterns
391
+ contextPct = learning.sessions > 0 ? Math.min(100, learning.sessions * 5) : 0;
363
392
  }
364
393
 
365
394
  // Sub-agents from file metrics (no ps aux)
@@ -23,6 +23,7 @@ import * as fs from 'fs';
23
23
  import * as os from 'os';
24
24
  import { fileURLToPath } from 'url';
25
25
  import { dirname } from 'path';
26
+ import { trackRequest } from './mcp-tools/request-tracker.js';
26
27
  // ESM-compatible __dirname
27
28
  const __filename = fileURLToPath(import.meta.url);
28
29
  const __dirname = dirname(__filename);
@@ -389,6 +390,7 @@ export class MCPServerManager extends EventEmitter {
389
390
  }
390
391
  try {
391
392
  const result = await callMCPTool(toolName, toolParams, { sessionId });
393
+ trackRequest(toolName, true);
392
394
  return {
393
395
  jsonrpc: '2.0',
394
396
  id: message.id,
@@ -396,6 +398,7 @@ export class MCPServerManager extends EventEmitter {
396
398
  };
397
399
  }
398
400
  catch (error) {
401
+ trackRequest(toolName, false);
399
402
  return {
400
403
  jsonrpc: '2.0',
401
404
  id: message.id,
@@ -83,6 +83,17 @@ export const daaTools = [
83
83
  };
84
84
  store.agents[id] = agent;
85
85
  saveDAAStore(store);
86
+ // Store agent in AgentDB for searchable agent registry
87
+ try {
88
+ const bridge = await import('../memory/memory-bridge.js');
89
+ await bridge.bridgeStoreEntry({
90
+ key: `daa-agent-${id}`,
91
+ value: JSON.stringify({ id: agent.id, name: agent.name, type: agent.type, cognitivePattern: agent.cognitivePattern }),
92
+ namespace: 'daa-agents',
93
+ tags: [agent.type, agent.cognitivePattern],
94
+ });
95
+ }
96
+ catch { /* AgentDB not available */ }
86
97
  return {
87
98
  success: true,
88
99
  agent: {
@@ -215,6 +226,20 @@ export const daaTools = [
215
226
  }
216
227
  workflow.status = 'running';
217
228
  saveDAAStore(store);
229
+ // Store workflow state in AgentDB for tracking
230
+ try {
231
+ const bridge = await import('../memory/memory-bridge.js');
232
+ await bridge.bridgeStoreEntry({
233
+ key: `workflow-${workflowId}`,
234
+ value: JSON.stringify({
235
+ id: workflowId, status: 'running',
236
+ steps: workflow.steps.length, strategy: workflow.strategy,
237
+ startedAt: new Date().toISOString(),
238
+ }),
239
+ namespace: 'daa-workflows',
240
+ });
241
+ }
242
+ catch { /* AgentDB not available */ }
218
243
  return {
219
244
  success: true,
220
245
  workflowId,
@@ -1,12 +1,8 @@
1
1
  /**
2
2
  * GitHub MCP Tools for CLI
3
3
  *
4
- * V2 Compatibility - GitHub integration tools
5
- *
6
- * ⚠️ IMPORTANT: These tools provide LOCAL STATE MANAGEMENT only.
7
- * - NO actual GitHub API calls are made
8
- * - Data is stored locally for workflow coordination
9
- * - For real GitHub operations, use `gh` CLI or GitHub MCP server
4
+ * Real GitHub integration via `gh` CLI and `git` commands.
5
+ * Falls back to local state management when CLI tools are unavailable.
10
6
  */
11
7
  import { type MCPTool } from './types.js';
12
8
  export declare const githubTools: MCPTool[];