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 { Sandbox } from "@pocketenv/sdk";
3import Table from "cli-table3";
4import dayjs from "dayjs";
5import relativeTime from "dayjs/plugin/relativeTime";
6import { c } from "../theme";
7import { configureSdk } from "../lib/sdk";
8
9dayjs.extend(relativeTime);
10
11async function listSandboxes() {
12 await configureSdk();
13 const { sandboxes } = await Sandbox.list({ limit: 100, offset: 0 });
14
15 const table = new Table({
16 head: [
17 c.primary("NAME"),
18 c.primary("BASE"),
19 c.primary("PROVIDER"),
20 c.primary("STATUS"),
21 c.primary("CREATED AT"),
22 ],
23 chars: {
24 top: "",
25 "top-mid": "",
26 "top-left": "",
27 "top-right": "",
28 bottom: "",
29 "bottom-mid": "",
30 "bottom-left": "",
31 "bottom-right": "",
32 left: "",
33 "left-mid": "",
34 mid: "",
35 "mid-mid": "",
36 right: "",
37 "right-mid": "",
38 middle: " ",
39 },
40 style: {
41 border: [],
42 head: [],
43 },
44 });
45
46 for (const sandbox of sandboxes) {
47 table.push([
48 c.secondary(sandbox.name),
49 sandbox.baseSandbox ?? "",
50 sandbox.provider,
51 sandbox.status === "RUNNING"
52 ? c.highlight(sandbox.status)
53 : (sandbox.status ?? ""),
54 dayjs(sandbox.createdAt).fromNow(),
55 ]);
56 }
57
58 consola.log(table.toString());
59}
60
61export default listSandboxes;