Function safe_preview

Source
pub fn safe_preview(text: &str, max_length: usize) -> String
Expand description

Create a safe preview of text by truncating and redacting PII

This combines truncation and PII redaction for maximum safety.

ยงExamples

use agents_core::security::safe_preview;

let text = "My email is john@example.com and here's a very long message that goes on and on...";
let preview = safe_preview(text, 50);
assert!(preview.len() <= 53); // 50 + "..."
assert!(preview.contains("[EMAIL]"));