symfonic.agent.response_presentation¶
response_presentation ¶
Pure final-text presentation: extraction directives and citation tags.
The legacy engine turns a raw model reply into user-visible text with
_parse_and_strip_extraction followed by _strip_citation_tags. The
kernel-backed :class:~symfonic.agent.facade.Agent returns the raw reply. This
module is the same transformation as a dependency-free function, so a caller
can opt into it without importing the closed engine module.
The extraction patterns are copies, not imports, on purpose: engine.py
is closed to new surface and heavy to import. The citation-tag strip is
not a copy: it delegates to core.streaming.citation_filter, the single
whole-text spelling, which is neither closed nor heavy. Drift against the
legacy strip is caught by the differential tests in
tests/agent/presentation/test_response_presentation_parity.py, which run
both implementations over the same inputs.
Not covered: the legacy activation_log_mode footer strip, which is
configuration-driven and has no facade-side configuration to read.
PresentedText
dataclass
¶
The visible text and the extraction ops that were removed from it.
ops is empty both when no directive was present and when one was
present but malformed. Unlike the legacy parser, malformed scalar
operation collections are not forwarded to a caller hook. The visible
directive text is still stripped.
present_response ¶
Apply the legacy extraction strip, then the citation-tag strip.
Source code in src/symfonic/agent/response_presentation.py
strip_citation_tags ¶
The citation-tag half alone, for text whose directive was already removed.
Legacy strips one directive per reply: once a tagged block matched, a bare object left in the text is visible content, not a second directive.
Delegates to the core whole-text spelling so the vocabulary lives once.