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

Function armSupervisedMonitor

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

Source from the content-addressed store, hash-verified

298};
299
300const armSupervisedMonitor = () => {
301 stopSupervisedMonitor();
302 supervisedMonitorTimer = setInterval(() => {
303 void (async () => {
304 const live = await attachToSupervisedDaemon();
305 const window = liveMainWindow();
306 if (!live) {
307 supervisedMonitorMisses += 1;
308 if (supervisedMonitorMisses < SUPERVISED_MONITOR_MISSES_BEFORE_DOWN) return;
309 if (!supervisedDaemonDown && window) {
310 supervisedDaemonDown = true;
311 const html = sidecarCrashHtml({ reported: errorReportingEnabled });
312 void window.loadURL(`data:text/html;charset=utf-8,${encodeURIComponent(html)}`);
313 }
314 return;
315 }
316 supervisedMonitorMisses = 0;
317 if (supervisedDaemonDown) {
318 supervisedDaemonDown = false;
319 connection = live;
320 installBearerAuthHeader(live.baseUrl, live.authToken);
321 if (window) void window.loadURL(webUrlForConnection(live));
322 }
323 })();
324 }, 10_000);
325};
326
327const installBearerAuthHeader = (origin: string, token: string | null) => {
328 authHeaderUnsubscribe?.();

Callers 3

restartSidecarAndReloadFunction · 0.85
registerIpcHandlersFunction · 0.85
bootFunction · 0.85

Calls 6

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

Tested by

no test coverage detected