  Jets in long-duration $\gamma$-ray bursts (GRBs) have to drill through the
collapsing star in order to break out of it and produce the $\gamma$-ray signal
while the central engine is still active. If the breakout time is shorter for
more powerful engines, then the jet-collapsar interaction acts as a filter of
less luminous jets. We show that the observed broken power-law GRB luminosity
function is a natural outcome of this process. For a theoretically motivated
breakout time that scales with jet luminosity as $L^{-\chi}$ with $\chi\sim
1/3-1/2$, we show that the shape of the $\gamma$-ray duration distribution can
be uniquely determined by the GRB luminosity function and matches the observed
one. This analysis has also interesting implications about the
supernova-central engine connection. We show that not only successful jets can
deposit sufficient energy in the stellar envelope to power the GRB-associated
supernovae, but also failed jets may operate in all Type Ib/c supernovae.
