@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,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { hotelSlot } from "../shared.ts";
|
|
3
|
+
|
|
4
|
+
/** Their `lookup_guest_history`: a returning guest's remembered preferences, or none. */
|
|
5
|
+
export default hotelSlot.tool({
|
|
6
|
+
description:
|
|
7
|
+
'Look up a returning guest\'s preferences from past stays ("I\'ve stayed before", "booking ' +
|
|
8
|
+
'another stay") so you can offer to set them up again. Only ever surface what this returns - ' +
|
|
9
|
+
"never invent a preference - and only for the guest themselves.",
|
|
10
|
+
inputSchema: z.object({ lastName: z.string().min(1) }),
|
|
11
|
+
execute({ lastName }, hotel) {
|
|
12
|
+
const wanted = lastName.trim().toLowerCase();
|
|
13
|
+
const history = hotel.guestHistory.find((g) => g.lastName.toLowerCase() === wanted);
|
|
14
|
+
if (history === undefined) {
|
|
15
|
+
return {
|
|
16
|
+
onFile: null,
|
|
17
|
+
message:
|
|
18
|
+
"No guest history on file for that name - treat them as a new guest and don't invent past preferences.",
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
onFile: history.preferences,
|
|
23
|
+
message:
|
|
24
|
+
"Proactively offer to set these up again for the new stay, and apply or note the ones the guest " +
|
|
25
|
+
"confirms. Don't add any preference beyond these.",
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isToolFailure, toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { invoiceFor } from "../hotel.ts";
|
|
3
|
+
import { speakUsd } from "../records.ts";
|
|
4
|
+
import { hotelSlot, requireVerified } from "../shared.ts";
|
|
5
|
+
|
|
6
|
+
/** Their `lookup_invoice`: the verified booking's line items, read back. */
|
|
7
|
+
export default hotelSlot.tool({
|
|
8
|
+
description:
|
|
9
|
+
"Fetch the verified caller's invoice and its line items - the step BEFORE any charge dispute, " +
|
|
10
|
+
"so the dispute names a line exactly as it appears. Verify first.",
|
|
11
|
+
execute(_args, hotel) {
|
|
12
|
+
const booking = requireVerified(hotel);
|
|
13
|
+
if (isToolFailure(booking)) return booking;
|
|
14
|
+
const invoice = invoiceFor(hotel, booking.code);
|
|
15
|
+
if (invoice === undefined) return toolFailure(`no invoice on file for ${booking.code}`);
|
|
16
|
+
return {
|
|
17
|
+
bookingCode: booking.code,
|
|
18
|
+
total: speakUsd(invoice.total),
|
|
19
|
+
paid: invoice.paid,
|
|
20
|
+
lineItems: invoice.lineItems.map((li) => ({ label: li.label, amount: speakUsd(li.amount) })),
|
|
21
|
+
next:
|
|
22
|
+
"Surface only what the caller asked about. You can email an itemized copy to the address on " +
|
|
23
|
+
`file, ${booking.email}, with resend_confirmation (kind folio) if they want one.`,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { tool } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { POLICIES, POLICY_TOPICS, policyIndex } from "../policies.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Their `build_lookup_policy_tool`: the whole topic index in the description,
|
|
7
|
+
* the topic as an enum, the body as the result. The description is what makes
|
|
8
|
+
* the knowledge base PROGRESSIVE — the model reads twenty one-line entries on
|
|
9
|
+
* every turn and one body when it needs it, rather than twenty bodies always.
|
|
10
|
+
*/
|
|
11
|
+
export default tool({
|
|
12
|
+
description:
|
|
13
|
+
"Fetch the full hotel or restaurant policy text for one topic. Call this before answering any " +
|
|
14
|
+
"question beyond the quick facts in your instructions - look it up rather than answering from " +
|
|
15
|
+
`memory. Topics:\n${policyIndex()}`,
|
|
16
|
+
inputSchema: z.object({ topic: z.enum(POLICY_TOPICS) }),
|
|
17
|
+
execute({ topic }) {
|
|
18
|
+
return { topic, policy: POLICIES[topic].body };
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { spokenDate, spokenTime } from "../records.ts";
|
|
4
|
+
import { findReservation } from "../restaurant.ts";
|
|
5
|
+
import { hotelSlot } from "../shared.ts";
|
|
6
|
+
|
|
7
|
+
/** Their `lookup_restaurant_reservation`: restaurants verify with last name + RES code. */
|
|
8
|
+
export default hotelSlot.tool({
|
|
9
|
+
description:
|
|
10
|
+
"Read-only lookup of a confirmed restaurant reservation by last name and RES code - to recall its " +
|
|
11
|
+
"details, or before a change that keeps some of them the same.",
|
|
12
|
+
inputSchema: z.object({ lastName: z.string().min(1), confirmationCode: z.string().min(1) }),
|
|
13
|
+
execute({ lastName, confirmationCode }, hotel) {
|
|
14
|
+
const reservation = findReservation(hotel, lastName, confirmationCode);
|
|
15
|
+
if (reservation === undefined || reservation.status !== "confirmed") {
|
|
16
|
+
return toolFailure("Couldn't find a matching confirmed reservation.");
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
code: reservation.code,
|
|
20
|
+
guest: `${reservation.firstName} ${reservation.lastName}`,
|
|
21
|
+
date: spokenDate(reservation.date),
|
|
22
|
+
time: spokenTime(reservation.time),
|
|
23
|
+
partySize: reservation.partySize,
|
|
24
|
+
notes: reservation.notes,
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { isToolFailure, toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { plural } from "@alexkroman1/aai/utils";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import {
|
|
5
|
+
clockTime,
|
|
6
|
+
DINNER_SLOTS,
|
|
7
|
+
isoDate,
|
|
8
|
+
MAX_PARTY_SIZE,
|
|
9
|
+
speakCode,
|
|
10
|
+
spokenDate,
|
|
11
|
+
spokenTime,
|
|
12
|
+
TODAY,
|
|
13
|
+
} from "../records.ts";
|
|
14
|
+
import { findReservation, modifyReservation, openDinnerSlots } from "../restaurant.ts";
|
|
15
|
+
import { hotelSlot } from "../shared.ts";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Move a reservation — their `modify_restaurant_reservation`, one step, same
|
|
19
|
+
* code. `newPartySize` is OMITTED when the caller keeps the same number, never
|
|
20
|
+
* filled with a guess; the result carries the size so a wrong count is caught
|
|
21
|
+
* on the read-back.
|
|
22
|
+
*/
|
|
23
|
+
export default hotelSlot.updateTool({
|
|
24
|
+
description:
|
|
25
|
+
"Move a confirmed restaurant reservation to a new date and time (and optionally a new party size), " +
|
|
26
|
+
"keeping its code. Verifies with last name + RES code. Omit newPartySize unless the caller states a " +
|
|
27
|
+
"new number. Read the new details back before calling, and relay the party size from the result.",
|
|
28
|
+
inputSchema: z.object({
|
|
29
|
+
lastName: z.string().min(1),
|
|
30
|
+
confirmationCode: z.string().min(1),
|
|
31
|
+
newDate: isoDate("the new date"),
|
|
32
|
+
newTime: clockTime("the new time"),
|
|
33
|
+
newPartySize: z.number().int().min(1).max(MAX_PARTY_SIZE).optional(),
|
|
34
|
+
}),
|
|
35
|
+
execute({ lastName, confirmationCode, newDate, newTime, newPartySize }, hotel) {
|
|
36
|
+
if (newDate < TODAY) return toolFailure("the new date can't be in the past");
|
|
37
|
+
if (!(DINNER_SLOTS as readonly string[]).includes(newTime)) {
|
|
38
|
+
return toolFailure(
|
|
39
|
+
`the restaurant seats at ${DINNER_SLOTS.map(spokenTime).join(", ")} - pick one of those`,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
const reservation = findReservation(hotel, lastName, confirmationCode);
|
|
43
|
+
if (reservation === undefined || reservation.status !== "confirmed") {
|
|
44
|
+
return toolFailure("Couldn't find a matching confirmed reservation.");
|
|
45
|
+
}
|
|
46
|
+
const updated = modifyReservation(
|
|
47
|
+
hotel,
|
|
48
|
+
reservation.code,
|
|
49
|
+
newDate,
|
|
50
|
+
newTime,
|
|
51
|
+
newPartySize ?? null,
|
|
52
|
+
);
|
|
53
|
+
if (isToolFailure(updated)) {
|
|
54
|
+
const party = newPartySize ?? reservation.partySize;
|
|
55
|
+
const open = openDinnerSlots(hotel, newDate, party).filter((slot) => slot !== newTime);
|
|
56
|
+
return toolFailure(
|
|
57
|
+
`No table for a party of ${party} at ${spokenTime(newTime)} on ${spokenDate(newDate)}.` +
|
|
58
|
+
(open.length > 0
|
|
59
|
+
? ` Open that evening: ${open.map(spokenTime).join(", ")}.`
|
|
60
|
+
: " Nothing is open that evening."),
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
code: updated.code,
|
|
65
|
+
spokenCode: speakCode(updated.code),
|
|
66
|
+
date: spokenDate(updated.date),
|
|
67
|
+
time: spokenTime(updated.time),
|
|
68
|
+
partySize: updated.partySize,
|
|
69
|
+
message:
|
|
70
|
+
`Done - the reservation is now ${spokenTime(updated.time)} on ${spokenDate(updated.date)} for ` +
|
|
71
|
+
`${updated.partySize} ${plural(updated.partySize, "guest")}, same code. Confirm the date, time AND ` +
|
|
72
|
+
"party size to the caller - if the size isn't what they expect, this is their chance to catch it.",
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { FLORIST_ARRANGEMENTS } from "../catalogs.ts";
|
|
3
|
+
import { catalogBookingTool } from "../concierge.ts";
|
|
4
|
+
import { isoDate, speakUsd, spokenDate } from "../records.ts";
|
|
5
|
+
|
|
6
|
+
/** Their `order_flowers`, as one instance of the catalog factory. */
|
|
7
|
+
export default catalogBookingTool({
|
|
8
|
+
description:
|
|
9
|
+
'Order a flower arrangement from the hotel florist for delivery to a room or a recipient. Look the catalog up first (lookup_policy "florist"), ' +
|
|
10
|
+
"let the caller pick, collect the delivery date, where it goes and the gift-card message - read the message back. THIS CALL places the order.",
|
|
11
|
+
kind: "flowers",
|
|
12
|
+
prefix: "FLR",
|
|
13
|
+
inputSchema: z.object({
|
|
14
|
+
arrangement: z.enum(
|
|
15
|
+
Object.keys(FLORIST_ARRANGEMENTS) as [
|
|
16
|
+
keyof typeof FLORIST_ARRANGEMENTS,
|
|
17
|
+
...(keyof typeof FLORIST_ARRANGEMENTS)[],
|
|
18
|
+
],
|
|
19
|
+
),
|
|
20
|
+
date: isoDate("the delivery date"),
|
|
21
|
+
deliverTo: z
|
|
22
|
+
.string()
|
|
23
|
+
.min(1)
|
|
24
|
+
.describe("A room number or the recipient's name - prefer the room"),
|
|
25
|
+
cardMessage: z.string().max(300).describe("Exactly as the caller dictates it"),
|
|
26
|
+
guestName: z.string().min(1),
|
|
27
|
+
guestPhone: z.string().min(1),
|
|
28
|
+
}),
|
|
29
|
+
price({ arrangement, date, deliverTo, cardMessage }) {
|
|
30
|
+
const a = FLORIST_ARRANGEMENTS[arrangement];
|
|
31
|
+
return {
|
|
32
|
+
total: a.price,
|
|
33
|
+
summary: `${a.name} to ${deliverTo} on ${date}`,
|
|
34
|
+
details: { arrangement, deliverTo, cardMessage },
|
|
35
|
+
confirm:
|
|
36
|
+
`${a.name} ordered for delivery to ${deliverTo} on ${spokenDate(date)}; total ${speakUsd(a.price)}. Confirm the ` +
|
|
37
|
+
"arrangement, where it's going, the date and the total.",
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { isToolFailure, toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { bookingStatus, nextStep } from "../booking.ts";
|
|
4
|
+
import { validateCard } from "../card.ts";
|
|
5
|
+
import { AFTER_DETAILS, deskFlow } from "../desk.ts";
|
|
6
|
+
import { hotelSlot } from "../shared.ts";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Take the card for a new booking — their `GetCardTask`, whose four recording
|
|
10
|
+
* tools each validated one field (Luhn, expiry, code length) so a bad value
|
|
11
|
+
* bounced straight back with instructions to re-ask just that field. One call
|
|
12
|
+
* here, and the refusal still names ONE field.
|
|
13
|
+
*
|
|
14
|
+
* **Only the last four digits ever reach the slot.** The number is checked and
|
|
15
|
+
* discarded in the same expression, which is the property a voice agent taking
|
|
16
|
+
* cards has to be able to show.
|
|
17
|
+
*/
|
|
18
|
+
export default deskFlow.tool({
|
|
19
|
+
description:
|
|
20
|
+
"Record the card for the booking once the caller has given the whole card: number, expiry, " +
|
|
21
|
+
"security code and the name on it. Never read the full number or the code back. A rejected " +
|
|
22
|
+
"value names the one field to re-ask.",
|
|
23
|
+
when: AFTER_DETAILS,
|
|
24
|
+
inputSchema: z.object({
|
|
25
|
+
cardNumber: z.string().describe("All the digits, spaces or dashes allowed"),
|
|
26
|
+
expiryMonth: z.number().int().describe("1-12"),
|
|
27
|
+
expiryYear: z.number().int().describe("Two or four digits"),
|
|
28
|
+
securityCode: z.string().describe("3 or 4 digits, leading zeros included"),
|
|
29
|
+
cardholderName: z.string().describe("The name on the card, exactly as given"),
|
|
30
|
+
}),
|
|
31
|
+
execute: (args, ctx) =>
|
|
32
|
+
hotelSlot.update(ctx, (hotel) => {
|
|
33
|
+
const d = hotel.draft;
|
|
34
|
+
if (d === null)
|
|
35
|
+
return toolFailure("No booking flow is open - call start_room_booking first.");
|
|
36
|
+
const card = validateCard(args);
|
|
37
|
+
if (isToolFailure(card)) return card;
|
|
38
|
+
d.cardLast4 = card.last4;
|
|
39
|
+
return {
|
|
40
|
+
recorded: `card ending ${card.last4}, ${card.issuer}`,
|
|
41
|
+
status: bookingStatus(d),
|
|
42
|
+
next: nextStep(d),
|
|
43
|
+
};
|
|
44
|
+
}),
|
|
45
|
+
sendFrom: (result) => ({ type: result.next }),
|
|
46
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { digitsOf, FOLLOWUP_KINDS, speakCode } from "../records.ts";
|
|
3
|
+
import { addTicket, hotelSlot } from "../shared.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Capture something for a human to follow up on — their `record_followup`, the
|
|
7
|
+
* one tool their session declared on the SESSION so every task could reach it:
|
|
8
|
+
* a caller can abandon anywhere, and the alternative to recording the callback
|
|
9
|
+
* where they say so is promising one that was never written.
|
|
10
|
+
*
|
|
11
|
+
* The result's `next` is deliberate: their return ended with "read it back so
|
|
12
|
+
* the caller knows it's actually on the list", because "logged" alone is the
|
|
13
|
+
* sentence a model says whether or not anything was.
|
|
14
|
+
*/
|
|
15
|
+
export default hotelSlot.updateTool({
|
|
16
|
+
description:
|
|
17
|
+
"Record a request for a human to follow up: housekeeping (in-house guest needs something " +
|
|
18
|
+
"brought or fixed), sales_lead (events, weddings, corporate rates), identity_change (email, " +
|
|
19
|
+
"phone or name on a booking), callback, verification_help (verification failed three times), " +
|
|
20
|
+
"early_checkout, abandoned_booking (dropped mid-booking, wants to finish later), lost_and_found, " +
|
|
21
|
+
'or other. ALWAYS call this instead of saying "someone will follow up" - an unrecorded request vanishes.',
|
|
22
|
+
inputSchema: z.object({
|
|
23
|
+
kind: z.enum(FOLLOWUP_KINDS),
|
|
24
|
+
callerName: z.string().min(1).describe("The caller's real name - ask; never a placeholder"),
|
|
25
|
+
callerPhone: z
|
|
26
|
+
.string()
|
|
27
|
+
.min(1)
|
|
28
|
+
.describe("Callback number - for an in-house guest, the room number works"),
|
|
29
|
+
summary: z.string().min(1).max(400).describe("One sentence a human can act on"),
|
|
30
|
+
}),
|
|
31
|
+
execute({ kind, callerName, callerPhone, summary }, hotel) {
|
|
32
|
+
const contact = digitsOf(callerPhone) || callerPhone;
|
|
33
|
+
const ticket = addTicket(hotel, "followup", "FUP", `${kind}: ${summary}`, {
|
|
34
|
+
kind,
|
|
35
|
+
callerName,
|
|
36
|
+
callerPhone: contact,
|
|
37
|
+
summary,
|
|
38
|
+
status: "open",
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
recorded: true,
|
|
42
|
+
reference: ticket.code,
|
|
43
|
+
spokenReference: speakCode(ticket.code),
|
|
44
|
+
next:
|
|
45
|
+
`Read it back so the caller knows it's actually on the list: who it's for (${callerName}, ` +
|
|
46
|
+
`${contact}) and what's noted ("${summary}"). Don't just say "logged", and don't promise anyone ` +
|
|
47
|
+
"will call back unless that's what was recorded. A followup is a recorded request, not a dispatch.",
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { digitsOf, isoDate, speakCode } from "../records.ts";
|
|
3
|
+
import { addTicket, hotelSlot } from "../shared.ts";
|
|
4
|
+
|
|
5
|
+
/** Their `record_group_inquiry`: fifteen or more guests is a block, never a booking. */
|
|
6
|
+
export default hotelSlot.updateTool({
|
|
7
|
+
description:
|
|
8
|
+
"Open a room-block inquiry for a group of 15 or more guests. Records it for the group desk - it " +
|
|
9
|
+
"does NOT confirm or hold rooms, and nothing can be confirmed on this call however hard the caller " +
|
|
10
|
+
'pushes; a new sponsor needs credit approval first. Quote terms from lookup_policy "group_bookings". ' +
|
|
11
|
+
"Under 15 guests, use the normal booking flow.",
|
|
12
|
+
inputSchema: z.object({
|
|
13
|
+
company: z.string().min(1),
|
|
14
|
+
contactName: z.string().min(1),
|
|
15
|
+
contactPhone: z.string().min(1),
|
|
16
|
+
partySize: z.number().int().min(15),
|
|
17
|
+
shareType: z
|
|
18
|
+
.enum(["twin", "double", "single", "mixed"])
|
|
19
|
+
.describe("The predominant room-share arrangement"),
|
|
20
|
+
checkIn: isoDate("the arrival date"),
|
|
21
|
+
nights: z.number().int().min(1),
|
|
22
|
+
}),
|
|
23
|
+
execute(args, hotel) {
|
|
24
|
+
const ticket = addTicket(
|
|
25
|
+
hotel,
|
|
26
|
+
"group_inquiry",
|
|
27
|
+
"GRP",
|
|
28
|
+
`${args.company}: ${args.partySize} guests from ${args.checkIn}, ${args.nights} nights`,
|
|
29
|
+
{
|
|
30
|
+
...args,
|
|
31
|
+
contactPhone: digitsOf(args.contactPhone) || args.contactPhone,
|
|
32
|
+
status: "pending_credit_approval",
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
return {
|
|
36
|
+
recorded: true,
|
|
37
|
+
reference: ticket.code,
|
|
38
|
+
spokenReference: speakCode(ticket.code),
|
|
39
|
+
next:
|
|
40
|
+
"Nothing is confirmed yet: tell the caller the group desk will call them back within two business " +
|
|
41
|
+
"days, after credit review, to confirm the block.",
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { bookingStatus, nextStep } from "../booking.ts";
|
|
4
|
+
import { AFTER_EXTRAS, deskFlow } from "../desk.ts";
|
|
5
|
+
import { digitsOf } from "../records.ts";
|
|
6
|
+
import { hotelSlot } from "../shared.ts";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Record the guest's name, email and phone — their three `beta.workflows`
|
|
10
|
+
* tasks (`GetNameTask`, `GetEmailTask`, `GetPhoneNumberTask`) as one tool that
|
|
11
|
+
* takes any subset, so a detail is stored the moment it is given and a later
|
|
12
|
+
* hiccup never re-asks it.
|
|
13
|
+
*
|
|
14
|
+
* The read-back-and-confirm those tasks did lives in the state's instruction:
|
|
15
|
+
* a spelled value is the value, letter by letter.
|
|
16
|
+
*/
|
|
17
|
+
export default deskFlow.tool({
|
|
18
|
+
description:
|
|
19
|
+
"Record the guest's name, email and/or phone for the booking - any subset, the moment each is " +
|
|
20
|
+
"given. A spelled name or email is recorded as spelled. Call again to correct a detail.",
|
|
21
|
+
when: AFTER_EXTRAS,
|
|
22
|
+
inputSchema: z.object({
|
|
23
|
+
firstName: z.string().min(1).optional(),
|
|
24
|
+
lastName: z.string().min(1).optional(),
|
|
25
|
+
email: z.string().optional(),
|
|
26
|
+
phone: z.string().optional(),
|
|
27
|
+
}),
|
|
28
|
+
execute: (args, ctx) =>
|
|
29
|
+
hotelSlot.update(ctx, (hotel) => {
|
|
30
|
+
const d = hotel.draft;
|
|
31
|
+
if (d === null)
|
|
32
|
+
return toolFailure("No booking flow is open - call start_room_booking first.");
|
|
33
|
+
if (
|
|
34
|
+
args.firstName === undefined &&
|
|
35
|
+
args.lastName === undefined &&
|
|
36
|
+
args.email === undefined &&
|
|
37
|
+
args.phone === undefined
|
|
38
|
+
) {
|
|
39
|
+
return toolFailure(
|
|
40
|
+
"nothing to record - pass at least one of firstName, lastName, email, phone",
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
if (args.email !== undefined) {
|
|
44
|
+
const email = args.email.trim().toLowerCase();
|
|
45
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
|
46
|
+
return toolFailure(
|
|
47
|
+
`"${args.email}" doesn't read as an email address - ask the caller to spell it`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
d.email = email;
|
|
51
|
+
}
|
|
52
|
+
if (args.phone !== undefined) {
|
|
53
|
+
const digits = digitsOf(args.phone);
|
|
54
|
+
if (digits.length < 7)
|
|
55
|
+
return toolFailure("that phone number is too short - ask the caller to repeat it");
|
|
56
|
+
d.phone = digits;
|
|
57
|
+
}
|
|
58
|
+
if (args.firstName !== undefined) d.firstName = args.firstName.trim();
|
|
59
|
+
if (args.lastName !== undefined) d.lastName = args.lastName.trim();
|
|
60
|
+
return {
|
|
61
|
+
recorded: {
|
|
62
|
+
name: d.firstName && d.lastName ? `${d.firstName} ${d.lastName}` : null,
|
|
63
|
+
email: d.email,
|
|
64
|
+
phone: d.phone,
|
|
65
|
+
},
|
|
66
|
+
status: bookingStatus(d),
|
|
67
|
+
next: nextStep(d),
|
|
68
|
+
};
|
|
69
|
+
}),
|
|
70
|
+
sendFrom: (result) => ({ type: result.next }),
|
|
71
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { isToolFailure, toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { reinstateBooking } from "../hotel.ts";
|
|
4
|
+
import { normalizeCode, speakCode, speakUsd, spokenDate, TODAY } from "../records.ts";
|
|
5
|
+
import { hotelSlot } from "../shared.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Bring back a cancelled booking — their `reinstate_booking`, the one flow that
|
|
9
|
+
* verifies against a CANCELLED record, which is why it takes the last name and
|
|
10
|
+
* code itself rather than going through `verify_booking`. If the room has been
|
|
11
|
+
* taken since, say so honestly and offer a new booking; never silently rebook a
|
|
12
|
+
* different room and call it reinstated.
|
|
13
|
+
*/
|
|
14
|
+
export default hotelSlot.updateTool({
|
|
15
|
+
description:
|
|
16
|
+
"Reactivate a room booking the caller previously CANCELLED. Takes last name plus the " +
|
|
17
|
+
"confirmation code (this is the one lookup that accepts a cancelled booking), checks the " +
|
|
18
|
+
"original room is still free for its dates, and flips it back to confirmed. Not for editing " +
|
|
19
|
+
"a live booking or making a new one.",
|
|
20
|
+
inputSchema: z.object({
|
|
21
|
+
lastName: z.string().min(1),
|
|
22
|
+
confirmationCode: z.string().min(1),
|
|
23
|
+
}),
|
|
24
|
+
execute({ lastName, confirmationCode }, hotel) {
|
|
25
|
+
const code = normalizeCode(confirmationCode);
|
|
26
|
+
const booking = hotel.bookings.find(
|
|
27
|
+
(b) =>
|
|
28
|
+
b.lastName.toLowerCase() === lastName.trim().toLowerCase() &&
|
|
29
|
+
normalizeCode(b.code) === code,
|
|
30
|
+
);
|
|
31
|
+
if (booking === undefined)
|
|
32
|
+
return toolFailure(
|
|
33
|
+
"No booking under that last name and code. Ask the caller to repeat the code.",
|
|
34
|
+
);
|
|
35
|
+
if (booking.status === "confirmed") {
|
|
36
|
+
return {
|
|
37
|
+
reinstated: false,
|
|
38
|
+
message: `That booking, ${speakCode(booking.code)}, is already active - nothing to reinstate. Reassure the caller it's all set.`,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (booking.checkIn < TODAY) {
|
|
42
|
+
return toolFailure(
|
|
43
|
+
"that stay's dates have already passed, so it can't be reinstated - offer a new booking",
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
const result = reinstateBooking(hotel, booking.code);
|
|
47
|
+
if (isToolFailure(result)) {
|
|
48
|
+
return toolFailure(
|
|
49
|
+
"that room has been taken for those dates since the cancellation - tell the caller honestly and " +
|
|
50
|
+
"offer to check other rooms or dates (start_room_booking); do NOT claim it was reinstated",
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
hotel.verifiedCode = result.code;
|
|
54
|
+
return {
|
|
55
|
+
reinstated: true,
|
|
56
|
+
code: result.code,
|
|
57
|
+
spokenCode: speakCode(result.code),
|
|
58
|
+
checkIn: spokenDate(result.checkIn),
|
|
59
|
+
checkOut: spokenDate(result.checkOut),
|
|
60
|
+
total: speakUsd(result.total),
|
|
61
|
+
cardLast4: result.cardLast4,
|
|
62
|
+
message: `Reinstated. Booking ${speakCode(result.code)} is active again - relay the dates and total and move on.`,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { isToolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { requireRoom } from "../hotel.ts";
|
|
4
|
+
import { isoDate, speakCode } from "../records.ts";
|
|
5
|
+
import { addTicket, hotelSlot } from "../shared.ts";
|
|
6
|
+
|
|
7
|
+
/** Their `request_flight_reconfirmation`: the concierge calls the carrier and rings the room. */
|
|
8
|
+
export default hotelSlot.updateTool({
|
|
9
|
+
description:
|
|
10
|
+
"Log a flight-reconfirmation request for an in-house guest: the concierge calls the carrier and " +
|
|
11
|
+
"rings the room with the result. Collect ALL the details and read the booking reference back " +
|
|
12
|
+
"before calling - a wrong reference makes the request useless. The flight is NOT confirmed by this.",
|
|
13
|
+
inputSchema: z.object({
|
|
14
|
+
room: z.string(),
|
|
15
|
+
airline: z.string().min(1),
|
|
16
|
+
flightNumber: z.string().min(1).describe("Airline code and number as given, e.g. IB 6174"),
|
|
17
|
+
flightDate: isoDate("the flight date").describe(
|
|
18
|
+
"YYYY-MM-DD - resolve a weekday against today and say the date back first",
|
|
19
|
+
),
|
|
20
|
+
bookingReference: z.string().min(1).describe("Letters and digits only"),
|
|
21
|
+
seatCheck: z.boolean().describe("True if the guest also wants their seat assignment checked"),
|
|
22
|
+
}),
|
|
23
|
+
execute(args, hotel) {
|
|
24
|
+
const found = requireRoom(hotel, args.room);
|
|
25
|
+
if (isToolFailure(found)) return found;
|
|
26
|
+
// Spoken codes arrive with unpredictable spaces and dashes.
|
|
27
|
+
const flightNumber = args.flightNumber.replaceAll(/[^a-z0-9]/gi, "").toUpperCase();
|
|
28
|
+
const bookingReference = args.bookingReference.replaceAll(/[^a-z0-9]/gi, "").toUpperCase();
|
|
29
|
+
const ticket = addTicket(
|
|
30
|
+
hotel,
|
|
31
|
+
"flight_reconfirmation",
|
|
32
|
+
"FLT",
|
|
33
|
+
`room ${found.id}: ${args.airline} ${flightNumber} on ${args.flightDate}`,
|
|
34
|
+
{
|
|
35
|
+
room: found.id,
|
|
36
|
+
airline: args.airline.trim(),
|
|
37
|
+
flightNumber,
|
|
38
|
+
flightDate: args.flightDate,
|
|
39
|
+
bookingReference,
|
|
40
|
+
seatCheck: args.seatCheck,
|
|
41
|
+
status: "pending",
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
return {
|
|
45
|
+
logged: true,
|
|
46
|
+
reference: ticket.code,
|
|
47
|
+
spokenReference: speakCode(ticket.code),
|
|
48
|
+
next:
|
|
49
|
+
"Tell the caller the concierge will call the carrier and ring their room with the result within the hour" +
|
|
50
|
+
(args.seatCheck ? ", including the seat check" : "") +
|
|
51
|
+
". The flight is NOT confirmed yet - never say it is; promise the callback instead.",
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { isToolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { addTicket, hotelSlot, requireVerified } from "../shared.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Re-send a document to the email ON FILE — their `resend_confirmation` over
|
|
7
|
+
* the stub `send_email`. It only ever goes to the recorded address: a caller
|
|
8
|
+
* reading out a different one has to change the contact email first
|
|
9
|
+
* (`record_followup`, kind `identity_change`), which is what stops a folio
|
|
10
|
+
* being mailed to whoever knows a guest's last name and code.
|
|
11
|
+
*/
|
|
12
|
+
export default hotelSlot.updateTool({
|
|
13
|
+
description:
|
|
14
|
+
"Re-send the booking confirmation or the itemized folio to the email already on file for the " +
|
|
15
|
+
"verified booking. It cannot go to a different address the caller reads out. Only say it's " +
|
|
16
|
+
"sent after this returns.",
|
|
17
|
+
inputSchema: z.object({ kind: z.enum(["booking_confirmation", "folio"]) }),
|
|
18
|
+
execute({ kind }, hotel) {
|
|
19
|
+
const booking = requireVerified(hotel);
|
|
20
|
+
if (isToolFailure(booking)) return booking;
|
|
21
|
+
const ticket = addTicket(
|
|
22
|
+
hotel,
|
|
23
|
+
"email",
|
|
24
|
+
"EML",
|
|
25
|
+
`${kind.replaceAll("_", " ")} re-sent to ${booking.email}`,
|
|
26
|
+
{
|
|
27
|
+
bookingCode: booking.code,
|
|
28
|
+
recipient: booking.email,
|
|
29
|
+
kind,
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
return {
|
|
33
|
+
sent: true,
|
|
34
|
+
to: booking.email,
|
|
35
|
+
reference: ticket.code,
|
|
36
|
+
message: `Sent to the address on file, ${booking.email}.`,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
});
|