| 56 | } |
| 57 | |
| 58 | func (s *Server) registerRoutes() { |
| 59 | // Health and readiness endpoints (not under /api) |
| 60 | s.e.GET("/health", s.health) |
| 61 | s.e.GET("/ready", s.ready) |
| 62 | |
| 63 | group := s.e.Group("/api") |
| 64 | |
| 65 | group.GET("/agents", s.getAgents) |
| 66 | group.GET("/agents/:id", s.getAgentConfig) |
| 67 | |
| 68 | group.GET("/sessions", s.getSessions) |
| 69 | group.GET("/sessions/:id", s.getSession) |
| 70 | group.GET("/sessions/:id/status", s.getSessionStatus) |
| 71 | group.GET("/sessions/:id/snapshot", s.getSessionSnapshot) |
| 72 | group.POST("/sessions/:id/resume", s.resumeSession) |
| 73 | group.POST("/sessions/:id/tools/toggle", s.toggleSessionYolo) |
| 74 | group.PATCH("/sessions/:id/permissions", s.updateSessionPermissions) |
| 75 | group.PATCH("/sessions/:id/title", s.updateSessionTitle) |
| 76 | group.PATCH("/sessions/:id/tokens", s.updateSessionTokens) |
| 77 | group.PATCH("/sessions/:id/starred", s.setSessionStarred) |
| 78 | group.GET("/sessions/:id/models", s.getSessionModels) |
| 79 | group.POST("/sessions", s.createSession) |
| 80 | group.POST("/sessions/:id/fork", s.forkSession) |
| 81 | group.DELETE("/sessions/:id", s.deleteSession) |
| 82 | group.POST("/sessions/:id/agent/:agent", s.runAgent) |
| 83 | group.POST("/sessions/:id/agent/:agent/:agent_name", s.runAgent) |
| 84 | group.POST("/sessions/:id/elicitation", s.elicitation) |
| 85 | group.POST("/sessions/:id/steer", s.steerSession) |
| 86 | group.POST("/sessions/:id/followup", s.followUpSession) |
| 87 | group.GET("/sessions/:id/events", s.sessionEvents) |
| 88 | group.POST("/sessions/:id/messages", s.addMessage) |
| 89 | group.PATCH("/sessions/:id/messages/:msg_id", s.updateMessage) |
| 90 | group.POST("/sessions/:id/summaries", s.addSummary) |
| 91 | group.GET("/sessions/:id/queue", s.getSessionQueueStatus) |
| 92 | group.GET("/sessions/:id/recovery", s.getSessionRecoveryData) |
| 93 | group.POST("/sessions/batch/delete", s.batchDeleteSessions) |
| 94 | group.POST("/sessions/batch/export", s.batchExportSessions) |
| 95 | |
| 96 | group.GET("/agents/:id/:agent_name/tools/count", s.getAgentToolCount) |
| 97 | |
| 98 | group.POST("/mcp-oauth/callback", s.mcpOAuthCallback) |
| 99 | |
| 100 | group.GET("/ping", func(c echo.Context) error { |
| 101 | return c.JSON(http.StatusOK, map[string]string{"status": "ok"}) |
| 102 | }) |
| 103 | group.GET("/ready", s.sessionsReady) |
| 104 | } |
| 105 | |
| 106 | func (s *Server) Serve(ctx context.Context, ln net.Listener) error { |
| 107 | // Wrap the Echo handler with otelhttp so the configured W3C |