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

Function armSupervisedMonitor

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

Source from the content-addressed store, hash-verified

336};
337
338const armSupervisedMonitor = () => {
339 stopSupervisedMonitor();
340 supervisedMonitorTimer = setInterval(() => {
341 void (async () => {
342 const live = await attachToSupervisedDaemon();
343 const window = liveMainWindow();
344 if (!live) {
345 supervisedMonitorMisses += 1;
346 if (supervisedMonitorMisses < SUPERVISED_MONITOR_MISSES_BEFORE_DOWN) return;
347 if (!supervisedDaemonDown && window) {
348 supervisedDaemonDown = true;
349 showCrashScreen(window);
350 }
351 return;
352 }
353 supervisedMonitorMisses = 0;
354 if (supervisedDaemonDown) {
355 supervisedDaemonDown = false;
356 connection = live;
357 installBearerAuthHeader(live.baseUrl, live.authToken);
358 if (window) void window.loadURL(webUrlForConnection(live));
359 }
360 })();
361 }, 10_000);
362};
363
364const installBearerAuthHeader = (origin: string, token: string | null) => {
365 authHeaderUnsubscribe?.();

Callers 3

restartSidecarAndReloadFunction · 0.85
registerIpcHandlersFunction · 0.85
bootFunction · 0.85

Calls 6

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

Tested by

no test coverage detected