/** * Persistent log footer — last N lines from the active service. */ import { Box, Text } from "ink"; import type { ReactElement } from "react"; import { TUI_MUTED } from "../theme.ts"; /** Props for {@link LogStream}. */ export type LogStreamProps = { readonly lines: readonly string[]; readonly max?: number; readonly title?: string; }; /** * Scrollable-ish log tail (shows last `max` lines). * * @param props - Lines + title */ export function LogStream(props: LogStreamProps): ReactElement { const max = props.max ?? 6; const tail = props.lines.slice(-max); return ( {props.title ?? "Logs"} {tail.length === 0 ? ( (quiet) ) : ( tail.map((line, i) => ( {line.replace(/\n$/, "")} )) )} ); }