// Isolated owned FIFO probe: parent bounds/kills this exact child if I/O blocks. import fs from 'node:fs'; import { join } from 'node:path'; import { watchModelOutput } from '../../src/model-stall.mjs'; import { getPriority, setPriority } from 'node:os'; // Enforce the gate's existing nice19 contract on this owned probe itself. setPriority(0, 19); let stops=0;const receipts=[]; const watch=watchModelOutput({runDir:process.argv[2],armAtFirstTurn:true,seconds:60,keyId:'0123456789ab',stop:async()=>{stops++;},receipt:r=>receipts.push(r)}); const clock=setTimeout(watch.cancel,100); await watch.done;clearTimeout(clock); const marker=join(process.argv[2],'proxy-first-turn'),openMarkerFds=fs.readdirSync('/proc/self/fd').filter(n=>{try{return fs.readlinkSync('/proc/self/fd/'+n)===marker;}catch{return false;}}).length; process.stdout.write(JSON.stringify({stops,receipts,nice:getPriority(0),openMarkerFds})+'\n');