symfonic.capabilities.tools.results.service¶
service ¶
The result-policy service — applying decisions to a transcript (T3.1.3).
Four invariants this service exists to hold, each one previously a comment in the middle of a react-node helper:
- the call id is preserved verbatim. A rewritten result whose id changed is an immediate provider 400; a result with no id at all is never rewritten, because there is no id to preserve.
- the tool_use side is never touched. Editing it is also a 400, and it sits inside the cached prefix — rewriting it shifts bytes and busts the cache for everything after it.
- nothing is mutated. The input list and its messages are left alone, so the checkpoint stays lossless and only the wire view is compact.
- stubs are deterministic. They come from the ledger handle, so a compacted prefix is byte-identical across iterations.
The transcript adapter is injected: constructing a provider message type is wire-format work, and a capability may not import one.
ResultPolicyService ¶
Rewrite the wire view of a transcript according to the policy.
Source code in src/symfonic/capabilities/tools/results/service.py
last_decisions
property
¶
What the most recent :meth:apply decided, per result.
apply
async
¶
Return the wire view of messages.
Returns the argument itself (identity, not a copy) when nothing can change — which is every iteration of every deployment that leaves compaction off.
Source code in src/symfonic/capabilities/tools/results/service.py
Transcript ¶
Bases: Protocol
The narrow slice of a message transcript the service reads.