An open-source, faster Devin alternative
TypeScript
adjustment to terminal, sandbox fixes
Brian Reardon9052236cfabb
diff --git a/internal/api/dashboard.go b/internal/api/dashboard.goindex 3ca06cdd..62d72cf6 100644--- a/internal/api/dashboard.go+++ b/internal/api/dashboard.go@@ -1,10 +1,15 @@package apiimport (+ "bytes""context""encoding/json""fmt"+ "io"+ "log""net/http"+ "net/url"+ "strings""time""github.com/google/uuid"@@ -471,13 +476,6 @@ func (s *Server) dashboardCreatePTY(c echo.Context) error {if err != nil {return err}- _ = session-- if s.ptyManager == nil {- return c.JSON(http.StatusServiceUnavailable, map[string]string{- "error": "terminal not available in server-only mode",- })- }var req types.PTYCreateRequestif err := c.Bind(&req); err != nil {@@ -486,6 +484,43 @@ func (s *Server) dashboardCreatePTY(c echo.Context) error {})}+ // Server mode: proxy PTY creation to the worker via gRPC+ if s.ptyManager == nil && s.workerRegistry != nil {+ grpcClient, err := s.workerRegistry.GetWorkerClient(session.WorkerID)+ if err != nil {+ return c.JSON(http.StatusServiceUnavailable, map[string]string{+ "error": "worker not available: " + err.Error(),+ })+ }++ ctx, cancel := context.WithTimeout(c.Request().Context(), 10*time.Second)+ defer cancel()++ grpcResp, err := grpcClient.CreatePTY(ctx, &pb.CreatePTYRequest{+ SandboxId: sandboxID,+ Cols: int32(req.Cols),+ Rows: int32(req.Rows),+ Shell: req.Shell,+ })+ if err != nil {+ return c.JSON(http.StatusInternalServerError, map[string]string{+ "error": "failed to create PTY: " + err.Error(),+ })+ }++ return c.JSON(http.StatusCreated, map[string]string{+ "sessionId": grpcResp.SessionId,+ "sandboxId": sandboxID,+ })+ }++ if s.ptyManager == nil {+ return c.JSON(http.StatusServiceUnavailable, map[string]string{+ "error": "terminal not available",+ })+ }++ // Combined/worker mode: create locallyvar ptySession *sandbox.PTYSessionHandlerouteOp := func(_ context.Context) error {var err error@@ -519,15 +554,21 @@ func (s *Server) dashboardPTYWebSocket(c echo.Context) error {if err != nil {return err}- _ = session++ sessionID := c.Param("sessionId")++ // Server mode: proxy WebSocket to the worker's HTTP API+ if s.ptyManager == nil && s.workerRegistry != nil {+ return s.dashboardPTYWebSocketRemote(c, sandboxID, sessionID, session)+ }if s.ptyManager == nil {return c.JSON(http.StatusServiceUnavailable, map[string]string{- "error": "terminal not available in server-only mode",+ "error": "terminal not available",})}- sessionID := c.Param("sessionId")+ // Combined/worker mode: connect directly to local PTYptySession, err := s.ptyManager.GetSession(sessionID)if err != nil {return c.JSON(http.StatusNotFound, map[string]string{@@ -591,19 +632,110 @@ func (s *Server) dashboardPTYWebSocket(c echo.Context) error {return nil}-// dashboardResizePTY resizes a PTY session.-func (s *Server) dashboardResizePTY(c echo.Context) error {- _, session, err := s.dashboardResolveSandbox(c)+// dashboardPTYWebSocketRemote proxies the dashboard WebSocket to the worker's+// PTY WebSocket endpoint, acting as a transparent bridge.+func (s *Server) dashboardPTYWebSocketRemote(c echo.Context, sandboxID, sessionID string, session *db.SandboxSession) error {+ worker := s.workerRegistry.GetWorker(session.WorkerID)+ if worker == nil {+ return c.JSON(http.StatusServiceUnavailable, map[string]string{+ "error": "worker not available",+ })+ }++ // Issue a short-lived JWT for the worker request+ orgID, _ := auth.GetOrgID(c)+ token, err := s.jwtIssuer.IssueSandboxToken(orgID, sandboxID, session.WorkerID, 5*time.Minute)if err != nil {- return err+ return c.JSON(http.StatusInternalServerError, map[string]string{+ "error": "failed to issue token",+ })}- _ = session- if s.ptyManager == nil {- return c.JSON(http.StatusServiceUnavailable, map[string]string{- "error": "terminal not available in server-only mode",+ // Build the worker WebSocket URL+ // worker.HTTPAddr is like "http://13.59.48.110:8080"+ workerURL := strings.Replace(worker.HTTPAddr, "http://", "ws://", 1)+ workerURL = strings.Replace(workerURL, "https://", "wss://", 1)+ workerWSURL := fmt.Sprintf("%s/sandboxes/%s/pty/%s", workerURL, sandboxID, sessionID)++ // Add auth token as query param (WebSocket can't set headers easily from browser,+ // but here we're server→worker so we can use headers)+ header := http.Header{}+ header.Set("Authorization", "Bearer "+token)++ dialer := websocket.Dialer{+ HandshakeTimeout: 10 * time.Second,+ }++ workerWS, resp, err := dialer.Dial(workerWSURL, header)+ if err != nil {+ status := 0+ if resp != nil {+ status = resp.StatusCode+ }+ log.Printf("dashboard: failed to dial worker PTY WebSocket %s (status=%d): %v", workerWSURL, status, err)+ return c.JSON(http.StatusBadGateway, map[string]string{+ "error": "failed to connect to worker terminal",})}+ defer workerWS.Close()++ // Upgrade the dashboard client connection+ clientWS, err := upgrader.Upgrade(c.Response(), c.Request(), nil)+ if err != nil {+ return err+ }+ defer clientWS.Close()++ // Bidirectional pipe: dashboard ↔ worker+ done := make(chan struct{}, 2)++ // worker → dashboard+ go func() {+ defer func() { done <- struct{}{} }()+ for {+ msgType, msg, err := workerWS.ReadMessage()+ if err != nil {+ return+ }+ if err := clientWS.WriteMessage(msgType, msg); err != nil {+ return+ }+ }+ }()++ // dashboard → worker+ go func() {+ defer func() { done <- struct{}{} }()+ for {+ msgType, msg, err := clientWS.ReadMessage()+ if err != nil {+ return+ }+ if err := workerWS.WriteMessage(msgType, msg); err != nil {+ return+ }+ }+ }()++ // Wait for either direction to close+ <-done++ clientWS.WriteControl(websocket.CloseMessage,+ websocket.FormatCloseMessage(websocket.CloseNormalClosure, ""),+ time.Now().Add(time.Second))+ workerWS.WriteControl(websocket.CloseMessage,+ websocket.FormatCloseMessage(websocket.CloseNormalClosure, ""),+ time.Now().Add(time.Second))++ return nil+}++// dashboardResizePTY resizes a PTY session.+func (s *Server) dashboardResizePTY(c echo.Context) error {+ sandboxID, session, err := s.dashboardResolveSandbox(c)+ if err != nil {+ return err+ }sessionID := c.Param("sessionId")@@ -617,6 +749,20 @@ func (s *Server) dashboardResizePTY(c echo.Context) error {})}+ // Server mode: proxy resize to the worker via HTTP+ // The worker doesn't have a dedicated resize gRPC call, so we proxy the HTTP request.+ if s.ptyManager == nil && s.workerRegistry != nil {+ return s.proxyWorkerHTTP(c, session, "POST",+ fmt.Sprintf("/sandboxes/%s/pty/%s/resize", sandboxID, sessionID),+ req)+ }++ if s.ptyManager == nil {+ return c.JSON(http.StatusServiceUnavailable, map[string]string{+ "error": "terminal not available",+ })+ }+if err := s.ptyManager.Resize(sessionID, req.Cols, req.Rows); err != nil {return c.JSON(http.StatusNotFound, map[string]string{"error": err.Error(),@@ -632,16 +778,21 @@ func (s *Server) dashboardKillPTY(c echo.Context) error {if err != nil {return err}- _ = session++ sessionID := c.Param("sessionId")++ // Server mode: proxy kill to the worker via HTTP+ if s.ptyManager == nil && s.workerRegistry != nil {+ return s.proxyWorkerHTTP(c, session, "DELETE",+ fmt.Sprintf("/sandboxes/%s/pty/%s", sandboxID, sessionID), nil)+ }if s.ptyManager == nil {return c.JSON(http.StatusServiceUnavailable, map[string]string{- "error": "terminal not available in server-only mode",+ "error": "terminal not available",})}- sessionID := c.Param("sessionId")-routeOp := func(_ context.Context) error {return s.ptyManager.KillSession(sessionID)}@@ -700,3 +851,69 @@ func (s *Server) dashboardResolveSandbox(c echo.Context) (string, *db.SandboxSesreturn sandboxID, session, nil}++// proxyWorkerHTTP proxies an HTTP request to the worker's HTTP API.+// Used by dashboard PTY resize/kill in server-only mode.+func (s *Server) proxyWorkerHTTP(c echo.Context, session *db.SandboxSession, method, path string, body interface{}) error {+ worker := s.workerRegistry.GetWorker(session.WorkerID)+ if worker == nil {+ return c.JSON(http.StatusServiceUnavailable, map[string]string{+ "error": "worker not available",+ })+ }++ // Issue a short-lived JWT for the worker request+ orgID, _ := auth.GetOrgID(c)+ sandboxID := c.Param("sandboxId")+ token, err := s.jwtIssuer.IssueSandboxToken(orgID, sandboxID, session.WorkerID, 5*time.Minute)+ if err != nil {+ return c.JSON(http.StatusInternalServerError, map[string]string{+ "error": "failed to issue token",+ })+ }++ // Build the worker URL+ workerBase := strings.TrimRight(worker.HTTPAddr, "/")+ workerURL, _ := url.JoinPath(workerBase, path)++ var bodyReader io.Reader+ if body != nil {+ bodyJSON, err := json.Marshal(body)+ if err != nil {+ return c.JSON(http.StatusInternalServerError, map[string]string{+ "error": "failed to marshal request body",+ })+ }+ bodyReader = bytes.NewReader(bodyJSON)+ }++ req, err := http.NewRequestWithContext(c.Request().Context(), method, workerURL, bodyReader)+ if err != nil {+ return c.JSON(http.StatusInternalServerError, map[string]string{+ "error": "failed to create request",+ })+ }+ req.Header.Set("Authorization", "Bearer "+token)+ if body != nil {+ req.Header.Set("Content-Type", "application/json")+ }++ client := &http.Client{Timeout: 10 * time.Second}+ resp, err := client.Do(req)+ if err != nil {+ log.Printf("dashboard: failed to proxy to worker %s: %v", workerURL, err)+ return c.JSON(http.StatusBadGateway, map[string]string{+ "error": "worker request failed",+ })+ }+ defer resp.Body.Close()++ // Forward the worker's response back to the dashboard+ respBody, _ := io.ReadAll(resp.Body)+ for k, vals := range resp.Header {+ for _, v := range vals {+ c.Response().Header().Add(k, v)+ }+ }+ return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), respBody)+}diff --git a/internal/api/sandbox.go b/internal/api/sandbox.goindex 1fa03480..649014a0 100644--- a/internal/api/sandbox.go+++ b/internal/api/sandbox.go@@ -149,6 +149,7 @@ func (s *Server) createSandboxRemote(c echo.Context, ctx context.Context, cfg tyCpuCount: int32(cfg.CpuCount),NetworkEnabled: cfg.NetworkEnabled,ImageRef: imageRef,+ Port: int32(cfg.Port),})if err != nil {return c.JSON(http.StatusInternalServerError, map[string]string{diff --git a/internal/podman/container.go b/internal/podman/container.goindex 396862e7..d0528816 100644--- a/internal/podman/container.go+++ b/internal/podman/container.go@@ -30,6 +30,9 @@ type ContainerConfig struct {}// DefaultContainerConfig returns a security-hardened container config.+// We drop ALL capabilities then add back only those needed for normal dev+// workflows (apt install, pip install, npm, chmod/chown, etc.).+// Dangerous caps like SYS_ADMIN, SYS_PTRACE, NET_ADMIN remain dropped.func DefaultContainerConfig(name, image string) ContainerConfig {return ContainerConfig{Name: name,@@ -40,9 +43,23 @@ func DefaultContainerConfig(name, image string) ContainerConfig {CPUs: "1",PidsLimit: 256,NetworkMode: "none",- ReadOnly: false,- TmpFS: map[string]string{},- CapDrop: []string{"ALL"},+ ReadOnly: false,+ TmpFS: map[string]string{},+ CapDrop: []string{"ALL"},+ CapAdd: []string{+ "CHOWN", // chown files (apt, npm)+ "DAC_OVERRIDE", // bypass file permission checks (apt, pip)+ "FOWNER", // bypass ownership checks on files (apt)+ "FSETID", // set SGID bit (apt, dpkg)+ "KILL", // send signals to processes+ "SETGID", // set group ID (apt, su)+ "SETUID", // set user ID (apt, su)+ "SETPCAP", // modify process capabilities+ "SETFCAP", // set file capabilities (dpkg)+ "NET_BIND_SERVICE", // bind to ports < 1024 (web servers on port 80)+ "SYS_CHROOT", // chroot (dpkg, debootstrap)+ "AUDIT_WRITE", // write to audit log (login-related utils)+ },SecurityOpts: []string{},UserNS: "",Entrypoint: []string{"/bin/sleep"},diff --git a/internal/proxy/proxy.go b/internal/proxy/proxy.goindex 67ed14f4..1782a71b 100644--- a/internal/proxy/proxy.go+++ b/internal/proxy/proxy.go@@ -11,6 +11,7 @@ import ("net/http/httputil""net/url""strings"+ "sync""time""github.com/labstack/echo/v4"@@ -73,12 +74,17 @@ func (p *SandboxProxy) extractSandboxID(host string) (string, bool) {return sandboxID, true}+// isWebSocketUpgrade returns true if the request is a WebSocket upgrade.+func isWebSocketUpgrade(r *http.Request) bool {+ return strings.EqualFold(r.Header.Get("Upgrade"), "websocket") &&+ strings.Contains(strings.ToLower(r.Header.Get("Connection")), "upgrade")+}+// doProxy looks up the sandbox's host port and reverse-proxies the request.// If the sandbox is hibernated, it auto-wakes via the router first.-// After restore, the upstream process may need a moment to stabilize its-// listening socket. We retry on transient connection errors (reset, refused)-// rather than using a static sleep, so the first request after wake succeeds-// without adding unnecessary latency.+// WebSocket upgrade requests are handled via raw TCP hijacking.+// Normal HTTP requests use a buffered reverse proxy with retry logic+// for transient connection errors after CRIU restore.func (p *SandboxProxy) doProxy(c echo.Context, sandboxID string) error {ctx := c.Request().Context()@@ -106,6 +112,93 @@ func (p *SandboxProxy) doProxy(c echo.Context, sandboxID string) error {}}+ addr := fmt.Sprintf("127.0.0.1:%d", hostPort)++ // WebSocket requests need raw TCP hijacking — can't buffer these.+ if isWebSocketUpgrade(c.Request()) {+ return p.doWebSocket(c, sandboxID, addr)+ }++ return p.doHTTP(c, sandboxID, addr, hostPort)+}++// doWebSocket hijacks the client connection and pipes it to the upstream+// container over raw TCP, enabling WebSocket (and any other Upgrade) traffic.+func (p *SandboxProxy) doWebSocket(c echo.Context, sandboxID, addr string) error {+ // Dial the upstream container+ upstream, err := net.DialTimeout("tcp", addr, 5*time.Second)+ if err != nil {+ log.Printf("proxy: websocket dial failed for sandbox %s (%s): %v", sandboxID, addr, err)+ return c.JSON(http.StatusBadGateway, map[string]string{+ "error": fmt.Sprintf("sandbox %s: upstream unavailable", sandboxID),+ })+ }+ defer upstream.Close()++ // Hijack the client connection from Echo/net/http+ hijacker, ok := c.Response().Writer.(http.Hijacker)+ if !ok {+ upstream.Close()+ return c.JSON(http.StatusInternalServerError, map[string]string{+ "error": "websocket hijack not supported",+ })+ }++ clientConn, clientBuf, err := hijacker.Hijack()+ if err != nil {+ upstream.Close()+ log.Printf("proxy: websocket hijack failed for sandbox %s: %v", sandboxID, err)+ return err // connection is in unknown state+ }+ defer clientConn.Close()++ // Forward the original HTTP request (including Upgrade headers) to upstream.+ // This is the raw HTTP request that the upstream will interpret as a WebSocket handshake.+ if err := c.Request().Write(upstream); err != nil {+ log.Printf("proxy: websocket write request failed for sandbox %s: %v", sandboxID, err)+ return nil // connections will close via defers+ }++ // Flush any buffered data the client already sent (e.g., after the headers)+ if clientBuf.Reader.Buffered() > 0 {+ buffered := make([]byte, clientBuf.Reader.Buffered())+ n, _ := clientBuf.Read(buffered)+ if n > 0 {+ upstream.Write(buffered[:n])+ }+ }++ // Bidirectional pipe: client ↔ upstream+ var wg sync.WaitGroup+ wg.Add(2)++ // upstream → client+ go func() {+ defer wg.Done()+ io.Copy(clientConn, upstream)+ // When upstream closes, close the write side of client+ if tc, ok := clientConn.(*net.TCPConn); ok {+ tc.CloseWrite()+ }+ }()++ // client → upstream+ go func() {+ defer wg.Done()+ io.Copy(upstream, clientConn)+ // When client closes, close the write side of upstream+ if tc, ok := upstream.(*net.TCPConn); ok {+ tc.CloseWrite()+ }+ }()++ wg.Wait()+ return nil+}++// doHTTP handles normal (non-WebSocket) HTTP requests with buffered reverse proxy+// and retry logic for transient errors after CRIU restore.+func (p *SandboxProxy) doHTTP(c echo.Context, sandboxID, addr string, hostPort int) error {// Buffer the request body so we can replay it across retries.var bodyBytes []byteif c.Request().Body != nil {@@ -119,7 +212,6 @@ func (p *SandboxProxy) doProxy(c echo.Context, sandboxID string) error {c.Request().Body.Close()}- addr := fmt.Sprintf("127.0.0.1:%d", hostPort)target := &url.URL{Scheme: "http",Host: addr,diff --git a/internal/sandbox/exec.go b/internal/sandbox/exec.goindex e6d7aac4..db0b17ed 100644--- a/internal/sandbox/exec.go+++ b/internal/sandbox/exec.go@@ -24,11 +24,16 @@ func (m *Manager) Exec(ctx context.Context, sandboxID string, cfg types.ProcessCcommand := buildCommand(cfg.Command, cfg.Args)+ cwd := cfg.Cwd+ if cwd == "" {+ cwd = "/workspace"+ }+result, err := m.podman.ExecInContainer(execCtx, podman.ExecConfig{Container: container,Command: command,Env: cfg.Env,- Cwd: cfg.Cwd,+ Cwd: cwd,})if err != nil {if execCtx.Err() == context.DeadlineExceeded {diff --git a/internal/sandbox/manager.go b/internal/sandbox/manager.goindex 31d328ba..c192e9c5 100644--- a/internal/sandbox/manager.go+++ b/internal/sandbox/manager.go@@ -81,21 +81,25 @@ func (m *Manager) Create(ctx context.Context, cfg types.SandboxConfig) (*types.S}// Always use bridge networking for subdomain proxy access.- // Containers get port 80 published to a random host port.+ // Container port defaults to 80 but can be overridden (e.g., 3000, 8080).ccfg.NetworkMode = "bridge"- ccfg.CapAdd = []string{"NET_BIND_SERVICE"} // Allow binding to port 80 inside the container++ containerPort := cfg.Port+ if containerPort <= 0 {+ containerPort = 80+ }hostPort, err := podman.FindFreePort()if err != nil {return nil, fmt.Errorf("failed to allocate host port for sandbox %s: %w", id, err)}- ccfg.Publish = []string{fmt.Sprintf("%d:80/tcp", hostPort)}+ ccfg.Publish = []string{fmt.Sprintf("%d:%d/tcp", hostPort, containerPort)}ccfg.Labels[labelHostPort] = strconv.Itoa(hostPort)// Make /tmp writable for sandbox useccfg.TmpFS["/tmp"] = "rw,size=100m"- // Add a writable home directory- ccfg.TmpFS["/home/user"] = "rw,size=200m"+ // Add a writable workspace directory (default working directory for users)+ ccfg.TmpFS["/workspace"] = "rw,size=200m"if _, err := m.podman.CreateContainer(ctx, ccfg); err != nil {return nil, fmt.Errorf("failed to create sandbox %s: %w", id, err)diff --git a/internal/sandbox/pty.go b/internal/sandbox/pty.goindex 0e7320f7..302c3151 100644--- a/internal/sandbox/pty.go+++ b/internal/sandbox/pty.go@@ -59,6 +59,7 @@ func (pm *PTYManager) CreateSession(sandboxID string, req types.PTYCreateRequestargs := []string{"exec", "-it","--env", "TERM=xterm-256color",+ "--workdir", "/workspace",containerName,shell,}diff --git a/internal/worker/grpc_server.go b/internal/worker/grpc_server.goindex be0547dc..7180ad21 100644--- a/internal/worker/grpc_server.go+++ b/internal/worker/grpc_server.go@@ -75,6 +75,7 @@ func (s *GRPCServer) CreateSandbox(ctx context.Context, req *pb.CreateSandboxReqCpuCount: int(req.CpuCount),NetworkEnabled: req.NetworkEnabled,ImageRef: req.ImageRef,+ Port: int(req.Port),}sb, err := s.manager.Create(ctx, cfg)diff --git a/internal/worker/handlers.go b/internal/worker/handlers.goindex 693e8296..e5bc8315 100644--- a/internal/worker/handlers.go+++ b/internal/worker/handlers.go@@ -360,6 +360,24 @@ func (s *HTTPServer) killPTY(c echo.Context) error {return c.NoContent(http.StatusNoContent)}+func (s *HTTPServer) resizePTY(c echo.Context) error {+ sessionID := c.Param("sessionID")++ var req struct {+ Cols int `json:"cols"`+ Rows int `json:"rows"`+ }+ if err := c.Bind(&req); err != nil {+ return c.JSON(http.StatusBadRequest, map[string]string{"error": "invalid request body"})+ }++ if err := s.ptyManager.Resize(sessionID, req.Cols, req.Rows); err != nil {+ return c.JSON(http.StatusNotFound, map[string]string{"error": err.Error()})+ }++ return c.NoContent(http.StatusOK)+}+// refreshToken issues a fresh 24h JWT for a sandbox.// The caller must already be authenticated (existing valid JWT via middleware).func (s *HTTPServer) refreshToken(c echo.Context) error {diff --git a/internal/worker/http_server.go b/internal/worker/http_server.goindex 4485757d..a54dbace 100644--- a/internal/worker/http_server.go+++ b/internal/worker/http_server.go@@ -98,6 +98,7 @@ func NewHTTPServer(mgr *sandbox.Manager, ptyMgr *sandbox.PTYManager, jwtIssuer *// PTYapi.POST("/sandboxes/:id/pty", s.createPTY)api.GET("/sandboxes/:id/pty/:sessionID", s.ptyWebSocket)+ api.POST("/sandboxes/:id/pty/:sessionID/resize", s.resizePTY)api.DELETE("/sandboxes/:id/pty/:sessionID", s.killPTY)return sdiff --git a/pkg/types/sandbox.go b/pkg/types/sandbox.goindex 8f171ee4..675d4d2c 100644--- a/pkg/types/sandbox.go+++ b/pkg/types/sandbox.go@@ -28,7 +28,7 @@ type Sandbox struct {ConnectURL string `json:"connectURL,omitempty"` // Direct worker URL for SDK accessToken string `json:"token,omitempty"` // Sandbox-scoped JWT for worker authDomain string `json:"domain,omitempty"` // Subdomain for web access (e.g., "abc123.workers.opensandbox.dev")- HostPort int `json:"hostPort,omitempty"` // Mapped host port for container port 80+ HostPort int `json:"hostPort,omitempty"` // Mapped host port for the sandbox's container port}// SandboxConfig is the request body for creating a sandbox.@@ -40,6 +40,7 @@ type SandboxConfig struct {CpuCount int `json:"cpuCount,omitempty"` // default 1MemoryMB int `json:"memoryMB,omitempty"` // default 512Envs map[string]string `json:"envs,omitempty"`+ Port int `json:"port,omitempty"` // container port to expose via subdomain (default 80)NetworkEnabled bool `json:"networkEnabled,omitempty"`ImageRef string `json:"imageRef,omitempty"` // resolved ECR URI for custom templates}diff --git a/proto/worker/worker.pb.go b/proto/worker/worker.pb.goindex 2a23a5da..b6dae3ea 100644--- a/proto/worker/worker.pb.go+++ b/proto/worker/worker.pb.go@@ -76,6 +76,7 @@ type CreateSandboxRequest struct {CpuCount int32 `protobuf:"varint,5,opt,name=cpu_count,json=cpuCount,proto3" json:"cpu_count,omitempty"`NetworkEnabled bool `protobuf:"varint,6,opt,name=network_enabled,json=networkEnabled,proto3" json:"network_enabled,omitempty"`ImageRef string `protobuf:"bytes,7,opt,name=image_ref,json=imageRef,proto3" json:"image_ref,omitempty"`+ Port int32 `protobuf:"varint,8,opt,name=port,proto3" json:"port,omitempty"` // container port to expose via subdomain (default 80)unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}@@ -159,6 +160,13 @@ func (x *CreateSandboxRequest) GetImageRef() string {return ""}+func (x *CreateSandboxRequest) GetPort() int32 {+ if x != nil {+ return x.Port+ }+ return 0+}+type CreateSandboxResponse struct {state protoimpl.MessageState `protogen:"open.v1"`SandboxId string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"`@@ -1817,7 +1825,7 @@ var File_proto_worker_worker_proto protoreflect.FileDescriptorconst file_proto_worker_worker_proto_rawDesc = "" +"\n" +- "\x19proto/worker/worker.proto\x12\x06worker\"\xc1\x02\n" ++ "\x19proto/worker/worker.proto\x12\x06worker\"\xd5\x02\n" +"\x14CreateSandboxRequest\x12\x1a\n" +"\btemplate\x18\x01 \x01(\tR\btemplate\x12\x18\n" +"\atimeout\x18\x02 \x01(\x05R\atimeout\x12:\n" +@@ -1825,7 +1833,8 @@ const file_proto_worker_worker_proto_rawDesc = "" +"\tmemory_mb\x18\x04 \x01(\x05R\bmemoryMb\x12\x1b\n" +"\tcpu_count\x18\x05 \x01(\x05R\bcpuCount\x12'\n" +"\x0fnetwork_enabled\x18\x06 \x01(\bR\x0enetworkEnabled\x12\x1b\n" +- "\timage_ref\x18\a \x01(\tR\bimageRef\x1a7\n" ++ "\timage_ref\x18\a \x01(\tR\bimageRef\x12\x12\n" ++ "\x04port\x18\b \x01(\x05R\x04port\x1a7\n" +"\tEnvsEntry\x12\x10\n" +"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"N\n" +diff --git a/proto/worker/worker.proto b/proto/worker/worker.protoindex 72c07f3e..d10b24c0 100644--- a/proto/worker/worker.proto+++ b/proto/worker/worker.proto@@ -36,6 +36,7 @@ message CreateSandboxRequest {int32 cpu_count = 5;bool network_enabled = 6;string image_ref = 7;+ int32 port = 8; // container port to expose via subdomain (default 80)}message CreateSandboxResponse {