@curless/hotel-storefront 0.85.0 → 0.86.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.
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/tools/accept-terms.d.ts +4 -0
- package/dist/tools/accept-terms.d.ts.map +1 -0
- package/dist/tools/accept-terms.js +26 -0
- package/dist/tools/accept-terms.js.map +1 -0
- package/dist/tools/add-booking-addon.d.ts +4 -0
- package/dist/tools/add-booking-addon.d.ts.map +1 -0
- package/dist/tools/add-booking-addon.js +44 -0
- package/dist/tools/add-booking-addon.js.map +1 -0
- package/dist/tools/add-to-trip.d.ts +4 -0
- package/dist/tools/add-to-trip.d.ts.map +1 -0
- package/dist/tools/add-to-trip.js +49 -0
- package/dist/tools/add-to-trip.js.map +1 -0
- package/dist/tools/all-tools.d.ts +1342 -0
- package/dist/tools/all-tools.d.ts.map +1 -0
- package/dist/tools/all-tools.js +954 -0
- package/dist/tools/all-tools.js.map +1 -0
- package/dist/tools/answer.d.ts +3 -0
- package/dist/tools/answer.d.ts.map +1 -0
- package/dist/tools/answer.js +104 -0
- package/dist/tools/answer.js.map +1 -0
- package/dist/tools/args.d.ts +149 -0
- package/dist/tools/args.d.ts.map +1 -0
- package/dist/tools/args.js +176 -0
- package/dist/tools/args.js.map +1 -0
- package/dist/tools/base-output-schemas.d.ts +3 -0
- package/dist/tools/base-output-schemas.d.ts.map +1 -0
- package/dist/tools/base-output-schemas.js +380 -0
- package/dist/tools/base-output-schemas.js.map +1 -0
- package/dist/tools/book-picked.d.ts +4 -0
- package/dist/tools/book-picked.d.ts.map +1 -0
- package/dist/tools/book-picked.js +14 -0
- package/dist/tools/book-picked.js.map +1 -0
- package/dist/tools/booking-answer.d.ts +24 -0
- package/dist/tools/booking-answer.d.ts.map +1 -0
- package/dist/tools/booking-answer.js +485 -0
- package/dist/tools/booking-answer.js.map +1 -0
- package/dist/tools/buy-shop-item.d.ts +4 -0
- package/dist/tools/buy-shop-item.d.ts.map +1 -0
- package/dist/tools/buy-shop-item.js +45 -0
- package/dist/tools/buy-shop-item.js.map +1 -0
- package/dist/tools/call.d.ts +11 -0
- package/dist/tools/call.d.ts.map +1 -0
- package/dist/tools/call.js +2 -0
- package/dist/tools/call.js.map +1 -0
- package/dist/tools/cancel-facts.d.ts +281 -0
- package/dist/tools/cancel-facts.d.ts.map +1 -0
- package/dist/tools/cancel-facts.js +309 -0
- package/dist/tools/cancel-facts.js.map +1 -0
- package/dist/tools/cancel.d.ts +4 -0
- package/dist/tools/cancel.d.ts.map +1 -0
- package/dist/tools/cancel.js +364 -0
- package/dist/tools/cancel.js.map +1 -0
- package/dist/tools/card-addons.d.ts +4 -0
- package/dist/tools/card-addons.d.ts.map +1 -0
- package/dist/tools/card-addons.js +76 -0
- package/dist/tools/card-addons.js.map +1 -0
- package/dist/tools/change-booking.d.ts +4 -0
- package/dist/tools/change-booking.d.ts.map +1 -0
- package/dist/tools/change-booking.js +145 -0
- package/dist/tools/change-booking.js.map +1 -0
- package/dist/tools/clear-trip.d.ts +4 -0
- package/dist/tools/clear-trip.d.ts.map +1 -0
- package/dist/tools/clear-trip.js +10 -0
- package/dist/tools/clear-trip.js.map +1 -0
- package/dist/tools/compare.d.ts +4 -0
- package/dist/tools/compare.d.ts.map +1 -0
- package/dist/tools/compare.js +114 -0
- package/dist/tools/compare.js.map +1 -0
- package/dist/tools/current-trip.d.ts +70 -0
- package/dist/tools/current-trip.d.ts.map +1 -0
- package/dist/tools/current-trip.js +261 -0
- package/dist/tools/current-trip.js.map +1 -0
- package/dist/tools/deps.d.ts +229 -0
- package/dist/tools/deps.d.ts.map +1 -0
- package/dist/tools/deps.js +2 -0
- package/dist/tools/deps.js.map +1 -0
- package/dist/tools/follow-ups.d.ts +120 -0
- package/dist/tools/follow-ups.d.ts.map +1 -0
- package/dist/tools/follow-ups.js +369 -0
- package/dist/tools/follow-ups.js.map +1 -0
- package/dist/tools/forget-preferences.d.ts +4 -0
- package/dist/tools/forget-preferences.d.ts.map +1 -0
- package/dist/tools/forget-preferences.js +24 -0
- package/dist/tools/forget-preferences.js.map +1 -0
- package/dist/tools/get-hotel.d.ts +4 -0
- package/dist/tools/get-hotel.d.ts.map +1 -0
- package/dist/tools/get-hotel.js +324 -0
- package/dist/tools/get-hotel.js.map +1 -0
- package/dist/tools/hotel-choices.d.ts +132 -0
- package/dist/tools/hotel-choices.d.ts.map +1 -0
- package/dist/tools/hotel-choices.js +558 -0
- package/dist/tools/hotel-choices.js.map +1 -0
- package/dist/tools/itinerary.d.ts +4 -0
- package/dist/tools/itinerary.d.ts.map +1 -0
- package/dist/tools/itinerary.js +148 -0
- package/dist/tools/itinerary.js.map +1 -0
- package/dist/tools/list-booking-addons.d.ts +4 -0
- package/dist/tools/list-booking-addons.d.ts.map +1 -0
- package/dist/tools/list-booking-addons.js +21 -0
- package/dist/tools/list-booking-addons.js.map +1 -0
- package/dist/tools/list-bookings.d.ts +4 -0
- package/dist/tools/list-bookings.d.ts.map +1 -0
- package/dist/tools/list-bookings.js +119 -0
- package/dist/tools/list-bookings.js.map +1 -0
- package/dist/tools/list-extras.d.ts +4 -0
- package/dist/tools/list-extras.d.ts.map +1 -0
- package/dist/tools/list-extras.js +90 -0
- package/dist/tools/list-extras.js.map +1 -0
- package/dist/tools/list-hotels.d.ts +4 -0
- package/dist/tools/list-hotels.d.ts.map +1 -0
- package/dist/tools/list-hotels.js +891 -0
- package/dist/tools/list-hotels.js.map +1 -0
- package/dist/tools/list-shop-items.d.ts +4 -0
- package/dist/tools/list-shop-items.d.ts.map +1 -0
- package/dist/tools/list-shop-items.js +34 -0
- package/dist/tools/list-shop-items.js.map +1 -0
- package/dist/tools/list-shop-orders.d.ts +4 -0
- package/dist/tools/list-shop-orders.d.ts.map +1 -0
- package/dist/tools/list-shop-orders.js +22 -0
- package/dist/tools/list-shop-orders.js.map +1 -0
- package/dist/tools/look-up.d.ts +4 -0
- package/dist/tools/look-up.d.ts.map +1 -0
- package/dist/tools/look-up.js +170 -0
- package/dist/tools/look-up.js.map +1 -0
- package/dist/tools/output-schemas.d.ts +645 -0
- package/dist/tools/output-schemas.d.ts.map +1 -0
- package/dist/tools/output-schemas.js +503 -0
- package/dist/tools/output-schemas.js.map +1 -0
- package/dist/tools/paid-lines.d.ts +718 -0
- package/dist/tools/paid-lines.d.ts.map +1 -0
- package/dist/tools/paid-lines.js +359 -0
- package/dist/tools/paid-lines.js.map +1 -0
- package/dist/tools/pay-with-union-pay.d.ts +4 -0
- package/dist/tools/pay-with-union-pay.d.ts.map +1 -0
- package/dist/tools/pay-with-union-pay.js +112 -0
- package/dist/tools/pay-with-union-pay.js.map +1 -0
- package/dist/tools/payment-words.d.ts +269 -0
- package/dist/tools/payment-words.d.ts.map +1 -0
- package/dist/tools/payment-words.js +365 -0
- package/dist/tools/payment-words.js.map +1 -0
- package/dist/tools/pick-room.d.ts +4 -0
- package/dist/tools/pick-room.d.ts.map +1 -0
- package/dist/tools/pick-room.js +23 -0
- package/dist/tools/pick-room.js.map +1 -0
- package/dist/tools/policies.d.ts +4 -0
- package/dist/tools/policies.d.ts.map +1 -0
- package/dist/tools/policies.js +74 -0
- package/dist/tools/policies.js.map +1 -0
- package/dist/tools/pricing.d.ts +55 -0
- package/dist/tools/pricing.d.ts.map +1 -0
- package/dist/tools/pricing.js +260 -0
- package/dist/tools/pricing.js.map +1 -0
- package/dist/tools/put-room-line.d.ts +12 -0
- package/dist/tools/put-room-line.d.ts.map +1 -0
- package/dist/tools/put-room-line.js +314 -0
- package/dist/tools/put-room-line.js.map +1 -0
- package/dist/tools/quote-card.d.ts +234 -0
- package/dist/tools/quote-card.d.ts.map +1 -0
- package/dist/tools/quote-card.js +375 -0
- package/dist/tools/quote-card.js.map +1 -0
- package/dist/tools/refund-booking.d.ts +4 -0
- package/dist/tools/refund-booking.d.ts.map +1 -0
- package/dist/tools/refund-booking.js +112 -0
- package/dist/tools/refund-booking.js.map +1 -0
- package/dist/tools/request-booking.d.ts +4 -0
- package/dist/tools/request-booking.d.ts.map +1 -0
- package/dist/tools/request-booking.js +5 -0
- package/dist/tools/request-booking.js.map +1 -0
- package/dist/tools/request-words.d.ts +238 -0
- package/dist/tools/request-words.d.ts.map +1 -0
- package/dist/tools/request-words.js +487 -0
- package/dist/tools/request-words.js.map +1 -0
- package/dist/tools/room-choices.d.ts +64 -0
- package/dist/tools/room-choices.d.ts.map +1 -0
- package/dist/tools/room-choices.js +348 -0
- package/dist/tools/room-choices.js.map +1 -0
- package/dist/tools/session-notes.d.ts +164 -0
- package/dist/tools/session-notes.d.ts.map +1 -0
- package/dist/tools/session-notes.js +412 -0
- package/dist/tools/session-notes.js.map +1 -0
- package/dist/tools/sign-in.d.ts +4 -0
- package/dist/tools/sign-in.d.ts.map +1 -0
- package/dist/tools/sign-in.js +72 -0
- package/dist/tools/sign-in.js.map +1 -0
- package/dist/tools/sign-out.d.ts +4 -0
- package/dist/tools/sign-out.d.ts.map +1 -0
- package/dist/tools/sign-out.js +13 -0
- package/dist/tools/sign-out.js.map +1 -0
- package/dist/tools/terms-answer.d.ts +114 -0
- package/dist/tools/terms-answer.d.ts.map +1 -0
- package/dist/tools/terms-answer.js +475 -0
- package/dist/tools/terms-answer.js.map +1 -0
- package/dist/tools/tool-set.d.ts +1474 -0
- package/dist/tools/tool-set.d.ts.map +1 -0
- package/dist/tools/tool-set.js +497 -0
- package/dist/tools/tool-set.js.map +1 -0
- package/dist/tools/view-trip.d.ts +4 -0
- package/dist/tools/view-trip.d.ts.map +1 -0
- package/dist/tools/view-trip.js +7 -0
- package/dist/tools/view-trip.js.map +1 -0
- package/dist/tools.d.ts +13 -2089
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +11 -10685
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,348 @@
|
|
|
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
|
+
// ⚠️ ONE ROOM'S STAY QUOTED BESIDE OTHERS' NIGHTS (0.76.1, Otaless - H1): where a stay total
|
|
76
|
+
// is ours (`stayTotalUnquoted`) the rooms are put side by side by the group's rate a night,
|
|
77
|
+
// and the one the group priced for the stay says "for the stay".
|
|
78
|
+
const unquoted = rooms.some((r) => r.stayTotalUnquoted);
|
|
79
|
+
const mixed = unquoted && rooms.some((r) => !r.stayTotalUnquoted && !r.hourly);
|
|
80
|
+
const basis = (r) => (unquoted ? r.nightly.minor : r.stayTotal.minor);
|
|
81
|
+
const rows = byRoomType(rooms)
|
|
82
|
+
.map((type) => ({
|
|
83
|
+
type,
|
|
84
|
+
r: type.rooms.reduce((a, b) => (basis(b) < basis(a) ? b : a)),
|
|
85
|
+
}))
|
|
86
|
+
.sort((a, b) => basis(a.r) - basis(b.r))
|
|
87
|
+
.map(({ type, r }) => ({ type, r, others: type.rooms.length - 1 }));
|
|
88
|
+
const many = roomsWanted > 1;
|
|
89
|
+
const price = (r) => r.hourly
|
|
90
|
+
? `${formatMoney(r.stayTotal)} for ${r.hourly.hours} hours`
|
|
91
|
+
: r.stayTotalUnquoted
|
|
92
|
+
? // ⚠️ A NIGHT'S PRICE, NOT OUR TOTAL (总线程 11-13, `Room.stayTotalUnquoted`).
|
|
93
|
+
`${formatMoney(r.nightly)} a night${many ? ', per room' : ''}`
|
|
94
|
+
: many
|
|
95
|
+
? `${formatMoney(multiplyMoney(r.stayTotal, roomsWanted))} for ${roomsWanted} rooms${mixed ? ' for the stay' : ''}`
|
|
96
|
+
: `${formatMoney(r.stayTotal)}${mixed ? ' for the stay' : ''}`;
|
|
97
|
+
// ⚠️ "BEFORE TAXES" ONLY WHERE IT IS SO (0.55.3): see `nightlyIncludesTaxes`.
|
|
98
|
+
//
|
|
99
|
+
// ⚠️ NOT TWICE (0.79.1, Manus 11-19, Otaless's River View Suite: 「可住3人。每晚 $208。」 and, a
|
|
100
|
+
// line under it, 「可住3人 · 每晚 $208」): where the price under the choice IS a night's
|
|
101
|
+
// (`stayTotalUnquoted`) the sentence does not say the night as well. Nor for one night of one
|
|
102
|
+
// room whose night is the stay (0.79.5, `nightIsTheStay`: 「$132 a night.」 + 「Lowest price · $132」).
|
|
103
|
+
const nightly = (r) => r.hourly || r.stayTotalUnquoted || nightIsTheStay(r, roomsWanted)
|
|
104
|
+
? ''
|
|
105
|
+
: `${nightlyPart(r, true)}${many ? ', per room' : ''}`;
|
|
106
|
+
const more = (n) => n ? `${n} more ${n === 1 ? 'rate' : 'rates'} on this room type` : '';
|
|
107
|
+
// Breakfast and terms are said for most as "unless one says otherwise"; the
|
|
108
|
+
// rest only where every one is the same.
|
|
109
|
+
const spread = {
|
|
110
|
+
beds: allOrEach(spreadOf(rows.map(({ r }) => r.beds ?? ''))),
|
|
111
|
+
breakfast: spreadOf(rows.map(({ r }) => breakfastColumn(r))),
|
|
112
|
+
cancel: spreadOf(rows.map(({ r }) => cancelWords(r))),
|
|
113
|
+
labels: allOrEach(spreadOf(rows.map(({ r }) => otherLabelsOf(r)))),
|
|
114
|
+
nightly: allOrEach(spreadOf(rows.map(({ r }) => nightly(r)))),
|
|
115
|
+
more: allOrEach(spreadOf(rows.map(({ others }) => String(others)))),
|
|
116
|
+
price: allOrEach(spreadOf(rows.map(({ r }) => price(r)))),
|
|
117
|
+
};
|
|
118
|
+
const pay = readOnly
|
|
119
|
+
? { said: '', tags: [] }
|
|
120
|
+
: paymentOf(rows.map(({ r }) => payOf(r)), 'room');
|
|
121
|
+
const lowest = Math.min(...rows.map(({ r }) => basis(r)));
|
|
122
|
+
const apart = {
|
|
123
|
+
cheapest: setsApart(rows.map(({ r }) => !r.hourly && basis(r) === lowest)),
|
|
124
|
+
breakfast: setsApart(rows.map(({ r }) => facetsOf(r).breakfast)),
|
|
125
|
+
free: setsApart(rows.map(({ r }) => facetsOf(r).freeCancellation)),
|
|
126
|
+
};
|
|
127
|
+
// ⚠️ A ROOM'S OWN FACTS IN WORDS (0.77.3, Manus 11-19: each line had a name, beds and a price):
|
|
128
|
+
// where the rooms carry what only Huazhu's record adds (Wi-Fi, an extra bed) every type says
|
|
129
|
+
// what the card says - sleeps, size, floor, window, Wi-Fi, extra bed. Only where they do: a group
|
|
130
|
+
// whose rooms carry none of these is told as before, word for word.
|
|
131
|
+
const withFacts = rows.some(({ r }) => r.wifi || r.extraBed);
|
|
132
|
+
const blocks = rows.map(({ type, r, others }, i) => {
|
|
133
|
+
const family = r.sleeps >= FAMILY_SLEEPS ? `sleeps ${r.sleeps}` : '';
|
|
134
|
+
const beds = saysOwn(spread.beds, r.beds ?? '') ? (r.beds ?? '') : '';
|
|
135
|
+
return choiceBlock(i + 1, {
|
|
136
|
+
title: withZh(type.name, r.roomType ? r.roomType.names : r.names, true),
|
|
137
|
+
sentence: sentenceOf([
|
|
138
|
+
// A room for a family says so: "three of us" is chosen by it.
|
|
139
|
+
[beds, ...(withFacts ? roomOwnFacts(r) : [family])]
|
|
140
|
+
.filter(Boolean)
|
|
141
|
+
.join(', '),
|
|
142
|
+
saysOwn(spread.breakfast, breakfastColumn(r)) ? breakfastColumn(r) : '',
|
|
143
|
+
saysOwn(spread.cancel, cancelWords(r)) ? cancelWords(r) : '',
|
|
144
|
+
saysOwn(spread.labels, otherLabelsOf(r)) ? otherLabelsOf(r) : '',
|
|
145
|
+
rows.length < 2 && !readOnly ? PAY_WORDS[payOf(r)] : '',
|
|
146
|
+
r.hourly
|
|
147
|
+
? `starting between ${r.hourly.earliestStart} and ${r.hourly.latestStart} today, out by ${r.hourly.latestEnd}`
|
|
148
|
+
: '',
|
|
149
|
+
[
|
|
150
|
+
saysOwn(spread.nightly, nightly(r)) ? nightly(r) : '',
|
|
151
|
+
saysOwn(spread.more, String(others)) ? more(others) : '',
|
|
152
|
+
]
|
|
153
|
+
.filter(Boolean)
|
|
154
|
+
.join('; '),
|
|
155
|
+
]),
|
|
156
|
+
tags: [
|
|
157
|
+
pay.tags[i] ?? '',
|
|
158
|
+
apart.cheapest && basis(r) === lowest ? 'Lowest price' : '',
|
|
159
|
+
apart.breakfast && facetsOf(r).breakfast ? 'Breakfast' : '',
|
|
160
|
+
apart.free && facetsOf(r).freeCancellation ? 'Free cancellation' : '',
|
|
161
|
+
// ⚠️ NO "Sleeps N" TAG (0.79.1): the sentence above already says it for every room that
|
|
162
|
+
// sleeps that many - the tag said it a second time, a line under.
|
|
163
|
+
].filter(Boolean),
|
|
164
|
+
price: price(r),
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
// What every one has, and what most have, said once before them.
|
|
168
|
+
const first = rows[0]?.r;
|
|
169
|
+
const samePrice = sharedBy(spread.price);
|
|
170
|
+
const shared = [
|
|
171
|
+
sharedBy(spread.beds),
|
|
172
|
+
sharedBy(spread.breakfast),
|
|
173
|
+
sharedBy(spread.cancel),
|
|
174
|
+
sharedBy(spread.labels),
|
|
175
|
+
samePrice ? '' : sharedBy(spread.nightly),
|
|
176
|
+
sharedBy(spread.more) && sharedBy(spread.more) !== '0'
|
|
177
|
+
? `${sharedBy(spread.more)} more ${sharedBy(spread.more) === '1' ? 'rate' : 'rates'} on each`
|
|
178
|
+
: '',
|
|
179
|
+
].filter(Boolean);
|
|
180
|
+
const most = [spread.breakfast, spread.cancel]
|
|
181
|
+
.map((s) => (s.kind === 'most' ? s.value : ''))
|
|
182
|
+
.filter(Boolean);
|
|
183
|
+
const said = [
|
|
184
|
+
first?.hourly
|
|
185
|
+
? "Prices are for each room's hours, taxes and fees included."
|
|
186
|
+
: rows.every(({ r }) => r.stayTotalUnquoted)
|
|
187
|
+
? // ⚠️ NIGHTLY PRICES, NOT STAY PRICES (总线程 11-13, `Room.stayTotalUnquoted`) - and said
|
|
188
|
+
// as not a total (0.76.1, H1).
|
|
189
|
+
'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.'
|
|
190
|
+
: mixed
|
|
191
|
+
? `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.`
|
|
192
|
+
: samePrice && rows.length > 1
|
|
193
|
+
? `All ${rows.length} are ${samePrice}${many ? '' : ' for the stay'}, taxes and fees included${sharedBy(spread.nightly) ? ` (${sharedBy(spread.nightly)})` : ''}.`
|
|
194
|
+
: many
|
|
195
|
+
? `Prices are for ${roomsWanted} rooms for the whole stay, taxes and fees included.`
|
|
196
|
+
: 'Prices are for the stay, taxes and fees included.',
|
|
197
|
+
shared.length ? `Every one: ${shared.join('; ')}.` : '',
|
|
198
|
+
most.length ? `Unless a room says otherwise: ${most.join('; ')}.` : '',
|
|
199
|
+
pay.said,
|
|
200
|
+
readOnly
|
|
201
|
+
? `Nothing can be booked here yet: to book, use these rooms and dates with ${group}, on its own website or app.`
|
|
202
|
+
: '',
|
|
203
|
+
]
|
|
204
|
+
.filter(Boolean)
|
|
205
|
+
.join(' ');
|
|
206
|
+
return {
|
|
207
|
+
said,
|
|
208
|
+
blocks,
|
|
209
|
+
ids: rows.map(({ r }) => r.id),
|
|
210
|
+
// How it is paid, for the model too (0.75.1: no "not booked here" before the guest wants one).
|
|
211
|
+
notes: rows.map(({ r }) => readOnly
|
|
212
|
+
? ''
|
|
213
|
+
: r.notSoldHere
|
|
214
|
+
? 'paid in advance'
|
|
215
|
+
: r.paymentNotConnected
|
|
216
|
+
? `paid in advance, ${UNPAID_TAG}`
|
|
217
|
+
: ''),
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* The ids behind numbered choices, in one line after them (总线程 11-09): with the
|
|
222
|
+
* id on each line - "— room `x`" - the model was to copy the line and drop its
|
|
223
|
+
* end, and on Manus it rewrote the lines and dropped the numbers instead. The
|
|
224
|
+
* choices are the guest's as they stand; this line is the model's - and it
|
|
225
|
+
* marks each one paid in advance too (P1-5), where the choices may say it once
|
|
226
|
+
* for all.
|
|
227
|
+
*/
|
|
228
|
+
export const idsByNumber = (what, ids, from = 1, notes = []) => `${what} ids by number, for your calls - never for the guest: ${ids
|
|
229
|
+
.map((id, i) => `${from + i} = \`${id}\`${notes[i] ? ` (${notes[i]})` : ''}`)
|
|
230
|
+
.join('; ')}.`;
|
|
231
|
+
/**
|
|
232
|
+
* What the assistant is told to do with the choices - in the text and, word for
|
|
233
|
+
* word, in the structure (`roomChoices`): the model reads the structure.
|
|
234
|
+
*/
|
|
235
|
+
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
|
|
236
|
+
? `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)`
|
|
237
|
+
: 'every one'}. The guest answers with a number or by describing one: a number is that room, by the ids after the rooms.`;
|
|
238
|
+
/**
|
|
239
|
+
* Today at a hotel, for the dates offered to a guest who named none: its own
|
|
240
|
+
* date where the backend gives it (`todayThere`); else the sun's, from where it
|
|
241
|
+
* is (15° of longitude an hour - the Otaless backend gives no clock); else UTC's.
|
|
242
|
+
*/
|
|
243
|
+
export const todayOfHotel = (h, now) => {
|
|
244
|
+
if (h.todayThere && isDay(h.todayThere))
|
|
245
|
+
return h.todayThere;
|
|
246
|
+
const lng = h.geo?.lng;
|
|
247
|
+
return typeof lng === 'number' && Number.isFinite(lng)
|
|
248
|
+
? toDay(now + Math.max(-12, Math.min(14, Math.round(lng / 15))) * 3_600_000)
|
|
249
|
+
: toDay(now);
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* What a client that draws no card is told of the night a dateless answer is
|
|
253
|
+
* priced for (robin 11-06: 「日期选择…文字版优化」): tonight, on the hotel's own
|
|
254
|
+
* calendar, said in the reply's first sentence - with this weekend and next by
|
|
255
|
+
* their weekdays and dates (`dateOptions`) as the other choices, in the same
|
|
256
|
+
* sentence. Named, not numbered: the numbers in that reply are the rooms' or the
|
|
257
|
+
* hotels', and "2" has to mean one thing. In the text and, word for word, in the
|
|
258
|
+
* structure (`stayDefault`).
|
|
259
|
+
*/
|
|
260
|
+
export const stayDefaultWords = (today, guests, roomsAsked,
|
|
261
|
+
/** What the reply numbers - the rooms of a hotel, or the hotels of a list. */
|
|
262
|
+
numbers) => {
|
|
263
|
+
const [tonight, ...others] = dateOptions(today);
|
|
264
|
+
const rooms = Math.max(1, Math.min(MAX_ROOMS_PER_LINE, Math.floor(Number(roomsAsked) || 1)));
|
|
265
|
+
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
|
|
266
|
+
.map((o) => `${o.label}, ${dayWords(o.checkIn)} to ${dayWords(o.checkOut)} (${o.nights} nights; checkIn ${o.checkIn}, checkOut ${o.checkOut})`)
|
|
267
|
+
.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.`;
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* The lead, what the rooms share and the choices - in the text and, word for
|
|
271
|
+
* word, in `roomChoices`.
|
|
272
|
+
*
|
|
273
|
+
* `before`: what is said before the list (other arrivals that cost less). Since 0.75.1
|
|
274
|
+
* (robin 11-18) that rates paid in advance cannot be booked here is not among it: it was
|
|
275
|
+
* first since robin's Manus run (11-06, via 总线程), and now it is said when the guest wants
|
|
276
|
+
* one (`notSoldHereWords`).
|
|
277
|
+
*/
|
|
278
|
+
export const roomChoicesOf = (rooms, roomsWanted, when, before, group, readOnly = false) => {
|
|
279
|
+
const c = roomChoicesBlock(rooms, roomsWanted, group, readOnly);
|
|
280
|
+
return [
|
|
281
|
+
...(before ? [before] : []),
|
|
282
|
+
roomChoicesLead(c.blocks.length, when),
|
|
283
|
+
...(c.said ? [c.said] : []),
|
|
284
|
+
// The blank lines are in the strings: the text's lines are joined after
|
|
285
|
+
// empty ones are dropped, and the text and `roomChoices` say the same.
|
|
286
|
+
`\n${c.blocks.join('\n\n')}`,
|
|
287
|
+
`\n${idsByNumber('Room', c.ids, 1, c.notes)}`,
|
|
288
|
+
];
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* What a hotel's rooms look like to the assistant for the nights: one line per
|
|
292
|
+
* type, and with filters only the rates that meet ALL of them. None meeting
|
|
293
|
+
* them is said plainly - which filters were asked, what each leaves on its own
|
|
294
|
+
* - and that the full list is there without them.
|
|
295
|
+
*/
|
|
296
|
+
export const roomsText = (hotelName,
|
|
297
|
+
/** "3 room types for 2026-11-04 to 2026-11-06, 2 guests" - what the rooms are, counted. */
|
|
298
|
+
counted,
|
|
299
|
+
/** "2026-11-04 to 2026-11-06" - when, for the sentence that says none fit. */
|
|
300
|
+
when, enough, roomsWanted, terms, noCards,
|
|
301
|
+
/** The nights as the guest reads them - weekdays first - for a client that draws no card. */
|
|
302
|
+
saidWhen,
|
|
303
|
+
/**
|
|
304
|
+
* What is said before the list to a client that draws no card: other arrivals
|
|
305
|
+
* that cost less (`dateFlex`).
|
|
306
|
+
*/
|
|
307
|
+
before,
|
|
308
|
+
/** The group a stay paid in advance is booked with instead - see `paymentOf`. */
|
|
309
|
+
group = '',
|
|
310
|
+
/** Nothing can be booked here - see `roomChoicesBlock`. */
|
|
311
|
+
readOnly = false) => {
|
|
312
|
+
// A type with several rates is priced from its cheapest: say how to reach another.
|
|
313
|
+
const lines = (rs) => [
|
|
314
|
+
...(noCards
|
|
315
|
+
? roomChoicesOf(rs, roomsWanted, saidWhen ?? when, before, group, readOnly)
|
|
316
|
+
: roomTypeLines(rs, roomsWanted, terms)),
|
|
317
|
+
...siteBookingLines(rs, group || 'the hotel group'),
|
|
318
|
+
...(byRoomType(rs).some((t) => t.rooms.length > 1)
|
|
319
|
+
? [
|
|
320
|
+
noCards
|
|
321
|
+
? // ⚠️ NO CARD LISTS THE OTHERS (2026-11-02 audit, P2-1).
|
|
322
|
+
'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.'
|
|
323
|
+
: '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).',
|
|
324
|
+
]
|
|
325
|
+
: []),
|
|
326
|
+
];
|
|
327
|
+
if (!terms)
|
|
328
|
+
return [`**${hotelName}** · ${counted(enough)}.`, ...lines(enough)];
|
|
329
|
+
const asked = termWords(terms);
|
|
330
|
+
const several = activeKeysOf(terms).length > 1;
|
|
331
|
+
const rates = (n) => `${n} ${n === 1 ? 'rate' : 'rates'}`;
|
|
332
|
+
const matching = enough.filter((r) => matchesTerms(r, terms));
|
|
333
|
+
if (matching.length === 0) {
|
|
334
|
+
const alone = several
|
|
335
|
+
? ` On its own, ${activeKeysOf(terms)
|
|
336
|
+
.map((k) => `${keyWords(k)} fits ${enough.filter((r) => facetsOf(r)[k]).length}`)
|
|
337
|
+
.join(', ')}.`
|
|
338
|
+
: '';
|
|
339
|
+
return [
|
|
340
|
+
`**${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'}.`,
|
|
341
|
+
];
|
|
342
|
+
}
|
|
343
|
+
return [
|
|
344
|
+
`**${hotelName}** · ${counted(matching)}, with ${asked} (${matching.length} of ${rates(enough.length)}).`,
|
|
345
|
+
...lines(matching),
|
|
346
|
+
];
|
|
347
|
+
};
|
|
348
|
+
//# 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,GAAG,CAAC,CAAC;AAEpC,wGAAwG;AACxG,MAAM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AAK,GAAG,OAAO;YACnB,CAAC,CAAC,gBAAgB,YAAY,CAAC,KAAK,CAAC;iBAChC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;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,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