trajectoryCapWireDump function

(String, bool) trajectoryCapWireDump(
  1. String payload, {
  2. int maxChars = wireDumpMaxChars,
})

Applies the wire-dump cap: payloads beyond maxChars are cut and carry wireDumpTruncationMarker (F5 cap enforcement). Returns the capped payload plus whether it was cut.

Implementation

(String, bool) trajectoryCapWireDump(
  String payload, {
  int maxChars = wireDumpMaxChars,
}) {
  if (payload.length <= maxChars) return (payload, false);
  return ('${payload.substring(0, maxChars)}$wireDumpTruncationMarker', true);
}