@curless/hotel-storefront 0.74.5 → 0.75.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/index.d.ts +1 -1
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +53 -20
- package/dist/account/index.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/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/legal.d.ts +3 -17
- package/dist/legal.d.ts.map +1 -1
- package/dist/legal.js +88 -4
- package/dist/legal.js.map +1 -1
- package/dist/otaless/backend.d.ts +2 -0
- package/dist/otaless/backend.d.ts.map +1 -1
- package/dist/otaless/backend.js +56 -3
- package/dist/otaless/backend.js.map +1 -1
- package/dist/otaless/booking.d.ts +1 -1
- package/dist/otaless/booking.d.ts.map +1 -1
- package/dist/otaless/booking.js +20 -7
- package/dist/otaless/booking.js.map +1 -1
- package/dist/otaless/client.d.ts +7 -0
- package/dist/otaless/client.d.ts.map +1 -1
- package/dist/otaless/client.js +16 -1
- package/dist/otaless/client.js.map +1 -1
- package/dist/otaless/make.d.ts.map +1 -1
- package/dist/otaless/make.js +17 -0
- package/dist/otaless/make.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +7 -3
- package/dist/server.js.map +1 -1
- package/dist/surface.js +1 -1
- package/dist/surface.js.map +1 -1
- package/dist/tools.d.ts +12 -4
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +139 -45
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -75,6 +75,19 @@ const books = (title, openWorld) => ({
|
|
|
75
75
|
idempotentHint: false,
|
|
76
76
|
openWorldHint: openWorld,
|
|
77
77
|
});
|
|
78
|
+
/**
|
|
79
|
+
* Places an order with the hotel's group - a booking, or the guest's agreement that sends it
|
|
80
|
+
* (0.75.0, T3). `destructiveHint: true`: OpenAI's rule gives it to "an irreversible send or a
|
|
81
|
+
* transaction", and that the group lets a booking be cancelled afterwards is not a reason to
|
|
82
|
+
* say false. Not idempotent: a second call is a second order.
|
|
83
|
+
*/
|
|
84
|
+
const orders = (title, openWorld) => ({
|
|
85
|
+
title,
|
|
86
|
+
readOnlyHint: false,
|
|
87
|
+
destructiveHint: true,
|
|
88
|
+
idempotentHint: false,
|
|
89
|
+
openWorldHint: openWorld,
|
|
90
|
+
});
|
|
78
91
|
const cancels = (title, openWorld) => ({
|
|
79
92
|
title,
|
|
80
93
|
readOnlyHint: false,
|
|
@@ -174,6 +187,14 @@ export const withheldTools = (n, caps) => new Set([
|
|
|
174
187
|
]
|
|
175
188
|
: []),
|
|
176
189
|
]);
|
|
190
|
+
/**
|
|
191
|
+
* Orders are the ACCOUNT'S (Otaless, 0.75.0 T5/T6): the group's own checkout with booking on.
|
|
192
|
+
* A booking is found by the account that made it - never by a confirmation code and the email
|
|
193
|
+
* it was made with - and what it sends the group is the guest's name, phone, email, dates and
|
|
194
|
+
* rooms and nothing else (no requests, arrival time or notes). So no tool lists an `email` to
|
|
195
|
+
* find one, nor a field the order has nowhere to carry. (`groupCheckout` is only ever Otaless's.)
|
|
196
|
+
*/
|
|
197
|
+
export const ordersByAccount = (caps) => !!caps.groupCheckout && !caps.readOnly;
|
|
177
198
|
/**
|
|
178
199
|
* What to tell a guest who wants to book where nothing can be booked yet
|
|
179
200
|
* (`capabilities.readOnly`) - the same words in the instructions and in each
|
|
@@ -351,7 +372,7 @@ const forCapabilities = (tools, n, v, caps) => {
|
|
|
351
372
|
if (t.name === n.requestBooking && caps.groupCheckout)
|
|
352
373
|
out = {
|
|
353
374
|
...out,
|
|
354
|
-
description: `Books the trip's rooms for a named guest through each hotel group's own checkout, one order per stay with the group that stay belongs to. The group may first send its booking terms back for the guest to read and agree to themselves - on the card or on a one-time page, not in the chat - and its payment page, with its host and the time to pay by, is then in the answer. A stay is booked once it is paid; the bookings list says when it has been
|
|
375
|
+
description: `Books the trip's rooms for a named guest through each hotel group's own checkout, one order per stay with the group that stay belongs to. The group may first send its booking terms back for the guest to read and agree to themselves - on the card or on a one-time page, not in the chat - and its payment page, with its host and the time to pay by, is then in the answer. A stay is booked once it is paid; the bookings list says when it has been.`,
|
|
355
376
|
};
|
|
356
377
|
// A market's suppliers book differently - its own description says so.
|
|
357
378
|
if (t.name === n.requestBooking && caps.booking === 'pay-at-hotel' && !v.market) {
|
|
@@ -370,6 +391,39 @@ const forCapabilities = (tools, n, v, caps) => {
|
|
|
370
391
|
};
|
|
371
392
|
}
|
|
372
393
|
}
|
|
394
|
+
// ⚠️ ORDERS ARE THE ACCOUNT'S (0.75.0, T5/T6; OpenAI: only the data that is needed).
|
|
395
|
+
// Old chats and old cards may still send `email`, `requests`, `arrivingAt` or `notes`:
|
|
396
|
+
// the server takes them and ignores them (`ordersByAccount`).
|
|
397
|
+
if (ordersByAccount(caps)) {
|
|
398
|
+
if (t.name === n.listBookings) {
|
|
399
|
+
out = {
|
|
400
|
+
...out,
|
|
401
|
+
// The account's, in any conversation signed in to it (`otaless/booking.ts`
|
|
402
|
+
// `listBookings`: by the sign-in at each order's group) - and nothing when no one is.
|
|
403
|
+
description: `The bookings of the ${v.brand} account signed in here - made in any conversation signed in to it - newest to oldest, with their status, dates and confirmation codes. Nothing is listed when no account is signed in.`,
|
|
404
|
+
inputSchema: (() => {
|
|
405
|
+
const s = without(out.inputSchema, 'email');
|
|
406
|
+
return {
|
|
407
|
+
...s,
|
|
408
|
+
properties: {
|
|
409
|
+
...s.properties,
|
|
410
|
+
booking: {
|
|
411
|
+
...s.properties.booking,
|
|
412
|
+
description: "A confirmation code of this account's",
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
};
|
|
416
|
+
})(),
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
if (t.name === n.previewCancellation || t.name === n.cancelBooking)
|
|
420
|
+
out = { ...out, inputSchema: without(out.inputSchema, 'email') };
|
|
421
|
+
if (t.name === n.requestBooking || t.name === n.bookPicked)
|
|
422
|
+
out = {
|
|
423
|
+
...out,
|
|
424
|
+
inputSchema: without(out.inputSchema, 'requests', 'arrivingAt', 'notes'),
|
|
425
|
+
};
|
|
426
|
+
}
|
|
373
427
|
// ⚠️ ONE CANCEL, WHICH ASKS THE REFUND TOO (0.74.2, robin 11-17): said by the tool
|
|
374
428
|
// itself, for the model in every client - there is no refund tool to reach for.
|
|
375
429
|
if (t.name === n.cancelBooking && caps.refunds && !caps.readOnly)
|
|
@@ -669,7 +723,7 @@ const allTools = (n, v) => {
|
|
|
669
723
|
: v.demo
|
|
670
724
|
? `Makes a booking request for the trip's rooms, for a named guest: it returns a confirmation code and the moment the hold lapses on its own. ${v.brand} does not receive it and no real room is held. No payment is taken and no card is collected. Preferences - a bed type, a floor, a late arrival - ride along on the request.`
|
|
671
725
|
: `Asks ${v.brand} to hold the trip's rooms for a named guest and returns a confirmation code and the moment the hold lapses. No payment is taken and no card is collected; the rooms are held, not paid for. Preferences - a bed type, a floor, a late arrival - ride along on the booking as requests the desk tries to meet.`,
|
|
672
|
-
annotations:
|
|
726
|
+
annotations: orders(v.market ? `Request a booking on ${v.brand}` : `Request a ${v.brand} booking`, open),
|
|
673
727
|
inputSchema: {
|
|
674
728
|
type: 'object',
|
|
675
729
|
properties: {
|
|
@@ -876,7 +930,7 @@ const allTools = (n, v) => {
|
|
|
876
930
|
},
|
|
877
931
|
{
|
|
878
932
|
name: n.itinerary,
|
|
879
|
-
description: `A day-by-day plan (行程) - one card, in an app that draws one - for a trip of several days, or for days a guest asked to have planned (a city with a span of dates and 行程 is one): the days are laid out by where they are spent, and each part of the trip has a ${v.noun} near those days, chosen from the ${v.nounPlural} read up as text.
|
|
933
|
+
description: `A day-by-day plan (行程) - one card, in an app that draws one - for a trip of several days, or for days a guest asked to have planned (a city with a span of dates and 行程 is one): the days are laid out by where they are spent, and each part of the trip has a ${v.noun} near those days, chosen from the ${v.nounPlural} read up as text. Each day carries its own label, an optional note, the moments of the day in order, and the ${v.nounPlural} and add-ons attached to it, with their details filled in from their own records - a ${v.noun} with its photograph and, given dates, the price of its nights. Each stay is marked with whether it is booked, in the trip or only in the plan, and the answer says how many of each. Nothing is added to the trip.`,
|
|
880
934
|
annotations: reads(v.market ? `Lay out an itinerary on ${v.brand}` : `Lay out a ${v.brand} itinerary`, open),
|
|
881
935
|
inputSchema: {
|
|
882
936
|
type: 'object',
|
|
@@ -1067,7 +1121,7 @@ const allTools = (n, v) => {
|
|
|
1067
1121
|
// room comes from differs (`bookTripLines`).
|
|
1068
1122
|
name: n.bookPicked,
|
|
1069
1123
|
description: "The card's own step when the guest submits the booking form for the room they picked with Reserve: books that one room for the named guest, the way a trip's rooms are booked. Leaves the trip as it is.",
|
|
1070
|
-
annotations:
|
|
1124
|
+
annotations: orders(v.market ? `Book the picked room on ${v.brand}` : `Book the picked ${v.brand} room`, open),
|
|
1071
1125
|
inputSchema: {
|
|
1072
1126
|
type: 'object',
|
|
1073
1127
|
properties: {
|
|
@@ -1097,7 +1151,7 @@ const allTools = (n, v) => {
|
|
|
1097
1151
|
// `ref` only says which terms the card was showing.
|
|
1098
1152
|
name: n.acceptTerms,
|
|
1099
1153
|
description: `The card's own step when the guest presses "Agree and continue" under a hotel group's booking terms: it sends the guest's agreement to the terms behind \`ref\` and the stay is then booked with the group. It answers like a booking: the group's payment page, the terms again, or why nothing was booked.`,
|
|
1100
|
-
annotations:
|
|
1154
|
+
annotations: orders(`Agree to booking terms on ${v.brand}`, open),
|
|
1101
1155
|
inputSchema: {
|
|
1102
1156
|
type: 'object',
|
|
1103
1157
|
properties: {
|
|
@@ -1574,6 +1628,8 @@ export const buildOutputSchemas = (n) => ({
|
|
|
1574
1628
|
quietSaid: STR,
|
|
1575
1629
|
/** Nothing found because nothing could be read - every group silent or held back (0.59.0, U4). */
|
|
1576
1630
|
unread: BOOL,
|
|
1631
|
+
/** A group looked up only with a place, chosen with none: it, and the cities it is known to be in (0.74.6). */
|
|
1632
|
+
placeFirst: OBJ,
|
|
1577
1633
|
/** What was asked and not done, in the backend's own sentences - a limit of ours, too. */
|
|
1578
1634
|
unapplied: STRS,
|
|
1579
1635
|
/** In a market: the place asked for, when it was not recognised - the hotels are not that place's (`unplacedOf`). */
|
|
@@ -4196,6 +4252,10 @@ const soldOutTypesOf = (detail, enough, wanted) => {
|
|
|
4196
4252
|
...(left > 0 ? { left } : {}),
|
|
4197
4253
|
}));
|
|
4198
4254
|
};
|
|
4255
|
+
/** A code that opens no booking here: where orders are the account's, no email would have opened it. */
|
|
4256
|
+
const noBookingLike = (deps) => ordersByAccount(deps.backend.capabilities ?? FULL_CAPABILITIES)
|
|
4257
|
+
? 'No booking here matches that code. Only bookings made here by this account are known.'
|
|
4258
|
+
: 'No booking here matches that code. A booking made in another conversation needs the email it was made with.';
|
|
4199
4259
|
const identity = (deps, ctx, key, args = {}) => {
|
|
4200
4260
|
const email = str(args.email);
|
|
4201
4261
|
const member = deps.members.read(key);
|
|
@@ -4360,20 +4420,20 @@ hush = false) => {
|
|
|
4360
4420
|
// In the market's own order: a group kept quiet beside one said softly is one sentence.
|
|
4361
4421
|
const factSilent = all.filter((d) => d.why !== 'needs-place' && (quiet.has(d.supplier) || softly(d)));
|
|
4362
4422
|
const hushedUnplaced = hushed.filter((d) => d.why === 'needs-place');
|
|
4363
|
-
const factOf = all.filter((d) => quiet.has(d.supplier) || softly(d));
|
|
4364
4423
|
const noneOf = (n) => `so none of ${n === 1 ? 'its' : 'their'} ${noun} is in this list`;
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4424
|
+
// ⚠️ A GROUP LOOKED UP ONLY WITH A PLACE IS ONE THE GUEST CAN STILL HAVE (0.74.6, robin 11-17
|
|
4425
|
+
// (a): Accor on the home is a chip, pressed it asks for a country or a city): asked about it,
|
|
4426
|
+
// the model asks which country or city - with the cities it is known to have hotels in.
|
|
4427
|
+
const quietSaid = [
|
|
4428
|
+
factSilent.length
|
|
4429
|
+
? `${listAnd(factSilent.map(named))} did not answer this time, ${noneOf(factSilent.length)}; mention this only if the guest asks about ${listOrWords(factSilent.map(named))}.`
|
|
4430
|
+
: '',
|
|
4431
|
+
hushedUnplaced.length
|
|
4432
|
+
? `${listAnd(hushedUnplaced.map(named))} ${hushedUnplaced.length === 1 ? 'is' : 'are'} looked up only once a country or a city is named, ${noneOf(hushedUnplaced.length)}; if the guest asks about ${listOrWords(hushedUnplaced.map(named))}, ask which country or city${placesWords(hushedUnplaced, named)}.`
|
|
4433
|
+
: '',
|
|
4434
|
+
]
|
|
4435
|
+
.filter(Boolean)
|
|
4436
|
+
.join(' ');
|
|
4377
4437
|
const quietPart = {
|
|
4378
4438
|
...(hushed.length
|
|
4379
4439
|
? {
|
|
@@ -4409,7 +4469,7 @@ hush = false) => {
|
|
|
4409
4469
|
}
|
|
4410
4470
|
if (unplaced.length) {
|
|
4411
4471
|
const one = unplaced.length === 1;
|
|
4412
|
-
parts.push(`${saidOf(unplaced)} ${one ? 'is' : 'are'} looked up only once a country or a city is named - name
|
|
4472
|
+
parts.push(`${saidOf(unplaced)} ${one ? 'is' : 'are'} looked up only once a country or a city is named - ask the guest which country or city${placesWords(unplaced, (d) => withZh(d.name, d.names, noCards))}, and name it to see ${one ? 'its' : 'their'} ${noun}.`);
|
|
4413
4473
|
}
|
|
4414
4474
|
const said = parts.join(' ');
|
|
4415
4475
|
return {
|
|
@@ -4421,6 +4481,18 @@ hush = false) => {
|
|
|
4421
4481
|
said: [said, quietSaid].filter(Boolean).join(' '),
|
|
4422
4482
|
};
|
|
4423
4483
|
};
|
|
4484
|
+
/**
|
|
4485
|
+
* " (Accor has hotels in Singapore, Paris and Tokyo, among others)" - the cities a group looked
|
|
4486
|
+
* up only with a place is known to have hotels in (`Unanswered.places`, 0.74.6), or nothing.
|
|
4487
|
+
*/
|
|
4488
|
+
const placesWords = (groups,
|
|
4489
|
+
/** The group as the rest of the sentence names it (with its Chinese name to a host with no card). */
|
|
4490
|
+
named = (g) => g.name) => {
|
|
4491
|
+
const said = groups
|
|
4492
|
+
.filter((g) => g.places?.length)
|
|
4493
|
+
.map((g) => `${named(g)} has hotels in ${listAnd((g.places ?? []).map((p) => p.name))}`);
|
|
4494
|
+
return said.length ? ` (${said.join('; ')}, among others)` : '';
|
|
4495
|
+
};
|
|
4424
4496
|
/**
|
|
4425
4497
|
* The groups a search keeps quiet about (`ToolDeps.quietGroups`) - less the one
|
|
4426
4498
|
* the guest asked for (`filters.supplier`): a list of Accor's own hotels that
|
|
@@ -7116,7 +7188,25 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
7116
7188
|
// the card offered another city. What was not asked, or not answered, is
|
|
7117
7189
|
// said as that; what our limit held back is said in its own words
|
|
7118
7190
|
// (`unapplied`), which this branch did not read.
|
|
7119
|
-
|
|
7191
|
+
// ⚠️ A GROUP LOOKED UP ONLY WITH A PLACE, CHOSEN WITH NONE (0.74.6, robin 11-17 (a): Accor's
|
|
7192
|
+
// chip on the home): not "nothing could be read" - the page to choose its country or city
|
|
7193
|
+
// on, with the cities it is known to have hotels in (`Unanswered.places`). An older card
|
|
7194
|
+
// draws the empty list it drew before, its words the same.
|
|
7195
|
+
const unplacedGroup = !emptyOfItself && !asked.city && !asked.query && asked.filters?.supplier
|
|
7196
|
+
? answer.degraded?.find((d) => d.supplier === asked.filters?.supplier && d.why === 'needs-place')
|
|
7197
|
+
: undefined;
|
|
7198
|
+
const placeFirst = unplacedGroup
|
|
7199
|
+
? {
|
|
7200
|
+
supplier: unplacedGroup.supplier,
|
|
7201
|
+
name: unplacedGroup.name,
|
|
7202
|
+
...(unplacedGroup.names ? { names: unplacedGroup.names } : {}),
|
|
7203
|
+
places: (unplacedGroup.places ?? []).map((p) => ({
|
|
7204
|
+
name: p.name,
|
|
7205
|
+
...(p.names ? { names: p.names } : {}),
|
|
7206
|
+
})),
|
|
7207
|
+
}
|
|
7208
|
+
: undefined;
|
|
7209
|
+
const unread = !emptyOfItself && !placeFirst && !!degraded.structured.degraded;
|
|
7120
7210
|
const why = pastTheEnd
|
|
7121
7211
|
? `That page is past the end: ${answer.total} match, so \`offset\` 0 to ${answer.total - 1} is where they are.`
|
|
7122
7212
|
: filteredEmpty
|
|
@@ -7125,16 +7215,18 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
7125
7215
|
? `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` : ''}.`
|
|
7126
7216
|
: ceilingEmpty
|
|
7127
7217
|
? `None of the ${answer.beforeCeiling} that match has a room for those nights.`
|
|
7128
|
-
:
|
|
7129
|
-
?
|
|
7130
|
-
:
|
|
7131
|
-
`No ${branded(deps.vocab, deps.vocab.nounPlural)}
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7218
|
+
: placeFirst
|
|
7219
|
+
? `${withZh(placeFirst.name, placeFirst.names, ctx?.noCards)}'s ${deps.vocab.nounPlural} are looked up by country or city, and none was named.`
|
|
7220
|
+
: unread
|
|
7221
|
+
? `No ${branded(deps.vocab, deps.vocab.nounPlural)} could be read this time.`
|
|
7222
|
+
: [
|
|
7223
|
+
`No ${branded(deps.vocab, deps.vocab.nounPlural)} match that.`,
|
|
7224
|
+
// What was tried and also failed is worth a sentence: it tells a
|
|
7225
|
+
// guest the word itself is the problem, not the narrowing.
|
|
7226
|
+
widened ? `${sentence(widened.to)} found nothing either.` : '',
|
|
7227
|
+
]
|
|
7228
|
+
.filter(Boolean)
|
|
7229
|
+
.join(' ');
|
|
7138
7230
|
return {
|
|
7139
7231
|
structured: {
|
|
7140
7232
|
view: 'no-hotels',
|
|
@@ -7149,6 +7241,8 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
7149
7241
|
...degraded.structured,
|
|
7150
7242
|
// Nothing read at all: the card says so, with 「重试」, not "try another city" (U4).
|
|
7151
7243
|
...(unread ? { unread: true } : {}),
|
|
7244
|
+
// The group to choose a place for, and the cities it is known to be in (0.74.6).
|
|
7245
|
+
...(placeFirst ? { placeFirst } : {}),
|
|
7152
7246
|
...(answer.unapplied?.length ? { unapplied: answer.unapplied } : {}),
|
|
7153
7247
|
// Why it is empty, in the words the model is told, so the card says
|
|
7154
7248
|
// the same thing rather than guessing at it.
|
|
@@ -7908,9 +8002,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
7908
8002
|
query: code,
|
|
7909
8003
|
...(tooMany ? { tooMany: true } : {}),
|
|
7910
8004
|
},
|
|
7911
|
-
text: tooMany
|
|
7912
|
-
? TOO_MANY_TRIES
|
|
7913
|
-
: 'No booking here matches that code. A booking made in another conversation needs the email it was made with.',
|
|
8005
|
+
text: tooMany ? TOO_MANY_TRIES : noBookingLike(deps),
|
|
7914
8006
|
};
|
|
7915
8007
|
}
|
|
7916
8008
|
const wanted = booked ? booked.hotelId : str(args.hotel);
|
|
@@ -8241,9 +8333,11 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8241
8333
|
// Read here, before a filter or a spread drops it: the groups whose
|
|
8242
8334
|
// bookings are not in `here` (2026-11-03 review, C5).
|
|
8243
8335
|
const missing = degradedOf(deps, { degraded: here.degraded }, 'bookings', ctx?.noCards);
|
|
8244
|
-
// Elsewhere, only with the code AND the email - see `listBookings`.
|
|
8336
|
+
// Elsewhere, only with the code AND the email - see `listBookings`. Where orders are the
|
|
8337
|
+
// account's (Otaless), the code alone finds this account's own, and an email is not asked.
|
|
8338
|
+
const byAccount = ordersByAccount(deps.backend.capabilities ?? FULL_CAPABILITIES);
|
|
8245
8339
|
const code = str(args.booking);
|
|
8246
|
-
const { found: there, tooMany } = code && str(args.email)
|
|
8340
|
+
const { found: there, tooMany } = code && (str(args.email) || byAccount)
|
|
8247
8341
|
? await guarded(deps, ctx, who, code, () => deps.backend.findBooking(code, who))
|
|
8248
8342
|
: { found: null, tooMany: false };
|
|
8249
8343
|
const bookings = there && !here.some((b) => b.id === there.id) ? [there, ...here] : here;
|
|
@@ -8253,9 +8347,11 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8253
8347
|
const missed = code && !there;
|
|
8254
8348
|
const missLine = tooMany
|
|
8255
8349
|
? TOO_MANY_TRIES
|
|
8256
|
-
:
|
|
8257
|
-
? '
|
|
8258
|
-
:
|
|
8350
|
+
: byAccount
|
|
8351
|
+
? 'No booking of this account matches that confirmation code.'
|
|
8352
|
+
: code && !str(args.email)
|
|
8353
|
+
? 'A booking made elsewhere needs the email it was made with as well as its code.'
|
|
8354
|
+
: 'No booking matches that confirmation code and email. Both are needed, as they are on the confirmation.';
|
|
8259
8355
|
return {
|
|
8260
8356
|
structured: {
|
|
8261
8357
|
view: 'bookings',
|
|
@@ -8277,7 +8373,9 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8277
8373
|
: // ⚠️ NOT "NO BOOKINGS" when a group did not answer: it may hold them.
|
|
8278
8374
|
missing.said
|
|
8279
8375
|
? ''
|
|
8280
|
-
:
|
|
8376
|
+
: byAccount
|
|
8377
|
+
? 'No bookings on this account.'
|
|
8378
|
+
: 'No bookings in this conversation. A booking made elsewhere is found with its confirmation code and the email it was made with.',
|
|
8281
8379
|
missing.said,
|
|
8282
8380
|
]
|
|
8283
8381
|
.filter(Boolean)
|
|
@@ -8409,9 +8507,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8409
8507
|
query: ref,
|
|
8410
8508
|
...(tooMany ? { tooMany: true } : {}),
|
|
8411
8509
|
},
|
|
8412
|
-
text: tooMany
|
|
8413
|
-
? TOO_MANY_TRIES
|
|
8414
|
-
: 'No booking here matches that code. A booking made in another conversation needs the email it was made with.',
|
|
8510
|
+
text: tooMany ? TOO_MANY_TRIES : noBookingLike(deps),
|
|
8415
8511
|
};
|
|
8416
8512
|
}
|
|
8417
8513
|
const stayOf = (x) => ({
|
|
@@ -8539,9 +8635,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8539
8635
|
query: ref,
|
|
8540
8636
|
...(tooMany ? { tooMany: true } : {}),
|
|
8541
8637
|
},
|
|
8542
|
-
text: tooMany
|
|
8543
|
-
? TOO_MANY_TRIES
|
|
8544
|
-
: 'No booking here matches that code. A booking made in another conversation needs the email it was made with.',
|
|
8638
|
+
text: tooMany ? TOO_MANY_TRIES : noBookingLike(deps),
|
|
8545
8639
|
};
|
|
8546
8640
|
}
|
|
8547
8641
|
// What is being cancelled, and on what terms, for the card to say in the
|