@curless/hotel-storefront 0.85.0 → 0.87.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 (251) hide show
  1. package/dist/server.d.ts +1 -1
  2. package/dist/server.js +1 -1
  3. package/dist/tools/accept-terms.d.ts +4 -0
  4. package/dist/tools/accept-terms.d.ts.map +1 -0
  5. package/dist/tools/accept-terms.js +26 -0
  6. package/dist/tools/accept-terms.js.map +1 -0
  7. package/dist/tools/add-booking-addon.d.ts +4 -0
  8. package/dist/tools/add-booking-addon.d.ts.map +1 -0
  9. package/dist/tools/add-booking-addon.js +44 -0
  10. package/dist/tools/add-booking-addon.js.map +1 -0
  11. package/dist/tools/add-to-trip.d.ts +4 -0
  12. package/dist/tools/add-to-trip.d.ts.map +1 -0
  13. package/dist/tools/add-to-trip.js +49 -0
  14. package/dist/tools/add-to-trip.js.map +1 -0
  15. package/dist/tools/all-tools.d.ts +19124 -0
  16. package/dist/tools/all-tools.d.ts.map +1 -0
  17. package/dist/tools/all-tools.js +43 -0
  18. package/dist/tools/all-tools.js.map +1 -0
  19. package/dist/tools/answer.d.ts +3 -0
  20. package/dist/tools/answer.d.ts.map +1 -0
  21. package/dist/tools/answer.js +104 -0
  22. package/dist/tools/answer.js.map +1 -0
  23. package/dist/tools/args.d.ts +149 -0
  24. package/dist/tools/args.d.ts.map +1 -0
  25. package/dist/tools/args.js +176 -0
  26. package/dist/tools/args.js.map +1 -0
  27. package/dist/tools/base-output-schemas.d.ts +3 -0
  28. package/dist/tools/base-output-schemas.d.ts.map +1 -0
  29. package/dist/tools/base-output-schemas.js +396 -0
  30. package/dist/tools/base-output-schemas.js.map +1 -0
  31. package/dist/tools/book-picked.d.ts +4 -0
  32. package/dist/tools/book-picked.d.ts.map +1 -0
  33. package/dist/tools/book-picked.js +14 -0
  34. package/dist/tools/book-picked.js.map +1 -0
  35. package/dist/tools/booking-answer.d.ts +24 -0
  36. package/dist/tools/booking-answer.d.ts.map +1 -0
  37. package/dist/tools/booking-answer.js +567 -0
  38. package/dist/tools/booking-answer.js.map +1 -0
  39. package/dist/tools/buy-shop-item.d.ts +4 -0
  40. package/dist/tools/buy-shop-item.d.ts.map +1 -0
  41. package/dist/tools/buy-shop-item.js +45 -0
  42. package/dist/tools/buy-shop-item.js.map +1 -0
  43. package/dist/tools/call.d.ts +11 -0
  44. package/dist/tools/call.d.ts.map +1 -0
  45. package/dist/tools/call.js +2 -0
  46. package/dist/tools/call.js.map +1 -0
  47. package/dist/tools/cancel-facts.d.ts +281 -0
  48. package/dist/tools/cancel-facts.d.ts.map +1 -0
  49. package/dist/tools/cancel-facts.js +309 -0
  50. package/dist/tools/cancel-facts.js.map +1 -0
  51. package/dist/tools/cancel.d.ts +4 -0
  52. package/dist/tools/cancel.d.ts.map +1 -0
  53. package/dist/tools/cancel.js +415 -0
  54. package/dist/tools/cancel.js.map +1 -0
  55. package/dist/tools/capability-adjust.d.ts +31 -0
  56. package/dist/tools/capability-adjust.d.ts.map +1 -0
  57. package/dist/tools/capability-adjust.js +299 -0
  58. package/dist/tools/capability-adjust.js.map +1 -0
  59. package/dist/tools/card-addons.d.ts +4 -0
  60. package/dist/tools/card-addons.d.ts.map +1 -0
  61. package/dist/tools/card-addons.js +76 -0
  62. package/dist/tools/card-addons.js.map +1 -0
  63. package/dist/tools/change-booking.d.ts +4 -0
  64. package/dist/tools/change-booking.d.ts.map +1 -0
  65. package/dist/tools/change-booking.js +145 -0
  66. package/dist/tools/change-booking.js.map +1 -0
  67. package/dist/tools/clear-trip.d.ts +4 -0
  68. package/dist/tools/clear-trip.d.ts.map +1 -0
  69. package/dist/tools/clear-trip.js +10 -0
  70. package/dist/tools/clear-trip.js.map +1 -0
  71. package/dist/tools/compare.d.ts +4 -0
  72. package/dist/tools/compare.d.ts.map +1 -0
  73. package/dist/tools/compare.js +114 -0
  74. package/dist/tools/compare.js.map +1 -0
  75. package/dist/tools/current-trip.d.ts +70 -0
  76. package/dist/tools/current-trip.d.ts.map +1 -0
  77. package/dist/tools/current-trip.js +269 -0
  78. package/dist/tools/current-trip.js.map +1 -0
  79. package/dist/tools/deps.d.ts +229 -0
  80. package/dist/tools/deps.d.ts.map +1 -0
  81. package/dist/tools/deps.js +2 -0
  82. package/dist/tools/deps.js.map +1 -0
  83. package/dist/tools/follow-ups.d.ts +120 -0
  84. package/dist/tools/follow-ups.d.ts.map +1 -0
  85. package/dist/tools/follow-ups.js +369 -0
  86. package/dist/tools/follow-ups.js.map +1 -0
  87. package/dist/tools/forget-preferences.d.ts +4 -0
  88. package/dist/tools/forget-preferences.d.ts.map +1 -0
  89. package/dist/tools/forget-preferences.js +24 -0
  90. package/dist/tools/forget-preferences.js.map +1 -0
  91. package/dist/tools/get-hotel.d.ts +4 -0
  92. package/dist/tools/get-hotel.d.ts.map +1 -0
  93. package/dist/tools/get-hotel.js +350 -0
  94. package/dist/tools/get-hotel.js.map +1 -0
  95. package/dist/tools/hotel-choices.d.ts +132 -0
  96. package/dist/tools/hotel-choices.d.ts.map +1 -0
  97. package/dist/tools/hotel-choices.js +587 -0
  98. package/dist/tools/hotel-choices.js.map +1 -0
  99. package/dist/tools/itinerary.d.ts +4 -0
  100. package/dist/tools/itinerary.d.ts.map +1 -0
  101. package/dist/tools/itinerary.js +158 -0
  102. package/dist/tools/itinerary.js.map +1 -0
  103. package/dist/tools/list-booking-addons.d.ts +4 -0
  104. package/dist/tools/list-booking-addons.d.ts.map +1 -0
  105. package/dist/tools/list-booking-addons.js +21 -0
  106. package/dist/tools/list-booking-addons.js.map +1 -0
  107. package/dist/tools/list-bookings.d.ts +4 -0
  108. package/dist/tools/list-bookings.d.ts.map +1 -0
  109. package/dist/tools/list-bookings.js +119 -0
  110. package/dist/tools/list-bookings.js.map +1 -0
  111. package/dist/tools/list-extras.d.ts +4 -0
  112. package/dist/tools/list-extras.d.ts.map +1 -0
  113. package/dist/tools/list-extras.js +90 -0
  114. package/dist/tools/list-extras.js.map +1 -0
  115. package/dist/tools/list-hotels-ask.d.ts +133 -0
  116. package/dist/tools/list-hotels-ask.d.ts.map +1 -0
  117. package/dist/tools/list-hotels-ask.js +326 -0
  118. package/dist/tools/list-hotels-ask.js.map +1 -0
  119. package/dist/tools/list-hotels-empty.d.ts +5 -0
  120. package/dist/tools/list-hotels-empty.d.ts.map +1 -0
  121. package/dist/tools/list-hotels-empty.js +130 -0
  122. package/dist/tools/list-hotels-empty.js.map +1 -0
  123. package/dist/tools/list-hotels-home.d.ts +9 -0
  124. package/dist/tools/list-hotels-home.d.ts.map +1 -0
  125. package/dist/tools/list-hotels-home.js +181 -0
  126. package/dist/tools/list-hotels-home.js.map +1 -0
  127. package/dist/tools/list-hotels-page.d.ts +43 -0
  128. package/dist/tools/list-hotels-page.d.ts.map +1 -0
  129. package/dist/tools/list-hotels-page.js +344 -0
  130. package/dist/tools/list-hotels-page.js.map +1 -0
  131. package/dist/tools/list-hotels.d.ts +4 -0
  132. package/dist/tools/list-hotels.d.ts.map +1 -0
  133. package/dist/tools/list-hotels.js +24 -0
  134. package/dist/tools/list-hotels.js.map +1 -0
  135. package/dist/tools/list-shop-items.d.ts +4 -0
  136. package/dist/tools/list-shop-items.d.ts.map +1 -0
  137. package/dist/tools/list-shop-items.js +34 -0
  138. package/dist/tools/list-shop-items.js.map +1 -0
  139. package/dist/tools/list-shop-orders.d.ts +4 -0
  140. package/dist/tools/list-shop-orders.d.ts.map +1 -0
  141. package/dist/tools/list-shop-orders.js +22 -0
  142. package/dist/tools/list-shop-orders.js.map +1 -0
  143. package/dist/tools/look-up.d.ts +4 -0
  144. package/dist/tools/look-up.d.ts.map +1 -0
  145. package/dist/tools/look-up.js +207 -0
  146. package/dist/tools/look-up.js.map +1 -0
  147. package/dist/tools/output-schemas.d.ts +645 -0
  148. package/dist/tools/output-schemas.d.ts.map +1 -0
  149. package/dist/tools/output-schemas.js +503 -0
  150. package/dist/tools/output-schemas.js.map +1 -0
  151. package/dist/tools/paid-lines.d.ts +718 -0
  152. package/dist/tools/paid-lines.d.ts.map +1 -0
  153. package/dist/tools/paid-lines.js +359 -0
  154. package/dist/tools/paid-lines.js.map +1 -0
  155. package/dist/tools/pay-with-union-pay.d.ts +4 -0
  156. package/dist/tools/pay-with-union-pay.d.ts.map +1 -0
  157. package/dist/tools/pay-with-union-pay.js +112 -0
  158. package/dist/tools/pay-with-union-pay.js.map +1 -0
  159. package/dist/tools/payment-words.d.ts +269 -0
  160. package/dist/tools/payment-words.d.ts.map +1 -0
  161. package/dist/tools/payment-words.js +365 -0
  162. package/dist/tools/payment-words.js.map +1 -0
  163. package/dist/tools/pick-room.d.ts +4 -0
  164. package/dist/tools/pick-room.d.ts.map +1 -0
  165. package/dist/tools/pick-room.js +23 -0
  166. package/dist/tools/pick-room.js.map +1 -0
  167. package/dist/tools/policies.d.ts +4 -0
  168. package/dist/tools/policies.d.ts.map +1 -0
  169. package/dist/tools/policies.js +74 -0
  170. package/dist/tools/policies.js.map +1 -0
  171. package/dist/tools/pricing.d.ts +55 -0
  172. package/dist/tools/pricing.d.ts.map +1 -0
  173. package/dist/tools/pricing.js +260 -0
  174. package/dist/tools/pricing.js.map +1 -0
  175. package/dist/tools/put-room-line.d.ts +12 -0
  176. package/dist/tools/put-room-line.d.ts.map +1 -0
  177. package/dist/tools/put-room-line.js +347 -0
  178. package/dist/tools/put-room-line.js.map +1 -0
  179. package/dist/tools/quote-card.d.ts +234 -0
  180. package/dist/tools/quote-card.d.ts.map +1 -0
  181. package/dist/tools/quote-card.js +375 -0
  182. package/dist/tools/quote-card.js.map +1 -0
  183. package/dist/tools/refund-booking.d.ts +4 -0
  184. package/dist/tools/refund-booking.d.ts.map +1 -0
  185. package/dist/tools/refund-booking.js +112 -0
  186. package/dist/tools/refund-booking.js.map +1 -0
  187. package/dist/tools/request-booking.d.ts +4 -0
  188. package/dist/tools/request-booking.d.ts.map +1 -0
  189. package/dist/tools/request-booking.js +5 -0
  190. package/dist/tools/request-booking.js.map +1 -0
  191. package/dist/tools/request-words.d.ts +238 -0
  192. package/dist/tools/request-words.d.ts.map +1 -0
  193. package/dist/tools/request-words.js +487 -0
  194. package/dist/tools/request-words.js.map +1 -0
  195. package/dist/tools/room-choices.d.ts +64 -0
  196. package/dist/tools/room-choices.d.ts.map +1 -0
  197. package/dist/tools/room-choices.js +374 -0
  198. package/dist/tools/room-choices.js.map +1 -0
  199. package/dist/tools/session-notes.d.ts +164 -0
  200. package/dist/tools/session-notes.d.ts.map +1 -0
  201. package/dist/tools/session-notes.js +412 -0
  202. package/dist/tools/session-notes.js.map +1 -0
  203. package/dist/tools/sign-in.d.ts +4 -0
  204. package/dist/tools/sign-in.d.ts.map +1 -0
  205. package/dist/tools/sign-in.js +72 -0
  206. package/dist/tools/sign-in.js.map +1 -0
  207. package/dist/tools/sign-out.d.ts +4 -0
  208. package/dist/tools/sign-out.d.ts.map +1 -0
  209. package/dist/tools/sign-out.js +13 -0
  210. package/dist/tools/sign-out.js.map +1 -0
  211. package/dist/tools/terms-answer.d.ts +114 -0
  212. package/dist/tools/terms-answer.d.ts.map +1 -0
  213. package/dist/tools/terms-answer.js +492 -0
  214. package/dist/tools/terms-answer.js.map +1 -0
  215. package/dist/tools/tool-defs-account.d.ts +80 -0
  216. package/dist/tools/tool-defs-account.d.ts.map +1 -0
  217. package/dist/tools/tool-defs-account.js +65 -0
  218. package/dist/tools/tool-defs-account.js.map +1 -0
  219. package/dist/tools/tool-defs-addons.d.ts +251 -0
  220. package/dist/tools/tool-defs-addons.d.ts.map +1 -0
  221. package/dist/tools/tool-defs-addons.js +198 -0
  222. package/dist/tools/tool-defs-addons.js.map +1 -0
  223. package/dist/tools/tool-defs-booking.d.ts +410 -0
  224. package/dist/tools/tool-defs-booking.d.ts.map +1 -0
  225. package/dist/tools/tool-defs-booking.js +285 -0
  226. package/dist/tools/tool-defs-booking.js.map +1 -0
  227. package/dist/tools/tool-defs-browse.d.ts +444 -0
  228. package/dist/tools/tool-defs-browse.d.ts.map +1 -0
  229. package/dist/tools/tool-defs-browse.js +307 -0
  230. package/dist/tools/tool-defs-browse.js.map +1 -0
  231. package/dist/tools/tool-defs-trip.d.ts +136 -0
  232. package/dist/tools/tool-defs-trip.d.ts.map +1 -0
  233. package/dist/tools/tool-defs-trip.js +79 -0
  234. package/dist/tools/tool-defs-trip.js.map +1 -0
  235. package/dist/tools/tool-env.d.ts +64 -0
  236. package/dist/tools/tool-env.d.ts.map +1 -0
  237. package/dist/tools/tool-env.js +49 -0
  238. package/dist/tools/tool-env.js.map +1 -0
  239. package/dist/tools/tool-set.d.ts +1425 -0
  240. package/dist/tools/tool-set.d.ts.map +1 -0
  241. package/dist/tools/tool-set.js +244 -0
  242. package/dist/tools/tool-set.js.map +1 -0
  243. package/dist/tools/view-trip.d.ts +4 -0
  244. package/dist/tools/view-trip.d.ts.map +1 -0
  245. package/dist/tools/view-trip.js +7 -0
  246. package/dist/tools/view-trip.js.map +1 -0
  247. package/dist/tools.d.ts +13 -2089
  248. package/dist/tools.d.ts.map +1 -1
  249. package/dist/tools.js +11 -10685
  250. package/dist/tools.js.map +1 -1
  251. package/package.json +1 -1
@@ -0,0 +1,374 @@
1
+ import { PAY_WORDS, allOrEach, choiceBlock, payOf, paymentOf, saysOwn, sentenceOf, setsApart, sharedBy, spreadOf, } from '../choices.js';
2
+ import { addDays, dateOptions, dayWords, isDay, stayDayWords, toDay } from '../dates.js';
3
+ import { formatMoney, multiplyMoney } from '../money.js';
4
+ import { nightIsTheStay } from '../present.js';
5
+ import { FAMILY_SLEEPS, activeKeysOf, byRoomType, facetsOf, keyWords, matchesTerms, termWords, } from '../room-filters.js';
6
+ import { MAX_ROOMS_PER_LINE } from '../trip.js';
7
+ import { withZh } from './quote-card.js';
8
+ import { LABEL_WORDS, UNPAID_TAG, cancelWords, nightlyPart, roomTypeLines, siteBookingLines, } from './request-words.js';
9
+ /** How many room types a client that draws no card shows the guest at once - see `roomChoiceRows`. */
10
+ export const ROOM_CHOICES_SHOWN = 5;
11
+ /** The labels that say what a rate has for breakfast - its column of a choice, not a label after it. */
12
+ const isMealLabel = (l) => l === 'room-only' || l.startsWith('breakfast');
13
+ /** Breakfast on a rate, as a column of a choice: its label's own words ("breakfast for 2"), or with or without. */
14
+ const breakfastColumn = (r) => {
15
+ const said = (r.labels ?? []).find((l) => l.startsWith('breakfast'));
16
+ return said ? LABEL_WORDS[said] : facetsOf(r).breakfast ? 'breakfast included' : 'no breakfast';
17
+ };
18
+ /** A rate's labels other than its breakfast and its payment - "booked-ahead rate" - as words. */
19
+ const otherLabelsOf = (r) => (r.labels ?? [])
20
+ .filter((l) => !isMealLabel(l))
21
+ .map((l) => LABEL_WORDS[l])
22
+ .join(', ');
23
+ /**
24
+ * A hotel's rooms for the nights as the numbered choices a client that draws no
25
+ * card tells the guest (robin 11-06: 「房型选择…看看有没有办法在文字版优化下」;
26
+ * as paragraphs since robin 11-09 - see choices.ts).
27
+ *
28
+ * One choice per ROOM TYPE, cheapest first, at its lowest rate, with how many
29
+ * other rates the type has: what the card shows a guest who can tap, in lines
30
+ * they can answer with a number. The room id `addToTrip` takes for that number
31
+ * is not in them: the ids follow, in one line of their own (`idsByNumber`).
32
+ * Every type is in the answer, numbered, so "the sixth" is one the model can
33
+ * name when the guest asks for the rest; the guest is shown the first
34
+ * `ROOM_CHOICES_SHOWN`, and the others as a count.
35
+ *
36
+ * What every type has - its breakfast, its terms, its price, its other rates,
37
+ * how it is paid - is said once before them (`said`), and what most have once
38
+ * as what holds unless one says otherwise; each type says only what sets it
39
+ * apart (robin 11-09: the same sentence five times over, on Huazhu's five).
40
+ *
41
+ * ⚠️ HOW EACH IS PAID CAN BE TOLD (2026-11-02 audit, P1-5): see `paymentOf`.
42
+ */
43
+ /** A floor as the card says it, in English: "Floor 10", "Floors 10–15"; the group's own words otherwise. */
44
+ const floorSaid = (floor) => {
45
+ const f = (floor ?? '').trim();
46
+ if (!f)
47
+ return '';
48
+ const range = /^(\d{1,3})\s*[-–—~~]\s*(\d{1,3})$/.exec(f);
49
+ const from = range?.[1] ?? (/^\d{1,3}$/.test(f) ? f : '');
50
+ const to = range?.[2] ?? from;
51
+ if (from && to && from !== to)
52
+ return `Floors ${from}–${to}`;
53
+ return from ? `Floor ${from}` : f;
54
+ };
55
+ const WINDOW_SAID = {
56
+ yes: 'Window',
57
+ no: 'No window',
58
+ partial: 'Partial window',
59
+ inner: 'Inner window, onto a courtyard',
60
+ };
61
+ /** What a room type says of itself, in the card's words: sleeps, size, floor, window, Wi-Fi, extra bed - each only where the record has it. */
62
+ const roomOwnFacts = (r) => [
63
+ `sleeps ${r.sleeps}`,
64
+ r.sizeSqm ? `${r.sizeSqm} m²` : '',
65
+ floorSaid(r.floor),
66
+ r.window ? (WINDOW_SAID[r.window] ?? '') : '',
67
+ r.wifi ? 'Wi-Fi' : '',
68
+ r.extraBed ? 'extra bed available' : '',
69
+ ].filter(Boolean);
70
+ const roomChoicesBlock = (rooms, roomsWanted,
71
+ /** The group a stay paid in advance is booked with instead. */
72
+ group,
73
+ /** Nothing can be booked here (`capabilities.readOnly`): said once, and no payment told apart. */
74
+ readOnly = false) => {
75
+ const facts = roomChoiceFacts(rooms, roomsWanted, readOnly);
76
+ const { rows } = facts;
77
+ const blocks = rows.map((row, i) => roomChoice(facts, row, i));
78
+ return {
79
+ said: roomChoicesSaid(facts, group),
80
+ blocks,
81
+ ids: rows.map(({ r }) => r.id),
82
+ // How it is paid, for the model too (0.75.1: no "not booked here" before the guest wants one).
83
+ notes: rows.map(({ r }) => readOnly
84
+ ? ''
85
+ : r.notSoldHere
86
+ ? 'paid in advance'
87
+ : r.paymentNotConnected
88
+ ? `paid in advance, ${UNPAID_TAG}`
89
+ : ''),
90
+ };
91
+ };
92
+ const roomChoiceFacts = (rooms, roomsWanted, readOnly) => {
93
+ // ⚠️ ONE ROOM'S STAY QUOTED BESIDE OTHERS' NIGHTS (0.76.1, Otaless - H1): where a stay total
94
+ // is ours (`stayTotalUnquoted`) the rooms are put side by side by the group's rate a night,
95
+ // and the one the group priced for the stay says "for the stay".
96
+ const unquoted = rooms.some((r) => r.stayTotalUnquoted);
97
+ const mixed = unquoted && rooms.some((r) => !r.stayTotalUnquoted && !r.hourly);
98
+ const basis = (r) => (unquoted ? r.nightly.minor : r.stayTotal.minor);
99
+ const rows = byRoomType(rooms)
100
+ .map((type) => ({
101
+ type,
102
+ r: type.rooms.reduce((a, b) => (basis(b) < basis(a) ? b : a)),
103
+ }))
104
+ .sort((a, b) => basis(a.r) - basis(b.r))
105
+ .map(({ type, r }) => ({ type, r, others: type.rooms.length - 1 }));
106
+ const many = roomsWanted > 1;
107
+ const price = (r) => r.hourly
108
+ ? `${formatMoney(r.stayTotal)} for ${r.hourly.hours} hours`
109
+ : r.stayTotalUnquoted
110
+ ? // ⚠️ A NIGHT'S PRICE, NOT OUR TOTAL (总线程 11-13, `Room.stayTotalUnquoted`).
111
+ `${formatMoney(r.nightly)} a night${many ? ', per room' : ''}`
112
+ : many
113
+ ? `${formatMoney(multiplyMoney(r.stayTotal, roomsWanted))} for ${roomsWanted} rooms${mixed ? ' for the stay' : ''}`
114
+ : `${formatMoney(r.stayTotal)}${mixed ? ' for the stay' : ''}`;
115
+ // ⚠️ "BEFORE TAXES" ONLY WHERE IT IS SO (0.55.3): see `nightlyIncludesTaxes`.
116
+ //
117
+ // ⚠️ NOT TWICE (0.79.1, Manus 11-19, Otaless's River View Suite: 「可住3人。每晚 $208。」 and, a
118
+ // line under it, 「可住3人 · 每晚 $208」): where the price under the choice IS a night's
119
+ // (`stayTotalUnquoted`) the sentence does not say the night as well. Nor for one night of one
120
+ // room whose night is the stay (0.79.5, `nightIsTheStay`: 「$132 a night.」 + 「Lowest price · $132」).
121
+ const nightly = (r) => r.hourly || r.stayTotalUnquoted || nightIsTheStay(r, roomsWanted)
122
+ ? ''
123
+ : `${nightlyPart(r, true)}${many ? ', per room' : ''}`;
124
+ const more = (n) => n ? `${n} more ${n === 1 ? 'rate' : 'rates'} on this room type` : '';
125
+ // Breakfast and terms are said for most as "unless one says otherwise"; the
126
+ // rest only where every one is the same.
127
+ const spread = {
128
+ beds: allOrEach(spreadOf(rows.map(({ r }) => r.beds ?? ''))),
129
+ breakfast: spreadOf(rows.map(({ r }) => breakfastColumn(r))),
130
+ cancel: spreadOf(rows.map(({ r }) => cancelWords(r))),
131
+ labels: allOrEach(spreadOf(rows.map(({ r }) => otherLabelsOf(r)))),
132
+ nightly: allOrEach(spreadOf(rows.map(({ r }) => nightly(r)))),
133
+ more: allOrEach(spreadOf(rows.map(({ others }) => String(others)))),
134
+ price: allOrEach(spreadOf(rows.map(({ r }) => price(r)))),
135
+ };
136
+ const pay = readOnly
137
+ ? { said: '', tags: [] }
138
+ : paymentOf(rows.map(({ r }) => payOf(r)), 'room');
139
+ const lowest = Math.min(...rows.map(({ r }) => basis(r)));
140
+ const apart = {
141
+ cheapest: setsApart(rows.map(({ r }) => !r.hourly && basis(r) === lowest)),
142
+ breakfast: setsApart(rows.map(({ r }) => facetsOf(r).breakfast)),
143
+ free: setsApart(rows.map(({ r }) => facetsOf(r).freeCancellation)),
144
+ };
145
+ // ⚠️ A ROOM'S OWN FACTS IN WORDS (0.77.3, Manus 11-19: each line had a name, beds and a price):
146
+ // where the rooms carry what only Huazhu's record adds (Wi-Fi, an extra bed) every type says
147
+ // what the card says - sleeps, size, floor, window, Wi-Fi, extra bed. Only where they do: a group
148
+ // whose rooms carry none of these is told as before, word for word.
149
+ const withFacts = rows.some(({ r }) => r.wifi || r.extraBed);
150
+ return {
151
+ roomsWanted,
152
+ readOnly,
153
+ unquoted,
154
+ mixed,
155
+ basis,
156
+ rows,
157
+ many,
158
+ price,
159
+ nightly,
160
+ more,
161
+ spread,
162
+ pay,
163
+ lowest,
164
+ apart,
165
+ withFacts,
166
+ };
167
+ };
168
+ /** One room type of the list, as a numbered choice. */
169
+ const roomChoice = ({ readOnly, basis, rows, many, price, nightly, more, spread, pay, lowest, apart, withFacts, }, { type, r, others }, i) => {
170
+ const family = r.sleeps >= FAMILY_SLEEPS ? `sleeps ${r.sleeps}` : '';
171
+ const beds = saysOwn(spread.beds, r.beds ?? '') ? (r.beds ?? '') : '';
172
+ return choiceBlock(i + 1, {
173
+ title: withZh(type.name, r.roomType ? r.roomType.names : r.names, true),
174
+ sentence: sentenceOf([
175
+ // A room for a family says so: "three of us" is chosen by it.
176
+ [beds, ...(withFacts ? roomOwnFacts(r) : [family])]
177
+ .filter(Boolean)
178
+ .join(', '),
179
+ saysOwn(spread.breakfast, breakfastColumn(r)) ? breakfastColumn(r) : '',
180
+ saysOwn(spread.cancel, cancelWords(r)) ? cancelWords(r) : '',
181
+ saysOwn(spread.labels, otherLabelsOf(r)) ? otherLabelsOf(r) : '',
182
+ rows.length < 2 && !readOnly ? PAY_WORDS[payOf(r)] : '',
183
+ r.hourly
184
+ ? `starting between ${r.hourly.earliestStart} and ${r.hourly.latestStart} today, out by ${r.hourly.latestEnd}`
185
+ : '',
186
+ [
187
+ saysOwn(spread.nightly, nightly(r)) ? nightly(r) : '',
188
+ saysOwn(spread.more, String(others)) ? more(others) : '',
189
+ ]
190
+ .filter(Boolean)
191
+ .join('; '),
192
+ ]),
193
+ tags: [
194
+ pay.tags[i] ?? '',
195
+ apart.cheapest && basis(r) === lowest ? 'Lowest price' : '',
196
+ apart.breakfast && facetsOf(r).breakfast ? 'Breakfast' : '',
197
+ apart.free && facetsOf(r).freeCancellation ? 'Free cancellation' : '',
198
+ // ⚠️ NO "Sleeps N" TAG (0.79.1): the sentence above already says it for every room that
199
+ // sleeps that many - the tag said it a second time, a line under.
200
+ ].filter(Boolean),
201
+ price: price(r),
202
+ });
203
+ };
204
+ /** What is said once of the whole list. */
205
+ const roomChoicesSaid = ({ roomsWanted, readOnly, mixed, rows, many, price, more, spread, pay }, group) => {
206
+ // What every one has, and what most have, said once before them.
207
+ const first = rows[0]?.r;
208
+ const samePrice = sharedBy(spread.price);
209
+ const shared = [
210
+ sharedBy(spread.beds),
211
+ sharedBy(spread.breakfast),
212
+ sharedBy(spread.cancel),
213
+ sharedBy(spread.labels),
214
+ samePrice ? '' : sharedBy(spread.nightly),
215
+ sharedBy(spread.more) && sharedBy(spread.more) !== '0'
216
+ ? `${sharedBy(spread.more)} more ${sharedBy(spread.more) === '1' ? 'rate' : 'rates'} on each`
217
+ : '',
218
+ ].filter(Boolean);
219
+ const most = [spread.breakfast, spread.cancel]
220
+ .map((s) => (s.kind === 'most' ? s.value : ''))
221
+ .filter(Boolean);
222
+ return [
223
+ first?.hourly
224
+ ? "Prices are for each room's hours, taxes and fees included."
225
+ : rows.every(({ r }) => r.stayTotalUnquoted)
226
+ ? // ⚠️ NIGHTLY PRICES, NOT STAY PRICES (总线程 11-13, `Room.stayTotalUnquoted`) - and said
227
+ // as not a total (0.76.1, H1).
228
+ 'Prices are a night each, as the group gives them - not totals for these nights; it has quoted no price for the whole stay yet.'
229
+ : mixed
230
+ ? `A price that says "for the stay" is the whole stay, taxes and fees included; the others are a night each, as the group gives them - not totals for these nights.`
231
+ : samePrice && rows.length > 1
232
+ ? `All ${rows.length} are ${samePrice}${many ? '' : ' for the stay'}, taxes and fees included${sharedBy(spread.nightly) ? ` (${sharedBy(spread.nightly)})` : ''}.`
233
+ : many
234
+ ? `Prices are for ${roomsWanted} rooms for the whole stay, taxes and fees included.`
235
+ : 'Prices are for the stay, taxes and fees included.',
236
+ shared.length ? `Every one: ${shared.join('; ')}.` : '',
237
+ most.length ? `Unless a room says otherwise: ${most.join('; ')}.` : '',
238
+ pay.said,
239
+ readOnly
240
+ ? `Nothing can be booked here yet: to book, use these rooms and dates with ${group}, on its own website or app.`
241
+ : '',
242
+ ]
243
+ .filter(Boolean)
244
+ .join(' ');
245
+ };
246
+ /**
247
+ * The ids behind numbered choices, in one line after them (总线程 11-09): with the
248
+ * id on each line - "— room `x`" - the model was to copy the line and drop its
249
+ * end, and on Manus it rewrote the lines and dropped the numbers instead. The
250
+ * choices are the guest's as they stand; this line is the model's - and it
251
+ * marks each one paid in advance too (P1-5), where the choices may say it once
252
+ * for all.
253
+ */
254
+ export const idsByNumber = (what, ids, from = 1, notes = []) => `${what} ids by number, for your calls - never for the guest: ${ids
255
+ .map((id, i) => `${from + i} = \`${id}\`${notes[i] ? ` (${notes[i]})` : ''}`)
256
+ .join('; ')}.`;
257
+ /**
258
+ * What the assistant is told to do with the choices - in the text and, word for
259
+ * word, in the structure (`roomChoices`): the model reads the structure.
260
+ */
261
+ const roomChoicesLead = (types, when) => `Say the dates first, as they are here - ${when} - then copy what follows into your reply as it stands, in this order: the sentence of what the rooms share, then each room as its own lines - its number and name in bold ("**1. …**"${types === 1 ? ', the one room too' : ''}), the sentence of what sets it apart where there is one, and its tags ending in its price - with a blank line between rooms. In the guest's language, with every number and figure kept and nothing added; never a table, and nothing said again on a room that the sentence before them says - ${types > ROOM_CHOICES_SHOWN
262
+ ? `the first ${ROOM_CHOICES_SHOWN}, then "${types - ROOM_CHOICES_SHOWN} more room ${types - ROOM_CHOICES_SHOWN === 1 ? 'type' : 'types'}" in one line (the rest are below, for a guest who asks)`
263
+ : 'every one'}. The guest answers with a number or by describing one: a number is that room, by the ids after the rooms.`;
264
+ /**
265
+ * Today at a hotel, for the dates offered to a guest who named none: its own
266
+ * date where the backend gives it (`todayThere`); else the sun's, from where it
267
+ * is (15° of longitude an hour - the Otaless backend gives no clock); else UTC's.
268
+ */
269
+ export const todayOfHotel = (h, now) => {
270
+ if (h.todayThere && isDay(h.todayThere))
271
+ return h.todayThere;
272
+ const lng = h.geo?.lng;
273
+ return typeof lng === 'number' && Number.isFinite(lng)
274
+ ? toDay(now + Math.max(-12, Math.min(14, Math.round(lng / 15))) * 3_600_000)
275
+ : toDay(now);
276
+ };
277
+ /**
278
+ * What a client that draws no card is told of the night a dateless answer is
279
+ * priced for (robin 11-06: 「日期选择…文字版优化」): tonight, on the hotel's own
280
+ * calendar, said in the reply's first sentence - with this weekend and next by
281
+ * their weekdays and dates (`dateOptions`) as the other choices, in the same
282
+ * sentence. Named, not numbered: the numbers in that reply are the rooms' or the
283
+ * hotels', and "2" has to mean one thing. In the text and, word for word, in the
284
+ * structure (`stayDefault`).
285
+ */
286
+ export const stayDefaultWords = (today, guests, roomsAsked,
287
+ /** What the reply numbers - the rooms of a hotel, or the hotels of a list. */
288
+ numbers) => {
289
+ const [tonight, ...others] = dateOptions(today);
290
+ const rooms = Math.max(1, Math.min(MAX_ROOMS_PER_LINE, Math.floor(Number(roomsAsked) || 1)));
291
+ return `No dates were asked for, so this is priced for tonight by default, on the ${numbers === 'rooms' ? "hotel's" : "hotels'"} own date: ${stayDayWords(tonight?.checkIn ?? today, tonight?.checkOut ?? addDays(today, 1))}, ${guests} ${guests === 1 ? 'guest' : 'guests'}, ${rooms === 1 ? 'one room' : `${rooms} rooms`}. Open your reply with that, in one sentence, and name the other nights in the same sentence as choices, by their dates - ${others
292
+ .map((o) => `${o.label}, ${dayWords(o.checkIn)} to ${dayWords(o.checkOut)} (${o.nights} nights; checkIn ${o.checkIn}, checkOut ${o.checkOut})`)
293
+ .join(', or ')}, or dates of their own. Do not number those: the numbers are the ${numbers}'. Never ask for dates before showing the ${numbers}; a guest who names other nights is asked again with them.`;
294
+ };
295
+ /**
296
+ * The lead, what the rooms share and the choices - in the text and, word for
297
+ * word, in `roomChoices`.
298
+ *
299
+ * `before`: what is said before the list (other arrivals that cost less). Since 0.75.1
300
+ * (robin 11-18) that rates paid in advance cannot be booked here is not among it: it was
301
+ * first since robin's Manus run (11-06, via 总线程), and now it is said when the guest wants
302
+ * one (`notSoldHereWords`).
303
+ */
304
+ export const roomChoicesOf = (rooms, roomsWanted, when, before, group, readOnly = false) => {
305
+ const c = roomChoicesBlock(rooms, roomsWanted, group, readOnly);
306
+ return [
307
+ ...(before ? [before] : []),
308
+ roomChoicesLead(c.blocks.length, when),
309
+ ...(c.said ? [c.said] : []),
310
+ // The blank lines are in the strings: the text's lines are joined after
311
+ // empty ones are dropped, and the text and `roomChoices` say the same.
312
+ `\n${c.blocks.join('\n\n')}`,
313
+ `\n${idsByNumber('Room', c.ids, 1, c.notes)}`,
314
+ ];
315
+ };
316
+ /**
317
+ * What a hotel's rooms look like to the assistant for the nights: one line per
318
+ * type, and with filters only the rates that meet ALL of them. None meeting
319
+ * them is said plainly - which filters were asked, what each leaves on its own
320
+ * - and that the full list is there without them.
321
+ */
322
+ export const roomsText = (hotelName,
323
+ /** "3 room types for 2026-11-04 to 2026-11-06, 2 guests" - what the rooms are, counted. */
324
+ counted,
325
+ /** "2026-11-04 to 2026-11-06" - when, for the sentence that says none fit. */
326
+ when, enough, roomsWanted, terms, noCards,
327
+ /** The nights as the guest reads them - weekdays first - for a client that draws no card. */
328
+ saidWhen,
329
+ /**
330
+ * What is said before the list to a client that draws no card: other arrivals
331
+ * that cost less (`dateFlex`).
332
+ */
333
+ before,
334
+ /** The group a stay paid in advance is booked with instead - see `paymentOf`. */
335
+ group = '',
336
+ /** Nothing can be booked here - see `roomChoicesBlock`. */
337
+ readOnly = false) => {
338
+ // A type with several rates is priced from its cheapest: say how to reach another.
339
+ const lines = (rs) => [
340
+ ...(noCards
341
+ ? roomChoicesOf(rs, roomsWanted, saidWhen ?? when, before, group, readOnly)
342
+ : roomTypeLines(rs, roomsWanted, terms)),
343
+ ...siteBookingLines(rs, group || 'the hotel group'),
344
+ ...(byRoomType(rs).some((t) => t.rooms.length > 1)
345
+ ? [
346
+ noCards
347
+ ? // ⚠️ NO CARD LISTS THE OTHERS (2026-11-02 audit, P2-1).
348
+ 'A type with several rates is priced from its cheapest one; bed, breakfast, freeCancellation, window, payment and family narrow to the others - asked again with them, this answer lists those rates.'
349
+ : 'A type with several rates is priced from its cheapest one; bed, breakfast, freeCancellation, window, payment and family narrow to the others (the card lists every rate).',
350
+ ]
351
+ : []),
352
+ ];
353
+ if (!terms)
354
+ return [`**${hotelName}** · ${counted(enough)}.`, ...lines(enough)];
355
+ const asked = termWords(terms);
356
+ const several = activeKeysOf(terms).length > 1;
357
+ const rates = (n) => `${n} ${n === 1 ? 'rate' : 'rates'}`;
358
+ const matching = enough.filter((r) => matchesTerms(r, terms));
359
+ if (matching.length === 0) {
360
+ const alone = several
361
+ ? ` On its own, ${activeKeysOf(terms)
362
+ .map((k) => `${keyWords(k)} fits ${enough.filter((r) => facetsOf(r)[k]).length}`)
363
+ .join(', ')}.`
364
+ : '';
365
+ return [
366
+ `**${hotelName}** · none of the ${rates(enough.length)} for ${when} has ${asked}${several ? ' together' : ''}.${alone} The full list is there without ${several ? 'those filters' : 'that filter'}.`,
367
+ ];
368
+ }
369
+ return [
370
+ `**${hotelName}** · ${counted(matching)}, with ${asked} (${matching.length} of ${rates(enough.length)}).`,
371
+ ...lines(matching),
372
+ ];
373
+ };
374
+ //# sourceMappingURL=room-choices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-choices.js","sourceRoot":"","sources":["../../src/tools/room-choices.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,KAAK,EACL,SAAS,EACT,OAAO,EACP,UAAU,EACV,SAAS,EACT,QAAQ,EACR,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,aAAa,EAEb,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,SAAS,GACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,sGAAsG;AACtG,MAAM,CAAC,MAAM,kBAAkB,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C;iBAChF,IAAI,CAAC,IAAI,CAAC,GAAG;YAClB,CAAC,CAAC,EAAE,CAAC;QACP,OAAO;YACL,KAAK,SAAS,oBAAoB,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,IAAI,QAAQ,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,mCAAmC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,GAAG;SACrM,CAAC;IACJ,CAAC;IACD,OAAO;QACL,KAAK,SAAS,QAAQ,OAAO,CAAC,QAAQ,CAAC,UAAU,KAAK,KAAK,QAAQ,CAAC,MAAM,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI;QACzG,GAAG,KAAK,CAAC,QAAQ,CAAC;KACnB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,164 @@
1
+ import type { ToolNames } from '../config.js';
2
+ import type { FailedStay, Identity, Names, Unanswered } from '../types.js';
3
+ import type { ToolAnswer, ToolContext, ToolDeps } from './deps.js';
4
+ export declare const identity: (deps: ToolDeps, ctx: ToolContext, key: string, args?: Record<string, unknown>) => Identity;
5
+ export declare const previewsOf: (deps: ToolDeps) => Map<string, number>;
6
+ export declare const remember: (deps: ToolDeps, k: string, amount: number) => void;
7
+ export declare const refundTokensOf: (deps: ToolDeps) => Map<string, {
8
+ preview: string;
9
+ until: number;
10
+ }>;
11
+ export declare const rememberRefund: (deps: ToolDeps, k: string, preview: string, until: number) => void;
12
+ /** "a, b and c" - "a and b" - "a". */
13
+ export declare const listAnd: (xs: string[]) => string;
14
+ /**
15
+ * What the model does when a hotel group did not answer: tells the guest, and
16
+ * leaves asking again to them - said after the sentence that names the groups,
17
+ * in the text and in `structuredContent` alike.
18
+ *
19
+ * ⚠️ NEVER "ASKING AGAIN IN A MOMENT MAY BRING THEM" (robin 11-04). Read as
20
+ * "ask again now", it had the model call the list a second time in the same
21
+ * turn: two of the same card under 「打开 Otaless」 on claude.ai, with every
22
+ * group of the backend silent. The guest asks again: with the card's 「重试」
23
+ * where a card was drawn, in words where none was.
24
+ */
25
+ export declare const askLater: (card: boolean) => string;
26
+ /** The groups a failed stay names (Otaless's `link-first`, 0.74.5) - codes only. */
27
+ export declare const groupsOfFailed: (f: FailedStay) => string[];
28
+ /**
29
+ * The groups of a market that did not answer a search, as the sentence the
30
+ * model is told and the fields the card draws its own line from - the same
31
+ * list in both (`HotelSearchResult.degraded`).
32
+ *
33
+ * ⚠️ "DID NOT ANSWER" IS NOT "HAS NONE". A list without Atour's hotels, from
34
+ * an Atour that timed out, reads to a guest as a city where Atour has no
35
+ * hotel. The sentence says the first and denies the second, in the text and in
36
+ * `structuredContent` alike - a host with no card has only the words.
37
+ */
38
+ export declare const degradedOf: (deps: ToolDeps, answer: {
39
+ degraded?: {
40
+ supplier: string;
41
+ name: string;
42
+ names?: Names;
43
+ why?: "needs-place";
44
+ places?: {
45
+ name: string;
46
+ }[];
47
+ }[];
48
+ },
49
+ /** What is missing from the list: the hotels of a search, the bookings of "my bookings". */
50
+ noun?: string,
51
+ /**
52
+ * The client draws no card: each group's own Chinese name goes beside its
53
+ * name, as a hotel's does (`withZh`) - told only "JI Hotel", a model with no
54
+ * card called it 锦江之星, another group (11-03, text-only eval). A card host
55
+ * is told the English name alone; the card says the group in its own words.
56
+ */
57
+ noCards?: boolean,
58
+ /** This answer draws a card, with its 「重试」 (`askLater`) - not so for `look_up`, which draws none. */
59
+ card?: boolean,
60
+ /**
61
+ * The groups kept quiet about here - a search's (`quietIn`), never a list of bookings.
62
+ *
63
+ * ⚠️ NOT A REMINDER EVERY TIME (robin 11-16: 「有 Accor 酒店的城市显示 Accor 就好了,没有的
64
+ * 默认就是不显示,没必要一直提醒」). A quiet group that did not answer, or was not looked
65
+ * up without a place, is left out of `degraded` - so no card draws a line for it, an
66
+ * old one neither - and said in `quietSaid` as a fact, in the text alike: mention it
67
+ * only if the guest asks about that group. No 「重试」, no "name a city".
68
+ */
69
+ quiet?: ReadonlySet<string>,
70
+ /**
71
+ * ⚠️ A SEARCH THAT HAS SOMETHING TO SHOW DOES NOT REMIND THE GUEST OF A GROUP THAT DID NOT
72
+ * ANSWER (0.74.4, robin 11-17: 「没关系,报错的就这样灰着就行,不用有报错信息」 - Otaless's home
73
+ * with a grey 「shopify」 under 「shopify didn't respond just now… Try again」, its /site
74
+ * listing a group with no LIST_HOTELS, 60411). Set, a group that did not answer - every
75
+ * group, every deployment - is said as a group kept quiet about is: a fact in `quietSaid`
76
+ * and the text alike, to mention only if the guest asks about it; no 「重试」, no "do not
77
+ * look again". It stays in `degraded`, which the card draws as a greyed chip, nothing more.
78
+ * Not set where nothing is shown because of it (a search with nothing read), nor for "my
79
+ * bookings" and the rest. A search of the group the guest asked for by name is always that:
80
+ * only that group is asked, so one that did not answer leaves nothing read - and is said.
81
+ */
82
+ hush?: boolean) => {
83
+ structured: Record<string, unknown>;
84
+ said: string;
85
+ };
86
+ /**
87
+ * The groups a search keeps quiet about (`ToolDeps.quietGroups`) - less the one
88
+ * the guest asked for (`filters.supplier`): a list of Accor's own hotels that
89
+ * has none because Accor did not answer says so, with its 「重试」.
90
+ */
91
+ export declare const quietIn: (deps: ToolDeps, asked?: string) => ReadonlySet<string>;
92
+ /**
93
+ * A place no table here knows (`HotelSearchResult.unplaced`), as the sentence the
94
+ * model is told and the field the card draws its own line from.
95
+ *
96
+ * ⚠️ NEVER "N HOTELS IN REYKJAVIK" (总线程 11-04, 0.55.5). Words that name no
97
+ * place this market knows narrow nothing, and the backend answers a place it
98
+ * cannot match with every hotel each group has - so the list is Sanya's,
99
+ * Singapore's, Tokyo's. Said once, in the text and in `structuredContent`
100
+ * alike: a host with no card has only the words.
101
+ */
102
+ export declare const unplacedOf: (deps: ToolDeps, answer: {
103
+ unplaced?: string;
104
+ },
105
+ /** The words were a `city` - or a guest's own words (`query`), a place looked for inside them. */
106
+ asCity: boolean) => {
107
+ structured: Record<string, unknown>;
108
+ said: string;
109
+ };
110
+ /**
111
+ * What is said when a read could not be had because hotel groups did not answer
112
+ * in time - one group, or several, or every one.
113
+ *
114
+ * ⚠️ NEVER JUST THE FIRST GROUP, NEVER "NONE HERE" (2026-11-03 review, C5/C8).
115
+ * Where every group of a market is silent it says so ("no group answered this
116
+ * time"), not the name of whichever was asked first; and in every case it
117
+ * denies the reading a guest would make of silence, that there is nothing.
118
+ */
119
+ export declare const notAnswered: (deps: ToolDeps, key: string, down: Unanswered[],
120
+ /** The answer draws a card, with its 「重试」 - see `askLater`. */
121
+ card: boolean) => ToolAnswer;
122
+ /** "2" is 2: a host that sends a count as a string has not asked for something else. */
123
+ export declare const countsAsNumbers: (args: Record<string, unknown>) => Record<string, unknown>;
124
+ /**
125
+ * Why a count in this call is not one this connector takes - or nothing.
126
+ *
127
+ * ⚠️ REFUSED, NOT QUIETLY MADE INTO SOMETHING ELSE (2026-10-05 audit, P2):
128
+ * six rooms became five, -1 became 1 and a billion became five, and the answer
129
+ * spoke as if that was what had been asked. A guest who asked for six rooms
130
+ * has to hear that five is the most, not be booked five.
131
+ */
132
+ export declare const countProblem: (t: ToolNames, name: string, args: Record<string, unknown>) => string | undefined;
133
+ /**
134
+ * What a backend's refusal says, for the guest - or, when the failure is the
135
+ * code's own, a sentence that says nothing about the code.
136
+ *
137
+ * ⚠️ A REFUSAL IS WORDS FOR THE GUEST; A FAULT IS NOT. Every backend refuses
138
+ * with a plain Error, or one carrying a `code`, and those words are written to
139
+ * be read back ("Nothing was booked: ..."). A TypeError's words - "Cannot read
140
+ * properties of null" - were read back too (2026-10-05 audit); they go to the
141
+ * log now.
142
+ */
143
+ export declare const guestWords: (err: unknown, fault?: string) => string;
144
+ /**
145
+ * A booking's own fault sentence. ⚠️ IT CANNOT SAY "NOTHING WAS CHANGED": the
146
+ * fault may come after the backend has booked (华住's review, 2026-10-05), and
147
+ * a guest told nothing happened books again.
148
+ */
149
+ export declare const BOOKING_FAULT = "It is not certain whether that booked - list the bookings before asking for it again.";
150
+ /** Said when a lookup has missed too often - see limits.ts. */
151
+ export declare const TOO_MANY_TRIES = "Too many codes and emails that did not match, so looking a booking up by email is paused for a quarter of an hour. Check the code and the email on the confirmation, then try again.";
152
+ /**
153
+ * A booking lookup, with any email in it counted as a guess.
154
+ *
155
+ * ⚠️ A CODE AND AN EMAIL ARE ONLY A PAIR WHEN SOMETHING COUNTS THE MISSES. A
156
+ * miss that carried an email is counted against the conversation AND the
157
+ * email; after a few, lookups by email wait (limits.ts). A lookup of this
158
+ * conversation's own booking, with no email, is never counted and never waits.
159
+ */
160
+ export declare const guarded: <T>(deps: ToolDeps, ctx: ToolContext, who: Identity, code: string, run: () => Promise<T | null>) => Promise<{
161
+ found: T | null;
162
+ tooMany: boolean;
163
+ }>;
164
+ //# sourceMappingURL=session-notes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-notes.d.ts","sourceRoot":"","sources":["../../src/tools/session-notes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG3E,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAInE,eAAO,MAAM,QAAQ,GACnB,MAAM,QAAQ,EACd,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,OAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,KACjC,QAwBF,CAAC;AAeF,eAAO,MAAM,UAAU,GAAI,MAAM,QAAQ,KAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAO7D,CAAC;AACF,eAAO,MAAM,QAAQ,GAAI,MAAM,QAAQ,EAAE,GAAG,MAAM,EAAE,QAAQ,MAAM,KAAG,IASpE,CAAC;AAQF,eAAO,MAAM,cAAc,GAAI,MAAM,QAAQ;aADqB,MAAM;WAAS,MAAM;EA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