Fix arrival/return transfer legs + plan restore + router guards

Transfers (airport<->hotel) were the app's weakest surface; this fixes the
long-standing cluster of bugs in one pass:

- saneRoute(): reject OSRM results implausible for the straight-line distance
  (extract coverage holes once produced a 9h 'route' for a 5km taxi hop);
  applied at every routePts call site
- healTransfers() on load: re-sync transfer endpoints against current hotel +
  AIRPORTS table, re-sync stays[] against the day-base hotel objects (the
  saved stays[] carried pre-coord-fix locations, and dayBase() resolves the
  hotel FROM stays — every return leg was routed to the stale hotel), drop
  implausible or endpoint-drifted stored routes so they re-route cleanly,
  default a missing mode to car, and recover arrLandingMin from the booked
  flight time
- the last-stop->hotel ride is now a first-class editable leg (retLeg): the
  rail row opens the route card with drag + walk/taxi toggle, exactly like
  stop-to-stop legs; previously auto-routed returns seed it
- startMin now actually tracks landing + drop-off (syncArrivalStart had a
  null arrLandingMin guard that silently froze the day's start)
- applySavedPlan re-points day: days becomes a new object tree on restore,
  and the current-day reference stayed on the stale base-plan day — the rail
  rendered the base plan instead of the saved one until a day-tab click
- setDay enriches the opened day (idempotent), so a day opened from a saved
  plan gets its legs (incl. the return leg) routed instead of sitting on
  straight-line estimates

Also in this change set: correct LLM model name, keyword-router removal (chat
goes to the LLM), screenshot_map + relocate_stop tools for the UI LLM,
server-side plan store with localStorage migration, thinking toggle +
keep-alive warm-up, three-state LLM guard with proactive model load,
spatial /near /nearest /corridor SQL fixes, and the full data.js
coordinate correction for the Colombia demo.
This commit is contained in:
gmp
2026-09-10 22:46:07 -04:00
parent df5fed691b
commit 1ba39f7333
6 changed files with 533 additions and 120 deletions
+1
View File
@@ -122,6 +122,7 @@
<input id="doc-file" type="file" accept=".pdf,.txt,.ics,.html,.htm,.eml,.csv,.json" hidden />
<button class="btn small" id="doc-attach" title="Attach a booking or confirmation (PDF, HTML email, .eml, text) — flight bookings reconfigure the trip, and everything stays attached for reference">📎</button>
<input id="chat-input" type="text" placeholder="Ask, direct — or drop a booking…" />
<button class="btn small think-toggle on" id="think-toggle" title="LLM thinking: on = deliberate (slower, better planning) · off = quick answers (faster)">💭 on</button>
<button class="btn primary small" id="chat-send">→</button>
</div>
</aside>