Render full session details as a Rich panel, then print report if it exists.
(session: dict[str, Any], index: int, console: Any)
| 151 | |
| 152 | |
| 153 | def display_session_detail(session: dict[str, Any], index: int, console: Any) -> None: |
| 154 | """Render full session details as a Rich panel, then print report if it exists.""" |
| 155 | from rich.panel import Panel |
| 156 | |
| 157 | prompts = session.get("prompts", []) |
| 158 | targets = session.get("targets", []) |
| 159 | tools = session.get("tools_used", []) |
| 160 | report = session.get("report_path", "") |
| 161 | |
| 162 | lines = [ |
| 163 | f"[bold]Date:[/] {session.get('timestamp', '')}", |
| 164 | f"[bold]Duration:[/] {_fmt_duration(session.get('duration_seconds', 0))}", |
| 165 | "[bold]Prompts:[/]", |
| 166 | *[f" • {p}" for p in prompts], |
| 167 | f"[bold]Targets:[/] {', '.join(targets) or '—'}", |
| 168 | f"[bold]Tools:[/] {', '.join(tools) or '—'}", |
| 169 | f"[bold]Report:[/] {report or '—'}", |
| 170 | ] |
| 171 | |
| 172 | console.print() |
| 173 | console.print( |
| 174 | Panel( |
| 175 | "\n".join(lines), |
| 176 | title=f"[bold]Session #{index}[/]", |
| 177 | border_style="#00ff88", |
| 178 | padding=(0, 2), |
| 179 | ) |
| 180 | ) |
| 181 | |
| 182 | if report: |
| 183 | rp = Path(report) |
| 184 | if rp.exists(): |
| 185 | from rich.markdown import Markdown |
| 186 | |
| 187 | console.print( |
| 188 | Panel( |
| 189 | Markdown(rp.read_text(encoding="utf-8")), |
| 190 | title="[bold]Report[/]", |
| 191 | border_style="#1e293b", |
| 192 | padding=(1, 2), |
| 193 | ) |
| 194 | ) |
| 195 | |
| 196 | console.print() |
no test coverage detected