import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent"; import { matchesKey, Text } from "@earendil-works/pi-tui"; export async function showStatusPanel(ctx: ExtensionCommandContext, lines: string[]): Promise { if (ctx.mode !== "tui") { if (ctx.hasUI) ctx.ui.notify(lines.join(" ยท "), "info"); return; } await ctx.ui.custom((_tui, theme, _kb, done) => ({ invalidate() {}, render(width: number) { return new Text([ theme.fg("accent", theme.bold("Tree labeler status")), "", ...lines, "", theme.fg("dim", "Press Enter or Esc to close"), ].join("\n"), 1, 0).render(width); }, handleInput(data: string) { if (matchesKey(data, "enter") || matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) done(undefined); }, })); }