# AGENTS.md — travel/ (':travel') > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `travel/` + allowed shared modules. Do not root-scan. _Install: ./install travel (dev by default)._ - Gradle: :travel / dir: travel/ - Package roots present: ui, data, domain, network, platform - Entry files: MainActivity.kt, Route.kt, Navigation.kt - Package roots present: ui, data, network, intents, domain, platform - Entry files: MainActivity.kt (no Route.kt — search/results/booking/manage flow with pages) - Deps: :library:room, :library:network, :library:image, Stripe Android SDK (payment sheet) - Metadata: metadata_data/travel.md (present) - Rust: no / screenshotTest: yes ### Relay server note (backend, outside this repo) `travel` does not use the relay directly, but `NetworkClient.init(FIRST_PARTY)` covers `api.maproj.org`. Server checkout: `../location_share_server` (sibling of this repo root, `C:\Users\Vayun\Documents\code\location_share_server`). Full details: root `AGENTS.md` → "Backend server (outside this repo)". ## Overview **Purpose:** Flight + hotel booking — search/comparison, seat maps, ancillaries/offers, trip management with in-app card payment; trips persist on-device so plans stay readable offline. **Key features:** - Flight search form (one-way / round-trip) → results → offer review → passengers → trip → ancillaries → payment sheet → confirm → confirmation; cancel/manage on booked trips (online changes are not offered — server sends `canChange=false`) - Round-trip step-by-step (grouped on-device); stays search → detail → guests → payment sheet → confirm → confirmation; seat-map picker - `data/` Room (trips, local booking profiles, frequent-flyer, recent searches) + `domain/` on-device grouping/status + `network/` trip/stays DTOs + APIs **Architecture / data-flow:** `ui/` search/results/booking pages → `platform/TravelViewModel` (+ `TravelUiContract`/`TravelUiState`, per-area `Travel*Ops`) → `domain/` grouping + `data/TravelRepository` over Room + `network/TravelApi`/`StaysApi`; booked trips stay readable from Room when offline. Every `*Page` is a thin binder over a stateless `*Screen` (state + `*Actions` from `platform/TravelUiContract.kt`), which is what `src/screenshotTest` renders. **Entry points + reading order:** `MainActivity.kt` → `Navigation.kt` → `ui/HomePage.kt` → `ui/HomeScreen.kt` → `ui/FlightSearchForm.kt` → `platform/TravelViewModel.kt` → `platform/TravelSearchOps.kt` → `network/TravelApi.kt`. - OpenAssistant read via `intents/GetTripsIntent` (`travel_get_trips`): stored trips as summaries only (name, dates, status, destination count), provider-capped at 10, behind the signature `ACCESS_TRAVEL` permission; no traveller, reference or cost data crosses **Architecture / data-flow:** `ui/` search/results/booking pages → `util/TravelViewModel` (+ `TravelUiContract`/`TravelUiState`, per-area `Travel*Ops`) → `domain/` grouping + `data/TravelRepository` over Room + `network/TravelApi`/`StaysApi`; booked trips stay readable from Room when offline. **Entry points + reading order:** `MainActivity.kt` → `ui/HomePage.kt` → `ui/FlightSearchForm.kt` → `util/TravelViewModel.kt` → `util/TravelSearchOps.kt` → `network/TravelApi.kt`. **Gotchas:** - Dialogs are routes: `Route.DatePickerDialog`/`DateRangeDialog`/`PassengerPickerDialog` (`DialogPage()` entries in `Navigation.kt`, stateless contents in `ui/dialogs/`, results via the nav result registry under the caller's key). `DateField`/`DateRangeFields`/`PassengerField` push them; never gate a picker on `remember` show-state - Booking is money-moving — price/availability must be re-confirmed server-side before payment, never trusted from cached offers - Offline readability is a feature (stored trips), offline booking is not — gate write paths on connectivity - Payment: `POST /trips/:id/checkout` returns a payment-intent `clientSecret` + `publishableKey` (the provider's processor account, per environment); present it with `platform/StripeCheckout.kt`, then `POST /trips/:id/confirm` books it. Never book before the sheet reports Completed ## Key files ### Root — entry + navigation - com/vayunmathur/travel/MainActivity.kt - com/vayunmathur/travel/Navigation.kt - com/vayunmathur/travel/Route.kt ### data/ — Room trips + profiles - com/vayunmathur/travel/data/TravelDatabase.kt - com/vayunmathur/travel/data/TravelRepository.kt - com/vayunmathur/travel/data/BookedTrip.kt - com/vayunmathur/travel/data/Customer.kt - com/vayunmathur/travel/data/FrequentFlyer.kt - com/vayunmathur/travel/data/RecentSearch.kt ### domain/ — on-device offer + trip logic - com/vayunmathur/travel/domain/OfferGrouping.kt - com/vayunmathur/travel/domain/TripStatus.kt ### intents/ — assistant IPC - com/vayunmathur/travel/intents/GetTripsIntent.kt — `travel_get_trips` over `TravelRepository.getAllBookedTrips` - com/vayunmathur/travel/intents/TripSummaries.kt — validated window/limit (max 10), summary mapping + destination count ### platform/ — in-app card payment (Stripe payment sheet) - com/vayunmathur/travel/platform/StripeCheckout.kt ### network/ — airline + stays APIs - com/vayunmathur/travel/network/TravelApi.kt - com/vayunmathur/travel/network/OfferDto.kt - com/vayunmathur/travel/network/OrderDto.kt - com/vayunmathur/travel/network/ManageDto.kt - com/vayunmathur/travel/network/AirlineDto.kt - com/vayunmathur/travel/network/AncillaryDto.kt - com/vayunmathur/travel/network/PlaceDto.kt - com/vayunmathur/travel/network/StaysApi.kt - com/vayunmathur/travel/network/StaysDto.kt ### platform/ — ViewModel + booking ops - com/vayunmathur/travel/platform/TravelViewModel.kt - com/vayunmathur/travel/platform/TravelUiContract.kt - com/vayunmathur/travel/platform/TravelUiState.kt - com/vayunmathur/travel/platform/TravelSearchOps.kt - com/vayunmathur/travel/platform/TravelBookingOps.kt - com/vayunmathur/travel/platform/TravelOrderOps.kt - com/vayunmathur/travel/platform/TravelCustomerOps.kt - com/vayunmathur/travel/platform/TravelStayOps.kt - com/vayunmathur/travel/platform/ContactAutofill.kt - com/vayunmathur/travel/platform/StripeCheckout.kt - com/vayunmathur/travel/platform/AppBackupAgent.kt — platform backup: `SqlCipherDbCodec` export/re-encrypt of `travel-db` (`travelDbConfigs` in `data/TravelDatabase.kt`) + `datastore_default`; raw DB/`secure_prefs` excluded in `res/xml/data_extraction_rules.xml` ### ui/ — search, results, booking, trips, stays - com/vayunmathur/travel/ui/HomePage.kt - com/vayunmathur/travel/ui/FlightSearchForm.kt - com/vayunmathur/travel/ui/FlightResultsPage.kt - com/vayunmathur/travel/ui/OfferReviewPage.kt - com/vayunmathur/travel/ui/PartialOffersPages.kt - com/vayunmathur/travel/ui/PassengersPage.kt - com/vayunmathur/travel/ui/PassengersFields.kt - com/vayunmathur/travel/ui/PaymentPage.kt - com/vayunmathur/travel/ui/SeatMapPage.kt - com/vayunmathur/travel/ui/AncillariesPage.kt - com/vayunmathur/travel/ui/ConfirmationPage.kt - com/vayunmathur/travel/ui/OrderDetailPage.kt - com/vayunmathur/travel/ui/ChangePage.kt - com/vayunmathur/travel/ui/CancellationPage.kt - com/vayunmathur/travel/ui/TripsPage.kt - com/vayunmathur/travel/ui/StaySearchForm.kt - com/vayunmathur/travel/ui/StayResultsScreen.kt - com/vayunmathur/travel/ui/StayDetailPage.kt - com/vayunmathur/travel/ui/StayGuestsPage.kt - com/vayunmathur/travel/ui/StayConfirmationPage.kt - com/vayunmathur/travel/ui/StaysPages.kt - com/vayunmathur/travel/ui/StayLabels.kt - com/vayunmathur/travel/ui/SettingsPage.kt - com/vayunmathur/travel/ui/Common.kt - com/vayunmathur/travel/ui/TravelFormat.kt - Stateless `*Screen` slices beside their `*Page` binders: HomeScreen, OfferReviewScreen, OutboundSelectScreen, FareSelectScreen, AncillariesScreen, PassengersScreen, PaymentScreen, ConfirmationScreen, CancellationScreen, ChangeScreen, StayDetailScreen, StayGuestsScreen, StayConfirmationScreen, TripsScreen, SettingsScreen (plus FlightResultsScreen, SeatMapScreen, OrderDetailScreen, StayResultsScreen) - com/vayunmathur/travel/ui/dialogs/DatePickerDialogContent.kt - com/vayunmathur/travel/ui/dialogs/DateRangeDialogContent.kt - com/vayunmathur/travel/ui/dialogs/PassengerPickerDialogContent.kt - screenshotTest `ui/MetadataPreviews.kt` — one deterministic capture per `Route` leaf (`1-flights-home` … `20-settings`, `21-date-picker-dialog`, `22-date-range-dialog`, `23-passenger-picker-dialog`, `24-flight-results-expanded`) ## Verify (this module only) ``` ./gradlew :travel:compileDevKotlin ./gradlew :travel:lint ./gradlew :travel:checkMetadata ```