Cot Mesh Sanitizer
Stateless CoT-XML hygiene for LoRa-mesh transport.
Centralized here so every consumer (Meshtastic-Android takserver, Meshtastic-Apple AccessoryManager, …) shares ONE golden-tested implementation instead of each maintaining its own regex list. Those lists had drifted and silently broken features — most recently TAK-Talk <voice> and <marti> were re-added to one side's strip set, so directed/voice TAK-Talk stopped surfacing end-to-end.
Pure string transforms — no platform, protobuf, or compression dependencies — so this lives in commonMain and is available on every KMP target (JVM, Android, iOS), which is what lets a multiplatform consumer call it from its own commonMain.
Regexes use [\s\S] rather than the DOTALL flag so behaviour is identical across all five language bindings (and Kotlin/Native, which doesn't expose RegexOption.DOT_MATCHES_ALL). The cross-binding fixtures under testdata/sanitizer/ lock byte-for-byte parity.
Functions
Normalize CoT XML for the TAK TCP stream: drop the <?xml …?> declaration and collapse inter-tag whitespace (> < → ><). TAK clients read a continuous stream of single-line events and choke on a pretty-printed, multi-line document with a prologue. Whitespace inside text nodes is left intact (only >-whitespace-< runs collapse).
Strip display-only CoT <detail> content to fit the LoRa MTU, preserving everything the receiver needs to render/route — including TAK-Talk <voice> and <marti>. Safe to run on any CoT XML; a no-op when there is nothing to strip.