mercury-agent 0.4.5

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 (218) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +438 -0
  3. package/container/Dockerfile +127 -0
  4. package/container/Dockerfile.base +109 -0
  5. package/container/Dockerfile.power +17 -0
  6. package/container/agent-package.json +8 -0
  7. package/container/build.sh +54 -0
  8. package/docs/TODOS.md +147 -0
  9. package/docs/auth/dashboard.md +28 -0
  10. package/docs/auth/overview.md +109 -0
  11. package/docs/auth/whatsapp.md +173 -0
  12. package/docs/configuration.md +54 -0
  13. package/docs/container-lifecycle.md +349 -0
  14. package/docs/context-architecture.md +87 -0
  15. package/docs/deployment.md +199 -0
  16. package/docs/extensions.md +375 -0
  17. package/docs/graceful-shutdown.md +62 -0
  18. package/docs/kb-distillation.md +77 -0
  19. package/docs/media/overview.md +140 -0
  20. package/docs/media/whatsapp.md +171 -0
  21. package/docs/memory.md +137 -0
  22. package/docs/permissions.md +217 -0
  23. package/docs/pipeline.md +228 -0
  24. package/docs/prd-chat-memory.md +76 -0
  25. package/docs/prd-config-load.md +82 -0
  26. package/docs/rate-limiting.md +166 -0
  27. package/docs/scheduler.md +288 -0
  28. package/docs/setup-discord.md +100 -0
  29. package/docs/setup-slack.md +119 -0
  30. package/docs/setup-whatsapp.md +94 -0
  31. package/docs/subagents.md +166 -0
  32. package/docs/web-search.md +62 -0
  33. package/examples/extensions/README.md +12 -0
  34. package/examples/extensions/charts/index.ts +13 -0
  35. package/examples/extensions/charts/skill/SKILL.md +98 -0
  36. package/examples/extensions/gws/README.md +52 -0
  37. package/examples/extensions/gws/index.ts +106 -0
  38. package/examples/extensions/gws/skill/SKILL.md +57 -0
  39. package/examples/extensions/gws/skill/references/calendar.md +101 -0
  40. package/examples/extensions/gws/skill/references/docs.md +65 -0
  41. package/examples/extensions/gws/skill/references/drive.md +79 -0
  42. package/examples/extensions/gws/skill/references/gmail.md +85 -0
  43. package/examples/extensions/gws/skill/references/sheets.md +60 -0
  44. package/examples/extensions/napkin/index.ts +821 -0
  45. package/examples/extensions/napkin/prompts/consolidation-monthly.md +73 -0
  46. package/examples/extensions/napkin/prompts/consolidation-weekly.md +67 -0
  47. package/examples/extensions/napkin/prompts/kb-distillation.md +176 -0
  48. package/examples/extensions/napkin/skill/SKILL.md +728 -0
  49. package/examples/extensions/pdf/index.ts +23 -0
  50. package/examples/extensions/pdf/skill/LICENSE.txt +30 -0
  51. package/examples/extensions/pdf/skill/SKILL.md +314 -0
  52. package/examples/extensions/pdf/skill/forms.md +294 -0
  53. package/examples/extensions/pdf/skill/reference.md +612 -0
  54. package/examples/extensions/pdf/skill/scripts/check_bounding_boxes.py +65 -0
  55. package/examples/extensions/pdf/skill/scripts/check_fillable_fields.py +11 -0
  56. package/examples/extensions/pdf/skill/scripts/convert_pdf_to_images.py +33 -0
  57. package/examples/extensions/pdf/skill/scripts/create_validation_image.py +37 -0
  58. package/examples/extensions/pdf/skill/scripts/extract_form_field_info.py +122 -0
  59. package/examples/extensions/pdf/skill/scripts/extract_form_structure.py +115 -0
  60. package/examples/extensions/pdf/skill/scripts/fill_fillable_fields.py +98 -0
  61. package/examples/extensions/pdf/skill/scripts/fill_pdf_form_with_annotations.py +107 -0
  62. package/examples/extensions/permission-guard/index.ts +65 -0
  63. package/examples/extensions/pinchtab/index.ts +199 -0
  64. package/examples/extensions/pinchtab/lib/session-injector.ts +144 -0
  65. package/examples/extensions/pinchtab/skill/SKILL.md +224 -0
  66. package/examples/extensions/pinchtab/skill/TRUST.md +69 -0
  67. package/examples/extensions/pinchtab/skill/references/api.md +297 -0
  68. package/examples/extensions/pinchtab/skill/references/env.md +45 -0
  69. package/examples/extensions/pinchtab/skill/references/profiles.md +107 -0
  70. package/examples/extensions/tradestation/host/refresh.ts +102 -0
  71. package/examples/extensions/tradestation/index.ts +153 -0
  72. package/examples/extensions/tradestation/skill/SKILL.md +67 -0
  73. package/examples/extensions/tradestation/skill/scripts/ts-cli.ts +111 -0
  74. package/examples/extensions/voice-synth/index.ts +94 -0
  75. package/examples/extensions/voice-synth/skill/SKILL.md +38 -0
  76. package/examples/extensions/voice-transcribe/index.ts +381 -0
  77. package/examples/extensions/voice-transcribe/requirements.txt +8 -0
  78. package/examples/extensions/voice-transcribe/scripts/transcribe.py +179 -0
  79. package/examples/extensions/voice-transcribe/skill/SKILL.md +53 -0
  80. package/examples/extensions/web-search/index.ts +22 -0
  81. package/examples/extensions/web-search/skill/SKILL.md +114 -0
  82. package/examples/extensions/web-search/skill/references/apartments.md +178 -0
  83. package/examples/extensions/web-search/skill/references/car-purchase.md +132 -0
  84. package/examples/extensions/web-search/skill/references/car-rental.md +113 -0
  85. package/examples/extensions/web-search/skill/references/flights.md +133 -0
  86. package/examples/extensions/web-search/skill/references/hotels.md +148 -0
  87. package/examples/extensions/yahoo-mail/cli/bun.lock +66 -0
  88. package/examples/extensions/yahoo-mail/cli/package.json +13 -0
  89. package/examples/extensions/yahoo-mail/cli/ymail.mjs +353 -0
  90. package/examples/extensions/yahoo-mail/index.ts +57 -0
  91. package/examples/extensions/yahoo-mail/skill/SKILL.md +78 -0
  92. package/package.json +106 -0
  93. package/resources/agents/explore.md +50 -0
  94. package/resources/agents/worker.md +24 -0
  95. package/resources/builtin-extensions.txt +3 -0
  96. package/resources/connection-env-vars.json +25 -0
  97. package/resources/extensions/.gitkeep +0 -0
  98. package/resources/pi-extensions/subagent/agents.ts +126 -0
  99. package/resources/pi-extensions/subagent/index.ts +964 -0
  100. package/resources/profiles/coding/AGENTS.md +43 -0
  101. package/resources/profiles/coding/mercury-profile.yaml +15 -0
  102. package/resources/profiles/general/AGENTS.md +31 -0
  103. package/resources/profiles/general/mercury-profile.yaml +15 -0
  104. package/resources/profiles/research/AGENTS.md +40 -0
  105. package/resources/profiles/research/mercury-profile.yaml +15 -0
  106. package/resources/skills/config/SKILL.md +25 -0
  107. package/resources/skills/context/SKILL.md +33 -0
  108. package/resources/skills/conversation-recap/SKILL.md +19 -0
  109. package/resources/skills/media/SKILL.md +27 -0
  110. package/resources/skills/mutes/SKILL.md +31 -0
  111. package/resources/skills/permissions/SKILL.md +19 -0
  112. package/resources/skills/preferences/SKILL.md +31 -0
  113. package/resources/skills/recall/SKILL.md +24 -0
  114. package/resources/skills/roles/SKILL.md +18 -0
  115. package/resources/skills/spaces/SKILL.md +18 -0
  116. package/resources/skills/tasks/SKILL.md +45 -0
  117. package/resources/templates/AGENTS.md +157 -0
  118. package/resources/templates/env.template +34 -0
  119. package/resources/templates/mercury.example.yaml +75 -0
  120. package/src/adapters/discord-native.ts +534 -0
  121. package/src/adapters/discord.ts +38 -0
  122. package/src/adapters/setup.ts +89 -0
  123. package/src/adapters/slack.ts +9 -0
  124. package/src/adapters/whatsapp-media.ts +337 -0
  125. package/src/adapters/whatsapp.ts +629 -0
  126. package/src/agent/api-socket.ts +127 -0
  127. package/src/agent/container-entry.ts +967 -0
  128. package/src/agent/container-error.ts +49 -0
  129. package/src/agent/container-runner.ts +1272 -0
  130. package/src/agent/model-capabilities-core.ts +23 -0
  131. package/src/agent/model-capabilities.ts +231 -0
  132. package/src/agent/pi-failure-class.ts +83 -0
  133. package/src/agent/pi-jsonl-parser.ts +306 -0
  134. package/src/agent/preferences-prompt.ts +20 -0
  135. package/src/agent/user-error-messages.ts +78 -0
  136. package/src/bridges/discord.ts +171 -0
  137. package/src/bridges/slack.ts +177 -0
  138. package/src/bridges/teams.ts +160 -0
  139. package/src/bridges/telegram.ts +571 -0
  140. package/src/bridges/whatsapp.ts +290 -0
  141. package/src/chat-shim.ts +259 -0
  142. package/src/cli/mercury.ts +2508 -0
  143. package/src/cli/mrctl-http.ts +27 -0
  144. package/src/cli/mrctl.ts +611 -0
  145. package/src/cli/whatsapp-auth.ts +260 -0
  146. package/src/config-file.ts +397 -0
  147. package/src/config-model-chain.ts +30 -0
  148. package/src/config.ts +316 -0
  149. package/src/core/api-types.ts +58 -0
  150. package/src/core/api.ts +105 -0
  151. package/src/core/commands.ts +76 -0
  152. package/src/core/conversation.ts +47 -0
  153. package/src/core/handler.ts +206 -0
  154. package/src/core/media.ts +200 -0
  155. package/src/core/mute-duration.ts +22 -0
  156. package/src/core/outbox.ts +76 -0
  157. package/src/core/permissions.ts +192 -0
  158. package/src/core/profiles.ts +245 -0
  159. package/src/core/rate-limiter.ts +127 -0
  160. package/src/core/router.ts +191 -0
  161. package/src/core/routes/chat.ts +172 -0
  162. package/src/core/routes/config-builtin.ts +107 -0
  163. package/src/core/routes/config.ts +81 -0
  164. package/src/core/routes/connections.ts +190 -0
  165. package/src/core/routes/console.ts +668 -0
  166. package/src/core/routes/control.ts +46 -0
  167. package/src/core/routes/conversations.ts +66 -0
  168. package/src/core/routes/dashboard.ts +2491 -0
  169. package/src/core/routes/extensions.ts +37 -0
  170. package/src/core/routes/index.ts +14 -0
  171. package/src/core/routes/media.ts +72 -0
  172. package/src/core/routes/messages.ts +37 -0
  173. package/src/core/routes/mutes.ts +89 -0
  174. package/src/core/routes/prefs.ts +95 -0
  175. package/src/core/routes/roles.ts +125 -0
  176. package/src/core/routes/spaces.ts +60 -0
  177. package/src/core/routes/storage.ts +126 -0
  178. package/src/core/routes/tasks.ts +189 -0
  179. package/src/core/routes/tradestation.ts +268 -0
  180. package/src/core/routes/tts.ts +51 -0
  181. package/src/core/runtime.ts +1140 -0
  182. package/src/core/space-queue.ts +103 -0
  183. package/src/core/storage-cleanup.ts +140 -0
  184. package/src/core/storage-guard.ts +24 -0
  185. package/src/core/task-scheduler.ts +132 -0
  186. package/src/core/telegram-format.ts +178 -0
  187. package/src/core/trigger.ts +142 -0
  188. package/src/dashboard/index.html +729 -0
  189. package/src/dashboard/tokens.css +53 -0
  190. package/src/extensions/api.ts +252 -0
  191. package/src/extensions/catalog.ts +117 -0
  192. package/src/extensions/config-registry.ts +83 -0
  193. package/src/extensions/context.ts +36 -0
  194. package/src/extensions/hooks.ts +156 -0
  195. package/src/extensions/image-builder.ts +617 -0
  196. package/src/extensions/installer.ts +306 -0
  197. package/src/extensions/jobs.ts +122 -0
  198. package/src/extensions/loader.ts +271 -0
  199. package/src/extensions/permission-guard.ts +52 -0
  200. package/src/extensions/reserved.ts +28 -0
  201. package/src/extensions/skills.ts +123 -0
  202. package/src/extensions/types.ts +462 -0
  203. package/src/logger.ts +174 -0
  204. package/src/main.ts +586 -0
  205. package/src/server.ts +391 -0
  206. package/src/storage/db.ts +1624 -0
  207. package/src/storage/memory.ts +45 -0
  208. package/src/storage/pi-auth.ts +95 -0
  209. package/src/text/markdown.ts +117 -0
  210. package/src/text/rtl.ts +38 -0
  211. package/src/tradestation/host-api.ts +77 -0
  212. package/src/tradestation/pending-orders.ts +69 -0
  213. package/src/tts/azure.ts +52 -0
  214. package/src/tts/google.ts +128 -0
  215. package/src/tts/index.ts +8 -0
  216. package/src/tts/language.ts +20 -0
  217. package/src/tts/synthesize.ts +133 -0
  218. package/src/types.ts +295 -0
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: web-search
3
+ description: Search public websites for real-world things — flights, hotels, car rentals, cars for purchase, and apartments/rentals. No credentials needed. Trigger when the user asks to find, compare, or book flights, accommodation, rental cars, used/new cars, or apartments. Uses headless browser automation (pinchtab) to navigate live sites and return real results.
4
+ ---
5
+
6
+ # Web Search
7
+
8
+ Search public websites for travel, accommodation, vehicles, and real estate using the headless browser (pinchtab). No API keys or credentials required.
9
+
10
+ ## Prerequisite
11
+
12
+ Before any search, ensure the browser is running:
13
+
14
+ ```bash
15
+ pinchtab_ensure || exit 1
16
+ ```
17
+
18
+ `pinchtab_ensure` is defined and injected by the pinchtab extension. If it is not already defined in your shell session, refer to the pinchtab skill for the full definition.
19
+
20
+ ## Dispatch Table
21
+
22
+ Identify the search category from the user's intent, then read the corresponding reference file before proceeding.
23
+
24
+ | User intent keywords | Category | Reference file |
25
+ |---|---|---|
26
+ | flight, fly, airline, plane ticket | Flights | `references/flights.md` |
27
+ | hotel, hostel, stay, accommodation, resort, inn | Hotels | `references/hotels.md` |
28
+ | rent a car, car hire, rental car, hire car | Car rental | `references/car-rental.md` |
29
+ | buy a car, used car, new car, car for sale | Car purchase | `references/car-purchase.md` |
30
+ | apartment, flat, rent apartment, house for rent/sale, real estate | Apartments | `references/apartments.md` |
31
+
32
+ **Always read the reference file for the matched category before navigating.** It contains the site selection rationale, exact URL format, and step-by-step workflow.
33
+
34
+ ## Parameter Collection
35
+
36
+ Do not navigate to any site until you have all required parameters. Ask the user for anything missing.
37
+
38
+ ### Flights (required: origin, destination, departure date)
39
+ - Origin airport or city
40
+ - Destination airport or city
41
+ - Departure date
42
+ - Return date (ask if not given — confirm one-way only if explicitly stated)
43
+ - Passengers: number of adults; children with ages (ages affect pricing); infants
44
+ - Cabin class: economy / premium economy / business / first (default: economy)
45
+ - Nonstop only? (default: show all; apply filter if requested)
46
+ - Sort by: cheapest / fastest / best (default: cheapest)
47
+
48
+ ### Hotels (required: city, check-in date, check-out date)
49
+ - City or area
50
+ - Check-in and check-out dates
51
+ - Number of adults and children (with ages if children)
52
+ - Number of rooms (default: 1)
53
+ - Star rating or price range (optional)
54
+ - Sort by: lowest price / rating / distance (default: lowest price)
55
+
56
+ ### Car rental (required: pickup location, pickup date, dropoff date)
57
+ - Pickup location (city name or airport IATA code)
58
+ - Pickup date and time
59
+ - Dropoff date and time
60
+ - Same location dropoff? (if not, ask for dropoff location)
61
+ - Driver age (under-25 surcharges vary by provider)
62
+ - Car category preference: economy / compact / SUV / etc. (optional)
63
+
64
+ ### Car purchase (required: make/model or open search, location/country)
65
+ - Make and/or model (or open description e.g. "any SUV")
66
+ - New or used
67
+ - Maximum price or price range
68
+ - Location / country (determines which site to use)
69
+ - Maximum mileage (for used cars)
70
+ - Year range (optional)
71
+
72
+ ### Apartments (required: city, rent or buy, short-term or long-term)
73
+ - City or neighbourhood
74
+ - Rent or buy
75
+ - Short-term (nightly, like Airbnb) or long-term (monthly lease)?
76
+ - Price range (per night or per month)
77
+ - Number of bedrooms
78
+ - Move-in / available-from date
79
+
80
+ ## Output Format
81
+
82
+ Present results as a numbered list. Limit to top 5–10 unless the user requests more.
83
+
84
+ ```
85
+ 1. [Airline / Hotel name / Car type / Listing title]
86
+ Price: [amount + currency]
87
+ Details: [duration + stops, or rating + location, or mileage + year, etc.]
88
+ Dates: [if applicable]
89
+ Link: [URL if visible in the page]
90
+
91
+ 2. ...
92
+ ```
93
+
94
+ Always state the site used and the search parameters at the top of the reply so the user can verify.
95
+
96
+ ## Error Handling
97
+
98
+ - **CAPTCHA or bot block**: note it, try the fallback site listed in the reference file.
99
+ - **Empty results**: try relaxing one constraint (e.g. remove nonstop-only filter, expand dates ±1 day, widen price range). Inform the user what was relaxed.
100
+ - **Page timeout / snapshot failure**: retry once with an additional `sleep 5` before the snapshot. If it fails again, report the error and the last output.
101
+ - **Consent banner blocking content**: find the dismiss/accept button ref via `pinchtab snap -i -c` and click it, then re-navigate.
102
+ - **Max cycles**: do not loop more than 3 interaction cycles on a single page without reporting progress to the user.
103
+
104
+ ## Token Efficiency
105
+
106
+ Match the pinchtab command to the task:
107
+
108
+ | Task | Command | ~Tokens |
109
+ |---|---|---|
110
+ | Read result prices/names | `pinchtab text` | ~800 |
111
+ | Find filter controls to click | `pinchtab snap -i -c` | ~3,600 |
112
+ | Full page understanding | `pinchtab snap` | ~10,500 |
113
+
114
+ Always start with `pinchtab text`. Only escalate to `snap -i -c` when you need to interact with a filter or button. Never use full `snap` for this skill.
@@ -0,0 +1,178 @@
1
+ # Apartments Reference
2
+
3
+ ## Branch: Short-Term vs Long-Term
4
+
5
+ **Always confirm before navigating:**
6
+ - **Short-term** = nightly rental (Airbnb-style, days/weeks, travel or vacation)
7
+ - **Long-term** = monthly lease or purchase (living, relocation)
8
+
9
+ ---
10
+
11
+ ## Short-Term: Airbnb (primary)
12
+
13
+ **Why**: Best accessibility tree for short-term rentals, reliable URL deep-linking, no consent banners.
14
+
15
+ ### URL Construction
16
+
17
+ ```
18
+ https://www.airbnb.com/s/{CITY}/homes?checkin={CHECKIN}&checkout={CHECKOUT}&adults={ADULTS}&children={CHILDREN}&min_bedrooms={BEDROOMS}&price_max={NIGHTLY_MAX}
19
+ ```
20
+
21
+ | Placeholder | Format | Example |
22
+ |---|---|---|
23
+ | `{CITY}` | URL-encoded city | `Bangkok`, `Tel+Aviv` |
24
+ | `{CHECKIN}` | YYYY-MM-DD | `2026-11-01` |
25
+ | `{CHECKOUT}` | YYYY-MM-DD | `2026-11-22` |
26
+ | `{ADULTS}` | integer | `2` |
27
+ | `{CHILDREN}` | integer | `2` |
28
+ | `{BEDROOMS}` | integer | `2` |
29
+ | `{NIGHTLY_MAX}` | integer (USD) | `150` |
30
+
31
+ **Worked example — Bangkok, Nov 1–22, 2 adults + 2 children, 2+ bedrooms:**
32
+ ```
33
+ https://www.airbnb.com/s/Bangkok/homes?checkin=2026-11-01&checkout=2026-11-22&adults=2&children=2&min_bedrooms=2
34
+ ```
35
+
36
+ ### Workflow
37
+
38
+ ```bash
39
+ pinchtab_ensure || exit 1
40
+ pinchtab nav "https://www.airbnb.com/s/Bangkok/homes?checkin=2026-11-01&checkout=2026-11-22&adults=2&children=2&min_bedrooms=2"
41
+ sleep 5 # Airbnb is React-heavy — needs longer render time
42
+ pinchtab text
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Short-Term Fallback: Booking.com Apartments
48
+
49
+ Use when Airbnb results are sparse or user prefers hotel-apartment hybrids.
50
+
51
+ ```
52
+ https://www.booking.com/searchresults.html?ss={CITY}&checkin={CHECKIN}&checkout={CHECKOUT}&group_adults={ADULTS}&group_children={CHILDREN}&age={AGE1}&age={AGE2}&nflt=ht_id%3D201%3Bht_id%3D220
53
+ ```
54
+ (`ht_id=201` = apartments; `ht_id=220` = holiday homes — include both)
55
+
56
+ ```bash
57
+ pinchtab nav "https://www.booking.com/searchresults.html?ss=Bangkok&checkin=2026-11-01&checkout=2026-11-22&group_adults=2&group_children=2&age=7&age=3&nflt=ht_id%3D201%3Bht_id%3D220"
58
+ sleep 4
59
+ pinchtab text
60
+ ```
61
+
62
+ **Known issue — consent banner**: If `pinchtab text` shows no results, run `pinchtab snap -i -c`, find the "Accept" button ref, click it, wait 2s, then re-navigate.
63
+
64
+ ---
65
+
66
+ ## Long-Term: Site Selection by Region
67
+
68
+ | Region | Rent | Buy |
69
+ |---|---|---|
70
+ | Israel | Yad2 | Yad2 |
71
+ | UK | Rightmove | Rightmove |
72
+ | Spain / Italy / Portugal | Idealista | Idealista |
73
+ | France | SeLoger | SeLoger |
74
+ | USA | Zillow | Zillow |
75
+ | Germany | ImmoScout24 | ImmoScout24 |
76
+ | International | Airbnb (monthly) | — |
77
+
78
+ ---
79
+
80
+ ## Yad2 — Long-Term (Israel)
81
+
82
+ ```
83
+ https://www.yad2.co.il/realestate/rent?city={CITY_ID}&rooms={MIN_ROOMS}-{MAX_ROOMS}&price={MIN}-{MAX}
84
+ ```
85
+
86
+ For open search in Tel Aviv:
87
+ ```
88
+ https://www.yad2.co.il/realestate/rent?topArea=2&area=1
89
+ ```
90
+ (topArea=2, area=1 = Tel Aviv district)
91
+
92
+ ```bash
93
+ pinchtab nav "https://www.yad2.co.il/realestate/rent?topArea=2&area=1"
94
+ sleep 4
95
+ pinchtab text
96
+ ```
97
+
98
+ **Note**: Results are in Hebrew. Extract prices (numbers with ₪), room counts, and neighbourhood names.
99
+
100
+ ---
101
+
102
+ ## Rightmove — Long-Term (UK)
103
+
104
+ ```
105
+ https://www.rightmove.co.uk/property-to-rent/find.html?searchType=RENT&locationIdentifier=REGION%5E{ID}&maxPrice={MAX}&minBedrooms={BEDS}
106
+ ```
107
+
108
+ For a city-level search without a region ID, use the simpler form:
109
+ ```
110
+ https://www.rightmove.co.uk/property-to-rent/find.html?searchType=RENT&searchLocation={CITY}&maxPrice={MAX_PCM}&minBedrooms={BEDS}
111
+ ```
112
+
113
+ ```bash
114
+ pinchtab nav "https://www.rightmove.co.uk/property-to-rent/find.html?searchType=RENT&searchLocation=London&maxPrice=2000&minBedrooms=2"
115
+ sleep 4
116
+ pinchtab text
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Zillow — Long-Term (USA)
122
+
123
+ ```
124
+ https://www.zillow.com/homes/for_rent/{CITY}/?searchQueryState={"pagination":{},"mapBounds":{},"filterState":{"price":{"max":{MAX}},"beds":{"min":{BEDS}}}}
125
+ ```
126
+
127
+ Simpler URL (Zillow also accepts natural-language city in the path):
128
+ ```
129
+ https://www.zillow.com/homes/for_rent/New-York,-NY/
130
+ ```
131
+
132
+ ```bash
133
+ pinchtab nav "https://www.zillow.com/homes/for_rent/New-York,-NY/"
134
+ sleep 5 # Zillow is JS-heavy
135
+ pinchtab text
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Idealista — Long-Term (Spain, Italy, Portugal)
141
+
142
+ ```
143
+ https://www.idealista.com/en/alquiler-viviendas/{CITY_SLUG}-{PROVINCE}/con-{ROOMS}-habitaciones,precio-hasta-{MAX}/
144
+ ```
145
+
146
+ **Known issue**: Idealista occasionally shows an anti-bot challenge on first load. If `pinchtab text` shows a Cloudflare page:
147
+ 1. Wait 10 seconds: `sleep 10`
148
+ 2. Retry `pinchtab text`
149
+ 3. If still blocked, try Airbnb monthly as fallback
150
+
151
+ ---
152
+
153
+ ## Airbnb Monthly (International Long-Term Fallback)
154
+
155
+ Airbnb supports monthly stays with discounted rates. Use as a universal long-term fallback:
156
+
157
+ ```
158
+ https://www.airbnb.com/s/{CITY}/homes?checkin={START}&checkout={END}&adults={ADULTS}&children={CHILDREN}&min_bedrooms={BEDS}&monthly_length=1
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Result Extraction
164
+
165
+ From `pinchtab text`, extract per listing:
166
+ - Property description (studio, 1BR, 2BR, house, etc.)
167
+ - Price (per night for short-term; per month for long-term; or asking price for purchase)
168
+ - Location / neighbourhood
169
+ - Key amenities if visible (pool, parking, A/C)
170
+ - Link or listing ID if visible
171
+
172
+ ---
173
+
174
+ ## Token Efficiency
175
+
176
+ - `pinchtab text` is sufficient to read listing summaries.
177
+ - Use `pinchtab snap -i -c` only for interacting with price/bedroom filters.
178
+ - Airbnb and Booking load slower than Google products — always use `sleep 5` minimum.
@@ -0,0 +1,132 @@
1
+ # Car Purchase Reference
2
+
3
+ ## Site Selection by Region
4
+
5
+ The right site depends on the user's location. **Always ask or infer the country before navigating.**
6
+
7
+ | Region | Primary site | Fallback |
8
+ |---|---|---|
9
+ | Europe (excl. UK) | AutoScout24 | Mobile.de (Germany), LeBonCoin (France) |
10
+ | Israel | Yad2 | AutoScout24 |
11
+ | United Kingdom | AutoTrader UK | Gumtree |
12
+ | United States / Canada | CarGurus | Cars.com |
13
+ | Australia | CarsGuide | Drive.com.au |
14
+
15
+ ---
16
+
17
+ ## AutoScout24 (Europe — primary)
18
+
19
+ **Why**: Strong EU-wide inventory, clean URL filtering, accessible result cards with price, mileage, year.
20
+
21
+ ### URL Construction
22
+
23
+ ```
24
+ https://www.autoscout24.com/lst/{MAKE}/{MODEL}?atype=C&cy={COUNTRY_CODE}&pricefrom={MIN}&priceto={MAX}&kmfrom={MIN_KM}&kmto={MAX_KM}&fregfrom={YEAR_FROM}&fregto={YEAR_TO}&sort=price&desc=0
25
+ ```
26
+
27
+ | Placeholder | Format / Values | Example |
28
+ |---|---|---|
29
+ | `{MAKE}` | lowercase make slug | `toyota`, `bmw`, `volkswagen` |
30
+ | `{MODEL}` | lowercase model slug | `corolla`, `3-series`, `golf` |
31
+ | `{COUNTRY_CODE}` | ISO 2-letter | `IL`, `DE`, `FR`, `IT`, `ES`, `NL` |
32
+ | `{MAX}` | integer (EUR) | `20000` |
33
+ | `{MAX_KM}` | integer | `150000` |
34
+ | `{YEAR_FROM}` | 4-digit year | `2018` |
35
+ | `sort=price&desc=0` | cheapest first | (keep as-is) |
36
+
37
+ **Worked example — used Toyota Corolla in Israel, under €20k, under 150k km, from 2018:**
38
+ ```
39
+ https://www.autoscout24.com/lst/toyota/corolla?atype=C&cy=IL&priceto=20000&kmto=150000&fregfrom=2018&sort=price&desc=0
40
+ ```
41
+
42
+ **Open search (no specific model):**
43
+ ```
44
+ https://www.autoscout24.com/lst?atype=C&cy=IL&bodytype=3&priceto=20000&sort=price&desc=0
45
+ ```
46
+ (`bodytype=3` = SUV; omit for any body type)
47
+
48
+ ### Workflow
49
+
50
+ ```bash
51
+ pinchtab_ensure || exit 1
52
+ pinchtab nav "https://www.autoscout24.com/lst/toyota/corolla?atype=C&cy=IL&priceto=20000&kmto=150000&fregfrom=2018&sort=price&desc=0"
53
+ sleep 4
54
+ pinchtab text
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Yad2 (Israel — primary for local listings)
60
+
61
+ **Why**: Dominant Israeli classifieds platform; more local dealer and private listings than AutoScout24 for Israel.
62
+
63
+ ### URL Construction
64
+
65
+ ```
66
+ https://www.yad2.co.il/vehicles/cars?manufacturer={MANUFACTURER_ID}&model={MODEL_ID}&price={MIN}-{MAX}&year={YEAR_FROM}-{YEAR_TO}&km={MIN_KM}-{MAX_KM}
67
+ ```
68
+
69
+ Yad2 uses numeric IDs for manufacturer and model. For open search without a specific make:
70
+ ```
71
+ https://www.yad2.co.il/vehicles/cars?price=0-100000&year=2018-2026
72
+ ```
73
+
74
+ **Note**: Yad2 is in Hebrew. The `pinchtab text` output will be in Hebrew. Extract prices (numbers), years, and mileage numerically. Translate model names as needed.
75
+
76
+ ### Workflow
77
+
78
+ ```bash
79
+ pinchtab_ensure || exit 1
80
+ pinchtab nav "https://www.yad2.co.il/vehicles/cars?price=0-100000&year=2018-2026"
81
+ sleep 4
82
+ pinchtab text
83
+ ```
84
+
85
+ ---
86
+
87
+ ## AutoTrader UK
88
+
89
+ ```
90
+ https://www.autotrader.co.uk/car-search?make={MAKE}&model={MODEL}&price-to={MAX}&year-from={YEAR}&maximum-mileage={MAX_KM}&sort=price-asc
91
+ ```
92
+
93
+ ```bash
94
+ pinchtab nav "https://www.autotrader.co.uk/car-search?make=TOYOTA&model=COROLLA&price-to=20000&year-from=2018&maximum-mileage=100000&sort=price-asc"
95
+ sleep 4
96
+ pinchtab text
97
+ ```
98
+
99
+ ---
100
+
101
+ ## CarGurus (USA / Canada)
102
+
103
+ ```
104
+ https://www.cargurus.com/Cars/new/nl_New_Cars.d?zip={ZIP}&sortDir=ASC&sortType=PRICE&maxPrice={MAX}&minYear={YEAR}&makes[]={MAKE}
105
+ ```
106
+
107
+ For used cars, use `nl_Used_Cars` instead of `nl_New_Cars`. Without a ZIP code, results show national listings.
108
+
109
+ ```bash
110
+ pinchtab nav "https://www.cargurus.com/Cars/new/nl_Used_Cars.d?sortDir=ASC&sortType=PRICE&maxPrice=20000&minYear=2018&makes[]=Toyota"
111
+ sleep 4
112
+ pinchtab text
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Result Extraction
118
+
119
+ From `pinchtab text`, extract per listing:
120
+ - Make and model
121
+ - Year
122
+ - Mileage (km or miles)
123
+ - Price (and currency)
124
+ - Location (city or dealership name)
125
+ - Fuel type / transmission (if visible)
126
+
127
+ ---
128
+
129
+ ## Token Efficiency
130
+
131
+ - `pinchtab text` is sufficient for reading classified listings.
132
+ - Use `pinchtab snap -i -c` only if you need to interact with filters (e.g. adjust mileage slider, select body type).
@@ -0,0 +1,113 @@
1
+ # Car Rental Reference
2
+
3
+ ## Primary site: Kayak Cars
4
+
5
+ **Why Kayak Cars:**
6
+ - Aggregates multiple rental providers (Hertz, Avis, Enterprise, local agencies) in one search
7
+ - IATA airport codes work as pickup/dropoff locations — clean URL deep-linking
8
+ - Price cells labelled with provider name + car category + daily and total rate
9
+ - No login required for searching
10
+
11
+ **Fallback: Rentalcars.com** — better international coverage outside major airports. See below.
12
+
13
+ ---
14
+
15
+ ## URL Construction
16
+
17
+ ```
18
+ https://www.kayak.com/cars/{LOCATION}/{PICKUP_DATE}-{PICKUP_TIME}h/{DROPOFF_DATE}-{DROPOFF_TIME}h
19
+ ```
20
+
21
+ | Placeholder | Format | Example |
22
+ |---|---|---|
23
+ | `{LOCATION}` | IATA airport code or city name | `TLV` or `Bangkok` |
24
+ | `{PICKUP_DATE}` | YYYY-MM-DD | `2026-11-01` |
25
+ | `{PICKUP_TIME}` | HH (24h) | `10` |
26
+ | `{DROPOFF_DATE}` | YYYY-MM-DD | `2026-11-15` |
27
+ | `{DROPOFF_TIME}` | HH (24h) | `10` |
28
+
29
+ **Worked example — Bangkok airport, Nov 1–15, pickup/dropoff at 10:00:**
30
+ ```
31
+ https://www.kayak.com/cars/BKK/2026-11-01-10h/2026-11-15-10h
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Step-by-Step Workflow
37
+
38
+ ```bash
39
+ # 1. Ensure browser is running
40
+ pinchtab_ensure || exit 1
41
+
42
+ # 2. Navigate
43
+ pinchtab nav "https://www.kayak.com/cars/BKK/2026-11-01-10h/2026-11-15-10h"
44
+
45
+ # 3. Kayak loads results asynchronously — wait longer than usual
46
+ sleep 5
47
+
48
+ # 4. Extract results
49
+ pinchtab text
50
+ ```
51
+
52
+ If `pinchtab text` returns car listings (provider names, car categories, prices), extract top 5–10.
53
+
54
+ If results are still loading (spinner text or empty): wait another 3 seconds and retry `pinchtab text` once.
55
+
56
+ ---
57
+
58
+ ## Applying Filters
59
+
60
+ | Filter | Action |
61
+ |---|---|
62
+ | Car category (economy, SUV, etc.) | Use `pinchtab snap -i -c`, find the category filter tabs at top, click the desired one |
63
+ | Sort by price | Kayak defaults to "Recommended" — find the sort dropdown ref, select "Price: lowest" |
64
+ | Specific provider | Find provider filter checkboxes in the left panel refs |
65
+
66
+ ```bash
67
+ pinchtab snap -i -c
68
+ pinchtab click {sort-ref}
69
+ sleep 2
70
+ pinchtab text
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Result Extraction
76
+
77
+ From `pinchtab text`, look for:
78
+ - Rental provider (e.g. "Hertz", "Avis", "Sixt")
79
+ - Car category (e.g. "Economy", "Compact SUV")
80
+ - Representative car model (e.g. "Toyota Yaris or similar")
81
+ - Daily rate (e.g. "$28/day")
82
+ - Total price for period
83
+
84
+ ---
85
+
86
+ ## Under-25 Driver Note
87
+
88
+ Most rental providers charge a Young Driver Surcharge for drivers under 25. This cannot be pre-applied via URL on Kayak. Always mention in your reply: *"If any driver is under 25, additional surcharges will apply at the counter — verify with the provider before booking."*
89
+
90
+ ---
91
+
92
+ ## Fallback: Rentalcars.com
93
+
94
+ Use for locations where Kayak returns no results (city centres, train stations, non-IATA locations).
95
+
96
+ ```
97
+ https://www.rentalcars.com/SearchResults.do?country={COUNTRY_CODE}&pickUpLocName={CITY}&depDate={DD/MM/YYYY}&retDate={DD/MM/YYYY}&depTime=1000&retTime=1000
98
+ ```
99
+
100
+ ```bash
101
+ pinchtab nav "https://www.rentalcars.com/SearchResults.do?country=TH&pickUpLocName=Bangkok&depDate=01/11/2026&retDate=15/11/2026&depTime=1000&retTime=1000"
102
+ sleep 5
103
+ pinchtab text
104
+ ```
105
+
106
+ **Note**: Rentalcars.com has a noisier accessibility tree. Use `pinchtab text` exclusively; avoid full snapshot.
107
+
108
+ ---
109
+
110
+ ## Token Efficiency
111
+
112
+ - `pinchtab text` is sufficient for reading car listings and prices.
113
+ - Use `pinchtab snap -i -c` only for filter/sort interactions.
@@ -0,0 +1,133 @@
1
+ # Flights Reference
2
+
3
+ ## Primary site: Google Flights
4
+
5
+ **Why Google Flights:**
6
+ - Deep-link URL accepts all search parameters (origin, destination, dates, passengers, cabin class, stops) — minimal or zero form interaction needed
7
+ - Clean accessibility tree: price cells have descriptive `aria-label` values (airline, price, duration, stops)
8
+ - No CAPTCHA for read-only searches
9
+ - Authoritative real-time pricing from airlines
10
+
11
+ **Fallback: Skyscanner** — use if Google Flights is inaccessible or returns no results. URL pattern below.
12
+
13
+ ---
14
+
15
+ ## URL Construction
16
+
17
+ ### Round trip
18
+
19
+ ```
20
+ https://www.google.com/travel/flights#flt={FROM}.{TO}.{DEPART_DATE}*{TO}.{FROM}.{RETURN_DATE};c:{CURRENCY};e:{STOPS};px:{PASSENGERS};t:f;tt:r
21
+ ```
22
+
23
+ | Placeholder | Format | Example |
24
+ |---|---|---|
25
+ | `{FROM}` | IATA airport code | `TLV` |
26
+ | `{TO}` | IATA airport code | `BKK` |
27
+ | `{DEPART_DATE}` | YYYY-MM-DD | `2026-11-01` |
28
+ | `{RETURN_DATE}` | YYYY-MM-DD | `2026-11-22` |
29
+ | `{CURRENCY}` | ISO 4217 | `USD` |
30
+ | `{STOPS}` | `0` = nonstop only, `1` = 1 stop max, `2` = any | `0` |
31
+ | `{PASSENGERS}` | see below | |
32
+
33
+ **Passenger encoding:**
34
+ - Adults only: `{n}` e.g. `2`
35
+ - With children (use age): `{adults},c{age}` for each child e.g. `2,c7,c3` = 2 adults + child age 7 + child age 3
36
+ - Infants on lap: append `,i{age}` (age 0 or 1)
37
+
38
+ **Worked example — TLV→BKK, Nov 2026, 2 adults + child 7 + child 3, nonstop, round trip:**
39
+ ```
40
+ https://www.google.com/travel/flights#flt=TLV.BKK.2026-11-01*BKK.TLV.2026-11-22;c:USD;e:0;px:2,c7,c3;t:f;tt:r
41
+ ```
42
+
43
+ ### One way
44
+
45
+ Replace `tt:r` with `tt:o` and remove the return leg (`*{TO}.{FROM}.{RETURN_DATE}`):
46
+ ```
47
+ https://www.google.com/travel/flights#flt=TLV.BKK.2026-11-01;c:USD;e:0;px:2;t:f;tt:o
48
+ ```
49
+
50
+ ### Cabin class
51
+
52
+ Append `;sc:{CLASS}` where `CLASS` is: `0`=any, `1`=economy, `2`=premium economy, `3`=business, `4`=first.
53
+ Default (omit) shows economy.
54
+
55
+ ---
56
+
57
+ ## Step-by-Step Workflow
58
+
59
+ ```bash
60
+ # 1. Ensure browser is running
61
+ pinchtab_ensure || exit 1
62
+
63
+ # 2. Navigate to the constructed URL
64
+ pinchtab nav "https://www.google.com/travel/flights#flt=TLV.BKK.2026-11-01*BKK.TLV.2026-11-22;c:USD;e:0;px:2,c7,c3;t:f;tt:r"
65
+
66
+ # 3. Wait for page to render (Google Flights loads results asynchronously)
67
+ sleep 4
68
+
69
+ # 4. Extract text — check that flight results are present
70
+ pinchtab text
71
+ ```
72
+
73
+ If `pinchtab text` returns flight results (airline names, prices, durations), extract the top 5–10 and format the reply. Done — no further interaction needed.
74
+
75
+ If results are not yet loaded (text shows only navigation/header): `sleep 3` and retry `pinchtab text` once.
76
+
77
+ ---
78
+
79
+ ## Filter Interaction (only if not pre-set in URL)
80
+
81
+ If the user wants a filter that cannot be encoded in the URL (e.g. specific airline preference, baggage included):
82
+
83
+ ```bash
84
+ # Get interactive refs for filter controls
85
+ pinchtab snap -i -c
86
+
87
+ # Find the relevant filter ref (e.g. "Stops" dropdown, "Airlines" filter)
88
+ # Click it, wait 2 seconds, re-read text
89
+ pinchtab click {ref}
90
+ sleep 2
91
+ pinchtab text
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Result Extraction
97
+
98
+ From `pinchtab text` output, look for lines containing:
99
+ - Airline name (e.g. El Al, Thai Airways, Emirates)
100
+ - Departure and arrival times
101
+ - Duration (e.g. "11 hr 20 min")
102
+ - Stop count (e.g. "Nonstop", "1 stop")
103
+ - Price (e.g. "$1,240")
104
+
105
+ **Sort order**: Google Flights defaults to "Best" (mix of price + duration). If the user wants cheapest first, look for the sort control and click "Cheapest" via `snap -i -c`.
106
+
107
+ ---
108
+
109
+ ## Fallback: Skyscanner
110
+
111
+ Use if Google Flights is blocked or returns no results.
112
+
113
+ ```
114
+ https://www.skyscanner.com/transport/flights/{from}/{to}/{YYMMDD_depart}/{YYMMDD_return}/?adults={n}&children={n}&childrensages={age1},{age2}&cabinclass=economy&stops=!oneOrMore&currency=USD
115
+ ```
116
+
117
+ Date format for Skyscanner: `YYMMDD` (e.g. `261101` for 2026-11-01).
118
+
119
+ ```bash
120
+ pinchtab nav "https://www.skyscanner.com/transport/flights/tlv/bkk/261101/261122/?adults=2&children=2&childrensages=7,3&cabinclass=economy&stops=!oneOrMore&currency=USD"
121
+ sleep 5 # Skyscanner loads slower than Google Flights
122
+ pinchtab text
123
+ ```
124
+
125
+ **Known issue**: Skyscanner occasionally shows a cookie consent banner on first load. If `pinchtab text` shows no results, run `pinchtab snap -i -c`, find the "Accept" or "Continue" button ref, click it, then re-navigate.
126
+
127
+ ---
128
+
129
+ ## Token Efficiency
130
+
131
+ - **Always start with `pinchtab text`** (~800 tokens) — sufficient to read all flight results.
132
+ - Only use `pinchtab snap -i -c` (~3,600 tokens) if you need to click a filter.
133
+ - Never use full `pinchtab snap` for flight searches.