UNPKG

agentfootprint

Version:

The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.

37 lines • 1.71 kB
"use strict"; /** * semantics/format — rendering one {@link SemanticsReport} for a terminal. * * Pattern: the tool-lint `format.ts` sibling — pure string building, no IO. * Role: lib/ layer, pure. * Emits: N/A. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.formatSemanticsReport = void 0; function findingLine(f) { const mark = f.severity === 'error' ? '✗' : '⚠'; const where = f.resultIndex !== undefined ? ` result ${f.resultIndex + 1}` : ''; return ` ${mark} ${f.tool}${where} [${f.code}] field: ${f.field}\n ${f.message}`; } /** Render the report. Every finding names its tool and its field — the two * facts a build log must carry for the fix to be a one-line edit. */ function formatSemanticsReport(report) { const errors = report.findings.filter((f) => f.severity === 'error'); const warnings = report.findings.filter((f) => f.severity === 'warning'); const lines = [ `check:semantics — ${report.checkedTools} tool${report.checkedTools === 1 ? '' : 's'}, ` + `${report.checkedResults} sample result${report.checkedResults === 1 ? '' : 's'}`, ]; if (report.findings.length === 0) { lines.push(' ✓ every sampled result honors the semantic vocabulary and its class rules'); } else { for (const f of report.findings) lines.push(findingLine(f)); } lines.push(`${report.ok ? 'ok' : 'FAILED'} — ${errors.length} error${errors.length === 1 ? '' : 's'}, ` + `${warnings.length} warning${warnings.length === 1 ? '' : 's'}`); return lines.join('\n'); } exports.formatSemanticsReport = formatSemanticsReport; //# sourceMappingURL=format.js.map