Skip to main content

user_turn_line

Function user_turn_line 

Source
pub fn user_turn_line(prompt: &str) -> String
Expand description

The single place the stdin wire shape is constructed: one line of JSON carrying the initial user turn for a --input-format stream-json child.

Shape ({"type":"user","message":{"role":"user","content":<prompt>}}) is reproduced from the three archived Phase 30 harnesses, which all wrote exactly this and got a working turn back.

Built with serde_json rather than format! so the prompt is ESCAPED, not interpolated. A stage prompt is arbitrary text containing quotes, newlines and backslashes; interpolating it would produce a torn JSON line the CLI rejects, and a prompt could then alter the surrounding document’s structure.