Skip to content
Merged
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
## Unreleased

### New Features

- **`render_map_tool`: live traffic, and Satellite/Traffic buttons on the map (#278).** Asked to show traffic downtown, ChatGPT told a user the map couldn't do it, which was true: the map only drew GeoJSON, and traffic showed up only in route summaries. Switching to satellite also took another tool call. Fixes #277.
- **Buttons:** two icon buttons sit under the zoom control, the same size as zoom and compass: a filled globe for satellite view and a filled car for live traffic, per the design feedback, each labeled with a tooltip and `aria-label`. One that's on gets a blue icon on a light blue background and `aria-pressed`.
- **Traffic:** the Mapbox Traffic v1 tileset (`mapbox://mapbox.mapbox-traffic-v1`) is drawn as lines colored by congestion (light, moderate, heavy, severe) in the `middle` slot, so road labels and our own layers stay on top. Light traffic shows only on main roads (motorway through tertiary, plus ramps), because on every side street it turned the whole map green; moderate and worse show on every road. Each direction is offset to its own side of the road, and lines run from 1 px at zoom 12 to 4 px at zoom 18. While it's on, a white "Fast [four colors] Slow" pill sits in the bottom left, below any payload legend, using the design's colors (`#00c94e`, `#ff9900`, `#ff2b3a`, `#8b0a18`) for both the pill and the lines. The tiles come from `api.mapbox.com`, which the CSP already allows. The map doesn't refetch them on a timer, so a map left open goes stale until it's moved or reloaded.
- **`showTraffic`:** a new `render_map_tool` input, and a line in the tool description, so the model knows it can show traffic and can open the map with it on. `false` turns it off. Left out, the map keeps whatever the user picked, the same way `baseStyle` works. A `showTraffic`-only call is renderable on its own, like `baseStyle`.
- **Style switches keep what's drawn:** `setStyle()` drops every source and layer the page added. The page now keeps a copy of each GeoJSON layer it draws (including self-fetched routes and isochrones, and deferred data once it arrives), and after a switch from the Satellite button it re-adds them, the base map config and traffic without moving the camera. A `baseStyle` switch from the model keeps traffic on too.
- **Summary chip:** it sat on top of the zoom buttons in the top-left corner. While it shows, the corner's controls now sit below it.
- **Logo and attribution:** the legend covered the Mapbox logo, and an open results panel covered the attribution, both of which the Mapbox terms require to stay visible. The legend now sits above the logo and the panel stops above the attribution, and the map's fit leaves room for the legend's new spot.
- **Testing:** added tests for both buttons, the traffic layer and legend, restoring layers and base map config after a switch, `showTraffic` on, off and left out, and the controls moving below the summary. The test sandbox's fake map now tracks sources and layers like a style does (`setStyle` clears them), and mounts controls through `onAdd`. Checked a live San Francisco tile: the source layer is `traffic`, with `congestion`, `class` and `structure`. Checked in Claude Desktop on both styles.

### Bug Fixes

- **The dev HTTP server (`npm run dev:http`) sends the server instructions (#314).** It built its server without them, unlike `src/index.ts` and hosted, so local plugin QA pointed at it could route tools differently from production. In Codex, an agent building a page asked the user for a Mapbox token instead of calling `list_public_tokens_tool`.
Expand Down
Loading
Loading