MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / waitForReady

Method waitForReady

services/cloud-agent-next/src/kilo/client.ts:54–76  ·  view source on GitHub ↗
(timeoutMs: number = 30_000)

Source from the content-addressed store, hash-verified

52 }
53
54 async waitForReady(timeoutMs: number = 30_000): Promise<HealthResponse> {
55 const startTime = Date.now();
56 const pollInterval = 500;
57
58 while (Date.now() - startTime < timeoutMs) {
59 try {
60 return await this.call<HealthResponse>(
61 'GET',
62 '/global/health',
63 undefined,
64 HEALTH_POLL_TIMEOUT_SECONDS
65 );
66 } catch {
67 const elapsed = Date.now() - startTime;
68 if (elapsed + pollInterval >= timeoutMs) {
69 break;
70 }
71 await this.sleep(pollInterval);
72 }
73 }
74
75 throw new KiloServerNotReadyError(`Server not ready after ${timeoutMs}ms on port ${this.port}`);
76 }
77
78 async createSession(options?: CreateSessionOptions): Promise<Session> {
79 const session = await this.call<Session>('POST', '/session', {

Callers 1

client.test.tsFile · 0.80

Calls 1

sleepMethod · 0.95

Tested by

no test coverage detected