The only connection I found to Kosice via bahn.de was 10 - 12 hours with 3-4 stops. I saw one non-stop train to Bratislava that may have a sleeper car, but with a note that says it may not run every day in September. Any advice?
Under the currently published train schedules, through June 9, the best train connection departs Krakow Glowny at 10:30 and makes 2 connections to reach Kosice at 19:53 daily. Schedules should be similar beyond that date, or may even improve for the summer, but won't be confirmed for a while.
You can also take a train to Zakopane, Poland, then bus to Poprad-Tatry, then train within Slovakia. There are also some direct bus services; try searching with Rome2rio.com, getbybus.com, or busbud.com.
There is one direct train from Krakow to Bratislava - it's a sleeper - overnight. But it is not non-stop. There are 9 stops on the way between Krakow and Bratislava. Currently there is no train from Krakow to Zakopane. You can go by train only from Sucha Beskidzka, from Krakow to S.B. you have to go by bus. The railroad is being reconstructed. It takes 5 hours plus minus to get to Zakopane from Krakow this way. I would recommend to go by bus, it's between 2 and 3 hours. Better yet inquire in Krakow if there is direct bus to Bratislava or at least to Poprad where you would change to train.
There is no reasonable train connection between Krakow and Kosice these days. But, there are very reasonable buses, starting at 4.50EUR and taking 4.5hrs from Krakow to Kosice (or Tatras/Poprad/Presov). See https://www.leoexpress.com/en/magazine/news/to-krakow-even-more-comfortably . The trains are currently not operating because they were ridiculously slow (7hrs). Soon (in 5 or so years), the tracks in Poland will get upgraded and then it will be possible to travel Krakow-Kosice by train in less than 4hrs (which is still not extra fast given that it's just 250km).
PS: LeoExpress also offers train connections via Ostrava/Bohumin. But that's a huge sidetrip.
PS2: if you wanted to try to go the direct way (ie, roughly along the bee-line, the way the direct train used to operate), you can take train from Krakow to Piwnicna-Zdroj, then a short cross-border bus to Stara Lubovna and then another train to Kosice.