@fortrip/agent-contract 3.5.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +145 -141
- package/dist/index.js +53 -63
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ apart.
|
|
|
8
8
|
|
|
9
9
|
It has one peer dependency, `zod` (`^4.4.0`), and runs anywhere
|
|
10
10
|
ES2023 does. Its major version changes when the contract breaks, not with
|
|
11
|
-
the API: `
|
|
11
|
+
the API: `4.x` serves Fortrip API v1.
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
14
|
import { API, LIMITS, PUBLIC_ORIGINS, containsCardNumber } from "@fortrip/agent-contract";
|
package/dist/index.d.ts
CHANGED
|
@@ -27,9 +27,9 @@ declare function containsCardNumber(text: string, minDigits?: number): boolean;
|
|
|
27
27
|
/** An object that keeps fields it does not know. */
|
|
28
28
|
declare function openObject<T extends z.ZodRawShape>(shape: T): z.ZodObject<T>;
|
|
29
29
|
/**
|
|
30
|
-
* An object another protocol defines (a UCP
|
|
30
|
+
* An object another protocol defines (a UCP instrument's `config`), passed on
|
|
31
31
|
* as that protocol has it: any fields, any values. Its fields are not the
|
|
32
|
-
* contract's to close, so `strictOutput` keeps it as it is
|
|
32
|
+
* contract's to close, so `strictOutput` keeps it as it is.
|
|
33
33
|
*/
|
|
34
34
|
declare function protocolObject(): z.ZodType<Record<string, unknown>>;
|
|
35
35
|
/** One of `values`, or any string. JSON Schema: `anyOf [enum, string]`. */
|
|
@@ -89,12 +89,12 @@ declare const ORDER_NEXT_STEP = "Before you give the user an order's payment.url
|
|
|
89
89
|
*/
|
|
90
90
|
declare const CANCEL_NEXT_STEP = "Before you call cancel_order, show the user the order's stay (hotel, dates), cancel.penalty and cancel.refund (amount and currency), then end your reply by asking them to confirm the cancellation, and wait for a clear yes. Pass maximumPenalty exactly as cancel.penalty.amount. Never state a refund the order did not return.";
|
|
91
91
|
/**
|
|
92
|
-
* How to pay without the link
|
|
93
|
-
*
|
|
94
|
-
*
|
|
92
|
+
* How to pay without the link. It rides as the last paragraph of the text
|
|
93
|
+
* of every MCP `book_hotel`, `get_order` and `list_orders` result that holds
|
|
94
|
+
* an order with non-empty `payment.handlers`, after `ORDER_NEXT_STEP`, and in
|
|
95
95
|
* the description of `pay_order`; never as `nextStep`.
|
|
96
96
|
*/
|
|
97
|
-
declare const PAY_NEXT_STEP = "To pay without the link, when the order
|
|
97
|
+
declare const PAY_NEXT_STEP = "To pay without the link, when the order's payment.handlers isn't empty and the user's wallet can grant a Stripe shared payment token: first show and ask exactly as for payment.url, and wait for a clear yes. Then request the token for this order from the user's wallet with the handler's config.business_profile and payment.credentialLimits (maxAmount in cents, currency, expiresAt), and call pay_order with it and the order's price.total. The charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: once pay_order succeeds, payment.url stops working.";
|
|
98
98
|
/**
|
|
99
99
|
* How to present hotels (the `presentation` guide, in one line). It rides as
|
|
100
100
|
* the last paragraph of every MCP `search_hotels`, `get_hotel` and
|
|
@@ -249,31 +249,33 @@ declare const MCP_OUTPUT: {
|
|
|
249
249
|
chargeCurrency: z.ZodString;
|
|
250
250
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
251
251
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
252
|
-
handlers: z.
|
|
252
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
253
253
|
id: z.ZodString;
|
|
254
254
|
type: z.ZodString;
|
|
255
255
|
version: z.ZodString;
|
|
256
256
|
spec: z.ZodString;
|
|
257
|
-
schema: z.
|
|
258
|
-
available_instruments: z.
|
|
257
|
+
schema: z.ZodString;
|
|
258
|
+
available_instruments: z.ZodArray<z.ZodObject<{
|
|
259
259
|
type: z.ZodString;
|
|
260
260
|
config: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
|
|
261
|
-
}, z.core.$strip
|
|
262
|
-
config: z.
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
261
|
+
}, z.core.$strip>>;
|
|
262
|
+
config: z.ZodObject<{
|
|
263
|
+
environment: z.ZodType<(string & {}) | "livemode" | "testmode", unknown, z.core.$ZodTypeInternals<(string & {}) | "livemode" | "testmode", unknown>>;
|
|
264
|
+
business_profile: z.ZodString;
|
|
265
|
+
}, z.core.$strip>;
|
|
266
|
+
}, z.core.$strip>>;
|
|
267
|
+
credentialLimits: z.ZodNullable<z.ZodObject<{
|
|
266
268
|
maxAmount: z.ZodNumber;
|
|
267
269
|
currency: z.ZodString;
|
|
268
270
|
expiresAt: z.ZodString;
|
|
269
271
|
}, z.core.$strip>>;
|
|
270
272
|
}, z.core.$strip>;
|
|
271
|
-
cancel: z.
|
|
273
|
+
cancel: z.ZodObject<{
|
|
272
274
|
available: z.ZodBoolean;
|
|
273
275
|
reason: z.ZodType<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown, z.core.$ZodTypeInternals<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown>>;
|
|
274
276
|
penalty: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
275
277
|
refund: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
276
|
-
}, z.core.$strip
|
|
278
|
+
}, z.core.$strip>;
|
|
277
279
|
manageUrl: z.ZodString;
|
|
278
280
|
nextStep: z.ZodOptional<z.ZodString>;
|
|
279
281
|
}, z.core.$strip>;
|
|
@@ -419,31 +421,33 @@ declare const MCP_OUTPUT: {
|
|
|
419
421
|
chargeCurrency: z.ZodString;
|
|
420
422
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
421
423
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
422
|
-
handlers: z.
|
|
424
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
423
425
|
id: z.ZodString;
|
|
424
426
|
type: z.ZodString;
|
|
425
427
|
version: z.ZodString;
|
|
426
428
|
spec: z.ZodString;
|
|
427
|
-
schema: z.
|
|
428
|
-
available_instruments: z.
|
|
429
|
+
schema: z.ZodString;
|
|
430
|
+
available_instruments: z.ZodArray<z.ZodObject<{
|
|
429
431
|
type: z.ZodString;
|
|
430
432
|
config: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
|
|
431
|
-
}, z.core.$strip
|
|
432
|
-
config: z.
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
433
|
+
}, z.core.$strip>>;
|
|
434
|
+
config: z.ZodObject<{
|
|
435
|
+
environment: z.ZodType<(string & {}) | "livemode" | "testmode", unknown, z.core.$ZodTypeInternals<(string & {}) | "livemode" | "testmode", unknown>>;
|
|
436
|
+
business_profile: z.ZodString;
|
|
437
|
+
}, z.core.$strip>;
|
|
438
|
+
}, z.core.$strip>>;
|
|
439
|
+
credentialLimits: z.ZodNullable<z.ZodObject<{
|
|
436
440
|
maxAmount: z.ZodNumber;
|
|
437
441
|
currency: z.ZodString;
|
|
438
442
|
expiresAt: z.ZodString;
|
|
439
443
|
}, z.core.$strip>>;
|
|
440
444
|
}, z.core.$strip>;
|
|
441
|
-
cancel: z.
|
|
445
|
+
cancel: z.ZodObject<{
|
|
442
446
|
available: z.ZodBoolean;
|
|
443
447
|
reason: z.ZodType<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown, z.core.$ZodTypeInternals<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown>>;
|
|
444
448
|
penalty: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
445
449
|
refund: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
446
|
-
}, z.core.$strip
|
|
450
|
+
}, z.core.$strip>;
|
|
447
451
|
manageUrl: z.ZodString;
|
|
448
452
|
nextStep: z.ZodOptional<z.ZodString>;
|
|
449
453
|
}, z.core.$strip>;
|
|
@@ -590,31 +594,33 @@ declare const MCP_OUTPUT: {
|
|
|
590
594
|
chargeCurrency: z.ZodString;
|
|
591
595
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
592
596
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
593
|
-
handlers: z.
|
|
597
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
594
598
|
id: z.ZodString;
|
|
595
599
|
type: z.ZodString;
|
|
596
600
|
version: z.ZodString;
|
|
597
601
|
spec: z.ZodString;
|
|
598
|
-
schema: z.
|
|
599
|
-
available_instruments: z.
|
|
602
|
+
schema: z.ZodString;
|
|
603
|
+
available_instruments: z.ZodArray<z.ZodObject<{
|
|
600
604
|
type: z.ZodString;
|
|
601
605
|
config: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
|
|
602
|
-
}, z.core.$strip
|
|
603
|
-
config: z.
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
606
|
+
}, z.core.$strip>>;
|
|
607
|
+
config: z.ZodObject<{
|
|
608
|
+
environment: z.ZodType<(string & {}) | "livemode" | "testmode", unknown, z.core.$ZodTypeInternals<(string & {}) | "livemode" | "testmode", unknown>>;
|
|
609
|
+
business_profile: z.ZodString;
|
|
610
|
+
}, z.core.$strip>;
|
|
611
|
+
}, z.core.$strip>>;
|
|
612
|
+
credentialLimits: z.ZodNullable<z.ZodObject<{
|
|
607
613
|
maxAmount: z.ZodNumber;
|
|
608
614
|
currency: z.ZodString;
|
|
609
615
|
expiresAt: z.ZodString;
|
|
610
616
|
}, z.core.$strip>>;
|
|
611
617
|
}, z.core.$strip>;
|
|
612
|
-
cancel: z.
|
|
618
|
+
cancel: z.ZodObject<{
|
|
613
619
|
available: z.ZodBoolean;
|
|
614
620
|
reason: z.ZodType<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown, z.core.$ZodTypeInternals<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown>>;
|
|
615
621
|
penalty: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
616
622
|
refund: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
617
|
-
}, z.core.$strip
|
|
623
|
+
}, z.core.$strip>;
|
|
618
624
|
manageUrl: z.ZodString;
|
|
619
625
|
}, z.core.$strip>>;
|
|
620
626
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
@@ -762,31 +768,33 @@ declare const MCP_OUTPUT: {
|
|
|
762
768
|
chargeCurrency: z.ZodString;
|
|
763
769
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
764
770
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
765
|
-
handlers: z.
|
|
771
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
766
772
|
id: z.ZodString;
|
|
767
773
|
type: z.ZodString;
|
|
768
774
|
version: z.ZodString;
|
|
769
775
|
spec: z.ZodString;
|
|
770
|
-
schema: z.
|
|
771
|
-
available_instruments: z.
|
|
776
|
+
schema: z.ZodString;
|
|
777
|
+
available_instruments: z.ZodArray<z.ZodObject<{
|
|
772
778
|
type: z.ZodString;
|
|
773
779
|
config: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
|
|
774
|
-
}, z.core.$strip
|
|
775
|
-
config: z.
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
780
|
+
}, z.core.$strip>>;
|
|
781
|
+
config: z.ZodObject<{
|
|
782
|
+
environment: z.ZodType<(string & {}) | "livemode" | "testmode", unknown, z.core.$ZodTypeInternals<(string & {}) | "livemode" | "testmode", unknown>>;
|
|
783
|
+
business_profile: z.ZodString;
|
|
784
|
+
}, z.core.$strip>;
|
|
785
|
+
}, z.core.$strip>>;
|
|
786
|
+
credentialLimits: z.ZodNullable<z.ZodObject<{
|
|
779
787
|
maxAmount: z.ZodNumber;
|
|
780
788
|
currency: z.ZodString;
|
|
781
789
|
expiresAt: z.ZodString;
|
|
782
790
|
}, z.core.$strip>>;
|
|
783
791
|
}, z.core.$strip>;
|
|
784
|
-
cancel: z.
|
|
792
|
+
cancel: z.ZodObject<{
|
|
785
793
|
available: z.ZodBoolean;
|
|
786
794
|
reason: z.ZodType<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown, z.core.$ZodTypeInternals<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown>>;
|
|
787
795
|
penalty: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
788
796
|
refund: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
789
|
-
}, z.core.$strip
|
|
797
|
+
}, z.core.$strip>;
|
|
790
798
|
manageUrl: z.ZodString;
|
|
791
799
|
}, z.core.$strip>;
|
|
792
800
|
readonly pay_order: z.ZodObject<{
|
|
@@ -931,31 +939,33 @@ declare const MCP_OUTPUT: {
|
|
|
931
939
|
chargeCurrency: z.ZodString;
|
|
932
940
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
933
941
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
934
|
-
handlers: z.
|
|
942
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
935
943
|
id: z.ZodString;
|
|
936
944
|
type: z.ZodString;
|
|
937
945
|
version: z.ZodString;
|
|
938
946
|
spec: z.ZodString;
|
|
939
|
-
schema: z.
|
|
940
|
-
available_instruments: z.
|
|
947
|
+
schema: z.ZodString;
|
|
948
|
+
available_instruments: z.ZodArray<z.ZodObject<{
|
|
941
949
|
type: z.ZodString;
|
|
942
950
|
config: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
|
|
943
|
-
}, z.core.$strip
|
|
944
|
-
config: z.
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
951
|
+
}, z.core.$strip>>;
|
|
952
|
+
config: z.ZodObject<{
|
|
953
|
+
environment: z.ZodType<(string & {}) | "livemode" | "testmode", unknown, z.core.$ZodTypeInternals<(string & {}) | "livemode" | "testmode", unknown>>;
|
|
954
|
+
business_profile: z.ZodString;
|
|
955
|
+
}, z.core.$strip>;
|
|
956
|
+
}, z.core.$strip>>;
|
|
957
|
+
credentialLimits: z.ZodNullable<z.ZodObject<{
|
|
948
958
|
maxAmount: z.ZodNumber;
|
|
949
959
|
currency: z.ZodString;
|
|
950
960
|
expiresAt: z.ZodString;
|
|
951
961
|
}, z.core.$strip>>;
|
|
952
962
|
}, z.core.$strip>;
|
|
953
|
-
cancel: z.
|
|
963
|
+
cancel: z.ZodObject<{
|
|
954
964
|
available: z.ZodBoolean;
|
|
955
965
|
reason: z.ZodType<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown, z.core.$ZodTypeInternals<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown>>;
|
|
956
966
|
penalty: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
957
967
|
refund: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
958
|
-
}, z.core.$strip
|
|
968
|
+
}, z.core.$strip>;
|
|
959
969
|
manageUrl: z.ZodString;
|
|
960
970
|
}, z.core.$strip>;
|
|
961
971
|
};
|
|
@@ -1391,8 +1401,8 @@ type CancelOrderInput = z.input<typeof cancelOrderInput>;
|
|
|
1391
1401
|
/** `POST /v1/orders/{orderId}/pay` and the MCP `pay_order` arguments: the
|
|
1392
1402
|
* order, a Stripe shared payment token granted for it, and the total the
|
|
1393
1403
|
* user approved. The token is `sharedPaymentToken` or, as UCP's Complete
|
|
1394
|
-
* Checkout sends it, the credential of `payment`'s selected instrument
|
|
1395
|
-
*
|
|
1404
|
+
* Checkout sends it, the credential of `payment`'s selected instrument:
|
|
1405
|
+
* exactly one of the two. A total other than the order's answers
|
|
1396
1406
|
* `payment_total_changed` and charges nothing. */
|
|
1397
1407
|
declare const payOrderInput: z.ZodObject<{
|
|
1398
1408
|
orderId: z.ZodString;
|
|
@@ -1414,7 +1424,7 @@ declare const payOrderInput: z.ZodObject<{
|
|
|
1414
1424
|
}, z.core.$strict>;
|
|
1415
1425
|
type PayOrderInput = z.input<typeof payOrderInput>;
|
|
1416
1426
|
/** The shared payment token a `pay_order` call pays with: `sharedPaymentToken`,
|
|
1417
|
-
* or the credential of `payment`'s selected instrument
|
|
1427
|
+
* or the credential of `payment`'s selected instrument. Takes what
|
|
1418
1428
|
* `payOrderInput` parsed, which holds exactly one. */
|
|
1419
1429
|
declare function sharedPaymentTokenOf(input: Pick<z.output<typeof payOrderInput>, "sharedPaymentToken" | "payment">): string;
|
|
1420
1430
|
|
|
@@ -1488,7 +1498,7 @@ declare const knownLocaleText: z.ZodObject<{
|
|
|
1488
1498
|
locale: z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>;
|
|
1489
1499
|
}, z.core.$strip>;
|
|
1490
1500
|
/**
|
|
1491
|
-
* A hotel photo on a first-party URL
|
|
1501
|
+
* A hotel photo on a first-party URL. `caption` is the catalogue's,
|
|
1492
1502
|
* with its locale; `null` without one.
|
|
1493
1503
|
*/
|
|
1494
1504
|
declare const photo: z.ZodObject<{
|
|
@@ -1951,9 +1961,8 @@ declare const ERROR_DETAILS: {
|
|
|
1951
1961
|
unassigned: z.ZodNumber;
|
|
1952
1962
|
more: z.ZodNumber;
|
|
1953
1963
|
}, z.core.$strip>;
|
|
1954
|
-
/** The searched area's center, as a search echoes it; null for text only.
|
|
1955
|
-
|
|
1956
|
-
center: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1964
|
+
/** The searched area's center, as a search echoes it; null for text only. */
|
|
1965
|
+
center: z.ZodNullable<z.ZodObject<{
|
|
1957
1966
|
location: z.ZodObject<{
|
|
1958
1967
|
lat: z.ZodNumber;
|
|
1959
1968
|
lng: z.ZodNumber;
|
|
@@ -1967,7 +1976,7 @@ declare const ERROR_DETAILS: {
|
|
|
1967
1976
|
}, z.core.$strip>;
|
|
1968
1977
|
}, z.core.$strip>>;
|
|
1969
1978
|
basis: z.ZodType<"point" | (string & {}) | "seat" | "capital" | "busiest_settlement" | "hub", unknown, z.core.$ZodTypeInternals<"point" | (string & {}) | "seat" | "capital" | "busiest_settlement" | "hub", unknown>>;
|
|
1970
|
-
}, z.core.$strip
|
|
1979
|
+
}, z.core.$strip>>;
|
|
1971
1980
|
}, z.core.$strip>;
|
|
1972
1981
|
stay_unsupported: z.ZodType<OpenUnionOutput<"reason", readonly [z.ZodObject<{
|
|
1973
1982
|
reason: z.ZodLiteral<"mixed_occupancy">;
|
|
@@ -2008,7 +2017,7 @@ type ErrorBody<C extends ErrorCode> = {
|
|
|
2008
2017
|
retryAfterSeconds?: number;
|
|
2009
2018
|
requestId: string;
|
|
2010
2019
|
} & (Details[C] extends z.ZodType ? {
|
|
2011
|
-
details
|
|
2020
|
+
details: z.output<Details[C]>;
|
|
2012
2021
|
} : unknown);
|
|
2013
2022
|
/** Any known code's error body; narrows by `code`. */
|
|
2014
2023
|
type KnownErrorBody = {
|
|
@@ -2018,20 +2027,14 @@ type ErrorEnvelope = {
|
|
|
2018
2027
|
error: KnownErrorBody | OpenFallback<"code">;
|
|
2019
2028
|
};
|
|
2020
2029
|
/**
|
|
2021
|
-
* `{ error: { code, message, param?, retryable, retryAfterSeconds?, details
|
|
2022
|
-
* requestId } }`, picked by `code`: a known code
|
|
2023
|
-
*
|
|
2030
|
+
* `{ error: { code, message, param?, retryable, retryAfterSeconds?, details,
|
|
2031
|
+
* requestId } }`, picked by `code`: a known code whose §11 row lists details
|
|
2032
|
+
* carries them, parsed as that code's; one whose row shows "–" has none. An
|
|
2033
|
+
* unknown code falls back.
|
|
2024
2034
|
*/
|
|
2025
2035
|
declare const errorEnvelope: z.ZodType<ErrorEnvelope>;
|
|
2026
|
-
/**
|
|
2027
|
-
* Server tests only: the closed envelope, where a code whose §11 row lists
|
|
2028
|
-
* details must carry them and a code whose row shows "–" must not.
|
|
2029
|
-
*/
|
|
2030
|
-
declare function strictErrorEnvelope(): z.ZodType<{
|
|
2031
|
-
error: KnownErrorBody;
|
|
2032
|
-
}>;
|
|
2033
2036
|
|
|
2034
|
-
/**
|
|
2037
|
+
/** The 14 policy topics, in snake_case, plus `other`. */
|
|
2035
2038
|
declare const POLICY_TOPICS: readonly ["check_in", "important_notices", "booking", "booking_tips", "check_in_out", "check_in_tips", "reception", "deposit", "meal", "extra_bed", "pets", "surroundings", "meetings", "non_smoking", "other"];
|
|
2036
2039
|
type PolicyTopic = (typeof POLICY_TOPICS)[number];
|
|
2037
2040
|
/** A room type's facts; shared with the offer's room. */
|
|
@@ -2081,14 +2084,14 @@ declare const hotel: z.ZodObject<{
|
|
|
2081
2084
|
locale: z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>;
|
|
2082
2085
|
}, z.core.$strip>>;
|
|
2083
2086
|
/** Up to 8 hotel photos, the cover first; `null` when the catalogue lists
|
|
2084
|
-
* none (unknown is not no).
|
|
2085
|
-
photos: z.
|
|
2087
|
+
* none (unknown is not no). */
|
|
2088
|
+
photos: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
2086
2089
|
url: z.ZodString;
|
|
2087
2090
|
caption: z.ZodNullable<z.ZodObject<{
|
|
2088
2091
|
text: z.ZodString;
|
|
2089
2092
|
locale: z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>;
|
|
2090
2093
|
}, z.core.$strip>>;
|
|
2091
|
-
}, z.core.$strip
|
|
2094
|
+
}, z.core.$strip>>>;
|
|
2092
2095
|
checkInTimes: z.ZodObject<{
|
|
2093
2096
|
from: z.ZodNullable<z.ZodString>;
|
|
2094
2097
|
until: z.ZodNullable<z.ZodString>;
|
|
@@ -2386,37 +2389,37 @@ declare const ORDER_STATUSES: readonly ["awaiting_payment", "expired", "confirmi
|
|
|
2386
2389
|
type OrderStatus = (typeof ORDER_STATUSES)[number];
|
|
2387
2390
|
declare const PAYMENT_STATUSES: readonly ["unpaid", "authorized", "paid", "released", "refund_pending", "refunded"];
|
|
2388
2391
|
type PaymentStatus = (typeof PAYMENT_STATUSES)[number];
|
|
2389
|
-
/** Why an order can or can't be cancelled now
|
|
2392
|
+
/** Why an order can or can't be cancelled now: `cancellable` when it
|
|
2390
2393
|
* can, else the first reason that holds. `non_refundable` is a rate the
|
|
2391
2394
|
* hotel takes no cancellation for; `refused`, a cancellation the hotel
|
|
2392
2395
|
* refused, the booking standing as it was. */
|
|
2393
2396
|
declare const CANCEL_REASONS: readonly ["cancellable", "already_cancelled", "in_progress", "not_confirmed", "stay_started", "non_refundable", "refused", "terms_unknown", "needs_attention"];
|
|
2394
2397
|
type CancelReason = (typeof CANCEL_REASONS)[number];
|
|
2395
|
-
/** Why a shared payment token can't pay an order
|
|
2398
|
+
/** Why a shared payment token can't pay an order. */
|
|
2396
2399
|
declare const CREDENTIAL_INVALID_REASONS: readonly ["not_found", "currency", "amount", "expired", "deactivated", "used", "other_seller"];
|
|
2397
2400
|
type CredentialInvalidReason = (typeof CREDENTIAL_INVALID_REASONS)[number];
|
|
2398
|
-
/** A way to pay an order other than its link
|
|
2399
|
-
* Protocol's payment handlers, its fields named as UCP and Stripe
|
|
2400
|
-
* them (snake case)
|
|
2401
|
-
* Stripe shared payment token)
|
|
2402
|
-
* specification it follows
|
|
2403
|
-
*
|
|
2404
|
-
* seller's id a wallet grants
|
|
2405
|
-
* profile)
|
|
2406
|
-
* `networkId` is deprecated (3.5): the same as `config.business_profile`,
|
|
2407
|
-
* null when the handler names none. */
|
|
2401
|
+
/** A way to pay an order other than its link: one of the Universal
|
|
2402
|
+
* Commerce Protocol's payment handlers, its fields named as UCP and Stripe
|
|
2403
|
+
* name them (snake case). `type` names it (`com.stripe.payments`, which
|
|
2404
|
+
* takes a Stripe shared payment token); `version`, `spec` and `schema` the
|
|
2405
|
+
* handler specification it follows; `available_instruments` the
|
|
2406
|
+
* instruments it takes; `config` its settings, whose `business_profile`
|
|
2407
|
+
* is the seller's id a wallet grants the token for (Stripe's business
|
|
2408
|
+
* profile). */
|
|
2408
2409
|
declare const paymentHandler: z.ZodObject<{
|
|
2409
2410
|
id: z.ZodString;
|
|
2410
2411
|
type: z.ZodString;
|
|
2411
2412
|
version: z.ZodString;
|
|
2412
2413
|
spec: z.ZodString;
|
|
2413
|
-
schema: z.
|
|
2414
|
-
available_instruments: z.
|
|
2414
|
+
schema: z.ZodString;
|
|
2415
|
+
available_instruments: z.ZodArray<z.ZodObject<{
|
|
2415
2416
|
type: z.ZodString;
|
|
2416
2417
|
config: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
|
|
2417
|
-
}, z.core.$strip
|
|
2418
|
-
config: z.
|
|
2419
|
-
|
|
2418
|
+
}, z.core.$strip>>;
|
|
2419
|
+
config: z.ZodObject<{
|
|
2420
|
+
environment: z.ZodType<(string & {}) | "livemode" | "testmode", unknown, z.core.$ZodTypeInternals<(string & {}) | "livemode" | "testmode", unknown>>;
|
|
2421
|
+
business_profile: z.ZodString;
|
|
2422
|
+
}, z.core.$strip>;
|
|
2420
2423
|
}, z.core.$strip>;
|
|
2421
2424
|
type PaymentHandler = z.infer<typeof paymentHandler>;
|
|
2422
2425
|
/** `FT-` and six characters with no 0, 1, I or O. */
|
|
@@ -2564,26 +2567,28 @@ declare const order: z.ZodObject<{
|
|
|
2564
2567
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
2565
2568
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
2566
2569
|
/** The ways to pay other than `url`, while the order can be paid that
|
|
2567
|
-
* way
|
|
2568
|
-
*
|
|
2569
|
-
handlers: z.
|
|
2570
|
+
* way: a `com.stripe.payments` handler takes a shared payment token
|
|
2571
|
+
* through `pay_order`. Empty when there is none. */
|
|
2572
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
2570
2573
|
id: z.ZodString;
|
|
2571
2574
|
type: z.ZodString;
|
|
2572
2575
|
version: z.ZodString;
|
|
2573
2576
|
spec: z.ZodString;
|
|
2574
|
-
schema: z.
|
|
2575
|
-
available_instruments: z.
|
|
2577
|
+
schema: z.ZodString;
|
|
2578
|
+
available_instruments: z.ZodArray<z.ZodObject<{
|
|
2576
2579
|
type: z.ZodString;
|
|
2577
2580
|
config: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
|
|
2578
|
-
}, z.core.$strip
|
|
2579
|
-
config: z.
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2581
|
+
}, z.core.$strip>>;
|
|
2582
|
+
config: z.ZodObject<{
|
|
2583
|
+
environment: z.ZodType<(string & {}) | "livemode" | "testmode", unknown, z.core.$ZodTypeInternals<(string & {}) | "livemode" | "testmode", unknown>>;
|
|
2584
|
+
business_profile: z.ZodString;
|
|
2585
|
+
}, z.core.$strip>;
|
|
2586
|
+
}, z.core.$strip>>;
|
|
2587
|
+
/** What a payment credential for `pay_order` must allow, with
|
|
2588
|
+
* `handlers`: `maxAmount` in minor units (cents) of `currency`,
|
|
2584
2589
|
* lowercase as Stripe takes it, and `expiresAt`, past which the order
|
|
2585
|
-
* can't be paid. */
|
|
2586
|
-
credentialLimits: z.
|
|
2590
|
+
* can't be paid. `null` when `handlers` is empty. */
|
|
2591
|
+
credentialLimits: z.ZodNullable<z.ZodObject<{
|
|
2587
2592
|
maxAmount: z.ZodNumber;
|
|
2588
2593
|
currency: z.ZodString;
|
|
2589
2594
|
expiresAt: z.ZodString;
|
|
@@ -2591,14 +2596,13 @@ declare const order: z.ZodObject<{
|
|
|
2591
2596
|
}, z.core.$strip>;
|
|
2592
2597
|
/** Whether the user can cancel the order now and, when they can, its
|
|
2593
2598
|
* penalty under the accepted terms (read a minute ahead) and the refund,
|
|
2594
|
-
* what was paid less the penalty, both in the charge currency.
|
|
2595
|
-
|
|
2596
|
-
cancel: z.ZodOptional<z.ZodObject<{
|
|
2599
|
+
* what was paid less the penalty, both in the charge currency. */
|
|
2600
|
+
cancel: z.ZodObject<{
|
|
2597
2601
|
available: z.ZodBoolean;
|
|
2598
2602
|
reason: z.ZodType<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown, z.core.$ZodTypeInternals<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown>>;
|
|
2599
2603
|
penalty: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
2600
2604
|
refund: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
2601
|
-
}, z.core.$strip
|
|
2605
|
+
}, z.core.$strip>;
|
|
2602
2606
|
manageUrl: z.ZodString;
|
|
2603
2607
|
}, z.core.$strip>;
|
|
2604
2608
|
type Order = z.infer<typeof order>;
|
|
@@ -2747,26 +2751,28 @@ declare const orderList: z.ZodObject<{
|
|
|
2747
2751
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
2748
2752
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
2749
2753
|
/** The ways to pay other than `url`, while the order can be paid that
|
|
2750
|
-
* way
|
|
2751
|
-
*
|
|
2752
|
-
handlers: z.
|
|
2754
|
+
* way: a `com.stripe.payments` handler takes a shared payment token
|
|
2755
|
+
* through `pay_order`. Empty when there is none. */
|
|
2756
|
+
handlers: z.ZodArray<z.ZodObject<{
|
|
2753
2757
|
id: z.ZodString;
|
|
2754
2758
|
type: z.ZodString;
|
|
2755
2759
|
version: z.ZodString;
|
|
2756
2760
|
spec: z.ZodString;
|
|
2757
|
-
schema: z.
|
|
2758
|
-
available_instruments: z.
|
|
2761
|
+
schema: z.ZodString;
|
|
2762
|
+
available_instruments: z.ZodArray<z.ZodObject<{
|
|
2759
2763
|
type: z.ZodString;
|
|
2760
2764
|
config: z.ZodOptional<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
|
|
2761
|
-
}, z.core.$strip
|
|
2762
|
-
config: z.
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2765
|
+
}, z.core.$strip>>;
|
|
2766
|
+
config: z.ZodObject<{
|
|
2767
|
+
environment: z.ZodType<(string & {}) | "livemode" | "testmode", unknown, z.core.$ZodTypeInternals<(string & {}) | "livemode" | "testmode", unknown>>;
|
|
2768
|
+
business_profile: z.ZodString;
|
|
2769
|
+
}, z.core.$strip>;
|
|
2770
|
+
}, z.core.$strip>>;
|
|
2771
|
+
/** What a payment credential for `pay_order` must allow, with
|
|
2772
|
+
* `handlers`: `maxAmount` in minor units (cents) of `currency`,
|
|
2767
2773
|
* lowercase as Stripe takes it, and `expiresAt`, past which the order
|
|
2768
|
-
* can't be paid. */
|
|
2769
|
-
credentialLimits: z.
|
|
2774
|
+
* can't be paid. `null` when `handlers` is empty. */
|
|
2775
|
+
credentialLimits: z.ZodNullable<z.ZodObject<{
|
|
2770
2776
|
maxAmount: z.ZodNumber;
|
|
2771
2777
|
currency: z.ZodString;
|
|
2772
2778
|
expiresAt: z.ZodString;
|
|
@@ -2774,14 +2780,13 @@ declare const orderList: z.ZodObject<{
|
|
|
2774
2780
|
}, z.core.$strip>;
|
|
2775
2781
|
/** Whether the user can cancel the order now and, when they can, its
|
|
2776
2782
|
* penalty under the accepted terms (read a minute ahead) and the refund,
|
|
2777
|
-
* what was paid less the penalty, both in the charge currency.
|
|
2778
|
-
|
|
2779
|
-
cancel: z.ZodOptional<z.ZodObject<{
|
|
2783
|
+
* what was paid less the penalty, both in the charge currency. */
|
|
2784
|
+
cancel: z.ZodObject<{
|
|
2780
2785
|
available: z.ZodBoolean;
|
|
2781
2786
|
reason: z.ZodType<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown, z.core.$ZodTypeInternals<(string & {}) | "non_refundable" | "needs_attention" | "cancellable" | "already_cancelled" | "in_progress" | "not_confirmed" | "stay_started" | "refused" | "terms_unknown", unknown>>;
|
|
2782
2787
|
penalty: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
2783
2788
|
refund: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
2784
|
-
}, z.core.$strip
|
|
2789
|
+
}, z.core.$strip>;
|
|
2785
2790
|
manageUrl: z.ZodString;
|
|
2786
2791
|
}, z.core.$strip>>;
|
|
2787
2792
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
@@ -3088,14 +3093,14 @@ declare const hotelSummary: z.ZodObject<{
|
|
|
3088
3093
|
rateDate: z.ZodString;
|
|
3089
3094
|
}, z.core.$strip>>;
|
|
3090
3095
|
}, z.core.$strip>>;
|
|
3091
|
-
/** The cover photo; `null` without one.
|
|
3092
|
-
photo: z.
|
|
3096
|
+
/** The cover photo; `null` without one. */
|
|
3097
|
+
photo: z.ZodNullable<z.ZodObject<{
|
|
3093
3098
|
url: z.ZodString;
|
|
3094
3099
|
caption: z.ZodNullable<z.ZodObject<{
|
|
3095
3100
|
text: z.ZodString;
|
|
3096
3101
|
locale: z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>;
|
|
3097
3102
|
}, z.core.$strip>>;
|
|
3098
|
-
}, z.core.$strip
|
|
3103
|
+
}, z.core.$strip>>;
|
|
3099
3104
|
}, z.core.$strip>;
|
|
3100
3105
|
type HotelSummary = z.infer<typeof hotelSummary>;
|
|
3101
3106
|
/** The top locality hubs of a scope (§7.6); also `search_too_broad` details. */
|
|
@@ -3358,14 +3363,14 @@ declare const searchResult: z.ZodObject<{
|
|
|
3358
3363
|
rateDate: z.ZodString;
|
|
3359
3364
|
}, z.core.$strip>>;
|
|
3360
3365
|
}, z.core.$strip>>;
|
|
3361
|
-
/** The cover photo; `null` without one.
|
|
3362
|
-
photo: z.
|
|
3366
|
+
/** The cover photo; `null` without one. */
|
|
3367
|
+
photo: z.ZodNullable<z.ZodObject<{
|
|
3363
3368
|
url: z.ZodString;
|
|
3364
3369
|
caption: z.ZodNullable<z.ZodObject<{
|
|
3365
3370
|
text: z.ZodString;
|
|
3366
3371
|
locale: z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>;
|
|
3367
3372
|
}, z.core.$strip>>;
|
|
3368
|
-
}, z.core.$strip
|
|
3373
|
+
}, z.core.$strip>>;
|
|
3369
3374
|
}, z.core.$strip>>;
|
|
3370
3375
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
3371
3376
|
notes: z.ZodArray<z.ZodObject<{
|
|
@@ -3410,10 +3415,9 @@ type RenderedTool = Exclude<ToolName, "get_planning_guide">;
|
|
|
3410
3415
|
* as they came. A result that does not parse is shown as JSON, never thrown.
|
|
3411
3416
|
* The consent rule (`ORDER_NEXT_STEP`) is the last paragraph whenever the
|
|
3412
3417
|
* result holds a non-null `payment.url`; the pay rule (`PAY_NEXT_STEP`)
|
|
3413
|
-
* follows it when a result holds an order with `payment.handlers`;
|
|
3414
|
-
* cancel rule (`CANCEL_NEXT_STEP`)
|
|
3415
|
-
*
|
|
3416
|
-
* `cancel.available`.
|
|
3418
|
+
* follows it when a result holds an order with non-empty `payment.handlers`;
|
|
3419
|
+
* the cancel rule (`CANCEL_NEXT_STEP`) follows it when a `get_order` or
|
|
3420
|
+
* `list_orders` result holds an order with `cancel.available`.
|
|
3417
3421
|
*/
|
|
3418
3422
|
declare function renderToolResult(tool: RenderedTool, data: unknown): string;
|
|
3419
3423
|
|
|
@@ -3433,4 +3437,4 @@ declare const UNKNOWN_IS_NOT_NO_EXEMPTIONS: Readonly<Record<string, string>>;
|
|
|
3433
3437
|
/** The contract's version, from package.json, the one place a release bumps it. */
|
|
3434
3438
|
declare const CONTRACT_VERSION: string;
|
|
3435
3439
|
|
|
3436
|
-
export { AMENITY_CODES, API, type AmenityCode, type AuthConfig, CANCEL_NEXT_STEP, CANCEL_REASONS, CARD_NUMBER_MESSAGE, CENTER_BASES, COMMANDS, COMMAND_GROUPS, CONTRACT_VERSION, CREDENTIAL_INVALID_REASONS, type CancelOrderInput, type CancelReason, type Center, type CommandGroupSpec, type CommandSpec, type CreateOrderInput, type CredentialInvalidReason, DISPLAY_CURRENCIES, type Destination, ERROR_CODES, ERROR_DETAILS, type ErrorBody, type ErrorCode, type ErrorEnvelope, FILTERABLE_AMENITIES, type FilterableAmenity, type FlagSpec, GLOBAL_FLAGS, type GetHotelInput, type GetOrderInput, type GuideSurface, type GuideTopic, type Hotel, type HotelOffersInput, type HotelOffersResult, type HotelSummary, type IndicativePrice, type KnownErrorBody, LIMITS, type ListOrdersInput, MCP_OUTPUT, MCP_PATH, type MeResult, type Money, ORDER_NEXT_STEP, ORDER_STATUSES, type Offer, type OfferChange, type Omitted, type OptionSpec, type Order, type OrderList, type OrderStatus, PAYMENT_STATUSES, PAY_NEXT_STEP, PLACE_KINDS, POLICY_TOPICS, PRESENTATION_HINT, PUBLIC_ORIGINS, type PayOrderInput, type PaymentHandler, type PaymentStatus, type Place, type PlaceRef, type PolicyTopic, type PositionalSpec, type RenderedTool, SEARCH_NOTE_CODES, SEARCH_SORTS, SUPPORT_EMAIL, type SearchHotelsInput, type SearchNoteCode, type SearchResult, type Stay, TOOLS, type ToolName, type ToolSpec, UNAVAILABLE_REASONS, UNKNOWN_IS_NOT_NO_EXEMPTIONS, addIsoDateDays, authConfig, cancelOrderInput, cancellation, center, commandInvocation, confirmation, containsCardNumber, countIsoDateDays, createOrderInput, createSearchHotelsInput, destination, errorEnvelope, flag, formatMoney, getHotelInput, getOrderInput, hotel, hotelId, hotelOffersInput, hotelOffersResult, hotelSummary, indicativePrice, instant, isIsoDate, knownLocaleText, latLng, listOrdersInput, localDate, localTime, localities, localizedText, meResult, meals, money, names, nonEmpty, offer, offerChange, offerId, omitted, oneOf, openEnum, openObject, openUnion, order, orderId, orderList, orderReference, parseOpen, payAtProperty, payOrderInput, paymentHandler, photo, place, placeId, placeRef, protocolObject, renderError, renderGuide, renderToolResult, roomFacts, searchHotelsInput, searchResult, sharedPaymentTokenOf, stay, stayEcho,
|
|
3440
|
+
export { AMENITY_CODES, API, type AmenityCode, type AuthConfig, CANCEL_NEXT_STEP, CANCEL_REASONS, CARD_NUMBER_MESSAGE, CENTER_BASES, COMMANDS, COMMAND_GROUPS, CONTRACT_VERSION, CREDENTIAL_INVALID_REASONS, type CancelOrderInput, type CancelReason, type Center, type CommandGroupSpec, type CommandSpec, type CreateOrderInput, type CredentialInvalidReason, DISPLAY_CURRENCIES, type Destination, ERROR_CODES, ERROR_DETAILS, type ErrorBody, type ErrorCode, type ErrorEnvelope, FILTERABLE_AMENITIES, type FilterableAmenity, type FlagSpec, GLOBAL_FLAGS, type GetHotelInput, type GetOrderInput, type GuideSurface, type GuideTopic, type Hotel, type HotelOffersInput, type HotelOffersResult, type HotelSummary, type IndicativePrice, type KnownErrorBody, LIMITS, type ListOrdersInput, MCP_OUTPUT, MCP_PATH, type MeResult, type Money, ORDER_NEXT_STEP, ORDER_STATUSES, type Offer, type OfferChange, type Omitted, type OptionSpec, type Order, type OrderList, type OrderStatus, PAYMENT_STATUSES, PAY_NEXT_STEP, PLACE_KINDS, POLICY_TOPICS, PRESENTATION_HINT, PUBLIC_ORIGINS, type PayOrderInput, type PaymentHandler, type PaymentStatus, type Place, type PlaceRef, type PolicyTopic, type PositionalSpec, type RenderedTool, SEARCH_NOTE_CODES, SEARCH_SORTS, SUPPORT_EMAIL, type SearchHotelsInput, type SearchNoteCode, type SearchResult, type Stay, TOOLS, type ToolName, type ToolSpec, UNAVAILABLE_REASONS, UNKNOWN_IS_NOT_NO_EXEMPTIONS, addIsoDateDays, authConfig, cancelOrderInput, cancellation, center, commandInvocation, confirmation, containsCardNumber, countIsoDateDays, createOrderInput, createSearchHotelsInput, destination, errorEnvelope, flag, formatMoney, getHotelInput, getOrderInput, hotel, hotelId, hotelOffersInput, hotelOffersResult, hotelSummary, indicativePrice, instant, isIsoDate, knownLocaleText, latLng, listOrdersInput, localDate, localTime, localities, localizedText, meResult, meals, money, names, nonEmpty, offer, offerChange, offerId, omitted, oneOf, openEnum, openObject, openUnion, order, orderId, orderList, orderReference, parseOpen, payAtProperty, payOrderInput, paymentHandler, photo, place, placeId, placeRef, protocolObject, renderError, renderGuide, renderToolResult, roomFacts, searchHotelsInput, searchResult, sharedPaymentTokenOf, stay, stayEcho, strictInput, strictOutput, text, timeZone, usdMoney, wholeNumber };
|
package/dist/index.js
CHANGED
|
@@ -1223,7 +1223,7 @@ var FRAGMENTS = {
|
|
|
1223
1223
|
"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',
|
|
1224
1224
|
"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",
|
|
1225
1225
|
"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 the `hub` it belongs to: search the hub, 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 USD; 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. A typo finds nothing.\n{{/if}}\n',
|
|
1226
|
-
"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 on Stripe. 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- Before you give `payment.url`, show the user 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.\n- An order `awaiting_payment` 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
|
|
1226
|
+
"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 on Stripe. 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- Before you give `payment.url`, show the user 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.\n- An order `awaiting_payment` 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.handlers` isn't empty can also be paid with a Stripe shared payment token that the user's wallet (Link) grants for it, through `{{tool:orders pay}}`:\n\n1. Show and ask exactly as before giving the payment link, 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 wallet with the handler's `config.business_profile` and `payment.credentialLimits`: `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: once `{{tool:orders pay}}` succeeds, `payment.url` stops working; a payment that fails leaves the link open. `payment_total_changed` means the total changed: show the new total and ask again, for a new 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 the order's `payment.credentialLimits`. `service_unavailable`: call `{{tool:orders pay}}` again with the same token, never a new one. A token pays one order only.\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",
|
|
1227
1227
|
"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}}{{#if cli}}`{{tool:guide}}`{{/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 other than `approx`, 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 USD.\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",
|
|
1228
1228
|
"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 USD, 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",
|
|
1229
1229
|
"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 for offers and the orders made from them.{{#if claude-skill cli}} `perNightAllRooms` is the total per night; to compare with a per-room budget, also divide by the rooms.{{/if}} Stripe's page may let the user pay in their card's local currency at Stripe's rate (Adaptive Pricing){{#if claude-skill cli}}: say so plainly, and that the USD total is the price{{/if}}. `approx`{{#if claude-skill cli}}, in `{{arg:displayCurrency}}`, with its `rateDate`,{{/if}} is an estimate, never the charge.\n{{#if claude-skill cli}}\n- `{{arg:displayCurrency}}`{{#if cli}} (or `FORTRIP_DISPLAY_CURRENCY`){{/if}} is `USD` or `CNY`: `CNY` adds `approx` in yuan to suit a user who thinks in it. It never changes the charge.\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",
|
|
@@ -1521,8 +1521,8 @@ var hotelSummary = openObject({
|
|
|
1521
1521
|
timeZone: z11.string().nullable(),
|
|
1522
1522
|
distanceMeters: z11.number().nullable(),
|
|
1523
1523
|
price: indicativePrice.nullable(),
|
|
1524
|
-
/** The cover photo; `null` without one.
|
|
1525
|
-
photo: photo.nullable()
|
|
1524
|
+
/** The cover photo; `null` without one. */
|
|
1525
|
+
photo: photo.nullable()
|
|
1526
1526
|
});
|
|
1527
1527
|
var localities = openObject({
|
|
1528
1528
|
items: z11.array(
|
|
@@ -1642,8 +1642,8 @@ var hotel = openObject({
|
|
|
1642
1642
|
timeZone: z12.string().nullable(),
|
|
1643
1643
|
description: knownLocaleText.nullable(),
|
|
1644
1644
|
/** Up to 8 hotel photos, the cover first; `null` when the catalogue lists
|
|
1645
|
-
* none (unknown is not no).
|
|
1646
|
-
photos: z12.array(photo).nullable()
|
|
1645
|
+
* none (unknown is not no). */
|
|
1646
|
+
photos: z12.array(photo).nullable(),
|
|
1647
1647
|
checkInTimes: timeRange,
|
|
1648
1648
|
checkOutTimes: timeRange,
|
|
1649
1649
|
policies: openObject({
|
|
@@ -1819,10 +1819,14 @@ var paymentHandler = openObject({
|
|
|
1819
1819
|
type: z14.string(),
|
|
1820
1820
|
version: z14.string(),
|
|
1821
1821
|
spec: z14.string(),
|
|
1822
|
-
schema: z14.string()
|
|
1823
|
-
available_instruments: z14.array(
|
|
1824
|
-
|
|
1825
|
-
|
|
1822
|
+
schema: z14.string(),
|
|
1823
|
+
available_instruments: z14.array(
|
|
1824
|
+
openObject({ type: z14.string(), config: protocolObject().optional() })
|
|
1825
|
+
),
|
|
1826
|
+
config: openObject({
|
|
1827
|
+
environment: openEnum(["livemode", "testmode"]),
|
|
1828
|
+
business_profile: z14.string()
|
|
1829
|
+
})
|
|
1826
1830
|
});
|
|
1827
1831
|
var orderReference = z14.string().regex(/^FT-[2-9A-HJ-NP-Z]{6}$/);
|
|
1828
1832
|
var hotelItem = openObject({
|
|
@@ -1862,29 +1866,28 @@ var order = openObject({
|
|
|
1862
1866
|
localCurrencyAtCheckout: z14.boolean(),
|
|
1863
1867
|
localCharge: money.nullable(),
|
|
1864
1868
|
/** The ways to pay other than `url`, while the order can be paid that
|
|
1865
|
-
* way
|
|
1866
|
-
*
|
|
1867
|
-
handlers: z14.array(paymentHandler)
|
|
1868
|
-
/** What a payment credential for `pay_order` must allow,
|
|
1869
|
-
* `handlers
|
|
1869
|
+
* way: a `com.stripe.payments` handler takes a shared payment token
|
|
1870
|
+
* through `pay_order`. Empty when there is none. */
|
|
1871
|
+
handlers: z14.array(paymentHandler),
|
|
1872
|
+
/** What a payment credential for `pay_order` must allow, with
|
|
1873
|
+
* `handlers`: `maxAmount` in minor units (cents) of `currency`,
|
|
1870
1874
|
* lowercase as Stripe takes it, and `expiresAt`, past which the order
|
|
1871
|
-
* can't be paid. */
|
|
1875
|
+
* can't be paid. `null` when `handlers` is empty. */
|
|
1872
1876
|
credentialLimits: openObject({
|
|
1873
1877
|
maxAmount: z14.number().int(),
|
|
1874
1878
|
currency: z14.string(),
|
|
1875
1879
|
expiresAt: instant
|
|
1876
|
-
}).
|
|
1880
|
+
}).nullable()
|
|
1877
1881
|
}),
|
|
1878
1882
|
/** Whether the user can cancel the order now and, when they can, its
|
|
1879
1883
|
* penalty under the accepted terms (read a minute ahead) and the refund,
|
|
1880
|
-
* what was paid less the penalty, both in the charge currency.
|
|
1881
|
-
* from servers before 3.3. */
|
|
1884
|
+
* what was paid less the penalty, both in the charge currency. */
|
|
1882
1885
|
cancel: openObject({
|
|
1883
1886
|
available: z14.boolean(),
|
|
1884
1887
|
reason: openEnum(CANCEL_REASONS),
|
|
1885
1888
|
penalty: money.nullable(),
|
|
1886
1889
|
refund: money.nullable()
|
|
1887
|
-
})
|
|
1890
|
+
}),
|
|
1888
1891
|
manageUrl: z14.string()
|
|
1889
1892
|
});
|
|
1890
1893
|
var orderList = openObject({
|
|
@@ -1977,9 +1980,8 @@ var ERROR_DETAILS = {
|
|
|
1977
1980
|
matched: count2,
|
|
1978
1981
|
poolLimit: count2,
|
|
1979
1982
|
localities,
|
|
1980
|
-
/** The searched area's center, as a search echoes it; null for text only.
|
|
1981
|
-
|
|
1982
|
-
center: center.nullable().optional()
|
|
1983
|
+
/** The searched area's center, as a search echoes it; null for text only. */
|
|
1984
|
+
center: center.nullable()
|
|
1983
1985
|
}),
|
|
1984
1986
|
stay_unsupported: openUnion("reason", [
|
|
1985
1987
|
openObject({ reason: z15.literal("mixed_occupancy") }),
|
|
@@ -2011,32 +2013,23 @@ var ERROR_DETAILS = {
|
|
|
2011
2013
|
}),
|
|
2012
2014
|
internal: null
|
|
2013
2015
|
};
|
|
2014
|
-
var
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
});
|
|
2032
|
-
})
|
|
2033
|
-
)
|
|
2034
|
-
});
|
|
2035
|
-
}
|
|
2036
|
-
var errorEnvelope = envelopeSchema(false);
|
|
2037
|
-
function strictErrorEnvelope() {
|
|
2038
|
-
return strictOutput(envelopeSchema(true));
|
|
2039
|
-
}
|
|
2016
|
+
var errorEnvelope = openObject({
|
|
2017
|
+
error: openUnion(
|
|
2018
|
+
"code",
|
|
2019
|
+
Object.keys(ERROR_CODES).map((code) => {
|
|
2020
|
+
const details = ERROR_DETAILS[code];
|
|
2021
|
+
return openObject({
|
|
2022
|
+
code: z15.literal(code),
|
|
2023
|
+
message: z15.string(),
|
|
2024
|
+
param: z15.string().optional(),
|
|
2025
|
+
retryable: z15.boolean(),
|
|
2026
|
+
retryAfterSeconds: z15.number().int().optional(),
|
|
2027
|
+
...details ? { details } : {},
|
|
2028
|
+
requestId: z15.string()
|
|
2029
|
+
});
|
|
2030
|
+
})
|
|
2031
|
+
)
|
|
2032
|
+
});
|
|
2040
2033
|
|
|
2041
2034
|
// src/paths.ts
|
|
2042
2035
|
var PUBLIC_ORIGINS = {
|
|
@@ -2071,7 +2064,7 @@ var MCP_PATH = "/";
|
|
|
2071
2064
|
import { z as z16 } from "zod";
|
|
2072
2065
|
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.";
|
|
2073
2066
|
var CANCEL_NEXT_STEP = "Before you call cancel_order, show the user the order's stay (hotel, dates), cancel.penalty and cancel.refund (amount and currency), then end your reply by asking them to confirm the cancellation, and wait for a clear yes. Pass maximumPenalty exactly as cancel.penalty.amount. Never state a refund the order did not return.";
|
|
2074
|
-
var PAY_NEXT_STEP = "To pay without the link, when the order
|
|
2067
|
+
var PAY_NEXT_STEP = "To pay without the link, when the order's payment.handlers isn't empty and the user's wallet can grant a Stripe shared payment token: first show and ask exactly as for payment.url, and wait for a clear yes. Then request the token for this order from the user's wallet with the handler's config.business_profile and payment.credentialLimits (maxAmount in cents, currency, expiresAt), and call pay_order with it and the order's price.total. The charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: once pay_order succeeds, payment.url stops working.";
|
|
2075
2068
|
var PRESENTATION_HINT = "Presentation: If 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 USD, 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.";
|
|
2076
2069
|
var nextStep = z16.string().optional().describe(
|
|
2077
2070
|
"What to show and ask before giving a payment.url. Present when the answer holds a non-null payment.url, and only then."
|
|
@@ -2168,7 +2161,7 @@ var TOOLS = [
|
|
|
2168
2161
|
{
|
|
2169
2162
|
name: "pay_order",
|
|
2170
2163
|
title: "Pay order with a shared payment token",
|
|
2171
|
-
description: "Pay an order awaiting payment without its link, with a Stripe shared payment token, when the order
|
|
2164
|
+
description: "Pay an order awaiting payment without its link, with a Stripe shared payment token, when the order's payment.handlers isn't empty. First show and ask exactly as for payment.url, and wait for a clear yes. Then request the token from the user's wallet with the handler's config.business_profile and payment.credentialLimits, and pass it with the order's price.total. The charge is in USD. Once it succeeds, payment.url stops working; a payment that fails leaves the link open. Answers the order: status confirming, the payment authorized (held, charged once the hotel confirms); poll get_order. payment_total_changed: show details.total and ask again, for a new token. payment_declined: the user picks another payment method in their wallet, or pays by link. payment_action_required: the card needs verification; pay by link. payment_credential_invalid: request a new token. service_unavailable: call pay_order again with the same token, never a new one. A token pays one order only; the same token again answers as before.",
|
|
2172
2165
|
annotations: {
|
|
2173
2166
|
readOnlyHint: false,
|
|
2174
2167
|
idempotentHint: true,
|
|
@@ -2530,17 +2523,15 @@ function paymentLines(o) {
|
|
|
2530
2523
|
} else if (o.status === "awaiting_payment") {
|
|
2531
2524
|
lines.push("Payment link: could not be read this time; read this order again for it.");
|
|
2532
2525
|
}
|
|
2533
|
-
if (p.handlers
|
|
2534
|
-
|
|
2526
|
+
if (p.handlers.length > 0) lines.push(handlersLine(p.handlers, p.credentialLimits));
|
|
2527
|
+
lines.push(cancelLine(o.cancel));
|
|
2535
2528
|
lines.push(`Manage: ${o.manageUrl}`);
|
|
2536
2529
|
return lines;
|
|
2537
2530
|
}
|
|
2538
2531
|
function handlersLine(handlers, limits) {
|
|
2539
|
-
const shown = handlers.map(
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
return `${h.type} (handler ${h.id}${businessProfile ? `, business_profile ${businessProfile}` : ""})`;
|
|
2543
|
-
});
|
|
2532
|
+
const shown = handlers.map(
|
|
2533
|
+
(h) => `${h.type} (handler ${h.id}, business_profile ${h.config.business_profile})`
|
|
2534
|
+
);
|
|
2544
2535
|
const limit = limits ? `; token limits: maxAmount ${limits.maxAmount} (cents), currency ${limits.currency}, expiresAt ${limits.expiresAt}` : "";
|
|
2545
2536
|
return `Pay without the link: pay_order with a shared payment token via ${shown.join(", ")}${limit}`;
|
|
2546
2537
|
}
|
|
@@ -2843,7 +2834,7 @@ function notFound(d) {
|
|
|
2843
2834
|
}
|
|
2844
2835
|
}
|
|
2845
2836
|
function detailLines(e) {
|
|
2846
|
-
if (!("details" in e)
|
|
2837
|
+
if (!("details" in e)) return [];
|
|
2847
2838
|
switch (e.code) {
|
|
2848
2839
|
case "invalid_request": {
|
|
2849
2840
|
const d = e.details;
|
|
@@ -3030,8 +3021,8 @@ function withConsent(tool, text2, orders) {
|
|
|
3030
3021
|
return [
|
|
3031
3022
|
text2,
|
|
3032
3023
|
orders.some((o) => o.payment.url !== null) ? ORDER_NEXT_STEP : "",
|
|
3033
|
-
orders.some((o) =>
|
|
3034
|
-
CANCEL_TOOLS.has(tool) && orders.some((o) => o.cancel
|
|
3024
|
+
orders.some((o) => o.payment.handlers.length > 0) ? PAY_NEXT_STEP : "",
|
|
3025
|
+
CANCEL_TOOLS.has(tool) && orders.some((o) => o.cancel.available) ? CANCEL_NEXT_STEP : ""
|
|
3035
3026
|
].filter(Boolean).join("\n\n");
|
|
3036
3027
|
}
|
|
3037
3028
|
|
|
@@ -3061,7 +3052,7 @@ var UNKNOWN_IS_NOT_NO_EXEMPTIONS = {
|
|
|
3061
3052
|
requiresSignIn: `${API_DECIDES} (whether the payment link needs a website sign-in).`,
|
|
3062
3053
|
localCurrencyAtCheckout: `${API_DECIDES} (whether checkout may charge in the card's currency).`,
|
|
3063
3054
|
"cancel.available": `${API_DECIDES} (whether an order can be cancelled now).`,
|
|
3064
|
-
"payment.handlers": `${RESULT_LIST} (the ways to pay an order other than its link;
|
|
3055
|
+
"payment.handlers": `${RESULT_LIST} (the ways to pay an order other than its link; empty when there is none).`,
|
|
3065
3056
|
available_instruments: `${RESULT_LIST} (the instruments a payment handler takes).`,
|
|
3066
3057
|
bookable: `${API_DECIDES} (whether the hotel is still in the index).`,
|
|
3067
3058
|
cityLike: `${API_DECIDES} (frozen per gazetteer release; null where not computed).`,
|
|
@@ -3072,7 +3063,7 @@ var UNKNOWN_IS_NOT_NO_EXEMPTIONS = {
|
|
|
3072
3063
|
// package.json
|
|
3073
3064
|
var package_default = {
|
|
3074
3065
|
name: "@fortrip/agent-contract",
|
|
3075
|
-
version: "
|
|
3066
|
+
version: "4.0.0",
|
|
3076
3067
|
license: "Apache-2.0",
|
|
3077
3068
|
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.",
|
|
3078
3069
|
type: "module",
|
|
@@ -3225,7 +3216,6 @@ export {
|
|
|
3225
3216
|
sharedPaymentTokenOf,
|
|
3226
3217
|
stay,
|
|
3227
3218
|
stayEcho,
|
|
3228
|
-
strictErrorEnvelope,
|
|
3229
3219
|
strictInput,
|
|
3230
3220
|
strictOutput,
|
|
3231
3221
|
text,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fortrip/agent-contract",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"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.",
|
|
6
6
|
"type": "module",
|