agents-relay 1.0.150 → 1.0.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dashboard-html.js +5 -1
- package/dist/dashboard.js +7 -2
- package/package.json +1 -1
package/dist/dashboard-html.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
const packageVersion = createRequire(import.meta.url)('../package.json').version;
|
|
3
|
+
export const dashboardVersion = packageVersion;
|
|
3
4
|
export const dashboardHtml = `<!doctype html>
|
|
4
5
|
<html lang="en" data-dashboard-contract="safe-dom,named-relay-events,snapshot-events,bounded-event-history">
|
|
5
6
|
<head>
|
|
@@ -163,7 +164,7 @@ export const dashboardHtml = `<!doctype html>
|
|
|
163
164
|
</head>
|
|
164
165
|
<body>
|
|
165
166
|
<header>
|
|
166
|
-
<div class="brand"><h1>Agents Relay Console</h1><p class="tagline">Durable PR state is authoritative; events are observability.</p><span class="version">v${
|
|
167
|
+
<div class="brand"><h1>Agents Relay Console</h1><p class="tagline">Durable PR state is authoritative; events are observability.</p><span class="version">v${dashboardVersion}</span></div>
|
|
167
168
|
<div id="runtime-summary" class="runtime-summary" aria-label="Runtime summary"></div>
|
|
168
169
|
<div id="rate-limit-warning" class="warning-banner" role="status" hidden></div>
|
|
169
170
|
<nav role="tablist" aria-label="Console views">
|
|
@@ -240,6 +241,7 @@ export const dashboardHtml = `<!doctype html>
|
|
|
240
241
|
// function usageBar(label, window)
|
|
241
242
|
|
|
242
243
|
const MAX_EVENTS=60;
|
|
244
|
+
const DASHBOARD_VERSION=${JSON.stringify(dashboardVersion)};
|
|
243
245
|
const jobsTab=document.querySelector('#jobs-tab');
|
|
244
246
|
const usageTab=document.querySelector('#usage-tab');
|
|
245
247
|
const rulesTab=document.querySelector('#rules-tab');
|
|
@@ -352,6 +354,7 @@ function isTerminalJob(job){return ['COMPLETED','CANCELLED'].includes(job.state)
|
|
|
352
354
|
function jobGroup(job){if(isTerminalJob(job))return 3;if(job.executionMode==='autonomous')return 1;if(job.draft||job.state==='DRAFT')return 2;return 0;}
|
|
353
355
|
function compareJobs(a,b){const groupDelta=jobGroup(a)-jobGroup(b);if(groupDelta)return groupDelta;const mergePendingDelta=Number(isCompleteUnmerged(b))-Number(isCompleteUnmerged(a));return mergePendingDelta||String(b.updatedAt).localeCompare(String(a.updatedAt));}
|
|
354
356
|
async function loadJSON(url){const response=await fetch(url);if(!response.ok)throw new Error(response.status+' '+response.statusText);return response.json();}
|
|
357
|
+
async function refreshVersion(){try{const live=await loadJSON('/api/version');if(live?.version&&live.version!==DASHBOARD_VERSION)location.reload();}catch{}}
|
|
355
358
|
function renderRateLimitStatus(status){
|
|
356
359
|
if(!status?.limited){rateLimitWarning.hidden=true;rateLimitWarning.textContent='';return;}
|
|
357
360
|
const until=status.cooldownUntil?new Date(status.cooldownUntil):null;
|
|
@@ -426,6 +429,7 @@ stream.addEventListener('relay',message=>{const payload=parseMessage(message);if
|
|
|
426
429
|
if(location.hash==='#/usage')showView('usage');else if(location.hash==='#/model-router-rules')showView('rules');else if(location.hash==='#/worker-router-rules')showView('worker-rules');else showView('jobs');
|
|
427
430
|
setInterval(()=>{if(location.hash!=='#/usage'&&location.hash!=='#/model-router-rules'&&location.hash!=='#/worker-router-rules')void refresh();},300000);
|
|
428
431
|
setInterval(()=>{if(location.hash==='#/usage')void drawUsage();},30000);
|
|
432
|
+
setInterval(()=>void refreshVersion(),30000);
|
|
429
433
|
async function refreshSelected(){if(!selectedJob){await refresh();return;}selectedJobRefresh.disabled=true;selectedJobRefresh.textContent='Refreshing…';try{const updated=await loadJSON('/api/job?id='+encodeURIComponent(selectedJob));const index=jobs.findIndex(job=>job.id===selectedJob);if(index>=0)jobs[index]=updated;else jobs.push(updated);rememberSelection();renderAll();connection.textContent='';connection.setAttribute('aria-label','Live durable state connected');connection.className='status-pill ok';}catch(error){connection.textContent='';connection.setAttribute('aria-label','Durable state unavailable');connection.className='status-pill bad';}finally{selectedJobRefresh.disabled=false;selectedJobRefresh.textContent='Refresh';}}
|
|
430
434
|
</script>
|
|
431
435
|
</body>
|
package/dist/dashboard.js
CHANGED
|
@@ -53,8 +53,8 @@ async function eventHistory(jobId, taskId, limit) {
|
|
|
53
53
|
}
|
|
54
54
|
return output;
|
|
55
55
|
}
|
|
56
|
-
export { dashboardHtml } from './dashboard-html.js';
|
|
57
|
-
import { dashboardHtml } from './dashboard-html.js';
|
|
56
|
+
export { dashboardHtml, dashboardVersion } from './dashboard-html.js';
|
|
57
|
+
import { dashboardHtml, dashboardVersion } from './dashboard-html.js';
|
|
58
58
|
export function serveDashboard(store, port = 8787, bus, refreshMs = 300000, jobId, usageRegistry, overviewProvider, webhook, statusProvider, githubUsageProvider, exactJobProvider, actions) {
|
|
59
59
|
const legacyActions = typeof exactJobProvider === 'object' && exactJobProvider !== null ? exactJobProvider : undefined;
|
|
60
60
|
const legacyExactJobProvider = !exactJobProvider && githubUsageProvider ? githubUsageProvider : undefined;
|
|
@@ -154,6 +154,11 @@ export function serveDashboard(store, port = 8787, bus, refreshMs = 300000, jobI
|
|
|
154
154
|
res.end(dashboardHtml);
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
+
if (req.url === '/api/version') {
|
|
158
|
+
res.writeHead(200, { 'content-type': 'application/json', 'cache-control': 'no-store' });
|
|
159
|
+
res.end(JSON.stringify({ version: dashboardVersion }));
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
157
162
|
if (req.url === '/webhooks/github' && req.method === 'POST') {
|
|
158
163
|
const chunks = [];
|
|
159
164
|
for await (const chunk of req)
|