An open-source, faster Devin alternative
TypeScript
prod fixes
Brian Reardon3ce3f3c444c1
diff --git a/cmd/server/main.go b/cmd/server/main.goindex abb038e8..8000099e 100644--- a/cmd/server/main.go+++ b/cmd/server/main.go@@ -167,6 +167,12 @@ func main() {}}+ // Set sandbox domain for API responses (works in both server and combined mode)+ if cfg.SandboxDomain != "" && cfg.SandboxDomain != "localhost" {+ opts.SandboxDomain = cfg.SandboxDomain+ log.Printf("opensandbox: sandbox domain configured (%s)", cfg.SandboxDomain)+ }+// Initialize Redis worker registry in server modeif cfg.Mode == "server" && cfg.RedisURL != "" {redisRegistry, err := controlplane.NewRedisWorkerRegistry(cfg.RedisURL)diff --git a/internal/api/sandbox.go b/internal/api/sandbox.goindex 779b3d3b..b80ae13d 100644--- a/internal/api/sandbox.go+++ b/internal/api/sandbox.go@@ -176,14 +176,19 @@ func (s *Server) createSandboxRemote(c echo.Context, ctx context.Context, cfg ty_, _ = s.store.CreateSandboxSession(ctx, grpcResp.SandboxId, orgID, nil, template, region, worker.ID, cfgJSON, metadataJSON)}- return c.JSON(http.StatusCreated, map[string]interface{}{+ resp := map[string]interface{}{"sandboxID": grpcResp.SandboxId,"connectURL": worker.HTTPAddr,"token": token,"status": grpcResp.Status,"region": region,"workerID": worker.ID,- })+ }+ if s.sandboxDomain != "" {+ resp["domain"] = fmt.Sprintf("%s.%s", grpcResp.SandboxId, s.sandboxDomain)+ }++ return c.JSON(http.StatusCreated, resp)}func (s *Server) getSandbox(c echo.Context) error {@@ -241,13 +246,17 @@ func (s *Server) getSandboxRemote(c echo.Context, sandboxID string) error {// Hibernated sandboxes have no workerif session.Status == "hibernated" {- return c.JSON(http.StatusOK, map[string]interface{}{+ resp := map[string]interface{}{"sandboxID": sandboxID,"status": "hibernated","region": session.Region,"template": session.Template,"startedAt": session.StartedAt,- })+ }+ if s.sandboxDomain != "" {+ resp["domain"] = fmt.Sprintf("%s.%s", sandboxID, s.sandboxDomain)+ }+ return c.JSON(http.StatusOK, resp)}// Look up worker address@@ -267,7 +276,7 @@ func (s *Server) getSandboxRemote(c echo.Context, sandboxID string) error {}}- return c.JSON(http.StatusOK, map[string]interface{}{+ resp := map[string]interface{}{"sandboxID": sandboxID,"connectURL": connectURL,"token": token,@@ -276,7 +285,12 @@ func (s *Server) getSandboxRemote(c echo.Context, sandboxID string) error {"workerID": session.WorkerID,"startedAt": session.StartedAt,"template": session.Template,- })+ }+ if s.sandboxDomain != "" {+ resp["domain"] = fmt.Sprintf("%s.%s", sandboxID, s.sandboxDomain)+ }++ return c.JSON(http.StatusOK, resp)}func (s *Server) killSandbox(c echo.Context) error {@@ -556,12 +570,17 @@ func (s *Server) hibernateSandboxRemote(c echo.Context, sandboxID string) errorsession.Region, session.Template, session.Config)_ = s.store.UpdateSandboxSessionStatus(c.Request().Context(), sandboxID, "hibernated", nil)- return c.JSON(http.StatusOK, map[string]interface{}{+ resp := map[string]interface{}{"sandboxID": sandboxID,"status": "hibernated","checkpointKey": grpcResp.CheckpointKey,"sizeBytes": grpcResp.SizeBytes,- })+ }+ if s.sandboxDomain != "" {+ resp["domain"] = fmt.Sprintf("%s.%s", sandboxID, s.sandboxDomain)+ }++ return c.JSON(http.StatusOK, resp)}func (s *Server) wakeSandbox(c echo.Context) error {@@ -696,14 +715,19 @@ func (s *Server) wakeSandboxRemote(c echo.Context, sandboxID string, req types.W}}- return c.JSON(http.StatusOK, map[string]interface{}{+ resp := map[string]interface{}{"sandboxID": sandboxID,"connectURL": worker.HTTPAddr,"token": token,"status": grpcResp.Status,"region": region,"workerID": worker.ID,- })+ }+ if s.sandboxDomain != "" {+ resp["domain"] = fmt.Sprintf("%s.%s", sandboxID, s.sandboxDomain)+ }++ return c.JSON(http.StatusOK, resp)}// listSessions returns session history from PostgreSQL.