@alexkroman1/aai-cli 15.1.0 → 16.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.
Files changed (362) hide show
  1. package/README.md +8 -5
  2. package/bin.mjs +12 -3
  3. package/dist/_build-target-55dJisQ-.mjs +649 -0
  4. package/dist/_build-target.d.ts +105 -108
  5. package/dist/_deno-output.d.ts +23 -0
  6. package/dist/_deno-target.d.ts +73 -0
  7. package/dist/{_init-Bsi3DZNJ.mjs → _init-BzQbV8Zh.mjs} +3 -1
  8. package/dist/_modal-app.d.ts +77 -0
  9. package/dist/_modal-output.d.ts +31 -0
  10. package/dist/_modal-target.d.ts +64 -0
  11. package/dist/_target-bundle.d.ts +27 -0
  12. package/dist/_target-drain.d.ts +44 -0
  13. package/dist/_target-output.d.ts +63 -0
  14. package/dist/{_templates-CIlJ3Vay.mjs → _templates-CuP74F8D.mjs} +94 -4
  15. package/dist/_templates.d.ts +14 -1
  16. package/dist/_vercel-output.d.ts +4 -19
  17. package/dist/_vercel-target.d.ts +169 -0
  18. package/dist/{test-D032V2cA.mjs → _vitest-runner-AVR9VtXh.mjs} +28 -68
  19. package/dist/_vitest-runner.d.ts +154 -0
  20. package/dist/build-ButI2IKc.mjs +689 -0
  21. package/dist/build.d.ts +11 -0
  22. package/dist/cli.mjs +12 -11
  23. package/dist/{dev-Bx9gYBHM.mjs → dev-kodAY23K.mjs} +7 -1
  24. package/dist/{eval-B3I7FqN9.mjs → eval-DvoSz7SZ.mjs} +1 -1
  25. package/dist/{init-CQbj3ycf.mjs → init-D363Ls5u.mjs} +2 -2
  26. package/dist/scaffold/CLAUDE.md +185 -35
  27. package/dist/scaffold/package.json +4 -4
  28. package/dist/start.mjs +3 -1
  29. package/dist/{studio-C_zuRC_z.mjs → studio-CtRBVVFR.mjs} +1 -1
  30. package/dist/templates/briefing-desk/agent.eval.test.ts +34 -6
  31. package/dist/templates/briefing-desk/agent.test.ts +347 -55
  32. package/dist/templates/briefing-desk/agent.ts +12 -0
  33. package/dist/templates/briefing-desk/shared.ts +220 -31
  34. package/dist/templates/briefing-desk/slack.ts +108 -0
  35. package/dist/templates/briefing-desk/system-prompt.md +12 -2
  36. package/dist/templates/briefing-desk/tools/briefing_so_far.ts +15 -7
  37. package/dist/templates/briefing-desk/tools/research_topic.ts +20 -28
  38. package/dist/templates/briefing-desk/tools/send_briefing.ts +77 -0
  39. package/dist/templates/briefing-desk/tools/verify_claim.ts +60 -14
  40. package/dist/templates/call-audit/agent.eval.test.ts +5 -0
  41. package/dist/templates/call-audit/agent.test.ts +6 -1
  42. package/dist/templates/call-audit/agent.ts +10 -23
  43. package/dist/templates/call-audit/client.tsx +30 -55
  44. package/dist/templates/call-audit/guards.test.ts +233 -0
  45. package/dist/templates/call-audit/workflows/audit.ts +95 -16
  46. package/dist/templates/call-audit/workflows/ingest.ts +107 -88
  47. package/dist/templates/call-audit/workflows/media.ts +98 -7
  48. package/dist/templates/call-audit/workflows/summarize.ts +35 -31
  49. package/dist/templates/call-audit/workflows/sync-api.ts +15 -6
  50. package/dist/templates/code-interpreter/agent.eval.test.ts +104 -56
  51. package/dist/templates/code-interpreter/agent.test.ts +44 -56
  52. package/dist/templates/code-interpreter/system-prompt.md +1 -1
  53. package/dist/templates/dispatch-center/agent.eval.test.ts +61 -24
  54. package/dist/templates/dispatch-center/agent.test.ts +253 -48
  55. package/dist/templates/dispatch-center/agent.ts +28 -1
  56. package/dist/templates/dispatch-center/client.tsx +126 -201
  57. package/dist/templates/dispatch-center/events.ts +48 -0
  58. package/dist/templates/dispatch-center/shared.ts +42 -1
  59. package/dist/templates/dispatch-center/tools/incident_create.ts +3 -2
  60. package/dist/templates/dispatch-center/tools/incident_escalate.ts +2 -1
  61. package/dist/templates/dispatch-center/tools/ops_dashboard.ts +35 -15
  62. package/dist/templates/dispatch-center/tools/ops_run_scenario.ts +3 -1
  63. package/dist/templates/dispatch-center/tools/resources_dispatch.ts +2 -2
  64. package/dist/templates/executive-assistant/agent.eval.test.ts +233 -0
  65. package/dist/templates/executive-assistant/agent.test.ts +672 -0
  66. package/dist/templates/executive-assistant/agent.ts +50 -0
  67. package/dist/templates/executive-assistant/calendar.test.ts +198 -0
  68. package/dist/templates/executive-assistant/client.tsx +195 -0
  69. package/dist/templates/executive-assistant/inbox.ts +233 -0
  70. package/dist/templates/executive-assistant/meeting.ts +138 -0
  71. package/dist/templates/executive-assistant/nodes.ts +152 -0
  72. package/dist/templates/executive-assistant/prompts.ts +331 -0
  73. package/dist/templates/executive-assistant/review.ts +425 -0
  74. package/dist/templates/executive-assistant/shared.ts +490 -0
  75. package/dist/templates/executive-assistant/system-prompt.md +15 -0
  76. package/dist/templates/executive-assistant/tools/accept.ts +10 -0
  77. package/dist/templates/executive-assistant/tools/ask_question.ts +30 -0
  78. package/dist/templates/executive-assistant/tools/draft_reply.ts +67 -0
  79. package/dist/templates/executive-assistant/tools/edit.ts +10 -0
  80. package/dist/templates/executive-assistant/tools/ignore.ts +10 -0
  81. package/dist/templates/executive-assistant/tools/inbox_status.ts +27 -0
  82. package/dist/templates/executive-assistant/tools/meeting_assistant.ts +52 -0
  83. package/dist/templates/executive-assistant/tools/new_email.ts +50 -0
  84. package/dist/templates/executive-assistant/tools/open_email.ts +165 -0
  85. package/dist/templates/executive-assistant/tools/respond.ts +10 -0
  86. package/dist/templates/executive-assistant/tools/review_memory.ts +22 -0
  87. package/dist/templates/executive-assistant/tools/send_calendar_invite.ts +68 -0
  88. package/dist/templates/executive-assistant/tools/triage_inbox.ts +75 -0
  89. package/dist/templates/health-assistant/agent.test.ts +134 -15
  90. package/dist/templates/health-assistant/agent.ts +8 -1
  91. package/dist/templates/health-assistant/fda.test.ts +130 -0
  92. package/dist/templates/health-assistant/fda.ts +75 -16
  93. package/dist/templates/health-assistant/system-prompt.md +9 -0
  94. package/dist/templates/health-assistant/tools/check_drug_interaction.ts +5 -2
  95. package/dist/templates/health-assistant/tools/medication_lookup.ts +16 -11
  96. package/dist/templates/hiring-desk/agent.eval.test.ts +242 -0
  97. package/dist/templates/hiring-desk/agent.test.ts +1021 -0
  98. package/dist/templates/hiring-desk/agent.ts +38 -0
  99. package/dist/templates/hiring-desk/client.tsx +154 -0
  100. package/dist/templates/hiring-desk/crews.ts +432 -0
  101. package/dist/templates/hiring-desk/leads.json +86 -0
  102. package/dist/templates/hiring-desk/screening-lock.test.ts +77 -0
  103. package/dist/templates/hiring-desk/screening-lock.ts +51 -0
  104. package/dist/templates/hiring-desk/shared.ts +480 -0
  105. package/dist/templates/hiring-desk/system-prompt.md +21 -0
  106. package/dist/templates/hiring-desk/tools/candidate_details.ts +49 -0
  107. package/dist/templates/hiring-desk/tools/proceed_to_emails.ts +127 -0
  108. package/dist/templates/hiring-desk/tools/read_email.ts +50 -0
  109. package/dist/templates/hiring-desk/tools/rescore_with_feedback.ts +140 -0
  110. package/dist/templates/hiring-desk/tools/screen_candidates.ts +128 -0
  111. package/dist/templates/hiring-desk/tools/screening_status.ts +51 -0
  112. package/dist/templates/hotel-desk/agent.eval.test.ts +177 -0
  113. package/dist/templates/hotel-desk/agent.test.ts +1128 -0
  114. package/dist/templates/hotel-desk/agent.ts +63 -0
  115. package/dist/templates/hotel-desk/booking.ts +159 -0
  116. package/dist/templates/hotel-desk/card.ts +92 -0
  117. package/dist/templates/hotel-desk/catalogs.ts +219 -0
  118. package/dist/templates/hotel-desk/client.tsx +137 -0
  119. package/dist/templates/hotel-desk/concierge.ts +99 -0
  120. package/dist/templates/hotel-desk/desk-seams.test.ts +334 -0
  121. package/dist/templates/hotel-desk/desk.ts +224 -0
  122. package/dist/templates/hotel-desk/disputes.ts +216 -0
  123. package/dist/templates/hotel-desk/events.ts +79 -0
  124. package/dist/templates/hotel-desk/hotel.ts +412 -0
  125. package/dist/templates/hotel-desk/policies.ts +209 -0
  126. package/dist/templates/hotel-desk/records.ts +384 -0
  127. package/dist/templates/hotel-desk/restaurant.ts +147 -0
  128. package/dist/templates/hotel-desk/seed.ts +955 -0
  129. package/dist/templates/hotel-desk/shared.ts +354 -0
  130. package/dist/templates/hotel-desk/system-prompt.md +76 -0
  131. package/dist/templates/hotel-desk/tools/abandon_booking.ts +30 -0
  132. package/dist/templates/hotel-desk/tools/add_to_waitlist.ts +41 -0
  133. package/dist/templates/hotel-desk/tools/book_airport_car.ts +57 -0
  134. package/dist/templates/hotel-desk/tools/book_business_center.ts +44 -0
  135. package/dist/templates/hotel-desk/tools/book_spa_appointment.ts +39 -0
  136. package/dist/templates/hotel-desk/tools/book_tour.ts +35 -0
  137. package/dist/templates/hotel-desk/tools/cancel_restaurant_reservation.ts +25 -0
  138. package/dist/templates/hotel-desk/tools/cancel_room_booking.ts +63 -0
  139. package/dist/templates/hotel-desk/tools/check_restaurant_availability.ts +24 -0
  140. package/dist/templates/hotel-desk/tools/check_room_availability.ts +40 -0
  141. package/dist/templates/hotel-desk/tools/choose_room.ts +93 -0
  142. package/dist/templates/hotel-desk/tools/confirm_booking.ts +153 -0
  143. package/dist/templates/hotel-desk/tools/dispatch_emergency.ts +61 -0
  144. package/dist/templates/hotel-desk/tools/dispute_charge.ts +90 -0
  145. package/dist/templates/hotel-desk/tools/flag_late_arrival.ts +26 -0
  146. package/dist/templates/hotel-desk/tools/lookup_booking.ts +48 -0
  147. package/dist/templates/hotel-desk/tools/lookup_guest_history.ts +28 -0
  148. package/dist/templates/hotel-desk/tools/lookup_invoice.ts +26 -0
  149. package/dist/templates/hotel-desk/tools/lookup_policy.ts +20 -0
  150. package/dist/templates/hotel-desk/tools/lookup_restaurant_reservation.ts +27 -0
  151. package/dist/templates/hotel-desk/tools/modify_restaurant_reservation.ts +75 -0
  152. package/dist/templates/hotel-desk/tools/order_flowers.ts +40 -0
  153. package/dist/templates/hotel-desk/tools/record_card.ts +46 -0
  154. package/dist/templates/hotel-desk/tools/record_followup.ts +50 -0
  155. package/dist/templates/hotel-desk/tools/record_group_inquiry.ts +44 -0
  156. package/dist/templates/hotel-desk/tools/record_guest_details.ts +71 -0
  157. package/dist/templates/hotel-desk/tools/reinstate_booking.ts +65 -0
  158. package/dist/templates/hotel-desk/tools/request_flight_reconfirmation.ts +54 -0
  159. package/dist/templates/hotel-desk/tools/resend_confirmation.ts +39 -0
  160. package/dist/templates/hotel-desk/tools/reserve_table.ts +87 -0
  161. package/dist/templates/hotel-desk/tools/resolve_room_conflict.ts +48 -0
  162. package/dist/templates/hotel-desk/tools/schedule_wakeup_call.ts +48 -0
  163. package/dist/templates/hotel-desk/tools/set_do_not_disturb.ts +28 -0
  164. package/dist/templates/hotel-desk/tools/set_extras.ts +51 -0
  165. package/dist/templates/hotel-desk/tools/set_stay.ts +97 -0
  166. package/dist/templates/hotel-desk/tools/start_booking_modification.ts +57 -0
  167. package/dist/templates/hotel-desk/tools/start_room_booking.ts +49 -0
  168. package/dist/templates/hotel-desk/tools/take_guest_message.ts +71 -0
  169. package/dist/templates/hotel-desk/tools/transfer_call.ts +47 -0
  170. package/dist/templates/hotel-desk/tools/update_card.ts +45 -0
  171. package/dist/templates/hotel-desk/tools/verify_booking.ts +95 -0
  172. package/dist/templates/infocom-adventure/agent.eval.test.ts +33 -1
  173. package/dist/templates/infocom-adventure/agent.test.ts +207 -52
  174. package/dist/templates/infocom-adventure/agent.ts +14 -3
  175. package/dist/templates/infocom-adventure/client.tsx +138 -176
  176. package/dist/templates/infocom-adventure/shared.ts +126 -6
  177. package/dist/templates/infocom-adventure/system-prompt.md +4 -4
  178. package/dist/templates/infocom-adventure/tools/game_state_drop.ts +20 -4
  179. package/dist/templates/infocom-adventure/tools/game_state_get.ts +6 -5
  180. package/dist/templates/infocom-adventure/tools/game_state_score.ts +9 -3
  181. package/dist/templates/link-digest/agent.eval.test.ts +8 -0
  182. package/dist/templates/link-digest/agent.test.ts +285 -29
  183. package/dist/templates/link-digest/agent.ts +9 -0
  184. package/dist/templates/link-digest/api-client.ts +144 -0
  185. package/dist/templates/link-digest/client.tsx +11 -30
  186. package/dist/templates/link-digest/workflows/digest.ts +72 -24
  187. package/dist/templates/night-owl/agent.eval.test.ts +55 -40
  188. package/dist/templates/night-owl/agent.test.ts +146 -12
  189. package/dist/templates/night-owl/client.tsx +50 -17
  190. package/dist/templates/night-owl/shared.ts +33 -2
  191. package/dist/templates/night-owl/system-prompt.md +3 -0
  192. package/dist/templates/night-owl/tools/recommend.ts +4 -1
  193. package/dist/templates/night-owl/tools/revisit.ts +49 -0
  194. package/dist/templates/pipeline-simple/agent.eval.test.ts +7 -6
  195. package/dist/templates/pipeline-simple/agent.test.ts +48 -91
  196. package/dist/templates/pipeline-simple/modes.test.ts +151 -0
  197. package/dist/templates/pipeline-simple/stages.test.ts +332 -0
  198. package/dist/templates/pizza-ordering/agent.test.ts +94 -38
  199. package/dist/templates/pizza-ordering/client.tsx +10 -5
  200. package/dist/templates/pizza-ordering/shared.ts +65 -6
  201. package/dist/templates/pizza-ordering/tools/add_pizza.ts +2 -7
  202. package/dist/templates/pizza-ordering/tools/place_order.ts +9 -6
  203. package/dist/templates/pizza-ordering/tools/remove_pizza.ts +6 -11
  204. package/dist/templates/pizza-ordering/tools/update_pizza.ts +8 -9
  205. package/dist/templates/pizza-ordering/tools/view_order.ts +2 -3
  206. package/dist/templates/plan-and-execute/agent.eval.test.ts +14 -6
  207. package/dist/templates/plan-and-execute/agent.test.ts +300 -113
  208. package/dist/templates/plan-and-execute/client.tsx +18 -7
  209. package/dist/templates/plan-and-execute/procedure.ts +162 -64
  210. package/dist/templates/plan-and-execute/prompts.ts +51 -15
  211. package/dist/templates/plan-and-execute/shared.ts +151 -45
  212. package/dist/templates/plan-and-execute/tools/plan_status.ts +15 -6
  213. package/dist/templates/plan-and-execute/tools/revise_plan.ts +2 -2
  214. package/dist/templates/plan-and-execute/tools/start_plan.ts +2 -2
  215. package/dist/templates/plan-and-execute/tools/work_next_step.ts +15 -13
  216. package/dist/templates/podcast-digest/agent.eval.test.ts +12 -7
  217. package/dist/templates/podcast-digest/agent.test.ts +126 -51
  218. package/dist/templates/podcast-digest/client.tsx +104 -68
  219. package/dist/templates/podcast-digest/workflows/digest.ts +71 -48
  220. package/dist/templates/podcast-digest/workflows/feeds.ts +5 -7
  221. package/dist/templates/podcast-digest/workflows/slack.ts +82 -17
  222. package/dist/templates/recap-workflow/agent.eval.test.ts +193 -209
  223. package/dist/templates/recap-workflow/agent.test.ts +207 -26
  224. package/dist/templates/recap-workflow/tools/recap_status.ts +2 -2
  225. package/dist/templates/recap-workflow/workflows/recap.ts +39 -28
  226. package/dist/templates/redline/agent.eval.test.ts +40 -3
  227. package/dist/templates/redline/agent.test.ts +216 -6
  228. package/dist/templates/redline/agent.ts +54 -34
  229. package/dist/templates/redline/client.tsx +82 -126
  230. package/dist/templates/redline/form.ts +74 -0
  231. package/dist/templates/redline/workflows/prompts.ts +3 -3
  232. package/dist/templates/redline/workflows/redline.ts +73 -4
  233. package/dist/templates/research-workflow/agent.eval.test.ts +152 -150
  234. package/dist/templates/research-workflow/agent.test.ts +436 -126
  235. package/dist/templates/research-workflow/agent.ts +20 -5
  236. package/dist/templates/research-workflow/tools/file_it_now.ts +11 -1
  237. package/dist/templates/research-workflow/tools/research_status.ts +39 -4
  238. package/dist/templates/research-workflow/workflows/filing.ts +164 -0
  239. package/dist/templates/research-workflow/workflows/notes.ts +69 -0
  240. package/dist/templates/research-workflow/workflows/prompts.ts +45 -31
  241. package/dist/templates/research-workflow/workflows/research.ts +227 -280
  242. package/dist/templates/research-workflow/workflows/review.ts +43 -0
  243. package/dist/templates/retail/address.ts +29 -35
  244. package/dist/templates/retail/agent.eval.test.ts +36 -16
  245. package/dist/templates/retail/agent.test.ts +104 -26
  246. package/dist/templates/retail/agent.ts +12 -0
  247. package/dist/templates/retail/cancel.ts +39 -42
  248. package/dist/templates/retail/client.tsx +111 -176
  249. package/dist/templates/retail/payment.ts +38 -43
  250. package/dist/templates/retail/pending.test.ts +16 -8
  251. package/dist/templates/retail/registry.test.ts +108 -49
  252. package/dist/templates/retail/resolve.test.ts +2 -63
  253. package/dist/templates/retail/resolve.ts +16 -56
  254. package/dist/templates/retail/returns.ts +53 -54
  255. package/dist/templates/retail/seed.test.ts +2 -1
  256. package/dist/templates/retail/shared.ts +58 -14
  257. package/dist/templates/retail/store.test.ts +40 -29
  258. package/dist/templates/retail/store.ts +60 -23
  259. package/dist/templates/retail/swap.ts +78 -81
  260. package/dist/templates/retail/tools/find_user_id_by_name_zip.ts +2 -1
  261. package/dist/templates/roadside-assist/agent.eval.test.ts +164 -0
  262. package/dist/templates/roadside-assist/agent.test.ts +617 -0
  263. package/dist/templates/roadside-assist/agent.ts +85 -0
  264. package/dist/templates/roadside-assist/call.ts +237 -0
  265. package/dist/templates/roadside-assist/events.ts +92 -0
  266. package/dist/templates/roadside-assist/shared.ts +334 -0
  267. package/dist/templates/roadside-assist/system-prompt.md +37 -0
  268. package/dist/templates/roadside-assist/tools/acknowledge_disclosure.ts +47 -0
  269. package/dist/templates/roadside-assist/tools/dispatch_truck.ts +148 -0
  270. package/dist/templates/roadside-assist/tools/job_status.ts +38 -0
  271. package/dist/templates/roadside-assist/tools/lookup_coverage.ts +72 -0
  272. package/dist/templates/roadside-assist/tools/report_location.ts +79 -0
  273. package/dist/templates/roadside-assist/tools/service_disclosure.ts +45 -0
  274. package/dist/templates/roadside-assist/yard.test.ts +158 -0
  275. package/dist/templates/roadside-assist/yard.ts +183 -0
  276. package/dist/templates/simple/agent.eval.test.ts +4 -1
  277. package/dist/templates/simple/agent.test.ts +54 -31
  278. package/dist/templates/solo-rpg/agent.eval.test.ts +19 -11
  279. package/dist/templates/solo-rpg/agent.test.ts +402 -175
  280. package/dist/templates/solo-rpg/agent.ts +14 -3
  281. package/dist/templates/solo-rpg/client.tsx +10 -10
  282. package/dist/templates/solo-rpg/shared.ts +198 -79
  283. package/dist/templates/solo-rpg/tools/action_roll.ts +7 -3
  284. package/dist/templates/solo-rpg/tools/burn_momentum.ts +16 -8
  285. package/dist/templates/solo-rpg/tools/oracle.ts +7 -7
  286. package/dist/templates/solo-rpg/tools/setup_character.ts +5 -5
  287. package/dist/templates/solo-rpg/tools/update_state.ts +29 -18
  288. package/dist/templates/spoken-summary/agent.test.ts +70 -15
  289. package/dist/templates/spoken-summary/agent.ts +25 -21
  290. package/dist/templates/spoken-summary/client.tsx +68 -88
  291. package/dist/templates/spoken-summary/workflows/summarize.ts +26 -8
  292. package/dist/templates/support-line/agent.test.ts +167 -36
  293. package/dist/templates/support-line/client.tsx +21 -9
  294. package/dist/templates/support-line/nodes.ts +74 -32
  295. package/dist/templates/support-line/procedure.ts +66 -21
  296. package/dist/templates/support-line/prompts.ts +9 -0
  297. package/dist/templates/support-line/shared.ts +55 -17
  298. package/dist/templates/support-line/tools/answer_question.ts +14 -14
  299. package/dist/templates/transcription-workflow/agent.test.ts +135 -13
  300. package/dist/templates/transcription-workflow/client.tsx +30 -23
  301. package/dist/templates/transcription-workflow/recover.test.ts +93 -12
  302. package/dist/templates/transcription-workflow/recover.ts +29 -5
  303. package/dist/templates/transcription-workflow/run-panel.tsx +40 -51
  304. package/dist/templates/transcription-workflow/workflows/normalize.ts +125 -24
  305. package/dist/templates/transcription-workflow/workflows/stream.ts +4 -1
  306. package/dist/templates/transcription-workflow/workflows/transcribe.ts +7 -5
  307. package/dist/templates/transcription-workflow/workflows/wav.ts +42 -117
  308. package/dist/templates/travel-concierge/agent.eval.test.ts +6 -4
  309. package/dist/templates/travel-concierge/agent.test.ts +209 -40
  310. package/dist/templates/travel-concierge/agent.ts +24 -4
  311. package/dist/templates/travel-concierge/call-events.ts +80 -0
  312. package/dist/templates/travel-concierge/client.tsx +3 -2
  313. package/dist/templates/travel-concierge/routing.ts +5 -7
  314. package/dist/templates/travel-concierge/shared.ts +202 -41
  315. package/dist/templates/travel-concierge/tools/book_car_rental.ts +2 -4
  316. package/dist/templates/travel-concierge/tools/book_excursion.ts +2 -4
  317. package/dist/templates/travel-concierge/tools/book_hotel.ts +2 -4
  318. package/dist/templates/travel-concierge/tools/cancel_ticket.ts +6 -4
  319. package/dist/templates/travel-concierge/tools/search_car_rentals.ts +3 -5
  320. package/dist/templates/travel-concierge/tools/search_excursions.ts +3 -5
  321. package/dist/templates/travel-concierge/tools/search_flights.ts +20 -9
  322. package/dist/templates/travel-concierge/tools/search_hotels.ts +3 -5
  323. package/dist/templates/travel-concierge/tools/update_ticket.ts +2 -4
  324. package/dist/templates/web-researcher/agent.eval.test.ts +3 -6
  325. package/dist/templates/web-researcher/agent.test.ts +102 -65
  326. package/dist/templates/web-researcher/agent.ts +93 -1
  327. package/dist/templates/web-researcher/system-prompt.md +7 -1
  328. package/dist/templates/word-wrangler/agent.eval.test.ts +157 -0
  329. package/dist/templates/word-wrangler/agent.test.ts +432 -0
  330. package/dist/templates/word-wrangler/agent.ts +35 -0
  331. package/dist/templates/word-wrangler/client.tsx +211 -0
  332. package/dist/templates/word-wrangler/game.ts +107 -0
  333. package/dist/templates/word-wrangler/guess.ts +63 -0
  334. package/dist/templates/word-wrangler/player.ts +68 -0
  335. package/dist/templates/word-wrangler/shared.ts +263 -0
  336. package/dist/templates/word-wrangler/system-prompt.md +15 -0
  337. package/dist/templates/word-wrangler/tools/final_score.ts +37 -0
  338. package/dist/templates/word-wrangler/tools/relay_description.ts +137 -0
  339. package/dist/templates/word-wrangler/tools/repeat_word.ts +19 -0
  340. package/dist/templates/word-wrangler/tools/skip_word.ts +31 -0
  341. package/dist/templates/word-wrangler/tools/start_game.ts +47 -0
  342. package/dist/templates/word-wrangler/words.ts +278 -0
  343. package/dist/test-Cllnx81G.mjs +83 -0
  344. package/dist/test.d.ts +9 -114
  345. package/package.json +5 -5
  346. package/dist/build-BhEaxBPu.mjs +0 -481
  347. package/dist/templates/embedded-assets/agent.eval.test.ts +0 -130
  348. package/dist/templates/embedded-assets/agent.test.ts +0 -79
  349. package/dist/templates/embedded-assets/agent.ts +0 -7
  350. package/dist/templates/embedded-assets/knowledge.json +0 -20
  351. package/dist/templates/embedded-assets/shared.ts +0 -17
  352. package/dist/templates/embedded-assets/system-prompt.md +0 -13
  353. package/dist/templates/embedded-assets/tools/list_topics.ts +0 -9
  354. package/dist/templates/embedded-assets/tools/search_knowledge.ts +0 -26
  355. package/dist/templates/math-buddy/agent.eval.test.ts +0 -128
  356. package/dist/templates/math-buddy/agent.test.ts +0 -126
  357. package/dist/templates/math-buddy/agent.ts +0 -15
  358. package/dist/templates/math-buddy/system-prompt.md +0 -12
  359. package/dist/templates/personal-finance/agent.eval.test.ts +0 -149
  360. package/dist/templates/personal-finance/agent.test.ts +0 -127
  361. package/dist/templates/personal-finance/agent.ts +0 -8
  362. package/dist/templates/personal-finance/system-prompt.md +0 -21
@@ -0,0 +1,412 @@
1
+ /**
2
+ * Their `HotelDB`, as functions over the session's state.
3
+ *
4
+ * Every query here was a SQL statement (`_SQL_AVAILABILITY`, `_SQL_FREE_ROOM`,
5
+ * `_SQL_FREE_BETTER_ROOM`, …) and every mutation a transaction. A slot is a plain
6
+ * object, so a query is a filter and a mutation writes the draft it is handed —
7
+ * which is why the WRITERS take a {@link HotelState} and the READERS take the
8
+ * frozen shape: a mutable state satisfies `FrozenHotelState`, so a tool inside
9
+ * `hotelSlot.update` can call either, while a read-only tool can call only the
10
+ * reads.
11
+ *
12
+ * What did not change is the rule each query encodes, stated where it lives:
13
+ * two stays overlap unless one ends before the other starts; a modified booking
14
+ * keeps its own room when that room still fits; a conflicted guest is moved to
15
+ * the same category or better, never down; a table shift prefers the table the
16
+ * party already has.
17
+ *
18
+ * **Every writer here answers `T | ToolFailure`, and the three that open with a
19
+ * lookup are `failable`.** `updateBooking`, `cancelBooking` and
20
+ * `resolveRoomConflict` each began by re-deriving `find(b => b.code === code &&
21
+ * b.status === "confirmed")` and the same `booking not found` sentence, and
22
+ * `resolveRoomConflict` re-derived the floor-plan lookup on top. Those are
23
+ * {@link requireConfirmedBooking} and `requireFloorPlanRoom` now, and the
24
+ * forwarding is `orFail` — `failable` replaces the `function` keyword, so it
25
+ * costs nothing and each guard statement it removes is a line. A lookup that
26
+ * ends in a REFUSAL still returns one plainly: `failable` absorbs it, and the
27
+ * spelling stays the one a reader can see the sentence in.
28
+ */
29
+
30
+ import type { ToolFailure } from "@alexkroman1/aai";
31
+ import { failable, orFail, spokenAlphanumeric, toolFailure } from "@alexkroman1/aai";
32
+ import {
33
+ addDays,
34
+ computeInvoice,
35
+ daysBetween,
36
+ digitsOf,
37
+ type Invoice,
38
+ mintCode,
39
+ type Room,
40
+ type RoomBooking,
41
+ type RoomExtra,
42
+ type RoomType,
43
+ type RoomView,
44
+ speakUsd,
45
+ TODAY,
46
+ WALK_PARTNER_HOTEL,
47
+ } from "./records.ts";
48
+ import { addTicket, type FrozenHotelState, type HotelState, note, takenCodes } from "./shared.ts";
49
+
50
+ // ─── Rooms ───────────────────────────────────────────────────────────────────
51
+
52
+ /** Two stays overlap unless one ends before the other begins. ISO dates compare as strings. */
53
+ function overlaps(
54
+ a: { checkIn: string; checkOut: string },
55
+ checkIn: string,
56
+ checkOut: string,
57
+ ): boolean {
58
+ return !(a.checkOut <= checkIn || a.checkIn >= checkOut);
59
+ }
60
+
61
+ /** Is `room` free for the whole window, ignoring the booking `exclude` names? */
62
+ function roomFree(
63
+ state: FrozenHotelState,
64
+ roomId: string,
65
+ checkIn: string,
66
+ checkOut: string,
67
+ exclude: string | null,
68
+ ): boolean {
69
+ return !state.bookings.some(
70
+ (b) =>
71
+ b.roomId === roomId &&
72
+ b.status === "confirmed" &&
73
+ b.code !== exclude &&
74
+ overlaps(b, checkIn, checkOut),
75
+ );
76
+ }
77
+
78
+ /**
79
+ * One bookable type+view pairing and what the cheapest room in it costs.
80
+ *
81
+ * The pairing is the unit a caller actually picks, not the type: rate varies
82
+ * with the view (a city king is 240 a night, an ocean king 260), so a price
83
+ * quoted per type is a price that moves once the view is known.
84
+ */
85
+ export interface RoomOption {
86
+ type: RoomType;
87
+ view: RoomView;
88
+ nightlyRate: number;
89
+ }
90
+
91
+ export interface StayQuery {
92
+ checkIn: string;
93
+ checkOut: string;
94
+ guests: number;
95
+ /** `undefined` is no preference — both kinds. */
96
+ smoking?: boolean | undefined;
97
+ /** A booking to ignore when checking for conflicts — the one being modified. */
98
+ excludeCode?: string | null | undefined;
99
+ }
100
+
101
+ /** Their `_SQL_AVAILABILITY`: the free pairings for a stay, cheapest first. */
102
+ export function listRoomOptions(state: FrozenHotelState, q: StayQuery): RoomOption[] {
103
+ const best = new Map<string, RoomOption>();
104
+ for (const room of state.rooms) {
105
+ if (room.maxOccupancy < q.guests) continue;
106
+ if (q.smoking !== undefined && room.smoking !== q.smoking) continue;
107
+ if (!roomFree(state, room.id, q.checkIn, q.checkOut, q.excludeCode ?? null)) continue;
108
+ const key = `${room.type}/${room.view}`;
109
+ const seen = best.get(key);
110
+ if (seen === undefined || room.nightlyRate < seen.nightlyRate) {
111
+ best.set(key, { type: room.type, view: room.view, nightlyRate: room.nightlyRate });
112
+ }
113
+ }
114
+ return [...best.values()].sort(
115
+ (a, b) =>
116
+ a.nightlyRate - b.nightlyRate || a.type.localeCompare(b.type) || a.view.localeCompare(b.view),
117
+ );
118
+ }
119
+
120
+ /**
121
+ * The bookable pairings as one line each — one type with one view and that
122
+ * pairing's price. Rolling a type's views onto a single line lets a neighbouring
123
+ * line's view bind to the wrong type (a garden-view king, which has never
124
+ * existed) and hides that the view moves the price.
125
+ */
126
+ export function describeRoomOptions(options: readonly RoomOption[]): string {
127
+ return options
128
+ .map(
129
+ (o) => `- ${o.type.replaceAll("_", " ")}, ${o.view} view: ${speakUsd(o.nightlyRate)}/night`,
130
+ )
131
+ .join("\n");
132
+ }
133
+
134
+ export interface FreeRoomQuery extends StayQuery {
135
+ roomType: RoomType;
136
+ smoking: boolean;
137
+ view?: RoomView | null | undefined;
138
+ /** The room to hand out if it still fits — a date change must never quietly
139
+ * move someone out of their garden view. */
140
+ prefer?: string | null | undefined;
141
+ }
142
+
143
+ /** Their `_SQL_FREE_ROOM`: the room `bookRoom` would pick, cheapest first. */
144
+ export function freeRoom(state: FrozenHotelState, q: FreeRoomQuery): Room | undefined {
145
+ const candidates = state.rooms.filter(
146
+ (room) =>
147
+ room.type === q.roomType &&
148
+ room.smoking === q.smoking &&
149
+ room.maxOccupancy >= q.guests &&
150
+ (q.view === undefined || q.view === null || room.view === q.view) &&
151
+ roomFree(state, room.id, q.checkIn, q.checkOut, q.excludeCode ?? null),
152
+ );
153
+ candidates.sort(
154
+ (a, b) =>
155
+ Number(b.id === q.prefer) - Number(a.id === q.prefer) ||
156
+ a.nightlyRate - b.nightlyRate ||
157
+ a.id.localeCompare(b.id),
158
+ );
159
+ // `.sort` on a readonly array's filter result is fine: `filter` returns a fresh, mutable array.
160
+ return candidates[0] as Room | undefined;
161
+ }
162
+
163
+ /** The exact total (with tax) for the room `bookRoom` would pick right now, so
164
+ * the read-back quotes the real number and never per-night arithmetic. */
165
+ export function peekStayTotal(
166
+ state: FrozenHotelState,
167
+ q: FreeRoomQuery,
168
+ extras: readonly RoomExtra[],
169
+ ): number | null {
170
+ const room = freeRoom(state, q);
171
+ if (room === undefined) return null;
172
+ return computeInvoice(room.nightlyRate, daysBetween(q.checkIn, q.checkOut), extras).total;
173
+ }
174
+
175
+ /**
176
+ * The CONFIRMED booking a code names, or the refusal.
177
+ *
178
+ * Three writers below opened with the same `find(b => b.code === code &&
179
+ * b.status === "confirmed")` and the same `booking not found: ${code}`
180
+ * sentence, and `resolveRoomConflict` then re-derived the floor-plan lookup on
181
+ * top of it. One helper answering `RoomBooking | ToolFailure` is what lets each
182
+ * of them start with a single `orFail` line instead — the forwarding is written
183
+ * once, in the SDK, rather than as a guard statement per lookup.
184
+ */
185
+ export function requireConfirmedBooking<S extends FrozenHotelState | HotelState>(
186
+ state: S,
187
+ code: string,
188
+ ): S["bookings"][number] | ToolFailure {
189
+ const booking = state.bookings.find((b) => b.code === code && b.status === "confirmed");
190
+ return booking ?? toolFailure(`booking not found: ${code}`);
191
+ }
192
+
193
+ /** The room a booking sits in, or the refusal — a booking always has one. */
194
+ export function requireFloorPlanRoom<S extends FrozenHotelState | HotelState>(
195
+ state: S,
196
+ roomId: string,
197
+ ): S["rooms"][number] | ToolFailure {
198
+ const room = state.rooms.find((r) => r.id === roomId);
199
+ return room ?? toolFailure(`room ${roomId} is not on the floor plan`);
200
+ }
201
+
202
+ export interface BookRoomInput {
203
+ roomType: RoomType;
204
+ smoking: boolean;
205
+ view: RoomView | null;
206
+ guests: number;
207
+ checkIn: string;
208
+ checkOut: string;
209
+ firstName: string;
210
+ lastName: string;
211
+ email: string;
212
+ phone: string;
213
+ cardLast4: string;
214
+ extras: readonly RoomExtra[];
215
+ }
216
+
217
+ /** Their `book_room`: pick the room, price the stay, write the booking and its invoice. */
218
+ export function bookRoom(state: HotelState, input: BookRoomInput): RoomBooking | ToolFailure {
219
+ const room = freeRoom(state, { ...input, excludeCode: null, prefer: null });
220
+ if (room === undefined) {
221
+ const what = input.view ? `${input.view}-view ${input.roomType}` : input.roomType;
222
+ return toolFailure(`sold out: no ${what.replaceAll("_", " ")} is free for those dates`);
223
+ }
224
+ const nights = daysBetween(input.checkIn, input.checkOut);
225
+ const extras = [...input.extras].sort();
226
+ const priced = computeInvoice(room.nightlyRate, nights, extras);
227
+ const booking: RoomBooking = {
228
+ code: mintCode("HTL", takenCodes(state)),
229
+ roomId: room.id,
230
+ firstName: input.firstName,
231
+ lastName: input.lastName,
232
+ // Spoken emails are case-free; transcription capitalization is noise.
233
+ email: input.email.trim().toLowerCase(),
234
+ phone: digitsOf(input.phone) || input.phone,
235
+ checkIn: input.checkIn,
236
+ checkOut: input.checkOut,
237
+ guests: input.guests,
238
+ extras,
239
+ total: priced.total,
240
+ cardLast4: input.cardLast4,
241
+ status: "confirmed",
242
+ lateArrivalNote: null,
243
+ };
244
+ state.bookings.push(booking);
245
+ state.invoices.push({ bookingCode: booking.code, ...priced, paid: false });
246
+ note(state, `Booked ${booking.code}: room ${room.id}, ${input.checkIn} → ${input.checkOut}`);
247
+ return booking;
248
+ }
249
+
250
+ export interface UpdateBookingInput {
251
+ roomType: RoomType;
252
+ smoking: boolean;
253
+ view: RoomView | null;
254
+ guests: number;
255
+ checkIn: string;
256
+ checkOut: string;
257
+ extras: readonly RoomExtra[];
258
+ }
259
+
260
+ /**
261
+ * Their `update_booking`: re-pick a free room of the new type for the new dates,
262
+ * ignoring the booking itself (so "extend by one night" does not conflict with
263
+ * its own stay), preferring the room the guest already has. A requested `view`
264
+ * filters to rooms with that view — which is how an unhappy guest gets MOVED.
265
+ */
266
+ export const updateBooking = failable(
267
+ (state: HotelState, code: string, input: UpdateBookingInput): RoomBooking | ToolFailure => {
268
+ const booking = orFail(requireConfirmedBooking(state, code));
269
+ const room = freeRoom(state, { ...input, excludeCode: code, prefer: booking.roomId });
270
+ if (room === undefined) {
271
+ const what = input.view ? `${input.view}-view ${input.roomType}` : input.roomType;
272
+ return toolFailure(`sold out: no ${what.replaceAll("_", " ")} is free for those dates`);
273
+ }
274
+ const nights = daysBetween(input.checkIn, input.checkOut);
275
+ const extras = [...input.extras].sort();
276
+ const priced = computeInvoice(room.nightlyRate, nights, extras);
277
+ booking.roomId = room.id;
278
+ booking.checkIn = input.checkIn;
279
+ booking.checkOut = input.checkOut;
280
+ booking.guests = input.guests;
281
+ booking.extras = extras;
282
+ booking.total = priced.total;
283
+ const invoice = state.invoices.find((i) => i.bookingCode === code);
284
+ if (invoice) Object.assign(invoice, priced);
285
+ note(state, `Updated ${code}: room ${room.id}, ${input.checkIn} → ${input.checkOut}`);
286
+ return booking;
287
+ },
288
+ );
289
+
290
+ /** Their `cancel_room_booking` — the status flip only; the refund maths is the tool's. */
291
+ export const cancelBooking = failable((state: HotelState, code: string): RoomBooking => {
292
+ const booking = orFail(requireConfirmedBooking(state, code));
293
+ booking.status = "cancelled";
294
+ note(state, `Cancelled ${code}`);
295
+ return booking;
296
+ });
297
+
298
+ /**
299
+ * Their `reinstate_booking`: reactivate a cancelled booking, but only if its
300
+ * original room is still free for its dates. A no-op on a confirmed one.
301
+ */
302
+ export function reinstateBooking(state: HotelState, code: string): RoomBooking | ToolFailure {
303
+ const booking = state.bookings.find((b) => b.code === code);
304
+ if (booking === undefined) return toolFailure(`booking not found: ${code}`);
305
+ if (booking.status === "confirmed") return booking;
306
+ if (!roomFree(state, booking.roomId, booking.checkIn, booking.checkOut, code)) {
307
+ return toolFailure("that room is no longer free for those dates");
308
+ }
309
+ booking.status = "confirmed";
310
+ note(state, `Reinstated ${code}`);
311
+ return booking;
312
+ }
313
+
314
+ /** The overlap window if another confirmed booking holds this booking's room. */
315
+ export function roomConflict(
316
+ state: FrozenHotelState,
317
+ code: string,
318
+ ): { from: string; to: string } | null {
319
+ const a = state.bookings.find((b) => b.code === code && b.status === "confirmed");
320
+ if (a === undefined) return null;
321
+ const b = state.bookings.find(
322
+ (other) =>
323
+ other.roomId === a.roomId &&
324
+ other.code !== a.code &&
325
+ other.status === "confirmed" &&
326
+ other.checkIn < a.checkOut &&
327
+ other.checkOut > a.checkIn,
328
+ );
329
+ if (b === undefined) return null;
330
+ return {
331
+ from: a.checkIn > b.checkIn ? a.checkIn : b.checkIn,
332
+ to: a.checkOut < b.checkOut ? a.checkOut : b.checkOut,
333
+ };
334
+ }
335
+
336
+ export type ConflictResolution =
337
+ | { kind: "moved"; roomId: string; type: RoomType; view: RoomView; upgraded: boolean }
338
+ | { kind: "walked"; partner: string; returnDate: string };
339
+
340
+ /**
341
+ * The house re-accommodation procedure, in fixed order: move the booking to a
342
+ * free room of the same or higher category for the whole remaining stay — an
343
+ * upgrade is free — and only when nothing in the house fits, arrange a walk:
344
+ * tonight at the partner hotel on us, back in the original room the next day.
345
+ *
346
+ * The rate on the booking never changes: a forced move is never the guest's
347
+ * cost, so an upgrade rides at the original total.
348
+ */
349
+ export const resolveRoomConflict = failable(
350
+ (state: HotelState, code: string): ConflictResolution | ToolFailure => {
351
+ const booking = orFail(requireConfirmedBooking(state, code));
352
+ if (roomConflict(state, code) === null) {
353
+ return toolFailure("no room conflict on this booking - nothing to resolve");
354
+ }
355
+ const original = orFail(requireFloorPlanRoom(state, booking.roomId));
356
+ const start = booking.checkIn > TODAY ? booking.checkIn : TODAY;
357
+
358
+ // Their `_SQL_FREE_BETTER_ROOM`: fits the party, matches smoking, same or
359
+ // higher rate, free for the whole remaining stay, cheapest first.
360
+ const candidate = state.rooms
361
+ .filter(
362
+ (r) =>
363
+ r.id !== original.id &&
364
+ r.maxOccupancy >= booking.guests &&
365
+ r.smoking === original.smoking &&
366
+ r.nightlyRate >= original.nightlyRate &&
367
+ roomFree(state, r.id, start, booking.checkOut, code),
368
+ )
369
+ .sort((a, b) => a.nightlyRate - b.nightlyRate || a.id.localeCompare(b.id))[0];
370
+
371
+ if (candidate !== undefined) {
372
+ booking.roomId = candidate.id;
373
+ note(state, `Conflict on ${code}: moved to ${candidate.id}`);
374
+ return {
375
+ kind: "moved",
376
+ roomId: candidate.id,
377
+ type: candidate.type,
378
+ view: candidate.view,
379
+ upgraded: candidate.nightlyRate > original.nightlyRate,
380
+ };
381
+ }
382
+
383
+ const returnDate = addDays(start, 1);
384
+ addTicket(state, "walk", "WLK", `${code} walked to ${WALK_PARTNER_HOTEL}, back ${returnDate}`, {
385
+ bookingCode: code,
386
+ partnerHotel: WALK_PARTNER_HOTEL,
387
+ returnDate,
388
+ });
389
+ return { kind: "walked", partner: WALK_PARTNER_HOTEL, returnDate };
390
+ },
391
+ );
392
+
393
+ /**
394
+ * A spoken room number ("304", "room 304", "ph") as the floor plan spells it.
395
+ *
396
+ * The strip-and-fold is `spokenAlphanumeric`'s — this had its own regex pair
397
+ * doing the same job in the other order, and it is `normalizeCode`'s basis too,
398
+ * so the desk now reads a room number and a confirmation code by one rule. What
399
+ * stays local is the word "room" itself, which is this floor plan's vocabulary
400
+ * rather than a fact about spoken ids.
401
+ */
402
+ export function requireRoom(state: FrozenHotelState, spoken: string): Room | ToolFailure {
403
+ const id = spokenAlphanumeric(spoken).replace(/^(ROOM|RM)/, "");
404
+ const room = state.rooms.find((r) => r.id === id);
405
+ return (
406
+ room ?? toolFailure(`no such room: ${spoken} - re-confirm the room number with the caller`)
407
+ );
408
+ }
409
+
410
+ export function invoiceFor(state: FrozenHotelState, code: string): Invoice | undefined {
411
+ return state.invoices.find((i) => i.bookingCode === code) as Invoice | undefined;
412
+ }
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Their `policies/*.md`: a progressive-disclosure knowledge base, one topic per
3
+ * entry, whose first line is the index the model reads in the tool's description
4
+ * and whose body is what it receives on lookup.
5
+ *
6
+ * The receptionist's prompt keeps only the hot-path facts inline; everything
7
+ * long-tail is here, and `lookup_policy` is the one way to reach it. Four topics
8
+ * are RENDERED from `catalogs.ts` rather than written — their files carried a
9
+ * "keep the two in sync" comment against the catalog, and the sync is now a
10
+ * function call. (Their `instructions.py` also pointed the model at a `tours`
11
+ * and a `spa` topic before either file existed; generating them closes that.)
12
+ */
13
+
14
+ import { businessCenterPolicy, floristPolicy, spaPolicy, toursPolicy } from "./catalogs.ts";
15
+ import { PRICING, usd } from "./records.ts";
16
+
17
+ export interface Policy {
18
+ /** One sentence, for the topic index in `lookup_policy`'s description. */
19
+ description: string;
20
+ body: string;
21
+ }
22
+
23
+ export const POLICY_TOPICS = [
24
+ "accessibility",
25
+ "business_center",
26
+ "cancellation",
27
+ "florist",
28
+ "functions",
29
+ "group_bookings",
30
+ "guest_privacy",
31
+ "guest_services",
32
+ "guest_walks",
33
+ "local_area",
34
+ "location_and_transport",
35
+ "payments_and_currency",
36
+ "restaurant_dietary",
37
+ "restaurant_dining",
38
+ "restaurant_menu",
39
+ "room_service",
40
+ "rooms_and_amenities",
41
+ "safe_deposit",
42
+ "spa",
43
+ "tours",
44
+ ] as const;
45
+
46
+ export type PolicyTopic = (typeof POLICY_TOPICS)[number];
47
+
48
+ export const POLICIES: Record<PolicyTopic, Policy> = {
49
+ accessibility: {
50
+ description: "Wheelchair and ADA accessibility: accessible rooms, roll-in showers.",
51
+ body: "Accessibility: ADA-accessible rooms on every floor, roll-in showers in the suites. Mention at booking so we assign one.",
52
+ },
53
+ business_center: {
54
+ description:
55
+ "Business centre services bookable through the desk: meeting room, secretarial help, and printing.",
56
+ body: businessCenterPolicy(),
57
+ },
58
+ cancellation: {
59
+ description:
60
+ "Cancellation, deposit, and no-show terms for room bookings: the cancellation window, what's charged and when, and how no-shows work.",
61
+ body:
62
+ `Cancellation: a confirmed booking can be cancelled free of charge up to ${PRICING.cancellationWindowHours} hours before check-in, with a full refund to the card on file (usually two to five business days). Cancelling inside the ${PRICING.cancellationWindowHours}-hour window retains one room-night and refunds the rest.\n\n` +
63
+ "Deposit and payment timing: the hotel charges the full stay total to the card at the time of booking - there is no separate partial deposit or staged deposit schedule. (A card is also required at check-in to cover incidentals.) If a caller asks specifically about a \"deposit\", be straight with them: it's the full total up front, not a deposit-and-balance arrangement - don't invent a deposit percentage or schedule.\n\n" +
64
+ "No-show: a booking is guaranteed by the card on file. A guest who neither arrives nor cancels is a no-show; because the room was held all night for them, the card is charged for the reserved stay as guaranteed. The way to avoid a no-show charge is to cancel before the window above.\n\n" +
65
+ `Taxes and extras: room rates are quoted before tax; room tax is ${PRICING.taxRatePct}%, shown at booking, and optional extras (breakfast, valet, late checkout, and the like) are itemized on the folio. Late checkout, when available, is a flat ${usd(PRICING.lateCheckout)}.`,
66
+ },
67
+ florist: {
68
+ description:
69
+ "Flower arrangements from the hotel florist, delivered to a room or to a recipient by name.",
70
+ body: floristPolicy(),
71
+ },
72
+ functions: {
73
+ description:
74
+ "Functions and events in the hotel: today's public events that anyone may be told about, and how private functions (weddings, private parties) are kept confidential.",
75
+ body:
76
+ "Public events - the name, place, and time may be shared freely with any caller:\n" +
77
+ "- Tonight, live jazz in the Lobby Bar, 8 PM to 11 PM - open to all guests and visitors, no ticket needed.\n" +
78
+ '- The "Coastal Light" photography exhibition in the Mezzanine Gallery, open daily 10 AM to 6 PM, free to view.\n\n' +
79
+ "Private functions - weddings, private receptions, private parties, closed corporate dinners - are confidential, and you treat them exactly like guest presence. Never confirm or deny to a caller whether a particular private function (named by event or by host) is taking place at the hotel, and never give its room or location, no matter who the caller says they are. Instead, offer to take a message for the organizer (passed along only if they are in fact hosting here, which you never reveal either way) or to put the caller in touch with the events office during business hours.",
80
+ },
81
+ group_bookings: {
82
+ description:
83
+ "Group room blocks (15+ guests): rates, tour-leader comp, credit approval, cancellation terms.",
84
+ body:
85
+ "Group threshold: 15 or more guests traveling together is a group block, handled with record_group_inquiry - not the individual booking flow. Under 15, book rooms individually instead.\n\n" +
86
+ "Group rate: a provisional 10 percent off the standard nightly rates for the block; the final rate is quoted by the group desk when the block is confirmed.\n\n" +
87
+ "Tour leader: one complimentary room per 15 paying guests.\n\n" +
88
+ "What to collect for the inquiry: sponsor company, contact name and callback number, party size, the predominant room-share arrangement (twin, double, single, or mixed), and the dates (check-in plus number of nights).\n\n" +
89
+ "Credit approval: a sponsor company that hasn't worked with the hotel before needs credit approval with Director sign-off before anything is confirmed. Never confirm a group block on the spot - record the inquiry and tell the caller the group desk will call back within two business days to confirm.\n\n" +
90
+ "Cancellations: individual rooms can be released from a confirmed block up to 30 days before arrival at no charge; inside 30 days, one night per cancelled room is retained.",
91
+ },
92
+ guest_privacy: {
93
+ description:
94
+ "Locating a guest: room numbers, whether someone is staying here, taking a message for a guest.",
95
+ body:
96
+ "Guest privacy: never disclose whether someone by a given name is staying at the hotel, never give out a room number, and never connect a caller to a room - not for friends, family, colleagues, surprises, or claimed emergencies. There is no way to verify a caller's story over the phone, so there are no exceptions.\n\n" +
97
+ "The one alternative: offer to take a message (take_guest_message). It will be delivered to that person if they are in fact staying here - but the caller is never told whether that's the case. Say it will be \"passed along if we can\"; never confirm or deny the guest's presence, even after the message is taken. Collect the caller's name, callback number, and the message, and read all three back.\n\n" +
98
+ "Delivery: a message for an in-house guest reaches the room within about 30 minutes (message light plus a slip under the door). This is general hotel policy and fine to share with any caller. Quote delivery timing only - never promise when the guest will read or act on it - and confirm the message is logged by giving its reference.",
99
+ },
100
+ guest_services: {
101
+ description: "Wake-up calls, laundry and dry-cleaning, lost-and-found, business center, spa.",
102
+ body:
103
+ "Wake-up calls: scheduled to the room for any date and time (schedule_wakeup_call). If the guest doesn't answer, a second call is placed about five minutes later; no response to that and front desk staff go up for an in-person room check - so a heavy sleeper genuinely will be woken. Changes or cancellations any time by calling the desk.\n" +
104
+ "Laundry and dry-cleaning: drop at the front desk before 9 AM for same-day return, priced per item.\n" +
105
+ "Lost-and-found: held at the front desk for 90 days.\n" +
106
+ "Business center: 24/7 lobby workstations with printing; bookable services under the business_center topic.\n" +
107
+ "Spa: on the third floor; bookable services under the spa topic.",
108
+ },
109
+ guest_walks: {
110
+ description:
111
+ "Overbooked or unavailable room for a confirmed guest: the re-accommodation and walk procedure.",
112
+ body:
113
+ 'When a confirmed guest has no room (double-booked, oversold night): own it - apologize plainly, no hiding behind "the system". Explain plainly WHY it happened: the hotel was overbooked - we oversold the night - so even though their reservation is confirmed, the physical room isn\'t available tonight. That is our mistake, not theirs.\n\n' +
114
+ "The procedure is fixed and resolve_room_conflict runs it in order:\n" +
115
+ "1. Move them within the house first: a free room of the same or better category for the whole stay. An upgrade is free - a forced move is never the guest's cost.\n" +
116
+ '2. Only when nothing in the house fits, walk them: tonight at our partner hotel, the Harbor House, two blocks away and comparable. The room there is paid by us, the taxi over (and back) is covered by us, and their room here is guaranteed from the return date the tool gives. Say "at no extra cost to you" explicitly.\n' +
117
+ "3. State the specifics when confirming: which hotel, how they get there, and the plan for tomorrow.\n\n" +
118
+ 'Delivering it to an upset guest: lead with the honest explanation and the apology, then the plan. Deliver it in short pieces and make sure every piece gets said before the call ends. If the guest stays angry after the full plan, offer a manager callback (record_followup, kind="callback") rather than arguing.',
119
+ },
120
+ local_area: {
121
+ description:
122
+ "Local-area information: getting downtown, public transit and taxis, nearby sights, banks and ATMs, pharmacy and medical, and places of worship.",
123
+ body:
124
+ "Getting downtown: downtown San Francisco is about ten minutes by car from the hotel and walkable in roughly twenty-five minutes. The nearest Muni stop is two blocks away; BART is a ten-minute walk and is the fastest way across town or out to the airport. Cabs and rideshares pick up at the main entrance - the doorman will hail a cab, and for a guaranteed pickup time the front desk can arrange the hotel car.\n\n" +
125
+ "Public transit: a reloadable Clipper card works on Muni, BART, and the cable cars. Cable cars run from the downtown turnaround; expect a line at peak times.\n\n" +
126
+ "Nearby sights: the waterfront and the main shopping street are both walkable. For the classic outings - the bay and bridge, the wharf, the parks - the half-day and full-day sightseeing tours (book_tour) cover the highlights with lobby pickup.\n\n" +
127
+ "Banks and ATMs: bank branches and ATMs within a couple of blocks, toward the main shopping street. For changing foreign cash into dollars, the front desk exchanges major currencies in person (see payments_and_currency).\n\n" +
128
+ "Pharmacy and medical: a pharmacy is within two blocks and a 24-hour pharmacy is nearby. Non-emergency urgent care is about five blocks south, and the nearest hospital is six blocks east. For a medical emergency the caller should dial 911.\n\n" +
129
+ "Places of worship: churches, a synagogue, and a mosque within walking distance or a short ride. The desk doesn't keep exact service times - offer to confirm those rather than guessing.\n\n" +
130
+ "General: give concrete directions and options the way a concierge would, but don't invent exact street addresses, phone numbers, or hours you don't have. When a detail isn't on hand, offer to find it out (record_followup) rather than improvising.",
131
+ },
132
+ location_and_transport: {
133
+ description:
134
+ "Address, airport access, public transit, parking pickup points, and the surrounding neighborhood.",
135
+ body:
136
+ "Address: 100 Harborlight Way, San Francisco.\n" +
137
+ "Airport: SFO is roughly 30 minutes by car. No hotel shuttle; the front desk will arrange a ride.\n" +
138
+ "Airport rides: the hotel car is a flat 85 dollars to SFO, seats up to four with luggage, books in advance at the desk (book_airport_car) and charges to the room - pickup at the front entrance. Taxis run metered, roughly 55 to 70 dollars to SFO, hailed at the door by the doorman but not reservable ahead. For a guaranteed time, the hotel car is the one to book. Getting FROM the airport is a taxi, a rideshare, or BART - the hotel car runs hotel-to-airport only.\n" +
139
+ "Getting around: nearest Muni stop is two blocks away; BART is a 10-minute walk. Cabs and rideshares pick up at the main entrance.\n" +
140
+ "Neighborhood: a few coffee shops and a 24-hour pharmacy within two blocks. The nearest hospital is six blocks east; non-emergency urgent care five blocks south.\n" +
141
+ "Things to do nearby: walkable to the waterfront and the main shopping street; the front desk keeps a list of dinner spots, museums, and tour operators for guests who ask.",
142
+ },
143
+ payments_and_currency: {
144
+ description:
145
+ "Accepted cards and payment methods, paying cash, foreign-currency exchange, exchange rates.",
146
+ body:
147
+ "Cards: Visa, Mastercard, American Express, and Discover - credit or debit; Apple Pay and Google Pay at the desk. A card is required at check-in for incidentals even when paying cash. No personal checks.\n\n" +
148
+ "Cash: US dollars are accepted for settling the bill. Foreign currency is not accepted as payment.\n\n" +
149
+ "Currency exchange: the front desk exchanges major foreign currencies (euros, pounds, yen, and similar) into US dollars for resident guests - in person at the desk, passport required, at the day's posted rate, with change given in dollars.\n\n" +
150
+ 'Exchange rates: the rate is posted at the desk each morning. There is no way to quote it over the phone - give the mechanism, never improvise, estimate, or "roughly" quote a rate on a call.\n\n' +
151
+ 'Card on file problems: when a guest\'s card isn\'t going through, keep it discreet - it "isn\'t going through at the moment, possibly a technical issue", never "declined" or "rejected", and never speculate about their funds. The moment the guest offers a replacement card, take it on this call (update_card, after verification) - never defer an offered card to check-in. ONLY when the guest has no other card to give: no pressure - the booking stays held, suggest they check with their card issuer, and log a callback to retry.',
152
+ },
153
+ restaurant_dietary: {
154
+ description: "Dietary restrictions, vegetarian options, and food-allergy handling.",
155
+ body: "Dietary and allergies: vegetarian and most dietary needs handled. For severe or anaphylactic allergies, the kitchen needs to know at the reservation.",
156
+ },
157
+ restaurant_dining: {
158
+ description: "Dress code, seating and reservations, private dining, celebrations.",
159
+ body:
160
+ "Dress code: smart casual. No jacket required.\n" +
161
+ "Seating: indoor dining room, outdoor terrace, and a bar. Children welcome.\n" +
162
+ "Reservations: bar walk-ins fine anytime; tables are reservation-only on weekends.\n" +
163
+ "Private dining: separate room seats up to twelve. Advance reservation required - the restaurant arranges it directly (transfer_call to the restaurant).\n" +
164
+ "Celebrations: mention a birthday or anniversary at the reservation and the kitchen sends out a small dessert.",
165
+ },
166
+ restaurant_menu: {
167
+ description: "What the restaurant serves and how to handle dish or price questions.",
168
+ body:
169
+ "Menu: standard dinner fare - starters and salads, mains (salmon, chicken, steak, pasta, " +
170
+ "burger, vegetarian risotto), sides, desserts, full bar. Specific dish prices rotate and I " +
171
+ "don't keep them memorized; if the caller asks about a particular dish or price I don't have, " +
172
+ 'offer to note the question for the kitchen via record_followup (kind "other").',
173
+ },
174
+ room_service: {
175
+ description: "Room service hours and menu; takeout and delivery policy.",
176
+ body: "Room service: same menu as the restaurant, 5:30 to 9:30 PM.\nTakeout and delivery: not offered.",
177
+ },
178
+ rooms_and_amenities: {
179
+ description: "In-room amenities and features, cribs and rollaway beds, connecting rooms.",
180
+ body:
181
+ "Rooms: 55-inch TV, mini-fridge, safe, iron, hair dryer, Nespresso, blackout curtains. King beds in most rooms; suites have a separate sitting area.\n" +
182
+ "Cribs and rollaway beds: free on request, subject to availability - mention it at booking or call ahead.\n" +
183
+ "Connecting rooms: available on request, subject to availability.",
184
+ },
185
+ safe_deposit: {
186
+ description:
187
+ "Safe-deposit boxes and in-room safes: storing valuables, access, hours, and the hotel's liability.",
188
+ body:
189
+ "In-room safe: every room has a small electronic safe in the closet, set with a code the guest chooses. Guests manage it themselves; the front desk doesn't keep a master code, but staff can come up and reset an empty safe if a guest forgets theirs.\n\n" +
190
+ "Safe-deposit boxes: complimentary safe-deposit boxes are held behind the front desk for anything a guest would rather not leave in the room. Ask at the desk to open one; it's free for the length of the stay.\n\n" +
191
+ "Access: in person at the desk, by the guest on the booking, with photo ID - it's not opened for anyone else and there's no access by phone. The desk is staffed 24 hours. An early check-out still has to empty the box in person before settling up.\n\n" +
192
+ "Liability: items properly deposited in a front-desk box are covered up to the limit posted at the desk. For valuables left loose in the room, the hotel's liability is limited - which is exactly why the safe and the deposit boxes are there.",
193
+ },
194
+ spa: {
195
+ description:
196
+ "Spa and health club services bookable through the desk: massage, facial, personal training, and group yoga.",
197
+ body: spaPolicy(),
198
+ },
199
+ tours: {
200
+ description:
201
+ "Sightseeing tours bookable through the desk: half-day, full-day, and private city tours.",
202
+ body: toursPolicy(),
203
+ },
204
+ };
205
+
206
+ /** The topic index, as the tool description reads it out to the model. */
207
+ export function policyIndex(): string {
208
+ return POLICY_TOPICS.map((topic) => `- ${topic}: ${POLICIES[topic].description}`).join("\n");
209
+ }