import{a as e,o as t}from"./B7lbTX5X.js";var n=3*6e4;async function r(r=n,i){let a=await e({status:`active`},i),o=new Date(Date.now()-r).toISOString(),s=[];for(let e of a)if(e.lastHeartbeat<o){let n=await t(e.id,`Heartbeat timeout — no heartbeat for >${Math.round(r/1e3)}s`,i);n&&s.push(n)}return s.sort((e,t)=>{let n=e.lastHeartbeat??``,r=t.lastHeartbeat??``;return n<r?-1:+(n>r)}),s}export{n as STALE_THRESHOLD_MS,r as detectCrashedAgents};