core/generate/determine/render.py
Shay dc06bd5a3c feat(runtime): surface the determination — the engine answers from accrued knowledge (Step B-2)
When accrue_realized_knowledge is on and a question turn is Determined over realized
knowledge, the user-facing surface IS that answer (generate.determine.render_determination):
'Yes — as I was told, truth is a concept.' The realizer's articulation_surface is
RETAINED as evidence — the determination is a user-facing SELECTION (like the
unknown-domain gate), not a rewrite. An Undetermined turn keeps the default
articulation surface (the honest 'I don't know'); flag-off never takes this path.

Basis is rendered honestly: SPECULATIVE grounds read 'as I was told', never 'verified'
(D0 only asserts answer=True, so the surface is an affirmation — no fabricated or
asserted-False string). Selection only: no field op, no normalization, proposes no
learning (HITL untouched).

Updates docs/runtime_contracts.md selection policy + adds the contract test in the
same PR (per the surface-contract discipline).
2026-06-06 10:52:54 -07:00

26 lines
1.2 KiB
Python

"""Deterministic surface rendering for a Determined answer (Step B-2).
Turns a ``Determined`` into the user-facing string the runtime surfaces. The basis is
rendered HONESTLY: SPECULATIVE grounds (today's only case) render as "as I was told",
never "verified" — only COHERENT-admissible grounds (not yet reachable) would. D0 only
ever asserts ``answer=True``, so the surface is an affirmation; there is no fabricated
or asserted-False surface to render.
"""
from __future__ import annotations
from generate.determine.determine import Determined
#: Predicate → surface phrase. ``member`` reads as "is a"; the relational pack
#: predicates fall back to their lemma with underscores spaced ("less_than" → "less
#: than"). Closed and deterministic; an unknown predicate still renders legibly.
_PREDICATE_PHRASE: dict[str, str] = {
"member": "is a",
}
def render_determination(d: Determined) -> str:
"""The user-facing surface for a Determined answer — deterministic, honest basis."""
phrase = _PREDICATE_PHRASE.get(d.predicate, d.predicate.replace("_", " "))
qualifier = "as I was told" if d.basis == "as_told" else "verified"
return f"Yes — {qualifier}, {d.subject} {phrase} {d.object}."