Strip Grok harness wrappers from a user prompt. Grok's agent runtime delivers the human message inside an XML-ish envelope: ```text Make sure this project runs. ``` Atomic records that string as the turn's change message, so `atomic log` would show the tags. Extract the inner text when the envelope is present; leave plain prompts untouched.
(prompt: &str)
| 367 | /// would show the tags. Extract the inner text when the envelope is present; |
| 368 | /// leave plain prompts untouched. |
| 369 | fn normalize_user_prompt(prompt: &str) -> String { |
| 370 | let trimmed = prompt.trim(); |
| 371 | |
| 372 | // Prefer a complete open/close pair (multiline body supported). |
| 373 | const OPEN: &str = "<user_query>"; |
| 374 | const CLOSE: &str = "</user_query>"; |
| 375 | if let Some(start) = trimmed.find(OPEN) { |
| 376 | let after_open = &trimmed[start + OPEN.len()..]; |
| 377 | if let Some(end) = after_open.find(CLOSE) { |
| 378 | return after_open[..end].trim().to_string(); |
| 379 | } |
| 380 | // Open tag without close — take everything after the open tag. |
| 381 | return after_open.trim().to_string(); |
| 382 | } |
| 383 | |
| 384 | trimmed.to_string() |
| 385 | } |
| 386 | |
| 387 | fn with_xai_provider(mut raw: Value) -> Value { |
| 388 | if let Some(obj) = raw.as_object_mut() { |