(text: str, record: Any, policy: CompositionPolicy)
| 621 | |
| 622 | |
| 623 | def _build_artifact_stub(text: str, record: Any, policy: CompositionPolicy) -> str: |
| 624 | preview = text[:policy.preview_chars].strip() |
| 625 | tail = text[-policy.tail_chars:].strip() if len(text) > policy.preview_chars else "" |
| 626 | lines = [ |
| 627 | f"[UncommonRoute artifact://{record.id}]", |
| 628 | "Large tool result offloaded for token efficiency.", |
| 629 | ( |
| 630 | f"tool={record.tool_name or 'unknown'}" |
| 631 | f" tool_call_id={record.tool_call_id or '-'}" |
| 632 | f" tokens~{record.token_estimate}" |
| 633 | f" chars={record.char_count}" |
| 634 | f" sha256={record.sha256[:12]}" |
| 635 | ), |
| 636 | ] |
| 637 | shape = _describe_shape(text) |
| 638 | if shape: |
| 639 | lines.append(shape) |
| 640 | if preview: |
| 641 | lines.extend(["preview:", preview]) |
| 642 | if tail and tail != preview: |
| 643 | lines.extend(["tail:", tail]) |
| 644 | return "\n".join(lines) |
| 645 | |
| 646 | |
| 647 | def _build_semantic_artifact_stub(artifact: dict[str, Any], summary: str, policy: CompositionPolicy) -> str: |
no test coverage detected