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

Function waitForSupervisedAttach

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

Source from the content-addressed store, hash-verified

183
184/** Poll for a reachable supervised daemon until the deadline. */
185const waitForSupervisedAttach = async (
186 timeoutMs: number,
187 options: { readonly port?: number } = {},
188): Promise<SidecarConnection | null> => {
189 const deadline = Date.now() + timeoutMs;
190 for (;;) {
191 const attached = await attachToSupervisedDaemon();
192 if (attached && (options.port === undefined || attached.port === options.port)) return attached;
193 if (Date.now() >= deadline) return null;
194 await delay(300);
195 }
196};
197
198const confirmEnableBackgroundService = async (): Promise<boolean> => {
199 // EXECUTOR_TEST_AUTO_CONFIRM_BACKGROUND_SERVICE skips the modal, the same seam

Callers 4

startWithCurrentSettingsFunction · 0.85
restartSidecarAndReloadFunction · 0.85
registerIpcHandlersFunction · 0.85

Calls 2

attachToSupervisedDaemonFunction · 0.90
delayFunction · 0.70

Tested by

no test coverage detected