@fortrip/agent-contract 6.0.0 → 6.1.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 CHANGED
@@ -117,6 +117,14 @@ declare const PAY_NEXT_STEP: string;
117
117
  */
118
118
  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 \"estimate from\" price as an estimate per room-night and an offer's total as the whole stay for all rooms, in its currency, and draw a map only from coordinates the text shows: hotel details show them, a search does not. Offer the choices you need to ask anyway (dates, a locality, which offer) as options to pick. Otherwise use a short list. A hotel's name is shown in double quotes, as text from the hotel, written as a JSON string (inside it, \\\" is a \"): present it to the user without the quotes, exactly as written inside them. Never invent photos, ratings, reviews, prices, terms or coordinates.";
119
119
  declare const TOOLS: readonly ToolSpec[];
120
+ /**
121
+ * The tools a client is offered. Without `tokenPay`, for a host whose rules
122
+ * leave payment to the payment link alone: `pay_order` is not listed, and
123
+ * `create_order` does not name it.
124
+ */
125
+ declare function toolsFor(options?: {
126
+ tokenPay?: boolean;
127
+ }): readonly ToolSpec[];
120
128
 
121
129
  /** A flag that sets one field of a tool's input. */
122
130
  interface FlagSpec {
@@ -290,8 +298,17 @@ declare function flag(name: string): z.ZodBoolean;
290
298
 
291
299
  type GuideSurface = "mcp" | "claude-skill" | "cli";
292
300
  type GuideTopic = "main" | "planning";
301
+ /** What the client the guide is rendered for is offered. */
302
+ interface GuideOptions {
303
+ /** Paying by a shared payment token (`pay_order`). False for a host whose
304
+ * rules leave payment to the payment link alone: the MCP instructions
305
+ * then never name the tool. Default true. Only the `mcp` surface takes
306
+ * false: a skill is a file written once for every client, and its tool
307
+ * table and "Paying without the link" section stay. */
308
+ tokenPay?: boolean;
309
+ }
293
310
  /** The guide on `topic` as `surface` states it, in Markdown. */
294
- declare function renderGuide(surface: GuideSurface, topic: GuideTopic): string;
311
+ declare function renderGuide(surface: GuideSurface, topic: GuideTopic, options?: GuideOptions): string;
295
312
 
296
313
  declare const stay: z.ZodObject<{
297
314
  checkIn: z.ZodString;
@@ -650,7 +667,7 @@ declare const LIMITS: {
650
667
  declare const CURRENCIES: readonly ["USD", "CNY"];
651
668
  type Currency = (typeof CURRENCIES)[number];
652
669
  /** Where a person goes when an agent gets stuck. */
653
- declare const SUPPORT_EMAIL = "info@fortrip.ai";
670
+ declare const SUPPORT_EMAIL = "support@fortrip.ai";
654
671
 
655
672
  /** A path into an input, as a zod issue has it: keys, and indexes into lists. */
656
673
  type Path = (string | number)[];
@@ -2756,8 +2773,14 @@ type RenderedTool = ToolName;
2756
2773
  * - on MCP, how to present hotels (`PRESENTATION_HINT`) for `search_hotels`,
2757
2774
  * `get_hotel` and `get_hotel_offers`. The CLI's text carries none: there
2758
2775
  * the rule is the skill's, as before.
2776
+ *
2777
+ * `options.tokenPay: false`, for a client not offered payment by token: no
2778
+ * order has a "Pay without the link" line, and no result ends with the pay
2779
+ * rule. The order is read as if it could not be paid by token.
2759
2780
  */
2760
- declare function renderToolResult(tool: RenderedTool, data: unknown, surface?: RenderSurface): string;
2781
+ declare function renderToolResult(tool: RenderedTool, data: unknown, surface?: RenderSurface, options?: {
2782
+ tokenPay?: boolean;
2783
+ }): string;
2761
2784
 
2762
2785
  /** Amenity codes a search can filter by (§7.7), in the order they are listed. */
2763
2786
  declare const FILTERABLE_AMENITIES: readonly ["parking", "wifi", "laundry", "restaurant", "room_service", "bar", "non_smoking", "business_center", "pool"];
@@ -2794,4 +2817,4 @@ declare const ME_SCOPES: {
2794
2817
  /** The contract's version, from package.json, the one place a release bumps it. */
2795
2818
  declare const CONTRACT_VERSION: string;
2796
2819
 
2797
- export { ACCOUNT_ROUTES, AMENITY_CODES, API, type AmenityCode, type AuthConfig, CANCEL_ACTIONS, CANCEL_BLOCKERS, CANCEL_NEXT_STEP, CARD_NUMBER_MESSAGE, CENTER_BASES, COMMANDS, COMMAND_GROUPS, CONTRACT_VERSION, CREDENTIAL_INVALID_REASONS, CURRENCIES, type CancelAction, type CancelBlocker, type CancelOrderInput, type Center, type CommandGroupSpec, type CommandSpec, type CreateOrderInput, type CredentialInvalidReason, type Currency, DOCS_ORIGIN, type Destination, ERROR_CODES, ERROR_DETAILS, type ErrorBody, type ErrorCode, type ErrorEnvelope, FAILURE_REASONS, FEE_KINDS, FILTERABLE_AMENITIES, type FailureReason, type FeeKind, 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_PATH, MCP_SERVER_URL, META_KEYS, ME_SCOPES, type MeResult, type MisplacedKey, type Money, ORDER_HTTP, ORDER_NEXT_STEP, ORDER_STATUSES, type Offer, type OfferChange, type Omitted, type OptionSpec, type Order, type OrderCancel, type OrderList, type OrderStatus, PAYMENT_METHOD_UNAVAILABLE_REASONS, PAYMENT_STATUSES, PAY_NEXT_STEP, PAY_WAYS, PLACE_KINDS, POLICY_TOPICS, PRESENTATION_HINT, PUBLIC_ORIGINS, type PayOrderInput, type PayWay, type PaymentHandler, type PaymentMethodUnavailableReason, type PaymentStatus, type Place, type PlaceRef, type PolicyTopic, type PositionalSpec, RATE_LIMITS, REPOSITORY_URL, type RateLimitName, type RenderSurface, type RenderedTool, type RoomType, SEARCH_NOTE_CODES, SEARCH_NOTE_DETAILS, SEARCH_RULES, SEARCH_SORTS, SERVER_INFO, SKILL_INSTALL_COMMAND, SUPPLIER_OUTCOME_STATUS, SUPPORT_EMAIL, type SearchHotelsInput, type SearchNote, type SearchNoteCode, type SearchResult, type Stay, TOOLS, type TokenUsageLimits, type ToolName, type ToolSpec, UNAVAILABLE_REASONS, UNKNOWN_IS_NOT_NO_EXEMPTIONS, 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, misplacedKeyHint, misplacedKeys, money, names, nonEmpty, offer, offerChange, offerId, offersPerHotel, omitted, oneOf, openEnum, openObject, openUnion, order, orderCancel, orderId, orderList, orderReference, parseOpen, payAtProperty, payNextStep, payOrderInput, paymentHandler, photo, place, placeId, placeRef, protocolObject, renderError, renderGuide, renderToolResult, requestMoney, roomType, routePath, searchHotelsInput, searchNote, searchResult, stay, stayEcho, strictInput, strictOutput, text, timeZone, tokenUsageLimits, unknownFieldsMessage, wholeNumber };
2820
+ export { ACCOUNT_ROUTES, AMENITY_CODES, API, type AmenityCode, type AuthConfig, CANCEL_ACTIONS, CANCEL_BLOCKERS, CANCEL_NEXT_STEP, CARD_NUMBER_MESSAGE, CENTER_BASES, COMMANDS, COMMAND_GROUPS, CONTRACT_VERSION, CREDENTIAL_INVALID_REASONS, CURRENCIES, type CancelAction, type CancelBlocker, type CancelOrderInput, type Center, type CommandGroupSpec, type CommandSpec, type CreateOrderInput, type CredentialInvalidReason, type Currency, DOCS_ORIGIN, type Destination, ERROR_CODES, ERROR_DETAILS, type ErrorBody, type ErrorCode, type ErrorEnvelope, FAILURE_REASONS, FEE_KINDS, FILTERABLE_AMENITIES, type FailureReason, type FeeKind, type FilterableAmenity, type FlagSpec, GLOBAL_FLAGS, type GetHotelInput, type GetOrderInput, type GuideOptions, 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_PATH, MCP_SERVER_URL, META_KEYS, ME_SCOPES, type MeResult, type MisplacedKey, type Money, ORDER_HTTP, ORDER_NEXT_STEP, ORDER_STATUSES, type Offer, type OfferChange, type Omitted, type OptionSpec, type Order, type OrderCancel, type OrderList, type OrderStatus, PAYMENT_METHOD_UNAVAILABLE_REASONS, PAYMENT_STATUSES, PAY_NEXT_STEP, PAY_WAYS, PLACE_KINDS, POLICY_TOPICS, PRESENTATION_HINT, PUBLIC_ORIGINS, type PayOrderInput, type PayWay, type PaymentHandler, type PaymentMethodUnavailableReason, type PaymentStatus, type Place, type PlaceRef, type PolicyTopic, type PositionalSpec, RATE_LIMITS, REPOSITORY_URL, type RateLimitName, type RenderSurface, type RenderedTool, type RoomType, SEARCH_NOTE_CODES, SEARCH_NOTE_DETAILS, SEARCH_RULES, SEARCH_SORTS, SERVER_INFO, SKILL_INSTALL_COMMAND, SUPPLIER_OUTCOME_STATUS, SUPPORT_EMAIL, type SearchHotelsInput, type SearchNote, type SearchNoteCode, type SearchResult, type Stay, TOOLS, type TokenUsageLimits, type ToolName, type ToolSpec, UNAVAILABLE_REASONS, UNKNOWN_IS_NOT_NO_EXEMPTIONS, 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, misplacedKeyHint, misplacedKeys, money, names, nonEmpty, offer, offerChange, offerId, offersPerHotel, omitted, oneOf, openEnum, openObject, openUnion, order, orderCancel, orderId, orderList, orderReference, parseOpen, payAtProperty, payNextStep, payOrderInput, paymentHandler, photo, place, placeId, placeRef, protocolObject, renderError, renderGuide, renderToolResult, requestMoney, roomType, routePath, searchHotelsInput, searchNote, searchResult, stay, stayEcho, strictInput, strictOutput, text, timeZone, tokenUsageLimits, toolsFor, unknownFieldsMessage, wholeNumber };
package/dist/index.js CHANGED
@@ -173,7 +173,7 @@ var LIMITS = {
173
173
  tokensPerOrder: 5
174
174
  };
175
175
  var CURRENCIES = ["USD", "CNY"];
176
- var SUPPORT_EMAIL = "info@fortrip.ai";
176
+ var SUPPORT_EMAIL = "support@fortrip.ai";
177
177
 
178
178
  // src/conventions/money.ts
179
179
  var amountError = "amount must be a decimal string such as 132.40";
@@ -1190,7 +1190,7 @@ An offer expires at the time its line gives, about 30 minutes after it was made;
1190
1190
  `,
1191
1191
  "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- Offers and orders take one party per call, every room the same: for different parties, order once per party. `{{tool:hotels offers}}` answers `stay_unsupported` for mixed rooms; `{{tool:hotels search}}` accepts them but prices only from the dates, with the note `party_split_required`.\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 also answers `stay_unsupported`: ask the user whether to split it into consecutive stays, each its own order.\n{{/if}}\n",
1192
1192
  "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 YYYY-MM-DD \\\n --check-out YYYY-MM-DD --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> [--room-types]\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 YYYY-MM-DD \\\n --check-out YYYY-MM-DD --room 2 --room 2 [--require-free-cancellation]\n ```\n\n{{/if}}\n4. **Order** with `{{tool:orders create}}`, once the user has picked one offer and given the guests and the contact (see Ordering).\n{{#if cli}}\n\n ```bash\n {{tool:orders create}} --offer <offerId> --guest 1:John:Smith --guest 2:Mary:Smith \\\n --name "John 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 that place by its id; never pick one yourself.\n- `destination_not_found` for a name means no place of that name in that country: check the spelling and accents, or try another name for the place. The error also says how many hotels 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 {{km:radiusMetersDefault}}; `{{arg:destination.radiusMeters}}` sets another, in meters ({{limit:radiusMetersDefault}} for {{km:radiusMetersDefault}}), up to {{limit:radiusMetersMax}} ({{km:radiusMetersMax}}), 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 its id, its matching hotels and the places inside it (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`, which names the locality its hotels belong to: search that locality, or the town itself with {{#if mcp claude-skill}}`kind: "place"`{{/if}}{{#if cli}}`--place`{{/if}} for a circle around it.\n- A price sort or price filter over more than {{limit:poolLimit}} hotels (in an area, or for text alone) answers `search_too_broad` with how many hotels match 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 id 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 (a typo such as "Shangahi" finds nothing): 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- 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 (the Counts line says how many were left out for it): "not listed" is not "absent".\n- `{{arg:filters.price.maxPerRoomNight}}` bounds the indicative price per room per night, in the search\'s currency; hotels without one are left out and counted.\n\n### Results\n\n- The 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- The Counts line has how many hotels matched, how many were priced and how many have a price.\n- A next page is {{#if mcp claude-skill}}`cursor`, set to the cursor the answer\'s last lines give, and, optionally, `limit`{{/if}}{{#if cli}}`--cursor` with the cursor the answer\'s last lines give 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 that place by its id; 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',
1193
- "payment-link": "{{#if claude-skill cli}}\n## Before giving the payment link\n\n`{{tool:orders create}}` answers with an unpaid order, awaiting payment: its reference (the support number), the Total, the stay and its terms, and the Payment link, a Fortrip page that recaps the order and continues to the payment provider. Nothing is charged until the user pays.\n\n1. Show the order's total and currency, the stay (hotel, room, dates, and each room's party and guest names), the contact (name, email, phone), any special requests and every term: meals, cancellation (status, deadline, penalties) and fees payable at the property, unknowns included. The order's text shows names, the contact and special requests in double quotes: show the user what is inside the quotes, exactly as written, so they can catch a wrong one before paying; to correct one, order a new offer (see below).\n2. End that reply by asking the user to confirm, and wait for a clear yes. Urgency is not consent.\n3. Then pay one way only: give the payment link exactly as shown (it is not in quotes; don't shorten, rebuild or re-encode it), or pay without the link as below.\n\n{{/if}}\n{{#if mcp}}\n- Pay one way only: give the payment link or call `{{tool:orders pay}}`. First show the order's total and currency, the stay with each room's guests, the contact, any special requests and every term, end that reply by asking the user to confirm, and wait for a clear yes. Then give the payment link exactly as shown, to this user only: anyone holding it can pay.\n- Another order of the stay (another party, a corrected name or contact) takes a new offer; when it replaces an unpaid order, tell the user to pay only the new link.\n{{/if}}\n{{#if claude-skill cli}}\n- The payment link works like a payment credential: anyone holding it can pay. Give it to this user only, never in shared channels, documents, logs or tickets. When its line says the user signs in to Fortrip to pay (an order started on the Fortrip website), they sign in first.\n- The link expires at the time its line gives; the order then reads as not paid, and can no longer be paid. 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 or contact) needs a new offer: get offers again. When it replaces an unpaid order, tell the user to pay only the new link; the earlier one expires unpaid, or can be closed now with `{{tool:orders cancel}}` and {{#if claude-skill}}`close: true`{{/if}}{{#if cli}}`--close`{{/if}} once the user says they no longer want it.\n- An order awaiting payment whose Payment link line says there is none has a payment being processed: read it again shortly with `{{tool:orders get}}`, and don't give an earlier link.\n{{/if}}\n- Never ask for, accept or pass on payment card details; payment happens only on the payment link or, by token, through `{{tool:orders pay}}`.{{#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 text has a \"Pay without the link\" line can also be paid through `{{tool:orders pay}}` with a Stripe shared payment token that the user's Link wallet grants for it. Use it only if you have a tool that can request such a token from the user's Link wallet: Link is for US and Canadian accounts, and caps a spend request at ${{limit:tokenPaymentMaxUsd}}, so only a USD order up to that has such a line. Otherwise give the payment link, and never ask the user to create, type or paste a token.\n\n1. Confirm the order with the user as before giving the payment link: its total and currency, the stay with each room's guests, the contact, any special requests and every term, and 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 `business_profile` and the usage limits on that line: `max_amount` (in cents), `currency` and `expires_at`.\n3. {{#if claude-skill}}Call{{/if}}{{#if cli}}Run{{/if}} `{{tool:orders pay}}` with the token and the order's total{{#if cli}} (`--token`, `--total`){{/if}}{{#if claude-skill}} (`sharedPaymentToken`, `total`){{/if}}. The order is then confirming with the hotel, 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. Once `{{tool:orders pay}}` succeeds, the payment link stops working; a payment that fails leaves the link open. `payment_total_mismatch` means the total sent isn't the order's, which the error gives; 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 card 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 usage limits on that line. `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}}`; its first line has the status:\n\n- confirming with the hotel, then confirmed, with the hotel confirmation number.\n- failed: no stay was booked. \"Why it failed\" says why and what to do next, and the Total line whether the payment was released or refunded.\n- needs attention from Fortrip: Fortrip is looking into it; the user can email {{support}} with the order's reference.\n- The Manage link is the user's own page for the order.\n{{/if}}\n",
1193
+ "payment-link": "{{#if claude-skill cli}}\n## Before giving the payment link\n\n`{{tool:orders create}}` answers with an unpaid order, awaiting payment: its reference (the support number), the Total, the stay and its terms, and the Payment link, a Fortrip page that recaps the order and continues to the payment provider. Nothing is charged until the user pays.\n\n1. Show the order's total and currency, the stay (hotel, room, dates, and each room's party and guest names), the contact (name, email, phone), any special requests and every term: meals, cancellation (status, deadline, penalties) and fees payable at the property, unknowns included. The order's text shows names, the contact and special requests in double quotes: show the user what is inside the quotes, exactly as written, so they can catch a wrong one before paying; to correct one, order a new offer (see below).\n2. End that reply by asking the user to confirm, and wait for a clear yes. Urgency is not consent.\n3. Then pay one way only: give the payment link exactly as shown (it is not in quotes; don't shorten, rebuild or re-encode it), or pay without the link as below.\n\n{{/if}}\n{{#if mcp}}\n- {{#if token-pay}}Pay one way only: give the payment link or call `{{tool:orders pay}}`. {{/if}}First show the order's total and currency, the stay with each room's guests, the contact, any special requests and every term, end that reply by asking the user to confirm, and wait for a clear yes. Then give the payment link exactly as shown, to this user only: anyone holding it can pay.\n- Another order of the stay (another party, a corrected name or contact) takes a new offer; when it replaces an unpaid order, tell the user to pay only the new link.\n{{/if}}\n{{#if claude-skill cli}}\n- The payment link works like a payment credential: anyone holding it can pay. Give it to this user only, never in shared channels, documents, logs or tickets. When its line says the user signs in to Fortrip to pay (an order started on the Fortrip website), they sign in first.\n- The link expires at the time its line gives; the order then reads as not paid, and can no longer be paid. 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 or contact) needs a new offer: get offers again. When it replaces an unpaid order, tell the user to pay only the new link; the earlier one expires unpaid, or can be closed now with `{{tool:orders cancel}}` and {{#if claude-skill}}`close: true`{{/if}}{{#if cli}}`--close`{{/if}} once the user says they no longer want it.\n- An order awaiting payment whose Payment link line says there is none has a payment being processed: read it again shortly with `{{tool:orders get}}`, and don't give an earlier link.\n{{/if}}\n- Never ask for, accept or pass on payment card details; payment happens only on the payment link{{#if token-pay}} or, by token, through `{{tool:orders pay}}`{{/if}}.{{#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 text has a \"Pay without the link\" line can also be paid through `{{tool:orders pay}}` with a Stripe shared payment token that the user's Link wallet grants for it. Use it only if you have a tool that can request such a token from the user's Link wallet: Link is for US and Canadian accounts, and caps a spend request at ${{limit:tokenPaymentMaxUsd}}, so only a USD order up to that has such a line. Otherwise give the payment link, and never ask the user to create, type or paste a token.\n\n1. Confirm the order with the user as before giving the payment link: its total and currency, the stay with each room's guests, the contact, any special requests and every term, and 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 `business_profile` and the usage limits on that line: `max_amount` (in cents), `currency` and `expires_at`.\n3. {{#if claude-skill}}Call{{/if}}{{#if cli}}Run{{/if}} `{{tool:orders pay}}` with the token and the order's total{{#if cli}} (`--token`, `--total`){{/if}}{{#if claude-skill}} (`sharedPaymentToken`, `total`){{/if}}. The order is then confirming with the hotel, 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. Once `{{tool:orders pay}}` succeeds, the payment link stops working; a payment that fails leaves the link open. `payment_total_mismatch` means the total sent isn't the order's, which the error gives; 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 card 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 usage limits on that line. `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}}`; its first line has the status:\n\n- confirming with the hotel, then confirmed, with the hotel confirmation number.\n- failed: no stay was booked. \"Why it failed\" says why and what to do next, and the Total line whether the payment was released or refunded.\n- needs attention from Fortrip: Fortrip is looking into it; the user can email {{support}} with the order's reference.\n- The Manage link is the user's own page for the order.\n{{/if}}\n",
1194
1194
  "planning": "# Planning a hotel stay\n\nRead this when the request is more than one hotel for fixed dates: flexible dates, a budget, split stays, several destinations, or \"find me the best\". The rules in {{#if mcp}}the server instructions{{/if}}{{#if claude-skill cli}}SKILL.md{{/if}} still apply{{#if mcp}} (call order, destinations, confirming the order `{{tool:orders create}}` returns before giving the payment link){{/if}}; 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\n{{#if mcp}}\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\n{{/if}}\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 mcp}} If children come along, ask each child's age; `{{tool:hotels offers}}` needs it. When a place name is ambiguous, ask which place the user means.{{/if}} Don't ask for trip type or style: infer it from the conversation or leave it general.\n\n## Evidence\n\n- {{#if mcp}}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{{/if}}{{#if claude-skill cli}}Once{{/if}} 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{{#if mcp}}\n- A hotel is available only once `{{tool:hotels offers}}` returned an offer for it.\n{{/if}}\n- Anything {{#if mcp claude-skill}}the tools{{/if}}{{#if cli}}the CLI{{/if}} didn't return, such as reviews, style, price trends or exchange rates, is unknown. Say so instead of filling it in.\n\n## Ranking\n\n1. Drop options that break a hard constraint (dates, guests, budget cap, required facility). Compare a budget in the unit the user gave it: per night, per room or for the whole stay. An offer's total covers the whole stay and every room, in the offer's currency.\n2. Keep only options with a live offer.\n3. Order by the user's stated main goal. Goals they didn't state don't count.\n4. Use other preferences only to break ties.\n\nUse the cheapest comparable offer as the baseline unless the user fixed the room type. Two or three plans usually suffice, each with its price difference from the baseline and what it trades off (meals, cancellation, location, confirmation). Give a hotel's name without the double quotes the text shows it in, exactly as written inside them, 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:orders create}}` 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:orders create}}` 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:orders create}}` returned.\n",
1195
1195
  "presentation": `{{#if claude-skill}}
1196
1196
  ## Presenting hotels
@@ -1199,12 +1199,13 @@ If your interface can show rich elements, show each hotel as a card with only wh
1199
1199
  {{/if}}
1200
1200
  `,
1201
1201
  "prices": '{{#if claude-skill cli}}\n## Prices and currency\n\n- A search price (shown as "estimate from \u2026 /room-night") is indicative and not bookable: the lowest price of one unit (a room or, at a hostel, possibly a bed) per night on the searched dates, for any party and possibly read days ago, 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. A hotel with "no indicative price" isn\'t full; about half the hotels have none for given dates.\n{{/if}}\n- {{#if claude-skill cli}}In an offer or order, the total is the whole stay for all rooms and is what is charged, in the request\'s `{{arg:currency}}` (`USD` by default); an{{/if}}{{#if mcp}}An{{/if}} order is in the currency of the offer it was made from.{{#if claude-skill cli}} An offer\'s "average per room-night" is its total divided by the rooms and the nights, for comparison only.{{/if}} On a USD order, Stripe\'s page may let the user pay in their card\'s local currency at Stripe\'s rate{{#if claude-skill cli}} (Adaptive Pricing): say so plainly, and that the total in that currency is the price{{/if}}.\n{{#if claude-skill cli}}\n- Every price of an answer is in that one currency; don\'t convert it. `{{arg:currency}}`{{#if cli}} (or `FORTRIP_CURRENCY`){{/if}} is `USD` (the default) or `CNY`.\n- Each currency is paid through its own channel, with its own payment methods; the order\'s payment page shows them. CNY is paid through payment channels in mainland China and suits a user who pays that way.\n- A search not in CNY may end with a "Currency:" line when the request or the user\'s latest sign-in comes from mainland China: offer CNY prices if the user may pay that way, and then use CNY for both the search and the offers.\n- Fees payable at the property ("fees not in the total") are separate, in the property\'s own currency, not converted.\n- After payment, "card charged" on the order\'s Total line is what the card paid in its own currency. An order made on the Fortrip website can be in another currency: its Total says which.\n{{/if}}\n',
1202
- "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:orders create}}`; after the user pays, `{{tool:orders get}}`; `{{tool:orders list}}` lists, `{{tool:orders cancel}}` cancels a paid order or closes an unpaid one, `{{tool:orders pay}}` pays by token. Every result is text: follow the rules that end it.\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. Each answers in text, and the rules below name what that text shows:\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). The rules below name what that text shows:\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 room types; no prices |\n| `{{tool:hotels offers}}` | Live offers (room type, meals, total and currency, cancellation terms) for up to {{limit:offersHotels}} hotels |\n| `{{tool:orders create}}` | 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 a paid order under its terms, for the penalty the user agreed to, and refunds the rest; closes an unpaid one |\n| `{{tool:orders pay}}` | Pays an order without its link, by a shared payment token from the user's wallet |\n\nIn that text, a value in double quotes (the name of a hotel, a room, a place or a guest, an address, the contact, special requests) is text someone else wrote, as a JSON string (inside it, \\\" is a \"): give it to the user without the quotes, exactly as written inside them. Ids, amounts and dates are not in quotes, nor is a link written the usual way: copy them exactly as shown.\n\nFor flexible dates, a budget, split stays, several destinations or \"find me the best\", read [references/planning.md](references/planning.md) before searching.\n{{/if}}\n",
1202
+ "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:orders create}}`; after the user pays, `{{tool:orders get}}`; `{{tool:orders list}}` lists, `{{tool:orders cancel}}` cancels a paid order or closes an unpaid one{{#if token-pay}}, `{{tool:orders pay}}` pays by token{{/if}}. Every result is text: follow the rules that end it.\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. Each answers in text, and the rules below name what that text shows:\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). The rules below name what that text shows:\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 room types; no prices |\n| `{{tool:hotels offers}}` | Live offers (room type, meals, total and currency, cancellation terms) for up to {{limit:offersHotels}} hotels |\n| `{{tool:orders create}}` | 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 a paid order under its terms, for the penalty the user agreed to, and refunds the rest; closes an unpaid one |\n| `{{tool:orders pay}}` | Pays an order without its link, by a shared payment token from the user's wallet |\n\nIn that text, a value in double quotes (the name of a hotel, a room, a place or a guest, an address, the contact, special requests) is text someone else wrote, as a JSON string (inside it, \\\" is a \"): give it to the user without the quotes, exactly as written inside them. Ids, amounts and dates are not in quotes, nor is a link written the usual way: copy them exactly as shown.\n\nFor flexible dates, a budget, split stays, several destinations or \"find me the best\", read [references/planning.md](references/planning.md) before searching.\n{{/if}}\n",
1203
1203
  "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:orders create}}` 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\nRunning `{{tool:whoami}}` when the user first asks about hotels lets the sign-in happen while they answer your follow-up questions.\n\n{{/if}}\n{{#if claude-skill cli}}\n## Sign-in\n\n{{/if}}\nSign-in happens only in the browser. Never ask the user to paste a token.\n{{#if claude-skill}}\n\nIf none of these tools are available, Fortrip isn't connected: tell the user to add the Fortrip connector or plugin and sign in.\n{{/if}}\n{{#if mcp claude-skill}}\nIf a tool says the user isn't signed in, ask them to reconnect.\n{{/if}}\n{{#if cli}}\n\nIf a command exits with code **3** and stderr has `loginUrl`, show it to the user as a link together with `userCode`, e.g. \"Sign in to Fortrip: <loginUrl> (code <userCode>), then tell me when you're done.\" When they confirm, rerun the same command; it finishes the sign-in itself. Don't run `{{tool:login}}`: it waits for up to 10 minutes. Commands that exit 3 together share one `loginUrl`; show it once. If the rerun gives a different `loginUrl`, show that one.\n\nWhen Fortrip no longer accepts the saved sign-in (it was revoked, or it expired and couldn't be renewed), the command also exits 3 with a `loginUrl`; handle it the same way. The saved sign-in is kept until the user approves the new link.\n\nIn a remote agent environment or a CI run without a browser, the user can set `FORTRIP_TOKEN` instead. Exit 3 with `tokenSource: \"FORTRIP_TOKEN\"` means Fortrip didn't accept that token: tell the user to replace or unset it.\n\n## Exit codes\n\n| Code | Meaning | What to do |\n|---|---|---|\n| 0 | Success; the answer on stdout | Continue |\n| 1 | Any other error: an error from Fortrip (see Errors), a network error or a timeout | Read the error on stderr. If it says it is retryable, wait as long as it says (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 as long as the error says, then retry once |\n| 5 | This version of the CLI is too old for Fortrip (`client_outdated`) | Run the update command the error gives, then rerun the same command |\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",
1204
- "support": "{{#if claude-skill cli}}\n## Cancelling an order\n\n`{{tool:orders get}}` and `{{tool:orders list}}` say on each order's Cancel line what can be done to it now. A paid order that can be cancelled has the penalty under its terms and the refund, what was paid less the penalty, both in the order's currency; an unpaid one can be closed instead. Otherwise the line says what blocks both.\n\n1. Show the user the stay (hotel, dates) and the penalty and the refund on the Cancel line (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}}make the call{{/if}}{{#if cli}}run the command{{/if}} the Cancel line gives, exactly as shown: `{{tool:orders cancel}}` with `{{arg:maximumPenalty}}` set to the penalty on that line{{#if cli}}, its amount (the CLI takes the currency from the order){{/if}}. Never state a refund the order's text doesn't show, 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}}`, which then says what the cancellation kept and returned. If the hotel refuses, the order is confirmed again and its Cancel line says so. `cancellation_changed` 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` says which of cancelling and closing applies to the order now, or what blocks both; nothing is ever cancelled or closed by the other one.\n\nClose an unpaid order only once the user says they no longer want it: {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders cancel}}` with {{#if claude-skill}}`close: true`{{/if}}{{#if cli}}`--close`{{/if}}. It then reads as not paid, and nothing is charged. `payment_in_progress` means a payment of it is under way: read it again shortly.{{#if cli}} Without `--max-penalty` or `--close`, `{{tool:orders cancel}}` is refused with exit 2 and nothing is sent: `{{tool:orders get}}` shows the order's Cancel line, with the command to run.{{/if}}\n\n## Changes and support\n\n{{/if}}\n{{#if mcp}}Cancel a paid order only after the user confirmed the penalty and the refund on its Cancel line; close an unpaid one only once they say they no longer want it. 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 its payment link).\n"
1204
+ "support": "{{#if claude-skill cli}}\n## Cancelling an order\n\n`{{tool:orders get}}` and `{{tool:orders list}}` say on each order's Cancel line what can be done to it now. A paid order that can be cancelled has the penalty under its terms and the refund, what was paid less the penalty, both in the order's currency; an unpaid one can be closed instead. Otherwise the line says what blocks both.\n\n1. Show the user the stay (hotel, dates) and the penalty and the refund on the Cancel line (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}}make the call{{/if}}{{#if cli}}run the command{{/if}} the Cancel line gives, exactly as shown: `{{tool:orders cancel}}` with `{{arg:maximumPenalty}}` set to the penalty on that line{{#if cli}}, its amount (the CLI takes the currency from the order){{/if}}. Never state a refund the order's text doesn't show, 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}}`, which then says what the cancellation kept and returned. If the hotel refuses, the order is confirmed again and its Cancel line says so. `cancellation_changed` 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` says which of cancelling and closing applies to the order now, or what blocks both; nothing is ever cancelled or closed by the other one.\n\nClose an unpaid order only once the user says they no longer want it: {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders cancel}}` with {{#if claude-skill}}`close: true`{{/if}}{{#if cli}}`--close`{{/if}}. It then reads as not paid, and nothing is charged. `payment_in_progress` means a payment of it is under way: read it again shortly.{{#if cli}} Without `--max-penalty` or `--close`, `{{tool:orders cancel}}` is refused with exit 2 and nothing is sent: `{{tool:orders get}}` shows the order's Cancel line, with the command to run.{{/if}}\n\n## Changes and support\n\n{{/if}}\n{{#if mcp}}Cancel a paid order only after the user confirmed the penalty and the refund on its Cancel line; close an unpaid one only once they say they no longer want it. An order can't be changed, only{{/if}}{{#if claude-skill}}These tools can't change an order: it can only be{{/if}}{{#if cli}}The CLI can't change an order: it can only be{{/if}} cancelled under its terms and ordered again. For a cancellation that `{{tool:orders cancel}}` can't make, or other problems, the user emails {{support}} with the order's reference (never its payment link).\n"
1205
1205
  };
1206
1206
 
1207
1207
  // src/guide.ts
1208
+ var TOKEN_PAY = "token-pay";
1208
1209
  var SURFACES = ["mcp", "claude-skill", "cli"];
1209
1210
  var TOPICS = {
1210
1211
  main: [
@@ -1222,7 +1223,7 @@ var TOPICS = {
1222
1223
  ],
1223
1224
  planning: ["planning"]
1224
1225
  };
1225
- function renderGuide(surface, topic) {
1226
+ function renderGuide(surface, topic, options = {}) {
1226
1227
  if (!Object.hasOwn(TOPICS, topic)) {
1227
1228
  throw new Error(`Unknown guide topic "${topic}"`);
1228
1229
  }
@@ -1231,7 +1232,7 @@ function renderGuide(surface, topic) {
1231
1232
  if (fragment === void 0) {
1232
1233
  throw new Error(`Missing guide fragment "${name}"`);
1233
1234
  }
1234
- return renderText(fragment, surface).trim();
1235
+ return renderText(fragment, surface, options).trim();
1235
1236
  });
1236
1237
  const text2 = parts.filter(Boolean).join("\n\n");
1237
1238
  return `${text2.replace(/\n{3,}/g, "\n\n")}
@@ -1240,14 +1241,17 @@ function renderGuide(surface, topic) {
1240
1241
  var TOKEN = /{{([^{}]*)}}/g;
1241
1242
  var CONDITION = /{{#if ([^{}]*)}}|{{\/if}}/g;
1242
1243
  var LONE_CONDITION = /^[ \t]*({{#if [^{}\n]*}}|{{\/if}})[ \t]*\n/gm;
1243
- function renderText(text2, surface) {
1244
+ function renderText(text2, surface, options = {}) {
1244
1245
  if (!SURFACES.includes(surface)) {
1245
1246
  throw new Error(`Unknown guide surface "${surface}"`);
1246
1247
  }
1247
1248
  for (const [token2, body] of text2.matchAll(TOKEN)) {
1248
1249
  if (!/^(#if |\/if$)/.test(body ?? "")) resolve(token2, surface, false);
1249
1250
  }
1250
- const shown = select(text2, surface).replace(
1251
+ if (options.tokenPay === false && surface !== "mcp") {
1252
+ throw new Error(`The guide without payment by token is the MCP server's only, not the ${surface} surface's`);
1253
+ }
1254
+ const shown = select(text2, surface, options.tokenPay !== false).replace(
1251
1255
  TOKEN,
1252
1256
  (token2) => resolve(token2, surface, true)
1253
1257
  );
@@ -1256,7 +1260,7 @@ function renderText(text2, surface) {
1256
1260
  }
1257
1261
  return shown;
1258
1262
  }
1259
- function select(text2, surface) {
1263
+ function select(text2, surface, tokenPay) {
1260
1264
  const tagged = text2.replace(LONE_CONDITION, "$1");
1261
1265
  const open = [];
1262
1266
  let out = "";
@@ -1271,6 +1275,10 @@ function select(text2, surface) {
1271
1275
  continue;
1272
1276
  }
1273
1277
  const names2 = tag[1].trim().split(/\s+/);
1278
+ if (names2.length === 1 && names2[0] === TOKEN_PAY) {
1279
+ open.push(tokenPay);
1280
+ continue;
1281
+ }
1274
1282
  for (const name of names2) {
1275
1283
  if (!SURFACES.includes(name)) {
1276
1284
  throw new Error(`Unknown guide surface "${name}" in ${tag[0]}`);
@@ -2385,6 +2393,8 @@ var READ = {
2385
2393
  destructiveHint: false
2386
2394
  };
2387
2395
  var READ_OWN = { ...READ, openWorldHint: false };
2396
+ var PAID_WHERE = ", on that page or with pay_order";
2397
+ var PAID_WHERE_WITHOUT_TOKEN = " on that page";
2388
2398
  var TOOLS = [
2389
2399
  {
2390
2400
  name: "search_hotels",
@@ -2413,7 +2423,7 @@ var TOOLS = [
2413
2423
  {
2414
2424
  name: "create_order",
2415
2425
  title: "Create order",
2416
- description: `Create an unpaid order for one offer from get_hotel_offers. It takes items, one item with the offer's offerId inside it (nowhere else in the arguments) and hotel.rooms, and contact. The answer is the order, awaiting payment: its reference, the total, the stay and its terms, and a payment link, a Fortrip page to pay on. Nothing is charged until the order is paid, on that page or with pay_order; 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: another order of the stay (another party, or a corrected guest name or contact) takes a new offer. cancel_order cancels or closes an order; for changes, or a cancellation it can't make, the user emails ${SUPPORT_EMAIL} with the order's reference.`,
2426
+ description: `Create an unpaid order for one offer from get_hotel_offers. It takes items, one item with the offer's offerId inside it (nowhere else in the arguments) and hotel.rooms, and contact. The answer is the order, awaiting payment: its reference, the total, the stay and its terms, and a payment link, a Fortrip page to pay on. Nothing is charged until the order is paid${PAID_WHERE}; 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: another order of the stay (another party, or a corrected guest name or contact) takes a new offer. cancel_order cancels or closes an order; for changes, or a cancellation it can't make, the user emails ${SUPPORT_EMAIL} with the order's reference.`,
2417
2427
  // Destructive: Claude's connector review asks `destructiveHint: true`
2418
2428
  // "for tools that modify or delete data", and a per-call confirmation
2419
2429
  // before an order is created is the behaviour wanted. Idempotent: the
@@ -2471,6 +2481,12 @@ var TOOLS = [
2471
2481
  output: order
2472
2482
  }
2473
2483
  ];
2484
+ function toolsFor(options = {}) {
2485
+ if (options.tokenPay !== false) return TOOLS;
2486
+ return TOOLS.filter((tool) => tool.name !== "pay_order").map(
2487
+ (tool) => tool.name === "create_order" ? { ...tool, description: tool.description.replace(PAID_WHERE, PAID_WHERE_WITHOUT_TOKEN) } : tool
2488
+ );
2489
+ }
2474
2490
 
2475
2491
  // src/render/third-party.ts
2476
2492
  var INVISIBLE = /[\p{Default_Ignorable_Code_Point}\ufff9-\ufffb]/gu;
@@ -2791,6 +2807,7 @@ function mealsWithLabel(m) {
2791
2807
  const text2 = mealsText(m);
2792
2808
  return m.label ? ours`${text2} (labelled ${theirs(m.label.text)})` : text2;
2793
2809
  }
2810
+ var PENALTY_STATUSES = { partial_penalty: "partial penalty now", non_refundable: "non-refundable" };
2794
2811
  function cancellationText(c) {
2795
2812
  const unknown = ours`cancellation terms unknown`;
2796
2813
  if (c.status === "unknown") return unknown;
@@ -2804,11 +2821,7 @@ function cancellationText(c) {
2804
2821
  const head2 = c.freeCancellationEndsAt === null ? ours`free cancellation until check-in` : ours`free cancellation until ${when(c.freeCancellationEndsAt, c.timeZone)}`;
2805
2822
  return steps ? ours`${head2}, then ${steps}` : head2;
2806
2823
  }
2807
- const head = label(
2808
- { partial_penalty: "partial penalty now", non_refundable: "non-refundable" },
2809
- c.status,
2810
- unknown
2811
- );
2824
+ const head = label(PENALTY_STATUSES, c.status, unknown);
2812
2825
  return steps ? ours`${head}: ${steps}` : head;
2813
2826
  }
2814
2827
  var BASES = {
@@ -2872,6 +2885,23 @@ function offerLine(o) {
2872
2885
  " \xB7 "
2873
2886
  );
2874
2887
  }
2888
+ function breakfastUnknown(m) {
2889
+ if (!m.known || m.included === null) return true;
2890
+ return !m.allInclusive && !m.included.includes("breakfast") && m.unspecifiedMainMeals !== 0;
2891
+ }
2892
+ function unknownTermLines(offers) {
2893
+ const n = offers.length;
2894
+ const mixed = (unknown) => {
2895
+ const k = offers.filter(unknown).length;
2896
+ return k > 0 && k < n ? k : null;
2897
+ };
2898
+ const meals2 = mixed((o) => breakfastUnknown(o.meals));
2899
+ const cancellation2 = mixed((o) => o.cancellation.status !== "free" && !Object.hasOwn(PENALTY_STATUSES, o.cancellation.status));
2900
+ return [
2901
+ meals2 !== null && ours`Unknown: the meals of ${num(meals2)} of these ${plural(n, "offer")}. A statement about the meals of every one of them (that none includes breakfast, that all are room only) is not known to be true: make it only about the offers that state their meals.`,
2902
+ cancellation2 !== null && ours`Unknown: the cancellation terms of ${num(cancellation2)} of these ${plural(n, "offer")}. A statement about the cancellation of every one of them (that none is free to cancel, that all are refundable) is not known to be true: make it only about the offers that state their terms.`
2903
+ ].filter((line) => line !== false);
2904
+ }
2875
2905
  var OMITTED = {
2876
2906
  byNationality: "restricted by nationality",
2877
2907
  byFilters: "removed by the filters",
@@ -2925,6 +2955,7 @@ function renderOffers(r, surface = "mcp") {
2925
2955
  for (const h of r.hotels) {
2926
2956
  lines.push(ours``, ours`Hotel: ${named(h.name, h.names)} · ${token("id", h.hotelId)} · ${plural(h.offers.length, "offer")}`);
2927
2957
  h.offers.forEach((o, i) => lines.push(ours`${i + 1}. ${offerLine(o)}`));
2958
+ lines.push(...unknownTermLines(h.offers));
2928
2959
  const omitted2 = omittedText(h.omitted);
2929
2960
  if (omitted2) lines.push(ours`Not shown: ${omitted2}.`);
2930
2961
  const callLimit = callLimitText(h.omitted, r.limitPerHotel, surface);
@@ -3792,12 +3823,21 @@ function renderError(envelope, status, surface = "mcp") {
3792
3823
 
3793
3824
  // src/render/index.ts
3794
3825
  var HOTEL_TOOLS = /* @__PURE__ */ new Set(["search_hotels", "get_hotel", "get_hotel_offers"]);
3795
- function renderToolResult(tool, data, surface = "mcp") {
3796
- const text2 = resultText(tool, data, surface);
3826
+ function renderToolResult(tool, data, surface = "mcp", options = {}) {
3827
+ const text2 = resultText(tool, options.tokenPay === false ? withoutTokenRequest(data) : data, surface);
3797
3828
  return surface === "mcp" && HOTEL_TOOLS.has(tool) ? `${text2}
3798
3829
 
3799
3830
  ${PRESENTATION_HINT}` : text2;
3800
3831
  }
3832
+ function withoutTokenRequest(value) {
3833
+ if (Array.isArray(value)) return value.map(withoutTokenRequest);
3834
+ if (typeof value !== "object" || value === null) return value;
3835
+ const out = {};
3836
+ for (const [key, inner] of Object.entries(value)) {
3837
+ out[key] = key === "payment" && typeof inner === "object" && inner !== null && "tokenRequest" in inner ? { ...inner, tokenRequest: null } : withoutTokenRequest(inner);
3838
+ }
3839
+ return out;
3840
+ }
3801
3841
  var orderPage = openObject({ data: z18.array(z18.unknown()), nextCursor: z18.string().nullable() });
3802
3842
  function resultText(tool, data, surface) {
3803
3843
  const schema = tool === "list_orders" ? orderPage : TOOLS.find((t) => t.name === tool)?.output;
@@ -3941,7 +3981,7 @@ var ME_SCOPES = { email: "email", name: "profile" };
3941
3981
  // package.json
3942
3982
  var package_default = {
3943
3983
  name: "@fortrip/agent-contract",
3944
- version: "6.0.0",
3984
+ version: "6.1.0",
3945
3985
  license: "Apache-2.0",
3946
3986
  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.",
3947
3987
  type: "module",
@@ -4132,6 +4172,7 @@ export {
4132
4172
  text,
4133
4173
  timeZone,
4134
4174
  tokenUsageLimits,
4175
+ toolsFor,
4135
4176
  unknownFieldsMessage,
4136
4177
  wholeNumber
4137
4178
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fortrip/agent-contract",
3
- "version": "6.0.0",
3
+ "version": "6.1.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",