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

Function armSupervisedMonitor

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

Source from the content-addressed store, hash-verified

369};
370
371const armSupervisedMonitor = () => {
372 stopSupervisedMonitor();
373 supervisedMonitorTimer = setInterval(() => {
374 void (async () => {
375 const live = await attachToSupervisedDaemon();
376 const window = liveMainWindow();
377 if (!live) {
378 supervisedMonitorMisses += 1;
379 if (supervisedMonitorMisses < SUPERVISED_MONITOR_MISSES_BEFORE_DOWN) return;
380 if (!supervisedDaemonDown && window) {
381 supervisedDaemonDown = true;
382 showCrashScreen(window);
383 }
384 return;
385 }
386 supervisedMonitorMisses = 0;
387 if (supervisedDaemonDown) {
388 supervisedDaemonDown = false;
389 connection = live;
390 installBearerAuthHeader(live.baseUrl, live.authToken);
391 if (window) void loadWindowUrl(window, webUrlForConnection(live));
392 }
393 })();
394 }, 10_000);
395};
396
397const installBearerAuthHeader = (origin: string, token: string | null) => {
398 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