Files
oh-my-pi/packages/coding-agent/src/modes/components/collab-prompt-message.ts
T
can1357 9f16ca4797 feat(tui): enabled tight layout mode with optional 1-char padding reduction
- Added new `tui.tight` setting with default `false` and documented behavior.
- Added global tight-mode APIs and `setIgnoreTight` propagation across Box, Text, and Markdown.
- Handled `tui.tight` updates to refresh UI borders and trigger rerendering.
- Updated key message components to ignore tight mode selectively and preserve intended spacing.
2026-06-17 15:09:55 +02:00

33 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { TextContent } from "@oh-my-pi/pi-ai";
import { Container, Markdown, Text } from "@oh-my-pi/pi-tui";
import type { CollabPromptDetails } from "../../collab/protocol";
import type { CustomMessage } from "../../session/messages";
import { getMarkdownTheme, theme } from "../theme/theme";
/**
* Renders a collab guest prompt on every participant's transcript: a
* user-message-styled bubble prefixed with the author's name.
*/
export class CollabPromptMessageComponent extends Container {
constructor(message: CustomMessage<CollabPromptDetails>) {
super();
const from = message.details?.from?.trim() || "guest";
const authorText = new Text(theme.fg("accent", `\x1b[1m«${from}»\x1b[22m ›`), 1, 0);
authorText.setIgnoreTight(true);
this.addChild(authorText);
const text =
typeof message.content === "string"
? message.content
: message.content
.filter((content): content is TextContent => content.type === "text")
.map(content => content.text)
.join("");
const md = new Markdown(text, 1, 1, getMarkdownTheme(), {
bgColor: (value: string) => theme.bg("userMessageBg", value),
color: (value: string) => theme.fg("userMessageText", value),
});
md.setIgnoreTight(true);
this.addChild(md);
}
}