From d0374a03f348be64971fcfed738f410ecbb881be Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Nov 2026 20:51:51 +0000 Subject: [PATCH 01/19] Add design for decoding wire protocols into MarkupText and rendering per output Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7WGskvSsoRXvKMqybx --- .../2026-11-06-display-pipeline-design.md | 485 ++++++++++++++++++ 1 file changed, 485 insertions(+) create mode 100644 docs/superpowers/specs/2026-11-06-display-pipeline-design.md diff --git a/docs/superpowers/specs/2026-11-06-display-pipeline-design.md b/docs/superpowers/specs/2026-11-06-display-pipeline-design.md new file mode 100644 index 0000000..37a981e --- /dev/null +++ b/docs/superpowers/specs/2026-11-06-display-pipeline-design.md @@ -0,0 +1,485 @@ +# Display pipeline: decoding wire protocols and rendering them per output — design + +Status: draft for review, 2026-11-06. Nothing here is implemented yet. + +## Problem + +MarkupString renders one way: a `MarkupText` built on the server goes out as ANSI, HTML, MXP, Pueblo and the +rest. Clients need the opposite direction. They receive a byte stream that mixes text, SGR, OSC, MXP or Pueblo +tags and entities, and have to turn it into something they can draw: terminal cells, a cell grid drawn by +Skia, or HTML spans in a browser. + +Each SharpMUSH client does this separately today, and none of them uses MarkupString to do it: + +| Client | Decode | Model | Draw | +|---|---|---|---| +| SharpMUTerm (`SharpMUTerm.Core`) | `AnsiParser`, `MxpParser` (2,260 lines with definitions), `PuebloParser` (786 lines), one per session picked by `ContentFormat` in `WorldSession` | `StyledLine` of `StyledSpan(Text, TextStyle, SpanInteraction?)` | TUI: `MarkupFormatter` turns a line into SharpConsoleUI markup (`[#rrggbb bold link=…]`), resolving colours through the theme and a contrast floor. Window: SharpConsoleUI writes into `CellGrid` (`GridCell(Rune, Combiners, Fg, Bg, Decorations, IsWideContinuation)`), and `CellRenderer` paints it with Skia, drawing Kitty placeholder cells (`U+10EEEE`) as picture slices. | +| SharpClient (`SharpClient.Core.Rendering`) | `AnsiParser.Parse(line, MxpParserState?)`: SGR, MXP and Pueblo in one 591-line function set | `StyledSegment(Text, TextStyle){Command, Hint, ImageUrl}` | `OutputView.razor`: one `` per segment from `SegmentStyle.ToCss`, `