agents-relay 2.0.243 → 2.0.244
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 +13 -1
- package/dist/dashboard-jel.js +54 -4
- package/dist/dashboard-style.js +5 -0
- 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 popup 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 chart never changes Job state. Shortcut-runner jobs display their direct execution path instead of fictitious planning, review, or merge stages.
|
|
130
|
+
The Dashboard Job detail includes a **View JEL chart** link. It opens a read-only Mermaid popup 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,7 +83,7 @@ ${dashboardStyles}
|
|
|
83
83
|
</div>
|
|
84
84
|
</div>
|
|
85
85
|
</section>
|
|
86
|
-
<dialog id="jel-dialog" class="jel-dialog" aria-label="Job Execution Lifecycle chart"><div class="jel-dialog-header"><strong id="jel-dialog-title">Job Execution Lifecycle</strong><button type="button" id="jel-dialog-close" class="refresh-button" aria-label="Close JEL chart">Close</button></div><div id="jel-chart" class="jel-chart" aria-live="polite"></div><p id="jel-status" class="subtle">Graph derived from the selected job snapshot.</p></dialog>
|
|
86
|
+
<dialog id="jel-dialog" class="jel-dialog" aria-label="Job Execution Lifecycle chart"><div class="jel-dialog-header"><strong id="jel-dialog-title">Job Execution Lifecycle</strong><button type="button" id="jel-dialog-close" class="refresh-button" aria-label="Close JEL chart">Close</button></div><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><div id="jel-chart" class="jel-chart" aria-live="polite"></div><p id="jel-status" class="subtle">Graph derived from the selected job snapshot.</p></dialog>
|
|
87
87
|
<dialog id="graph-dialog" class="graph-dialog" aria-label="Workflow 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-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>
|
|
@@ -236,6 +236,7 @@ async function openJelChart(job){
|
|
|
236
236
|
const definitions=graphNodeDefinitions(source);
|
|
237
237
|
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
238
|
applyGraphPalette(svg);
|
|
239
|
+
applyJelHighlights(svg);
|
|
239
240
|
jelChart.replaceChildren(svg);
|
|
240
241
|
}catch(error){
|
|
241
242
|
if(renderId!==jelRenderSequence||!jelDialog.open)return;
|
|
@@ -245,6 +246,17 @@ async function openJelChart(job){
|
|
|
245
246
|
}
|
|
246
247
|
jelDialog.querySelector('#jel-dialog-close').addEventListener('click',()=>jelDialog.close());
|
|
247
248
|
jelDialog.addEventListener('close',()=>{jelRenderSequence++;});
|
|
249
|
+
function applyJelHighlights(svg){
|
|
250
|
+
const palette={failed:['#fee2e2','#b91c1c','#991b1b'],retry:['#ede9fe','#7c3aed','#5b21b6'],troubleshooter:['#fef3c7','#b45309','#92400e']};
|
|
251
|
+
for(const node of svg.querySelectorAll('g.node')){
|
|
252
|
+
const kind=node.id.includes('-flowchart-failed_')?'failed':node.id.includes('-flowchart-retry_')?'retry':node.id.includes('-flowchart-troubleshooter_')?'troubleshooter':null;
|
|
253
|
+
if(!kind)continue;
|
|
254
|
+
node.classList.add('jel-'+kind);
|
|
255
|
+
const [fill,stroke,color]=palette[kind];
|
|
256
|
+
for(const shape of node.querySelectorAll('rect,polygon,circle,ellipse')){shape.setAttribute('fill',fill);shape.setAttribute('stroke',stroke);shape.setAttribute('stroke-width','2');}
|
|
257
|
+
for(const label of node.querySelectorAll('text,tspan'))label.setAttribute('fill',color);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
248
260
|
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='#jel-dialog';link.addEventListener('click',event=>{event.preventDefault();void openJelChart(job);});line.append(link);box.append(line);return box;}
|
|
249
261
|
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
262
|
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));}}
|
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
|
@@ -134,6 +134,11 @@ export const dashboardStyles = ` <style>
|
|
|
134
134
|
.jel-dialog { width:min(1050px,96vw); max-height:90vh; padding:.8rem; border:1px solid var(--border); border-radius:.55rem; background:var(--surface); color:var(--text); }
|
|
135
135
|
.jel-dialog::backdrop { background:#17202b99; }
|
|
136
136
|
.jel-dialog-header { display:flex; justify-content:space-between; align-items:center; gap:1rem; padding:.2rem .3rem .6rem; }
|
|
137
|
+
.jel-legend { display:flex; align-items:center; flex-wrap:wrap; gap:.5rem; padding:.1rem .3rem .6rem; font-size:.76rem; font-weight:700; }
|
|
138
|
+
.jel-legend span { padding:.16rem .5rem; border-radius:.35rem; border:1px solid; }
|
|
139
|
+
.jel-legend-failed { background:#fee2e2; border-color:#b91c1c!important; color:#991b1b; }
|
|
140
|
+
.jel-legend-retry { background:#ede9fe; border-color:#7c3aed!important; color:#5b21b6; }
|
|
141
|
+
.jel-legend-troubleshooter { background:#fef3c7; border-color:#b45309!important; color:#92400e; }
|
|
137
142
|
.jel-chart { min-height:14rem; max-height:72vh; overflow:auto; padding:.8rem; border:1px solid var(--border); border-radius:.4rem; background:var(--surface2); }
|
|
138
143
|
.jel-chart svg { display:block; min-width:100%; max-width:none; height:auto; }
|
|
139
144
|
.jel-source { overflow:auto; white-space:pre; font:12px/1.5 ui-monospace,monospace; }
|