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

Function waitForSupervisedAttach

apps/desktop/src/main/index.ts:196–207  ·  view source on GitHub ↗
(
  timeoutMs: number,
  options: { readonly port?: number } = {},
)

Source from the content-addressed store, hash-verified

194
195/** Poll for a reachable supervised daemon until the deadline. */
196const waitForSupervisedAttach = async (
197 timeoutMs: number,
198 options: { readonly port?: number } = {},
199): Promise<SidecarConnection | null> => {
200 const deadline = Date.now() + timeoutMs;
201 for (;;) {
202 const attached = await attachToSupervisedDaemon();
203 if (attached && (options.port === undefined || attached.port === options.port)) return attached;
204 if (Date.now() >= deadline) return null;
205 await delay(300);
206 }
207};
208
209const confirmEnableBackgroundService = async (): Promise<boolean> => {
210 // EXECUTOR_TEST_AUTO_CONFIRM_BACKGROUND_SERVICE skips the modal, the same seam

Callers 6

installSupervisedAndWaitFunction · 0.85
startWithCurrentSettingsFunction · 0.85
restartSidecarAndReloadFunction · 0.85
registerIpcHandlersFunction · 0.85

Calls 2

attachToSupervisedDaemonFunction · 0.90
delayFunction · 0.70

Tested by

no test coverage detected