@curless/hotel-storefront 0.27.5 → 0.27.6

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.
Files changed (105) hide show
  1. package/README.md +18 -8
  2. package/dist/fence.d.ts +12 -1
  3. package/dist/fence.d.ts.map +1 -1
  4. package/dist/fence.js +0 -0
  5. package/dist/fence.js.map +1 -1
  6. package/dist/legal.js +1 -1
  7. package/dist/legal.js.map +1 -1
  8. package/dist/money.d.ts +2 -0
  9. package/dist/money.d.ts.map +1 -1
  10. package/dist/money.js +43 -6
  11. package/dist/money.js.map +1 -1
  12. package/dist/server.d.ts +1 -1
  13. package/dist/server.d.ts.map +1 -1
  14. package/dist/server.js +9 -1
  15. package/dist/server.js.map +1 -1
  16. package/dist/sessions.d.ts.map +1 -1
  17. package/dist/sessions.js +3 -2
  18. package/dist/sessions.js.map +1 -1
  19. package/dist/surface.d.ts +2 -0
  20. package/dist/surface.d.ts.map +1 -1
  21. package/dist/surface.js +10 -1
  22. package/dist/surface.js.map +1 -1
  23. package/dist/tools.d.ts +4 -4
  24. package/dist/tools.d.ts.map +1 -1
  25. package/dist/tools.js +21 -8
  26. package/dist/tools.js.map +1 -1
  27. package/dist/trip-ids.js +1 -1
  28. package/dist/trip-ids.js.map +1 -1
  29. package/package.json +2 -2
  30. package/dist/__tests__/__fixtures__/huazhu-fake.d.ts +0 -2
  31. package/dist/__tests__/__fixtures__/huazhu-fake.d.ts.map +0 -1
  32. package/dist/__tests__/__fixtures__/huazhu-fake.js +0 -3
  33. package/dist/__tests__/__fixtures__/huazhu-fake.js.map +0 -1
  34. package/dist/__tests__/__helpers__/sessions.d.ts +0 -10
  35. package/dist/__tests__/__helpers__/sessions.d.ts.map +0 -1
  36. package/dist/__tests__/__helpers__/sessions.js +0 -40
  37. package/dist/__tests__/__helpers__/sessions.js.map +0 -1
  38. package/dist/__tests__/audit-p0.test.d.ts +0 -2
  39. package/dist/__tests__/audit-p0.test.d.ts.map +0 -1
  40. package/dist/__tests__/audit-p0.test.js +0 -274
  41. package/dist/__tests__/audit-p0.test.js.map +0 -1
  42. package/dist/__tests__/audit-p2.test.d.ts +0 -2
  43. package/dist/__tests__/audit-p2.test.d.ts.map +0 -1
  44. package/dist/__tests__/audit-p2.test.js +0 -98
  45. package/dist/__tests__/audit-p2.test.js.map +0 -1
  46. package/dist/__tests__/card-contract.test.d.ts +0 -2
  47. package/dist/__tests__/card-contract.test.d.ts.map +0 -1
  48. package/dist/__tests__/card-contract.test.js +0 -282
  49. package/dist/__tests__/card-contract.test.js.map +0 -1
  50. package/dist/__tests__/data.test.d.ts +0 -2
  51. package/dist/__tests__/data.test.d.ts.map +0 -1
  52. package/dist/__tests__/data.test.js +0 -210
  53. package/dist/__tests__/data.test.js.map +0 -1
  54. package/dist/__tests__/dates.test.d.ts +0 -2
  55. package/dist/__tests__/dates.test.d.ts.map +0 -1
  56. package/dist/__tests__/dates.test.js +0 -107
  57. package/dist/__tests__/dates.test.js.map +0 -1
  58. package/dist/__tests__/demo-hotels.test.d.ts +0 -2
  59. package/dist/__tests__/demo-hotels.test.d.ts.map +0 -1
  60. package/dist/__tests__/demo-hotels.test.js +0 -765
  61. package/dist/__tests__/demo-hotels.test.js.map +0 -1
  62. package/dist/__tests__/huazhu-audit.test.d.ts +0 -2
  63. package/dist/__tests__/huazhu-audit.test.d.ts.map +0 -1
  64. package/dist/__tests__/huazhu-audit.test.js +0 -234
  65. package/dist/__tests__/huazhu-audit.test.js.map +0 -1
  66. package/dist/__tests__/huazhu-backend.test.d.ts +0 -2
  67. package/dist/__tests__/huazhu-backend.test.d.ts.map +0 -1
  68. package/dist/__tests__/huazhu-backend.test.js +0 -1326
  69. package/dist/__tests__/huazhu-backend.test.js.map +0 -1
  70. package/dist/__tests__/huazhu-cancel-policy.test.d.ts +0 -2
  71. package/dist/__tests__/huazhu-cancel-policy.test.d.ts.map +0 -1
  72. package/dist/__tests__/huazhu-cancel-policy.test.js +0 -82
  73. package/dist/__tests__/huazhu-cancel-policy.test.js.map +0 -1
  74. package/dist/__tests__/huazhu-sandbox.test.d.ts +0 -2
  75. package/dist/__tests__/huazhu-sandbox.test.d.ts.map +0 -1
  76. package/dist/__tests__/huazhu-sandbox.test.js +0 -195
  77. package/dist/__tests__/huazhu-sandbox.test.js.map +0 -1
  78. package/dist/__tests__/huazhu-sellable.test.d.ts +0 -2
  79. package/dist/__tests__/huazhu-sellable.test.d.ts.map +0 -1
  80. package/dist/__tests__/huazhu-sellable.test.js +0 -192
  81. package/dist/__tests__/huazhu-sellable.test.js.map +0 -1
  82. package/dist/__tests__/present.test.d.ts +0 -2
  83. package/dist/__tests__/present.test.d.ts.map +0 -1
  84. package/dist/__tests__/present.test.js +0 -367
  85. package/dist/__tests__/present.test.js.map +0 -1
  86. package/dist/__tests__/prose.test.d.ts +0 -2
  87. package/dist/__tests__/prose.test.d.ts.map +0 -1
  88. package/dist/__tests__/prose.test.js +0 -171
  89. package/dist/__tests__/prose.test.js.map +0 -1
  90. package/dist/__tests__/server.test.d.ts +0 -2
  91. package/dist/__tests__/server.test.d.ts.map +0 -1
  92. package/dist/__tests__/server.test.js +0 -557
  93. package/dist/__tests__/server.test.js.map +0 -1
  94. package/dist/__tests__/state.test.d.ts +0 -2
  95. package/dist/__tests__/state.test.d.ts.map +0 -1
  96. package/dist/__tests__/state.test.js +0 -204
  97. package/dist/__tests__/state.test.js.map +0 -1
  98. package/dist/__tests__/tool-descriptions.test.d.ts +0 -2
  99. package/dist/__tests__/tool-descriptions.test.d.ts.map +0 -1
  100. package/dist/__tests__/tool-descriptions.test.js +0 -220
  101. package/dist/__tests__/tool-descriptions.test.js.map +0 -1
  102. package/dist/__tests__/tools.test.d.ts +0 -2
  103. package/dist/__tests__/tools.test.d.ts.map +0 -1
  104. package/dist/__tests__/tools.test.js +0 -1598
  105. package/dist/__tests__/tools.test.js.map +0 -1
package/dist/tools.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { DEFAULT_PAGE, FULL_CAPABILITIES, LASTING_REQUESTS, MAX_PAGE, REQUEST_KINDS, REQUEST_NOTE_MAX, guestTooLong, unitWords, } from './backend.js';
2
2
  import { MAX_GUESTS, isDay, nights as nightsBetween } from './dates.js';
3
3
  import { FACILITIES } from './facilities.js';
4
- import { DESCRIPTION_MAX, POLICY_MAX, hotelText } from './fence.js';
4
+ import { DESCRIPTION_MAX, POLICY_MAX, guestText, hotelText } from './fence.js';
5
5
  import { formatMoney, money, multiplyMoney, toMinor } from './money.js';
6
6
  import { MAX_COMPARED, MAX_CONS, MAX_DAYS, MAX_ITEMS_PER_DAY, MAX_MOMENTS, MAX_PROS, buildItinerary, compareHotels, } from './present.js';
7
7
  import { regionOf } from './regions.js';
@@ -45,6 +45,18 @@ const edits = (title, openWorld) => ({
45
45
  idempotentHint: true,
46
46
  openWorldHint: openWorld,
47
47
  });
48
+ /**
49
+ * Writes over something that was there - the whole trip, or a booking's nights.
50
+ * Repeating it changes nothing more, but what it replaced is gone (2026-10-05
51
+ * audit, P3: these two said `destructiveHint: false`).
52
+ */
53
+ const replaces = (title, openWorld) => ({
54
+ title,
55
+ readOnlyHint: false,
56
+ destructiveHint: true,
57
+ idempotentHint: true,
58
+ openWorldHint: openWorld,
59
+ });
48
60
  /** Asks the hotel to hold rooms. Takes no money, and undoing it is what the cancel tools are for. */
49
61
  const books = (title, openWorld) => ({
50
62
  title,
@@ -347,7 +359,7 @@ const allTools = (n, v) => {
347
359
  {
348
360
  name: n.clearTrip,
349
361
  description: 'Empties the trip.',
350
- annotations: edits(`Clear the ${v.brand} trip`, open),
362
+ annotations: replaces(`Clear the ${v.brand} trip`, open),
351
363
  inputSchema: { type: 'object', properties: {} },
352
364
  },
353
365
  {
@@ -407,7 +419,7 @@ const allTools = (n, v) => {
407
419
  },
408
420
  {
409
421
  name: n.previewCancellation,
410
- description: 'What cancelling a booking would cost and what would be refunded, with the rule it was worked out from and the free-cancellation deadline where the rate has one. Nothing is cancelled.',
422
+ description: 'What cancelling a booking would cost, with the rule it was worked out from and the free-cancellation deadline where the rate has one. Nothing is cancelled.',
411
423
  annotations: reads('Preview a cancellation', open),
412
424
  inputSchema: {
413
425
  type: 'object',
@@ -427,7 +439,7 @@ const allTools = (n, v) => {
427
439
  // directory attestation covers descriptions that instruct about other
428
440
  // tools. The preview it returns is the same payload the preview tool
429
441
  // returns, which is a fact about THIS tool's answer.
430
- description: 'Cancels a booking. Called without `confirmed` it returns the cancellation preview - the fee, the refund and the rule behind them - and cancels nothing; it cancels only when `confirmed` is true.',
442
+ description: 'Cancels a booking. Called without `confirmed` it returns the cancellation preview - the fee and the rule behind it - and cancels nothing; it cancels only when `confirmed` is true.',
431
443
  annotations: cancels('Cancel a booking', open),
432
444
  inputSchema: {
433
445
  type: 'object',
@@ -493,7 +505,7 @@ const allTools = (n, v) => {
493
505
  {
494
506
  name: n.changeBooking,
495
507
  description: 'Moves a booking to other nights, another room type or a different number of rooms, or sets one of its add-ons (`extra` and `quantity`; 0 takes it off). Called without `confirmed` it returns the same preview - the two stays and the difference - and changes nothing; it changes only when `confirmed` is true. The confirmation code stays the same.',
496
- annotations: edits('Change a booking', open),
508
+ annotations: replaces('Change a booking', open),
497
509
  inputSchema: {
498
510
  type: 'object',
499
511
  properties: {
@@ -1225,7 +1237,7 @@ const requestLines = (b, dropped, checkInFrom) => {
1225
1237
  out.push(`Asked for on the booking: ${words.join(', ')}. The desk meets what it can on the day; none of it is held.`);
1226
1238
  }
1227
1239
  if (r.note)
1228
- out.push(`Passed to the hotel in the guest's words: "${r.note}"`);
1240
+ out.push(`Passed to the hotel:\n${guestText('note for the hotel', r.note, REQUEST_NOTE_MAX)}`);
1229
1241
  if (r.kinds.includes('accessible-room')) {
1230
1242
  out.push(`An accessible room is a room type, and this booking does not hold one - ${b.hotelName} confirms accessible rooms directly, quoting ${b.confirmationCode}.`);
1231
1243
  }
@@ -3068,7 +3080,9 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
3068
3080
  ...common(deps, key),
3069
3081
  booking: { id: preview.bookingId, confirmationCode: preview.confirmationCode },
3070
3082
  fee: formatMoney(preview.fee),
3071
- refund: formatMoney(preview.refund),
3083
+ // ⚠️ NO "REFUND": nothing was ever paid here - a demonstration takes no
3084
+ // money and a hotel's own booking is paid at the hotel - so a figure
3085
+ // called a refund is money that is not coming back (2026-10-05 audit, P3).
3072
3086
  rule: preview.rule,
3073
3087
  freeUntil: preview.freeUntil,
3074
3088
  cancellable: preview.cancellable,
@@ -3122,7 +3136,6 @@ const answerTool = async (deps, name, rawArgs, ctx) => {
3122
3136
  ...common(deps, key),
3123
3137
  booking: { ...cancelled, quote: quoteForCard(cancelled.quote) },
3124
3138
  fee: formatMoney(charged),
3125
- refund: formatMoney(preview.refund),
3126
3139
  rule: preview.rule,
3127
3140
  cancellable: false,
3128
3141
  },