symfonic.capabilities.prompting.sources¶
sources ¶
Source resolution and the failure policy that governs it.
The one thing this module never does is fabricate content. A source that cannot be read produces exactly one of three outcomes — the compile fails, the last known good revision renders (marked degraded), or the contribution is omitted (recorded) — and which one is a property of the contribution's tier unless the operator states otherwise.
last_known_good deliberately does not fall back to "render nothing" on
its own authority. With no stored revision it defers to the tier default, so
an authored block whose backend has never been reachable fails the compile
rather than quietly shipping an agent without its rules on the first boot after
a deployment.
InMemoryLastKnownGood
dataclass
¶
A per-process store of the last revision each contribution served.
Keyed by :func:~.boundaries.isolation_key, so one tenant's stored profile
can never be served into another tenant's prompt — the failure mode that
makes a "just use the cached copy" fallback dangerous in a shared process.
SourceResolution
dataclass
¶
SourceResolution(read: SourceRead | None, diagnostics: tuple[PromptDiagnostic, ...] = (), degraded: bool = False)
The outcome of reading one contribution's source.
resolve_source ¶
resolve_source(contribution: PromptContribution, *, scope_path: str = '', turn: int = 0, store: InMemoryLastKnownGood | None = None) -> SourceResolution
Read one contribution's source, applying its declared failure policy.
The synchronous door. A source that offers only aread is refused by
name here rather than dropped: a silent drop is the defect this whole seam
exists to avoid, and a compile that accepted the declaration and rendered
none of it would be exactly the "accepted, validated, and never resolved"
failure TA8.38 refused to ship.
Source code in src/symfonic/capabilities/prompting/sources.py
resolve_source_async
async
¶
resolve_source_async(contribution: PromptContribution, *, scope_path: str = '', turn: int = 0, store: InMemoryLastKnownGood | None = None) -> SourceResolution
Read one contribution's source, awaiting it when it asks to be awaited.
The asynchronous door, and the only new failure mode it introduces is
cancellation, which is named ahead of the policy arm on purpose.
CancelledError derives from BaseException rather than Exception,
so the arm below would not have caught it anyway -- it is written out
because a later edit widening that arm to BaseException would otherwise
absorb a cancelled turn into on_source_failure and leave the turn
running. PromptBlockResolver.resolve_block names the same hazard in the
same words, and this seam is the one that brings that hazard onto the kernel
line.
Source code in src/symfonic/capabilities/prompting/sources.py
source_request ¶
source_request(contribution: PromptContribution, *, scope_path: str = '', turn: int = 0) -> SourceRequest
The request one contribution's source is asked with, on one turn.