diff --git a/examples/shared/src/docker.ts b/examples/shared/src/docker.ts index 5ec8a8c..adceecb 100644 --- a/examples/shared/src/docker.ts +++ b/examples/shared/src/docker.ts @@ -4,7 +4,6 @@ import fs from "node:fs"; import path from "node:path"; import { PassThrough } from "node:stream"; import { fileURLToPath } from "node:url"; -import { waitForHealth } from "./sandbox-agent-client.ts"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const EXAMPLE_IMAGE = "sandbox-agent-examples:latest"; @@ -173,7 +172,7 @@ async function ensureExampleImage(_docker: Docker): Promise { } /** - * Start a Docker container running sandbox-agent and wait for it to be healthy. + * Start a Docker container running sandbox-agent. * Registers SIGINT/SIGTERM handlers for cleanup. */ export async function startDockerSandbox(opts: DockerSandboxOptions): Promise { @@ -275,18 +274,8 @@ export async function startDockerSandbox(opts: DockerSandboxOptions): Promise { stopStartupLogs(); diff --git a/examples/shared/src/sandbox-agent-client.ts b/examples/shared/src/sandbox-agent-client.ts index df8fa51..5c7e7cf 100644 --- a/examples/shared/src/sandbox-agent-client.ts +++ b/examples/shared/src/sandbox-agent-client.ts @@ -3,8 +3,6 @@ * Provides minimal helpers for connecting to and interacting with sandbox-agent servers. */ -import { setTimeout as delay } from "node:timers/promises"; - function normalizeBaseUrl(baseUrl: string): string { return baseUrl.replace(/\/+$/, ""); } @@ -74,41 +72,6 @@ export function buildHeaders({ return headers; } -export async function waitForHealth({ - baseUrl, - token, - extraHeaders, - timeoutMs = 120_000, -}: { - baseUrl: string; - token?: string; - extraHeaders?: Record; - timeoutMs?: number; -}): Promise { - const normalized = normalizeBaseUrl(baseUrl); - const deadline = Date.now() + timeoutMs; - let lastError: unknown; - while (Date.now() < deadline) { - try { - const headers = buildHeaders({ token, extraHeaders }); - const response = await fetch(`${normalized}/v1/health`, { headers }); - if (response.ok) { - const data = await response.json(); - if (data?.status === "ok") { - return; - } - lastError = new Error(`Unexpected health response: ${JSON.stringify(data)}`); - } else { - lastError = new Error(`Health check failed: ${response.status}`); - } - } catch (error) { - lastError = error; - } - await delay(500); - } - throw (lastError ?? new Error("Timed out waiting for /v1/health")) as Error; -} - export function generateSessionId(): string { const chars = "abcdefghijklmnopqrstuvwxyz0123456789"; let id = "session-"; @@ -144,4 +107,3 @@ export function detectAgent(): string { } return "claude"; } -