An open-source, faster Devin alternative
TypeScript
Merge pull request #62 from diggerhq/tls2
Mohamed Habibec5cf2422528
diff --cc internal/api/router.goindex a354d9ea,b9e4b2f6..fd260085--- a/internal/api/router.go+++ b/internal/api/router.go@@@ -155,38 -157,77 +157,76 @@@ func NewServer(mgr sandbox.Manager, ptyapi.GET("/sandboxes/:id/preview", s.listPreviewURLs)api.DELETE("/sandboxes/:id/preview/:port", s.deletePreviewURL)- // Exec sessions (replaces old /commands)- api.POST("/sandboxes/:id/exec", s.createExecSession)- api.GET("/sandboxes/:id/exec", s.listExecSessions)- api.GET("/sandboxes/:id/exec/:sessionID", s.execSessionWebSocket)- api.POST("/sandboxes/:id/exec/:sessionID/kill", s.killExecSession)- api.POST("/sandboxes/:id/exec/run", s.execRun)-- // Agent sessions (Claude Agent SDK)- api.POST("/sandboxes/:id/agent", s.createAgentSession)- api.GET("/sandboxes/:id/agent", s.listAgentSessions)- api.POST("/sandboxes/:id/agent/:sid/prompt", s.sendAgentPrompt)- api.POST("/sandboxes/:id/agent/:sid/interrupt", s.interruptAgent)- api.POST("/sandboxes/:id/agent/:sid/kill", s.killAgentSession)-- // Filesystem- api.GET("/sandboxes/:id/files", s.readFile)- api.PUT("/sandboxes/:id/files", s.writeFile)- api.GET("/sandboxes/:id/files/list", s.listDir)- api.POST("/sandboxes/:id/files/mkdir", s.makeDir)- api.DELETE("/sandboxes/:id/files", s.removeFile)-- // PTY- api.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)+ // Data-plane routes: in server mode, proxy to workers; otherwise handle locally+ if s.sandboxAPIProxy != nil {+ // Server mode: proxy all data-plane requests to the worker that owns the sandbox+ pxy := s.sandboxAPIProxy.ProxyHandler++ // Exec+ api.POST("/sandboxes/:id/exec", pxy)+ api.GET("/sandboxes/:id/exec", pxy)+ api.GET("/sandboxes/:id/exec/:sessionID", pxy)+ api.POST("/sandboxes/:id/exec/:sessionID/kill", pxy)+ api.POST("/sandboxes/:id/exec/run", pxy)++ // Agent+ api.POST("/sandboxes/:id/agent", pxy)+ api.GET("/sandboxes/:id/agent", pxy)+ api.POST("/sandboxes/:id/agent/:sid/prompt", pxy)+ api.POST("/sandboxes/:id/agent/:sid/interrupt", pxy)+ api.POST("/sandboxes/:id/agent/:sid/kill", pxy)++ // Filesystem+ api.GET("/sandboxes/:id/files", pxy)+ api.PUT("/sandboxes/:id/files", pxy)+ api.GET("/sandboxes/:id/files/list", pxy)+ api.POST("/sandboxes/:id/files/mkdir", pxy)+ api.DELETE("/sandboxes/:id/files", pxy)++ // PTY+ api.POST("/sandboxes/:id/pty", pxy)+ api.GET("/sandboxes/:id/pty/:sessionID", pxy)+ api.POST("/sandboxes/:id/pty/:sessionID/resize", pxy)+ api.DELETE("/sandboxes/:id/pty/:sessionID", pxy)++ // Timeout+ api.POST("/sandboxes/:id/timeout", pxy)++ // Token refresh+ api.POST("/sandboxes/:id/token/refresh", pxy)+ } else {+ // Combined/worker mode: handle locally+ api.POST("/sandboxes/:id/exec", s.createExecSession)+ api.GET("/sandboxes/:id/exec", s.listExecSessions)+ api.GET("/sandboxes/:id/exec/:sessionID", s.execSessionWebSocket)+ api.POST("/sandboxes/:id/exec/:sessionID/kill", s.killExecSession)+ api.POST("/sandboxes/:id/exec/run", s.execRun)++ api.POST("/sandboxes/:id/agent", s.createAgentSession)+ api.GET("/sandboxes/:id/agent", s.listAgentSessions)+ api.POST("/sandboxes/:id/agent/:sid/prompt", s.sendAgentPrompt)+ api.POST("/sandboxes/:id/agent/:sid/interrupt", s.interruptAgent)+ api.POST("/sandboxes/:id/agent/:sid/kill", s.killAgentSession)++ api.GET("/sandboxes/:id/files", s.readFile)+ api.PUT("/sandboxes/:id/files", s.writeFile)+ api.GET("/sandboxes/:id/files/list", s.listDir)+ api.POST("/sandboxes/:id/files/mkdir", s.makeDir)+ api.DELETE("/sandboxes/:id/files", s.removeFile)++ api.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)++ api.POST("/sandboxes/:id/timeout", s.setTimeout)+ }- // Templates- api.POST("/templates", s.buildTemplate)- api.GET("/templates", s.listTemplates)- api.GET("/templates/:name", s.getTemplate)- api.DELETE("/templates/:name", s.deleteTemplate)- api.POST("/sandboxes/:sandboxId/save-as-template", s.dashboardSaveAsTemplate)+ // Snapshots (pre-built declarative images)+ api.POST("/snapshots", s.createSnapshot)+ api.GET("/snapshots", s.listSnapshots)+ api.GET("/snapshots/:name", s.getSnapshot)+ api.DELETE("/snapshots/:name", s.deleteSnapshot)// Workers (server mode only — queries worker registry)api.GET("/workers", s.listWorkers)