e2b

package
v0.6.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const PathPrefix = "/e2b"
View Source
const RuntimePath = PathPrefix + "/runtime"

RuntimePath is the envd runtime proxy. It is the one /e2b route with no API principal: the sandbox's own envd token guards it (and nothing does when the caller created the sandbox with secure:false), so it sits on the registry test's public allowlist.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(mux apihttp.Mux, d Deps)

RegisterRoutes mounts the supported E2B control-plane compatibility surface.

func WriteError

func WriteError(w http.ResponseWriter, status int, message string)

WriteError writes the E2B error envelope shape expected by the SDK.

func WriteErrorReason added in v0.6.8

func WriteErrorReason(w http.ResponseWriter, status int, message, reason string)

WriteErrorReason is WriteError with the D17 refusal reason in the body (omitted when empty). The API edge sets the matching WWW-Authenticate header before calling it.

Types

type Deps

type Deps struct {
	Service *service.Service
	Logger  *slog.Logger
	// Auth authenticates a request with the E2B credential headers
	// (pkg/api). Routes never call it directly: Route composes it with the
	// permission check.
	Auth func(http.Handler) http.Handler
	// Audit is the seam task T5 fills with kind "api" records
	// (apihttp.AuditHook). nil records nothing.
	Audit apihttp.AuditHook
	// TemplateMapJSON maps template ids → images (SB_E2B_TEMPLATE_MAP_JSON),
	// ClientID is the client id the SDK echoes (SB_E2B_CLIENT_ID). Both are
	// read once in config; the facade parses TemplateMapJSON and applies its
	// own defaults.
	TemplateMapJSON string
	ClientID        string
	// ListGate bounds the cluster-wide lists this node runs at once
	// (clusterlist.Admit); nil admits every list. One gate is shared by v1
	// and every facade: they cost the same fan-out.
	ListGate *apihttp.Gate
}

Deps are the shared dependencies the E2B facade needs from the top-level API package.

func (Deps) Route added in v0.6.8

func (d Deps) Route(perm controlplane.Permission, h http.Handler) http.Handler

Route returns h behind authenticate → authorize(perm) → audit seam (plans/identity-and-access.md §5.3).

type EnvdCall added in v0.6.12

type EnvdCall struct {
	Method string
	Path   string
}

EnvdCall is one envd request the E2B SDK makes through this facade's /envd/* pass-through (runtime_proxy.go).

func EnvdCalls added in v0.6.12

func EnvdCalls() []EnvdCall

EnvdCalls lists the envd routes the E2B SDK calls: health, file read and write, and the process and filesystem Connect RPCs. The facade forwards the whole /envd prefix, so this list is what the toolboxd route inventory test (plan X2) checks toolboxd answers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL