let s=inputData.envelope; let e; try { if(typeof s==='string' && s.startsWith('Object.to_json(') && s.endsWith(')')) s=s.slice(15,-1); e=typeof s==='string'?JSON.parse(s):s; } catch { return {route:'human_review',reason:'invalid_envelope'}; } let b=e?.response?.body; try { b=typeof b==='string'?JSON.parse(b):b; } catch { return {route:'human_review',reason:'invalid_json'}; } const c=b?.checks?.email; const complete=Number(e?.response?.status)===200 && b?.status==='completed' && b?.mode==='live' && Array.isArray(b?.skipped) && b.skipped.length===0 && c?.status==='completed' && c.error==null && ['allow','review','block'].includes(b?.recommendation); return {route:complete&&b.recommendation==='allow'?'allow':'human_review',reason:complete?b.recommendation:'incomplete_or_unavailable'};