pub fn parse_agent_response_strict(
raw: &str,
) -> Result<AgentResponse, AgentResponseParseError>Expand description
Parses one raw assistant message strictly as protocol payload.
The final assistant payload must match AgentResponse and contain at
least one recognized protocol key (answer, questions,
review_comment_outcomes, or summary).
When a provider prepends stray prose before the final schema object, this still recovers the trailing protocol payload as long as nothing except whitespace follows the JSON object. As a further resilience fallback, markdown code fences wrapping the JSON object are stripped before parsing when neither direct parsing nor trailing-object recovery succeeds. An additional fallback extracts JSON from an embedded code fence preceded by prose text (e.g., commentary followed by a fenced JSON block). Top-level fields may rely on the wire type’s defaults.
§Errors
Returns AgentResponseParseError when no valid protocol payload is found.