Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Contracts and edge cases

Platform spec article

Contracts and edge cases

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

State MUST/SHOULD rules for escape framing, capability gating, and the v1 conformance-tested CSI subset.

IDRequirement
ANSI-001Ansi.Escape.Esc() must return exactly one U+001B code unit.
ANSI-002Csi(body, finalByte) must produce ESC[ + body + finalByte with no capability filtering (test and composition primitive).
ANSI-003EmitCsi, EmitOsc, EmitDec, and builders whose IntoSequence calls WhenEnabled must return "" when Console.Capabilities.ShouldEmitAnsi() is false.
ANSI-004PrivateMode(mode, enable) must encode ESC[?{mode}h or ESC[?{mode}l.
ANSI-005DecSaveCursor / DecRestoreCursor must emit ESC 7 and ESC 8 respectively (single-byte suffix, no bracket).
ANSI-006OscSequence(payload) must terminate with BEL (0x07).
ANSI-007SgrBuilder RGB helpers must downgrade per EffectiveColorModel before calling EmitCsi (see Console capabilities).
ANSI-008Golden tests listed in verification and traceability must match byte-for-byte output when emission is enabled.
FinalBuilder surfaceExample
mAnsi.Sgr, Ansi.StyleChainESC[1;31m
AG, H, fAnsi.CursorESC[2J via Ansi.Erase uses J/K
J, KAnsi.EraseESC[2J, ESC[2K
h, lAnsi.Escape.PrivateMode, Ansi.ScreenESC[?1049h

Sequences present in ANSI.md but without a corelib builder or golden test are informative until added to this table.

  • Piped stdout: When stdout is not a TTY and FORCE_COLOR is unset, styled helpers must emit no escapes (ANSI-003); plain System.Output.Write still writes bytes.
  • Partial terminal support: Terminals may ignore italic, blink, or truecolor; downgrade reduces garbled output but cannot guarantee visual fidelity.
  • Multiplexers (tmux, screen): Alternate-buffer and private-mode sequences may behave differently; corelib does not special-case multiplexers in v1.
  • Keyboard redefinition (ESC[{code};{string}p): Not implemented; documented in ANSI.md for historical completeness only.
  • Erase without cursor move: After ESC[2K, callers should emit \r if the cursor must sit at column 1 (see design model).

Each ANSI-* row maps to AnsiEscapeTests.bd / AnsiSgrGoldenTests.bd or capability tests — verification and traceability.

  • Flow and algorithm

  • Console markup format — must use builders, not raw ESC in markup

  • DCS string handling

  • Full xterm private-mode catalog

  • Host-specific WIN32 console APIs beyond Platform.* extern stubs