@fortrip/agent-contract 4.2.0 → 4.3.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +86 -1
- package/dist/index.js +112 -8
- package/dist/regions.d.ts +10 -0
- package/dist/regions.js +3779 -0
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -1475,6 +1475,12 @@ declare const cancelOrderInput: z.ZodObject<{
|
|
|
1475
1475
|
maximumPenalty: z.ZodNumber;
|
|
1476
1476
|
}, z.core.$strict>;
|
|
1477
1477
|
type CancelOrderInput = z.input<typeof cancelOrderInput>;
|
|
1478
|
+
/** The ways an order is paid: the order's own link, a shared payment token
|
|
1479
|
+
* through `pay_order`, or Alipay/WeChat Pay through `pay_order`. */
|
|
1480
|
+
declare const PAY_WAYS: readonly ["payment_link", "shared_payment_token", "alipay_wechat_pay"];
|
|
1481
|
+
type PayWay = (typeof PAY_WAYS)[number];
|
|
1482
|
+
/** The way each exclusive field of `payOrderInput` pays by. */
|
|
1483
|
+
declare const PAY_INPUT_WAYS: Record<"sharedPaymentToken" | "payment" | "method", PayWay>;
|
|
1478
1484
|
/** `POST /v1/orders/{orderId}/pay` and the MCP `pay_order` arguments: the
|
|
1479
1485
|
* order, how to pay it, and the total the user approved. The way is a
|
|
1480
1486
|
* Stripe shared payment token granted for the order, or `method`
|
|
@@ -1536,6 +1542,20 @@ declare const LIMITS: {
|
|
|
1536
1542
|
readonly candidatesShown: 8;
|
|
1537
1543
|
readonly candidatesCounted: 200;
|
|
1538
1544
|
readonly localitiesShown: 8;
|
|
1545
|
+
readonly tokenPaymentMaxUsd: 500;
|
|
1546
|
+
/** Minutes that must be left before the order's payment window closes
|
|
1547
|
+
* (`payment.expiresAt`) for the order to offer a token or wallet payment
|
|
1548
|
+
* (`payment.handlers`, `payment.wallets`). */
|
|
1549
|
+
readonly payMinMinutesLeft: 15;
|
|
1550
|
+
/** `pay_order` refuses (`order_not_payable`), by token or wallet, when the
|
|
1551
|
+
* order's payment window (`payment.expiresAt`) closes within this many
|
|
1552
|
+
* minutes. */
|
|
1553
|
+
readonly payCutoffMinutes: 2;
|
|
1554
|
+
readonly tokensPerOrder: 5;
|
|
1555
|
+
readonly wechatCodeMinutes: 120;
|
|
1556
|
+
/** Orders one account can make for one stay (the same room, rate, dates
|
|
1557
|
+
* and party); past it, ordering the stay answers `order_exists`. */
|
|
1558
|
+
readonly ordersPerStay: 20;
|
|
1539
1559
|
};
|
|
1540
1560
|
/** Currencies a v1 response can show prices in (USD is also what is paid). */
|
|
1541
1561
|
declare const DISPLAY_CURRENCIES: readonly ["USD", "CNY"];
|
|
@@ -1606,12 +1626,21 @@ declare const stayEcho: z.ZodObject<{
|
|
|
1606
1626
|
|
|
1607
1627
|
/** Every code the v1 error envelope can carry (spec §11). */
|
|
1608
1628
|
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";
|
|
1629
|
+
/** The statuses `supplier_unavailable` is sent with (by its `details.outcome`:
|
|
1630
|
+
* `SUPPLIER_OUTCOME_STATUS`). */
|
|
1631
|
+
declare const SUPPLIER_STATUSES: readonly [503, 504];
|
|
1609
1632
|
/** The HTTP statuses each code is sent with, and whether a retry can help. */
|
|
1610
1633
|
declare const ERROR_CODES: Readonly<Record<ErrorCode, {
|
|
1611
1634
|
status: readonly number[];
|
|
1612
1635
|
retryable: boolean;
|
|
1613
1636
|
}>>;
|
|
1614
1637
|
|
|
1638
|
+
/** `supplier_unavailable`'s `details.outcome`: nothing was sent, or the call
|
|
1639
|
+
* was sent and timed out. */
|
|
1640
|
+
declare const SUPPLIER_OUTCOMES: readonly ["not_started", "unknown"];
|
|
1641
|
+
/** The HTTP status `supplier_unavailable` is answered with, by its
|
|
1642
|
+
* `details.outcome`: one of its statuses for each outcome it names. */
|
|
1643
|
+
declare const SUPPLIER_OUTCOME_STATUS: Readonly<Record<(typeof SUPPLIER_OUTCOMES)[number], (typeof SUPPLIER_STATUSES)[number]>>;
|
|
1615
1644
|
declare const ERROR_DETAILS: {
|
|
1616
1645
|
invalid_request: z.ZodObject<{
|
|
1617
1646
|
issues: z.ZodArray<z.ZodObject<{
|
|
@@ -3515,6 +3544,43 @@ declare const API: {
|
|
|
3515
3544
|
};
|
|
3516
3545
|
/** The MCP server answers at the root of `PUBLIC_ORIGINS.mcp`. */
|
|
3517
3546
|
declare const MCP_PATH = "/";
|
|
3547
|
+
/** The URL to add as a remote MCP server. */
|
|
3548
|
+
declare const MCP_SERVER_URL: string;
|
|
3549
|
+
/** Installs the CLI skill into an agent. */
|
|
3550
|
+
declare const SKILL_INSTALL_COMMAND = "npx skills add FortripEngineering/fortrip --skill fortrip-cli";
|
|
3551
|
+
declare const REPOSITORY_URL = "https://github.com/FortripEngineering/fortrip";
|
|
3552
|
+
declare const DOCS_ORIGIN = "https://docs.fortrip.ai";
|
|
3553
|
+
|
|
3554
|
+
/** The tools that are HTTP endpoints: all but the guide, which is MCP-only. */
|
|
3555
|
+
type HttpToolName = Exclude<ToolName, "get_planning_guide">;
|
|
3556
|
+
interface HttpRoute {
|
|
3557
|
+
method: "GET" | "POST";
|
|
3558
|
+
/** An OpenAPI path template, e.g. `/v1/orders/{orderId}/pay`. */
|
|
3559
|
+
path: string;
|
|
3560
|
+
/** Input fields that fill the template's `{braces}`. */
|
|
3561
|
+
pathFields: readonly string[];
|
|
3562
|
+
/** Input fields a request carries in its query, in this order. A POST
|
|
3563
|
+
* sends every other field as its body. */
|
|
3564
|
+
queryFields: readonly string[];
|
|
3565
|
+
}
|
|
3566
|
+
/** Where each tool's request goes. */
|
|
3567
|
+
declare const HTTP_ROUTES: Record<HttpToolName, HttpRoute>;
|
|
3568
|
+
/** The two endpoints that are not tools: who the caller is, and how to sign in. */
|
|
3569
|
+
declare const ACCOUNT_ROUTES: {
|
|
3570
|
+
me: HttpRoute;
|
|
3571
|
+
authConfig: HttpRoute;
|
|
3572
|
+
};
|
|
3573
|
+
/** The request path for `input`: path fields filled in (URL-encoded), then
|
|
3574
|
+
* the query fields that are set. */
|
|
3575
|
+
declare function routePath(route: HttpRoute, input: Record<string, unknown>): string;
|
|
3576
|
+
|
|
3577
|
+
/** A `rate_limited` error names the limit that was hit by this scope. */
|
|
3578
|
+
type RateLimitScope = NonNullable<ErrorBody<"rate_limited">["details"]>["scope"];
|
|
3579
|
+
/** Requests one token may make per scope in a window. */
|
|
3580
|
+
declare const RATE_LIMITS: Record<RateLimitScope, {
|
|
3581
|
+
limit: number;
|
|
3582
|
+
windowSeconds: number;
|
|
3583
|
+
}>;
|
|
3518
3584
|
|
|
3519
3585
|
/** The error envelope as text; `status` is the HTTP status, when known.
|
|
3520
3586
|
* `surface` names the next calls: tools (`mcp`, the default) or commands
|
|
@@ -3550,7 +3616,26 @@ declare const SEARCH_SORTS: readonly ["distance", "relevance", "stars_desc", "pr
|
|
|
3550
3616
|
|
|
3551
3617
|
declare const UNKNOWN_IS_NOT_NO_EXEMPTIONS: Readonly<Record<string, string>>;
|
|
3552
3618
|
|
|
3619
|
+
/** How a search resolves and ranks places. */
|
|
3620
|
+
declare const SEARCH_RULES: {
|
|
3621
|
+
readonly largeSettlementPopulation: 50000;
|
|
3622
|
+
readonly dominanceRatio: 100;
|
|
3623
|
+
readonly nearDuplicateMeters: 5000;
|
|
3624
|
+
readonly hubIncludes: 3;
|
|
3625
|
+
};
|
|
3626
|
+
/** How `POST /v1/orders` answers a success: `201` for a new order, `200` with the header for a replay. */
|
|
3627
|
+
declare const ORDER_HTTP: {
|
|
3628
|
+
readonly createdStatus: 201;
|
|
3629
|
+
readonly replayedStatus: 200;
|
|
3630
|
+
readonly replayedHeader: "Idempotent-Replayed";
|
|
3631
|
+
};
|
|
3632
|
+
/** The scope each identity field of `GET /v1/me` needs; without it the field is null. */
|
|
3633
|
+
declare const ME_SCOPES: {
|
|
3634
|
+
readonly email: "email";
|
|
3635
|
+
readonly name: "profile";
|
|
3636
|
+
};
|
|
3637
|
+
|
|
3553
3638
|
/** The contract's version, from package.json, the one place a release bumps it. */
|
|
3554
3639
|
declare const CONTRACT_VERSION: string;
|
|
3555
3640
|
|
|
3556
|
-
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 RenderSurface, 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, WALLET_NEXT_STEP, addIsoDateDays, authConfig, cancelNextStep, 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, payNextStep, payOrderInput, paymentHandler, photo, place, placeId, placeRef, protocolObject, renderError, renderGuide, renderToolResult, roomFacts, searchHotelsInput, searchResult, sharedPaymentTokenOf, stay, stayEcho, strictInput, strictOutput, text, timeZone, usdMoney, walletNextStep, wholeNumber };
|
|
3641
|
+
export { ACCOUNT_ROUTES, 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, DOCS_ORIGIN, 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, HTTP_ROUTES, type Hotel, type HotelOffersInput, type HotelOffersResult, type HotelSummary, type HttpRoute, type HttpToolName, type IndicativePrice, type KnownErrorBody, LIMITS, type ListOrdersInput, MCP_OUTPUT, MCP_PATH, MCP_SERVER_URL, ME_SCOPES, type MeResult, type Money, ORDER_HTTP, ORDER_NEXT_STEP, ORDER_STATUSES, type Offer, type OfferChange, type Omitted, type OptionSpec, type Order, type OrderList, type OrderStatus, PAYMENT_STATUSES, PAY_INPUT_WAYS, PAY_NEXT_STEP, PAY_WAYS, PLACE_KINDS, POLICY_TOPICS, PRESENTATION_HINT, PUBLIC_ORIGINS, type PayOrderInput, type PayWay, type PaymentHandler, type PaymentStatus, type Place, type PlaceRef, type PolicyTopic, type PositionalSpec, RATE_LIMITS, REPOSITORY_URL, type RateLimitScope, type RenderSurface, type RenderedTool, SEARCH_NOTE_CODES, SEARCH_RULES, SEARCH_SORTS, SKILL_INSTALL_COMMAND, SUPPLIER_OUTCOME_STATUS, SUPPORT_EMAIL, type SearchHotelsInput, type SearchNoteCode, type SearchResult, type Stay, TOOLS, type ToolName, type ToolSpec, UNAVAILABLE_REASONS, UNKNOWN_IS_NOT_NO_EXEMPTIONS, WALLET_NEXT_STEP, addIsoDateDays, authConfig, cancelNextStep, 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, payNextStep, payOrderInput, paymentHandler, photo, place, placeId, placeRef, protocolObject, renderError, renderGuide, renderToolResult, roomFacts, routePath, searchHotelsInput, searchResult, sharedPaymentTokenOf, stay, stayEcho, strictInput, strictOutput, text, timeZone, usdMoney, walletNextStep, wholeNumber };
|
package/dist/index.js
CHANGED
|
@@ -191,7 +191,21 @@ var LIMITS = {
|
|
|
191
191
|
poolLimit: 3e3,
|
|
192
192
|
candidatesShown: 8,
|
|
193
193
|
candidatesCounted: 200,
|
|
194
|
-
localitiesShown: 8
|
|
194
|
+
localitiesShown: 8,
|
|
195
|
+
tokenPaymentMaxUsd: 500,
|
|
196
|
+
/** Minutes that must be left before the order's payment window closes
|
|
197
|
+
* (`payment.expiresAt`) for the order to offer a token or wallet payment
|
|
198
|
+
* (`payment.handlers`, `payment.wallets`). */
|
|
199
|
+
payMinMinutesLeft: 15,
|
|
200
|
+
/** `pay_order` refuses (`order_not_payable`), by token or wallet, when the
|
|
201
|
+
* order's payment window (`payment.expiresAt`) closes within this many
|
|
202
|
+
* minutes. */
|
|
203
|
+
payCutoffMinutes: 2,
|
|
204
|
+
tokensPerOrder: 5,
|
|
205
|
+
wechatCodeMinutes: 120,
|
|
206
|
+
/** Orders one account can make for one stay (the same room, rate, dates
|
|
207
|
+
* and party); past it, ordering the stay answers `order_exists`. */
|
|
208
|
+
ordersPerStay: 20
|
|
195
209
|
};
|
|
196
210
|
var DISPLAY_CURRENCIES = ["USD", "CNY"];
|
|
197
211
|
var SUPPORT_EMAIL = "info@fortrip.ai";
|
|
@@ -624,6 +638,12 @@ function selectedOf(instruments) {
|
|
|
624
638
|
}
|
|
625
639
|
return chosen;
|
|
626
640
|
}
|
|
641
|
+
var PAY_WAYS = ["payment_link", "shared_payment_token", "alipay_wechat_pay"];
|
|
642
|
+
var PAY_INPUT_WAYS = {
|
|
643
|
+
sharedPaymentToken: "shared_payment_token",
|
|
644
|
+
payment: "shared_payment_token",
|
|
645
|
+
method: "alipay_wechat_pay"
|
|
646
|
+
};
|
|
627
647
|
var payOrderInput = strictInput({
|
|
628
648
|
orderId: orderId.describe("The orderId of the order to pay."),
|
|
629
649
|
sharedPaymentToken: z5.string({ error: sharedPaymentTokenError }).regex(sharedPaymentTokenRe, { error: sharedPaymentTokenError }).optional().describe(
|
|
@@ -1239,11 +1259,11 @@ function strictify(schema) {
|
|
|
1239
1259
|
// src/guide-data.generated.ts
|
|
1240
1260
|
var FRAGMENTS = {
|
|
1241
1261
|
"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",
|
|
1242
|
-
"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
|
|
1262
|
+
"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 {{limit:ordersPerStay}} 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",
|
|
1243
1263
|
"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',
|
|
1244
1264
|
"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",
|
|
1245
1265
|
"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.\n{{/if}}\n',
|
|
1246
|
-
"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- Pay one way only: give `payment.url` or call `{{tool:orders pay}}`. First show the order's total and currency, the stay and every term, end that reply by asking the user to confirm, and wait for a clear yes. Then give `payment.url` exactly as returned, to this user only: anyone holding it can pay.\n{{/if}}\n{{#if claude-skill cli}}\n- `payment.url` works like a payment credential: anyone holding it can pay. Give it to this user only, never in shared channels, documents, logs or tickets. With `requiresSignIn: true` (an order started on the Fortrip website), the user signs in to pay.\n- The link expires at `payment.expiresAt`; the order is then `expired`. To order the stay again, get offers again, and confirm the new order with the user before giving its link.\n- Another order of the stay (another party, or a corrected guest name) needs a new offer: get offers again. When it replaces an unpaid order, tell the user to pay only the new link; the earlier one expires unpaid.\n- An order `awaiting_payment` whose `payment.url` is null had its link unreadable this time: read it again with `{{tool:orders get}}`.\n{{/if}}\n- Never ask for, accept or pass on payment card details; payment happens only through Stripe.{{#if claude-skill cli}} A card number in a guest name, the contact or the special requests is rejected{{#if cli}} with exit 2{{/if}}.{{/if}}\n{{#if claude-skill cli}}\n\n## Paying without the link\n\nAn order whose `payment.handlers` isn't empty (in {{#if claude-skill}}a result's text{{/if}}{{#if cli}}the text output{{/if}}, the line \"Pay without the link\") can also be paid through `{{tool:orders pay}}` with a Stripe shared payment token that the user's Link wallet grants for it. Use it only if you have a tool that can request such a token from the user's Link wallet: Link is for US and Canadian accounts, and caps a spend request at $
|
|
1266
|
+
"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- Pay one way only: give `payment.url` or call `{{tool:orders pay}}`. First show the order's total and currency, the stay and every term, end that reply by asking the user to confirm, and wait for a clear yes. Then give `payment.url` exactly as returned, to this user only: anyone holding it can pay.\n{{/if}}\n{{#if claude-skill cli}}\n- `payment.url` works like a payment credential: anyone holding it can pay. Give it to this user only, never in shared channels, documents, logs or tickets. With `requiresSignIn: true` (an order started on the Fortrip website), the user signs in to pay.\n- The link expires at `payment.expiresAt`; the order is then `expired`. To order the stay again, get offers again, and confirm the new order with the user before giving its link.\n- Another order of the stay (another party, or a corrected guest name) needs a new offer: get offers again. When it replaces an unpaid order, tell the user to pay only the new link; the earlier one expires unpaid.\n- An order `awaiting_payment` whose `payment.url` is null had its link unreadable this time: read it again with `{{tool:orders get}}`.\n{{/if}}\n- Never ask for, accept or pass on payment card details; payment happens only through Stripe.{{#if claude-skill cli}} A card number in a guest name, the contact or the special requests is rejected{{#if cli}} with exit 2{{/if}}.{{/if}}\n{{#if claude-skill cli}}\n\n## Paying without the link\n\nAn order whose `payment.handlers` isn't empty (in {{#if claude-skill}}a result's text{{/if}}{{#if cli}}the text output{{/if}}, the line \"Pay without the link\") can also be paid through `{{tool:orders pay}}` with a Stripe shared payment token that the user's Link wallet grants for it. Use it only if you have a tool that can request such a token from the user's Link wallet: Link is for US and Canadian accounts, and caps a spend request at ${{limit:tokenPaymentMaxUsd}}, so `payment.handlers` is empty for a larger order. Otherwise give `payment.url`, and never ask the user to create, type or paste a token.\n\n1. Show the user the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation and fees payable at the property. End that reply by asking the user to confirm, and wait for a clear yes. The token comes from the user's wallet, never from card details.\n2. Request the token from the user's Link wallet with the handler's `config.business_profile` and `payment.credentialLimits`: `maxAmount` (in cents), `currency` and `expiresAt`.\n3. {{#if claude-skill}}Call{{/if}}{{#if cli}}Run{{/if}} `{{tool:orders pay}}` with the token and the order's `price.total`{{#if cli}} (`--token`, `--total`){{/if}}{{#if claude-skill}}, the token as `sharedPaymentToken` or in UCP's `payment.instruments`{{/if}}. The order is then `confirming`, its payment `authorized`: check it as after payment.\n\nThe charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: either give `payment.url` or {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders pay}}`. Once `{{tool:orders pay}}` succeeds, `payment.url` stops working; a payment that fails leaves the link open. `payment_total_changed` means the total sent isn't the order's (`details.total`); the order's total hasn't changed: confirm it with the user, then {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders pay}}` again with it and the same token. `payment_declined`: the user picks another payment method in their wallet, or pays by link. `payment_action_required`: the card needs a verification this can't give: pay by link. `payment_credential_invalid`: request a new token with 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## Paying with Alipay or WeChat Pay\n\nAn order whose result text has the line \"Pay with Alipay or WeChat Pay\" can be paid in the user's Alipay or WeChat wallet, with no token: it is for users who have a mainland-China wallet. {{#if claude-skill}}Call{{/if}}{{#if cli}}Run{{/if}} `{{tool:orders pay}}` {{#if claude-skill}}with `method` `alipay_wechat_pay`{{/if}}{{#if cli}}the way that line shows{{/if}} and the order's `price.total`, only after the user has confirmed.\n\n1. Show the user the order's total in USD, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation and fees payable at the property. End that reply by asking the user to confirm, and wait for a clear yes. Pay one way only: `payment.url` or this.\n2. Then show `payment.wallets`: the WeChat Pay code as an image if you can, and both links (WeChat Pay and Alipay). The user pays once, by either. Alipay and WeChat Pay charge at once; if the hotel can't confirm, the payment is refunded in full. The total is in US dollars, and the wallets show it in yuan at their rate.\n3. Check the order with `{{tool:orders get}}` until it isn't `awaiting_payment`.\n\nA WeChat Pay code expires {{limit:wechatCodeMinutes}} minutes after it is made, and goes dead earlier if the user opens the Alipay link instead. Then `payment.wallets.wechatPay.qrData` is null: tell the user to open the WeChat link again, or {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders pay}}` again for a new code.\n\nWeChat can't scan a code shown on the same phone's screen. Offer both ways, since you can't tell which device the user is on: save the image and scan it from the album (WeChat, then Scan, then Album), or open the WeChat link on another screen; on a phone, the Alipay link opens the Alipay app.\n\n## After payment\n\nCheck the order with `{{tool:orders get}}`:\n\n- `confirming` while the hotel confirms, then `confirmed` with the hotel's `confirmationNumber`.\n- `failed`: no stay was booked; `payment.status` says whether the payment was released or refunded.\n- `needs_attention`: Fortrip is looking into it; the user can email {{support}} with the `reference`.\n- `manageUrl` is the user's own page for the order.\n{{/if}}\n",
|
|
1247
1267
|
"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",
|
|
1248
1268
|
"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",
|
|
1249
1269
|
"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{{#if claude-skill cli}} (Adaptive Pricing): 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",
|
|
@@ -1414,6 +1434,7 @@ var stayEcho = openObject({
|
|
|
1414
1434
|
import { z as z15 } from "zod";
|
|
1415
1435
|
|
|
1416
1436
|
// src/errors.ts
|
|
1437
|
+
var SUPPLIER_STATUSES = [503, 504];
|
|
1417
1438
|
var ERROR_CODES = {
|
|
1418
1439
|
invalid_request: { status: [400], retryable: false },
|
|
1419
1440
|
cursor_invalid: { status: [400], retryable: false },
|
|
@@ -1445,7 +1466,7 @@ var ERROR_CODES = {
|
|
|
1445
1466
|
rate_limited: { status: [429], retryable: true },
|
|
1446
1467
|
ordering_paused: { status: [503], retryable: true },
|
|
1447
1468
|
service_unavailable: { status: [503], retryable: true },
|
|
1448
|
-
supplier_unavailable: { status:
|
|
1469
|
+
supplier_unavailable: { status: SUPPLIER_STATUSES, retryable: true },
|
|
1449
1470
|
internal: { status: [500], retryable: false }
|
|
1450
1471
|
};
|
|
1451
1472
|
|
|
@@ -1965,6 +1986,8 @@ var offerChange = openUnion("field", [
|
|
|
1965
1986
|
|
|
1966
1987
|
// src/outputs/error-details.ts
|
|
1967
1988
|
var count2 = z15.number().int();
|
|
1989
|
+
var SUPPLIER_OUTCOMES = ["not_started", "unknown"];
|
|
1990
|
+
var SUPPLIER_OUTCOME_STATUS = { not_started: 503, unknown: 504 };
|
|
1968
1991
|
var ERROR_DETAILS = {
|
|
1969
1992
|
invalid_request: openObject({
|
|
1970
1993
|
issues: z15.array(openObject({ pointer: z15.string(), message: z15.string() })),
|
|
@@ -2062,7 +2085,7 @@ var ERROR_DETAILS = {
|
|
|
2062
2085
|
ordering_paused: null,
|
|
2063
2086
|
service_unavailable: null,
|
|
2064
2087
|
supplier_unavailable: openObject({
|
|
2065
|
-
outcome: openEnum(
|
|
2088
|
+
outcome: openEnum(SUPPLIER_OUTCOMES)
|
|
2066
2089
|
}),
|
|
2067
2090
|
internal: null
|
|
2068
2091
|
};
|
|
@@ -2112,6 +2135,55 @@ var API = {
|
|
|
2112
2135
|
}
|
|
2113
2136
|
};
|
|
2114
2137
|
var MCP_PATH = "/";
|
|
2138
|
+
var MCP_SERVER_URL = `${PUBLIC_ORIGINS.mcp}${MCP_PATH}`;
|
|
2139
|
+
var SKILL_INSTALL_COMMAND = "npx skills add FortripEngineering/fortrip --skill fortrip-cli";
|
|
2140
|
+
var REPOSITORY_URL = "https://github.com/FortripEngineering/fortrip";
|
|
2141
|
+
var DOCS_ORIGIN = "https://docs.fortrip.ai";
|
|
2142
|
+
|
|
2143
|
+
// src/routes.ts
|
|
2144
|
+
var route = (method, path, queryFields = []) => ({
|
|
2145
|
+
method,
|
|
2146
|
+
path,
|
|
2147
|
+
pathFields: [...path.matchAll(/\{(\w+)\}/g)].map((match) => match[1]),
|
|
2148
|
+
queryFields
|
|
2149
|
+
});
|
|
2150
|
+
var HTTP_ROUTES = {
|
|
2151
|
+
search_hotels: route("POST", "/v1/hotels/search"),
|
|
2152
|
+
get_hotel: route("GET", "/v1/hotels/{hotelId}", ["include", "locale"]),
|
|
2153
|
+
get_hotel_offers: route("POST", "/v1/hotels/offers"),
|
|
2154
|
+
book_hotel: route("POST", "/v1/orders"),
|
|
2155
|
+
get_order: route("GET", "/v1/orders/{orderId}", ["locale"]),
|
|
2156
|
+
list_orders: route("GET", "/v1/orders", ["cursor", "limit", "locale"]),
|
|
2157
|
+
cancel_order: route("POST", "/v1/orders/{orderId}/cancel"),
|
|
2158
|
+
pay_order: route("POST", "/v1/orders/{orderId}/pay")
|
|
2159
|
+
};
|
|
2160
|
+
var ACCOUNT_ROUTES = {
|
|
2161
|
+
me: route("GET", "/v1/me"),
|
|
2162
|
+
authConfig: route("GET", "/v1/auth/config")
|
|
2163
|
+
};
|
|
2164
|
+
function routePath(route2, input) {
|
|
2165
|
+
const path = route2.path.replace(
|
|
2166
|
+
/\{(\w+)\}/g,
|
|
2167
|
+
(_, field) => encodeURIComponent(String(input[field]))
|
|
2168
|
+
);
|
|
2169
|
+
const query = new URLSearchParams();
|
|
2170
|
+
for (const field of route2.queryFields) {
|
|
2171
|
+
if (input[field] !== void 0) query.set(field, String(input[field]));
|
|
2172
|
+
}
|
|
2173
|
+
const text2 = query.toString();
|
|
2174
|
+
return text2 ? `${path}?${text2}` : path;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
// src/rate-limits.ts
|
|
2178
|
+
var RATE_LIMITS = {
|
|
2179
|
+
search: { limit: 10, windowSeconds: 60 },
|
|
2180
|
+
offers: { limit: 20, windowSeconds: 60 },
|
|
2181
|
+
hotel: { limit: 30, windowSeconds: 60 },
|
|
2182
|
+
orders_create: { limit: 20, windowSeconds: 60 },
|
|
2183
|
+
orders_read: { limit: 60, windowSeconds: 60 },
|
|
2184
|
+
orders_cancel: { limit: 10, windowSeconds: 60 },
|
|
2185
|
+
orders_pay: { limit: 10, windowSeconds: 60 }
|
|
2186
|
+
};
|
|
2115
2187
|
|
|
2116
2188
|
// src/tools.ts
|
|
2117
2189
|
import { z as z16 } from "zod";
|
|
@@ -2249,7 +2321,7 @@ var TOOLS = [
|
|
|
2249
2321
|
{
|
|
2250
2322
|
name: "pay_order",
|
|
2251
2323
|
title: "Pay order by token or Alipay/WeChat Pay",
|
|
2252
|
-
description:
|
|
2324
|
+
description: `Pay an order without its link, by shared payment token or Alipay/WeChat Pay (method alipay_wechat_pay). Token: only if payment.handlers isn't empty and you can request one from the user's Link wallet (US and Canadian accounts); never ask the user for one. First show the user the USD total, the stay and every term (meals, cancellation, fees payable at the property), ask them to confirm and wait for a clear yes. Token: request it with config.business_profile and payment.credentialLimits; pass it with price.total. Wallet: pass method, price.total; show payment.wallets (WeChat code as an image if you can, both links); they pay once by either; a code lasts ${LIMITS.wechatCodeMinutes} minutes; then the WeChat link opens a new one, or call again. Pay one way only: payment.url or pay_order. On success payment.url stops working; on failure it stays open. Then poll get_order. payment_total_changed: confirm details.total, retry. payment_credential_invalid: new token. service_unavailable: retry. Else payment.url. A token pays one order only.`,
|
|
2253
2325
|
annotations: {
|
|
2254
2326
|
readOnlyHint: false,
|
|
2255
2327
|
idempotentHint: true,
|
|
@@ -2647,7 +2719,7 @@ function walletLines(w, surface) {
|
|
|
2647
2719
|
}
|
|
2648
2720
|
if (w.alipay) lines.push(`Alipay: ${w.alipay.url}`);
|
|
2649
2721
|
lines.push(
|
|
2650
|
-
`Show the user the WeChat Pay code as an image if you can, and both links. They pay once, by either; the code lasts
|
|
2722
|
+
`Show the user the WeChat Pay code as an image if you can, and both links. They pay once, by either; the code lasts ${LIMITS.wechatCodeMinutes} minutes. Then ${c.get} until the order isn't awaiting_payment.`
|
|
2651
2723
|
);
|
|
2652
2724
|
return lines;
|
|
2653
2725
|
}
|
|
@@ -3205,10 +3277,24 @@ var UNKNOWN_IS_NOT_NO_EXEMPTIONS = {
|
|
|
3205
3277
|
listed: `${THE_FLAG} (policies, amenities, rooms).`
|
|
3206
3278
|
};
|
|
3207
3279
|
|
|
3280
|
+
// src/stated-facts.ts
|
|
3281
|
+
var SEARCH_RULES = {
|
|
3282
|
+
largeSettlementPopulation: 5e4,
|
|
3283
|
+
dominanceRatio: 100,
|
|
3284
|
+
nearDuplicateMeters: 5e3,
|
|
3285
|
+
hubIncludes: 3
|
|
3286
|
+
};
|
|
3287
|
+
var ORDER_HTTP = {
|
|
3288
|
+
createdStatus: 201,
|
|
3289
|
+
replayedStatus: 200,
|
|
3290
|
+
replayedHeader: "Idempotent-Replayed"
|
|
3291
|
+
};
|
|
3292
|
+
var ME_SCOPES = { email: "email", name: "profile" };
|
|
3293
|
+
|
|
3208
3294
|
// package.json
|
|
3209
3295
|
var package_default = {
|
|
3210
3296
|
name: "@fortrip/agent-contract",
|
|
3211
|
-
version: "4.
|
|
3297
|
+
version: "4.3.0-rc.1",
|
|
3212
3298
|
license: "Apache-2.0",
|
|
3213
3299
|
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.",
|
|
3214
3300
|
type: "module",
|
|
@@ -3225,6 +3311,10 @@ var package_default = {
|
|
|
3225
3311
|
"./guest-name": {
|
|
3226
3312
|
types: "./dist/guest-name.d.ts",
|
|
3227
3313
|
import: "./dist/guest-name.js"
|
|
3314
|
+
},
|
|
3315
|
+
"./regions": {
|
|
3316
|
+
types: "./dist/regions.d.ts",
|
|
3317
|
+
import: "./dist/regions.js"
|
|
3228
3318
|
}
|
|
3229
3319
|
},
|
|
3230
3320
|
files: ["dist", "NOTICE"],
|
|
@@ -3257,6 +3347,7 @@ var package_default = {
|
|
|
3257
3347
|
// src/version.ts
|
|
3258
3348
|
var CONTRACT_VERSION = package_default.version;
|
|
3259
3349
|
export {
|
|
3350
|
+
ACCOUNT_ROUTES,
|
|
3260
3351
|
AMENITY_CODES,
|
|
3261
3352
|
API,
|
|
3262
3353
|
CANCEL_NEXT_STEP,
|
|
@@ -3268,6 +3359,7 @@ export {
|
|
|
3268
3359
|
CONTRACT_VERSION,
|
|
3269
3360
|
CREDENTIAL_INVALID_REASONS,
|
|
3270
3361
|
DISPLAY_CURRENCIES,
|
|
3362
|
+
DOCS_ORIGIN,
|
|
3271
3363
|
ERROR_CODES,
|
|
3272
3364
|
ERROR_DETAILS,
|
|
3273
3365
|
FILTERABLE_AMENITIES,
|
|
@@ -3275,19 +3367,30 @@ export {
|
|
|
3275
3367
|
GUEST_NAME_MESSAGE,
|
|
3276
3368
|
GUEST_NAME_PATTERN,
|
|
3277
3369
|
GUEST_NAME_TITLE,
|
|
3370
|
+
HTTP_ROUTES,
|
|
3278
3371
|
LIMITS,
|
|
3279
3372
|
MCP_OUTPUT,
|
|
3280
3373
|
MCP_PATH,
|
|
3374
|
+
MCP_SERVER_URL,
|
|
3375
|
+
ME_SCOPES,
|
|
3376
|
+
ORDER_HTTP,
|
|
3281
3377
|
ORDER_NEXT_STEP,
|
|
3282
3378
|
ORDER_STATUSES,
|
|
3283
3379
|
PAYMENT_STATUSES,
|
|
3380
|
+
PAY_INPUT_WAYS,
|
|
3284
3381
|
PAY_NEXT_STEP,
|
|
3382
|
+
PAY_WAYS,
|
|
3285
3383
|
PLACE_KINDS,
|
|
3286
3384
|
POLICY_TOPICS,
|
|
3287
3385
|
PRESENTATION_HINT,
|
|
3288
3386
|
PUBLIC_ORIGINS,
|
|
3387
|
+
RATE_LIMITS,
|
|
3388
|
+
REPOSITORY_URL,
|
|
3289
3389
|
SEARCH_NOTE_CODES,
|
|
3390
|
+
SEARCH_RULES,
|
|
3290
3391
|
SEARCH_SORTS,
|
|
3392
|
+
SKILL_INSTALL_COMMAND,
|
|
3393
|
+
SUPPLIER_OUTCOME_STATUS,
|
|
3291
3394
|
SUPPORT_EMAIL,
|
|
3292
3395
|
TOOLS,
|
|
3293
3396
|
UNAVAILABLE_REASONS,
|
|
@@ -3359,6 +3462,7 @@ export {
|
|
|
3359
3462
|
renderGuide,
|
|
3360
3463
|
renderToolResult,
|
|
3361
3464
|
roomFacts,
|
|
3465
|
+
routePath,
|
|
3362
3466
|
searchHotelsInput,
|
|
3363
3467
|
searchResult,
|
|
3364
3468
|
sharedPaymentTokenOf,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A place Fortrip searches by region. */
|
|
2
|
+
interface EnabledRegion {
|
|
3
|
+
placeId: string;
|
|
4
|
+
countryCode: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
/** The regions a search can be scoped to. Its own entry point so the CLI bundle never loads it. */
|
|
8
|
+
declare const ENABLED_REGIONS: readonly EnabledRegion[];
|
|
9
|
+
|
|
10
|
+
export { ENABLED_REGIONS, type EnabledRegion };
|