# Session reports

## What it does

Completed mobile Sessions open a detail page with the petaV3 transcript, AI
analysis, meeting report and suggestions. Existing active-recording navigation,
Assign Lead and upload Retry actions remain available. Refresh retrieves current
results without scheduling AI work.

## How it works

The App reads the server recording UUID already persisted after upload. It
requests `GET /agent-api/agent-recordings/{recording_uuid}/report` using the
current company's API client and account session lease. A changed session
rejects late responses; reports are not persisted in a shared cache.

The route requires authenticated staff and selects only recordings owned by
the user's Admin row. Missing, foreign, ignored and deleted recordings return
404. The response includes only UUID, processing status, transcript, normalized
AI analysis, meeting report and recommendations; no audio URLs, storage metadata
or pipeline claim tokens. Credentialed responses use no-store headers.

The existing ConversationAnalysis normalizer and action accessors preserve both
v1 and v2 data. The legacy JSON report is used when the modern report is absent.
Queued, transcribing, analyzing and failed states retain any available results.
The App renders nested report content as readable labels and selectable text,
with explicit empty states and refresh/retry controls. Local, not-yet-uploaded
recordings display an upload message; filtered recordings have no report.

Deploy the backend addition to each participating company before distributing
this App revision. An older backend's 404 is shown as report unavailable; it
does not break recording or upload.

## Related files

- `routes/agent-api.php`
- `app/Http/Controllers/AgentApi/AgentRecordingReportsController.php`
- `src/Call/CallRecording.php`
- `src/Conversation/ConversationAnalysis.php`
- `tests/Feature/AgentApi/AgentRecordingReportTest.php`
- App: `lib/features/sessions/data/session_report_api.dart`
- App: `lib/features/sessions/presentation/session_detail_page.dart`
- App: `lib/features/sessions/data/session_store.dart`
- App: `lib/app/app_runtime.dart`
