fortrip 4.3.1 → 5.0.0-rc.2
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/README.md +16 -24
- package/dist/{chunk-63KHFEME.js → chunk-DYSYHQQY.js} +278 -298
- package/dist/cli.js +103 -48
- package/dist/{mcp-bridge-2GXFE2SC.js → mcp-bridge-WB44PZPA.js} +7 -11
- package/package.json +2 -2
|
@@ -5,6 +5,48 @@ var __export = (target, all) => {
|
|
|
5
5
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
// ../contract/src/limits.ts
|
|
9
|
+
var LIMITS = {
|
|
10
|
+
rooms: 8,
|
|
11
|
+
adultsPerRoom: 8,
|
|
12
|
+
childrenPerRoom: 4,
|
|
13
|
+
childAgeMax: 17,
|
|
14
|
+
nightsFortrip: 30,
|
|
15
|
+
nightsSupplier: 15,
|
|
16
|
+
offersHotels: 15,
|
|
17
|
+
offersPerHotelDefault: 10,
|
|
18
|
+
offersPerHotelMax: 20,
|
|
19
|
+
pageSizeDefault: 20,
|
|
20
|
+
pageSizeMax: 50,
|
|
21
|
+
textLength: 128,
|
|
22
|
+
radiusMetersMax: 8e4,
|
|
23
|
+
radiusMetersDefault: 8e3,
|
|
24
|
+
amenityFilters: 9,
|
|
25
|
+
guestName: 60,
|
|
26
|
+
contactFirstName: 59,
|
|
27
|
+
contactLastName: 59,
|
|
28
|
+
contactPhoneMin: 3,
|
|
29
|
+
contactPhoneMax: 40,
|
|
30
|
+
specialRequests: 500,
|
|
31
|
+
poolLimit: 3e3,
|
|
32
|
+
candidatesShown: 8,
|
|
33
|
+
candidatesCounted: 200,
|
|
34
|
+
localitiesShown: 8,
|
|
35
|
+
tokenPaymentMaxUsd: 500,
|
|
36
|
+
/** Minutes that must be left before the order's payment window closes
|
|
37
|
+
* (`payment.expiresAt`) for the order to offer a token or wallet payment
|
|
38
|
+
* (an entry of `payment.methods`). */
|
|
39
|
+
payMinMinutesLeft: 15,
|
|
40
|
+
/** `pay_order` refuses (`order_not_payable`), by token or wallet, when the
|
|
41
|
+
* order's payment window (`payment.expiresAt`) closes within this many
|
|
42
|
+
* minutes. */
|
|
43
|
+
payCutoffMinutes: 2,
|
|
44
|
+
tokensPerOrder: 5,
|
|
45
|
+
wechatCodeMinutes: 120
|
|
46
|
+
};
|
|
47
|
+
var CURRENCIES = ["USD", "CNY"];
|
|
48
|
+
var SUPPORT_EMAIL = "info@fortrip.ai";
|
|
49
|
+
|
|
8
50
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
9
51
|
var external_exports = {};
|
|
10
52
|
__export(external_exports, {
|
|
@@ -14604,15 +14646,26 @@ var money = external_exports.looseObject({
|
|
|
14604
14646
|
error: currencyError
|
|
14605
14647
|
})
|
|
14606
14648
|
});
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14649
|
+
function requestMoney(name) {
|
|
14650
|
+
return external_exports.strictObject(
|
|
14651
|
+
{
|
|
14652
|
+
amount: external_exports.string({ error: amountError }).regex(/^\d+(\.\d+)?$/, { error: amountError }).describe("Decimal string such as 132.40, never a number."),
|
|
14653
|
+
currency: external_exports.enum(CURRENCIES, { error: "currency must be USD or CNY" }).describe("USD or CNY.")
|
|
14654
|
+
},
|
|
14655
|
+
{
|
|
14656
|
+
error: (issue2) => issue2.code === "unrecognized_keys" ? `Unknown field(s): ${issue2.keys.join(", ")}` : `${name} must be Money: { amount: "132.40", currency: "USD" or "CNY" }`
|
|
14657
|
+
}
|
|
14658
|
+
);
|
|
14659
|
+
}
|
|
14660
|
+
function echoedMoney(name) {
|
|
14661
|
+
return external_exports.looseObject(
|
|
14662
|
+
{
|
|
14663
|
+
amount: external_exports.string({ error: amountError }).regex(/^\d+(\.\d+)?$/, { error: amountError }).describe("Decimal string such as 132.40, never a number."),
|
|
14664
|
+
currency: external_exports.string({ error: currencyError }).regex(/^[A-Z]{3}$/, { error: currencyError }).describe("3-letter uppercase ISO 4217 code, as returned.")
|
|
14665
|
+
},
|
|
14666
|
+
{ error: `${name} must be Money as returned: { amount: "132.40", currency: "USD" }` }
|
|
14667
|
+
);
|
|
14668
|
+
}
|
|
14616
14669
|
|
|
14617
14670
|
// ../contract/src/conventions/time.ts
|
|
14618
14671
|
var instant = external_exports.string({ error: "must be an RFC 3339 UTC instant such as 2026-10-23T08:00:00Z" }).regex(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?Z$/, {
|
|
@@ -14670,51 +14723,6 @@ function normalizeGuestName(value) {
|
|
|
14670
14723
|
return value.replace(CURLY_APOSTROPHES, "'").replace(/\s+/g, " ").trim();
|
|
14671
14724
|
}
|
|
14672
14725
|
|
|
14673
|
-
// ../contract/src/limits.ts
|
|
14674
|
-
var LIMITS = {
|
|
14675
|
-
rooms: 8,
|
|
14676
|
-
adultsPerRoom: 8,
|
|
14677
|
-
childrenPerRoom: 4,
|
|
14678
|
-
childAgeMax: 17,
|
|
14679
|
-
nightsFortrip: 30,
|
|
14680
|
-
nightsSupplier: 15,
|
|
14681
|
-
offersHotels: 15,
|
|
14682
|
-
offersPerHotelDefault: 10,
|
|
14683
|
-
offersPerHotelMax: 20,
|
|
14684
|
-
pageSizeDefault: 20,
|
|
14685
|
-
pageSizeMax: 50,
|
|
14686
|
-
textLength: 128,
|
|
14687
|
-
radiusMetersMax: 8e4,
|
|
14688
|
-
radiusMetersDefault: 8e3,
|
|
14689
|
-
amenityFilters: 9,
|
|
14690
|
-
guestName: 60,
|
|
14691
|
-
contactFirstName: 59,
|
|
14692
|
-
contactLastName: 59,
|
|
14693
|
-
contactPhoneMin: 3,
|
|
14694
|
-
contactPhoneMax: 40,
|
|
14695
|
-
specialRequests: 500,
|
|
14696
|
-
poolLimit: 3e3,
|
|
14697
|
-
candidatesShown: 8,
|
|
14698
|
-
candidatesCounted: 200,
|
|
14699
|
-
localitiesShown: 8,
|
|
14700
|
-
tokenPaymentMaxUsd: 500,
|
|
14701
|
-
/** Minutes that must be left before the order's payment window closes
|
|
14702
|
-
* (`payment.expiresAt`) for the order to offer a token or wallet payment
|
|
14703
|
-
* (`payment.handlers`, `payment.wallets`). */
|
|
14704
|
-
payMinMinutesLeft: 15,
|
|
14705
|
-
/** `pay_order` refuses (`order_not_payable`), by token or wallet, when the
|
|
14706
|
-
* order's payment window (`payment.expiresAt`) closes within this many
|
|
14707
|
-
* minutes. */
|
|
14708
|
-
payCutoffMinutes: 2,
|
|
14709
|
-
tokensPerOrder: 5,
|
|
14710
|
-
wechatCodeMinutes: 120,
|
|
14711
|
-
/** Orders one account can make for one stay (the same room, rate, dates
|
|
14712
|
-
* and party); past it, ordering the stay answers `order_exists`. */
|
|
14713
|
-
ordersPerStay: 20
|
|
14714
|
-
};
|
|
14715
|
-
var DISPLAY_CURRENCIES = ["USD", "CNY"];
|
|
14716
|
-
var SUPPORT_EMAIL = "info@fortrip.ai";
|
|
14717
|
-
|
|
14718
14726
|
// ../contract/src/vocabulary.ts
|
|
14719
14727
|
var FILTERABLE_AMENITIES = [
|
|
14720
14728
|
"parking",
|
|
@@ -14751,12 +14759,7 @@ var SEARCH_SORTS = [
|
|
|
14751
14759
|
var locale = oneOf("locale", ["en", "zh"]).describe(
|
|
14752
14760
|
"Language for names and text in the response: en or zh."
|
|
14753
14761
|
);
|
|
14754
|
-
var
|
|
14755
|
-
"USD",
|
|
14756
|
-
"CNY"
|
|
14757
|
-
]).describe(
|
|
14758
|
-
"Currency to show prices in, USD or CNY. It never changes what is charged: payment is in USD."
|
|
14759
|
-
);
|
|
14762
|
+
var currencyDescription = "The currency to price and charge in: USD (default) or CNY, where available (otherwise the answer is currency_unavailable).";
|
|
14760
14763
|
var cursor = nonEmpty("cursor");
|
|
14761
14764
|
var nightsError = (name) => `${name} must be after the check-in date and at most ${LIMITS.nightsFortrip} nights later`;
|
|
14762
14765
|
var stay = strictInput({
|
|
@@ -14880,8 +14883,8 @@ var searchFilters = strictInput({
|
|
|
14880
14883
|
"Amenities every hotel must list. Only some codes can filter; asking for one that cannot is answered with the list that can."
|
|
14881
14884
|
),
|
|
14882
14885
|
price: strictInput({
|
|
14883
|
-
maxPerRoomNight:
|
|
14884
|
-
"Highest price per room per night, in
|
|
14886
|
+
maxPerRoomNight: requestMoney("filters.price.maxPerRoomNight").describe(
|
|
14887
|
+
"Highest price per room per night, in the search's currency."
|
|
14885
14888
|
)
|
|
14886
14889
|
}).optional().describe("Price limit. Needs indicative pricing, so a stay.")
|
|
14887
14890
|
}).optional().describe("Filters every hotel in the answer must pass.");
|
|
@@ -14909,7 +14912,7 @@ function createSearchHotelsInput(now = Date.now) {
|
|
|
14909
14912
|
"`nextCursor` from the previous response. A next page is the cursor and, optionally, `limit`; nothing else."
|
|
14910
14913
|
),
|
|
14911
14914
|
locale: locale.optional(),
|
|
14912
|
-
|
|
14915
|
+
currency: oneOf("currency", CURRENCIES).optional().describe(currencyDescription)
|
|
14913
14916
|
}).superRefine((input, ctx) => {
|
|
14914
14917
|
const issue2 = (path, message) => ctx.addIssue({ code: "custom", path, message });
|
|
14915
14918
|
if (input.cursor !== void 0) {
|
|
@@ -14951,6 +14954,14 @@ function createSearchHotelsInput(now = Date.now) {
|
|
|
14951
14954
|
);
|
|
14952
14955
|
}
|
|
14953
14956
|
}
|
|
14957
|
+
const bound = input.filters?.price?.maxPerRoomNight;
|
|
14958
|
+
const searchCurrency = input.currency ?? "USD";
|
|
14959
|
+
if (bound !== void 0 && bound.currency !== searchCurrency) {
|
|
14960
|
+
issue2(
|
|
14961
|
+
["filters", "price", "maxPerRoomNight", "currency"],
|
|
14962
|
+
`filters.price.maxPerRoomNight.currency is ${bound.currency}, but the search is in ${searchCurrency}${input.currency === void 0 ? " (the default)" : ""}: send the price in ${searchCurrency}`
|
|
14963
|
+
);
|
|
14964
|
+
}
|
|
14954
14965
|
const checkIn = input.stay?.checkIn;
|
|
14955
14966
|
if (checkIn !== void 0 && isIsoDate(checkIn)) {
|
|
14956
14967
|
const earliest = new Date(now() - 12 * 36e5).toISOString().slice(0, 10);
|
|
@@ -14982,7 +14993,7 @@ var hotelOffersInput = strictInput({
|
|
|
14982
14993
|
`Offers per hotel, 1 to ${LIMITS.offersPerHotelMax}. Default ${LIMITS.offersPerHotelDefault}.`
|
|
14983
14994
|
),
|
|
14984
14995
|
locale: locale.optional(),
|
|
14985
|
-
|
|
14996
|
+
currency: oneOf("currency", CURRENCIES).optional().describe(`${currencyDescription} An order made from these offers is charged in this currency.`)
|
|
14986
14997
|
});
|
|
14987
14998
|
function cardFreeText(name, min, max, minDigits) {
|
|
14988
14999
|
return text(name, min, max).refine(
|
|
@@ -15081,11 +15092,10 @@ var listOrdersInput = strictInput({
|
|
|
15081
15092
|
),
|
|
15082
15093
|
locale: locale.optional()
|
|
15083
15094
|
});
|
|
15084
|
-
var maximumPenaltyError = "maximumPenalty must be a number of 0 or more: the order's cancel.penalty.amount, such as 12.5 for 12.50";
|
|
15085
15095
|
var cancelOrderInput = strictInput({
|
|
15086
15096
|
orderId: orderId.describe("The orderId of the order to cancel."),
|
|
15087
|
-
maximumPenalty:
|
|
15088
|
-
|
|
15097
|
+
maximumPenalty: echoedMoney("maximumPenalty").optional().describe(
|
|
15098
|
+
"The penalty the user agreed to: the order's cancel.penalty, exactly as returned. Ignored when closing an unpaid order."
|
|
15089
15099
|
)
|
|
15090
15100
|
});
|
|
15091
15101
|
var sharedPaymentTokenRe = /^spt_[A-Za-z0-9]{1,250}$/;
|
|
@@ -15111,7 +15121,7 @@ var ucpInstrument = external_exports.looseObject(
|
|
|
15111
15121
|
"The credential type: stripe_payment_token for the selected one."
|
|
15112
15122
|
),
|
|
15113
15123
|
token: external_exports.string({ error: instrumentTokenError }).optional().describe(
|
|
15114
|
-
"The shared payment token (spt_\u2026) the user approved for this order, requested with the order's
|
|
15124
|
+
"The shared payment token (spt_\u2026) the user approved for this order, requested with the limits of the order's stripe_shared_payment_token method."
|
|
15115
15125
|
)
|
|
15116
15126
|
},
|
|
15117
15127
|
{ error: "credential must be a JSON object" }
|
|
@@ -15146,7 +15156,7 @@ function selectedOf(instruments) {
|
|
|
15146
15156
|
var payOrderInput = strictInput({
|
|
15147
15157
|
orderId: orderId.describe("The orderId of the order to pay."),
|
|
15148
15158
|
sharedPaymentToken: external_exports.string({ error: sharedPaymentTokenError }).regex(sharedPaymentTokenRe, { error: sharedPaymentTokenError }).optional().describe(
|
|
15149
|
-
"The shared payment token (spt_\u2026) the user approved for this order, requested with the order's
|
|
15159
|
+
"The shared payment token (spt_\u2026) the user approved for this order, requested with the limits of the order's stripe_shared_payment_token method. Exactly one of sharedPaymentToken, payment and method."
|
|
15150
15160
|
),
|
|
15151
15161
|
payment: strictInput({
|
|
15152
15162
|
instruments: external_exports.array(ucpInstrument, { error: instrumentsError }).min(1, { error: instrumentsError }).max(8, { error: instrumentsError }).describe("The instruments, exactly one of them selected.")
|
|
@@ -15184,11 +15194,11 @@ var payOrderInput = strictInput({
|
|
|
15184
15194
|
}).optional().describe(
|
|
15185
15195
|
"UCP's Complete Checkout payment, in place of sharedPaymentToken: the token as the stripe_payment_token credential of the one selected stripe_payments card instrument. Exactly one of sharedPaymentToken, payment and method."
|
|
15186
15196
|
),
|
|
15187
|
-
method: oneOf("method", ["
|
|
15188
|
-
"Pay
|
|
15197
|
+
method: oneOf("method", ["stripe_alipay_wechat_pay"]).optional().describe(
|
|
15198
|
+
"Pay by a method in payment.methods other than the token, which is paid with sharedPaymentToken or payment. Exactly one of sharedPaymentToken, payment and method."
|
|
15189
15199
|
),
|
|
15190
|
-
total:
|
|
15191
|
-
"The total the user approved: the order's price.total, exactly as returned."
|
|
15200
|
+
total: requestMoney("total").describe(
|
|
15201
|
+
"The total the user approved: the order's price.total, in its currency, exactly as returned."
|
|
15192
15202
|
)
|
|
15193
15203
|
}).superRefine((input, ctx) => {
|
|
15194
15204
|
const given = [
|
|
@@ -15257,11 +15267,11 @@ var localeFlag = {
|
|
|
15257
15267
|
type: "string",
|
|
15258
15268
|
placeholder: LOCALES
|
|
15259
15269
|
};
|
|
15260
|
-
var
|
|
15261
|
-
flag: "
|
|
15262
|
-
field: "
|
|
15270
|
+
var currencyFlag = {
|
|
15271
|
+
flag: "currency",
|
|
15272
|
+
field: "currency",
|
|
15263
15273
|
type: "string",
|
|
15264
|
-
placeholder:
|
|
15274
|
+
placeholder: CURRENCIES.join("|")
|
|
15265
15275
|
};
|
|
15266
15276
|
function stayFlags(roomDescription) {
|
|
15267
15277
|
return [
|
|
@@ -15363,8 +15373,8 @@ var searchFlags = flagsOf(searchHotelsInput, [
|
|
|
15363
15373
|
flag: "price-max-per-room-night",
|
|
15364
15374
|
field: "filters.price.maxPerRoomNight",
|
|
15365
15375
|
type: "string",
|
|
15366
|
-
placeholder: "<
|
|
15367
|
-
description: "Highest indicative price per room per night, in USD, e.g. `150` or `149.50`. Needs a stay."
|
|
15376
|
+
placeholder: "<decimal>",
|
|
15377
|
+
description: "Highest indicative price per room per night, in the search's currency (`--currency`, else USD), e.g. `150` or `149.50`. Needs a stay."
|
|
15368
15378
|
},
|
|
15369
15379
|
{
|
|
15370
15380
|
flag: "sort",
|
|
@@ -15381,7 +15391,7 @@ var searchFlags = flagsOf(searchHotelsInput, [
|
|
|
15381
15391
|
description: "`nextCursor` from the previous page. A next page takes only `--cursor` and `--limit`."
|
|
15382
15392
|
},
|
|
15383
15393
|
localeFlag,
|
|
15384
|
-
|
|
15394
|
+
currencyFlag
|
|
15385
15395
|
]);
|
|
15386
15396
|
var hotelFlags = flagsOf(getHotelInput, [
|
|
15387
15397
|
{
|
|
@@ -15413,7 +15423,7 @@ var offersFlags = flagsOf(hotelOffersInput, [
|
|
|
15413
15423
|
},
|
|
15414
15424
|
{ flag: "limit-per-hotel", field: "limitPerHotel", type: "number", placeholder: COUNT },
|
|
15415
15425
|
localeFlag,
|
|
15416
|
-
|
|
15426
|
+
currencyFlag
|
|
15417
15427
|
]);
|
|
15418
15428
|
var bookFlags = flagsOf(createOrderInput, [
|
|
15419
15429
|
{
|
|
@@ -15452,10 +15462,9 @@ var cancelFlags = flagsOf(cancelOrderInput, [
|
|
|
15452
15462
|
{
|
|
15453
15463
|
flag: "max-penalty",
|
|
15454
15464
|
field: "maximumPenalty",
|
|
15455
|
-
type: "
|
|
15456
|
-
optional: true,
|
|
15465
|
+
type: "string",
|
|
15457
15466
|
placeholder: "<amount>",
|
|
15458
|
-
description: "
|
|
15467
|
+
description: "To cancel a paid order: the penalty the user agreed to, exactly as `orders get` shows it, in the order's currency, e.g. `12.50`. Without it or --close, the command changes nothing: it shows the penalty and the refund, or that the order can be closed."
|
|
15459
15468
|
}
|
|
15460
15469
|
]);
|
|
15461
15470
|
var payFlags = flagsOf(payOrderInput, [
|
|
@@ -15464,22 +15473,22 @@ var payFlags = flagsOf(payOrderInput, [
|
|
|
15464
15473
|
field: "sharedPaymentToken",
|
|
15465
15474
|
type: "string",
|
|
15466
15475
|
placeholder: "<spt_\u2026>",
|
|
15467
|
-
description: "Required unless --
|
|
15476
|
+
description: "Required unless --method. The spt_\u2026 token the user's Link wallet issued for this order. For agents that can request a token from the user's Link wallet; people pay by the order's link or --method."
|
|
15468
15477
|
},
|
|
15469
15478
|
{
|
|
15470
|
-
flag: "
|
|
15479
|
+
flag: "method",
|
|
15471
15480
|
field: "method",
|
|
15472
|
-
type: "
|
|
15473
|
-
|
|
15474
|
-
description: "Pay
|
|
15481
|
+
type: "string",
|
|
15482
|
+
placeholder: "stripe_alipay_wechat_pay",
|
|
15483
|
+
description: "Pay by a method in the order's payment.methods instead of a token: stripe_alipay_wechat_pay is Alipay or WeChat Pay, and prints the WeChat Pay code and both links."
|
|
15475
15484
|
},
|
|
15476
15485
|
{
|
|
15477
15486
|
flag: "total",
|
|
15478
15487
|
field: "total",
|
|
15479
15488
|
type: "string",
|
|
15480
|
-
placeholder: "<
|
|
15489
|
+
placeholder: "<decimal>",
|
|
15481
15490
|
required: "always",
|
|
15482
|
-
description: "The total the user approved, exactly as `orders get` shows it, in
|
|
15491
|
+
description: "The total the user approved, exactly as `orders get` shows it, in the order's currency, e.g. `125.00`."
|
|
15483
15492
|
}
|
|
15484
15493
|
]);
|
|
15485
15494
|
var BODY_OPTION = {
|
|
@@ -15543,10 +15552,17 @@ var COMMANDS = [
|
|
|
15543
15552
|
{
|
|
15544
15553
|
group: "orders",
|
|
15545
15554
|
name: "cancel",
|
|
15546
|
-
summary: "
|
|
15555
|
+
summary: "With the penalty the user agreed to (--max-penalty) it cancels a paid order under its terms, and --close closes an unpaid one; with neither it changes nothing and shows what the order allows",
|
|
15547
15556
|
tool: "cancel_order",
|
|
15548
15557
|
flags: cancelFlags,
|
|
15549
|
-
positionals: [positional(cancelOrderInput, "orderId")]
|
|
15558
|
+
positionals: [positional(cancelOrderInput, "orderId")],
|
|
15559
|
+
options: [
|
|
15560
|
+
{
|
|
15561
|
+
flag: "close",
|
|
15562
|
+
type: "boolean",
|
|
15563
|
+
description: "Close an unpaid order (cancel.reason unpaid), only once the user says they no longer want it: nothing is charged, and it becomes expired. Nothing is sent for an order that can't be closed."
|
|
15564
|
+
}
|
|
15565
|
+
]
|
|
15550
15566
|
},
|
|
15551
15567
|
{
|
|
15552
15568
|
group: "orders",
|
|
@@ -15584,21 +15600,6 @@ var COMMANDS = [
|
|
|
15584
15600
|
tool: null,
|
|
15585
15601
|
flags: []
|
|
15586
15602
|
},
|
|
15587
|
-
{
|
|
15588
|
-
group: null,
|
|
15589
|
-
name: "guide",
|
|
15590
|
-
summary: "Print the guide for AI agents (Markdown); `fortrip guide planning` prints the planning guide",
|
|
15591
|
-
tool: "get_planning_guide",
|
|
15592
|
-
flags: [],
|
|
15593
|
-
positionals: [
|
|
15594
|
-
{
|
|
15595
|
-
name: "topic",
|
|
15596
|
-
field: null,
|
|
15597
|
-
optional: true,
|
|
15598
|
-
description: "`planning` for the planning guide; left out, the main guide."
|
|
15599
|
-
}
|
|
15600
|
-
]
|
|
15601
|
-
},
|
|
15602
15603
|
{
|
|
15603
15604
|
group: null,
|
|
15604
15605
|
name: "mcp",
|
|
@@ -15633,17 +15634,17 @@ var GLOBAL_FLAGS = [
|
|
|
15633
15634
|
// ../contract/src/guide-data.generated.ts
|
|
15634
15635
|
var FRAGMENTS = {
|
|
15635
15636
|
"booking": "{{#if claude-skill cli}}\n## Ordering\n\n{{/if}}\n- Call `{{tool:hotels book}}` only for the offer the user picked, with at least one guest per room{{#if claude-skill cli}}, named as the user gave them{{/if}}; never invent guests.{{#if claude-skill cli}} Room 1 is the offer's first room, and a room takes no more guests than it sleeps.{{/if}}\n- Guest names: Latin letters as on the passport (M\xFCller \u2192 Mueller), first and last name 1\u2013{{limit:guestName}} characters each{{#if cli}}, as `--guest 1:John:Smith` (room 1, first name, last name){{/if}}.\n{{#if claude-skill cli}}\n- The contact's first and last name (up to {{limit:contactFirstName}} characters each), email and phone (with its country code) are all required. Special requests must be in English and aren't guaranteed.\n{{/if}}\n- `{{tool:hotels book}}` can take about two minutes{{#if cli}}: allow the command at least 3 minutes{{/if}}. If it times out, {{#if cli}}run it again with identical flags{{/if}}{{#if mcp claude-skill}}call it again with the same details{{/if}}: it returns the same order.\n{{#if mcp}}\n- On `offer_changed`, show the user every change and ask again before ordering the new offer.\n{{/if}}\n{{#if cli}}\n- `{{tool:hotels book}}` takes only these fields: a `--body` with any other field (such as `nationality`) is rejected with exit 2.\n{{/if}}\n",
|
|
15636
|
-
"errors": "{{#if claude-skill cli}}\n## Errors\n\n{{#if claude-skill}}A tool error{{/if}}{{#if cli}}An error on stderr{{/if}} carries `code`, `message` and `retryable`, and `retryAfterSeconds` when waiting helps; many carry `details`. Search errors are under Search. Ordering errors:\n\n| `code` | Do this |\n|---|---|\n| `offer_changed` (409) | The price or terms changed since the offer: `changes` lists every change (`worse` says which are worse for the user) and `offer` is the new offer. Show the user every change and ask again; if they still want it, order the new offer, and confirm the new order before giving its link |\n| `offer_expired` (409) | Get offers again and let the user choose again |\n| `offer_unavailable` (422) | The offer is sold out or was refused: get offers again and let the user choose again |\n| `order_in_progress` (409) | The same order is still being created: wait `retryAfterSeconds`, then {{#if claude-skill}}call again with the same details{{/if}}{{#if cli}}run the command again with identical flags{{/if}} |\n| `offer_already_ordered` (409) | This offer was already ordered with other details: show that order (`orderId`) instead. An offer is ordered once
|
|
15637
|
+
"errors": "{{#if claude-skill cli}}\n## Errors\n\n{{#if claude-skill}}A tool error{{/if}}{{#if cli}}An error on stderr{{/if}} carries `code`, `message` and `retryable`, and `retryAfterSeconds` when waiting helps; many carry `details`. Search errors are under Search. Ordering errors:\n\n| `code` | Do this |\n|---|---|\n| `offer_changed` (409) | The price or terms changed since the offer: `changes` lists every change (`worse` says which are worse for the user) and `offer` is the new offer. Show the user every change and ask again; if they still want it, order the new offer, and confirm the new order before giving its link |\n| `offer_expired` (409) | Get offers again and let the user choose again |\n| `offer_unavailable` (422) | The offer is sold out or was refused: get offers again and let the user choose again |\n| `order_in_progress` (409) | The same order is still being created: wait `retryAfterSeconds`, then {{#if claude-skill}}call again with the same details{{/if}}{{#if cli}}run the command again with identical flags{{/if}} |\n| `offer_already_ordered` (409) | This offer was already ordered with other details: show that order (`orderId`) instead. An offer is ordered once, even when its order failed or expired: to order with other details, get offers again |\n| `stay_unsupported` (422) | `mixed_occupancy`: order once per party; `max_nights`: at most `max` nights per order |\n| `currency_unavailable` (422) | Prices in `details.currency` aren't available yet: tell the user, and ask whether to see USD prices |\n| `stay_in_past` (422) | Check-in has passed in the hotel's time zone: ask for new dates |\n| `ordering_paused` (503) | Ordering is paused on Fortrip's side: tell the user, and try again only after `retryAfterSeconds` |\n\nAny code:\n\n- `invalid_request` (400): `details.issues` lists each bad field; fix them. For amenities, `details.filterable` lists those that can filter.\n- `cursor_invalid` (400): the page is gone; search again from the first page.\n- `not_found` (404): no such hotel, or no such order for this user.\n- `rate_limited` (429): wait `retryAfterSeconds`, then retry once.\n- `service_unavailable` (503) and `supplier_unavailable` (503 or 504): wait `retryAfterSeconds`, then retry once with the same details; if it fails again, tell the user.\n- Any other code: read `message`. If `retryable` is true, wait `retryAfterSeconds` and retry once; otherwise tell the user instead of guessing.\n{{/if}}\n",
|
|
15637
15638
|
"meals": '{{#if claude-skill cli}}\n## Presenting an offer\n\nGive the user, for each offer:\n\n- the room (`room.name`, beds, size) and the total, as above;\n- the meals: `meals.included` (breakfast, lunch, dinner) or `allInclusive`, with `guestsCoveredPerRoom`. Fewer than the guests per room means not everyone gets the meals (breakfast for 1 with 2 adults in the room): say who is covered. `unspecifiedMainMeals` counts main meals the hotel didn\'t name. With `known: false`, the meals are unknown: say so, and don\'t call it room only;\n- cancellation: `status` (`free`, `partial_penalty`, `non_refundable` or `unknown`), `freeCancellationEndsAt` (null with `free`: free until check-in) and the `penalties`. Times are in UTC: also give them in the hotel\'s `timeZone`;\n- confirmation: `mode` `instant` or `on_request` (within `withinMinutes`);\n- fees payable at the property (`payAtProperty.items`), in the property\'s currency. `disclosure: "incomplete"` means there can be fees not listed: say so.\n\nAn offer expires at `expiresAt`, about 30 minutes after it was made; after that, get offers again.\n\n"Not listed" is not "no": `listed: false` (amenities, policies, rooms), `null` and `unknown` mean the source didn\'t say. Tell the user it\'s unknown instead of turning it into "no".\n{{/if}}\n{{#if mcp}}\n- "Not listed" or "unknown" is not "no".\n{{/if}}\n',
|
|
15638
15639
|
"occupancy": "{{#if claude-skill cli}}\n## Rooms and guests\n\n- {{#if mcp claude-skill}}`stay.rooms` lists each room's party as `{ adults, childrenAges }`: two rooms of 2 adults, one with a child of 6, is `[{ adults: 2, childrenAges: [6] }, { adults: 2, childrenAges: [] }]`{{/if}}{{#if cli}}`--room <adults[:age,\u2026]>`, once per room, gives each room's party: two rooms of 2 adults, one with a child of 6, is `--room 2:6 --room 2`{{/if}}.\n- Ask each child's age; offers need it.\n- If the party doesn't split evenly across the rooms (3 adults in 2 rooms), ask the user how it splits.\n{{/if}}\n- Offers and orders take one party per call, every room the same: for different parties, order once per party.{{#if claude-skill cli}} `{{tool:hotels offers}}` answers `stay_unsupported` (`mixed_occupancy`) for mixed rooms; `{{tool:hotels search}}` accepts them but prices only from the dates, with the note `party_split_required`.{{/if}}\n{{#if claude-skill cli}}\n- Limits: 1\u2013{{limit:rooms}} rooms, 1\u2013{{limit:adultsPerRoom}} adults and 0\u2013{{limit:childrenPerRoom}} children (aged 0\u2013{{limit:childAgeMax}}) per room, 1\u2013{{limit:nightsSupplier}} nights, up to {{limit:offersHotels}} hotels per `{{tool:hotels offers}}` call. A longer stay answers `stay_unsupported` (`max_nights`): ask the user whether to split it into consecutive stays, each its own order.\n{{/if}}\n",
|
|
15639
|
-
"order": '{{#if claude-skill cli}}\n## Workflow\n\n1. **Search** with `{{tool:hotels search}}` for candidate hotels: a destination, `{{arg:text}}` or both, and the stay\'s dates and rooms for indicative prices.\n{{#if cli}}\n\n ```bash\n {{tool:hotels search}} --place-name Bangkok --country TH --check-in 2026-11-10 \\\n --check-out 2026-11-12 --room 2 --stars-min 4 --sort price_asc --limit 10\n ```\n\n{{/if}}\n2. **Details** (optional) with `{{tool:hotels get}}`, when the user asks about a hotel or a stated preference needs evidence (a pool, a policy, room size). For a details-only question, call it directly when you know the hotel\'s `hotelId`; otherwise find the hotel with `{{tool:hotels search}}`.\n{{#if cli}}\n\n ```bash\n {{tool:hotels get}} <hotelId> [--rooms]\n ```\n\n{{/if}}\n3. **Offers** with `{{tool:hotels offers}}` for a few shortlisted hotels, with the dates and rooms the user will order. It takes about 15 seconds. A hotel is available only once this returns an offer for it.\n{{#if cli}}\n\n ```bash\n {{tool:hotels offers}} --hotel <hotelId> --hotel <hotelId> --check-in 2026-11-10 \\\n --check-out 2026-11-12 --room 2 --room 2 [--require-free-cancellation]\n ```\n\n{{/if}}\n4. **Order** with `{{tool:hotels book}}`, once the user has picked one offer and given the guests and the contact (see Ordering).\n{{#if cli}}\n\n ```bash\n {{tool:hotels book}} --offer <offerId> --guest 1:John:Smith --guest 2:Mary:Smith \\\n --first-name John --last-name Smith --email john@example.com \\\n --phone "+8613800000000"\n ```\n\n{{/if}}\n5. **Confirm, then give the payment link**, as in "Before giving the payment link" below.\n6. **After payment**, check the order with `{{tool:orders get}}` (see After payment).\n\n## Search\n\n### Where\n\n- **A place by name:** {{#if mcp claude-skill}}`{ kind: "place_name", name, countryCode }`{{/if}}{{#if cli}}`--place-name <name> --country <CC>`{{/if}}, in any language (Kyoto or \u4EAC\u90FD). The country is required: ask the user when it isn\'t clear. Names match exactly, ignoring only case and spacing: accents, hyphens, apostrophes and periods count ("K\xF6ln" or "Cologne", not "Koln"; "St. Moritz", not "St Moritz").\n- If several places bear the name, the answer is `destination_ambiguous` with up to {{limit:candidatesShown}} candidates and their hotel counts: ask the user which one they mean, then search it by its `placeId`; never pick one yourself.\n- `destination_not_found` with `no_match` means no place of that name in that country: check the spelling and accents, or try another name for the place. Its `nameAsText` counts the hotels that a `{{arg:text}}` search for the name would find.\n- **A place from an earlier answer:** {{#if mcp claude-skill}}`{ kind: "place", placeId }`{{/if}}{{#if cli}}`--place <placeId>`{{/if}}.\n- **Near a point:** {{#if mcp claude-skill}}`{ kind: "point", location: { lat, lng } }`{{/if}}{{#if cli}}`--point <lat,lng>`{{/if}}, for "near X" when you know where X is.\n- **A whole country:** {{#if mcp claude-skill}}`{ kind: "country", countryCode }`{{/if}}{{#if cli}}`--country-only <CC>`{{/if}}, as for the Maldives.\n- Countries, regions (states, provinces), prefecture-level cities in China and main islands cover their whole area. Towns, neighbourhoods, districts, small islands and points cover a circle of {{limit:radiusMetersDefault}} meters; `{{arg:destination.radiusMeters}}` sets another, up to {{limit:radiusMetersMax}} meters, and narrows an area to a circle around its center.\n- **Localities:** an area search lists its `localities`, the towns its hotels belong to, each with a `placeId`, its hotel `count` and the places it `includes` (Patong is part of Phuket). To search one, pass it as {{#if mcp claude-skill}}`{ kind: "locality", placeId }`{{/if}}{{#if cli}}`--locality <placeId>`{{/if}}. A town that isn\'t a locality answers `destination_not_found` with `not_a_locality` and, in `hub`, the locality it belongs to: search that locality, or the town itself with {{#if mcp claude-skill}}`kind: "place"`{{/if}}{{#if cli}}`--place`{{/if}} for a circle around it.\n- A price sort or price filter over more than {{limit:poolLimit}} hotels (in an area, or for text alone) answers `search_too_broad` with `matched` and the top `localities`: show them and ask the user which they prefer, unless the request already names one of them; search that one by its `placeId` as a locality, never by its name.\n\n### Text\n\n`{{arg:text}}` matches exact words in hotel names and addresses, in Chinese or English:\n\n- Every word must match as written: plurals, accents, spacing and abbreviations count ("hostel" and "hostels", "St Regis" and "Saint Regis" find different hotels). Hyphens and apostrophes don\'t (Ritz-Carlton finds Ritz Carlton).\n- In Chinese, matching follows word segmentation, so part of a name can match unrelated hotels (\u5E0C\u5C14 is not \u5E0C\u5C14\u987F).\n- Use only distinctive words: a hotel or brand name, a district or a landmark. Not "hotel", "near", "cheap" or "best".\n- Typos return nothing: "Shangahi" finds no hotel.\n- Place names belong in the destination: "Maldives" as text finds a hotel named Maldives in China.\n\n### Filters\n\n- Stars run from 1 to 5 in half steps{{#if mcp claude-skill}} (`filters.stars`){{/if}}. "4 stars" as {{#if mcp claude-skill}}`{ min: 4, max: 4 }`{{/if}}{{#if cli}}`--stars-min 4 --stars-max 4`{{/if}} leaves out 4.5: unless the user means exactly 4, use {{#if mcp claude-skill}}`{ min: 4 }`{{/if}}{{#if cli}}`--stars-min 4`{{/if}} or ask. Unrated hotels are left out whenever stars are filtered.\n- `{{arg:filters.amenities}}` takes only the amenities that can filter (such as pool, parking, wifi); others, such as gym or spa, show in `{{tool:hotels get}}` but can\'t filter. A hotel matches only when it lists the amenity, and about half the hotels list no amenities at all (`coverage.excludedNoFacilityData` counts those left out): "not listed" is not "absent".\n- `{{arg:filters.price.maxPerRoomNight}}` bounds the indicative price per room per night, in
|
|
15640
|
-
"payment-link": "{{#if claude-skill cli}}\n## Before giving the payment link\n\n`{{tool:hotels book}}` answers with an unpaid order: `status` `awaiting_payment`, its `reference` (the support number), `price.total`, the stay and its terms, and `payment.url`, a Fortrip page that recaps the order and continues to payment
|
|
15641
|
-
"planning": "# Planning a hotel stay\n\nRead this when the request is more than one hotel for fixed dates: flexible dates, a budget, split stays, several destinations, or \"find me the best\". The rules in {{#if mcp}}the server instructions{{/if}}{{#if claude-skill}}SKILL.md{{/if}}
|
|
15642
|
-
"presentation": "{{#if claude-skill}}\n## Presenting hotels\n\nIf your interface can show rich elements, show each hotel as a card with only what Fortrip's tools returned for it in this conversation: photo, name, stars, region and price, and once you have offers every term that changes the choice (meals and who they cover, cancellation, fees payable at the property, confirmation), an unknown one as unknown. Label a search's `price.fromPerRoomNight` as an estimate per room-night and an offer's `price.total` as the whole stay for all rooms, in
|
|
15643
|
-
"prices": "{{#if claude-skill cli}}\n## Prices and currency\n\n- A search price (`price.fromPerRoomNight`) is indicative and not bookable: the lowest price of one unit (a room or, at a hostel, possibly a bed) per night, for any party and often any date, and it can be well above or below the offers. Call it an estimate, quote `{{tool:hotels offers}}` prices, and never call a search result available or bookable. `price: null` means there is no indicative price, not that the hotel is full; about half the hotels have none for given dates.\n{{/if}}\n{{#if mcp}}\n- Search prices are indicative, not bookable: quote `{{tool:hotels offers}}` prices.\n{{/if}}\n- {{#if claude-skill cli}}In an offer or order, {{/if}}`price.total` is the whole stay for all rooms and is what is charged, in USD
|
|
15644
|
-
"scope": "{{#if claude-skill cli}}\n# Fortrip hotel stays\n\n{{/if}}\nFortrip: hotel search, live offers and orders with a payment link.{{#if claude-skill cli}} Not for flights, activities, or changing an existing order.{{/if}}\n\n{{#if mcp}}\nCall order: `{{tool:hotels search}}` \u2192 (optional) `{{tool:hotels get}}` \u2192 `{{tool:hotels offers}}` \u2192 `{{tool:hotels book}}`; after the user pays, `{{tool:orders get}}`; `{{tool:orders list}}` lists, `{{tool:orders cancel}}` cancels, `{{tool:orders pay}}` pays by token or Alipay/WeChat Pay
|
|
15640
|
+
"order": '{{#if claude-skill cli}}\n## Workflow\n\n1. **Search** with `{{tool:hotels search}}` for candidate hotels: a destination, `{{arg:text}}` or both, and the stay\'s dates and rooms for indicative prices.\n{{#if cli}}\n\n ```bash\n {{tool:hotels search}} --place-name Bangkok --country TH --check-in 2026-11-10 \\\n --check-out 2026-11-12 --room 2 --stars-min 4 --sort price_asc --limit 10\n ```\n\n{{/if}}\n2. **Details** (optional) with `{{tool:hotels get}}`, when the user asks about a hotel or a stated preference needs evidence (a pool, a policy, room size). For a details-only question, call it directly when you know the hotel\'s `hotelId`; otherwise find the hotel with `{{tool:hotels search}}`.\n{{#if cli}}\n\n ```bash\n {{tool:hotels get}} <hotelId> [--rooms]\n ```\n\n{{/if}}\n3. **Offers** with `{{tool:hotels offers}}` for a few shortlisted hotels, with the dates and rooms the user will order. It takes about 15 seconds. A hotel is available only once this returns an offer for it.\n{{#if cli}}\n\n ```bash\n {{tool:hotels offers}} --hotel <hotelId> --hotel <hotelId> --check-in 2026-11-10 \\\n --check-out 2026-11-12 --room 2 --room 2 [--require-free-cancellation]\n ```\n\n{{/if}}\n4. **Order** with `{{tool:hotels book}}`, once the user has picked one offer and given the guests and the contact (see Ordering).\n{{#if cli}}\n\n ```bash\n {{tool:hotels book}} --offer <offerId> --guest 1:John:Smith --guest 2:Mary:Smith \\\n --first-name John --last-name Smith --email john@example.com \\\n --phone "+8613800000000"\n ```\n\n{{/if}}\n5. **Confirm, then give the payment link**, as in "Before giving the payment link" below.\n6. **After payment**, check the order with `{{tool:orders get}}` (see After payment).\n\n## Search\n\n### Where\n\n- **A place by name:** {{#if mcp claude-skill}}`{ kind: "place_name", name, countryCode }`{{/if}}{{#if cli}}`--place-name <name> --country <CC>`{{/if}}, in any language (Kyoto or \u4EAC\u90FD). The country is required: ask the user when it isn\'t clear. Names match exactly, ignoring only case and spacing: accents, hyphens, apostrophes and periods count ("K\xF6ln" or "Cologne", not "Koln"; "St. Moritz", not "St Moritz").\n- If several places bear the name, the answer is `destination_ambiguous` with up to {{limit:candidatesShown}} candidates and their hotel counts: ask the user which one they mean, then search it by its `placeId`; never pick one yourself.\n- `destination_not_found` with `no_match` means no place of that name in that country: check the spelling and accents, or try another name for the place. Its `nameAsText` counts the hotels that a `{{arg:text}}` search for the name would find.\n- **A place from an earlier answer:** {{#if mcp claude-skill}}`{ kind: "place", placeId }`{{/if}}{{#if cli}}`--place <placeId>`{{/if}}.\n- **Near a point:** {{#if mcp claude-skill}}`{ kind: "point", location: { lat, lng } }`{{/if}}{{#if cli}}`--point <lat,lng>`{{/if}}, for "near X" when you know where X is.\n- **A whole country:** {{#if mcp claude-skill}}`{ kind: "country", countryCode }`{{/if}}{{#if cli}}`--country-only <CC>`{{/if}}, as for the Maldives.\n- Countries, regions (states, provinces), prefecture-level cities in China and main islands cover their whole area. Towns, neighbourhoods, districts, small islands and points cover a circle of {{limit:radiusMetersDefault}} meters; `{{arg:destination.radiusMeters}}` sets another, up to {{limit:radiusMetersMax}} meters, and narrows an area to a circle around its center.\n- **Localities:** an area search lists its `localities`, the towns its hotels belong to, each with a `placeId`, its hotel `count` and the places it `includes` (Patong is part of Phuket). To search one, pass it as {{#if mcp claude-skill}}`{ kind: "locality", placeId }`{{/if}}{{#if cli}}`--locality <placeId>`{{/if}}. A town that isn\'t a locality answers `destination_not_found` with `not_a_locality` and, in `hub`, the locality it belongs to: search that locality, or the town itself with {{#if mcp claude-skill}}`kind: "place"`{{/if}}{{#if cli}}`--place`{{/if}} for a circle around it.\n- A price sort or price filter over more than {{limit:poolLimit}} hotels (in an area, or for text alone) answers `search_too_broad` with `matched` and the top `localities`: show them and ask the user which they prefer, unless the request already names one of them; search that one by its `placeId` as a locality, never by its name.\n\n### Text\n\n`{{arg:text}}` matches exact words in hotel names and addresses, in Chinese or English:\n\n- Every word must match as written: plurals, accents, spacing and abbreviations count ("hostel" and "hostels", "St Regis" and "Saint Regis" find different hotels). Hyphens and apostrophes don\'t (Ritz-Carlton finds Ritz Carlton).\n- In Chinese, matching follows word segmentation, so part of a name can match unrelated hotels (\u5E0C\u5C14 is not \u5E0C\u5C14\u987F).\n- Use only distinctive words: a hotel or brand name, a district or a landmark. Not "hotel", "near", "cheap" or "best".\n- Typos return nothing: "Shangahi" finds no hotel.\n- Place names belong in the destination: "Maldives" as text finds a hotel named Maldives in China.\n\n### Filters\n\n- Stars run from 1 to 5 in half steps{{#if mcp claude-skill}} (`filters.stars`){{/if}}. "4 stars" as {{#if mcp claude-skill}}`{ min: 4, max: 4 }`{{/if}}{{#if cli}}`--stars-min 4 --stars-max 4`{{/if}} leaves out 4.5: unless the user means exactly 4, use {{#if mcp claude-skill}}`{ min: 4 }`{{/if}}{{#if cli}}`--stars-min 4`{{/if}} or ask. Unrated hotels are left out whenever stars are filtered.\n- `{{arg:filters.amenities}}` takes only the amenities that can filter (such as pool, parking, wifi); others, such as gym or spa, show in `{{tool:hotels get}}` but can\'t filter. A hotel matches only when it lists the amenity, and about half the hotels list no amenities at all (`coverage.excludedNoFacilityData` counts those left out): "not listed" is not "absent".\n- `{{arg:filters.price.maxPerRoomNight}}` bounds the indicative price per room per night, in the search\'s currency; hotels without one are left out and counted.\n\n### Results\n\n- `notes` explain the answer (a limited pool, a circle around an island, more hotels just outside it): pass on what matters to the user.\n- `coverage` has the counts: `matched` hotels, how many were priced and how many have a price.\n- A next page is {{#if mcp claude-skill}}`cursor` set to `nextCursor` and, optionally, `limit`{{/if}}{{#if cli}}`--cursor <nextCursor>` and, optionally, `--limit`{{/if}}; nothing else.\n{{/if}}\n{{#if mcp}}\n- A place name needs its `countryCode` (ask the user if unclear) and matches exactly (accents and periods count). On `destination_ambiguous`, ask the user which they mean, then search its `placeId`; never pick one yourself.\n- On `search_too_broad`, show its `localities` and ask the user which, unless they already named one; search it as `{ kind: "locality", placeId }`, never by name.\n- `text` matches whole words of hotel names and addresses: use a distinctive name, brand or landmark.\n{{/if}}\n',
|
|
15641
|
+
"payment-link": "{{#if claude-skill cli}}\n## Before giving the payment link\n\n`{{tool:hotels book}}` answers with an unpaid order: `status` `awaiting_payment`, its `reference` (the support number), `price.total`, the stay and its terms, and `payment.url`, a Fortrip page that recaps the order and continues to the payment provider. Nothing is charged until the user pays.\n\n1. Show the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation (status, deadline, penalties) and fees payable at the property, unknowns included.\n2. End that reply by asking the user to confirm, and wait for a clear yes. Urgency is not consent.\n3. Then give `payment.url` exactly as returned: don't shorten, rebuild or re-encode it.\n\n{{/if}}\n{{#if mcp}}\n- Pay one way only: give `payment.url` or call `{{tool:orders pay}}`. First show the order's total and currency, the stay and every term, end that reply by asking the user to confirm, and wait for a clear yes. Then give `payment.url` exactly as returned, to this user only: anyone holding it can pay.\n{{/if}}\n{{#if claude-skill cli}}\n- `payment.url` works like a payment credential: anyone holding it can pay. Give it to this user only, never in shared channels, documents, logs or tickets. With `requiresSignIn: true` (an order started on the Fortrip website), the user signs in to pay.\n- The link expires at `payment.expiresAt`; the order is then `expired`. To order the stay again, get offers again, and confirm the new order with the user before giving its link.\n- Another order of the stay (another party, or a corrected guest name) needs a new offer: get offers again. When it replaces an unpaid order, tell the user to pay only the new link; the earlier one expires unpaid, or can be closed now with `{{tool:orders cancel}}`{{#if cli}} and `--close`{{/if}} once the user says they no longer want it.\n- An order `awaiting_payment` with `payment.status` `unpaid` whose `payment.url` is null had its link unreadable this time: read it again with `{{tool:orders get}}`.\n{{/if}}\n- Never ask for, accept or pass on payment card details; payment happens only through Stripe.{{#if claude-skill cli}} A card number in a guest name, the contact or the special requests is rejected{{#if cli}} with exit 2{{/if}}.{{/if}}\n{{#if claude-skill cli}}\n\n## Paying without the link\n\nAn order whose `payment.methods` has the `stripe_shared_payment_token` entry (in {{#if claude-skill}}a result's text{{/if}}{{#if cli}}the text output{{/if}}, the line \"Pay without the link\") can also be paid through `{{tool:orders pay}}` with a Stripe shared payment token that the user's Link wallet grants for it. Use it only if you have a tool that can request such a token from the user's Link wallet: Link is for US and Canadian accounts, and caps a spend request at ${{limit:tokenPaymentMaxUsd}}, so only a USD order up to that has such an entry. Otherwise give `payment.url`, and never ask the user to create, type or paste a token.\n\n1. Show the user the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation and fees payable at the property. End that reply by asking the user to confirm, and wait for a clear yes. The token comes from the user's wallet, never from card details.\n2. Request the token from the user's Link wallet with that entry's `handler.config.business_profile` and its `limits`: `maxAmount` (in cents), `currency` and `expiresAt`.\n3. {{#if claude-skill}}Call{{/if}}{{#if cli}}Run{{/if}} `{{tool:orders pay}}` with the token and the order's `price.total`{{#if cli}} (`--token`, `--total`){{/if}}{{#if claude-skill}}, the token as `sharedPaymentToken` or in UCP's `payment.instruments`{{/if}}. The order is then `confirming`, its payment `authorized`: check it as after payment.\n\nThe charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: either give `payment.url` or {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders pay}}`. Once `{{tool:orders pay}}` succeeds, `payment.url` stops working; a payment that fails leaves the link open. `payment_total_changed` means the total sent isn't the order's (`details.total`); the order's total hasn't changed: confirm it with the user, then {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders pay}}` again with it and the same token. `payment_declined`: the user picks another payment method in their wallet, or pays by link. `payment_action_required`: the card needs a verification this can't give: pay by link. `payment_credential_invalid`: request a new token with that entry's `limits`. `service_unavailable`: call `{{tool:orders pay}}` again with the same token, never a new one. A token pays one order only.\n\n## Paying with Alipay or WeChat Pay\n\nAn order whose result text has the line \"Pay with Alipay or WeChat Pay\" can be paid in the user's Alipay or WeChat wallet, with no token: it is for users who have a mainland-China wallet. {{#if claude-skill}}Call{{/if}}{{#if cli}}Run{{/if}} `{{tool:orders pay}}` {{#if claude-skill}}with `method` `stripe_alipay_wechat_pay`{{/if}}{{#if cli}}the way that line shows{{/if}} and the order's `price.total`, only after the user has confirmed.\n\n1. Show the user the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation and fees payable at the property. End that reply by asking the user to confirm, and wait for a clear yes. Pay one way only: `payment.url` or this.\n2. Then show the `stripe_alipay_wechat_pay` entry of `payment.methods`: the WeChat Pay code as an image if you can, and both links (WeChat Pay and Alipay). The user pays once, by either. Alipay and WeChat Pay charge at once; if the hotel can't confirm, the payment is refunded in full. The total is in the order's currency, and the wallets show it in yuan at their rate.\n3. Check the order with `{{tool:orders get}}` until it isn't `awaiting_payment`.\n\nA WeChat Pay code expires {{limit:wechatCodeMinutes}} minutes after it is made, and goes dead earlier if the user opens the Alipay link instead. Then that entry's `wechatPay.qrData` is null: tell the user to open the WeChat link again, or {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders pay}}` again for a new code.\n\nWeChat can't scan a code shown on the same phone's screen. Offer both ways, since you can't tell which device the user is on: save the image and scan it from the album (WeChat, then Scan, then Album), or open the WeChat link on another screen; on a phone, the Alipay link opens the Alipay app.\n\n## After payment\n\nCheck the order with `{{tool:orders get}}`:\n\n- `confirming` while the hotel confirms, then `confirmed` with the hotel's `confirmationNumber`.\n- `failed`: no stay was booked; `payment.status` says whether the payment was released or refunded.\n- `needs_attention`: Fortrip is looking into it; the user can email {{support}} with the `reference`.\n- `manageUrl` is the user's own page for the order.\n{{/if}}\n",
|
|
15642
|
+
"planning": "# Planning a hotel stay\n\nRead this when the request is more than one hotel for fixed dates: flexible dates, a budget, split stays, several destinations, or \"find me the best\". The rules in {{#if mcp}}the server instructions{{/if}}{{#if claude-skill cli}}SKILL.md{{/if}} still apply (call order, destinations, one party per offer and order, confirming the order `{{tool:hotels book}}` returns before giving the payment link); this covers what to ask, how to compare and how to present.{{#if cli}} As there, `fortrip` is short for `npx -y fortrip@latest`.{{/if}}\n\n## What to collect\n\nKeep track of: dates (or the flexible window), nights, destination(s) with their country, rooms and the guests in each room, room constraints (beds, connecting rooms, accessibility), budget, and what the user said matters most (cheapest, most flexible, closest to X).\n\nOffers and orders take one party per call, every room the same, so if the party doesn't split evenly across the rooms, ask how it splits. Rooms for different parties are priced and ordered separately, each order with its own payment link.\n\nAsk only for what changes which hotels qualify or how they rank. \"4 stars\" as {{#if mcp claude-skill}}`{ min: 4, max: 4 }`{{/if}}{{#if cli}}`--stars-min 4 --stars-max 4`{{/if}} leaves out 4.5: unless the user means exactly 4, use {{#if mcp claude-skill}}`{ min: 4 }`{{/if}}{{#if cli}}`--stars-min 4`{{/if}} or ask. If children come along, ask each child's age; `{{tool:hotels offers}}` needs it. Don't ask for trip type or style: infer it from the conversation or leave it general. When a place name is ambiguous, ask which place the user means.\n\n## Evidence\n\n- A `{{tool:hotels search}}` price is an indicative estimate per room per night, not a quote. Never call a search result available or bookable, and once you have offers, compare offers only. A hotel without a search price can still have offers.\n- Use `{{tool:hotels get}}` only when a stated preference needs evidence (a pool, a policy, room size). An amenity or policy it doesn't list is unknown, not absent.\n- A hotel is available only once `{{tool:hotels offers}}` returned an offer for it.\n- Anything {{#if mcp claude-skill}}the tools{{/if}}{{#if cli}}the CLI{{/if}} didn't return, such as reviews, style, price trends or exchange rates, is unknown. Say so instead of filling it in.\n\n## Ranking\n\n1. Drop options that break a hard constraint (dates, guests, budget cap, required facility). Compare a budget in the unit the user gave it: per night, per room or for the whole stay. An offer's `price.total` covers the whole stay and every room, in the offer's currency.\n2. Keep only options with a live offer.\n3. Order by the user's stated main goal. Goals they didn't state don't count.\n4. Use other preferences only to break ties.\n\nUse the cheapest comparable offer as the baseline unless the user fixed the room type. Show at most three plans, each with its price difference from the baseline and what it trades off (meals, cancellation, location, confirmation). Keep hotel names as returned and dates in the user's notation.\n\nFor a split stay or several destinations, price each leg with its own `{{tool:hotels offers}}` call and add up the legs. Each leg is a separate `{{tool:hotels book}}` call, with its own confirmation and its own payment link.\n\n## Stop and say so\n\n- `{{tool:hotels offers}}` covers up to {{limit:offersHotels}} hotels per call and takes about 15 seconds, and its offers expire after about 30 minutes. If the request needs more hotels or date combinations than a few calls can cover, narrow it with the user, or present the result as a comparison of the hotels you priced, not the best overall.\n- When a search is too broad to price, show its localities and ask the user which they prefer, unless the request already names one of them; never pick one yourself.\n- Urgency is not consent. Call `{{tool:hotels book}}` only for the offer the user picked, and give its payment link only after the user confirms the total, currency, stay and terms of the order `{{tool:hotels book}}` returned.\n",
|
|
15643
|
+
"presentation": "{{#if claude-skill}}\n## Presenting hotels\n\nIf your interface can show rich elements, show each hotel as a card with only what Fortrip's tools returned for it in this conversation: photo, name, stars, region and price, and once you have offers every term that changes the choice (meals and who they cover, cancellation, fees payable at the property, confirmation), an unknown one as unknown. Label a search's `price.fromPerRoomNight` as an estimate per room-night and an offer's `price.total` as the whole stay for all rooms, in its currency, and draw a map only from returned `location` coordinates. Offer the choices you need to ask anyway (dates, a locality, which offer) as options to pick. Otherwise use a short list. Keep hotel names as returned, and never invent photos, ratings, reviews, prices, terms or coordinates.\n{{/if}}\n",
|
|
15644
|
+
"prices": "{{#if claude-skill cli}}\n## Prices and currency\n\n- A search price (`price.fromPerRoomNight`) is indicative and not bookable: the lowest price of one unit (a room or, at a hostel, possibly a bed) per night, for any party and often any date, and it can be well above or below the offers. Call it an estimate, quote `{{tool:hotels offers}}` prices, and never call a search result available or bookable. `price: null` means there is no indicative price, not that the hotel is full; about half the hotels have none for given dates.\n{{/if}}\n{{#if mcp}}\n- Search prices are indicative, not bookable: quote `{{tool:hotels offers}}` prices.\n{{/if}}\n- {{#if claude-skill cli}}In an offer or order, {{/if}}`price.total` is the whole stay for all rooms and is what is charged, in the request's `{{arg:currency}}` (`USD` by default); an order is in the currency of the offer it was made from.{{#if claude-skill cli}} `perNightAllRooms` is the total per night; to compare with a per-room budget, also divide by the rooms.{{/if}} On a USD order, Stripe's page may let the user pay in their card's local currency at Stripe's rate{{#if claude-skill cli}} (Adaptive Pricing): say so plainly, and that the total in that currency is the price{{/if}}.\n{{#if claude-skill cli}}\n- Every price of a response is in that one currency; don't convert it. `{{arg:currency}}`{{#if cli}} (or `FORTRIP_CURRENCY`){{/if}} is `USD` (the default) or `CNY`, where available; otherwise the answer is `currency_unavailable`.\n- Fees payable at the property (`payAtProperty`) are separate, in the property's own currency, not converted.\n- After payment, `payment.localCharge` is what the card paid in its own currency. Orders made on the Fortrip website can be charged in another currency: `payment.chargeCurrency` says which.\n{{/if}}\n",
|
|
15645
|
+
"scope": "{{#if claude-skill cli}}\n# Fortrip hotel stays\n\n{{/if}}\nFortrip: hotel search, live offers and orders with a payment link.{{#if claude-skill cli}} Not for flights, activities, or changing an existing order.{{/if}}\n\n{{#if mcp}}\nCall order: `{{tool:hotels search}}` \u2192 (optional) `{{tool:hotels get}}` \u2192 `{{tool:hotels offers}}` \u2192 `{{tool:hotels book}}`; after the user pays, `{{tool:orders get}}`; `{{tool:orders list}}` lists, `{{tool:orders cancel}}` cancels or closes an unpaid one, `{{tool:orders pay}}` pays by token or Alipay/WeChat Pay.\n{{/if}}\n{{#if claude-skill}}\nThe tools are on Fortrip's MCP server, named `fortrip` in this plugin (a Fortrip connector added on claude.ai can show under its own name). They're written `fortrip:<tool>` below:\n{{/if}}\n{{#if cli}}\nThe `fortrip` CLI (npm package `fortrip`) calls Fortrip as the signed-in user and prints each answer as compact text (`--json` prints its JSON):\n{{/if}}\n{{#if claude-skill cli}}\n\n| {{#if claude-skill}}Tool{{/if}}{{#if cli}}Command{{/if}} | Returns |\n|---|---|\n| `{{tool:hotels search}}` | Hotels in a place, near a point or matching a name (`{{arg:text}}`), with indicative prices |\n| `{{tool:hotels get}}` | One hotel's address, check-in and check-out times, description, policies, amenities and rooms; no prices |\n| `{{tool:hotels offers}}` | Live offers (room, meals, total and currency, cancellation terms) for up to {{limit:offersHotels}} hotels |\n| `{{tool:hotels book}}` | An unpaid order for one offer, with its terms and a payment link |\n| `{{tool:orders get}}` | One order and its status, including whether the hotel confirmed it |\n| `{{tool:orders list}}` | The user's orders, newest first, including those made on the Fortrip website |\n| `{{tool:orders cancel}}` | Cancels an order under its terms, for the penalty the user agreed to, and refunds the rest; closes an unpaid one |\n| `{{tool:orders pay}}` | Pays an order without its link, by a shared payment token from the user's wallet, or with Alipay or WeChat Pay |\n\nFor flexible dates, a budget, split stays, several destinations or \"find me the best\", read [references/planning.md](references/planning.md) before searching.\n{{/if}}\n",
|
|
15645
15646
|
"setup": "{{#if cli}}\n## Setup\n\nRun every command as `npx -y fortrip@latest <command>` (Node.js 22 or newer). The examples below shorten that to `fortrip`; `fortrip <command> --help` lists a command's flags. `{{tool:hotels search}}`, `{{tool:hotels offers}}` and `{{tool:hotels book}}` also take `--body '<json>'` (or `--body @file.json`), the raw request body; flags override its fields. Add `--json` to any command that calls Fortrip to get its answer as one line of JSON instead of text.\n\nWhen the user first asks about hotels, run `{{tool:whoami}}` before asking follow-up questions, so the sign-in can happen while they answer.\n\n{{/if}}\n{{#if claude-skill cli}}\n## Sign-in\n\n{{/if}}\nSign-in happens only in the browser. Never ask the user to paste a token.\n{{#if claude-skill}}\n\nIf none of these tools are available, Fortrip isn't connected: tell the user to add the Fortrip connector or plugin and sign in.\n{{/if}}\n{{#if mcp claude-skill}}\nIf a tool says the user isn't signed in, ask them to reconnect.\n{{/if}}\n{{#if cli}}\n\nIf a command exits with code **3** and stderr has `loginUrl`, show it to the user as a link together with `userCode`, e.g. \"Sign in to Fortrip: <loginUrl> (code <userCode>), then tell me when you're done.\" When they confirm, rerun the same command; it finishes the sign-in itself. Don't run `{{tool:login}}`: it waits for up to 10 minutes. Commands that exit 3 together share one `loginUrl`; show it once. If the rerun gives a different `loginUrl`, show that one.\n\nWhen Fortrip no longer accepts the saved sign-in (it was revoked, or it expired and couldn't be renewed), the command also exits 3 with a `loginUrl`; handle it the same way. The saved sign-in is kept until the user approves the new link.\n\nIn a remote agent environment or a CI run without a browser, the user can set `FORTRIP_TOKEN` instead. Exit 3 with `tokenSource: \"FORTRIP_TOKEN\"` means Fortrip didn't accept that token: tell the user to replace or unset it.\n\n## Exit codes\n\n| Code | Meaning | What to do |\n|---|---|---|\n| 0 | Success; the answer on stdout | Continue |\n| 1 | Any other error: an error from Fortrip (see Errors), a network error or a timeout | Read the error on stderr. If `retryable` is true, wait `retryAfterSeconds` (or a few seconds) and retry once |\n| 2 | Invalid arguments, or `invalid_request` from Fortrip | Fix the flags; the error lists each bad field with a message |\n| 3 | Not signed in | Show `loginUrl` to the user, then rerun (above) |\n| 4 | Rate limited | Wait `retryAfterSeconds`, then retry once |\n\nOutput on stdout or stderr can carry `warning` (with `recoveryFile` when a sign-in couldn't be saved): pass it on to the user.\n{{/if}}\n",
|
|
15646
|
-
"support": "{{#if claude-skill cli}}\n## Cancelling an order\n\n`{{tool:orders get}}` and `{{tool:orders list}}` say of each order whether the user can cancel it now (`cancel.available`)
|
|
15647
|
+
"support": "{{#if claude-skill cli}}\n## Cancelling an order\n\n`{{tool:orders get}}` and `{{tool:orders list}}` say of each order whether the user can cancel it now (`cancel.available`). A paid order (`cancel.reason` `cancellable`) then has the penalty under its terms (`cancel.penalty`) and the refund, what was paid less the penalty (`cancel.refund`), both in the charge currency; an unpaid one (`unpaid`) can be closed instead. Otherwise `cancel.reason` says why not.\n\n1. Show the user the stay (hotel, dates), `cancel.penalty` and `cancel.refund` (amount and currency). A refund of 0 means nothing is paid back: say so plainly.\n2. End that reply by asking the user to confirm the cancellation, and wait for a clear yes.\n3. Then {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders cancel}}` with `{{arg:maximumPenalty}}` set to `cancel.penalty` as shown{{#if cli}}, its amount: the CLI takes the currency from the order{{/if}}. Never state a refund the order didn't return, and never choose or work out an amount yourself.\n\nThe order is then `cancelling`, and `cancelled` once the hotel has cancelled and the refund is issued: check it with `{{tool:orders get}}`. If the hotel refuses, the order is `confirmed` again with `cancel.reason` `refused`. `cancellation_changed` (409) means the penalty is now higher than the one the user agreed to: read the order again and ask the user again. `order_not_cancellable` (409) says why in `reason`.\n\nClose an unpaid order only once the user says they no longer want it: {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders cancel}}` {{#if claude-skill}}without `maximumPenalty`{{/if}}{{#if cli}}with `--close`{{/if}}. It becomes `expired`, and nothing is charged. `payment_in_progress` (409) means a payment of it is under way: read it again shortly.{{#if cli}} Without `--max-penalty` or `--close`, `{{tool:orders cancel}}` changes nothing: it prints the penalty and the refund, or that the order can be closed, and exits 2.{{/if}}\n\n## Changes and support\n\n{{/if}}\n{{#if mcp}}For changes{{/if}}{{#if claude-skill}}These tools can't change an order: for changes{{/if}}{{#if cli}}The CLI can't change an order: for changes{{/if}}, a cancellation that `{{tool:orders cancel}}` can't make, or other problems, the user emails {{support}} with the order's `reference` (never `payment.url`).\n"
|
|
15647
15648
|
};
|
|
15648
15649
|
|
|
15649
15650
|
// ../contract/src/guide.ts
|
|
@@ -15751,7 +15752,7 @@ function resolve(token, surface, shown) {
|
|
|
15751
15752
|
}
|
|
15752
15753
|
function toolName(spec, surface, token) {
|
|
15753
15754
|
if (surface === "cli") return commandInvocation(spec);
|
|
15754
|
-
if (spec.tool === null
|
|
15755
|
+
if (spec.tool === null) {
|
|
15755
15756
|
throw new Error(`Guide token ${token} has no tool on ${surface}`);
|
|
15756
15757
|
}
|
|
15757
15758
|
return surface === "mcp" ? spec.tool : `fortrip:${spec.tool}`;
|
|
@@ -15890,12 +15891,7 @@ var indicativePrice = openObject({
|
|
|
15890
15891
|
kind: openEnum(["indicative"]),
|
|
15891
15892
|
basis: openEnum(["lowest_unit"]),
|
|
15892
15893
|
fromPerRoomNight: money,
|
|
15893
|
-
fromPerRoomStay: money
|
|
15894
|
-
approx: openObject({
|
|
15895
|
-
fromPerRoomNight: money,
|
|
15896
|
-
fromPerRoomStay: money,
|
|
15897
|
-
rateDate: localDate
|
|
15898
|
-
}).nullable()
|
|
15894
|
+
fromPerRoomStay: money
|
|
15899
15895
|
});
|
|
15900
15896
|
var hotelSummary = openObject({
|
|
15901
15897
|
hotelId,
|
|
@@ -16147,11 +16143,6 @@ var offer = openObject({
|
|
|
16147
16143
|
perNightAllRooms: money.describe(
|
|
16148
16144
|
"price.total divided by the nights: all rooms, one night. A search's fromPerRoomNight is for one room; divide by roomCount to compare."
|
|
16149
16145
|
),
|
|
16150
|
-
approx: openObject({
|
|
16151
|
-
total: money,
|
|
16152
|
-
perNightAllRooms: money,
|
|
16153
|
-
rateDate: localDate
|
|
16154
|
-
}).nullable(),
|
|
16155
16146
|
payAtProperty
|
|
16156
16147
|
}),
|
|
16157
16148
|
cancellation,
|
|
@@ -16219,6 +16210,7 @@ var PAYMENT_STATUSES = [
|
|
|
16219
16210
|
];
|
|
16220
16211
|
var CANCEL_REASONS = [
|
|
16221
16212
|
"cancellable",
|
|
16213
|
+
"unpaid",
|
|
16222
16214
|
"already_cancelled",
|
|
16223
16215
|
"in_progress",
|
|
16224
16216
|
"not_confirmed",
|
|
@@ -16251,6 +16243,38 @@ var paymentHandler = openObject({
|
|
|
16251
16243
|
business_profile: external_exports.string()
|
|
16252
16244
|
})
|
|
16253
16245
|
});
|
|
16246
|
+
var paymentMethod = openUnion("id", [
|
|
16247
|
+
openObject({
|
|
16248
|
+
id: external_exports.literal("stripe_shared_payment_token"),
|
|
16249
|
+
handler: paymentHandler.describe("The com.stripe.payments handler, which takes the token."),
|
|
16250
|
+
limits: openObject({
|
|
16251
|
+
maxAmount: external_exports.number().int().describe("Request the token for at least this amount, in cents; a token that allows less can't pay."),
|
|
16252
|
+
currency: external_exports.string().describe("The token's currency, lowercase as Stripe takes it: usd."),
|
|
16253
|
+
expiresAt: instant.describe(
|
|
16254
|
+
"Request the token valid until at least this time; the order can't be paid after it."
|
|
16255
|
+
)
|
|
16256
|
+
}).describe("What the shared payment token for pay_order must allow.")
|
|
16257
|
+
}).describe(
|
|
16258
|
+
`A Stripe shared payment token, through pay_order's sharedPaymentToken or payment. The entry is absent when a token can't pay the order: over $${LIMITS.tokenPaymentMaxUsd}, not charged in USD, an order started on the Fortrip website, a negotiated price, under ${LIMITS.payMinMinutesLeft} minutes left, ${LIMITS.tokensPerOrder} tokens tried, a token payment is under way, an Alipay or WeChat Pay payment is open, or token payment isn't offered for this order.`
|
|
16259
|
+
),
|
|
16260
|
+
openObject({
|
|
16261
|
+
id: external_exports.literal("stripe_alipay_wechat_pay"),
|
|
16262
|
+
open: external_exports.boolean().describe("Whether pay_order has opened an Alipay or WeChat Pay payment on this order."),
|
|
16263
|
+
current: openEnum(["wechat_pay", "alipay"]).nullable().describe("Which of the two the payment is on now; null until it is open."),
|
|
16264
|
+
wechatPay: openObject({
|
|
16265
|
+
qrData: external_exports.string().nullable().describe(
|
|
16266
|
+
"The WeChat Pay code's content, to draw as a QR code; null when there is no live code (open wechatPay.url for one)."
|
|
16267
|
+
),
|
|
16268
|
+
qrImageUrl: external_exports.string().nullable().describe("A 480 px PNG of the same code."),
|
|
16269
|
+
url: external_exports.string().describe("A link, on fortrip.ai, for the user to pay with WeChat Pay; anyone holding it can pay.")
|
|
16270
|
+
}).nullable().describe("The WeChat Pay code and link; null until the payment is open."),
|
|
16271
|
+
alipay: openObject({
|
|
16272
|
+
url: external_exports.string().describe("A link, on fortrip.ai, for the user to pay with Alipay; anyone holding it can pay.")
|
|
16273
|
+
}).nullable().describe("The Alipay link; null until the payment is open.")
|
|
16274
|
+
}).describe(
|
|
16275
|
+
"Paying with Alipay or WeChat Pay: pass method stripe_alipay_wechat_pay to pay_order to open it. The entry is absent when the order can't be paid this way and none is open."
|
|
16276
|
+
)
|
|
16277
|
+
]);
|
|
16254
16278
|
var orderReference = external_exports.string().regex(/^FT-[2-9A-HJ-NP-Z]{6}$/);
|
|
16255
16279
|
var hotelItem = openObject({
|
|
16256
16280
|
type: external_exports.literal("hotel"),
|
|
@@ -16278,7 +16302,7 @@ var order = openObject({
|
|
|
16278
16302
|
orderId,
|
|
16279
16303
|
reference: orderReference,
|
|
16280
16304
|
status: openEnum(ORDER_STATUSES).describe(
|
|
16281
|
-
"awaiting_payment: unpaid, nothing charged; payable until payment.expiresAt. expired: not paid
|
|
16305
|
+
"awaiting_payment: unpaid, nothing charged; payable until payment.expiresAt. expired: not paid; the time ran out or the order was closed. Nothing charged. confirming: paid or held, the booking is with the hotel. confirmed: the hotel confirmed and the payment is charged. failed: no stay was booked; payment.status says what became of the money. cancelling, then cancelled: a cancellation under the terms. needs_attention: a person at Fortrip has to resolve it."
|
|
16282
16306
|
),
|
|
16283
16307
|
createdAt: instant,
|
|
16284
16308
|
updatedAt: instant,
|
|
@@ -16291,55 +16315,32 @@ var order = openObject({
|
|
|
16291
16315
|
payment: openObject({
|
|
16292
16316
|
status: openEnum(PAYMENT_STATUSES),
|
|
16293
16317
|
url: external_exports.string().nullable().describe(
|
|
16294
|
-
"The payment page, on fortrip.ai
|
|
16318
|
+
"The payment page, on fortrip.ai; it continues to the payment provider. With requiresSignIn false anyone holding it can pay; with requiresSignIn true (an order started on the Fortrip website) it continues to the Fortrip booking page, where only the signed-in owner can pay. null while a payment is held (authorized) or when the order isn't awaiting payment, or, while it is and its payment is unpaid, when the link couldn't be read this time: read the order again."
|
|
16295
16319
|
),
|
|
16296
16320
|
requiresSignIn: external_exports.boolean(),
|
|
16297
16321
|
expiresAt: instant.nullable().describe(
|
|
16298
16322
|
"When the time to pay ends: an order unpaid by then expires, with nothing charged. null unless status is awaiting_payment."
|
|
16299
16323
|
),
|
|
16300
16324
|
chargeCurrency: external_exports.string().describe(
|
|
16301
|
-
"
|
|
16325
|
+
"USD or CNY: the currency of the offer the order was made from. An order made on the Fortrip website may be in another currency."
|
|
16302
16326
|
),
|
|
16303
16327
|
localCurrencyAtCheckout: external_exports.boolean().describe(
|
|
16304
|
-
"Whether paying by url may charge the card in its own currency, converted by Stripe; false once paid by token, Alipay or WeChat Pay."
|
|
16328
|
+
"Whether paying by url may charge the card in its own currency, converted by Stripe; false once paid by token, Alipay or WeChat Pay; always false on a CNY order."
|
|
16305
16329
|
),
|
|
16306
|
-
localCharge: money.nullable().describe(
|
|
16307
|
-
|
|
16308
|
-
`The ways to pay other than url: a com.stripe.payments handler takes a Stripe shared payment token through pay_order. [] when a token can't pay the order: over $${LIMITS.tokenPaymentMaxUsd}, not charged in USD, an order started on the Fortrip website, a negotiated price, under ${LIMITS.payMinMinutesLeft} minutes left, ${LIMITS.tokensPerOrder} tokens tried, a token payment is under way, an Alipay or WeChat Pay payment is open, or token payment isn't offered for this order.`
|
|
16330
|
+
localCharge: money.nullable().describe(
|
|
16331
|
+
"What the card was charged in its own currency, when Stripe converted the total; otherwise null. Always null on a CNY order."
|
|
16309
16332
|
),
|
|
16310
|
-
|
|
16311
|
-
|
|
16312
|
-
currency: external_exports.string().describe("The token's currency, lowercase as Stripe takes it: usd."),
|
|
16313
|
-
expiresAt: instant.describe(
|
|
16314
|
-
"Request the token valid until at least this time; the order can't be paid after it."
|
|
16315
|
-
)
|
|
16316
|
-
}).nullable().describe(
|
|
16317
|
-
"What the shared payment token for pay_order must allow. null exactly when handlers is []."
|
|
16318
|
-
),
|
|
16319
|
-
wallets: openObject({
|
|
16320
|
-
open: external_exports.boolean().describe("Whether pay_order has opened an Alipay or WeChat Pay payment on this order."),
|
|
16321
|
-
current: openEnum(["wechat_pay", "alipay"]).nullable().describe("Which of the two the payment is on now; null until it is open."),
|
|
16322
|
-
wechatPay: openObject({
|
|
16323
|
-
qrData: external_exports.string().nullable().describe(
|
|
16324
|
-
"The WeChat Pay code's content, to draw as a QR code; null when there is no live code (open wechatPay.url for one)."
|
|
16325
|
-
),
|
|
16326
|
-
qrImageUrl: external_exports.string().nullable().describe("A 480 px PNG of the same code."),
|
|
16327
|
-
url: external_exports.string().describe("A link, on fortrip.ai, for the user to pay with WeChat Pay; anyone holding it can pay.")
|
|
16328
|
-
}).nullable().describe("The WeChat Pay code and link; null until the payment is open."),
|
|
16329
|
-
alipay: openObject({
|
|
16330
|
-
url: external_exports.string().describe("A link, on fortrip.ai, for the user to pay with Alipay; anyone holding it can pay.")
|
|
16331
|
-
}).nullable().describe("The Alipay link; null until the payment is open.")
|
|
16332
|
-
}).nullable().describe(
|
|
16333
|
-
"Paying with Alipay or WeChat Pay: pass method alipay_wechat_pay to pay_order to open it. null when the order can't be paid this way and none is open."
|
|
16333
|
+
methods: external_exports.array(paymentMethod).describe(
|
|
16334
|
+
"What pay_order accepts for this order now, by id. [] means: give the user payment.url, when it isn't null."
|
|
16334
16335
|
)
|
|
16335
16336
|
}),
|
|
16336
16337
|
cancel: openObject({
|
|
16337
|
-
available: external_exports.boolean().describe("Whether the user can cancel the order now."),
|
|
16338
|
+
available: external_exports.boolean().describe("Whether the user can cancel the order now, or, unpaid (reason unpaid), close it."),
|
|
16338
16339
|
reason: openEnum(CANCEL_REASONS).describe(
|
|
16339
|
-
"cancellable
|
|
16340
|
+
"cancellable: a paid order can be cancelled now; unpaid: an unpaid order can be closed; otherwise why not."
|
|
16340
16341
|
),
|
|
16341
16342
|
penalty: money.nullable().describe(
|
|
16342
|
-
"The penalty if cancelled now, under the accepted terms, in the charge currency; null when not stated."
|
|
16343
|
+
"The penalty if cancelled now, under the accepted terms, in the charge currency; null when not stated, except on an unpaid order (reason unpaid), where null means closing it charges nothing."
|
|
16343
16344
|
),
|
|
16344
16345
|
refund: money.nullable().describe(
|
|
16345
16346
|
"What a cancellation now refunds: what was paid less the penalty, in the charge currency; null when not stated."
|
|
@@ -16367,24 +16368,90 @@ var offerChange = openUnion("field", [
|
|
|
16367
16368
|
change("pay_at_property", payAtProperty)
|
|
16368
16369
|
]);
|
|
16369
16370
|
|
|
16371
|
+
// ../contract/src/paths.ts
|
|
16372
|
+
var PUBLIC_ORIGINS = {
|
|
16373
|
+
api: "https://api.fortrip.ai",
|
|
16374
|
+
mcp: "https://mcp.fortrip.ai"
|
|
16375
|
+
};
|
|
16376
|
+
var API = {
|
|
16377
|
+
me: "/v1/me",
|
|
16378
|
+
authConfig: "/v1/auth/config",
|
|
16379
|
+
hotelSearch: "/v1/hotels/search",
|
|
16380
|
+
hotelOffers: "/v1/hotels/offers",
|
|
16381
|
+
orders: "/v1/orders",
|
|
16382
|
+
hotel(id, opts) {
|
|
16383
|
+
const query = [];
|
|
16384
|
+
if (opts?.rooms) query.push("include=rooms");
|
|
16385
|
+
if (opts?.locale) query.push(`locale=${opts.locale}`);
|
|
16386
|
+
return `/v1/hotels/${encodeURIComponent(id)}${query.length ? `?${query.join("&")}` : ""}`;
|
|
16387
|
+
},
|
|
16388
|
+
order(id, opts) {
|
|
16389
|
+
return `/v1/orders/${encodeURIComponent(id)}${opts?.locale ? `?locale=${opts.locale}` : ""}`;
|
|
16390
|
+
},
|
|
16391
|
+
orderCancel(id) {
|
|
16392
|
+
return `/v1/orders/${encodeURIComponent(id)}/cancel`;
|
|
16393
|
+
},
|
|
16394
|
+
orderPay(id) {
|
|
16395
|
+
return `/v1/orders/${encodeURIComponent(id)}/pay`;
|
|
16396
|
+
}
|
|
16397
|
+
};
|
|
16398
|
+
var MCP_PATH = "/";
|
|
16399
|
+
var MCP_SERVER_URL = `${PUBLIC_ORIGINS.mcp}${MCP_PATH}`;
|
|
16400
|
+
|
|
16401
|
+
// ../contract/src/routes.ts
|
|
16402
|
+
var route = (method, path, queryFields = []) => ({
|
|
16403
|
+
method,
|
|
16404
|
+
path,
|
|
16405
|
+
pathFields: [...path.matchAll(/\{(\w+)\}/g)].map((match) => match[1]),
|
|
16406
|
+
queryFields
|
|
16407
|
+
});
|
|
16408
|
+
var HTTP_ROUTES = {
|
|
16409
|
+
search_hotels: route("POST", "/v1/hotels/search"),
|
|
16410
|
+
get_hotel: route("GET", "/v1/hotels/{hotelId}", ["include", "locale"]),
|
|
16411
|
+
get_hotel_offers: route("POST", "/v1/hotels/offers"),
|
|
16412
|
+
book_hotel: route("POST", "/v1/orders"),
|
|
16413
|
+
get_order: route("GET", "/v1/orders/{orderId}", ["locale"]),
|
|
16414
|
+
list_orders: route("GET", "/v1/orders", ["cursor", "limit", "locale"]),
|
|
16415
|
+
cancel_order: route("POST", "/v1/orders/{orderId}/cancel"),
|
|
16416
|
+
pay_order: route("POST", "/v1/orders/{orderId}/pay")
|
|
16417
|
+
};
|
|
16418
|
+
var ACCOUNT_ROUTES = {
|
|
16419
|
+
me: route("GET", "/v1/me"),
|
|
16420
|
+
authConfig: route("GET", "/v1/auth/config")
|
|
16421
|
+
};
|
|
16422
|
+
function routePath(route2, input) {
|
|
16423
|
+
const path = route2.path.replace(
|
|
16424
|
+
/\{(\w+)\}/g,
|
|
16425
|
+
(_, field) => encodeURIComponent(String(input[field]))
|
|
16426
|
+
);
|
|
16427
|
+
const query = new URLSearchParams();
|
|
16428
|
+
for (const field of route2.queryFields) {
|
|
16429
|
+
if (input[field] !== void 0) query.set(field, String(input[field]));
|
|
16430
|
+
}
|
|
16431
|
+
const text2 = query.toString();
|
|
16432
|
+
return text2 ? `${path}?${text2}` : path;
|
|
16433
|
+
}
|
|
16434
|
+
|
|
16370
16435
|
// ../contract/src/tools.ts
|
|
16371
16436
|
var ORDER_NEXT_STEP = "Before you give the user an order's payment.url, show them its total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term (meals, cancellation, fees payable at the property), then end your reply by asking them to confirm, and wait for a clear yes. Only after they say yes, give them payment.url exactly as returned.";
|
|
16372
16437
|
var CALLS = {
|
|
16373
16438
|
mcp: {
|
|
16374
16439
|
cancel: "call cancel_order",
|
|
16375
|
-
penalty:
|
|
16440
|
+
penalty: "Pass maximumPenalty as cancel.penalty, exactly as returned.",
|
|
16441
|
+
close: "call cancel_order",
|
|
16376
16442
|
pay: "call pay_order",
|
|
16377
|
-
payWallet: " with method
|
|
16443
|
+
payWallet: " with method stripe_alipay_wechat_pay",
|
|
16378
16444
|
get: "call get_order",
|
|
16379
16445
|
poll: "poll get_order",
|
|
16380
16446
|
payWith: "call pay_order with it and the order's price.total",
|
|
16381
16447
|
paid: "pay_order"
|
|
16382
16448
|
},
|
|
16383
16449
|
cli: {
|
|
16384
|
-
cancel: "run `fortrip orders cancel <orderId> --max-penalty <
|
|
16450
|
+
cancel: "run `fortrip orders cancel <orderId> --max-penalty <amount>`",
|
|
16451
|
+
close: "run `fortrip orders cancel <orderId> --close`",
|
|
16385
16452
|
penalty: "Pass the penalty's amount as --max-penalty (120.00 for a penalty of USD 120.00).",
|
|
16386
16453
|
pay: "run `fortrip orders pay`",
|
|
16387
|
-
payWallet: " with --
|
|
16454
|
+
payWallet: " with --method stripe_alipay_wechat_pay",
|
|
16388
16455
|
get: "run `fortrip orders get <orderId>`",
|
|
16389
16456
|
poll: "poll it with `fortrip orders get <orderId>`",
|
|
16390
16457
|
payWith: "run `fortrip orders pay <orderId> --token <spt_\u2026> --total <total>` with the token and the order's total",
|
|
@@ -16398,12 +16465,12 @@ function cancelNextStep(surface) {
|
|
|
16398
16465
|
var CANCEL_NEXT_STEP = cancelNextStep("mcp");
|
|
16399
16466
|
function payNextStep(surface) {
|
|
16400
16467
|
const c = CALLS[surface];
|
|
16401
|
-
return `To pay without the link: only if you have a tool that can request a Stripe shared payment token from the user's Link wallet (US and Canadian Link accounts), and the order's payment.
|
|
16468
|
+
return `To pay without the link: only if you have a tool that can request a Stripe shared payment token from the user's Link wallet (US and Canadian Link accounts), and the order's payment.methods has the stripe_shared_payment_token entry. Otherwise give payment.url, and never ask the user to create, type or paste a token. Before you ${c.pay}, show the user the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term (meals, cancellation, fees payable at the property), then end your reply by asking them to confirm, and wait for a clear yes. Then request the token for this order from the user's Link wallet with that entry's handler config.business_profile and its limits (maxAmount in cents, currency, expiresAt), and ${c.payWith}. The charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: either give payment.url or ${c.pay}. Once ${c.paid} succeeds, payment.url stops working; a failed payment leaves it open.`;
|
|
16402
16469
|
}
|
|
16403
16470
|
var PAY_NEXT_STEP = payNextStep("mcp");
|
|
16404
16471
|
function walletNextStep(surface) {
|
|
16405
16472
|
const c = CALLS[surface];
|
|
16406
|
-
return `Before you ${c.pay}${c.payWallet}, show the user the order's total
|
|
16473
|
+
return `Before you ${c.pay}${c.payWallet}, show the user the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term (meals, cancellation, fees payable at the property), then ask them to confirm, and wait for a clear yes. Then show the stripe_alipay_wechat_pay entry of payment.methods: the WeChat code as an image if you can, and both links. The user pays once, by one of them. Alipay and WeChat Pay charge at once; if the hotel can't confirm, the payment is refunded in full. Then ${c.poll}.`;
|
|
16407
16474
|
}
|
|
16408
16475
|
var WALLET_NEXT_STEP = walletNextStep("mcp");
|
|
16409
16476
|
var nextStep = external_exports.string().optional().describe(
|
|
@@ -16424,14 +16491,6 @@ var READ = {
|
|
|
16424
16491
|
};
|
|
16425
16492
|
var READ_OWN = { ...READ, openWorldHint: false };
|
|
16426
16493
|
var TOOLS = [
|
|
16427
|
-
{
|
|
16428
|
-
name: "get_planning_guide",
|
|
16429
|
-
title: "Planning guide",
|
|
16430
|
-
description: `Returns Fortrip's planning guide for a request that is more than one hotel for fixed dates (flexible dates, a budget, split stays, several destinations, "find me the best"): what to ask the user, which results count as evidence, how to rank and how to present options.`,
|
|
16431
|
-
annotations: READ_OWN,
|
|
16432
|
-
input: null,
|
|
16433
|
-
output: null
|
|
16434
|
-
},
|
|
16435
16494
|
{
|
|
16436
16495
|
name: "search_hotels",
|
|
16437
16496
|
title: "Search hotels",
|
|
@@ -16451,7 +16510,7 @@ var TOOLS = [
|
|
|
16451
16510
|
{
|
|
16452
16511
|
name: "get_hotel_offers",
|
|
16453
16512
|
title: "Live offers",
|
|
16454
|
-
description: `Live, bookable offers for up to ${LIMITS.offersHotels} hotels and one stay. Every room in stay.rooms must have the same party: for different parties, call once per party. Each offer has the room, the meals included, price.total in
|
|
16513
|
+
description: `Live, bookable offers for up to ${LIMITS.offersHotels} hotels and one stay. Every room in stay.rooms must have the same party: for different parties, call once per party. Each offer has the room, the meals included, price.total, in the request's currency, for the whole stay and every room (what is charged), fees payable at the property, the cancellation terms with times in UTC and the hotel's time zone, the confirmation mode, and an offerId for book_hotel that expires at expiresAt. Hotels with nothing to offer are listed under unavailable with the reason. Up to limitPerHotel offers per hotel, default ${LIMITS.offersPerHotelDefault}, chosen for a spread of choices in this order while room remains: the cheapest offer, the cheapest that can be cancelled free, the cheapest with breakfast, the cheapest of each other room, then the rest by price; listed cheapest first.`,
|
|
16455
16514
|
annotations: READ,
|
|
16456
16515
|
input: hotelOffersInput,
|
|
16457
16516
|
output: hotelOffersResult
|
|
@@ -16488,7 +16547,7 @@ var TOOLS = [
|
|
|
16488
16547
|
{
|
|
16489
16548
|
name: "cancel_order",
|
|
16490
16549
|
title: "Cancel order",
|
|
16491
|
-
description: `Cancel
|
|
16550
|
+
description: `Cancel a paid order under its terms, or close an unpaid one. Paid (cancel.reason cancellable): the hotel booking is cancelled and cancel.refund is refunded. ${CANCEL_NEXT_STEP} Penalty now above maximumPenalty: cancellation_changed, nothing changed; ask again. Then poll get_order: cancelling, then cancelled. Hotel refused: confirmed, reason refused. Unpaid (cancel.reason unpaid): close it only once the user says they no longer want it, without maximumPenalty; nothing is charged; it becomes expired. Paid meanwhile: the answer is the paid order or invalid_request; then cancel only under cancel.penalty, with the user's yes. payment_in_progress: read it again shortly. Repeat calls answer the order as it is.`,
|
|
16492
16551
|
annotations: {
|
|
16493
16552
|
readOnlyHint: false,
|
|
16494
16553
|
idempotentHint: true,
|
|
@@ -16501,7 +16560,7 @@ var TOOLS = [
|
|
|
16501
16560
|
{
|
|
16502
16561
|
name: "pay_order",
|
|
16503
16562
|
title: "Pay order",
|
|
16504
|
-
description: `Pay an order without its link, by shared payment token or Alipay/WeChat Pay (method
|
|
16563
|
+
description: `Pay an order without its link, by one of its payment.methods: a shared payment token, or Alipay/WeChat Pay (method stripe_alipay_wechat_pay). Token: only if you can request one from the user's Link wallet (US and Canadian accounts); never ask the user for one. First show the user the total and currency, the stay and every term (meals, cancellation, fees payable at the property), ask them to confirm and wait for a clear yes. Token: request it with the entry's handler config.business_profile and limits; pass it with price.total. Wallet: pass method, price.total; show the wallet entry (WeChat code as an image if you can, both links); they pay once by either; a code lasts ${LIMITS.wechatCodeMinutes} minutes; then the WeChat link opens a new one, or call again. Pay one way only: payment.url or pay_order. Success closes payment.url; failure leaves it open. Then poll get_order. payment_total_changed: confirm details.total, retry. payment_credential_invalid: new token. service_unavailable: retry. Else payment.url. A token pays one order.`,
|
|
16505
16564
|
annotations: {
|
|
16506
16565
|
readOnlyHint: false,
|
|
16507
16566
|
idempotentHint: true,
|
|
@@ -16521,13 +16580,10 @@ var ERROR_CODES = {
|
|
|
16521
16580
|
unauthenticated: { status: [401], retryable: false },
|
|
16522
16581
|
forbidden: { status: [403], retryable: false },
|
|
16523
16582
|
not_found: { status: [404], retryable: false },
|
|
16524
|
-
order_removed: { status: [410], retryable: false },
|
|
16525
16583
|
offer_expired: { status: [409], retryable: false },
|
|
16526
16584
|
offer_changed: { status: [409], retryable: false },
|
|
16527
16585
|
offer_already_ordered: { status: [409], retryable: false },
|
|
16528
|
-
order_exists: { status: [409], retryable: false },
|
|
16529
16586
|
order_in_progress: { status: [409], retryable: true },
|
|
16530
|
-
order_attempts_exhausted: { status: [409], retryable: false },
|
|
16531
16587
|
cancellation_changed: { status: [409], retryable: false },
|
|
16532
16588
|
order_not_cancellable: { status: [409], retryable: false },
|
|
16533
16589
|
order_not_payable: { status: [409], retryable: false },
|
|
@@ -16543,6 +16599,7 @@ var ERROR_CODES = {
|
|
|
16543
16599
|
stay_unsupported: { status: [422], retryable: false },
|
|
16544
16600
|
stay_in_past: { status: [422], retryable: false },
|
|
16545
16601
|
offer_unavailable: { status: [422], retryable: false },
|
|
16602
|
+
currency_unavailable: { status: [422], retryable: false },
|
|
16546
16603
|
rate_limited: { status: [429], retryable: true },
|
|
16547
16604
|
ordering_paused: { status: [503], retryable: true },
|
|
16548
16605
|
service_unavailable: { status: [503], retryable: true },
|
|
@@ -16568,13 +16625,10 @@ var ERROR_DETAILS = {
|
|
|
16568
16625
|
unauthenticated: null,
|
|
16569
16626
|
forbidden: null,
|
|
16570
16627
|
not_found: null,
|
|
16571
|
-
order_removed: openObject({ orderId, reference: orderReference }),
|
|
16572
16628
|
offer_expired: openObject({ offerId, expiredAt: instant }),
|
|
16573
16629
|
offer_changed: openObject({ changes: external_exports.array(offerChange).min(1), offer }),
|
|
16574
16630
|
offer_already_ordered: openObject({ orderId }),
|
|
16575
|
-
order_exists: openObject({ orderId, status: openEnum(ORDER_STATUSES) }),
|
|
16576
16631
|
order_in_progress: openObject({ orderId }),
|
|
16577
|
-
order_attempts_exhausted: openObject({ orderId }),
|
|
16578
16632
|
cancellation_changed: null,
|
|
16579
16633
|
order_not_cancellable: openObject({ reason: openEnum(CANCEL_REASONS) }),
|
|
16580
16634
|
order_not_payable: openObject({ orderId, status: openEnum(ORDER_STATUSES) }),
|
|
@@ -16636,6 +16690,7 @@ var ERROR_DETAILS = {
|
|
|
16636
16690
|
offerId,
|
|
16637
16691
|
reason: openEnum(["sold_out", "refused"])
|
|
16638
16692
|
}),
|
|
16693
|
+
currency_unavailable: openObject({ currency: external_exports.string() }),
|
|
16639
16694
|
rate_limited: openObject({
|
|
16640
16695
|
scope: openEnum([
|
|
16641
16696
|
"search",
|
|
@@ -16825,10 +16880,7 @@ function roomText(r) {
|
|
|
16825
16880
|
}
|
|
16826
16881
|
function offerLine(o) {
|
|
16827
16882
|
const p = o.price;
|
|
16828
|
-
|
|
16829
|
-
if (p.approx) {
|
|
16830
|
-
price += ` \u2248 ${money2(p.approx.total)} (${money2(p.approx.perNightAllRooms)} per night), exchange rate of ${p.approx.rateDate}`;
|
|
16831
|
-
}
|
|
16883
|
+
const price = `${money2(p.total)} total (${money2(p.perNightAllRooms)} per night, all rooms)`;
|
|
16832
16884
|
return [
|
|
16833
16885
|
`${o.offerId}${o.type === "hotel" ? "" : ` (${o.type})`}`,
|
|
16834
16886
|
`${plural(o.hotel.roomCount, "room")}: ${roomText(o.hotel.room)}`,
|
|
@@ -16888,9 +16940,12 @@ function renderOffers(r, surface = "mcp") {
|
|
|
16888
16940
|
}
|
|
16889
16941
|
|
|
16890
16942
|
// ../contract/src/render/order.ts
|
|
16943
|
+
function methodOf(o, id) {
|
|
16944
|
+
return o.payment.methods.find((m) => m.id === id);
|
|
16945
|
+
}
|
|
16891
16946
|
var ORDER_STATUS_WORDS = {
|
|
16892
16947
|
awaiting_payment: "awaiting payment",
|
|
16893
|
-
expired: "
|
|
16948
|
+
expired: "not paid: the time ran out or it was closed",
|
|
16894
16949
|
confirming: "confirming with the hotel",
|
|
16895
16950
|
confirmed: "confirmed",
|
|
16896
16951
|
failed: "failed",
|
|
@@ -16909,6 +16964,7 @@ var PAYMENT_WORDS = {
|
|
|
16909
16964
|
var SUPPORT = `for help, the user emails ${SUPPORT_EMAIL} with the order's reference`;
|
|
16910
16965
|
var CANCEL_REASON_WORDS = {
|
|
16911
16966
|
cancellable: "it can be cancelled",
|
|
16967
|
+
unpaid: "it isn't paid: it can be closed if the user no longer wants it",
|
|
16912
16968
|
already_cancelled: "it is already cancelled",
|
|
16913
16969
|
in_progress: "a cancellation is in progress",
|
|
16914
16970
|
not_confirmed: "only a confirmed order that is paid can be cancelled",
|
|
@@ -16952,24 +17008,22 @@ function paymentLines(o, surface) {
|
|
|
16952
17008
|
p.requiresSignIn ? "the user signs in to Fortrip to pay" : "no sign-in needed"
|
|
16953
17009
|
].filter(Boolean);
|
|
16954
17010
|
lines.push(`Payment link (${about.join("; ")}): ${p.url}`);
|
|
16955
|
-
} else if (o.status === "awaiting_payment") {
|
|
17011
|
+
} else if (o.status === "awaiting_payment" && p.status === "unpaid") {
|
|
16956
17012
|
lines.push("Payment link: could not be read this time; read this order again for it.");
|
|
16957
17013
|
}
|
|
16958
|
-
|
|
16959
|
-
if (
|
|
16960
|
-
|
|
17014
|
+
const token = methodOf(o, "stripe_shared_payment_token");
|
|
17015
|
+
if (token) lines.push(tokenLine(o, token, surface));
|
|
17016
|
+
const wallet = methodOf(o, "stripe_alipay_wechat_pay");
|
|
17017
|
+
if (wallet) lines.push(...walletLines(wallet, surface));
|
|
17018
|
+
lines.push(cancelLine(o, surface));
|
|
16961
17019
|
lines.push(`Manage: ${o.manageUrl}`);
|
|
16962
17020
|
return lines;
|
|
16963
17021
|
}
|
|
16964
|
-
function
|
|
16965
|
-
const {
|
|
17022
|
+
function tokenLine(o, token, surface) {
|
|
17023
|
+
const { handler: h, limits } = token;
|
|
16966
17024
|
const pay = surface === "cli" ? `\`fortrip orders pay ${o.orderId} --token <spt_\u2026> --total ${o.price.total.amount}\`` : "pay_order";
|
|
16967
|
-
const shown = handlers.map(
|
|
16968
|
-
(h) => `${h.type} (handler ${h.id}, business_profile ${h.config.business_profile})`
|
|
16969
|
-
);
|
|
16970
|
-
const limit = limits ? `; token limits: maxAmount ${limits.maxAmount} (cents), currency ${limits.currency}, expiresAt ${limits.expiresAt}` : "";
|
|
16971
17025
|
return [
|
|
16972
|
-
`Pay without the link: ${pay} with a shared payment token via ${
|
|
17026
|
+
`Pay without the link: ${pay} with a shared payment token via ${h.type} (handler ${h.id}, business_profile ${h.config.business_profile}); token limits: maxAmount ${limits.maxAmount} (cents), currency ${limits.currency}, expiresAt ${limits.expiresAt}.`,
|
|
16973
17027
|
"Only if you have a tool that can request the token from the user's Link wallet (US and Canadian Link accounts); otherwise give the payment link, and never ask the user to create, type or paste a token.",
|
|
16974
17028
|
`First show the user the total and currency, the stay and every term, and wait for a clear yes. Pay one way only: the link or ${surface === "cli" ? "`fortrip orders pay`" : "pay_order"}.`
|
|
16975
17029
|
].join(" ");
|
|
@@ -16977,7 +17031,7 @@ function handlersLine(o, surface) {
|
|
|
16977
17031
|
function walletLines(w, surface) {
|
|
16978
17032
|
const c = CALLS[surface];
|
|
16979
17033
|
if (!w.open) {
|
|
16980
|
-
const pay = surface === "cli" ? "run `fortrip orders pay <orderId> --
|
|
17034
|
+
const pay = surface === "cli" ? "run `fortrip orders pay <orderId> --method stripe_alipay_wechat_pay --total <total>`" : "call pay_order with method stripe_alipay_wechat_pay and the order's price.total";
|
|
16981
17035
|
return [`Pay with Alipay or WeChat Pay: ${pay}.`];
|
|
16982
17036
|
}
|
|
16983
17037
|
const lines = [];
|
|
@@ -16994,9 +17048,13 @@ function walletLines(w, surface) {
|
|
|
16994
17048
|
);
|
|
16995
17049
|
return lines;
|
|
16996
17050
|
}
|
|
16997
|
-
function cancelLine(o) {
|
|
17051
|
+
function cancelLine(o, surface) {
|
|
16998
17052
|
const c = o.cancel;
|
|
17053
|
+
if (c.available && c.reason === "unpaid") {
|
|
17054
|
+
return `Cancel: can be closed now, nothing is charged; close it only if the user says they no longer want it (${CALLS[surface].close})`;
|
|
17055
|
+
}
|
|
16999
17056
|
if (o.status === "awaiting_payment" && !c.available && c.reason === "not_confirmed") {
|
|
17057
|
+
if (!o.payment.requiresSignIn) return "Cancel: not now: a payment is under way; read the order again shortly";
|
|
17000
17058
|
const at = o.payment.expiresAt === null ? "" : ` at ${when(o.payment.expiresAt, null)}`;
|
|
17001
17059
|
return `Cancel: not needed: an unpaid order expires unpaid${at}`;
|
|
17002
17060
|
}
|
|
@@ -17150,9 +17208,6 @@ function priceWords(h, status) {
|
|
|
17150
17208
|
return status === "ok" ? "no indicative price" : "price unavailable this time";
|
|
17151
17209
|
}
|
|
17152
17210
|
let text2 = `from ${money2(p.fromPerRoomNight)}/room-night (${money2(p.fromPerRoomStay)} per room for the stay)`;
|
|
17153
|
-
if (p.approx) {
|
|
17154
|
-
text2 += ` \u2248 ${money2(p.approx.fromPerRoomNight)}/room-night (${money2(p.approx.fromPerRoomStay)}), exchange rate of ${p.approx.rateDate}`;
|
|
17155
|
-
}
|
|
17156
17211
|
if (p.kind !== "indicative" || p.basis !== "lowest_unit") {
|
|
17157
17212
|
text2 += ` [${p.kind}, ${p.basis}]`;
|
|
17158
17213
|
}
|
|
@@ -17318,8 +17373,6 @@ function detailLines(e, surface) {
|
|
|
17318
17373
|
}
|
|
17319
17374
|
case "cursor_invalid":
|
|
17320
17375
|
return [`The cursor is ${e.details.reason}: search again without a cursor.`];
|
|
17321
|
-
case "order_removed":
|
|
17322
|
-
return [`Order ${e.details.orderId}, reference ${e.details.reference}.`];
|
|
17323
17376
|
case "offer_expired":
|
|
17324
17377
|
return [`Offer ${e.details.offerId} expired at ${when(e.details.expiredAt, null)}: get fresh offers.`];
|
|
17325
17378
|
case "offer_changed":
|
|
@@ -17332,10 +17385,7 @@ function detailLines(e, surface) {
|
|
|
17332
17385
|
];
|
|
17333
17386
|
case "offer_already_ordered":
|
|
17334
17387
|
case "order_in_progress":
|
|
17335
|
-
case "order_attempts_exhausted":
|
|
17336
17388
|
return [`Order ${e.details.orderId}.`];
|
|
17337
|
-
case "order_exists":
|
|
17338
|
-
return [`Order ${e.details.orderId}, ${label(ORDER_STATUS_WORDS, e.details.status)}.`];
|
|
17339
17389
|
case "order_not_cancellable":
|
|
17340
17390
|
return [`Not cancellable: ${label(CANCEL_REASON_WORDS, e.details.reason)}.`];
|
|
17341
17391
|
case "order_not_payable":
|
|
@@ -17350,7 +17400,7 @@ function detailLines(e, surface) {
|
|
|
17350
17400
|
];
|
|
17351
17401
|
case "payment_credential_invalid":
|
|
17352
17402
|
return [
|
|
17353
|
-
`The token ${label(CREDENTIAL_INVALID_WORDS, e.details.reason)}: request a new one with the order's
|
|
17403
|
+
`The token ${label(CREDENTIAL_INVALID_WORDS, e.details.reason)}: request a new one with the limits of the order's stripe_shared_payment_token method. Nothing was charged.`
|
|
17354
17404
|
];
|
|
17355
17405
|
case "payment_declined":
|
|
17356
17406
|
return [
|
|
@@ -17372,6 +17422,8 @@ function detailLines(e, surface) {
|
|
|
17372
17422
|
return [
|
|
17373
17423
|
`Offer ${e.details.offerId}: ${label({ sold_out: "sold out", refused: "can no longer be booked" }, e.details.reason)}. Get fresh offers.`
|
|
17374
17424
|
];
|
|
17425
|
+
case "currency_unavailable":
|
|
17426
|
+
return [`Prices in ${e.details.currency} aren't available yet. Tell the user, and ask whether to see USD prices.`];
|
|
17375
17427
|
case "rate_limited":
|
|
17376
17428
|
return [`Limit reached for: ${e.details.scope}.`];
|
|
17377
17429
|
case "supplier_unavailable":
|
|
@@ -17504,8 +17556,8 @@ ${raw(data)}`;
|
|
|
17504
17556
|
return [
|
|
17505
17557
|
text2,
|
|
17506
17558
|
ORDER_TOOLS.has(tool) && holdsPaymentUrl(data) ? ORDER_NEXT_STEP : "",
|
|
17507
|
-
ORDER_TOOLS.has(tool) &&
|
|
17508
|
-
ORDER_TOOLS.has(tool) &&
|
|
17559
|
+
ORDER_TOOLS.has(tool) && holdsMethod(data, isTokenMethod) ? payNextStep(surface) : "",
|
|
17560
|
+
ORDER_TOOLS.has(tool) && holdsMethod(data, isWalletOffer) ? walletNextStep(surface) : "",
|
|
17509
17561
|
CANCEL_TOOLS.has(tool) && holdsCancellable(data) ? cancelNextStep(surface) : ""
|
|
17510
17562
|
].filter(Boolean).join("\n\n");
|
|
17511
17563
|
}
|
|
@@ -17541,32 +17593,23 @@ function holdsPaymentUrl(value, seen = /* @__PURE__ */ new Set()) {
|
|
|
17541
17593
|
}
|
|
17542
17594
|
return Object.values(value).some((v) => holdsPaymentUrl(v, seen));
|
|
17543
17595
|
}
|
|
17544
|
-
|
|
17596
|
+
var isTokenMethod = (m) => m.id === "stripe_shared_payment_token";
|
|
17597
|
+
var isWalletOffer = (m) => m.id === "stripe_alipay_wechat_pay" && m.open === false;
|
|
17598
|
+
function holdsMethod(value, match, seen = /* @__PURE__ */ new Set()) {
|
|
17545
17599
|
if (typeof value !== "object" || value === null || seen.has(value)) return false;
|
|
17546
17600
|
seen.add(value);
|
|
17547
17601
|
const payment = value.payment;
|
|
17548
|
-
|
|
17602
|
+
const methods = typeof payment === "object" && payment !== null ? payment.methods : void 0;
|
|
17603
|
+
if (Array.isArray(methods) && methods.some((m) => typeof m === "object" && m !== null && match(m))) {
|
|
17549
17604
|
return true;
|
|
17550
17605
|
}
|
|
17551
|
-
return Object.values(value).some((v) =>
|
|
17552
|
-
}
|
|
17553
|
-
function holdsWalletOffer(value, seen = /* @__PURE__ */ new Set()) {
|
|
17554
|
-
if (typeof value !== "object" || value === null || seen.has(value)) return false;
|
|
17555
|
-
seen.add(value);
|
|
17556
|
-
const payment = value.payment;
|
|
17557
|
-
if (typeof payment === "object" && payment !== null) {
|
|
17558
|
-
const wallets = payment.wallets;
|
|
17559
|
-
if (typeof wallets === "object" && wallets !== null && wallets.open === false) {
|
|
17560
|
-
return true;
|
|
17561
|
-
}
|
|
17562
|
-
}
|
|
17563
|
-
return Object.values(value).some((v) => holdsWalletOffer(v, seen));
|
|
17606
|
+
return Object.values(value).some((v) => holdsMethod(v, match, seen));
|
|
17564
17607
|
}
|
|
17565
17608
|
function holdsCancellable(value, seen = /* @__PURE__ */ new Set()) {
|
|
17566
17609
|
if (typeof value !== "object" || value === null || seen.has(value)) return false;
|
|
17567
17610
|
seen.add(value);
|
|
17568
17611
|
const cancel = value.cancel;
|
|
17569
|
-
if (typeof cancel === "object" && cancel !== null && cancel.available === true) {
|
|
17612
|
+
if (typeof cancel === "object" && cancel !== null && cancel.available === true && cancel.reason !== "unpaid") {
|
|
17570
17613
|
return true;
|
|
17571
17614
|
}
|
|
17572
17615
|
return Object.values(value).some((v) => holdsCancellable(v, seen));
|
|
@@ -17575,16 +17618,16 @@ function withConsent(tool, surface, text2, orders) {
|
|
|
17575
17618
|
return [
|
|
17576
17619
|
text2,
|
|
17577
17620
|
orders.some((o) => o.payment.url !== null) ? ORDER_NEXT_STEP : "",
|
|
17578
|
-
orders.some((o) => o
|
|
17579
|
-
orders.some((o) => o
|
|
17580
|
-
CANCEL_TOOLS.has(tool) && orders.some((o) => o.cancel.available) ? cancelNextStep(surface) : ""
|
|
17621
|
+
orders.some((o) => methodOf(o, "stripe_shared_payment_token")) ? payNextStep(surface) : "",
|
|
17622
|
+
orders.some((o) => methodOf(o, "stripe_alipay_wechat_pay")?.open === false) ? walletNextStep(surface) : "",
|
|
17623
|
+
CANCEL_TOOLS.has(tool) && orders.some((o) => o.cancel.available && o.cancel.reason !== "unpaid") ? cancelNextStep(surface) : ""
|
|
17581
17624
|
].filter(Boolean).join("\n\n");
|
|
17582
17625
|
}
|
|
17583
17626
|
|
|
17584
17627
|
// ../contract/package.json
|
|
17585
17628
|
var package_default = {
|
|
17586
17629
|
name: "@fortrip/agent-contract",
|
|
17587
|
-
version: "
|
|
17630
|
+
version: "5.0.0-rc.2",
|
|
17588
17631
|
license: "Apache-2.0",
|
|
17589
17632
|
description: "The contract of Fortrip's agent API (https://api.fortrip.ai/v1) and its MCP server: limits, paths, request and response schemas, error codes and field rules.",
|
|
17590
17633
|
type: "module",
|
|
@@ -17655,70 +17698,6 @@ var authConfig = openObject({
|
|
|
17655
17698
|
revocationEndpoint: external_exports.string()
|
|
17656
17699
|
});
|
|
17657
17700
|
|
|
17658
|
-
// ../contract/src/paths.ts
|
|
17659
|
-
var PUBLIC_ORIGINS = {
|
|
17660
|
-
api: "https://api.fortrip.ai",
|
|
17661
|
-
mcp: "https://mcp.fortrip.ai"
|
|
17662
|
-
};
|
|
17663
|
-
var API = {
|
|
17664
|
-
me: "/v1/me",
|
|
17665
|
-
authConfig: "/v1/auth/config",
|
|
17666
|
-
hotelSearch: "/v1/hotels/search",
|
|
17667
|
-
hotelOffers: "/v1/hotels/offers",
|
|
17668
|
-
orders: "/v1/orders",
|
|
17669
|
-
hotel(id, opts) {
|
|
17670
|
-
const query = [];
|
|
17671
|
-
if (opts?.rooms) query.push("include=rooms");
|
|
17672
|
-
if (opts?.locale) query.push(`locale=${opts.locale}`);
|
|
17673
|
-
return `/v1/hotels/${encodeURIComponent(id)}${query.length ? `?${query.join("&")}` : ""}`;
|
|
17674
|
-
},
|
|
17675
|
-
order(id, opts) {
|
|
17676
|
-
return `/v1/orders/${encodeURIComponent(id)}${opts?.locale ? `?locale=${opts.locale}` : ""}`;
|
|
17677
|
-
},
|
|
17678
|
-
orderCancel(id) {
|
|
17679
|
-
return `/v1/orders/${encodeURIComponent(id)}/cancel`;
|
|
17680
|
-
},
|
|
17681
|
-
orderPay(id) {
|
|
17682
|
-
return `/v1/orders/${encodeURIComponent(id)}/pay`;
|
|
17683
|
-
}
|
|
17684
|
-
};
|
|
17685
|
-
var MCP_PATH = "/";
|
|
17686
|
-
var MCP_SERVER_URL = `${PUBLIC_ORIGINS.mcp}${MCP_PATH}`;
|
|
17687
|
-
|
|
17688
|
-
// ../contract/src/routes.ts
|
|
17689
|
-
var route = (method, path, queryFields = []) => ({
|
|
17690
|
-
method,
|
|
17691
|
-
path,
|
|
17692
|
-
pathFields: [...path.matchAll(/\{(\w+)\}/g)].map((match) => match[1]),
|
|
17693
|
-
queryFields
|
|
17694
|
-
});
|
|
17695
|
-
var HTTP_ROUTES = {
|
|
17696
|
-
search_hotels: route("POST", "/v1/hotels/search"),
|
|
17697
|
-
get_hotel: route("GET", "/v1/hotels/{hotelId}", ["include", "locale"]),
|
|
17698
|
-
get_hotel_offers: route("POST", "/v1/hotels/offers"),
|
|
17699
|
-
book_hotel: route("POST", "/v1/orders"),
|
|
17700
|
-
get_order: route("GET", "/v1/orders/{orderId}", ["locale"]),
|
|
17701
|
-
list_orders: route("GET", "/v1/orders", ["cursor", "limit", "locale"]),
|
|
17702
|
-
cancel_order: route("POST", "/v1/orders/{orderId}/cancel"),
|
|
17703
|
-
pay_order: route("POST", "/v1/orders/{orderId}/pay")
|
|
17704
|
-
};
|
|
17705
|
-
var ACCOUNT_ROUTES = {
|
|
17706
|
-
me: route("GET", "/v1/me"),
|
|
17707
|
-
authConfig: route("GET", "/v1/auth/config")
|
|
17708
|
-
};
|
|
17709
|
-
function routePath(route2, input) {
|
|
17710
|
-
const path = route2.path.replace(
|
|
17711
|
-
/\{(\w+)\}/g,
|
|
17712
|
-
(_, field) => encodeURIComponent(String(input[field]))
|
|
17713
|
-
);
|
|
17714
|
-
const query = new URLSearchParams();
|
|
17715
|
-
for (const field of route2.queryFields) {
|
|
17716
|
-
if (input[field] !== void 0) query.set(field, String(input[field]));
|
|
17717
|
-
}
|
|
17718
|
-
const text2 = query.toString();
|
|
17719
|
-
return text2 ? `${path}?${text2}` : path;
|
|
17720
|
-
}
|
|
17721
|
-
|
|
17722
17701
|
// src/exit-codes.ts
|
|
17723
17702
|
var EXIT = {
|
|
17724
17703
|
ok: 0,
|
|
@@ -18736,6 +18715,7 @@ async function whoami(apiUrl, token) {
|
|
|
18736
18715
|
|
|
18737
18716
|
export {
|
|
18738
18717
|
LIMITS,
|
|
18718
|
+
CURRENCIES,
|
|
18739
18719
|
COMMAND_GROUPS,
|
|
18740
18720
|
COMMANDS,
|
|
18741
18721
|
commandInvocation,
|