MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / waitForAliceReady

Function waitForAliceReady

apps/desktop/src/main.ts:170–183  ·  view source on GitHub ↗
(timeoutMs = READY_TIMEOUT_MS)

Source from the content-addressed store, hash-verified

168}
169
170async function waitForAliceReady(timeoutMs = READY_TIMEOUT_MS): Promise<void> {
171 const deadline = Date.now() + timeoutMs
172 while (Date.now() < deadline) {
173 try {
174 // 5xx still means the app is reachable; only transport errors mean not-ready.
175 const res = await fetchAliceWebRequest(new Request('app://openalice/api/version'), alice, 1_000)
176 if (res.status < 500) return
177 } catch {
178 // child not listening on its IPC web transport yet
179 }
180 await new Promise((r) => setTimeout(r, 200))
181 }
182 throw new Error(`Alice did not become ready over Electron IPC within ${timeoutMs}ms`)
183}
184
185async function waitForUTA(utaUrl: string, timeoutMs = UTA_READY_TIMEOUT_MS): Promise<boolean> {
186 const deadline = Date.now() + timeoutMs

Callers 1

main.tsFile · 0.85

Calls 1

fetchAliceWebRequestFunction · 0.85

Tested by

no test coverage detected