fortrip 6.0.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -232,9 +232,10 @@ that starts with `local_`.
232
232
 
233
233
  ## Support
234
234
 
235
- A cancellation the CLI can make goes through `fortrip orders cancel`. For
236
- changes, other cancellations, refunds or other help with a booking, email
237
- [info@fortrip.ai](mailto:info@fortrip.ai) with the order's reference. Never
235
+ A cancellation the CLI can make goes through `fortrip orders cancel`. An order
236
+ can't be changed: cancel it under its terms and order again. For other
237
+ cancellations, refunds or other help with a booking, email
238
+ [support@fortrip.ai](mailto:support@fortrip.ai) with the order's reference. Never
238
239
  send the payment link.
239
240
 
240
241
  ## Releasing
@@ -14670,7 +14670,7 @@ var LIMITS = {
14670
14670
  tokensPerOrder: 5
14671
14671
  };
14672
14672
  var CURRENCIES = ["USD", "CNY"];
14673
- var SUPPORT_EMAIL = "info@fortrip.ai";
14673
+ var SUPPORT_EMAIL = "support@fortrip.ai";
14674
14674
 
14675
14675
  // ../contract/src/conventions/money.ts
14676
14676
  var amountError = "amount must be a decimal string such as 132.40";
@@ -15585,7 +15585,7 @@ If your interface can show rich elements, show each hotel as a card with only wh
15585
15585
  "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',
15586
15586
  "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",
15587
15587
  "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",
15588
- "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"
15588
+ "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"
15589
15589
  };
15590
15590
 
15591
15591
  // ../contract/src/guide.ts
@@ -16931,6 +16931,7 @@ function mealsWithLabel(m) {
16931
16931
  const text2 = mealsText(m);
16932
16932
  return m.label ? ours`${text2} (labelled ${theirs(m.label.text)})` : text2;
16933
16933
  }
16934
+ var PENALTY_STATUSES = { partial_penalty: "partial penalty now", non_refundable: "non-refundable" };
16934
16935
  function cancellationText(c) {
16935
16936
  const unknown2 = ours`cancellation terms unknown`;
16936
16937
  if (c.status === "unknown") return unknown2;
@@ -16944,11 +16945,7 @@ function cancellationText(c) {
16944
16945
  const head2 = c.freeCancellationEndsAt === null ? ours`free cancellation until check-in` : ours`free cancellation until ${when(c.freeCancellationEndsAt, c.timeZone)}`;
16945
16946
  return steps ? ours`${head2}, then ${steps}` : head2;
16946
16947
  }
16947
- const head = label(
16948
- { partial_penalty: "partial penalty now", non_refundable: "non-refundable" },
16949
- c.status,
16950
- unknown2
16951
- );
16948
+ const head = label(PENALTY_STATUSES, c.status, unknown2);
16952
16949
  return steps ? ours`${head}: ${steps}` : head;
16953
16950
  }
16954
16951
  var BASES = {
@@ -17012,6 +17009,23 @@ function offerLine(o) {
17012
17009
  " \xB7 "
17013
17010
  );
17014
17011
  }
17012
+ function breakfastUnknown(m) {
17013
+ if (!m.known || m.included === null) return true;
17014
+ return !m.allInclusive && !m.included.includes("breakfast") && m.unspecifiedMainMeals !== 0;
17015
+ }
17016
+ function unknownTermLines(offers) {
17017
+ const n = offers.length;
17018
+ const mixed = (unknown2) => {
17019
+ const k = offers.filter(unknown2).length;
17020
+ return k > 0 && k < n ? k : null;
17021
+ };
17022
+ const meals2 = mixed((o) => breakfastUnknown(o.meals));
17023
+ const cancellation2 = mixed((o) => o.cancellation.status !== "free" && !Object.hasOwn(PENALTY_STATUSES, o.cancellation.status));
17024
+ return [
17025
+ 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.`,
17026
+ 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.`
17027
+ ].filter((line) => line !== false);
17028
+ }
17015
17029
  var OMITTED = {
17016
17030
  byNationality: "restricted by nationality",
17017
17031
  byFilters: "removed by the filters",
@@ -17065,6 +17079,7 @@ function renderOffers(r, surface = "mcp") {
17065
17079
  for (const h of r.hotels) {
17066
17080
  lines.push(ours``, ours`Hotel: ${named(h.name, h.names)} · ${token("id", h.hotelId)} · ${plural(h.offers.length, "offer")}`);
17067
17081
  h.offers.forEach((o, i) => lines.push(ours`${i + 1}. ${offerLine(o)}`));
17082
+ lines.push(...unknownTermLines(h.offers));
17068
17083
  const omitted2 = omittedText(h.omitted);
17069
17084
  if (omitted2) lines.push(ours`Not shown: ${omitted2}.`);
17070
17085
  const callLimit = callLimitText(h.omitted, r.limitPerHotel, surface);
@@ -18170,7 +18185,7 @@ function withRules(text2, surface, applies) {
18170
18185
  // ../contract/package.json
18171
18186
  var package_default = {
18172
18187
  name: "@fortrip/agent-contract",
18173
- version: "6.0.0",
18188
+ version: "6.0.1",
18174
18189
  license: "Apache-2.0",
18175
18190
  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.",
18176
18191
  type: "module",
package/dist/cli.js CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  unwrap,
32
32
  usageError,
33
33
  whoami
34
- } from "./chunk-AL7WAMVL.js";
34
+ } from "./chunk-4SKE4K7Q.js";
35
35
 
36
36
  // src/commands.ts
37
37
  import { readFileSync } from "fs";
@@ -587,7 +587,7 @@ async function run(argv) {
587
587
  case "mcp": {
588
588
  parseOptions(spec, rest);
589
589
  const mcpUrl = resolveMcpUrl(apiUrl);
590
- const { runMcpBridge } = await import("./mcp-bridge-23ZAFBA6.js");
590
+ const { runMcpBridge } = await import("./mcp-bridge-THMWRFFF.js");
591
591
  await runMcpBridge(mcpUrl, apiUrl);
592
592
  return void 0;
593
593
  }
@@ -14,7 +14,7 @@ import {
14
14
  renderError,
15
15
  renderGuide,
16
16
  requireToken
17
- } from "./chunk-AL7WAMVL.js";
17
+ } from "./chunk-4SKE4K7Q.js";
18
18
 
19
19
  // src/mcp-bridge.ts
20
20
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fortrip",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
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": "6.0.0"
35
+ "@fortrip/agent-contract": "6.0.1"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsup",