@alexkroman1/aai-cli 15.1.0 → 16.0.1
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 +12 -11
- package/dist/{dev-Bx9gYBHM.mjs → dev-kodAY23K.mjs} +7 -1
- package/dist/{eval-B3I7FqN9.mjs → eval-DvoSz7SZ.mjs} +1 -1
- package/dist/{init-CQbj3ycf.mjs → init-D363Ls5u.mjs} +2 -2
- 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
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SELF-CONTAINED deployment directory — the half two targets share.
|
|
3
|
+
*
|
|
4
|
+
* `deno deploy` uploads a directory and runs one entrypoint in it; `modal
|
|
5
|
+
* deploy` uploads a directory into an image layer and spawns node on one file
|
|
6
|
+
* in it. Neither performs an install, so both emits have the identical job:
|
|
7
|
+
* put beside the bundled entry every file the server opens at RUN time. Each
|
|
8
|
+
* of the three was found by a deployment failing without it, which is the
|
|
9
|
+
* reason this is one module and not a shape each target re-derives —
|
|
10
|
+
* a fourth target must not get to rediscover them.
|
|
11
|
+
*
|
|
12
|
+
* - **`.aai/worker.mjs`**, loaded through `import(pathToFileURL(...))`. Bundling
|
|
13
|
+
* cannot inline it and nothing else would carry it.
|
|
14
|
+
* - **The browser client.** `resolveClientDir` falls back to `defaultClientDir()`,
|
|
15
|
+
* which is `require.resolve("@alexkroman1/aai-ui/package.json")` — a lookup
|
|
16
|
+
* with no `node_modules` to answer it. A bundled deployment died at boot on
|
|
17
|
+
* exactly that until the prebuilt UI was copied in.
|
|
18
|
+
* - **`.env.example`**, which DECLARES which variables become `ctx.env`. Without
|
|
19
|
+
* it every tool sees an empty env while the platform has the values set.
|
|
20
|
+
*
|
|
21
|
+
* **`.env` is deliberately absent**, the same rule the Vercel emit follows:
|
|
22
|
+
* declarations ship, values come from the host (`deno deploy env`, a
|
|
23
|
+
* `modal.Secret`). Copying it would upload a developer's live credentials AND
|
|
24
|
+
* let them outrank what the host was configured with.
|
|
25
|
+
*
|
|
26
|
+
* The nesting is not an accident. `createProjectServer` resolves the worker at
|
|
27
|
+
* `<cwd>/.aai/worker.mjs` and each entry passes its own directory as `cwd`, so
|
|
28
|
+
* the output holds its own `.aai/` — the layout the server already knows,
|
|
29
|
+
* rather than a second one this module would have to teach it.
|
|
30
|
+
*/
|
|
31
|
+
/** What a self-contained target declares about its own directory. */
|
|
32
|
+
export interface SelfContainedTarget {
|
|
33
|
+
/** Where the directory goes, relative to the project root. */
|
|
34
|
+
outputDir: string;
|
|
35
|
+
/** The entry's filename inside it — a contract with whatever the host is pointed at. */
|
|
36
|
+
entryFile: string;
|
|
37
|
+
/** The entry source, bundled into {@link SelfContainedTarget.entryFile}. */
|
|
38
|
+
entrySource: string;
|
|
39
|
+
/** The target's name, for the bundler's temp entry and its diagnostics. */
|
|
40
|
+
name: string;
|
|
41
|
+
}
|
|
42
|
+
/** Options for {@link emitSelfContainedOutput}. */
|
|
43
|
+
export interface EmitSelfContainedOptions {
|
|
44
|
+
/**
|
|
45
|
+
* Produce the entry. Defaults to bundling the target's `entrySource`.
|
|
46
|
+
*
|
|
47
|
+
* Injectable because the ASSEMBLY — which file lands where, and which does
|
|
48
|
+
* not — is a question about a DIRECTORY, and answering it should not cost a
|
|
49
|
+
* rolldown pass over the whole runtime. The bundler's own contract needs a
|
|
50
|
+
* real pass and is asserted in the scenario tier.
|
|
51
|
+
*/
|
|
52
|
+
bundle?: (cwd: string) => Promise<string>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Write a target's self-contained directory and answer its absolute path.
|
|
56
|
+
*
|
|
57
|
+
* REMOVED first: the directory is uploaded wholesale, so anything an earlier
|
|
58
|
+
* build left in it would be deployed alongside this one.
|
|
59
|
+
*
|
|
60
|
+
* The path comes back so a target with MORE to write — Modal's `app.py` — adds
|
|
61
|
+
* it here rather than recomputing where "here" is.
|
|
62
|
+
*/
|
|
63
|
+
export declare function emitSelfContainedOutput(cwd: string, target: SelfContainedTarget, options?: EmitSelfContainedOptions): Promise<string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { g as writeJson, s as errorMessage$1 } from "./_utils-D5JGcjiW.mjs";
|
|
2
|
+
import { g as writeJson, s as errorMessage$1, u as isEexist } from "./_utils-D5JGcjiW.mjs";
|
|
3
3
|
import { t as getMonorepoRoot } from "./_agent-BzUeqOdj.mjs";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -129,6 +129,79 @@ function scaffoldDir() {
|
|
|
129
129
|
return path.join(resolveTemplatesDir(), "scaffold");
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
|
+
* The project-root `CLAUDE.md` a scaffolded project gets — a POINTER at the
|
|
133
|
+
* guide inside the resolved SDK, not a copy of it.
|
|
134
|
+
*
|
|
135
|
+
* `scaffold/CLAUDE.md` is the authoring guide itself: 2,533 lines and 119k
|
|
136
|
+
* characters, sitting against the working cap `claude-md-limit.test.ts`
|
|
137
|
+
* enforces. It has three consumers, and only one wanted the bytes in a project:
|
|
138
|
+
* `sync-agent-guide.mjs` copies it into the `@alexkroman1/aai` tarball as
|
|
139
|
+
* `AGENT_GUIDE.md`, `studio-prompt.ts` embeds it in the studio system prompt,
|
|
140
|
+
* and — until this file — `fs.cp` wrote all 120KB into every `aai init`
|
|
141
|
+
* directory. That third copy is the one that cannot be right:
|
|
142
|
+
*
|
|
143
|
+
* - **It is stale by design.** The SDK's own shipped skill
|
|
144
|
+
* (`packages/aai/skills/aai/SKILL.md`) already says so in as many words:
|
|
145
|
+
* the project copy is "correct on day one, but frozen at scaffold time —
|
|
146
|
+
* `pnpm update @alexkroman1/aai` moves the SDK and leaves it behind. Prefer
|
|
147
|
+
* the file above whenever the two disagree." A file whose own publisher
|
|
148
|
+
* tells agents not to trust it is not carrying its weight.
|
|
149
|
+
* - **An agent pays for it on every session, whether or not it is writing
|
|
150
|
+
* agent code.** Claude Code loads a project-root `CLAUDE.md` in FULL at
|
|
151
|
+
* launch and documents a 200-line target; this was 2,533. Splitting it
|
|
152
|
+
* behind an `@import` would not have helped — imports are expanded at
|
|
153
|
+
* launch too — which is why the pointer below names the path inside a FENCE,
|
|
154
|
+
* the documented spelling for "mention, do not import". It is read on
|
|
155
|
+
* demand, by the agent that needs it, out of the tarball the project
|
|
156
|
+
* actually resolved.
|
|
157
|
+
*
|
|
158
|
+
* Nothing is lost that was not already duplicated: the guide ships in the SDK
|
|
159
|
+
* beside the `.d.ts` files it describes, which is the copy the skill has
|
|
160
|
+
* pointed at all along. What a project gets instead is the one thing the
|
|
161
|
+
* 120KB could not be — version-matched.
|
|
162
|
+
*/
|
|
163
|
+
const PROJECT_GUIDE_POINTER = `# Agent instructions
|
|
164
|
+
|
|
165
|
+
This is an [aai](${REPO_URL}) voice-agent project. An agent is a directory
|
|
166
|
+
containing \`agent.ts\`; the \`aai\` CLI bundles it and deploys it.
|
|
167
|
+
|
|
168
|
+
## Read the SDK guide before writing agent code
|
|
169
|
+
|
|
170
|
+
The complete authoring guide ships inside the installed package:
|
|
171
|
+
|
|
172
|
+
\`\`\`text
|
|
173
|
+
node_modules/@alexkroman1/aai/AGENT_GUIDE.md
|
|
174
|
+
\`\`\`
|
|
175
|
+
|
|
176
|
+
Read it with your file tools. It is version-matched by construction — it lives
|
|
177
|
+
in the same tarball as the \`@alexkroman1/aai\` this project resolved, so it
|
|
178
|
+
cannot describe a different release than the one being imported. Prefer it over
|
|
179
|
+
anything remembered about the SDK, and over anything in this file.
|
|
180
|
+
|
|
181
|
+
The types are the second source of truth: the shipped declarations are in
|
|
182
|
+
\`node_modules/@alexkroman1/aai/dist/\`. When the guide and the types disagree,
|
|
183
|
+
the types are what the compiler enforces.
|
|
184
|
+
|
|
185
|
+
## Commands
|
|
186
|
+
|
|
187
|
+
\`\`\`sh
|
|
188
|
+
npm run dev # Run locally on http://localhost:3000
|
|
189
|
+
npm test # This project's suite, minus the evals (vitest)
|
|
190
|
+
npm run test:agent # Just agent.test.ts, via the CLI
|
|
191
|
+
npm run eval # Drive a real session against a live model (spends money)
|
|
192
|
+
npm run build # Bundle the agent
|
|
193
|
+
npm start # Build, then self-host on http://127.0.0.1:3000
|
|
194
|
+
npm run publish:agent # Publish to the managed platform
|
|
195
|
+
\`\`\`
|
|
196
|
+
|
|
197
|
+
The \`aai\` CLI is a devDependency, so it is in \`node_modules/.bin\` rather than
|
|
198
|
+
on \`PATH\`: reach it through these scripts or with \`npx aai <command>\`.
|
|
199
|
+
|
|
200
|
+
## Project-specific notes
|
|
201
|
+
|
|
202
|
+
<!-- Add conventions, gotchas and decisions for THIS agent below. -->
|
|
203
|
+
`;
|
|
204
|
+
/**
|
|
132
205
|
* Layer the base scaffold (package.json, tsconfig, …) into targetDir
|
|
133
206
|
* WITHOUT overwriting anything already there. Shared by `aai init`
|
|
134
207
|
* (underneath a template) and `aai pull` (underneath the studio workspace
|
|
@@ -137,7 +210,9 @@ function scaffoldDir() {
|
|
|
137
210
|
* before an in-sandbox build).
|
|
138
211
|
*
|
|
139
212
|
* package.json is the one file merged rather than skipped — see
|
|
140
|
-
* {@link layerScaffoldManifest}.
|
|
213
|
+
* {@link layerScaffoldManifest}. `CLAUDE.md` is the one file SUBSTITUTED: the
|
|
214
|
+
* scaffold's copy is the authoring guide, and a project gets
|
|
215
|
+
* {@link PROJECT_GUIDE_POINTER} instead.
|
|
141
216
|
*/
|
|
142
217
|
async function layerScaffold(targetDir) {
|
|
143
218
|
const dir = scaffoldDir();
|
|
@@ -146,9 +221,24 @@ async function layerScaffold(targetDir) {
|
|
|
146
221
|
recursive: true,
|
|
147
222
|
force: false,
|
|
148
223
|
errorOnExist: false,
|
|
149
|
-
filter:
|
|
224
|
+
filter: (src) => scaffoldCopyFilter(src, dir)
|
|
150
225
|
});
|
|
151
|
-
await layerScaffoldManifest(dir, targetDir)
|
|
226
|
+
await Promise.all([layerScaffoldManifest(dir, targetDir), fs.writeFile(path.join(targetDir, "CLAUDE.md"), PROJECT_GUIDE_POINTER, { flag: "wx" }).catch((err) => {
|
|
227
|
+
if (!isEexist(err)) throw err;
|
|
228
|
+
})]);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* `templateCopyFilter` plus the scaffold's own `CLAUDE.md`, which is the
|
|
232
|
+
* authoring guide rather than a file a project wants — see
|
|
233
|
+
* {@link PROJECT_GUIDE_POINTER}.
|
|
234
|
+
*
|
|
235
|
+
* Only the scaffold copy filters it. A TEMPLATE's `CLAUDE.md` would be that
|
|
236
|
+
* template's own notes and belongs in the project it seeds, so
|
|
237
|
+
* {@link downloadAndMergeTemplate} keeps using the unfiltered version. Matched
|
|
238
|
+
* on the full path rather than the basename for the same reason.
|
|
239
|
+
*/
|
|
240
|
+
function scaffoldCopyFilter(src, scaffold = scaffoldDir()) {
|
|
241
|
+
return templateCopyFilter(src) && path.resolve(src) !== path.join(scaffold, "CLAUDE.md");
|
|
152
242
|
}
|
|
153
243
|
/**
|
|
154
244
|
* `fs.cp` filter for every copy OUT of a template or the scaffold — the runtime
|
package/dist/_templates.d.ts
CHANGED
|
@@ -53,9 +53,22 @@ export declare function scaffoldDir(): string;
|
|
|
53
53
|
* before an in-sandbox build).
|
|
54
54
|
*
|
|
55
55
|
* package.json is the one file merged rather than skipped — see
|
|
56
|
-
* {@link layerScaffoldManifest}.
|
|
56
|
+
* {@link layerScaffoldManifest}. `CLAUDE.md` is the one file SUBSTITUTED: the
|
|
57
|
+
* scaffold's copy is the authoring guide, and a project gets
|
|
58
|
+
* {@link PROJECT_GUIDE_POINTER} instead.
|
|
57
59
|
*/
|
|
58
60
|
export declare function layerScaffold(targetDir: string): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* `templateCopyFilter` plus the scaffold's own `CLAUDE.md`, which is the
|
|
63
|
+
* authoring guide rather than a file a project wants — see
|
|
64
|
+
* {@link PROJECT_GUIDE_POINTER}.
|
|
65
|
+
*
|
|
66
|
+
* Only the scaffold copy filters it. A TEMPLATE's `CLAUDE.md` would be that
|
|
67
|
+
* template's own notes and belongs in the project it seeds, so
|
|
68
|
+
* {@link downloadAndMergeTemplate} keeps using the unfiltered version. Matched
|
|
69
|
+
* on the full path rather than the basename for the same reason.
|
|
70
|
+
*/
|
|
71
|
+
export declare function scaffoldCopyFilter(src: string, scaffold?: string): boolean;
|
|
59
72
|
/**
|
|
60
73
|
* `fs.cp` filter for every copy OUT of a template or the scaffold — the runtime
|
|
61
74
|
* ones here and the build-time one in `bundle-templates.mjs`.
|
package/dist/_vercel-output.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* `aai build` just produced.
|
|
4
4
|
*
|
|
5
5
|
* The argument for the Build Output API over an `api/` entry is in
|
|
6
|
-
* `
|
|
6
|
+
* `_vercel-target.ts` at {@link VERCEL_OUTPUT_DIR}; what this module adds is the
|
|
7
7
|
* consequence of it. A `.func` directory is a directory WE fill, so every file
|
|
8
8
|
* the server reads at runtime is present because it was copied in, and nothing
|
|
9
9
|
* depends on a static tracer following a path it structurally cannot:
|
|
@@ -21,17 +21,13 @@
|
|
|
21
21
|
* beside the worker, so `resolveClientDir` finds a real directory rather
|
|
22
22
|
* than reaching into a `node_modules` that the bundle replaced.
|
|
23
23
|
*
|
|
24
|
-
* The entry is BUNDLED rather than shipped with a `node_modules
|
|
25
|
-
*
|
|
26
|
-
* project's own installed SDK and pulls the runtime, `ws` and `pg` in with it
|
|
27
|
-
* — which is already the arrangement a deployed worker runs under, and it is
|
|
28
|
-
* what makes the function independent of whether the host's install left a
|
|
29
|
-
* usable, hoisted `node_modules` behind.
|
|
24
|
+
* The entry is BUNDLED rather than shipped with a `node_modules` — see
|
|
25
|
+
* `_target-bundle.ts`, which every target that emits an entry shares.
|
|
30
26
|
*/
|
|
31
27
|
/** Options for {@link emitVercelOutput}. */
|
|
32
28
|
export interface EmitVercelOutputOptions {
|
|
33
29
|
/**
|
|
34
|
-
* Produce the function's `index.mjs`. Defaults to {@link
|
|
30
|
+
* Produce the function's `index.mjs`. Defaults to bundling {@link VERCEL_ENTRY_SOURCE}.
|
|
35
31
|
*
|
|
36
32
|
* Injectable so the ASSEMBLY — which file lands where, and which does not —
|
|
37
33
|
* can be asserted without a ~15s rolldown pass over the whole runtime. The
|
|
@@ -50,14 +46,3 @@ export interface EmitVercelOutputOptions {
|
|
|
50
46
|
* uploads whatever is there.
|
|
51
47
|
*/
|
|
52
48
|
export declare function emitVercelOutput(cwd: string, options?: EmitVercelOutputOptions): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Bundle {@link VERCEL_ENTRY_SOURCE} and everything it imports into one ESM
|
|
55
|
-
* file.
|
|
56
|
-
*
|
|
57
|
-
* The entry is written INTO the project rather than a temp directory, because
|
|
58
|
-
* that is what makes `@alexkroman1/aai-cli/start` resolve against the user's
|
|
59
|
-
* install — the deployed server is then the version their lockfile pins, which
|
|
60
|
-
* is the same guarantee `aai publish` gives. Removed in a `finally`: a build
|
|
61
|
-
* that throws must not leave a file that looks authored.
|
|
62
|
-
*/
|
|
63
|
-
export declare function bundleEntry(cwd: string): Promise<string>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **Vercel** target — a PREBUILT deployment under `.vercel/output/`.
|
|
3
|
+
*
|
|
4
|
+
* Its own module for the reason Nitro keeps a directory per preset: a host's
|
|
5
|
+
* expected shape is one self-contained body of knowledge (a routing table, a
|
|
6
|
+
* function config, an entry in whatever shape its launcher invokes), and the
|
|
7
|
+
* only thing the others need from it is where its output lands. `TARGET_OUTPUTS`
|
|
8
|
+
* in `_build-target.ts` is that seam; `_vercel-output.ts` does the assembling.
|
|
9
|
+
*
|
|
10
|
+
* Vercel is also the one target here that is SERVERLESS. Everything in
|
|
11
|
+
* `_deno-target.ts` and `_modal-target.ts` is a long-lived process that binds a
|
|
12
|
+
* port and drains on a signal; nothing in this file binds anything, and the
|
|
13
|
+
* differences below all follow from that.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Where a PREBUILT Vercel deployment lives, relative to the project root.
|
|
17
|
+
*
|
|
18
|
+
* The Build Output API rather than an `api/` entry plus a `vercel.json`, and
|
|
19
|
+
* the reason is ORDERING. Vercel reads `vercel.json` and decides what to build
|
|
20
|
+
* BEFORE it runs the build command, so a `vercel.json` that the build WRITES
|
|
21
|
+
* configures the NEXT deployment and not this one — a clean clone deploys with
|
|
22
|
+
* no rewrite and no function at all. The `api/` shape only ever appeared to
|
|
23
|
+
* work because a previous local `aai build --target vercel` had left both
|
|
24
|
+
* files in the working tree, which is a property of one laptop rather than of
|
|
25
|
+
* the repository. `.vercel/output/` is read AFTER the build command; it is the
|
|
26
|
+
* only place a build can describe its own deployment.
|
|
27
|
+
*
|
|
28
|
+
* Two more things fall out of owning the directory, both of which the `api/`
|
|
29
|
+
* shape got wrong and could not fix. The function bundle is ASSEMBLED here
|
|
30
|
+
* rather than traced, so `.aai/worker.mjs` — loaded through a dynamic
|
|
31
|
+
* `import(pathToFileURL(...))` that no static tracer can follow — and
|
|
32
|
+
* `.env.example` — the file that DECLARES which variables become `ctx.env` —
|
|
33
|
+
* are present because they were copied in. And the built client is served by
|
|
34
|
+
* the CDN out of `static/` instead of through the function.
|
|
35
|
+
*
|
|
36
|
+
* Nitro's vercel preset is the worked precedent and lands in exactly here:
|
|
37
|
+
* `output.dir = {{rootDir}}/.vercel/output`, `serverDir` a `.func` under it.
|
|
38
|
+
*
|
|
39
|
+
* @see https://vercel.com/docs/build-output-api/v3
|
|
40
|
+
*/
|
|
41
|
+
export declare const VERCEL_OUTPUT_DIR: string;
|
|
42
|
+
/**
|
|
43
|
+
* The one function every request that is not a static file reaches.
|
|
44
|
+
*
|
|
45
|
+
* The Build Output API derives a function's ROUTE from its path, so the
|
|
46
|
+
* directory name IS a URL and must not collide with one the static output
|
|
47
|
+
* claims. **`index.func` collides**, which a deployment is the only way to
|
|
48
|
+
* find out: it is served at `/index`, and Vercel's directory index resolves
|
|
49
|
+
* `/` to the extensionless `/index` — so the function won `/`, every other
|
|
50
|
+
* asset came off the CDN correctly, and the home page 500'd on a deployment
|
|
51
|
+
* whose static output was perfect. Measured on a real preview:
|
|
52
|
+
* `/favicon.ico`, `/index.html` and both hashed `/assets/*` returned 200
|
|
53
|
+
* while `/` and `/index` did not.
|
|
54
|
+
*
|
|
55
|
+
* `__server` is Nitro's answer to the same problem (`__server.func`) and the
|
|
56
|
+
* reason is this one: a double-underscore prefix is not a path any bundler
|
|
57
|
+
* emits, so no static file can ever take the name.
|
|
58
|
+
*/
|
|
59
|
+
export declare const VERCEL_FUNCTION_DIR: string;
|
|
60
|
+
/**
|
|
61
|
+
* The route {@link VERCEL_FUNCTION_DIR} is served at — its directory name
|
|
62
|
+
* without `.func`, which is how the Build Output API names a function.
|
|
63
|
+
*/
|
|
64
|
+
export declare const VERCEL_FUNCTION_ROUTE = "/__server";
|
|
65
|
+
/** Static assets the Vercel CDN serves directly, never reaching the function. */
|
|
66
|
+
export declare const VERCEL_STATIC_DIR: string;
|
|
67
|
+
/**
|
|
68
|
+
* `nodejs<major>.x` for the Node running this build, resolved to what Vercel
|
|
69
|
+
* offers — the SMALLEST offered major that is at least this one, and the
|
|
70
|
+
* newest offered when the build is newer than all of them.
|
|
71
|
+
*
|
|
72
|
+
* **Rounding UP is the load-bearing half**, and it used to round down. The
|
|
73
|
+
* bundle in the function was produced by, and resolved its dependencies for,
|
|
74
|
+
* the Node running the build; placing it on an OLDER major is how a
|
|
75
|
+
* `node:`-builtin API that shipped in 23 becomes a runtime `TypeError` in a
|
|
76
|
+
* deployed function that built clean. A build on Node 23 named `nodejs22.x`
|
|
77
|
+
* for exactly that reason. Rounding up cannot produce that failure — Node
|
|
78
|
+
* majors do not remove APIs on the schedule they add them — so the direction
|
|
79
|
+
* that can only be wrong cosmetically is the one to take. It is also what
|
|
80
|
+
* Nitro's `resolveVercelRuntime` does (`find(v => v >= systemNodeVersion)`)
|
|
81
|
+
* over this same list.
|
|
82
|
+
*
|
|
83
|
+
* Above the list there is nothing to round up TO, so a build on Node 26 is
|
|
84
|
+
* clamped to the newest Vercel offers rather than naming a runtime the
|
|
85
|
+
* deployment would be rejected for.
|
|
86
|
+
*/
|
|
87
|
+
export declare function vercelNodeRuntime(version?: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* The Vercel function entry, emitted into {@link VERCEL_FUNCTION_DIR}.
|
|
90
|
+
*
|
|
91
|
+
* ## Why a `(req, res)` handler and not `export default server`
|
|
92
|
+
*
|
|
93
|
+
* `export default <http.Server>` is what Vercel's own `@vercel/node` BUILDER
|
|
94
|
+
* accepts, and it is the shape the previous `api/index.mjs` used. The Build
|
|
95
|
+
* Output API has no builder in the path: `launcherType: "Nodejs"` invokes the
|
|
96
|
+
* module's default export as a request handler, so the server never gets
|
|
97
|
+
* bound and there is nothing to raise an `upgrade` event on it.
|
|
98
|
+
*
|
|
99
|
+
* ## How a WebSocket survives that
|
|
100
|
+
*
|
|
101
|
+
* Vercel hands a Node function the raw upgrade through its PER-REQUEST
|
|
102
|
+
* context — `globalThis[Symbol.for("@vercel/request-context")].get()
|
|
103
|
+
* .upgradeWebSocket()` returns the `{ req, socket, head }` triple — rather
|
|
104
|
+
* than as an event. Nitro reaches it through `crossws/adapters/vercel`; here
|
|
105
|
+
* the adapter is three lines, because {@link AgentServer.node} is a real
|
|
106
|
+
* `http.Server` that already has both an `upgrade` and a `request` listener
|
|
107
|
+
* registered. Re-emitting onto it is the whole translation, and it means the
|
|
108
|
+
* deployed path through `server.ts` is the same one `aai dev` and `aai start`
|
|
109
|
+
* take — no second WebSocket entry point to keep in step.
|
|
110
|
+
*
|
|
111
|
+
* The `204` afterwards is what the launcher needs to consider the invocation
|
|
112
|
+
* finished; the socket the agent is now talking on is not this `res`.
|
|
113
|
+
*
|
|
114
|
+
* ## `import.meta.dirname`, not `process.cwd()`
|
|
115
|
+
*
|
|
116
|
+
* The function's working directory belongs to the platform, but `.aai/` and
|
|
117
|
+
* `.env.example` were copied in BESIDE this file. Resolving from the module
|
|
118
|
+
* keeps that a fact about the bundle rather than about how Vercel happens to
|
|
119
|
+
* invoke it.
|
|
120
|
+
*/
|
|
121
|
+
export declare const VERCEL_ENTRY_SOURCE = "// Generated by `aai build --target vercel` \u2014 do not edit, and do not commit.\n// Vercel invokes this handler per request and delivers a WebSocket upgrade\n// through its request context. See @alexkroman1/aai-cli/start.\nimport { createProjectServer } from \"@alexkroman1/aai-cli/start\";\n\nconst server = (await createProjectServer({ cwd: import.meta.dirname })).node;\n\nconst REQUEST_CONTEXT = Symbol.for(\"@vercel/request-context\");\n\nexport default function handler(req, res) {\n if (req.method === \"GET\" && req.headers.upgrade?.toLowerCase() === \"websocket\") {\n const upgrade = globalThis[REQUEST_CONTEXT]?.get?.()?.upgradeWebSocket?.();\n if (upgrade) {\n server.emit(\"upgrade\", upgrade.req, upgrade.socket, upgrade.head);\n if (!res.headersSent && !res.writableEnded) {\n res.statusCode = 204;\n res.end();\n }\n return;\n }\n }\n server.emit(\"request\", req, res);\n}\n";
|
|
122
|
+
/**
|
|
123
|
+
* `.vc-config.json` — how the platform runs {@link VERCEL_ENTRY_SOURCE}.
|
|
124
|
+
*
|
|
125
|
+
* `supportsResponseStreaming` is not optional here: an agent streams TTS audio
|
|
126
|
+
* and SSE workflow events, and without it the platform buffers a response to
|
|
127
|
+
* completion, which for a stream that ends when the call does means it never
|
|
128
|
+
* arrives. `shouldAddHelpers` stays off — the entry speaks `node:http`, and
|
|
129
|
+
* the helpers exist to bolt Express-shaped sugar onto a handler that does not.
|
|
130
|
+
*/
|
|
131
|
+
export declare function vercelFunctionConfigSource(runtime?: string): string;
|
|
132
|
+
/**
|
|
133
|
+
* `config.json` — the routing table, and the reason static assets stop paying
|
|
134
|
+
* for a function invocation.
|
|
135
|
+
*
|
|
136
|
+
* `{ "handle": "filesystem" }` serves anything present in
|
|
137
|
+
* {@link VERCEL_STATIC_DIR} from the CDN and only then falls through, so the
|
|
138
|
+
* client bundle, its assets and the worklets are edge-served while
|
|
139
|
+
* `/client-config`, `/websocket`, `/workflows/*` and the webhook route reach
|
|
140
|
+
* the agent. The `api/` shape routed EVERY request through the function, which
|
|
141
|
+
* this file's earlier revision noted as deliberate and "not what makes a
|
|
142
|
+
* deployment work or not" — true of correctness, false of cost, and free here
|
|
143
|
+
* because the Build Output API already separates the two directories.
|
|
144
|
+
*
|
|
145
|
+
* ## The two rules AROUND `filesystem`, and why a filesystem hit is not enough
|
|
146
|
+
*
|
|
147
|
+
* Both come from Nitro's `getPublicAssetRoutes`, which brackets its own
|
|
148
|
+
* `handle: filesystem` the same way, and both are about
|
|
149
|
+
* {@link CLIENT_ASSETS_DIR} rather than about static files in general.
|
|
150
|
+
*
|
|
151
|
+
* **Before** it, a `cache-control` rule with `continue: true`. Serving a
|
|
152
|
+
* content-hashed bundle from the CDN with no explicit freshness leaves it on
|
|
153
|
+
* Vercel's default, so every client re-validates every asset on every load —
|
|
154
|
+
* a round trip per file for bytes that CANNOT change, since a change produces
|
|
155
|
+
* a different filename. `continue: true` is what keeps this a header rule and
|
|
156
|
+
* not a terminal one: the request goes on to `filesystem` and is served there.
|
|
157
|
+
*
|
|
158
|
+
* **After** it, a terminal `404` for the same prefix. A miss under a hashed
|
|
159
|
+
* name is a stale `index.html` asking for a bundle this deployment does not
|
|
160
|
+
* have, and there is no version of that request the agent can answer — so
|
|
161
|
+
* falling through to the function buys an invocation to produce the 404 the
|
|
162
|
+
* CDN could have. Nitro's reason is the sharper one and applies here too: the
|
|
163
|
+
* immutable header above is already attached, and letting a DYNAMIC response
|
|
164
|
+
* inherit it would cache a 404 for a year. `no-store` is what takes it back.
|
|
165
|
+
*
|
|
166
|
+
* Everything outside {@link CLIENT_ASSETS_DIR} still falls through, which is
|
|
167
|
+
* what keeps `/`, `/favicon.ico` and every agent route working.
|
|
168
|
+
*/
|
|
169
|
+
export declare const VERCEL_BUILD_CONFIG_SOURCE: string;
|
|
@@ -1,15 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { n as log, r as notify } from "./_ui-DCt4qZrk.mjs";
|
|
2
|
+
import { r as notify } from "./_ui-DCt4qZrk.mjs";
|
|
4
3
|
import { a as errorCode, i as compareCodeUnits, l as formatCappedList, r as binFromPackageJson, s as errorMessage$1 } from "./_utils-D5JGcjiW.mjs";
|
|
5
4
|
import { createRequire } from "node:module";
|
|
6
5
|
import { existsSync, readdirSync } from "node:fs";
|
|
7
6
|
import path from "node:path";
|
|
8
7
|
import { omitUndefined } from "@alexkroman1/aai/utils";
|
|
9
8
|
import { execaSync } from "execa";
|
|
10
|
-
//#region src/
|
|
9
|
+
//#region src/_vitest-runner.ts
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
11
|
+
* Running vitest over an agent project's specs — the launcher three commands
|
|
12
|
+
* share.
|
|
13
|
+
*
|
|
14
|
+
* `aai test`, `aai eval` and `aai build`'s pre-build gate all spawn the
|
|
15
|
+
* project's own vitest, and all three used to import it from `test.ts`. Nothing
|
|
16
|
+
* about the code was wrong; what the import SAID was, because `aai eval` took
|
|
17
|
+
* its runner from the file named after the other command. Those two are
|
|
18
|
+
* deliberately disjoint — a positional argument to `vitest run` is a substring
|
|
19
|
+
* FILTER rather than an include glob, so `agent.test.ts` cannot match
|
|
20
|
+
* `agent.eval.test.ts` and neither command has to know the other's filenames
|
|
21
|
+
* (see {@link runVitest}) — and an import edge between them is the one thing
|
|
22
|
+
* that could quietly grow the coupling that design exists to prevent.
|
|
23
|
+
*
|
|
24
|
+
* What lives here is everything that follows from POINTING VITEST AT A SUBSET:
|
|
25
|
+
* how the binary is resolved, which files a run covers, which ones it therefore
|
|
26
|
+
* does NOT, and the notice a caller owes when it narrowed without saying so.
|
|
27
|
+
* The tiers' own filenames stay with the commands that own them — `TEST_FILES`
|
|
28
|
+
* in `test.ts`, `EVAL_FILES` in `eval.ts` — so this module has no opinion about
|
|
29
|
+
* which tier is running, which is why {@link VitestRunOptions.candidates} has
|
|
30
|
+
* no default.
|
|
31
|
+
*
|
|
32
|
+
* @module
|
|
13
33
|
*/
|
|
14
34
|
/**
|
|
15
35
|
* Resolve the agent project's own vitest binary so tests run without the
|
|
@@ -32,8 +52,6 @@ function resolveVitestCommand(cwd, resolve = createRequire(path.join(cwd, "packa
|
|
|
32
52
|
args: ["vitest"]
|
|
33
53
|
};
|
|
34
54
|
}
|
|
35
|
-
/** The files `aai test` runs, in preference order. */
|
|
36
|
-
const TEST_FILES = ["agent.test.ts", "agent.test.js"];
|
|
37
55
|
/**
|
|
38
56
|
* Run vitest over `candidates` (or, with `all`, the whole project) in the given
|
|
39
57
|
* project directory.
|
|
@@ -49,7 +67,7 @@ const TEST_FILES = ["agent.test.ts", "agent.test.js"];
|
|
|
49
67
|
* `all` list too: it is built from {@link projectSpecFiles}, which drops the
|
|
50
68
|
* eval tier by infix.
|
|
51
69
|
*/
|
|
52
|
-
function runVitest(cwd, opts
|
|
70
|
+
function runVitest(cwd, opts) {
|
|
53
71
|
const files = resolveRunFiles(cwd, opts);
|
|
54
72
|
if (files.length === 0) return false;
|
|
55
73
|
const { cmd, args } = resolveVitestCommand(cwd);
|
|
@@ -128,8 +146,8 @@ function projectSpecFiles(cwd) {
|
|
|
128
146
|
* contract (the scaffold guide says "Run agent.test.ts via vitest"), and running
|
|
129
147
|
* a project's other specs by default could reach ones that are slow or want
|
|
130
148
|
* credentials. What does not stand is a GREEN VERDICT over the difference: this
|
|
131
|
-
* set is what
|
|
132
|
-
*
|
|
149
|
+
* set is what `executeTest` refuses to call a pass, what it puts in its result
|
|
150
|
+
* for a script to read, and what `--all` opts into running.
|
|
133
151
|
*/
|
|
134
152
|
function unrunSpecFiles(cwd, ran) {
|
|
135
153
|
const covered = new Set(coveredList(ran));
|
|
@@ -180,63 +198,5 @@ function warnUnrunSpecs(cwd, ran) {
|
|
|
180
198
|
const preamble = ranList.length === 0 ? `No agent.test.ts, so vitest ran nothing. ${skipped.length} spec file(s) exist and were NOT run:` : `vitest ran ${ranList.join(", ")} only. ${skipped.length} other spec file(s) were NOT run:`;
|
|
181
199
|
notify("warn", `${preamble} ${formatCappedList(skipped)}. ${WIDEN_HINT}`);
|
|
182
200
|
}
|
|
183
|
-
/**
|
|
184
|
-
* Execute agent tests and return structured result.
|
|
185
|
-
*
|
|
186
|
-
* **An incomplete run is not a pass.** For as long as this command answered
|
|
187
|
-
* `{"ok":true,"data":{"passed":true}}` with exit 0 over specs it had not run,
|
|
188
|
-
* the scaffold's `"test": "aai test"` was what users wired into CI — so a suite
|
|
189
|
-
* of 25 tests could go red in the editor and green in the pipeline, and adding
|
|
190
|
-
* one tool could break `registry.test.ts` in 17 assertions with `pnpm test` and
|
|
191
|
-
* `pnpm build` both staying green throughout. It is the same defect
|
|
192
|
-
* `defineExec`'s `cwd` policy exists for (a green result for a project that is
|
|
193
|
-
* not there), one directory over, and it gets the same answer: the command
|
|
194
|
-
* fails, names the files, and names the flag that runs them.
|
|
195
|
-
*/
|
|
196
|
-
async function executeTest(cwd, opts = {}) {
|
|
197
|
-
log.step(opts.all ? "Running project tests" : "Running agent tests");
|
|
198
|
-
try {
|
|
199
|
-
const ran = runVitest(cwd, {
|
|
200
|
-
candidates: TEST_FILES,
|
|
201
|
-
announceUnrun: false,
|
|
202
|
-
...omitUndefined({ all: opts.all })
|
|
203
|
-
});
|
|
204
|
-
const unrun = unrunSpecFiles(cwd, ran);
|
|
205
|
-
if (unrun.length > 0) return incomplete(ran, unrun);
|
|
206
|
-
if (ran === false) {
|
|
207
|
-
log.info("No test file found. Create agent.test.ts to add tests.");
|
|
208
|
-
return ok({
|
|
209
|
-
passed: true,
|
|
210
|
-
skipped: true,
|
|
211
|
-
ran: [],
|
|
212
|
-
unrun: [],
|
|
213
|
-
complete: true
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
log.success(`Tests passed (${ran.length} spec file(s))`);
|
|
217
|
-
return ok({
|
|
218
|
-
passed: true,
|
|
219
|
-
ran,
|
|
220
|
-
unrun: [],
|
|
221
|
-
complete: true
|
|
222
|
-
});
|
|
223
|
-
} catch (err) {
|
|
224
|
-
const { code, message } = classifyVitestError(err);
|
|
225
|
-
return fail(code, message);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* The verdict for a run that left specs uncovered.
|
|
230
|
-
*
|
|
231
|
-
* Both arms fail, and the `ran === false` arm is the one that had misled
|
|
232
|
-
* longest: `aai test` printed "No test file found" while the project's specs sat
|
|
233
|
-
* right there unrun, which reads as "this project has no tests". Measured on a
|
|
234
|
-
* project whose only spec was `tools/echo_back.test.ts` — `{"passed":true,
|
|
235
|
-
* "skipped":true}`, exit 0, and not a word about it.
|
|
236
|
-
*/
|
|
237
|
-
function incomplete(ran, unrun) {
|
|
238
|
-
const preamble = ran === false ? `\`aai test\` found no agent.test.ts, so it ran nothing, but ${unrun.length} spec file(s) exist` : `\`aai test\` ran ${ran.join(", ")} only — ${unrun.length} other spec file(s) in this project were not run`;
|
|
239
|
-
return fail("incomplete_run", `${preamble}: ${formatCappedList(unrun)}. An unrun spec is not a passing one, so this is not a green result.`, WIDEN_HINT);
|
|
240
|
-
}
|
|
241
201
|
//#endregion
|
|
242
|
-
export {
|
|
202
|
+
export { unrunSpecFiles as i, classifyVitestError as n, runVitest as r, WIDEN_HINT as t };
|