@alexkroman1/aai-cli 15.0.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 (363) 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 +14 -20
  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-CFyusRbq.mjs → init-D363Ls5u.mjs} +13 -39
  26. package/dist/init.d.ts +5 -10
  27. package/dist/scaffold/CLAUDE.md +185 -35
  28. package/dist/scaffold/package.json +4 -4
  29. package/dist/start.mjs +3 -1
  30. package/dist/{studio-C_zuRC_z.mjs → studio-CtRBVVFR.mjs} +1 -1
  31. package/dist/templates/briefing-desk/agent.eval.test.ts +34 -6
  32. package/dist/templates/briefing-desk/agent.test.ts +347 -55
  33. package/dist/templates/briefing-desk/agent.ts +12 -0
  34. package/dist/templates/briefing-desk/shared.ts +220 -31
  35. package/dist/templates/briefing-desk/slack.ts +108 -0
  36. package/dist/templates/briefing-desk/system-prompt.md +12 -2
  37. package/dist/templates/briefing-desk/tools/briefing_so_far.ts +15 -7
  38. package/dist/templates/briefing-desk/tools/research_topic.ts +20 -28
  39. package/dist/templates/briefing-desk/tools/send_briefing.ts +77 -0
  40. package/dist/templates/briefing-desk/tools/verify_claim.ts +60 -14
  41. package/dist/templates/call-audit/agent.eval.test.ts +5 -0
  42. package/dist/templates/call-audit/agent.test.ts +6 -1
  43. package/dist/templates/call-audit/agent.ts +10 -23
  44. package/dist/templates/call-audit/client.tsx +30 -55
  45. package/dist/templates/call-audit/guards.test.ts +233 -0
  46. package/dist/templates/call-audit/workflows/audit.ts +95 -16
  47. package/dist/templates/call-audit/workflows/ingest.ts +107 -88
  48. package/dist/templates/call-audit/workflows/media.ts +98 -7
  49. package/dist/templates/call-audit/workflows/summarize.ts +35 -31
  50. package/dist/templates/call-audit/workflows/sync-api.ts +15 -6
  51. package/dist/templates/code-interpreter/agent.eval.test.ts +104 -56
  52. package/dist/templates/code-interpreter/agent.test.ts +44 -56
  53. package/dist/templates/code-interpreter/system-prompt.md +1 -1
  54. package/dist/templates/dispatch-center/agent.eval.test.ts +61 -24
  55. package/dist/templates/dispatch-center/agent.test.ts +253 -48
  56. package/dist/templates/dispatch-center/agent.ts +28 -1
  57. package/dist/templates/dispatch-center/client.tsx +126 -201
  58. package/dist/templates/dispatch-center/events.ts +48 -0
  59. package/dist/templates/dispatch-center/shared.ts +42 -1
  60. package/dist/templates/dispatch-center/tools/incident_create.ts +3 -2
  61. package/dist/templates/dispatch-center/tools/incident_escalate.ts +2 -1
  62. package/dist/templates/dispatch-center/tools/ops_dashboard.ts +35 -15
  63. package/dist/templates/dispatch-center/tools/ops_run_scenario.ts +3 -1
  64. package/dist/templates/dispatch-center/tools/resources_dispatch.ts +2 -2
  65. package/dist/templates/executive-assistant/agent.eval.test.ts +233 -0
  66. package/dist/templates/executive-assistant/agent.test.ts +672 -0
  67. package/dist/templates/executive-assistant/agent.ts +50 -0
  68. package/dist/templates/executive-assistant/calendar.test.ts +198 -0
  69. package/dist/templates/executive-assistant/client.tsx +195 -0
  70. package/dist/templates/executive-assistant/inbox.ts +233 -0
  71. package/dist/templates/executive-assistant/meeting.ts +138 -0
  72. package/dist/templates/executive-assistant/nodes.ts +152 -0
  73. package/dist/templates/executive-assistant/prompts.ts +331 -0
  74. package/dist/templates/executive-assistant/review.ts +425 -0
  75. package/dist/templates/executive-assistant/shared.ts +490 -0
  76. package/dist/templates/executive-assistant/system-prompt.md +15 -0
  77. package/dist/templates/executive-assistant/tools/accept.ts +10 -0
  78. package/dist/templates/executive-assistant/tools/ask_question.ts +30 -0
  79. package/dist/templates/executive-assistant/tools/draft_reply.ts +67 -0
  80. package/dist/templates/executive-assistant/tools/edit.ts +10 -0
  81. package/dist/templates/executive-assistant/tools/ignore.ts +10 -0
  82. package/dist/templates/executive-assistant/tools/inbox_status.ts +27 -0
  83. package/dist/templates/executive-assistant/tools/meeting_assistant.ts +52 -0
  84. package/dist/templates/executive-assistant/tools/new_email.ts +50 -0
  85. package/dist/templates/executive-assistant/tools/open_email.ts +165 -0
  86. package/dist/templates/executive-assistant/tools/respond.ts +10 -0
  87. package/dist/templates/executive-assistant/tools/review_memory.ts +22 -0
  88. package/dist/templates/executive-assistant/tools/send_calendar_invite.ts +68 -0
  89. package/dist/templates/executive-assistant/tools/triage_inbox.ts +75 -0
  90. package/dist/templates/health-assistant/agent.test.ts +134 -15
  91. package/dist/templates/health-assistant/agent.ts +8 -1
  92. package/dist/templates/health-assistant/fda.test.ts +130 -0
  93. package/dist/templates/health-assistant/fda.ts +75 -16
  94. package/dist/templates/health-assistant/system-prompt.md +9 -0
  95. package/dist/templates/health-assistant/tools/check_drug_interaction.ts +5 -2
  96. package/dist/templates/health-assistant/tools/medication_lookup.ts +16 -11
  97. package/dist/templates/hiring-desk/agent.eval.test.ts +242 -0
  98. package/dist/templates/hiring-desk/agent.test.ts +1021 -0
  99. package/dist/templates/hiring-desk/agent.ts +38 -0
  100. package/dist/templates/hiring-desk/client.tsx +154 -0
  101. package/dist/templates/hiring-desk/crews.ts +432 -0
  102. package/dist/templates/hiring-desk/leads.json +86 -0
  103. package/dist/templates/hiring-desk/screening-lock.test.ts +77 -0
  104. package/dist/templates/hiring-desk/screening-lock.ts +51 -0
  105. package/dist/templates/hiring-desk/shared.ts +480 -0
  106. package/dist/templates/hiring-desk/system-prompt.md +21 -0
  107. package/dist/templates/hiring-desk/tools/candidate_details.ts +49 -0
  108. package/dist/templates/hiring-desk/tools/proceed_to_emails.ts +127 -0
  109. package/dist/templates/hiring-desk/tools/read_email.ts +50 -0
  110. package/dist/templates/hiring-desk/tools/rescore_with_feedback.ts +140 -0
  111. package/dist/templates/hiring-desk/tools/screen_candidates.ts +128 -0
  112. package/dist/templates/hiring-desk/tools/screening_status.ts +51 -0
  113. package/dist/templates/hotel-desk/agent.eval.test.ts +177 -0
  114. package/dist/templates/hotel-desk/agent.test.ts +1128 -0
  115. package/dist/templates/hotel-desk/agent.ts +63 -0
  116. package/dist/templates/hotel-desk/booking.ts +159 -0
  117. package/dist/templates/hotel-desk/card.ts +92 -0
  118. package/dist/templates/hotel-desk/catalogs.ts +219 -0
  119. package/dist/templates/hotel-desk/client.tsx +137 -0
  120. package/dist/templates/hotel-desk/concierge.ts +99 -0
  121. package/dist/templates/hotel-desk/desk-seams.test.ts +334 -0
  122. package/dist/templates/hotel-desk/desk.ts +224 -0
  123. package/dist/templates/hotel-desk/disputes.ts +216 -0
  124. package/dist/templates/hotel-desk/events.ts +79 -0
  125. package/dist/templates/hotel-desk/hotel.ts +412 -0
  126. package/dist/templates/hotel-desk/policies.ts +209 -0
  127. package/dist/templates/hotel-desk/records.ts +384 -0
  128. package/dist/templates/hotel-desk/restaurant.ts +147 -0
  129. package/dist/templates/hotel-desk/seed.ts +955 -0
  130. package/dist/templates/hotel-desk/shared.ts +354 -0
  131. package/dist/templates/hotel-desk/system-prompt.md +76 -0
  132. package/dist/templates/hotel-desk/tools/abandon_booking.ts +30 -0
  133. package/dist/templates/hotel-desk/tools/add_to_waitlist.ts +41 -0
  134. package/dist/templates/hotel-desk/tools/book_airport_car.ts +57 -0
  135. package/dist/templates/hotel-desk/tools/book_business_center.ts +44 -0
  136. package/dist/templates/hotel-desk/tools/book_spa_appointment.ts +39 -0
  137. package/dist/templates/hotel-desk/tools/book_tour.ts +35 -0
  138. package/dist/templates/hotel-desk/tools/cancel_restaurant_reservation.ts +25 -0
  139. package/dist/templates/hotel-desk/tools/cancel_room_booking.ts +63 -0
  140. package/dist/templates/hotel-desk/tools/check_restaurant_availability.ts +24 -0
  141. package/dist/templates/hotel-desk/tools/check_room_availability.ts +40 -0
  142. package/dist/templates/hotel-desk/tools/choose_room.ts +93 -0
  143. package/dist/templates/hotel-desk/tools/confirm_booking.ts +153 -0
  144. package/dist/templates/hotel-desk/tools/dispatch_emergency.ts +61 -0
  145. package/dist/templates/hotel-desk/tools/dispute_charge.ts +90 -0
  146. package/dist/templates/hotel-desk/tools/flag_late_arrival.ts +26 -0
  147. package/dist/templates/hotel-desk/tools/lookup_booking.ts +48 -0
  148. package/dist/templates/hotel-desk/tools/lookup_guest_history.ts +28 -0
  149. package/dist/templates/hotel-desk/tools/lookup_invoice.ts +26 -0
  150. package/dist/templates/hotel-desk/tools/lookup_policy.ts +20 -0
  151. package/dist/templates/hotel-desk/tools/lookup_restaurant_reservation.ts +27 -0
  152. package/dist/templates/hotel-desk/tools/modify_restaurant_reservation.ts +75 -0
  153. package/dist/templates/hotel-desk/tools/order_flowers.ts +40 -0
  154. package/dist/templates/hotel-desk/tools/record_card.ts +46 -0
  155. package/dist/templates/hotel-desk/tools/record_followup.ts +50 -0
  156. package/dist/templates/hotel-desk/tools/record_group_inquiry.ts +44 -0
  157. package/dist/templates/hotel-desk/tools/record_guest_details.ts +71 -0
  158. package/dist/templates/hotel-desk/tools/reinstate_booking.ts +65 -0
  159. package/dist/templates/hotel-desk/tools/request_flight_reconfirmation.ts +54 -0
  160. package/dist/templates/hotel-desk/tools/resend_confirmation.ts +39 -0
  161. package/dist/templates/hotel-desk/tools/reserve_table.ts +87 -0
  162. package/dist/templates/hotel-desk/tools/resolve_room_conflict.ts +48 -0
  163. package/dist/templates/hotel-desk/tools/schedule_wakeup_call.ts +48 -0
  164. package/dist/templates/hotel-desk/tools/set_do_not_disturb.ts +28 -0
  165. package/dist/templates/hotel-desk/tools/set_extras.ts +51 -0
  166. package/dist/templates/hotel-desk/tools/set_stay.ts +97 -0
  167. package/dist/templates/hotel-desk/tools/start_booking_modification.ts +57 -0
  168. package/dist/templates/hotel-desk/tools/start_room_booking.ts +49 -0
  169. package/dist/templates/hotel-desk/tools/take_guest_message.ts +71 -0
  170. package/dist/templates/hotel-desk/tools/transfer_call.ts +47 -0
  171. package/dist/templates/hotel-desk/tools/update_card.ts +45 -0
  172. package/dist/templates/hotel-desk/tools/verify_booking.ts +95 -0
  173. package/dist/templates/infocom-adventure/agent.eval.test.ts +33 -1
  174. package/dist/templates/infocom-adventure/agent.test.ts +207 -52
  175. package/dist/templates/infocom-adventure/agent.ts +14 -3
  176. package/dist/templates/infocom-adventure/client.tsx +138 -176
  177. package/dist/templates/infocom-adventure/shared.ts +126 -6
  178. package/dist/templates/infocom-adventure/system-prompt.md +4 -4
  179. package/dist/templates/infocom-adventure/tools/game_state_drop.ts +20 -4
  180. package/dist/templates/infocom-adventure/tools/game_state_get.ts +6 -5
  181. package/dist/templates/infocom-adventure/tools/game_state_score.ts +9 -3
  182. package/dist/templates/link-digest/agent.eval.test.ts +8 -0
  183. package/dist/templates/link-digest/agent.test.ts +285 -29
  184. package/dist/templates/link-digest/agent.ts +9 -0
  185. package/dist/templates/link-digest/api-client.ts +144 -0
  186. package/dist/templates/link-digest/client.tsx +11 -30
  187. package/dist/templates/link-digest/workflows/digest.ts +72 -24
  188. package/dist/templates/night-owl/agent.eval.test.ts +55 -40
  189. package/dist/templates/night-owl/agent.test.ts +146 -12
  190. package/dist/templates/night-owl/client.tsx +50 -17
  191. package/dist/templates/night-owl/shared.ts +33 -2
  192. package/dist/templates/night-owl/system-prompt.md +3 -0
  193. package/dist/templates/night-owl/tools/recommend.ts +4 -1
  194. package/dist/templates/night-owl/tools/revisit.ts +49 -0
  195. package/dist/templates/pipeline-simple/agent.eval.test.ts +7 -6
  196. package/dist/templates/pipeline-simple/agent.test.ts +48 -91
  197. package/dist/templates/pipeline-simple/modes.test.ts +151 -0
  198. package/dist/templates/pipeline-simple/stages.test.ts +332 -0
  199. package/dist/templates/pizza-ordering/agent.test.ts +94 -38
  200. package/dist/templates/pizza-ordering/client.tsx +10 -5
  201. package/dist/templates/pizza-ordering/shared.ts +65 -6
  202. package/dist/templates/pizza-ordering/tools/add_pizza.ts +2 -7
  203. package/dist/templates/pizza-ordering/tools/place_order.ts +9 -6
  204. package/dist/templates/pizza-ordering/tools/remove_pizza.ts +6 -11
  205. package/dist/templates/pizza-ordering/tools/update_pizza.ts +8 -9
  206. package/dist/templates/pizza-ordering/tools/view_order.ts +2 -3
  207. package/dist/templates/plan-and-execute/agent.eval.test.ts +14 -6
  208. package/dist/templates/plan-and-execute/agent.test.ts +300 -113
  209. package/dist/templates/plan-and-execute/client.tsx +18 -7
  210. package/dist/templates/plan-and-execute/procedure.ts +162 -64
  211. package/dist/templates/plan-and-execute/prompts.ts +51 -15
  212. package/dist/templates/plan-and-execute/shared.ts +151 -45
  213. package/dist/templates/plan-and-execute/tools/plan_status.ts +15 -6
  214. package/dist/templates/plan-and-execute/tools/revise_plan.ts +2 -2
  215. package/dist/templates/plan-and-execute/tools/start_plan.ts +2 -2
  216. package/dist/templates/plan-and-execute/tools/work_next_step.ts +15 -13
  217. package/dist/templates/podcast-digest/agent.eval.test.ts +12 -7
  218. package/dist/templates/podcast-digest/agent.test.ts +126 -51
  219. package/dist/templates/podcast-digest/client.tsx +104 -68
  220. package/dist/templates/podcast-digest/workflows/digest.ts +71 -48
  221. package/dist/templates/podcast-digest/workflows/feeds.ts +5 -7
  222. package/dist/templates/podcast-digest/workflows/slack.ts +82 -17
  223. package/dist/templates/recap-workflow/agent.eval.test.ts +193 -209
  224. package/dist/templates/recap-workflow/agent.test.ts +207 -26
  225. package/dist/templates/recap-workflow/tools/recap_status.ts +2 -2
  226. package/dist/templates/recap-workflow/workflows/recap.ts +39 -28
  227. package/dist/templates/redline/agent.eval.test.ts +40 -3
  228. package/dist/templates/redline/agent.test.ts +216 -6
  229. package/dist/templates/redline/agent.ts +54 -34
  230. package/dist/templates/redline/client.tsx +82 -126
  231. package/dist/templates/redline/form.ts +74 -0
  232. package/dist/templates/redline/workflows/prompts.ts +3 -3
  233. package/dist/templates/redline/workflows/redline.ts +73 -4
  234. package/dist/templates/research-workflow/agent.eval.test.ts +152 -150
  235. package/dist/templates/research-workflow/agent.test.ts +436 -126
  236. package/dist/templates/research-workflow/agent.ts +20 -5
  237. package/dist/templates/research-workflow/tools/file_it_now.ts +11 -1
  238. package/dist/templates/research-workflow/tools/research_status.ts +39 -4
  239. package/dist/templates/research-workflow/workflows/filing.ts +164 -0
  240. package/dist/templates/research-workflow/workflows/notes.ts +69 -0
  241. package/dist/templates/research-workflow/workflows/prompts.ts +45 -31
  242. package/dist/templates/research-workflow/workflows/research.ts +227 -280
  243. package/dist/templates/research-workflow/workflows/review.ts +43 -0
  244. package/dist/templates/retail/address.ts +29 -35
  245. package/dist/templates/retail/agent.eval.test.ts +36 -16
  246. package/dist/templates/retail/agent.test.ts +104 -26
  247. package/dist/templates/retail/agent.ts +12 -0
  248. package/dist/templates/retail/cancel.ts +39 -42
  249. package/dist/templates/retail/client.tsx +111 -176
  250. package/dist/templates/retail/payment.ts +38 -43
  251. package/dist/templates/retail/pending.test.ts +16 -8
  252. package/dist/templates/retail/registry.test.ts +108 -49
  253. package/dist/templates/retail/resolve.test.ts +2 -63
  254. package/dist/templates/retail/resolve.ts +16 -56
  255. package/dist/templates/retail/returns.ts +53 -54
  256. package/dist/templates/retail/seed.test.ts +2 -1
  257. package/dist/templates/retail/shared.ts +58 -14
  258. package/dist/templates/retail/store.test.ts +40 -29
  259. package/dist/templates/retail/store.ts +60 -23
  260. package/dist/templates/retail/swap.ts +78 -81
  261. package/dist/templates/retail/tools/find_user_id_by_name_zip.ts +2 -1
  262. package/dist/templates/roadside-assist/agent.eval.test.ts +164 -0
  263. package/dist/templates/roadside-assist/agent.test.ts +617 -0
  264. package/dist/templates/roadside-assist/agent.ts +85 -0
  265. package/dist/templates/roadside-assist/call.ts +237 -0
  266. package/dist/templates/roadside-assist/events.ts +92 -0
  267. package/dist/templates/roadside-assist/shared.ts +334 -0
  268. package/dist/templates/roadside-assist/system-prompt.md +37 -0
  269. package/dist/templates/roadside-assist/tools/acknowledge_disclosure.ts +47 -0
  270. package/dist/templates/roadside-assist/tools/dispatch_truck.ts +148 -0
  271. package/dist/templates/roadside-assist/tools/job_status.ts +38 -0
  272. package/dist/templates/roadside-assist/tools/lookup_coverage.ts +72 -0
  273. package/dist/templates/roadside-assist/tools/report_location.ts +79 -0
  274. package/dist/templates/roadside-assist/tools/service_disclosure.ts +45 -0
  275. package/dist/templates/roadside-assist/yard.test.ts +158 -0
  276. package/dist/templates/roadside-assist/yard.ts +183 -0
  277. package/dist/templates/simple/agent.eval.test.ts +4 -1
  278. package/dist/templates/simple/agent.test.ts +54 -31
  279. package/dist/templates/solo-rpg/agent.eval.test.ts +19 -11
  280. package/dist/templates/solo-rpg/agent.test.ts +402 -175
  281. package/dist/templates/solo-rpg/agent.ts +14 -3
  282. package/dist/templates/solo-rpg/client.tsx +10 -10
  283. package/dist/templates/solo-rpg/shared.ts +198 -79
  284. package/dist/templates/solo-rpg/tools/action_roll.ts +7 -3
  285. package/dist/templates/solo-rpg/tools/burn_momentum.ts +16 -8
  286. package/dist/templates/solo-rpg/tools/oracle.ts +7 -7
  287. package/dist/templates/solo-rpg/tools/setup_character.ts +5 -5
  288. package/dist/templates/solo-rpg/tools/update_state.ts +29 -18
  289. package/dist/templates/spoken-summary/agent.test.ts +70 -15
  290. package/dist/templates/spoken-summary/agent.ts +25 -21
  291. package/dist/templates/spoken-summary/client.tsx +68 -88
  292. package/dist/templates/spoken-summary/workflows/summarize.ts +26 -8
  293. package/dist/templates/support-line/agent.test.ts +167 -36
  294. package/dist/templates/support-line/client.tsx +21 -9
  295. package/dist/templates/support-line/nodes.ts +74 -32
  296. package/dist/templates/support-line/procedure.ts +66 -21
  297. package/dist/templates/support-line/prompts.ts +9 -0
  298. package/dist/templates/support-line/shared.ts +55 -17
  299. package/dist/templates/support-line/tools/answer_question.ts +14 -14
  300. package/dist/templates/transcription-workflow/agent.test.ts +135 -13
  301. package/dist/templates/transcription-workflow/client.tsx +30 -23
  302. package/dist/templates/transcription-workflow/recover.test.ts +93 -12
  303. package/dist/templates/transcription-workflow/recover.ts +29 -5
  304. package/dist/templates/transcription-workflow/run-panel.tsx +40 -51
  305. package/dist/templates/transcription-workflow/workflows/normalize.ts +125 -24
  306. package/dist/templates/transcription-workflow/workflows/stream.ts +4 -1
  307. package/dist/templates/transcription-workflow/workflows/transcribe.ts +7 -5
  308. package/dist/templates/transcription-workflow/workflows/wav.ts +42 -117
  309. package/dist/templates/travel-concierge/agent.eval.test.ts +6 -4
  310. package/dist/templates/travel-concierge/agent.test.ts +209 -40
  311. package/dist/templates/travel-concierge/agent.ts +24 -4
  312. package/dist/templates/travel-concierge/call-events.ts +80 -0
  313. package/dist/templates/travel-concierge/client.tsx +3 -2
  314. package/dist/templates/travel-concierge/routing.ts +5 -7
  315. package/dist/templates/travel-concierge/shared.ts +202 -41
  316. package/dist/templates/travel-concierge/tools/book_car_rental.ts +2 -4
  317. package/dist/templates/travel-concierge/tools/book_excursion.ts +2 -4
  318. package/dist/templates/travel-concierge/tools/book_hotel.ts +2 -4
  319. package/dist/templates/travel-concierge/tools/cancel_ticket.ts +6 -4
  320. package/dist/templates/travel-concierge/tools/search_car_rentals.ts +3 -5
  321. package/dist/templates/travel-concierge/tools/search_excursions.ts +3 -5
  322. package/dist/templates/travel-concierge/tools/search_flights.ts +20 -9
  323. package/dist/templates/travel-concierge/tools/search_hotels.ts +3 -5
  324. package/dist/templates/travel-concierge/tools/update_ticket.ts +2 -4
  325. package/dist/templates/web-researcher/agent.eval.test.ts +3 -6
  326. package/dist/templates/web-researcher/agent.test.ts +102 -65
  327. package/dist/templates/web-researcher/agent.ts +93 -1
  328. package/dist/templates/web-researcher/system-prompt.md +7 -1
  329. package/dist/templates/word-wrangler/agent.eval.test.ts +157 -0
  330. package/dist/templates/word-wrangler/agent.test.ts +432 -0
  331. package/dist/templates/word-wrangler/agent.ts +35 -0
  332. package/dist/templates/word-wrangler/client.tsx +211 -0
  333. package/dist/templates/word-wrangler/game.ts +107 -0
  334. package/dist/templates/word-wrangler/guess.ts +63 -0
  335. package/dist/templates/word-wrangler/player.ts +68 -0
  336. package/dist/templates/word-wrangler/shared.ts +263 -0
  337. package/dist/templates/word-wrangler/system-prompt.md +15 -0
  338. package/dist/templates/word-wrangler/tools/final_score.ts +37 -0
  339. package/dist/templates/word-wrangler/tools/relay_description.ts +137 -0
  340. package/dist/templates/word-wrangler/tools/repeat_word.ts +19 -0
  341. package/dist/templates/word-wrangler/tools/skip_word.ts +31 -0
  342. package/dist/templates/word-wrangler/tools/start_game.ts +47 -0
  343. package/dist/templates/word-wrangler/words.ts +278 -0
  344. package/dist/test-Cllnx81G.mjs +83 -0
  345. package/dist/test.d.ts +9 -114
  346. package/package.json +5 -5
  347. package/dist/build-BhEaxBPu.mjs +0 -481
  348. package/dist/templates/embedded-assets/agent.eval.test.ts +0 -130
  349. package/dist/templates/embedded-assets/agent.test.ts +0 -79
  350. package/dist/templates/embedded-assets/agent.ts +0 -7
  351. package/dist/templates/embedded-assets/knowledge.json +0 -20
  352. package/dist/templates/embedded-assets/shared.ts +0 -17
  353. package/dist/templates/embedded-assets/system-prompt.md +0 -13
  354. package/dist/templates/embedded-assets/tools/list_topics.ts +0 -9
  355. package/dist/templates/embedded-assets/tools/search_knowledge.ts +0 -26
  356. package/dist/templates/math-buddy/agent.eval.test.ts +0 -128
  357. package/dist/templates/math-buddy/agent.test.ts +0 -126
  358. package/dist/templates/math-buddy/agent.ts +0 -15
  359. package/dist/templates/math-buddy/system-prompt.md +0 -12
  360. package/dist/templates/personal-finance/agent.eval.test.ts +0 -149
  361. package/dist/templates/personal-finance/agent.test.ts +0 -127
  362. package/dist/templates/personal-finance/agent.ts +0 -8
  363. package/dist/templates/personal-finance/system-prompt.md +0 -21
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The SELF-CONTAINED deployment directory — the half two targets share.
3
+ *
4
+ * `deno deploy` uploads a directory and runs one entrypoint in it; `modal
5
+ * deploy` uploads a directory into an image layer and spawns node on one file
6
+ * in it. Neither performs an install, so both emits have the identical job:
7
+ * put beside the bundled entry every file the server opens at RUN time. Each
8
+ * of the three was found by a deployment failing without it, which is the
9
+ * reason this is one module and not a shape each target re-derives —
10
+ * a fourth target must not get to rediscover them.
11
+ *
12
+ * - **`.aai/worker.mjs`**, loaded through `import(pathToFileURL(...))`. Bundling
13
+ * cannot inline it and nothing else would carry it.
14
+ * - **The browser client.** `resolveClientDir` falls back to `defaultClientDir()`,
15
+ * which is `require.resolve("@alexkroman1/aai-ui/package.json")` — a lookup
16
+ * with no `node_modules` to answer it. A bundled deployment died at boot on
17
+ * exactly that until the prebuilt UI was copied in.
18
+ * - **`.env.example`**, which DECLARES which variables become `ctx.env`. Without
19
+ * it every tool sees an empty env while the platform has the values set.
20
+ *
21
+ * **`.env` is deliberately absent**, the same rule the Vercel emit follows:
22
+ * declarations ship, values come from the host (`deno deploy env`, a
23
+ * `modal.Secret`). Copying it would upload a developer's live credentials AND
24
+ * let them outrank what the host was configured with.
25
+ *
26
+ * The nesting is not an accident. `createProjectServer` resolves the worker at
27
+ * `<cwd>/.aai/worker.mjs` and each entry passes its own directory as `cwd`, so
28
+ * the output holds its own `.aai/` — the layout the server already knows,
29
+ * rather than a second one this module would have to teach it.
30
+ */
31
+ /** What a self-contained target declares about its own directory. */
32
+ export interface SelfContainedTarget {
33
+ /** Where the directory goes, relative to the project root. */
34
+ outputDir: string;
35
+ /** The entry's filename inside it — a contract with whatever the host is pointed at. */
36
+ entryFile: string;
37
+ /** The entry source, bundled into {@link SelfContainedTarget.entryFile}. */
38
+ entrySource: string;
39
+ /** The target's name, for the bundler's temp entry and its diagnostics. */
40
+ name: string;
41
+ }
42
+ /** Options for {@link emitSelfContainedOutput}. */
43
+ export interface EmitSelfContainedOptions {
44
+ /**
45
+ * Produce the entry. Defaults to bundling the target's `entrySource`.
46
+ *
47
+ * Injectable because the ASSEMBLY — which file lands where, and which does
48
+ * not — is a question about a DIRECTORY, and answering it should not cost a
49
+ * rolldown pass over the whole runtime. The bundler's own contract needs a
50
+ * real pass and is asserted in the scenario tier.
51
+ */
52
+ bundle?: (cwd: string) => Promise<string>;
53
+ }
54
+ /**
55
+ * Write a target's self-contained directory and answer its absolute path.
56
+ *
57
+ * REMOVED first: the directory is uploaded wholesale, so anything an earlier
58
+ * build left in it would be deployed alongside this one.
59
+ *
60
+ * The path comes back so a target with MORE to write — Modal's `app.py` — adds
61
+ * it here rather than recomputing where "here" is.
62
+ */
63
+ export declare function emitSelfContainedOutput(cwd: string, target: SelfContainedTarget, options?: EmitSelfContainedOptions): Promise<string>;
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { g as writeJson, s as errorMessage$1 } from "./_utils-D5JGcjiW.mjs";
2
+ import { g as writeJson, s as errorMessage$1, u as isEexist } from "./_utils-D5JGcjiW.mjs";
3
3
  import { t as getMonorepoRoot } from "./_agent-BzUeqOdj.mjs";
4
4
  import { existsSync } from "node:fs";
5
5
  import path from "node:path";
@@ -129,6 +129,79 @@ function scaffoldDir() {
129
129
  return path.join(resolveTemplatesDir(), "scaffold");
130
130
  }
131
131
  /**
132
+ * The project-root `CLAUDE.md` a scaffolded project gets — a POINTER at the
133
+ * guide inside the resolved SDK, not a copy of it.
134
+ *
135
+ * `scaffold/CLAUDE.md` is the authoring guide itself: 2,533 lines and 119k
136
+ * characters, sitting against the working cap `claude-md-limit.test.ts`
137
+ * enforces. It has three consumers, and only one wanted the bytes in a project:
138
+ * `sync-agent-guide.mjs` copies it into the `@alexkroman1/aai` tarball as
139
+ * `AGENT_GUIDE.md`, `studio-prompt.ts` embeds it in the studio system prompt,
140
+ * and — until this file — `fs.cp` wrote all 120KB into every `aai init`
141
+ * directory. That third copy is the one that cannot be right:
142
+ *
143
+ * - **It is stale by design.** The SDK's own shipped skill
144
+ * (`packages/aai/skills/aai/SKILL.md`) already says so in as many words:
145
+ * the project copy is "correct on day one, but frozen at scaffold time —
146
+ * `pnpm update @alexkroman1/aai` moves the SDK and leaves it behind. Prefer
147
+ * the file above whenever the two disagree." A file whose own publisher
148
+ * tells agents not to trust it is not carrying its weight.
149
+ * - **An agent pays for it on every session, whether or not it is writing
150
+ * agent code.** Claude Code loads a project-root `CLAUDE.md` in FULL at
151
+ * launch and documents a 200-line target; this was 2,533. Splitting it
152
+ * behind an `@import` would not have helped — imports are expanded at
153
+ * launch too — which is why the pointer below names the path inside a FENCE,
154
+ * the documented spelling for "mention, do not import". It is read on
155
+ * demand, by the agent that needs it, out of the tarball the project
156
+ * actually resolved.
157
+ *
158
+ * Nothing is lost that was not already duplicated: the guide ships in the SDK
159
+ * beside the `.d.ts` files it describes, which is the copy the skill has
160
+ * pointed at all along. What a project gets instead is the one thing the
161
+ * 120KB could not be — version-matched.
162
+ */
163
+ const PROJECT_GUIDE_POINTER = `# Agent instructions
164
+
165
+ This is an [aai](${REPO_URL}) voice-agent project. An agent is a directory
166
+ containing \`agent.ts\`; the \`aai\` CLI bundles it and deploys it.
167
+
168
+ ## Read the SDK guide before writing agent code
169
+
170
+ The complete authoring guide ships inside the installed package:
171
+
172
+ \`\`\`text
173
+ node_modules/@alexkroman1/aai/AGENT_GUIDE.md
174
+ \`\`\`
175
+
176
+ Read it with your file tools. It is version-matched by construction — it lives
177
+ in the same tarball as the \`@alexkroman1/aai\` this project resolved, so it
178
+ cannot describe a different release than the one being imported. Prefer it over
179
+ anything remembered about the SDK, and over anything in this file.
180
+
181
+ The types are the second source of truth: the shipped declarations are in
182
+ \`node_modules/@alexkroman1/aai/dist/\`. When the guide and the types disagree,
183
+ the types are what the compiler enforces.
184
+
185
+ ## Commands
186
+
187
+ \`\`\`sh
188
+ npm run dev # Run locally on http://localhost:3000
189
+ npm test # This project's suite, minus the evals (vitest)
190
+ npm run test:agent # Just agent.test.ts, via the CLI
191
+ npm run eval # Drive a real session against a live model (spends money)
192
+ npm run build # Bundle the agent
193
+ npm start # Build, then self-host on http://127.0.0.1:3000
194
+ npm run publish:agent # Publish to the managed platform
195
+ \`\`\`
196
+
197
+ The \`aai\` CLI is a devDependency, so it is in \`node_modules/.bin\` rather than
198
+ on \`PATH\`: reach it through these scripts or with \`npx aai <command>\`.
199
+
200
+ ## Project-specific notes
201
+
202
+ <!-- Add conventions, gotchas and decisions for THIS agent below. -->
203
+ `;
204
+ /**
132
205
  * Layer the base scaffold (package.json, tsconfig, …) into targetDir
133
206
  * WITHOUT overwriting anything already there. Shared by `aai init`
134
207
  * (underneath a template) and `aai pull` (underneath the studio workspace
@@ -137,7 +210,9 @@ function scaffoldDir() {
137
210
  * before an in-sandbox build).
138
211
  *
139
212
  * package.json is the one file merged rather than skipped — see
140
- * {@link layerScaffoldManifest}.
213
+ * {@link layerScaffoldManifest}. `CLAUDE.md` is the one file SUBSTITUTED: the
214
+ * scaffold's copy is the authoring guide, and a project gets
215
+ * {@link PROJECT_GUIDE_POINTER} instead.
141
216
  */
142
217
  async function layerScaffold(targetDir) {
143
218
  const dir = scaffoldDir();
@@ -146,9 +221,24 @@ async function layerScaffold(targetDir) {
146
221
  recursive: true,
147
222
  force: false,
148
223
  errorOnExist: false,
149
- filter: templateCopyFilter
224
+ filter: (src) => scaffoldCopyFilter(src, dir)
150
225
  });
151
- await layerScaffoldManifest(dir, targetDir);
226
+ await Promise.all([layerScaffoldManifest(dir, targetDir), fs.writeFile(path.join(targetDir, "CLAUDE.md"), PROJECT_GUIDE_POINTER, { flag: "wx" }).catch((err) => {
227
+ if (!isEexist(err)) throw err;
228
+ })]);
229
+ }
230
+ /**
231
+ * `templateCopyFilter` plus the scaffold's own `CLAUDE.md`, which is the
232
+ * authoring guide rather than a file a project wants — see
233
+ * {@link PROJECT_GUIDE_POINTER}.
234
+ *
235
+ * Only the scaffold copy filters it. A TEMPLATE's `CLAUDE.md` would be that
236
+ * template's own notes and belongs in the project it seeds, so
237
+ * {@link downloadAndMergeTemplate} keeps using the unfiltered version. Matched
238
+ * on the full path rather than the basename for the same reason.
239
+ */
240
+ function scaffoldCopyFilter(src, scaffold = scaffoldDir()) {
241
+ return templateCopyFilter(src) && path.resolve(src) !== path.join(scaffold, "CLAUDE.md");
152
242
  }
153
243
  /**
154
244
  * `fs.cp` filter for every copy OUT of a template or the scaffold — the runtime
@@ -53,9 +53,22 @@ export declare function scaffoldDir(): string;
53
53
  * before an in-sandbox build).
54
54
  *
55
55
  * package.json is the one file merged rather than skipped — see
56
- * {@link layerScaffoldManifest}.
56
+ * {@link layerScaffoldManifest}. `CLAUDE.md` is the one file SUBSTITUTED: the
57
+ * scaffold's copy is the authoring guide, and a project gets
58
+ * {@link PROJECT_GUIDE_POINTER} instead.
57
59
  */
58
60
  export declare function layerScaffold(targetDir: string): Promise<void>;
61
+ /**
62
+ * `templateCopyFilter` plus the scaffold's own `CLAUDE.md`, which is the
63
+ * authoring guide rather than a file a project wants — see
64
+ * {@link PROJECT_GUIDE_POINTER}.
65
+ *
66
+ * Only the scaffold copy filters it. A TEMPLATE's `CLAUDE.md` would be that
67
+ * template's own notes and belongs in the project it seeds, so
68
+ * {@link downloadAndMergeTemplate} keeps using the unfiltered version. Matched
69
+ * on the full path rather than the basename for the same reason.
70
+ */
71
+ export declare function scaffoldCopyFilter(src: string, scaffold?: string): boolean;
59
72
  /**
60
73
  * `fs.cp` filter for every copy OUT of a template or the scaffold — the runtime
61
74
  * ones here and the build-time one in `bundle-templates.mjs`.
@@ -3,7 +3,7 @@
3
3
  * `aai build` just produced.
4
4
  *
5
5
  * The argument for the Build Output API over an `api/` entry is in
6
- * `_build-target.ts` at {@link VERCEL_OUTPUT_DIR}; what this module adds is the
6
+ * `_vercel-target.ts` at {@link VERCEL_OUTPUT_DIR}; what this module adds is the
7
7
  * consequence of it. A `.func` directory is a directory WE fill, so every file
8
8
  * the server reads at runtime is present because it was copied in, and nothing
9
9
  * depends on a static tracer following a path it structurally cannot:
@@ -21,17 +21,13 @@
21
21
  * beside the worker, so `resolveClientDir` finds a real directory rather
22
22
  * than reaching into a `node_modules` that the bundle replaced.
23
23
  *
24
- * The entry is BUNDLED rather than shipped with a `node_modules`. Same call as
25
- * the worker (`ssr: { noExternal: true }`, `root: cwd`), so it resolves the
26
- * project's own installed SDK and pulls the runtime, `ws` and `pg` in with it
27
- * — which is already the arrangement a deployed worker runs under, and it is
28
- * what makes the function independent of whether the host's install left a
29
- * usable, hoisted `node_modules` behind.
24
+ * The entry is BUNDLED rather than shipped with a `node_modules` — see
25
+ * `_target-bundle.ts`, which every target that emits an entry shares.
30
26
  */
31
27
  /** Options for {@link emitVercelOutput}. */
32
28
  export interface EmitVercelOutputOptions {
33
29
  /**
34
- * Produce the function's `index.mjs`. Defaults to {@link bundleEntry}.
30
+ * Produce the function's `index.mjs`. Defaults to bundling {@link VERCEL_ENTRY_SOURCE}.
35
31
  *
36
32
  * Injectable so the ASSEMBLY — which file lands where, and which does not —
37
33
  * can be asserted without a ~15s rolldown pass over the whole runtime. The
@@ -50,14 +46,3 @@ export interface EmitVercelOutputOptions {
50
46
  * uploads whatever is there.
51
47
  */
52
48
  export declare function emitVercelOutput(cwd: string, options?: EmitVercelOutputOptions): Promise<void>;
53
- /**
54
- * Bundle {@link VERCEL_ENTRY_SOURCE} and everything it imports into one ESM
55
- * file.
56
- *
57
- * The entry is written INTO the project rather than a temp directory, because
58
- * that is what makes `@alexkroman1/aai-cli/start` resolve against the user's
59
- * install — the deployed server is then the version their lockfile pins, which
60
- * is the same guarantee `aai publish` gives. Removed in a `finally`: a build
61
- * that throws must not leave a file that looks authored.
62
- */
63
- export declare function bundleEntry(cwd: string): Promise<string>;
@@ -0,0 +1,169 @@
1
+ /**
2
+ * The **Vercel** target — a PREBUILT deployment under `.vercel/output/`.
3
+ *
4
+ * Its own module for the reason Nitro keeps a directory per preset: a host's
5
+ * expected shape is one self-contained body of knowledge (a routing table, a
6
+ * function config, an entry in whatever shape its launcher invokes), and the
7
+ * only thing the others need from it is where its output lands. `TARGET_OUTPUTS`
8
+ * in `_build-target.ts` is that seam; `_vercel-output.ts` does the assembling.
9
+ *
10
+ * Vercel is also the one target here that is SERVERLESS. Everything in
11
+ * `_deno-target.ts` and `_modal-target.ts` is a long-lived process that binds a
12
+ * port and drains on a signal; nothing in this file binds anything, and the
13
+ * differences below all follow from that.
14
+ */
15
+ /**
16
+ * Where a PREBUILT Vercel deployment lives, relative to the project root.
17
+ *
18
+ * The Build Output API rather than an `api/` entry plus a `vercel.json`, and
19
+ * the reason is ORDERING. Vercel reads `vercel.json` and decides what to build
20
+ * BEFORE it runs the build command, so a `vercel.json` that the build WRITES
21
+ * configures the NEXT deployment and not this one — a clean clone deploys with
22
+ * no rewrite and no function at all. The `api/` shape only ever appeared to
23
+ * work because a previous local `aai build --target vercel` had left both
24
+ * files in the working tree, which is a property of one laptop rather than of
25
+ * the repository. `.vercel/output/` is read AFTER the build command; it is the
26
+ * only place a build can describe its own deployment.
27
+ *
28
+ * Two more things fall out of owning the directory, both of which the `api/`
29
+ * shape got wrong and could not fix. The function bundle is ASSEMBLED here
30
+ * rather than traced, so `.aai/worker.mjs` — loaded through a dynamic
31
+ * `import(pathToFileURL(...))` that no static tracer can follow — and
32
+ * `.env.example` — the file that DECLARES which variables become `ctx.env` —
33
+ * are present because they were copied in. And the built client is served by
34
+ * the CDN out of `static/` instead of through the function.
35
+ *
36
+ * Nitro's vercel preset is the worked precedent and lands in exactly here:
37
+ * `output.dir = {{rootDir}}/.vercel/output`, `serverDir` a `.func` under it.
38
+ *
39
+ * @see https://vercel.com/docs/build-output-api/v3
40
+ */
41
+ export declare const VERCEL_OUTPUT_DIR: string;
42
+ /**
43
+ * The one function every request that is not a static file reaches.
44
+ *
45
+ * The Build Output API derives a function's ROUTE from its path, so the
46
+ * directory name IS a URL and must not collide with one the static output
47
+ * claims. **`index.func` collides**, which a deployment is the only way to
48
+ * find out: it is served at `/index`, and Vercel's directory index resolves
49
+ * `/` to the extensionless `/index` — so the function won `/`, every other
50
+ * asset came off the CDN correctly, and the home page 500'd on a deployment
51
+ * whose static output was perfect. Measured on a real preview:
52
+ * `/favicon.ico`, `/index.html` and both hashed `/assets/*` returned 200
53
+ * while `/` and `/index` did not.
54
+ *
55
+ * `__server` is Nitro's answer to the same problem (`__server.func`) and the
56
+ * reason is this one: a double-underscore prefix is not a path any bundler
57
+ * emits, so no static file can ever take the name.
58
+ */
59
+ export declare const VERCEL_FUNCTION_DIR: string;
60
+ /**
61
+ * The route {@link VERCEL_FUNCTION_DIR} is served at — its directory name
62
+ * without `.func`, which is how the Build Output API names a function.
63
+ */
64
+ export declare const VERCEL_FUNCTION_ROUTE = "/__server";
65
+ /** Static assets the Vercel CDN serves directly, never reaching the function. */
66
+ export declare const VERCEL_STATIC_DIR: string;
67
+ /**
68
+ * `nodejs<major>.x` for the Node running this build, resolved to what Vercel
69
+ * offers — the SMALLEST offered major that is at least this one, and the
70
+ * newest offered when the build is newer than all of them.
71
+ *
72
+ * **Rounding UP is the load-bearing half**, and it used to round down. The
73
+ * bundle in the function was produced by, and resolved its dependencies for,
74
+ * the Node running the build; placing it on an OLDER major is how a
75
+ * `node:`-builtin API that shipped in 23 becomes a runtime `TypeError` in a
76
+ * deployed function that built clean. A build on Node 23 named `nodejs22.x`
77
+ * for exactly that reason. Rounding up cannot produce that failure — Node
78
+ * majors do not remove APIs on the schedule they add them — so the direction
79
+ * that can only be wrong cosmetically is the one to take. It is also what
80
+ * Nitro's `resolveVercelRuntime` does (`find(v => v >= systemNodeVersion)`)
81
+ * over this same list.
82
+ *
83
+ * Above the list there is nothing to round up TO, so a build on Node 26 is
84
+ * clamped to the newest Vercel offers rather than naming a runtime the
85
+ * deployment would be rejected for.
86
+ */
87
+ export declare function vercelNodeRuntime(version?: string): string;
88
+ /**
89
+ * The Vercel function entry, emitted into {@link VERCEL_FUNCTION_DIR}.
90
+ *
91
+ * ## Why a `(req, res)` handler and not `export default server`
92
+ *
93
+ * `export default <http.Server>` is what Vercel's own `@vercel/node` BUILDER
94
+ * accepts, and it is the shape the previous `api/index.mjs` used. The Build
95
+ * Output API has no builder in the path: `launcherType: "Nodejs"` invokes the
96
+ * module's default export as a request handler, so the server never gets
97
+ * bound and there is nothing to raise an `upgrade` event on it.
98
+ *
99
+ * ## How a WebSocket survives that
100
+ *
101
+ * Vercel hands a Node function the raw upgrade through its PER-REQUEST
102
+ * context — `globalThis[Symbol.for("@vercel/request-context")].get()
103
+ * .upgradeWebSocket()` returns the `{ req, socket, head }` triple — rather
104
+ * than as an event. Nitro reaches it through `crossws/adapters/vercel`; here
105
+ * the adapter is three lines, because {@link AgentServer.node} is a real
106
+ * `http.Server` that already has both an `upgrade` and a `request` listener
107
+ * registered. Re-emitting onto it is the whole translation, and it means the
108
+ * deployed path through `server.ts` is the same one `aai dev` and `aai start`
109
+ * take — no second WebSocket entry point to keep in step.
110
+ *
111
+ * The `204` afterwards is what the launcher needs to consider the invocation
112
+ * finished; the socket the agent is now talking on is not this `res`.
113
+ *
114
+ * ## `import.meta.dirname`, not `process.cwd()`
115
+ *
116
+ * The function's working directory belongs to the platform, but `.aai/` and
117
+ * `.env.example` were copied in BESIDE this file. Resolving from the module
118
+ * keeps that a fact about the bundle rather than about how Vercel happens to
119
+ * invoke it.
120
+ */
121
+ export declare const VERCEL_ENTRY_SOURCE = "// Generated by `aai build --target vercel` \u2014 do not edit, and do not commit.\n// Vercel invokes this handler per request and delivers a WebSocket upgrade\n// through its request context. See @alexkroman1/aai-cli/start.\nimport { createProjectServer } from \"@alexkroman1/aai-cli/start\";\n\nconst server = (await createProjectServer({ cwd: import.meta.dirname })).node;\n\nconst REQUEST_CONTEXT = Symbol.for(\"@vercel/request-context\");\n\nexport default function handler(req, res) {\n if (req.method === \"GET\" && req.headers.upgrade?.toLowerCase() === \"websocket\") {\n const upgrade = globalThis[REQUEST_CONTEXT]?.get?.()?.upgradeWebSocket?.();\n if (upgrade) {\n server.emit(\"upgrade\", upgrade.req, upgrade.socket, upgrade.head);\n if (!res.headersSent && !res.writableEnded) {\n res.statusCode = 204;\n res.end();\n }\n return;\n }\n }\n server.emit(\"request\", req, res);\n}\n";
122
+ /**
123
+ * `.vc-config.json` — how the platform runs {@link VERCEL_ENTRY_SOURCE}.
124
+ *
125
+ * `supportsResponseStreaming` is not optional here: an agent streams TTS audio
126
+ * and SSE workflow events, and without it the platform buffers a response to
127
+ * completion, which for a stream that ends when the call does means it never
128
+ * arrives. `shouldAddHelpers` stays off — the entry speaks `node:http`, and
129
+ * the helpers exist to bolt Express-shaped sugar onto a handler that does not.
130
+ */
131
+ export declare function vercelFunctionConfigSource(runtime?: string): string;
132
+ /**
133
+ * `config.json` — the routing table, and the reason static assets stop paying
134
+ * for a function invocation.
135
+ *
136
+ * `{ "handle": "filesystem" }` serves anything present in
137
+ * {@link VERCEL_STATIC_DIR} from the CDN and only then falls through, so the
138
+ * client bundle, its assets and the worklets are edge-served while
139
+ * `/client-config`, `/websocket`, `/workflows/*` and the webhook route reach
140
+ * the agent. The `api/` shape routed EVERY request through the function, which
141
+ * this file's earlier revision noted as deliberate and "not what makes a
142
+ * deployment work or not" — true of correctness, false of cost, and free here
143
+ * because the Build Output API already separates the two directories.
144
+ *
145
+ * ## The two rules AROUND `filesystem`, and why a filesystem hit is not enough
146
+ *
147
+ * Both come from Nitro's `getPublicAssetRoutes`, which brackets its own
148
+ * `handle: filesystem` the same way, and both are about
149
+ * {@link CLIENT_ASSETS_DIR} rather than about static files in general.
150
+ *
151
+ * **Before** it, a `cache-control` rule with `continue: true`. Serving a
152
+ * content-hashed bundle from the CDN with no explicit freshness leaves it on
153
+ * Vercel's default, so every client re-validates every asset on every load —
154
+ * a round trip per file for bytes that CANNOT change, since a change produces
155
+ * a different filename. `continue: true` is what keeps this a header rule and
156
+ * not a terminal one: the request goes on to `filesystem` and is served there.
157
+ *
158
+ * **After** it, a terminal `404` for the same prefix. A miss under a hashed
159
+ * name is a stale `index.html` asking for a bundle this deployment does not
160
+ * have, and there is no version of that request the agent can answer — so
161
+ * falling through to the function buys an invocation to produce the 404 the
162
+ * CDN could have. Nitro's reason is the sharper one and applies here too: the
163
+ * immutable header above is already attached, and letting a DYNAMIC response
164
+ * inherit it would cache a 404 for a year. `no-store` is what takes it back.
165
+ *
166
+ * Everything outside {@link CLIENT_ASSETS_DIR} still falls through, which is
167
+ * what keeps `/`, `/favicon.ico` and every agent route working.
168
+ */
169
+ export declare const VERCEL_BUILD_CONFIG_SOURCE: string;
@@ -1,15 +1,35 @@
1
1
  #!/usr/bin/env node
2
- import { a as ok, n as fail } from "./_output-DBP9Op_d.mjs";
3
- import { n as log, r as notify } from "./_ui-DCt4qZrk.mjs";
2
+ import { r as notify } from "./_ui-DCt4qZrk.mjs";
4
3
  import { a as errorCode, i as compareCodeUnits, l as formatCappedList, r as binFromPackageJson, s as errorMessage$1 } from "./_utils-D5JGcjiW.mjs";
5
4
  import { createRequire } from "node:module";
6
5
  import { existsSync, readdirSync } from "node:fs";
7
6
  import path from "node:path";
8
7
  import { omitUndefined } from "@alexkroman1/aai/utils";
9
8
  import { execaSync } from "execa";
10
- //#region src/test.ts
9
+ //#region src/_vitest-runner.ts
11
10
  /**
12
- * `aai test` — run agent tests via vitest.
11
+ * Running vitest over an agent project's specs — the launcher three commands
12
+ * share.
13
+ *
14
+ * `aai test`, `aai eval` and `aai build`'s pre-build gate all spawn the
15
+ * project's own vitest, and all three used to import it from `test.ts`. Nothing
16
+ * about the code was wrong; what the import SAID was, because `aai eval` took
17
+ * its runner from the file named after the other command. Those two are
18
+ * deliberately disjoint — a positional argument to `vitest run` is a substring
19
+ * FILTER rather than an include glob, so `agent.test.ts` cannot match
20
+ * `agent.eval.test.ts` and neither command has to know the other's filenames
21
+ * (see {@link runVitest}) — and an import edge between them is the one thing
22
+ * that could quietly grow the coupling that design exists to prevent.
23
+ *
24
+ * What lives here is everything that follows from POINTING VITEST AT A SUBSET:
25
+ * how the binary is resolved, which files a run covers, which ones it therefore
26
+ * does NOT, and the notice a caller owes when it narrowed without saying so.
27
+ * The tiers' own filenames stay with the commands that own them — `TEST_FILES`
28
+ * in `test.ts`, `EVAL_FILES` in `eval.ts` — so this module has no opinion about
29
+ * which tier is running, which is why {@link VitestRunOptions.candidates} has
30
+ * no default.
31
+ *
32
+ * @module
13
33
  */
14
34
  /**
15
35
  * Resolve the agent project's own vitest binary so tests run without the
@@ -32,8 +52,6 @@ function resolveVitestCommand(cwd, resolve = createRequire(path.join(cwd, "packa
32
52
  args: ["vitest"]
33
53
  };
34
54
  }
35
- /** The files `aai test` runs, in preference order. */
36
- const TEST_FILES = ["agent.test.ts", "agent.test.js"];
37
55
  /**
38
56
  * Run vitest over `candidates` (or, with `all`, the whole project) in the given
39
57
  * project directory.
@@ -49,7 +67,7 @@ const TEST_FILES = ["agent.test.ts", "agent.test.js"];
49
67
  * `all` list too: it is built from {@link projectSpecFiles}, which drops the
50
68
  * eval tier by infix.
51
69
  */
52
- function runVitest(cwd, opts = { candidates: TEST_FILES }) {
70
+ function runVitest(cwd, opts) {
53
71
  const files = resolveRunFiles(cwd, opts);
54
72
  if (files.length === 0) return false;
55
73
  const { cmd, args } = resolveVitestCommand(cwd);
@@ -128,8 +146,8 @@ function projectSpecFiles(cwd) {
128
146
  * contract (the scaffold guide says "Run agent.test.ts via vitest"), and running
129
147
  * a project's other specs by default could reach ones that are slow or want
130
148
  * credentials. What does not stand is a GREEN VERDICT over the difference: this
131
- * set is what {@link executeTest} refuses to call a pass, what it puts in its
132
- * result for a script to read, and what `--all` opts into running.
149
+ * set is what `executeTest` refuses to call a pass, what it puts in its result
150
+ * for a script to read, and what `--all` opts into running.
133
151
  */
134
152
  function unrunSpecFiles(cwd, ran) {
135
153
  const covered = new Set(coveredList(ran));
@@ -180,63 +198,5 @@ function warnUnrunSpecs(cwd, ran) {
180
198
  const preamble = ranList.length === 0 ? `No agent.test.ts, so vitest ran nothing. ${skipped.length} spec file(s) exist and were NOT run:` : `vitest ran ${ranList.join(", ")} only. ${skipped.length} other spec file(s) were NOT run:`;
181
199
  notify("warn", `${preamble} ${formatCappedList(skipped)}. ${WIDEN_HINT}`);
182
200
  }
183
- /**
184
- * Execute agent tests and return structured result.
185
- *
186
- * **An incomplete run is not a pass.** For as long as this command answered
187
- * `{"ok":true,"data":{"passed":true}}` with exit 0 over specs it had not run,
188
- * the scaffold's `"test": "aai test"` was what users wired into CI — so a suite
189
- * of 25 tests could go red in the editor and green in the pipeline, and adding
190
- * one tool could break `registry.test.ts` in 17 assertions with `pnpm test` and
191
- * `pnpm build` both staying green throughout. It is the same defect
192
- * `defineExec`'s `cwd` policy exists for (a green result for a project that is
193
- * not there), one directory over, and it gets the same answer: the command
194
- * fails, names the files, and names the flag that runs them.
195
- */
196
- async function executeTest(cwd, opts = {}) {
197
- log.step(opts.all ? "Running project tests" : "Running agent tests");
198
- try {
199
- const ran = runVitest(cwd, {
200
- candidates: TEST_FILES,
201
- announceUnrun: false,
202
- ...omitUndefined({ all: opts.all })
203
- });
204
- const unrun = unrunSpecFiles(cwd, ran);
205
- if (unrun.length > 0) return incomplete(ran, unrun);
206
- if (ran === false) {
207
- log.info("No test file found. Create agent.test.ts to add tests.");
208
- return ok({
209
- passed: true,
210
- skipped: true,
211
- ran: [],
212
- unrun: [],
213
- complete: true
214
- });
215
- }
216
- log.success(`Tests passed (${ran.length} spec file(s))`);
217
- return ok({
218
- passed: true,
219
- ran,
220
- unrun: [],
221
- complete: true
222
- });
223
- } catch (err) {
224
- const { code, message } = classifyVitestError(err);
225
- return fail(code, message);
226
- }
227
- }
228
- /**
229
- * The verdict for a run that left specs uncovered.
230
- *
231
- * Both arms fail, and the `ran === false` arm is the one that had misled
232
- * longest: `aai test` printed "No test file found" while the project's specs sat
233
- * right there unrun, which reads as "this project has no tests". Measured on a
234
- * project whose only spec was `tools/echo_back.test.ts` — `{"passed":true,
235
- * "skipped":true}`, exit 0, and not a word about it.
236
- */
237
- function incomplete(ran, unrun) {
238
- const preamble = ran === false ? `\`aai test\` found no agent.test.ts, so it ran nothing, but ${unrun.length} spec file(s) exist` : `\`aai test\` ran ${ran.join(", ")} only — ${unrun.length} other spec file(s) in this project were not run`;
239
- return fail("incomplete_run", `${preamble}: ${formatCappedList(unrun)}. An unrun spec is not a passing one, so this is not a green result.`, WIDEN_HINT);
240
- }
241
201
  //#endregion
242
- export { TEST_FILES, classifyVitestError, executeTest, runVitest };
202
+ export { unrunSpecFiles as i, classifyVitestError as n, runVitest as r, WIDEN_HINT as t };