@curless/hotel-storefront 0.83.0 → 0.84.1
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/addon-pages.d.ts +1 -0
- package/dist/account/addon-pages.d.ts.map +1 -1
- package/dist/account/addon-pages.js +6 -1
- package/dist/account/addon-pages.js.map +1 -1
- package/dist/account/index.d.ts +42 -0
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +84 -16
- package/dist/account/index.js.map +1 -1
- package/dist/account/page-words.d.ts +5 -0
- package/dist/account/page-words.d.ts.map +1 -0
- package/dist/account/page-words.js +10 -0
- package/dist/account/page-words.js.map +1 -0
- package/dist/account/store.js +3 -3
- package/dist/account/store.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 +10 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/legal.d.ts.map +1 -1
- package/dist/legal.js +4 -3
- package/dist/legal.js.map +1 -1
- package/dist/money.d.ts +2 -0
- package/dist/money.d.ts.map +1 -1
- package/dist/money.js +14 -1
- package/dist/money.js.map +1 -1
- package/dist/otaless/addons-answers.d.ts +18 -1
- package/dist/otaless/addons-answers.d.ts.map +1 -1
- package/dist/otaless/addons-answers.js +51 -5
- package/dist/otaless/addons-answers.js.map +1 -1
- package/dist/otaless/addons.d.ts +25 -4
- package/dist/otaless/addons.d.ts.map +1 -1
- package/dist/otaless/addons.js +78 -0
- package/dist/otaless/addons.js.map +1 -1
- package/dist/otaless/make.d.ts.map +1 -1
- package/dist/otaless/make.js +7 -0
- package/dist/otaless/make.js.map +1 -1
- package/dist/otaless/shop-answers.d.ts +43 -2
- package/dist/otaless/shop-answers.d.ts.map +1 -1
- package/dist/otaless/shop-answers.js +167 -23
- package/dist/otaless/shop-answers.js.map +1 -1
- package/dist/otaless/shop-fake.d.ts +5 -0
- package/dist/otaless/shop-fake.d.ts.map +1 -1
- package/dist/otaless/shop-fake.js +2 -0
- package/dist/otaless/shop-fake.js.map +1 -1
- package/dist/otaless/shop-record.d.ts +24 -0
- package/dist/otaless/shop-record.d.ts.map +1 -0
- package/dist/otaless/shop-record.js +128 -0
- package/dist/otaless/shop-record.js.map +1 -0
- package/dist/otaless/shop-service.d.ts +13 -0
- package/dist/otaless/shop-service.d.ts.map +1 -1
- package/dist/otaless/shop-service.js +58 -4
- package/dist/otaless/shop-service.js.map +1 -1
- package/dist/otaless/shop.d.ts +45 -0
- package/dist/otaless/shop.d.ts.map +1 -1
- package/dist/otaless/shop.js +136 -1
- package/dist/otaless/shop.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +116 -7
- package/dist/server.js.map +1 -1
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +5 -1
- package/dist/surface.js.map +1 -1
- package/dist/tools.d.ts +80 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +206 -22
- package/dist/tools.js.map +1 -1
- package/dist/trip-ids.d.ts +9 -1
- package/dist/trip-ids.d.ts.map +1 -1
- package/dist/trip-ids.js +23 -1
- package/dist/trip-ids.js.map +1 -1
- package/package.json +1 -1
package/dist/tools.d.ts
CHANGED
|
@@ -1167,6 +1167,43 @@ export declare const buildTools: (n: ToolNames, v: Vocabulary, caps?: BackendCap
|
|
|
1167
1167
|
date?: undefined;
|
|
1168
1168
|
partySize?: undefined;
|
|
1169
1169
|
shownTotal?: undefined;
|
|
1170
|
+
order?: undefined;
|
|
1171
|
+
shownUnit?: undefined;
|
|
1172
|
+
press?: undefined;
|
|
1173
|
+
};
|
|
1174
|
+
required?: undefined;
|
|
1175
|
+
};
|
|
1176
|
+
} | {
|
|
1177
|
+
name: string;
|
|
1178
|
+
description: string;
|
|
1179
|
+
annotations: {
|
|
1180
|
+
readonly title: string;
|
|
1181
|
+
readonly readOnlyHint: true;
|
|
1182
|
+
readonly destructiveHint: false;
|
|
1183
|
+
readonly idempotentHint: true;
|
|
1184
|
+
readonly openWorldHint: boolean;
|
|
1185
|
+
};
|
|
1186
|
+
inputSchema: {
|
|
1187
|
+
type: string;
|
|
1188
|
+
properties: {
|
|
1189
|
+
query?: undefined;
|
|
1190
|
+
category?: undefined;
|
|
1191
|
+
maxPrice?: undefined;
|
|
1192
|
+
item?: undefined;
|
|
1193
|
+
option?: undefined;
|
|
1194
|
+
quantity?: undefined;
|
|
1195
|
+
booking?: undefined;
|
|
1196
|
+
unitPrice?: undefined;
|
|
1197
|
+
currency?: undefined;
|
|
1198
|
+
action?: undefined;
|
|
1199
|
+
catalogId?: undefined;
|
|
1200
|
+
direction?: undefined;
|
|
1201
|
+
flightNo?: undefined;
|
|
1202
|
+
pickupTime?: undefined;
|
|
1203
|
+
date?: undefined;
|
|
1204
|
+
partySize?: undefined;
|
|
1205
|
+
shownTotal?: undefined;
|
|
1206
|
+
order?: undefined;
|
|
1170
1207
|
shownUnit?: undefined;
|
|
1171
1208
|
press?: undefined;
|
|
1172
1209
|
};
|
|
@@ -1223,6 +1260,7 @@ export declare const buildTools: (n: ToolNames, v: Vocabulary, caps?: BackendCap
|
|
|
1223
1260
|
date?: undefined;
|
|
1224
1261
|
partySize?: undefined;
|
|
1225
1262
|
shownTotal?: undefined;
|
|
1263
|
+
order?: undefined;
|
|
1226
1264
|
shownUnit?: undefined;
|
|
1227
1265
|
press?: undefined;
|
|
1228
1266
|
};
|
|
@@ -1291,6 +1329,10 @@ export declare const buildTools: (n: ToolNames, v: Vocabulary, caps?: BackendCap
|
|
|
1291
1329
|
type: string;
|
|
1292
1330
|
description: string;
|
|
1293
1331
|
};
|
|
1332
|
+
order: {
|
|
1333
|
+
type: string;
|
|
1334
|
+
description: string;
|
|
1335
|
+
};
|
|
1294
1336
|
option: {
|
|
1295
1337
|
type: string;
|
|
1296
1338
|
description: string;
|
|
@@ -1364,6 +1406,14 @@ export declare const readOnlyWords: (v: Pick<Vocabulary, "brand" | "noun">) => s
|
|
|
1364
1406
|
* asks to book, in one sentence.
|
|
1365
1407
|
*/
|
|
1366
1408
|
export declare const notBookableWords: (v: Pick<Vocabulary, "brand" | "noun">) => string;
|
|
1409
|
+
/**
|
|
1410
|
+
* The value-added service orders tool (0.84.1). ⚠️ Says what it reads, in the words a guest uses for it
|
|
1411
|
+
* (增值服务订单, 商城订单, shop orders, add-on orders - one thing), and that they are not hotel bookings;
|
|
1412
|
+
* names no other tool and tells the model nothing to do (listing.ts).
|
|
1413
|
+
*/
|
|
1414
|
+
export declare const SHOP_ORDERS_DESCRIPTION = "The value-added service orders (\u589E\u503C\u670D\u52A1\u8BA2\u5355) of the Otaless account signed in here: goods bought from the Otaless shop to go with a stay - not hotel bookings. \u589E\u503C\u670D\u52A1\u8BA2\u5355, \u5546\u57CE\u8BA2\u5355, shop orders and add-on orders are all the same thing. Each order comes with its item, total and currency, status, order id, the hotel booking it was bought with where that is known, and when it was ordered and paid where that is known (in UTC); cancelled ones are listed as the shop has them. It only reads: nothing is ordered, paid or cancelled. Nothing is listed when no account is signed in.";
|
|
1415
|
+
/** Said by the bookings list where the shop is on (0.84.1). */
|
|
1416
|
+
export declare const SHOP_ORDERS_IN_BOOKINGS = "Value-added service orders (\u589E\u503C\u670D\u52A1\u8BA2\u5355 - the same as shop orders or add-on orders) are not hotel bookings: here each one shows under the hotel booking it was bought with, and one that matches none under other value-added service orders; the account's value-added service orders tool lists them all on their own, with their times.";
|
|
1367
1417
|
/**
|
|
1368
1418
|
* The output schemas with what this backend never fills taken out.
|
|
1369
1419
|
*
|
|
@@ -1490,6 +1540,18 @@ export type ToolDeps = {
|
|
|
1490
1540
|
url: string;
|
|
1491
1541
|
expiresAt: string;
|
|
1492
1542
|
} | undefined;
|
|
1543
|
+
/**
|
|
1544
|
+
* 0.84.0 (`data.fullCurrency`, 总线程's task 7): every amount an answer writes in words names its
|
|
1545
|
+
* whole currency - US$, CN¥ (money.ts `inFullCurrency`). Absent: as `formatMoney` always wrote them.
|
|
1546
|
+
*/
|
|
1547
|
+
fullCurrency?: boolean;
|
|
1548
|
+
/**
|
|
1549
|
+
* 0.84.0 (`account.cookieSameSite: "Lax"`, robin 11-24 「改回登录」): a link to our pages clicked in
|
|
1550
|
+
* the chat carries the account cookie, so the words a client that draws no card is given for one
|
|
1551
|
+
* say it opens signed in in the guest's own browser, and is theirs alone to press
|
|
1552
|
+
* (account/page-words.ts). Absent: the words are as they were.
|
|
1553
|
+
*/
|
|
1554
|
+
accountCookieLax?: boolean;
|
|
1493
1555
|
/**
|
|
1494
1556
|
* 0.82.0: where the guest links their shop account (the account's link tool and the shop's
|
|
1495
1557
|
* group code, `account.memberships` with `via: "addon"`) - only where that entry is configured.
|
|
@@ -1902,6 +1964,20 @@ export declare const HOME_LIST_MAX = 6;
|
|
|
1902
1964
|
* assistant's next answer hands the card.
|
|
1903
1965
|
*/
|
|
1904
1966
|
export declare const tripGone: (deps: ToolDeps) => ToolAnswer;
|
|
1967
|
+
/**
|
|
1968
|
+
* ⚠️ A CARD DRAWN BEFORE THE SIGN-IN, PRESSED AFTER IT (0.84.0; walkthrough 11-24 #5). Since a sign-in
|
|
1969
|
+
* the conversation's trip goes by a new id, handed only to the card that started the sign-in (0.75.1,
|
|
1970
|
+
* P1-a - `renewedAway` in server.ts): any other card from before it can no longer act on the trip. That
|
|
1971
|
+
* is by design and STAYS - this only says what happened, instead of `tripGone`'s "updated, or quiet for
|
|
1972
|
+
* a long time", which was not true a few minutes after a sign-in. Still `trip-gone` (a card holding the
|
|
1973
|
+
* sign-in's claim asks again with it, as before), with `renewed: true` for the card's own words.
|
|
1974
|
+
*/
|
|
1975
|
+
export declare const tripRenewed: (deps: ToolDeps, o?: {
|
|
1976
|
+
pressed: "sign-in" | "book" | "other";
|
|
1977
|
+
signedIn: boolean;
|
|
1978
|
+
/** 0.84.1: what voided the card's id - a sign-in (before `account.signInKeepsCards`) or a sign-out. */
|
|
1979
|
+
why?: "sign-in" | "sign-out";
|
|
1980
|
+
}) => ToolAnswer;
|
|
1905
1981
|
/**
|
|
1906
1982
|
* The guest's agreement to the terms behind `ref`, and what it came to: the
|
|
1907
1983
|
* booking (with its payment page), the group's terms again, or a refusal's
|
|
@@ -1924,6 +2000,10 @@ export declare const identityFor: (deps: ToolDeps, key: string) => Identity;
|
|
|
1924
2000
|
export declare const bookingRefusal: (deps: ToolDeps, key: string, err: unknown) => (ToolAnswer & {
|
|
1925
2001
|
isError?: boolean;
|
|
1926
2002
|
}) | undefined;
|
|
2003
|
+
/**
|
|
2004
|
+
* A tool's answer - every amount in it written with its whole currency where the deployment says so
|
|
2005
|
+
* (`fullCurrency`, 0.84.0), else exactly as before.
|
|
2006
|
+
*/
|
|
1927
2007
|
export declare const handleTool: (deps: ToolDeps, name: string, rawArgs: unknown, ctx: ToolContext) => Promise<ToolAnswer>;
|
|
1928
2008
|
/**
|
|
1929
2009
|
* Every plan's answer ends with this: the card is the plan, and a correction
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EACL,KAAK,mBAAmB,EAczB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAa,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAa1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAiB7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAgEhD,OAAO,EAGL,KAAK,SAAS,EAMf,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UEST_ALONE, OPENS_SIGNED_IN } from './account/page-words.js';
|
|
2
3
|
import { DEFAULT_PAGE, FULL_CAPABILITIES, LASTING_REQUESTS, MAX_PAGE, REQUEST_KINDS, REQUEST_NOTE_MAX, guestTooLong, maskedEmail, notPricedForNoAnswer, unansweredBy, unitWords, unpaidBookingNote, wholeEmail, } from './backend.js';
|
|
3
4
|
import { PAY_WORDS, allOrEach, choiceBlock, payOf, paymentOf, saysOwn, sentenceOf, setsApart, sharedBy, spreadOf, } from './choices.js';
|
|
4
5
|
import { usedOnWords } from './coupon-words.js';
|
|
@@ -6,10 +7,10 @@ import { MAX_GUESTS, addDays, dateOptions, dayWords, isDay, nights as nightsBetw
|
|
|
6
7
|
import { FACILITIES } from './facilities.js';
|
|
7
8
|
import { DESCRIPTION_MAX, POLICY_MAX, hotelName, hotelText } from './fence.js';
|
|
8
9
|
import { clockOf, minutesOf, startProblem, stayWords, windowWords } from './hourly.js';
|
|
9
|
-
import { amountsIn, formatMoney, keepingAmounts, money, multiplyMoney, toMinor } from './money.js';
|
|
10
|
+
import { amountsIn, formatMoney, inFullCurrency, keepingAmounts, money, multiplyMoney, toMinor, } from './money.js';
|
|
10
11
|
import { namedExactly, roomNamesOf, roomTypeNamed, withTraditional } from './names.js';
|
|
11
|
-
import { cardAnswer, hotelListAnswer, prepareRefusal, preparedAnswer, } from './otaless/addons-answers.js';
|
|
12
|
-
import { buyAnswer, finishAnswer, itemAnswer, listAnswer, ordersPart, previewAnswer, shopSignInAnswer, } from './otaless/shop-answers.js';
|
|
12
|
+
import { cardAnswer, hotelListAnswer, prepareRefusal, preparedAnswer, statusAnswer, } from './otaless/addons-answers.js';
|
|
13
|
+
import { buyAnswer, finishAnswer, itemAnswer, listAnswer, ordersPart, previewAnswer, shopOrdersAnswer, shopSignInAnswer, } from './otaless/shop-answers.js';
|
|
13
14
|
import { looksLikeShopOrder, unitCentsOf } from './otaless/shop-service.js';
|
|
14
15
|
import { overlapsOf } from './overlap.js';
|
|
15
16
|
import { MAX_COMPARED, MAX_CONS, MAX_DAYS, MAX_ITEMS_PER_DAY, MAX_MOMENTS, MAX_PROS, buildItinerary, candidatesFor, compareHotels, namesMoreThanOne, nightlyIncludesTaxes, } from './present.js';
|
|
@@ -196,6 +197,8 @@ export const withheldTools = (n, caps) => new Set([
|
|
|
196
197
|
// its buy tool only where buying is open too. The names exist only with `data.otaless.shop`.
|
|
197
198
|
...(n.listShopItems && !(caps.shop && !caps.readOnly) ? [n.listShopItems] : []),
|
|
198
199
|
...(n.buyShopItem && !(caps.shop && caps.shopBuy && !caps.readOnly) ? [n.buyShopItem] : []),
|
|
200
|
+
// The account's value-added service orders (0.84.1): where the shop's listing is.
|
|
201
|
+
...(n.listShopOrders && !(caps.shop && !caps.readOnly) ? [n.listShopOrders] : []),
|
|
199
202
|
// The card's own add-ons tool (0.82.0): only where the hotel's add-ons or the shop are on.
|
|
200
203
|
...(n.cardAddons && !((caps.addons || caps.shop) && !caps.readOnly) ? [n.cardAddons] : []),
|
|
201
204
|
// Nothing can be booked here yet (`readOnly`, Otaless 2026-11-03): no tool
|
|
@@ -492,6 +495,14 @@ const forCapabilities = (tools, n, v, caps) => {
|
|
|
492
495
|
inputSchema: without(out.inputSchema, 'requests', 'arrivingAt', 'notes'),
|
|
493
496
|
};
|
|
494
497
|
}
|
|
498
|
+
// ⚠️ A VALUE-ADDED SERVICE ORDER IS NOT A HOTEL BOOKING (0.84.1, robin 11-25: asked for "my shop
|
|
499
|
+
// orders", the model read the hotel bookings first and had no times). Only where the shop is on:
|
|
500
|
+
// every other deployment's description is word for word as it was (the frozen root listing).
|
|
501
|
+
if (t.name === n.listBookings && n.listShopOrders && caps.shop && !caps.readOnly)
|
|
502
|
+
out = {
|
|
503
|
+
...out,
|
|
504
|
+
description: `${out.description} ${SHOP_ORDERS_IN_BOOKINGS}`,
|
|
505
|
+
};
|
|
495
506
|
// ⚠️ ONE CANCEL, WHICH ASKS THE REFUND TOO (0.74.2, robin 11-17): said by the tool
|
|
496
507
|
// itself, for the model in every client - there is no refund tool to reach for.
|
|
497
508
|
if (t.name === n.cancelBooking && caps.refunds && !caps.readOnly)
|
|
@@ -1321,7 +1332,7 @@ const allTools = (n, v) => {
|
|
|
1321
1332
|
? [
|
|
1322
1333
|
{
|
|
1323
1334
|
name: n.listShopItems,
|
|
1324
|
-
description: "The
|
|
1335
|
+
description: "The value-added services (增值服务): goods in Otaless's shop to buy for a stay, not rooms - each with its id, name, price and currency, whether it is available and its options. With `item` it opens one item. It only reads the shop; nothing is ordered.",
|
|
1325
1336
|
annotations: reads('Shop items', open),
|
|
1326
1337
|
inputSchema: {
|
|
1327
1338
|
type: 'object',
|
|
@@ -1342,11 +1353,23 @@ const allTools = (n, v) => {
|
|
|
1342
1353
|
},
|
|
1343
1354
|
]
|
|
1344
1355
|
: []),
|
|
1356
|
+
// ⚠️ THE ACCOUNT'S VALUE-ADDED SERVICE ORDERS ON THEIR OWN (0.84.1, robin 11-25: 「首选把我酒店预订订单先
|
|
1357
|
+
// 出来,然后没有时间」): asked for its shop orders, the model read the hotel bookings first. Read only.
|
|
1358
|
+
...(n.listShopOrders
|
|
1359
|
+
? [
|
|
1360
|
+
{
|
|
1361
|
+
name: n.listShopOrders,
|
|
1362
|
+
description: SHOP_ORDERS_DESCRIPTION,
|
|
1363
|
+
annotations: reads('Value-added service orders', open),
|
|
1364
|
+
inputSchema: { type: 'object', properties: {} },
|
|
1365
|
+
},
|
|
1366
|
+
]
|
|
1367
|
+
: []),
|
|
1345
1368
|
...(n.buyShopItem
|
|
1346
1369
|
? [
|
|
1347
1370
|
{
|
|
1348
1371
|
name: n.buyShopItem,
|
|
1349
|
-
description: "Prepares buying one shop item to go with the guest's own hotel booking. It does NOT order or charge anything: the answer gives a one-time page address for the guest to open in the browser signed in to their account, where they see the item, the quantity and the total and press confirm themselves - and when they do, the backend charges a card linked to their account, or gives a payment link if there is none. Pass that link on; never say the item was ordered or paid until the guest confirmed and the shop says so. It checks the price against the one the guest was shown and refuses a booking that is not theirs or is over.",
|
|
1372
|
+
description: "Prepares buying one value-added service (增值服务: a shop item) to go with the guest's own hotel booking. It does NOT order or charge anything: the answer gives a one-time page address for the guest to open in the browser signed in to their account, where they see the item, the quantity and the total and press confirm themselves - and when they do, the backend charges a card linked to their account, or gives a payment link if there is none. Pass that link on; never say the item was ordered or paid until the guest confirmed and the shop says so. It checks the price against the one the guest was shown and refuses a booking that is not theirs or is over.",
|
|
1350
1373
|
annotations: books('Prepare a shop purchase', open),
|
|
1351
1374
|
inputSchema: {
|
|
1352
1375
|
type: 'object',
|
|
@@ -1388,12 +1411,15 @@ const allTools = (n, v) => {
|
|
|
1388
1411
|
? [
|
|
1389
1412
|
{
|
|
1390
1413
|
name: n.cardAddons,
|
|
1391
|
-
description: `The card's own
|
|
1414
|
+
description: `The card's own steps for the value-added services (增值服务) of a booking made here: \`view\` reads what can be added (the shop's goods, and the hotel's own services where they are offered) fresh; \`buy_shop_item\` (and \`book_hotel_addon\`, where hotel services are offered) is the guest's press on a confirm screen that showed the item, the quantity and the total - each answers with \`addonResult\` and a fresh \`addonsView\`; \`shop_status\` reads whether a shop \`order\` the guest is paying for is paid yet (a read, nothing changes). Never the assistant's: nothing here is called without the guest's press.`,
|
|
1392
1415
|
annotations: orders('Add to a booking', open),
|
|
1393
1416
|
inputSchema: {
|
|
1394
1417
|
type: 'object',
|
|
1395
1418
|
properties: {
|
|
1396
|
-
action: {
|
|
1419
|
+
action: {
|
|
1420
|
+
type: 'string',
|
|
1421
|
+
enum: ['view', 'book_hotel_addon', 'buy_shop_item', 'shop_status'],
|
|
1422
|
+
},
|
|
1397
1423
|
booking: {
|
|
1398
1424
|
type: 'string',
|
|
1399
1425
|
description: "The confirmation code of the guest's own booking",
|
|
@@ -1411,6 +1437,10 @@ const allTools = (n, v) => {
|
|
|
1411
1437
|
},
|
|
1412
1438
|
currency: { type: 'string', description: 'The currency the screen showed' },
|
|
1413
1439
|
item: { type: 'string', description: 'buy_shop_item: the shop item id' },
|
|
1440
|
+
order: {
|
|
1441
|
+
type: 'string',
|
|
1442
|
+
description: 'shop_status: the shop order id buy_shop_item answered with',
|
|
1443
|
+
},
|
|
1414
1444
|
option: { type: 'string', description: 'buy_shop_item: the option, as listed' },
|
|
1415
1445
|
shownUnit: {
|
|
1416
1446
|
type: 'string',
|
|
@@ -1428,6 +1458,14 @@ const allTools = (n, v) => {
|
|
|
1428
1458
|
: []),
|
|
1429
1459
|
];
|
|
1430
1460
|
};
|
|
1461
|
+
/**
|
|
1462
|
+
* The value-added service orders tool (0.84.1). ⚠️ Says what it reads, in the words a guest uses for it
|
|
1463
|
+
* (增值服务订单, 商城订单, shop orders, add-on orders - one thing), and that they are not hotel bookings;
|
|
1464
|
+
* names no other tool and tells the model nothing to do (listing.ts).
|
|
1465
|
+
*/
|
|
1466
|
+
export const SHOP_ORDERS_DESCRIPTION = 'The value-added service orders (增值服务订单) of the Otaless account signed in here: goods bought from the Otaless shop to go with a stay - not hotel bookings. 增值服务订单, 商城订单, shop orders and add-on orders are all the same thing. Each order comes with its item, total and currency, status, order id, the hotel booking it was bought with where that is known, and when it was ordered and paid where that is known (in UTC); cancelled ones are listed as the shop has them. It only reads: nothing is ordered, paid or cancelled. Nothing is listed when no account is signed in.';
|
|
1467
|
+
/** Said by the bookings list where the shop is on (0.84.1). */
|
|
1468
|
+
export const SHOP_ORDERS_IN_BOOKINGS = "Value-added service orders (增值服务订单 - the same as shop orders or add-on orders) are not hotel bookings: here each one shows under the hotel booking it was bought with, and one that matches none under other value-added service orders; the account's value-added service orders tool lists them all on their own, with their times.";
|
|
1431
1469
|
/** A guest's reason for a refund, as the group's staff are sent it (`otaless/booking.ts`). */
|
|
1432
1470
|
const REFUND_REASON_MAX = 200;
|
|
1433
1471
|
// The shape of each tool's `structuredContent`, so a reader knows what it is
|
|
@@ -1873,6 +1911,26 @@ const shopSchemas = (n) => ({
|
|
|
1873
1911
|
},
|
|
1874
1912
|
}
|
|
1875
1913
|
: {}),
|
|
1914
|
+
...(n.listShopOrders
|
|
1915
|
+
? {
|
|
1916
|
+
[n.listShopOrders]: {
|
|
1917
|
+
type: 'object',
|
|
1918
|
+
properties: {
|
|
1919
|
+
view: { enum: ['shop-orders', 'error'] },
|
|
1920
|
+
brand: STR,
|
|
1921
|
+
toolNames: OBJ,
|
|
1922
|
+
bookingMode: STR,
|
|
1923
|
+
shopOrders: ARR,
|
|
1924
|
+
count: { type: 'number' },
|
|
1925
|
+
counts: OBJ,
|
|
1926
|
+
timesNote: STR,
|
|
1927
|
+
error: STR,
|
|
1928
|
+
detail: STR,
|
|
1929
|
+
},
|
|
1930
|
+
required: ['view'],
|
|
1931
|
+
},
|
|
1932
|
+
}
|
|
1933
|
+
: {}),
|
|
1876
1934
|
...(n.buyShopItem
|
|
1877
1935
|
? {
|
|
1878
1936
|
[n.buyShopItem]: {
|
|
@@ -4243,6 +4301,36 @@ const notPaidWords = (b) => !b.paymentNotConnected
|
|
|
4243
4301
|
: b.status === 'cancelled' || b.status === 'expired' || b.status === 'failed'
|
|
4244
4302
|
? 'Nothing was paid or charged for this booking.'
|
|
4245
4303
|
: '**It is not paid: nothing has been charged** - payment is not connected here yet. Say exactly that; never that it is paid at the hotel.';
|
|
4304
|
+
/**
|
|
4305
|
+
* ⚠️ VALUE-ADDED SERVICES (增值服务), SAID WHERE A BOOKING IS DONE (0.84.0, robin 11-24: 「应该在订单完成的
|
|
4306
|
+
* 时候就可以购买,而不是要去我的预订买」). Only where the deployment sells them (`/claude`: the shop with
|
|
4307
|
+
* buying open), only for a booking of this account that can still take them, and - where the booking
|
|
4308
|
+
* was just made - only once it is confirmed (a booking waiting for its payment is paid first). The next
|
|
4309
|
+
* step in words, tool names and what each takes, so a client that draws no card can go on; a card
|
|
4310
|
+
* client is told the card shows them under the booking. ⚠️ NOTHING IS BOUGHT BY THE ASSISTANT: the buy
|
|
4311
|
+
* tool prepares a page the guest confirms on.
|
|
4312
|
+
*/
|
|
4313
|
+
const valueAddedLine = (deps, t, ctx, list, confirmedOnly) => {
|
|
4314
|
+
const api = deps.backend.otalessAddons;
|
|
4315
|
+
if (!api?.buyOpen || !t.listShopItems || !t.buyShopItem)
|
|
4316
|
+
return '';
|
|
4317
|
+
const codes = list
|
|
4318
|
+
.filter((b) => b.confirmationCode && api.canAdd(b))
|
|
4319
|
+
.filter((b) => !confirmedOnly || b.status === 'confirmed')
|
|
4320
|
+
.map((b) => b.confirmationCode);
|
|
4321
|
+
if (!codes.length)
|
|
4322
|
+
return '';
|
|
4323
|
+
const one = codes[0];
|
|
4324
|
+
return [
|
|
4325
|
+
`Value-added services (增值服务: goods from the Otaless shop to go with a stay) can be bought now for ${codes.join(', ')} - tell the guest.`,
|
|
4326
|
+
ctx.noCards
|
|
4327
|
+
? ''
|
|
4328
|
+
: 'Where the booking is drawn for the guest they are shown under it, each with its picture, price and a Buy button to press.',
|
|
4329
|
+
`${t.listShopItems} lists them (each item's id, price and currency); then ${t.buyShopItem} with \`item\` (the item id), \`quantity\`, \`booking\` ("${one}"), \`unitPrice\` and \`currency\` as listed prepares a one-time page where the guest confirms the purchase - nothing is bought by the assistant.`,
|
|
4330
|
+
]
|
|
4331
|
+
.filter(Boolean)
|
|
4332
|
+
.join(' ');
|
|
4333
|
+
};
|
|
4246
4334
|
/** A booking for the card and the model's structure, with `notSentStatus` where there is one. */
|
|
4247
4335
|
const listedForCard = (deps, b) => {
|
|
4248
4336
|
const said = notSentStatus(deps, b) ?? unconfirmedSaid(deps, b);
|
|
@@ -4260,6 +4348,10 @@ const listedForCard = (deps, b) => {
|
|
|
4260
4348
|
...(b.termsChanged || b.confirmAsked ? { termsHeldSaid: termsHeldWords(deps, b) } : {}),
|
|
4261
4349
|
// …and past its time: for the card, which has no clock of the deployment's (0.67.0).
|
|
4262
4350
|
...(termsOverdue(deps, b) ? { termsOverdue: true } : {}),
|
|
4351
|
+
// 0.84.0: a booking of this account that can still take value-added services, wherever it is
|
|
4352
|
+
// drawn - the booking just made and paid too, not only My bookings (robin 11-24). Only where the
|
|
4353
|
+
// deployment has them (`otalessAddons`); everywhere else nothing changes.
|
|
4354
|
+
...(deps.backend.otalessAddons?.canAdd(b) ? { addons: true } : {}),
|
|
4263
4355
|
};
|
|
4264
4356
|
};
|
|
4265
4357
|
/**
|
|
@@ -4451,6 +4543,12 @@ const TERMS_TEXT_MAX = 2_000;
|
|
|
4451
4543
|
* the same (`termsSaid`) - the model reads the structure. Neither carries the
|
|
4452
4544
|
* terms' `ref` or their text: see `TERMS_META_KEY`.
|
|
4453
4545
|
*/
|
|
4546
|
+
/**
|
|
4547
|
+
* Whether a link to our pages is handed out with the words of a Lax account cookie (0.84.0): a client
|
|
4548
|
+
* that said it draws no card, on a deployment with `account.cookieSameSite: "Lax"` - see
|
|
4549
|
+
* `ToolDeps.accountCookieLax`. A card host's words, and every word of the root deployment, as before.
|
|
4550
|
+
*/
|
|
4551
|
+
const inBrowserWords = (deps, ctx) => deps.accountCookieLax === true && ctx.noCards === true;
|
|
4454
4552
|
const termsAnswer = (deps, ctx, key, terms) => {
|
|
4455
4553
|
const t = deps.tools;
|
|
4456
4554
|
// A client that draws no card, or that never said it does, is given the page.
|
|
@@ -4468,7 +4566,9 @@ const termsAnswer = (deps, ctx, key, terms) => {
|
|
|
4468
4566
|
const before = terms.filter((x) => !x.changed && !x.askedByGroup);
|
|
4469
4567
|
const changed = terms.filter((x) => x.changed);
|
|
4470
4568
|
const where = onPage
|
|
4471
|
-
?
|
|
4569
|
+
? inBrowserWords(deps, ctx)
|
|
4570
|
+
? 'on the one-time page linked below, in their own browser, signed in to their account there'
|
|
4571
|
+
: "on the one-time page linked below, which opens only in the browser signed in to the guest's account"
|
|
4472
4572
|
: `on the card, with its ${terms.every((x) => x.askedByGroup === 'confirm') ? 'Confirm' : 'Agree'} button`;
|
|
4473
4573
|
// ⚠️ EVERY BOOKING STARTS WITH ITS TERMS (Otaless 0.66.0, 8 booking/create, docs/
|
|
4474
4574
|
// otaless-hotels.md §15): nothing is ordered before the guest agrees - but terms the
|
|
@@ -4558,7 +4658,9 @@ const termsAnswer = (deps, ctx, key, terms) => {
|
|
|
4558
4658
|
: `They can be agreed to until ${until}.`,
|
|
4559
4659
|
onPage
|
|
4560
4660
|
? link
|
|
4561
|
-
?
|
|
4661
|
+
? inBrowserWords(deps, ctx)
|
|
4662
|
+
? `Give the guest this one-time link to read the terms and agree on ${deps.vocab.brand}'s page - it works once, until ${clockWords(link.expiresAt) ?? link.expiresAt}: ${link.url}. ${OPENS_SIGNED_IN} ${GUEST_ALONE} When they say they are done, call ${t.listBookings} to see the booking and its payment page.`
|
|
4663
|
+
: `Give the guest this one-time link to read the terms and agree on ${deps.vocab.brand}'s page - it opens only in the browser signed in to their ${deps.vocab.brand} account, works once, until ${clockWords(link.expiresAt) ?? link.expiresAt}: ${link.url}. When they say they are done, call ${t.listBookings} to see the booking and its payment page.`
|
|
4562
4664
|
: x.changed
|
|
4563
4665
|
? 'These terms can only be agreed to on a client that shows the card.'
|
|
4564
4666
|
: heldOrder
|
|
@@ -5840,6 +5942,40 @@ export const tripGone = (deps) => {
|
|
|
5840
5942
|
text: detail,
|
|
5841
5943
|
};
|
|
5842
5944
|
};
|
|
5945
|
+
/**
|
|
5946
|
+
* ⚠️ A CARD DRAWN BEFORE THE SIGN-IN, PRESSED AFTER IT (0.84.0; walkthrough 11-24 #5). Since a sign-in
|
|
5947
|
+
* the conversation's trip goes by a new id, handed only to the card that started the sign-in (0.75.1,
|
|
5948
|
+
* P1-a - `renewedAway` in server.ts): any other card from before it can no longer act on the trip. That
|
|
5949
|
+
* is by design and STAYS - this only says what happened, instead of `tripGone`'s "updated, or quiet for
|
|
5950
|
+
* a long time", which was not true a few minutes after a sign-in. Still `trip-gone` (a card holding the
|
|
5951
|
+
* sign-in's claim asks again with it, as before), with `renewed: true` for the card's own words.
|
|
5952
|
+
*/
|
|
5953
|
+
export const tripRenewed = (deps, o = {
|
|
5954
|
+
pressed: 'other',
|
|
5955
|
+
signedIn: false,
|
|
5956
|
+
}) => {
|
|
5957
|
+
const t = deps.tools;
|
|
5958
|
+
const again = t.listHotels ? ` or draw the hotels again (${t.listHotels})` : '';
|
|
5959
|
+
// ⚠️ WHAT HAPPENED, AS IT HAPPENED (总线程 11-25): never "signed in somewhere else", never "already
|
|
5960
|
+
// signed in" unchecked. The way on is the card's own sign-in (the same account goes back to this
|
|
5961
|
+
// conversation - server.ts `rejoins`).
|
|
5962
|
+
const happened = o.why === 'sign-out'
|
|
5963
|
+
? 'This card was drawn before this conversation signed out, so it can no longer act on its trip'
|
|
5964
|
+
: 'This card was drawn before this conversation signed in, and its trip moved on with the sign-in, so this card can no longer act on it';
|
|
5965
|
+
const detail = `${happened} - nothing was lost, booked or changed by the press.${o.pressed === 'book' ? ' Nothing was booked.' : ''} The guest can sign in on this card to carry on with it (signed in as the same account, it is back on this conversation)${again}.`;
|
|
5966
|
+
return {
|
|
5967
|
+
structured: {
|
|
5968
|
+
view: 'error',
|
|
5969
|
+
...common(deps),
|
|
5970
|
+
error: 'trip-gone',
|
|
5971
|
+
renewed: true,
|
|
5972
|
+
renewedFor: o.pressed,
|
|
5973
|
+
renewedWhy: o.why ?? 'sign-in',
|
|
5974
|
+
detail,
|
|
5975
|
+
},
|
|
5976
|
+
text: detail,
|
|
5977
|
+
};
|
|
5978
|
+
};
|
|
5843
5979
|
/**
|
|
5844
5980
|
* The guest's agreement to the terms behind `ref`, and what it came to: the
|
|
5845
5981
|
* booking (with its payment page), the group's terms again, or a refusal's
|
|
@@ -5894,7 +6030,12 @@ export const contextFor = (deps, key) => {
|
|
|
5894
6030
|
export const identityFor = (deps, key) => identity(deps, contextFor(deps, key), key);
|
|
5895
6031
|
/** A booking refusal as its answer (`view: 'error'`, its code), or undefined when `err` is not one. */
|
|
5896
6032
|
export const bookingRefusal = refusalAnswer;
|
|
5897
|
-
|
|
6033
|
+
/**
|
|
6034
|
+
* A tool's answer - every amount in it written with its whole currency where the deployment says so
|
|
6035
|
+
* (`fullCurrency`, 0.84.0), else exactly as before.
|
|
6036
|
+
*/
|
|
6037
|
+
export const handleTool = (deps, name, rawArgs, ctx) => inFullCurrency(deps.fullCurrency, () => answerWithAmounts(deps, name, rawArgs, ctx));
|
|
6038
|
+
const answerWithAmounts = async (deps, name, rawArgs, ctx) => {
|
|
5898
6039
|
const { result, written } = await keepingAmounts(async () => {
|
|
5899
6040
|
// ⚠️ A GROUP THAT DID NOT ANSWER A READ IS AN ANSWER, NOT A FAULT (2026-11-03
|
|
5900
6041
|
// review, C5/C8): the hotel page, the add-ons, the dates, a booking looked
|
|
@@ -7093,6 +7234,8 @@ const bookingAnswer = async (deps, t, ctx, key, store, args, inTrip, lines, show
|
|
|
7093
7234
|
...asked,
|
|
7094
7235
|
]),
|
|
7095
7236
|
...failedText,
|
|
7237
|
+
// 0.84.0: what can be bought with a booking just made and confirmed (增值服务).
|
|
7238
|
+
valueAddedLine(deps, t, ctx, booked.map(({ booking }) => booking), true),
|
|
7096
7239
|
remembered?.line ?? '',
|
|
7097
7240
|
others ? `The trip's other stays are still in it, not booked:\n${rest?.text ?? ''}` : '',
|
|
7098
7241
|
]
|
|
@@ -8964,6 +9107,24 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8964
9107
|
});
|
|
8965
9108
|
return listAnswer(base, found, { ...(query ? { query } : {}), ...(category ? { category } : {}), maxPrice }, shop.buyOpen, deps.shopLink);
|
|
8966
9109
|
}
|
|
9110
|
+
// ⚠️ THE ACCOUNT'S VALUE-ADDED SERVICE ORDERS ON THEIR OWN (0.84.1, robin 11-25: 「首选把我酒店预订订单先
|
|
9111
|
+
// 出来,然后没有时间」). A read: every order as the shop lists it, with what is known of its booking
|
|
9112
|
+
// and times (shop-service.ts adds this server's own note of an order bought here) - and the card's page.
|
|
9113
|
+
if (t.listShopOrders && name === t.listShopOrders) {
|
|
9114
|
+
const shop = deps.backend.otalessShop;
|
|
9115
|
+
const base = common(deps, key);
|
|
9116
|
+
if (!shop)
|
|
9117
|
+
return {
|
|
9118
|
+
structured: { view: 'error', ...base, error: 'not-offered' },
|
|
9119
|
+
text: `There is no shop through ${deps.vocab.brand}.`,
|
|
9120
|
+
isError: true,
|
|
9121
|
+
};
|
|
9122
|
+
const who = identity(deps, ctx, key, args);
|
|
9123
|
+
return shopOrdersAnswer(base, await shop.orders(who, deps.lang === 'zh' ? 'zh' : 'en'), {
|
|
9124
|
+
...(deps.groupSignIn?.signInTool ? { signIn: deps.groupSignIn.signInTool } : {}),
|
|
9125
|
+
...(deps.shopLink ? { shopLink: deps.shopLink } : {}),
|
|
9126
|
+
});
|
|
9127
|
+
}
|
|
8967
9128
|
// ⚠️ NEVER BUYS (0.82.0): it checks the item, the booking and the price the guest was shown, and
|
|
8968
9129
|
// PREPARES a one-time confirm page. The purchase is the guest's press on that page.
|
|
8969
9130
|
if (t.buyShopItem && name === t.buyShopItem) {
|
|
@@ -8998,7 +9159,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
8998
9159
|
api.discard(who, prepared.ref);
|
|
8999
9160
|
return noConfirmPage(base);
|
|
9000
9161
|
}
|
|
9001
|
-
return preparedAnswer(base, prepared, link, (iso) => clockWords(iso) ?? iso);
|
|
9162
|
+
return preparedAnswer(base, prepared, link, (iso) => clockWords(iso) ?? iso, inBrowserWords(deps, ctx));
|
|
9002
9163
|
}
|
|
9003
9164
|
// The card's own add-ons steps (0.82.0, app-only): the guest's press on a confirm screen. ⚠️ NO
|
|
9004
9165
|
// PARAMETER MEANS "CONFIRMED" EXCEPT THE `press` THE CARD MADE FOR THAT SCREEN, with the values it
|
|
@@ -9055,10 +9216,15 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
9055
9216
|
press: str(args.press),
|
|
9056
9217
|
}, lang);
|
|
9057
9218
|
}
|
|
9219
|
+
else if (action === 'shop_status') {
|
|
9220
|
+
// ⚠️ A READ (0.84.0): one order's payment state, held to one backend check per order every few
|
|
9221
|
+
// seconds (addons.ts) - and no fresh view, so the card's checks cost the backend one read each.
|
|
9222
|
+
return statusAnswer(base, booking, await api.shopStatus(who, str(args.order), lang));
|
|
9223
|
+
}
|
|
9058
9224
|
else if (action !== 'view') {
|
|
9059
9225
|
return {
|
|
9060
9226
|
structured: { view: 'error', ...base, error: 'bad-input' },
|
|
9061
|
-
text: 'action is view, book_hotel_addon or
|
|
9227
|
+
text: 'action is view, book_hotel_addon, buy_shop_item or shop_status.',
|
|
9062
9228
|
isError: true,
|
|
9063
9229
|
};
|
|
9064
9230
|
}
|
|
@@ -9117,7 +9283,7 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
9117
9283
|
api.discard(who, prepared.ref);
|
|
9118
9284
|
return noConfirmPage(base);
|
|
9119
9285
|
}
|
|
9120
|
-
return preparedAnswer(base, prepared, link, (iso) => clockWords(iso) ?? iso);
|
|
9286
|
+
return preparedAnswer(base, prepared, link, (iso) => clockWords(iso) ?? iso, inBrowserWords(deps, ctx));
|
|
9121
9287
|
}
|
|
9122
9288
|
if (name === t.listBookings) {
|
|
9123
9289
|
const who = identity(deps, ctx, key, args);
|
|
@@ -9150,8 +9316,10 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
9150
9316
|
// ⚠️ ADD-ONS (0.82.0): only where `addons` or the shop is on, and only for a live booking of this account.
|
|
9151
9317
|
const addonsApi = deps.backend.otalessAddons;
|
|
9152
9318
|
const addable = addonsApi ? bookings.filter((b) => addonsApi.canAdd(b)) : [];
|
|
9319
|
+
// 0.84.1 (robin 11-25): each value-added service order under the booking it was bought with; one
|
|
9320
|
+
// that matches none of these under "other" - never forced under a booking.
|
|
9153
9321
|
const shopPart = shopApi && !code
|
|
9154
|
-
? ordersPart(await shopApi.orders(who, deps.lang === 'zh' ? 'zh' : 'en'), deps.shopLink)
|
|
9322
|
+
? ordersPart(await shopApi.orders(who, deps.lang === 'zh' ? 'zh' : 'en'), deps.shopLink, bookings.map((b) => b.confirmationCode))
|
|
9155
9323
|
: undefined;
|
|
9156
9324
|
return {
|
|
9157
9325
|
structured: {
|
|
@@ -9173,7 +9341,11 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
9173
9341
|
text: [
|
|
9174
9342
|
missed ? missLine : '',
|
|
9175
9343
|
bookings.length
|
|
9176
|
-
? bookings
|
|
9344
|
+
? bookings
|
|
9345
|
+
.map((b) => [bookingLine(deps, b, ctx.noCards), shopPart?.under.get(b.confirmationCode) ?? '']
|
|
9346
|
+
.filter(Boolean)
|
|
9347
|
+
.join('\n'))
|
|
9348
|
+
.join('\n')
|
|
9177
9349
|
: code
|
|
9178
9350
|
? ''
|
|
9179
9351
|
: // ⚠️ NOT "NO BOOKINGS" when a group did not answer: it may hold them.
|
|
@@ -9183,15 +9355,27 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
|
|
|
9183
9355
|
? 'No bookings on this account.'
|
|
9184
9356
|
: 'No bookings in this conversation. A booking made elsewhere is found with its confirmation code and the email it was made with.',
|
|
9185
9357
|
missing.said,
|
|
9358
|
+
// 0.84.0: called value-added services (增值服务), with the next step in words where the shop sells.
|
|
9186
9359
|
addable.length
|
|
9187
|
-
?
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9360
|
+
? (addonsApi?.buyOpen && t.listShopItems && t.buyShopItem
|
|
9361
|
+
? [
|
|
9362
|
+
valueAddedLine(deps, t, ctx, addable, false),
|
|
9363
|
+
deps.backend.capabilities?.addons && t.listBookingAddons
|
|
9364
|
+
? `${t.listBookingAddons} lists the hotel's own services for a booking; the guest confirms each on a page it gives them.`
|
|
9365
|
+
: '',
|
|
9366
|
+
]
|
|
9367
|
+
: [
|
|
9368
|
+
`Value-added services (增值服务) can be added to ${addable.map((b) => b.confirmationCode).join(', ')}: ${[
|
|
9369
|
+
deps.backend.capabilities?.addons && t.listBookingAddons
|
|
9370
|
+
? `${t.listBookingAddons} lists the hotel's own services`
|
|
9371
|
+
: '',
|
|
9372
|
+
shopApi && t.listShopItems ? `${t.listShopItems} lists the shop's goods` : '',
|
|
9373
|
+
]
|
|
9374
|
+
.filter(Boolean)
|
|
9375
|
+
.join('; ')}. The guest confirms each one on a page it gives them - nothing is added by the assistant.`,
|
|
9376
|
+
])
|
|
9193
9377
|
.filter(Boolean)
|
|
9194
|
-
.join('
|
|
9378
|
+
.join(' ')
|
|
9195
9379
|
: '',
|
|
9196
9380
|
shopPart?.text ?? '',
|
|
9197
9381
|
]
|