cf813c1091
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
57 lines
3.2 KiB
JavaScript
57 lines
3.2 KiB
JavaScript
#!/usr/bin/env node
|
|
/** verdict-surface-detail — подписанные строки вердиктов на участника (роутер/наставник/судья).
|
|
* Тотальны: мусор/null → ''. Без побочных эффектов. Видимость, не гейт. */
|
|
|
|
export function buildRouterSurface(router, { round = null } = {}) {
|
|
if (!router || typeof router !== 'object') return '';
|
|
const r = round ? ` [круг ${round}]` : '';
|
|
const chain = Array.isArray(router.recommendedChain) ? router.recommendedChain : null;
|
|
const declared = Array.isArray(router.declared) ? router.declared : [];
|
|
if (!chain) return `🧭 РОУТЕР${r}: скил-сверка пропущена (classify недоступен/сбой)`;
|
|
return `🧭 РОУТЕР${r}: рекомендует [${chain.join(', ')}] · объявлено [${declared.join(', ')}]`;
|
|
}
|
|
|
|
export function buildMentorSurface(kindObj, { round = null, verdict = null } = {}) {
|
|
if (!kindObj || typeof kindObj !== 'object') return '';
|
|
const r = round ? ` [круг ${round}]` : '';
|
|
const k = String(kindObj.kind || '');
|
|
if (k === 'go') {
|
|
const reasoning = (verdict && typeof verdict.reasoning === 'string' && verdict.reasoning.trim()) ? verdict.reasoning.trim() : '—';
|
|
const rec = (verdict && typeof verdict.recommendation === 'string' && verdict.recommendation.trim()) ? verdict.recommendation.trim() : '—';
|
|
return `🧑🏫 НАСТАВНИК${r}: GO · reasoning: ${reasoning} · recommendation: ${rec}`;
|
|
}
|
|
if (k === 'nogo') {
|
|
const t = (typeof kindObj.text === 'string' && kindObj.text.trim()) ? kindObj.text.trim() : '(без текста)';
|
|
return `🧑🏫 НАСТАВНИК${r}: NO-GO · ${t}`;
|
|
}
|
|
if (k === 'degraded') {
|
|
const reason = (typeof kindObj.reason === 'string' && kindObj.reason.trim()) ? kindObj.reason.trim() : 'причина неизвестна';
|
|
return `🧑🏫 НАСТАВНИК${r}: ⚠ не дозвонился (${reason})`;
|
|
}
|
|
if (k === 'skip') {
|
|
const reason = (typeof kindObj.reason === 'string' && kindObj.reason.trim()) ? kindObj.reason.trim() : 'причина неизвестна';
|
|
return `🧑🏫 НАСТАВНИК${r}: ⏭ пропуск (${reason})`;
|
|
}
|
|
return '';
|
|
}
|
|
|
|
export function buildJudgeSurface(outcome, { gate = '' } = {}) {
|
|
if (!outcome || typeof outcome !== 'object') return '';
|
|
const g = gate ? ` ${gate}` : '';
|
|
const k = String(outcome.kind || '');
|
|
if (k === 'go') return `⚖️ СУДЬЯ${g}: GO`;
|
|
if (k === 'nogo') {
|
|
const t = (typeof outcome.text === 'string' && outcome.text.trim()) ? outcome.text.trim() : '(без текста)';
|
|
return `⚖️ СУДЬЯ${g}: NO-GO · ${t}`;
|
|
}
|
|
if (k === 'degraded') {
|
|
const reason = (typeof outcome.reason === 'string' && outcome.reason.trim()) ? outcome.reason.trim() : 'причина неизвестна';
|
|
return `⚖️ СУДЬЯ${g}: ⚠ не дозвонился (${reason})`;
|
|
}
|
|
if (k === 'skip') {
|
|
const reason = (typeof outcome.reason === 'string' && outcome.reason.trim()) ? outcome.reason.trim() : 'причина неизвестна';
|
|
return `⚖️ СУДЬЯ${g}: ⏭ пропуск (${reason})`;
|
|
}
|
|
return '';
|
|
}
|