claude-flow 2.7.38 → 2.7.39

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.
@@ -1,11 +1,13 @@
1
- import * as fs from 'fs/promises';
2
- import * as path from 'path';
1
+ import { promises as fs } from 'fs';
2
+ import path from 'path';
3
3
  import { exec } from 'child_process';
4
4
  import { promisify } from 'util';
5
5
  const execAsync = promisify(exec);
6
- export class MetricsReader {
7
- metricsDir = '.claude-flow/metrics';
8
- sessionsDir = '.claude-flow/sessions';
6
+ let MetricsReader = class MetricsReader {
7
+ constructor(){
8
+ this.metricsDir = '.claude-flow/metrics';
9
+ this.sessionsDir = '.claude-flow/sessions';
10
+ }
9
11
  async getSystemMetrics() {
10
12
  try {
11
13
  const filePath = path.join(this.metricsDir, 'system-metrics.json');
@@ -16,6 +18,15 @@ export class MetricsReader {
16
18
  return null;
17
19
  }
18
20
  }
21
+ async getTaskQueue() {
22
+ try {
23
+ const queueFile = '.claude-flow/tasks/queue.json';
24
+ const content = await fs.readFile(queueFile, 'utf8');
25
+ return JSON.parse(content);
26
+ } catch (error) {
27
+ return [];
28
+ }
29
+ }
19
30
  async getTaskMetrics() {
20
31
  try {
21
32
  const filePath = path.join(this.metricsDir, 'task-metrics.json');
@@ -36,30 +47,30 @@ export class MetricsReader {
36
47
  }
37
48
  async getActiveAgents() {
38
49
  try {
39
- const perfMetrics = await this.getPerformanceMetrics();
40
- const sessionFiles = await this.getSessionFiles();
41
50
  const agents = [];
42
- for (const file of sessionFiles){
43
- try {
44
- const content = await fs.readFile(path.join(this.sessionsDir, 'pair', file), 'utf8');
45
- const sessionData = JSON.parse(content);
46
- if (sessionData.agents && Array.isArray(sessionData.agents)) {
47
- agents.push(...sessionData.agents);
51
+ const agentsDir = '.claude-flow/agents';
52
+ try {
53
+ const agentFiles = await fs.readdir(agentsDir);
54
+ for (const file of agentFiles){
55
+ if (file.endsWith('.json')) {
56
+ try {
57
+ const content = await fs.readFile(path.join(agentsDir, file), 'utf8');
58
+ const agent = JSON.parse(content);
59
+ agents.push(agent);
60
+ } catch {}
48
61
  }
49
- } catch {}
50
- }
51
- if (agents.length === 0 && perfMetrics) {
52
- const activeCount = perfMetrics.activeAgents || 0;
53
- const totalCount = perfMetrics.totalAgents || 0;
54
- for(let i = 0; i < totalCount; i++){
55
- agents.push({
56
- id: `agent-${i + 1}`,
57
- name: `Agent ${i + 1}`,
58
- type: i === 0 ? 'orchestrator' : 'worker',
59
- status: i < activeCount ? 'active' : 'idle',
60
- activeTasks: i < activeCount ? 1 : 0,
61
- lastActivity: Date.now() - i * 1000
62
- });
62
+ }
63
+ } catch {}
64
+ if (agents.length === 0) {
65
+ const sessionFiles = await this.getSessionFiles();
66
+ for (const file of sessionFiles){
67
+ try {
68
+ const content = await fs.readFile(path.join(this.sessionsDir, 'pair', file), 'utf8');
69
+ const sessionData = JSON.parse(content);
70
+ if (sessionData.agents && Array.isArray(sessionData.agents)) {
71
+ agents.push(...sessionData.agents);
72
+ }
73
+ } catch {}
63
74
  }
64
75
  }
65
76
  return agents;
@@ -135,7 +146,7 @@ export class MetricsReader {
135
146
  }
136
147
  async getMCPServerStatus() {
137
148
  try {
138
- const { stdout } = await execAsync('ps aux | grep -E "mcp-server\\.js|claude-flow mcp start" | grep -v grep | wc -l');
149
+ const { stdout } = await execAsync('ps aux | grep -E "mcp" | grep -v grep | wc -l');
139
150
  const processCount = parseInt(stdout.trim(), 10);
140
151
  const { stdout: orchestratorOut } = await execAsync('ps aux | grep -E "claude-flow start" | grep -v grep | wc -l');
141
152
  const orchestratorRunning = parseInt(orchestratorOut.trim(), 10) > 0;
@@ -164,15 +175,6 @@ export class MetricsReader {
164
175
  };
165
176
  }
166
177
  }
167
- }
168
-
169
- //# sourceMappingURL=metrics-reader.js.map processCount: 0,
170
- orchestratorRunning: false,
171
- port: null,
172
- connections: 0
173
- };
174
- }
175
- }
176
178
  };
177
179
  export { MetricsReader };
178
180
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "2.7.38",
3
+ "version": "2.7.39",
4
4
  "description": "Enterprise-grade AI agent orchestration with WASM-powered ReasoningBank memory and AgentDB vector database (always uses latest agentic-flow)",
5
5
  "mcpName": "io.github.ruvnet/claude-flow",
6
6
  "main": "cli.mjs",