Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: pm2 jlist JSON parsing with ANSI codes
Adam Eivy7337fcfa9a23
diff --git a/server/services/cos.js b/server/services/cos.jsindex f9c2181322..f54798d0e5 100644--- a/server/services/cos.js+++ b/server/services/cos.js@@ -1753,9 +1753,15 @@ export async function runHealthCheck() {// Check PM2 processesconst pm2Result = await execAsync('pm2 jlist 2>/dev/null || echo "[]"').catch(() => ({ stdout: '[]' }));- // pm2 jlist may output warnings before JSON, extract the JSON array+ // pm2 jlist may output ANSI codes and warnings before JSON, extract the JSON array+ // Look for '[{' (array with objects) or '[]' (empty array) to avoid matching ANSI codes like [31mconst pm2Output = pm2Result.stdout || '[]';- const jsonStart = pm2Output.indexOf('[');+ let jsonStart = pm2Output.indexOf('[{');+ if (jsonStart < 0) {+ // Check for empty array - find '[]' that's not part of ANSI codes+ const emptyMatch = pm2Output.match(/\[\](?![0-9])/);+ jsonStart = emptyMatch ? pm2Output.indexOf(emptyMatch[0]) : -1;+ }const pm2Json = jsonStart >= 0 ? pm2Output.slice(jsonStart) : '[]';const pm2Processes = JSON.parse(pm2Json);