imprint-mcp 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +6 -4
  2. package/examples/discoverandgo/README.md +1 -1
  3. package/examples/discoverandgo/book_discoverandgo_museum_pass/workflow.json +7 -0
  4. package/examples/google-flights/README.md +41 -14
  5. package/examples/google-flights/_shared/google_batchexecute_parser.ts +165 -0
  6. package/examples/google-flights/_shared/google_flights_transport.ts +70 -0
  7. package/examples/google-flights/_shared/google_flights_types.ts +56 -0
  8. package/examples/google-flights/get_flight_booking_options/backends.json +43 -0
  9. package/examples/google-flights/get_flight_booking_options/index.ts +129 -0
  10. package/examples/google-flights/get_flight_booking_options/parser.ts +209 -0
  11. package/examples/google-flights/get_flight_booking_options/playbook.yaml +46 -0
  12. package/examples/google-flights/get_flight_booking_options/request-transform.ts +210 -0
  13. package/examples/google-flights/get_flight_booking_options/workflow.json +85 -0
  14. package/examples/google-flights/get_flight_calendar_prices/backends.json +27 -0
  15. package/examples/google-flights/get_flight_calendar_prices/index.ts +44 -29
  16. package/examples/google-flights/get_flight_calendar_prices/parser.ts +76 -69
  17. package/examples/google-flights/get_flight_calendar_prices/playbook.yaml +67 -40
  18. package/examples/google-flights/get_flight_calendar_prices/workflow.json +29 -17
  19. package/examples/google-flights/get_flight_location_details/backends.json +27 -0
  20. package/examples/google-flights/{lookup_airport → get_flight_location_details}/index.ts +30 -20
  21. package/examples/google-flights/get_flight_location_details/parser.ts +103 -0
  22. package/examples/google-flights/get_flight_location_details/playbook.yaml +59 -0
  23. package/examples/google-flights/{lookup_airport → get_flight_location_details}/workflow.json +19 -12
  24. package/examples/google-flights/lookup_flight_locations/backends.json +27 -0
  25. package/examples/google-flights/lookup_flight_locations/index.ts +111 -0
  26. package/examples/google-flights/lookup_flight_locations/package.json +9 -0
  27. package/examples/google-flights/lookup_flight_locations/parser.ts +135 -0
  28. package/examples/google-flights/lookup_flight_locations/playbook.yaml +47 -0
  29. package/examples/google-flights/lookup_flight_locations/request-transform.ts +53 -0
  30. package/examples/google-flights/lookup_flight_locations/workflow.json +64 -0
  31. package/examples/google-flights/search_flights/backends.json +42 -0
  32. package/examples/google-flights/search_flights/index.ts +105 -69
  33. package/examples/google-flights/search_flights/parser.ts +186 -183
  34. package/examples/google-flights/search_flights/playbook.yaml +295 -88
  35. package/examples/google-flights/search_flights/request-transform.ts +247 -92
  36. package/examples/google-flights/search_flights/workflow.json +66 -40
  37. package/examples/google-flights/validate_flight_itinerary/backends.json +27 -0
  38. package/examples/google-flights/validate_flight_itinerary/index.ts +103 -0
  39. package/examples/google-flights/validate_flight_itinerary/package.json +9 -0
  40. package/examples/google-flights/validate_flight_itinerary/parser.ts +101 -0
  41. package/examples/google-flights/validate_flight_itinerary/playbook.yaml +84 -0
  42. package/examples/google-flights/validate_flight_itinerary/request-transform.ts +92 -0
  43. package/examples/google-flights/validate_flight_itinerary/workflow.json +59 -0
  44. package/examples/google-hotels/README.md +40 -15
  45. package/examples/google-hotels/get_hotel_details/backends.json +16 -0
  46. package/examples/google-hotels/get_hotel_details/index.ts +122 -0
  47. package/examples/google-hotels/get_hotel_details/parser.ts +275 -0
  48. package/examples/google-hotels/get_hotel_details/playbook.yaml +40 -0
  49. package/examples/google-hotels/get_hotel_details/request-transform.ts +67 -0
  50. package/examples/google-hotels/get_hotel_details/workflow.json +67 -0
  51. package/examples/google-hotels/get_hotel_photos/backends.json +16 -0
  52. package/examples/google-hotels/get_hotel_photos/index.ts +90 -0
  53. package/examples/google-hotels/get_hotel_photos/parser.ts +75 -0
  54. package/examples/google-hotels/get_hotel_photos/playbook.yaml +23 -0
  55. package/examples/google-hotels/get_hotel_photos/request-transform.ts +27 -0
  56. package/examples/google-hotels/get_hotel_photos/workflow.json +44 -0
  57. package/examples/google-hotels/get_hotel_reviews/backends.json +16 -0
  58. package/examples/google-hotels/get_hotel_reviews/index.ts +14 -17
  59. package/examples/google-hotels/get_hotel_reviews/parser.ts +177 -105
  60. package/examples/google-hotels/get_hotel_reviews/playbook.yaml +9 -54
  61. package/examples/google-hotels/get_hotel_reviews/workflow.json +10 -13
  62. package/examples/google-hotels/get_travel_area_boundaries/backends.json +16 -0
  63. package/examples/google-hotels/get_travel_area_boundaries/index.ts +104 -0
  64. package/examples/google-hotels/get_travel_area_boundaries/package.json +9 -0
  65. package/examples/google-hotels/get_travel_area_boundaries/parser.ts +127 -0
  66. package/examples/google-hotels/get_travel_area_boundaries/playbook.yaml +38 -0
  67. package/examples/google-hotels/get_travel_area_boundaries/request-transform.ts +52 -0
  68. package/examples/google-hotels/get_travel_area_boundaries/workflow.json +54 -0
  69. package/examples/google-hotels/list_hotel_booking_options/backends.json +16 -0
  70. package/examples/google-hotels/list_hotel_booking_options/index.ts +123 -0
  71. package/examples/google-hotels/list_hotel_booking_options/package.json +9 -0
  72. package/examples/google-hotels/list_hotel_booking_options/parser.ts +308 -0
  73. package/examples/google-hotels/list_hotel_booking_options/playbook.yaml +95 -0
  74. package/examples/google-hotels/list_hotel_booking_options/request-transform.ts +77 -0
  75. package/examples/google-hotels/list_hotel_booking_options/workflow.json +67 -0
  76. package/examples/google-hotels/search_hotel_web_links/backends.json +16 -0
  77. package/examples/google-hotels/search_hotel_web_links/index.ts +90 -0
  78. package/examples/google-hotels/search_hotel_web_links/package.json +9 -0
  79. package/examples/google-hotels/search_hotel_web_links/parser.ts +96 -0
  80. package/examples/google-hotels/search_hotel_web_links/playbook.yaml +53 -0
  81. package/examples/google-hotels/search_hotel_web_links/request-transform.ts +17 -0
  82. package/examples/google-hotels/search_hotel_web_links/workflow.json +43 -0
  83. package/examples/google-hotels/search_hotels/backends.json +16 -0
  84. package/examples/google-hotels/search_hotels/index.ts +32 -102
  85. package/examples/google-hotels/search_hotels/parser.ts +237 -216
  86. package/examples/google-hotels/search_hotels/playbook.yaml +177 -42
  87. package/examples/google-hotels/search_hotels/request-transform.ts +101 -170
  88. package/examples/google-hotels/search_hotels/workflow.json +24 -73
  89. package/examples/google-hotels/suggest_hotel_destinations/backends.json +16 -0
  90. package/examples/google-hotels/{autocomplete_hotel_location → suggest_hotel_destinations}/index.ts +30 -19
  91. package/examples/google-hotels/suggest_hotel_destinations/package.json +9 -0
  92. package/examples/google-hotels/suggest_hotel_destinations/parser.ts +138 -0
  93. package/examples/google-hotels/suggest_hotel_destinations/playbook.yaml +47 -0
  94. package/examples/google-hotels/suggest_hotel_destinations/request-transform.ts +33 -0
  95. package/examples/google-hotels/suggest_hotel_destinations/workflow.json +44 -0
  96. package/examples/southwest/README.md +31 -70
  97. package/examples/southwest/get_account_details/backends.json +22 -0
  98. package/examples/southwest/get_account_details/credentials.manifest.json +17 -0
  99. package/examples/southwest/get_account_details/index.ts +138 -0
  100. package/examples/{google-hotels/_shared → southwest/get_account_details}/package.json +2 -2
  101. package/examples/southwest/get_account_details/parser.ts +136 -0
  102. package/examples/southwest/get_account_details/playbook.yaml +19 -0
  103. package/examples/southwest/get_account_details/workflow.json +93 -0
  104. package/examples/southwest/get_flight_status/backends.json +21 -0
  105. package/examples/southwest/get_flight_status/index.ts +130 -0
  106. package/examples/southwest/get_flight_status/package.json +9 -0
  107. package/examples/southwest/get_flight_status/parser.ts +138 -0
  108. package/examples/southwest/get_flight_status/playbook.yaml +58 -0
  109. package/examples/southwest/get_flight_status/workflow.json +77 -0
  110. package/examples/southwest/get_low_fare_calendar/backends.json +21 -0
  111. package/examples/southwest/get_low_fare_calendar/index.ts +134 -0
  112. package/examples/southwest/get_low_fare_calendar/package.json +9 -0
  113. package/examples/southwest/get_low_fare_calendar/parser.ts +107 -0
  114. package/examples/southwest/get_low_fare_calendar/playbook.yaml +41 -0
  115. package/examples/southwest/get_low_fare_calendar/workflow.json +81 -0
  116. package/examples/southwest/list_upcoming_trips/backends.json +22 -0
  117. package/examples/southwest/list_upcoming_trips/credentials.manifest.json +17 -0
  118. package/examples/southwest/list_upcoming_trips/index.ts +123 -0
  119. package/examples/southwest/list_upcoming_trips/package.json +9 -0
  120. package/examples/southwest/list_upcoming_trips/parser.ts +160 -0
  121. package/examples/southwest/list_upcoming_trips/playbook.yaml +24 -0
  122. package/examples/southwest/list_upcoming_trips/workflow.json +78 -0
  123. package/examples/southwest/search_flights/backends.json +21 -0
  124. package/examples/southwest/search_flights/index.ts +150 -0
  125. package/examples/southwest/search_flights/package.json +9 -0
  126. package/examples/southwest/search_flights/parser.ts +214 -0
  127. package/examples/southwest/search_flights/playbook.yaml +52 -0
  128. package/examples/southwest/search_flights/workflow.json +88 -0
  129. package/package.json +1 -1
  130. package/prompts/audit-agent.md +2 -1
  131. package/prompts/build-planning.md +22 -1
  132. package/prompts/compile-agent.md +66 -53
  133. package/prompts/prereq-builder.md +3 -1
  134. package/prompts/tool-planning.md +2 -0
  135. package/src/cli.ts +8 -3
  136. package/src/imprint/audit.ts +337 -44
  137. package/src/imprint/backend-cache.ts +114 -0
  138. package/src/imprint/backend-ladder.ts +74 -24
  139. package/src/imprint/bot-defense.ts +12 -0
  140. package/src/imprint/build-plan.ts +346 -53
  141. package/src/imprint/cdp-browser-fetch.ts +96 -43
  142. package/src/imprint/cdp-jar-cache.ts +6 -5
  143. package/src/imprint/chromium.ts +34 -0
  144. package/src/imprint/codex-cli-compile.ts +13 -2
  145. package/src/imprint/compile-agent.ts +3 -1
  146. package/src/imprint/compile-tools.ts +715 -138
  147. package/src/imprint/compile.ts +41 -9
  148. package/src/imprint/concurrency.ts +26 -3
  149. package/src/imprint/cron.ts +0 -3
  150. package/src/imprint/endpoint-key.ts +23 -0
  151. package/src/imprint/llm-url.ts +69 -0
  152. package/src/imprint/llm.ts +366 -47
  153. package/src/imprint/login.ts +83 -75
  154. package/src/imprint/mcp-compile-server.ts +4 -1
  155. package/src/imprint/mcp-server.ts +51 -16
  156. package/src/imprint/param-grounding.ts +61 -52
  157. package/src/imprint/probe-backends.ts +21 -115
  158. package/src/imprint/redact.ts +17 -15
  159. package/src/imprint/request-capture.ts +94 -0
  160. package/src/imprint/runtime.ts +1 -78
  161. package/src/imprint/session-diff.ts +14 -1
  162. package/src/imprint/stealth-fetch.ts +30 -20
  163. package/src/imprint/stealth-token-cache.ts +2 -2
  164. package/src/imprint/teach-plan.ts +2 -0
  165. package/src/imprint/teach-state.ts +14 -9
  166. package/src/imprint/teach.ts +41 -7
  167. package/src/imprint/telemetry.ts +3 -0
  168. package/src/imprint/tool-candidates.ts +8 -7
  169. package/src/imprint/tool-plan.ts +29 -3
  170. package/src/imprint/tracing.ts +18 -2
  171. package/examples/google-flights/_shared/batchexecute.ts +0 -63
  172. package/examples/google-flights/_shared/flights_request.ts +0 -97
  173. package/examples/google-flights/get_flight_booking_details/index.ts +0 -159
  174. package/examples/google-flights/get_flight_booking_details/parser.ts +0 -182
  175. package/examples/google-flights/get_flight_booking_details/playbook.yaml +0 -138
  176. package/examples/google-flights/get_flight_booking_details/request-transform.ts +0 -86
  177. package/examples/google-flights/get_flight_booking_details/workflow.json +0 -98
  178. package/examples/google-flights/get_flight_calendar_prices/request-transform.ts +0 -31
  179. package/examples/google-flights/lookup_airport/parser.ts +0 -66
  180. package/examples/google-flights/lookup_airport/playbook.yaml +0 -47
  181. package/examples/google-flights/lookup_airport/request-transform.ts +0 -20
  182. package/examples/google-hotels/_shared/batchexecute.ts +0 -73
  183. package/examples/google-hotels/_shared/freq.ts +0 -158
  184. package/examples/google-hotels/autocomplete_hotel_location/parser.ts +0 -71
  185. package/examples/google-hotels/autocomplete_hotel_location/playbook.yaml +0 -36
  186. package/examples/google-hotels/autocomplete_hotel_location/request-transform.ts +0 -37
  187. package/examples/google-hotels/autocomplete_hotel_location/workflow.json +0 -36
  188. package/examples/google-hotels/get_hotel_booking_options/index.ts +0 -143
  189. package/examples/google-hotels/get_hotel_booking_options/parser.ts +0 -271
  190. package/examples/google-hotels/get_hotel_booking_options/playbook.yaml +0 -154
  191. package/examples/google-hotels/get_hotel_booking_options/request-transform.ts +0 -154
  192. package/examples/google-hotels/get_hotel_booking_options/workflow.json +0 -84
  193. package/examples/google-hotels/get_hotel_reviews/request-transform.ts +0 -42
  194. package/examples/southwest/search_southwest_flights/backends.json +0 -23
  195. package/examples/southwest/search_southwest_flights/cron.json +0 -19
  196. package/examples/southwest/search_southwest_flights/index.ts +0 -127
  197. package/examples/southwest/search_southwest_flights/playbook.yaml +0 -46
  198. package/examples/southwest/search_southwest_flights/workflow.json +0 -71
  199. /package/examples/google-flights/{get_flight_booking_details → get_flight_booking_options}/package.json +0 -0
  200. /package/examples/google-flights/{lookup_airport → get_flight_location_details}/package.json +0 -0
  201. /package/examples/google-hotels/{autocomplete_hotel_location → get_hotel_details}/package.json +0 -0
  202. /package/examples/google-hotels/{get_hotel_booking_options → get_hotel_photos}/package.json +0 -0
@@ -1,184 +1,391 @@
1
1
  toolName: search_flights
2
- summary: "Search Google Flights for itineraries between two airports on given dates and trip type, returning the GetShoppingResults batchexecute payload."
2
+ summary: Search Google Flights for flight options by trip type, route, dates, passengers, and optional filters.
3
3
  parameters:
4
+ - name: trip_type
5
+ type: string
6
+ description: Ticket type such as round_trip, one_way, or multi_city.
7
+ default: round_trip
4
8
  - name: origin
5
9
  type: string
6
- description: "Origin airport/city code, e.g. SJC"
10
+ description: Origin airport code, city code, or place identifier for one-way and round-trip searches.
7
11
  - name: destination
8
12
  type: string
9
- description: "Destination airport/city code, e.g. SAN"
13
+ description: Destination airport code, city code, or place identifier for one-way and round-trip searches.
10
14
  - name: departure_date
11
15
  type: string
12
- description: "Outbound date in YYYY-MM-DD"
16
+ description: Departure date in YYYY-MM-DD format.
13
17
  - name: return_date
14
18
  type: string
15
- description: "Return date in YYYY-MM-DD (omit/ignore for one-way)"
16
- - name: trip_type
19
+ description: Return date in YYYY-MM-DD format for round-trip searches.
20
+ - name: itinerary
17
21
  type: string
18
- description: "Visible ticket-type label to select: 'Round trip', 'One way', or 'Multi-city' (workflow encodes 1/2/3)"
19
- - name: max_stops
22
+ description: For multi-city searches, ordered legs as origin, destination, and date entries.
23
+ - name: adults
20
24
  type: number
21
- description: "Max stops filter: 0 nonstop, 1, 2, or 3 any (best-effort via filter bar)"
25
+ description: Number of adult passengers.
26
+ default: 1
27
+ - name: stops
28
+ type: string
29
+ description: Stops filter, such as any, nonstop_only, one_stop_or_fewer, or two_stops_or_fewer.
30
+ default: any
22
31
  - name: airlines
23
32
  type: string
24
- description: "Alliance (Oneworld/SkyTeam/Star Alliance) or carrier name to include (best-effort via filter bar)"
33
+ description: Comma-separated airline or alliance codes to include, such as AS, AA, WN, ONEWORLD, SKYTEAM, or STAR_ALLIANCE.
34
+ - name: bags
35
+ type: number
36
+ description: Number of bags to include in fare filtering.
37
+ default: 0
25
38
  - name: max_price
26
39
  type: number
27
- description: "Maximum total price in USD (best-effort via filter bar)"
28
- - name: outbound_times
40
+ description: Maximum fare price in USD.
41
+ - name: outbound_time_range
29
42
  type: string
30
- description: "Outbound departure/arrival time window in hours (best-effort via filter bar)"
31
- - name: return_times
43
+ description: Outbound departure or arrival time constraints encoded as start and end hours.
44
+ - name: return_time_range
32
45
  type: string
33
- description: "Return departure/arrival time window in hours (best-effort via filter bar)"
34
- - name: max_duration
46
+ description: Return departure or arrival time constraints encoded as start and end hours.
47
+ - name: max_duration_minutes
35
48
  type: number
36
- description: "Maximum total trip duration in minutes (best-effort via filter bar)"
37
- - name: carry_on_bags
38
- type: number
39
- description: "Number of carry-on bags to filter/price by (best-effort via filter bar)"
49
+ description: Maximum flight duration in minutes.
40
50
  steps:
41
51
  - action: navigate
42
52
  url: https://www.google.com/travel/flights
43
53
  wait_for: networkidle
44
54
  - action: click
45
55
  locators:
56
+ - by: role
57
+ value: button
58
+ name: Round trip
46
59
  - by: aria_label
47
- value: "Where from?"
60
+ value: Select your ticket type.
61
+ - by: text
62
+ value: Round trip
48
63
  - by: css
49
- value: 'div.cQnuXe.k0gFV input.II2One.j0Ppje'
64
+ value: "div.TQYpgc.gInvKb div.VfPpkd-aPP78e"
65
+ wait_for:
66
+ sleep_ms: 300
67
+ - action: click
68
+ locators:
69
+ - by: role
70
+ value: option
71
+ name: "${trip_type}"
72
+ - by: text
73
+ value_pattern: "${trip_type}"
74
+ - by: css
75
+ value: "ul[aria-label='Select your ticket type.'] li"
76
+ wait_for:
77
+ sleep_ms: 500
78
+ - action: click
79
+ locators:
80
+ - by: role
81
+ value: textbox
82
+ name: Where from?
83
+ - by: aria_label
84
+ value_pattern: Where from
85
+ - by: text
86
+ value_pattern: Where from
87
+ - by: css
88
+ value: "input[aria-label*='Where from']"
50
89
  wait_for:
51
90
  sleep_ms: 300
52
91
  - action: type
53
92
  locators:
93
+ - by: role
94
+ value: textbox
95
+ name: Where else?
54
96
  - by: aria_label
55
- value_pattern: "Where (from\\?|else\\?)"
97
+ value_pattern: Where else
98
+ - by: aria_label
99
+ value_pattern: Where from
56
100
  - by: css
57
- value: 'div.cQnuXe.k0gFV input.II2One.j0Ppje'
58
- value: ${origin}
101
+ value: "input[aria-label*='Where']"
102
+ value: "${origin}"
59
103
  wait_for:
60
104
  sleep_ms: 500
61
105
  - action: click
62
106
  locators:
107
+ - by: role
108
+ value: option
109
+ name: "${origin}"
63
110
  - by: aria_label
64
- value_pattern: ${origin}
111
+ value_pattern: "${origin}"
65
112
  - by: text
66
- value_pattern: ${origin}
113
+ value_pattern: "${origin}"
114
+ - by: css
115
+ value: "ul.DFGgtd li"
67
116
  wait_for: visible
68
117
  - action: click
69
118
  locators:
119
+ - by: role
120
+ value: textbox
121
+ name: Where to?
70
122
  - by: aria_label
71
- value: "Where to? "
123
+ value_pattern: Where to
124
+ - by: text
125
+ value_pattern: Where to
72
126
  - by: css
73
- value: 'div.wUiEcc.SOcuWe input.II2One.j0Ppje'
127
+ value: "input[aria-label*='Where to']"
74
128
  wait_for:
75
129
  sleep_ms: 300
76
130
  - action: type
77
131
  locators:
132
+ - by: role
133
+ value: textbox
134
+ name: Where to?
78
135
  - by: aria_label
79
- value_pattern: "Where (to\\? ?|else\\?)"
136
+ value_pattern: Where to
137
+ - by: aria_label
138
+ value_pattern: Where else
80
139
  - by: css
81
- value: 'div.wUiEcc.SOcuWe input.II2One.j0Ppje'
82
- value: ${destination}
140
+ value: "input[aria-label*='Where']"
141
+ value: "${destination}"
83
142
  wait_for:
84
143
  sleep_ms: 500
85
144
  - action: click
86
145
  locators:
146
+ - by: role
147
+ value: option
148
+ name: "${destination}"
87
149
  - by: aria_label
88
- value_pattern: ${destination}
150
+ value_pattern: "${destination}"
89
151
  - by: text
90
- value_pattern: ${destination}
152
+ value_pattern: "${destination}"
153
+ - by: css
154
+ value: "ul.DFGgtd li"
91
155
  wait_for: visible
92
156
  - action: click
93
157
  locators:
158
+ - by: role
159
+ value: textbox
160
+ name: Departure
161
+ - by: aria_label
162
+ value: Departure
163
+ - by: text
164
+ value: Departure
165
+ - by: css
166
+ value: "input[aria-label='Departure']"
167
+ wait_for:
168
+ xhr: GetCalendarPicker
169
+ - action: type
170
+ locators:
171
+ - by: role
172
+ value: textbox
173
+ name: Departure
94
174
  - by: aria_label
95
- value: "Select your ticket type."
175
+ value: Departure
96
176
  - by: css
97
- value: 'div.TQYpgc.gInvKb div.VfPpkd-aPP78e'
177
+ value: "input[aria-label='Departure']"
178
+ value: "${departure_date}"
179
+ wait_for:
180
+ sleep_ms: 300
181
+ - action: type
182
+ locators:
183
+ - by: role
184
+ value: textbox
185
+ name: Return
186
+ - by: aria_label
187
+ value: Return
188
+ - by: css
189
+ value: "input[aria-label='Return']"
190
+ value: "${return_date}"
98
191
  wait_for:
99
192
  sleep_ms: 300
100
193
  - action: click
101
194
  locators:
102
195
  - by: role
103
- value: option
104
- name: ${trip_type}
196
+ value: button
197
+ name: Done
105
198
  - by: text
106
- value_pattern: ${trip_type}
107
- wait_for: visible
199
+ value: Done
200
+ - by: css
201
+ value: "button span.VfPpkd-vQzf8d"
202
+ wait_for:
203
+ sleep_ms: 500
204
+ - action: click
205
+ locators:
206
+ - by: role
207
+ value: button
208
+ name: Search
209
+ - by: text
210
+ value: Search
211
+ - by: css
212
+ value: "button span.VfPpkd-vQzf8d"
213
+ wait_for:
214
+ xhr: GetShoppingResults
108
215
  - action: click
109
216
  locators:
217
+ - by: role
218
+ value: button
219
+ name: Stops
220
+ - by: text
221
+ value: Stops
110
222
  - by: aria_label
111
- value: "Departure"
223
+ value_pattern: Stops
112
224
  - by: css
113
- value: 'div.GYgkab.YICvqf input.TP4Lpb.eoY5cb'
225
+ value: "button:has-text('Stops')"
114
226
  wait_for:
115
227
  sleep_ms: 300
116
- - action: type
228
+ - action: click
229
+ locators:
230
+ - by: role
231
+ value: radio
232
+ name: "${stops}"
233
+ - by: text
234
+ value_pattern: "${stops}"
235
+ - by: css
236
+ value: "input[name='itEVCd']"
237
+ wait_for:
238
+ xhr: GetShoppingResults
239
+ - action: click
240
+ locators:
241
+ - by: role
242
+ value: button
243
+ name: Airlines
244
+ - by: text
245
+ value: Airlines
246
+ - by: aria_label
247
+ value_pattern: Airlines
248
+ - by: css
249
+ value: "button:has-text('Airlines')"
250
+ wait_for:
251
+ sleep_ms: 300
252
+ - action: click
253
+ locators:
254
+ - by: role
255
+ value: checkbox
256
+ name: "${airlines}"
257
+ - by: text
258
+ value_pattern: "${airlines}"
259
+ - by: aria_label
260
+ value_pattern: "${airlines}"
261
+ - by: css
262
+ value: "input[type='checkbox']"
263
+ wait_for:
264
+ xhr: GetShoppingResults
265
+ - action: click
266
+ locators:
267
+ - by: role
268
+ value: button
269
+ name: Bags
270
+ - by: text
271
+ value: Bags
272
+ - by: aria_label
273
+ value_pattern: Bags
274
+ - by: css
275
+ value: "button:has-text('Bags')"
276
+ wait_for:
277
+ sleep_ms: 300
278
+ - action: click
279
+ locators:
280
+ - by: role
281
+ value: button
282
+ name: Add bag
283
+ - by: aria_label
284
+ value_pattern: Add
285
+ - by: text
286
+ value_pattern: Add
287
+ - by: css
288
+ value: "button[aria-label*='Add']"
289
+ wait_for:
290
+ xhr: GetShoppingResults
291
+ - action: click
117
292
  locators:
293
+ - by: role
294
+ value: button
295
+ name: Price
296
+ - by: text
297
+ value: Price
118
298
  - by: aria_label
119
- value: "Departure"
299
+ value_pattern: Price
120
300
  - by: css
121
- value: 'div.GYgkab.YICvqf input.TP4Lpb.eoY5cb'
122
- value: ${departure_date}
301
+ value: "button:has-text('Price')"
123
302
  wait_for:
124
- sleep_ms: 400
303
+ sleep_ms: 300
125
304
  - action: type
126
305
  locators:
306
+ - by: role
307
+ value: slider
308
+ name: Price
127
309
  - by: aria_label
128
- value: "Return"
129
- value: ${return_date}
310
+ value_pattern: Price
311
+ - by: text
312
+ value_pattern: "$"
313
+ - by: css
314
+ value: "div.GegIwe div.Cs7q4e"
315
+ value: "${max_price}"
130
316
  wait_for:
131
- sleep_ms: 400
317
+ xhr: GetShoppingResults
132
318
  - action: click
133
319
  locators:
320
+ - by: role
321
+ value: button
322
+ name: Times
134
323
  - by: text
135
- value: Done
324
+ value: Times
136
325
  - by: aria_label
137
- value_pattern: "Done"
326
+ value_pattern: Times
327
+ - by: css
328
+ value: "button:has-text('Times')"
138
329
  wait_for:
139
330
  sleep_ms: 300
331
+ - action: type
332
+ locators:
333
+ - by: role
334
+ value: slider
335
+ name: Outbound
336
+ - by: aria_label
337
+ value_pattern: Outbound
338
+ - by: text
339
+ value_pattern: Departure
340
+ - by: css
341
+ value: "div.PlyoXe div.Cs7q4e"
342
+ value: "${outbound_time_range}"
343
+ wait_for:
344
+ xhr: GetShoppingResults
345
+ - action: type
346
+ locators:
347
+ - by: role
348
+ value: slider
349
+ name: Return
350
+ - by: aria_label
351
+ value_pattern: Return
352
+ - by: text
353
+ value: Return
354
+ - by: css
355
+ value: "button#id_1"
356
+ value: "${return_time_range}"
357
+ wait_for:
358
+ xhr: GetShoppingResults
140
359
  - action: click
141
360
  locators:
142
361
  - by: role
143
362
  value: button
144
- name: Search
363
+ name: Duration
145
364
  - by: text
146
- value: Search
365
+ value: Duration
147
366
  - by: aria_label
148
- value_pattern: "Search"
367
+ value_pattern: Duration
368
+ - by: css
369
+ value: "button:has-text('Duration')"
370
+ wait_for:
371
+ sleep_ms: 300
372
+ - action: type
373
+ locators:
374
+ - by: role
375
+ value: slider
376
+ name: Duration
377
+ - by: aria_label
378
+ value_pattern: Duration
379
+ - by: text
380
+ value_pattern: Under
381
+ - by: css
382
+ value: "div.uKklMc div.Cs7q4e"
383
+ value: "${max_duration_minutes}"
149
384
  wait_for:
150
- xhr: /FlightsFrontendService/GetShoppingResults
385
+ xhr: GetShoppingResults
151
386
  result:
152
387
  source: xhr
153
- url_pattern: /FlightsFrontendService/GetShoppingResults
154
- extract: "2"
155
- return_as: itineraries
156
- notes: >
157
- Google Flights is a batchexecute RPC app. The result-bearing XHR is
158
- GetShoppingResults (POST to /_/FlightsFrontendUi/data/travel.frontend.flights.FlightsFrontendService/GetShoppingResults);
159
- the largest/last GetShoppingResults response after the Search click carries the
160
- full itinerary set. The response is NOT plain JSON: it is prefixed with )]}' and
161
- chunked into length-prefixed lines. The parser must strip the )]}' prefix, split
162
- on the numeric length markers, JSON.parse each line to find the ["wrb.fr",null,"<json-string>"]
163
- envelope, then JSON.parse the index-2 element (the double-encoded payload). Flight
164
- itineraries live in deeply nested positional arrays inside that payload — each
165
- itinerary exposes carrier code+name, flight number, origin/destination codes,
166
- [hour,minute] depart/arrive, duration minutes, stops, layover info, and price in
167
- USD (the integer like 88008 = $880.08 scaled, or the [[null,337],...] cents-ish
168
- marker). The extract path "2" denotes the wrb.fr payload slot and requires the
169
- custom decoding above — a plain dot-path cannot traverse the stringified inner JSON.
170
- DOM-locator caveats: this site uses auto-generated class names (e.g. VfPpkd-*,
171
- II2One) and react-style ids (#c7293, #c115604) that change every deploy and per
172
- session — prefer the aria_label/text/role locators; the css fallbacks are brittle.
173
- The origin/destination editable field re-labels itself to "Where else?" while
174
- focused, hence the regex aria_label patterns.
175
- trip_type must be passed as the visible label ("Round trip" / "One way" /
176
- "Multi-city"), not the 1/2/3 encoding used by the API workflow.
177
- For one-way searches the "Return" type step is a no-op/absent — skip or expect it
178
- to be ignored. Multi-city requires per-leg origin/destination entry not captured
179
- as discrete linear steps here.
180
- Filter parameters (max_stops, airlines, max_price, outbound_times, return_times,
181
- max_duration, carry_on_bags) are applied via the chip filter bar (Stops/Airlines/
182
- Bags/Price/Times/Duration buttons) which open popovers with obfuscated controls;
183
- they are best applied through the API workflow rather than DOM steps. They are
184
- listed here only to keep params 1:1 with workflow.json for cron/MCP fallback.
388
+ url_pattern: GetShoppingResults
389
+ extract: "0.0.2"
390
+ return_as: flight_results
391
+ notes: "Google Flights returns batchexecute payloads with an anti-XSSI prefix and nested JSON strings. Strip the prefix, parse the outer batchexecute records, then parse the wrb.fr payload at extract path 0.0.2 to obtain the shopping results array containing leg groups, fares, prices, booking or selection tokens, airlines, times, durations, stops, and emissions. For multi_city searches, expand itinerary into repeated leg origin, destination, and date interactions before clicking Search."