pub fn encode_user_prompt(
prompt: &str,
session_id: &str,
uuid: &str,
) -> Result<String, Error>Expand description
Encode a user prompt as one line of stream-json input.
Returns a string terminated by \n suitable for writing directly to the
subprocess’s stdin.
uuid is the prompt’s own id, and it is stamped on every frame: the CLI
emits that prompt’s command_lifecycle frames (queued, started, …) only
when the frame carries one (measured: zero frames without), and a reused id
makes the CLI drop the prompt outright with no error anywhere. Mint a fresh
one per send (crate::request_id::next_prompt_id).
§Errors
Error::MessageParse wrapping a JSON serialization failure
(extraordinarily rare for string inputs; included for totality).