Coverage for src \ truenex_memory \ retrieval \ result.py: 100%
4 statements
« prev ^ index » next coverage.py v7.14.0, created at 2026-05-19 10:21 +0200
« prev ^ index » next coverage.py v7.14.0, created at 2026-05-19 10:21 +0200
1"""JSON helpers for retrieval results."""
3from __future__ import annotations
5from truenex_memory.store.models import SearchHit
8def search_payload(query: str, results: list[SearchHit], *, trace_id: str | None = None) -> dict[str, object]:
9 """Return the stable CLI/MCP search response shape."""
11 return {
12 "query": query,
13 "results": [
14 {
15 "title": item.title,
16 "content": item.content,
17 "source_path": item.source_path,
18 "heading_path": item.heading_path,
19 "memory_type": item.memory_type,
20 "status": item.status,
21 "score": item.score,
22 }
23 for item in results
24 ],
25 "trace_id": trace_id,
26 }