agents-relay 2.0.243 → 2.0.245
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/README.md +1 -1
- package/dist/dashboard-html.js +117 -11
- package/dist/dashboard-jel.js +54 -4
- package/dist/dashboard-style.js +12 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,7 +127,7 @@ Jobs separate durable lifecycle from derived runtime status. Durable lifecycle i
|
|
|
127
127
|
|
|
128
128
|
The **Job Execution Lifecycle (JEL)** is Create → Plan → Execute → Final Review → Merge → Completed. All work/recovery Tasks must reach a terminal state (SUCCEEDED, FAILED, or CANCELLED) before Final Review is eligible; terminal failure is evidence for the reviewer, not automatic acceptance. The independent Final Reviewer records findings. A PASS goes to the merge gate; CHANGES_REQUIRED persists findings and starts a minimal Planner N+1 repair round, then another Final Review. No automatic Plan N+1 is created after successful work. Planner and Workers use the discovered `ponytail` Skill to avoid unnecessary tasks without omitting required verification. For operator discussion, call this lifecycle **JEL**.
|
|
129
129
|
|
|
130
|
-
The Dashboard Job detail includes a **View JEL chart** link. It opens a read-only Mermaid
|
|
130
|
+
The Dashboard Job detail includes a **View JEL chart** link. It opens the full-screen graph viewer (Fit, zoom in/out, Ctrl/⌘-wheel zoom, and drag-to-pan) with a read-only Mermaid diagram that shows each persisted Plan, execution round, Final Review (including CHANGES_REQUIRED → Plan N+1), merge stage, and completion status. Every node displays wall-clock elapsed time derived from persisted timestamps (including queued time); missing timing data is labeled **unknown**, not estimated. The JEL popup highlights failed attempts in red, repeated worker attempts (Retry) in purple, and Troubleshooter tasks in amber, as dashed read-only diagnostic branches off their Execute round. Historical failure is shown only when a persisted `recoveryForAttempt` record supports it. The chart never changes Job state. Shortcut-runner jobs display their direct execution path instead of fictitious planning, review, or merge stages.
|
|
131
131
|
|
|
132
132
|
Lifecycle transition authority lives in the directly renderable canonical flowchart sources linked in [Workflow graph navigation](#workflow-graph-navigation). Git history owns prior graph versions; the working tree contains only the current graph set.
|
|
133
133
|
|
package/dist/dashboard-html.js
CHANGED
|
@@ -83,8 +83,8 @@ ${dashboardStyles}
|
|
|
83
83
|
</div>
|
|
84
84
|
</div>
|
|
85
85
|
</section>
|
|
86
|
-
<
|
|
87
|
-
<dialog id="graph-dialog" class="graph-dialog" aria-label="
|
|
86
|
+
<div id="jel-chart" class="graph-canvas jel-chart" aria-live="polite" hidden></div>
|
|
87
|
+
<dialog id="graph-dialog" class="graph-dialog" aria-label="Graph viewer"><div class="graph-dialog-header"><strong id="graph-dialog-title">Workflow graph</strong><div class="graph-navigation"><button type="button" id="graph-zoom-out" class="refresh-button" aria-label="Zoom out">−</button><span id="graph-zoom-level" aria-live="polite">100%</span><button type="button" id="graph-zoom-in" class="refresh-button" aria-label="Zoom in">+</button><button type="button" id="graph-zoom-reset" class="refresh-button">Fit</button><button type="button" id="graph-dialog-close" class="refresh-button">Close</button></div></div><div id="graph-jel-meta" class="graph-jel-meta" hidden><div class="jel-legend" aria-label="JEL diagnostics"><span class="jel-legend-failed">Failed</span><span class="jel-legend-retry">Retry</span><span class="jel-legend-troubleshooter">Troubleshooter</span></div><p id="jel-status" class="subtle">Graph derived from the selected job snapshot.</p></div><div id="graph-dialog-viewport" class="graph-dialog-viewport"></div></dialog>
|
|
88
88
|
<section id="rules-view" role="tabpanel" aria-labelledby="rules-tab" hidden><div class="panel"><div class="panel-head"><h2>Router Rules</h2><span id="rules-meta" class="subtle"></span></div><div class="panel-body"><div class="router-rules-workspace"><div class="router-rules-pane rules-editor"><h3>Rules Editor</h3><p class="rules-help">Execution Router rules with an explicit <code>[choices]</code> section (provider: model [reasoning] entries, additive to profile defaults) and a <code>[routing-instruction]</code> section forwarded verbatim to Laya. Relay deduplicates, applies hard gates, and sends one merged choice list; impossible routes remain excluded by code and Codex stays the deterministic fallback.</p><textarea id="rules-text" class="rules-textarea" spellcheck="true" aria-label="Execution router rules" placeholder="[choices]\nopenai: sol medium, luna high\nzai: glm-5.3-flash high\n\n[routing-instruction]\nPrefer zai until its quota resets; otherwise use the openai default."></textarea><div class="rules-footer"><span id="rules-status" class="subtle" aria-live="polite"></span><div><button id="rules-test" class="rules-save" type="button">Test Router</button> <button id="rules-save" class="rules-save" type="button">Save rules</button></div></div></div><div class="router-rules-pane"><div class="panel-head"><h3>Audit Log</h3><button id="audit-refresh" type="button">Refresh</button></div><div id="audit-log" class="audit-log" aria-live="polite"><p class="empty">Loading latest routing decisions…</p></div></div></div><div class="router-test-panel"><h3>Test Router Result</h3><div id="router-test-results" class="router-test-results" aria-live="polite"><p class="empty">Select a Job and Task, then run Test Router.</p></div></div></div></div></section>
|
|
89
89
|
<section id="qa-view" role="tabpanel" aria-labelledby="qa-tab" hidden>
|
|
90
90
|
<div class="panel"><div class="panel-head"><h2>Troubleshooter Q&A</h2><span class="subtle">skills/agents-relay/troubleshooter-qa.md</span></div>
|
|
@@ -216,36 +216,45 @@ function syncFilters(){
|
|
|
216
216
|
}
|
|
217
217
|
function repoName(repository){if(typeof repository!=='string'||!repository)return 'unknown-repo';const parts=repository.split('/').filter(Boolean);return parts.at(-1)||repository;}
|
|
218
218
|
const buildJelDiagram=${jobJelDiagram.toString()};
|
|
219
|
-
const jelDialog=document.querySelector('#jel-dialog');
|
|
220
219
|
const jelChart=document.querySelector('#jel-chart');
|
|
221
220
|
const jelStatus=document.querySelector('#jel-status');
|
|
222
221
|
let jelRenderSequence=0;
|
|
223
222
|
async function openJelChart(job){
|
|
224
223
|
const renderId=++jelRenderSequence;
|
|
225
|
-
jelDialog.querySelector('#jel-dialog-title').textContent='JEL · '+value(job.repository)+'/'+value(job.id);
|
|
226
224
|
jelChart.replaceChildren(element('p','subtle',text('Rendering job lifecycle…')));
|
|
227
225
|
jelStatus.textContent='Wall-clock elapsed from persisted timestamps (includes queued time); unknown means timing data is unavailable. Pending stages are not complete.';
|
|
228
|
-
|
|
226
|
+
showGraphViewer(jelChart,'JEL · '+value(job.repository)+'/'+value(job.id),true);
|
|
229
227
|
const source=buildJelDiagram(job);
|
|
230
228
|
try{
|
|
231
229
|
if(!window.mermaid)throw new Error('Mermaid unavailable');
|
|
232
230
|
if(!window.__relayMermaidReady){window.mermaid.initialize({startOnLoad:false,securityLevel:'strict',flowchart:{htmlLabels:false}});window.__relayMermaidReady=true;}
|
|
233
231
|
const rendered=await window.mermaid.render('relay-jel-'+renderId,source);
|
|
234
|
-
if(renderId!==jelRenderSequence||!
|
|
232
|
+
if(renderId!==jelRenderSequence||!graphDialog.open||graphViewerContent!==jelChart)return;
|
|
235
233
|
const svg=sanitizeGraphSvg(rendered.svg);
|
|
236
234
|
const definitions=graphNodeDefinitions(source);
|
|
237
235
|
for(const node of svg.querySelectorAll('g.node')){const entry=Array.from(definitions.entries()).find(([key])=>node.id.includes('-flowchart-'+key+'-'));if(entry)addNodeLabel(node,entry[1]);}
|
|
238
236
|
applyGraphPalette(svg);
|
|
237
|
+
applyJelHighlights(svg);
|
|
239
238
|
jelChart.replaceChildren(svg);
|
|
239
|
+
fitGraphViewer();
|
|
240
240
|
}catch(error){
|
|
241
|
-
if(renderId!==jelRenderSequence||!
|
|
241
|
+
if(renderId!==jelRenderSequence||!graphDialog.open||graphViewerContent!==jelChart)return;
|
|
242
242
|
jelChart.replaceChildren(element('pre','jel-source',text(source)));
|
|
243
243
|
jelStatus.textContent='Graph preview unavailable; showing the JEL source.';
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
246
|
+
function applyJelHighlights(svg){
|
|
247
|
+
const palette={failed:['#fee2e2','#b91c1c','#991b1b'],retry:['#ede9fe','#7c3aed','#5b21b6'],troubleshooter:['#fef3c7','#b45309','#92400e']};
|
|
248
|
+
for(const node of svg.querySelectorAll('g.node')){
|
|
249
|
+
const kind=node.id.includes('-flowchart-failed_')?'failed':node.id.includes('-flowchart-retry_')?'retry':node.id.includes('-flowchart-troubleshooter_')?'troubleshooter':null;
|
|
250
|
+
if(!kind)continue;
|
|
251
|
+
node.classList.add('jel-'+kind);
|
|
252
|
+
const [fill,stroke,color]=palette[kind];
|
|
253
|
+
for(const shape of node.querySelectorAll('rect,polygon,circle,ellipse')){shape.setAttribute('fill',fill);shape.setAttribute('stroke',stroke);shape.setAttribute('stroke-width','2');}
|
|
254
|
+
for(const label of node.querySelectorAll('text,tspan'))label.setAttribute('fill',color);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function jelField(job){const box=element('div','detail-group');box.append(element('p','detail-label',text('Job Execution Lifecycle')));const line=element('p','detail-value');const link=element('a','',text('View JEL chart'));link.href='#graph-dialog';link.addEventListener('click',event=>{event.preventDefault();void openJelChart(job);});line.append(link);box.append(line);return box;}
|
|
249
258
|
function shortcutProgress(job){if(job.executionMode!=='shortcut')return null;const root=(job.tasks||[]).find(task=>task.agentGraph);const checkpoint=root?.result?.data?.shortcut;const nodes=Object.keys(checkpoint?.nodes||{});const pending=Object.keys(checkpoint?.inFlight||{});const completed=nodes.filter(id=>checkpoint.nodes[id]?.status==='COMPLETED').length;const current=pending.length?pending.join(', '):'—';return completed+' completed · '+(pending.length?'running: '+current:'no active node');}
|
|
250
259
|
function renderJobList(){jobList.replaceChildren();const visible=filteredJobs();if(!jobs.length){jobList.append(element('li','empty',text('No durable jobs discovered.')));return;}if(!visible.length){jobList.append(element('li','empty',text('No jobs match the selected filters.')));return;}for(const job of visible){const row=element('div','job-row'+(isCompleteUnmerged(job)?' complete-unmerged':''));row.setAttribute('aria-current',String(jobSelectionKey(job)===selectedJob));row.addEventListener('click',()=>selectJob(job));const content=element('div','job-content');const select=document.createElement('button');select.type='button';select.className='job-button';select.setAttribute('aria-current',String(jobSelectionKey(job)===selectedJob));select.title=job.title||job.id;select.addEventListener('click',event=>{event.stopPropagation();selectJob(job);});select.append(element('span','job-title',text(repoName(job.repository)+'/'+value(job.id)+(Number(job.prNumber||0)>0?'/PR#'+value(job.prNumber):'')+': '+value(job.title||job.id))));const states=element('span','job-status-line');states.append(element('span','badge '+value(job.state),text(value(job.state))));if(job.executionMode==='shortcut')states.append(element('span','badge shortcut-mode',text('SHORTCUT')));states.append(element('span','badge '+value(job.runtimeStatus||'IDLE'),text(value(job.runtimeStatus||'IDLE'))));if(job.publicationFailure)states.append(element('span','badge FAILED',text('PUBLISH FAILED: '+value(job.publicationFailure.stage))));else if(job.publication?.version)states.append(element('span','badge SUCCEEDED',text('v'+job.publication.version)));else if(Number(job.prNumber||0)>0&&job.githubState==='MERGED')states.append(element('span','badge MERGED',text('PR Merged')));else if(job.state==='COMPLETED'&&job.githubState==='CLOSED')states.append(element('span','badge SUCCEEDED',text('PR Archived')));if(job.state==='ACTIVE'&&job.reviewEnabled!==false)states.append(element('span','badge flag-review',text('REVIEW REQUIRED')));if(job.localMerge?.status==='failed')states.append(element('span','badge FAILED',text('MERGE FAILED: '+value(job.localMerge.error||'Unknown error'))));else if(isCompleteUnmerged(job))states.append(element('span','badge MERGE_PENDING',text('MERGE PENDING')));const primary=element('div','job-primary');primary.append(states);const lastLine=element('div','job-last-line');lastLine.append(element('span','subtle',text(compactCounts(counts(job.tasks)))),element('span','subtle',text(relativeTime(job.updatedAt))));content.append(select,primary,lastLine);row.append(content);jobList.append(element('li','',row));}}
|
|
251
260
|
function taskTagDisplay(job,task){const display=task.tag&&job?.tag?.values?.[task.tag];return typeof display==='string'&&display?display:null;}
|
|
@@ -351,7 +360,104 @@ window.addEventListener('hashchange',syncMobileJobsView);
|
|
|
351
360
|
usageTab.addEventListener('click',()=>{location.hash='#/usage';showView('usage');});
|
|
352
361
|
graphsTab.addEventListener('click',()=>{location.hash='#/graphs/entry';showView('graphs');});
|
|
353
362
|
document.querySelector('#graph-entry').addEventListener('click',()=>navigateGraph('main'));
|
|
354
|
-
const graphDialog=document.querySelector('#graph-dialog');
|
|
363
|
+
const graphDialog=document.querySelector('#graph-dialog');
|
|
364
|
+
const graphViewport=document.querySelector('#graph-dialog-viewport');
|
|
365
|
+
const graphJelMeta=document.querySelector('#graph-jel-meta');
|
|
366
|
+
const graphZoomLevel=document.querySelector('#graph-zoom-level');
|
|
367
|
+
let graphZoom=1;
|
|
368
|
+
let graphViewerContent=null;
|
|
369
|
+
let graphViewerHome=null;
|
|
370
|
+
let graphViewerNext=null;
|
|
371
|
+
let graphViewerWasHidden=false;
|
|
372
|
+
function graphViewerSvg(){return graphViewerContent?.querySelector('svg')||null;}
|
|
373
|
+
function graphIntrinsicSize(svg){
|
|
374
|
+
const view=svg.viewBox?.baseVal;
|
|
375
|
+
const width=view?.width||Number.parseFloat(svg.getAttribute('width'))||svg.getBoundingClientRect().width||900;
|
|
376
|
+
const height=view?.height||Number.parseFloat(svg.getAttribute('height'))||svg.getBoundingClientRect().height||500;
|
|
377
|
+
return {width:Math.max(1,width),height:Math.max(1,height)};
|
|
378
|
+
}
|
|
379
|
+
function setGraphZoom(value,preserveCenter=true){
|
|
380
|
+
const svg=graphViewerSvg();
|
|
381
|
+
const dimensions=svg?graphIntrinsicSize(svg):null;
|
|
382
|
+
const centerX=dimensions?(graphViewport.scrollLeft+graphViewport.clientWidth/2)/(dimensions.width*graphZoom):0;
|
|
383
|
+
const centerY=dimensions?(graphViewport.scrollTop+graphViewport.clientHeight/2)/(dimensions.height*graphZoom):0;
|
|
384
|
+
graphZoom=Math.max(.05,Math.min(6,Number.isFinite(value)?value:1));
|
|
385
|
+
if(svg&&dimensions){
|
|
386
|
+
svg.style.width=dimensions.width*graphZoom+'px';
|
|
387
|
+
svg.style.height=dimensions.height*graphZoom+'px';
|
|
388
|
+
svg.style.maxWidth='none';
|
|
389
|
+
if(preserveCenter){
|
|
390
|
+
graphViewport.scrollLeft=dimensions.width*graphZoom*centerX-graphViewport.clientWidth/2;
|
|
391
|
+
graphViewport.scrollTop=dimensions.height*graphZoom*centerY-graphViewport.clientHeight/2;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
graphZoomLevel.textContent=Math.round(graphZoom*100)+'%';
|
|
395
|
+
}
|
|
396
|
+
function fitGraphViewer(){
|
|
397
|
+
const svg=graphViewerSvg();
|
|
398
|
+
if(!svg){setGraphZoom(1,false);return;}
|
|
399
|
+
const {width,height}=graphIntrinsicSize(svg);
|
|
400
|
+
const availableWidth=Math.max(1,graphViewport.clientWidth-48);
|
|
401
|
+
const availableHeight=Math.max(1,graphViewport.clientHeight-48);
|
|
402
|
+
setGraphZoom(Math.min(availableWidth/width,availableHeight/height),false);
|
|
403
|
+
graphViewport.scrollLeft=Math.max(0,(graphViewport.scrollWidth-graphViewport.clientWidth)/2);
|
|
404
|
+
graphViewport.scrollTop=Math.max(0,(graphViewport.scrollHeight-graphViewport.clientHeight)/2);
|
|
405
|
+
}
|
|
406
|
+
function showGraphViewer(content,title,isJel=false){
|
|
407
|
+
if(graphDialog.open)return;
|
|
408
|
+
// A native dialog close event can arrive after a fast reopen. Restore the
|
|
409
|
+
// previous content synchronously so it is never orphaned by replaceChildren.
|
|
410
|
+
if(graphViewerContent)closeGraphViewer();
|
|
411
|
+
graphViewerContent=content;
|
|
412
|
+
graphViewerHome=content.parentNode;
|
|
413
|
+
graphViewerNext=content.nextSibling;
|
|
414
|
+
graphViewerWasHidden=content.hidden;
|
|
415
|
+
content.hidden=false;
|
|
416
|
+
graphJelMeta.hidden=!isJel;
|
|
417
|
+
graphViewport.replaceChildren(content);
|
|
418
|
+
document.querySelector('#graph-dialog-title').textContent=title;
|
|
419
|
+
graphDialog.showModal();
|
|
420
|
+
graphViewport.scrollLeft=0;
|
|
421
|
+
graphViewport.scrollTop=0;
|
|
422
|
+
fitGraphViewer();
|
|
423
|
+
}
|
|
424
|
+
function closeGraphViewer(){
|
|
425
|
+
const content=graphViewerContent;
|
|
426
|
+
if(!content)return;
|
|
427
|
+
if(content===jelChart)jelRenderSequence++;
|
|
428
|
+
const svg=graphViewerSvg();
|
|
429
|
+
if(svg){svg.style.width='';svg.style.height='';svg.style.maxWidth='';}
|
|
430
|
+
const next=graphViewerNext?.parentNode===graphViewerHome?graphViewerNext:null;
|
|
431
|
+
graphViewerHome.insertBefore(content,next);
|
|
432
|
+
content.hidden=graphViewerWasHidden;
|
|
433
|
+
graphViewerContent=null;
|
|
434
|
+
graphViewerHome=null;
|
|
435
|
+
graphViewerNext=null;
|
|
436
|
+
graphJelMeta.hidden=true;
|
|
437
|
+
graphZoom=1;
|
|
438
|
+
graphZoomLevel.textContent='100%';
|
|
439
|
+
}
|
|
440
|
+
document.querySelector('#graph-maximize').addEventListener('click',()=>showGraphViewer(graphCanvas,graphTitle.textContent));
|
|
441
|
+
function dismissGraphViewer(){if(graphDialog.open)graphDialog.close();closeGraphViewer();}
|
|
442
|
+
graphDialog.addEventListener('close',()=>{if(!graphDialog.open)closeGraphViewer();});
|
|
443
|
+
graphDialog.addEventListener('cancel',event=>{event.preventDefault();dismissGraphViewer();});
|
|
444
|
+
document.querySelector('#graph-dialog-close').addEventListener('click',dismissGraphViewer);
|
|
445
|
+
document.querySelector('#graph-zoom-in').addEventListener('click',()=>setGraphZoom(graphZoom*1.25));
|
|
446
|
+
document.querySelector('#graph-zoom-out').addEventListener('click',()=>setGraphZoom(graphZoom/1.25));
|
|
447
|
+
document.querySelector('#graph-zoom-reset').addEventListener('click',fitGraphViewer);
|
|
448
|
+
graphViewport.addEventListener('wheel',event=>{if(!event.ctrlKey&&!event.metaKey)return;event.preventDefault();setGraphZoom(graphZoom*(event.deltaY<0?1.15:1/1.15));},{passive:false});
|
|
449
|
+
let graphDrag=null;
|
|
450
|
+
graphViewport.addEventListener('pointerdown',event=>{
|
|
451
|
+
if(event.target.closest('.drillable')||event.button!==0)return;
|
|
452
|
+
graphDrag={id:event.pointerId,x:event.clientX,y:event.clientY,left:graphViewport.scrollLeft,top:graphViewport.scrollTop};
|
|
453
|
+
graphViewport.setPointerCapture(event.pointerId);
|
|
454
|
+
});
|
|
455
|
+
graphViewport.addEventListener('pointermove',event=>{
|
|
456
|
+
if(!graphDrag||event.pointerId!==graphDrag.id)return;
|
|
457
|
+
graphViewport.scrollLeft=graphDrag.left-(event.clientX-graphDrag.x);
|
|
458
|
+
graphViewport.scrollTop=graphDrag.top-(event.clientY-graphDrag.y);
|
|
459
|
+
});
|
|
460
|
+
for(const eventName of ['pointerup','pointercancel','lostpointercapture'])graphViewport.addEventListener(eventName,()=>{graphDrag=null;});
|
|
355
461
|
document.querySelector('#graph-back').addEventListener('click',()=>history.back());
|
|
356
462
|
document.querySelector('#graph-forward').addEventListener('click',()=>history.forward());
|
|
357
463
|
window.addEventListener('popstate',()=>{if(graphFromHash()){renderGraphNavigation();showView('graphs');}else if(location.hash==='#/usage')showView('usage');else if(location.hash==='#/execution-router-rules')showView('rules');else if(location.hash==='#/troubleshooter-qa')showView('qa');else showView('jobs');});
|
package/dist/dashboard-jel.js
CHANGED
|
@@ -37,6 +37,7 @@ export function jobJelDiagram(job) {
|
|
|
37
37
|
const edge = (from, to, reason = '') => lines.push(' ' + from + ' -->' + (reason ? '|' + safe(reason) + '|' : '') + ' ' + to);
|
|
38
38
|
const tasks = Array.isArray(job.tasks) ? job.tasks : [];
|
|
39
39
|
const isReviewer = (task) => task.agentName === 'job-acceptance-reviewer';
|
|
40
|
+
const isTroubleshooter = (task) => task.agentName === 'troubleshooter';
|
|
40
41
|
const state = (value, fallback) => typeof value === 'string' && value ? safe(value).toUpperCase() : fallback;
|
|
41
42
|
const workLabel = (work) => {
|
|
42
43
|
const succeeded = work.filter(task => task.state === 'SUCCEEDED').length;
|
|
@@ -44,17 +45,62 @@ export function jobJelDiagram(job) {
|
|
|
44
45
|
const active = work.filter(task => !['SUCCEEDED', 'FAILED', 'CANCELLED'].includes(task.state || '')).length;
|
|
45
46
|
return work.length + ' tasks / ' + succeeded + ' succeeded / ' + failed + ' failed / ' + active + ' active';
|
|
46
47
|
};
|
|
48
|
+
// These dashed observation branches are not workflow transitions: persisted
|
|
49
|
+
// Task facts are projected without inferring a new scheduling decision.
|
|
50
|
+
const diagnostics = (executionId, suffix, work, troubleshoot) => {
|
|
51
|
+
const failed = new Set();
|
|
52
|
+
const add = (kind, label, time) => {
|
|
53
|
+
const id = kind + '_' + suffix + '_' + String(lines.filter(line => line.startsWith(' ' + kind + '_' + suffix + '_')).length);
|
|
54
|
+
node(id, label, time);
|
|
55
|
+
lines.push(' ' + executionId + ' -.-> ' + id);
|
|
56
|
+
lines.push(' class ' + id + ' jel' + kind[0].toUpperCase() + kind.slice(1));
|
|
57
|
+
};
|
|
58
|
+
for (const task of work) {
|
|
59
|
+
if (task.state === 'FAILED') {
|
|
60
|
+
const key = (task.id || 'unknown') + ':' + String(task.attempt ?? '?');
|
|
61
|
+
failed.add(key);
|
|
62
|
+
add('failed', 'Failed ' + (task.id || 'unknown') + ' / attempt ' + (task.attempt || 'unknown'), elapsed(task.createdAt, task.updatedAt));
|
|
63
|
+
}
|
|
64
|
+
if (typeof task.attempt === 'number' && Number.isInteger(task.attempt) && task.attempt > 1) {
|
|
65
|
+
const history = Array.isArray(task.executionHistory) ? task.executionHistory : [];
|
|
66
|
+
const current = history.slice().reverse().find(record => record.attempt === task.attempt);
|
|
67
|
+
add('retry', 'Retry ' + (task.id || 'unknown') + ' / ' + (task.attempt - 1) + ' retries / attempt ' + task.attempt, elapsed(current?.startedAt, terminalTask(task) ? task.updatedAt : 'NOW'));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
for (const task of troubleshoot) {
|
|
71
|
+
const parent = work.find(candidate => candidate.id === task.parentTaskId);
|
|
72
|
+
if (parent && Number.isInteger(task.recoveryForAttempt) && (task.recoveryForAttempt ?? 0) > 0) {
|
|
73
|
+
const key = (parent.id || 'unknown') + ':' + task.recoveryForAttempt;
|
|
74
|
+
if (!failed.has(key)) {
|
|
75
|
+
failed.add(key);
|
|
76
|
+
// Recovery-for-attempt is durable evidence of a failed attempt, but
|
|
77
|
+
// not of its terminal timestamp: display unknown, never fabricate.
|
|
78
|
+
add('failed', 'Failed ' + (parent.id || 'unknown') + ' / attempt ' + task.recoveryForAttempt, 'unknown');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
add('troubleshooter', 'Troubleshooter ' + (task.id || 'unknown') + ' / ' + state(task.state, 'UNKNOWN'), workElapsed([task]));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const finish = () => {
|
|
85
|
+
// The browser applies the same palette *after* SVG sanitization; Mermaid
|
|
86
|
+
// styling alone is not trusted to survive the safe SVG renderer.
|
|
87
|
+
lines.push(' classDef jelFailed fill:#fee2e2,stroke:#b91c1c,color:#991b1b,stroke-width:2px');
|
|
88
|
+
lines.push(' classDef jelRetry fill:#ede9fe,stroke:#7c3aed,color:#5b21b6,stroke-width:2px');
|
|
89
|
+
lines.push(' classDef jelTroubleshooter fill:#fef3c7,stroke:#b45309,color:#92400e,stroke-width:2px');
|
|
90
|
+
return lines.join('\n');
|
|
91
|
+
};
|
|
47
92
|
const plans = Array.isArray(job.plans) ? job.plans : [];
|
|
48
93
|
const jobEnd = ['COMPLETED', 'CANCELLED'].includes(job.state || '') ? job.updatedAt : 'NOW';
|
|
49
94
|
const firstStart = plans[0]?.createdAt || (job.tasks || []).map(task => task.createdAt).filter(Boolean).sort()[0];
|
|
50
95
|
node('created', 'Create / recorded', elapsed(job.createdAt, firstStart || jobEnd));
|
|
51
96
|
if (job.executionMode === 'shortcut') {
|
|
52
|
-
const work = tasks.filter(task => !isReviewer(task));
|
|
97
|
+
const work = tasks.filter(task => !isReviewer(task) && !isTroubleshooter(task));
|
|
53
98
|
node('execute', 'Shortcut execute / ' + workLabel(work), workElapsed(work));
|
|
99
|
+
diagnostics('execute', 'shortcut', work, tasks.filter(isTroubleshooter));
|
|
54
100
|
node('finished', 'Job / ' + state(job.state, 'UNKNOWN'), elapsed(job.createdAt, jobEnd));
|
|
55
101
|
edge('created', 'execute');
|
|
56
102
|
edge('execute', 'finished');
|
|
57
|
-
return
|
|
103
|
+
return finish();
|
|
58
104
|
}
|
|
59
105
|
const rounds = plans.length ? plans : [{ id: '', round: 1, status: 'NOT STARTED', generatedTaskIds: [] }];
|
|
60
106
|
let previous = 'created';
|
|
@@ -66,9 +112,13 @@ export function jobJelDiagram(job) {
|
|
|
66
112
|
const executeId = 'execute_' + suffix;
|
|
67
113
|
const reviewId = 'review_' + suffix;
|
|
68
114
|
const assigned = new Set(Array.isArray(plan.generatedTaskIds) ? plan.generatedTaskIds : []);
|
|
69
|
-
const work = (plans.length ? tasks.filter(task => !isReviewer(task) && (task.planningDecisionId === plan.id || assigned.has(task.id || ''))) : tasks.filter(task => !isReviewer(task)));
|
|
115
|
+
const work = (plans.length ? tasks.filter(task => !isReviewer(task) && !isTroubleshooter(task) && (task.planningDecisionId === plan.id || assigned.has(task.id || ''))) : tasks.filter(task => !isReviewer(task) && !isTroubleshooter(task)));
|
|
70
116
|
node(planId, 'Plan ' + number + ' / ' + state(plan.status, 'NOT STARTED'), elapsed(plan.createdAt, plan.status === 'PLANNING' ? 'NOW' : plan.updatedAt));
|
|
71
117
|
node(executeId, 'Execute ' + number + ' / ' + workLabel(work), workElapsed(work));
|
|
118
|
+
const workIds = new Set(work.map(task => task.id));
|
|
119
|
+
const troubleshoot = tasks.filter(task => isTroubleshooter(task) &&
|
|
120
|
+
(workIds.has(task.parentTaskId || '') || task.planningDecisionId === plan.id || !plans.length));
|
|
121
|
+
diagnostics(executeId, suffix, work, troubleshoot);
|
|
72
122
|
const nextPlan = plans[i + 1];
|
|
73
123
|
const review = job.reviewEnabled === false ? 'NOT REQUIRED' : nextPlan?.trigger?.source === 'review' ? 'CHANGES REQUIRED' : i === rounds.length - 1 ? state(job.review?.outcome, 'NOT STARTED') : 'NOT RECORDED';
|
|
74
124
|
// Review Tasks are not guaranteed to carry the Plan ID. Use their persisted
|
|
@@ -88,5 +138,5 @@ export function jobJelDiagram(job) {
|
|
|
88
138
|
node('finished', 'Job / ' + state(job.state, 'UNKNOWN'), elapsed(job.createdAt, jobEnd));
|
|
89
139
|
edge(previous, 'merge');
|
|
90
140
|
edge('merge', 'finished');
|
|
91
|
-
return
|
|
141
|
+
return finish();
|
|
92
142
|
}
|
package/dist/dashboard-style.js
CHANGED
|
@@ -131,18 +131,22 @@ export const dashboardStyles = ` <style>
|
|
|
131
131
|
.graph-navigation { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; margin-bottom:.7rem; }
|
|
132
132
|
.graph-canvas .node.drillable { cursor:pointer; }
|
|
133
133
|
.graph-canvas .node.drillable text, .graph-canvas .node.drillable tspan { fill:#2367b1; }
|
|
134
|
-
.jel-
|
|
135
|
-
.jel-
|
|
136
|
-
.jel-
|
|
137
|
-
.jel-
|
|
138
|
-
.jel-
|
|
134
|
+
.jel-legend { display:flex; align-items:center; flex-wrap:wrap; gap:.5rem; padding:.1rem .3rem .6rem; font-size:.76rem; font-weight:700; }
|
|
135
|
+
.jel-legend span { padding:.16rem .5rem; border-radius:.35rem; border:1px solid; }
|
|
136
|
+
.jel-legend-failed { background:#fee2e2; border-color:#b91c1c!important; color:#991b1b; }
|
|
137
|
+
.jel-legend-retry { background:#ede9fe; border-color:#7c3aed!important; color:#5b21b6; }
|
|
138
|
+
.jel-legend-troubleshooter { background:#fef3c7; border-color:#b45309!important; color:#92400e; }
|
|
139
139
|
.jel-source { overflow:auto; white-space:pre; font:12px/1.5 ui-monospace,monospace; }
|
|
140
|
-
.graph-dialog { width:
|
|
140
|
+
.graph-dialog { box-sizing:border-box; width:98vw; height:96vh; height:96dvh; max-width:none; max-height:none; padding:.55rem; border:1px solid var(--border); border-radius:.5rem; background:var(--surface); color:var(--text); }
|
|
141
|
+
.graph-dialog[open] { display:flex; flex-direction:column; gap:.25rem; }
|
|
141
142
|
.graph-dialog::backdrop { background:#17202b99; }
|
|
142
143
|
.graph-dialog-header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.7rem; padding:.3rem .5rem; }
|
|
143
|
-
.graph-dialog-viewport { height:
|
|
144
|
+
.graph-dialog-viewport { flex:1; min-height:0; min-width:0; overflow:auto; cursor:grab; background:var(--surface2); border:1px solid var(--border); border-radius:.4rem; }
|
|
145
|
+
.graph-jel-meta { display:grid; gap:.2rem; padding:.1rem .3rem .25rem; }
|
|
146
|
+
.graph-jel-meta[hidden] { display:none; }
|
|
147
|
+
.graph-jel-meta #jel-status { margin:0; font-size:.74rem; }
|
|
144
148
|
.graph-dialog-viewport:active { cursor:grabbing; }
|
|
145
|
-
.graph-dialog-viewport .graph-canvas { display:
|
|
149
|
+
.graph-dialog-viewport .graph-canvas { display:grid; width:max-content; min-width:100%; min-height:100%; overflow:visible; }
|
|
146
150
|
.graph-canvas .node text { pointer-events:none; }
|
|
147
151
|
.graph-source { margin:0; max-height:22rem; overflow:auto; padding:.7rem; border:1px solid var(--border); border-radius:.4rem; background:var(--surface2); color:var(--muted); font:.72rem/1.5 ui-monospace,SFMono-Regular,Menlo,monospace; white-space:pre; }
|
|
148
152
|
.graph-source-details summary { cursor:pointer; color:var(--muted); font-size:.74rem; font-weight:700; }
|