@alexkroman1/aai-cli 15.1.0 → 16.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 (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
@@ -1,130 +0,0 @@
1
- // An EVAL: does the FAQ bot actually look things up?
2
- //
3
- // `agent.test.ts` scores the search index directly, which settles what
4
- // `search_knowledge` returns for a query it is handed. What it cannot settle is
5
- // the discipline this agent's whole prompt is about: that an answer comes from
6
- // `knowledge.json` and not from what a model happens to know about the
7
- // framework it is describing.
8
- //
9
- // Run it with `aai eval`. Without a provider key each case runs against a
10
- // SCRIPTED model (its `stubReply`) — the real session and the real tools, a
11
- // fake reply — which proves the wiring and says nothing about the discipline.
12
-
13
- /**
14
- * The def a DEPLOYED agent runs: authored, plus what `tools/` declares.
15
- *
16
- * Taken from `virtual:aai/agent` rather than a hand-written glob: the plugin
17
- * expands it against THIS file's own directory, so the spec needs no glob and
18
- * no shared helper — which matters because this file SHIPS, and a scaffolded
19
- * project has no repo helper to import. Without
20
- * it this agent would have no tools and would answer every question from the
21
- * model's own memory, which is exactly what the cases below forbid.
22
- *
23
- * And plus its PROMPT. `agent.ts` does not declare one, because
24
- * `system-prompt.md` is resolved by the BUILD (`aai build`/`aai deploy`) — so
25
- * the raw default export carries the FRAMEWORK DEFAULT prompt. An eval that
26
- * drives it measures a different agent than the one that deploys, and every
27
- * tool-choice claim below then passes or fails for the wrong reason.
28
- */
29
- import agentDef from "virtual:aai/agent";
30
- import { toolNames, toolResultIn } from "@alexkroman1/aai-runtime/eval";
31
- import { describeEval } from "@alexkroman1/aai-runtime/eval/vitest";
32
- import { expect } from "vitest";
33
- import { z } from "zod";
34
- import { faqs } from "./shared.ts";
35
-
36
- /**
37
- * A knowledge-base HIT, as the model saw it — `tool.completed` carries it
38
- * serialized, and `toolResultIn` parses and validates it.
39
- *
40
- * A schema rather than a cast, which is the whole reason to pass one: an index
41
- * that started answering with a different shape FAILS here naming the field,
42
- * where the cast this replaced would have read `undefined` off it and failed a
43
- * line later on something unrelated. `search_knowledge` also answers
44
- * `{ result: "No matching FAQ found." }` for a miss, so a miss fails HERE — and
45
- * a miss on this question is the finding.
46
- */
47
- const FaqEntrySchema = z.object({ question: z.string(), answer: z.string() });
48
-
49
- /** The knowledge-base entry this template's own answer about the web is in. */
50
- const INTERNET = faqs.find((f) => f.question.includes("internet"))!;
51
-
52
- describeEval(agentDef, (test) => {
53
- test(
54
- "answers a PARAPHRASED question out of the knowledge base",
55
- async ({ session }) => {
56
- // Nothing in this wording appears in the entry's question, so the entry
57
- // has to be found by the index rather than matched by substring — and the
58
- // agent has to go looking instead of telling the caller what it knows
59
- // about voice frameworks in general.
60
- const turn = await session.say("Can your agents make HTTP requests?");
61
-
62
- expect(toolNames(turn.toolCalls)).toEqual(["search_knowledge"]);
63
- const call = turn.toolCalls[0]!;
64
- expect(typeof (call.args as { query?: unknown }).query).toBe("string");
65
- // The right entry, out of four: the one this question is really about.
66
- expect(toolResultIn(turn.toolCalls, "search_knowledge", FaqEntrySchema).question).toBe(
67
- INTERNET.question,
68
- );
69
- // And the reply is that entry's answer rather than an embellishment of
70
- // it — "quote the knowledge base accurately" is the prompt's rule.
71
- expect(turn.text).toMatch(/fetch|web_search|http/i);
72
- },
73
- {
74
- stubReply: [
75
- { tool: "search_knowledge", args: { query: "Can your agents make HTTP requests?" } },
76
- "Yes — agents run with network access and can use the fetch API or the web_search builtin.",
77
- ],
78
- },
79
- );
80
-
81
- test(
82
- "lists the topics it really has, not the ones it can imagine",
83
- async ({ session }) => {
84
- const turn = await session.say("What topics can you help me with?");
85
-
86
- expect(toolNames(turn.toolCalls)).toEqual(["list_topics"]);
87
- // Every question in `knowledge.json` and nothing else — the check that
88
- // catches an index built from a stale copy of the asset.
89
- expect(toolResultIn(turn.toolCalls, "list_topics", z.array(z.string()))).toEqual(
90
- faqs.map((f) => f.question),
91
- );
92
- expect(turn.completed).toBe(true);
93
- },
94
- {
95
- stubReply: [
96
- { tool: "list_topics" },
97
- "I can cover what AAI is, how tools work, speech providers, and network access.",
98
- ],
99
- },
100
- );
101
-
102
- test(
103
- "says it does not know rather than answering off-base",
104
- async ({ session }) => {
105
- // The knowledge base has four entries and none of them is the weather.
106
- // A model asked this will answer it unless the prompt holds — and an FAQ
107
- // bot that answers from outside its own asset is the failure this
108
- // template exists to demonstrate the fix for.
109
- const turn = await session.say("What's the weather in Paris right now?");
110
-
111
- expect(turn.text).toMatch(/can.?t|cannot|do(n.?t| not) have|not something I/i);
112
- // No degrees, no forecast: whatever it says, it must not have invented an
113
- // answer, and it may not have found one in a knowledge base without one.
114
- expect(turn.text).not.toMatch(/\d+\s*(°|degrees)/i);
115
- for (const call of turn.toolCalls) {
116
- // `toolResultIn` over a ONE-CALL list: the name is this call's own, so
117
- // the reader's "no such call" and "two calls" throws are unreachable and
118
- // what is left is the parse plus its "never completed" failure — which
119
- // is exactly what the local helper this replaced did by hand.
120
- expect(toolResultIn([call], call.name)).not.toMatchObject({
121
- question: expect.stringContaining("weather"),
122
- });
123
- }
124
- },
125
- // Live only: a scripted model saying "I don't know" proves that the script
126
- // said so, which is not the claim. `{ live: true }` is the honest way to
127
- // write a case a stub cannot satisfy.
128
- { live: true },
129
- );
130
- });
@@ -1,79 +0,0 @@
1
- /** The def a DEPLOYED agent runs: authored, plus what `tools/` declares. */
2
- import agentDef from "virtual:aai/agent";
3
- import { toolRunner } from "@alexkroman1/aai/testing";
4
- import { describe, expect, test } from "vitest";
5
- import { faqs, searchable } from "./shared.ts";
6
-
7
- /**
8
- * Both tools here are stateless, so no call passes a context: `runTool` builds
9
- * a fresh one, which is a distinct session with empty slots — right for a tool
10
- * that reads nothing but its arguments, and never what two calls sharing state
11
- * want. `list_topics` takes no arguments either, and may say so by leaving them
12
- * out rather than passing a `{}` between the two values a reader cares about.
13
- */
14
- const run = toolRunner(agentDef);
15
-
16
- describe("embedded-assets template", () => {
17
- test("the JSON asset really is bundled, and the index is built from it", () => {
18
- // The template's whole subject: an asset imported with an import attribute,
19
- // resolved at build time rather than fetched. An empty knowledge base would
20
- // make every search below trivially "not found".
21
- expect(faqs.length).toBeGreaterThan(0);
22
- expect(searchable).toHaveLength(faqs.length);
23
- for (const entry of faqs) {
24
- expect(entry.question).toBeTypeOf("string");
25
- expect(entry.answer).toBeTypeOf("string");
26
- }
27
- });
28
-
29
- test("both tools are discovered from tools/", () => {
30
- // `agent()` takes no `tools` field: a file in `tools/` IS the tool, and
31
- // nothing imports it. Discovery is what puts it in front of the model, so a
32
- // template whose tools are never resolved ships a model with no tools.
33
- // `arrayContaining` rather than an exact list: adding a file to `tools/` is
34
- // the edit this template most invites, and an exact list would redden on
35
- // it. Losing one of these two is still a failure — that is the half worth
36
- // asserting.
37
- expect(Object.keys(agentDef.tools ?? {})).toEqual(
38
- expect.arrayContaining(["list_topics", "search_knowledge"]),
39
- );
40
- });
41
- });
42
-
43
- describe("list_topics", () => {
44
- test("answers with every question in the knowledge base", async () => {
45
- const topics = await run("list_topics");
46
- expect(topics).toEqual(faqs.map((f) => f.question));
47
- });
48
- });
49
-
50
- describe("search_knowledge", () => {
51
- test("scores by word overlap rather than by substring", async () => {
52
- // The reason the tool does not just `includes()` the query: a caller asks a
53
- // natural question, which is never a substring of an FAQ entry.
54
- const target = faqs[0];
55
- if (!target) throw new Error("the knowledge base is empty");
56
- const words = target.question
57
- .toLowerCase()
58
- .split(/\W+/)
59
- .filter((w) => w.length > 2);
60
- const result = await run("search_knowledge", {
61
- query: `hey, could you tell me ${words.join(" ")}?`,
62
- });
63
- expect(result).toEqual(target);
64
- });
65
-
66
- test("a query with no words longer than two characters is refused early", async () => {
67
- // The guard before the scan: with no scoreable words every entry ties at
68
- // zero, and returning the first one would be an answer to nothing.
69
- expect(await run("search_knowledge", { query: "is it a" })).toEqual({
70
- result: "No matching FAQ found.",
71
- });
72
- });
73
-
74
- test("a query that overlaps nothing reports no match rather than guessing", async () => {
75
- expect(await run("search_knowledge", { query: "zzzqqq wibbleflange" })).toEqual({
76
- result: "No matching FAQ found.",
77
- });
78
- });
79
- });
@@ -1,7 +0,0 @@
1
- import { agent } from "@alexkroman1/aai";
2
-
3
- export default agent({
4
- name: "FAQ Bot",
5
- greeting:
6
- "Hi! I'm your FAQ assistant. Ask me anything about the AAI agent framework and I'll look it up in my knowledge base.",
7
- });
@@ -1,20 +0,0 @@
1
- {
2
- "faqs": [
3
- {
4
- "question": "What is AAI?",
5
- "answer": "AAI is a framework for building voice-powered AI agents that run on Node.js."
6
- },
7
- {
8
- "question": "How do agents handle tools?",
9
- "answer": "Agents define tools with a schema and handler function. The LLM decides when to call them based on the conversation."
10
- },
11
- {
12
- "question": "What speech providers are supported?",
13
- "answer": "AAI supports AssemblyAI for speech-to-text and text-to-speech."
14
- },
15
- {
16
- "question": "Can agents access the internet?",
17
- "answer": "Yes, agents run with network access and can make HTTP requests via the fetch API or built-in tools like web_search."
18
- }
19
- ]
20
- }
@@ -1,17 +0,0 @@
1
- import knowledge from "./knowledge.json" with { type: "json" };
2
-
3
- export type FaqEntry = { question: string; answer: string };
4
-
5
- export const faqs: FaqEntry[] = knowledge.faqs;
6
-
7
- /**
8
- * The searchable index, built once at module load.
9
- *
10
- * Search text is static, so normalizing it here keeps per-call work O(query)
11
- * even when the knowledge base grows — and both tools import this module, so
12
- * the index is built once for the process rather than once per tool.
13
- */
14
- export const searchable = faqs.map((entry) => ({
15
- entry,
16
- text: `${entry.question} ${entry.answer}`.toLowerCase(),
17
- }));
@@ -1,13 +0,0 @@
1
- You are a friendly FAQ assistant. Answer questions using ONLY the information
2
- from your embedded knowledge base. If the user asks something not covered by
3
- your knowledge base, say you don't have that information and suggest they check
4
- the official documentation.
5
-
6
- Rules:
7
-
8
- - Keep answers concise and conversational — this is a voice agent
9
- - Quote the knowledge base accurately, do not embellish
10
- - If a question is ambiguous, ask the user to clarify
11
- - Use 'search_knowledge' to find answers to specific questions
12
- - Use 'list_topics' to see all available FAQ topics
13
- - Always be helpful and polite
@@ -1,9 +0,0 @@
1
- import { tool } from "@alexkroman1/aai";
2
- import { faqs } from "../shared.ts";
3
-
4
- export default tool({
5
- description: "List all available topics in the embedded FAQ knowledge base.",
6
- async execute() {
7
- return faqs.map((f) => f.question);
8
- },
9
- });
@@ -1,26 +0,0 @@
1
- import { tool } from "@alexkroman1/aai";
2
- import { z } from "zod";
3
- import { type FaqEntry, searchable } from "../shared.ts";
4
-
5
- export default tool({
6
- description: "Search the embedded FAQ knowledge base for an answer matching the user's question.",
7
- inputSchema: z.object({
8
- query: z.string().describe("The user's question to search for"),
9
- }),
10
- async execute(args) {
11
- // Score by word overlap — natural questions rarely match an FAQ
12
- // entry as an exact substring.
13
- const words = args.query
14
- .toLowerCase()
15
- .split(/\W+/)
16
- .filter((w) => w.length > 2);
17
- if (words.length === 0) return { result: "No matching FAQ found." };
18
-
19
- let best: { entry: FaqEntry; score: number } | null = null;
20
- for (const { entry, text } of searchable) {
21
- const score = words.filter((w) => text.includes(w)).length;
22
- if (score > 0 && (!best || score > best.score)) best = { entry, score };
23
- }
24
- return best?.entry ?? { result: "No matching FAQ found." };
25
- },
26
- });
@@ -1,128 +0,0 @@
1
- // An EVAL: does Math Buddy delegate every calculation to code? Run it with
2
- // `aai eval`.
3
- //
4
- // This tutor's whole design is "the model does the talking, run_code does the
5
- // arithmetic" — which is also why it runs on Flash-Lite. So the claim worth
6
- // pinning is not that the answer is right, it is that the answer came from
7
- // CODE, and that the code is the recipe the prompt gave.
8
- //
9
- // Two things this file has to work around, both explained at length in
10
- // `../code-interpreter/agent.eval.test.ts`: `system-prompt.md` is discovered by
11
- // the build rather than imported, so an eval has to apply it or it measures a
12
- // different agent; and `run_code` refuses unless the EVAL supplies an executor,
13
- // which this suite does — so the cases below assert the answer the code came
14
- // back with as well as the code the tutor wrote.
15
-
16
- import agentDef from "virtual:aai/agent";
17
- import {
18
- createVmRunCode,
19
- type EvalTurn,
20
- toolArgsIn,
21
- toolNames,
22
- toolResultsIn,
23
- } from "@alexkroman1/aai-runtime/eval";
24
- import { describeEval } from "@alexkroman1/aai-runtime/eval/vitest";
25
- import { expect } from "vitest";
26
- import { z } from "zod";
27
-
28
- /**
29
- * The code every `run_code` call in this turn carried, joined.
30
- *
31
- * Read through `toolArgsIn` WITH a schema, which is what that reader takes one
32
- * for: `args` is `Record<string, unknown>` on the wire — the tutor wrote it and
33
- * nothing validated it — so the `String(c.args.code ?? "")` this replaced turned
34
- * an argument the model renamed, or never sent, into `""`. The claims below are
35
- * about the recipe the tutor wrote, and against `""` every one of them would
36
- * have been a claim about nothing. A `code` that stops arriving FAILS here,
37
- * naming the field.
38
- */
39
- const RunCodeArgs = z.object({ code: z.string() });
40
- const codeIn = (turn: EvalTurn) =>
41
- toolArgsIn(turn.toolCalls, "run_code", RunCodeArgs)
42
- .map((args) => args.code)
43
- .join("\n");
44
-
45
- /**
46
- * A `run_code` executor, so these cases can assert the answer the tutor's code
47
- * came back with and not merely the code — `createVmRunCode`'s own doc carries
48
- * why the builtin refuses without one.
49
- */
50
- const runCode = createVmRunCode();
51
-
52
- describeEval(
53
- agentDef,
54
- (test) => {
55
- test(
56
- "converts units in code, with a real conversion factor",
57
- async ({ session }) => {
58
- const turn = await session.say("Convert 5 miles to kilometres.");
59
-
60
- // The prompt hands the tutor the factors; the finding it guards against
61
- // is a tutor that recites a remembered figure instead. A factor in the
62
- // code is the evidence that the conversion was computed, not recalled.
63
- expect(toolNames(turn.toolCalls)).toContain("run_code");
64
- const code = codeIn(turn);
65
- expect(code).toContain("5");
66
- expect(code).toMatch(/1\.60|1\.61|0\.621|8\.04/);
67
- // And the factor was applied rather than merely mentioned: five miles is
68
- // 8.0467 km, so whatever rounding the tutor chose the answer starts 8.0.
69
- const output = toolResultsIn(turn.toolCalls, "run_code").join("\n");
70
- expect(output, `run_code printed: ${output}`).toMatch(/8\.0/);
71
- },
72
- { live: true },
73
- );
74
-
75
- test(
76
- "rolls dice with a random draw rather than inventing numbers",
77
- async ({ session }) => {
78
- const turn = await session.say("Roll 3 twenty-sided dice for me.");
79
-
80
- // A model asked for dice will happily make three numbers up, and the
81
- // reply is indistinguishable from a real roll. `Math.random` in the code
82
- // is the only thing that tells them apart.
83
- expect(toolNames(turn.toolCalls)).toContain("run_code");
84
- const code = codeIn(turn);
85
- expect(code).toMatch(/Math\.random/);
86
- expect(code).toContain("20");
87
- expect(code).toContain("3");
88
-
89
- // And the draw really happened: three integers, every one of them a legal
90
- // face of a twenty-sided die. `Math.random` in the code says the tutor
91
- // asked for a roll; this says it GOT one — a `run_code` that refused
92
- // prints a sentence with no dice in it at all.
93
- const output = toolResultsIn(turn.toolCalls, "run_code").join("\n");
94
- const rolled = [...output.matchAll(/\d+/g)].map((m) => Number(m[0]));
95
- expect(rolled.length, `run_code printed: ${output}`).toBeGreaterThanOrEqual(3);
96
- for (const face of rolled) {
97
- expect(face, `run_code printed: ${output}`).toBeGreaterThanOrEqual(1);
98
- expect(face, `run_code printed: ${output}`).toBeLessThanOrEqual(20);
99
- }
100
- },
101
- { live: true },
102
- );
103
-
104
- test(
105
- "the run_code builtin is wired to the agent's tool executor",
106
- async ({ session }) => {
107
- const turn = await session.say("What is 127 times 849?");
108
-
109
- // A tool the agent does not declare produces a `tool.called` with no
110
- // result, so the paired result is what says `builtinTools: ["run_code"]`
111
- // still resolves to something executable. The ANSWER rather than
112
- // `toBeDefined()`, which the refusal string satisfied too.
113
- const [call] = turn.toolCalls;
114
- expect(call?.name).toBe("run_code");
115
- expect(call?.result).toBe("107823");
116
- expect(turn.completed).toBe(true);
117
- },
118
- {
119
- stubReply: [
120
- { tool: "run_code", args: { code: "console.log(127 * 849)" } },
121
- "That's 107,823.",
122
- ],
123
- },
124
- );
125
- },
126
- // `runCode` is what makes these cases about the ANSWER and not just the call.
127
- { runCode },
128
- );
@@ -1,126 +0,0 @@
1
- /**
2
- * The def a DEPLOYED agent runs: authored, plus the `system-prompt.md` beside
3
- * it.
4
- *
5
- * This template declares no `tools/` at all — every calculation is the
6
- * `run_code` builtin's — so the prompt is the only thing discovery adds here,
7
- * and it is what half the tests below are about. Importing `./agent.ts`
8
- * directly would measure a tutor whose prompt is the framework default, i.e.
9
- * an agent that was never told to compute in code.
10
- */
11
- import agentDef from "virtual:aai/agent";
12
- import { toAgentConfig } from "@alexkroman1/aai/manifest";
13
- import { describe, expect, test } from "vitest";
14
-
15
- /**
16
- * What a starter's spec may assert.
17
- *
18
- * `aai build` runs these tests before it bundles, so an assertion pinning this
19
- * tutor's own identity — its literal name, the wording of its greeting, the
20
- * model id it happens to run today — turns the first customization into a build
21
- * failure in a file the author never wrote. Every test here therefore asserts a
22
- * property that survives a rename, a voice, a reworded prompt and a model swap,
23
- * on the RESOLVED config rather than on the def's empty fields.
24
- *
25
- * `run_code` is the one thing named literally, and deliberately: taking it away
26
- * is not a customization of Math Buddy but a deletion of its subject — the
27
- * prompt is nothing but recipes for it — and the tutor left behind does
28
- * arithmetic from memory, which reads exactly like a correct answer until it is
29
- * wrong.
30
- *
31
- * What is NOT here is anything about the code the tutor writes or the answer it
32
- * comes back with: that needs a model and a sandbox, so it belongs to
33
- * `agent.eval.test.ts`, which supplies both. This tier's question is the one
34
- * that comes first — was the tutor handed anything to run at all.
35
- */
36
- describe("math-buddy template", () => {
37
- test("config passes manifest validation", () => {
38
- // Same conversion `aai build`/`aai deploy` run — and the only thing that
39
- // says this template's declared LLM descriptor is well formed before a
40
- // live session tries to open one from it.
41
- expect(() => toAgentConfig(agentDef)).not.toThrow();
42
- });
43
-
44
- test("exports an agent the platform can name", () => {
45
- // Not the literal: what has to hold is that there IS a name and that the
46
- // conversion carries it through — `AgentName` refuses a blank one, and the
47
- // studio lists a deployed agent by exactly this string.
48
- expect(agentDef.name).toBeTruthy();
49
- expect(toAgentConfig(agentDef).name).toBe(agentDef.name);
50
- });
51
-
52
- test("run_code is declared, and the prompt the deploy carries asks for it", () => {
53
- const config = toAgentConfig(agentDef);
54
- // Two halves, each of which fails silently and produces a plausible tutor.
55
- // Without the declaration the model has nothing to run, so it computes in
56
- // its head and says the answer with the same confidence either way. Without
57
- // the prompt reaching the CONFIG — the "I edited system-prompt.md and
58
- // nothing changed" failure `withSystemPrompt` exists to catch, since the
59
- // file is discovered by the build rather than imported by `agent.ts` — the
60
- // recipes are gone and what deploys is a general assistant that happens to
61
- // have a sandbox attached. The framework default says nothing about
62
- // `run_code`, which is what makes the second assertion a real check on
63
- // discovery rather than a restatement of the first.
64
- expect(config.builtinTools).toContain("run_code");
65
- expect(config.systemPrompt).toContain("run_code");
66
- });
67
-
68
- test("whichever model this tutor runs on, the conversion carries its tuning", () => {
69
- const config = toAgentConfig(agentDef);
70
- if (config.mode !== "pipeline") {
71
- // Switched the def to `s2s`? Then one model listens and talks, and there
72
- // is no separate LLM stage left for anything to be carried on.
73
- expect(config.mode).toBe("s2s");
74
- expect(config.llm).toBeUndefined();
75
- return;
76
- }
77
- if (agentDef.llm === undefined) {
78
- // Dropped the declaration to take the default cascade: it still resolves
79
- // to a NAMED model, because the gateway refuses an unknown id with a 400
80
- // at the first session — "no model" is not a state a deploy may reach.
81
- expect(config.llm?.options.model).toBeTruthy();
82
- return;
83
- }
84
- // A model choice is the only reason this tutor declares a stage at all —
85
- // a quick, cheap one, since `run_code` does the arithmetic and what is left
86
- // is turn-taking speed. So the descriptor is checked whole rather than by
87
- // `kind`: one that arrived with its options dropped would deploy the
88
- // gateway's default model instead, quietly slower, with nothing on the line
89
- // saying so. Read off the def rather than pinned, because swapping the id
90
- // is the first tuning an author of this template tries.
91
- expect(config.llm?.kind).toBe(agentDef.llm.kind);
92
- expect(config.llm?.options).toEqual(agentDef.llm.options);
93
- expect(config.llm?.options.model).toBeTruthy();
94
- });
95
-
96
- test("every stage its mode needs is filled, declared or defaulted", () => {
97
- // This template's other half: it declares the LLM and nothing else, so STT
98
- // and TTS are injected at parse time (see `defaultProviders`) and the tutor
99
- // can still hear and speak. Asserted per MODE so it survives a swap —
100
- // declare `stt`/`tts` and the rest still default; declare `s2s` and there
101
- // is no cascade to fill, which is the one thing that must never happen by
102
- // fallthrough.
103
- const config = toAgentConfig(agentDef);
104
- if (config.mode === "s2s") {
105
- expect(config.s2s?.kind).toBeTruthy();
106
- expect(config.stt).toBeUndefined();
107
- expect(config.tts).toBeUndefined();
108
- return;
109
- }
110
- expect(config.mode).toBe("pipeline");
111
- for (const stage of ["stt", "llm", "tts"] as const) {
112
- expect(config[stage]?.kind, stage).toBe(agentDef[stage]?.kind ?? "assemblyai");
113
- }
114
- });
115
-
116
- test("the caller is told what to ask, and the greeting survives the conversion", () => {
117
- // A voice agent has no buttons, so the opener is the only place a caller
118
- // learns that this one wants arithmetic, conversions and dice rather than
119
- // conversation. It rides to the browser in `/client-config` beside `name`,
120
- // so what has to hold is that there is one and the conversion carries it:
121
- // a greeting lost at that boundary is replaced by the framework's generic
122
- // opener, which invites the caller to ask for anything at all.
123
- expect(agentDef.greeting).toBeTruthy();
124
- expect(toAgentConfig(agentDef).greeting).toBe(agentDef.greeting);
125
- });
126
- });
@@ -1,15 +0,0 @@
1
- import { agent } from "@alexkroman1/aai";
2
- import { assemblyAILlm } from "@alexkroman1/aai/llm";
3
-
4
- export default agent({
5
- name: "Math Buddy",
6
- // Only the LLM stage is declared: this tutor delegates every calculation
7
- // to run_code, so it needs turn-taking speed more than reasoning depth —
8
- // and Flash-Lite is both quicker and cheaper than the default model. STT
9
- // and TTS stay on the AssemblyAI defaults. (The string shorthand
10
- // `llm: "gemini-2.5-flash-lite"` desugars to this same descriptor.)
11
- llm: assemblyAILlm({ model: "gemini-2.5-flash-lite" }),
12
- greeting:
13
- "Hey, I'm Math Buddy. Try asking me something like, what's 127 times 849, convert 5 miles to kilometers, or roll 3 twenty-sided dice.",
14
- builtinTools: ["run_code"],
15
- });
@@ -1,12 +0,0 @@
1
- You are Math Buddy, a friendly math assistant. You help with calculations,
2
- unit conversions, dice rolls, and random number generation. Keep answers short and clear.
3
- When doing multi-step math, show your work briefly.
4
-
5
- Use run_code for ALL calculations. Write JavaScript using console.log() for output.
6
-
7
- Examples:
8
- - Math expressions: console.log((12 + 8) * 3) or console.log(Math.sqrt(144))
9
- - Unit conversions: convert using known factors (1 km = 0.621371 mi, 1 lb = 0.453592 kg, etc.)
10
- - Temperature: C to F = (c * 9/5) + 32, F to C = (f - 32) * 5/9, C to K = c + 273.15
11
- - Dice rolls: console.log(Array.from({length: N}, () => Math.floor(Math.random() * sides) + 1))
12
- - Random numbers: console.log(Math.floor(Math.random() * (max - min + 1)) + min)