@yemi33/minions 0.1.609 → 0.1.611

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.611 (2026-04-08)
4
+
5
+ ### Fixes
6
+ - accurate LLM call timing and agent metrics on engine page
7
+ - worktree count now checks for .git file instead of any directory
8
+
3
9
  ## 0.1.609 (2026-04-08)
4
10
 
5
11
  ### Fixes
@@ -65,7 +65,7 @@ function renderMetrics(metrics) {
65
65
 
66
66
  function fmtAvgRuntime(m) {
67
67
  const total = m.totalRuntimeMs || 0;
68
- const count = (m.tasksCompleted || 0) + (m.tasksErrored || 0);
68
+ const count = m.timedTasks || 0;
69
69
  if (!count || !total) return '-';
70
70
  const avgMin = total / count / 60000;
71
71
  return avgMin < 1 ? '<1m' : Math.round(avgMin) + 'm';
@@ -106,7 +106,8 @@ function renderLlmPerf(metrics) {
106
106
  for (const [type, m] of entries) {
107
107
  const calls = m.calls || 0;
108
108
  const totalMs = m.totalDurationMs || 0;
109
- const avgMs = calls > 0 ? totalMs / calls : 0;
109
+ const timedCalls = m.timedCalls || 0;
110
+ const avgMs = timedCalls > 0 ? totalMs / timedCalls : 0;
110
111
  const fmtTotal = totalMs < 60000 ? Math.round(totalMs / 1000) + 's' : Math.round(totalMs / 60000) + 'm';
111
112
  const fmtAvg = avgMs < 1000 ? Math.round(avgMs) + 'ms' : avgMs < 60000 ? Math.round(avgMs / 1000) + 's' : Math.round(avgMs / 60000) + 'm';
112
113
  const cost = m.costUsd ? '$' + m.costUsd.toFixed(2) : '-';
package/dashboard.js CHANGED
@@ -176,7 +176,24 @@ function _countWorktrees() {
176
176
  const root = p.localPath ? path.resolve(p.localPath) : null;
177
177
  if (!root) continue;
178
178
  const wtRoot = path.resolve(root, config.engine?.worktreeRoot || shared.ENGINE_DEFAULTS.worktreeRoot);
179
- try { count += fs.readdirSync(wtRoot).filter(f => fs.statSync(path.join(wtRoot, f)).isDirectory()).length; } catch {}
179
+ try {
180
+ for (const dir of fs.readdirSync(wtRoot)) {
181
+ const dirPath = path.join(wtRoot, dir);
182
+ try { if (!fs.statSync(dirPath).isDirectory()) continue; } catch { continue; }
183
+ // A git worktree has a .git file (not directory) in its root
184
+ if (fs.existsSync(path.join(dirPath, '.git'))) {
185
+ count++;
186
+ } else {
187
+ // Parent directory — scan subdirs for nested worktrees
188
+ try {
189
+ for (const sub of fs.readdirSync(dirPath)) {
190
+ const subPath = path.join(dirPath, sub);
191
+ try { if (fs.statSync(subPath).isDirectory() && fs.existsSync(path.join(subPath, '.git'))) count++; } catch {}
192
+ }
193
+ } catch {}
194
+ }
195
+ }
196
+ } catch {}
180
197
  }
181
198
  return count;
182
199
  } catch { return 0; }
package/engine/cli.js CHANGED
@@ -562,12 +562,12 @@ const commands = {
562
562
  console.log(`Active processes: ${e.activeProcesses.size}`);
563
563
 
564
564
  const metricsPath = path.join(ENGINE_DIR, 'metrics.json');
565
- const metrics = safeJson(metricsPath);
566
- if (metrics && Object.keys(metrics).length > 0) {
565
+ const metricsData = safeJson(metricsPath);
566
+ if (metricsData && Object.keys(metricsData).length > 0) {
567
567
  console.log('\nMetrics:');
568
568
  console.log(` ${'Agent'.padEnd(12)} ${'Done'.padEnd(6)} ${'Err'.padEnd(6)} ${'PRs'.padEnd(6)} ${'Appr'.padEnd(6)} ${'Rej'.padEnd(6)} ${'Reviews'.padEnd(8)} ${'Cost'.padEnd(8)}`);
569
569
  console.log(' ' + '-'.repeat(64));
570
- for (const [id, m] of Object.entries(metrics)) {
570
+ for (const [id, m] of Object.entries(metricsData)) {
571
571
  if (id.startsWith('_')) continue;
572
572
  const cost = m.totalCostUsd ? '$' + m.totalCostUsd.toFixed(1) : '-';
573
573
  console.log(` ${id.padEnd(12)} ${String(m.tasksCompleted || 0).padEnd(6)} ${String(m.tasksErrored || 0).padEnd(6)} ${String(m.prsCreated || 0).padEnd(6)} ${String(m.prsApproved || 0).padEnd(6)} ${String(m.prsRejected || 0).padEnd(6)} ${String(m.reviewsDone || 0).padEnd(8)} ${cost.padEnd(8)}`);
@@ -1023,7 +1023,10 @@ function updateMetrics(agentId, dispatchItem, result, taskUsage, prsCreatedCount
1023
1023
  const runtimeMs = dispatchItem.started_at
1024
1024
  ? Date.now() - new Date(dispatchItem.started_at).getTime()
1025
1025
  : 0;
1026
- if (runtimeMs > 0) m.totalRuntimeMs = (m.totalRuntimeMs || 0) + runtimeMs;
1026
+ if (runtimeMs > 0) {
1027
+ m.totalRuntimeMs = (m.totalRuntimeMs || 0) + runtimeMs;
1028
+ m.timedTasks = (m.timedTasks || 0) + 1;
1029
+ }
1027
1030
 
1028
1031
  if (result === DISPATCH_RESULT.SUCCESS) {
1029
1032
  m.tasksCompleted++;
@@ -1047,7 +1050,10 @@ function updateMetrics(agentId, dispatchItem, result, taskUsage, prsCreatedCount
1047
1050
  }
1048
1051
  const eng = metrics._engine['agent-dispatch'];
1049
1052
  eng.calls++;
1050
- if (runtimeMs > 0) eng.totalDurationMs = (eng.totalDurationMs || 0) + runtimeMs;
1053
+ if (runtimeMs > 0) {
1054
+ eng.totalDurationMs = (eng.totalDurationMs || 0) + runtimeMs;
1055
+ eng.timedCalls = (eng.timedCalls || 0) + 1;
1056
+ }
1051
1057
  if (taskUsage) {
1052
1058
  eng.costUsd += taskUsage.costUsd || 0;
1053
1059
  eng.inputTokens += taskUsage.inputTokens || 0;
package/engine/llm.js CHANGED
@@ -27,7 +27,10 @@ function trackEngineUsage(category, usage) {
27
27
  cat.outputTokens += usage.outputTokens || 0;
28
28
  cat.cacheRead += usage.cacheRead || 0;
29
29
  cat.cacheCreation = (cat.cacheCreation || 0) + (usage.cacheCreation || 0);
30
- if (usage.durationMs) cat.totalDurationMs = (cat.totalDurationMs || 0) + usage.durationMs;
30
+ if (usage.durationMs) {
31
+ cat.totalDurationMs = (cat.totalDurationMs || 0) + usage.durationMs;
32
+ cat.timedCalls = (cat.timedCalls || 0) + 1;
33
+ }
31
34
 
32
35
  const today = ts().slice(0, 10);
33
36
  if (!metrics._daily) metrics._daily = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.609",
3
+ "version": "0.1.611",
4
4
  "description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
5
5
  "bin": {
6
6
  "minions": "bin/minions.js"