@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
25 lines • 974 B
JavaScript
import { Box, wrapTextWithAnsi } from "@earendil-works/pi-tui";
const BOLD = "[1m";
const BOLD_OFF = "[22m";
function noticeText(text) {
return {
render(width) {
return wrapTextWithAnsi(text, Math.max(1, width));
},
invalidate() { },
};
}
/** Render a NoticeSpec as the shared transcript notice box (loop-guard visual family). */
export function buildNoticeBox(spec, options, theme) {
const box = new Box(1, 1, (text) => theme.bg("customMessageBg", text));
box.addChild(noticeText(theme.fg(spec.tone ?? "accent", `${BOLD}${spec.title}${BOLD_OFF}`)));
box.addChild(noticeText(theme.fg("dim", spec.why)));
for (const line of spec.extra ?? []) {
box.addChild(noticeText(theme.fg(line.tone ?? "dim", line.text)));
}
if (options.expanded && spec.expandedLine !== undefined) {
box.addChild(noticeText(theme.fg("dim", spec.expandedLine)));
}
return box;
}
//# sourceMappingURL=box.js.map