feat: return the view that shows each answer

Tool answers with something to show now include data.view: the view with
the matching layers on, the area framed from above or a single aircraft or
satellite followed, and the link that opens it. Area framing moves to
src/tools/views.js so links and answers frame alike.
This commit is contained in:
Sameh Khamis committed 2026-10-02 15:21:36 -07:00
1 parent 96a8a9addb
commit d6473b6049
20 files changed
+393 -34

No files matched your search

+4
View File
@@ -1,5 +1,6 @@
/** Bike-share and public transit queries. */
import { suggestView } from '../views.js';
import {
parseStationInformation,
parseStationStatus,
@@ -134,6 +135,7 @@ export const getBikeShare = defineTool({
`${countNoun(bikes, 'bike')} available` +
(notes.length ? ` (${notes.join('; ')}).` : '.'),
data: {
view: suggestView(services, { area, layers: ['bikeshare'] }),
...capRows(rows, args.limit),
systems: systems.map((system) => system.city),
systems_not_searched: skipped.map((system) => system.city),
@@ -275,6 +277,7 @@ export const getTransitVehicles = defineTool({
`${countNoun(rows.length, 'transit vehicle')}${what} in ${area.label}` +
(notes.length ? ` (${notes.join('; ')}).` : '.'),
data: {
view: suggestView(services, { area, layers: ['transit'] }),
...capRows(rows, args.limit),
stale: staleFeeds > 0,
expired_positions_dropped: expired,
@@ -472,6 +475,7 @@ export const getTrafficFlow = defineTool({
? ' Some map tiles did not load, so these figures are partial.'
: ''),
data: {
view: suggestView(services, { area, layers: ['traffic'] }),
area: area.label,
partial: flow.partial,
speed_pct_of_free_flow: speedPct,