From e7b5551d73cb08cf1284d294b0c78c43cac75042 Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Thu, 5 Mar 2026 20:17:09 -0800 Subject: [PATCH] Refactor SDK health probe helper --- sdks/typescript/src/client.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sdks/typescript/src/client.ts b/sdks/typescript/src/client.ts index d20cef4..59d8f14 100644 --- a/sdks/typescript/src/client.ts +++ b/sdks/typescript/src/client.ts @@ -693,7 +693,7 @@ export class SandboxAgent { } async getHealth(): Promise { - return this.requestJson("GET", `${API_PREFIX}/health`, { skipReadyWait: true }); + return this.requestHealth(); } async listAgents(options?: { config?: boolean }): Promise { @@ -1066,10 +1066,7 @@ export class SandboxAgent { throwIfAborted(signal); try { - const health = await this.requestJson("GET", `${API_PREFIX}/health`, { - signal, - skipReadyWait: true, - }); + const health = await this.requestHealth({ signal }); if (health.status === "ok") { return; } @@ -1132,6 +1129,13 @@ export class SandboxAgent { return url.toString(); } + + private async requestHealth(options: { signal?: AbortSignal } = {}): Promise { + return this.requestJson("GET", `${API_PREFIX}/health`, { + signal: options.signal, + skipReadyWait: true, + }); + } } type QueryValue = string | number | boolean | null | undefined;