@fortrip/agent-contract 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +312 -7
- package/dist/index.js +161 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ declare function parseOpen<T>(schema: z.ZodType<T>, value: unknown): T;
|
|
|
52
52
|
*/
|
|
53
53
|
declare function strictOutput<T extends z.ZodType>(schema: T): T;
|
|
54
54
|
|
|
55
|
-
type ToolName = "get_planning_guide" | "search_hotels" | "get_hotel" | "get_hotel_offers" | "book_hotel" | "get_order" | "list_orders" | "cancel_order";
|
|
55
|
+
type ToolName = "get_planning_guide" | "search_hotels" | "get_hotel" | "get_hotel_offers" | "book_hotel" | "get_order" | "list_orders" | "cancel_order" | "pay_order";
|
|
56
56
|
interface ToolSpec {
|
|
57
57
|
name: ToolName;
|
|
58
58
|
title: string;
|
|
@@ -81,6 +81,13 @@ declare const ORDER_NEXT_STEP = "Before you give the user an order's payment.url
|
|
|
81
81
|
* both apply, and never as `nextStep`, which keeps its payment-only meaning.
|
|
82
82
|
*/
|
|
83
83
|
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.";
|
|
84
|
+
/**
|
|
85
|
+
* How to pay without the link (3.4). It rides as the last paragraph of the
|
|
86
|
+
* text of every MCP `book_hotel`, `get_order` and `list_orders` result that
|
|
87
|
+
* holds an order with `payment.handlers`, after `ORDER_NEXT_STEP`, and in
|
|
88
|
+
* the description of `pay_order`; never as `nextStep`.
|
|
89
|
+
*/
|
|
90
|
+
declare const PAY_NEXT_STEP = "To pay without the link, when the order has payment.handlers 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 networkId 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.";
|
|
84
91
|
/**
|
|
85
92
|
* How to present hotels (the `presentation` guide, in one line). It rides as
|
|
86
93
|
* the last paragraph of every MCP `search_hotels`, `get_hotel` and
|
|
@@ -90,7 +97,8 @@ declare const CANCEL_NEXT_STEP = "Before you call cancel_order, show the user th
|
|
|
90
97
|
declare const 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.";
|
|
91
98
|
/** The answers over MCP that are orders. Those that can hold a
|
|
92
99
|
* `payment.url` are the HTTP answer plus `nextStep`, which only MCP
|
|
93
|
-
* declares; `cancel_order`'s never
|
|
100
|
+
* declares; `cancel_order`'s and `pay_order`'s never hold one, so they are
|
|
101
|
+
* the HTTP answer. */
|
|
94
102
|
declare const MCP_OUTPUT: {
|
|
95
103
|
readonly book_hotel: z.ZodObject<{
|
|
96
104
|
orderId: z.ZodString;
|
|
@@ -234,6 +242,18 @@ declare const MCP_OUTPUT: {
|
|
|
234
242
|
chargeCurrency: z.ZodString;
|
|
235
243
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
236
244
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
245
|
+
handlers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
246
|
+
id: z.ZodString;
|
|
247
|
+
type: z.ZodString;
|
|
248
|
+
version: z.ZodString;
|
|
249
|
+
spec: z.ZodString;
|
|
250
|
+
networkId: z.ZodNullable<z.ZodString>;
|
|
251
|
+
}, z.core.$strip>>>;
|
|
252
|
+
credentialLimits: z.ZodOptional<z.ZodObject<{
|
|
253
|
+
maxAmount: z.ZodNumber;
|
|
254
|
+
currency: z.ZodString;
|
|
255
|
+
expiresAt: z.ZodString;
|
|
256
|
+
}, z.core.$strip>>;
|
|
237
257
|
}, z.core.$strip>;
|
|
238
258
|
cancel: z.ZodOptional<z.ZodObject<{
|
|
239
259
|
available: z.ZodBoolean;
|
|
@@ -386,6 +406,18 @@ declare const MCP_OUTPUT: {
|
|
|
386
406
|
chargeCurrency: z.ZodString;
|
|
387
407
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
388
408
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
409
|
+
handlers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
410
|
+
id: z.ZodString;
|
|
411
|
+
type: z.ZodString;
|
|
412
|
+
version: z.ZodString;
|
|
413
|
+
spec: z.ZodString;
|
|
414
|
+
networkId: z.ZodNullable<z.ZodString>;
|
|
415
|
+
}, z.core.$strip>>>;
|
|
416
|
+
credentialLimits: z.ZodOptional<z.ZodObject<{
|
|
417
|
+
maxAmount: z.ZodNumber;
|
|
418
|
+
currency: z.ZodString;
|
|
419
|
+
expiresAt: z.ZodString;
|
|
420
|
+
}, z.core.$strip>>;
|
|
389
421
|
}, z.core.$strip>;
|
|
390
422
|
cancel: z.ZodOptional<z.ZodObject<{
|
|
391
423
|
available: z.ZodBoolean;
|
|
@@ -539,6 +571,18 @@ declare const MCP_OUTPUT: {
|
|
|
539
571
|
chargeCurrency: z.ZodString;
|
|
540
572
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
541
573
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
574
|
+
handlers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
575
|
+
id: z.ZodString;
|
|
576
|
+
type: z.ZodString;
|
|
577
|
+
version: z.ZodString;
|
|
578
|
+
spec: z.ZodString;
|
|
579
|
+
networkId: z.ZodNullable<z.ZodString>;
|
|
580
|
+
}, z.core.$strip>>>;
|
|
581
|
+
credentialLimits: z.ZodOptional<z.ZodObject<{
|
|
582
|
+
maxAmount: z.ZodNumber;
|
|
583
|
+
currency: z.ZodString;
|
|
584
|
+
expiresAt: z.ZodString;
|
|
585
|
+
}, z.core.$strip>>;
|
|
542
586
|
}, z.core.$strip>;
|
|
543
587
|
cancel: z.ZodOptional<z.ZodObject<{
|
|
544
588
|
available: z.ZodBoolean;
|
|
@@ -693,6 +737,181 @@ declare const MCP_OUTPUT: {
|
|
|
693
737
|
chargeCurrency: z.ZodString;
|
|
694
738
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
695
739
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
740
|
+
handlers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
741
|
+
id: z.ZodString;
|
|
742
|
+
type: z.ZodString;
|
|
743
|
+
version: z.ZodString;
|
|
744
|
+
spec: z.ZodString;
|
|
745
|
+
networkId: z.ZodNullable<z.ZodString>;
|
|
746
|
+
}, z.core.$strip>>>;
|
|
747
|
+
credentialLimits: z.ZodOptional<z.ZodObject<{
|
|
748
|
+
maxAmount: z.ZodNumber;
|
|
749
|
+
currency: z.ZodString;
|
|
750
|
+
expiresAt: z.ZodString;
|
|
751
|
+
}, z.core.$strip>>;
|
|
752
|
+
}, z.core.$strip>;
|
|
753
|
+
cancel: z.ZodOptional<z.ZodObject<{
|
|
754
|
+
available: z.ZodBoolean;
|
|
755
|
+
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>>;
|
|
756
|
+
penalty: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
757
|
+
refund: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
758
|
+
}, z.core.$strip>>;
|
|
759
|
+
manageUrl: z.ZodString;
|
|
760
|
+
}, z.core.$strip>;
|
|
761
|
+
readonly pay_order: z.ZodObject<{
|
|
762
|
+
orderId: z.ZodString;
|
|
763
|
+
reference: z.ZodString;
|
|
764
|
+
status: z.ZodType<(string & {}) | "awaiting_payment" | "expired" | "confirming" | "confirmed" | "failed" | "cancelling" | "cancelled" | "needs_attention", unknown, z.core.$ZodTypeInternals<(string & {}) | "awaiting_payment" | "expired" | "confirming" | "confirmed" | "failed" | "cancelling" | "cancelled" | "needs_attention", unknown>>;
|
|
765
|
+
createdAt: z.ZodString;
|
|
766
|
+
updatedAt: z.ZodString;
|
|
767
|
+
items: z.ZodArray<z.ZodType<OpenUnionOutput<"type", readonly [z.ZodObject<{
|
|
768
|
+
type: z.ZodLiteral<"hotel">;
|
|
769
|
+
hotel: z.ZodObject<{
|
|
770
|
+
hotelId: z.ZodNullable<z.ZodString>;
|
|
771
|
+
name: z.ZodString;
|
|
772
|
+
names: z.ZodObject<{
|
|
773
|
+
en: z.ZodNullable<z.ZodString>;
|
|
774
|
+
zh: z.ZodNullable<z.ZodString>;
|
|
775
|
+
}, z.core.$strip>;
|
|
776
|
+
checkIn: z.ZodString;
|
|
777
|
+
checkOut: z.ZodString;
|
|
778
|
+
timeZone: z.ZodNullable<z.ZodString>;
|
|
779
|
+
rooms: z.ZodArray<z.ZodObject<{
|
|
780
|
+
adults: z.ZodNumber;
|
|
781
|
+
childrenAges: z.ZodArray<z.ZodNumber>;
|
|
782
|
+
}, z.core.$strip>>;
|
|
783
|
+
room: z.ZodObject<{
|
|
784
|
+
name: z.ZodNullable<z.ZodObject<{
|
|
785
|
+
text: z.ZodString;
|
|
786
|
+
locale: z.ZodNullable<z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>>;
|
|
787
|
+
}, z.core.$strip>>;
|
|
788
|
+
beds: z.ZodNullable<z.ZodObject<{
|
|
789
|
+
text: z.ZodString;
|
|
790
|
+
locale: z.ZodNullable<z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>>;
|
|
791
|
+
}, z.core.$strip>>;
|
|
792
|
+
}, z.core.$strip>;
|
|
793
|
+
meals: z.ZodObject<{
|
|
794
|
+
known: z.ZodBoolean;
|
|
795
|
+
included: z.ZodNullable<z.ZodArray<z.ZodType<(string & {}) | "breakfast" | "lunch" | "dinner", unknown, z.core.$ZodTypeInternals<(string & {}) | "breakfast" | "lunch" | "dinner", unknown>>>>;
|
|
796
|
+
unspecifiedMainMeals: z.ZodNullable<z.ZodNumber>;
|
|
797
|
+
allInclusive: z.ZodNullable<z.ZodBoolean>;
|
|
798
|
+
guestsCoveredPerRoom: z.ZodNullable<z.ZodNumber>;
|
|
799
|
+
label: z.ZodNullable<z.ZodObject<{
|
|
800
|
+
text: z.ZodString;
|
|
801
|
+
locale: z.ZodNullable<z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>>;
|
|
802
|
+
}, z.core.$strip>>;
|
|
803
|
+
}, z.core.$strip>;
|
|
804
|
+
cancellation: z.ZodObject<{
|
|
805
|
+
status: z.ZodType<"unknown" | (string & {}) | "free" | "partial_penalty" | "non_refundable", unknown, z.core.$ZodTypeInternals<"unknown" | (string & {}) | "free" | "partial_penalty" | "non_refundable", unknown>>;
|
|
806
|
+
asOf: z.ZodString;
|
|
807
|
+
freeCancellationEndsAt: z.ZodNullable<z.ZodString>;
|
|
808
|
+
penalties: z.ZodArray<z.ZodObject<{
|
|
809
|
+
startsAt: z.ZodNullable<z.ZodString>;
|
|
810
|
+
amount: z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>;
|
|
811
|
+
}, z.core.$strip>>;
|
|
812
|
+
timeZone: z.ZodNullable<z.ZodString>;
|
|
813
|
+
}, z.core.$strip>;
|
|
814
|
+
payAtProperty: z.ZodObject<{
|
|
815
|
+
disclosure: z.ZodType<(string & {}) | "complete" | "incomplete", unknown, z.core.$ZodTypeInternals<(string & {}) | "complete" | "incomplete", unknown>>;
|
|
816
|
+
items: z.ZodArray<z.ZodObject<{
|
|
817
|
+
label: z.ZodNullable<z.ZodObject<{
|
|
818
|
+
text: z.ZodString;
|
|
819
|
+
locale: z.ZodNullable<z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>>;
|
|
820
|
+
}, z.core.$strip>>;
|
|
821
|
+
amount: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
822
|
+
mandatory: z.ZodBoolean;
|
|
823
|
+
basis: z.ZodType<"unknown" | (string & {}) | "per_stay" | "per_night" | "per_person" | "per_person_per_night", unknown, z.core.$ZodTypeInternals<"unknown" | (string & {}) | "per_stay" | "per_night" | "per_person" | "per_person_per_night", unknown>>;
|
|
824
|
+
collectedAt: z.ZodType<"unknown" | (string & {}) | "property", unknown, z.core.$ZodTypeInternals<"unknown" | (string & {}) | "property", unknown>>;
|
|
825
|
+
}, z.core.$strip>>;
|
|
826
|
+
}, z.core.$strip>;
|
|
827
|
+
confirmationNumber: z.ZodNullable<z.ZodString>;
|
|
828
|
+
}, z.core.$strip>;
|
|
829
|
+
}, z.core.$strip>]>, unknown, z.core.$ZodTypeInternals<OpenUnionOutput<"type", readonly [z.ZodObject<{
|
|
830
|
+
type: z.ZodLiteral<"hotel">;
|
|
831
|
+
hotel: z.ZodObject<{
|
|
832
|
+
hotelId: z.ZodNullable<z.ZodString>;
|
|
833
|
+
name: z.ZodString;
|
|
834
|
+
names: z.ZodObject<{
|
|
835
|
+
en: z.ZodNullable<z.ZodString>;
|
|
836
|
+
zh: z.ZodNullable<z.ZodString>;
|
|
837
|
+
}, z.core.$strip>;
|
|
838
|
+
checkIn: z.ZodString;
|
|
839
|
+
checkOut: z.ZodString;
|
|
840
|
+
timeZone: z.ZodNullable<z.ZodString>;
|
|
841
|
+
rooms: z.ZodArray<z.ZodObject<{
|
|
842
|
+
adults: z.ZodNumber;
|
|
843
|
+
childrenAges: z.ZodArray<z.ZodNumber>;
|
|
844
|
+
}, z.core.$strip>>;
|
|
845
|
+
room: z.ZodObject<{
|
|
846
|
+
name: z.ZodNullable<z.ZodObject<{
|
|
847
|
+
text: z.ZodString;
|
|
848
|
+
locale: z.ZodNullable<z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>>;
|
|
849
|
+
}, z.core.$strip>>;
|
|
850
|
+
beds: z.ZodNullable<z.ZodObject<{
|
|
851
|
+
text: z.ZodString;
|
|
852
|
+
locale: z.ZodNullable<z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>>;
|
|
853
|
+
}, z.core.$strip>>;
|
|
854
|
+
}, z.core.$strip>;
|
|
855
|
+
meals: z.ZodObject<{
|
|
856
|
+
known: z.ZodBoolean;
|
|
857
|
+
included: z.ZodNullable<z.ZodArray<z.ZodType<(string & {}) | "breakfast" | "lunch" | "dinner", unknown, z.core.$ZodTypeInternals<(string & {}) | "breakfast" | "lunch" | "dinner", unknown>>>>;
|
|
858
|
+
unspecifiedMainMeals: z.ZodNullable<z.ZodNumber>;
|
|
859
|
+
allInclusive: z.ZodNullable<z.ZodBoolean>;
|
|
860
|
+
guestsCoveredPerRoom: z.ZodNullable<z.ZodNumber>;
|
|
861
|
+
label: z.ZodNullable<z.ZodObject<{
|
|
862
|
+
text: z.ZodString;
|
|
863
|
+
locale: z.ZodNullable<z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>>;
|
|
864
|
+
}, z.core.$strip>>;
|
|
865
|
+
}, z.core.$strip>;
|
|
866
|
+
cancellation: z.ZodObject<{
|
|
867
|
+
status: z.ZodType<"unknown" | (string & {}) | "free" | "partial_penalty" | "non_refundable", unknown, z.core.$ZodTypeInternals<"unknown" | (string & {}) | "free" | "partial_penalty" | "non_refundable", unknown>>;
|
|
868
|
+
asOf: z.ZodString;
|
|
869
|
+
freeCancellationEndsAt: z.ZodNullable<z.ZodString>;
|
|
870
|
+
penalties: z.ZodArray<z.ZodObject<{
|
|
871
|
+
startsAt: z.ZodNullable<z.ZodString>;
|
|
872
|
+
amount: z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>;
|
|
873
|
+
}, z.core.$strip>>;
|
|
874
|
+
timeZone: z.ZodNullable<z.ZodString>;
|
|
875
|
+
}, z.core.$strip>;
|
|
876
|
+
payAtProperty: z.ZodObject<{
|
|
877
|
+
disclosure: z.ZodType<(string & {}) | "complete" | "incomplete", unknown, z.core.$ZodTypeInternals<(string & {}) | "complete" | "incomplete", unknown>>;
|
|
878
|
+
items: z.ZodArray<z.ZodObject<{
|
|
879
|
+
label: z.ZodNullable<z.ZodObject<{
|
|
880
|
+
text: z.ZodString;
|
|
881
|
+
locale: z.ZodNullable<z.ZodType<"en" | "zh" | (string & {}), unknown, z.core.$ZodTypeInternals<"en" | "zh" | (string & {}), unknown>>>;
|
|
882
|
+
}, z.core.$strip>>;
|
|
883
|
+
amount: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
884
|
+
mandatory: z.ZodBoolean;
|
|
885
|
+
basis: z.ZodType<"unknown" | (string & {}) | "per_stay" | "per_night" | "per_person" | "per_person_per_night", unknown, z.core.$ZodTypeInternals<"unknown" | (string & {}) | "per_stay" | "per_night" | "per_person" | "per_person_per_night", unknown>>;
|
|
886
|
+
collectedAt: z.ZodType<"unknown" | (string & {}) | "property", unknown, z.core.$ZodTypeInternals<"unknown" | (string & {}) | "property", unknown>>;
|
|
887
|
+
}, z.core.$strip>>;
|
|
888
|
+
}, z.core.$strip>;
|
|
889
|
+
confirmationNumber: z.ZodNullable<z.ZodString>;
|
|
890
|
+
}, z.core.$strip>;
|
|
891
|
+
}, z.core.$strip>]>, unknown>>>;
|
|
892
|
+
price: z.ZodObject<{
|
|
893
|
+
total: z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>;
|
|
894
|
+
}, z.core.$strip>;
|
|
895
|
+
payment: z.ZodObject<{
|
|
896
|
+
status: z.ZodType<(string & {}) | "unpaid" | "authorized" | "paid" | "released" | "refund_pending" | "refunded", unknown, z.core.$ZodTypeInternals<(string & {}) | "unpaid" | "authorized" | "paid" | "released" | "refund_pending" | "refunded", unknown>>;
|
|
897
|
+
url: z.ZodNullable<z.ZodString>;
|
|
898
|
+
requiresSignIn: z.ZodBoolean;
|
|
899
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
900
|
+
chargeCurrency: z.ZodString;
|
|
901
|
+
localCurrencyAtCheckout: z.ZodBoolean;
|
|
902
|
+
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
903
|
+
handlers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
904
|
+
id: z.ZodString;
|
|
905
|
+
type: z.ZodString;
|
|
906
|
+
version: z.ZodString;
|
|
907
|
+
spec: z.ZodString;
|
|
908
|
+
networkId: z.ZodNullable<z.ZodString>;
|
|
909
|
+
}, z.core.$strip>>>;
|
|
910
|
+
credentialLimits: z.ZodOptional<z.ZodObject<{
|
|
911
|
+
maxAmount: z.ZodNumber;
|
|
912
|
+
currency: z.ZodString;
|
|
913
|
+
expiresAt: z.ZodString;
|
|
914
|
+
}, z.core.$strip>>;
|
|
696
915
|
}, z.core.$strip>;
|
|
697
916
|
cancel: z.ZodOptional<z.ZodObject<{
|
|
698
917
|
available: z.ZodBoolean;
|
|
@@ -772,7 +991,7 @@ interface CommandSpec {
|
|
|
772
991
|
/** The group it is typed after; `null` for a command typed on its own. */
|
|
773
992
|
group: CommandGroupSpec["name"] | null;
|
|
774
993
|
/** Unique within its group. */
|
|
775
|
-
name: "search" | "get" | "offers" | "book" | "list" | "cancel" | "login" | "logout" | "whoami" | "guide" | "mcp";
|
|
994
|
+
name: "search" | "get" | "offers" | "book" | "list" | "cancel" | "pay" | "login" | "logout" | "whoami" | "guide" | "mcp";
|
|
776
995
|
summary: string;
|
|
777
996
|
/** The MCP tool the command mirrors; `null` for one that is the CLI's own. */
|
|
778
997
|
tool: ToolName | null;
|
|
@@ -1132,6 +1351,16 @@ declare const cancelOrderInput: z.ZodObject<{
|
|
|
1132
1351
|
maximumPenalty: z.ZodNumber;
|
|
1133
1352
|
}, z.core.$strict>;
|
|
1134
1353
|
type CancelOrderInput = z.input<typeof cancelOrderInput>;
|
|
1354
|
+
/** `POST /v1/orders/{orderId}/pay` and the MCP `pay_order` arguments: the
|
|
1355
|
+
* order, a Stripe shared payment token granted for it, and the total the
|
|
1356
|
+
* user approved. A total other than the order's answers
|
|
1357
|
+
* `payment_total_changed` and charges nothing. */
|
|
1358
|
+
declare const payOrderInput: z.ZodObject<{
|
|
1359
|
+
orderId: z.ZodString;
|
|
1360
|
+
sharedPaymentToken: z.ZodString;
|
|
1361
|
+
total: z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>;
|
|
1362
|
+
}, z.core.$strict>;
|
|
1363
|
+
type PayOrderInput = z.input<typeof payOrderInput>;
|
|
1135
1364
|
|
|
1136
1365
|
/** The ceilings and floors every agent surface enforces and documents (spec §15). */
|
|
1137
1366
|
declare const LIMITS: {
|
|
@@ -1229,7 +1458,7 @@ declare const stayEcho: z.ZodObject<{
|
|
|
1229
1458
|
}, z.core.$strip>;
|
|
1230
1459
|
|
|
1231
1460
|
/** Every code the v1 error envelope can carry (spec §11). */
|
|
1232
|
-
type ErrorCode = "invalid_request" | "cursor_invalid" | "unauthenticated" | "forbidden" | "not_found" | "order_removed" | "offer_expired" | "offer_changed" | "offer_already_ordered" | "order_exists" | "order_in_progress" | "order_attempts_exhausted" | "cancellation_changed" | "order_not_cancellable" | "destination_ambiguous" | "destination_not_found" | "search_too_broad" | "stay_unsupported" | "stay_in_past" | "offer_unavailable" | "rate_limited" | "ordering_paused" | "service_unavailable" | "supplier_unavailable" | "internal";
|
|
1461
|
+
type ErrorCode = "invalid_request" | "cursor_invalid" | "unauthenticated" | "forbidden" | "not_found" | "order_removed" | "offer_expired" | "offer_changed" | "offer_already_ordered" | "order_exists" | "order_in_progress" | "order_attempts_exhausted" | "cancellation_changed" | "order_not_cancellable" | "order_not_payable" | "payment_in_progress" | "payment_total_changed" | "payment_credential_invalid" | "payment_declined" | "payment_action_required" | "payment_method_unavailable" | "destination_ambiguous" | "destination_not_found" | "search_too_broad" | "stay_unsupported" | "stay_in_past" | "offer_unavailable" | "rate_limited" | "ordering_paused" | "service_unavailable" | "supplier_unavailable" | "internal";
|
|
1233
1462
|
/** The HTTP statuses each code is sent with, and whether a retry can help. */
|
|
1234
1463
|
declare const ERROR_CODES: Readonly<Record<ErrorCode, {
|
|
1235
1464
|
status: readonly number[];
|
|
@@ -1540,6 +1769,25 @@ declare const ERROR_DETAILS: {
|
|
|
1540
1769
|
order_not_cancellable: z.ZodObject<{
|
|
1541
1770
|
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>>;
|
|
1542
1771
|
}, z.core.$strip>;
|
|
1772
|
+
order_not_payable: z.ZodObject<{
|
|
1773
|
+
orderId: z.ZodString;
|
|
1774
|
+
status: z.ZodType<(string & {}) | "awaiting_payment" | "expired" | "confirming" | "confirmed" | "failed" | "cancelling" | "cancelled" | "needs_attention", unknown, z.core.$ZodTypeInternals<(string & {}) | "awaiting_payment" | "expired" | "confirming" | "confirmed" | "failed" | "cancelling" | "cancelled" | "needs_attention", unknown>>;
|
|
1775
|
+
}, z.core.$strip>;
|
|
1776
|
+
payment_in_progress: z.ZodObject<{
|
|
1777
|
+
orderId: z.ZodString;
|
|
1778
|
+
}, z.core.$strip>;
|
|
1779
|
+
payment_total_changed: z.ZodObject<{
|
|
1780
|
+
orderId: z.ZodString;
|
|
1781
|
+
total: z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>;
|
|
1782
|
+
}, z.core.$strip>;
|
|
1783
|
+
payment_credential_invalid: z.ZodObject<{
|
|
1784
|
+
reason: z.ZodType<"amount" | "currency" | (string & {}) | "not_found" | "expired" | "deactivated" | "used" | "other_seller", unknown, z.core.$ZodTypeInternals<"amount" | "currency" | (string & {}) | "not_found" | "expired" | "deactivated" | "used" | "other_seller", unknown>>;
|
|
1785
|
+
}, z.core.$strip>;
|
|
1786
|
+
payment_declined: z.ZodObject<{
|
|
1787
|
+
declineCode: z.ZodNullable<z.ZodString>;
|
|
1788
|
+
}, z.core.$strip>;
|
|
1789
|
+
payment_action_required: null;
|
|
1790
|
+
payment_method_unavailable: null;
|
|
1543
1791
|
destination_ambiguous: z.ZodObject<{
|
|
1544
1792
|
name: z.ZodString;
|
|
1545
1793
|
countryCode: z.ZodString;
|
|
@@ -1685,7 +1933,7 @@ declare const ERROR_DETAILS: {
|
|
|
1685
1933
|
reason: z.ZodType<(string & {}) | "sold_out" | "refused", unknown, z.core.$ZodTypeInternals<(string & {}) | "sold_out" | "refused", unknown>>;
|
|
1686
1934
|
}, z.core.$strip>;
|
|
1687
1935
|
rate_limited: z.ZodObject<{
|
|
1688
|
-
scope: z.ZodType<"search" | "hotel" | (string & {}) | "offers" | "orders_read" | "orders_create" | "orders_cancel", unknown, z.core.$ZodTypeInternals<"search" | "hotel" | (string & {}) | "offers" | "orders_read" | "orders_create" | "orders_cancel", unknown>>;
|
|
1936
|
+
scope: z.ZodType<"search" | "hotel" | (string & {}) | "offers" | "orders_read" | "orders_create" | "orders_cancel" | "orders_pay", unknown, z.core.$ZodTypeInternals<"search" | "hotel" | (string & {}) | "offers" | "orders_read" | "orders_create" | "orders_cancel" | "orders_pay", unknown>>;
|
|
1689
1937
|
}, z.core.$strip>;
|
|
1690
1938
|
ordering_paused: null;
|
|
1691
1939
|
service_unavailable: null;
|
|
@@ -2088,6 +2336,22 @@ type PaymentStatus = (typeof PAYMENT_STATUSES)[number];
|
|
|
2088
2336
|
* refused, the booking standing as it was. */
|
|
2089
2337
|
declare const CANCEL_REASONS: readonly ["cancellable", "already_cancelled", "in_progress", "not_confirmed", "stay_started", "non_refundable", "refused", "terms_unknown", "needs_attention"];
|
|
2090
2338
|
type CancelReason = (typeof CANCEL_REASONS)[number];
|
|
2339
|
+
/** Why a shared payment token can't pay an order (3.4). */
|
|
2340
|
+
declare const CREDENTIAL_INVALID_REASONS: readonly ["not_found", "currency", "amount", "expired", "deactivated", "used", "other_seller"];
|
|
2341
|
+
type CredentialInvalidReason = (typeof CREDENTIAL_INVALID_REASONS)[number];
|
|
2342
|
+
/** A way to pay an order other than its link, after the Universal Commerce
|
|
2343
|
+
* Protocol's payment handlers: `type` names it (`com.stripe.payments`),
|
|
2344
|
+
* `version` and `spec` the handler specification it follows, and
|
|
2345
|
+
* `networkId` the seller's id a wallet grants a payment credential for
|
|
2346
|
+
* (Stripe's business profile), null when the handler names none. */
|
|
2347
|
+
declare const paymentHandler: z.ZodObject<{
|
|
2348
|
+
id: z.ZodString;
|
|
2349
|
+
type: z.ZodString;
|
|
2350
|
+
version: z.ZodString;
|
|
2351
|
+
spec: z.ZodString;
|
|
2352
|
+
networkId: z.ZodNullable<z.ZodString>;
|
|
2353
|
+
}, z.core.$strip>;
|
|
2354
|
+
type PaymentHandler = z.infer<typeof paymentHandler>;
|
|
2091
2355
|
/** `FT-` and six characters with no 0, 1, I or O. */
|
|
2092
2356
|
declare const orderReference: z.ZodString;
|
|
2093
2357
|
declare const order: z.ZodObject<{
|
|
@@ -2232,6 +2496,25 @@ declare const order: z.ZodObject<{
|
|
|
2232
2496
|
chargeCurrency: z.ZodString;
|
|
2233
2497
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
2234
2498
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
2499
|
+
/** The ways to pay other than `url`, while the order can be paid that
|
|
2500
|
+
* way (3.4): a `com.stripe.payments` handler takes a shared payment
|
|
2501
|
+
* token through `pay_order`. Absent when there is none. */
|
|
2502
|
+
handlers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2503
|
+
id: z.ZodString;
|
|
2504
|
+
type: z.ZodString;
|
|
2505
|
+
version: z.ZodString;
|
|
2506
|
+
spec: z.ZodString;
|
|
2507
|
+
networkId: z.ZodNullable<z.ZodString>;
|
|
2508
|
+
}, z.core.$strip>>>;
|
|
2509
|
+
/** What a payment credential for `pay_order` must allow, present with
|
|
2510
|
+
* `handlers` (3.4): `maxAmount` in minor units (cents) of `currency`,
|
|
2511
|
+
* lowercase as Stripe takes it, and `expiresAt`, past which the order
|
|
2512
|
+
* can't be paid. */
|
|
2513
|
+
credentialLimits: z.ZodOptional<z.ZodObject<{
|
|
2514
|
+
maxAmount: z.ZodNumber;
|
|
2515
|
+
currency: z.ZodString;
|
|
2516
|
+
expiresAt: z.ZodString;
|
|
2517
|
+
}, z.core.$strip>>;
|
|
2235
2518
|
}, z.core.$strip>;
|
|
2236
2519
|
/** Whether the user can cancel the order now and, when they can, its
|
|
2237
2520
|
* penalty under the accepted terms (read a minute ahead) and the refund,
|
|
@@ -2390,6 +2673,25 @@ declare const orderList: z.ZodObject<{
|
|
|
2390
2673
|
chargeCurrency: z.ZodString;
|
|
2391
2674
|
localCurrencyAtCheckout: z.ZodBoolean;
|
|
2392
2675
|
localCharge: z.ZodNullable<z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>>;
|
|
2676
|
+
/** The ways to pay other than `url`, while the order can be paid that
|
|
2677
|
+
* way (3.4): a `com.stripe.payments` handler takes a shared payment
|
|
2678
|
+
* token through `pay_order`. Absent when there is none. */
|
|
2679
|
+
handlers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2680
|
+
id: z.ZodString;
|
|
2681
|
+
type: z.ZodString;
|
|
2682
|
+
version: z.ZodString;
|
|
2683
|
+
spec: z.ZodString;
|
|
2684
|
+
networkId: z.ZodNullable<z.ZodString>;
|
|
2685
|
+
}, z.core.$strip>>>;
|
|
2686
|
+
/** What a payment credential for `pay_order` must allow, present with
|
|
2687
|
+
* `handlers` (3.4): `maxAmount` in minor units (cents) of `currency`,
|
|
2688
|
+
* lowercase as Stripe takes it, and `expiresAt`, past which the order
|
|
2689
|
+
* can't be paid. */
|
|
2690
|
+
credentialLimits: z.ZodOptional<z.ZodObject<{
|
|
2691
|
+
maxAmount: z.ZodNumber;
|
|
2692
|
+
currency: z.ZodString;
|
|
2693
|
+
expiresAt: z.ZodString;
|
|
2694
|
+
}, z.core.$strip>>;
|
|
2393
2695
|
}, z.core.$strip>;
|
|
2394
2696
|
/** Whether the user can cancel the order now and, when they can, its
|
|
2395
2697
|
* penalty under the accepted terms (read a minute ahead) and the refund,
|
|
@@ -3014,6 +3316,7 @@ declare const API: {
|
|
|
3014
3316
|
locale?: "en" | "zh";
|
|
3015
3317
|
}) => string;
|
|
3016
3318
|
readonly orderCancel: (id: string) => string;
|
|
3319
|
+
readonly orderPay: (id: string) => string;
|
|
3017
3320
|
};
|
|
3018
3321
|
/** The MCP server answers at the root of `PUBLIC_ORIGINS.mcp`. */
|
|
3019
3322
|
declare const MCP_PATH = "/";
|
|
@@ -3027,7 +3330,9 @@ type RenderedTool = Exclude<ToolName, "get_planning_guide">;
|
|
|
3027
3330
|
* open output schema: unknown fields are ignored and unknown values shown
|
|
3028
3331
|
* as they came. A result that does not parse is shown as JSON, never thrown.
|
|
3029
3332
|
* The consent rule (`ORDER_NEXT_STEP`) is the last paragraph whenever the
|
|
3030
|
-
* result holds a non-null `payment.url`; the
|
|
3333
|
+
* result holds a non-null `payment.url`; the pay rule (`PAY_NEXT_STEP`)
|
|
3334
|
+
* follows it when a result holds an order with `payment.handlers`; the
|
|
3335
|
+
* cancel rule (`CANCEL_NEXT_STEP`)
|
|
3031
3336
|
* follows it when a `get_order` or `list_orders` result holds an order with
|
|
3032
3337
|
* `cancel.available`.
|
|
3033
3338
|
*/
|
|
@@ -3049,4 +3354,4 @@ declare const UNKNOWN_IS_NOT_NO_EXEMPTIONS: Readonly<Record<string, string>>;
|
|
|
3049
3354
|
/** The contract's version, from package.json, the one place a release bumps it. */
|
|
3050
3355
|
declare const CONTRACT_VERSION: string;
|
|
3051
3356
|
|
|
3052
|
-
export { AMENITY_CODES, API, type AmenityCode, type AuthConfig, CANCEL_NEXT_STEP, CANCEL_REASONS, CARD_NUMBER_MESSAGE, CENTER_BASES, COMMANDS, COMMAND_GROUPS, CONTRACT_VERSION, type CancelOrderInput, type CancelReason, type Center, type CommandGroupSpec, type CommandSpec, type CreateOrderInput, 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, PLACE_KINDS, POLICY_TOPICS, PRESENTATION_HINT, PUBLIC_ORIGINS, 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, photo, place, placeId, placeRef, renderError, renderGuide, renderToolResult, roomFacts, searchHotelsInput, searchResult, stay, stayEcho, strictErrorEnvelope, strictInput, strictOutput, text, timeZone, usdMoney, wholeNumber };
|
|
3357
|
+
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, renderError, renderGuide, renderToolResult, roomFacts, searchHotelsInput, searchResult, stay, stayEcho, strictErrorEnvelope, strictInput, strictOutput, text, timeZone, usdMoney, wholeNumber };
|
package/dist/index.js
CHANGED
|
@@ -569,6 +569,16 @@ var cancelOrderInput = strictInput({
|
|
|
569
569
|
"The penalty the user agreed to: cancel.penalty.amount of the order, in its currency."
|
|
570
570
|
)
|
|
571
571
|
});
|
|
572
|
+
var sharedPaymentTokenError = "sharedPaymentToken must be a Stripe shared payment token: spt_ followed by letters and digits";
|
|
573
|
+
var payOrderInput = strictInput({
|
|
574
|
+
orderId: orderId.describe("orderId of the order to pay, from create order or get order."),
|
|
575
|
+
sharedPaymentToken: z5.string({ error: sharedPaymentTokenError }).regex(/^spt_[A-Za-z0-9]{1,250}$/, { error: sharedPaymentTokenError }).describe(
|
|
576
|
+
"The shared payment token (spt_\u2026) the user approved for this order, requested with the order's payment.credentialLimits."
|
|
577
|
+
),
|
|
578
|
+
total: usdMoney.describe(
|
|
579
|
+
"The total the user approved: the order's price.total, exactly as returned."
|
|
580
|
+
)
|
|
581
|
+
});
|
|
572
582
|
|
|
573
583
|
// src/commands.ts
|
|
574
584
|
function fieldDescription(json, field, sets = {}) {
|
|
@@ -814,6 +824,22 @@ var cancelFlags = flagsOf(cancelOrderInput, [
|
|
|
814
824
|
description: "The penalty the user agreed to, exactly as `orders get` shows it, in the order's currency, e.g. `12.50`. Without it, the command cancels nothing: it shows the penalty and the refund."
|
|
815
825
|
}
|
|
816
826
|
]);
|
|
827
|
+
var payFlags = flagsOf(payOrderInput, [
|
|
828
|
+
{
|
|
829
|
+
flag: "token",
|
|
830
|
+
field: "sharedPaymentToken",
|
|
831
|
+
type: "string",
|
|
832
|
+
placeholder: "<spt_\u2026>",
|
|
833
|
+
description: "The shared payment token the user's wallet granted for this order, with the order's credential limits."
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
flag: "total",
|
|
837
|
+
field: "total",
|
|
838
|
+
type: "string",
|
|
839
|
+
placeholder: "<USD decimal>",
|
|
840
|
+
description: "The total the user approved, exactly as `orders get` shows it, in USD, e.g. `125.00`."
|
|
841
|
+
}
|
|
842
|
+
]);
|
|
817
843
|
var BODY_OPTION = {
|
|
818
844
|
flag: "body",
|
|
819
845
|
type: "string",
|
|
@@ -822,7 +848,7 @@ var BODY_OPTION = {
|
|
|
822
848
|
};
|
|
823
849
|
var COMMAND_GROUPS = [
|
|
824
850
|
{ name: "hotels", summary: "Search hotels, get offers and order one" },
|
|
825
|
-
{ name: "orders", summary: "Your orders, their status, and cancelling one" }
|
|
851
|
+
{ name: "orders", summary: "Your orders, their status, paying and cancelling one" }
|
|
826
852
|
];
|
|
827
853
|
var COMMANDS = [
|
|
828
854
|
{
|
|
@@ -880,6 +906,14 @@ var COMMANDS = [
|
|
|
880
906
|
flags: cancelFlags,
|
|
881
907
|
positionals: [positional(cancelOrderInput, "orderId")]
|
|
882
908
|
},
|
|
909
|
+
{
|
|
910
|
+
group: "orders",
|
|
911
|
+
name: "pay",
|
|
912
|
+
summary: "Pay an order with a shared payment token instead of its link",
|
|
913
|
+
tool: "pay_order",
|
|
914
|
+
flags: payFlags,
|
|
915
|
+
positionals: [positional(payOrderInput, "orderId")]
|
|
916
|
+
},
|
|
883
917
|
{
|
|
884
918
|
group: null,
|
|
885
919
|
name: "login",
|
|
@@ -1068,17 +1102,17 @@ function strictify(schema) {
|
|
|
1068
1102
|
|
|
1069
1103
|
// src/guide-data.generated.ts
|
|
1070
1104
|
var FRAGMENTS = {
|
|
1071
|
-
"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
|
|
1072
|
-
"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 |\n| `order_exists` (409) | This stay already has an order (`orderId`, `status`): show it instead of ordering again.
|
|
1105
|
+
"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",
|
|
1106
|
+
"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 |\n| `order_exists` (409) | This stay already has an open order for one of these guests (`orderId`, `status`): show it instead of ordering again. A party with none of its guests can order the stay from a new offer (get offers again), and so can the user once the stay's order is confirmed, cancelled or refused by the hotel. It also answers when the stay's earlier order failed at the hotel with its outcome unknown, or the stay has had 20 orders; for those, the user emails {{support}} |\n| `order_attempts_exhausted` (409) | This order can't be tried again: the user emails {{support}} with its `reference` |\n| `order_removed` (410) | The order was never completed and no payment is held: get offers again and order the new offer (the order keeps its `orderId`) |\n| `stay_unsupported` (422) | `mixed_occupancy`: order once per party; `max_nights`: at most `max` nights per order |\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` (10 minutes or more) |\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",
|
|
1073
1107
|
"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',
|
|
1074
1108
|
"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",
|
|
1075
1109
|
"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',
|
|
1076
|
-
"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- 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 on the payment page.{{#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## 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",
|
|
1110
|
+
"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 on the payment page.{{#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 with `payment.handlers` 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 `networkId` 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}}. 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",
|
|
1077
1111
|
"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",
|
|
1078
1112
|
"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",
|
|
1079
1113
|
"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",
|
|
1080
|
-
"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
|
|
1081
|
-
"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
|
|
1114
|
+
"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 them; `{{tool:orders cancel}}` cancels one, `{{tool:orders pay}}` pays by token. `{{tool:guide}}` returns Fortrip's guidance for flexible dates, budgets or several destinations.\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 in USD, 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 |\n| `{{tool:orders pay}}` | Pays an order without its link, with a shared payment token from the user's wallet |\n\nFor flexible dates, a budget, split stays, several destinations or \"find me the best\", {{#if claude-skill}}read [references/planning.md](references/planning.md){{/if}}{{#if cli}}also run `{{tool:guide}} planning`{{/if}} before searching.\n{{/if}}\n",
|
|
1115
|
+
"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 CI or a sandbox 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",
|
|
1082
1116
|
"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`), and then the penalty under its terms (`cancel.penalty`) and the refund, what was paid less the penalty (`cancel.refund`), both in the charge currency; 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.amount` as shown. 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`.{{#if cli}} Without `--max-penalty`, `{{tool:orders cancel}}` cancels nothing: it prints the penalty and the refund 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"
|
|
1083
1117
|
};
|
|
1084
1118
|
|
|
@@ -1259,6 +1293,13 @@ var ERROR_CODES = {
|
|
|
1259
1293
|
order_attempts_exhausted: { status: [409], retryable: false },
|
|
1260
1294
|
cancellation_changed: { status: [409], retryable: false },
|
|
1261
1295
|
order_not_cancellable: { status: [409], retryable: false },
|
|
1296
|
+
order_not_payable: { status: [409], retryable: false },
|
|
1297
|
+
payment_in_progress: { status: [409], retryable: true },
|
|
1298
|
+
payment_total_changed: { status: [409], retryable: false },
|
|
1299
|
+
payment_credential_invalid: { status: [422], retryable: false },
|
|
1300
|
+
payment_declined: { status: [402], retryable: false },
|
|
1301
|
+
payment_action_required: { status: [402], retryable: false },
|
|
1302
|
+
payment_method_unavailable: { status: [403], retryable: false },
|
|
1262
1303
|
destination_ambiguous: { status: [422], retryable: false },
|
|
1263
1304
|
destination_not_found: { status: [422], retryable: false },
|
|
1264
1305
|
search_too_broad: { status: [422], retryable: false },
|
|
@@ -1648,6 +1689,22 @@ var CANCEL_REASONS = [
|
|
|
1648
1689
|
"terms_unknown",
|
|
1649
1690
|
"needs_attention"
|
|
1650
1691
|
];
|
|
1692
|
+
var CREDENTIAL_INVALID_REASONS = [
|
|
1693
|
+
"not_found",
|
|
1694
|
+
"currency",
|
|
1695
|
+
"amount",
|
|
1696
|
+
"expired",
|
|
1697
|
+
"deactivated",
|
|
1698
|
+
"used",
|
|
1699
|
+
"other_seller"
|
|
1700
|
+
];
|
|
1701
|
+
var paymentHandler = openObject({
|
|
1702
|
+
id: z14.string(),
|
|
1703
|
+
type: z14.string(),
|
|
1704
|
+
version: z14.string(),
|
|
1705
|
+
spec: z14.string(),
|
|
1706
|
+
networkId: z14.string().nullable()
|
|
1707
|
+
});
|
|
1651
1708
|
var orderReference = z14.string().regex(/^FT-[2-9A-HJ-NP-Z]{6}$/);
|
|
1652
1709
|
var hotelItem = openObject({
|
|
1653
1710
|
type: z14.literal("hotel"),
|
|
@@ -1684,7 +1741,20 @@ var order = openObject({
|
|
|
1684
1741
|
expiresAt: instant.nullable(),
|
|
1685
1742
|
chargeCurrency: z14.string(),
|
|
1686
1743
|
localCurrencyAtCheckout: z14.boolean(),
|
|
1687
|
-
localCharge: money.nullable()
|
|
1744
|
+
localCharge: money.nullable(),
|
|
1745
|
+
/** The ways to pay other than `url`, while the order can be paid that
|
|
1746
|
+
* way (3.4): a `com.stripe.payments` handler takes a shared payment
|
|
1747
|
+
* token through `pay_order`. Absent when there is none. */
|
|
1748
|
+
handlers: z14.array(paymentHandler).optional(),
|
|
1749
|
+
/** What a payment credential for `pay_order` must allow, present with
|
|
1750
|
+
* `handlers` (3.4): `maxAmount` in minor units (cents) of `currency`,
|
|
1751
|
+
* lowercase as Stripe takes it, and `expiresAt`, past which the order
|
|
1752
|
+
* can't be paid. */
|
|
1753
|
+
credentialLimits: openObject({
|
|
1754
|
+
maxAmount: z14.number().int(),
|
|
1755
|
+
currency: z14.string(),
|
|
1756
|
+
expiresAt: instant
|
|
1757
|
+
}).optional()
|
|
1688
1758
|
}),
|
|
1689
1759
|
/** Whether the user can cancel the order now and, when they can, its
|
|
1690
1760
|
* penalty under the accepted terms (read a minute ahead) and the refund,
|
|
@@ -1744,6 +1814,15 @@ var ERROR_DETAILS = {
|
|
|
1744
1814
|
order_attempts_exhausted: openObject({ orderId }),
|
|
1745
1815
|
cancellation_changed: null,
|
|
1746
1816
|
order_not_cancellable: openObject({ reason: openEnum(CANCEL_REASONS) }),
|
|
1817
|
+
order_not_payable: openObject({ orderId, status: openEnum(ORDER_STATUSES) }),
|
|
1818
|
+
payment_in_progress: openObject({ orderId }),
|
|
1819
|
+
payment_total_changed: openObject({ orderId, total: money }),
|
|
1820
|
+
payment_credential_invalid: openObject({
|
|
1821
|
+
reason: openEnum(CREDENTIAL_INVALID_REASONS)
|
|
1822
|
+
}),
|
|
1823
|
+
payment_declined: openObject({ declineCode: z15.string().nullable() }),
|
|
1824
|
+
payment_action_required: null,
|
|
1825
|
+
payment_method_unavailable: null,
|
|
1747
1826
|
destination_ambiguous: openObject({
|
|
1748
1827
|
name: z15.string(),
|
|
1749
1828
|
countryCode: z15.string(),
|
|
@@ -1802,7 +1881,8 @@ var ERROR_DETAILS = {
|
|
|
1802
1881
|
"hotel",
|
|
1803
1882
|
"orders_read",
|
|
1804
1883
|
"orders_create",
|
|
1805
|
-
"orders_cancel"
|
|
1884
|
+
"orders_cancel",
|
|
1885
|
+
"orders_pay"
|
|
1806
1886
|
])
|
|
1807
1887
|
}),
|
|
1808
1888
|
ordering_paused: null,
|
|
@@ -1861,6 +1941,9 @@ var API = {
|
|
|
1861
1941
|
},
|
|
1862
1942
|
orderCancel(id) {
|
|
1863
1943
|
return `/v1/orders/${encodeURIComponent(id)}/cancel`;
|
|
1944
|
+
},
|
|
1945
|
+
orderPay(id) {
|
|
1946
|
+
return `/v1/orders/${encodeURIComponent(id)}/pay`;
|
|
1864
1947
|
}
|
|
1865
1948
|
};
|
|
1866
1949
|
var MCP_PATH = "/";
|
|
@@ -1869,6 +1952,7 @@ var MCP_PATH = "/";
|
|
|
1869
1952
|
import { z as z16 } from "zod";
|
|
1870
1953
|
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.";
|
|
1871
1954
|
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.";
|
|
1955
|
+
var PAY_NEXT_STEP = "To pay without the link, when the order has payment.handlers 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 networkId 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.";
|
|
1872
1956
|
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.";
|
|
1873
1957
|
var nextStep = z16.string().optional().describe(
|
|
1874
1958
|
"What to show and ask before giving a payment.url. Present when the answer holds a non-null payment.url, and only then."
|
|
@@ -1877,7 +1961,8 @@ var MCP_OUTPUT = {
|
|
|
1877
1961
|
book_hotel: order.extend({ nextStep }),
|
|
1878
1962
|
get_order: order.extend({ nextStep }),
|
|
1879
1963
|
list_orders: orderList.extend({ nextStep }),
|
|
1880
|
-
cancel_order: order
|
|
1964
|
+
cancel_order: order,
|
|
1965
|
+
pay_order: order
|
|
1881
1966
|
};
|
|
1882
1967
|
var READ = {
|
|
1883
1968
|
readOnlyHint: true,
|
|
@@ -1922,7 +2007,7 @@ var TOOLS = [
|
|
|
1922
2007
|
{
|
|
1923
2008
|
name: "book_hotel",
|
|
1924
2009
|
title: "Create hotel order and payment link",
|
|
1925
|
-
description: `Order one offer from get_hotel_offers. The answer is an unpaid order with a payment link: status awaiting_payment, the total, the stay and its terms, and payment.url, a Fortrip page where the user pays. Nothing is charged until the user pays there; anyone holding the link can pay. Send the contact and, for each room of the offer, at least one guest. If the price or terms changed since the offer, the answer is offer_changed with every change and a new offer: show the changes and ask the user again before ordering it. Sending the same details again returns the same order. To cancel an order, use cancel_order; for changes, or a cancellation cancel_order can't make, the user emails ${SUPPORT_EMAIL} with the order's reference.`,
|
|
2010
|
+
description: `Order one offer from get_hotel_offers. The answer is an unpaid order with a payment link: status awaiting_payment, the total, the stay and its terms, and payment.url, a Fortrip page where the user pays. Nothing is charged until the user pays there; anyone holding the link can pay. Send the contact and, for each room of the offer, at least one guest. If the price or terms changed since the offer, the answer is offer_changed with every change and a new offer: show the changes and ask the user again before ordering it. Sending the same details again returns the same order. An offer is ordered once: for another order of the stay (another party, or a corrected guest name), get offers again and order the new offer; when it replaces an unpaid order, tell the user to pay only the new link, as the earlier one expires unpaid. To cancel an order, use cancel_order; for changes, or a cancellation cancel_order can't make, the user emails ${SUPPORT_EMAIL} with the order's reference.`,
|
|
1926
2011
|
annotations: {
|
|
1927
2012
|
readOnlyHint: false,
|
|
1928
2013
|
idempotentHint: false,
|
|
@@ -1960,6 +2045,19 @@ var TOOLS = [
|
|
|
1960
2045
|
},
|
|
1961
2046
|
input: cancelOrderInput,
|
|
1962
2047
|
output: MCP_OUTPUT.cancel_order
|
|
2048
|
+
},
|
|
2049
|
+
{
|
|
2050
|
+
name: "pay_order",
|
|
2051
|
+
title: "Pay order with a shared payment token",
|
|
2052
|
+
description: "Pay an order awaiting payment without its link, with a Stripe shared payment token, when the order has payment.handlers. 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 networkId 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 a verification this can't give; 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.",
|
|
2053
|
+
annotations: {
|
|
2054
|
+
readOnlyHint: false,
|
|
2055
|
+
idempotentHint: true,
|
|
2056
|
+
openWorldHint: true,
|
|
2057
|
+
destructiveHint: false
|
|
2058
|
+
},
|
|
2059
|
+
input: payOrderInput,
|
|
2060
|
+
output: MCP_OUTPUT.pay_order
|
|
1963
2061
|
}
|
|
1964
2062
|
];
|
|
1965
2063
|
|
|
@@ -2313,10 +2411,18 @@ function paymentLines(o) {
|
|
|
2313
2411
|
} else if (o.status === "awaiting_payment") {
|
|
2314
2412
|
lines.push("Payment link: could not be read this time; read this order again for it.");
|
|
2315
2413
|
}
|
|
2414
|
+
if (p.handlers?.length) lines.push(handlersLine(p.handlers, p.credentialLimits));
|
|
2316
2415
|
if (o.cancel) lines.push(cancelLine(o.cancel));
|
|
2317
2416
|
lines.push(`Manage: ${o.manageUrl}`);
|
|
2318
2417
|
return lines;
|
|
2319
2418
|
}
|
|
2419
|
+
function handlersLine(handlers, limits) {
|
|
2420
|
+
const shown = handlers.map(
|
|
2421
|
+
(h) => `${h.type} (handler ${h.id}${h.networkId ? `, networkId ${h.networkId}` : ""})`
|
|
2422
|
+
);
|
|
2423
|
+
const limit = limits ? `; token limits: maxAmount ${limits.maxAmount} (cents), currency ${limits.currency}, expiresAt ${limits.expiresAt}` : "";
|
|
2424
|
+
return `Pay without the link: pay_order with a shared payment token via ${shown.join(", ")}${limit}`;
|
|
2425
|
+
}
|
|
2320
2426
|
function cancelLine(c) {
|
|
2321
2427
|
const figure = (name, m) => `${name} ${m ? money2(m) : "not stated"}`;
|
|
2322
2428
|
const figures = `${figure("penalty", c.penalty)}, ${figure("refund", c.refund)}`;
|
|
@@ -2526,6 +2632,15 @@ function renderSearch(r) {
|
|
|
2526
2632
|
}
|
|
2527
2633
|
|
|
2528
2634
|
// src/render/errors.ts
|
|
2635
|
+
var CREDENTIAL_INVALID_WORDS = {
|
|
2636
|
+
not_found: "was not found",
|
|
2637
|
+
currency: "is for another currency than USD",
|
|
2638
|
+
amount: "allows less than the order's total",
|
|
2639
|
+
expired: "expires before it can be charged",
|
|
2640
|
+
deactivated: "was revoked",
|
|
2641
|
+
used: "was already used, or is held for another order",
|
|
2642
|
+
other_seller: "was granted to another seller"
|
|
2643
|
+
};
|
|
2529
2644
|
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
2530
2645
|
function changeLine(c) {
|
|
2531
2646
|
const worse = c.worse === true ? " (worse)" : c.worse === false ? " (not worse)" : "";
|
|
@@ -2642,6 +2757,24 @@ function detailLines(e) {
|
|
|
2642
2757
|
return [`Order ${e.details.orderId}, ${label(ORDER_STATUS_WORDS, e.details.status)}.`];
|
|
2643
2758
|
case "order_not_cancellable":
|
|
2644
2759
|
return [`Not cancellable: ${label(CANCEL_REASON_WORDS, e.details.reason)}.`];
|
|
2760
|
+
case "order_not_payable":
|
|
2761
|
+
return [
|
|
2762
|
+
`Order ${e.details.orderId}, ${label(ORDER_STATUS_WORDS, e.details.status)}: read it with get_order; nothing was charged.`
|
|
2763
|
+
];
|
|
2764
|
+
case "payment_in_progress":
|
|
2765
|
+
return [`Order ${e.details.orderId}: read it with get_order in a few seconds.`];
|
|
2766
|
+
case "payment_total_changed":
|
|
2767
|
+
return [
|
|
2768
|
+
`Order ${e.details.orderId} now totals ${money2(e.details.total)}: show the user the new total and ask again, then request a new token for it. Nothing was charged.`
|
|
2769
|
+
];
|
|
2770
|
+
case "payment_credential_invalid":
|
|
2771
|
+
return [
|
|
2772
|
+
`The token ${label(CREDENTIAL_INVALID_WORDS, e.details.reason)}: request a new one with the order's payment.credentialLimits. Nothing was charged.`
|
|
2773
|
+
];
|
|
2774
|
+
case "payment_declined":
|
|
2775
|
+
return [
|
|
2776
|
+
`Declined${e.details.declineCode ? ` (${e.details.declineCode})` : ""}: the user picks another payment method in their wallet for a new token, or pays by link (call book_hotel again with the same details for a new payment.url).`
|
|
2777
|
+
];
|
|
2645
2778
|
case "destination_ambiguous":
|
|
2646
2779
|
return ambiguous(e.details);
|
|
2647
2780
|
case "destination_not_found":
|
|
@@ -2718,6 +2851,7 @@ ${raw(data)}`;
|
|
|
2718
2851
|
return [
|
|
2719
2852
|
text2,
|
|
2720
2853
|
ORDER_TOOLS.has(tool) && holdsPaymentUrl(data) ? ORDER_NEXT_STEP : "",
|
|
2854
|
+
ORDER_TOOLS.has(tool) && holdsHandlers(data) ? PAY_NEXT_STEP : "",
|
|
2721
2855
|
CANCEL_TOOLS.has(tool) && holdsCancellable(data) ? CANCEL_NEXT_STEP : ""
|
|
2722
2856
|
].filter(Boolean).join("\n\n");
|
|
2723
2857
|
}
|
|
@@ -2738,6 +2872,7 @@ ${raw(data)}`;
|
|
|
2738
2872
|
return withConsent(tool, renderOrderList(list), list.data);
|
|
2739
2873
|
}
|
|
2740
2874
|
case "cancel_order":
|
|
2875
|
+
case "pay_order":
|
|
2741
2876
|
return renderOrder(parsed);
|
|
2742
2877
|
}
|
|
2743
2878
|
}
|
|
@@ -2752,6 +2887,15 @@ function holdsPaymentUrl(value, seen = /* @__PURE__ */ new Set()) {
|
|
|
2752
2887
|
}
|
|
2753
2888
|
return Object.values(value).some((v) => holdsPaymentUrl(v, seen));
|
|
2754
2889
|
}
|
|
2890
|
+
function holdsHandlers(value, seen = /* @__PURE__ */ new Set()) {
|
|
2891
|
+
if (typeof value !== "object" || value === null || seen.has(value)) return false;
|
|
2892
|
+
seen.add(value);
|
|
2893
|
+
const payment = value.payment;
|
|
2894
|
+
if (typeof payment === "object" && payment !== null && Array.isArray(payment.handlers) && payment.handlers.length > 0) {
|
|
2895
|
+
return true;
|
|
2896
|
+
}
|
|
2897
|
+
return Object.values(value).some((v) => holdsHandlers(v, seen));
|
|
2898
|
+
}
|
|
2755
2899
|
function holdsCancellable(value, seen = /* @__PURE__ */ new Set()) {
|
|
2756
2900
|
if (typeof value !== "object" || value === null || seen.has(value)) return false;
|
|
2757
2901
|
seen.add(value);
|
|
@@ -2765,6 +2909,7 @@ function withConsent(tool, text2, orders) {
|
|
|
2765
2909
|
return [
|
|
2766
2910
|
text2,
|
|
2767
2911
|
orders.some((o) => o.payment.url !== null) ? ORDER_NEXT_STEP : "",
|
|
2912
|
+
orders.some((o) => (o.payment.handlers?.length ?? 0) > 0) ? PAY_NEXT_STEP : "",
|
|
2768
2913
|
CANCEL_TOOLS.has(tool) && orders.some((o) => o.cancel?.available === true) ? CANCEL_NEXT_STEP : ""
|
|
2769
2914
|
].filter(Boolean).join("\n\n");
|
|
2770
2915
|
}
|
|
@@ -2795,6 +2940,7 @@ var UNKNOWN_IS_NOT_NO_EXEMPTIONS = {
|
|
|
2795
2940
|
requiresSignIn: `${API_DECIDES} (whether the payment link needs a website sign-in).`,
|
|
2796
2941
|
localCurrencyAtCheckout: `${API_DECIDES} (whether checkout may charge in the card's currency).`,
|
|
2797
2942
|
"cancel.available": `${API_DECIDES} (whether an order can be cancelled now).`,
|
|
2943
|
+
"payment.handlers": `${RESULT_LIST} (the ways to pay an order other than its link; absent when there is none).`,
|
|
2798
2944
|
bookable: `${API_DECIDES} (whether the hotel is still in the index).`,
|
|
2799
2945
|
cityLike: `${API_DECIDES} (frozen per gazetteer release; null where not computed).`,
|
|
2800
2946
|
known: `${THE_FLAG} (meals).`,
|
|
@@ -2804,7 +2950,7 @@ var UNKNOWN_IS_NOT_NO_EXEMPTIONS = {
|
|
|
2804
2950
|
// package.json
|
|
2805
2951
|
var package_default = {
|
|
2806
2952
|
name: "@fortrip/agent-contract",
|
|
2807
|
-
version: "3.
|
|
2953
|
+
version: "3.4.0",
|
|
2808
2954
|
license: "Apache-2.0",
|
|
2809
2955
|
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.",
|
|
2810
2956
|
type: "module",
|
|
@@ -2862,6 +3008,7 @@ export {
|
|
|
2862
3008
|
COMMANDS,
|
|
2863
3009
|
COMMAND_GROUPS,
|
|
2864
3010
|
CONTRACT_VERSION,
|
|
3011
|
+
CREDENTIAL_INVALID_REASONS,
|
|
2865
3012
|
DISPLAY_CURRENCIES,
|
|
2866
3013
|
ERROR_CODES,
|
|
2867
3014
|
ERROR_DETAILS,
|
|
@@ -2876,6 +3023,7 @@ export {
|
|
|
2876
3023
|
ORDER_NEXT_STEP,
|
|
2877
3024
|
ORDER_STATUSES,
|
|
2878
3025
|
PAYMENT_STATUSES,
|
|
3026
|
+
PAY_NEXT_STEP,
|
|
2879
3027
|
PLACE_KINDS,
|
|
2880
3028
|
POLICY_TOPICS,
|
|
2881
3029
|
PRESENTATION_HINT,
|
|
@@ -2939,6 +3087,8 @@ export {
|
|
|
2939
3087
|
orderReference,
|
|
2940
3088
|
parseOpen,
|
|
2941
3089
|
payAtProperty,
|
|
3090
|
+
payOrderInput,
|
|
3091
|
+
paymentHandler,
|
|
2942
3092
|
photo,
|
|
2943
3093
|
place,
|
|
2944
3094
|
placeId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fortrip/agent-contract",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.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",
|