erne-universal 0.12.7 → 0.12.8

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.
@@ -1315,9 +1315,6 @@ async function resolvePort() {
1315
1315
  resolvePort().then((resolvedPort) => {
1316
1316
  PORT = resolvedPort;
1317
1317
 
1318
- // Register port in ~/.erne/ports.json
1319
- registerPort(projectDir, PORT, process.pid);
1320
-
1321
1318
  // Cleanup on exit
1322
1319
  const cleanupRegistry = () => {
1323
1320
  unregisterPort(projectDir);
@@ -1332,7 +1329,13 @@ resolvePort().then((resolvedPort) => {
1332
1329
  process.exit(0);
1333
1330
  });
1334
1331
 
1335
- server.listen(PORT, () => {
1332
+ // Retry with next free port on EADDRINUSE
1333
+ let retries = 0;
1334
+ const MAX_RETRIES = 10;
1335
+
1336
+ function startServer(port) {
1337
+ PORT = port;
1338
+ server.listen(PORT, () => {
1336
1339
  console.log(`ERNE Dashboard running on http://localhost:${PORT}`);
1337
1340
 
1338
1341
  // Wire tab handlers
@@ -1369,5 +1372,30 @@ resolvePort().then((resolvedPort) => {
1369
1372
  ecosystemHandler.autoRefresh(projectDir, broadcast);
1370
1373
  if (insightsHandler && insightsHandler.autoSnapshot) insightsHandler.autoSnapshot(projectDir);
1371
1374
  }, 5000);
1375
+
1376
+ // Register port after successful listen
1377
+ registerPort(projectDir, PORT, process.pid);
1378
+ });
1379
+ }
1380
+
1381
+ server.on('error', (err) => {
1382
+ if (err.code === 'EADDRINUSE' && retries < MAX_RETRIES) {
1383
+ retries++;
1384
+ // Find next free port
1385
+ findFreePort().then((nextPort) => {
1386
+ startServer(nextPort);
1387
+ }).catch(() => {
1388
+ console.error(`Error: No free ports available in range 3333-3399.`);
1389
+ process.exit(1);
1390
+ });
1391
+ } else if (err.code === 'EADDRINUSE') {
1392
+ console.error(`Error: All ports in range 3333-3399 are in use.`);
1393
+ process.exit(1);
1394
+ } else {
1395
+ console.error(`Server error: ${err.message}`);
1396
+ process.exit(1);
1397
+ }
1372
1398
  });
1399
+
1400
+ startServer(PORT);
1373
1401
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "erne-universal",
3
- "version": "0.12.7",
3
+ "version": "0.12.8",
4
4
  "description": "Complete AI coding agent harness for React Native and Expo \u2014 13 specialized agents, autonomous worker mode, visual debugging, smart routing",
5
5
  "keywords": [
6
6
  "react-native",