Expose Guardian assessments in response streams (#57757)

## What changed

Decode `response.metadata` Guardian assessments into typed `GuardianAssessment` events over SSE and WebSocket, carrying `response_id`, `item_id`, and `requires_review`. Ignore assessments with missing, empty, or incorrectly typed required fields while preserving independent delivery of other metadata.

Expose the assessment type to request-scoped extension interceptors. Keep assessments out of conversation history; they do not authorize tool execution.

## Testing

Add SSE coverage for assessment ordering, malformed metadata, and mixed metadata delivery. Extend model request tests to cover SSE and WebSocket interceptor delivery and exclusion from subsequent model input.

GitOrigin-RevId: 282b8817ee97346d76b40bcb412eef023df60ff1
This commit is contained in:
jif
2026-10-28 15:04:29 +00:00
committed by copyberry
parent ce2d47bdc4
commit fc916a22b5
12 changed files with 452 additions and 56 deletions
+2
View File
@@ -93,6 +93,8 @@ pub enum ResponseEvent {
ModelVerifications(Vec<ModelVerification>),
/// Emitted when the server includes moderation metadata for first-party turn presentation.
TurnModerationMetadata(TurnModerationMetadataEvent),
/// Action-bound Guardian evidence for request-scoped consumers, not model history.
GuardianAssessment(crate::guardian_assessment::GuardianAssessment),
/// Emitted when `X-Reasoning-Included: true` is present on the response,
/// meaning the server already accounted for past reasoning tokens and the
/// client should not re-estimate them.