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

+19 -1
View File
@@ -3,6 +3,7 @@
* terrain height, mapped military sites and map features.
*/
import { suggestView } from '../views.js';
import { defineTool, ToolError } from '../catalog.js';
import {
AREA_SCHEMA,
@@ -221,6 +222,16 @@ export const getCyclones = defineTool({
? `; strongest ${storms[0].name} at ${storms[0].wind_kt} kt.`
: '.'),
data: {
view: suggestView(
services,
area
? { area, layers: ['weather-cyclones'] }
: {
point: { lat: 20, lon: 0 },
altitudeM: 15_000_000,
layers: ['weather-cyclones'],
},
),
storms,
coverage: snapshot.coverage ?? null,
source: snapshot.source ?? null,
@@ -269,7 +280,10 @@ export const getFirePerimeters = defineTool({
.sort((a, b) => (b.acres ?? 0) - (a.acres ?? 0));
return {
summary: `${countNoun(rows.length, 'mapped wildfire perimeter')} in ${area.label}.`,
data: capRows(rows, args.limit),
data: {
view: suggestView(services, { area, layers: ['fire-perimeters'] }),
...capRows(rows, args.limit),
},
};
},
});
@@ -436,6 +450,10 @@ export const findMilitaryInstallations = defineTool({
`${countNoun(rows.length, 'mapped military installation')} in ${area.label}` +
(notes.length ? ` (${notes.join('; ')}).` : '.'),
data: {
view: suggestView(services, {
area,
layers: ['military-installations'],
}),
...capRows(rows, args.limit),
complete,
names_pending: namesPending,