| 147 | |
| 148 | @dataclass(frozen=True, slots=True) |
| 149 | class CompositionResult: |
| 150 | messages: list[dict[str, Any]] |
| 151 | input_tokens_before: int |
| 152 | input_tokens_after: int |
| 153 | artifact_ids: list[str] = field(default_factory=list) |
| 154 | compacted_messages: int = 0 |
| 155 | offloaded_messages: int = 0 |
| 156 | semantic_summaries: int = 0 |
| 157 | checkpoint_created: bool = False |
| 158 | rehydrated_artifacts: int = 0 |
| 159 | semantic_calls: int = 0 |
| 160 | semantic_failures: int = 0 |
| 161 | semantic_quality_fallbacks: int = 0 |
| 162 | semantic_estimated_cost: float = 0.0 |
| 163 | semantic_actual_cost: float = 0.0 |
| 164 | |
| 165 | @property |
| 166 | def changed(self) -> bool: |
| 167 | return ( |
| 168 | self.input_tokens_after < self.input_tokens_before |
| 169 | or self.compacted_messages > 0 |
| 170 | or self.offloaded_messages > 0 |
| 171 | or self.semantic_summaries > 0 |
| 172 | or self.checkpoint_created |
| 173 | or self.rehydrated_artifacts > 0 |
| 174 | ) |
| 175 | |
| 176 | |
| 177 | DEFAULT_COMPOSITION_POLICY = CompositionPolicy() |
no outgoing calls
no test coverage detected