mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-11 01:01:13 +00:00
* feat(tui): add OSC 8 hyperlinks to make wrapped URLs clickable Long URLs that exceed terminal width get broken across lines by pi-tui's word wrapping, making them unclickable. Post-process rendered markdown output to add OSC 8 terminal hyperlink sequences around URL fragments, so each line fragment links to the full URL. Gracefully degrades on terminals without OSC 8 support. * tui: harden OSC8 URL extraction and prefix resolution * tui: add changelog entry for OSC 8 markdown hyperlinks --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
23 lines
708 B
TypeScript
23 lines
708 B
TypeScript
import { Container, Spacer } from "@mariozechner/pi-tui";
|
|
import { markdownTheme, theme } from "../theme/theme.js";
|
|
import { HyperlinkMarkdown } from "./hyperlink-markdown.js";
|
|
|
|
export class AssistantMessageComponent extends Container {
|
|
private body: HyperlinkMarkdown;
|
|
|
|
constructor(text: string) {
|
|
super();
|
|
this.body = new HyperlinkMarkdown(text, 1, 0, markdownTheme, {
|
|
// 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);
|
|
}
|
|
}
|