diff --git a/examples/boxlite/src/index.ts b/examples/boxlite/src/index.ts index 2f59fd9..c2401be 100644 --- a/examples/boxlite/src/index.ts +++ b/examples/boxlite/src/index.ts @@ -27,7 +27,7 @@ if (result.exitCode !== 0) throw new Error(`Failed to start server: ${result.std const baseUrl = "http://localhost:3000"; console.log("Connecting to server..."); -const client = await SandboxAgent.connect({ baseUrl, waitForHealth: { timeoutMs: 120_000 } }); +const client = await SandboxAgent.connect({ baseUrl }); const session = await client.createSession({ agent: detectAgent(), sessionInit: { cwd: "/root", mcpServers: [] } }); const sessionId = session.id; diff --git a/examples/computesdk/src/computesdk.ts b/examples/computesdk/src/computesdk.ts index 1d70287..37f413d 100644 --- a/examples/computesdk/src/computesdk.ts +++ b/examples/computesdk/src/computesdk.ts @@ -138,7 +138,7 @@ export async function runComputeSdkExample(): Promise { process.once("SIGINT", handleExit); process.once("SIGTERM", handleExit); - const client = await SandboxAgent.connect({ baseUrl, waitForHealth: { timeoutMs: 120_000 } }); + const client = await SandboxAgent.connect({ baseUrl }); const session = await client.createSession({ agent: detectAgent(), sessionInit: { cwd: "/home", mcpServers: [] } }); const sessionId = session.id; diff --git a/examples/daytona/src/daytona-with-snapshot.ts b/examples/daytona/src/daytona-with-snapshot.ts index 9c27e81..d6900df 100644 --- a/examples/daytona/src/daytona-with-snapshot.ts +++ b/examples/daytona/src/daytona-with-snapshot.ts @@ -26,7 +26,7 @@ await sandbox.process.executeCommand( const baseUrl = (await sandbox.getSignedPreviewUrl(3000, 4 * 60 * 60)).url; console.log("Connecting to server..."); -const client = await SandboxAgent.connect({ baseUrl, waitForHealth: { timeoutMs: 120_000 } }); +const client = await SandboxAgent.connect({ baseUrl }); const session = await client.createSession({ agent: detectAgent(), sessionInit: { cwd: "/home/daytona", mcpServers: [] } }); const sessionId = session.id; diff --git a/examples/daytona/src/index.ts b/examples/daytona/src/index.ts index 8ef0041..bbf9d6e 100644 --- a/examples/daytona/src/index.ts +++ b/examples/daytona/src/index.ts @@ -31,7 +31,7 @@ await sandbox.process.executeCommand( const baseUrl = (await sandbox.getSignedPreviewUrl(3000, 4 * 60 * 60)).url; console.log("Connecting to server..."); -const client = await SandboxAgent.connect({ baseUrl, waitForHealth: { timeoutMs: 120_000 } }); +const client = await SandboxAgent.connect({ baseUrl }); const session = await client.createSession({ agent: detectAgent(), sessionInit: { cwd: "/home/daytona", mcpServers: [] } }); const sessionId = session.id; diff --git a/examples/docker/src/index.ts b/examples/docker/src/index.ts index e7db99d..b876ba8 100644 --- a/examples/docker/src/index.ts +++ b/examples/docker/src/index.ts @@ -44,7 +44,7 @@ await container.start(); const baseUrl = `http://127.0.0.1:${PORT}`; -const client = await SandboxAgent.connect({ baseUrl, waitForHealth: { timeoutMs: 120_000 } }); +const client = await SandboxAgent.connect({ baseUrl }); const session = await client.createSession({ agent: detectAgent(), sessionInit: { cwd: "/root", mcpServers: [] } }); const sessionId = session.id; diff --git a/examples/e2b/src/index.ts b/examples/e2b/src/index.ts index 61f3ef9..b02f239 100644 --- a/examples/e2b/src/index.ts +++ b/examples/e2b/src/index.ts @@ -28,7 +28,7 @@ await sandbox.commands.run("sandbox-agent server --no-token --host 0.0.0.0 --por const baseUrl = `https://${sandbox.getHost(3000)}`; console.log("Connecting to server..."); -const client = await SandboxAgent.connect({ baseUrl, waitForHealth: { timeoutMs: 120_000 } }); +const client = await SandboxAgent.connect({ baseUrl }); const session = await client.createSession({ agent: detectAgent(), sessionInit: { cwd: "/home/user", mcpServers: [] } }); const sessionId = session.id; diff --git a/examples/vercel/src/index.ts b/examples/vercel/src/index.ts index 9077a2b..258fbe4 100644 --- a/examples/vercel/src/index.ts +++ b/examples/vercel/src/index.ts @@ -39,7 +39,7 @@ await sandbox.runCommand({ const baseUrl = sandbox.domain(3000); console.log("Connecting to server..."); -const client = await SandboxAgent.connect({ baseUrl, waitForHealth: { timeoutMs: 120_000 } }); +const client = await SandboxAgent.connect({ baseUrl }); const session = await client.createSession({ agent: detectAgent(), sessionInit: { cwd: "/home/vercel-sandbox", mcpServers: [] } }); const sessionId = session.id; diff --git a/sdks/typescript/src/client.ts b/sdks/typescript/src/client.ts index cbf5758..cc23e82 100644 --- a/sdks/typescript/src/client.ts +++ b/sdks/typescript/src/client.ts @@ -510,6 +510,7 @@ export class SandboxAgent { token: handle.token, fetch: options.fetch, headers: options.headers, + waitForHealth: false, persist: options.persist, replayMaxEvents: options.replayMaxEvents, replayMaxChars: options.replayMaxChars, @@ -1297,11 +1298,11 @@ function normalizePositiveInt(value: number | undefined, fallback: number): numb function normalizeHealthWaitOptions( value: boolean | SandboxAgentHealthWaitOptions | undefined, ): NormalizedHealthWaitOptions { - if (!value) { + if (value === false) { return { enabled: false }; } - if (value === true) { + if (value === true || value === undefined) { return { enabled: true }; } diff --git a/sdks/typescript/tests/integration.test.ts b/sdks/typescript/tests/integration.test.ts index 3a2e6a4..806c005 100644 --- a/sdks/typescript/tests/integration.test.ts +++ b/sdks/typescript/tests/integration.test.ts @@ -204,7 +204,6 @@ describe("Integration: TypeScript SDK flat session API", () => { const sdk = await SandboxAgent.connect({ token, fetch: customFetch, - waitForHealth: true, }); const agents = await sdk.listAgents();