From 2c51338de7b76167971dea3d1fc113ea89c56304 Mon Sep 17 00:00:00 2001 From: Shay Date: Thu, 14 May 2026 13:10:54 -0700 Subject: [PATCH] generate/result: add identity_score field to GenerationResult IdentityCheck runs after generation in ChatRuntime and must travel forward with the result without requiring a second pass or a wrapper. The field is Optional so all existing call sites that don't supply it continue to work unmodified. --- generate/result.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/generate/result.py b/generate/result.py index ddc24199..da634d99 100644 --- a/generate/result.py +++ b/generate/result.py @@ -7,14 +7,16 @@ field state before generation; discarding it means the vault stores the prompt field, not the assistant response field. Contracts: - tokens — the decoded token sequence in emission order - final_state — FieldState after the last propagation step - trajectory — optional ordered list of intermediate FieldStates; - None unless the caller explicitly requests it (expensive) + tokens — the decoded token sequence in emission order + final_state — FieldState after the last propagation step + trajectory — optional ordered list of intermediate FieldStates; + None unless the caller explicitly requests it (expensive) + identity_score — IdentityScore from IdentityCheck; None if not evaluated """ from __future__ import annotations from dataclasses import dataclass +from typing import Optional from field.state import FieldState @@ -25,6 +27,7 @@ class GenerationResult: trajectory: tuple | None = None # (FieldState, ...) or None salience_top_k: int | None = None candidates_used: int | None = None + identity_score: Optional[object] = None # IdentityScore | None def __post_init__(self) -> None: # Coerce list inputs to tuple for immutability.