spb/khaelor Public
KHAELOR — a terminal-native autonomous engineering agent powered by Anthropic.
TypeScript 82.9%
HTML 14.9%
CSS 1.1%
JavaScript 0.7%
1/**2 * KHAELOR3 * File: src/tui/components/error-panel.ts4 * Description: Error presentation per CLAUDE.md §17 — what failed, where, what happens next; never a bare "command failed".5 *6 * Author: Simon-Pierre Boucher7 * Contact: contact@spboucher.ai8 */910import { truncateAnsi } from "../renderer/ansi.js";11import type { Theme } from "../theme.js";1213export interface ErrorPanelData {14 /** What failed, concretely: `npm test failed`. */15 title: string;16 /** The specifics: counts, files, failing test names. */17 detailLines?: string[];18 /** What happens next, e.g. `KHAELOR is inspecting the failure.` */19 followUp?: string;20}2122/**23 * Settled error block:24 *25 * npm test failed26 * 2 tests failed27 * src/context/engine.test.ts28 * context compaction preserves running processes29 * KHAELOR is inspecting the failure.30 */31export function renderErrorPanel(data: ErrorPanelData, width: number, theme: Theme): string[] {32 const out: string[] = [truncateAnsi(" " + theme.paint("error", data.title), width)];33 for (const line of data.detailLines ?? []) {34 out.push(truncateAnsi(" " + line, width));35 }36 if (data.followUp !== undefined) {37 out.push(truncateAnsi(" " + theme.paint("dim", data.followUp), width));38 }39 return out;40}41