You have some husbandry issues that may be causing the problems you are seeing.
The basking area should have 105*-110*F and the warm side mid 90's and cool side of the tank in the 85* range. This is important for digestion and passing of stool. If the temps are not correct, this can also cause a problem.
You need to have 2 lights, a day time basking bulb as well as a UVB. I recommend a reptisun 10.0 and UVB lights do not put out heat. The UVB bulb is needed to stop Metabolic Bone Disease. The UVB needs to be changed every 6 months.
The UVB should be a tube type. Coil UVB bulbs can injure the eyes. Compact UVB problems: http://www.uvguide.co.uk/phototherapyphosphor-info.htm This should not be giving off a lot of heat, but UVB rays.
The UVB bulb should not have any plastic between it and the Dragon, it needs to run the length of the tank and be no more than 12" from the Dragon. Both lights should run daily for 12-14 hours a day. UVB cannot penetrate glass so sitting by the window, does not supply UVB rays which are needed to metabolize calcium. The UVB light can change the level of activity as well as the Dragon can get MBD: http://exoticpets.about.com/cs/reptilesgeneral/a/metabolicbd.htm That is why it is extremely important to be giving a calcium suppleent 5 days a week.
You should be feeding Collard greens, mustard greens, dandelion greens, escarole and curly endives. Butternut squash and various berries are great for a treat. The Veggies should be put in fresh daily, and done about an hour after lights on. The kale you are feeding will bind calcium adding to problems. They need 80% veggies daily and 20% live prey overr a year of age. The live prey should include crickets, silk worms, roaches, goliath worms and phoenix worms.The canned prey looses the nutritional value and is high in chitin which is the outer shells and can cause a blockage.
Super worms and wax worms are like giving the Dragon candy. All veggies and prey should be dusted with calcium daily 5 days a week and vitamins 2 days a week. The super worms also hav e high Chitin amount that may have been the problem with the gaping and problems breathing.
Another issue if the Dragon was outside, it is possible it ate a wild caught insect that was toxic. Fireflies are one that can cause serious toxicity issues.
Please let me know if you got any response. I am standing by.