Sorry to hear of your trouble! I've had an old '90 7.3 IDI NA Diesel for many years. Your engine is many years later but the scarcity is probably similar. If I had a newer truck that was worth the expenditure, I'd contact a Jasper installer and get a quote on a reman engine. That installer will be able to diagnose the engine and order the level of rebuild from Jasper that you need (short block, long block, full engine, etc).
If I had such a failure here's what I'd do.
First, check coolant to see if there a problem there, like oil contamination, or low level. If engine still runs see if bubbles come out the cap. Some of these engines suffer from cavitation which results in a puncture through the cylinder wall. Your later engine might not be prone to that like the older 7.3s are. If you find oil in the coolant, that's bad news and you'll need a replacement engine or block and rebuild.
Second, have a sample of the oil tested. The testing company can tell you what type metal you are seeing, and that can help pinpoint the problem. However, a knock certainly points out main bearing, rod bearing, wrist pin, etc. so a teardown will be necessary. Might be able to diagnose from pulling the pan.
Regrettably, you are probably looking at an expensive repair. Any recourse from the seller?
Bob