@curless/hotel-storefront 0.58.1 → 0.59.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/account/fake-mall.d.ts +19 -0
- package/dist/account/fake-mall.d.ts.map +1 -1
- package/dist/account/fake-mall.js +81 -10
- package/dist/account/fake-mall.js.map +1 -1
- package/dist/account/index.d.ts +75 -3
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +769 -33
- package/dist/account/index.js.map +1 -1
- package/dist/account/mall.d.ts +3 -1
- package/dist/account/mall.d.ts.map +1 -1
- package/dist/account/mall.js +17 -2
- package/dist/account/mall.js.map +1 -1
- package/dist/account/ota-member.d.ts +72 -0
- package/dist/account/ota-member.d.ts.map +1 -0
- package/dist/account/ota-member.js +127 -0
- package/dist/account/ota-member.js.map +1 -0
- package/dist/account/pages.d.ts +99 -4
- package/dist/account/pages.d.ts.map +1 -1
- package/dist/account/pages.js +221 -16
- package/dist/account/pages.js.map +1 -1
- package/dist/account/requests.d.ts +13 -1
- package/dist/account/requests.d.ts.map +1 -1
- package/dist/account/requests.js +2 -1
- package/dist/account/requests.js.map +1 -1
- package/dist/account/store.d.ts +8 -0
- package/dist/account/store.d.ts.map +1 -1
- package/dist/account/store.js.map +1 -1
- package/dist/aggregate/places.d.ts +10 -0
- package/dist/aggregate/places.d.ts.map +1 -1
- package/dist/aggregate/places.js +21 -0
- package/dist/aggregate/places.js.map +1 -1
- package/dist/card.generated.d.ts +1 -1
- package/dist/card.generated.js +2 -2
- package/dist/card.generated.js.map +1 -1
- package/dist/dates.d.ts +33 -0
- package/dist/dates.d.ts.map +1 -1
- package/dist/dates.js +46 -0
- package/dist/dates.js.map +1 -1
- package/dist/otaless/backend.d.ts +28 -0
- package/dist/otaless/backend.d.ts.map +1 -1
- package/dist/otaless/backend.js +330 -84
- package/dist/otaless/backend.js.map +1 -1
- package/dist/otaless/client.d.ts +46 -4
- package/dist/otaless/client.d.ts.map +1 -1
- package/dist/otaless/client.js +138 -35
- package/dist/otaless/client.js.map +1 -1
- package/dist/otaless/limits.d.ts +58 -0
- package/dist/otaless/limits.d.ts.map +1 -0
- package/dist/otaless/limits.js +132 -0
- package/dist/otaless/limits.js.map +1 -0
- package/dist/otaless/make.d.ts.map +1 -1
- package/dist/otaless/make.js +14 -1
- package/dist/otaless/make.js.map +1 -1
- package/dist/present.d.ts +12 -1
- package/dist/present.d.ts.map +1 -1
- package/dist/present.js +27 -1
- package/dist/present.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +54 -35
- package/dist/server.js.map +1 -1
- package/dist/sessions.d.ts +23 -4
- package/dist/sessions.d.ts.map +1 -1
- package/dist/sessions.js +57 -7
- package/dist/sessions.js.map +1 -1
- package/dist/supplier.d.ts +6 -0
- package/dist/supplier.d.ts.map +1 -1
- package/dist/supplier.js.map +1 -1
- package/dist/surface.d.ts +2 -0
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +23 -3
- package/dist/surface.js.map +1 -1
- package/dist/tools.d.ts +2 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +196 -69
- package/dist/tools.js.map +1 -1
- package/dist/trip-ids.d.ts +35 -4
- package/dist/trip-ids.d.ts.map +1 -1
- package/dist/trip-ids.js +87 -19
- package/dist/trip-ids.js.map +1 -1
- package/dist/types.d.ts +35 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { aboutLines } from './about.js';
|
|
2
2
|
import { DEFAULT_PAGE, FULL_CAPABILITIES, LASTING_REQUESTS, MAX_PAGE, REQUEST_KINDS, REQUEST_NOTE_MAX, guestTooLong, notPricedForNoAnswer, unansweredBy, unitWords, } from './backend.js';
|
|
3
3
|
import { usedOnWords } from './coupon-words.js';
|
|
4
|
-
import { MAX_GUESTS, addDays, dateOptions, dayWords, isDay, nights as nightsBetween, stayDayWords, toDay, } from './dates.js';
|
|
4
|
+
import { MAX_GUESTS, addDays, dateOptions, dayWords, isDay, nights as nightsBetween, stayDayWords, toDay, weekendOf, weekendWords, } from './dates.js';
|
|
5
5
|
import { FACILITIES } from './facilities.js';
|
|
6
6
|
import { DESCRIPTION_MAX, POLICY_MAX, hotelName, hotelText } from './fence.js';
|
|
7
7
|
import { clockOf, minutesOf, startProblem, stayWords, windowWords } from './hourly.js';
|
|
8
8
|
import { amountsIn, formatMoney, keepingAmounts, money, multiplyMoney, toMinor } from './money.js';
|
|
9
9
|
import { namedExactly, roomNamesOf, roomTypeNamed, withTraditional } from './names.js';
|
|
10
10
|
import { overlapsOf } from './overlap.js';
|
|
11
|
-
import { MAX_COMPARED, MAX_CONS, MAX_DAYS, MAX_ITEMS_PER_DAY, MAX_MOMENTS, MAX_PROS, buildItinerary, candidatesFor, compareHotels, namesMoreThanOne, } from './present.js';
|
|
11
|
+
import { MAX_COMPARED, MAX_CONS, MAX_DAYS, MAX_ITEMS_PER_DAY, MAX_MOMENTS, MAX_PROS, buildItinerary, candidatesFor, compareHotels, namesMoreThanOne, nightlyIncludesTaxes, } from './present.js';
|
|
12
12
|
import { withReference } from './reference.js';
|
|
13
13
|
import { regionOf } from './regions.js';
|
|
14
14
|
import { FAMILY_SLEEPS, activeKeysOf, byRoomType, facetsOf, keyWords, matchesTerms, optionsOf, roomTermsOf, termWords, } from './room-filters.js';
|
|
@@ -181,6 +181,14 @@ const forCapabilities = (tools, n, v, caps) => {
|
|
|
181
181
|
.filter((t) => !withheld.has(t.name))
|
|
182
182
|
.map((t) => {
|
|
183
183
|
let out = t;
|
|
184
|
+
// ⚠️ NOTHING TO BOOK, SO NO "TO BOOK" (2026-11-09 audit, T3): a read-only
|
|
185
|
+
// deployment's list is for looking through and picking one.
|
|
186
|
+
if (caps.readOnly && t.name === n.listHotels) {
|
|
187
|
+
out = {
|
|
188
|
+
...out,
|
|
189
|
+
description: out.description.replace(`pick one ${v.noun} to book.`, `pick one ${v.noun}.`),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
184
192
|
if (!caps.extras) {
|
|
185
193
|
if (t.name === n.addToTrip) {
|
|
186
194
|
out = {
|
|
@@ -338,8 +346,10 @@ const allTools = (n, v) => {
|
|
|
338
346
|
const open = !v.demo;
|
|
339
347
|
const places = v.hints.places ?? [];
|
|
340
348
|
const stayProps = {
|
|
341
|
-
|
|
342
|
-
|
|
349
|
+
// A weekend in the words a guest says it, as `WEEKEND_WORDS` has it (总线程 11-09:
|
|
350
|
+
// 「这周末」 went in as Saturday night alone).
|
|
351
|
+
checkIn: DATE('The arrival date - for a weekend (周末, this weekend), the Friday'),
|
|
352
|
+
checkOut: DATE('The departure date - the night before it is the last night; for a weekend, the Sunday'),
|
|
343
353
|
guests: {
|
|
344
354
|
type: 'integer',
|
|
345
355
|
minimum: 1,
|
|
@@ -891,7 +901,9 @@ const allTools = (n, v) => {
|
|
|
891
901
|
// 自己的登陆也要改成外链」): the membership number and the surname are typed
|
|
892
902
|
// on our page (account/member-login.ts), never in the chat - so no schema
|
|
893
903
|
// here has a field a model could fill with them.
|
|
894
|
-
|
|
904
|
+
// ⚠️ THE WORDS A GUEST SAYS FOR IT (总线程 11-09): a host that finds tools by
|
|
905
|
+
// searching them (Manus) has 「登录」 to search with.
|
|
906
|
+
description: `Signs a ${v.brand} loyalty member in (log in) for this conversation - ${v.brand} 会员登录 - on ${v.brand}'s own sign-in page: answers with a one-time link and a short code the page shows too, where the guest types their membership number and the surname on it; the chat does not carry them. Once they have, it answers with their tier, their point balance and what the tier takes off the public rate; room rates and trip totals are then quoted at the member rate until they are signed out.`,
|
|
895
907
|
annotations: edits(`Sign in to ${v.brand}`, open),
|
|
896
908
|
inputSchema: {
|
|
897
909
|
type: 'object',
|
|
@@ -1397,6 +1409,10 @@ export const buildOutputSchemas = (n) => ({
|
|
|
1397
1409
|
degraded: ARR,
|
|
1398
1410
|
/** What `degraded` means, as the text says it: not that those groups have none here. */
|
|
1399
1411
|
degradedSaid: STR,
|
|
1412
|
+
/** Nothing found because nothing could be read - every group silent or held back (0.59.0, U4). */
|
|
1413
|
+
unread: BOOL,
|
|
1414
|
+
/** What was asked and not done, in the backend's own sentences - a limit of ours, too. */
|
|
1415
|
+
unapplied: STRS,
|
|
1400
1416
|
/** In a market: the place asked for, when it was not recognised - the hotels are not that place's (`unplacedOf`). */
|
|
1401
1417
|
unplaced: STR,
|
|
1402
1418
|
/** What `unplaced` means, as the text says it. */
|
|
@@ -1650,7 +1666,24 @@ export const buildOutputSchemas = (n) => ({
|
|
|
1650
1666
|
required: ['view'],
|
|
1651
1667
|
},
|
|
1652
1668
|
});
|
|
1653
|
-
|
|
1669
|
+
/** At most `n` characters (code points, so no half of a pair is left), from a string cut short first. */
|
|
1670
|
+
const upTo = (s, n) => s.length <= n
|
|
1671
|
+
? s
|
|
1672
|
+
: Array.from(s.slice(0, n * 2))
|
|
1673
|
+
.slice(0, n)
|
|
1674
|
+
.join('');
|
|
1675
|
+
/**
|
|
1676
|
+
* A string argument, trimmed - and never longer than any field here needs.
|
|
1677
|
+
*
|
|
1678
|
+
* ⚠️ AN ARGUMENT WAS AS LONG AS THE BODY (0.59.0, review C6): a `query` of a
|
|
1679
|
+
* megabyte went whole into the search, the cache key and the request to the
|
|
1680
|
+
* group. Every field is capped here; a place - `query`, `city`, `group` - at
|
|
1681
|
+
* `PLACE_MAX` (`place`), as the Otaless backend caps it (otaless/limits.ts).
|
|
1682
|
+
*/
|
|
1683
|
+
const STR_MAX = 2_000;
|
|
1684
|
+
const PLACE_MAX = 200;
|
|
1685
|
+
const str = (v) => (typeof v === 'string' ? upTo(v, STR_MAX).trim() : '');
|
|
1686
|
+
const place = (v) => upTo(str(v), PLACE_MAX).trim();
|
|
1654
1687
|
const asStay = (args) => {
|
|
1655
1688
|
const checkIn = str(args.checkIn);
|
|
1656
1689
|
const checkOut = str(args.checkOut);
|
|
@@ -2694,7 +2727,7 @@ const planGap = (plan) => {
|
|
|
2694
2727
|
if (booked === planned)
|
|
2695
2728
|
return `All ${planned} are booked - held under their confirmation codes, nothing paid.`;
|
|
2696
2729
|
if (inTrip === planned)
|
|
2697
|
-
return `All ${planned} are in the trip.`;
|
|
2730
|
+
return planned === 1 ? 'It is in the trip.' : `All ${planned} are in the trip.`;
|
|
2698
2731
|
const parts = [
|
|
2699
2732
|
booked ? `${booked} of ${planned} booked` : '',
|
|
2700
2733
|
inTrip || !booked ? `${inTrip} of ${planned} in the trip` : '',
|
|
@@ -2719,7 +2752,7 @@ const offerCount = (rooms) => {
|
|
|
2719
2752
|
/** What one room costs, as the text says it: nights, or the hours of a room by the hour. */
|
|
2720
2753
|
const priceWords = (r, noCards) => r.hourly
|
|
2721
2754
|
? `${formatMoney(r.stayTotal)} for ${r.hourly.hours} hours incl. taxes and fees, starting between ${r.hourly.earliestStart} and ${r.hourly.latestStart} today and out by ${r.hourly.latestEnd}`
|
|
2722
|
-
: `${formatMoney(r.nightly)} ${nightWords(noCards)}, ${formatMoney(r.stayTotal)} for the stay incl. taxes and fees`;
|
|
2755
|
+
: `${formatMoney(r.nightly)} ${nightWords(noCards, nightlyIncludesTaxes(r))}, ${formatMoney(r.stayTotal)} for the stay incl. taxes and fees`;
|
|
2723
2756
|
/**
|
|
2724
2757
|
* "a night" - and to a client that draws no card, "a night before taxes".
|
|
2725
2758
|
*
|
|
@@ -2763,7 +2796,16 @@ const NOT_SOLD_OUT = 'not sold out, and other nights make no difference';
|
|
|
2763
2796
|
* card says no more than 预付 on them (robin, 2026-10-30), so the assistant is
|
|
2764
2797
|
* the one who knows - and says it when the guest wants one.
|
|
2765
2798
|
*/
|
|
2766
|
-
export const notSoldHereWords = (group) => `Rates marked paid in advance are listed as ${group} sells them, but a stay paid in advance cannot be booked here yet; only rates paid at the hotel can be. If the guest wants one, say so plainly - nothing is booked or charged - and
|
|
2799
|
+
export const notSoldHereWords = (group) => `Rates marked paid in advance are listed as ${group} sells them, but a stay paid in advance cannot be booked here yet; only rates paid at the hotel can be. If the guest wants one, say so plainly - nothing is booked or charged - and ${waysOnWords(group, 'a rate paid at the hotel, where this answer lists one')}`;
|
|
2800
|
+
/**
|
|
2801
|
+
* Where a guest goes from a rate paid in advance (总线程 11-09, Manus on Huazhu:
|
|
2802
|
+
* 「选最便宜那个」 was answered "it cannot be booked here" and nothing more,
|
|
2803
|
+
* where claude.ai had said a rate paid at the hotel, or Huazhu's own app or
|
|
2804
|
+
* site). Only what is so: a rate paid at the hotel where the answer has one,
|
|
2805
|
+
* other nights looked up here, and the group's own channels - by name, never a
|
|
2806
|
+
* link to its site (`server.websiteUrl`: a link reads as the official way in).
|
|
2807
|
+
*/
|
|
2808
|
+
const waysOnWords = (group, atHotel) => `give the ways on in the same reply, never stopping at "it cannot be booked here": ${atHotel ? `${atHotel}; ` : ''}other nights, looked up here again; or booking with ${group} directly, in its own app or on its website.`;
|
|
2767
2809
|
/**
|
|
2768
2810
|
* A hotel none of whose rooms are on sale here (`none-on-sale`), said on its page
|
|
2769
2811
|
* with the way out (2026-11-03 review, T5). The page's text had one sentence -
|
|
@@ -2811,7 +2853,7 @@ const roomFactsWords = (r, rate = false) => {
|
|
|
2811
2853
|
/** The cheapest price a rate quotes, as the text says it: "from" a night, or the hours of a block. */
|
|
2812
2854
|
const fromWords = (r, noCards) => r.hourly
|
|
2813
2855
|
? `${formatMoney(r.stayTotal)} for ${r.hourly.hours} hours incl. taxes and fees`
|
|
2814
|
-
: `${formatMoney(r.nightly)} ${nightWords(noCards)}, ${formatMoney(r.stayTotal)} for the stay incl. taxes and fees`;
|
|
2856
|
+
: `${formatMoney(r.nightly)} ${nightWords(noCards, nightlyIncludesTaxes(r))}, ${formatMoney(r.stayTotal)} for the stay incl. taxes and fees`;
|
|
2815
2857
|
/**
|
|
2816
2858
|
* A hotel's rooms for the nights, one line per ROOM TYPE.
|
|
2817
2859
|
*
|
|
@@ -2873,8 +2915,8 @@ const otherLabelWords = (r) => labelWords({ ...r, labels: (r.labels ?? []).filte
|
|
|
2873
2915
|
* One row per ROOM TYPE, cheapest first - name · bed · breakfast · cancelling ·
|
|
2874
2916
|
* the whole stay's total - at its lowest rate, with how many other rates the
|
|
2875
2917
|
* type has: what the card shows a guest who can tap, in a line they can answer
|
|
2876
|
-
* with its number. The room id
|
|
2877
|
-
*
|
|
2918
|
+
* with its number. The room id `addToTrip` takes for that number is not on
|
|
2919
|
+
* the line: the ids follow the lines, in one line of their own (`idsByNumber`). Every row is in the answer, numbered, so "the sixth" is a row
|
|
2878
2920
|
* the model can name when the guest asks for the rest; the guest is shown the
|
|
2879
2921
|
* first `ROOM_CHOICES_SHOWN`, and the others as a count.
|
|
2880
2922
|
*
|
|
@@ -2893,34 +2935,44 @@ const roomChoiceRows = (rooms, roomsWanted) => byRoomType(rooms)
|
|
|
2893
2935
|
const more = others
|
|
2894
2936
|
? `${others} more ${others === 1 ? 'rate' : 'rates'} on this room type`
|
|
2895
2937
|
: '';
|
|
2896
|
-
// ⚠️ "BEFORE TAXES" ONLY WHERE IT IS SO (0.55.3):
|
|
2897
|
-
|
|
2898
|
-
// is "a night" alone.
|
|
2899
|
-
const night = nightWords(true, r.terms !== undefined && r.taxesAndFees.minor === 0);
|
|
2938
|
+
// ⚠️ "BEFORE TAXES" ONLY WHERE IT IS SO (0.55.3): see `nightlyIncludesTaxes`.
|
|
2939
|
+
const night = nightWords(true, nightlyIncludesTaxes(r));
|
|
2900
2940
|
const total = r.hourly
|
|
2901
2941
|
? `${priceWords(r, true)}${more ? ` (${more})` : ''}`
|
|
2902
2942
|
: `${roomsWanted > 1
|
|
2903
2943
|
? `${formatMoney(multiplyMoney(r.stayTotal, roomsWanted))} for ${roomsWanted} rooms, for the stay incl. taxes and fees (${formatMoney(r.nightly)} ${night} a room`
|
|
2904
2944
|
: `${formatMoney(r.stayTotal)} for the stay incl. taxes and fees (${formatMoney(r.nightly)} ${night}`}${more ? `; ${more}` : ''})`;
|
|
2905
|
-
return
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2945
|
+
return {
|
|
2946
|
+
line: `${i + 1}. ${[
|
|
2947
|
+
withZh(type.name, r.roomType ? r.roomType.names : r.names, true),
|
|
2948
|
+
r.beds,
|
|
2949
|
+
// A room for a family says so: "three of us" is chosen by it.
|
|
2950
|
+
r.sleeps >= FAMILY_SLEEPS ? `sleeps ${r.sleeps}` : '',
|
|
2951
|
+
breakfastColumn(r),
|
|
2952
|
+
cancelWords(r),
|
|
2953
|
+
total,
|
|
2954
|
+
]
|
|
2955
|
+
.filter(Boolean)
|
|
2956
|
+
.join(' · ')}${otherLabelWords(r)}`,
|
|
2957
|
+
id: r.id,
|
|
2958
|
+
};
|
|
2916
2959
|
});
|
|
2960
|
+
/**
|
|
2961
|
+
* The ids behind numbered lines, in one line after them (总线程 11-09): with the
|
|
2962
|
+
* id on each line - "— room `x`" - the model was to copy the line and drop its
|
|
2963
|
+
* end, and on Manus it rewrote the lines and dropped the numbers instead. The
|
|
2964
|
+
* lines are now the guest's as they stand; this line is the model's.
|
|
2965
|
+
*/
|
|
2966
|
+
const idsByNumber = (what, ids, from = 1) => `${what} ids by number, for your calls - never for the guest: ${ids
|
|
2967
|
+
.map((id, i) => `${from + i} = \`${id}\``)
|
|
2968
|
+
.join('; ')}.`;
|
|
2917
2969
|
/**
|
|
2918
2970
|
* What the assistant is told to do with `roomChoiceRows` - in the text and,
|
|
2919
2971
|
* word for word, in the structure (`roomChoices`): the model reads the structure.
|
|
2920
2972
|
*/
|
|
2921
|
-
const roomChoicesLead = (types, when) => `Say the dates first, as they are here - ${when} - then
|
|
2973
|
+
const roomChoicesLead = (types, when) => `Say the dates first, as they are here - ${when} - then copy the numbered lines below into your reply as they stand, one line each, each starting with its number ("1.")${types === 1 ? ' - the one line too, as "1."' : ''}; in the guest's language, with every number and figure kept - ${types > ROOM_CHOICES_SHOWN
|
|
2922
2974
|
? `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)`
|
|
2923
|
-
: 'every one'}. The guest answers with a number or by describing one: a number is that line's room.`;
|
|
2975
|
+
: 'every one'}. The guest answers with a number or by describing one: a number is that line's room, by the ids after the lines.`;
|
|
2924
2976
|
/**
|
|
2925
2977
|
* Today at a hotel, for the dates offered to a guest who named none: its own
|
|
2926
2978
|
* date where the backend gives it (`todayThere`); else the sun's, from where it
|
|
@@ -2959,16 +3011,20 @@ numbers) => {
|
|
|
2959
3011
|
* via 总线程): nine Huazhu rates, every one paid in advance, and "none of these can
|
|
2960
3012
|
* be booked here" came after all of them. `before` is that sentence, first.
|
|
2961
3013
|
*/
|
|
2962
|
-
const roomChoicesOf = (rooms, roomsWanted, when, before) =>
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
3014
|
+
const roomChoicesOf = (rooms, roomsWanted, when, before) => {
|
|
3015
|
+
const rows = roomChoiceRows(rooms, roomsWanted);
|
|
3016
|
+
return [
|
|
3017
|
+
...(before ? [before] : []),
|
|
3018
|
+
roomChoicesLead(rows.length, when),
|
|
3019
|
+
...rows.map((r) => r.line),
|
|
3020
|
+
idsByNumber('Room', rows.map((r) => r.id)),
|
|
3021
|
+
];
|
|
3022
|
+
};
|
|
2967
3023
|
/** The sentence said before the rooms where some - or all - of them are paid in advance and not booked here. */
|
|
2968
3024
|
const notSoldFirst = (rooms, notSold) => !notSold
|
|
2969
3025
|
? ''
|
|
2970
3026
|
: rooms.length > 0 && rooms.every((r) => r.notSoldHere)
|
|
2971
|
-
? `Every rate here for these nights is paid in advance, so none of them can be booked here yet - say that first, before the list. ${notSold}`
|
|
3027
|
+
? `Every rate here for these nights is paid in advance, so none of them can be booked here yet and none is paid at the hotel - say that first, before the list. ${notSold}`
|
|
2972
3028
|
: `${notSold} Say it before the list.`;
|
|
2973
3029
|
/**
|
|
2974
3030
|
* What a hotel's rooms look like to the assistant for the nights: one line per
|
|
@@ -3771,7 +3827,7 @@ const filtersOf = (args) => {
|
|
|
3771
3827
|
: [];
|
|
3772
3828
|
const f = {
|
|
3773
3829
|
...(str(args.brand) ? { brand: str(args.brand) } : {}),
|
|
3774
|
-
...(
|
|
3830
|
+
...(place(args.group) ? { supplier: place(args.group) } : {}),
|
|
3775
3831
|
...(facilities.length ? { facilities } : {}),
|
|
3776
3832
|
...(args.freeCancellation === true ? { freeCancellation: true } : {}),
|
|
3777
3833
|
...(args.breakfast === true ? { breakfast: true } : {}),
|
|
@@ -3871,7 +3927,9 @@ export const CITY_PICKER_MIN = 4;
|
|
|
3871
3927
|
* chooses a city first.
|
|
3872
3928
|
*/
|
|
3873
3929
|
export const HOME_LIST_MAX = 6;
|
|
3874
|
-
const suggestionsFor = async (deps, d
|
|
3930
|
+
const suggestionsFor = async (deps, d,
|
|
3931
|
+
// Whose look this is, for a backend that counts its own calls by it (Otaless's limits, C6).
|
|
3932
|
+
who) => {
|
|
3875
3933
|
const view = String(d.view ?? '');
|
|
3876
3934
|
const out = [];
|
|
3877
3935
|
const hotel = d.hotel;
|
|
@@ -3882,7 +3940,7 @@ const suggestionsFor = async (deps, d) => {
|
|
|
3882
3940
|
// The hotel view already has buttons for its add-ons and its policies; the
|
|
3883
3941
|
// one thing it cannot do alone is set it beside the others.
|
|
3884
3942
|
if (view === 'hotel' && hotel && Array.isArray(d.rooms) && d.rooms.length) {
|
|
3885
|
-
const nearby = await deps.backend.searchHotels({ city: hotel.city, limit: 2 });
|
|
3943
|
+
const nearby = await deps.backend.searchHotels({ city: hotel.city, limit: 2 }, who);
|
|
3886
3944
|
if (nearby.total > 1)
|
|
3887
3945
|
out.push({
|
|
3888
3946
|
// The label IS what is sent: a chip that sends more than it says is
|
|
@@ -4040,7 +4098,7 @@ export const handleTool = async (deps, name, rawArgs, ctx) => {
|
|
|
4040
4098
|
const card = !ctx.noCards && name !== deps.tools.lookUp && name !== deps.tools.policies;
|
|
4041
4099
|
return notAnswered(deps, ctx.tripKey ?? tripKey(ctx.session, deps.vocab.brand), down, card);
|
|
4042
4100
|
});
|
|
4043
|
-
const suggestions = await suggestionsFor(deps, answer.structured).catch(() => []);
|
|
4101
|
+
const suggestions = await suggestionsFor(deps, answer.structured, identity(deps, ctx, ctx.tripKey ?? tripKey(ctx.session, deps.vocab.brand))).catch(() => []);
|
|
4044
4102
|
return { answer, suggestions };
|
|
4045
4103
|
});
|
|
4046
4104
|
const { answer, suggestions } = result;
|
|
@@ -4120,7 +4178,11 @@ export const ON_CARD = {
|
|
|
4120
4178
|
* (总线程 11-06, after RollingGo's text answers): the rest are a count.
|
|
4121
4179
|
*/
|
|
4122
4180
|
export const HOTEL_CHOICES_SHOWN = 6;
|
|
4123
|
-
|
|
4181
|
+
// ⚠️ COPIED, NOT RETOLD (总线程 11-09, Manus): told to "tell them as a numbered list",
|
|
4182
|
+
// a model handed one Huazhu hotel wrote it as a sentence with no number, and the
|
|
4183
|
+
// guest's next 「第1家」 had nothing to point at. The lines are the guest's as
|
|
4184
|
+
// they stand, a single one included; the ids are after them, for the model.
|
|
4185
|
+
export const LIST_NOT_DRAWN = `Nothing was drawn: this app shows no cards, so the guest has seen none of these hotels. Copy the numbered lines below into your reply as they stand, in this order and with these numbers, each starting with its number ("1.") - a single line too, as "1."; in the guest's language, with every figure kept and nothing that is not in them - at most ${HOTEL_CHOICES_SHOWN}, and any more as a count the guest can ask for, never a pick of your own. The guest answers with a number or a name; the ids after the lines are for your calls:`;
|
|
4124
4186
|
/**
|
|
4125
4187
|
* One hotel of a list as a line, for a client that shows no cards.
|
|
4126
4188
|
*
|
|
@@ -4172,7 +4234,7 @@ const listedInWords = (h, n, tags = []) => {
|
|
|
4172
4234
|
? `rated ${h.rating.value}/${h.rating.scaleMax}${h.rating.count ? ` from ${h.rating.count} reviews` : ''}`
|
|
4173
4235
|
: '';
|
|
4174
4236
|
const has = h.amenities.slice(0, 3).map(hotelName).filter(Boolean);
|
|
4175
|
-
return `${n}. ${withZh(h.name, h.names?.name, true)}
|
|
4237
|
+
return `${n}. ${withZh(h.name, h.names?.name, true)}${[where, brand, rated]
|
|
4176
4238
|
.filter(Boolean)
|
|
4177
4239
|
.map((x) => ` · ${x}`)
|
|
4178
4240
|
.join('')}${price ? `: ${price}` : ''}${has.length ? `; has ${has.join(', ')}` : ''}${tags.length ? `\n tags: ${tags.join(' · ')}` : ''}`;
|
|
@@ -4240,7 +4302,7 @@ const comparedInWords = (c) => {
|
|
|
4240
4302
|
const p = c.price;
|
|
4241
4303
|
const priced = p
|
|
4242
4304
|
? [
|
|
4243
|
-
`${withZh(p.room, p.roomNames, true)} at ${p.nightly} ${nightWords(true)}, ${p.stayTotal} for the stay incl. taxes and fees`,
|
|
4305
|
+
`${withZh(p.room, p.roomNames, true)} at ${p.nightly} ${nightWords(true, p.nightlyTaxesIn)}, ${p.stayTotal} for the stay incl. taxes and fees`,
|
|
4244
4306
|
p.terms !== undefined
|
|
4245
4307
|
? termsWords(p.terms)
|
|
4246
4308
|
: p.freeCancellationUntil
|
|
@@ -4306,7 +4368,7 @@ const dayNames = (day, words) => {
|
|
|
4306
4368
|
* whose own words name another area's hotel is named here - also for a trip
|
|
4307
4369
|
* shorter than four nights - so the model does not have to find it again.
|
|
4308
4370
|
*/
|
|
4309
|
-
const longStayNudges = async (deps, stays, days) => {
|
|
4371
|
+
const longStayNudges = async (deps, stays, days, who) => {
|
|
4310
4372
|
// The areas the plan already uses are not "other" for any of its stays.
|
|
4311
4373
|
const used = new Set(stays.map((x) => x.area?.toLowerCase()).filter(Boolean));
|
|
4312
4374
|
const out = [];
|
|
@@ -4316,7 +4378,8 @@ const longStayNudges = async (deps, stays, days) => {
|
|
|
4316
4378
|
continue;
|
|
4317
4379
|
let hotels;
|
|
4318
4380
|
try {
|
|
4319
|
-
hotels = (await deps.backend.searchHotels({ city: x.city, limit: MAX_PAGE }))
|
|
4381
|
+
hotels = (await deps.backend.searchHotels({ city: place(x.city), limit: MAX_PAGE }, who))
|
|
4382
|
+
.hotels;
|
|
4320
4383
|
}
|
|
4321
4384
|
catch {
|
|
4322
4385
|
// The plan is already drawn; a city that cannot be read just gets no nudge.
|
|
@@ -4617,14 +4680,25 @@ const putRoomLine = async (deps, t, ctx, key, store, args, detail) => {
|
|
|
4617
4680
|
// ONE ANSWER FOR A ROOM BY THE NIGHT AND A ROOM BY THE HOUR (2026-11-03
|
|
4618
4681
|
// review, C6): the hourly branch put such a room in the trip before this was
|
|
4619
4682
|
// asked, and the guest met the refusal at "Book".
|
|
4620
|
-
const prepaidNotHere = (room, open, stay, when) => {
|
|
4683
|
+
const prepaidNotHere = (room, open, stay, when, wanted = 1) => {
|
|
4621
4684
|
const group = groupNameOf(deps, hotelId);
|
|
4685
|
+
// ⚠️ WITH THEIR PRICES, CHEAPEST FIRST, AND THE WAYS ON SAID (总线程 11-09,
|
|
4686
|
+
// Manus on Huazhu): the names alone and "the other ways on" last, and the
|
|
4687
|
+
// model told the guest only that the room could not be booked here.
|
|
4688
|
+
const priced = [...open].sort((a, b) => a.stayTotal.minor - b.stayTotal.minor);
|
|
4689
|
+
const price = (r) => r.hourly
|
|
4690
|
+
? priceWords(r, true)
|
|
4691
|
+
: wanted > 1
|
|
4692
|
+
? `${formatMoney(multiplyMoney(r.stayTotal, wanted))} for ${wanted} rooms, for the stay incl. taxes and fees`
|
|
4693
|
+
: `${formatMoney(r.stayTotal)} for the stay incl. taxes and fees`;
|
|
4622
4694
|
const said = [
|
|
4623
4695
|
`Nothing was booked or charged: ${room.name} is paid in advance, and a stay paid in advance cannot be booked here yet - only rates paid at the hotel can be.`,
|
|
4624
|
-
|
|
4625
|
-
? `Paid at the hotel at ${detail.hotel.name} ${when}: ${
|
|
4696
|
+
priced.length
|
|
4697
|
+
? `Paid at the hotel at ${detail.hotel.name} ${when}, cheapest first: ${priced.map((r) => `${withZh(r.name, r.roomType ? r.roomType.names : r.names, true)} (\`${r.id}\`) - ${price(r)}`).join('; ')}.`
|
|
4626
4698
|
: `No rate at ${detail.hotel.name} ${when} is paid at the hotel.`,
|
|
4627
|
-
`
|
|
4699
|
+
`Tell the guest that nothing was booked, and ${waysOnWords(group, priced.length
|
|
4700
|
+
? 'the rates paid at the hotel above, by name and price - one of them is booked here as any other room'
|
|
4701
|
+
: undefined)}`,
|
|
4628
4702
|
].join(' ');
|
|
4629
4703
|
return {
|
|
4630
4704
|
structured: {
|
|
@@ -4684,7 +4758,7 @@ const putRoomLine = async (deps, t, ctx, key, store, args, detail) => {
|
|
|
4684
4758
|
checkIn: hourlyRoom.hourly.date,
|
|
4685
4759
|
checkOut: hourlyRoom.hourly.date,
|
|
4686
4760
|
guests: guestsOf(args),
|
|
4687
|
-
}, 'by the hour today');
|
|
4761
|
+
}, 'by the hour today', wantedHere);
|
|
4688
4762
|
}
|
|
4689
4763
|
const bad = startProblem(hourlyRoom.hourly, startTime);
|
|
4690
4764
|
if (bad) {
|
|
@@ -4818,7 +4892,7 @@ const putRoomLine = async (deps, t, ctx, key, store, args, detail) => {
|
|
|
4818
4892
|
// Listed, not booked here - see `prepaidNotHere`.
|
|
4819
4893
|
if (room.notSoldHere) {
|
|
4820
4894
|
const open = dated.rooms.filter((r) => !r.notSoldHere && r.sleeps >= stay.guests && r.roomsLeft >= wanted);
|
|
4821
|
-
return prepaidNotHere(room, open, stay, 'for those nights');
|
|
4895
|
+
return prepaidNotHere(room, open, stay, 'for those nights', wanted);
|
|
4822
4896
|
}
|
|
4823
4897
|
deps.trips.set(store, {
|
|
4824
4898
|
kind: 'room',
|
|
@@ -4871,7 +4945,7 @@ const bookTripLines = async (deps, t, ctx, key, store, args, nothingThere) => {
|
|
|
4871
4945
|
// ⚠️ ONE GROUP AT A TIME, in a market: a booking cannot be all-or-nothing
|
|
4872
4946
|
// across two groups' systems (Marketplace, §6-1). `group` books one
|
|
4873
4947
|
// group's stays and leaves the rest in the trip.
|
|
4874
|
-
const asked = deps.backend.suppliers ?
|
|
4948
|
+
const asked = deps.backend.suppliers ? place(args.group) : '';
|
|
4875
4949
|
const group = asked ? groupNamed(deps, asked) : undefined;
|
|
4876
4950
|
const groupOf = (l) => deps.backend.supplierOf?.(l.hotelId);
|
|
4877
4951
|
const lines = group ? inTrip.filter((l) => groupOf(l) === group.id) : inTrip;
|
|
@@ -5209,8 +5283,8 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
5209
5283
|
// server instructions say otherwise, but a host may not pass them on; this
|
|
5210
5284
|
// answer always reaches the model, so it says it here, after the list.
|
|
5211
5285
|
const forPlans = `A stay of several days with its days to plan (行程, an itinerary) is laid out day by day with ${t.itinerary}, its ${deps.vocab.nounPlural} read up with ${t.lookUp} near where each part of the trip is spent - also right after this list; this list is for a guest looking through ${deps.vocab.nounPlural}.`;
|
|
5212
|
-
const query =
|
|
5213
|
-
const city =
|
|
5286
|
+
const query = place(args.query);
|
|
5287
|
+
const city = place(args.city);
|
|
5214
5288
|
const sort = SORTS.includes(str(args.sort))
|
|
5215
5289
|
? str(args.sort)
|
|
5216
5290
|
: 'group';
|
|
@@ -5610,6 +5684,13 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
5610
5684
|
const capCurrency = answer.currencies[0] ?? cheapest?.currency ?? 'HKD';
|
|
5611
5685
|
const cap = formatMoney(money(toMinor(Number(ceiling), capCurrency), capCurrency));
|
|
5612
5686
|
const pastTheEnd = answer.total > 0 && offset > 0;
|
|
5687
|
+
// ⚠️ NOTHING READ IS NOT "NOTHING MATCHES" (0.59.0, review U4): with every
|
|
5688
|
+
// group silent - or held back by a limit of ours (otaless/limits.ts) - the
|
|
5689
|
+
// answer said "No hotels match that" beside "did not answer in time", and
|
|
5690
|
+
// the card offered another city. What was not asked, or not answered, is
|
|
5691
|
+
// said as that; what our limit held back is said in its own words
|
|
5692
|
+
// (`unapplied`), which this branch did not read.
|
|
5693
|
+
const unread = !pastTheEnd && !filteredEmpty && !ceilingEmpty && !!degraded.structured.degraded;
|
|
5613
5694
|
const why = pastTheEnd
|
|
5614
5695
|
? `That page is past the end: ${answer.total} match, so \`offset\` 0 to ${answer.total - 1} is where they are.`
|
|
5615
5696
|
: filteredEmpty
|
|
@@ -5618,14 +5699,16 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
5618
5699
|
? `Nothing under ${cap} a night. The cheapest that matched is ${first?.name} at ${cheapest ? formatMoney(cheapest) : '-'}${answer.overBudget && answer.overBudget > 1 ? `, of ${answer.overBudget} over the ceiling` : ''}.`
|
|
5619
5700
|
: ceilingEmpty
|
|
5620
5701
|
? `None of the ${answer.beforeCeiling} that match has a room for those nights.`
|
|
5621
|
-
:
|
|
5622
|
-
`No ${branded(deps.vocab, deps.vocab.nounPlural)}
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5702
|
+
: unread
|
|
5703
|
+
? `No ${branded(deps.vocab, deps.vocab.nounPlural)} could be read this time.`
|
|
5704
|
+
: [
|
|
5705
|
+
`No ${branded(deps.vocab, deps.vocab.nounPlural)} match that.`,
|
|
5706
|
+
// What was tried and also failed is worth a sentence: it tells a
|
|
5707
|
+
// guest the word itself is the problem, not the narrowing.
|
|
5708
|
+
widened ? `${sentence(widened.to)} found nothing either.` : '',
|
|
5709
|
+
]
|
|
5710
|
+
.filter(Boolean)
|
|
5711
|
+
.join(' ');
|
|
5629
5712
|
return {
|
|
5630
5713
|
structured: {
|
|
5631
5714
|
view: 'no-hotels',
|
|
@@ -5638,6 +5721,9 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
5638
5721
|
...(widened?.found ? { widened } : {}),
|
|
5639
5722
|
// Nothing found while a group did not answer is not "none here".
|
|
5640
5723
|
...degraded.structured,
|
|
5724
|
+
// Nothing read at all: the card says so, with 「重试」, not "try another city" (U4).
|
|
5725
|
+
...(unread ? { unread: true } : {}),
|
|
5726
|
+
...(answer.unapplied?.length ? { unapplied: answer.unapplied } : {}),
|
|
5641
5727
|
// Why it is empty, in the words the model is told, so the card says
|
|
5642
5728
|
// the same thing rather than guessing at it.
|
|
5643
5729
|
why,
|
|
@@ -5651,8 +5737,10 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
5651
5737
|
beforeFilters: answer.beforeFilters,
|
|
5652
5738
|
}
|
|
5653
5739
|
: // A market's group asked for and with no hotel here (11-05): the card says
|
|
5654
|
-
// which group, and does not send the guest off to "try a city".
|
|
5655
|
-
|
|
5740
|
+
// which group, and does not send the guest off to "try a city". And
|
|
5741
|
+
// nothing read at all (U4): the same search, for the card to ask again
|
|
5742
|
+
// and to say where it looked.
|
|
5743
|
+
asked.filters?.supplier || unread
|
|
5656
5744
|
? { ask: echo(sort) }
|
|
5657
5745
|
: {}),
|
|
5658
5746
|
},
|
|
@@ -5660,6 +5748,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
5660
5748
|
widened?.found ? `Nothing matched ${widened.from}, so this looked in ${widened.to}.` : '',
|
|
5661
5749
|
why,
|
|
5662
5750
|
degraded.said,
|
|
5751
|
+
...(answer.unapplied ?? []),
|
|
5663
5752
|
]
|
|
5664
5753
|
.filter(Boolean)
|
|
5665
5754
|
.join(' '),
|
|
@@ -5735,9 +5824,16 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
5735
5824
|
ask.filters?.hourly && hotels.some((h) => h.forStay?.hours)
|
|
5736
5825
|
? `By the hour, today: each price is that ${deps.vocab.noun}'s cheapest room by the hour, for its hours, taxes included.`
|
|
5737
5826
|
: ask.stay && fromPricesOnly
|
|
5738
|
-
? `No price for ${
|
|
5827
|
+
? `No price for ${ctx.noCards
|
|
5828
|
+
? `${stayDayWords(ask.stay.checkIn, ask.stay.checkOut)} - ${ask.stay.checkIn} to ${ask.stay.checkOut} (open your reply with those nights in one sentence, by weekday and date) -`
|
|
5829
|
+
: `${ask.stay.checkIn} to ${ask.stay.checkOut}`} is available here: each price is the ${deps.vocab.noun}'s from-price a night, not a total for the stay. Say so; do not quote a stay total.`
|
|
5739
5830
|
: ask.stay
|
|
5740
|
-
? `Priced for ${
|
|
5831
|
+
? `Priced for ${
|
|
5832
|
+
// ⚠️ THE NIGHTS BY THEIR WEEKDAYS, SAID FIRST (总线程 11-09, Manus: a
|
|
5833
|
+
// list for 「这周末」 came back and the reply never said which nights).
|
|
5834
|
+
ctx.noCards
|
|
5835
|
+
? `${stayDayWords(ask.stay.checkIn, ask.stay.checkOut)} - ${ask.stay.checkIn} to ${ask.stay.checkOut}, ${ask.stay.guests} ${ask.stay.guests === 1 ? 'guest' : 'guests'} (open your reply with those nights in one sentence, by weekday and date)`
|
|
5836
|
+
: `${ask.stay.checkIn} to ${ask.stay.checkOut}`}${ask.rooms && ask.rooms > 1 ? `, ${ask.rooms} rooms` : ''}: each price is that ${deps.vocab.noun}'s cheapest room for the whole stay, taxes included${hotels.some((h) => h.noRoomsForStay && h.noRoomsForStayCode !== 'none-on-sale')
|
|
5741
5837
|
? `; ${hotels.filter((h) => h.noRoomsForStay && h.noRoomsForStayCode !== 'none-on-sale').length} in this answer have no room for those nights`
|
|
5742
5838
|
: ''}${
|
|
5743
5839
|
// The other kind, said as its own (U11): other nights will not help.
|
|
@@ -5749,7 +5845,16 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
5749
5845
|
// A price on the list that is not booked here (`notSoldHere`): said as on
|
|
5750
5846
|
// the hotel's page, in both - see `notSoldHereWords`.
|
|
5751
5847
|
const notSoldOn = hotels.find((h) => h.forStay?.notSoldHere);
|
|
5752
|
-
|
|
5848
|
+
// ⚠️ EVERY PRICE LISTED PAID IN ADVANCE IS SAID FIRST (总线程 11-09, Manus on
|
|
5849
|
+
// Huazhu's production): one hotel, its one price paid in advance, and the
|
|
5850
|
+
// guest's 「选最便宜那个」 met "it cannot be booked here" and nothing more.
|
|
5851
|
+
const pricedHere = hotels.filter((h) => h.forStay);
|
|
5852
|
+
const allPrepaid = pricedHere.length > 0 && pricedHere.every((h) => h.forStay?.notSoldHere);
|
|
5853
|
+
const notSold = notSoldOn
|
|
5854
|
+
? `${allPrepaid
|
|
5855
|
+
? `Every price in this list is a rate paid in advance, which cannot be booked here - say that first, before the list. A ${deps.vocab.noun}'s own page (${deps.tools.getHotel}) lists the rates it has paid at the hotel, if it has any. `
|
|
5856
|
+
: ''}${notSoldHereWords(groupNameOf(deps, notSoldOn.id))}`
|
|
5857
|
+
: '';
|
|
5753
5858
|
if (notSold)
|
|
5754
5859
|
priceNotes.push(notSold);
|
|
5755
5860
|
// To a client that draws no card, the hotels as numbered lines - numbered
|
|
@@ -5757,7 +5862,10 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
5757
5862
|
// text and, word for word, in the structure (`hotelChoices`).
|
|
5758
5863
|
const tagsOf = ctx.noCards ? listTagsOf(hotels) : [];
|
|
5759
5864
|
const hotelChoices = ctx.noCards && hotels.length
|
|
5760
|
-
?
|
|
5865
|
+
? [
|
|
5866
|
+
...hotels.map((h, i) => listedInWords(h, offset + i + 1, tagsOf[i])),
|
|
5867
|
+
idsByNumber('Hotel', hotels.map((h) => h.id), offset + 1),
|
|
5868
|
+
].join('\n')
|
|
5761
5869
|
: '';
|
|
5762
5870
|
// …and, asked without dates, what its prices are - first of the notes.
|
|
5763
5871
|
const fromPrices = ctx.noCards && hotels.length && !ask.stay && !ask.filters?.hourly
|
|
@@ -5765,6 +5873,14 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
5765
5873
|
: '';
|
|
5766
5874
|
if (fromPrices)
|
|
5767
5875
|
priceNotes.unshift(fromPrices);
|
|
5876
|
+
// ⚠️ 「这周末」 WORKED OUT AS SATURDAY NIGHT (总线程 11-09) is said first, in
|
|
5877
|
+
// both - see `weekendOf`.
|
|
5878
|
+
const weekendFor = ask.stay && !ask.filters?.hourly && hotels.length
|
|
5879
|
+
? weekendOf(ask.stay.checkIn, ask.stay.checkOut, today?.min ?? todayOfHotel(hotels[0], deps.trips.now()))
|
|
5880
|
+
: null;
|
|
5881
|
+
const weekend = weekendFor ? weekendWords(weekendFor) : '';
|
|
5882
|
+
if (weekend)
|
|
5883
|
+
priceNotes.unshift(weekend);
|
|
5768
5884
|
// Every one by name and city, and that there are no others - or, told
|
|
5769
5885
|
// only "2 hotels", the model asked for the list again to learn which.
|
|
5770
5886
|
const degraded = degradedOf(deps, answer, undefined, ctx?.noCards);
|
|
@@ -5814,6 +5930,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
5814
5930
|
// not a new one - and a place chip keeps the order the guest chose.
|
|
5815
5931
|
ask: echo(applied),
|
|
5816
5932
|
...(ask.stay ? { stay: ask.stay } : {}),
|
|
5933
|
+
...(weekend ? { weekend } : {}),
|
|
5817
5934
|
...(fromPricesOnly ? { fromPricesOnly: true } : {}),
|
|
5818
5935
|
...(answer.refine
|
|
5819
5936
|
? { refine: refineFor(answer.refine, asked.filters, total, !!ask.stay) }
|
|
@@ -6076,11 +6193,18 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
6076
6193
|
const roomChoices = ctx.noCards && choosable.length
|
|
6077
6194
|
? roomChoicesOf(choosable, roomsWanted, saidWhen, before).join('\n')
|
|
6078
6195
|
: undefined;
|
|
6196
|
+
// ⚠️ 「这周末」 WORKED OUT AS SATURDAY NIGHT (总线程 11-09, claude.ai and Manus
|
|
6197
|
+
// both) is said back first, in both - see `weekendOf`.
|
|
6198
|
+
const weekendFor = byTheHour
|
|
6199
|
+
? null
|
|
6200
|
+
: weekendOf(stay.checkIn, stay.checkOut, todayOfHotel(h, deps.trips.now()));
|
|
6201
|
+
const weekend = weekendFor ? weekendWords(weekendFor) : '';
|
|
6079
6202
|
return {
|
|
6080
6203
|
structured: {
|
|
6081
6204
|
view: 'hotel',
|
|
6082
6205
|
...base,
|
|
6083
6206
|
stay,
|
|
6207
|
+
...(weekend ? { weekend } : {}),
|
|
6084
6208
|
...(roomChoices ? { roomChoices } : {}),
|
|
6085
6209
|
rooms,
|
|
6086
6210
|
rooms_wanted: roomsWanted,
|
|
@@ -6094,6 +6218,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
6094
6218
|
...(ctx.drawsCards && enough.length ? { cardShows: ON_CARD.rooms } : {}),
|
|
6095
6219
|
},
|
|
6096
6220
|
text: [
|
|
6221
|
+
weekend,
|
|
6097
6222
|
memberRates?.said ?? '',
|
|
6098
6223
|
...roomsText(ctx.noCards ? withZh(h.name, h.names?.name, true) : h.name, byTheHour
|
|
6099
6224
|
? (rs) => `${rs.length} ${rs.length === 1 ? 'room' : 'rooms'} by the hour for today, ${stay.checkIn}, ${stay.guests} guests`
|
|
@@ -6120,7 +6245,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
6120
6245
|
.map((x) => str(x))
|
|
6121
6246
|
.filter(Boolean)
|
|
6122
6247
|
.slice(0, LOOK_UP_MAX);
|
|
6123
|
-
const city =
|
|
6248
|
+
const city = place(args.city);
|
|
6124
6249
|
const ids = [];
|
|
6125
6250
|
const dropped = [];
|
|
6126
6251
|
/** For each name that fits more than one, which ones - see `namesLike`. */
|
|
@@ -7099,7 +7224,9 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
7099
7224
|
// the model `structuredContent` rather than the text never saw what the
|
|
7100
7225
|
// text said of a long stay. The model's part of the answer is the same on
|
|
7101
7226
|
// either side.
|
|
7102
|
-
const nudges = stays.length
|
|
7227
|
+
const nudges = stays.length
|
|
7228
|
+
? await longStayNudges(deps, stayItems, plan.days, identity(deps, ctx, key))
|
|
7229
|
+
: [];
|
|
7103
7230
|
// Two hotels on the same nights of the plan - said, never refused (overlap.ts).
|
|
7104
7231
|
const overlaps = overlapsOf(stayItems.flatMap((x) => x.checkIn && x.checkOut
|
|
7105
7232
|
? [{ hotelId: x.id, name: hotelName(x.name), checkIn: x.checkIn, checkOut: x.checkOut }]
|