()
| 174 | } |
| 175 | |
| 176 | function _proxyHealthyIfExpected() { |
| 177 | if (!_proxyExpected()) return true; |
| 178 | const dir = process.env.EVOLVER_SETTINGS_DIR || path.join(os.homedir(), '.evolver'); |
| 179 | const settings = _readJson(path.join(dir, 'settings.json')); |
| 180 | const proxy = settings && settings.proxy; |
| 181 | if (!proxy || !proxy.url) return false; |
| 182 | if (proxy.pid) { |
| 183 | try { process.kill(proxy.pid, 0); } catch (e) { |
| 184 | if (!(e && e.code === 'EPERM')) return false; |
| 185 | } |
| 186 | } |
| 187 | if (!proxy.token) return false; |
| 188 | return _proxyReachable(proxy.url, proxy.token); |
| 189 | } |
| 190 | |
| 191 | // Auto-restart guard: if the evolver daemon is not running when a new agent |
| 192 | // session starts, attempt a background restart. This covers the "idle-death" |
no test coverage detected