(artifact: dict[str, Any], summary: str, policy: CompositionPolicy)
| 645 | |
| 646 | |
| 647 | def _build_semantic_artifact_stub(artifact: dict[str, Any], summary: str, policy: CompositionPolicy) -> str: |
| 648 | preview = summary[: policy.preview_chars].strip() |
| 649 | lines = [ |
| 650 | f"[UncommonRoute artifact://{artifact['id']}]", |
| 651 | "Large tool result summarized via side-channel compression.", |
| 652 | ( |
| 653 | f"tool={artifact.get('tool_name') or 'unknown'}" |
| 654 | f" tool_call_id={artifact.get('tool_call_id') or '-'}" |
| 655 | f" tokens~{artifact.get('token_estimate', 0)}" |
| 656 | f" sha256={str(artifact.get('sha256', ''))[:12]}" |
| 657 | ), |
| 658 | "summary:", |
| 659 | preview, |
| 660 | ] |
| 661 | return "\n".join(lines) |
| 662 | |
| 663 | |
| 664 | def _messages_to_transcript(messages: list[dict[str, Any]]) -> str: |
no test coverage detected