Documentation
¶
Overview ¶
Package runloop is a compatibility facade for the official Runloop SDKs (@runloop/api-client, runloop_api_client). Pointing RUNLOOP_BASE_URL at https://<host>/runloop makes the SDK's /v1/devboxes/... calls land here, where they are translated onto internal/service the same way the /e2b and /daytona facades are. Devboxes are native sandboxes; executions and file calls go through the sandbox toolbox.
Index ¶
Constants ¶
const PathPrefix = "/runloop"
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
RegisterRoutes mounts the facade. Routing below /v1/devboxes is done by hand rather than with ServeMux patterns: Runloop puts literal segments (create_and_await_running, disk_snapshots, evictions) where devbox ids go, and ServeMux panics at registration on pairs such as "POST .../disk_snapshots/{sid}" vs "POST .../{id}/shutdown", which match the same path with neither more specific.
func WriteError ¶
func WriteError(w http.ResponseWriter, status int, message string)
WriteError writes the Runloop error body. Both SDKs retry 408, 409, 429 and every 5xx up to five times with backoff, POSTs included, so a status in that set that retrying cannot fix carries x-should-retry: false. Without it a 501 or a permanent conflict costs the caller ~30s of pointless retries before the error surfaces.
Types ¶
type Deps ¶
type Deps struct {
Service *service.Service
Logger *slog.Logger
Auth func(http.Handler) http.Handler
// BlueprintMapJSON maps blueprint names/ids → images
// (SB_RUNLOOP_BLUEPRINT_MAP_JSON), read once in config; the facade parses
// it and applies its own defaults.
BlueprintMapJSON string
}
Deps are the shared dependencies the Runloop facade needs from the top-level API package.