fix: carry weather and fire freshness into tool answers

get_weather dropped the proxy's stale status and get_active_fires dropped
FIRMS staleness and failed satellite sources, so answers and the HUD caption
read them as current. Both now report them, and the caption context marks
such sections stale or degraded.
This commit is contained in:
Sameh Khamis committed 2026-10-02 15:21:36 -07:00
1 parent dd8ba562d2
commit 56f0d2e203
4 files changed
+80 -6

No files matched your search

+16 -1
View File
@@ -78,9 +78,24 @@ export const getActiveFires = defineTool({
.filter((fire) => areaContains(area, fire))
.sort((a, b) => (b.frp ?? 0) - (a.frp ?? 0));
const result = capRows(fires, args.limit);
// The proxy serves its last good snapshot when a refresh fails, and marks
// satellites whose download failed.
const stale = snapshot.stale === true;
const missing = (snapshot.sources || [])
.filter((source) => source?.ok === false)
.map((source) => source.source);
const notes = [
...(stale ? ['data may be stale'] : []),
...(missing.length ? [`no data from ${missing.join(', ')}`] : []),
];
return {
summary: `${countNoun(fires.length, 'fire detection')} in ${area.label} in the last 24 hours.`,
summary:
`${countNoun(fires.length, 'fire detection')} in ${area.label} in the last 24 hours` +
(notes.length ? ` (${notes.join('; ')}).` : '.'),
data: {
stale,
missing_sources: missing,
fetched_at: isoTime(snapshot.fetchedAt),
...result,
rows: result.rows.map((fire) => ({
lat: fire.lat,