okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Agent watchdog: the engine's prompt-read progress counts as activity; local routes get a 60 min stream-idle timeout (#3623)425bca719

main
765 B11 linesraw
1/**
2 * How far a local engine has got, as a short text that changes whenever it makes progress. The agent's stall watchdog
3 * compares it with the last one it saw: while a long prompt is read the Harness hears nothing for minutes, but the
4 * engine's /metrics (polled every 2 s) shows `live.prompt_read` moving (#3623). Null when the engine is idle or says nothing.
5 */
6export function engineProgressMark(instance) {
7  const live = instance?.metrics?.live;
8  if (!live || live.state === 'idle' || live.state === 'unloaded') return null;
9  const slots = Array.isArray(live.slots) ? live.slots.map(s => `${s?.state}:${s?.prompt_read ?? ''}:${s?.generated ?? ''}`).join(',') : '';
10  return `${live.state}|${live.prompt_read ?? ''}|${live.generated ?? ''}|${slots}`;
11}