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 { type InferInsertModel, type InferSelectModel, sql } from "drizzle-orm";
2import { pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
3import sandboxes from "./sandboxes";
4import users from "./users";
5
6const runloopAuth = pgTable(
7 "runloop_auth",
8 {
9 id: text("id")
10 .primaryKey()
11 .default(sql`xata_id()`),
12 sandboxId: text("sandbox_id")
13 .notNull()
14 .references(() => sandboxes.id, { onDelete: "cascade" }),
15 userId: text("user_id")
16 .notNull()
17 .references(() => users.id),
18 apiKey: text("api_key").notNull(),
19 redactedApiKey: text("redacted_api_key").notNull(),
20 createdAt: timestamp("created_at").defaultNow().notNull(),
21 },
22 (t) => [uniqueIndex("unique_runloop_auth").on(t.sandboxId, t.userId)],
23);
24
25export type SelectRunloopAuth = InferSelectModel<typeof runloopAuth>;
26export type InsertRunloopAuth = InferInsertModel<typeof runloopAuth>;
27
28export default runloopAuth;