You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fcbd951
Browse filesBrowse the repository at this point in the historyBrowse files
function runChanged(oldRunId,nextRunId){return oldRunId!==null&&oldRunId!==undefined&&nextRunId!==null&&nextRunId!==undefined&&String(oldRunId)!==String(nextRunId);}
function bayPendingSparkline(samples,label){if(!samples.length)return '<div class="bay-control-empty">Awaiting history.</div>';var width=180,height=28,pad=2;var first=Date.parse(samples[0].at),last=Date.parse(samples[samples.length-1].at),span=Math.max(1,last-first),maximum=Math.max(1,...samples.map(function(sample){return sample.pending;}));var previous=null;var path=samples.map(function(sample){var at=Date.parse(sample.at);var x=pad+(at-first)/span*(width-pad*2);var y=height-pad-(sample.pending/maximum)*(height-pad*2);var connected=previous!==null&&at-previous<=12*60000;previous=at;return (connected?"L":"M")+x.toFixed(1)+" "+y.toFixed(1);}).join(" ");var points=samples.map(function(sample){var at=Date.parse(sample.at);var x=pad+(at-first)/span*(width-pad*2);var y=height-pad-(sample.pending/maximum)*(height-pad*2);return '<circle class="bay-control-point" cx="'+x.toFixed(1)+'" cy="'+y.toFixed(1)+'" r="2"><title>'+esc(bayFormatTime(sample.at)+" · "+sample.pending+" waiting")+'</title></circle>';}).join("");return '<div class="bay-control-chart"><small>Waiting</small><svg viewBox="0 0 '+width+' '+height+'" role="img" aria-label="'+esc(label+' pending backlog over six hours; hover a point for the count')+'"><line class="bay-control-grid" x1="0" x2="'+width+'" y1="'+(height/2)+'" y2="'+(height/2)+'"></line><path class="bay-control-line" d="'+path+'"></path>'+points+'</svg></div>';}
200
+
function bayPendingSparkline(samples,label){var valid=samples.filter(function(sample){return sample.valid;});if(!valid.length)return '<div class="bay-control-empty">Awaiting history.</div>';var width=180,height=28,pad=2;var first=Date.parse(samples[0].at),last=Date.parse(samples[samples.length-1].at),span=Math.max(1,last-first),maximum=Math.max(1,...valid.map(function(sample){return sample.pending;}));var previous=null;var path=samples.map(function(sample){if(!sample.valid){previous=null;return "";}var at=Date.parse(sample.at);var x=pad+(at-first)/span*(width-pad*2);var y=height-pad-(sample.pending/maximum)*(height-pad*2);var connected=previous!==null&&at-previous<=12*60000;previous=at;return (connected?"L":"M")+x.toFixed(1)+" "+y.toFixed(1);}).filter(Boolean).join(" ");var points=valid.map(function(sample){var at=Date.parse(sample.at);var x=pad+(at-first)/span*(width-pad*2);var y=height-pad-(sample.pending/maximum)*(height-pad*2);return '<circle class="bay-control-point" cx="'+x.toFixed(1)+'" cy="'+y.toFixed(1)+'" r="2"><title>'+esc(bayFormatTime(sample.at)+" · "+sample.pending+" waiting")+'</title></circle>';}).join("");return '<div class="bay-control-chart"><small>Waiting</small><svg viewBox="0 0 '+width+' '+height+'" role="img" aria-label="'+esc(label+' pending backlog over six hours; hover a point for the count')+'"><line class="bay-control-grid" x1="0" x2="'+width+'" y1="'+(height/2)+'" y2="'+(height/2)+'"></line><path class="bay-control-line" d="'+path+'"></path>'+points+'</svg></div>';}
201
201
function bayRateSparkline(samples,label){if(!samples.length)return '<div class="bay-control-chart"><small>Net rate</small><div class="bay-control-empty">Awaiting history.</div></div>';var width=180,height=28,pad=2;var first=Date.parse(samples[0].at),last=Date.parse(samples[samples.length-1].at),span=Math.max(1,last-first),maximum=Math.max(1,...samples.map(function(sample){return Math.abs(sample.rate);}));var previous=null;var path=samples.map(function(sample){var at=Date.parse(sample.at);var x=pad+(at-first)/span*(width-pad*2);var y=height/2-(sample.rate/(maximum*2))*(height-pad*2);var connected=previous!==null&&sample.segmentId===previous.segmentId&&at-previous.at<=12*60000;previous={at:at,segmentId:sample.segmentId};return (connected?"L":"M")+x.toFixed(1)+" "+y.toFixed(1);}).join(" ");var points=samples.map(function(sample){var at=Date.parse(sample.at);var x=pad+(at-first)/span*(width-pad*2);var y=height/2-(sample.rate/(maximum*2))*(height-pad*2);var rounded=Math.round(sample.rate);var prefix=rounded>0?"+":"";var provisional=sample.provisional?" · provisional window":"";return '<circle class="bay-control-point rate" cx="'+x.toFixed(1)+'" cy="'+y.toFixed(1)+'" r="2"><title>'+esc(bayFormatTime(sample.at)+" · "+prefix+rounded+" / hour"+provisional)+'</title></circle>';}).join("");return '<div class="bay-control-chart"><small>Net rate</small><svg viewBox="0 0 '+width+' '+height+'" role="img" aria-label="'+esc(label+' net throughput over six hours; hover a point for the hourly rate')+'"><line class="bay-control-grid" x1="0" x2="'+width+'" y1="'+(height/2)+'" y2="'+(height/2)+'"></line><path class="bay-control-line rate" d="'+path+'"></path>'+points+'</svg></div>';}
202
202
function bayRateCopy(rate,historyStale){if(historyStale)return {className:"collecting",label:"Stale · no rate sample in the last 12m"};if(rate===null)return {className:"collecting",label:"Awaiting enough flow history"};if(rate>0)return {className:"",label:"Catching up · +"+rate+" / hour"};if(rate<0)return {className:"rising",label:"Falling behind · −"+Math.abs(rate)+" / hour"};return {className:"",label:"Balanced · 0 / hour"};}
203
-
function bayLaneCard(title,laneName){var queue=state.data&&state.data.exact_review_queue||{};var lane=queue.lanes&&queue.lanes[laneName]||{};var samples=bayHistory(laneName);var rateSamples=bayRateHistory(samples,laneName);var historyStale=samples.length>0&&!bayHistoryIsCurrent(samples);var trend=historyStale?{className:"collecting",label:"History stale · awaiting current sample"}:bayPendingTrend(samples);var latestSample=samples[samples.length-1];var latestRateSample=rateSamples[rateSamples.length-1];var latestRate=!historyStale&&latestSample&&latestRateSample&&latestSample.at===latestRateSample.at?Math.round(latestRateSample.rate):null;var rate=bayRateCopy(latestRate,historyStale);var pending=Number(lane.pending||0);var live=[];if(Number(lane.ready||0))live.push(lane.ready+" ready");if(Number(lane.backoff||0))live.push(lane.backoff+" backoff");if(Number(lane.dispatching||0))live.push(lane.dispatching+" dispatching");if(Number(lane.leased||0))live.push(lane.leased+" leased");var label=title+". "+pending+" pending; "+(live.join(", ")||"no active queue items")+". Historical samples are from the dashboard's cached health history.";return '<section class="bay-control-card" title="'+esc(label)+'"><h2>'+esc(title)+'</h2><div class="bay-control-summary"><strong>'+pending+' waiting</strong><span>'+esc(live.join(" · ")||"No active items")+'</span></div><div class="bay-control-charts">'+bayPendingSparkline(samples,title)+bayRateSparkline(rateSamples,title)+'</div><div class="bay-control-rate '+trend.className+'">'+esc(trend.label)+' · '+esc(rate.label)+'</div></section>';}
203
+
function bayLaneCard(title,laneName){var queue=state.data&&state.data.exact_review_queue||{};var lane=queue.lanes&&queue.lanes[laneName]||{};var samples=bayHistory(laneName);var rateSamples=bayRateHistory(samples,laneName);var historyStale=samples.length>0&&!bayHistoryIsCurrent(samples);var historyGap=samples.length>0&&!samples[samples.length-1].valid;var trend=historyGap?{className:"collecting",label:"History gap · awaiting current sample"}:historyStale?{className:"collecting",label:"History stale · awaiting current sample"}:bayPendingTrend(samples);var latestSample=samples[samples.length-1];var latestRateSample=rateSamples[rateSamples.length-1];var latestRate=!historyStale&&!historyGap&&latestSample&&latestRateSample&&latestSample.at===latestRateSample.at?Math.round(latestRateSample.rate):null;var rate=historyGap?{className:"collecting",label:"No rate across a history gap"}:bayRateCopy(latestRate,historyStale);var pending=Number(lane.pending||0);var live=[];if(Number(lane.ready||0))live.push(lane.ready+" ready");if(Number(lane.backoff||0))live.push(lane.backoff+" backoff");if(Number(lane.dispatching||0))live.push(lane.dispatching+" dispatching");if(Number(lane.leased||0))live.push(lane.leased+" leased");var label=title+". "+pending+" pending; "+(live.join(", ")||"no active queue items")+". Historical samples are from the dashboard's cached health history.";return '<section class="bay-control-card" title="'+esc(label)+'"><h2>'+esc(title)+'</h2><div class="bay-control-summary"><strong>'+pending+' waiting</strong><span>'+esc(live.join(" · ")||"No active items")+'</span></div><div class="bay-control-charts">'+bayPendingSparkline(samples,title)+bayRateSparkline(rateSamples,title)+'</div><div class="bay-control-rate '+trend.className+'">'+esc(trend.label)+' · '+esc(rate.label)+'</div></section>';}
204
204
function bayHandoffCard(){var queue=state.data&&state.data.exact_review_queue||{};var handoff=queue.handoff_health||{};var phases=handoff.phases||{};var pending=phases.pending&&Number(phases.pending.count||0)||0;var dispatching=phases.dispatching&&Number(phases.dispatching.count||0)||0;var leased=phases.leased&&Number(phases.leased.count||0)||0;var status=String(handoff.status||"unknown");var title="Queue handoff health. Pending work awaits review admission; dispatching work is awaiting a run claim; leased work is owned by an active run.";return '<section class="bay-control-card" title="'+esc(title)+'"><h2>Queue handoff</h2><div class="bay-handoff"><div><span>Pending</span><strong>'+pending+'</strong></div><div><span>Dispatching</span><strong>'+dispatching+'</strong></div><div><span>Leased</span><strong>'+leased+'</strong></div></div><span class="bay-handoff-status '+esc(status)+'">'+esc(status)+'</span></section>';}
205
205
function renderBayControl(){var board=document.getElementById("bay-control-board");if(!board)return;var queue=state.data&&state.data.exact_review_queue;if(!queue){board.innerHTML='<section class="bay-control-card"><h2>Exact review control board</h2><p class="bay-control-empty">Queue telemetry is unavailable in this snapshot.</p></section>';return;}board.innerHTML=bayLaneCard("Review admission","review")+bayLaneCard("Result publication","publication")+bayHandoffCard();}
206
206
async function loadBayHistory(){if(state.healthHistoryLoading||Date.now()-state.healthHistoryLoadedAt<60000)return;state.healthHistoryLoading=true;state.healthHistoryLoadedAt=Date.now();try{var origin=state.previewSource?["https://clawsweeper","openclaw","ai"].join("."):"";var response=await fetch(origin+"/api/health-history?range=6h",{cache:"no-store"});if(!response.ok)throw new Error("history returned "+response.status);var payload=await response.json();state.healthHistory=Array.isArray(payload.samples)?payload.samples:[];state.healthHistoryLoadedAt=Date.now();renderBayControl();}catch(_){renderBayControl();}finally{state.healthHistoryLoading=false;}}
0 commit comments