@fortrip/agent-contract 6.0.0-rc.1 → 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/dist/index.d.ts CHANGED
@@ -650,7 +650,7 @@ declare const LIMITS: {
650
650
  declare const CURRENCIES: readonly ["USD", "CNY"];
651
651
  type Currency = (typeof CURRENCIES)[number];
652
652
  /** Where a person goes when an agent gets stuck. */
653
- declare const SUPPORT_EMAIL = "info@fortrip.ai";
653
+ declare const SUPPORT_EMAIL = "support@fortrip.ai";
654
654
 
655
655
  /** A path into an input, as a zod issue has it: keys, and indexes into lists. */
656
656
  type Path = (string | number)[];
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";
@@ -1201,7 +1201,7 @@ If your interface can show rich elements, show each hotel as a card with only wh
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
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",
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
@@ -2791,6 +2791,7 @@ function mealsWithLabel(m) {
2791
2791
  const text2 = mealsText(m);
2792
2792
  return m.label ? ours`${text2} (labelled ${theirs(m.label.text)})` : text2;
2793
2793
  }
2794
+ var PENALTY_STATUSES = { partial_penalty: "partial penalty now", non_refundable: "non-refundable" };
2794
2795
  function cancellationText(c) {
2795
2796
  const unknown = ours`cancellation terms unknown`;
2796
2797
  if (c.status === "unknown") return unknown;
@@ -2804,11 +2805,7 @@ function cancellationText(c) {
2804
2805
  const head2 = c.freeCancellationEndsAt === null ? ours`free cancellation until check-in` : ours`free cancellation until ${when(c.freeCancellationEndsAt, c.timeZone)}`;
2805
2806
  return steps ? ours`${head2}, then ${steps}` : head2;
2806
2807
  }
2807
- const head = label(
2808
- { partial_penalty: "partial penalty now", non_refundable: "non-refundable" },
2809
- c.status,
2810
- unknown
2811
- );
2808
+ const head = label(PENALTY_STATUSES, c.status, unknown);
2812
2809
  return steps ? ours`${head}: ${steps}` : head;
2813
2810
  }
2814
2811
  var BASES = {
@@ -2872,6 +2869,23 @@ function offerLine(o) {
2872
2869
  " \xB7 "
2873
2870
  );
2874
2871
  }
2872
+ function breakfastUnknown(m) {
2873
+ if (!m.known || m.included === null) return true;
2874
+ return !m.allInclusive && !m.included.includes("breakfast") && m.unspecifiedMainMeals !== 0;
2875
+ }
2876
+ function unknownTermLines(offers) {
2877
+ const n = offers.length;
2878
+ const mixed = (unknown) => {
2879
+ const k = offers.filter(unknown).length;
2880
+ return k > 0 && k < n ? k : null;
2881
+ };
2882
+ const meals2 = mixed((o) => breakfastUnknown(o.meals));
2883
+ const cancellation2 = mixed((o) => o.cancellation.status !== "free" && !Object.hasOwn(PENALTY_STATUSES, o.cancellation.status));
2884
+ return [
2885
+ 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.`,
2886
+ 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.`
2887
+ ].filter((line) => line !== false);
2888
+ }
2875
2889
  var OMITTED = {
2876
2890
  byNationality: "restricted by nationality",
2877
2891
  byFilters: "removed by the filters",
@@ -2925,6 +2939,7 @@ function renderOffers(r, surface = "mcp") {
2925
2939
  for (const h of r.hotels) {
2926
2940
  lines.push(ours``, ours`Hotel: ${named(h.name, h.names)} · ${token("id", h.hotelId)} · ${plural(h.offers.length, "offer")}`);
2927
2941
  h.offers.forEach((o, i) => lines.push(ours`${i + 1}. ${offerLine(o)}`));
2942
+ lines.push(...unknownTermLines(h.offers));
2928
2943
  const omitted2 = omittedText(h.omitted);
2929
2944
  if (omitted2) lines.push(ours`Not shown: ${omitted2}.`);
2930
2945
  const callLimit = callLimitText(h.omitted, r.limitPerHotel, surface);
@@ -3941,7 +3956,7 @@ var ME_SCOPES = { email: "email", name: "profile" };
3941
3956
  // package.json
3942
3957
  var package_default = {
3943
3958
  name: "@fortrip/agent-contract",
3944
- version: "6.0.0-rc.1",
3959
+ version: "6.0.1",
3945
3960
  license: "Apache-2.0",
3946
3961
  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
3962
  type: "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fortrip/agent-contract",
3
- "version": "6.0.0-rc.1",
3
+ "version": "6.0.1",
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",