@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
@@ -2,7 +2,8 @@ import { agent } from "@alexkroman1/aai";
2
2
  import { anthropicLlm } from "@alexkroman1/aai/llm";
3
3
 
4
4
  export default agent({
5
- name: "pipeline-simple",
5
+ name: "Custom Pipeline Assistant",
6
+ description: "Answers general questions on a pipeline whose stages you swap one at a time",
6
7
  greeting: "Hi! I'm running in pipeline mode. What can I help with?",
7
8
  // Declare only the stage you want elsewhere — here the LLM. Every stage
8
9
  // left unset (STT and TTS here) runs on the AssemblyAI default, billed to
@@ -84,7 +84,7 @@ describe("three modes, three arms", () => {
84
84
 
85
85
  test("the preset takes OPTIONS — one setting across the three stages at once", () => {
86
86
  // That a bare `assemblyAIPipeline()` is exactly what an undeclared agent gets
87
- // filled with is `simple`'s claim, and it stays there. This is the half that
87
+ // filled with is `quickstart-agent`'s claim, and it stays there. This is the half that
88
88
  // template only points at: the options bag, which is the reason to reach for
89
89
  // the preset rather than let the default fill happen. `region` applies to STT
90
90
  // and the LLM gateway together, so a residency choice is made once instead of
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A WORKFLOW APP — LangGraph's reflection agent, as a thing you submit work to.
3
3
  *
4
- * `link-digest` owns the shape and is the one to read first (`workflowApp()`, no
4
+ * `link-digest-workflow` owns the shape and is the one to read first (`workflowApp()`, no
5
5
  * session, no tools, a form that starts a run and a page that watches it), and
6
6
  * none of that is restated here. What this one is FOR is the mechanism in
7
7
  * `workflows/redline.ts`: write a piece — or take one the author attached —
@@ -15,7 +15,7 @@
15
15
  * holds a phone for that, and nothing useful can be said down the line while it
16
16
  * happens — the interesting output is a piece of prose to READ, not two
17
17
  * sentences to hear. The same test sorts the other ports in this repo:
18
- * `travel-concierge`, `support-line` and `plan-and-execute` all answer a caller inside a
18
+ * `travel-concierge-agent`, `technical-support-agent` and `research-planner-agent` all answer a caller inside a
19
19
  * turn, so they are voice agents; this one and `transcription-workflow` produce a
20
20
  * document, so they are pages over durable runs.
21
21
  *
@@ -103,6 +103,8 @@ export const redline = workflow({
103
103
 
104
104
  export default workflowApp({
105
105
  name: "Redline",
106
+ description:
107
+ "Takes a brief or a draft and returns a piece that has been through rounds of critique",
106
108
  workflows: { redline },
107
109
  // Checked at deploy time, so a missing key is a warning naming it rather than
108
110
  // a run that fails on its first step.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The redline desk's page: a form, the loop turning, and the piece it produced.
3
3
  *
4
- * `link-digest` shows the workflow primitives raw and `transcription-workflow` shows
4
+ * `link-digest-workflow` shows the workflow primitives raw and `transcription-workflow` shows
5
5
  * the form layer over them; this page is the MIXED case, which is what most real
6
6
  * schemas need and what neither of those has.
7
7
  *
@@ -3,7 +3,7 @@
3
3
  * whose length the CRITIC decides.
4
4
  *
5
5
  * The rules a workflow body lives under are spelled out in
6
- * `research-workflow/workflows/research.ts` and `link-digest/workflows/digest.ts`:
6
+ * `research-handoff-agent/workflows/research.ts` and `link-digest-workflow/workflows/digest.ts`:
7
7
  * the body is replayed from the top on every resume, so it holds no live handle
8
8
  * and makes no undurable decision, and a step's arguments and result cross a
9
9
  * queue. Read those first. What THIS one adds is the shape neither of them has:
@@ -21,6 +21,7 @@ import {
21
21
  } from "@alexkroman1/aai/testing";
22
22
  import { describe, expect, test, vi } from "vitest";
23
23
  import { DISPATCH_EVENTS } from "./events.ts";
24
+ import { claimsUnitsMoving } from "./guardrails.ts";
24
25
  import { callFlow, callSpec, dispatchSlot } from "./shared.ts";
25
26
  import incidentAddNote from "./tools/incident_add_note.ts";
26
27
  import incidentCreate from "./tools/incident_create.ts";
@@ -59,7 +60,7 @@ async function createIncidentFor(
59
60
  return result.incidentId;
60
61
  }
61
62
 
62
- describe("dispatch-center template", () => {
63
+ describe("emergency-dispatch-agent template", () => {
63
64
  test("resolving an incident does not yank a reassigned unit off its new incident", async () => {
64
65
  const ctx = createToolContext();
65
66
 
@@ -471,3 +472,105 @@ describe("a dropped 911 call", () => {
471
472
  expect(Object.keys(dispatchSlot.get(ctx).incidents)).toEqual([]);
472
473
  });
473
474
  });
475
+
476
+ describe("the desk's own output guardrail", () => {
477
+ /**
478
+ * The guardrail as the runtime runs it: the list off the DEF, not off the
479
+ * resolved config.
480
+ *
481
+ * `outputGuardrails` is host-only — `toAgentConfig` strips it with `tools`,
482
+ * `events` and `dialogs`, because a function cannot cross the wire — so
483
+ * `expectDeployable` has nothing to say about it and the check that it is
484
+ * wired at all has to be this one. Looked up and CHECKED rather than reached
485
+ * through `?.[0]`, for the reason `hangUpOn` is: a def that lost the field
486
+ * would leave every assertion below passing against nothing.
487
+ */
488
+ function say(ctx: ToolContext, text: string): true | string {
489
+ const [guardrail, ...rest] = dispatchAgent.outputGuardrails ?? [];
490
+ if (guardrail === undefined) throw new Error("the def declares no outputGuardrails");
491
+ // One rule, deliberately: a second one would be judged here and asserted
492
+ // nowhere. Adding one is a real edit and should say so by failing.
493
+ if (rest.length > 0) throw new Error(`the def declares ${rest.length + 1} outputGuardrails`);
494
+ const verdict = guardrail(text, ctx);
495
+ // Synchronous by construction here — it reads the board and a regex. An
496
+ // awaited promise would make the assertions below pass on `{}`.
497
+ if (typeof verdict === "object") throw new Error("this guardrail must not be async");
498
+ return verdict;
499
+ }
500
+
501
+ test("blocks 'units are on the way' while nothing is assigned, naming the tool", async () => {
502
+ const ctx = createToolContext();
503
+ await createIncidentFor(ctx);
504
+
505
+ const verdict = say(ctx, "Copy that. Medic-1 is en route, ETA four minutes.");
506
+
507
+ expect(verdict).not.toBe(true);
508
+ // The verdict is SPOKEN in place of the reply, so it has to be usable to
509
+ // the dispatcher hearing it — which means naming what to do, not what went
510
+ // wrong.
511
+ expect(verdict).toMatch(/resources_dispatch/);
512
+ });
513
+
514
+ test("passes the same sentence once a unit really is assigned", async () => {
515
+ const ctx = createToolContext();
516
+ const incidentId = await createIncidentFor(ctx);
517
+ expectToolOk(await resourcesDispatch.execute({ incidentId, callsigns: ["Medic-1"] }, ctx));
518
+
519
+ // The STATE half is the whole point: the same words are a lie on one board
520
+ // and a report on the other, and only the board can tell them apart.
521
+ expect(say(ctx, "Copy that. Medic-1 is en route, ETA four minutes.")).toBe(true);
522
+ });
523
+
524
+ test("lets the desk SAY that nothing is rolling", async () => {
525
+ const ctx = createToolContext();
526
+ await createIncidentFor(ctx);
527
+
528
+ // The false positive that would matter most: on a shift with nothing
529
+ // assigned, "no units are en route yet" is the truthful sentence and is
530
+ // exactly the one a keyword filter blocks.
531
+ expect(say(ctx, "Negative — no units are en route yet.")).toBe(true);
532
+ expect(say(ctx, "I'll get Engine-7 rolling once you confirm the address.")).toBe(true);
533
+ });
534
+
535
+ test("claimsUnitsMoving is biased toward missing a claim, never toward a false block", () => {
536
+ // The detector alone, away from the board — the half worth pinning, since
537
+ // the guardrail around it is two branches.
538
+ expect(claimsUnitsMoving("Engine-7 is on the way.")).toBe(true);
539
+ expect(claimsUnitsMoving("Units are responding now.")).toBe(true);
540
+
541
+ expect(claimsUnitsMoving("Nothing is rolling yet.")).toBe(false);
542
+ expect(claimsUnitsMoving("Once Medic-2 is en route I'll update you.")).toBe(false);
543
+ expect(
544
+ claimsUnitsMoving("Confirmed, 400 Oak Street. What's the nature of the emergency?"),
545
+ ).toBe(false);
546
+
547
+ // Per SENTENCE, so a hedge in one clause does not excuse the next.
548
+ expect(claimsUnitsMoving("No one is assigned yet. Ladder-2 is inbound.")).toBe(true);
549
+ });
550
+
551
+ test("a NEGATED claim is not a claim — the contraction is the whole hedge", () => {
552
+ // `\bn't\b` cannot match: there is no word boundary between the `n` and the
553
+ // `'` of "isn't", so that alternative was dead and every one of these read
554
+ // as a claim — the guardrail speaking a correction over a dispatcher who
555
+ // said the true thing, which inverts this file's stated bias. Each sentence
556
+ // here carries the contraction and NO other hedge, so a `NOT_A_CLAIM` that
557
+ // cannot see one fails on it.
558
+ expect(claimsUnitsMoving("Medic-1 isn't en route.")).toBe(false);
559
+ expect(claimsUnitsMoving("Engine-7 wasn't rolling.")).toBe(false);
560
+ expect(claimsUnitsMoving("I can't confirm anyone is responding.")).toBe(false);
561
+ expect(claimsUnitsMoving("We don't have anyone inbound.")).toBe(false);
562
+ // The typographic apostrophe a model writes as readily as the straight one.
563
+ expect(claimsUnitsMoving("Medic-1 isn\u2019t en route.")).toBe(false);
564
+ });
565
+
566
+ test("the desk can say a negated one out loud, on a board with nothing assigned", async () => {
567
+ const ctx = createToolContext();
568
+ await createIncidentFor(ctx);
569
+
570
+ // The end-to-end shape of the same bug: a true sentence, spoken over. No
571
+ // other hedge in either — take the contraction out and the desk is
572
+ // corrected for reporting the board accurately.
573
+ expect(say(ctx, "Negative — Medic-1 isn't en route.")).toBe(true);
574
+ expect(say(ctx, "We don't have anyone inbound.")).toBe(true);
575
+ });
576
+ });
@@ -1,9 +1,11 @@
1
1
  import { agent } from "@alexkroman1/aai";
2
2
  import { DISPATCH_EVENTS } from "./events.ts";
3
+ import { DISPATCH_GUARDRAILS } from "./guardrails.ts";
3
4
  import { callFlow, dashboardProjection } from "./shared.ts";
4
5
 
5
6
  export default agent({
6
7
  name: "Dispatch Command Center",
8
+ description: "Runs a 911 dispatch shift: logs incidents, triages them, and assigns units",
7
9
 
8
10
  /**
9
11
  * Declaring the flow is what makes its instructions reach a turn that calls
@@ -42,6 +44,19 @@ export default agent({
42
44
  */
43
45
  events: DISPATCH_EVENTS,
44
46
 
47
+ /**
48
+ * The desk's own last check on itself, and the third of the three things
49
+ * `agent()` can declare about a turn — the gates decide which tools are
50
+ * LEGAL, `events` OBSERVES what happens, and this is the only one that can
51
+ * stop the desk speaking.
52
+ *
53
+ * One rule, and it is the one the tool gates structurally cannot hold: never
54
+ * say help is coming before a unit has been assigned. See `guardrails.ts`,
55
+ * which also carries what the hold costs and why a desk that talks in radio
56
+ * traffic can afford it.
57
+ */
58
+ outputGuardrails: DISPATCH_GUARDRAILS,
59
+
45
60
  // The system prompt instructs the model to use web_search and run_code, so
46
61
  // they must be enabled here — the default builtin set does not include them.
47
62
  builtinTools: ["think", "remember", "recall", "calculate", "web_search", "run_code"],
@@ -11,7 +11,7 @@ import { callInHand, dispatchSlot, logEvent } from "./shared.ts";
11
11
  * how an agent observes its own stream.
12
12
  *
13
13
  * **The dialog deliberately does NOT move on it, and that is the difference
14
- * between this desk and a phone desk.** `retail` and `roadside-assist` both
14
+ * between this desk and a phone desk.** `retail-orders-agent` and `roadside-assistance-agent` both
15
15
  * carry `"@session.timed-out"` into a `final` state, because there the caller
16
16
  * IS the conversation and a hang-up ends it. Here the caller is one input to a
17
17
  * shift: units are rolling, the board is live, and the dispatcher goes on
@@ -0,0 +1,105 @@
1
+ import type { AgentGuardrail } from "@alexkroman1/aai";
2
+ import { callInHand, dispatchSlot } from "./shared.ts";
3
+
4
+ /**
5
+ * The one rule on this desk that the tool gates cannot hold: **never say help
6
+ * is coming before a unit has been assigned.**
7
+ *
8
+ * Everything else here is enforced structurally. Six mutating tools refuse
9
+ * until something has been logged, every one of them is addressed by incident
10
+ * id, and `callFlow`'s `dispatching` state says "never leave a critical
11
+ * incident without at least one" on every turn. None of that reaches the
12
+ * SPEECH: a model that has been told to dispatch and has not can still tell the
13
+ * room that Medic-1 is rolling, and the gates have nothing to say about it,
14
+ * because no tool ran. That is the hole `outputGuardrails` closes — it is the
15
+ * only declaration on an agent that can stop a turn, and `agent({ events })`
16
+ * deliberately cannot (a handler's return value is ignored).
17
+ *
18
+ * **It is pipeline-mode only, and refused at config time in the other two.**
19
+ * S2S synthesizes provider-side, so the words reach this runtime after the
20
+ * caller has heard them; text mode hands its caller the model stream directly
21
+ * and owns no point at which to hold a reply. `agent-guardrails.ts` argues
22
+ * both.
23
+ *
24
+ * ## What it costs, and why this desk can pay it
25
+ *
26
+ * A reply that has to be judged whole cannot be spoken as it arrives, so
27
+ * declaring one trades time-to-first-word for the check — the whole reply is
28
+ * held until the model finishes. That is a real regression on a live call and
29
+ * it is not free here either. What makes it bearable is the shape of this
30
+ * agent's speech: `system-prompt.md` asks for radio traffic ("Medic-1, respond
31
+ * priority one to 400 Oak Street"), so a reply is one or two short lines rather
32
+ * than a paragraph, and the dead-air cover is exempt from the hold and fills
33
+ * the gap exactly as it does during a tool chain.
34
+ *
35
+ * A desk that spoke at length would be the wrong place for this. The test is
36
+ * whether the sentence being checked is worth waiting for the whole of, and on
37
+ * a dispatch floor it is.
38
+ */
39
+ export const DISPATCH_GUARDRAILS: readonly AgentGuardrail[] = [
40
+ (text, ctx) => {
41
+ // The STATE half, and it is what keeps this from being a keyword filter: an
42
+ // `AgentSessionContext` carries `slots`, so the check can ask the board
43
+ // whether the claim is true rather than whether the sentence looks bad.
44
+ // `callInHand` is the same reading of "which incident" that `events.ts`
45
+ // uses for a dropped call — the most recently touched open one.
46
+ const incident = callInHand(dispatchSlot.get(ctx));
47
+ if (incident !== undefined && incident.assignedResources.length > 0) return true;
48
+ if (!claimsUnitsMoving(text)) return true;
49
+ return (
50
+ "Correction — nothing is rolling on that call yet. Assign a unit with " +
51
+ "resources_dispatch, then say so."
52
+ );
53
+ },
54
+ ];
55
+
56
+ /** One sentence at a time, so a hedge in one clause does not excuse the next. */
57
+ const SENTENCES = /[^.!?]+[.!?]?/g;
58
+
59
+ /** The desk asserting that something is already moving. */
60
+ const MOVING = /\b(?:on (?:the|their) way|en ?route|rolling|responding|inbound|underway)\b/i;
61
+
62
+ /**
63
+ * Words that make the same sentence a denial, a condition or a plan rather than
64
+ * a claim — "no units are en route yet", "once Medic-1 is rolling", "I'll get
65
+ * someone responding".
66
+ *
67
+ * **The contractions sit OUTSIDE the leading `\b`, and that is not a style
68
+ * choice.** `\bn't\b` can never match: `\b` is a boundary between a word
69
+ * character and a non-word one, and there is none between the `n` and the `'`
70
+ * of "isn't". The alternative was dead for as long as it was written that way,
71
+ * so "Medic-1 isn't en route" read as a CLAIM and the desk was corrected for
72
+ * saying the true thing — the exact inversion of this file's stated bias. Every
73
+ * other alternative begins and ends with a word character, so the shared `\b`
74
+ * pair is right for them; `n't` and `'ll` carry the boundary they actually
75
+ * have, which is the trailing one. The curly apostrophe is accepted too: a model
76
+ * writes "isn’t" often enough, and a guardrail that misses the typographic form
77
+ * is the same bug in a different font.
78
+ *
79
+ * `n['’]t` also covers "won't", "can't" and "doesn't", none of which any other
80
+ * alternative here reaches.
81
+ */
82
+ const NOT_A_CLAIM =
83
+ /(?:\b(?:no|not|none|nothing|never|nobody|yet|once|when|if|until|before|after|will|going to|need|should|about to)|n['’]t|['’]ll)\b/i;
84
+
85
+ /**
86
+ * Does this reply tell the room that units are already moving?
87
+ *
88
+ * A keyword heuristic, and the bias is deliberate: `NOT_A_CLAIM` is broad, so
89
+ * the check MISSES a claim far more often than it blocks an innocent sentence.
90
+ * That is the right way round for a guardrail whose verdict is spoken over the
91
+ * top of a dispatcher — a missed claim leaves the desk where it was, and a
92
+ * false block interrupts a shift with a correction that is not true.
93
+ *
94
+ * The state gate above is what makes the false-positive rate tolerable at all:
95
+ * this function is only ever consulted on an incident with nothing assigned to
96
+ * it, which on a working shift is a minority of turns.
97
+ *
98
+ * Exported because it is the half worth testing directly — the guardrail around
99
+ * it is two branches over the board.
100
+ */
101
+ export function claimsUnitsMoving(text: string): boolean {
102
+ return (text.match(SENTENCES) ?? []).some(
103
+ (sentence) => MOVING.test(sentence) && !NOT_A_CLAIM.test(sentence),
104
+ );
105
+ }
@@ -32,6 +32,7 @@ Operational rules:
32
32
  - Location is always the first priority in any emergency call
33
33
  - Critical incidents get immediate dispatch, triage can happen simultaneously
34
34
  - Never leave a critical incident without at least one resource dispatched
35
+ - Never say units are moving until resources_dispatch has actually assigned one. The desk checks this before it speaks: a reply that claims help is rolling on an incident with nothing on it is replaced by a correction the room hears instead
35
36
  - Monitor resource utilization. If it exceeds 65 percent, warn about degraded capacity
36
37
  - At red alert level, recommend mutual aid from neighboring jurisdictions
37
38
  - Track time on all incidents. Escalate if critical incidents have no on-scene resources within 8 minutes
@@ -15,7 +15,7 @@ import {
15
15
  /**
16
16
  * **Not a `callFlow.tool`, deliberately.** A new 911 call is legal in every
17
17
  * state, so a `when` listing all of them would be a gate that gates nothing —
18
- * the same call `plan-and-execute`'s `start_plan` makes. It sends `LOGGED`
18
+ * the same call `research-planner-agent`'s `start_plan` makes. It sends `LOGGED`
19
19
  * itself, which is what `dialog.send` is public for, and reports the position it
20
20
  * landed in so the model reads "confirm the severity and type" as part of this
21
21
  * result rather than having to remember it from the prompt.
@@ -32,6 +32,7 @@ import {
32
32
  createVmRunCode,
33
33
  customEventsIn,
34
34
  describeTurn,
35
+ expectCalled,
35
36
  lastStateIn,
36
37
  runCodeIn,
37
38
  runCodeOutput,
@@ -133,6 +134,12 @@ describeEval(
133
134
  await session.say("I want something cozy to watch tonight.");
134
135
  const turn = await session.say("Now give me something spooky to read.");
135
136
 
137
+ // `expectCalled` first, because "the host named something out of its own
138
+ // head and ended the turn" is how this case actually fails — the night's
139
+ // log stays empty and `revisit` has nothing to find. It reports the
140
+ // sentence spoken in place of the call, where `expected [] to deeply
141
+ // equal [ 'recommend' ]` reported neither.
142
+ expectCalled(turn, "recommend");
136
143
  expect(toolNames(turn.toolCalls)).toEqual(["recommend"]);
137
144
  expect(turn.toolCalls[0]!.args).toEqual({ category: "book", mood: "spooky" });
138
145
 
@@ -229,7 +236,7 @@ describeEval(
229
236
  // about a companion that talked its way through the sum instead, and it
230
237
  // names a cancelled reply, which is the usual reason a turn reached for
231
238
  // nothing.
232
- expect(toolNames(turn.toolCalls), describeTurn(turn)).toContain("run_code");
239
+ expectCalled(turn, "run_code");
233
240
  // The recipe is the prompt's, and it is two constants: a 90-minute cycle
234
241
  // plus the 15 minutes it takes to fall asleep. Arithmetic done in the
235
242
  // model's head has neither of them anywhere in the code. `runCodeIn`
@@ -39,7 +39,7 @@ type RecommendResult = InferToolOutput<typeof recommend>;
39
39
  */
40
40
  const run = toolRunner(agentDef);
41
41
 
42
- describe("night-owl template", () => {
42
+ describe("entertainment-picks-agent template", () => {
43
43
  test("is deployable: validates, is nameable, and every stage its mode needs is filled", () => {
44
44
  // The same conversion `aai build`/`aai deploy` run. `expectDeployable`
45
45
  // rather than `expect(() => toAgentConfig(…)).not.toThrow()`: that spelling
@@ -3,6 +3,7 @@ import { nightProjection } from "./shared.ts";
3
3
 
4
4
  export default agent({
5
5
  name: "Night Owl",
6
+ description: "Recommends films, music and books for the evening, and works out when to go to bed",
6
7
  // The night's recommendation log, pushed to the client after every tool
7
8
  // call. The page renders `useAgentState(nightProjection)` and keeps no copy
8
9
  // of its own, so a reload resumes with the list intact.
@@ -4,7 +4,7 @@
4
4
  * The recommendation LOG is state: the agent owns it in a `sessionSlot`,
5
5
  * `syncState` projects it, and `useAgentState(nightProjection)` reads it. The
6
6
  * page stores no copy, so a reload resumes with every pick still there. That is
7
- * the pattern to reach for by default — see `pizza-ordering` for the same shape
7
+ * the pattern to reach for by default — see `pizza-ordering-agent` for the same shape
8
8
  * over a shopping cart.
9
9
  *
10
10
  * The "recommending…" flash and the wind-down nudge are MOMENTS someone else
@@ -2,6 +2,12 @@ You are Night Owl, a cozy evening companion. You help people wind down,
2
2
  recommend entertainment, and share interesting facts about the night sky. Keep
3
3
  your tone warm and relaxed. Use short, conversational responses.
4
4
 
5
+ Every recommendation goes through the recommend tool — call it, then say what
6
+ it gave you. Naming something out of your own head instead leaves the night's
7
+ log empty, so the sidebar shows nothing and revisit has nothing to find later.
8
+ Call it before you speak: saying the title first ends your turn and the pick is
9
+ never recorded.
10
+
5
11
  When someone asks about something you already recommended tonight, look it up
6
12
  with revisit and pass along their own words — never recall it from memory.
7
13
 
@@ -43,6 +43,13 @@ export default nightSlot.tool({
43
43
  // Two words the listener can name, scored independently: "the spooky
44
44
  // books" beats a spooky MOVIE and a cozy BOOK, and "the spooky ones"
45
45
  // ties them — which is a refusal that asks, not a coin flip.
46
+ //
47
+ // A hand-written scorer where four sibling templates use `resolveOne`'s
48
+ // built-in `match`, and deliberately: a listener says "books" where the
49
+ // field says `book`, and the built-in matches whole WORDS on both sides
50
+ // with no stemming, so the plural would score nothing and every category
51
+ // would tie. Substring containment against two NAMED fields is the
52
+ // domain fact here, which is exactly what `score` is kept for.
46
53
  score: (rec, text) =>
47
54
  (text.includes(rec.mood) ? 1 : 0) + (text.includes(rec.category) ? 1 : 0),
48
55
  }),
@@ -23,8 +23,10 @@
23
23
  import agentDef from "virtual:aai/agent";
24
24
  import { dialogRefusalPattern } from "@alexkroman1/aai/testing";
25
25
  import {
26
+ describeToolCalls,
26
27
  describeTurn,
27
28
  type EvalSession,
29
+ expectCalled,
28
30
  lastStateIn,
29
31
  statesIn,
30
32
  toolCallsInTurns,
@@ -70,17 +72,37 @@ const DRAFT =
70
72
  describeEval(agentDef, (test) => {
71
73
  test(
72
74
  "the call opens with a triage, and a triage sends nothing",
73
- async ({ session }) => {
75
+ async ({ session, mode }) => {
74
76
  const turn = await session.say("Morning. What came in?");
75
- expect(toolNames(turn.toolCalls), describeTurn(turn)).toContain("triage_inbox");
76
- // Their `route_after_triage`: two `no`s filed on the spot, six queued.
77
+ expectCalled(turn, "triage_inbox");
78
+ // Their `route_after_triage` routed EVERY email: nothing is left
79
+ // `untriaged`. `open` is allowed because a desk that went on to open the
80
+ // first one has still triaged all eight, and whether it opens unprompted
81
+ // is the next case's business rather than this one's.
77
82
  const view = latest(session);
78
- expect(view?.emails.filter((e) => e.status === "closed")).toHaveLength(2);
79
- expect(view?.emails.filter((e) => e.status === "queued")).toHaveLength(6);
80
- // Triage is not a proposal, and nothing was sent by reading the inbox.
81
- expect(view?.proposal).toBeNull();
83
+ expect(view?.emails).toHaveLength(TRIAGE_SCRIPT.length);
84
+ expect(
85
+ view?.emails.every((e) => e.status !== "untriaged"),
86
+ describeTurn(turn),
87
+ ).toBe(true);
88
+ // The exact split is the TRIAGE model's judgment — one verdict per email,
89
+ // eight of them — so it is pinned only where `TRIAGE_SCRIPT` determines
90
+ // it. Live it drifts: a run that filed nothing failed this case on "expected
91
+ // [] to have a length of 2", which reads as broken routing rather than as
92
+ // a model that found every email worth answering.
93
+ if (mode === "stub") {
94
+ expect(view?.emails.filter((e) => e.status === "closed")).toHaveLength(2);
95
+ expect(view?.emails.filter((e) => e.status === "queued")).toHaveLength(6);
96
+ }
97
+ // THE claim, and the one this case is named for: reading the inbox sent
98
+ // nothing. Live, that is all it asserts.
82
99
  expect(view?.sent).toEqual([]);
83
100
  expect(toolNames(turn.toolCalls)).not.toContain("accept");
101
+ // A triage is not a proposal — true of the SCRIPT, which runs `triage_inbox`
102
+ // and stops. A live desk that opened the first email as well has staged a
103
+ // proposal and still sent nothing, so pinning this live measured its
104
+ // helpfulness rather than the gate.
105
+ if (mode === "stub") expect(view?.proposal).toBeNull();
84
106
  },
85
107
  {
86
108
  stubReply: [
@@ -94,18 +116,37 @@ describeEval(agentDef, (test) => {
94
116
  test(
95
117
  "a draft is staged and read back, and nothing is sent before a yes",
96
118
  async ({ session }) => {
97
- const turn = await session.say(
119
+ // Two turns, and the second only repeats the instruction the first
120
+ // carried. The desk opens the email and then usually SPEAKS — one tool
121
+ // per reply is the live model's median — so reading both calls out of a
122
+ // single turn measured that rather than the gate. Nothing below cares
123
+ // which turn the staging landed in: the claim is that staging produced a
124
+ // READ-BACK and not a receipt, and that nothing was sent without a yes.
125
+ //
126
+ // The nudge is worded twice over. "Go ahead and draft that reply" reads as
127
+ // APPROVAL to a live model, which answered it with `accept` — passing the
128
+ // chain and failing the one assertion this case exists for. "Draft it, but
129
+ // do not send anything yet" fixed that and cost the other half: the desk
130
+ // heard the negation and did nothing at all, and a bare "write that reply
131
+ // for me" was no better. What works is an instruction to ACT that names
132
+ // the reply AND its content while saying nothing about sending — there is
133
+ // no yes in it to mishear, and nothing to read as "wait".
134
+ const turns = await session.sayAll([
98
135
  "Open the one from Dana at Northwind and reply that yes, inference stays inside their VPC.",
99
- );
100
- const names = toolNames(turn.toolCalls);
101
- expect(names, describeTurn(turn)).toContain("open_email");
102
- expect(names).toContain("draft_reply");
136
+ "Write the reply now — say yes, it stays inside their VPC.",
137
+ ]);
138
+ const calls = toolCallsInTurns(turns);
139
+ const names = toolNames(calls);
140
+ // Across BOTH turns, and named: "expected [ 'open_email' ] to include
141
+ // 'draft_reply'" said nothing about what the desk did instead.
142
+ expectCalled(turns, "open_email", "draft_reply");
103
143
  // The staging tool answered with the read-back, not a receipt.
104
- const staged = turn.toolCalls.find((call) => call.name === "draft_reply");
144
+ const staged = calls.find((call) => call.name === "draft_reply");
105
145
  expect(staged?.result).toMatch(/awaitingDecision/);
106
146
  expect(staged?.result).toMatch(/Nothing has been sent/);
107
- // The assistant asks; it does not decide. An `accept` in the same turn as
108
- // the staging is the agent confirming on its own initiative.
147
+ // The assistant asks; it does not decide. An `accept` anywhere in here is
148
+ // the agent confirming on its own initiative — neither utterance was a
149
+ // yes to SEND, only an instruction to draft.
109
150
  expect(names).not.toContain("accept");
110
151
  // THE claim: through every frame, nothing went out.
111
152
  for (const view of frames(session)) expect(view.sent).toEqual([]);
@@ -117,6 +158,7 @@ describeEval(agentDef, (test) => {
117
158
  {
118
159
  stubReply: [
119
160
  { tool: "open_email", args: { which: "m2" } },
161
+ "Dana is asking whether inference stays inside their VPC.",
120
162
  { tool: "draft_reply", args: { content: DRAFT } },
121
163
  "Here's the draft: Dana, it stays inside your VPC, models included. Send it?",
122
164
  ],
@@ -145,8 +187,14 @@ describeEval(agentDef, (test) => {
145
187
  test(
146
188
  "the executive's yes is the only thing that sends",
147
189
  async ({ session }) => {
190
+ // Three turns: the request, an instruction to draft, THEN the yes. The
191
+ // middle one exists because the desk reliably opens the email and speaks
192
+ // rather than chaining the staging into the same reply, which left this
193
+ // case failing on a draft that had not happened yet rather than on the
194
+ // gate it is here to measure. The yes is still the only send.
148
195
  const turns = await session.sayAll([
149
196
  "Open Dana's email from Northwind and reply that inference stays inside their VPC.",
197
+ "Write the reply now — say inference stays inside their VPC.",
150
198
  "Yes. Send it.",
151
199
  ]);
152
200
  const calls = toolCallsInTurns(turns);
@@ -154,7 +202,11 @@ describeEval(agentDef, (test) => {
154
202
  // Staged first, sent second, once each — reversed, or a send with nothing
155
203
  // staged, is the regression this template's whole shape exists to prevent.
156
204
  expect(names.indexOf("draft_reply"), describeTurn(turns[0]!)).toBeGreaterThanOrEqual(0);
157
- expect(names.lastIndexOf("accept")).toBeGreaterThan(names.indexOf("draft_reply"));
205
+ // Named across BOTH turns: "expected -1 to be greater than 2" says a send
206
+ // never happened and nothing about what the desk did with the yes instead.
207
+ expect(names.lastIndexOf("accept"), describeToolCalls(calls)).toBeGreaterThan(
208
+ names.indexOf("draft_reply"),
209
+ );
158
210
  const sent = calls.filter(
159
211
  (call) => call.name === "accept" && /"sent"/.test(call.result ?? ""),
160
212
  );
@@ -172,6 +224,7 @@ describeEval(agentDef, (test) => {
172
224
  {
173
225
  stubReply: [
174
226
  { tool: "open_email", args: { which: "m2" } },
227
+ "Dana wants to know whether inference stays inside their VPC.",
175
228
  { tool: "draft_reply", args: { content: DRAFT } },
176
229
  "Here's the draft — it stays inside your VPC. Send it?",
177
230
  { tool: "accept" },
@@ -186,7 +239,7 @@ describeEval(agentDef, (test) => {
186
239
  async ({ session }) => {
187
240
  const turn = await session.say("Open the Docusign one.");
188
241
  const names = toolNames(turn.toolCalls);
189
- expect(names, describeTurn(turn)).toContain("open_email");
242
+ expectCalled(turn, "open_email");
190
243
  // Their `notify` route halts for the human with nothing drafted.
191
244
  expect(names).not.toContain("draft_reply");
192
245
  const view = latest(session);
@@ -207,11 +260,19 @@ describeEval(agentDef, (test) => {
207
260
  "a scheduling request goes through the meeting assistant before any draft",
208
261
  async ({ session }) => {
209
262
  const scheduling = INBOX.find((e) => e.id === "m4");
210
- const turn = await session.say(
263
+ // Two turns, and the second NAMES the action. "Yes, go ahead" left this a
264
+ // coin toss (measured 1/2 over repeats) because it authorises without
265
+ // saying what to do; naming the calendar is what a caller answering
266
+ // "shall I check?" actually says. The judgement being
267
+ // measured is that the CALENDAR is consulted before a time is written
268
+ // down — an ordering claim, and the ordering holds across the pair.
269
+ const turns = await session.sayAll([
211
270
  `Open the one from Sam Reyes, "${scheduling?.subject}", and sort out a time with him.`,
212
- );
213
- const names = toolNames(turn.toolCalls);
214
- expect(names, describeTurn(turn)).toContain("meeting_assistant");
271
+ "Check my calendar and find us a slot.",
272
+ ]);
273
+ const calls = toolCallsInTurns(turns);
274
+ const names = toolNames(calls);
275
+ expectCalled(turns, "meeting_assistant");
215
276
  // The calendar is consulted before a time is ever written down: the brief
216
277
  // says never to guess free time, and a draft or an invite that came first
217
278
  // would have.
@@ -220,8 +281,8 @@ describeEval(agentDef, (test) => {
220
281
  const at = names.indexOf(later);
221
282
  if (at >= 0) expect(at).toBeGreaterThan(checked);
222
283
  }
223
- // And the specialist's report is what came back — not a calendar dump.
224
- const report = turn.toolCalls.find((call) => call.name === "meeting_assistant");
284
+ // And the subagent's report is what came back — not a calendar dump.
285
+ const report = calls.find((call) => call.name === "meeting_assistant");
225
286
  expect(report?.result).toMatch(/availability/);
226
287
  expect(latest(session)?.sent).toEqual([]);
227
288
  },