Get session file path for a project directory.
(project_dir: str = None)
| 31 | return text |
| 32 | |
| 33 | def _session_path(project_dir: str = None) -> Path: |
| 34 | """Get session file path for a project directory.""" |
| 35 | SESSIONS_DIR.mkdir(exist_ok=True) |
| 36 | cwd = project_dir or os.getcwd() |
| 37 | # Hash the path to make a safe filename |
| 38 | key = hashlib.sha256(cwd.encode()).hexdigest()[:12] |
| 39 | # Also include last dir name for readability |
| 40 | name = Path(cwd).name |
| 41 | return SESSIONS_DIR / f"{name}_{key}.json" |
| 42 | |
| 43 | def save_session(history: list, project_dir: str = None, max_turns: int = 6): |
| 44 | """Save conversation history to disk. Keeps last max_turns turns.""" |
no outgoing calls
no test coverage detected