refactor(tui): dedupe handlers and formatter test setup

This commit is contained in:
Peter Steinberger
2026-02-22 14:05:51 +00:00
parent 66f814a0af
commit 38752338dc
20 changed files with 430 additions and 477 deletions

View File

@@ -1,21 +1,12 @@
import { Container, Markdown, Spacer } from "@mariozechner/pi-tui";
import { markdownTheme, theme } from "../theme/theme.js";
export class AssistantMessageComponent extends Container {
private body: Markdown;
import { theme } from "../theme/theme.js";
import { MarkdownMessageComponent } from "./markdown-message.js";
export class AssistantMessageComponent extends MarkdownMessageComponent {
constructor(text: string) {
super();
this.body = new Markdown(text, 1, 0, markdownTheme, {
super(text, 0, {
// Keep assistant body text in terminal default foreground so contrast
// follows the user's terminal theme (dark or light).
color: (line) => theme.assistantText(line),
});
this.addChild(new Spacer(1));
this.addChild(this.body);
}
setText(text: string) {
this.body.setText(text);
}
}