open, interoperable sandbox platform for agents and humans 📦 ✨
pocketenv.io
claude-code
atproto
sandbox
openclaw
agent
1import { client } from ".";
2import type { File } from "../types/file";
3
4export const addFile = (sandboxId: string, path: string, content: string) =>
5 client.post(
6 "/xrpc/io.pocketenv.file.addFile",
7 {
8 file: {
9 sandboxId,
10 path,
11 content,
12 },
13 },
14 {
15 headers: {
16 Authorization: `Bearer ${localStorage.getItem("token")}`,
17 },
18 },
19 );
20
21export const deleteFile = (id: string) =>
22 client.post(`/xrpc/io.pocketenv.file.deleteFile`, undefined, {
23 params: {
24 id,
25 },
26 headers: {
27 Authorization: `Bearer ${localStorage.getItem("token")}`,
28 },
29 });
30
31export const getFiles = (sandboxId?: string, offset?: number, limit?: number) =>
32 client.get<{ files: File[]; total: number }>(
33 `/xrpc/io.pocketenv.file.getFiles`,
34 {
35 params: {
36 sandboxId,
37 offset: offset ?? 0,
38 limit: limit ?? 30,
39 },
40 headers: {
41 Authorization: `Bearer ${localStorage.getItem("token")}`,
42 },
43 },
44 );
45
46export const getFile = (id: string) =>
47 client.get<{ file: File }>(`/xrpc/io.pocketenv.file.getFile?id=${id}`, {
48 headers: {
49 Authorization: `Bearer ${localStorage.getItem("token")}`,
50 },
51 });
52
53export const updateFile = (id: string, path: string, content: string) =>
54 client.post(
55 "/xrpc/io.pocketenv.file.updateFile",
56 {
57 id,
58 file: {
59 path,
60 content,
61 },
62 },
63 {
64 headers: {
65 Authorization: `Bearer ${localStorage.getItem("token")}`,
66 },
67 },
68 );