fortrip 0.1.2 → 0.2.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/AGENT_GUIDE.md CHANGED
@@ -14,6 +14,9 @@ signed-in user and prints JSON.
14
14
 
15
15
  Not for flights, activities, or changing/cancelling an existing booking.
16
16
 
17
+ For flexible dates, a budget, split stays, several destinations or "find me
18
+ the best", also run `npx -y fortrip@latest skill planning` before searching.
19
+
17
20
  ## Setup
18
21
 
19
22
  Run every command as `npx -y fortrip@latest <command>`, the same version that
@@ -73,8 +76,8 @@ token into the chat.
73
76
  [--nationality CN] [--board BB] [--free-cancellation]
74
77
  ```
75
78
 
76
- This call takes about 15 seconds. `totalPrice` is CNY at a fixed exchange
77
- rate. Present each option with meal plan (`boardCode`: RO room only,
79
+ This call takes about 15 seconds. `totalPrice` is CNY at Stripe's exchange
80
+ rate (refreshed hourly). Present each option with meal plan (`boardCode`: RO room only,
78
81
  BB breakfast, HB half board, FB full board, AI all inclusive),
79
82
  `freeCancelUntil` / `refundable`, `isInstantConfirm`, and any `fees`
80
83
  (taxes paid at the hotel, in their own currency).
@@ -105,8 +108,9 @@ token into the chat.
105
108
  `confirmByMins`) and `payAtHotelFees`.
106
109
  2. **Explain the amount.** `rates` showed CNY, but the charge is `amount` in
107
110
  `currency` (usually USD), and the Stripe page may display the user's local
108
- currency at Stripe's rate. The amount on the payment page is what will be
109
- charged; the CNY figure was a reference.
111
+ currency at Stripe's rate. The CNY figure used a Stripe rate too, so it is
112
+ usually close, but the amount on the payment page is what will be charged;
113
+ the CNY figure was a reference.
110
114
  3. The link is for **this user only**: whoever has it can pay. Don't post it
111
115
  in shared channels, logs or tickets. It expires after about 3 hours 45
112
116
  minutes; call `book` again with the same details for a fresh one.
package/README.md CHANGED
@@ -64,6 +64,12 @@ and what to show the user before handing over a payment link. The guide ships
64
64
  with the package, so a CLI release updates every installed skill. Edit
65
65
  `AGENT_GUIDE.md`, not `SKILL.md`.
66
66
 
67
+ `fortrip skill planning` prints [`guides/planning.md`](guides/planning.md):
68
+ what to ask, how to rank and how to present options for flexible dates,
69
+ budgets, split stays and several destinations. Both guides are printed with
70
+ `fortrip@latest` replaced by the running version, so an agent keeps using the
71
+ same CLI for the whole conversation.
72
+
67
73
  ## Development
68
74
 
69
75
  ```bash
package/dist/cli.js CHANGED
@@ -518,8 +518,15 @@ function deviceLabel() {
518
518
 
519
519
  // src/guide.ts
520
520
  import { readFile as readFile2 } from "fs/promises";
521
- function readGuide() {
522
- return readFile2(new URL("../AGENT_GUIDE.md", import.meta.url), "utf8");
521
+ var GUIDES = {
522
+ main: "../AGENT_GUIDE.md",
523
+ planning: "../guides/planning.md"
524
+ };
525
+ async function readGuide(topic = "main") {
526
+ const path = GUIDES[topic];
527
+ if (!path) throw usageError("Usage: fortrip skill [planning]");
528
+ const guide = await readFile2(new URL(path, import.meta.url), "utf8");
529
+ return guide.replaceAll("fortrip@latest", `fortrip@${VERSION}`);
523
530
  }
524
531
 
525
532
  // src/cli.ts
@@ -535,7 +542,7 @@ Commands:
535
542
  hotel <hotelId> Static hotel detail [--with-rooms]
536
543
  rates Live rooms and rates (CNY) for up to 15 hotels
537
544
  book Create an order and get a payment link
538
- skill Print the guide for AI agents (Markdown)
545
+ skill [planning] Print the guide for AI agents (Markdown)
539
546
 
540
547
  search: --query <text> | --city-code <n> | --near <lat,lng,km>
541
548
  --check-in YYYY-MM-DD --check-out YYYY-MM-DD
@@ -573,8 +580,8 @@ async function run(argv) {
573
580
  return void 0;
574
581
  }
575
582
  if (command === "skill") {
576
- parse(rest, {});
577
- process.stdout.write(await readGuide());
583
+ const { positionals } = parse(rest, {});
584
+ process.stdout.write(await readGuide(positionals.join(" ") || void 0));
578
585
  return void 0;
579
586
  }
580
587
  const apiUrl = resolveApiUrl();
@@ -0,0 +1,54 @@
1
+ # Planning a hotel stay
2
+
3
+ Read this when the request is more than one hotel for fixed dates: flexible
4
+ dates, a budget, split stays, several destinations, or "find me the best".
5
+ Commands, login and the booking checklist are in `fortrip skill`; this covers
6
+ what to ask, how to compare and how to present. As there, `fortrip` is short
7
+ for `npx -y fortrip@latest`.
8
+
9
+ ## What to collect
10
+
11
+ Keep track of: dates (or the flexible window), nights, destination(s), guests
12
+ and rooms, room constraints (beds, connecting rooms, accessibility), budget,
13
+ and what the user said matters most (cheapest, most flexible, closest to X).
14
+
15
+ Ask only for what changes which hotels qualify or how they rank. If children
16
+ come along, ask each child's age; `rates` and `book` need it. Don't ask for
17
+ trip type or style: infer it from the conversation or leave it general.
18
+
19
+ ## Evidence
20
+
21
+ - A `search` price is a floor. Never call a search result available or
22
+ bookable.
23
+ - Use `hotel` only when a stated preference needs evidence (a pool, a
24
+ policy, room size).
25
+ - A hotel is available only once `rates` returned a live option for it.
26
+ - Anything the CLI didn't return, such as reviews, style, price trends or
27
+ exchange rates, is unknown. Say so instead of filling it in.
28
+
29
+ ## Ranking
30
+
31
+ 1. Drop options that break a hard constraint (dates, guests, budget cap,
32
+ required facility).
33
+ 2. Keep only options with a live rate.
34
+ 3. Order by the user's stated main goal. Goals they didn't state don't count.
35
+ 4. Use other preferences only to break ties.
36
+
37
+ Use the cheapest comparable live room as the baseline unless the user fixed
38
+ the room type. Show at most three plans, each with its price difference from
39
+ the baseline and what it trades off (meal plan, cancellation, location,
40
+ instant confirmation). Keep hotel names as returned and dates in the user's
41
+ notation.
42
+
43
+ For a split stay or several destinations, price each leg with its own
44
+ `rates` call and add up the legs. Each leg is a separate `book` call and a
45
+ separate payment link.
46
+
47
+ ## Stop and say so
48
+
49
+ - `rates` covers up to 15 hotels per call and takes about 15 seconds. If the
50
+ request needs more hotels or date combinations than a few calls can cover,
51
+ narrow it with the user, or present the result as a comparison of the
52
+ hotels you priced, not the best overall.
53
+ - Urgency is not consent: create a payment link only after the user picked a
54
+ rate and confirmed its terms.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fortrip",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Search, price and book Fortrip hotels from the terminal or an AI agent.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,6 +9,7 @@
9
9
  "files": [
10
10
  "dist",
11
11
  "skills",
12
+ "guides",
12
13
  "AGENT_GUIDE.md",
13
14
  "README.md"
14
15
  ],
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: fortrip-hotels
3
- description: Search hotels, compare live room rates and create a hotel booking with a payment link through Fortrip. Use when the user wants to find, price or book a hotel stay for specific dates, or asks for a hotel payment link.
3
+ description: Search hotels, compare live room rates and create a hotel booking with a payment link through Fortrip. Use when the user wants to find, compare, price or book a hotel stay, including flexible dates, budgets, split stays or several destinations, or asks for a hotel payment link.
4
4
  ---
5
5
 
6
6
  # Fortrip hotels