@yemi33/minions 0.1.2419 → 0.1.2421

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/engine.js CHANGED
@@ -5854,7 +5854,7 @@ async function spawnAgent(dispatchItem, config) {
5854
5854
  // healthy:false, alive:true and the engine sweep / item-3 healthcheck
5855
5855
  // loop will drive its state from there.
5856
5856
  let managedSpawnAcceptanceFailure = null;
5857
- let managedSpawnSpawned = []; // [{name, pid, started_at, log_path}]
5857
+ let managedSpawnSpawned = []; // serializable runtime facts + in-memory exit promise
5858
5858
  {
5859
5859
  const _wiMeta = dispatchItem.meta?.item?.meta || {};
5860
5860
  const _msEnabled = !!_wiMeta.managed_spawn
@@ -5935,7 +5935,13 @@ async function spawnAgent(dispatchItem, config) {
5935
5935
  try {
5936
5936
  const runtime = managedSpawn.spawnManagedSpec(spec, ctx);
5937
5937
  spawnedItems.push({ spec, runtime });
5938
- managedSpawnSpawned.push({ name: spec.name, pid: runtime.pid, started_at: runtime.started_at, log_path: runtime.log_path });
5938
+ managedSpawnSpawned.push({
5939
+ name: spec.name,
5940
+ pid: runtime.pid,
5941
+ started_at: runtime.started_at,
5942
+ log_path: runtime.log_path,
5943
+ exit: runtime.exit,
5944
+ });
5939
5945
  } catch (specErr) {
5940
5946
  spawnFailureReason = `spawn failed for ${spec.name}: ${specErr.message}`;
5941
5947
  log('warn', `managed-spawn: ${spawnFailureReason}`);
@@ -5947,7 +5953,7 @@ async function spawnAgent(dispatchItem, config) {
5947
5953
  // state. This is consistent with the "all healthy or fail"
5948
5954
  // contract item 3 will enforce on healthcheck timeout.
5949
5955
  for (const item of spawnedItems) {
5950
- try { shared.killByPidImmediate(item.runtime.pid); } catch (_e) {}
5956
+ try { shared.killImmediate({ pid: item.runtime.pid }); } catch (_e) {}
5951
5957
  }
5952
5958
  managedSpawnSpawned = [];
5953
5959
  managedSpawnAcceptanceFailure = {
@@ -5999,7 +6005,8 @@ async function spawnAgent(dispatchItem, config) {
5999
6005
  if (!spec || !spec.healthcheck) {
6000
6006
  return Promise.resolve({ healthy: false, error: 'no healthcheck recorded for ' + spawned.name, _name: spawned.name });
6001
6007
  }
6002
- return managedSpawn.waitForFirstHealth(spec).then(r => Object.assign({ _name: spec.name, _pid: spawned.pid }, r));
6008
+ return managedSpawn.waitForFirstHealth(spec, { exit: spawned.exit })
6009
+ .then(r => Object.assign({ _name: spec.name, _pid: spawned.pid }, r));
6003
6010
  }));
6004
6011
  const failed = [];
6005
6012
  for (let i = 0; i < results.length; i++) {
@@ -6009,7 +6016,12 @@ async function spawnAgent(dispatchItem, config) {
6009
6016
  continue;
6010
6017
  }
6011
6018
  if (!r.value.healthy) {
6012
- failed.push({ name: r.value._name || items[i].name, pid: r.value._pid || items[i].pid, error: r.value.error || 'unhealthy' });
6019
+ failed.push({
6020
+ name: r.value._name || items[i].name,
6021
+ pid: r.value._pid || items[i].pid,
6022
+ error: r.value.error || 'unhealthy',
6023
+ log_tail: r.value.log_tail || '',
6024
+ });
6013
6025
  }
6014
6026
  }
6015
6027
  if (failed.length > 0) {
@@ -6024,8 +6036,8 @@ async function spawnAgent(dispatchItem, config) {
6024
6036
  // re-reading the log files later. Use the same tailManagedLog helper
6025
6037
  // the inbox alert uses; cap each tail to 2KB to bound the WI write.
6026
6038
  const _failedDetails = failed.map(f => {
6027
- let tail = '';
6028
- try { tail = (managedSpawn.tailManagedLog(f.name, 20) || '').slice(-2048); }
6039
+ let tail = f.log_tail || '';
6040
+ try { if (!tail) tail = (managedSpawn.tailManagedLog(f.name, 20) || '').slice(-2048); }
6029
6041
  catch (_e) { tail = ''; }
6030
6042
  return { name: f.name, reason: f.error, log_tail: tail };
6031
6043
  });
@@ -6051,7 +6063,7 @@ async function spawnAgent(dispatchItem, config) {
6051
6063
  try {
6052
6064
  const wiId = dispatchItem.meta?.item?.id || '';
6053
6065
  const logTails = failed.map(f => {
6054
- const tail = managedSpawn.tailManagedLog(f.name, 50) || '(log empty or unreadable)';
6066
+ const tail = f.log_tail || managedSpawn.tailManagedLog(f.name, 50) || '(log empty or unreadable)';
6055
6067
  return '### ' + f.name + ' (pid ' + (f.pid || '?') + ')\n\nReason: `' + f.error + '`\n\n```\n' + tail.slice(-2000) + '\n```';
6056
6068
  }).join('\n\n');
6057
6069
  const alertBody = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2419",
3
+ "version": "0.1.2421",
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"