mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-16 06:02:46 +00:00
Add SDK health wait gate
This commit is contained in:
parent
c3a95c3611
commit
b860767d3f
10 changed files with 220 additions and 34 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { SimpleBox } from "@boxlite-ai/boxlite";
|
||||
import { SandboxAgent } from "sandbox-agent";
|
||||
import { detectAgent, buildInspectorUrl, waitForHealth } from "@sandbox-agent/example-shared";
|
||||
import { detectAgent, buildInspectorUrl } from "@sandbox-agent/example-shared";
|
||||
import { setupImage, OCI_DIR } from "./setup-image.ts";
|
||||
|
||||
const env: Record<string, string> = {};
|
||||
|
|
@ -26,10 +26,8 @@ if (result.exitCode !== 0) throw new Error(`Failed to start server: ${result.std
|
|||
|
||||
const baseUrl = "http://localhost:3000";
|
||||
|
||||
console.log("Waiting for server...");
|
||||
await waitForHealth({ baseUrl });
|
||||
|
||||
const client = await SandboxAgent.connect({ baseUrl });
|
||||
console.log("Connecting to server...");
|
||||
const client = await SandboxAgent.connect({ baseUrl, waitForHealth: { timeoutMs: 120_000 } });
|
||||
const session = await client.createSession({ agent: detectAgent(), sessionInit: { cwd: "/root", mcpServers: [] } });
|
||||
const sessionId = session.id;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue