Load a previously saved RunState JSON payload, if present.
(self)
| 105 | await asyncio.to_thread(file_path.write_text, payload, encoding="utf-8") |
| 106 | |
| 107 | async def load_state_json(self) -> dict[str, Any] | None: |
| 108 | """Load a previously saved RunState JSON payload, if present.""" |
| 109 | session_id = await self._ensure_session_id() |
| 110 | state_path = self._state_path(session_id) |
| 111 | try: |
| 112 | data = await asyncio.to_thread(state_path.read_text, "utf-8") |
| 113 | parsed = json.loads(data) |
| 114 | return parsed if isinstance(parsed, dict) else None |
| 115 | except FileNotFoundError: |
| 116 | return None |
| 117 | |
| 118 | async def save_state_json(self, state: dict[str, Any]) -> None: |
| 119 | """Persist the serialized RunState JSON payload alongside session items.""" |
no test coverage detected