open, interoperable sandbox platform for agents and humans 📦 ✨ pocketenv.io
claude-code atproto sandbox openclaw agent
at main 81 lines 1.7 kB view raw
1import { client } from "."; 2import type { Volume } from "../types/volume"; 3 4export const addVolume = (sandboxId: string, name: string, path: string) => 5 client.post( 6 "/xrpc/io.pocketenv.volume.addVolume", 7 { 8 volume: { 9 sandboxId, 10 name, 11 path, 12 }, 13 }, 14 { 15 headers: { 16 Authorization: `Bearer ${localStorage.getItem("token")}`, 17 }, 18 }, 19 ); 20 21export const deleteVolume = (id: string) => 22 client.post(`/xrpc/io.pocketenv.volume.deleteVolume`, undefined, { 23 params: { 24 id, 25 }, 26 headers: { 27 Authorization: `Bearer ${localStorage.getItem("token")}`, 28 }, 29 }); 30 31export const getVolumes = ( 32 sandboxId?: string, 33 offset?: number, 34 limit?: number, 35) => 36 client.get<{ volumes: Volume[]; total: number }>( 37 `/xrpc/io.pocketenv.volume.getVolumes`, 38 { 39 params: { 40 sandboxId, 41 offset: offset ?? 0, 42 limit: limit ?? 30, 43 }, 44 headers: { 45 Authorization: `Bearer ${localStorage.getItem("token")}`, 46 }, 47 }, 48 ); 49 50export const getVolume = (id: string) => 51 client.get<{ volume: Volume }>(`/xrpc/io.pocketenv.volume.getVolume`, { 52 params: { 53 id, 54 }, 55 headers: { 56 Authorization: `Bearer ${localStorage.getItem("token")}`, 57 }, 58 }); 59 60export const updateVolume = ( 61 id: string, 62 name: string, 63 path: string, 64 sandboxId: string, 65) => 66 client.post( 67 "/xrpc/io.pocketenv.volume.updateVolume", 68 { 69 id, 70 volume: { 71 name, 72 path, 73 sandboxId, 74 }, 75 }, 76 { 77 headers: { 78 Authorization: `Bearer ${localStorage.getItem("token")}`, 79 }, 80 }, 81 );