# UI MVP Prompt (SignalReach Launcher + Viewer)

You are building the signalreach UI MVP (launcher + results viewer). The CLI is the source of truth and writes outputs into a run folder. Do not post-process KML contents. Serve the run directory as-is.

## How to run
- Command: .\.venv\Scripts\python.exe -m signalreach <mission.json>
- Working directory MUST be: `<repo-root>`
- Mission JSON MUST be written as UTF-8 without BOM (we tolerate BOM, but avoid it).

## Output contract
Each run writes to: `<repo-root>\out\runs\<run_id>\`
Files include:
- recommendation.kml
- coverage.png
- coverage_overlay.kml
- backhaul_links.kml
- (optional) margin.png, legend.png, per-site heatmaps

IMPORTANT: KMLs reference local images via relative paths. The UI must:
- copy/serve the whole run directory as a unit
- not rename or relocate images separately
Otherwise Google Earth will show red X placeholders.

## Validation UX
CLI prints:
- preview_check_armed: step=... max_points=... warn_delta=...
- preview_check: coarse_cov=... full_cov=... delta=...
If abs(delta) > warn_delta, show a banner:
"Preview sampling optimistic. Use validated coverage or rerun higher fidelity."

## Mission knobs the UI must expose
Top-level:
- workers (1–8)
- validate_full (bool)
- validate_full_max_points (int; 20000 ~ all demand)
- validate_warn_delta_pct (number)
los:
- max_points (int)
- sampling ("random"|"stratified")
- strata_spacing_m (meters; when stratified)
- step_m, freq_mhz, fresnel_k
heatmap:
- enabled, spacing_m, max_px, mode
backhaul:
- enabled, enforce_connected, require_gateway, candidate_k, min_confidence, max_distance_km
assets + anchors editor (minimal): name/lat/lon/heights/backhaul_required, asset qty/heights/backhaul_capable

## Locked presets to ship in MVP
Create preset mission JSONs (these exact knobs) and let the user choose:

1) FAST_PREVIEW_STRAT (UI default)
- workers=8
- los.sampling="stratified"
- los.strata_spacing_m=150
- los.max_points=2500
- validate_full=true
- validate_full_max_points=20000
- validate_warn_delta_pct=2.0

2) MID_FIDELITY_STRAT
- workers=8
- los.sampling="stratified"
- strata_spacing_m=150
- los.max_points=6000
- validate_full=true (same validation settings)

3) FIELD_GRADE_STRAT_10K (recommended for ops decisions)
- workers=8
- los.sampling="stratified"
- strata_spacing_m=150
- los.max_points=10000
- validate_full=true (same validation settings)

4) VALIDATE_ONLY (gate run)
- leave los settings unchanged
- validate_full=true, validate_full_max_points=20000, warn_delta=2.0
Use when the UI wants to confirm the preview estimate.

## What to display
- Coverage heatmap image + legend if present
- Backhaul links KML overlay
- Recommendation pins KML overlay
- Text metrics: los_covered_pct (coarse), full_cov (validated), delta, elapsed_s
