MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / armSupervisedMonitor

Function armSupervisedMonitor

apps/desktop/src/main/index.ts:378–402  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

376};
377
378const armSupervisedMonitor = () => {
379 stopSupervisedMonitor();
380 supervisedMonitorTimer = setInterval(() => {
381 void (async () => {
382 const live = await attachToSupervisedDaemon();
383 const window = liveMainWindow();
384 if (!live) {
385 supervisedMonitorMisses += 1;
386 if (supervisedMonitorMisses < SUPERVISED_MONITOR_MISSES_BEFORE_DOWN) return;
387 if (!supervisedDaemonDown && window) {
388 supervisedDaemonDown = true;
389 showCrashScreen(window);
390 }
391 return;
392 }
393 supervisedMonitorMisses = 0;
394 if (supervisedDaemonDown) {
395 supervisedDaemonDown = false;
396 connection = live;
397 installBearerAuthHeader(live.baseUrl, live.authToken);
398 if (window) void loadWindowUrl(window, webUrlForConnection(live));
399 }
400 })();
401 }, 10_000);
402};
403
404const installBearerAuthHeader = (origin: string, token: string | null) => {
405 authHeaderUnsubscribe?.();

Callers 3

restartSidecarAndReloadFunction · 0.85
registerIpcHandlersFunction · 0.85
bootFunction · 0.85

Calls 7

attachToSupervisedDaemonFunction · 0.90
stopSupervisedMonitorFunction · 0.85
liveMainWindowFunction · 0.85
showCrashScreenFunction · 0.85
installBearerAuthHeaderFunction · 0.85
loadWindowUrlFunction · 0.85
webUrlForConnectionFunction · 0.85

Tested by

no test coverage detected