Surface bridge handoff readiness in results

This commit is contained in:
OpenClaw Bot
2026-05-27 19:31:32 +02:00
parent c26bd4bfb0
commit 90beb50459
2 changed files with 42 additions and 3 deletions
+39 -1
View File
@@ -182,6 +182,12 @@ function renderItemSourceTrace(item = {}) {
`;
}
function readinessTone(status = '') {
if (status === 'ready') return 'ready';
if (status === 'usable-with-warnings') return 'warn';
return status ? 'blocked' : '';
}
function renderHandoffStatus(handoff = {}) {
const readiness = handoff.readiness || {};
if (!readiness.status) return '';
@@ -196,6 +202,37 @@ function renderHandoffStatus(handoff = {}) {
`;
}
function renderBridgeHandoffStrip(data = {}) {
const handoff = data.handoff || {};
const readiness = handoff.readiness || {};
if (!readiness.status) return '';
const source = handoff.source || data.brief?.source || data.input?.provenance || {};
const activeSlice = handoff.activeSlice || {};
const activeItem = activeSlice.item || {};
const sourceBits = [source.snapshotTitle, source.artifactId].filter(Boolean).join(' · ');
const tone = readinessTone(readiness.status);
return `
<section class="handoff-strip status-${escapeHtml(tone)}" aria-label="Bridge handoff readiness">
<div>
<span>Bridge readiness</span>
<strong>${escapeHtml(readiness.label || readiness.status)}</strong>
<p>${escapeHtml(readiness.summary || 'Read the warnings before handing this back to Scattermind.')}</p>
</div>
<div>
<span>Active slice</span>
<strong>${escapeHtml(activeItem.title || data.brief?.decisionReceipt?.activeMove || 'No active move')}</strong>
<p>${escapeHtml(activeSlice.rule || data.brief?.decisionReceipt?.handoffRule || 'Only the Do first item is active.')}</p>
</div>
<div>
<span>Source</span>
<strong>${escapeHtml(sourceBits || 'No artifact attached')}</strong>
<p>${escapeHtml(source.originalPromptExcerpt || source.sourceSummaryExcerpt || 'Add source context before treating this as a durable bridge handoff.')}</p>
</div>
${(readiness.nextChecks || []).length ? `<small>Next check: ${escapeHtml(readiness.nextChecks[0])}</small>` : ''}
</section>
`;
}
function renderFirstScreen(firstScreen = {}) {
if (!firstScreen.headline) return '';
const held = firstScreen.holdBack || [];
@@ -366,9 +403,10 @@ function renderResults(data) {
<p class="eyebrow">${escapeHtml(data.mode?.label || 'Ranked feedback')} · first-pass judgement memo</p>
<h2>${escapeHtml(brief.headline || 'Ranked feedback map')}</h2>
<p>${escapeHtml(brief.summary || '')}</p>
<div class="memo-stamps"><span>Not an oracle</span><span>${escapeHtml(data.rankConfidence?.level || 'first pass')} confidence</span><span>${ranked.length} items judged</span></div>
<div class="memo-stamps"><span>Not an oracle</span><span>${escapeHtml(data.rankConfidence?.level || 'first pass')} confidence</span><span>${ranked.length} items judged</span><span>${escapeHtml(data.handoff?.readiness?.label || data.handoff?.readiness?.status || 'handoff unchecked')}</span></div>
</div>
${renderBridgeHandoffStrip(data)}
<section class="quick-glance" aria-label="Quick judgement">
<div><span>Do this first</span><strong>${escapeHtml(glance.topPick || 'Add options')}</strong></div>
<div><span>Why it wins</span><p>${escapeHtml(glance.whyThisWins || 'The list needs more comparable options.')}</p></div>