Skip to main content

bounded_routing_payload

Function bounded_routing_payload 

Source
pub fn bounded_routing_payload(task: &str) -> RoutingPayload
Expand description

Bound, sanitize, and redact task text into the payload a Router receives.

Four things happen, in order:

  1. 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.
  2. 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.
  3. 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.
  4. The result is cut to ROUTER_SUMMARY_MAX_CHARS characters, and the cut is recorded rather than hidden.