@alexkroman1/aai-cli 16.0.1 → 17.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (454) hide show
  1. package/README.md +3 -2
  2. package/dist/{_build-target-55dJisQ-.mjs → _build-target-C08aM-Es.mjs} +511 -41
  3. package/dist/_build-target.d.ts +109 -2
  4. package/dist/_deno-target.d.ts +15 -14
  5. package/dist/_dev-env.d.ts +19 -13
  6. package/dist/{_dev-server-BzWB6-4y.mjs → _dev-server-CLU9xjH5.mjs} +27 -19
  7. package/dist/_dev-server.d.ts +4 -3
  8. package/dist/_dev-vite-config.d.ts +1 -1
  9. package/dist/_init.d.ts +39 -0
  10. package/dist/_modal-target.d.ts +11 -6
  11. package/dist/_preflight-CnW9QiE7.mjs +116 -0
  12. package/dist/_preflight.d.ts +110 -5
  13. package/dist/{_server-common-De0haHr9.mjs → _server-common-DAcv1nC5.mjs} +46 -2
  14. package/dist/_server-common.d.ts +39 -0
  15. package/dist/_target-bundle.d.ts +112 -0
  16. package/dist/_target-entry.d.ts +81 -0
  17. package/dist/{_templates-CuP74F8D.mjs → _templates-IMeKMVIj.mjs} +1 -1
  18. package/dist/{_vitest-runner-AVR9VtXh.mjs → _vitest-runner-CZNGj0ZC.mjs} +22 -17
  19. package/dist/_vitest-runner.d.ts +36 -24
  20. package/dist/{_workflow-determinism-CvpqMpdh.mjs → _workflow-determinism-CLxFQ5ox.mjs} +1 -1
  21. package/dist/_workflow-determinism.d.ts +1 -1
  22. package/dist/{build-ButI2IKc.mjs → build-DrQTSc2R.mjs} +187 -289
  23. package/dist/build.d.ts +88 -2
  24. package/dist/cli.mjs +20 -16
  25. package/dist/{deploy-CGqPU5U-.mjs → deploy-B68-x7xM.mjs} +14 -6
  26. package/dist/deploy.d.ts +9 -0
  27. package/dist/{dev-kodAY23K.mjs → dev-ChsrNHpK.mjs} +1 -1
  28. package/dist/dev.d.ts +1 -1
  29. package/dist/{eval-DvoSz7SZ.mjs → eval-DB07kTxO.mjs} +2 -2
  30. package/dist/init-W-4k-lCF.mjs +559 -0
  31. package/dist/init.d.ts +43 -3
  32. package/dist/scaffold/CLAUDE.md +87 -100
  33. package/dist/scaffold/package.json +6 -6
  34. package/dist/scaffold/vite.config.ts +29 -1
  35. package/dist/start.mjs +1 -1
  36. package/dist/{studio-CtRBVVFR.mjs → studio-DEAJGBXa.mjs} +20 -10
  37. package/dist/templates/{hiring-desk → applicant-screening-agent}/agent.eval.test.ts +20 -6
  38. package/dist/templates/{hiring-desk → applicant-screening-agent}/agent.ts +28 -0
  39. package/dist/templates/{hiring-desk → applicant-screening-agent}/crews.ts +1 -1
  40. package/dist/templates/{hiring-desk → applicant-screening-agent}/shared.ts +11 -11
  41. package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/screening_status.ts +1 -1
  42. package/dist/templates/{call-audit → call-audit-workflow}/agent.ts +4 -2
  43. package/dist/templates/{call-audit → call-audit-workflow}/client.tsx +3 -3
  44. package/dist/templates/{call-audit → call-audit-workflow}/guards.test.ts +2 -2
  45. package/dist/templates/{call-audit → call-audit-workflow}/workflows/summarize.ts +1 -1
  46. package/dist/templates/{code-interpreter → code-interpreter-agent}/agent.eval.test.ts +3 -2
  47. package/dist/templates/{code-interpreter → code-interpreter-agent}/agent.test.ts +1 -1
  48. package/dist/templates/{code-interpreter → code-interpreter-agent}/agent.ts +1 -0
  49. package/dist/templates/coding-agent/agent.eval.test.ts +136 -0
  50. package/dist/templates/coding-agent/agent.test.ts +109 -0
  51. package/dist/templates/coding-agent/agent.ts +45 -0
  52. package/dist/templates/coding-agent/chat.ts +63 -0
  53. package/dist/templates/coding-agent/shared.ts +46 -0
  54. package/dist/templates/coding-agent/system-prompt.md +32 -0
  55. package/dist/templates/coding-agent/tools/bash.ts +6 -0
  56. package/dist/templates/coding-agent/tools/delete_file.ts +6 -0
  57. package/dist/templates/coding-agent/tools/edit_file.ts +6 -0
  58. package/dist/templates/coding-agent/tools/glob.ts +6 -0
  59. package/dist/templates/coding-agent/tools/grep.ts +6 -0
  60. package/dist/templates/coding-agent/tools/list_files.ts +6 -0
  61. package/dist/templates/coding-agent/tools/read_file.ts +6 -0
  62. package/dist/templates/coding-agent/tools/todo_write.ts +6 -0
  63. package/dist/templates/coding-agent/tools/write_file.ts +6 -0
  64. package/dist/templates/{pipeline-simple → custom-pipeline-agent}/agent.test.ts +2 -2
  65. package/dist/templates/{pipeline-simple → custom-pipeline-agent}/agent.ts +2 -1
  66. package/dist/templates/{pipeline-simple → custom-pipeline-agent}/modes.test.ts +1 -1
  67. package/dist/templates/{redline → document-redline-workflow}/agent.ts +4 -2
  68. package/dist/templates/{redline → document-redline-workflow}/client.tsx +1 -1
  69. package/dist/templates/{redline → document-redline-workflow}/workflows/redline.ts +1 -1
  70. package/dist/templates/{dispatch-center → emergency-dispatch-agent}/agent.test.ts +104 -1
  71. package/dist/templates/{dispatch-center → emergency-dispatch-agent}/agent.ts +15 -0
  72. package/dist/templates/{dispatch-center → emergency-dispatch-agent}/events.ts +1 -1
  73. package/dist/templates/emergency-dispatch-agent/guardrails.ts +105 -0
  74. package/dist/templates/{dispatch-center → emergency-dispatch-agent}/system-prompt.md +1 -0
  75. package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_create.ts +1 -1
  76. package/dist/templates/{night-owl → entertainment-picks-agent}/agent.eval.test.ts +8 -1
  77. package/dist/templates/{night-owl → entertainment-picks-agent}/agent.test.ts +1 -1
  78. package/dist/templates/{night-owl → entertainment-picks-agent}/agent.ts +1 -0
  79. package/dist/templates/{night-owl → entertainment-picks-agent}/client.tsx +1 -1
  80. package/dist/templates/{night-owl → entertainment-picks-agent}/system-prompt.md +6 -0
  81. package/dist/templates/{night-owl → entertainment-picks-agent}/tools/revisit.ts +7 -0
  82. package/dist/templates/{executive-assistant → executive-inbox-agent}/agent.eval.test.ts +84 -23
  83. package/dist/templates/{executive-assistant → executive-inbox-agent}/agent.ts +1 -0
  84. package/dist/templates/{executive-assistant → executive-inbox-agent}/meeting.ts +2 -2
  85. package/dist/templates/{executive-assistant → executive-inbox-agent}/prompts.ts +3 -1
  86. package/dist/templates/{executive-assistant → executive-inbox-agent}/shared.ts +2 -2
  87. package/dist/templates/{executive-assistant → executive-inbox-agent}/system-prompt.md +3 -3
  88. package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/meeting_assistant.ts +3 -3
  89. package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/open_email.ts +8 -16
  90. package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/send_calendar_invite.ts +1 -1
  91. package/dist/templates/{hotel-desk → hotel-reception-agent}/agent.eval.test.ts +85 -21
  92. package/dist/templates/{hotel-desk → hotel-reception-agent}/agent.test.ts +2 -1
  93. package/dist/templates/{hotel-desk → hotel-reception-agent}/agent.ts +6 -3
  94. package/dist/templates/{hotel-desk → hotel-reception-agent}/client.tsx +14 -2
  95. package/dist/templates/{hotel-desk → hotel-reception-agent}/concierge.ts +3 -2
  96. package/dist/templates/{hotel-desk → hotel-reception-agent}/desk-seams.test.ts +2 -1
  97. package/dist/templates/{hotel-desk → hotel-reception-agent}/disputes.ts +9 -11
  98. package/dist/templates/{hotel-desk → hotel-reception-agent}/events.ts +2 -1
  99. package/dist/templates/hotel-reception-agent/session.ts +56 -0
  100. package/dist/templates/{hotel-desk → hotel-reception-agent}/shared.ts +21 -22
  101. package/dist/templates/{hotel-desk → hotel-reception-agent}/system-prompt.md +1 -1
  102. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/abandon_booking.ts +2 -1
  103. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/add_to_waitlist.ts +2 -1
  104. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/book_airport_car.ts +2 -1
  105. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/cancel_restaurant_reservation.ts +2 -1
  106. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/cancel_room_booking.ts +2 -1
  107. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/check_restaurant_availability.ts +1 -1
  108. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/check_room_availability.ts +1 -1
  109. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/choose_room.ts +1 -1
  110. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/confirm_booking.ts +2 -1
  111. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/dispatch_emergency.ts +2 -1
  112. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/dispute_charge.ts +2 -1
  113. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/flag_late_arrival.ts +2 -1
  114. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_booking.ts +2 -1
  115. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_guest_history.ts +1 -1
  116. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_invoice.ts +2 -1
  117. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_restaurant_reservation.ts +1 -1
  118. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/modify_restaurant_reservation.ts +1 -1
  119. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/record_card.ts +1 -1
  120. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/record_followup.ts +2 -1
  121. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/record_group_inquiry.ts +2 -1
  122. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/record_guest_details.ts +1 -1
  123. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/reinstate_booking.ts +1 -1
  124. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/request_flight_reconfirmation.ts +2 -1
  125. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/resend_confirmation.ts +2 -1
  126. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/reserve_table.ts +1 -1
  127. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/resolve_room_conflict.ts +2 -1
  128. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/schedule_wakeup_call.ts +2 -1
  129. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/set_do_not_disturb.ts +2 -1
  130. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/set_extras.ts +1 -1
  131. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/set_stay.ts +2 -1
  132. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/start_booking_modification.ts +2 -1
  133. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/start_room_booking.ts +2 -1
  134. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/take_guest_message.ts +2 -1
  135. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/transfer_call.ts +2 -1
  136. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/update_card.ts +2 -1
  137. package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/verify_booking.ts +2 -1
  138. package/dist/templates/{link-digest → link-digest-workflow}/agent.eval.test.ts +16 -1
  139. package/dist/templates/{link-digest → link-digest-workflow}/agent.test.ts +2 -2
  140. package/dist/templates/{link-digest → link-digest-workflow}/agent.ts +8 -3
  141. package/dist/templates/{link-digest → link-digest-workflow}/client.tsx +2 -2
  142. package/dist/templates/{link-digest → link-digest-workflow}/workflows/digest.ts +1 -1
  143. package/dist/templates/{health-assistant → medication-safety-agent}/agent.test.ts +55 -1
  144. package/dist/templates/medication-safety-agent/agent.ts +62 -0
  145. package/dist/templates/{recap-workflow → meeting-recap-agent}/agent.test.ts +4 -4
  146. package/dist/templates/{recap-workflow → meeting-recap-agent}/agent.ts +5 -1
  147. package/dist/templates/{recap-workflow → meeting-recap-agent}/workflows/recap.ts +3 -3
  148. package/dist/templates/{pizza-ordering → pizza-ordering-agent}/agent.ts +3 -0
  149. package/dist/templates/{podcast-digest → podcast-digest-workflow}/agent.eval.test.ts +1 -1
  150. package/dist/templates/{podcast-digest → podcast-digest-workflow}/agent.test.ts +1 -1
  151. package/dist/templates/{podcast-digest → podcast-digest-workflow}/agent.ts +6 -2
  152. package/dist/templates/{podcast-digest → podcast-digest-workflow}/client.tsx +3 -3
  153. package/dist/templates/{podcast-digest → podcast-digest-workflow}/workflows/digest.ts +1 -1
  154. package/dist/templates/{simple → quickstart-agent}/agent.eval.test.ts +39 -3
  155. package/dist/templates/{simple → quickstart-agent}/agent.test.ts +25 -3
  156. package/dist/templates/quickstart-agent/agent.ts +24 -0
  157. package/dist/templates/quickstart-agent/system-prompt.md +8 -0
  158. package/dist/templates/quickstart-agent/tools/get_weather.ts +59 -0
  159. package/dist/templates/{research-workflow → research-handoff-agent}/agent.test.ts +1 -1
  160. package/dist/templates/{research-workflow → research-handoff-agent}/agent.ts +5 -1
  161. package/dist/templates/{research-workflow → research-handoff-agent}/workflows/filing.ts +1 -1
  162. package/dist/templates/{research-workflow → research-handoff-agent}/workflows/research.ts +1 -1
  163. package/dist/templates/{research-workflow → research-handoff-agent}/workflows/review.ts +1 -1
  164. package/dist/templates/{plan-and-execute → research-planner-agent}/agent.eval.test.ts +24 -2
  165. package/dist/templates/{plan-and-execute → research-planner-agent}/agent.ts +3 -0
  166. package/dist/templates/{plan-and-execute → research-planner-agent}/shared.ts +1 -1
  167. package/dist/templates/{plan-and-execute → research-planner-agent}/system-prompt.md +1 -1
  168. package/dist/templates/{retail → retail-orders-agent}/agent.ts +32 -3
  169. package/dist/templates/retail-orders-agent/keyterms.ts +154 -0
  170. package/dist/templates/{retail → retail-orders-agent}/pending.ts +2 -2
  171. package/dist/templates/{retail → retail-orders-agent}/resolve.ts +18 -3
  172. package/dist/templates/{retail → retail-orders-agent}/shared.ts +1 -1
  173. package/dist/templates/{retail → retail-orders-agent}/store.ts +3 -3
  174. package/dist/templates/{roadside-assist → roadside-assistance-agent}/agent.eval.test.ts +37 -5
  175. package/dist/templates/{roadside-assist → roadside-assistance-agent}/agent.test.ts +38 -6
  176. package/dist/templates/{roadside-assist → roadside-assistance-agent}/agent.ts +5 -1
  177. package/dist/templates/{roadside-assist → roadside-assistance-agent}/call.ts +1 -1
  178. package/dist/templates/{roadside-assist → roadside-assistance-agent}/shared.ts +15 -3
  179. package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/acknowledge_disclosure.ts +14 -0
  180. package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/dispatch_truck.ts +1 -1
  181. package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/lookup_coverage.ts +11 -0
  182. package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/service_disclosure.ts +17 -11
  183. package/dist/templates/{roadside-assist → roadside-assistance-agent}/yard.test.ts +4 -0
  184. package/dist/templates/{spoken-summary → spoken-summary-workflow}/agent.test.ts +1 -1
  185. package/dist/templates/{spoken-summary → spoken-summary-workflow}/agent.ts +5 -1
  186. package/dist/templates/{spoken-summary → spoken-summary-workflow}/client.tsx +1 -1
  187. package/dist/templates/{spoken-summary → spoken-summary-workflow}/workflows/summarize.ts +1 -1
  188. package/dist/templates/{solo-rpg → tabletop-rpg-agent}/agent.eval.test.ts +6 -0
  189. package/dist/templates/{solo-rpg → tabletop-rpg-agent}/agent.test.ts +125 -1
  190. package/dist/templates/tabletop-rpg-agent/agent.ts +58 -0
  191. package/dist/templates/{solo-rpg → tabletop-rpg-agent}/shared.ts +84 -3
  192. package/dist/templates/{solo-rpg → tabletop-rpg-agent}/system-prompt.md +1 -1
  193. package/dist/templates/tabletop-rpg-agent/tools/check_state.ts +37 -0
  194. package/dist/templates/{support-line → technical-support-agent}/agent.test.ts +3 -3
  195. package/dist/templates/{support-line → technical-support-agent}/agent.ts +5 -1
  196. package/dist/templates/technical-support-agent/knowledge.ts +165 -0
  197. package/dist/templates/{support-line → technical-support-agent}/nodes.ts +3 -2
  198. package/dist/templates/{support-line → technical-support-agent}/procedure.ts +4 -3
  199. package/dist/templates/technical-support-agent/shared.ts +145 -0
  200. package/dist/templates/{support-line → technical-support-agent}/tools/list_topics.ts +2 -1
  201. package/dist/templates/{infocom-adventure → text-adventure-agent}/agent.eval.test.ts +39 -6
  202. package/dist/templates/{infocom-adventure → text-adventure-agent}/agent.test.ts +79 -1
  203. package/dist/templates/{infocom-adventure → text-adventure-agent}/agent.ts +30 -1
  204. package/dist/templates/{infocom-adventure → text-adventure-agent}/client.tsx +2 -2
  205. package/dist/templates/{infocom-adventure → text-adventure-agent}/shared.ts +37 -0
  206. package/dist/templates/{infocom-adventure → text-adventure-agent}/system-prompt.md +9 -2
  207. package/dist/templates/{briefing-desk → topic-briefing-agent}/agent.eval.test.ts +21 -7
  208. package/dist/templates/{briefing-desk → topic-briefing-agent}/agent.test.ts +23 -11
  209. package/dist/templates/{briefing-desk → topic-briefing-agent}/agent.ts +5 -2
  210. package/dist/templates/{briefing-desk → topic-briefing-agent}/shared.ts +11 -11
  211. package/dist/templates/{briefing-desk → topic-briefing-agent}/slack.ts +1 -1
  212. package/dist/templates/{briefing-desk → topic-briefing-agent}/system-prompt.md +13 -8
  213. package/dist/templates/{briefing-desk → topic-briefing-agent}/tools/send_briefing.ts +43 -5
  214. package/dist/templates/transcription-workflow/agent.test.ts +1 -1
  215. package/dist/templates/transcription-workflow/agent.ts +4 -1
  216. package/dist/templates/transcription-workflow/client.tsx +1 -1
  217. package/dist/templates/transcription-workflow/workflows/batch.ts +2 -2
  218. package/dist/templates/transcription-workflow/workflows/transcribe.ts +1 -1
  219. package/dist/templates/{travel-concierge → travel-concierge-agent}/agent.ts +4 -0
  220. package/dist/templates/{travel-concierge → travel-concierge-agent}/shared.ts +1 -1
  221. package/dist/templates/{web-researcher → web-research-agent}/agent.eval.test.ts +32 -6
  222. package/dist/templates/{web-researcher → web-research-agent}/agent.test.ts +17 -1
  223. package/dist/templates/{web-researcher → web-research-agent}/agent.ts +31 -1
  224. package/dist/templates/{web-researcher → web-research-agent}/system-prompt.md +8 -2
  225. package/dist/templates/{word-wrangler → word-game-agent}/agent.eval.test.ts +79 -18
  226. package/dist/templates/{word-wrangler → word-game-agent}/agent.ts +20 -0
  227. package/dist/templates/{word-wrangler → word-game-agent}/game.ts +1 -1
  228. package/dist/templates/{word-wrangler → word-game-agent}/shared.ts +1 -1
  229. package/dist/test-CjKPQ9_B.mjs +102 -0
  230. package/dist/test.d.ts +37 -12
  231. package/package.json +5 -5
  232. package/dist/_init-BzQbV8Zh.mjs +0 -199
  233. package/dist/_preflight-CcAR577V.mjs +0 -46
  234. package/dist/init-D363Ls5u.mjs +0 -183
  235. package/dist/templates/health-assistant/agent.ts +0 -15
  236. package/dist/templates/simple/agent.ts +0 -8
  237. package/dist/templates/solo-rpg/agent.ts +0 -29
  238. package/dist/templates/solo-rpg/tools/check_state.ts +0 -28
  239. package/dist/templates/support-line/shared.ts +0 -281
  240. package/dist/test-Cllnx81G.mjs +0 -83
  241. /package/dist/templates/{hiring-desk → applicant-screening-agent}/agent.test.ts +0 -0
  242. /package/dist/templates/{hiring-desk → applicant-screening-agent}/client.tsx +0 -0
  243. /package/dist/templates/{hiring-desk → applicant-screening-agent}/leads.json +0 -0
  244. /package/dist/templates/{hiring-desk → applicant-screening-agent}/screening-lock.test.ts +0 -0
  245. /package/dist/templates/{hiring-desk → applicant-screening-agent}/screening-lock.ts +0 -0
  246. /package/dist/templates/{hiring-desk → applicant-screening-agent}/system-prompt.md +0 -0
  247. /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/candidate_details.ts +0 -0
  248. /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/proceed_to_emails.ts +0 -0
  249. /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/read_email.ts +0 -0
  250. /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/rescore_with_feedback.ts +0 -0
  251. /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/screen_candidates.ts +0 -0
  252. /package/dist/templates/{call-audit → call-audit-workflow}/agent.eval.test.ts +0 -0
  253. /package/dist/templates/{call-audit → call-audit-workflow}/agent.test.ts +0 -0
  254. /package/dist/templates/{call-audit → call-audit-workflow}/workflows/audit.ts +0 -0
  255. /package/dist/templates/{call-audit → call-audit-workflow}/workflows/ingest.ts +0 -0
  256. /package/dist/templates/{call-audit → call-audit-workflow}/workflows/media.ts +0 -0
  257. /package/dist/templates/{call-audit → call-audit-workflow}/workflows/sync-api.ts +0 -0
  258. /package/dist/templates/{code-interpreter → code-interpreter-agent}/system-prompt.md +0 -0
  259. /package/dist/templates/{pipeline-simple → custom-pipeline-agent}/agent.eval.test.ts +0 -0
  260. /package/dist/templates/{pipeline-simple → custom-pipeline-agent}/stages.test.ts +0 -0
  261. /package/dist/templates/{redline → document-redline-workflow}/agent.eval.test.ts +0 -0
  262. /package/dist/templates/{redline → document-redline-workflow}/agent.test.ts +0 -0
  263. /package/dist/templates/{redline → document-redline-workflow}/form.ts +0 -0
  264. /package/dist/templates/{redline → document-redline-workflow}/workflows/prompts.ts +0 -0
  265. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/agent.eval.test.ts +0 -0
  266. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/client.tsx +0 -0
  267. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/shared.ts +0 -0
  268. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_add_note.ts +0 -0
  269. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_escalate.ts +0 -0
  270. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_get.ts +0 -0
  271. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_triage.ts +0 -0
  272. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_update_status.ts +0 -0
  273. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/ops_dashboard.ts +0 -0
  274. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/ops_protocols.ts +0 -0
  275. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/ops_run_scenario.ts +0 -0
  276. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/resources_dispatch.ts +0 -0
  277. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/resources_get_available.ts +0 -0
  278. /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/resources_update_status.ts +0 -0
  279. /package/dist/templates/{night-owl → entertainment-picks-agent}/shared.ts +0 -0
  280. /package/dist/templates/{night-owl → entertainment-picks-agent}/tools/recommend.ts +0 -0
  281. /package/dist/templates/{executive-assistant → executive-inbox-agent}/agent.test.ts +0 -0
  282. /package/dist/templates/{executive-assistant → executive-inbox-agent}/calendar.test.ts +0 -0
  283. /package/dist/templates/{executive-assistant → executive-inbox-agent}/client.tsx +0 -0
  284. /package/dist/templates/{executive-assistant → executive-inbox-agent}/inbox.ts +0 -0
  285. /package/dist/templates/{executive-assistant → executive-inbox-agent}/nodes.ts +0 -0
  286. /package/dist/templates/{executive-assistant → executive-inbox-agent}/review.ts +0 -0
  287. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/accept.ts +0 -0
  288. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/ask_question.ts +0 -0
  289. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/draft_reply.ts +0 -0
  290. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/edit.ts +0 -0
  291. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/ignore.ts +0 -0
  292. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/inbox_status.ts +0 -0
  293. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/new_email.ts +0 -0
  294. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/respond.ts +0 -0
  295. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/review_memory.ts +0 -0
  296. /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/triage_inbox.ts +0 -0
  297. /package/dist/templates/{hotel-desk → hotel-reception-agent}/booking.ts +0 -0
  298. /package/dist/templates/{hotel-desk → hotel-reception-agent}/card.ts +0 -0
  299. /package/dist/templates/{hotel-desk → hotel-reception-agent}/catalogs.ts +0 -0
  300. /package/dist/templates/{hotel-desk → hotel-reception-agent}/desk.ts +0 -0
  301. /package/dist/templates/{hotel-desk → hotel-reception-agent}/hotel.ts +0 -0
  302. /package/dist/templates/{hotel-desk → hotel-reception-agent}/policies.ts +0 -0
  303. /package/dist/templates/{hotel-desk → hotel-reception-agent}/records.ts +0 -0
  304. /package/dist/templates/{hotel-desk → hotel-reception-agent}/restaurant.ts +0 -0
  305. /package/dist/templates/{hotel-desk → hotel-reception-agent}/seed.ts +0 -0
  306. /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/book_business_center.ts +0 -0
  307. /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/book_spa_appointment.ts +0 -0
  308. /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/book_tour.ts +0 -0
  309. /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_policy.ts +0 -0
  310. /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/order_flowers.ts +0 -0
  311. /package/dist/templates/{link-digest → link-digest-workflow}/api-client.ts +0 -0
  312. /package/dist/templates/{health-assistant → medication-safety-agent}/agent.eval.test.ts +0 -0
  313. /package/dist/templates/{health-assistant → medication-safety-agent}/fda.test.ts +0 -0
  314. /package/dist/templates/{health-assistant → medication-safety-agent}/fda.ts +0 -0
  315. /package/dist/templates/{health-assistant → medication-safety-agent}/system-prompt.md +0 -0
  316. /package/dist/templates/{health-assistant → medication-safety-agent}/tools/check_drug_interaction.ts +0 -0
  317. /package/dist/templates/{health-assistant → medication-safety-agent}/tools/medication_lookup.ts +0 -0
  318. /package/dist/templates/{recap-workflow → meeting-recap-agent}/agent.eval.test.ts +0 -0
  319. /package/dist/templates/{recap-workflow → meeting-recap-agent}/shared.ts +0 -0
  320. /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/cancel_recap.ts +0 -0
  321. /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/keep_transcript.ts +0 -0
  322. /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/recap_progress.ts +0 -0
  323. /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/recap_status.ts +0 -0
  324. /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/request_recap.ts +0 -0
  325. /package/dist/templates/{recap-workflow → meeting-recap-agent}/workflows/tokens.ts +0 -0
  326. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/agent.eval.test.ts +0 -0
  327. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/agent.test.ts +0 -0
  328. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/client.tsx +0 -0
  329. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/shared.ts +0 -0
  330. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/system-prompt.md +0 -0
  331. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/add_pizza.ts +0 -0
  332. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/place_order.ts +0 -0
  333. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/remove_pizza.ts +0 -0
  334. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/set_customer_name.ts +0 -0
  335. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/update_pizza.ts +0 -0
  336. /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/view_order.ts +0 -0
  337. /package/dist/templates/{podcast-digest → podcast-digest-workflow}/workflows/feeds.ts +0 -0
  338. /package/dist/templates/{podcast-digest → podcast-digest-workflow}/workflows/slack.ts +0 -0
  339. /package/dist/templates/{research-workflow → research-handoff-agent}/agent.eval.test.ts +0 -0
  340. /package/dist/templates/{research-workflow → research-handoff-agent}/shared.ts +0 -0
  341. /package/dist/templates/{research-workflow → research-handoff-agent}/tools/file_it_now.ts +0 -0
  342. /package/dist/templates/{research-workflow → research-handoff-agent}/tools/request_research.ts +0 -0
  343. /package/dist/templates/{research-workflow → research-handoff-agent}/tools/research_progress.ts +0 -0
  344. /package/dist/templates/{research-workflow → research-handoff-agent}/tools/research_status.ts +0 -0
  345. /package/dist/templates/{research-workflow → research-handoff-agent}/workflows/notes.ts +0 -0
  346. /package/dist/templates/{research-workflow → research-handoff-agent}/workflows/prompts.ts +0 -0
  347. /package/dist/templates/{plan-and-execute → research-planner-agent}/agent.test.ts +0 -0
  348. /package/dist/templates/{plan-and-execute → research-planner-agent}/client.tsx +0 -0
  349. /package/dist/templates/{plan-and-execute → research-planner-agent}/procedure.ts +0 -0
  350. /package/dist/templates/{plan-and-execute → research-planner-agent}/prompts.ts +0 -0
  351. /package/dist/templates/{plan-and-execute → research-planner-agent}/tools/plan_status.ts +0 -0
  352. /package/dist/templates/{plan-and-execute → research-planner-agent}/tools/revise_plan.ts +0 -0
  353. /package/dist/templates/{plan-and-execute → research-planner-agent}/tools/start_plan.ts +0 -0
  354. /package/dist/templates/{plan-and-execute → research-planner-agent}/tools/work_next_step.ts +0 -0
  355. /package/dist/templates/{retail → retail-orders-agent}/address.ts +0 -0
  356. /package/dist/templates/{retail → retail-orders-agent}/agent.eval.test.ts +0 -0
  357. /package/dist/templates/{retail → retail-orders-agent}/agent.test.ts +0 -0
  358. /package/dist/templates/{retail → retail-orders-agent}/authenticate.ts +0 -0
  359. /package/dist/templates/{retail → retail-orders-agent}/cancel.ts +0 -0
  360. /package/dist/templates/{retail → retail-orders-agent}/client.tsx +0 -0
  361. /package/dist/templates/{retail → retail-orders-agent}/payment.ts +0 -0
  362. /package/dist/templates/{retail → retail-orders-agent}/pending.test.ts +0 -0
  363. /package/dist/templates/{retail → retail-orders-agent}/refund.ts +0 -0
  364. /package/dist/templates/{retail → retail-orders-agent}/registry.test.ts +0 -0
  365. /package/dist/templates/{retail → retail-orders-agent}/resolve.test.ts +0 -0
  366. /package/dist/templates/{retail → retail-orders-agent}/returns.ts +0 -0
  367. /package/dist/templates/{retail → retail-orders-agent}/seed.json +0 -0
  368. /package/dist/templates/{retail → retail-orders-agent}/seed.test.ts +0 -0
  369. /package/dist/templates/{retail → retail-orders-agent}/shared.test.ts +0 -0
  370. /package/dist/templates/{retail → retail-orders-agent}/store.test.ts +0 -0
  371. /package/dist/templates/{retail → retail-orders-agent}/swap.test.ts +0 -0
  372. /package/dist/templates/{retail → retail-orders-agent}/swap.ts +0 -0
  373. /package/dist/templates/{retail → retail-orders-agent}/system-prompt.md +0 -0
  374. /package/dist/templates/{retail → retail-orders-agent}/tools/cancel_change.ts +0 -0
  375. /package/dist/templates/{retail → retail-orders-agent}/tools/cancel_pending_order.ts +0 -0
  376. /package/dist/templates/{retail → retail-orders-agent}/tools/confirm_change.ts +0 -0
  377. /package/dist/templates/{retail → retail-orders-agent}/tools/exchange_delivered_order_items.ts +0 -0
  378. /package/dist/templates/{retail → retail-orders-agent}/tools/find_user_id_by_email.ts +0 -0
  379. /package/dist/templates/{retail → retail-orders-agent}/tools/find_user_id_by_name_zip.ts +0 -0
  380. /package/dist/templates/{retail → retail-orders-agent}/tools/get_item_details.ts +0 -0
  381. /package/dist/templates/{retail → retail-orders-agent}/tools/get_order_details.ts +0 -0
  382. /package/dist/templates/{retail → retail-orders-agent}/tools/get_product_details.ts +0 -0
  383. /package/dist/templates/{retail → retail-orders-agent}/tools/get_user_details.ts +0 -0
  384. /package/dist/templates/{retail → retail-orders-agent}/tools/list_all_product_types.ts +0 -0
  385. /package/dist/templates/{retail → retail-orders-agent}/tools/modify_pending_order_address.ts +0 -0
  386. /package/dist/templates/{retail → retail-orders-agent}/tools/modify_pending_order_items.ts +0 -0
  387. /package/dist/templates/{retail → retail-orders-agent}/tools/modify_pending_order_payment.ts +0 -0
  388. /package/dist/templates/{retail → retail-orders-agent}/tools/modify_user_address.ts +0 -0
  389. /package/dist/templates/{retail → retail-orders-agent}/tools/return_delivered_order_items.ts +0 -0
  390. /package/dist/templates/{retail → retail-orders-agent}/tools/transfer_to_human_agents.ts +0 -0
  391. /package/dist/templates/{roadside-assist → roadside-assistance-agent}/events.ts +0 -0
  392. /package/dist/templates/{roadside-assist → roadside-assistance-agent}/system-prompt.md +0 -0
  393. /package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/job_status.ts +0 -0
  394. /package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/report_location.ts +0 -0
  395. /package/dist/templates/{roadside-assist → roadside-assistance-agent}/yard.ts +0 -0
  396. /package/dist/templates/{spoken-summary → spoken-summary-workflow}/agent.eval.test.ts +0 -0
  397. /package/dist/templates/{spoken-summary → spoken-summary-workflow}/workflows/transcribe.ts +0 -0
  398. /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/client.tsx +0 -0
  399. /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/action_roll.ts +0 -0
  400. /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/burn_momentum.ts +0 -0
  401. /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/oracle.ts +0 -0
  402. /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/setup_character.ts +0 -0
  403. /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/update_state.ts +0 -0
  404. /package/dist/templates/{support-line → technical-support-agent}/agent.eval.test.ts +0 -0
  405. /package/dist/templates/{support-line → technical-support-agent}/client.tsx +0 -0
  406. /package/dist/templates/{support-line → technical-support-agent}/knowledge.json +0 -0
  407. /package/dist/templates/{support-line → technical-support-agent}/prompts.ts +0 -0
  408. /package/dist/templates/{support-line → technical-support-agent}/system-prompt.md +0 -0
  409. /package/dist/templates/{support-line → technical-support-agent}/tools/answer_question.ts +0 -0
  410. /package/dist/templates/{support-line → technical-support-agent}/tools/log_ticket.ts +0 -0
  411. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_drop.ts +0 -0
  412. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_flag.ts +0 -0
  413. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_get.ts +0 -0
  414. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_move.ts +0 -0
  415. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_restart.ts +0 -0
  416. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_score.ts +0 -0
  417. /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_take.ts +0 -0
  418. /package/dist/templates/{briefing-desk → topic-briefing-agent}/tools/briefing_so_far.ts +0 -0
  419. /package/dist/templates/{briefing-desk → topic-briefing-agent}/tools/research_topic.ts +0 -0
  420. /package/dist/templates/{briefing-desk → topic-briefing-agent}/tools/verify_claim.ts +0 -0
  421. /package/dist/templates/{travel-concierge → travel-concierge-agent}/agent.eval.test.ts +0 -0
  422. /package/dist/templates/{travel-concierge → travel-concierge-agent}/agent.test.ts +0 -0
  423. /package/dist/templates/{travel-concierge → travel-concierge-agent}/call-events.ts +0 -0
  424. /package/dist/templates/{travel-concierge → travel-concierge-agent}/client.tsx +0 -0
  425. /package/dist/templates/{travel-concierge → travel-concierge-agent}/routing.ts +0 -0
  426. /package/dist/templates/{travel-concierge → travel-concierge-agent}/system-prompt.md +0 -0
  427. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/book_car_rental.ts +0 -0
  428. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/book_excursion.ts +0 -0
  429. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/book_hotel.ts +0 -0
  430. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/cancel_action.ts +0 -0
  431. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/cancel_ticket.ts +0 -0
  432. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/complete_or_escalate.ts +0 -0
  433. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/confirm_action.ts +0 -0
  434. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/lookup_booking.ts +0 -0
  435. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/search_car_rentals.ts +0 -0
  436. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/search_excursions.ts +0 -0
  437. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/search_flights.ts +0 -0
  438. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/search_hotels.ts +0 -0
  439. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/to_car_rental_assistant.ts +0 -0
  440. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/to_excursion_assistant.ts +0 -0
  441. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/to_flight_assistant.ts +0 -0
  442. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/to_hotel_assistant.ts +0 -0
  443. /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/update_ticket.ts +0 -0
  444. /package/dist/templates/{word-wrangler → word-game-agent}/agent.test.ts +0 -0
  445. /package/dist/templates/{word-wrangler → word-game-agent}/client.tsx +0 -0
  446. /package/dist/templates/{word-wrangler → word-game-agent}/guess.ts +0 -0
  447. /package/dist/templates/{word-wrangler → word-game-agent}/player.ts +0 -0
  448. /package/dist/templates/{word-wrangler → word-game-agent}/system-prompt.md +0 -0
  449. /package/dist/templates/{word-wrangler → word-game-agent}/tools/final_score.ts +0 -0
  450. /package/dist/templates/{word-wrangler → word-game-agent}/tools/relay_description.ts +0 -0
  451. /package/dist/templates/{word-wrangler → word-game-agent}/tools/repeat_word.ts +0 -0
  452. /package/dist/templates/{word-wrangler → word-game-agent}/tools/skip_word.ts +0 -0
  453. /package/dist/templates/{word-wrangler → word-game-agent}/tools/start_game.ts +0 -0
  454. /package/dist/templates/{word-wrangler → word-game-agent}/words.ts +0 -0
@@ -15,7 +15,7 @@
15
15
  * re-arm the two minutes on every sentence and the round would never end. The
16
16
  * tools that run during a round (`relay_description`, `skip_word`, `repeat_word`)
17
17
  * therefore send NOTHING; they read and write the slot and leave the position
18
- * alone. That is the opposite of `roadside-assist`'s silence ladder, and the
18
+ * alone. That is the opposite of `roadside-assistance-agent`'s silence ladder, and the
19
19
  * same rule read the other way.
20
20
  *
21
21
  * **Time's up is announced a turn late, and that is a property of deadlines.** A
@@ -15,7 +15,7 @@
15
15
  * disconnect-and-reconnect of the player on every new word so it never carries
16
16
  * a previous word's context.
17
17
  *
18
- * | word-wrangler phone game | here |
18
+ * | word-game-agent phone game | here |
19
19
  * | --- | --- |
20
20
  * | the host `GeminiLiveLLMService` (text modality) | the voice agent — its model and its TTS |
21
21
  * | the player `ResettablePlayerLLM` (its own Gemini Live session) | `askPlayer` in `player.ts`: one `ctx.generate` per description, on the player's own system prompt |
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env node
2
+ import { a as ok, n as fail } from "./_output-DBP9Op_d.mjs";
3
+ import { n as log } from "./_ui-DCt4qZrk.mjs";
4
+ import { l as formatCappedList } from "./_utils-D5JGcjiW.mjs";
5
+ import { i as unrunSpecFiles, n as classifyVitestError, r as runVitest, t as WIDEN_HINT } from "./_vitest-runner-CZNGj0ZC.mjs";
6
+ //#region src/test.ts
7
+ /**
8
+ * `aai test` — run agent tests via vitest.
9
+ *
10
+ * The launcher is `_vitest-runner.ts`, shared with `aai eval` and `aai build`'s
11
+ * pre-build gate. What is here is the COMMAND: which files the test tier runs,
12
+ * and the verdict over the ones a run did not cover.
13
+ */
14
+ /**
15
+ * The files a NARROWED `aai test` runs, in preference order.
16
+ *
17
+ * The tier's filenames belong to the command, not to the runner — `aai eval`
18
+ * declares `EVAL_FILES` the same way one module over, and neither names the
19
+ * other's. `aai build` imports this one because its pre-build gate runs the
20
+ * TEST tier.
21
+ *
22
+ * They are no longer what a BARE `aai test` runs — see {@link executeTest} for
23
+ * why the default is the whole project — so this list is now reached only by
24
+ * `--only`.
25
+ */
26
+ const TEST_FILES = ["agent.test.ts", "agent.test.js"];
27
+ /**
28
+ * Execute agent tests and return structured result.
29
+ *
30
+ * **The default is the whole project, and it used to be one file.**
31
+ * `aai test` ran `agent.test.ts` alone and then FAILED (`incomplete_run`) over
32
+ * every other spec it had skipped — so on any project with a second spec file
33
+ * the default invocation could never be green, and the scaffold routed around
34
+ * the command it was supposed to wire into CI (`"test": "vitest run --exclude
35
+ * …"`, with `aai test` demoted to `test:agent`). Nine shipped templates carry
36
+ * two or more non-eval specs, so that was the normal case rather than the edge:
37
+ * the command's own remedy was "do not run this command".
38
+ *
39
+ * The narrow default was defensible when it was written — running a project's
40
+ * other specs could reach ones that are slow or want credentials — but the
41
+ * verdict is what made it unusable, and `aai build`'s pre-build gate had
42
+ * already gone the other way (`all: true`) for the same reason a build is run
43
+ * deliberately. So the widening is the default here too and `--only` is the
44
+ * inner loop, which leaves the two halves of the original defect closed: a
45
+ * complete run is a green run, and a narrowed one is honest about what it
46
+ * skipped instead of failing over it.
47
+ *
48
+ * **An incomplete run is still not a pass.** For as long as this command
49
+ * answered `{"ok":true,"data":{"passed":true}}` with exit 0 over specs it had
50
+ * not run, adding one tool could break `registry.test.ts` in 17 assertions with
51
+ * `pnpm test` and `pnpm build` both staying green throughout. What carries that
52
+ * now is the RESULT (`unrun`, `complete: false`) plus the runner's own warning,
53
+ * because the reader of a deliberate `--only` asked for the narrowing.
54
+ */
55
+ async function executeTest(cwd, opts = {}) {
56
+ const narrowed = opts.only === true;
57
+ log.step(narrowed ? "Running agent tests" : "Running project tests");
58
+ try {
59
+ const ran = runVitest(cwd, {
60
+ candidates: TEST_FILES,
61
+ all: !narrowed
62
+ });
63
+ const unrun = unrunSpecFiles(cwd, ran);
64
+ if (ran === false) {
65
+ if (unrun.length > 0) return noNarrowTarget(unrun);
66
+ log.info("No test file found. Create agent.test.ts to add tests.");
67
+ return ok({
68
+ passed: true,
69
+ skipped: true,
70
+ ran: [],
71
+ unrun: [],
72
+ complete: true
73
+ });
74
+ }
75
+ log.success(`Tests passed (${ran.length} spec file(s))`);
76
+ return ok({
77
+ passed: true,
78
+ ran,
79
+ unrun,
80
+ complete: unrun.length === 0
81
+ });
82
+ } catch (err) {
83
+ const { code, message } = classifyVitestError(err);
84
+ return fail(code, message);
85
+ }
86
+ }
87
+ /**
88
+ * The verdict for `--only` in a project with no `agent.test.ts`.
89
+ *
90
+ * This is the arm that had misled longest, and it is the one place the
91
+ * `incomplete_run` failure is still right: `aai test` printed "No test file
92
+ * found" while the project's specs sat right there unrun, which reads as "this
93
+ * project has no tests". Measured on a project whose only spec was
94
+ * `tools/echo_back.test.ts` — `{"passed":true,"skipped":true}`, exit 0, and not
95
+ * a word about it. Bare `aai test` runs those specs now; `--only` asked for a
96
+ * file that is not there, and the honest answer is neither a pass nor silence.
97
+ */
98
+ function noNarrowTarget(unrun) {
99
+ return fail("incomplete_run", `\`aai test --only\` found no ${TEST_FILES[0]}, so it ran nothing, but ${unrun.length} spec file(s) exist: ${formatCappedList(unrun)}. An unrun spec is not a passing one, so this is not a green result.`, WIDEN_HINT);
100
+ }
101
+ //#endregion
102
+ export { TEST_FILES, executeTest };
package/dist/test.d.ts CHANGED
@@ -25,31 +25,56 @@ type TestData = {
25
25
  complete: boolean;
26
26
  };
27
27
  /**
28
- * The files `aai test` runs, in preference order.
28
+ * The files a NARROWED `aai test` runs, in preference order.
29
29
  *
30
30
  * The tier's filenames belong to the command, not to the runner — `aai eval`
31
31
  * declares `EVAL_FILES` the same way one module over, and neither names the
32
32
  * other's. `aai build` imports this one because its pre-build gate runs the
33
33
  * TEST tier.
34
+ *
35
+ * They are no longer what a BARE `aai test` runs — see {@link executeTest} for
36
+ * why the default is the whole project — so this list is now reached only by
37
+ * `--only`.
34
38
  */
35
39
  export declare const TEST_FILES: readonly ["agent.test.ts", "agent.test.js"];
36
40
  /** What `aai test` was asked to cover. */
37
41
  export type TestOptions = {
38
- /** Run every non-eval spec in the project rather than `agent.test.ts` alone. */
39
- readonly all?: boolean | undefined;
42
+ /**
43
+ * Narrow the run to {@link TEST_FILES} rather than every non-eval spec.
44
+ *
45
+ * The fast inner loop, and the OPT-IN half of the pair: it is what the old
46
+ * default did, minus the false verdict — a narrowed run reports the specs it
47
+ * skipped through `warnUnrunSpecs` and says `complete: false`.
48
+ */
49
+ readonly only?: boolean | undefined;
40
50
  };
41
51
  /**
42
52
  * Execute agent tests and return structured result.
43
53
  *
44
- * **An incomplete run is not a pass.** For as long as this command answered
45
- * `{"ok":true,"data":{"passed":true}}` with exit 0 over specs it had not run,
46
- * the scaffold's `"test": "aai test"` was what users wired into CI — so a suite
47
- * of 25 tests could go red in the editor and green in the pipeline, and adding
48
- * one tool could break `registry.test.ts` in 17 assertions with `pnpm test` and
49
- * `pnpm build` both staying green throughout. It is the same defect
50
- * `defineExec`'s `cwd` policy exists for (a green result for a project that is
51
- * not there), one directory over, and it gets the same answer: the command
52
- * fails, names the files, and names the flag that runs them.
54
+ * **The default is the whole project, and it used to be one file.**
55
+ * `aai test` ran `agent.test.ts` alone and then FAILED (`incomplete_run`) over
56
+ * every other spec it had skipped — so on any project with a second spec file
57
+ * the default invocation could never be green, and the scaffold routed around
58
+ * the command it was supposed to wire into CI (`"test": "vitest run --exclude
59
+ * …"`, with `aai test` demoted to `test:agent`). Nine shipped templates carry
60
+ * two or more non-eval specs, so that was the normal case rather than the edge:
61
+ * the command's own remedy was "do not run this command".
62
+ *
63
+ * The narrow default was defensible when it was written — running a project's
64
+ * other specs could reach ones that are slow or want credentials — but the
65
+ * verdict is what made it unusable, and `aai build`'s pre-build gate had
66
+ * already gone the other way (`all: true`) for the same reason a build is run
67
+ * deliberately. So the widening is the default here too and `--only` is the
68
+ * inner loop, which leaves the two halves of the original defect closed: a
69
+ * complete run is a green run, and a narrowed one is honest about what it
70
+ * skipped instead of failing over it.
71
+ *
72
+ * **An incomplete run is still not a pass.** For as long as this command
73
+ * answered `{"ok":true,"data":{"passed":true}}` with exit 0 over specs it had
74
+ * not run, adding one tool could break `registry.test.ts` in 17 assertions with
75
+ * `pnpm test` and `pnpm build` both staying green throughout. What carries that
76
+ * now is the RESULT (`unrun`, `complete: false`) plus the runner's own warning,
77
+ * because the reader of a deliberate `--only` asked for the narrowing.
53
78
  */
54
79
  export declare function executeTest(cwd: string, opts?: TestOptions): Promise<CommandResult<TestData>>;
55
80
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexkroman1/aai-cli",
3
- "version": "16.0.1",
3
+ "version": "17.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -57,16 +57,16 @@
57
57
  "p-timeout": "^7.0.1",
58
58
  "vite": "^8.2.2",
59
59
  "zod": "^4.5.4",
60
- "@alexkroman1/aai": "16.0.1",
61
- "@alexkroman1/aai-ui": "16.0.1",
62
- "@alexkroman1/aai-runtime": "16.0.1"
60
+ "@alexkroman1/aai": "17.0.0",
61
+ "@alexkroman1/aai-runtime": "17.0.0",
62
+ "@alexkroman1/aai-ui": "17.0.0"
63
63
  },
64
64
  "devDependencies": {
65
65
  "playwright": "^1.62.1",
66
66
  "tsdown": "^0.22.14",
67
67
  "verdaccio": "^6.10.1",
68
68
  "vitest": "^4.1.11",
69
- "aai-templates": "0.4.0"
69
+ "aai-templates": "0.5.0"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "vitest": "^4.1.10"
@@ -1,199 +0,0 @@
1
- #!/usr/bin/env node
2
- import { d as readJson, g as writeJson, i as compareCodeUnits, u as isEexist } from "./_utils-D5JGcjiW.mjs";
3
- import { r as isDevMode, t as getMonorepoRoot } from "./_agent-BzUeqOdj.mjs";
4
- import { REPO_URL, downloadAndMergeTemplate } from "./_templates-CuP74F8D.mjs";
5
- import path from "node:path";
6
- import fs from "node:fs/promises";
7
- //#region src/_init.ts
8
- /**
9
- * The README every scaffolded project gets, and the first thing a new author
10
- * reads. Three things in it are corrections rather than prose:
11
- *
12
- * - **`npm run dev`, never a bare `aai dev`.** The CLI is a devDependency, so
13
- * after `npm install` the binary is in `node_modules/.bin` and NOT on
14
- * `PATH`. The old quickstart said `aai dev`, which fails with
15
- * `command not found` for everyone who has not installed the CLI globally.
16
- * - **The key `aai dev` needs is named, with the two LOCAL ways first.** No
17
- * step of local development needs a platform account; a twenty-persona DX
18
- * audit read the account-shaped failure it used to get and concluded the
19
- * opposite, then stopped using the loop this file documents.
20
- * - **`aai login` appears where it is actually required.** It was in no
21
- * user-facing doc at all, while the quickstart's own publish step needs it.
22
- */
23
- function readmeContent(slug) {
24
- return `# ${slug}
25
-
26
- A voice agent built with [aai](${REPO_URL}).
27
-
28
- ## Getting started
29
-
30
- \`\`\`sh
31
- npm install # Install dependencies
32
- npm run dev # Run locally on http://localhost:3000 (opens browser)
33
- \`\`\`
34
-
35
- The \`aai\` CLI is a devDependency of this project, so it lives in
36
- \`node_modules/.bin\` rather than on your \`PATH\`. Run it through npm
37
- (\`npm run dev\`, \`npm test\`, \`npm run build\`) or with \`npx aai <command>\`.
38
- Installing it globally (\`npm i -g @alexkroman1/aai-cli\`) also works, and is
39
- what the project docs assume.
40
-
41
- ### The one key local development needs
42
-
43
- The default pipeline (speech-to-text → LLM → text-to-speech) runs on a single
44
- AssemblyAI key. **Any one of these is enough, and the first two need no aai
45
- account** — nothing about running this agent locally is gated on one:
46
-
47
- 1. Put \`ASSEMBLYAI_API_KEY=<your key>\` in \`.env\` (this project's \`.env.example\`
48
- documents it, and it is the same file \`aai publish\` uploads as secrets).
49
- 2. Or export it in your shell: \`export ASSEMBLYAI_API_KEY=<your key>\`.
50
- 3. Or run \`npx aai login\`, and \`aai dev\` will use your account's key.
51
-
52
- Get a key at <https://www.assemblyai.com/dashboard>.
53
-
54
- ## Publishing
55
-
56
- Publishing (and the studio it syncs to) is the one part that does need an
57
- account:
58
-
59
- \`\`\`sh
60
- npx aai login # Link your account — once per machine
61
- npm run publish:agent # Publish to production (and sync to the studio)
62
- \`\`\`
63
-
64
- You can also run this agent as a plain Node server, with no aai account and
65
- nothing managed:
66
-
67
- \`\`\`sh
68
- npm start # Builds, then serves on http://127.0.0.1:3000
69
- \`\`\`
70
-
71
- ## Secrets
72
-
73
- Access secrets in your agent via \`ctx.env.MY_KEY\`.
74
-
75
- **Local development** — add secrets to \`.env\` (auto-loaded by \`aai dev\`):
76
-
77
- \`\`\`sh
78
- ALPHA_VANTAGE_KEY=sk-abc123
79
- MY_API_KEY=secret-value
80
- \`\`\`
81
-
82
- **Production** — set secrets on the server:
83
-
84
- \`\`\`sh
85
- npx aai secret put MY_KEY # Set a secret (prompts for value)
86
- npx aai secret list # List secret names
87
- npx aai secret delete MY_KEY # Remove a secret
88
- \`\`\`
89
-
90
- `;
91
- }
92
- /**
93
- * Map from npm package name to directory name under packages/.
94
- * Used to rewrite published version ranges to link: paths in dev mode.
95
- */
96
- const WORKSPACE_PKG_DIRS = {
97
- "@alexkroman1/aai": "aai",
98
- "@alexkroman1/aai-cli": "aai-cli",
99
- "@alexkroman1/aai-runtime": "aai-runtime",
100
- "@alexkroman1/aai-ui": "aai-ui"
101
- };
102
- /** Rewrite workspace deps to link: paths so pnpm links to local source. */
103
- async function patchPackageJsonForWorkspace(targetDir) {
104
- const pkgPath = path.join(targetDir, "package.json");
105
- const pkgJson = await readJson(pkgPath);
106
- if (!pkgJson) return;
107
- pkgJson.name = path.basename(targetDir);
108
- delete pkgJson.packageManager;
109
- const root = getMonorepoRoot();
110
- if (!root) return;
111
- const packagesDir = path.join(root, "packages");
112
- for (const field of ["dependencies", "devDependencies"]) {
113
- const deps = pkgJson[field];
114
- if (!deps) continue;
115
- for (const key of Object.keys(deps)) {
116
- const dir = WORKSPACE_PKG_DIRS[key];
117
- if (dir) deps[key] = `link:${path.relative(targetDir, path.join(packagesDir, dir))}`;
118
- }
119
- }
120
- await writeJson(pkgPath, pkgJson);
121
- await pinSharedDeps(targetDir, packagesDir, pkgJson);
122
- }
123
- /**
124
- * Pin every THIRD-PARTY dependency this project shares with a linked workspace
125
- * package to the copy that workspace package resolved.
126
- *
127
- * Linking is what makes this necessary, and it only bites in dev mode. The
128
- * project's `@alexkroman1/*` deps become `link:` paths, so the SDK's types come
129
- * out of the WORKSPACE's `node_modules` — while the project installs its own
130
- * copy of anything it also declares. Two copies of a structurally identical
131
- * library are two NOMINALLY different types to TypeScript, and the error runs to
132
- * a hundred lines of `Type 'AnyActorLogic' is not assignable to type
133
- * 'AnyActorLogic'` with two absolute paths in it.
134
- *
135
- * Measured: `aai init --template support-line` produced exactly that. The
136
- * workspace lockfile pinned `xstate@5.32.5`, the fresh project resolved
137
- * `^5.32.5` to `5.32.6`, the CLI's typecheck gate failed, and the deploy was
138
- * REFUSED — `"deployed": false` with the whole error as a warning. One
139
- * `overrides` entry fixes it; verified end to end.
140
- *
141
- * A published install has no such problem, which is why this is dev-mode only:
142
- * a user's project and the published SDK both ask for `^5.32.5` and pnpm
143
- * resolves ONE copy. Nothing here changes what a user gets.
144
- *
145
- * Written to `pnpm-workspace.yaml` rather than `pnpm.overrides` in the manifest:
146
- * the scaffold ships that file, which makes the project its own workspace root,
147
- * and pnpm 10+ reads overrides from there. Verified both ways — the manifest
148
- * spelling installed `5.32.6` anyway.
149
- */
150
- async function pinSharedDeps(targetDir, packagesDir, pkgJson) {
151
- const declared = {
152
- ...pkgJson.dependencies,
153
- ...pkgJson.devDependencies
154
- };
155
- const linked = Object.entries(WORKSPACE_PKG_DIRS).filter(([name]) => name in declared).map(([, dir]) => dir);
156
- const resolved = await Promise.all(Object.keys(declared).filter((name) => !(name in WORKSPACE_PKG_DIRS)).map(async (name) => {
157
- for (const dir of linked) {
158
- const manifest = await readJson(path.join(packagesDir, dir, "node_modules", name, "package.json"));
159
- if (typeof manifest?.version === "string") return [name, manifest.version];
160
- }
161
- return null;
162
- }));
163
- const pins = new Map(resolved.filter((entry) => entry !== null));
164
- if (pins.size === 0) return;
165
- const file = path.join(targetDir, "pnpm-workspace.yaml");
166
- let existing;
167
- try {
168
- existing = await fs.readFile(file, "utf-8");
169
- } catch {
170
- return;
171
- }
172
- const block = [...pins].sort(([a], [b]) => compareCodeUnits(a, b)).map(([name, version]) => ` "${name}": "${version}"`).join("\n");
173
- await fs.writeFile(file, `${existing.trimEnd()}\n\n# Added by \`aai init\` in DEV MODE only — see pinSharedDeps in\n# packages/aai-cli/src/_init.ts. The @alexkroman1/* packages above are LINKED to
174
- # this checkout, so anything they and this project both depend on has to be
175
- # ONE copy: two copies of xstate are two incompatible sets of types, and the
176
- # typecheck gate refuses the deploy.\noverrides:\n${block}\n`);
177
- }
178
- async function runInit(opts) {
179
- const { targetDir, template } = opts;
180
- await downloadAndMergeTemplate(template, targetDir);
181
- if (isDevMode()) {
182
- await patchPackageJsonForWorkspace(targetDir);
183
- try {
184
- await fs.unlink(path.join(targetDir, ".npmrc"));
185
- } catch {}
186
- }
187
- try {
188
- await fs.copyFile(path.join(targetDir, ".env.example"), path.join(targetDir, ".env"), fs.constants.COPYFILE_EXCL);
189
- } catch {}
190
- const readmePath = path.join(targetDir, "README.md");
191
- const slug = path.basename(path.resolve(targetDir));
192
- try {
193
- await fs.writeFile(readmePath, readmeContent(slug), { flag: "wx" });
194
- } catch (err) {
195
- if (!isEexist(err)) throw err;
196
- }
197
- }
198
- //#endregion
199
- export { runInit };
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env node
2
- import { plural } from "@alexkroman1/aai/utils";
3
- import { requiredProviderEnvVars } from "@alexkroman1/aai-runtime";
4
- //#region src/_preflight.ts
5
- /**
6
- * The deploy-time credential preflight — the classic dev/prod failure, caught
7
- * before the upload instead of at the deployed agent's first session.
8
- *
9
- * An agent that ran locally on shell-exported provider keys dies after deploy
10
- * with what looks like a provider outage: `aai dev` falls back to the shell
11
- * (`withHostCredentialFallback`), and the platform never will. Naming the key
12
- * here turns that into one line of output while the developer is still in the
13
- * directory that owns the `.env`.
14
- *
15
- * **This lives in the CLI because the agent's config does.** The platform
16
- * stores no description of a bundle and never evaluates one (see "The
17
- * platform stores no agent config" in packages/aai-server/CLAUDE.md), so the
18
- * only place that knows an agent needs `CARTESIA_API_KEY` is the process that
19
- * just built it.
20
- *
21
- * **It WARNS, and must not be turned into a hard failure.** The CLI sees the
22
- * env it is about to upload; it cannot see what is already stored against the
23
- * slug from an earlier `aai secret put`, so a key the platform holds looks
24
- * missing from here. The server-side check this replaced could see both and
25
- * so could reject — moving the config to where it is authored costs that
26
- * accuracy, and a false rejection is worse than a false warning: it blocks a
27
- * deploy that would have worked.
28
- */
29
- /**
30
- * Env var names the agent needs that the env being uploaded doesn't supply.
31
- * Empty values count as missing — an empty credential authenticates nothing.
32
- *
33
- * Two sources: provider credentials derived from the stt/llm/tts/s2s
34
- * descriptors (the same registry-backed derivation the runtime resolves keys
35
- * with), and the agent's own declared `requiredEnv` — an `agent()` field for
36
- * custom keys tools read from `ctx.env`, which no static derivation can see.
37
- */
38
- function missingCredentials(config, env) {
39
- return [.../* @__PURE__ */ new Set([...requiredProviderEnvVars(config), ...config.requiredEnv ?? []])].filter((name) => !env[name]);
40
- }
41
- /** One line naming the missing keys and what to do about them. */
42
- function missingCredentialMessage(missing) {
43
- return `Missing ${plural(missing.length, "credential")} the agent needs to start: ${missing.join(", ")}. Declare ${plural(missing.length, "it", "them")} in .env and redeploy (already set on the platform with \`aai secret put\`? then this is already handled).`;
44
- }
45
- //#endregion
46
- export { missingCredentialMessage, missingCredentials };
@@ -1,183 +0,0 @@
1
- #!/usr/bin/env node
2
- import { a as ok } from "./_output-DBP9Op_d.mjs";
3
- import { n as log, s as unwrapCancel } from "./_ui-DCt4qZrk.mjs";
4
- import { c as fileExists, d as readJson, p as resolveCwd, s as errorMessage, t as AGENT_ENTRY } from "./_utils-D5JGcjiW.mjs";
5
- import { r as isDevMode, t as getMonorepoRoot } from "./_agent-BzUeqOdj.mjs";
6
- import { listTemplates } from "./_templates-CuP74F8D.mjs";
7
- import path from "node:path";
8
- import { styleText } from "node:util";
9
- import * as p from "@clack/prompts";
10
- import { execa } from "execa";
11
- //#region src/init.ts
12
- /**
13
- * Run `fn` behind a clack spinner, stopping it in EVERY outcome.
14
- *
15
- * The naked form (`s?.start(); await work(); s?.stop()`) leaks the spinner on a
16
- * failure: clack keeps its interval and its raw-mode stdin hook, so a throw
17
- * left a spinner ticking under the error message with the cursor hidden. The
18
- * `catch` label is what the terminal is left showing, so it names the step.
19
- */
20
- async function withSpinner(silent, labels, fn) {
21
- const s = silent ? void 0 : p.spinner();
22
- s?.start(labels.start);
23
- let succeeded = false;
24
- try {
25
- const value = await fn();
26
- succeeded = true;
27
- return value;
28
- } finally {
29
- s?.stop(succeeded ? labels.done : labels.failed);
30
- }
31
- }
32
- const DEFAULT_PROJECT_NAME = "my-voice-agent";
33
- /** Prompt for project name or return default when --yes is set. */
34
- async function promptProjectName(yes) {
35
- if (yes) return DEFAULT_PROJECT_NAME;
36
- return unwrapCancel(await p.text({
37
- message: "What is your project named?",
38
- placeholder: DEFAULT_PROJECT_NAME,
39
- defaultValue: DEFAULT_PROJECT_NAME
40
- }), "Setup cancelled") || DEFAULT_PROJECT_NAME;
41
- }
42
- /**
43
- * The template a non-interactive `init` gets, and the entry the selector opens
44
- * on — so an author who just presses Enter lands where they used to.
45
- */
46
- const DEFAULT_TEMPLATE = "simple";
47
- /**
48
- * Ask which template to scaffold, listing what this CLI actually ships.
49
- *
50
- * The options are derived from {@link listTemplates} rather than a roster kept
51
- * here: that function already backs `aai templates` AND the unknown-template
52
- * error, so a template added to the package shows up in the picker with no
53
- * second list to update. {@link DEFAULT_TEMPLATE} is hoisted to the top and
54
- * pre-selected, which is what keeps a bare `aai init` a single Enter away from
55
- * the project it produced before there was a picker.
56
- *
57
- * Callers must not reach here when there is nobody to answer — `--yes` and
58
- * JSON mode (auto-detected on a pipe) resolve the default without prompting.
59
- */
60
- async function promptTemplate(list = listTemplates) {
61
- const [first, ...rest] = await list();
62
- if (first === void 0) return DEFAULT_TEMPLATE;
63
- if (rest.length === 0) return first;
64
- const names = [first, ...rest];
65
- const hasDefault = names.includes(DEFAULT_TEMPLATE);
66
- const ordered = hasDefault ? [DEFAULT_TEMPLATE, ...names.filter((name) => name !== DEFAULT_TEMPLATE)] : names;
67
- return unwrapCancel(await p.select({
68
- message: "Which template?",
69
- maxItems: 12,
70
- initialValue: hasDefault ? DEFAULT_TEMPLATE : first,
71
- options: ordered.map((name) => name === DEFAULT_TEMPLATE ? {
72
- value: name,
73
- hint: "the default starting point"
74
- } : { value: name })
75
- }), "Setup cancelled");
76
- }
77
- /** Best-effort corepack enable so pnpm is available (scaffold declares packageManager: pnpm). */
78
- async function ensurePnpm() {
79
- await execa("corepack", ["enable"], { reject: false });
80
- }
81
- /** Check if the project has any dependencies to install. */
82
- async function hasDeps(cwd) {
83
- if (await fileExists(path.join(cwd, "node_modules"))) return false;
84
- const pkgJson = await readJson(path.join(cwd, "package.json")) ?? {};
85
- const deps = Object.keys(pkgJson.dependencies ?? {});
86
- const devDeps = Object.keys(pkgJson.devDependencies ?? {});
87
- return deps.length > 0 || devDeps.length > 0;
88
- }
89
- /** Check whether the safe-chain binary is on PATH. */
90
- async function hasSafeChain() {
91
- const { failed } = await execa("safe-chain", ["--version"], { reject: false });
92
- return !failed;
93
- }
94
- /** Build the command + args for running pnpm, routing through safe-chain when available. */
95
- async function resolvePnpmCommand(checkSafeChain = hasSafeChain) {
96
- if (await checkSafeChain()) return {
97
- cmd: "safe-chain",
98
- args: ["pnpm", "--safe-chain-skip-minimum-package-age"]
99
- };
100
- return {
101
- cmd: "pnpm",
102
- args: []
103
- };
104
- }
105
- /** Run pnpm install and warn on failure. */
106
- async function runPnpmInstall(cwd) {
107
- const { cmd, args } = await resolvePnpmCommand();
108
- const pnpmArgs = isDevMode() ? ["install"] : ["install", "--ignore-workspace"];
109
- await execa(cmd, [...args, ...pnpmArgs], { cwd });
110
- }
111
- /**
112
- * Install deps with pnpm, reporting a failure through `warn` rather than
113
- * throwing: the project is scaffolded either way, and the two warnings say how
114
- * to finish the install by hand. Nothing downstream branches on the outcome —
115
- * `init` stops here — so it returns nothing.
116
- */
117
- async function installDeps(cwd, warn, silent) {
118
- if (!await hasDeps(cwd)) return;
119
- await ensurePnpm();
120
- try {
121
- await withSpinner(silent, {
122
- start: "Installing dependencies with pnpm",
123
- done: "Dependencies installed",
124
- failed: "Dependency install failed"
125
- }, () => runPnpmInstall(cwd));
126
- } catch (err) {
127
- warn(`pnpm install failed: ${errorMessage(err)}`);
128
- warn("Install pnpm (`npm install -g pnpm`), then run `pnpm install` in the project.");
129
- }
130
- }
131
- /** Resolve target directory relative to the user's current directory. */
132
- function resolveTargetDir(dir) {
133
- return path.resolve(resolveCwd(), dir);
134
- }
135
- function collectWarnings() {
136
- const warnings = [];
137
- return {
138
- warnings,
139
- warn: (message) => {
140
- warnings.push(message);
141
- log.warn(message);
142
- }
143
- };
144
- }
145
- /** Scaffold the project, optionally showing a spinner. */
146
- async function scaffoldProject(dir, cwd, template, silent) {
147
- const { runInit } = await import("./_init-BzQbV8Zh.mjs");
148
- await withSpinner(silent, {
149
- start: `Creating ${dir}`,
150
- done: "Project created",
151
- failed: `Could not create ${dir}`
152
- }, () => runInit({
153
- targetDir: cwd,
154
- template
155
- }));
156
- }
157
- /** Print post-init instructions. */
158
- function printPostInitInfo(cwd, monorepoRoot) {
159
- log.success(`Created ${cwd}`);
160
- if (monorepoRoot) log.info("Dev mode: project linked to workspace packages");
161
- log.info(`Next: cd ${cwd} && aai dev`);
162
- }
163
- async function executeInit(opts, extra) {
164
- const suppressUi = extra?.silent;
165
- if (!suppressUi) p.intro(styleText("cyanBright", "Create a new voice agent"));
166
- const dir = opts.dir ?? await promptProjectName(opts.yes);
167
- const monorepoRoot = getMonorepoRoot();
168
- const cwd = resolveTargetDir(dir);
169
- if (!opts.force && await fileExists(path.join(cwd, "agent.ts"))) throw new Error(`${AGENT_ENTRY} already exists in this directory. Use ${styleText("cyanBright", "--force")} to overwrite.`);
170
- const template = opts.template ?? (opts.yes || suppressUi ? DEFAULT_TEMPLATE : await promptTemplate());
171
- const { warn, warnings } = collectWarnings();
172
- await scaffoldProject(dir, cwd, template, suppressUi);
173
- await installDeps(cwd, warn, suppressUi);
174
- if (!suppressUi) printPostInitInfo(cwd, monorepoRoot);
175
- const data = {
176
- dir: cwd,
177
- template
178
- };
179
- if (warnings.length > 0) data.warnings = warnings;
180
- return ok(data);
181
- }
182
- //#endregion
183
- export { executeInit };
@@ -1,15 +0,0 @@
1
- import { agent } from "@alexkroman1/aai";
2
-
3
- export default agent({
4
- name: "Dr. Sage",
5
- greeting:
6
- "Hey, I'm Dr. Sage. Try asking me something like, what are the side effects of ibuprofen, can I take aspirin and warfarin together, or calculate my BMI. Just remember, I'm not a real doctor, so always check with your healthcare provider.",
7
- // Three builtins, and `fetch_json` is the one worth explaining: `fda.ts`
8
- // already reaches openFDA's LABEL endpoint in tool code, and a label is the
9
- // manufacturer's text. What the two tools cannot answer is what people
10
- // actually REPORT, which lives in a different dataset (`/drug/event.json`)
11
- // and is a counting query rather than a lookup — so it is the model's to
12
- // compose, not a fixed tool's. `system-prompt.md` holds the endpoint and the
13
- // caveat that a report count is not an incidence rate.
14
- builtinTools: ["web_search", "run_code", "fetch_json"],
15
- });