the universal sandbox runtime for agents and humans.
pocketenv.io
sandbox
openclaw
agent
claude-code
vercel-sandbox
deno-sandbox
cloudflare-sandbox
atproto
sprites
daytona
1import consola from "consola";
2import chalk from "chalk";
3import { Sandbox } from "@pocketenv/sdk";
4import connectToSandbox from "./ssh";
5import { expandRepo } from "../lib/expandRepo";
6import { configureSdk } from "../lib/sdk";
7
8async function start(
9 name: string,
10 {
11 ssh,
12 repo,
13 keepAlive,
14 }: { ssh?: boolean; repo?: string; keepAlive?: boolean },
15) {
16 await configureSdk();
17 if (repo) repo = expandRepo(repo);
18
19 try {
20 const sandbox = await Sandbox.get(name);
21 await sandbox.start({ repo, keepAlive });
22
23 if (ssh) {
24 await sandbox.waitUntilRunning();
25 await connectToSandbox(name);
26 return;
27 }
28
29 consola.success(`Sandbox ${chalk.greenBright(name)} started`);
30 consola.log(
31 `Run ${chalk.greenBright(`pocketenv console ${name}`)} to access the sandbox`,
32 );
33 } catch {
34 consola.error("Failed to start sandbox");
35 }
36}
37
38export default start;