@alexkroman1/aai-cli 16.0.1 → 17.0.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.
Files changed (454) hide show
  1. package/README.md +3 -2
  2. package/dist/{_build-target-55dJisQ-.mjs → _build-target-C08aM-Es.mjs} +511 -41
  3. package/dist/_build-target.d.ts +109 -2
  4. package/dist/_deno-target.d.ts +15 -14
  5. package/dist/_dev-env.d.ts +19 -13
  6. package/dist/{_dev-server-BzWB6-4y.mjs → _dev-server-CLU9xjH5.mjs} +27 -19
  7. package/dist/_dev-server.d.ts +4 -3
  8. package/dist/_dev-vite-config.d.ts +1 -1
  9. package/dist/_init.d.ts +39 -0
  10. package/dist/_modal-target.d.ts +11 -6
  11. package/dist/_preflight-CnW9QiE7.mjs +116 -0
  12. package/dist/_preflight.d.ts +110 -5
  13. package/dist/{_server-common-De0haHr9.mjs → _server-common-DAcv1nC5.mjs} +46 -2
  14. package/dist/_server-common.d.ts +39 -0
  15. package/dist/_target-bundle.d.ts +112 -0
  16. package/dist/_target-entry.d.ts +81 -0
  17. package/dist/{_templates-CuP74F8D.mjs → _templates-IMeKMVIj.mjs} +1 -1
  18. package/dist/{_vitest-runner-AVR9VtXh.mjs → _vitest-runner-CZNGj0ZC.mjs} +22 -17
  19. package/dist/_vitest-runner.d.ts +36 -24
  20. package/dist/{_workflow-determinism-CvpqMpdh.mjs → _workflow-determinism-CLxFQ5ox.mjs} +1 -1
  21. package/dist/_workflow-determinism.d.ts +1 -1
  22. package/dist/{build-ButI2IKc.mjs → build-DrQTSc2R.mjs} +187 -289
  23. package/dist/build.d.ts +88 -2
  24. package/dist/cli.mjs +20 -16
  25. package/dist/{deploy-CGqPU5U-.mjs → deploy-B68-x7xM.mjs} +14 -6
  26. package/dist/deploy.d.ts +9 -0
  27. package/dist/{dev-kodAY23K.mjs → dev-ChsrNHpK.mjs} +1 -1
  28. package/dist/dev.d.ts +1 -1
  29. package/dist/{eval-DvoSz7SZ.mjs → eval-DB07kTxO.mjs} +2 -2
  30. package/dist/init-W-4k-lCF.mjs +559 -0
  31. package/dist/init.d.ts +43 -3
  32. package/dist/scaffold/CLAUDE.md +87 -100
  33. package/dist/scaffold/package.json +6 -6
  34. package/dist/scaffold/vite.config.ts +29 -1
  35. package/dist/start.mjs +1 -1
  36. package/dist/{studio-CtRBVVFR.mjs → studio-DEAJGBXa.mjs} +20 -10
  37. package/dist/templates/{hiring-desk → applicant-screening-agent}/agent.eval.test.ts +20 -6
  38. package/dist/templates/{hiring-desk → applicant-screening-agent}/agent.ts +28 -0
  39. package/dist/templates/{hiring-desk → applicant-screening-agent}/crews.ts +1 -1
  40. package/dist/templates/{hiring-desk → applicant-screening-agent}/shared.ts +11 -11
  41. package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/screening_status.ts +1 -1
  42. package/dist/templates/{call-audit → call-audit-workflow}/agent.ts +4 -2
  43. package/dist/templates/{call-audit → call-audit-workflow}/client.tsx +3 -3
  44. package/dist/templates/{call-audit → call-audit-workflow}/guards.test.ts +2 -2
  45. package/dist/templates/{call-audit → call-audit-workflow}/workflows/summarize.ts +1 -1
  46. package/dist/templates/{code-interpreter → code-interpreter-agent}/agent.eval.test.ts +3 -2
  47. package/dist/templates/{code-interpreter → code-interpreter-agent}/agent.test.ts +1 -1
  48. package/dist/templates/{code-interpreter → code-interpreter-agent}/agent.ts +1 -0
  49. package/dist/templates/coding-agent/agent.eval.test.ts +136 -0
  50. package/dist/templates/coding-agent/agent.test.ts +109 -0
  51. package/dist/templates/coding-agent/agent.ts +45 -0
  52. package/dist/templates/coding-agent/chat.ts +63 -0
  53. package/dist/templates/coding-agent/shared.ts +46 -0
  54. package/dist/templates/coding-agent/system-prompt.md +32 -0
  55. package/dist/templates/coding-agent/tools/bash.ts +6 -0
  56. package/dist/templates/coding-agent/tools/delete_file.ts +6 -0
  57. package/dist/templates/coding-agent/tools/edit_file.ts +6 -0
  58. package/dist/templates/coding-agent/tools/glob.ts +6 -0
  59. package/dist/templates/coding-agent/tools/grep.ts +6 -0
  60. package/dist/templates/coding-agent/tools/list_files.ts +6 -0
  61. package/dist/templates/coding-agent/tools/read_file.ts +6 -0
  62. package/dist/templates/coding-agent/tools/todo_write.ts +6 -0
  63. package/dist/templates/coding-agent/tools/write_file.ts +6 -0
  64. package/dist/templates/{pipeline-simple → custom-pipeline-agent}/agent.test.ts +2 -2
  65. package/dist/templates/{pipeline-simple → custom-pipeline-agent}/agent.ts +2 -1
  66. package/dist/templates/{pipeline-simple → custom-pipeline-agent}/modes.test.ts +1 -1
  67. package/dist/templates/{redline → document-redline-workflow}/agent.ts +4 -2
  68. package/dist/templates/{redline → document-redline-workflow}/client.tsx +1 -1
  69. package/dist/templates/{redline → document-redline-workflow}/workflows/redline.ts +1 -1
  70. package/dist/templates/{dispatch-center → emergency-dispatch-agent}/agent.test.ts +104 -1
  71. package/dist/templates/{dispatch-center → emergency-dispatch-agent}/agent.ts +15 -0
  72. package/dist/templates/{dispatch-center → emergency-dispatch-agent}/events.ts +1 -1
  73. package/dist/templates/emergency-dispatch-agent/guardrails.ts +105 -0
  74. package/dist/templates/{dispatch-center → emergency-dispatch-agent}/system-prompt.md +1 -0
  75. package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_create.ts +1 -1
  76. package/dist/templates/{night-owl → entertainment-picks-agent}/agent.eval.test.ts +8 -1
  77. package/dist/templates/{night-owl → entertainment-picks-agent}/agent.test.ts +1 -1
  78. package/dist/templates/{night-owl → entertainment-picks-agent}/agent.ts +1 -0
  79. package/dist/templates/{night-owl → entertainment-picks-agent}/client.tsx +1 -1
  80. package/dist/templates/{night-owl → entertainment-picks-agent}/system-prompt.md +6 -0
  81. package/dist/templates/{night-owl → entertainment-picks-agent}/tools/revisit.ts +7 -0
  82. package/dist/templates/{executive-assistant → executive-inbox-agent}/agent.eval.test.ts +84 -23
  83. package/dist/templates/{executive-assistant → executive-inbox-agent}/agent.ts +1 -0
  84. package/dist/templates/{executive-assistant → executive-inbox-agent}/meeting.ts +2 -2
  85. package/dist/templates/{executive-assistant → executive-inbox-agent}/prompts.ts +3 -1
  86. package/dist/templates/{executive-assistant → executive-inbox-agent}/shared.ts +2 -2
  87. package/dist/templates/{executive-assistant → executive-inbox-agent}/system-prompt.md +3 -3
  88. package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/meeting_assistant.ts +3 -3
  89. package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/open_email.ts +8 -16
  90. package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/send_calendar_invite.ts +1 -1
  91. package/dist/templates/{hotel-desk → hotel-reception-agent}/agent.eval.test.ts +85 -21
  92. package/dist/templates/{hotel-desk → hotel-reception-agent}/agent.test.ts +2 -1
  93. package/dist/templates/{hotel-desk → hotel-reception-agent}/agent.ts +6 -3
  94. package/dist/templates/{hotel-desk → hotel-reception-agent}/client.tsx +14 -2
  95. package/dist/templates/{hotel-desk → hotel-reception-agent}/concierge.ts +3 -2
  96. package/dist/templates/{hotel-desk → hotel-reception-agent}/desk-seams.test.ts +2 -1
  97. package/dist/templates/{hotel-desk → hotel-reception-agent}/disputes.ts +9 -11
  98. package/dist/templates/{hotel-desk → hotel-reception-agent}/events.ts +2 -1
  99. package/dist/templates/hotel-reception-agent/session.ts +56 -0
  100. package/dist/templates/{hotel-desk → hotel-reception-agent}/shared.ts +21 -22
  101. package/dist/templates/{hotel-desk → hotel-reception-agent}/system-prompt.md +1 -1
  102. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/abandon_booking.ts +2 -1
  103. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/add_to_waitlist.ts +2 -1
  104. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/book_airport_car.ts +2 -1
  105. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/cancel_restaurant_reservation.ts +2 -1
  106. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/cancel_room_booking.ts +2 -1
  107. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/check_restaurant_availability.ts +1 -1
  108. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/check_room_availability.ts +1 -1
  109. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/choose_room.ts +1 -1
  110. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/confirm_booking.ts +2 -1
  111. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/dispatch_emergency.ts +2 -1
  112. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/dispute_charge.ts +2 -1
  113. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/flag_late_arrival.ts +2 -1
  114. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_booking.ts +2 -1
  115. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_guest_history.ts +1 -1
  116. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_invoice.ts +2 -1
  117. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_restaurant_reservation.ts +1 -1
  118. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/modify_restaurant_reservation.ts +1 -1
  119. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/record_card.ts +1 -1
  120. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/record_followup.ts +2 -1
  121. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/record_group_inquiry.ts +2 -1
  122. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/record_guest_details.ts +1 -1
  123. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/reinstate_booking.ts +1 -1
  124. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/request_flight_reconfirmation.ts +2 -1
  125. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/resend_confirmation.ts +2 -1
  126. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/reserve_table.ts +1 -1
  127. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/resolve_room_conflict.ts +2 -1
  128. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/schedule_wakeup_call.ts +2 -1
  129. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/set_do_not_disturb.ts +2 -1
  130. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/set_extras.ts +1 -1
  131. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/set_stay.ts +2 -1
  132. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/start_booking_modification.ts +2 -1
  133. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/start_room_booking.ts +2 -1
  134. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/take_guest_message.ts +2 -1
  135. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/transfer_call.ts +2 -1
  136. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/update_card.ts +2 -1
  137. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/verify_booking.ts +2 -1
  138. package/dist/templates/{link-digest → link-digest-workflow}/agent.eval.test.ts +16 -1
  139. package/dist/templates/{link-digest → link-digest-workflow}/agent.test.ts +2 -2
  140. package/dist/templates/{link-digest → link-digest-workflow}/agent.ts +8 -3
  141. package/dist/templates/{link-digest → link-digest-workflow}/client.tsx +2 -2
  142. package/dist/templates/{link-digest → link-digest-workflow}/workflows/digest.ts +1 -1
  143. package/dist/templates/{health-assistant → medication-safety-agent}/agent.test.ts +55 -1
  144. package/dist/templates/medication-safety-agent/agent.ts +62 -0
  145. package/dist/templates/{recap-workflow → meeting-recap-agent}/agent.test.ts +4 -4
  146. package/dist/templates/{recap-workflow → meeting-recap-agent}/agent.ts +5 -1
  147. package/dist/templates/{recap-workflow → meeting-recap-agent}/workflows/recap.ts +3 -3
  148. package/dist/templates/{pizza-ordering → pizza-ordering-agent}/agent.ts +3 -0
  149. package/dist/templates/{podcast-digest → podcast-digest-workflow}/agent.eval.test.ts +1 -1
  150. package/dist/templates/{podcast-digest → podcast-digest-workflow}/agent.test.ts +1 -1
  151. package/dist/templates/{podcast-digest → podcast-digest-workflow}/agent.ts +6 -2
  152. package/dist/templates/{podcast-digest → podcast-digest-workflow}/client.tsx +3 -3
  153. package/dist/templates/{podcast-digest → podcast-digest-workflow}/workflows/digest.ts +1 -1
  154. package/dist/templates/{simple → quickstart-agent}/agent.eval.test.ts +39 -3
  155. package/dist/templates/{simple → quickstart-agent}/agent.test.ts +25 -3
  156. package/dist/templates/quickstart-agent/agent.ts +24 -0
  157. package/dist/templates/quickstart-agent/system-prompt.md +8 -0
  158. package/dist/templates/quickstart-agent/tools/get_weather.ts +59 -0
  159. package/dist/templates/{research-workflow → research-handoff-agent}/agent.test.ts +1 -1
  160. package/dist/templates/{research-workflow → research-handoff-agent}/agent.ts +5 -1
  161. package/dist/templates/{research-workflow → research-handoff-agent}/workflows/filing.ts +1 -1
  162. package/dist/templates/{research-workflow → research-handoff-agent}/workflows/research.ts +1 -1
  163. package/dist/templates/{research-workflow → research-handoff-agent}/workflows/review.ts +1 -1
  164. package/dist/templates/{plan-and-execute → research-planner-agent}/agent.eval.test.ts +24 -2
  165. package/dist/templates/{plan-and-execute → research-planner-agent}/agent.ts +3 -0
  166. package/dist/templates/{plan-and-execute → research-planner-agent}/shared.ts +1 -1
  167. package/dist/templates/{plan-and-execute → research-planner-agent}/system-prompt.md +1 -1
  168. package/dist/templates/{retail → retail-orders-agent}/agent.ts +32 -3
  169. package/dist/templates/retail-orders-agent/keyterms.ts +154 -0
  170. package/dist/templates/{retail → retail-orders-agent}/pending.ts +2 -2
  171. package/dist/templates/{retail → retail-orders-agent}/resolve.ts +18 -3
  172. package/dist/templates/{retail → retail-orders-agent}/shared.ts +1 -1
  173. package/dist/templates/{retail → retail-orders-agent}/store.ts +3 -3
  174. package/dist/templates/{roadside-assist → roadside-assistance-agent}/agent.eval.test.ts +37 -5
  175. package/dist/templates/{roadside-assist → roadside-assistance-agent}/agent.test.ts +38 -6
  176. package/dist/templates/{roadside-assist → roadside-assistance-agent}/agent.ts +5 -1
  177. package/dist/templates/{roadside-assist → roadside-assistance-agent}/call.ts +1 -1
  178. package/dist/templates/{roadside-assist → roadside-assistance-agent}/shared.ts +15 -3
  179. package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/acknowledge_disclosure.ts +14 -0
  180. package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/dispatch_truck.ts +1 -1
  181. package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/lookup_coverage.ts +11 -0
  182. package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/service_disclosure.ts +17 -11
  183. package/dist/templates/{roadside-assist → roadside-assistance-agent}/yard.test.ts +4 -0
  184. package/dist/templates/{spoken-summary → spoken-summary-workflow}/agent.test.ts +1 -1
  185. package/dist/templates/{spoken-summary → spoken-summary-workflow}/agent.ts +5 -1
  186. package/dist/templates/{spoken-summary → spoken-summary-workflow}/client.tsx +1 -1
  187. package/dist/templates/{spoken-summary → spoken-summary-workflow}/workflows/summarize.ts +1 -1
  188. package/dist/templates/{solo-rpg → tabletop-rpg-agent}/agent.eval.test.ts +6 -0
  189. package/dist/templates/{solo-rpg → tabletop-rpg-agent}/agent.test.ts +125 -1
  190. package/dist/templates/tabletop-rpg-agent/agent.ts +58 -0
  191. package/dist/templates/{solo-rpg → tabletop-rpg-agent}/shared.ts +84 -3
  192. package/dist/templates/{solo-rpg → tabletop-rpg-agent}/system-prompt.md +1 -1
  193. package/dist/templates/tabletop-rpg-agent/tools/check_state.ts +37 -0
  194. package/dist/templates/{support-line → technical-support-agent}/agent.test.ts +3 -3
  195. package/dist/templates/{support-line → technical-support-agent}/agent.ts +5 -1
  196. package/dist/templates/technical-support-agent/knowledge.ts +165 -0
  197. package/dist/templates/{support-line → technical-support-agent}/nodes.ts +3 -2
  198. package/dist/templates/{support-line → technical-support-agent}/procedure.ts +4 -3
  199. package/dist/templates/technical-support-agent/shared.ts +145 -0
  200. package/dist/templates/{support-line → technical-support-agent}/tools/list_topics.ts +2 -1
  201. package/dist/templates/{infocom-adventure → text-adventure-agent}/agent.eval.test.ts +39 -6
  202. package/dist/templates/{infocom-adventure → text-adventure-agent}/agent.test.ts +79 -1
  203. package/dist/templates/{infocom-adventure → text-adventure-agent}/agent.ts +30 -1
  204. package/dist/templates/{infocom-adventure → text-adventure-agent}/client.tsx +2 -2
  205. package/dist/templates/{infocom-adventure → text-adventure-agent}/shared.ts +37 -0
  206. package/dist/templates/{infocom-adventure → text-adventure-agent}/system-prompt.md +9 -2
  207. package/dist/templates/{briefing-desk → topic-briefing-agent}/agent.eval.test.ts +21 -7
  208. package/dist/templates/{briefing-desk → topic-briefing-agent}/agent.test.ts +23 -11
  209. package/dist/templates/{briefing-desk → topic-briefing-agent}/agent.ts +5 -2
  210. package/dist/templates/{briefing-desk → topic-briefing-agent}/shared.ts +11 -11
  211. package/dist/templates/{briefing-desk → topic-briefing-agent}/slack.ts +1 -1
  212. package/dist/templates/{briefing-desk → topic-briefing-agent}/system-prompt.md +13 -8
  213. package/dist/templates/{briefing-desk → topic-briefing-agent}/tools/send_briefing.ts +43 -5
  214. package/dist/templates/transcription-workflow/agent.test.ts +1 -1
  215. package/dist/templates/transcription-workflow/agent.ts +4 -1
  216. package/dist/templates/transcription-workflow/client.tsx +1 -1
  217. package/dist/templates/transcription-workflow/workflows/batch.ts +2 -2
  218. package/dist/templates/transcription-workflow/workflows/transcribe.ts +1 -1
  219. package/dist/templates/{travel-concierge → travel-concierge-agent}/agent.ts +4 -0
  220. package/dist/templates/{travel-concierge → travel-concierge-agent}/shared.ts +1 -1
  221. package/dist/templates/{web-researcher → web-research-agent}/agent.eval.test.ts +32 -6
  222. package/dist/templates/{web-researcher → web-research-agent}/agent.test.ts +17 -1
  223. package/dist/templates/{web-researcher → web-research-agent}/agent.ts +31 -1
  224. package/dist/templates/{web-researcher → web-research-agent}/system-prompt.md +8 -2
  225. package/dist/templates/{word-wrangler → word-game-agent}/agent.eval.test.ts +79 -18
  226. package/dist/templates/{word-wrangler → word-game-agent}/agent.ts +20 -0
  227. package/dist/templates/{word-wrangler → word-game-agent}/game.ts +1 -1
  228. package/dist/templates/{word-wrangler → word-game-agent}/shared.ts +1 -1
  229. package/dist/test-CjKPQ9_B.mjs +102 -0
  230. package/dist/test.d.ts +37 -12
  231. package/package.json +5 -5
  232. package/dist/_init-BzQbV8Zh.mjs +0 -199
  233. package/dist/_preflight-CcAR577V.mjs +0 -46
  234. package/dist/init-D363Ls5u.mjs +0 -183
  235. package/dist/templates/health-assistant/agent.ts +0 -15
  236. package/dist/templates/simple/agent.ts +0 -8
  237. package/dist/templates/solo-rpg/agent.ts +0 -29
  238. package/dist/templates/solo-rpg/tools/check_state.ts +0 -28
  239. package/dist/templates/support-line/shared.ts +0 -281
  240. package/dist/test-Cllnx81G.mjs +0 -83
  241. /package/dist/templates/{hiring-desk → applicant-screening-agent}/agent.test.ts +0 -0
  242. /package/dist/templates/{hiring-desk → applicant-screening-agent}/client.tsx +0 -0
  243. /package/dist/templates/{hiring-desk → applicant-screening-agent}/leads.json +0 -0
  244. /package/dist/templates/{hiring-desk → applicant-screening-agent}/screening-lock.test.ts +0 -0
  245. /package/dist/templates/{hiring-desk → applicant-screening-agent}/screening-lock.ts +0 -0
  246. /package/dist/templates/{hiring-desk → applicant-screening-agent}/system-prompt.md +0 -0
  247. /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/candidate_details.ts +0 -0
  248. /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/proceed_to_emails.ts +0 -0
  249. /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/read_email.ts +0 -0
  250. /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/rescore_with_feedback.ts +0 -0
  251. /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/screen_candidates.ts +0 -0
  252. /package/dist/templates/{call-audit → call-audit-workflow}/agent.eval.test.ts +0 -0
  253. /package/dist/templates/{call-audit → call-audit-workflow}/agent.test.ts +0 -0
  254. /package/dist/templates/{call-audit → call-audit-workflow}/workflows/audit.ts +0 -0
  255. /package/dist/templates/{call-audit → call-audit-workflow}/workflows/ingest.ts +0 -0
  256. /package/dist/templates/{call-audit → call-audit-workflow}/workflows/media.ts +0 -0
  257. /package/dist/templates/{call-audit → call-audit-workflow}/workflows/sync-api.ts +0 -0
  258. /package/dist/templates/{code-interpreter → code-interpreter-agent}/system-prompt.md +0 -0
  259. /package/dist/templates/{pipeline-simple → custom-pipeline-agent}/agent.eval.test.ts +0 -0
  260. /package/dist/templates/{pipeline-simple → custom-pipeline-agent}/stages.test.ts +0 -0
  261. /package/dist/templates/{redline → document-redline-workflow}/agent.eval.test.ts +0 -0
  262. /package/dist/templates/{redline → document-redline-workflow}/agent.test.ts +0 -0
  263. /package/dist/templates/{redline → document-redline-workflow}/form.ts +0 -0
  264. /package/dist/templates/{redline → document-redline-workflow}/workflows/prompts.ts +0 -0
  265. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/agent.eval.test.ts +0 -0
  266. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/client.tsx +0 -0
  267. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/shared.ts +0 -0
  268. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_add_note.ts +0 -0
  269. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_escalate.ts +0 -0
  270. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_get.ts +0 -0
  271. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_triage.ts +0 -0
  272. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_update_status.ts +0 -0
  273. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/ops_dashboard.ts +0 -0
  274. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/ops_protocols.ts +0 -0
  275. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/ops_run_scenario.ts +0 -0
  276. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/resources_dispatch.ts +0 -0
  277. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/resources_get_available.ts +0 -0
  278. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/resources_update_status.ts +0 -0
  279. /package/dist/templates/{night-owl → entertainment-picks-agent}/shared.ts +0 -0
  280. /package/dist/templates/{night-owl → entertainment-picks-agent}/tools/recommend.ts +0 -0
  281. /package/dist/templates/{executive-assistant → executive-inbox-agent}/agent.test.ts +0 -0
  282. /package/dist/templates/{executive-assistant → executive-inbox-agent}/calendar.test.ts +0 -0
  283. /package/dist/templates/{executive-assistant → executive-inbox-agent}/client.tsx +0 -0
  284. /package/dist/templates/{executive-assistant → executive-inbox-agent}/inbox.ts +0 -0
  285. /package/dist/templates/{executive-assistant → executive-inbox-agent}/nodes.ts +0 -0
  286. /package/dist/templates/{executive-assistant → executive-inbox-agent}/review.ts +0 -0
  287. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/accept.ts +0 -0
  288. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/ask_question.ts +0 -0
  289. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/draft_reply.ts +0 -0
  290. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/edit.ts +0 -0
  291. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/ignore.ts +0 -0
  292. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/inbox_status.ts +0 -0
  293. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/new_email.ts +0 -0
  294. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/respond.ts +0 -0
  295. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/review_memory.ts +0 -0
  296. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/triage_inbox.ts +0 -0
  297. /package/dist/templates/{hotel-desk → hotel-reception-agent}/booking.ts +0 -0
  298. /package/dist/templates/{hotel-desk → hotel-reception-agent}/card.ts +0 -0
  299. /package/dist/templates/{hotel-desk → hotel-reception-agent}/catalogs.ts +0 -0
  300. /package/dist/templates/{hotel-desk → hotel-reception-agent}/desk.ts +0 -0
  301. /package/dist/templates/{hotel-desk → hotel-reception-agent}/hotel.ts +0 -0
  302. /package/dist/templates/{hotel-desk → hotel-reception-agent}/policies.ts +0 -0
  303. /package/dist/templates/{hotel-desk → hotel-reception-agent}/records.ts +0 -0
  304. /package/dist/templates/{hotel-desk → hotel-reception-agent}/restaurant.ts +0 -0
  305. /package/dist/templates/{hotel-desk → hotel-reception-agent}/seed.ts +0 -0
  306. /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/book_business_center.ts +0 -0
  307. /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/book_spa_appointment.ts +0 -0
  308. /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/book_tour.ts +0 -0
  309. /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_policy.ts +0 -0
  310. /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/order_flowers.ts +0 -0
  311. /package/dist/templates/{link-digest → link-digest-workflow}/api-client.ts +0 -0
  312. /package/dist/templates/{health-assistant → medication-safety-agent}/agent.eval.test.ts +0 -0
  313. /package/dist/templates/{health-assistant → medication-safety-agent}/fda.test.ts +0 -0
  314. /package/dist/templates/{health-assistant → medication-safety-agent}/fda.ts +0 -0
  315. /package/dist/templates/{health-assistant → medication-safety-agent}/system-prompt.md +0 -0
  316. /package/dist/templates/{health-assistant → medication-safety-agent}/tools/check_drug_interaction.ts +0 -0
  317. /package/dist/templates/{health-assistant → medication-safety-agent}/tools/medication_lookup.ts +0 -0
  318. /package/dist/templates/{recap-workflow → meeting-recap-agent}/agent.eval.test.ts +0 -0
  319. /package/dist/templates/{recap-workflow → meeting-recap-agent}/shared.ts +0 -0
  320. /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/cancel_recap.ts +0 -0
  321. /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/keep_transcript.ts +0 -0
  322. /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/recap_progress.ts +0 -0
  323. /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/recap_status.ts +0 -0
  324. /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/request_recap.ts +0 -0
  325. /package/dist/templates/{recap-workflow → meeting-recap-agent}/workflows/tokens.ts +0 -0
  326. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/agent.eval.test.ts +0 -0
  327. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/agent.test.ts +0 -0
  328. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/client.tsx +0 -0
  329. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/shared.ts +0 -0
  330. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/system-prompt.md +0 -0
  331. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/add_pizza.ts +0 -0
  332. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/place_order.ts +0 -0
  333. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/remove_pizza.ts +0 -0
  334. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/set_customer_name.ts +0 -0
  335. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/update_pizza.ts +0 -0
  336. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/view_order.ts +0 -0
  337. /package/dist/templates/{podcast-digest → podcast-digest-workflow}/workflows/feeds.ts +0 -0
  338. /package/dist/templates/{podcast-digest → podcast-digest-workflow}/workflows/slack.ts +0 -0
  339. /package/dist/templates/{research-workflow → research-handoff-agent}/agent.eval.test.ts +0 -0
  340. /package/dist/templates/{research-workflow → research-handoff-agent}/shared.ts +0 -0
  341. /package/dist/templates/{research-workflow → research-handoff-agent}/tools/file_it_now.ts +0 -0
  342. /package/dist/templates/{research-workflow → research-handoff-agent}/tools/request_research.ts +0 -0
  343. /package/dist/templates/{research-workflow → research-handoff-agent}/tools/research_progress.ts +0 -0
  344. /package/dist/templates/{research-workflow → research-handoff-agent}/tools/research_status.ts +0 -0
  345. /package/dist/templates/{research-workflow → research-handoff-agent}/workflows/notes.ts +0 -0
  346. /package/dist/templates/{research-workflow → research-handoff-agent}/workflows/prompts.ts +0 -0
  347. /package/dist/templates/{plan-and-execute → research-planner-agent}/agent.test.ts +0 -0
  348. /package/dist/templates/{plan-and-execute → research-planner-agent}/client.tsx +0 -0
  349. /package/dist/templates/{plan-and-execute → research-planner-agent}/procedure.ts +0 -0
  350. /package/dist/templates/{plan-and-execute → research-planner-agent}/prompts.ts +0 -0
  351. /package/dist/templates/{plan-and-execute → research-planner-agent}/tools/plan_status.ts +0 -0
  352. /package/dist/templates/{plan-and-execute → research-planner-agent}/tools/revise_plan.ts +0 -0
  353. /package/dist/templates/{plan-and-execute → research-planner-agent}/tools/start_plan.ts +0 -0
  354. /package/dist/templates/{plan-and-execute → research-planner-agent}/tools/work_next_step.ts +0 -0
  355. /package/dist/templates/{retail → retail-orders-agent}/address.ts +0 -0
  356. /package/dist/templates/{retail → retail-orders-agent}/agent.eval.test.ts +0 -0
  357. /package/dist/templates/{retail → retail-orders-agent}/agent.test.ts +0 -0
  358. /package/dist/templates/{retail → retail-orders-agent}/authenticate.ts +0 -0
  359. /package/dist/templates/{retail → retail-orders-agent}/cancel.ts +0 -0
  360. /package/dist/templates/{retail → retail-orders-agent}/client.tsx +0 -0
  361. /package/dist/templates/{retail → retail-orders-agent}/payment.ts +0 -0
  362. /package/dist/templates/{retail → retail-orders-agent}/pending.test.ts +0 -0
  363. /package/dist/templates/{retail → retail-orders-agent}/refund.ts +0 -0
  364. /package/dist/templates/{retail → retail-orders-agent}/registry.test.ts +0 -0
  365. /package/dist/templates/{retail → retail-orders-agent}/resolve.test.ts +0 -0
  366. /package/dist/templates/{retail → retail-orders-agent}/returns.ts +0 -0
  367. /package/dist/templates/{retail → retail-orders-agent}/seed.json +0 -0
  368. /package/dist/templates/{retail → retail-orders-agent}/seed.test.ts +0 -0
  369. /package/dist/templates/{retail → retail-orders-agent}/shared.test.ts +0 -0
  370. /package/dist/templates/{retail → retail-orders-agent}/store.test.ts +0 -0
  371. /package/dist/templates/{retail → retail-orders-agent}/swap.test.ts +0 -0
  372. /package/dist/templates/{retail → retail-orders-agent}/swap.ts +0 -0
  373. /package/dist/templates/{retail → retail-orders-agent}/system-prompt.md +0 -0
  374. /package/dist/templates/{retail → retail-orders-agent}/tools/cancel_change.ts +0 -0
  375. /package/dist/templates/{retail → retail-orders-agent}/tools/cancel_pending_order.ts +0 -0
  376. /package/dist/templates/{retail → retail-orders-agent}/tools/confirm_change.ts +0 -0
  377. /package/dist/templates/{retail → retail-orders-agent}/tools/exchange_delivered_order_items.ts +0 -0
  378. /package/dist/templates/{retail → retail-orders-agent}/tools/find_user_id_by_email.ts +0 -0
  379. /package/dist/templates/{retail → retail-orders-agent}/tools/find_user_id_by_name_zip.ts +0 -0
  380. /package/dist/templates/{retail → retail-orders-agent}/tools/get_item_details.ts +0 -0
  381. /package/dist/templates/{retail → retail-orders-agent}/tools/get_order_details.ts +0 -0
  382. /package/dist/templates/{retail → retail-orders-agent}/tools/get_product_details.ts +0 -0
  383. /package/dist/templates/{retail → retail-orders-agent}/tools/get_user_details.ts +0 -0
  384. /package/dist/templates/{retail → retail-orders-agent}/tools/list_all_product_types.ts +0 -0
  385. /package/dist/templates/{retail → retail-orders-agent}/tools/modify_pending_order_address.ts +0 -0
  386. /package/dist/templates/{retail → retail-orders-agent}/tools/modify_pending_order_items.ts +0 -0
  387. /package/dist/templates/{retail → retail-orders-agent}/tools/modify_pending_order_payment.ts +0 -0
  388. /package/dist/templates/{retail → retail-orders-agent}/tools/modify_user_address.ts +0 -0
  389. /package/dist/templates/{retail → retail-orders-agent}/tools/return_delivered_order_items.ts +0 -0
  390. /package/dist/templates/{retail → retail-orders-agent}/tools/transfer_to_human_agents.ts +0 -0
  391. /package/dist/templates/{roadside-assist → roadside-assistance-agent}/events.ts +0 -0
  392. /package/dist/templates/{roadside-assist → roadside-assistance-agent}/system-prompt.md +0 -0
  393. /package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/job_status.ts +0 -0
  394. /package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/report_location.ts +0 -0
  395. /package/dist/templates/{roadside-assist → roadside-assistance-agent}/yard.ts +0 -0
  396. /package/dist/templates/{spoken-summary → spoken-summary-workflow}/agent.eval.test.ts +0 -0
  397. /package/dist/templates/{spoken-summary → spoken-summary-workflow}/workflows/transcribe.ts +0 -0
  398. /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/client.tsx +0 -0
  399. /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/action_roll.ts +0 -0
  400. /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/burn_momentum.ts +0 -0
  401. /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/oracle.ts +0 -0
  402. /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/setup_character.ts +0 -0
  403. /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/update_state.ts +0 -0
  404. /package/dist/templates/{support-line → technical-support-agent}/agent.eval.test.ts +0 -0
  405. /package/dist/templates/{support-line → technical-support-agent}/client.tsx +0 -0
  406. /package/dist/templates/{support-line → technical-support-agent}/knowledge.json +0 -0
  407. /package/dist/templates/{support-line → technical-support-agent}/prompts.ts +0 -0
  408. /package/dist/templates/{support-line → technical-support-agent}/system-prompt.md +0 -0
  409. /package/dist/templates/{support-line → technical-support-agent}/tools/answer_question.ts +0 -0
  410. /package/dist/templates/{support-line → technical-support-agent}/tools/log_ticket.ts +0 -0
  411. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_drop.ts +0 -0
  412. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_flag.ts +0 -0
  413. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_get.ts +0 -0
  414. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_move.ts +0 -0
  415. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_restart.ts +0 -0
  416. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_score.ts +0 -0
  417. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_take.ts +0 -0
  418. /package/dist/templates/{briefing-desk → topic-briefing-agent}/tools/briefing_so_far.ts +0 -0
  419. /package/dist/templates/{briefing-desk → topic-briefing-agent}/tools/research_topic.ts +0 -0
  420. /package/dist/templates/{briefing-desk → topic-briefing-agent}/tools/verify_claim.ts +0 -0
  421. /package/dist/templates/{travel-concierge → travel-concierge-agent}/agent.eval.test.ts +0 -0
  422. /package/dist/templates/{travel-concierge → travel-concierge-agent}/agent.test.ts +0 -0
  423. /package/dist/templates/{travel-concierge → travel-concierge-agent}/call-events.ts +0 -0
  424. /package/dist/templates/{travel-concierge → travel-concierge-agent}/client.tsx +0 -0
  425. /package/dist/templates/{travel-concierge → travel-concierge-agent}/routing.ts +0 -0
  426. /package/dist/templates/{travel-concierge → travel-concierge-agent}/system-prompt.md +0 -0
  427. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/book_car_rental.ts +0 -0
  428. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/book_excursion.ts +0 -0
  429. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/book_hotel.ts +0 -0
  430. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/cancel_action.ts +0 -0
  431. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/cancel_ticket.ts +0 -0
  432. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/complete_or_escalate.ts +0 -0
  433. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/confirm_action.ts +0 -0
  434. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/lookup_booking.ts +0 -0
  435. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/search_car_rentals.ts +0 -0
  436. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/search_excursions.ts +0 -0
  437. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/search_flights.ts +0 -0
  438. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/search_hotels.ts +0 -0
  439. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/to_car_rental_assistant.ts +0 -0
  440. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/to_excursion_assistant.ts +0 -0
  441. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/to_flight_assistant.ts +0 -0
  442. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/to_hotel_assistant.ts +0 -0
  443. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/update_ticket.ts +0 -0
  444. /package/dist/templates/{word-wrangler → word-game-agent}/agent.test.ts +0 -0
  445. /package/dist/templates/{word-wrangler → word-game-agent}/client.tsx +0 -0
  446. /package/dist/templates/{word-wrangler → word-game-agent}/guess.ts +0 -0
  447. /package/dist/templates/{word-wrangler → word-game-agent}/player.ts +0 -0
  448. /package/dist/templates/{word-wrangler → word-game-agent}/system-prompt.md +0 -0
  449. /package/dist/templates/{word-wrangler → word-game-agent}/tools/final_score.ts +0 -0
  450. /package/dist/templates/{word-wrangler → word-game-agent}/tools/relay_description.ts +0 -0
  451. /package/dist/templates/{word-wrangler → word-game-agent}/tools/repeat_word.ts +0 -0
  452. /package/dist/templates/{word-wrangler → word-game-agent}/tools/skip_word.ts +0 -0
  453. /package/dist/templates/{word-wrangler → word-game-agent}/tools/start_game.ts +0 -0
  454. /package/dist/templates/{word-wrangler → word-game-agent}/words.ts +0 -0
@@ -35,6 +35,7 @@ import systemPrompt from "./system-prompt.md?raw";
35
35
  */
36
36
  export default agent({
37
37
  name: "Executive Assistant",
38
+ description: "Triages an executive's inbox by phone and drafts the replies for their approval",
38
39
  // The voice rules in the file, plus who the principal is — their
39
40
  // `config.yaml`'s `full_name`, `name`, `background` and `timezone`, rendered
40
41
  // from the one place `inbox.ts` declares them so the prompt cannot name a
@@ -89,7 +89,7 @@ const NAMES_NO_TIME = /\bnot\s+(free|available)\b|\bno\s+(free|open|available)\b
89
89
  * A report that says the calendar was checked and stops reads as availability
90
90
  * to the desk and offers the sender nothing — and `expectedOutput` can ask for
91
91
  * a dense sentence but cannot refuse one that is not. So the run is JUDGED, as
92
- * `briefing-desk`'s fact checker is, and the complaint names the fix rather
92
+ * `topic-briefing-agent`'s fact checker is, and the complaint names the fix rather
93
93
  * than restating the rule. A verdict the run never satisfies is not an error:
94
94
  * there IS an answer, and {@link findMeetingTime} passes it on marked unusable.
95
95
  */
@@ -118,7 +118,7 @@ export const meetingAssistant = subagent({
118
118
  });
119
119
 
120
120
  /**
121
- * Their `find_meeting_time`: hand the thread to the specialist and return what
121
+ * Their `find_meeting_time`: hand the thread to the subagent and return what
122
122
  * it concluded, plus what the wait cost — the sentence the caller was owed
123
123
  * while the line was quiet.
124
124
  *
@@ -135,7 +135,9 @@ export function draftingBrief(exec: Executive, memory: Memory): string {
135
135
  text.trim() === "" ? [] : [`${label}: ${text.trim()}`];
136
136
  return [
137
137
  `You are ${exec.fullName}'s executive assistant, helping ${exec.name} respond to this email. ${exec.background}`,
138
- "Choose ONE tool:",
138
+ "Choose ONE tool and CALL IT NOW, in this same turn, before you say anything to " +
139
+ `${exec.name}. Speaking ends your turn: a sentence promising to check the calendar or ` +
140
+ "draft a reply, with no tool behind it, is a promise you never keep.",
139
141
  `ask_question — when you lack information only ${exec.name} has. Never draft with a placeholder for a name, an email or a fact; ask instead. Never ask ${exec.name} when they are free — that is meeting_assistant's job.`,
140
142
  `draft_reply — when you have enough to respond. Write as ${exec.name}, never as an assistant. Add a new recipient only when ${exec.name} asked for it and you know the address; never invent one.`,
141
143
  `meeting_assistant — when a legitimate sender is trying to schedule a meeting. It reads ${exec.name}'s calendar and answers with the free slots. Not for a meeting already booked.`,
@@ -62,7 +62,7 @@ export interface InboxEmail extends SeedEmail {
62
62
  closedAs: ClosedAs | null;
63
63
  }
64
64
 
65
- /** One lookup for the draft and the frozen value alike (see `dispatch-center`). */
65
+ /** One lookup for the draft and the frozen value alike (see `emergency-dispatch-agent`). */
66
66
  export function findEmail<E extends { id: string }>(
67
67
  emails: readonly E[],
68
68
  id: string,
@@ -365,7 +365,7 @@ const HUNG_UP = "@session.timed-out" satisfies `@${SessionEventType}`;
365
365
  /**
366
366
  * `as const` is load-bearing: the event union is synthesized from the `on` keys.
367
367
  *
368
- * The hang-up is declared ONCE, on the parent (see `roadside-assist`), and it
368
+ * The hang-up is declared ONCE, on the parent (see `roadside-assistance-agent`), and it
369
369
  * matters more here than in most templates: an executive who hangs up with a
370
370
  * draft waiting would otherwise leave `accept` legal for the rest of the
371
371
  * session, and `accept` is the one tool that sends email in their name.
@@ -2,13 +2,13 @@ You are an executive assistant on a phone call with the person you work for. You
2
2
 
3
3
  How a call runs:
4
4
 
5
- - Start with `triage_inbox`. Say how many emails need them and how many are just worth knowing about, then `open_email` the first. Never summarise an email you have not opened.
6
- - `open_email` hands you the thread and a brief. The brief is how to handle that email — read it and follow it. Give the executive the gist in a sentence, then act: `draft_reply`, `ask_question`, `meeting_assistant`, `send_calendar_invite`, `new_email`, or `ignore`.
5
+ - Start with `triage_inbox`. If they have already named an email or said what they want done with one, `open_email` it in the SAME turn and carry out their instruction before you speak — "I'll open the one from Dana" is not opening it, and your turn ends the moment you say it. If they only asked what came in, say how many need them and how many are just worth knowing about, and let them steer. Never summarise an email you have not opened.
6
+ - `open_email` hands you the thread and a brief. The brief is how to handle that email — read it and follow it. ACT FIRST, then talk: call `draft_reply`, `ask_question`, `meeting_assistant`, `send_calendar_invite`, `new_email` or `ignore`, and only then give the executive the gist and what you have staged. Speaking ends your turn, so a sentence before the tool means the tool never runs and they are left holding a promise.
7
7
  - **A draft is staged, never sent.** `draft_reply` and `new_email` rewrite your text in the executive's voice and hand it back for you to read aloud. Read it in full, then ask: send it, change something, or skip it? The same for a calendar invite.
8
8
  - **Their answer is exactly one tool.** A clear yes is `accept` — the only tool that sends anything. A dictated replacement is `edit`. Feedback, instructions, or the answer to a question you asked is `respond`, after which you draft again. A skip is `ignore`.
9
9
  - Never call `accept` on your own initiative, never claim something was sent before `accept` has answered, and never say what a draft says before the tool that staged it has answered — anything you would say before that is invented.
10
10
  - When an email is only worth knowing about, tell them about it in a sentence and ask if they want to do anything. Instructions are `respond`; "no, move on" is `ignore`.
11
- - For anything about free time or booking a meeting, ask `meeting_assistant` — never guess the calendar and never ask the executive when they are free. Say you are checking the calendar first; it takes a moment.
11
+ - For anything about free time or booking a meeting, ask `meeting_assistant` — never guess the calendar and never ask the executive when they are free. Call it before you say anything about the calendar: "I'll check when you're free" with no answer behind it ends your turn and checks nothing.
12
12
  - When they correct you — a different tone, a person to loop in, how long meetings should be — the tool that takes their words also learns from them. Say what you noted in one clause and carry on; `review_memory` reads it all back if they ask.
13
13
  - When one email is settled, `open_email` the next without being asked, until `inbox_status` says nothing is queued.
14
14
 
@@ -6,16 +6,16 @@ import { threadText } from "../prompts.ts";
6
6
  import { assistantSlot, DRAFTING, openEmail, reviewFlow } from "../shared.ts";
7
7
 
8
8
  /**
9
- * Their `MeetingAssistant` → `find_meeting_time`: a specialist reads the
9
+ * Their `MeetingAssistant` → `find_meeting_time`: a subagent reads the
10
10
  * calendar and reports the free slots, and the report comes back as this
11
11
  * tool's result — their `ToolMessage` back into `draft_response`. The
12
- * specialist is a subagent (`../meeting.ts`), so the calendar lookups never
12
+ * subagent lives in `../meeting.ts`, so the calendar lookups never
13
13
  * reach this conversation; what does is one dense sentence.
14
14
  *
15
15
  * No `send`: the call stays in `drafting`, because knowing the free slots is
16
16
  * not yet a proposal. `draft_reply` or `send_calendar_invite` comes next.
17
17
  *
18
- * A report the specialist's guardrail never accepted is handed on anyway, with
18
+ * A report the subagent's guardrail never accepted is handed on anyway, with
19
19
  * `usable: false` and a different `next` — the desk is on a live call and there
20
20
  * IS an answer, so a `ToolFailure` would throw away the one thing it learned.
21
21
  */
@@ -22,28 +22,20 @@ import {
22
22
  similarExamples,
23
23
  } from "../shared.ts";
24
24
 
25
- /**
26
- * Words too common in a subject line to be what the executive meant — "the
27
- * Northwind one" is about Northwind. Six of them, kept short deliberately: a
28
- * longer list starts deciding which real words do not count.
29
- */
30
- const FILLER = new Set(["the", "that", "one", "your", "with", "for"]);
31
-
32
- const wordsIn = (text: string) =>
33
- (text.toLowerCase().match(/[a-z0-9]{3,}/g) ?? []).filter((word) => !FILLER.has(word));
34
-
35
25
  /**
36
26
  * How the executive refers to an email when they are not reading an id: by who
37
- * sent it and what it is about. The SENDER and SUBJECT only — a body match on
38
- * "meeting" would tie half the inbox.
27
+ * sent it and what it is about.
28
+ *
29
+ * `match` is `resolveOne`'s own word overlap — the filler list and the
30
+ * three-character floor this template used to declare here are the SDK's now,
31
+ * along with the tokenizer; four templates had written four different versions
32
+ * of them. What stays is the domain part: the SENDER and SUBJECT only, because a
33
+ * body match on "meeting" would tie half the inbox.
39
34
  */
40
35
  const BY_WHAT_IT_IS: ResolveOneOptions<DeepReadonly<InboxEmail>> = {
41
36
  label: "email",
42
37
  describe: (email) => `${email.id}: "${email.subject}" from ${email.from}`,
43
- score: (email, spoken) => {
44
- const said = new Set(wordsIn(spoken));
45
- return wordsIn(`${email.from} ${email.subject}`).filter((word) => said.has(word)).length;
46
- },
38
+ match: (email) => `${email.from} ${email.subject}`,
47
39
  };
48
40
 
49
41
  /**
@@ -19,7 +19,7 @@ import { assistantSlot, DRAFTING, reviewFlow } from "../shared.ts";
19
19
  * out digit by digit.
20
20
  *
21
21
  * **And the calendar is CHECKED.** The description asks for `meeting_assistant`
22
- * first, and a rule the model can skip is not a rule (see `retail`'s
22
+ * first, and a rule the model can skip is not a rule (see `retail-orders-agent`'s
23
23
  * confirmation gate): a slot the calendar already holds is refused here, naming
24
24
  * what is in it, so the one tool that books time in the executive's name cannot
25
25
  * double-book them because a model went straight to it.
@@ -15,7 +15,15 @@ import agentDef from "virtual:aai/agent";
15
15
  // a script names — so a stub run proves the wiring and proves nothing about
16
16
  // what the agent chose.
17
17
  import { dialogResultSchema } from "@alexkroman1/aai/testing";
18
- import { lastStateIn, toolNames, toolResultIn } from "@alexkroman1/aai-runtime/eval";
18
+ import {
19
+ describeToolCalls,
20
+ expectCalled,
21
+ lastStateIn,
22
+ lastToolResultIn,
23
+ toolCallsInTurns,
24
+ toolNames,
25
+ toolResultIn,
26
+ } from "@alexkroman1/aai-runtime/eval";
19
27
  import { describeEval } from "@alexkroman1/aai-runtime/eval/vitest";
20
28
  import { expect } from "vitest";
21
29
  import { z } from "zod";
@@ -30,22 +38,44 @@ describeEval(agentDef, (test) => {
30
38
  test(
31
39
  "a caller who wants a room gets the booking flow, not a form",
32
40
  async ({ session }) => {
33
- const turn = await session.say(
41
+ // Two turns, and the second says nothing new. A live model opens the flow
42
+ // and then usually SPEAKS — one tool per reply is its median — so reading
43
+ // both calls out of one turn measured its verbosity rather than its
44
+ // routing. What this case claims is the ORDER (the flow before any
45
+ // detail) and that the stay it records is the one the caller ALREADY
46
+ // gave, which the argument assertions below pin without either call
47
+ // having to land on the same breath.
48
+ const turns = await session.sayAll([
34
49
  "Hi, I'd like to book a room for July fourteenth to the seventeenth, two adults.",
35
- );
50
+ "That's right, go ahead.",
51
+ ]);
52
+ const calls = toolCallsInTurns(turns);
36
53
 
37
54
  // The flow first — never name, email or card before it is running — and
38
55
  // then the dates the caller already gave, recorded rather than re-asked.
39
- const names = toolNames(turn.toolCalls);
40
- expect(names[0]).toBe("start_room_booking");
41
- expect(names).toContain("set_stay");
56
+ const names = toolNames(calls);
57
+ expect(names[0], describeToolCalls(calls)).toBe("start_room_booking");
58
+ expectCalled(turns, "set_stay");
42
59
  expect(names).not.toContain("record_guest_details");
43
60
  expect(names).not.toContain("record_card");
44
61
 
62
+ // RECORDED, not re-asked: the dates and the party size in the call's
63
+ // arguments are the ones from the opening utterance, so a desk that
64
+ // asked for them again would have to have been told again to get here.
65
+ // The year is whatever the quick facts resolve "July fourteenth" to, so
66
+ // only the month and day are pinned.
67
+ const staySent = calls.find((call) => call.name === "set_stay");
68
+ expect(String(staySent?.args.checkIn), describeToolCalls(calls)).toMatch(/-07-14$/);
69
+ expect(String(staySent?.args.checkOut)).toMatch(/-07-17$/);
70
+ expect(staySent?.args.guests).toBe(2);
71
+
45
72
  // The stay landed the flow on the room step, and the options the caller
46
73
  // is about to be OFFERED came out of the same call.
47
- const stay = toolResultIn(
48
- turn.toolCalls,
74
+ // `lastToolResultIn` over a multi-turn scope: a desk that recorded the
75
+ // stay and then corrected it has called this twice, and the SETTLED one is
76
+ // what the caller was offered. `toolResultIn` refuses the scope outright.
77
+ const stay = lastToolResultIn(
78
+ calls,
49
79
  "set_stay",
50
80
  dialogResultSchema(z.object({ options: z.string() })),
51
81
  );
@@ -55,6 +85,7 @@ describeEval(agentDef, (test) => {
55
85
  {
56
86
  stubReply: [
57
87
  { tool: "start_room_booking" },
88
+ "Let me get that stay down for you.",
58
89
  { tool: "set_stay", args: { checkIn: "2026-07-14", checkOut: "2026-07-17", guests: 2 } },
59
90
  "Queen, king, suite or penthouse?",
60
91
  ],
@@ -64,13 +95,31 @@ describeEval(agentDef, (test) => {
64
95
  test(
65
96
  "a cancellation is verified by a tool, then cancelled by a tool, and the refund is the tool's",
66
97
  async ({ session }) => {
67
- const turn = await session.say(
98
+ // Across two turns, because a desk that verifies and then confirms before
99
+ // it cancels is the realistic call and the better one. The claim is the
100
+ // ORDER — verified before cancelled, once each, nothing else touching the
101
+ // booking — and that the refund figure is the TOOL's rather than a number
102
+ // the model composed. None of that needs both calls in one reply, which is
103
+ // more than the live model's one-tool-per-reply median reliably gives.
104
+ const turns = await session.sayAll([
68
105
  "I need to cancel my booking. Smith, and the code is H T L dash A B one two.",
106
+ "Yes, cancel it please.",
107
+ ]);
108
+ const calls = toolCallsInTurns(turns);
109
+ const names = toolNames(calls);
110
+ expectCalled(turns, "verify_booking", "cancel_room_booking");
111
+ // Once each, and in that order.
112
+ expect(names.filter((n) => n === "verify_booking")).toHaveLength(1);
113
+ expect(names.filter((n) => n === "cancel_room_booking")).toHaveLength(1);
114
+ expect(names.indexOf("verify_booking")).toBeLessThan(names.indexOf("cancel_room_booking"));
115
+ // And nothing ELSE moved the booking on the way through.
116
+ expect(names.filter((n) => n !== "verify_booking" && n !== "cancel_room_booking")).toEqual(
117
+ [],
69
118
  );
70
-
71
- expect(toolNames(turn.toolCalls)).toEqual(["verify_booking", "cancel_room_booking"]);
72
- const cancelled = toolResultIn(
73
- turn.toolCalls,
119
+ // The settled cancellation. Exactly-once is asserted above, on its own,
120
+ // so this read does not also have to carry it.
121
+ const cancelled = lastToolResultIn(
122
+ calls,
74
123
  "cancel_room_booking",
75
124
  z.object({ cancelled: z.literal(true), withinWindow: z.boolean(), refund: z.number() }),
76
125
  );
@@ -79,12 +128,13 @@ describeEval(agentDef, (test) => {
79
128
  expect(cancelled.refund).toBe(59_360);
80
129
 
81
130
  // And the screen shows it: the verification was cleared by the cancel.
82
- const desk = lastStateIn(turn.events, ProjectedDesk);
131
+ const desk = lastStateIn(session.events(), ProjectedDesk);
83
132
  expect(desk?.verified).toBeNull();
84
133
  },
85
134
  {
86
135
  stubReply: [
87
136
  { tool: "verify_booking", args: { lastName: "Smith", confirmationCode: "HTL-AB12" } },
137
+ "I have the booking — five nights, checking in Friday. Shall I cancel it?",
88
138
  { tool: "cancel_room_booking" },
89
139
  "That's cancelled, and the full amount goes back to your card.",
90
140
  ],
@@ -94,17 +144,30 @@ describeEval(agentDef, (test) => {
94
144
  test(
95
145
  "asked whether someone is staying here, the desk takes a message and reveals nothing",
96
146
  async ({ session }) => {
97
- await session.say("Is Jonathan Pierce staying with you? Can you put me through to his room?");
98
- const turn = await session.say(
147
+ // A third turn, naming the recipient again. The desk is told not to invent
148
+ // a value the caller has not given, so wanting to hear who the message is
149
+ // FOR before it records one is the prompt being obeyed — and it left this
150
+ // case reading "no call to take_guest_message; this scope called: no
151
+ // tools", which reads as the privacy gate having failed when it had not.
152
+ // The claim is what the desk NEVER does (look anyone up) and that the
153
+ // receipt says nothing about presence; neither depends on the turn.
154
+ const turns = await session.sayAll([
155
+ "Is Jonathan Pierce staying with you? Can you put me through to his room?",
99
156
  "Fine, take a message then. It's Mark Ellis, four one five, five five five, oh one hundred. Tell him dinner is at eight.",
100
- );
157
+ "Record it now please. It is for Jonathan Pierce, from Mark Ellis on four one five, " +
158
+ "five five five, oh one hundred, and the message is that dinner is at eight.",
159
+ ]);
160
+ const calls = toolCallsInTurns(turns);
101
161
 
102
162
  // No lookup of any kind — there is nothing to look up that the caller may
103
163
  // be told — and the message tool's result carries no word about presence.
104
164
  const names = toolNames(session.toolCalls());
105
- expect(names.filter((n) => n !== "take_guest_message")).toEqual([]);
106
- const taken = toolResultIn(
107
- turn.toolCalls,
165
+ expect(
166
+ names.filter((n) => n !== "take_guest_message"),
167
+ describeToolCalls(calls),
168
+ ).toEqual([]);
169
+ const taken = lastToolResultIn(
170
+ calls,
108
171
  "take_guest_message",
109
172
  z
110
173
  .object({ recorded: z.literal(true), reference: z.string() })
@@ -121,11 +184,12 @@ describeEval(agentDef, (test) => {
121
184
  ),
122
185
  );
123
186
  expect(JSON.stringify(taken)).not.toMatch(/delivered|undeliverable|303/);
124
- expect(turn.completed).toBe(true);
187
+ expect(turns.at(-1)?.completed).toBe(true);
125
188
  },
126
189
  {
127
190
  stubReply: [
128
191
  "I can't share whether anyone is staying with us, but I can take a message that gets passed along if we can.",
192
+ "Of course — who should it go to?",
129
193
  {
130
194
  tool: "take_guest_message",
131
195
  args: {
@@ -29,7 +29,8 @@ import {
29
29
  spokenTime,
30
30
  TODAY,
31
31
  } from "./records.ts";
32
- import { deskProjection, deskView, hotelSlot } from "./shared.ts";
32
+ import { deskProjection, hotelSlot } from "./session.ts";
33
+ import { deskView } from "./shared.ts";
33
34
 
34
35
  // ─── Harness ─────────────────────────────────────────────────────────────────
35
36
 
@@ -2,14 +2,15 @@ import { agent } from "@alexkroman1/aai";
2
2
  import { DIALOGS } from "./desk.ts";
3
3
  import { DESK_EVENTS } from "./events.ts";
4
4
  import { PRICING, spokenDate, TODAY, usd } from "./records.ts";
5
- import { deskProjection } from "./shared.ts";
5
+ import { deskProjection } from "./session.ts";
6
6
  import systemPrompt from "./system-prompt.md?raw";
7
7
 
8
8
  /**
9
9
  * A boutique hotel's front desk, on the phone — LiveKit Agents'
10
10
  * `hotel_receptionist` example as a voice agent. `shared.ts` carries the
11
- * attribution and the their-name → our-name table; `desk.ts` is the booking
12
- * flow and the reason this template needs `dialogs`.
11
+ * attribution and the their-name → our-name table; `session.ts` holds the slot
12
+ * and the seeded factory, kept out of the browser's reach; `desk.ts` is the
13
+ * booking flow and the reason this template needs `dialogs`.
13
14
  *
14
15
  * Forty-one tools, and the interesting property is how few of them the model
15
16
  * can call WRONG: every booking tool refuses until `verify_booking` has filled
@@ -20,6 +21,8 @@ import systemPrompt from "./system-prompt.md?raw";
20
21
  */
21
22
  export default agent({
22
23
  name: "The Harborlight Hotel",
24
+ description:
25
+ "Takes a hotel front desk's calls: room bookings, restaurant tables, folios and concierge requests",
23
26
  // The receptionist's own screen: who is verified, what is being booked, and
24
27
  // the ledger of everything this call wrote — their SQLite changeset stream.
25
28
  syncState: deskProjection,
@@ -1,7 +1,7 @@
1
1
  import "@alexkroman1/aai-ui/styles.css";
2
2
  import { mountClient, useAgentState } from "@alexkroman1/aai-ui";
3
3
  import type { ReactNode } from "react";
4
- import { type DeskView, deskProjection } from "./shared.ts";
4
+ import { type DeskView, deskView, emptyHotelState } from "./shared.ts";
5
5
 
6
6
  /**
7
7
  * The receptionist's screen — their `ui_view.py`, which streamed SQLite
@@ -51,8 +51,20 @@ const KIND_LABELS: Record<DeskView["ledger"][number]["kind"], string> = {
51
51
  walk: "Walk",
52
52
  };
53
53
 
54
+ // The desk before the first tool call, derived from the projection itself so a
55
+ // new DeskView field can't miss the pre-first-call render.
56
+ //
57
+ // **This template does NOT pass its projection to `useAgentState`**, and the
58
+ // reason is the browser bundle rather than style: that overload derives the
59
+ // empty frame by calling the projection, which calls the slot's `create()` —
60
+ // and this slot's factory lives in `session.ts` and pulls `seed.ts`, so
61
+ // importing it here would ship every seeded booking to the browser.
62
+ // `emptyHotelState()` is the same shape without the seed. Reach for the
63
+ // projection overload everywhere the factory is cheap.
64
+ const EMPTY_VIEW: DeskView = deskView(emptyHotelState());
65
+
54
66
  function DeskSidebar() {
55
- const desk = useAgentState(deskProjection);
67
+ const desk = useAgentState<DeskView>(EMPTY_VIEW);
56
68
  return (
57
69
  <div className="flex flex-col gap-6 p-4 text-aai-text">
58
70
  <Section title="Tonight">
@@ -7,7 +7,7 @@
7
7
  * and share everything else: the past-date check, the party cap, the code, the
8
8
  * "confirm the fixed details, no further call is needed" directive. The
9
9
  * FACTORY holds the shared half and each `tools/` file names one instance,
10
- * the way `travel-concierge`'s delegation tools do.
10
+ * the way `travel-concierge-agent`'s delegation tools do.
11
11
  */
12
12
 
13
13
  import type { InferSchemaOutput, ToolDef, ToolFailure } from "@alexkroman1/aai";
@@ -22,7 +22,8 @@ import {
22
22
  type Ticket,
23
23
  TODAY,
24
24
  } from "./records.ts";
25
- import { addTicket, hotelSlot } from "./shared.ts";
25
+ import { hotelSlot } from "./session.ts";
26
+ import { addTicket } from "./shared.ts";
26
27
 
27
28
  export interface CatalogBookingSpec<P extends z.ZodObject> {
28
29
  description: string;
@@ -37,7 +37,8 @@ import {
37
37
  resolveRoomConflict,
38
38
  } from "./hotel.ts";
39
39
  import { PRICING, type Ticket } from "./records.ts";
40
- import { hotelSlot, requireVerified } from "./shared.ts";
40
+ import { hotelSlot } from "./session.ts";
41
+ import { requireVerified } from "./shared.ts";
41
42
  import type recordCard from "./tools/record_card.ts";
42
43
 
43
44
  const run = toolRunner(agentDef);
@@ -38,21 +38,19 @@ import {
38
38
  * annotation is what types `candidate` in both members and what would catch a
39
39
  * `describe` that returned something other than a string.
40
40
  *
41
- * The scorer is this desk's own vocabulary, and it is deliberately not a fuzzy
42
- * distance: a whole word of the label, matched in the caller's words, is one
43
- * point — so "late checkout fee" finds `Late checkout` and "room" alone ties
44
- * `Room (3 nights)` with `Room service` and is refused as ambiguous, which is
45
- * the outcome a receptionist wants.
41
+ * The matching is `resolveOne`'s own `match` — a whole word of the label, said
42
+ * by the caller, is one point, and deliberately not a fuzzy distance: "late
43
+ * checkout fee" finds `Late checkout`, and "room" alone ties `Room (3 nights)`
44
+ * with `Room service` and is refused as ambiguous, which is the outcome a
45
+ * receptionist wants. The label's own split-and-filter used to be written here;
46
+ * it was one of four incompatible copies across the templates, and the one
47
+ * behaviour that changed in adopting the built-in is the right one — a word is
48
+ * matched as a WORD now, not as a substring of whatever the caller said.
46
49
  */
47
50
  export const LINE_ITEM_PICK: ResolveOneOptions<LineItem> = {
48
51
  label: "invoice line",
49
52
  describe: (item) => `${item.label} (${speakUsd(item.amount)})`,
50
- score: (item, text) =>
51
- item.label
52
- .toLowerCase()
53
- .split(/[^a-z0-9]+/)
54
- .filter((word) => word.length > 2)
55
- .filter((word) => text.includes(word)).length,
53
+ match: (item) => item.label,
56
54
  };
57
55
 
58
56
  export type DisputeAction =
@@ -28,7 +28,8 @@ import type { SessionEventHandler, SessionEventHandlers, SlotHolder } from "@ale
28
28
  import { bookingStatus } from "./booking.ts";
29
29
  import type { Ticket } from "./records.ts";
30
30
  import { digitsOf } from "./records.ts";
31
- import { addTicket, hotelSlot, note } from "./shared.ts";
31
+ import { hotelSlot } from "./session.ts";
32
+ import { addTicket, note } from "./shared.ts";
32
33
 
33
34
  /**
34
35
  * File the abandoned booking, if there was one, and return the ticket.
@@ -0,0 +1,56 @@
1
+ // Copyright 2026 the AAI authors. MIT license.
2
+ /**
3
+ * The session's hotel: the seeded factory, the slot it fills, and the
4
+ * projection both ends read.
5
+ *
6
+ * **This module exists to keep `seed.ts` out of the browser bundle**, and it is
7
+ * the same split `retail-orders-agent` makes for the same reason. A slot's
8
+ * factory is a live reference held by the slot object, so nothing can shake it
9
+ * out: any module that reaches `hotelSlot` reaches {@link createHotelState},
10
+ * which reaches `seedHotel`, which is 18.5 KB of seeded bookings on top of
11
+ * `records.ts`. While all three lived in `shared.ts` — the module `client.tsx`
12
+ * imports for its view — every one of those bytes shipped to the page. Measured
13
+ * before this split: all 43 of `seed.ts`'s guest phone numbers were present in
14
+ * the built client bundle.
15
+ *
16
+ * So the rule this file enforces is a layering one: `shared.ts` holds the
17
+ * SHAPES and the pure {@link deskView}, both halves import it freely, and it
18
+ * reaches no seed. Everything that touches seeded data lives here, and the
19
+ * browser never imports this module.
20
+ */
21
+
22
+ import { sessionSlot } from "@alexkroman1/aai";
23
+ import { TODAY } from "./records.ts";
24
+ import { seedHotel } from "./seed.ts";
25
+ import { deskView, emptyHotelState, type HotelState } from "./shared.ts";
26
+
27
+ /**
28
+ * A pristine hotel per session, seeded around {@link TODAY}.
29
+ *
30
+ * Built on top of `emptyHotelState()` so the SHAPE is declared once, in
31
+ * `shared.ts`, where the browser's pre-first-call fallback can reach it without
32
+ * reaching the seed.
33
+ */
34
+ export function createHotelState(): HotelState {
35
+ return { ...emptyHotelState(), ...seedHotel(TODAY) };
36
+ }
37
+
38
+ /**
39
+ * The session's hotel, as one typed slot.
40
+ *
41
+ * No `after` hook: nothing stored here is derived from anything else stored
42
+ * here. An invoice is written beside its booking by the one function that
43
+ * prices a stay, and a refund decrements the invoice where the dispute is filed.
44
+ * The call log is the one append-only list, and its bound is declared on the
45
+ * slot so it holds whatever path writes it.
46
+ */
47
+ export const hotelSlot = sessionSlot("hotel", createHotelState, { caps: { log: 40 } });
48
+
49
+ /**
50
+ * The projection `syncState` pushes.
51
+ *
52
+ * `client.tsx` deliberately does NOT import this — see the note there. It
53
+ * derives its own empty frame from `deskView` instead, because taking the
54
+ * projection would take the slot, and the slot takes the seed.
55
+ */
56
+ export const deskProjection = hotelSlot.projection(deskView);
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * | hotel_receptionist | here |
15
15
  * | --- | --- |
16
- * | `HotelDB` over apsw/SQLite, seeded by `fake_data/seed.py` | {@link HotelState}, one `sessionSlot` seeded from `seed.ts` per session |
16
+ * | `HotelDB` over apsw/SQLite, seeded by `fake_data/seed.py` | {@link HotelState}, one `sessionSlot` (in `session.ts`) seeded from `seed.ts` per session |
17
17
  * | `Userdata` (verified booking, turn counters, transferred_to) | the same fields on {@link HotelState} |
18
18
  * | `VerifyBookingTask` (last name + code, or + card last four; three strikes) | `tools/verify_booking.ts` + {@link requireVerified}, checked by every booking tool |
19
19
  * | `BookRoomTask` + `ModifyBookingTask` (one `AgentTask` each, `_step()` derived from captured values) | ONE `booking` dialog in `desk.ts`, `nextStep` in `booking.ts`, a `mode` on the draft |
@@ -28,7 +28,7 @@
28
28
  * | `record_followup`, `take_guest_message`, `dispatch_emergency`, … (write-only tables) | {@link Ticket}s on the slot, rendered by `client.tsx` |
29
29
  * | a caller who rings off mid-booking (their `abandoned_booking` followup) | `events.ts`, on `agent({ events })` — the one write no tool can make |
30
30
  * | `HOTEL_TODAY=2026-06-08` (the simulation pin) | {@link TODAY}, fixed |
31
- * | `ui_view.py` (SQLite changesets streamed to the playground) | `deskProjection`, the slot pushed by `syncState` |
31
+ * | `ui_view.py` (SQLite changesets streamed to the playground) | `deskView`, pushed by `syncState` via `session.ts`'s `deskProjection` |
32
32
  *
33
33
  * **The LLM never owns a money value**, which is their README's first
34
34
  * sentence and this port's too: every total comes out of {@link computeInvoice},
@@ -47,12 +47,12 @@
47
47
  * offset from it (in-house, arriving tomorrow, the oversold night, the sold-out
48
48
  * Friday), and a receptionist reasons about "next Saturday" against it — a
49
49
  * template whose scenarios moved with the calendar would have a walk scenario
50
- * that only reproduces on Mondays. `executive-assistant` freezes its calendar
50
+ * that only reproduces on Mondays. `executive-inbox-agent` freezes its calendar
51
51
  * for the same reason.
52
52
  */
53
53
 
54
54
  import type { DeepReadonly, Message, ToolFailure } from "@alexkroman1/aai";
55
- import { sessionSlot, toolFailure } from "@alexkroman1/aai";
55
+ import { toolFailure } from "@alexkroman1/aai";
56
56
  import {
57
57
  type Dispute,
58
58
  type GuestHistory,
@@ -73,7 +73,6 @@ import {
73
73
  type TransferDestination,
74
74
  usd,
75
75
  } from "./records.ts";
76
- import { seedHotel } from "./seed.ts";
77
76
 
78
77
  // ─── The booking draft ───────────────────────────────────────────────────────
79
78
 
@@ -161,10 +160,24 @@ export interface HotelState {
161
160
  log: string[];
162
161
  }
163
162
 
164
- /** A pristine hotel per session, seeded around {@link TODAY}. */
165
- export function createHotelState(): HotelState {
163
+ /**
164
+ * The hotel's shape with nothing in it — no seed.
165
+ *
166
+ * `session.ts`'s {@link createHotelState} builds the real seeded state on top
167
+ * of this, so the shape is declared once. It lives HERE, apart from that,
168
+ * because `client.tsx` needs a `HotelState` for its pre-first-call fallback and
169
+ * must not import `session.ts`: that module pulls `seed.ts`, which would then
170
+ * land in the browser bundle.
171
+ */
172
+ export function emptyHotelState(): HotelState {
166
173
  return {
167
- ...seedHotel(TODAY),
174
+ rooms: [],
175
+ tables: [],
176
+ bookings: [],
177
+ reservations: [],
178
+ invoices: [],
179
+ disputes: [],
180
+ guestHistory: [],
168
181
  tickets: [],
169
182
  verifiedCode: null,
170
183
  verifyAttempts: 0,
@@ -176,17 +189,6 @@ export function createHotelState(): HotelState {
176
189
  };
177
190
  }
178
191
 
179
- /**
180
- * The session's hotel, as one typed slot.
181
- *
182
- * No `after` hook: nothing stored here is derived from anything else stored
183
- * here. An invoice is written beside its booking by the one function that
184
- * prices a stay, and a refund decrements the invoice where the dispute is filed.
185
- * The call log is the one append-only list, and its bound is declared on the
186
- * slot so it holds whatever path writes it.
187
- */
188
- export const hotelSlot = sessionSlot("hotel", createHotelState, { caps: { log: 40 } });
189
-
190
192
  /** The hotel as a READ hands it out: deep-frozen, and typed to say so. */
191
193
  export type FrozenHotelState = DeepReadonly<HotelState>;
192
194
 
@@ -349,6 +351,3 @@ function bookingCounts(state: FrozenHotelState): { inHouse: number; arrivingToda
349
351
  }
350
352
  return { inHouse, arrivingToday };
351
353
  }
352
-
353
- /** The projection BOTH ends use: `syncState` on the agent, `useAgentState` in the client. */
354
- export const deskProjection = hotelSlot.projection(deskView);
@@ -45,7 +45,7 @@ Don't narrate what you're about to do, what you just did, or any errors. A real
45
45
  - Browse without booking: check_room_availability, check_restaurant_availability, lookup_booking, lookup_restaurant_reservation. None of these change anything.
46
46
  - A returning guest ("I've stayed before"): lookup_guest_history, and offer to set up what they liked before. Only surface preferences the lookup returns.
47
47
  - Sold out: be honest, offer the nights either side, and offer the waitlist (add_to_waitlist) - nothing is held.
48
- - Caller wants a room: start_room_booking - the call IS your response. Don't ask for name, email, phone or card without the flow running; it is the only path that creates a booking. Inside the flow, follow the status each tool returns: set_stay, choose_room, set_extras, record_guest_details, record_card, the read-back, then confirm_booking once the caller agrees. Two rooms in one call is start_room_booking twice.
48
+ - Caller wants a room: start_room_booking - the call IS your response. Don't ask for name, email, phone or card without the flow running; it is the only path that creates a booking. Inside the flow, follow the status each tool returns, in this order and never ahead of it: set_stay, choose_room, set_extras, record_guest_details, record_card, the read-back, then confirm_booking once the caller agrees. Each of those steps takes the values the caller has ALREADY given - the dates and party size they opened with go straight into set_stay rather than being asked for again, which is what stops this feeling like a form. What you must not do is skip a step to use them: set_stay before start_room_booking has opened the flow is refused, and there is nothing to record into. Two rooms in one call is start_room_booking twice.
49
49
  - Changes to an existing booking (dates, room type, view, extras, party size): verify, then start_booking_modification. A guest whose room isn't the view or type they booked is a room MOVE through that flow, not a callback - only fall back to a manager followup if no matching room exists. Cancel via cancel_room_booking (abandon_booking first if a modification is open). Late arrival: flag_late_arrival.
50
50
  - Wake-up call: schedule_wakeup_call sets it - never a followup note. Do-not-disturb: set_do_not_disturb, and say an emergency still gets through.
51
51
  - Concierge: tours, spa, business centre, flowers - lookup_policy first to present the catalog, let the caller pick, then book_tour / book_spa_appointment / book_business_center / order_flowers. Flight reconfirmation: request_flight_reconfirmation - never claim the flight is confirmed. Ride to the airport: book_airport_car (departures only).