MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _build_artifact_stub

Function _build_artifact_stub

uncommon_route/composition.py:623–644  ·  view source on GitHub ↗
(text: str, record: Any, policy: CompositionPolicy)

Source from the content-addressed store, hash-verified

621
622
623def _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
647def _build_semantic_artifact_stub(artifact: dict[str, Any], summary: str, policy: CompositionPolicy) -> str:

Callers 1

_compose_deterministicFunction · 0.85

Calls 2

_describe_shapeFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected