# Shared: Browser evidence & HTML reports

Shared by `verify` and `review` (and any subcommand that records browser
evidence). The protocol: record during the session, then generate a local HTML
report.

## Protocol

1. Start the session with evidence on:
   `new_session({ ..., browser_options: { record_evidence: true } })`.
2. Do the work (`inspect_page`, `act`, `get_browser_console_logs`). `act` returns
   a `step_index` for each action, and a `screenshot_path` of the active tab
   after it when one could be taken.
   That screenshot is the step's image in the report, so cite the step whose
   result shows what a check claims.
3. `close_session()` → keep the returned `local_video_path` and
   `local_trace_path`.
4. **Generate the report** with `generate_html_report`:

   ```json
   {
     "session_id": "<session_id>",
     "local_video_path": "<local_video_path from close_session>",
     "local_trace_path": "<local_trace_path from close_session>",
     "title": "...",
     "summary": "...",
     "checks": [
       { "description": "...", "passed": true, "step_indices": [2, 3], "note": "..." }
     ]
   }
   ```

   Each check is your own pass/fail judgement of one acceptance criterion; cite
   the steps that prove it. A check also fails if a step it cites failed. The
   report passes only if every check passes and no step failed.

   Show the returned `file_path` to the user so they can open it.
   When you report on several sessions (one per viewport, say), give each
   report its own `output_path`: by default every report goes to the same
   `report.html` in the system temp directory, so the last one overwrites the
   rest.

There is no upload tool. The report is one local HTML file with the step
screenshots embedded; the video and trace stay separate local files, and the
report's video player plays the video from its path on this machine. To share
the report, send the HTML file, plus the video and trace for the reader to open
separately.

Only generate a report when the session was started with
`browser_options.record_evidence: true`.
