agents-relay 2.0.194 → 2.0.195
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 +8 -6
- package/dist/dashboard-style.js +16 -1
- package/package.json +1 -1
package/dist/dashboard-html.js
CHANGED
|
@@ -42,12 +42,12 @@ ${dashboardStyles}
|
|
|
42
42
|
</header>
|
|
43
43
|
<main>
|
|
44
44
|
<section id="jobs-view" role="tabpanel" aria-labelledby="jobs-tab" class="panel jobs-panel">
|
|
45
|
-
<div class="panel-head"><h2>Jobs</h2><div class="panel-actions"><div class="job-filters"><input id="job-search" class="job-search" type="search" placeholder="Search" aria-label="Search jobs by title or PR number"><select id="status-filter" class="job-filter" aria-label="Filter jobs by status (default excludes cancelled)"><option value="">No cancelled</option><option value="DRAFT">DRAFT</option><option value="ACTIVE">ACTIVE</option><option value="COMPLETED">COMPLETED</option><option value="CANCELLED">CANCELLED</option></select><select id="repo-filter" class="job-filter" aria-label="Filter jobs by repository"><option value="">All repos</option></select></div><div class="jobs-actions"><button id="jobs-refresh" class="
|
|
45
|
+
<div class="panel-head"><h2>Jobs</h2><div class="panel-actions"><div class="job-filters"><input id="job-search" class="job-search" type="search" placeholder="Search" aria-label="Search jobs by title or PR number"><select id="status-filter" class="job-filter" aria-label="Filter jobs by status (default excludes cancelled)"><option value="">No cancelled</option><option value="DRAFT">DRAFT</option><option value="ACTIVE">ACTIVE</option><option value="COMPLETED">COMPLETED</option><option value="CANCELLED">CANCELLED</option></select><select id="repo-filter" class="job-filter" aria-label="Filter jobs by repository"><option value="">All repos</option></select></div><div class="jobs-actions"><button id="jobs-refresh" class="icon-button" type="button" aria-label="Refresh jobs" title="Refresh jobs"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M20 11a8 8 0 1 0 1 5"/><path d="M20 4v7h-7"/></svg></button></div><span id="jobs-feedback" class="jobs-feedback subtle" role="status" aria-live="polite"></span></div></div>
|
|
46
46
|
<div class="panel-body" aria-live="polite"><ul id="job-list" class="job-list"><li class="skeleton" aria-hidden="true"></li></ul></div>
|
|
47
47
|
</section>
|
|
48
48
|
<div class="workspace" id="jobs-workspace">
|
|
49
49
|
<section class="panel" aria-labelledby="workspace-heading">
|
|
50
|
-
<div class="panel-head"><button id="mobile-jobs-back" class="
|
|
50
|
+
<div class="panel-head"><button id="mobile-jobs-back" class="icon-button mobile-only" type="button" aria-label="Back to Jobs" title="Back to Jobs"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M19 12H5m7-7-7 7 7 7"/></svg></button><h2 id="workspace-heading"><span id="selected-job-title" class="subtle"></span></h2><div class="panel-actions"><button id="job-content-open" class="icon-button job-status-button" type="button" aria-label="Job details" title="Job details" data-state="IDLE"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="3" class="status-center"/></svg></button><button id="selected-job-refresh" class="icon-button" type="button" aria-label="Refresh selected job" title="Refresh selected job"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M20 11a8 8 0 1 0 1 5"/><path d="M20 4v7h-7"/></svg></button><span id="connection" class="status-pill neutral" aria-live="polite" aria-label="Connecting"></span></div></div>
|
|
51
51
|
<div class="panel-body">
|
|
52
52
|
<div id="job-detail"><div class="skeleton"></div></div>
|
|
53
53
|
<h3 class="section-title">Task hierarchy</h3>
|
|
@@ -57,7 +57,7 @@ ${dashboardStyles}
|
|
|
57
57
|
</div>
|
|
58
58
|
</section>
|
|
59
59
|
<section class="panel" id="events-panel" aria-labelledby="events-heading">
|
|
60
|
-
<div class="panel-head"><h2 id="events-heading">Events</h2><div class="panel-actions"><button id="events-all-tasks" class="
|
|
60
|
+
<div class="panel-head"><h2 id="events-heading">Events</h2><div class="panel-actions"><button id="events-all-tasks" class="icon-button" type="button" aria-label="Show events for all tasks" title="All tasks"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4 6h2m4 0h10M4 12h2m4 0h10M4 18h2m4 0h10"/></svg></button><span id="events-scope" class="subtle">Job-wide · newest first · 60 max</span></div></div>
|
|
61
61
|
<div class="panel-body"><ol id="event-feed" class="event-list"><li class="empty">Waiting for events.</li></ol></div>
|
|
62
62
|
</section>
|
|
63
63
|
</div>
|
|
@@ -147,6 +147,7 @@ const repoFilter=document.querySelector('#repo-filter');
|
|
|
147
147
|
const statusFilter=document.querySelector('#status-filter');
|
|
148
148
|
const jobsFeedback=document.querySelector('#jobs-feedback');
|
|
149
149
|
const selectedJobRefresh=document.querySelector('#selected-job-refresh');
|
|
150
|
+
const jobContentButton=document.querySelector('#job-content-open');
|
|
150
151
|
const mobileJobsBack=document.querySelector('#mobile-jobs-back');
|
|
151
152
|
const mobileJobs=window.matchMedia('(max-width:650px)');
|
|
152
153
|
const jobDetail=document.querySelector('#job-detail');
|
|
@@ -252,13 +253,14 @@ function buildTree(tasks){taskTree.replaceChildren();if(!Array.isArray(tasks)||!
|
|
|
252
253
|
function attemptBudget(task){const attempt=Number(task?.attempt)||0;const max=Number(task?.maxAttempts)||0;if(max>=3&&max%3===0){const effectiveMax=Math.max(max,Math.ceil(attempt/3)*3);return attempt+' / 3×'+(effectiveMax/3);}return attempt+' / '+max;}
|
|
253
254
|
const JOB_STATES=['DRAFT','ACTIVE','COMPLETED','CANCELLED'];
|
|
254
255
|
async function setJobState(job,state,select){if(!job||state===job.state)return;select.disabled=true;try{const params=new URLSearchParams({id:job.id,state,repo:job.repository,pr:String(job.prNumber)});const response=await fetch('/api/job-state?'+params.toString(),{method:'POST'});if(!response.ok)throw new Error(response.status+' '+response.statusText);const updated=await response.json();const index=jobs.findIndex(candidate=>jobSelectionKey(candidate)===jobSelectionKey(job));if(index>=0)jobs[index]=updated;else jobs.push(updated);renderAll();void loadEventHistory();}catch(error){select.title='Set job lifecycle state: '+error.message;select.value=job.state;}finally{select.disabled=false;}}
|
|
255
|
-
function jobStateField(job){const box=element('div','detail-group');box.append(element('p','detail-label',text('Lifecycle state')));const select=document.createElement('select');select.className='job-filter job-state-select';select.setAttribute('aria-label','Job lifecycle state');for(const state of JOB_STATES)select.append(new Option(state,state));select.value=job.state;select.addEventListener('change',()=>void setJobState(job,select.value,select));box.append(select);return box;}
|
|
256
|
+
function jobStateField(job){const box=element('div','detail-group');box.append(element('p','detail-label',text('Lifecycle state')));const select=document.createElement('select');select.className='job-filter job-state-select';select.dataset.state=job.state;select.setAttribute('aria-label','Job lifecycle state');for(const state of JOB_STATES)select.append(new Option(state,state));select.value=job.state;select.addEventListener('change',()=>void setJobState(job,select.value,select));box.append(select);return box;}
|
|
256
257
|
const TASK_STATES=['DRAFT','QUEUED','RUNNING','BLOCKED','SUCCEEDED','FAILED','CANCELLED'];
|
|
257
258
|
async function setTaskState(task,state,select){const job=selected();if(!job||state===task.state)return;select.disabled=true;try{const params=new URLSearchParams({id:job.id,task:task.id,state,repo:job.repository,pr:String(job.prNumber)});const response=await fetch('/api/task-state?'+params.toString(),{method:'POST'});if(!response.ok)throw new Error(response.status+' '+response.statusText);const updated=await response.json();const index=jobs.findIndex(candidate=>jobSelectionKey(candidate)===jobSelectionKey(job));if(index>=0)jobs[index]=updated;else jobs.push(updated);renderAll();void loadEventHistory();}catch(error){select.title='Set task state: '+error.message;select.value=task.state;}finally{select.disabled=false;}}
|
|
258
259
|
function taskStateField(task){const box=element('div','detail-group');box.append(element('p','detail-label',text('State')));const select=document.createElement('select');select.className='job-filter task-state-select';select.setAttribute('aria-label','Task state');for(const state of TASK_STATES)select.append(new Option(state,state));select.value=task.state;select.addEventListener('change',()=>void setTaskState(task,select.value,select));box.append(select);return box;}
|
|
259
260
|
function manualOverrideField(task){const rows=Array.isArray(task.manualStateOverrides)?task.manualStateOverrides:[];const last=rows.at(-1);return field('Manual override',last?last.from+' → '+last.to+' · '+relativeTime(last.at):'—');}
|
|
260
|
-
function
|
|
261
|
-
function
|
|
261
|
+
function iconSvg(name){const paths={close:'M5 5l14 14M19 5 5 19',detail:'M7 3h7l4 4v14H7zM14 3v5h4M10 12h5m-5 4h5'};const ns='http://www.w3.org/2000/svg';const svg=document.createElementNS(ns,'svg');svg.setAttribute('viewBox','0 0 24 24');svg.setAttribute('aria-hidden','true');const path=document.createElementNS(ns,'path');path.setAttribute('d',paths[name]);svg.append(path);return svg;}
|
|
262
|
+
function showDetailsDialog(title,sections){const dialog=element('dialog','details-dialog');dialog.setAttribute('aria-label',title);const head=element('div','details-dialog-head');const name=element('strong','',text(title));const close=element('button','icon-button');close.append(iconSvg('close'));close.type='button';close.setAttribute('aria-label','Close details');close.title='Close details';close.addEventListener('click',()=>dialog.close());head.append(name,close);dialog.append(head);for(const [label,value] of sections){if(value===undefined||value===null||value==='')continue;dialog.append(element('h3','',text(label)));const content=element('pre');content.textContent=typeof value==='string'?value:JSON.stringify(value,null,2);dialog.append(content);}dialog.addEventListener('close',()=>dialog.remove());document.body.append(dialog);dialog.showModal();}function openJobDetails(){const job=selected();if(!job)return;showDetailsDialog('Job '+job.id+' · '+value(job.title),[['Objective',job.objective],['Description',job.description],['State',job.state],['Plans',job.plans?.map(p=>({id:p.id,status:p.status,assessment:p.assessment,error:p.error,generatedTaskIds:p.generatedTaskIds}))],['Review',job.review],['Outcome',job.result],['Publication',job.publication],['Failure',job.error]]);}function openTaskDetails(task){const result=task.result?.data??task.result;showDetailsDialog('Task '+task.id+' · '+value(task.title),[['Input / task objective',task.input],['State',task.state],['Conclusion',result],['Result summary',task.result?.summary],['Planner assessment',task.plannerResult?.assessment],['Resolution',task.resolution],['Resolution classification',task.resolutionClassification],['Failure',task.failureReason||task.error],['Dependencies',task.dependencies]]);}document.querySelector('#job-content-open').addEventListener('click',openJobDetails);function renderTaskDetail(task){taskDetailRoot.replaceChildren();if(!task){taskDetailRoot.append(element('p','empty',text('Select a task to inspect execution details.')));return;}const routing=task.routing||{};const groups=element('div','detail-groups');groups.append(field('Title',task.title||'—'),field('Task ID',task.id),field('Kind',task.kind||'work'),taskStateField(task),...(task.state==='FAILED'&&task.resolution?.state?[field('Resolution state',task.resolution.state),field('Resolution path',task.resolution.path||'—'),field('Resolution target',task.resolution.targetTaskId||'—')]:[]),manualOverrideField(task),field('Planning decision',task.planningDecisionId||'—'),field('Planning source',task.planningSource||'—'),field('Planning round',task.planningRound===undefined?'—':String(task.planningRound)),field('Project / agent',value(task.projectName)+' / '+value(task.agentName)),field('Parent task',task.parentTaskId||'root'),...(task.resolutionClassification?[field('Resolution classification',task.resolutionClassification.kind),field('Resolution target',task.resolutionClassification.targetTaskId),field('Resolution evidence',task.resolutionClassification.evidence),field('Resolution reason',task.resolutionClassification.reason)]:[]),field('Adapter',task.adapter),field('Provider / model',value(routing.provider)+' / '+value(routing.model)),field('Reasoning / profile',value(routing.reasoning||routing.profile)),field('Attempt',attemptBudget(task)),field('Dependencies',Array.isArray(task.dependencies)&&task.dependencies.length?task.dependencies.join(', '):'none'),taskCommentField(task),chatField(task));const job=selected();if(task.reviewHeadSha&&job)groups.append(commitField('HEAD commit',job,task.reviewHeadSha));const graph=agentGraphField(task);if(graph)groups.append(graph);if(task.plannerResult)groups.append(field('Objective status',task.plannerResult.objective_status),markdownField('Assessment',task.plannerResult.assessment));if(task.error)groups.append(field('Error',task.error));const result=task.result?.data??task.result;if(result){groups.append(field('Conclusion',result.verdict||result.outcome?.verdict||task.result?.summary||'Available'));}taskDetailRoot.append(groups);const details=element('button','icon-button');details.append(iconSvg('detail'));details.type='button';details.setAttribute('aria-label','Task details and conclusion');details.title='Task details and conclusion';details.addEventListener('click',()=>openTaskDetails(task));taskDetailRoot.append(details);}
|
|
263
|
+
function reviewStatus(job){const review=job?.review;if(!review)return 'Not started';if(review.outcome==='approved'&&review.headSha===job.headSha)return 'MERGE READY · approved';const stale=Array.isArray(job?.tasks)&&job.tasks.some(task=>task.agentName==='reviewer'&&task.reviewHeadSha&&job.headSha&&task.reviewHeadSha!==job.headSha);if(stale)return 'STALE · awaiting review';return String(review.outcome||'pending').replace('_',' ').toUpperCase();}function renderSelectedJob(){jobDetail.replaceChildren();const job=selected();if(!job){selectedJobTitle.textContent='';jobContentButton.disabled=true;jobContentButton.dataset.state='IDLE';jobDetail.append(element('div','empty',text('No durable jobs discovered.')));buildTree([]);renderTaskDetail(null);return;}selectedJobTitle.textContent=value(job.title||job.id);jobContentButton.disabled=false;jobContentButton.dataset.state=JOB_STATES.includes(job.state)?job.state:'IDLE';jobContentButton.setAttribute('aria-label','Job details · '+value(job.state));jobContentButton.title='Job details · '+value(job.state);if(jobSelectionKey(job)!==selectedJob){selectedJob=jobSelectionKey(job);selectedTaskId=null;eventTaskId=null;clearEvents();rememberSelection();}const summary=element('div','job-summary');summary.append(field('PR state',job.githubState||'UNKNOWN'),jobStateField(job),field('Runtime status',job.runtimeStatus||'IDLE'),field('Review',reviewStatus(job)),field('Creator thread',job.creatorThreadId||'—'),threadField('Implementation thread',job.implementationThreadId),threadField('Reviewer thread',job.reviewerThreadId),commitField('Review head SHA',job,job.review?.headSha||job.headSha||''),prField(job),field('Repository',job.repository||'—'),field('Last activity',relativeTime(job.updatedAt)),field('Task states',compactCounts(job.tasks)),chatShortcutField(job));jobDetail.append(summary);const selectedTask=(job.tasks||[]).find(task=>task.id===selectedTaskId)||null;if(selectedTaskId&&!selectedTask){selectedTaskId=null;eventTaskId=null;clearEvents();rememberSelection();}buildTree(job.tasks||[]);renderTaskDetail(selectedTask);renderEventScope();}function renderAll(){jobs.sort(compareJobs);syncFilters();renderJobList();renderSelectedJob();syncMobileJobsView();}
|
|
262
264
|
function isCompleteUnmerged(job){return job.runtimeStatus==='MERGE_PENDING';}
|
|
263
265
|
function compareJobs(a,b){const timestamp=job=>{const updated=Date.parse(job.updatedAt||'');if(Number.isFinite(updated))return updated;const created=Date.parse(job.createdAt||'');return Number.isFinite(created)?created:0;};return timestamp(b)-timestamp(a)||String(a.repository||'').localeCompare(String(b.repository||''))||String(a.id||'').localeCompare(String(b.id||''));}
|
|
264
266
|
async function loadJSON(url){const response=await fetch(url);if(!response.ok)throw new Error(response.status+' '+response.statusText);return response.json();}
|
package/dist/dashboard-style.js
CHANGED
|
@@ -43,6 +43,18 @@ export const dashboardStyles = ` <style>
|
|
|
43
43
|
.quick-filter[aria-pressed="true"] { border-color:var(--accent); background:var(--accent2); color:var(--accent); }
|
|
44
44
|
.refresh-button { border:1px solid var(--border); border-radius:.35rem; background:var(--surface); color:var(--muted); padding:.28rem .55rem; font:inherit; font-size:.72rem; font-weight:700; cursor:pointer; }
|
|
45
45
|
.refresh-button:disabled { cursor:default; opacity:.55; }
|
|
46
|
+
.icon-button { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; width:2.5rem; height:2.5rem; padding:0; border:0; border-radius:50%; color:var(--muted); background:transparent; cursor:pointer; }
|
|
47
|
+
.icon-button svg { display:block; width:1.3rem; height:1.3rem; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
|
|
48
|
+
.icon-button:hover { color:var(--accent); background:var(--accent2); }
|
|
49
|
+
.icon-button:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
|
|
50
|
+
.icon-button:disabled { cursor:default; opacity:.4; }
|
|
51
|
+
.job-status-button[data-state="ACTIVE"],.job-status-button[data-state="COMPLETED"] { color:var(--ok); background:#e5f3e9; }
|
|
52
|
+
.job-status-button[data-state="DRAFT"] { color:#3f51b5; background:#eef2ff; }
|
|
53
|
+
.job-status-button[data-state="CANCELLED"],.job-status-button[data-state="IDLE"] { color:var(--muted); background:#edf0f4; }
|
|
54
|
+
.job-status-button .status-center { fill:currentColor; stroke:none; }
|
|
55
|
+
.job-state-select[data-state="ACTIVE"],.job-state-select[data-state="COMPLETED"] { color:var(--ok); background:#e5f3e9; border-color:transparent; }
|
|
56
|
+
.job-state-select[data-state="DRAFT"] { color:#3f51b5; background:#eef2ff; border-color:transparent; }
|
|
57
|
+
.job-state-select[data-state="CANCELLED"] { color:var(--muted); background:#edf0f4; border-color:transparent; }
|
|
46
58
|
.mobile-only { display:none; }
|
|
47
59
|
.panel-body { padding:.75rem; overflow:auto; max-height:calc(100vh - 11.5rem); }
|
|
48
60
|
#jobs-workspace > .panel:first-child .panel-body { overflow:visible; max-height:none; }
|
|
@@ -165,7 +177,10 @@ export const dashboardStyles = ` <style>
|
|
|
165
177
|
#jobs-view .job-filter { width:100%; max-width:none; min-width:0; text-transform:none; font-size:.69rem; min-height:2.25rem; padding:.2rem .15rem; }
|
|
166
178
|
#jobs-view .jobs-actions { justify-content:flex-end; }
|
|
167
179
|
#jobs-view .jobs-feedback { grid-column:1 / -1; text-align:left; }
|
|
168
|
-
#jobs-view #jobs-refresh {
|
|
180
|
+
#jobs-view #jobs-refresh { width:2.25rem; height:2.25rem; }
|
|
181
|
+
#jobs-workspace > .panel:first-child > .panel-head { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:.3rem; align-items:center; }
|
|
182
|
+
#jobs-workspace > .panel:first-child > .panel-head .panel-actions { flex-wrap:nowrap; gap:.05rem; }
|
|
183
|
+
#jobs-workspace > .panel:first-child > .panel-head #connection { display:none; }
|
|
169
184
|
#jobs-view .panel-body { max-height:none; }
|
|
170
185
|
#jobs-workspace { gap:.65rem; }
|
|
171
186
|
#jobs-workspace .panel-body { max-height:none; }
|