mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-04 07:18:50 +00:00
A local engine reading a long prompt sends the Harness nothing for minutes, so the 4 minute stall limit ended the turn mid-read. The host now hands the bridge the engine's /metrics progress (live.prompt_read, generated, slots); a moving mark keeps the turn alive for at most 30 minutes after the Harness last spoke. An engine that stops reporting still ends at the usual limit. API routes are unchanged.
12 lines
765 B
JavaScript
12 lines
765 B
JavaScript
/**
|
|
* How far a local engine has got, as a short text that changes whenever it makes progress. The agent's stall watchdog
|
|
* compares it with the last one it saw: while a long prompt is read the Harness hears nothing for minutes, but the
|
|
* engine's /metrics (polled every 2 s) shows `live.prompt_read` moving (#3623). Null when the engine is idle or says nothing.
|
|
*/
|
|
export function engineProgressMark(instance) {
|
|
const live = instance?.metrics?.live;
|
|
if (!live || live.state === 'idle' || live.state === 'unloaded') return null;
|
|
const slots = Array.isArray(live.slots) ? live.slots.map(s => `${s?.state}:${s?.prompt_read ?? ''}:${s?.generated ?? ''}`).join(',') : '';
|
|
return `${live.state}|${live.prompt_read ?? ''}|${live.generated ?? ''}|${slots}`;
|
|
}
|