@yemi33/minions 0.1.1798 → 0.1.1799

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,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1799 (2026-05-08)
4
+
5
+ ### Other
6
+ - Clarify active dispatch PID liveness
7
+
3
8
  ## 0.1.1798 (2026-05-08)
4
9
 
5
10
  ### Other
package/engine/cli.js CHANGED
@@ -52,6 +52,44 @@ function isEngineProcessAlive(control) {
52
52
  }
53
53
  }
54
54
 
55
+ function dispatchSafeId(itemId) {
56
+ return String(itemId || '').replace(/[:\\/*?"<>|]/g, '-');
57
+ }
58
+
59
+ function readDispatchPid(itemId) {
60
+ const pidFile = path.join(ENGINE_DIR, 'tmp', `pid-${dispatchSafeId(itemId)}.pid`);
61
+ let raw;
62
+ try { raw = fs.readFileSync(pidFile, 'utf8').trim(); }
63
+ catch { return null; }
64
+ if (!raw) return null;
65
+ try { return shared.validatePid(raw); }
66
+ catch { return null; }
67
+ }
68
+
69
+ function isPidAlive(pid) {
70
+ try {
71
+ process.kill(shared.validatePid(pid), 0);
72
+ return true;
73
+ } catch {
74
+ return false;
75
+ }
76
+ }
77
+
78
+ function summarizeActiveDispatchPids(activeItems = []) {
79
+ const summary = { live: 0, dead: 0, missing: 0 };
80
+ for (const item of activeItems || []) {
81
+ const pid = readDispatchPid(item.id);
82
+ if (!pid) {
83
+ summary.missing++;
84
+ } else if (isPidAlive(pid)) {
85
+ summary.live++;
86
+ } else {
87
+ summary.dead++;
88
+ }
89
+ }
90
+ return summary;
91
+ }
92
+
55
93
  function createControlOwner(pid = process.pid) {
56
94
  return { pid, ownerToken: `${pid}-${shared.uid()}` };
57
95
  }
@@ -453,21 +491,13 @@ const commands = {
453
491
  e.loadCooldowns();
454
492
 
455
493
  // Re-attach to surviving agent processes from previous session
456
- const { exec } = require('./shared');
457
494
  const dispatch = getDispatch();
458
495
  const activeOnStart = (dispatch.active || []);
459
496
  if (activeOnStart.length > 0) {
460
497
  let reattached = 0;
461
498
  for (const item of activeOnStart) {
462
499
  const agentId = item.agent;
463
- let agentPid = null;
464
-
465
- const safeId = item.id.replace(/[:\\/*?"<>|]/g, '-');
466
- const pidFile = path.join(ENGINE_DIR, 'tmp', `pid-${safeId}.pid`);
467
- try {
468
- const pidStr = fs.readFileSync(pidFile, 'utf8').trim();
469
- if (pidStr) agentPid = parseInt(pidStr);
470
- } catch { /* optional */ }
500
+ let agentPid = readDispatchPid(item.id);
471
501
 
472
502
  if (!agentPid) {
473
503
  const status = getAgentStatus(agentId);
@@ -484,16 +514,7 @@ const commands = {
484
514
  }
485
515
 
486
516
  const hadPid = agentPid && agentPid > 0; // track before liveness check
487
- if (agentPid && agentPid > 0) {
488
- try {
489
- if (process.platform === 'win32') {
490
- const out = exec(`tasklist /FI "PID eq ${agentPid}" /NH`, { encoding: 'utf8', timeout: 3000 }).trim();
491
- if (!new RegExp(`\\b${agentPid}\\b`).test(out)) agentPid = null;
492
- } else {
493
- process.kill(agentPid, 0);
494
- }
495
- } catch { agentPid = null; }
496
- }
517
+ if (agentPid && agentPid > 0 && !isPidAlive(agentPid)) agentPid = null;
497
518
 
498
519
  // PID was found but confirmed dead — exempt from restart grace period (#869)
499
520
  if (hadPid && !agentPid) {
@@ -1003,7 +1024,8 @@ const commands = {
1003
1024
  const metrics = shared.safeJson(path.join(__dirname, 'metrics.json')) || {};
1004
1025
  const lifetimeCompleted = Object.entries(metrics).filter(([k]) => !k.startsWith('_')).reduce((sum, [, m]) => sum + (m.tasksCompleted || 0) + (m.tasksErrored || 0), 0);
1005
1026
  console.log(`Dispatch: ${dispatch.pending.length} pending | ${(dispatch.active || []).length} active | ${lifetimeCompleted} completed`);
1006
- console.log(`Active processes: ${e.activeProcesses.size}`);
1027
+ const pidSummary = summarizeActiveDispatchPids(dispatch.active || []);
1028
+ console.log(`Active dispatch PID files: ${pidSummary.live} live | ${pidSummary.dead} dead | ${pidSummary.missing} missing`);
1007
1029
 
1008
1030
  const metricsPath = path.join(ENGINE_DIR, 'metrics.json');
1009
1031
  const metricsData = safeJson(metricsPath);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "runtime": "copilot",
3
3
  "models": null,
4
- "cachedAt": "2026-05-08T16:36:25.273Z"
4
+ "cachedAt": "2026-05-08T16:51:53.990Z"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.1798",
3
+ "version": "0.1.1799",
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"