(self)
| 63 | # ── persistence ────────────────────────────────────────────── |
| 64 | |
| 65 | def _load(self) -> None: |
| 66 | if not self._path.exists(): |
| 67 | return |
| 68 | try: |
| 69 | raw = json.loads(self._path.read_text(encoding="utf-8")) |
| 70 | for sid, entry in raw.get("bindings", {}).items(): |
| 71 | self._bindings[sid] = CliSessionBinding( |
| 72 | cli_session_id=entry["cli_session_id"], |
| 73 | auth_profile_id=entry.get("auth_profile_id"), |
| 74 | system_prompt_hash=entry.get("system_prompt_hash"), |
| 75 | created_at=entry.get("created_at", 0.0), |
| 76 | ) |
| 77 | except Exception as e: |
| 78 | logger.warning("[CliSessionStore] failed to load %s: %s", self._path, e) |
| 79 | |
| 80 | def save(self) -> None: |
| 81 | self._path.parent.mkdir(parents=True, exist_ok=True) |
no test coverage detected