fortrip 3.5.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,65 +27,6 @@ npm install --global fortrip
27
27
  commands, `fortrip <command> --help` one command's flags, and
28
28
  `fortrip --version` prints the version.
29
29
 
30
- ## Upgrading from 2.x
31
-
32
- 3.0 moves the CLI to Fortrip API v1. A 2.x CLI and the 2.x MCP server stop
33
- working when 3.0 is released, so upgrade the CLI and, if you added it, the
34
- hosted MCP server's address (see [MCP server](#mcp-server)).
35
-
36
- - **Sign in again.** The CLI keeps one sign-in per API URL. 2.x saved yours
37
- under `https://fortrip.ai`; 3.0's API is `https://api.fortrip.ai`, so run
38
- `fortrip login` once. The old sign-in is not revoked and is left in the file;
39
- `fortrip logout` removes only the new one.
40
- - **`hotels rates` is now `hotels offers`.** It prices up to 15 hotels with
41
- live, bookable offers. `hotels book` orders an offer by its `offerId`
42
- (`--offer`), and the guests are given per room (`--guest room:first:last`),
43
- instead of by room and rate plan. `hotels search`, `hotels get`, `login`,
44
- `logout`, `whoami`, `guide` and `mcp` keep their names; `orders get` and
45
- `orders list` are new.
46
- - **Flags changed with the API.** Run `fortrip <command> --help` for the flags
47
- of 3.0; these are the 2.x ones that moved.
48
- - Search: `--query` and `--city-code` are replaced by `--place-name` with its
49
- `--country` (or `--place`, `--locality`, `--point`, `--country-only`);
50
- `--text` matches a hotel name, brand or area. `--near` is
51
- `--point lat,lng` with `--radius-meters` (meters, where `--near` took km). `--star-min` and `--star-max`
52
- are `--stars-min` and `--stars-max`, `--facility` is `--amenity` and
53
- `--price-max` is `--price-max-per-room-night`. `--price-min` and the short `-q` are gone.
54
- - Paging: `--page` and `--page-size` are not renamed but replaced. Results
55
- are paged with a cursor: pass the `nextCursor` of the previous page to
56
- `--cursor`, and set the page size with `--limit`. There is no page number.
57
- - Rooms: `--rooms`, `--adults` and `--child-age` are replaced by
58
- `--room <adults[:age,…]>`, once per room, in `hotels search` and
59
- `hotels offers`. `hotels book` no longer takes the stay at all: the offer
60
- carries it.
61
- - `hotels get`: `--with-rooms` is `--rooms`.
62
- - `hotels offers` (was `hotels rates`): `--board` is `--require-breakfast`,
63
- `--free-cancellation` is `--require-free-cancellation`, and `--max-rooms`
64
- (rooms per hotel) is `--limit-per-hotel` (offers per hotel, 5 by default).
65
- `--nationality` and `--include-unbookable` are gone.
66
- - `hotels book`: `--hotel`, `--room-id` and `--rate-plan` are replaced by
67
- `--offer`, the `offerId` from `hotels offers`. `--guest "First Last:2"` is
68
- `--guest 2:First:Last` (room, first name, last name). `--contact-name` is
69
- `--first-name` and `--last-name`, `--contact-phone` is `--phone` and
70
- `--contact-email` is `--email`.
71
- - `--currency` is `--display-currency`, which only changes the currency
72
- prices are shown in: orders are paid in USD.
73
- - Ids are strings (`htl_…`, `off_…`, `ord_…`, `plc_…`) that you pass back as
74
- they were returned.
75
- - **New output.** A result is compact text by default, written for people and
76
- for models; `--json` prints the API's JSON instead (see
77
- [Output and exit codes](#output-and-exit-codes)). 2.x printed JSON.
78
- - **New environment names.** `FORTRIP_CURRENCY` is now
79
- `FORTRIP_DISPLAY_CURRENCY`, and the default `FORTRIP_API_URL` is
80
- `https://api.fortrip.ai`. `FORTRIP_MCP_URL` is new. See
81
- [Environment variables](#environment-variables).
82
- - **MCP.** The hosted MCP server is `https://mcp.fortrip.ai/`; its address on
83
- `fortrip.ai` is retired. `get_hotel_rates` is now `get_hotel_offers`, and
84
- `get_order` and `list_orders` are new.
85
-
86
- Commands of 1.x and earlier that were renamed (`hotel`, `rates`) are answered
87
- with the command to type instead.
88
-
89
30
  ## Sign in
90
31
 
91
32
  ```bash
@@ -15602,7 +15602,7 @@ var FRAGMENTS = {
15602
15602
  "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',
15603
15603
  "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",
15604
15604
  "order": '{{#if claude-skill cli}}\n## Workflow\n\n1. **Search** with `{{tool:hotels search}}` for candidate hotels: a destination, `{{arg:text}}` or both, and the stay\'s dates and rooms for indicative prices.\n{{#if cli}}\n\n ```bash\n {{tool:hotels search}} --place-name Bangkok --country TH --check-in 2026-11-10 \\\n --check-out 2026-11-12 --room 2 --stars-min 4 --sort price_asc --limit 10\n ```\n\n{{/if}}\n2. **Details** (optional) with `{{tool:hotels get}}`, when the user asks about a hotel or a stated preference needs evidence (a pool, a policy, room size). For a details-only question, call it directly when you know the hotel\'s `hotelId`; otherwise find the hotel with `{{tool:hotels search}}`.\n{{#if cli}}\n\n ```bash\n {{tool:hotels get}} <hotelId> [--rooms]\n ```\n\n{{/if}}\n3. **Offers** with `{{tool:hotels offers}}` for a few shortlisted hotels, with the dates and rooms the user will order. It takes about 15 seconds. A hotel is available only once this returns an offer for it.\n{{#if cli}}\n\n ```bash\n {{tool:hotels offers}} --hotel <hotelId> --hotel <hotelId> --check-in 2026-11-10 \\\n --check-out 2026-11-12 --room 2 --room 2 [--require-free-cancellation]\n ```\n\n{{/if}}\n4. **Order** with `{{tool:hotels book}}`, once the user has picked one offer and given the guests and the contact (see Ordering).\n{{#if cli}}\n\n ```bash\n {{tool:hotels book}} --offer <offerId> --guest 1:John:Smith --guest 2:Mary:Smith \\\n --first-name John --last-name Smith --email john@example.com \\\n --phone "+8613800000000"\n ```\n\n{{/if}}\n5. **Confirm, then give the payment link**, as in "Before giving the payment link" below.\n6. **After payment**, check the order with `{{tool:orders get}}` (see After payment).\n\n## Search\n\n### Where\n\n- **A place by name:** {{#if mcp claude-skill}}`{ kind: "place_name", name, countryCode }`{{/if}}{{#if cli}}`--place-name <name> --country <CC>`{{/if}}, in any language (Kyoto or \u4EAC\u90FD). The country is required: ask the user when it isn\'t clear. Names match exactly, ignoring only case and spacing: accents, hyphens, apostrophes and periods count ("K\xF6ln" or "Cologne", not "Koln"; "St. Moritz", not "St Moritz").\n- If several places bear the name, the answer is `destination_ambiguous` with up to {{limit:candidatesShown}} candidates and their hotel counts: ask the user which one they mean, then search it by its `placeId`; never pick one yourself.\n- `destination_not_found` with `no_match` means no place of that name in that country: check the spelling and accents, or try another name for the place. Its `nameAsText` counts the hotels that a `{{arg:text}}` search for the name would find.\n- **A place from an earlier answer:** {{#if mcp claude-skill}}`{ kind: "place", placeId }`{{/if}}{{#if cli}}`--place <placeId>`{{/if}}.\n- **Near a point:** {{#if mcp claude-skill}}`{ kind: "point", location: { lat, lng } }`{{/if}}{{#if cli}}`--point <lat,lng>`{{/if}}, for "near X" when you know where X is.\n- **A whole country:** {{#if mcp claude-skill}}`{ kind: "country", countryCode }`{{/if}}{{#if cli}}`--country-only <CC>`{{/if}}, as for the Maldives.\n- Countries, regions (states, provinces), prefecture-level cities in China and main islands cover their whole area. Towns, neighbourhoods, districts, small islands and points cover a circle of {{limit:radiusMetersDefault}} meters; `{{arg:destination.radiusMeters}}` sets another, up to {{limit:radiusMetersMax}} meters, and narrows an area to a circle around its center.\n- **Localities:** an area search lists its `localities`, the towns its hotels belong to, each with a `placeId`, its hotel `count` and the places it `includes` (Patong is part of Phuket). To search one, pass it as {{#if mcp claude-skill}}`{ kind: "locality", placeId }`{{/if}}{{#if cli}}`--locality <placeId>`{{/if}}. A town that isn\'t a locality answers `destination_not_found` with `not_a_locality` and the `hub` it belongs to: search the hub, or the town itself with {{#if mcp claude-skill}}`kind: "place"`{{/if}}{{#if cli}}`--place`{{/if}} for a circle around it.\n- A price sort or price filter over more than {{limit:poolLimit}} hotels (in an area, or for text alone) answers `search_too_broad` with `matched` and the top `localities`: show them and ask the user which they prefer, unless the request already names one of them; search that one by its `placeId` as a locality, never by its name.\n\n### Text\n\n`{{arg:text}}` matches exact words in hotel names and addresses, in Chinese or English:\n\n- Every word must match as written: plurals, accents, spacing and abbreviations count ("hostel" and "hostels", "St Regis" and "Saint Regis" find different hotels). Hyphens and apostrophes don\'t (Ritz-Carlton finds Ritz Carlton).\n- In Chinese, matching follows word segmentation, so part of a name can match unrelated hotels (\u5E0C\u5C14 is not \u5E0C\u5C14\u987F).\n- Use only distinctive words: a hotel or brand name, a district or a landmark. Not "hotel", "near", "cheap" or "best".\n- Typos return nothing: "Shangahi" finds no hotel.\n- Place names belong in the destination: "Maldives" as text finds a hotel named Maldives in China.\n\n### Filters\n\n- Stars run from 1 to 5 in half steps{{#if mcp claude-skill}} (`filters.stars`){{/if}}. "4 stars" as {{#if mcp claude-skill}}`{ min: 4, max: 4 }`{{/if}}{{#if cli}}`--stars-min 4 --stars-max 4`{{/if}} leaves out 4.5: unless the user means exactly 4, use {{#if mcp claude-skill}}`{ min: 4 }`{{/if}}{{#if cli}}`--stars-min 4`{{/if}} or ask. Unrated hotels are left out whenever stars are filtered.\n- `{{arg:filters.amenities}}` takes only the amenities that can filter (such as pool, parking, wifi); others, such as gym or spa, show in `{{tool:hotels get}}` but can\'t filter. A hotel matches only when it lists the amenity, and about half the hotels list no amenities at all (`coverage.excludedNoFacilityData` counts those left out): "not listed" is not "absent".\n- `{{arg:filters.price.maxPerRoomNight}}` bounds the indicative price per room per night, in USD; hotels without one are left out and counted.\n\n### Results\n\n- `notes` explain the answer (a limited pool, a circle around an island, more hotels just outside it): pass on what matters to the user.\n- `coverage` has the counts: `matched` hotels, how many were priced and how many have a price.\n- A next page is {{#if mcp claude-skill}}`cursor` set to `nextCursor` and, optionally, `limit`{{/if}}{{#if cli}}`--cursor <nextCursor>` and, optionally, `--limit`{{/if}}; nothing else.\n{{/if}}\n{{#if mcp}}\n- A place name needs its `countryCode` (ask the user if unclear) and matches exactly (accents and periods count). On `destination_ambiguous`, ask the user which they mean, then search its `placeId`; never pick one yourself.\n- On `search_too_broad`, show its `localities` and ask the user which, unless they already named one; search it as `{ kind: "locality", placeId }`, never by name.\n- `text` matches whole words of hotel names and addresses: use a distinctive name, brand or landmark. A typo finds nothing.\n{{/if}}\n',
15605
- "payment-link": "{{#if claude-skill cli}}\n## Before giving the payment link\n\n`{{tool:hotels book}}` answers with an unpaid order: `status` `awaiting_payment`, its `reference` (the support number), `price.total`, the stay and its terms, and `payment.url`, a Fortrip page that recaps the order and continues to payment on Stripe. Nothing is charged until the user pays.\n\n1. Show the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation (status, deadline, penalties) and fees payable at the property, unknowns included.\n2. End that reply by asking the user to confirm, and wait for a clear yes. Urgency is not consent.\n3. Then give `payment.url` exactly as returned: don't shorten, rebuild or re-encode it.\n\n{{/if}}\n{{#if mcp}}\n- Before you give `payment.url`, show the user the order's total and currency, the stay and every term, end that reply by asking the user to confirm, and wait for a clear yes. Then give `payment.url` exactly as returned, to this user only: anyone holding it can pay.\n{{/if}}\n{{#if claude-skill cli}}\n- `payment.url` works like a payment credential: anyone holding it can pay. Give it to this user only, never in shared channels, documents, logs or tickets. With `requiresSignIn: true` (an order started on the Fortrip website), the user signs in to pay.\n- The link expires at `payment.expiresAt`; the order is then `expired`. To order the stay again, get offers again, and confirm the new order with the user before giving its link.\n- Another order of the stay (another party, or a corrected guest name) needs a new offer: get offers again. When it replaces an unpaid order, tell the user to pay only the new link; the earlier one expires unpaid.\n- An order `awaiting_payment` whose `payment.url` is null had its link unreadable this time: read it again with `{{tool:orders get}}`.\n{{/if}}\n- Never ask for, accept or pass on payment card details; payment happens only through Stripe.{{#if claude-skill cli}} A card number in a guest name, the contact or the special requests is rejected{{#if cli}} with exit 2{{/if}}.{{/if}}\n{{#if claude-skill cli}}\n\n## Paying without the link\n\nAn order with `payment.handlers` can also be paid with a Stripe shared payment token that the user's wallet (Link) grants for it, through `{{tool:orders pay}}`:\n\n1. Show and ask exactly as before giving the payment link, and wait for a clear yes. The token comes from the user's wallet, never from card details.\n2. Request the token from the user's wallet with the handler's `config.business_profile` and `payment.credentialLimits`: `maxAmount` (in cents), `currency` and `expiresAt`.\n3. {{#if claude-skill}}Call{{/if}}{{#if cli}}Run{{/if}} `{{tool:orders pay}}` with the token and the order's `price.total`{{#if cli}} (`--token`, `--total`){{/if}}{{#if claude-skill}}, the token as `sharedPaymentToken` or in UCP's `payment.instruments`{{/if}}. The order is then `confirming`, its payment `authorized`: check it as after payment.\n\nThe charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: once `{{tool:orders pay}}` succeeds, `payment.url` stops working; a payment that fails leaves the link open. `payment_total_changed` means the total changed: show the new total and ask again, for a new token. `payment_declined`: the user picks another payment method in their wallet, or pays by link. `payment_action_required`: the card needs a verification this can't give: pay by link. `payment_credential_invalid`: request a new token with the order's `payment.credentialLimits`. `service_unavailable`: call `{{tool:orders pay}}` again with the same token, never a new one. A token pays one order only.\n\n## After payment\n\nCheck the order with `{{tool:orders get}}`:\n\n- `confirming` while the hotel confirms, then `confirmed` with the hotel's `confirmationNumber`.\n- `failed`: no stay was booked; `payment.status` says whether the payment was released or refunded.\n- `needs_attention`: Fortrip is looking into it; the user can email {{support}} with the `reference`.\n- `manageUrl` is the user's own page for the order.\n{{/if}}\n",
15605
+ "payment-link": "{{#if claude-skill cli}}\n## Before giving the payment link\n\n`{{tool:hotels book}}` answers with an unpaid order: `status` `awaiting_payment`, its `reference` (the support number), `price.total`, the stay and its terms, and `payment.url`, a Fortrip page that recaps the order and continues to payment on Stripe. Nothing is charged until the user pays.\n\n1. Show the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation (status, deadline, penalties) and fees payable at the property, unknowns included.\n2. End that reply by asking the user to confirm, and wait for a clear yes. Urgency is not consent.\n3. Then give `payment.url` exactly as returned: don't shorten, rebuild or re-encode it.\n\n{{/if}}\n{{#if mcp}}\n- Before you give `payment.url`, show the user the order's total and currency, the stay and every term, end that reply by asking the user to confirm, and wait for a clear yes. Then give `payment.url` exactly as returned, to this user only: anyone holding it can pay.\n{{/if}}\n{{#if claude-skill cli}}\n- `payment.url` works like a payment credential: anyone holding it can pay. Give it to this user only, never in shared channels, documents, logs or tickets. With `requiresSignIn: true` (an order started on the Fortrip website), the user signs in to pay.\n- The link expires at `payment.expiresAt`; the order is then `expired`. To order the stay again, get offers again, and confirm the new order with the user before giving its link.\n- Another order of the stay (another party, or a corrected guest name) needs a new offer: get offers again. When it replaces an unpaid order, tell the user to pay only the new link; the earlier one expires unpaid.\n- An order `awaiting_payment` whose `payment.url` is null had its link unreadable this time: read it again with `{{tool:orders get}}`.\n{{/if}}\n- Never ask for, accept or pass on payment card details; payment happens only through Stripe.{{#if claude-skill cli}} A card number in a guest name, the contact or the special requests is rejected{{#if cli}} with exit 2{{/if}}.{{/if}}\n{{#if claude-skill cli}}\n\n## Paying without the link\n\nAn order whose `payment.handlers` isn't empty can also be paid with a Stripe shared payment token that the user's wallet (Link) grants for it, through `{{tool:orders pay}}`:\n\n1. Show and ask exactly as before giving the payment link, and wait for a clear yes. The token comes from the user's wallet, never from card details.\n2. Request the token from the user's wallet with the handler's `config.business_profile` and `payment.credentialLimits`: `maxAmount` (in cents), `currency` and `expiresAt`.\n3. {{#if claude-skill}}Call{{/if}}{{#if cli}}Run{{/if}} `{{tool:orders pay}}` with the token and the order's `price.total`{{#if cli}} (`--token`, `--total`){{/if}}{{#if claude-skill}}, the token as `sharedPaymentToken` or in UCP's `payment.instruments`{{/if}}. The order is then `confirming`, its payment `authorized`: check it as after payment.\n\nThe charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: once `{{tool:orders pay}}` succeeds, `payment.url` stops working; a payment that fails leaves the link open. `payment_total_changed` means the total changed: show the new total and ask again, for a new token. `payment_declined`: the user picks another payment method in their wallet, or pays by link. `payment_action_required`: the card needs a verification this can't give: pay by link. `payment_credential_invalid`: request a new token with the order's `payment.credentialLimits`. `service_unavailable`: call `{{tool:orders pay}}` again with the same token, never a new one. A token pays one order only.\n\n## After payment\n\nCheck the order with `{{tool:orders get}}`:\n\n- `confirming` while the hotel confirms, then `confirmed` with the hotel's `confirmationNumber`.\n- `failed`: no stay was booked; `payment.status` says whether the payment was released or refunded.\n- `needs_attention`: Fortrip is looking into it; the user can email {{support}} with the `reference`.\n- `manageUrl` is the user's own page for the order.\n{{/if}}\n",
15606
15606
  "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",
15607
15607
  "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",
15608
15608
  "prices": "{{#if claude-skill cli}}\n## Prices and currency\n\n- A search price (`price.fromPerRoomNight`) is indicative and not bookable: the lowest price of one unit (a room or, at a hostel, possibly a bed) per night, for any party and often any date, and it can be well above or below the offers. Call it an estimate, quote `{{tool:hotels offers}}` prices, and never call a search result available or bookable. `price: null` means there is no indicative price, not that the hotel is full; about half the hotels have none for given dates.\n{{/if}}\n{{#if mcp}}\n- Search prices are indicative, not bookable: quote `{{tool:hotels offers}}` prices.\n{{/if}}\n- {{#if claude-skill cli}}In an offer or order, {{/if}}`price.total` is the whole stay for all rooms and is what is charged, in USD for offers and the orders made from them.{{#if claude-skill cli}} `perNightAllRooms` is the total per night; to compare with a per-room budget, also divide by the rooms.{{/if}} Stripe's page may let the user pay in their card's local currency at Stripe's rate (Adaptive Pricing){{#if claude-skill cli}}: say so plainly, and that the USD total is the price{{/if}}. `approx`{{#if claude-skill cli}}, in `{{arg:displayCurrency}}`, with its `rateDate`,{{/if}} is an estimate, never the charge.\n{{#if claude-skill cli}}\n- `{{arg:displayCurrency}}`{{#if cli}} (or `FORTRIP_DISPLAY_CURRENCY`){{/if}} is `USD` or `CNY`: `CNY` adds `approx` in yuan to suit a user who thinks in it. It never changes the charge.\n- Fees payable at the property (`payAtProperty`) are separate, in the property's own currency, not converted.\n- After payment, `payment.localCharge` is what the card paid in its own currency. Orders made on the Fortrip website can be charged in another currency: `payment.chargeCurrency` says which.\n{{/if}}\n",
@@ -15876,8 +15876,8 @@ var hotelSummary = openObject({
15876
15876
  timeZone: external_exports.string().nullable(),
15877
15877
  distanceMeters: external_exports.number().nullable(),
15878
15878
  price: indicativePrice.nullable(),
15879
- /** The cover photo; `null` without one. Absent from servers before 3.1. */
15880
- photo: photo.nullable().optional()
15879
+ /** The cover photo; `null` without one. */
15880
+ photo: photo.nullable()
15881
15881
  });
15882
15882
  var localities = openObject({
15883
15883
  items: external_exports.array(
@@ -15997,8 +15997,8 @@ var hotel = openObject({
15997
15997
  timeZone: external_exports.string().nullable(),
15998
15998
  description: knownLocaleText.nullable(),
15999
15999
  /** Up to 8 hotel photos, the cover first; `null` when the catalogue lists
16000
- * none (unknown is not no). Absent from servers before 3.1. */
16001
- photos: external_exports.array(photo).nullable().optional(),
16000
+ * none (unknown is not no). */
16001
+ photos: external_exports.array(photo).nullable(),
16002
16002
  checkInTimes: timeRange,
16003
16003
  checkOutTimes: timeRange,
16004
16004
  policies: openObject({
@@ -16173,10 +16173,14 @@ var paymentHandler = openObject({
16173
16173
  type: external_exports.string(),
16174
16174
  version: external_exports.string(),
16175
16175
  spec: external_exports.string(),
16176
- schema: external_exports.string().optional(),
16177
- available_instruments: external_exports.array(openObject({ type: external_exports.string(), config: protocolObject().optional() })).optional(),
16178
- config: protocolObject().optional(),
16179
- networkId: external_exports.string().nullable()
16176
+ schema: external_exports.string(),
16177
+ available_instruments: external_exports.array(
16178
+ openObject({ type: external_exports.string(), config: protocolObject().optional() })
16179
+ ),
16180
+ config: openObject({
16181
+ environment: openEnum(["livemode", "testmode"]),
16182
+ business_profile: external_exports.string()
16183
+ })
16180
16184
  });
16181
16185
  var orderReference = external_exports.string().regex(/^FT-[2-9A-HJ-NP-Z]{6}$/);
16182
16186
  var hotelItem = openObject({
@@ -16216,29 +16220,28 @@ var order = openObject({
16216
16220
  localCurrencyAtCheckout: external_exports.boolean(),
16217
16221
  localCharge: money.nullable(),
16218
16222
  /** The ways to pay other than `url`, while the order can be paid that
16219
- * way (3.4): a `com.stripe.payments` handler takes a shared payment
16220
- * token through `pay_order`. Absent when there is none. */
16221
- handlers: external_exports.array(paymentHandler).optional(),
16222
- /** What a payment credential for `pay_order` must allow, present with
16223
- * `handlers` (3.4): `maxAmount` in minor units (cents) of `currency`,
16223
+ * way: a `com.stripe.payments` handler takes a shared payment token
16224
+ * through `pay_order`. Empty when there is none. */
16225
+ handlers: external_exports.array(paymentHandler),
16226
+ /** What a payment credential for `pay_order` must allow, with
16227
+ * `handlers`: `maxAmount` in minor units (cents) of `currency`,
16224
16228
  * lowercase as Stripe takes it, and `expiresAt`, past which the order
16225
- * can't be paid. */
16229
+ * can't be paid. `null` when `handlers` is empty. */
16226
16230
  credentialLimits: openObject({
16227
16231
  maxAmount: external_exports.number().int(),
16228
16232
  currency: external_exports.string(),
16229
16233
  expiresAt: instant
16230
- }).optional()
16234
+ }).nullable()
16231
16235
  }),
16232
16236
  /** Whether the user can cancel the order now and, when they can, its
16233
16237
  * penalty under the accepted terms (read a minute ahead) and the refund,
16234
- * what was paid less the penalty, both in the charge currency. Absent
16235
- * from servers before 3.3. */
16238
+ * what was paid less the penalty, both in the charge currency. */
16236
16239
  cancel: openObject({
16237
16240
  available: external_exports.boolean(),
16238
16241
  reason: openEnum(CANCEL_REASONS),
16239
16242
  penalty: money.nullable(),
16240
16243
  refund: money.nullable()
16241
- }).optional(),
16244
+ }),
16242
16245
  manageUrl: external_exports.string()
16243
16246
  });
16244
16247
  var orderList = openObject({
@@ -16264,7 +16267,7 @@ var offerChange = openUnion("field", [
16264
16267
  // ../contract/src/tools.ts
16265
16268
  var ORDER_NEXT_STEP = "Before you give the user an order's payment.url, show them its total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term (meals, cancellation, fees payable at the property), then end your reply by asking them to confirm, and wait for a clear yes. Only after they say yes, give them payment.url exactly as returned.";
16266
16269
  var CANCEL_NEXT_STEP = "Before you call cancel_order, show the user the order's stay (hotel, dates), cancel.penalty and cancel.refund (amount and currency), then end your reply by asking them to confirm the cancellation, and wait for a clear yes. Pass maximumPenalty exactly as cancel.penalty.amount. Never state a refund the order did not return.";
16267
- var PAY_NEXT_STEP = "To pay without the link, when the order has payment.handlers and the user's wallet can grant a Stripe shared payment token: first show and ask exactly as for payment.url, and wait for a clear yes. Then request the token for this order from the user's wallet with the handler's config.business_profile and payment.credentialLimits (maxAmount in cents, currency, expiresAt), and call pay_order with it and the order's price.total. The charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: once pay_order succeeds, payment.url stops working.";
16270
+ var PAY_NEXT_STEP = "To pay without the link, when the order's payment.handlers isn't empty and the user's wallet can grant a Stripe shared payment token: first show and ask exactly as for payment.url, and wait for a clear yes. Then request the token for this order from the user's wallet with the handler's config.business_profile and payment.credentialLimits (maxAmount in cents, currency, expiresAt), and call pay_order with it and the order's price.total. The charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: once pay_order succeeds, payment.url stops working.";
16268
16271
  var nextStep = external_exports.string().optional().describe(
16269
16272
  "What to show and ask before giving a payment.url. Present when the answer holds a non-null payment.url, and only then."
16270
16273
  );
@@ -16360,7 +16363,7 @@ var TOOLS = [
16360
16363
  {
16361
16364
  name: "pay_order",
16362
16365
  title: "Pay order with a shared payment token",
16363
- description: "Pay an order awaiting payment without its link, with a Stripe shared payment token, when the order has payment.handlers. First show and ask exactly as for payment.url, and wait for a clear yes. Then request the token from the user's wallet with the handler's config.business_profile and payment.credentialLimits, and pass it with the order's price.total. The charge is in USD. Once it succeeds, payment.url stops working; a payment that fails leaves the link open. Answers the order: status confirming, the payment authorized (held, charged once the hotel confirms); poll get_order. payment_total_changed: show details.total and ask again, for a new token. payment_declined: the user picks another payment method in their wallet, or pays by link. payment_action_required: the card needs verification; pay by link. payment_credential_invalid: request a new token. service_unavailable: call pay_order again with the same token, never a new one. A token pays one order only; the same token again answers as before.",
16366
+ description: "Pay an order awaiting payment without its link, with a Stripe shared payment token, when the order's payment.handlers isn't empty. First show and ask exactly as for payment.url, and wait for a clear yes. Then request the token from the user's wallet with the handler's config.business_profile and payment.credentialLimits, and pass it with the order's price.total. The charge is in USD. Once it succeeds, payment.url stops working; a payment that fails leaves the link open. Answers the order: status confirming, the payment authorized (held, charged once the hotel confirms); poll get_order. payment_total_changed: show details.total and ask again, for a new token. payment_declined: the user picks another payment method in their wallet, or pays by link. payment_action_required: the card needs verification; pay by link. payment_credential_invalid: request a new token. service_unavailable: call pay_order again with the same token, never a new one. A token pays one order only; the same token again answers as before.",
16364
16367
  annotations: {
16365
16368
  readOnlyHint: false,
16366
16369
  idempotentHint: true,
@@ -16478,9 +16481,8 @@ var ERROR_DETAILS = {
16478
16481
  matched: count2,
16479
16482
  poolLimit: count2,
16480
16483
  localities,
16481
- /** The searched area's center, as a search echoes it; null for text only.
16482
- * Optional for clients; the server must send it (`SERVER_DETAILS`). */
16483
- center: center.nullable().optional()
16484
+ /** The searched area's center, as a search echoes it; null for text only. */
16485
+ center: center.nullable()
16484
16486
  }),
16485
16487
  stay_unsupported: openUnion("reason", [
16486
16488
  openObject({ reason: external_exports.literal("mixed_occupancy") }),
@@ -16512,29 +16514,23 @@ var ERROR_DETAILS = {
16512
16514
  }),
16513
16515
  internal: null
16514
16516
  };
16515
- var SERVER_DETAILS = {
16516
- search_too_broad: ERROR_DETAILS.search_too_broad.extend({ center: center.nullable() })
16517
- };
16518
- function envelopeSchema(detailsRequired) {
16519
- return openObject({
16520
- error: openUnion(
16521
- "code",
16522
- Object.keys(ERROR_CODES).map((code) => {
16523
- const details = detailsRequired ? SERVER_DETAILS[code] ?? ERROR_DETAILS[code] : ERROR_DETAILS[code];
16524
- return openObject({
16525
- code: external_exports.literal(code),
16526
- message: external_exports.string(),
16527
- param: external_exports.string().optional(),
16528
- retryable: external_exports.boolean(),
16529
- retryAfterSeconds: external_exports.number().int().optional(),
16530
- ...details ? { details: detailsRequired ? details : details.optional() } : {},
16531
- requestId: external_exports.string()
16532
- });
16533
- })
16534
- )
16535
- });
16536
- }
16537
- var errorEnvelope = envelopeSchema(false);
16517
+ var errorEnvelope = openObject({
16518
+ error: openUnion(
16519
+ "code",
16520
+ Object.keys(ERROR_CODES).map((code) => {
16521
+ const details = ERROR_DETAILS[code];
16522
+ return openObject({
16523
+ code: external_exports.literal(code),
16524
+ message: external_exports.string(),
16525
+ param: external_exports.string().optional(),
16526
+ retryable: external_exports.boolean(),
16527
+ retryAfterSeconds: external_exports.number().int().optional(),
16528
+ ...details ? { details } : {},
16529
+ requestId: external_exports.string()
16530
+ });
16531
+ })
16532
+ )
16533
+ });
16538
16534
 
16539
16535
  // ../contract/src/render/format.ts
16540
16536
  function num(n) {
@@ -16818,17 +16814,15 @@ function paymentLines(o) {
16818
16814
  } else if (o.status === "awaiting_payment") {
16819
16815
  lines.push("Payment link: could not be read this time; read this order again for it.");
16820
16816
  }
16821
- if (p.handlers?.length) lines.push(handlersLine(p.handlers, p.credentialLimits));
16822
- if (o.cancel) lines.push(cancelLine(o.cancel));
16817
+ if (p.handlers.length > 0) lines.push(handlersLine(p.handlers, p.credentialLimits));
16818
+ lines.push(cancelLine(o.cancel));
16823
16819
  lines.push(`Manage: ${o.manageUrl}`);
16824
16820
  return lines;
16825
16821
  }
16826
16822
  function handlersLine(handlers, limits) {
16827
- const shown = handlers.map((h) => {
16828
- const profile = h.config?.business_profile;
16829
- const businessProfile = typeof profile === "string" ? profile : h.networkId;
16830
- return `${h.type} (handler ${h.id}${businessProfile ? `, business_profile ${businessProfile}` : ""})`;
16831
- });
16823
+ const shown = handlers.map(
16824
+ (h) => `${h.type} (handler ${h.id}, business_profile ${h.config.business_profile})`
16825
+ );
16832
16826
  const limit = limits ? `; token limits: maxAmount ${limits.maxAmount} (cents), currency ${limits.currency}, expiresAt ${limits.expiresAt}` : "";
16833
16827
  return `Pay without the link: pay_order with a shared payment token via ${shown.join(", ")}${limit}`;
16834
16828
  }
@@ -17131,7 +17125,7 @@ function notFound(d) {
17131
17125
  }
17132
17126
  }
17133
17127
  function detailLines(e) {
17134
- if (!("details" in e) || e.details === void 0) return [];
17128
+ if (!("details" in e)) return [];
17135
17129
  switch (e.code) {
17136
17130
  case "invalid_request": {
17137
17131
  const d = e.details;
@@ -17386,15 +17380,15 @@ function withConsent(tool, text2, orders) {
17386
17380
  return [
17387
17381
  text2,
17388
17382
  orders.some((o) => o.payment.url !== null) ? ORDER_NEXT_STEP : "",
17389
- orders.some((o) => (o.payment.handlers?.length ?? 0) > 0) ? PAY_NEXT_STEP : "",
17390
- CANCEL_TOOLS.has(tool) && orders.some((o) => o.cancel?.available === true) ? CANCEL_NEXT_STEP : ""
17383
+ orders.some((o) => o.payment.handlers.length > 0) ? PAY_NEXT_STEP : "",
17384
+ CANCEL_TOOLS.has(tool) && orders.some((o) => o.cancel.available) ? CANCEL_NEXT_STEP : ""
17391
17385
  ].filter(Boolean).join("\n\n");
17392
17386
  }
17393
17387
 
17394
17388
  // ../contract/package.json
17395
17389
  var package_default = {
17396
17390
  name: "@fortrip/agent-contract",
17397
- version: "3.5.0",
17391
+ version: "4.0.0",
17398
17392
  license: "Apache-2.0",
17399
17393
  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.",
17400
17394
  type: "module",
@@ -17524,8 +17518,6 @@ function localCode(failure) {
17524
17518
  return "invalid_request";
17525
17519
  case EXIT.unauthenticated:
17526
17520
  return "unauthenticated";
17527
- case EXIT.rateLimited:
17528
- return "rate_limited";
17529
17521
  default:
17530
17522
  return failure.details.retryable === true ? "service_unavailable" : "cli_error";
17531
17523
  }
@@ -17540,11 +17532,13 @@ function formatError2(failure, json2) {
17540
17532
  const inError = (name) => fromApi ? Object.hasOwn(fromApi, name) : ERROR_FIELDS.has(name);
17541
17533
  const own = Object.entries(failure.details);
17542
17534
  if (json2) {
17535
+ const code = localCode(failure);
17543
17536
  const error51 = fromApi ?? {
17544
- code: localCode(failure),
17537
+ code,
17545
17538
  message: failure.message,
17546
17539
  retryable: failure.details.retryable === true,
17547
17540
  requestId: localRequestId(),
17541
+ ...code === "invalid_request" ? { details: { issues: [] } } : {},
17548
17542
  ...Object.fromEntries(own.filter(([n]) => inError(n) && n !== "retryable"))
17549
17543
  };
17550
17544
  return JSON.stringify({ error: error51, ...Object.fromEntries(own.filter(([n]) => !inError(n))), ...notices });
@@ -17683,7 +17677,7 @@ function unwrap(response) {
17683
17677
  const retryAfter = Number(headers.get("retry-after"));
17684
17678
  throw new CliError(`Unexpected ${status} answer from the API`, exitCodeFor(void 0, status), {
17685
17679
  status,
17686
- ...status >= 500 ? { retryable: true } : {},
17680
+ ...status >= 500 || status === 429 ? { retryable: true } : {},
17687
17681
  ...Number.isFinite(retryAfter) && retryAfter > 0 ? { retryAfterSeconds: retryAfter } : {},
17688
17682
  ...raw2 ? { raw: raw2 } : {}
17689
17683
  });
@@ -17767,7 +17761,6 @@ function parse3(text2) {
17767
17761
  }
17768
17762
  if (!isObject3(raw2)) return null;
17769
17763
  const { version: version2, sessions, pendingLogins, ...other } = raw2;
17770
- if (version2 === void 0) return emptyCredentials();
17771
17764
  if (version2 !== 2) return null;
17772
17765
  const credentials = { sessions: {}, logins: {}, other };
17773
17766
  for (const [apiUrl, session] of Object.entries(isObject3(sessions) ? sessions : {})) {
@@ -18498,6 +18491,7 @@ export {
18498
18491
  commandInvocation,
18499
18492
  GLOBAL_FLAGS,
18500
18493
  renderGuide,
18494
+ order,
18501
18495
  API,
18502
18496
  TOOLS,
18503
18497
  renderError,
package/dist/cli.js CHANGED
@@ -18,6 +18,7 @@ import {
18
18
  login,
19
19
  logout,
20
20
  notices,
21
+ order,
21
22
  renderGuide,
22
23
  renderToolResult,
23
24
  resolveApiUrl,
@@ -25,7 +26,7 @@ import {
25
26
  unwrap,
26
27
  usageError,
27
28
  whoami
28
- } from "./chunk-WG73EDWB.js";
29
+ } from "./chunk-3PTMRDQF.js";
29
30
 
30
31
  // src/commands.ts
31
32
  import { readFileSync } from "fs";
@@ -445,11 +446,6 @@ function globalFlag(name) {
445
446
  var HELP_FLAGS = globalFlag("help");
446
447
  var VERSION_FLAGS = globalFlag("version");
447
448
  var JSON_FLAG = "--json";
448
- var RENAMED = /* @__PURE__ */ new Map([
449
- ["hotel", { group: "hotels", name: "get" }],
450
- ["rates", { group: "hotels", name: "offers" }],
451
- ["hotels rates", { group: "hotels", name: "offers" }]
452
- ]);
453
449
  function findCommand(argv) {
454
450
  const [word, ...afterWord] = argv;
455
451
  const group = COMMAND_GROUPS.find((candidate) => candidate.name === word);
@@ -462,9 +458,8 @@ function findCommand(argv) {
462
458
  (candidate) => candidate.group === group.name && candidate.name === name
463
459
  );
464
460
  if (!spec2) {
465
- const renamed2 = RENAMED.get(`${group.name} ${name}`);
466
461
  throw usageError(
467
- renamed2 ? `Unknown command "${group.name} ${name}". Did you mean \`${commandInvocation(renamed2)}\`?` : `Unknown command "${group.name} ${name}". Run \`fortrip ${group.name} --help\`.`
462
+ `Unknown command "${group.name} ${name}". Run \`fortrip ${group.name} --help\`.`
468
463
  );
469
464
  }
470
465
  return { spec: spec2, rest };
@@ -473,11 +468,9 @@ function findCommand(argv) {
473
468
  (candidate) => candidate.group === null && candidate.name === word
474
469
  );
475
470
  if (spec) return { spec, rest: afterWord };
476
- const renamed = RENAMED.get(word ?? "");
477
- const meant = [
478
- ...COMMANDS.filter((candidate) => candidate.group !== null && candidate.name === word),
479
- ...renamed ? [renamed] : []
480
- ].map((candidate) => `\`${commandInvocation(candidate)}\``);
471
+ const meant = COMMANDS.filter(
472
+ (candidate) => candidate.group !== null && candidate.name === word
473
+ ).map((candidate) => `\`${commandInvocation(candidate)}\``);
481
474
  throw usageError(
482
475
  meant.length ? `Unknown command "${word}". Did you mean ${meant.join(" or ")}?` : `Unknown command "${word}". Run \`fortrip --help\`.`
483
476
  );
@@ -535,7 +528,7 @@ async function run(argv) {
535
528
  case "mcp": {
536
529
  parseOptions(spec, rest);
537
530
  const mcpUrl = resolveMcpUrl(apiUrl);
538
- const { runMcpBridge } = await import("./mcp-bridge-X3OIXXS4.js");
531
+ const { runMcpBridge } = await import("./mcp-bridge-NK65DPFT.js");
539
532
  await runMcpBridge(mcpUrl, apiUrl);
540
533
  return void 0;
541
534
  }
@@ -543,21 +536,21 @@ async function run(argv) {
543
536
  }
544
537
  const preview = cancelPreview(spec, rest);
545
538
  if (preview) {
546
- const order = unwrap(await authorizedRequest(apiUrl, preview.path, { method: preview.method }));
547
- throw usageError(notCancelled(spec, preview.flag, order));
539
+ const order2 = unwrap(await authorizedRequest(apiUrl, preview.path, { method: preview.method }));
540
+ throw usageError(notCancelled(spec, preview.flag, order2));
548
541
  }
549
542
  const { method, path, body } = parseCommand(spec, rest, process.env);
550
543
  const data = unwrap(await authorizedRequest(apiUrl, path, { method, body }));
551
544
  return { data, text: renderToolResult(spec.tool, data) };
552
545
  }
553
- function notCancelled(spec, flag, order) {
554
- const line = renderToolResult("get_order", order).split("\n").find((text) => text.startsWith("Cancel: "));
555
- const cancel = order?.cancel;
556
- const amount = cancel?.available === true ? cancel.penalty?.amount : void 0;
546
+ function notCancelled(spec, flag, order2) {
547
+ const cancelLine = renderToolResult("get_order", order2).split("\n").filter((text) => text.startsWith("Cancel: "));
548
+ const parsed = order.safeParse(order2);
549
+ const cancel = parsed.success ? parsed.data.cancel : void 0;
557
550
  return [
558
551
  `Not cancelled: ${commandInvocation(spec)} needs ${flag}, the penalty the user agreed to.`,
559
- line ?? "Cancel: not stated for this order.",
560
- ...typeof amount === "string" ? [`Pass ${flag} ${amount} to cancel.`] : []
552
+ ...cancelLine,
553
+ ...cancel?.available && cancel.penalty ? [`Pass ${flag} ${cancel.penalty.amount} to cancel.`] : []
561
554
  ].join("\n");
562
555
  }
563
556
  function account(data) {
@@ -11,7 +11,7 @@ import {
11
11
  renderError,
12
12
  renderGuide,
13
13
  requireToken
14
- } from "./chunk-WG73EDWB.js";
14
+ } from "./chunk-3PTMRDQF.js";
15
15
 
16
16
  // src/mcp-bridge.ts
17
17
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fortrip",
3
- "version": "3.5.0",
3
+ "version": "4.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Search, price and book Fortrip hotels from the terminal or an AI agent.",
6
6
  "mcpName": "io.github.FortripEngineering/fortrip",
@@ -32,7 +32,7 @@
32
32
  "tsx": "^4.20.0",
33
33
  "typescript": "^5.9.0",
34
34
  "zod": "4.4.3",
35
- "@fortrip/agent-contract": "3.5.0"
35
+ "@fortrip/agent-contract": "4.0.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsup",