trips/mock
Greg Pomerantz f03e7b5dbc mock: robust booking-doc extraction + documents persist across turns
An 118 KB HTML flight confirmation exposed two problems:

1. Extraction — the old <[^>]+> tag-strip broke on a ">" inside a quoted
   attribute (inline SVG data-URIs are common in mail markup) and the
   text was silently cut at 20 000 chars, so the model saw a mangled,
   truncated document ("it was truncated"). /parse-doc now uses a
   quote-aware state-machine extractor (skips comments / MSO conditional
   comments / style / script / head blocks; block tags → newlines; table
   cells → " | "; single-pass entity decode), decodes .eml / MIME mail
   (base64 + quoted-printable, html part preferred, one level of nested
   multipart), collapses 10×+ repeated boilerplate lines, and caps at
   60 000 chars with an explicit `truncated` flag (server logs it too).
   File limit raised to 16 MB; Outlook .msg gets a clear "forward as
   HTML" error. A 130 KB bloated fixture now extracts to 901 clean chars
   with all flight details intact.

2. Memory — uploaded documents now stay attached to the trip: persisted
   in tripStore with the plan, shown as chips in the chat, and included
   in the model's context on EVERY turn, so follow-up questions
   ("what's my confirmation code?") are answered without a re-upload and
   documents survive reloads. 📎 now works for any reference doc (flight
   bookings still trigger the re-anchor flow; the model asks to confirm
   when the booked dates don't match the plan).

Also: askLLM refuses to start a second agent loop while one is in
flight — a question typed during a long tool loop used to fork a
parallel loop that corrupted the first.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-09 14:16:36 -04:00
..
scripts multi-trip mock + Colombia trip with a real walking router 2026-09-09 09:44:29 -04:00
app.js mock: robust booking-doc extraction + documents persist across turns 2026-09-09 14:16:36 -04:00
data.js multi-trip mock + Colombia trip with a real walking router 2026-09-09 09:44:29 -04:00
index.html mock: robust booking-doc extraction + documents persist across turns 2026-09-09 14:16:36 -04:00
server.js mock: robust booking-doc extraction + documents persist across turns 2026-09-09 14:16:36 -04:00
styles.css mock: robust booking-doc extraction + documents persist across turns 2026-09-09 14:16:36 -04:00