Add shallotand cook, stirring occasionallyand reducing heat if needed toprevent burning, until soft,4-5 minutes.
Add garlic andcook, stirring occasionally,until aromatic, about 1 minute.
Transfer shallot mixture to alarge bowl and let cool.
Combine panko and milk ina small bowl; let stand until milkis absorbed, 2-3 minutes.
Addto bowl with shallot mixture.Squeeze any excess liquid fromsauerkraut; coarsely chop andadd to bowl. Stir in 1 tablespoon Dijonmustard and caraway seeds;season with salt and pepper.
Mix well.
Add pork; using a forkor your hands, gently mix untiljust combined (do not overmix).
Line a baking sheet withparchment paper.
Roll outpastry on a lightly flouredsurface to a 14x10" rectangle.
Cut lengthwise into three14x3 1/3" strips.
Transfer strips toprepared baking sheet. Usingone-third of sausage filling andleaving a 1" border at each end,pat sausage to form a thin logof filling down the center of1 pastry strip. Fold pastry oversausage mixture to enclose,then press pastry together toseal. Fold seam under to ensurethat sausage is tightly wrapped.Repeat with remaining pastryand sausage mixture.
Cut small diagonal slits at1" intervals along top of pastries(to help release steam).
Brushtop and sides of pastry withbeaten egg; chill in freezer forabout 30 minutes. DO AHEAD:Pastries can be made 2 weeksahead. Cover tightly with plasticwrap, then foil, and keep frozen.
Preheat oven to 425°F.
Bakepastries (if frozen, no needto thaw) until puffed and lightbrown, about 15 minutes.Reduce heat to 350°F; continuebaking until sausage is cookedthrough and pastry is goldenand completely puffed, about25 minutes.