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
¶
apply(messages: Sequence[Any], *, start_index: int = 0, fresh_start_index: int | None = None) -> list[Any]
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. start_index leaves replayed history full:
its call IDs can repeat in this invocation, while its payloads do not
belong to the invocation ledger. fresh_start_index protects recall
outputs only until their first model exposure.
Source code in src/symfonic/capabilities/tools/results/service.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
Transcript ¶
Bases: Protocol
The narrow slice of a message transcript the service reads.