Read all entries from the JSONL transcript.
(self)
| 226 | # --- Transcript reading --- |
| 227 | |
| 228 | def read_transcript(self) -> list[dict[str, Any]]: |
| 229 | """Read all entries from the JSONL transcript.""" |
| 230 | if not self._transcript_path.exists(): |
| 231 | return [] |
| 232 | entries: list[dict[str, Any]] = [] |
| 233 | with open(self._transcript_path, "r", encoding="utf-8") as f: |
| 234 | for line_num, line in enumerate(f, 1): |
| 235 | line = line.strip() |
| 236 | if not line: |
| 237 | continue |
| 238 | try: |
| 239 | entries.append(json.loads(line)) |
| 240 | except json.JSONDecodeError as e: |
| 241 | logger.warning("Malformed JSONL line %d: %s", line_num, e) |
| 242 | return entries |
| 243 | |
| 244 | def read_messages(self) -> list[Message]: |
| 245 | """Read transcript as typed Message objects.""" |