@alexkroman1/aai-cli 15.0.0 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/bin.mjs +12 -3
- package/dist/_build-target-55dJisQ-.mjs +649 -0
- package/dist/_build-target.d.ts +105 -108
- package/dist/_deno-output.d.ts +23 -0
- package/dist/_deno-target.d.ts +73 -0
- package/dist/{_init-Bsi3DZNJ.mjs → _init-BzQbV8Zh.mjs} +3 -1
- package/dist/_modal-app.d.ts +77 -0
- package/dist/_modal-output.d.ts +31 -0
- package/dist/_modal-target.d.ts +64 -0
- package/dist/_target-bundle.d.ts +27 -0
- package/dist/_target-drain.d.ts +44 -0
- package/dist/_target-output.d.ts +63 -0
- package/dist/{_templates-CIlJ3Vay.mjs → _templates-CuP74F8D.mjs} +94 -4
- package/dist/_templates.d.ts +14 -1
- package/dist/_vercel-output.d.ts +4 -19
- package/dist/_vercel-target.d.ts +169 -0
- package/dist/{test-D032V2cA.mjs → _vitest-runner-AVR9VtXh.mjs} +28 -68
- package/dist/_vitest-runner.d.ts +154 -0
- package/dist/build-ButI2IKc.mjs +689 -0
- package/dist/build.d.ts +11 -0
- package/dist/cli.mjs +14 -20
- package/dist/{dev-Bx9gYBHM.mjs → dev-kodAY23K.mjs} +7 -1
- package/dist/{eval-B3I7FqN9.mjs → eval-DvoSz7SZ.mjs} +1 -1
- package/dist/{init-CFyusRbq.mjs → init-D363Ls5u.mjs} +13 -39
- package/dist/init.d.ts +5 -10
- package/dist/scaffold/CLAUDE.md +185 -35
- package/dist/scaffold/package.json +4 -4
- package/dist/start.mjs +3 -1
- package/dist/{studio-C_zuRC_z.mjs → studio-CtRBVVFR.mjs} +1 -1
- package/dist/templates/briefing-desk/agent.eval.test.ts +34 -6
- package/dist/templates/briefing-desk/agent.test.ts +347 -55
- package/dist/templates/briefing-desk/agent.ts +12 -0
- package/dist/templates/briefing-desk/shared.ts +220 -31
- package/dist/templates/briefing-desk/slack.ts +108 -0
- package/dist/templates/briefing-desk/system-prompt.md +12 -2
- package/dist/templates/briefing-desk/tools/briefing_so_far.ts +15 -7
- package/dist/templates/briefing-desk/tools/research_topic.ts +20 -28
- package/dist/templates/briefing-desk/tools/send_briefing.ts +77 -0
- package/dist/templates/briefing-desk/tools/verify_claim.ts +60 -14
- package/dist/templates/call-audit/agent.eval.test.ts +5 -0
- package/dist/templates/call-audit/agent.test.ts +6 -1
- package/dist/templates/call-audit/agent.ts +10 -23
- package/dist/templates/call-audit/client.tsx +30 -55
- package/dist/templates/call-audit/guards.test.ts +233 -0
- package/dist/templates/call-audit/workflows/audit.ts +95 -16
- package/dist/templates/call-audit/workflows/ingest.ts +107 -88
- package/dist/templates/call-audit/workflows/media.ts +98 -7
- package/dist/templates/call-audit/workflows/summarize.ts +35 -31
- package/dist/templates/call-audit/workflows/sync-api.ts +15 -6
- package/dist/templates/code-interpreter/agent.eval.test.ts +104 -56
- package/dist/templates/code-interpreter/agent.test.ts +44 -56
- package/dist/templates/code-interpreter/system-prompt.md +1 -1
- package/dist/templates/dispatch-center/agent.eval.test.ts +61 -24
- package/dist/templates/dispatch-center/agent.test.ts +253 -48
- package/dist/templates/dispatch-center/agent.ts +28 -1
- package/dist/templates/dispatch-center/client.tsx +126 -201
- package/dist/templates/dispatch-center/events.ts +48 -0
- package/dist/templates/dispatch-center/shared.ts +42 -1
- package/dist/templates/dispatch-center/tools/incident_create.ts +3 -2
- package/dist/templates/dispatch-center/tools/incident_escalate.ts +2 -1
- package/dist/templates/dispatch-center/tools/ops_dashboard.ts +35 -15
- package/dist/templates/dispatch-center/tools/ops_run_scenario.ts +3 -1
- package/dist/templates/dispatch-center/tools/resources_dispatch.ts +2 -2
- package/dist/templates/executive-assistant/agent.eval.test.ts +233 -0
- package/dist/templates/executive-assistant/agent.test.ts +672 -0
- package/dist/templates/executive-assistant/agent.ts +50 -0
- package/dist/templates/executive-assistant/calendar.test.ts +198 -0
- package/dist/templates/executive-assistant/client.tsx +195 -0
- package/dist/templates/executive-assistant/inbox.ts +233 -0
- package/dist/templates/executive-assistant/meeting.ts +138 -0
- package/dist/templates/executive-assistant/nodes.ts +152 -0
- package/dist/templates/executive-assistant/prompts.ts +331 -0
- package/dist/templates/executive-assistant/review.ts +425 -0
- package/dist/templates/executive-assistant/shared.ts +490 -0
- package/dist/templates/executive-assistant/system-prompt.md +15 -0
- package/dist/templates/executive-assistant/tools/accept.ts +10 -0
- package/dist/templates/executive-assistant/tools/ask_question.ts +30 -0
- package/dist/templates/executive-assistant/tools/draft_reply.ts +67 -0
- package/dist/templates/executive-assistant/tools/edit.ts +10 -0
- package/dist/templates/executive-assistant/tools/ignore.ts +10 -0
- package/dist/templates/executive-assistant/tools/inbox_status.ts +27 -0
- package/dist/templates/executive-assistant/tools/meeting_assistant.ts +52 -0
- package/dist/templates/executive-assistant/tools/new_email.ts +50 -0
- package/dist/templates/executive-assistant/tools/open_email.ts +165 -0
- package/dist/templates/executive-assistant/tools/respond.ts +10 -0
- package/dist/templates/executive-assistant/tools/review_memory.ts +22 -0
- package/dist/templates/executive-assistant/tools/send_calendar_invite.ts +68 -0
- package/dist/templates/executive-assistant/tools/triage_inbox.ts +75 -0
- package/dist/templates/health-assistant/agent.test.ts +134 -15
- package/dist/templates/health-assistant/agent.ts +8 -1
- package/dist/templates/health-assistant/fda.test.ts +130 -0
- package/dist/templates/health-assistant/fda.ts +75 -16
- package/dist/templates/health-assistant/system-prompt.md +9 -0
- package/dist/templates/health-assistant/tools/check_drug_interaction.ts +5 -2
- package/dist/templates/health-assistant/tools/medication_lookup.ts +16 -11
- package/dist/templates/hiring-desk/agent.eval.test.ts +242 -0
- package/dist/templates/hiring-desk/agent.test.ts +1021 -0
- package/dist/templates/hiring-desk/agent.ts +38 -0
- package/dist/templates/hiring-desk/client.tsx +154 -0
- package/dist/templates/hiring-desk/crews.ts +432 -0
- package/dist/templates/hiring-desk/leads.json +86 -0
- package/dist/templates/hiring-desk/screening-lock.test.ts +77 -0
- package/dist/templates/hiring-desk/screening-lock.ts +51 -0
- package/dist/templates/hiring-desk/shared.ts +480 -0
- package/dist/templates/hiring-desk/system-prompt.md +21 -0
- package/dist/templates/hiring-desk/tools/candidate_details.ts +49 -0
- package/dist/templates/hiring-desk/tools/proceed_to_emails.ts +127 -0
- package/dist/templates/hiring-desk/tools/read_email.ts +50 -0
- package/dist/templates/hiring-desk/tools/rescore_with_feedback.ts +140 -0
- package/dist/templates/hiring-desk/tools/screen_candidates.ts +128 -0
- package/dist/templates/hiring-desk/tools/screening_status.ts +51 -0
- package/dist/templates/hotel-desk/agent.eval.test.ts +177 -0
- package/dist/templates/hotel-desk/agent.test.ts +1128 -0
- package/dist/templates/hotel-desk/agent.ts +63 -0
- package/dist/templates/hotel-desk/booking.ts +159 -0
- package/dist/templates/hotel-desk/card.ts +92 -0
- package/dist/templates/hotel-desk/catalogs.ts +219 -0
- package/dist/templates/hotel-desk/client.tsx +137 -0
- package/dist/templates/hotel-desk/concierge.ts +99 -0
- package/dist/templates/hotel-desk/desk-seams.test.ts +334 -0
- package/dist/templates/hotel-desk/desk.ts +224 -0
- package/dist/templates/hotel-desk/disputes.ts +216 -0
- package/dist/templates/hotel-desk/events.ts +79 -0
- package/dist/templates/hotel-desk/hotel.ts +412 -0
- package/dist/templates/hotel-desk/policies.ts +209 -0
- package/dist/templates/hotel-desk/records.ts +384 -0
- package/dist/templates/hotel-desk/restaurant.ts +147 -0
- package/dist/templates/hotel-desk/seed.ts +955 -0
- package/dist/templates/hotel-desk/shared.ts +354 -0
- package/dist/templates/hotel-desk/system-prompt.md +76 -0
- package/dist/templates/hotel-desk/tools/abandon_booking.ts +30 -0
- package/dist/templates/hotel-desk/tools/add_to_waitlist.ts +41 -0
- package/dist/templates/hotel-desk/tools/book_airport_car.ts +57 -0
- package/dist/templates/hotel-desk/tools/book_business_center.ts +44 -0
- package/dist/templates/hotel-desk/tools/book_spa_appointment.ts +39 -0
- package/dist/templates/hotel-desk/tools/book_tour.ts +35 -0
- package/dist/templates/hotel-desk/tools/cancel_restaurant_reservation.ts +25 -0
- package/dist/templates/hotel-desk/tools/cancel_room_booking.ts +63 -0
- package/dist/templates/hotel-desk/tools/check_restaurant_availability.ts +24 -0
- package/dist/templates/hotel-desk/tools/check_room_availability.ts +40 -0
- package/dist/templates/hotel-desk/tools/choose_room.ts +93 -0
- package/dist/templates/hotel-desk/tools/confirm_booking.ts +153 -0
- package/dist/templates/hotel-desk/tools/dispatch_emergency.ts +61 -0
- package/dist/templates/hotel-desk/tools/dispute_charge.ts +90 -0
- package/dist/templates/hotel-desk/tools/flag_late_arrival.ts +26 -0
- package/dist/templates/hotel-desk/tools/lookup_booking.ts +48 -0
- package/dist/templates/hotel-desk/tools/lookup_guest_history.ts +28 -0
- package/dist/templates/hotel-desk/tools/lookup_invoice.ts +26 -0
- package/dist/templates/hotel-desk/tools/lookup_policy.ts +20 -0
- package/dist/templates/hotel-desk/tools/lookup_restaurant_reservation.ts +27 -0
- package/dist/templates/hotel-desk/tools/modify_restaurant_reservation.ts +75 -0
- package/dist/templates/hotel-desk/tools/order_flowers.ts +40 -0
- package/dist/templates/hotel-desk/tools/record_card.ts +46 -0
- package/dist/templates/hotel-desk/tools/record_followup.ts +50 -0
- package/dist/templates/hotel-desk/tools/record_group_inquiry.ts +44 -0
- package/dist/templates/hotel-desk/tools/record_guest_details.ts +71 -0
- package/dist/templates/hotel-desk/tools/reinstate_booking.ts +65 -0
- package/dist/templates/hotel-desk/tools/request_flight_reconfirmation.ts +54 -0
- package/dist/templates/hotel-desk/tools/resend_confirmation.ts +39 -0
- package/dist/templates/hotel-desk/tools/reserve_table.ts +87 -0
- package/dist/templates/hotel-desk/tools/resolve_room_conflict.ts +48 -0
- package/dist/templates/hotel-desk/tools/schedule_wakeup_call.ts +48 -0
- package/dist/templates/hotel-desk/tools/set_do_not_disturb.ts +28 -0
- package/dist/templates/hotel-desk/tools/set_extras.ts +51 -0
- package/dist/templates/hotel-desk/tools/set_stay.ts +97 -0
- package/dist/templates/hotel-desk/tools/start_booking_modification.ts +57 -0
- package/dist/templates/hotel-desk/tools/start_room_booking.ts +49 -0
- package/dist/templates/hotel-desk/tools/take_guest_message.ts +71 -0
- package/dist/templates/hotel-desk/tools/transfer_call.ts +47 -0
- package/dist/templates/hotel-desk/tools/update_card.ts +45 -0
- package/dist/templates/hotel-desk/tools/verify_booking.ts +95 -0
- package/dist/templates/infocom-adventure/agent.eval.test.ts +33 -1
- package/dist/templates/infocom-adventure/agent.test.ts +207 -52
- package/dist/templates/infocom-adventure/agent.ts +14 -3
- package/dist/templates/infocom-adventure/client.tsx +138 -176
- package/dist/templates/infocom-adventure/shared.ts +126 -6
- package/dist/templates/infocom-adventure/system-prompt.md +4 -4
- package/dist/templates/infocom-adventure/tools/game_state_drop.ts +20 -4
- package/dist/templates/infocom-adventure/tools/game_state_get.ts +6 -5
- package/dist/templates/infocom-adventure/tools/game_state_score.ts +9 -3
- package/dist/templates/link-digest/agent.eval.test.ts +8 -0
- package/dist/templates/link-digest/agent.test.ts +285 -29
- package/dist/templates/link-digest/agent.ts +9 -0
- package/dist/templates/link-digest/api-client.ts +144 -0
- package/dist/templates/link-digest/client.tsx +11 -30
- package/dist/templates/link-digest/workflows/digest.ts +72 -24
- package/dist/templates/night-owl/agent.eval.test.ts +55 -40
- package/dist/templates/night-owl/agent.test.ts +146 -12
- package/dist/templates/night-owl/client.tsx +50 -17
- package/dist/templates/night-owl/shared.ts +33 -2
- package/dist/templates/night-owl/system-prompt.md +3 -0
- package/dist/templates/night-owl/tools/recommend.ts +4 -1
- package/dist/templates/night-owl/tools/revisit.ts +49 -0
- package/dist/templates/pipeline-simple/agent.eval.test.ts +7 -6
- package/dist/templates/pipeline-simple/agent.test.ts +48 -91
- package/dist/templates/pipeline-simple/modes.test.ts +151 -0
- package/dist/templates/pipeline-simple/stages.test.ts +332 -0
- package/dist/templates/pizza-ordering/agent.test.ts +94 -38
- package/dist/templates/pizza-ordering/client.tsx +10 -5
- package/dist/templates/pizza-ordering/shared.ts +65 -6
- package/dist/templates/pizza-ordering/tools/add_pizza.ts +2 -7
- package/dist/templates/pizza-ordering/tools/place_order.ts +9 -6
- package/dist/templates/pizza-ordering/tools/remove_pizza.ts +6 -11
- package/dist/templates/pizza-ordering/tools/update_pizza.ts +8 -9
- package/dist/templates/pizza-ordering/tools/view_order.ts +2 -3
- package/dist/templates/plan-and-execute/agent.eval.test.ts +14 -6
- package/dist/templates/plan-and-execute/agent.test.ts +300 -113
- package/dist/templates/plan-and-execute/client.tsx +18 -7
- package/dist/templates/plan-and-execute/procedure.ts +162 -64
- package/dist/templates/plan-and-execute/prompts.ts +51 -15
- package/dist/templates/plan-and-execute/shared.ts +151 -45
- package/dist/templates/plan-and-execute/tools/plan_status.ts +15 -6
- package/dist/templates/plan-and-execute/tools/revise_plan.ts +2 -2
- package/dist/templates/plan-and-execute/tools/start_plan.ts +2 -2
- package/dist/templates/plan-and-execute/tools/work_next_step.ts +15 -13
- package/dist/templates/podcast-digest/agent.eval.test.ts +12 -7
- package/dist/templates/podcast-digest/agent.test.ts +126 -51
- package/dist/templates/podcast-digest/client.tsx +104 -68
- package/dist/templates/podcast-digest/workflows/digest.ts +71 -48
- package/dist/templates/podcast-digest/workflows/feeds.ts +5 -7
- package/dist/templates/podcast-digest/workflows/slack.ts +82 -17
- package/dist/templates/recap-workflow/agent.eval.test.ts +193 -209
- package/dist/templates/recap-workflow/agent.test.ts +207 -26
- package/dist/templates/recap-workflow/tools/recap_status.ts +2 -2
- package/dist/templates/recap-workflow/workflows/recap.ts +39 -28
- package/dist/templates/redline/agent.eval.test.ts +40 -3
- package/dist/templates/redline/agent.test.ts +216 -6
- package/dist/templates/redline/agent.ts +54 -34
- package/dist/templates/redline/client.tsx +82 -126
- package/dist/templates/redline/form.ts +74 -0
- package/dist/templates/redline/workflows/prompts.ts +3 -3
- package/dist/templates/redline/workflows/redline.ts +73 -4
- package/dist/templates/research-workflow/agent.eval.test.ts +152 -150
- package/dist/templates/research-workflow/agent.test.ts +436 -126
- package/dist/templates/research-workflow/agent.ts +20 -5
- package/dist/templates/research-workflow/tools/file_it_now.ts +11 -1
- package/dist/templates/research-workflow/tools/research_status.ts +39 -4
- package/dist/templates/research-workflow/workflows/filing.ts +164 -0
- package/dist/templates/research-workflow/workflows/notes.ts +69 -0
- package/dist/templates/research-workflow/workflows/prompts.ts +45 -31
- package/dist/templates/research-workflow/workflows/research.ts +227 -280
- package/dist/templates/research-workflow/workflows/review.ts +43 -0
- package/dist/templates/retail/address.ts +29 -35
- package/dist/templates/retail/agent.eval.test.ts +36 -16
- package/dist/templates/retail/agent.test.ts +104 -26
- package/dist/templates/retail/agent.ts +12 -0
- package/dist/templates/retail/cancel.ts +39 -42
- package/dist/templates/retail/client.tsx +111 -176
- package/dist/templates/retail/payment.ts +38 -43
- package/dist/templates/retail/pending.test.ts +16 -8
- package/dist/templates/retail/registry.test.ts +108 -49
- package/dist/templates/retail/resolve.test.ts +2 -63
- package/dist/templates/retail/resolve.ts +16 -56
- package/dist/templates/retail/returns.ts +53 -54
- package/dist/templates/retail/seed.test.ts +2 -1
- package/dist/templates/retail/shared.ts +58 -14
- package/dist/templates/retail/store.test.ts +40 -29
- package/dist/templates/retail/store.ts +60 -23
- package/dist/templates/retail/swap.ts +78 -81
- package/dist/templates/retail/tools/find_user_id_by_name_zip.ts +2 -1
- package/dist/templates/roadside-assist/agent.eval.test.ts +164 -0
- package/dist/templates/roadside-assist/agent.test.ts +617 -0
- package/dist/templates/roadside-assist/agent.ts +85 -0
- package/dist/templates/roadside-assist/call.ts +237 -0
- package/dist/templates/roadside-assist/events.ts +92 -0
- package/dist/templates/roadside-assist/shared.ts +334 -0
- package/dist/templates/roadside-assist/system-prompt.md +37 -0
- package/dist/templates/roadside-assist/tools/acknowledge_disclosure.ts +47 -0
- package/dist/templates/roadside-assist/tools/dispatch_truck.ts +148 -0
- package/dist/templates/roadside-assist/tools/job_status.ts +38 -0
- package/dist/templates/roadside-assist/tools/lookup_coverage.ts +72 -0
- package/dist/templates/roadside-assist/tools/report_location.ts +79 -0
- package/dist/templates/roadside-assist/tools/service_disclosure.ts +45 -0
- package/dist/templates/roadside-assist/yard.test.ts +158 -0
- package/dist/templates/roadside-assist/yard.ts +183 -0
- package/dist/templates/simple/agent.eval.test.ts +4 -1
- package/dist/templates/simple/agent.test.ts +54 -31
- package/dist/templates/solo-rpg/agent.eval.test.ts +19 -11
- package/dist/templates/solo-rpg/agent.test.ts +402 -175
- package/dist/templates/solo-rpg/agent.ts +14 -3
- package/dist/templates/solo-rpg/client.tsx +10 -10
- package/dist/templates/solo-rpg/shared.ts +198 -79
- package/dist/templates/solo-rpg/tools/action_roll.ts +7 -3
- package/dist/templates/solo-rpg/tools/burn_momentum.ts +16 -8
- package/dist/templates/solo-rpg/tools/oracle.ts +7 -7
- package/dist/templates/solo-rpg/tools/setup_character.ts +5 -5
- package/dist/templates/solo-rpg/tools/update_state.ts +29 -18
- package/dist/templates/spoken-summary/agent.test.ts +70 -15
- package/dist/templates/spoken-summary/agent.ts +25 -21
- package/dist/templates/spoken-summary/client.tsx +68 -88
- package/dist/templates/spoken-summary/workflows/summarize.ts +26 -8
- package/dist/templates/support-line/agent.test.ts +167 -36
- package/dist/templates/support-line/client.tsx +21 -9
- package/dist/templates/support-line/nodes.ts +74 -32
- package/dist/templates/support-line/procedure.ts +66 -21
- package/dist/templates/support-line/prompts.ts +9 -0
- package/dist/templates/support-line/shared.ts +55 -17
- package/dist/templates/support-line/tools/answer_question.ts +14 -14
- package/dist/templates/transcription-workflow/agent.test.ts +135 -13
- package/dist/templates/transcription-workflow/client.tsx +30 -23
- package/dist/templates/transcription-workflow/recover.test.ts +93 -12
- package/dist/templates/transcription-workflow/recover.ts +29 -5
- package/dist/templates/transcription-workflow/run-panel.tsx +40 -51
- package/dist/templates/transcription-workflow/workflows/normalize.ts +125 -24
- package/dist/templates/transcription-workflow/workflows/stream.ts +4 -1
- package/dist/templates/transcription-workflow/workflows/transcribe.ts +7 -5
- package/dist/templates/transcription-workflow/workflows/wav.ts +42 -117
- package/dist/templates/travel-concierge/agent.eval.test.ts +6 -4
- package/dist/templates/travel-concierge/agent.test.ts +209 -40
- package/dist/templates/travel-concierge/agent.ts +24 -4
- package/dist/templates/travel-concierge/call-events.ts +80 -0
- package/dist/templates/travel-concierge/client.tsx +3 -2
- package/dist/templates/travel-concierge/routing.ts +5 -7
- package/dist/templates/travel-concierge/shared.ts +202 -41
- package/dist/templates/travel-concierge/tools/book_car_rental.ts +2 -4
- package/dist/templates/travel-concierge/tools/book_excursion.ts +2 -4
- package/dist/templates/travel-concierge/tools/book_hotel.ts +2 -4
- package/dist/templates/travel-concierge/tools/cancel_ticket.ts +6 -4
- package/dist/templates/travel-concierge/tools/search_car_rentals.ts +3 -5
- package/dist/templates/travel-concierge/tools/search_excursions.ts +3 -5
- package/dist/templates/travel-concierge/tools/search_flights.ts +20 -9
- package/dist/templates/travel-concierge/tools/search_hotels.ts +3 -5
- package/dist/templates/travel-concierge/tools/update_ticket.ts +2 -4
- package/dist/templates/web-researcher/agent.eval.test.ts +3 -6
- package/dist/templates/web-researcher/agent.test.ts +102 -65
- package/dist/templates/web-researcher/agent.ts +93 -1
- package/dist/templates/web-researcher/system-prompt.md +7 -1
- package/dist/templates/word-wrangler/agent.eval.test.ts +157 -0
- package/dist/templates/word-wrangler/agent.test.ts +432 -0
- package/dist/templates/word-wrangler/agent.ts +35 -0
- package/dist/templates/word-wrangler/client.tsx +211 -0
- package/dist/templates/word-wrangler/game.ts +107 -0
- package/dist/templates/word-wrangler/guess.ts +63 -0
- package/dist/templates/word-wrangler/player.ts +68 -0
- package/dist/templates/word-wrangler/shared.ts +263 -0
- package/dist/templates/word-wrangler/system-prompt.md +15 -0
- package/dist/templates/word-wrangler/tools/final_score.ts +37 -0
- package/dist/templates/word-wrangler/tools/relay_description.ts +137 -0
- package/dist/templates/word-wrangler/tools/repeat_word.ts +19 -0
- package/dist/templates/word-wrangler/tools/skip_word.ts +31 -0
- package/dist/templates/word-wrangler/tools/start_game.ts +47 -0
- package/dist/templates/word-wrangler/words.ts +278 -0
- package/dist/test-Cllnx81G.mjs +83 -0
- package/dist/test.d.ts +9 -114
- package/package.json +5 -5
- package/dist/build-BhEaxBPu.mjs +0 -481
- package/dist/templates/embedded-assets/agent.eval.test.ts +0 -130
- package/dist/templates/embedded-assets/agent.test.ts +0 -79
- package/dist/templates/embedded-assets/agent.ts +0 -7
- package/dist/templates/embedded-assets/knowledge.json +0 -20
- package/dist/templates/embedded-assets/shared.ts +0 -17
- package/dist/templates/embedded-assets/system-prompt.md +0 -13
- package/dist/templates/embedded-assets/tools/list_topics.ts +0 -9
- package/dist/templates/embedded-assets/tools/search_knowledge.ts +0 -26
- package/dist/templates/math-buddy/agent.eval.test.ts +0 -128
- package/dist/templates/math-buddy/agent.test.ts +0 -126
- package/dist/templates/math-buddy/agent.ts +0 -15
- package/dist/templates/math-buddy/system-prompt.md +0 -12
- package/dist/templates/personal-finance/agent.eval.test.ts +0 -149
- package/dist/templates/personal-finance/agent.test.ts +0 -127
- package/dist/templates/personal-finance/agent.ts +0 -8
- package/dist/templates/personal-finance/system-prompt.md +0 -21
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// An EVAL: does the FAQ bot actually look things up?
|
|
2
|
-
//
|
|
3
|
-
// `agent.test.ts` scores the search index directly, which settles what
|
|
4
|
-
// `search_knowledge` returns for a query it is handed. What it cannot settle is
|
|
5
|
-
// the discipline this agent's whole prompt is about: that an answer comes from
|
|
6
|
-
// `knowledge.json` and not from what a model happens to know about the
|
|
7
|
-
// framework it is describing.
|
|
8
|
-
//
|
|
9
|
-
// Run it with `aai eval`. Without a provider key each case runs against a
|
|
10
|
-
// SCRIPTED model (its `stubReply`) — the real session and the real tools, a
|
|
11
|
-
// fake reply — which proves the wiring and says nothing about the discipline.
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The def a DEPLOYED agent runs: authored, plus what `tools/` declares.
|
|
15
|
-
*
|
|
16
|
-
* Taken from `virtual:aai/agent` rather than a hand-written glob: the plugin
|
|
17
|
-
* expands it against THIS file's own directory, so the spec needs no glob and
|
|
18
|
-
* no shared helper — which matters because this file SHIPS, and a scaffolded
|
|
19
|
-
* project has no repo helper to import. Without
|
|
20
|
-
* it this agent would have no tools and would answer every question from the
|
|
21
|
-
* model's own memory, which is exactly what the cases below forbid.
|
|
22
|
-
*
|
|
23
|
-
* And plus its PROMPT. `agent.ts` does not declare one, because
|
|
24
|
-
* `system-prompt.md` is resolved by the BUILD (`aai build`/`aai deploy`) — so
|
|
25
|
-
* the raw default export carries the FRAMEWORK DEFAULT prompt. An eval that
|
|
26
|
-
* drives it measures a different agent than the one that deploys, and every
|
|
27
|
-
* tool-choice claim below then passes or fails for the wrong reason.
|
|
28
|
-
*/
|
|
29
|
-
import agentDef from "virtual:aai/agent";
|
|
30
|
-
import { toolNames, toolResultIn } from "@alexkroman1/aai-runtime/eval";
|
|
31
|
-
import { describeEval } from "@alexkroman1/aai-runtime/eval/vitest";
|
|
32
|
-
import { expect } from "vitest";
|
|
33
|
-
import { z } from "zod";
|
|
34
|
-
import { faqs } from "./shared.ts";
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* A knowledge-base HIT, as the model saw it — `tool.completed` carries it
|
|
38
|
-
* serialized, and `toolResultIn` parses and validates it.
|
|
39
|
-
*
|
|
40
|
-
* A schema rather than a cast, which is the whole reason to pass one: an index
|
|
41
|
-
* that started answering with a different shape FAILS here naming the field,
|
|
42
|
-
* where the cast this replaced would have read `undefined` off it and failed a
|
|
43
|
-
* line later on something unrelated. `search_knowledge` also answers
|
|
44
|
-
* `{ result: "No matching FAQ found." }` for a miss, so a miss fails HERE — and
|
|
45
|
-
* a miss on this question is the finding.
|
|
46
|
-
*/
|
|
47
|
-
const FaqEntrySchema = z.object({ question: z.string(), answer: z.string() });
|
|
48
|
-
|
|
49
|
-
/** The knowledge-base entry this template's own answer about the web is in. */
|
|
50
|
-
const INTERNET = faqs.find((f) => f.question.includes("internet"))!;
|
|
51
|
-
|
|
52
|
-
describeEval(agentDef, (test) => {
|
|
53
|
-
test(
|
|
54
|
-
"answers a PARAPHRASED question out of the knowledge base",
|
|
55
|
-
async ({ session }) => {
|
|
56
|
-
// Nothing in this wording appears in the entry's question, so the entry
|
|
57
|
-
// has to be found by the index rather than matched by substring — and the
|
|
58
|
-
// agent has to go looking instead of telling the caller what it knows
|
|
59
|
-
// about voice frameworks in general.
|
|
60
|
-
const turn = await session.say("Can your agents make HTTP requests?");
|
|
61
|
-
|
|
62
|
-
expect(toolNames(turn.toolCalls)).toEqual(["search_knowledge"]);
|
|
63
|
-
const call = turn.toolCalls[0]!;
|
|
64
|
-
expect(typeof (call.args as { query?: unknown }).query).toBe("string");
|
|
65
|
-
// The right entry, out of four: the one this question is really about.
|
|
66
|
-
expect(toolResultIn(turn.toolCalls, "search_knowledge", FaqEntrySchema).question).toBe(
|
|
67
|
-
INTERNET.question,
|
|
68
|
-
);
|
|
69
|
-
// And the reply is that entry's answer rather than an embellishment of
|
|
70
|
-
// it — "quote the knowledge base accurately" is the prompt's rule.
|
|
71
|
-
expect(turn.text).toMatch(/fetch|web_search|http/i);
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
stubReply: [
|
|
75
|
-
{ tool: "search_knowledge", args: { query: "Can your agents make HTTP requests?" } },
|
|
76
|
-
"Yes — agents run with network access and can use the fetch API or the web_search builtin.",
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
test(
|
|
82
|
-
"lists the topics it really has, not the ones it can imagine",
|
|
83
|
-
async ({ session }) => {
|
|
84
|
-
const turn = await session.say("What topics can you help me with?");
|
|
85
|
-
|
|
86
|
-
expect(toolNames(turn.toolCalls)).toEqual(["list_topics"]);
|
|
87
|
-
// Every question in `knowledge.json` and nothing else — the check that
|
|
88
|
-
// catches an index built from a stale copy of the asset.
|
|
89
|
-
expect(toolResultIn(turn.toolCalls, "list_topics", z.array(z.string()))).toEqual(
|
|
90
|
-
faqs.map((f) => f.question),
|
|
91
|
-
);
|
|
92
|
-
expect(turn.completed).toBe(true);
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
stubReply: [
|
|
96
|
-
{ tool: "list_topics" },
|
|
97
|
-
"I can cover what AAI is, how tools work, speech providers, and network access.",
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
test(
|
|
103
|
-
"says it does not know rather than answering off-base",
|
|
104
|
-
async ({ session }) => {
|
|
105
|
-
// The knowledge base has four entries and none of them is the weather.
|
|
106
|
-
// A model asked this will answer it unless the prompt holds — and an FAQ
|
|
107
|
-
// bot that answers from outside its own asset is the failure this
|
|
108
|
-
// template exists to demonstrate the fix for.
|
|
109
|
-
const turn = await session.say("What's the weather in Paris right now?");
|
|
110
|
-
|
|
111
|
-
expect(turn.text).toMatch(/can.?t|cannot|do(n.?t| not) have|not something I/i);
|
|
112
|
-
// No degrees, no forecast: whatever it says, it must not have invented an
|
|
113
|
-
// answer, and it may not have found one in a knowledge base without one.
|
|
114
|
-
expect(turn.text).not.toMatch(/\d+\s*(°|degrees)/i);
|
|
115
|
-
for (const call of turn.toolCalls) {
|
|
116
|
-
// `toolResultIn` over a ONE-CALL list: the name is this call's own, so
|
|
117
|
-
// the reader's "no such call" and "two calls" throws are unreachable and
|
|
118
|
-
// what is left is the parse plus its "never completed" failure — which
|
|
119
|
-
// is exactly what the local helper this replaced did by hand.
|
|
120
|
-
expect(toolResultIn([call], call.name)).not.toMatchObject({
|
|
121
|
-
question: expect.stringContaining("weather"),
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
// Live only: a scripted model saying "I don't know" proves that the script
|
|
126
|
-
// said so, which is not the claim. `{ live: true }` is the honest way to
|
|
127
|
-
// write a case a stub cannot satisfy.
|
|
128
|
-
{ live: true },
|
|
129
|
-
);
|
|
130
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/** The def a DEPLOYED agent runs: authored, plus what `tools/` declares. */
|
|
2
|
-
import agentDef from "virtual:aai/agent";
|
|
3
|
-
import { toolRunner } from "@alexkroman1/aai/testing";
|
|
4
|
-
import { describe, expect, test } from "vitest";
|
|
5
|
-
import { faqs, searchable } from "./shared.ts";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Both tools here are stateless, so no call passes a context: `runTool` builds
|
|
9
|
-
* a fresh one, which is a distinct session with empty slots — right for a tool
|
|
10
|
-
* that reads nothing but its arguments, and never what two calls sharing state
|
|
11
|
-
* want. `list_topics` takes no arguments either, and may say so by leaving them
|
|
12
|
-
* out rather than passing a `{}` between the two values a reader cares about.
|
|
13
|
-
*/
|
|
14
|
-
const run = toolRunner(agentDef);
|
|
15
|
-
|
|
16
|
-
describe("embedded-assets template", () => {
|
|
17
|
-
test("the JSON asset really is bundled, and the index is built from it", () => {
|
|
18
|
-
// The template's whole subject: an asset imported with an import attribute,
|
|
19
|
-
// resolved at build time rather than fetched. An empty knowledge base would
|
|
20
|
-
// make every search below trivially "not found".
|
|
21
|
-
expect(faqs.length).toBeGreaterThan(0);
|
|
22
|
-
expect(searchable).toHaveLength(faqs.length);
|
|
23
|
-
for (const entry of faqs) {
|
|
24
|
-
expect(entry.question).toBeTypeOf("string");
|
|
25
|
-
expect(entry.answer).toBeTypeOf("string");
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test("both tools are discovered from tools/", () => {
|
|
30
|
-
// `agent()` takes no `tools` field: a file in `tools/` IS the tool, and
|
|
31
|
-
// nothing imports it. Discovery is what puts it in front of the model, so a
|
|
32
|
-
// template whose tools are never resolved ships a model with no tools.
|
|
33
|
-
// `arrayContaining` rather than an exact list: adding a file to `tools/` is
|
|
34
|
-
// the edit this template most invites, and an exact list would redden on
|
|
35
|
-
// it. Losing one of these two is still a failure — that is the half worth
|
|
36
|
-
// asserting.
|
|
37
|
-
expect(Object.keys(agentDef.tools ?? {})).toEqual(
|
|
38
|
-
expect.arrayContaining(["list_topics", "search_knowledge"]),
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
describe("list_topics", () => {
|
|
44
|
-
test("answers with every question in the knowledge base", async () => {
|
|
45
|
-
const topics = await run("list_topics");
|
|
46
|
-
expect(topics).toEqual(faqs.map((f) => f.question));
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
describe("search_knowledge", () => {
|
|
51
|
-
test("scores by word overlap rather than by substring", async () => {
|
|
52
|
-
// The reason the tool does not just `includes()` the query: a caller asks a
|
|
53
|
-
// natural question, which is never a substring of an FAQ entry.
|
|
54
|
-
const target = faqs[0];
|
|
55
|
-
if (!target) throw new Error("the knowledge base is empty");
|
|
56
|
-
const words = target.question
|
|
57
|
-
.toLowerCase()
|
|
58
|
-
.split(/\W+/)
|
|
59
|
-
.filter((w) => w.length > 2);
|
|
60
|
-
const result = await run("search_knowledge", {
|
|
61
|
-
query: `hey, could you tell me ${words.join(" ")}?`,
|
|
62
|
-
});
|
|
63
|
-
expect(result).toEqual(target);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test("a query with no words longer than two characters is refused early", async () => {
|
|
67
|
-
// The guard before the scan: with no scoreable words every entry ties at
|
|
68
|
-
// zero, and returning the first one would be an answer to nothing.
|
|
69
|
-
expect(await run("search_knowledge", { query: "is it a" })).toEqual({
|
|
70
|
-
result: "No matching FAQ found.",
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test("a query that overlaps nothing reports no match rather than guessing", async () => {
|
|
75
|
-
expect(await run("search_knowledge", { query: "zzzqqq wibbleflange" })).toEqual({
|
|
76
|
-
result: "No matching FAQ found.",
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"faqs": [
|
|
3
|
-
{
|
|
4
|
-
"question": "What is AAI?",
|
|
5
|
-
"answer": "AAI is a framework for building voice-powered AI agents that run on Node.js."
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"question": "How do agents handle tools?",
|
|
9
|
-
"answer": "Agents define tools with a schema and handler function. The LLM decides when to call them based on the conversation."
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"question": "What speech providers are supported?",
|
|
13
|
-
"answer": "AAI supports AssemblyAI for speech-to-text and text-to-speech."
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"question": "Can agents access the internet?",
|
|
17
|
-
"answer": "Yes, agents run with network access and can make HTTP requests via the fetch API or built-in tools like web_search."
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import knowledge from "./knowledge.json" with { type: "json" };
|
|
2
|
-
|
|
3
|
-
export type FaqEntry = { question: string; answer: string };
|
|
4
|
-
|
|
5
|
-
export const faqs: FaqEntry[] = knowledge.faqs;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The searchable index, built once at module load.
|
|
9
|
-
*
|
|
10
|
-
* Search text is static, so normalizing it here keeps per-call work O(query)
|
|
11
|
-
* even when the knowledge base grows — and both tools import this module, so
|
|
12
|
-
* the index is built once for the process rather than once per tool.
|
|
13
|
-
*/
|
|
14
|
-
export const searchable = faqs.map((entry) => ({
|
|
15
|
-
entry,
|
|
16
|
-
text: `${entry.question} ${entry.answer}`.toLowerCase(),
|
|
17
|
-
}));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
You are a friendly FAQ assistant. Answer questions using ONLY the information
|
|
2
|
-
from your embedded knowledge base. If the user asks something not covered by
|
|
3
|
-
your knowledge base, say you don't have that information and suggest they check
|
|
4
|
-
the official documentation.
|
|
5
|
-
|
|
6
|
-
Rules:
|
|
7
|
-
|
|
8
|
-
- Keep answers concise and conversational — this is a voice agent
|
|
9
|
-
- Quote the knowledge base accurately, do not embellish
|
|
10
|
-
- If a question is ambiguous, ask the user to clarify
|
|
11
|
-
- Use 'search_knowledge' to find answers to specific questions
|
|
12
|
-
- Use 'list_topics' to see all available FAQ topics
|
|
13
|
-
- Always be helpful and polite
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { tool } from "@alexkroman1/aai";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { type FaqEntry, searchable } from "../shared.ts";
|
|
4
|
-
|
|
5
|
-
export default tool({
|
|
6
|
-
description: "Search the embedded FAQ knowledge base for an answer matching the user's question.",
|
|
7
|
-
inputSchema: z.object({
|
|
8
|
-
query: z.string().describe("The user's question to search for"),
|
|
9
|
-
}),
|
|
10
|
-
async execute(args) {
|
|
11
|
-
// Score by word overlap — natural questions rarely match an FAQ
|
|
12
|
-
// entry as an exact substring.
|
|
13
|
-
const words = args.query
|
|
14
|
-
.toLowerCase()
|
|
15
|
-
.split(/\W+/)
|
|
16
|
-
.filter((w) => w.length > 2);
|
|
17
|
-
if (words.length === 0) return { result: "No matching FAQ found." };
|
|
18
|
-
|
|
19
|
-
let best: { entry: FaqEntry; score: number } | null = null;
|
|
20
|
-
for (const { entry, text } of searchable) {
|
|
21
|
-
const score = words.filter((w) => text.includes(w)).length;
|
|
22
|
-
if (score > 0 && (!best || score > best.score)) best = { entry, score };
|
|
23
|
-
}
|
|
24
|
-
return best?.entry ?? { result: "No matching FAQ found." };
|
|
25
|
-
},
|
|
26
|
-
});
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
// An EVAL: does Math Buddy delegate every calculation to code? Run it with
|
|
2
|
-
// `aai eval`.
|
|
3
|
-
//
|
|
4
|
-
// This tutor's whole design is "the model does the talking, run_code does the
|
|
5
|
-
// arithmetic" — which is also why it runs on Flash-Lite. So the claim worth
|
|
6
|
-
// pinning is not that the answer is right, it is that the answer came from
|
|
7
|
-
// CODE, and that the code is the recipe the prompt gave.
|
|
8
|
-
//
|
|
9
|
-
// Two things this file has to work around, both explained at length in
|
|
10
|
-
// `../code-interpreter/agent.eval.test.ts`: `system-prompt.md` is discovered by
|
|
11
|
-
// the build rather than imported, so an eval has to apply it or it measures a
|
|
12
|
-
// different agent; and `run_code` refuses unless the EVAL supplies an executor,
|
|
13
|
-
// which this suite does — so the cases below assert the answer the code came
|
|
14
|
-
// back with as well as the code the tutor wrote.
|
|
15
|
-
|
|
16
|
-
import agentDef from "virtual:aai/agent";
|
|
17
|
-
import {
|
|
18
|
-
createVmRunCode,
|
|
19
|
-
type EvalTurn,
|
|
20
|
-
toolArgsIn,
|
|
21
|
-
toolNames,
|
|
22
|
-
toolResultsIn,
|
|
23
|
-
} from "@alexkroman1/aai-runtime/eval";
|
|
24
|
-
import { describeEval } from "@alexkroman1/aai-runtime/eval/vitest";
|
|
25
|
-
import { expect } from "vitest";
|
|
26
|
-
import { z } from "zod";
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The code every `run_code` call in this turn carried, joined.
|
|
30
|
-
*
|
|
31
|
-
* Read through `toolArgsIn` WITH a schema, which is what that reader takes one
|
|
32
|
-
* for: `args` is `Record<string, unknown>` on the wire — the tutor wrote it and
|
|
33
|
-
* nothing validated it — so the `String(c.args.code ?? "")` this replaced turned
|
|
34
|
-
* an argument the model renamed, or never sent, into `""`. The claims below are
|
|
35
|
-
* about the recipe the tutor wrote, and against `""` every one of them would
|
|
36
|
-
* have been a claim about nothing. A `code` that stops arriving FAILS here,
|
|
37
|
-
* naming the field.
|
|
38
|
-
*/
|
|
39
|
-
const RunCodeArgs = z.object({ code: z.string() });
|
|
40
|
-
const codeIn = (turn: EvalTurn) =>
|
|
41
|
-
toolArgsIn(turn.toolCalls, "run_code", RunCodeArgs)
|
|
42
|
-
.map((args) => args.code)
|
|
43
|
-
.join("\n");
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* A `run_code` executor, so these cases can assert the answer the tutor's code
|
|
47
|
-
* came back with and not merely the code — `createVmRunCode`'s own doc carries
|
|
48
|
-
* why the builtin refuses without one.
|
|
49
|
-
*/
|
|
50
|
-
const runCode = createVmRunCode();
|
|
51
|
-
|
|
52
|
-
describeEval(
|
|
53
|
-
agentDef,
|
|
54
|
-
(test) => {
|
|
55
|
-
test(
|
|
56
|
-
"converts units in code, with a real conversion factor",
|
|
57
|
-
async ({ session }) => {
|
|
58
|
-
const turn = await session.say("Convert 5 miles to kilometres.");
|
|
59
|
-
|
|
60
|
-
// The prompt hands the tutor the factors; the finding it guards against
|
|
61
|
-
// is a tutor that recites a remembered figure instead. A factor in the
|
|
62
|
-
// code is the evidence that the conversion was computed, not recalled.
|
|
63
|
-
expect(toolNames(turn.toolCalls)).toContain("run_code");
|
|
64
|
-
const code = codeIn(turn);
|
|
65
|
-
expect(code).toContain("5");
|
|
66
|
-
expect(code).toMatch(/1\.60|1\.61|0\.621|8\.04/);
|
|
67
|
-
// And the factor was applied rather than merely mentioned: five miles is
|
|
68
|
-
// 8.0467 km, so whatever rounding the tutor chose the answer starts 8.0.
|
|
69
|
-
const output = toolResultsIn(turn.toolCalls, "run_code").join("\n");
|
|
70
|
-
expect(output, `run_code printed: ${output}`).toMatch(/8\.0/);
|
|
71
|
-
},
|
|
72
|
-
{ live: true },
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
test(
|
|
76
|
-
"rolls dice with a random draw rather than inventing numbers",
|
|
77
|
-
async ({ session }) => {
|
|
78
|
-
const turn = await session.say("Roll 3 twenty-sided dice for me.");
|
|
79
|
-
|
|
80
|
-
// A model asked for dice will happily make three numbers up, and the
|
|
81
|
-
// reply is indistinguishable from a real roll. `Math.random` in the code
|
|
82
|
-
// is the only thing that tells them apart.
|
|
83
|
-
expect(toolNames(turn.toolCalls)).toContain("run_code");
|
|
84
|
-
const code = codeIn(turn);
|
|
85
|
-
expect(code).toMatch(/Math\.random/);
|
|
86
|
-
expect(code).toContain("20");
|
|
87
|
-
expect(code).toContain("3");
|
|
88
|
-
|
|
89
|
-
// And the draw really happened: three integers, every one of them a legal
|
|
90
|
-
// face of a twenty-sided die. `Math.random` in the code says the tutor
|
|
91
|
-
// asked for a roll; this says it GOT one — a `run_code` that refused
|
|
92
|
-
// prints a sentence with no dice in it at all.
|
|
93
|
-
const output = toolResultsIn(turn.toolCalls, "run_code").join("\n");
|
|
94
|
-
const rolled = [...output.matchAll(/\d+/g)].map((m) => Number(m[0]));
|
|
95
|
-
expect(rolled.length, `run_code printed: ${output}`).toBeGreaterThanOrEqual(3);
|
|
96
|
-
for (const face of rolled) {
|
|
97
|
-
expect(face, `run_code printed: ${output}`).toBeGreaterThanOrEqual(1);
|
|
98
|
-
expect(face, `run_code printed: ${output}`).toBeLessThanOrEqual(20);
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
{ live: true },
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
test(
|
|
105
|
-
"the run_code builtin is wired to the agent's tool executor",
|
|
106
|
-
async ({ session }) => {
|
|
107
|
-
const turn = await session.say("What is 127 times 849?");
|
|
108
|
-
|
|
109
|
-
// A tool the agent does not declare produces a `tool.called` with no
|
|
110
|
-
// result, so the paired result is what says `builtinTools: ["run_code"]`
|
|
111
|
-
// still resolves to something executable. The ANSWER rather than
|
|
112
|
-
// `toBeDefined()`, which the refusal string satisfied too.
|
|
113
|
-
const [call] = turn.toolCalls;
|
|
114
|
-
expect(call?.name).toBe("run_code");
|
|
115
|
-
expect(call?.result).toBe("107823");
|
|
116
|
-
expect(turn.completed).toBe(true);
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
stubReply: [
|
|
120
|
-
{ tool: "run_code", args: { code: "console.log(127 * 849)" } },
|
|
121
|
-
"That's 107,823.",
|
|
122
|
-
],
|
|
123
|
-
},
|
|
124
|
-
);
|
|
125
|
-
},
|
|
126
|
-
// `runCode` is what makes these cases about the ANSWER and not just the call.
|
|
127
|
-
{ runCode },
|
|
128
|
-
);
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The def a DEPLOYED agent runs: authored, plus the `system-prompt.md` beside
|
|
3
|
-
* it.
|
|
4
|
-
*
|
|
5
|
-
* This template declares no `tools/` at all — every calculation is the
|
|
6
|
-
* `run_code` builtin's — so the prompt is the only thing discovery adds here,
|
|
7
|
-
* and it is what half the tests below are about. Importing `./agent.ts`
|
|
8
|
-
* directly would measure a tutor whose prompt is the framework default, i.e.
|
|
9
|
-
* an agent that was never told to compute in code.
|
|
10
|
-
*/
|
|
11
|
-
import agentDef from "virtual:aai/agent";
|
|
12
|
-
import { toAgentConfig } from "@alexkroman1/aai/manifest";
|
|
13
|
-
import { describe, expect, test } from "vitest";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* What a starter's spec may assert.
|
|
17
|
-
*
|
|
18
|
-
* `aai build` runs these tests before it bundles, so an assertion pinning this
|
|
19
|
-
* tutor's own identity — its literal name, the wording of its greeting, the
|
|
20
|
-
* model id it happens to run today — turns the first customization into a build
|
|
21
|
-
* failure in a file the author never wrote. Every test here therefore asserts a
|
|
22
|
-
* property that survives a rename, a voice, a reworded prompt and a model swap,
|
|
23
|
-
* on the RESOLVED config rather than on the def's empty fields.
|
|
24
|
-
*
|
|
25
|
-
* `run_code` is the one thing named literally, and deliberately: taking it away
|
|
26
|
-
* is not a customization of Math Buddy but a deletion of its subject — the
|
|
27
|
-
* prompt is nothing but recipes for it — and the tutor left behind does
|
|
28
|
-
* arithmetic from memory, which reads exactly like a correct answer until it is
|
|
29
|
-
* wrong.
|
|
30
|
-
*
|
|
31
|
-
* What is NOT here is anything about the code the tutor writes or the answer it
|
|
32
|
-
* comes back with: that needs a model and a sandbox, so it belongs to
|
|
33
|
-
* `agent.eval.test.ts`, which supplies both. This tier's question is the one
|
|
34
|
-
* that comes first — was the tutor handed anything to run at all.
|
|
35
|
-
*/
|
|
36
|
-
describe("math-buddy template", () => {
|
|
37
|
-
test("config passes manifest validation", () => {
|
|
38
|
-
// Same conversion `aai build`/`aai deploy` run — and the only thing that
|
|
39
|
-
// says this template's declared LLM descriptor is well formed before a
|
|
40
|
-
// live session tries to open one from it.
|
|
41
|
-
expect(() => toAgentConfig(agentDef)).not.toThrow();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test("exports an agent the platform can name", () => {
|
|
45
|
-
// Not the literal: what has to hold is that there IS a name and that the
|
|
46
|
-
// conversion carries it through — `AgentName` refuses a blank one, and the
|
|
47
|
-
// studio lists a deployed agent by exactly this string.
|
|
48
|
-
expect(agentDef.name).toBeTruthy();
|
|
49
|
-
expect(toAgentConfig(agentDef).name).toBe(agentDef.name);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test("run_code is declared, and the prompt the deploy carries asks for it", () => {
|
|
53
|
-
const config = toAgentConfig(agentDef);
|
|
54
|
-
// Two halves, each of which fails silently and produces a plausible tutor.
|
|
55
|
-
// Without the declaration the model has nothing to run, so it computes in
|
|
56
|
-
// its head and says the answer with the same confidence either way. Without
|
|
57
|
-
// the prompt reaching the CONFIG — the "I edited system-prompt.md and
|
|
58
|
-
// nothing changed" failure `withSystemPrompt` exists to catch, since the
|
|
59
|
-
// file is discovered by the build rather than imported by `agent.ts` — the
|
|
60
|
-
// recipes are gone and what deploys is a general assistant that happens to
|
|
61
|
-
// have a sandbox attached. The framework default says nothing about
|
|
62
|
-
// `run_code`, which is what makes the second assertion a real check on
|
|
63
|
-
// discovery rather than a restatement of the first.
|
|
64
|
-
expect(config.builtinTools).toContain("run_code");
|
|
65
|
-
expect(config.systemPrompt).toContain("run_code");
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test("whichever model this tutor runs on, the conversion carries its tuning", () => {
|
|
69
|
-
const config = toAgentConfig(agentDef);
|
|
70
|
-
if (config.mode !== "pipeline") {
|
|
71
|
-
// Switched the def to `s2s`? Then one model listens and talks, and there
|
|
72
|
-
// is no separate LLM stage left for anything to be carried on.
|
|
73
|
-
expect(config.mode).toBe("s2s");
|
|
74
|
-
expect(config.llm).toBeUndefined();
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (agentDef.llm === undefined) {
|
|
78
|
-
// Dropped the declaration to take the default cascade: it still resolves
|
|
79
|
-
// to a NAMED model, because the gateway refuses an unknown id with a 400
|
|
80
|
-
// at the first session — "no model" is not a state a deploy may reach.
|
|
81
|
-
expect(config.llm?.options.model).toBeTruthy();
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
// A model choice is the only reason this tutor declares a stage at all —
|
|
85
|
-
// a quick, cheap one, since `run_code` does the arithmetic and what is left
|
|
86
|
-
// is turn-taking speed. So the descriptor is checked whole rather than by
|
|
87
|
-
// `kind`: one that arrived with its options dropped would deploy the
|
|
88
|
-
// gateway's default model instead, quietly slower, with nothing on the line
|
|
89
|
-
// saying so. Read off the def rather than pinned, because swapping the id
|
|
90
|
-
// is the first tuning an author of this template tries.
|
|
91
|
-
expect(config.llm?.kind).toBe(agentDef.llm.kind);
|
|
92
|
-
expect(config.llm?.options).toEqual(agentDef.llm.options);
|
|
93
|
-
expect(config.llm?.options.model).toBeTruthy();
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test("every stage its mode needs is filled, declared or defaulted", () => {
|
|
97
|
-
// This template's other half: it declares the LLM and nothing else, so STT
|
|
98
|
-
// and TTS are injected at parse time (see `defaultProviders`) and the tutor
|
|
99
|
-
// can still hear and speak. Asserted per MODE so it survives a swap —
|
|
100
|
-
// declare `stt`/`tts` and the rest still default; declare `s2s` and there
|
|
101
|
-
// is no cascade to fill, which is the one thing that must never happen by
|
|
102
|
-
// fallthrough.
|
|
103
|
-
const config = toAgentConfig(agentDef);
|
|
104
|
-
if (config.mode === "s2s") {
|
|
105
|
-
expect(config.s2s?.kind).toBeTruthy();
|
|
106
|
-
expect(config.stt).toBeUndefined();
|
|
107
|
-
expect(config.tts).toBeUndefined();
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
expect(config.mode).toBe("pipeline");
|
|
111
|
-
for (const stage of ["stt", "llm", "tts"] as const) {
|
|
112
|
-
expect(config[stage]?.kind, stage).toBe(agentDef[stage]?.kind ?? "assemblyai");
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
test("the caller is told what to ask, and the greeting survives the conversion", () => {
|
|
117
|
-
// A voice agent has no buttons, so the opener is the only place a caller
|
|
118
|
-
// learns that this one wants arithmetic, conversions and dice rather than
|
|
119
|
-
// conversation. It rides to the browser in `/client-config` beside `name`,
|
|
120
|
-
// so what has to hold is that there is one and the conversion carries it:
|
|
121
|
-
// a greeting lost at that boundary is replaced by the framework's generic
|
|
122
|
-
// opener, which invites the caller to ask for anything at all.
|
|
123
|
-
expect(agentDef.greeting).toBeTruthy();
|
|
124
|
-
expect(toAgentConfig(agentDef).greeting).toBe(agentDef.greeting);
|
|
125
|
-
});
|
|
126
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { agent } from "@alexkroman1/aai";
|
|
2
|
-
import { assemblyAILlm } from "@alexkroman1/aai/llm";
|
|
3
|
-
|
|
4
|
-
export default agent({
|
|
5
|
-
name: "Math Buddy",
|
|
6
|
-
// Only the LLM stage is declared: this tutor delegates every calculation
|
|
7
|
-
// to run_code, so it needs turn-taking speed more than reasoning depth —
|
|
8
|
-
// and Flash-Lite is both quicker and cheaper than the default model. STT
|
|
9
|
-
// and TTS stay on the AssemblyAI defaults. (The string shorthand
|
|
10
|
-
// `llm: "gemini-2.5-flash-lite"` desugars to this same descriptor.)
|
|
11
|
-
llm: assemblyAILlm({ model: "gemini-2.5-flash-lite" }),
|
|
12
|
-
greeting:
|
|
13
|
-
"Hey, I'm Math Buddy. Try asking me something like, what's 127 times 849, convert 5 miles to kilometers, or roll 3 twenty-sided dice.",
|
|
14
|
-
builtinTools: ["run_code"],
|
|
15
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
You are Math Buddy, a friendly math assistant. You help with calculations,
|
|
2
|
-
unit conversions, dice rolls, and random number generation. Keep answers short and clear.
|
|
3
|
-
When doing multi-step math, show your work briefly.
|
|
4
|
-
|
|
5
|
-
Use run_code for ALL calculations. Write JavaScript using console.log() for output.
|
|
6
|
-
|
|
7
|
-
Examples:
|
|
8
|
-
- Math expressions: console.log((12 + 8) * 3) or console.log(Math.sqrt(144))
|
|
9
|
-
- Unit conversions: convert using known factors (1 km = 0.621371 mi, 1 lb = 0.453592 kg, etc.)
|
|
10
|
-
- Temperature: C to F = (c * 9/5) + 32, F to C = (f - 32) * 5/9, C to K = c + 273.15
|
|
11
|
-
- Dice rolls: console.log(Array.from({length: N}, () => Math.floor(Math.random() * sides) + 1))
|
|
12
|
-
- Random numbers: console.log(Math.floor(Math.random() * (max - min + 1)) + min)
|