pub fn bounded_routing_payload(task: &str) -> RoutingPayloadExpand description
Bound, sanitize, and redact task text into the payload a Router receives.
Four things happen, in order:
- Control characters (including newlines) collapse to spaces and runs of whitespace collapse to one, so the task cannot restructure the prompt it is embedded in.
- Wrapper/fence sequences a router prompt uses structurally — backtick fences and brace-JSON — are neutralized, so task text cannot close the prompt’s own framing or present itself as the answer object.
- Absolute paths and secret-shaped tokens are removed, and the fact is recorded. Neither has any business reaching a routing service, and neither may be persisted next to one.
- The result is cut to
ROUTER_SUMMARY_MAX_CHARScharacters, and the cut is recorded rather than hidden.