@alexkroman1/aai-cli 0.12.3 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -0
- package/bin.mjs +58 -0
- package/dist/_agent-BopNO5Bq.mjs +152 -0
- package/dist/_agent.d.ts +83 -0
- package/dist/_api-client.d.ts +92 -0
- package/dist/_artifacts-BJOYGQPp.mjs +21 -0
- package/dist/_artifacts.d.ts +16 -0
- package/dist/_build-target-C08aM-Es.mjs +1119 -0
- package/dist/_build-target.d.ts +276 -0
- package/dist/_bundler-CgBw5Bcu.mjs +102 -0
- package/dist/_bundler.d.ts +60 -0
- package/dist/_cli-common.d.ts +173 -0
- package/dist/_client-plugins.d.ts +57 -0
- package/dist/_config-mq1I5Cva.mjs +263 -0
- package/dist/_config.d.ts +122 -0
- package/dist/_console-audio.d.ts +17 -0
- package/dist/_console-session.d.ts +70 -0
- package/dist/_default-html.d.ts +33 -0
- package/dist/_deno-output.d.ts +23 -0
- package/dist/_deno-target.d.ts +74 -0
- package/dist/_deploy.d.ts +22 -0
- package/dist/_dev-agent-env.d.ts +27 -0
- package/dist/_dev-env-D9Uy5wNt.mjs +89 -0
- package/dist/_dev-env.d.ts +77 -0
- package/dist/_dev-restart.d.ts +64 -0
- package/dist/_dev-server-BNq5OnUJ.mjs +737 -0
- package/dist/_dev-server.d.ts +89 -0
- package/dist/_dev-session-ticket.d.ts +63 -0
- package/dist/_dev-source.d.ts +55 -0
- package/dist/_dev-tunnel.d.ts +90 -0
- package/dist/_dev-typecheck.d.ts +38 -0
- package/dist/_dev-vite-config.d.ts +100 -0
- package/dist/_dev-watch.d.ts +35 -0
- package/dist/_dotenv-file.d.ts +45 -0
- package/dist/_e2e-test-utils.d.ts +120 -0
- package/dist/_fault-mode.d.ts +194 -0
- package/dist/_help.d.ts +31 -0
- package/dist/_init.d.ts +66 -0
- package/dist/_mock-api.d.ts +22 -0
- package/dist/_mock-registry.d.ts +17 -0
- package/dist/_modal-app.d.ts +77 -0
- package/dist/_modal-output.d.ts +31 -0
- package/dist/_modal-target.d.ts +69 -0
- package/dist/_output-DBP9Op_d.mjs +120 -0
- package/dist/_output.d.ts +74 -0
- package/dist/_preflight-Bv6Ct4ss.mjs +149 -0
- package/dist/_preflight.d.ts +170 -0
- package/dist/_resource-commands.d.ts +22 -0
- package/dist/_run-code-deno-C0AtfHeH.mjs +268 -0
- package/dist/_run-code-deno.d.ts +130 -0
- package/dist/_server-common-CVXIeWrY.mjs +114 -0
- package/dist/_server-common.d.ts +75 -0
- package/dist/_slug-api-DJuwYZ6T.mjs +68 -0
- package/dist/_slug-api.d.ts +61 -0
- package/dist/_stop-server.d.ts +17 -0
- package/dist/_studio-BH05zugt.mjs +251 -0
- package/dist/_studio-commands.d.ts +73 -0
- package/dist/_studio.d.ts +80 -0
- package/dist/_target-bundle.d.ts +139 -0
- package/dist/_target-drain.d.ts +44 -0
- package/dist/_target-entry.d.ts +81 -0
- package/dist/_target-output.d.ts +63 -0
- package/dist/_templates-Bv-rd0SO.mjs +135 -0
- package/dist/_templates.d.ts +82 -0
- package/dist/_typecheck-gate-CcX2gLJZ.mjs +19 -0
- package/dist/_typecheck-gate.d.ts +11 -0
- package/dist/_ui-Coe0zwmm.mjs +102 -0
- package/dist/_ui.d.ts +90 -0
- package/dist/_utils-BVLdBvdT.mjs +186 -0
- package/dist/_utils.d.ts +126 -0
- package/dist/_vercel-output.d.ts +48 -0
- package/dist/_vercel-target.d.ts +169 -0
- package/dist/_vite-env-BiyJ0GQH.mjs +105 -0
- package/dist/_vite-env.d.ts +38 -0
- package/dist/_vitest-runner-CKI8_K1b.mjs +207 -0
- package/dist/_vitest-runner.d.ts +182 -0
- package/dist/_workflow-determinism-CLxFQ5ox.mjs +198 -0
- package/dist/_workflow-determinism.d.ts +118 -0
- package/dist/build-B37oBfEv.mjs +592 -0
- package/dist/build.d.ts +146 -0
- package/dist/cli-workflow.d.ts +10 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +1063 -198
- package/dist/client-bundler-D4SeZJ8E.mjs +240 -0
- package/dist/client-bundler.d.ts +32 -0
- package/dist/client-bundler.mjs +3 -0
- package/dist/console-D6OOjjeJ.mjs +443 -0
- package/dist/console.d.ts +70 -0
- package/dist/delete-Br0EOH0g.mjs +55 -0
- package/dist/delete.d.ts +25 -0
- package/dist/deploy-CLUH5cv2.mjs +97 -0
- package/dist/deploy.d.ts +25 -0
- package/dist/dev-ZVuyPLUk.mjs +274 -0
- package/dist/dev.d.ts +34 -0
- package/dist/eval-Dl8o91yC.mjs +74 -0
- package/dist/eval.d.ts +46 -0
- package/dist/init-x3FsKl2q.mjs +609 -0
- package/dist/init.d.ts +101 -0
- package/dist/login-oJdBWu2B.mjs +166 -0
- package/dist/login.d.ts +54 -0
- package/dist/logs-BfRq1HX9.mjs +80 -0
- package/dist/logs.d.ts +65 -0
- package/dist/project-config.d.ts +23 -0
- package/dist/project-config.mjs +3 -0
- package/dist/scaffold/.env.example +51 -0
- package/dist/scaffold/CLAUDE.md +390 -0
- package/dist/scaffold/agent-guide/AGENT-API.md +223 -0
- package/dist/scaffold/agent-guide/HOSTING.md +140 -0
- package/dist/scaffold/agent-guide/PIPELINE-TUNING.md +235 -0
- package/dist/scaffold/agent-guide/PROVIDERS.md +143 -0
- package/dist/scaffold/agent-guide/TESTING-EVALS.md +158 -0
- package/dist/scaffold/agent-guide/TOOLS.md +628 -0
- package/dist/scaffold/agent-guide/UI.md +291 -0
- package/dist/scaffold/agent-guide/WORKFLOWS.md +801 -0
- package/dist/scaffold/package.json +38 -0
- package/dist/scaffold/pnpm-workspace.yaml +45 -0
- package/dist/scaffold/tsconfig.json +3 -0
- package/dist/scaffold/vitest.config.ts +8 -0
- package/dist/secret-Db1UWLSZ.mjs +300 -0
- package/dist/secret.d.ts +70 -0
- package/dist/start.d.ts +112 -0
- package/dist/start.mjs +183 -0
- package/dist/studio-DAoJApzD.mjs +209 -0
- package/dist/studio.d.ts +55 -0
- package/dist/templates/applicant-screening-agent/agent.eval.test.ts +258 -0
- package/dist/templates/applicant-screening-agent/agent.test.ts +987 -0
- package/dist/templates/applicant-screening-agent/agent.ts +66 -0
- package/dist/templates/applicant-screening-agent/client.tsx +154 -0
- package/dist/templates/applicant-screening-agent/crews.ts +432 -0
- package/dist/templates/applicant-screening-agent/leads.json +86 -0
- package/dist/templates/applicant-screening-agent/screening-lock.test.ts +77 -0
- package/dist/templates/applicant-screening-agent/screening-lock.ts +51 -0
- package/dist/templates/applicant-screening-agent/shared.ts +483 -0
- package/dist/templates/applicant-screening-agent/system-prompt.md +21 -0
- package/dist/templates/applicant-screening-agent/tools/candidate_details.ts +49 -0
- package/dist/templates/applicant-screening-agent/tools/proceed_to_emails.ts +127 -0
- package/dist/templates/applicant-screening-agent/tools/read_email.ts +50 -0
- package/dist/templates/applicant-screening-agent/tools/rescore_with_feedback.ts +140 -0
- package/dist/templates/applicant-screening-agent/tools/screen_candidates.ts +128 -0
- package/dist/templates/applicant-screening-agent/tools/screening_status.ts +51 -0
- package/dist/templates/call-audit-workflow/agent.eval.test.ts +492 -0
- package/dist/templates/call-audit-workflow/agent.test.ts +1032 -0
- package/dist/templates/call-audit-workflow/agent.ts +161 -0
- package/dist/templates/call-audit-workflow/client.tsx +236 -0
- package/dist/templates/call-audit-workflow/guards.test.ts +233 -0
- package/dist/templates/call-audit-workflow/workflows/audit.ts +391 -0
- package/dist/templates/call-audit-workflow/workflows/ingest.ts +279 -0
- package/dist/templates/call-audit-workflow/workflows/media.ts +729 -0
- package/dist/templates/call-audit-workflow/workflows/summarize.ts +201 -0
- package/dist/templates/call-audit-workflow/workflows/sync-api.ts +54 -0
- package/dist/templates/code-interpreter-agent/agent.eval.test.ts +195 -0
- package/dist/templates/code-interpreter-agent/agent.test.ts +91 -0
- package/dist/templates/code-interpreter-agent/agent.ts +9 -0
- package/dist/templates/code-interpreter-agent/system-prompt.md +18 -0
- package/dist/templates/coding-agent/agent.eval.test.ts +135 -0
- package/dist/templates/coding-agent/agent.test.ts +109 -0
- package/dist/templates/coding-agent/agent.ts +45 -0
- package/dist/templates/coding-agent/chat.ts +63 -0
- package/dist/templates/coding-agent/shared.ts +46 -0
- package/dist/templates/coding-agent/system-prompt.md +32 -0
- package/dist/templates/coding-agent/tools/bash.ts +6 -0
- package/dist/templates/coding-agent/tools/delete_file.ts +6 -0
- package/dist/templates/coding-agent/tools/edit_file.ts +6 -0
- package/dist/templates/coding-agent/tools/glob.ts +6 -0
- package/dist/templates/coding-agent/tools/grep.ts +6 -0
- package/dist/templates/coding-agent/tools/list_files.ts +6 -0
- package/dist/templates/coding-agent/tools/read_file.ts +6 -0
- package/dist/templates/coding-agent/tools/todo_write.ts +6 -0
- package/dist/templates/coding-agent/tools/write_file.ts +6 -0
- package/dist/templates/custom-pipeline-agent/agent.eval.test.ts +79 -0
- package/dist/templates/custom-pipeline-agent/agent.test.ts +79 -0
- package/dist/templates/custom-pipeline-agent/agent.ts +13 -0
- package/dist/templates/custom-pipeline-agent/modes.test.ts +162 -0
- package/dist/templates/custom-pipeline-agent/stages.test.ts +330 -0
- package/dist/templates/document-redline-workflow/agent.eval.test.ts +254 -0
- package/dist/templates/document-redline-workflow/agent.test.ts +552 -0
- package/dist/templates/document-redline-workflow/agent.ts +112 -0
- package/dist/templates/document-redline-workflow/client.tsx +224 -0
- package/dist/templates/document-redline-workflow/form.ts +74 -0
- package/dist/templates/document-redline-workflow/workflows/prompts.ts +68 -0
- package/dist/templates/document-redline-workflow/workflows/redline.ts +317 -0
- package/dist/templates/emergency-dispatch-agent/agent.eval.test.ts +372 -0
- package/dist/templates/emergency-dispatch-agent/agent.test.ts +576 -0
- package/dist/templates/emergency-dispatch-agent/agent.ts +63 -0
- package/dist/templates/emergency-dispatch-agent/client.tsx +453 -0
- package/dist/templates/emergency-dispatch-agent/events.ts +48 -0
- package/dist/templates/emergency-dispatch-agent/guardrails.ts +105 -0
- package/dist/templates/emergency-dispatch-agent/shared.ts +768 -0
- package/dist/templates/emergency-dispatch-agent/system-prompt.md +42 -0
- package/dist/templates/emergency-dispatch-agent/tools/incident_add_note.ts +28 -0
- package/dist/templates/emergency-dispatch-agent/tools/incident_create.ts +95 -0
- package/dist/templates/emergency-dispatch-agent/tools/incident_escalate.ts +96 -0
- package/dist/templates/emergency-dispatch-agent/tools/incident_get.ts +40 -0
- package/dist/templates/emergency-dispatch-agent/tools/incident_triage.ts +90 -0
- package/dist/templates/emergency-dispatch-agent/tools/incident_update_status.ts +75 -0
- package/dist/templates/emergency-dispatch-agent/tools/ops_dashboard.ts +72 -0
- package/dist/templates/emergency-dispatch-agent/tools/ops_protocols.ts +27 -0
- package/dist/templates/emergency-dispatch-agent/tools/ops_run_scenario.ts +154 -0
- package/dist/templates/emergency-dispatch-agent/tools/resources_dispatch.ts +112 -0
- package/dist/templates/emergency-dispatch-agent/tools/resources_get_available.ts +34 -0
- package/dist/templates/emergency-dispatch-agent/tools/resources_update_status.ts +63 -0
- package/dist/templates/entertainment-picks-agent/agent.eval.test.ts +281 -0
- package/dist/templates/entertainment-picks-agent/agent.test.ts +260 -0
- package/dist/templates/entertainment-picks-agent/agent.ts +14 -0
- package/dist/templates/entertainment-picks-agent/client.tsx +169 -0
- package/dist/templates/entertainment-picks-agent/shared.ts +50 -0
- package/dist/templates/entertainment-picks-agent/system-prompt.md +19 -0
- package/dist/templates/entertainment-picks-agent/tools/recommend.ts +79 -0
- package/dist/templates/entertainment-picks-agent/tools/revisit.ts +56 -0
- package/dist/templates/executive-inbox-agent/agent.eval.test.ts +296 -0
- package/dist/templates/executive-inbox-agent/agent.test.ts +682 -0
- package/dist/templates/executive-inbox-agent/agent.ts +51 -0
- package/dist/templates/executive-inbox-agent/calendar.test.ts +203 -0
- package/dist/templates/executive-inbox-agent/client.tsx +195 -0
- package/dist/templates/executive-inbox-agent/inbox.ts +233 -0
- package/dist/templates/executive-inbox-agent/meeting.ts +138 -0
- package/dist/templates/executive-inbox-agent/nodes.ts +148 -0
- package/dist/templates/executive-inbox-agent/prompts.ts +333 -0
- package/dist/templates/executive-inbox-agent/review.ts +425 -0
- package/dist/templates/executive-inbox-agent/shared.ts +486 -0
- package/dist/templates/executive-inbox-agent/system-prompt.md +15 -0
- package/dist/templates/executive-inbox-agent/tools/accept.ts +10 -0
- package/dist/templates/executive-inbox-agent/tools/ask_question.ts +30 -0
- package/dist/templates/executive-inbox-agent/tools/draft_reply.ts +67 -0
- package/dist/templates/executive-inbox-agent/tools/edit.ts +10 -0
- package/dist/templates/executive-inbox-agent/tools/ignore.ts +10 -0
- package/dist/templates/executive-inbox-agent/tools/inbox_status.ts +27 -0
- package/dist/templates/executive-inbox-agent/tools/meeting_assistant.ts +52 -0
- package/dist/templates/executive-inbox-agent/tools/new_email.ts +50 -0
- package/dist/templates/executive-inbox-agent/tools/open_email.ts +157 -0
- package/dist/templates/executive-inbox-agent/tools/respond.ts +10 -0
- package/dist/templates/executive-inbox-agent/tools/review_memory.ts +22 -0
- package/dist/templates/executive-inbox-agent/tools/send_calendar_invite.ts +68 -0
- package/dist/templates/executive-inbox-agent/tools/triage_inbox.ts +75 -0
- package/dist/templates/front-desk-agent/agent.eval.test.ts +177 -0
- package/dist/templates/front-desk-agent/agent.test.ts +155 -0
- package/dist/templates/front-desk-agent/agent.ts +22 -0
- package/dist/templates/front-desk-agent/shared.ts +239 -0
- package/dist/templates/front-desk-agent/system-prompt.md +13 -0
- package/dist/templates/front-desk-agent/tools/verify_account.ts +41 -0
- package/dist/templates/home-assistant-agent/agent.eval.test.ts +176 -0
- package/dist/templates/home-assistant-agent/agent.test.ts +513 -0
- package/dist/templates/home-assistant-agent/agent.ts +37 -0
- package/dist/templates/home-assistant-agent/client.tsx +176 -0
- package/dist/templates/home-assistant-agent/ring.tsx +55 -0
- package/dist/templates/home-assistant-agent/shared.ts +130 -0
- package/dist/templates/home-assistant-agent/system-prompt.md +43 -0
- package/dist/templates/home-assistant-agent/tools/cancel_reminders.ts +16 -0
- package/dist/templates/home-assistant-agent/tools/deep_research.ts +55 -0
- package/dist/templates/home-assistant-agent/tools/remind_me.ts +53 -0
- package/dist/templates/home-assistant-agent/tools/stop.ts +25 -0
- package/dist/templates/home-assistant-agent/use-speaker.ts +98 -0
- package/dist/templates/home-assistant-agent/workflows/remind.ts +25 -0
- package/dist/templates/home-assistant-agent/workflows/research-prompts.ts +41 -0
- package/dist/templates/home-assistant-agent/workflows/research.ts +110 -0
- package/dist/templates/home-assistant-agent/workflows/text.ts +30 -0
- package/dist/templates/hotel-reception-agent/agent.eval.test.ts +241 -0
- package/dist/templates/hotel-reception-agent/agent.test.ts +1121 -0
- package/dist/templates/hotel-reception-agent/agent.ts +66 -0
- package/dist/templates/hotel-reception-agent/booking.ts +159 -0
- package/dist/templates/hotel-reception-agent/card.ts +92 -0
- package/dist/templates/hotel-reception-agent/catalogs.ts +219 -0
- package/dist/templates/hotel-reception-agent/client.tsx +150 -0
- package/dist/templates/hotel-reception-agent/concierge.ts +104 -0
- package/dist/templates/hotel-reception-agent/desk-seams.test.ts +339 -0
- package/dist/templates/hotel-reception-agent/desk.ts +220 -0
- package/dist/templates/hotel-reception-agent/disputes.ts +214 -0
- package/dist/templates/hotel-reception-agent/events.ts +80 -0
- package/dist/templates/hotel-reception-agent/hotel.ts +412 -0
- package/dist/templates/hotel-reception-agent/policies.ts +209 -0
- package/dist/templates/hotel-reception-agent/records.ts +384 -0
- package/dist/templates/hotel-reception-agent/restaurant.ts +147 -0
- package/dist/templates/hotel-reception-agent/seed.ts +955 -0
- package/dist/templates/hotel-reception-agent/session.ts +50 -0
- package/dist/templates/hotel-reception-agent/shared.ts +353 -0
- package/dist/templates/hotel-reception-agent/system-prompt.md +76 -0
- package/dist/templates/hotel-reception-agent/tools/abandon_booking.ts +31 -0
- package/dist/templates/hotel-reception-agent/tools/add_to_waitlist.ts +42 -0
- package/dist/templates/hotel-reception-agent/tools/book_airport_car.ts +58 -0
- package/dist/templates/hotel-reception-agent/tools/book_business_center.ts +44 -0
- package/dist/templates/hotel-reception-agent/tools/book_spa_appointment.ts +39 -0
- package/dist/templates/hotel-reception-agent/tools/book_tour.ts +35 -0
- package/dist/templates/hotel-reception-agent/tools/cancel_restaurant_reservation.ts +26 -0
- package/dist/templates/hotel-reception-agent/tools/cancel_room_booking.ts +64 -0
- package/dist/templates/hotel-reception-agent/tools/check_restaurant_availability.ts +24 -0
- package/dist/templates/hotel-reception-agent/tools/check_room_availability.ts +40 -0
- package/dist/templates/hotel-reception-agent/tools/choose_room.ts +93 -0
- package/dist/templates/hotel-reception-agent/tools/confirm_booking.ts +154 -0
- package/dist/templates/hotel-reception-agent/tools/dispatch_emergency.ts +62 -0
- package/dist/templates/hotel-reception-agent/tools/dispute_charge.ts +91 -0
- package/dist/templates/hotel-reception-agent/tools/flag_late_arrival.ts +27 -0
- package/dist/templates/hotel-reception-agent/tools/lookup_booking.ts +49 -0
- package/dist/templates/hotel-reception-agent/tools/lookup_guest_history.ts +28 -0
- package/dist/templates/hotel-reception-agent/tools/lookup_invoice.ts +27 -0
- package/dist/templates/hotel-reception-agent/tools/lookup_policy.ts +20 -0
- package/dist/templates/hotel-reception-agent/tools/lookup_restaurant_reservation.ts +27 -0
- package/dist/templates/hotel-reception-agent/tools/modify_restaurant_reservation.ts +75 -0
- package/dist/templates/hotel-reception-agent/tools/order_flowers.ts +40 -0
- package/dist/templates/hotel-reception-agent/tools/record_card.ts +46 -0
- package/dist/templates/hotel-reception-agent/tools/record_followup.ts +51 -0
- package/dist/templates/hotel-reception-agent/tools/record_group_inquiry.ts +45 -0
- package/dist/templates/hotel-reception-agent/tools/record_guest_details.ts +71 -0
- package/dist/templates/hotel-reception-agent/tools/reinstate_booking.ts +65 -0
- package/dist/templates/hotel-reception-agent/tools/request_flight_reconfirmation.ts +55 -0
- package/dist/templates/hotel-reception-agent/tools/resend_confirmation.ts +40 -0
- package/dist/templates/hotel-reception-agent/tools/reserve_table.ts +87 -0
- package/dist/templates/hotel-reception-agent/tools/resolve_room_conflict.ts +49 -0
- package/dist/templates/hotel-reception-agent/tools/schedule_wakeup_call.ts +49 -0
- package/dist/templates/hotel-reception-agent/tools/set_do_not_disturb.ts +29 -0
- package/dist/templates/hotel-reception-agent/tools/set_extras.ts +51 -0
- package/dist/templates/hotel-reception-agent/tools/set_stay.ts +98 -0
- package/dist/templates/hotel-reception-agent/tools/start_booking_modification.ts +58 -0
- package/dist/templates/hotel-reception-agent/tools/start_room_booking.ts +50 -0
- package/dist/templates/hotel-reception-agent/tools/take_guest_message.ts +72 -0
- package/dist/templates/hotel-reception-agent/tools/transfer_call.ts +48 -0
- package/dist/templates/hotel-reception-agent/tools/update_card.ts +46 -0
- package/dist/templates/hotel-reception-agent/tools/verify_booking.ts +96 -0
- package/dist/templates/link-digest-workflow/agent.eval.test.ts +231 -0
- package/dist/templates/link-digest-workflow/agent.test.ts +647 -0
- package/dist/templates/link-digest-workflow/agent.ts +100 -0
- package/dist/templates/link-digest-workflow/api-client.ts +144 -0
- package/dist/templates/link-digest-workflow/client.tsx +231 -0
- package/dist/templates/link-digest-workflow/workflows/digest.ts +334 -0
- package/dist/templates/medication-safety-agent/agent.eval.test.ts +182 -0
- package/dist/templates/medication-safety-agent/agent.test.ts +332 -0
- package/dist/templates/medication-safety-agent/agent.ts +62 -0
- package/dist/templates/medication-safety-agent/fda.test.ts +130 -0
- package/dist/templates/medication-safety-agent/fda.ts +159 -0
- package/dist/templates/medication-safety-agent/system-prompt.md +26 -0
- package/dist/templates/medication-safety-agent/tools/check_drug_interaction.ts +62 -0
- package/dist/templates/medication-safety-agent/tools/medication_lookup.ts +36 -0
- package/dist/templates/meeting-recap-agent/agent.eval.test.ts +446 -0
- package/dist/templates/meeting-recap-agent/agent.test.ts +1408 -0
- package/dist/templates/meeting-recap-agent/agent.ts +104 -0
- package/dist/templates/meeting-recap-agent/shared.ts +44 -0
- package/dist/templates/meeting-recap-agent/tools/cancel_recap.ts +23 -0
- package/dist/templates/meeting-recap-agent/tools/keep_transcript.ts +31 -0
- package/dist/templates/meeting-recap-agent/tools/recap_progress.ts +24 -0
- package/dist/templates/meeting-recap-agent/tools/recap_status.ts +45 -0
- package/dist/templates/meeting-recap-agent/tools/request_recap.ts +44 -0
- package/dist/templates/meeting-recap-agent/workflows/recap.ts +838 -0
- package/dist/templates/meeting-recap-agent/workflows/tokens.ts +47 -0
- package/dist/templates/pizza-ordering-agent/agent.eval.test.ts +228 -0
- package/dist/templates/pizza-ordering-agent/agent.test.ts +299 -0
- package/dist/templates/pizza-ordering-agent/agent.ts +24 -0
- package/dist/templates/pizza-ordering-agent/client.tsx +104 -0
- package/dist/templates/pizza-ordering-agent/shared.ts +225 -0
- package/dist/templates/pizza-ordering-agent/system-prompt.md +23 -0
- package/dist/templates/pizza-ordering-agent/tools/add_pizza.ts +27 -0
- package/dist/templates/pizza-ordering-agent/tools/place_order.ts +26 -0
- package/dist/templates/pizza-ordering-agent/tools/remove_pizza.ts +18 -0
- package/dist/templates/pizza-ordering-agent/tools/set_customer_name.ts +13 -0
- package/dist/templates/pizza-ordering-agent/tools/update_pizza.ts +28 -0
- package/dist/templates/pizza-ordering-agent/tools/view_order.ts +21 -0
- package/dist/templates/podcast-digest-workflow/agent.eval.test.ts +421 -0
- package/dist/templates/podcast-digest-workflow/agent.test.ts +1225 -0
- package/dist/templates/podcast-digest-workflow/agent.ts +143 -0
- package/dist/templates/podcast-digest-workflow/client.tsx +259 -0
- package/dist/templates/podcast-digest-workflow/workflows/digest.ts +499 -0
- package/dist/templates/podcast-digest-workflow/workflows/feeds.ts +575 -0
- package/dist/templates/podcast-digest-workflow/workflows/slack.ts +153 -0
- package/dist/templates/push-to-talk-agent/agent.eval.test.ts +78 -0
- package/dist/templates/push-to-talk-agent/agent.test.ts +63 -0
- package/dist/templates/push-to-talk-agent/agent.ts +22 -0
- package/dist/templates/push-to-talk-agent/client.tsx +124 -0
- package/dist/templates/push-to-talk-agent/shared.ts +28 -0
- package/dist/templates/push-to-talk-agent/system-prompt.md +11 -0
- package/dist/templates/push-to-talk-agent/tools/list_notes.ts +15 -0
- package/dist/templates/push-to-talk-agent/tools/save_note.ts +26 -0
- package/dist/templates/quickstart-agent/agent.eval.test.ts +148 -0
- package/dist/templates/quickstart-agent/agent.test.ts +96 -0
- package/dist/templates/quickstart-agent/agent.ts +25 -0
- package/dist/templates/quickstart-agent/system-prompt.md +8 -0
- package/dist/templates/quickstart-agent/tools/get_weather.ts +59 -0
- package/dist/templates/research-handoff-agent/agent.eval.test.ts +341 -0
- package/dist/templates/research-handoff-agent/agent.test.ts +831 -0
- package/dist/templates/research-handoff-agent/agent.ts +118 -0
- package/dist/templates/research-handoff-agent/shared.ts +41 -0
- package/dist/templates/research-handoff-agent/tools/file_it_now.ts +32 -0
- package/dist/templates/research-handoff-agent/tools/request_research.ts +33 -0
- package/dist/templates/research-handoff-agent/tools/research_progress.ts +23 -0
- package/dist/templates/research-handoff-agent/tools/research_status.ts +73 -0
- package/dist/templates/research-handoff-agent/workflows/filing.ts +164 -0
- package/dist/templates/research-handoff-agent/workflows/prompts.ts +46 -0
- package/dist/templates/research-handoff-agent/workflows/research.ts +100 -0
- package/dist/templates/research-handoff-agent/workflows/review.ts +43 -0
- package/dist/templates/research-planner-agent/agent.eval.test.ts +241 -0
- package/dist/templates/research-planner-agent/agent.test.ts +635 -0
- package/dist/templates/research-planner-agent/agent.ts +26 -0
- package/dist/templates/research-planner-agent/client.tsx +120 -0
- package/dist/templates/research-planner-agent/procedure.ts +287 -0
- package/dist/templates/research-planner-agent/prompts.ts +153 -0
- package/dist/templates/research-planner-agent/shared.ts +327 -0
- package/dist/templates/research-planner-agent/system-prompt.md +18 -0
- package/dist/templates/research-planner-agent/tools/plan_status.ts +41 -0
- package/dist/templates/research-planner-agent/tools/revise_plan.ts +71 -0
- package/dist/templates/research-planner-agent/tools/start_plan.ts +62 -0
- package/dist/templates/research-planner-agent/tools/work_next_step.ts +177 -0
- package/dist/templates/retail-orders-agent/address.ts +109 -0
- package/dist/templates/retail-orders-agent/agent.eval.test.ts +305 -0
- package/dist/templates/retail-orders-agent/agent.test.ts +1260 -0
- package/dist/templates/retail-orders-agent/agent.ts +103 -0
- package/dist/templates/retail-orders-agent/authenticate.ts +34 -0
- package/dist/templates/retail-orders-agent/cancel.ts +114 -0
- package/dist/templates/retail-orders-agent/client.tsx +579 -0
- package/dist/templates/retail-orders-agent/keyterms.ts +154 -0
- package/dist/templates/retail-orders-agent/payment.ts +103 -0
- package/dist/templates/retail-orders-agent/pending.test.ts +204 -0
- package/dist/templates/retail-orders-agent/pending.ts +137 -0
- package/dist/templates/retail-orders-agent/refund.ts +19 -0
- package/dist/templates/retail-orders-agent/registry.test.ts +446 -0
- package/dist/templates/retail-orders-agent/resolve.test.ts +100 -0
- package/dist/templates/retail-orders-agent/resolve.ts +114 -0
- package/dist/templates/retail-orders-agent/returns.ts +101 -0
- package/dist/templates/retail-orders-agent/seed.json +4260 -0
- package/dist/templates/retail-orders-agent/seed.test.ts +233 -0
- package/dist/templates/retail-orders-agent/shared.test.ts +240 -0
- package/dist/templates/retail-orders-agent/shared.ts +547 -0
- package/dist/templates/retail-orders-agent/store.test.ts +331 -0
- package/dist/templates/retail-orders-agent/store.ts +485 -0
- package/dist/templates/retail-orders-agent/swap.test.ts +189 -0
- package/dist/templates/retail-orders-agent/swap.ts +358 -0
- package/dist/templates/retail-orders-agent/system-prompt.md +152 -0
- package/dist/templates/retail-orders-agent/tools/cancel_change.ts +33 -0
- package/dist/templates/retail-orders-agent/tools/cancel_pending_order.ts +31 -0
- package/dist/templates/retail-orders-agent/tools/confirm_change.ts +42 -0
- package/dist/templates/retail-orders-agent/tools/exchange_delivered_order_items.ts +47 -0
- package/dist/templates/retail-orders-agent/tools/find_user_id_by_email.ts +31 -0
- package/dist/templates/retail-orders-agent/tools/find_user_id_by_name_zip.ts +36 -0
- package/dist/templates/retail-orders-agent/tools/get_item_details.ts +27 -0
- package/dist/templates/retail-orders-agent/tools/get_order_details.ts +37 -0
- package/dist/templates/retail-orders-agent/tools/get_product_details.ts +30 -0
- package/dist/templates/retail-orders-agent/tools/get_user_details.ts +37 -0
- package/dist/templates/retail-orders-agent/tools/list_all_product_types.ts +22 -0
- package/dist/templates/retail-orders-agent/tools/modify_pending_order_address.ts +27 -0
- package/dist/templates/retail-orders-agent/tools/modify_pending_order_items.ts +48 -0
- package/dist/templates/retail-orders-agent/tools/modify_pending_order_payment.ts +32 -0
- package/dist/templates/retail-orders-agent/tools/modify_user_address.ts +26 -0
- package/dist/templates/retail-orders-agent/tools/return_delivered_order_items.ts +37 -0
- package/dist/templates/retail-orders-agent/tools/transfer_to_human_agents.ts +28 -0
- package/dist/templates/roadside-assistance-agent/agent.eval.test.ts +283 -0
- package/dist/templates/roadside-assistance-agent/agent.test.ts +650 -0
- package/dist/templates/roadside-assistance-agent/agent.ts +89 -0
- package/dist/templates/roadside-assistance-agent/call.ts +232 -0
- package/dist/templates/roadside-assistance-agent/events.ts +92 -0
- package/dist/templates/roadside-assistance-agent/shared.ts +346 -0
- package/dist/templates/roadside-assistance-agent/system-prompt.md +37 -0
- package/dist/templates/roadside-assistance-agent/tools/acknowledge_disclosure.ts +61 -0
- package/dist/templates/roadside-assistance-agent/tools/dispatch_truck.ts +149 -0
- package/dist/templates/roadside-assistance-agent/tools/job_status.ts +38 -0
- package/dist/templates/roadside-assistance-agent/tools/lookup_coverage.ts +83 -0
- package/dist/templates/roadside-assistance-agent/tools/report_location.ts +79 -0
- package/dist/templates/roadside-assistance-agent/tools/service_disclosure.ts +51 -0
- package/dist/templates/roadside-assistance-agent/yard.test.ts +162 -0
- package/dist/templates/roadside-assistance-agent/yard.ts +183 -0
- package/dist/templates/spoken-summary-workflow/agent.eval.test.ts +354 -0
- package/dist/templates/spoken-summary-workflow/agent.test.ts +493 -0
- package/dist/templates/spoken-summary-workflow/agent.ts +164 -0
- package/dist/templates/spoken-summary-workflow/client.tsx +220 -0
- package/dist/templates/spoken-summary-workflow/workflows/summarize.ts +260 -0
- package/dist/templates/spoken-summary-workflow/workflows/transcribe.ts +137 -0
- package/dist/templates/tabletop-rpg-agent/agent.eval.test.ts +314 -0
- package/dist/templates/tabletop-rpg-agent/agent.test.ts +1000 -0
- package/dist/templates/tabletop-rpg-agent/agent.ts +58 -0
- package/dist/templates/tabletop-rpg-agent/client.tsx +814 -0
- package/dist/templates/tabletop-rpg-agent/shared.ts +1028 -0
- package/dist/templates/tabletop-rpg-agent/system-prompt.md +116 -0
- package/dist/templates/tabletop-rpg-agent/tools/action_roll.ts +119 -0
- package/dist/templates/tabletop-rpg-agent/tools/burn_momentum.ts +110 -0
- package/dist/templates/tabletop-rpg-agent/tools/check_state.ts +37 -0
- package/dist/templates/tabletop-rpg-agent/tools/oracle.ts +255 -0
- package/dist/templates/tabletop-rpg-agent/tools/setup_character.ts +228 -0
- package/dist/templates/tabletop-rpg-agent/tools/update_state.ts +194 -0
- package/dist/templates/technical-support-agent/agent.eval.test.ts +260 -0
- package/dist/templates/technical-support-agent/agent.test.ts +424 -0
- package/dist/templates/technical-support-agent/agent.ts +39 -0
- package/dist/templates/technical-support-agent/client.tsx +132 -0
- package/dist/templates/technical-support-agent/knowledge.json +65 -0
- package/dist/templates/technical-support-agent/knowledge.ts +165 -0
- package/dist/templates/technical-support-agent/nodes.ts +143 -0
- package/dist/templates/technical-support-agent/procedure.ts +453 -0
- package/dist/templates/technical-support-agent/prompts.ts +102 -0
- package/dist/templates/technical-support-agent/shared.ts +128 -0
- package/dist/templates/technical-support-agent/system-prompt.md +18 -0
- package/dist/templates/technical-support-agent/tools/answer_question.ts +134 -0
- package/dist/templates/technical-support-agent/tools/list_topics.ts +23 -0
- package/dist/templates/technical-support-agent/tools/log_ticket.ts +30 -0
- package/dist/templates/text-adventure-agent/agent.eval.test.ts +222 -0
- package/dist/templates/text-adventure-agent/agent.test.ts +429 -0
- package/dist/templates/text-adventure-agent/agent.ts +76 -0
- package/dist/templates/text-adventure-agent/client.tsx +359 -0
- package/dist/templates/text-adventure-agent/shared.ts +210 -0
- package/dist/templates/text-adventure-agent/system-prompt.md +50 -0
- package/dist/templates/text-adventure-agent/tools/game_state_drop.ts +29 -0
- package/dist/templates/text-adventure-agent/tools/game_state_flag.ts +13 -0
- package/dist/templates/text-adventure-agent/tools/game_state_get.ts +17 -0
- package/dist/templates/text-adventure-agent/tools/game_state_move.ts +15 -0
- package/dist/templates/text-adventure-agent/tools/game_state_restart.ts +13 -0
- package/dist/templates/text-adventure-agent/tools/game_state_score.ts +19 -0
- package/dist/templates/text-adventure-agent/tools/game_state_take.ts +13 -0
- package/dist/templates/topic-briefing-agent/agent.eval.test.ts +202 -0
- package/dist/templates/topic-briefing-agent/agent.test.ts +651 -0
- package/dist/templates/topic-briefing-agent/agent.ts +45 -0
- package/dist/templates/topic-briefing-agent/shared.ts +392 -0
- package/dist/templates/topic-briefing-agent/slack.ts +108 -0
- package/dist/templates/topic-briefing-agent/system-prompt.md +54 -0
- package/dist/templates/topic-briefing-agent/tools/briefing_so_far.ts +43 -0
- package/dist/templates/topic-briefing-agent/tools/research_topic.ts +80 -0
- package/dist/templates/topic-briefing-agent/tools/send_briefing.ts +115 -0
- package/dist/templates/topic-briefing-agent/tools/verify_claim.ts +123 -0
- package/dist/templates/transcription-workflow/agent.eval.test.ts +237 -0
- package/dist/templates/transcription-workflow/agent.test.ts +2032 -0
- package/dist/templates/transcription-workflow/agent.ts +188 -0
- package/dist/templates/transcription-workflow/client.tsx +511 -0
- package/dist/templates/transcription-workflow/recover.test.ts +222 -0
- package/dist/templates/transcription-workflow/recover.ts +154 -0
- package/dist/templates/transcription-workflow/run-panel.tsx +212 -0
- package/dist/templates/transcription-workflow/total-latency.tsx +170 -0
- package/dist/templates/transcription-workflow/workflows/batch.ts +189 -0
- package/dist/templates/transcription-workflow/workflows/downsample.ts +273 -0
- package/dist/templates/transcription-workflow/workflows/normalize.ts +385 -0
- package/dist/templates/transcription-workflow/workflows/stitch.ts +122 -0
- package/dist/templates/transcription-workflow/workflows/stream.ts +690 -0
- package/dist/templates/transcription-workflow/workflows/sync-api.ts +81 -0
- package/dist/templates/transcription-workflow/workflows/transcribe.ts +479 -0
- package/dist/templates/transcription-workflow/workflows/wav.ts +250 -0
- package/dist/templates/travel-concierge-agent/agent.eval.test.ts +300 -0
- package/dist/templates/travel-concierge-agent/agent.test.ts +601 -0
- package/dist/templates/travel-concierge-agent/agent.ts +62 -0
- package/dist/templates/travel-concierge-agent/call-events.ts +80 -0
- package/dist/templates/travel-concierge-agent/client.tsx +146 -0
- package/dist/templates/travel-concierge-agent/routing.ts +170 -0
- package/dist/templates/travel-concierge-agent/shared.ts +862 -0
- package/dist/templates/travel-concierge-agent/system-prompt.md +30 -0
- package/dist/templates/travel-concierge-agent/tools/book_car_rental.ts +21 -0
- package/dist/templates/travel-concierge-agent/tools/book_excursion.ts +19 -0
- package/dist/templates/travel-concierge-agent/tools/book_hotel.ts +21 -0
- package/dist/templates/travel-concierge-agent/tools/cancel_action.ts +9 -0
- package/dist/templates/travel-concierge-agent/tools/cancel_ticket.ts +21 -0
- package/dist/templates/travel-concierge-agent/tools/complete_or_escalate.ts +9 -0
- package/dist/templates/travel-concierge-agent/tools/confirm_action.ts +9 -0
- package/dist/templates/travel-concierge-agent/tools/lookup_booking.ts +36 -0
- package/dist/templates/travel-concierge-agent/tools/search_car_rentals.ts +36 -0
- package/dist/templates/travel-concierge-agent/tools/search_excursions.ts +40 -0
- package/dist/templates/travel-concierge-agent/tools/search_flights.ts +58 -0
- package/dist/templates/travel-concierge-agent/tools/search_hotels.ts +39 -0
- package/dist/templates/travel-concierge-agent/tools/to_car_rental_assistant.ts +11 -0
- package/dist/templates/travel-concierge-agent/tools/to_excursion_assistant.ts +11 -0
- package/dist/templates/travel-concierge-agent/tools/to_flight_assistant.ts +11 -0
- package/dist/templates/travel-concierge-agent/tools/to_hotel_assistant.ts +11 -0
- package/dist/templates/travel-concierge-agent/tools/update_ticket.ts +23 -0
- package/dist/templates/web-research-agent/agent.eval.test.ts +144 -0
- package/dist/templates/web-research-agent/agent.test.ts +181 -0
- package/dist/templates/web-research-agent/agent.ts +128 -0
- package/dist/templates/web-research-agent/system-prompt.md +33 -0
- package/dist/templates/word-game-agent/agent.eval.test.ts +222 -0
- package/dist/templates/word-game-agent/agent.test.ts +484 -0
- package/dist/templates/word-game-agent/agent.ts +55 -0
- package/dist/templates/word-game-agent/client.tsx +211 -0
- package/dist/templates/word-game-agent/game.ts +133 -0
- package/dist/templates/word-game-agent/guess.ts +63 -0
- package/dist/templates/word-game-agent/player.ts +67 -0
- package/dist/templates/word-game-agent/shared.ts +249 -0
- package/dist/templates/word-game-agent/system-prompt.md +15 -0
- package/dist/templates/word-game-agent/tools/final_score.ts +37 -0
- package/dist/templates/word-game-agent/tools/relay_description.ts +137 -0
- package/dist/templates/word-game-agent/tools/repeat_word.ts +19 -0
- package/dist/templates/word-game-agent/tools/skip_word.ts +31 -0
- package/dist/templates/word-game-agent/tools/start_game.ts +52 -0
- package/dist/templates/word-game-agent/words.ts +278 -0
- package/dist/test-XufelYGW.mjs +104 -0
- package/dist/test.d.ts +81 -0
- package/dist/typecheck.d.ts +44 -0
- package/dist/typecheck.mjs +185 -0
- package/dist/worker-bundler.d.ts +37 -0
- package/dist/worker-bundler.mjs +156 -0
- package/dist/workflow-CDUlTD5B.mjs +239 -0
- package/dist/workflow.d.ts +76 -0
- package/package.json +74 -28
- package/dist/_api-client-H4MFOr8j.mjs +0 -35
- package/dist/_bundler-DQtFVeww.mjs +0 -125
- package/dist/_discover-DzsMlg3G.mjs +0 -218
- package/dist/_init-CbMs9S2O.mjs +0 -56
- package/dist/_templates-BDkbj3TM.mjs +0 -72
- package/dist/_ui-DWGXImbO.mjs +0 -30
- package/dist/delete-CalIL6Pg.mjs +0 -34
- package/dist/deploy-CLs8gLHV.mjs +0 -53
- package/dist/dev-DEZKrw8v.mjs +0 -18
- package/dist/init-CNuntiij.mjs +0 -114
- package/dist/secret-xmLQ96Yz.mjs +0 -46
- package/dist/test-yqHGZPF3.mjs +0 -44
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
speakCode,
|
|
9
|
+
spokenDate,
|
|
10
|
+
spokenTime,
|
|
11
|
+
TODAY,
|
|
12
|
+
} from "../records.ts";
|
|
13
|
+
import { openDinnerSlots, reserveTable } from "../restaurant.ts";
|
|
14
|
+
import { hotelSlot } from "../session.ts";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Book a table — their `BookRestaurantTask`, collapsed to one call.
|
|
18
|
+
*
|
|
19
|
+
* That task existed for one coupling (open slots depend on the date and the
|
|
20
|
+
* party) and otherwise collected independent values one dialog at a time. The
|
|
21
|
+
* coupling survives as the refusal: a slot that is not open comes back with the
|
|
22
|
+
* slots that are, so the model offers those and calls again. Their
|
|
23
|
+
* `MAX_PARTY_SIZE` bail-out survives too — a bigger party is private dining the
|
|
24
|
+
* restaurant arranges directly, never a table quietly shrunk to fit.
|
|
25
|
+
*/
|
|
26
|
+
export default hotelSlot.updateTool({
|
|
27
|
+
description:
|
|
28
|
+
"Book a restaurant table once you have the date, time, party size, and the caller's name and " +
|
|
29
|
+
"phone, read back and agreed. A time that is not open comes back with the open ones. Parties " +
|
|
30
|
+
"over six are private dining - transfer_call to the restaurant instead.",
|
|
31
|
+
inputSchema: z.object({
|
|
32
|
+
date: isoDate("the date"),
|
|
33
|
+
time: clockTime("the sitting time"),
|
|
34
|
+
partySize: z.number().int().min(1),
|
|
35
|
+
firstName: z.string().min(1),
|
|
36
|
+
lastName: z.string().min(1),
|
|
37
|
+
phone: z.string().min(1),
|
|
38
|
+
notes: z.string().max(200).optional().describe("Allergy, anniversary, seating wish"),
|
|
39
|
+
}),
|
|
40
|
+
execute(args, hotel) {
|
|
41
|
+
if (args.date < TODAY) return toolFailure("the date can't be in the past");
|
|
42
|
+
if (args.partySize > 6) {
|
|
43
|
+
return toolFailure(
|
|
44
|
+
`${args.partySize} guests is beyond a normal table - we seat up to 6. Don't book it here and don't ` +
|
|
45
|
+
"reduce the number to fit: this is a large-party / private-dining request the restaurant handles " +
|
|
46
|
+
"directly. Tell the caller you'll put them on hold to connect them and, once they agree, " +
|
|
47
|
+
'transfer_call(destination "restaurant") with a one-line summary.',
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
if (!(DINNER_SLOTS as readonly string[]).includes(args.time)) {
|
|
51
|
+
return toolFailure(
|
|
52
|
+
`the restaurant seats at ${DINNER_SLOTS.map(spokenTime).join(", ")} - pick one of those`,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
const reservation = reserveTable(hotel, {
|
|
56
|
+
firstName: args.firstName,
|
|
57
|
+
lastName: args.lastName,
|
|
58
|
+
phone: args.phone,
|
|
59
|
+
partySize: args.partySize,
|
|
60
|
+
date: args.date,
|
|
61
|
+
time: args.time,
|
|
62
|
+
notes: args.notes ?? null,
|
|
63
|
+
});
|
|
64
|
+
if (isToolFailure(reservation)) {
|
|
65
|
+
const open = openDinnerSlots(hotel, args.date, args.partySize);
|
|
66
|
+
if (open.length === 0)
|
|
67
|
+
return toolFailure(
|
|
68
|
+
`fully booked on ${spokenDate(args.date)} for ${args.partySize} - ask for another date`,
|
|
69
|
+
);
|
|
70
|
+
return toolFailure(
|
|
71
|
+
`${spokenTime(args.time)} isn't open for that party; offer one of: ${open.map(spokenTime).join(", ")}`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
reserved: true,
|
|
76
|
+
code: reservation.code,
|
|
77
|
+
spokenCode: speakCode(reservation.code),
|
|
78
|
+
date: spokenDate(reservation.date),
|
|
79
|
+
time: spokenTime(reservation.time),
|
|
80
|
+
partySize: reservation.partySize,
|
|
81
|
+
message:
|
|
82
|
+
`You're set for ${spokenTime(reservation.time)} on ${spokenDate(reservation.date)} for ${reservation.partySize} ` +
|
|
83
|
+
`${plural(reservation.partySize, "guest")}. Confirmation code ${speakCode(reservation.code)}. Relay this; ` +
|
|
84
|
+
"no further tool call is needed.",
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { isToolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { resolveRoomConflict } from "../hotel.ts";
|
|
3
|
+
import { spokenDate } from "../records.ts";
|
|
4
|
+
import { hotelSlot } from "../session.ts";
|
|
5
|
+
import { requireVerified } from "../shared.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Fix a double-booked room on the verified booking — their
|
|
9
|
+
* `resolve_room_conflict`, running the house procedure in fixed order: a free
|
|
10
|
+
* room of the same or better category (an upgrade is free), and only when the
|
|
11
|
+
* house is full, a walk to the partner hotel on us.
|
|
12
|
+
*/
|
|
13
|
+
export default hotelSlot.updateTool({
|
|
14
|
+
description:
|
|
15
|
+
"Fix a double-booked / no-room situation on the verified booking - run this when lookup_booking " +
|
|
16
|
+
"warned the room is double-booked. Moves the guest to a same-or-better room for free, or when " +
|
|
17
|
+
"nothing in the house fits, arranges the walk (partner hotel tonight on us, taxi covered, their " +
|
|
18
|
+
'room back from the return date). Deliver the result per lookup_policy "guest_walks".',
|
|
19
|
+
execute(_args, hotel) {
|
|
20
|
+
const booking = requireVerified(hotel);
|
|
21
|
+
if (isToolFailure(booking)) return booking;
|
|
22
|
+
const resolution = resolveRoomConflict(hotel, booking.code);
|
|
23
|
+
if (isToolFailure(resolution)) return resolution;
|
|
24
|
+
if (resolution.kind === "moved") {
|
|
25
|
+
return {
|
|
26
|
+
resolved: "moved" as const,
|
|
27
|
+
room: resolution.roomId,
|
|
28
|
+
roomType: resolution.type.replaceAll("_", " "),
|
|
29
|
+
view: resolution.view,
|
|
30
|
+
upgraded: resolution.upgraded,
|
|
31
|
+
message:
|
|
32
|
+
`Moved to room ${resolution.roomId} - a ${resolution.view}-view ${resolution.type.replaceAll("_", " ")} ` +
|
|
33
|
+
`(${resolution.upgraded ? "an upgrade, free of charge" : "same category, no charge"}), same dates, total unchanged. ` +
|
|
34
|
+
"Own the overbooking and explain plainly why it happened, then confirm they still have a place for the whole " +
|
|
35
|
+
"stay at the same total. No further tool call is needed.",
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
resolved: "walked" as const,
|
|
40
|
+
partnerHotel: resolution.partner,
|
|
41
|
+
returnDate: spokenDate(resolution.returnDate),
|
|
42
|
+
message:
|
|
43
|
+
`No room in the house fits (every room was checked) - walk arranged at ${resolution.partner}, two blocks ` +
|
|
44
|
+
`away, room and taxi both on us; the guest's room here is back ${spokenDate(resolution.returnDate)}. Own the ` +
|
|
45
|
+
"overbooking, explain plainly why it happened, then the plan above, all at no extra cost to them. Give it in " +
|
|
46
|
+
'short pieces. If still upset after the full plan, record a manager callback (record_followup, kind "callback").',
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { isToolFailure, toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { requireRoom } from "../hotel.ts";
|
|
4
|
+
import { clockTime, isoDate, speakCode, spokenDate, spokenTime, TODAY } from "../records.ts";
|
|
5
|
+
import { hotelSlot } from "../session.ts";
|
|
6
|
+
import { addTicket } from "../shared.ts";
|
|
7
|
+
|
|
8
|
+
/** Their `schedule_wakeup_call`: it actually sets the call — never a followup note instead. */
|
|
9
|
+
export default hotelSlot.updateTool({
|
|
10
|
+
description:
|
|
11
|
+
"Schedule a wake-up call to a guest's room. This actually sets the call - never log a wake-up " +
|
|
12
|
+
"as a followup. Collect room, name, date and time, read them back, then call once agreed. No " +
|
|
13
|
+
"booking verification needed.",
|
|
14
|
+
inputSchema: z.object({
|
|
15
|
+
room: z.string().describe("The room number as the caller gave it, e.g. 304"),
|
|
16
|
+
guestName: z.string().min(1),
|
|
17
|
+
date: isoDate("the date").describe("YYYY-MM-DD; 'tomorrow morning' is tomorrow's date"),
|
|
18
|
+
time: clockTime("the wake-up time"),
|
|
19
|
+
}),
|
|
20
|
+
execute({ room, guestName, date, time }, hotel) {
|
|
21
|
+
const found = requireRoom(hotel, room);
|
|
22
|
+
if (isToolFailure(found)) return found;
|
|
23
|
+
if (date < TODAY)
|
|
24
|
+
return toolFailure(`${spokenDate(date)} is in the past - re-confirm the date`);
|
|
25
|
+
const ticket = addTicket(
|
|
26
|
+
hotel,
|
|
27
|
+
"wakeup_call",
|
|
28
|
+
"WUC",
|
|
29
|
+
`room ${found.id}, ${date} ${time} (${guestName})`,
|
|
30
|
+
{
|
|
31
|
+
room: found.id,
|
|
32
|
+
guestName,
|
|
33
|
+
date,
|
|
34
|
+
time,
|
|
35
|
+
status: "scheduled",
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
return {
|
|
39
|
+
scheduled: true,
|
|
40
|
+
reference: ticket.code,
|
|
41
|
+
spokenReference: speakCode(ticket.code),
|
|
42
|
+
when: `${spokenDate(date)} at ${spokenTime(time)}`,
|
|
43
|
+
room: found.id,
|
|
44
|
+
next:
|
|
45
|
+
"Confirm it's set. If the caller worries about sleeping through: a second call comes about five " +
|
|
46
|
+
"minutes later if there's no answer, and no response to that sends staff up for an in-person room check.",
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isToolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { requireRoom } from "../hotel.ts";
|
|
4
|
+
import { speakCode } from "../records.ts";
|
|
5
|
+
import { hotelSlot } from "../session.ts";
|
|
6
|
+
import { addTicket } from "../shared.ts";
|
|
7
|
+
|
|
8
|
+
/** Their `set_do_not_disturb`: a standing hold on a room's calls and messages. */
|
|
9
|
+
export default hotelSlot.updateTool({
|
|
10
|
+
description:
|
|
11
|
+
"Place a Do-Not-Disturb hold on an in-house guest's room - their calls and messages are held until " +
|
|
12
|
+
"they lift it. A standing hold, not a one-off. Always tell the guest a genuine emergency still gets through.",
|
|
13
|
+
inputSchema: z.object({ room: z.string() }),
|
|
14
|
+
execute({ room }, hotel) {
|
|
15
|
+
const found = requireRoom(hotel, room);
|
|
16
|
+
if (isToolFailure(found)) return found;
|
|
17
|
+
const ticket = addTicket(hotel, "do_not_disturb", "DND", `room ${found.id}`, {
|
|
18
|
+
room: found.id,
|
|
19
|
+
status: "active",
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
set: true,
|
|
23
|
+
room: found.id,
|
|
24
|
+
reference: ticket.code,
|
|
25
|
+
spokenReference: speakCode(ticket.code),
|
|
26
|
+
next: "Confirm it holds their calls and messages until they ask to lift it, and that a genuine emergency still gets through.",
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { bookingStatus, nextStep, requote } from "../booking.ts";
|
|
4
|
+
import { AFTER_ROOM, deskFlow } from "../desk.ts";
|
|
5
|
+
import { type RoomExtra, speakUsd } from "../records.ts";
|
|
6
|
+
import { hotelSlot } from "../session.ts";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Record the caller's answer on each extra — their `set_extras`.
|
|
10
|
+
*
|
|
11
|
+
* One boolean per extra rather than a list, for their reason: the model has to
|
|
12
|
+
* answer for every one, so an extra it never raised with the caller cannot be
|
|
13
|
+
* quietly left out the way an omitted list member is. This is where the total
|
|
14
|
+
* is computed, because every extra moves it.
|
|
15
|
+
*/
|
|
16
|
+
export default deskFlow.tool({
|
|
17
|
+
description:
|
|
18
|
+
"Record the caller's answer on each extra, after you have offered them. Every extra takes an " +
|
|
19
|
+
"explicit true or false - all four false is a real answer. The stay's total is computed here.",
|
|
20
|
+
when: AFTER_ROOM,
|
|
21
|
+
inputSchema: z.object({
|
|
22
|
+
breakfast: z.boolean(),
|
|
23
|
+
valet: z.boolean(),
|
|
24
|
+
lateCheckout: z.boolean(),
|
|
25
|
+
pets: z.boolean(),
|
|
26
|
+
}),
|
|
27
|
+
execute: (args, ctx) =>
|
|
28
|
+
hotelSlot.update(ctx, (hotel) => {
|
|
29
|
+
const d = hotel.draft;
|
|
30
|
+
if (d === null)
|
|
31
|
+
return toolFailure("No booking flow is open - call start_room_booking first.");
|
|
32
|
+
if (d.roomType === null) return toolFailure("no room recorded yet - call choose_room first");
|
|
33
|
+
const answers: [RoomExtra, boolean][] = [
|
|
34
|
+
["breakfast", args.breakfast],
|
|
35
|
+
["valet", args.valet],
|
|
36
|
+
["late_checkout", args.lateCheckout],
|
|
37
|
+
["pets", args.pets],
|
|
38
|
+
];
|
|
39
|
+
d.extras = answers.filter(([, wanted]) => wanted).map(([name]) => name);
|
|
40
|
+
d.extrasSet = true;
|
|
41
|
+
requote(hotel, d);
|
|
42
|
+
return {
|
|
43
|
+
recorded:
|
|
44
|
+
d.extras.length > 0 ? d.extras.map((e) => e.replaceAll("_", " ")).join(", ") : "none",
|
|
45
|
+
total: d.quotedTotal === null ? null : `${speakUsd(d.quotedTotal)} including tax`,
|
|
46
|
+
status: bookingStatus(d),
|
|
47
|
+
next: nextStep(d),
|
|
48
|
+
};
|
|
49
|
+
}),
|
|
50
|
+
sendFrom: (result) => ({ type: result.next }),
|
|
51
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { bookingStatus, nextStep, requote } from "../booking.ts";
|
|
4
|
+
import { deskFlow, IN_BOOKING } from "../desk.ts";
|
|
5
|
+
import { describeRoomOptions, listRoomOptions } from "../hotel.ts";
|
|
6
|
+
import { daysBetween, isoDate, MAX_PARTY_SIZE, spokenDate, TODAY } from "../records.ts";
|
|
7
|
+
import { hotelSlot } from "../session.ts";
|
|
8
|
+
import { bookingByCode } from "../shared.ts";
|
|
9
|
+
|
|
10
|
+
const MAX_NIGHTS = 30;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Record the stay — their `set_stay`, on both the booking and the modification
|
|
14
|
+
* task, since the draft's `mode` says which.
|
|
15
|
+
*
|
|
16
|
+
* **Sold-out dates are NOT persisted.** If the model drifted forward without
|
|
17
|
+
* re-setting, the booking would carry invalid dates; the caller needs different
|
|
18
|
+
* dates anyway, so the refusal (which sends no event) is the right shape.
|
|
19
|
+
*
|
|
20
|
+
* **A re-dated pick that dies re-opens the OFFER.** Their `_must_offer` was
|
|
21
|
+
* armed only where a pick was invalidated by new dates — not on the first
|
|
22
|
+
* `set_stay` (nothing to invalidate) and not when the pick survives (re-arming
|
|
23
|
+
* would rewind a settled step). `OFFER` here follows the same three cases.
|
|
24
|
+
*/
|
|
25
|
+
export default deskFlow.tool({
|
|
26
|
+
description:
|
|
27
|
+
"Record the stay dates and party size. The result lists each available room type with " +
|
|
28
|
+
'its view and rate - reference material for OFFERING the choice and answering "how much?". ' +
|
|
29
|
+
"Never pick a type yourself. Pass the FULL stay even when only one field changes.",
|
|
30
|
+
when: IN_BOOKING,
|
|
31
|
+
inputSchema: z.object({
|
|
32
|
+
checkIn: isoDate("the check-in date"),
|
|
33
|
+
checkOut: isoDate("the check-out date"),
|
|
34
|
+
guests: z
|
|
35
|
+
.number()
|
|
36
|
+
.int()
|
|
37
|
+
.min(1)
|
|
38
|
+
.max(MAX_PARTY_SIZE)
|
|
39
|
+
.describe("Guests in the room - ask if not said"),
|
|
40
|
+
}),
|
|
41
|
+
execute: ({ checkIn, checkOut, guests }, ctx) =>
|
|
42
|
+
hotelSlot.update(ctx, (hotel) => {
|
|
43
|
+
const d = hotel.draft;
|
|
44
|
+
if (d === null)
|
|
45
|
+
return toolFailure("No booking flow is open - call start_room_booking first.");
|
|
46
|
+
if (checkOut <= checkIn) return toolFailure("check-out must be after check-in");
|
|
47
|
+
if (daysBetween(checkIn, checkOut) > MAX_NIGHTS)
|
|
48
|
+
return toolFailure(`the max stay is ${MAX_NIGHTS} nights`);
|
|
49
|
+
const existing = d.existingCode === null ? undefined : bookingByCode(hotel, d.existingCode);
|
|
50
|
+
// An in-house booking's existing check-in IS in the past, and the caller
|
|
51
|
+
// should be able to keep it while shifting the check-out.
|
|
52
|
+
if (checkIn < TODAY && checkIn !== existing?.checkIn)
|
|
53
|
+
return toolFailure("check-in can't be in the past");
|
|
54
|
+
|
|
55
|
+
const options = listRoomOptions(hotel, {
|
|
56
|
+
checkIn,
|
|
57
|
+
checkOut,
|
|
58
|
+
guests,
|
|
59
|
+
smoking: d.mode === "modify" ? d.smoking : undefined,
|
|
60
|
+
excludeCode: d.existingCode,
|
|
61
|
+
});
|
|
62
|
+
if (options.length === 0) {
|
|
63
|
+
return toolFailure(
|
|
64
|
+
`sold out for ${spokenDate(checkIn)} to ${spokenDate(checkOut)}, ${guests} guests - dates not ` +
|
|
65
|
+
"recorded; offer the nights either side, or the waitlist (add_to_waitlist).",
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
d.checkIn = checkIn;
|
|
70
|
+
d.checkOut = checkOut;
|
|
71
|
+
d.guests = guests;
|
|
72
|
+
const hadRoom = d.roomType !== null;
|
|
73
|
+
const survives =
|
|
74
|
+
hadRoom &&
|
|
75
|
+
options.some((o) => o.type === d.roomType && (d.view === null || o.view === d.view));
|
|
76
|
+
let offer = false;
|
|
77
|
+
if (!survives) {
|
|
78
|
+
d.roomType = null;
|
|
79
|
+
d.view = null;
|
|
80
|
+
if (hadRoom) offer = true;
|
|
81
|
+
}
|
|
82
|
+
requote(hotel, d);
|
|
83
|
+
return {
|
|
84
|
+
recorded: `${spokenDate(checkIn)} to ${spokenDate(checkOut)}, ${guests} guests`,
|
|
85
|
+
nights: daysBetween(checkIn, checkOut),
|
|
86
|
+
options: describeRoomOptions(options),
|
|
87
|
+
note:
|
|
88
|
+
"one line per room type + view - the price is that pairing's, so the view is part of " +
|
|
89
|
+
"what the caller is picking",
|
|
90
|
+
status: offer
|
|
91
|
+
? "the room the caller had chosen is not available for these dates - offer the options " +
|
|
92
|
+
"above and ask which they want; choose_room opens once they have answered"
|
|
93
|
+
: bookingStatus(d),
|
|
94
|
+
next: offer ? ("OFFER" as const) : nextStep(d),
|
|
95
|
+
};
|
|
96
|
+
}),
|
|
97
|
+
sendFrom: (result) => ({ type: result.next }),
|
|
98
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { isToolFailure, toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { draftForModification } from "../booking.ts";
|
|
4
|
+
import { deskFlow } from "../desk.ts";
|
|
5
|
+
import { requireFloorPlanRoom } from "../hotel.ts";
|
|
6
|
+
import { speakUsd, spokenDate, TODAY } from "../records.ts";
|
|
7
|
+
import { hotelSlot } from "../session.ts";
|
|
8
|
+
import { requireVerified } from "../shared.ts";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Open the modification flow on the verified booking — their
|
|
12
|
+
* `start_booking_modification`, which `await`ed a `ModifyBookingTask` with the
|
|
13
|
+
* booking pre-loaded. The draft is pre-filled here and the dialog enters
|
|
14
|
+
* `booking.editing`, where the recording tools are open and `confirm_booking`
|
|
15
|
+
* is not until something changes and is read back.
|
|
16
|
+
*
|
|
17
|
+
* The result carries the booking's FACTS, for the reason their task put them in
|
|
18
|
+
* its instructions: the model is asked to read the booking back, so its actual
|
|
19
|
+
* dates and amounts have to be in its context or it invents them.
|
|
20
|
+
*/
|
|
21
|
+
export default deskFlow.tool({
|
|
22
|
+
description:
|
|
23
|
+
"Start changing an existing, verified booking: dates, room type, room view, extras, party " +
|
|
24
|
+
"size. This is the path for a guest whose room's view or type doesn't match what they " +
|
|
25
|
+
"booked - it moves them. Identity fields are NOT changed here (record_followup, " +
|
|
26
|
+
"kind identity_change) and a new card goes through update_card. NOT for cancellations.",
|
|
27
|
+
when: "desk",
|
|
28
|
+
inputSchema: z.object({}),
|
|
29
|
+
execute: (_args, ctx) =>
|
|
30
|
+
hotelSlot.update(ctx, (hotel) => {
|
|
31
|
+
const booking = requireVerified(hotel);
|
|
32
|
+
if (isToolFailure(booking)) return booking;
|
|
33
|
+
if (booking.status !== "confirmed")
|
|
34
|
+
return toolFailure("that booking was cancelled - nothing to modify");
|
|
35
|
+
if (booking.checkOut < TODAY)
|
|
36
|
+
return toolFailure("that stay already ended - can't modify a past booking");
|
|
37
|
+
const room = requireFloorPlanRoom(hotel, booking.roomId);
|
|
38
|
+
if (isToolFailure(room)) return room;
|
|
39
|
+
hotel.draft = draftForModification(booking, room);
|
|
40
|
+
const extras = booking.extras.length > 0 ? booking.extras.join(", ") : "none";
|
|
41
|
+
return {
|
|
42
|
+
loaded: {
|
|
43
|
+
guest: `${booking.firstName} ${booking.lastName}`,
|
|
44
|
+
room: `${room.type.replaceAll("_", " ")}, ${room.view} view, room ${room.id}`,
|
|
45
|
+
checkIn: spokenDate(booking.checkIn),
|
|
46
|
+
checkOut: spokenDate(booking.checkOut),
|
|
47
|
+
guests: booking.guests,
|
|
48
|
+
extras,
|
|
49
|
+
total: speakUsd(booking.total),
|
|
50
|
+
},
|
|
51
|
+
instructions:
|
|
52
|
+
"Read the booking back briefly in one sentence and ask what the caller wants to change. " +
|
|
53
|
+
"These are the ONLY facts to read back - never invent dates or amounts. Run set_stay " +
|
|
54
|
+
"before choose_room when changing dates.",
|
|
55
|
+
};
|
|
56
|
+
}),
|
|
57
|
+
send: { type: "MODIFY_STARTED" },
|
|
58
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { bookingStatus, draftForNewBooking } from "../booking.ts";
|
|
4
|
+
import { deskFlow } from "../desk.ts";
|
|
5
|
+
import { speakCode } from "../records.ts";
|
|
6
|
+
import { hotelSlot } from "../session.ts";
|
|
7
|
+
import { callerTurns } from "../shared.ts";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Open the room-booking flow — their `start_room_booking`, which `await`ed a
|
|
11
|
+
* `BookRoomTask`. Here it opens the `booking` dialog, whose states carry the
|
|
12
|
+
* task's instructions and whose gates carry its tool set.
|
|
13
|
+
*
|
|
14
|
+
* **The double-booking guard is theirs, and it reads `ctx.messages`.** After a
|
|
15
|
+
* booking completes the model sometimes re-enters this flow on its own and
|
|
16
|
+
* re-fills every field from the transcript — no caller input — committing a
|
|
17
|
+
* duplicate into another room. If the caller has not spoken since the last
|
|
18
|
+
* booking there is nothing to book, so this REFUSES, and a refusal sends no
|
|
19
|
+
* event: the dialog stays at the desk. A real second room (a family's extra
|
|
20
|
+
* room) is always preceded by the caller asking, so that path stays open.
|
|
21
|
+
*/
|
|
22
|
+
export default deskFlow.tool({
|
|
23
|
+
description:
|
|
24
|
+
"Start the room-booking flow. Call it the MOMENT the caller wants to book - never " +
|
|
25
|
+
"pre-collect name, email, phone or card first; the flow gathers everything. Not for " +
|
|
26
|
+
"changing an existing booking (start_booking_modification).",
|
|
27
|
+
when: "desk",
|
|
28
|
+
inputSchema: z.object({}),
|
|
29
|
+
execute: (_args, ctx) =>
|
|
30
|
+
hotelSlot.update(ctx, (hotel) => {
|
|
31
|
+
const prev = hotel.lastBooking;
|
|
32
|
+
if (prev !== null && callerTurns(ctx.messages) <= prev.callerTurns) {
|
|
33
|
+
return toolFailure(
|
|
34
|
+
`This booking is already complete - confirmation ${speakCode(prev.code)} was issued ` +
|
|
35
|
+
"moments ago and the caller has the code and total. Do NOT book again or repeat the " +
|
|
36
|
+
"confirmation. If they actually want an ADDITIONAL room, ask them to confirm that " +
|
|
37
|
+
"first; otherwise ask if there is anything else.",
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
hotel.draft = draftForNewBooking();
|
|
41
|
+
return {
|
|
42
|
+
opened: true,
|
|
43
|
+
instructions:
|
|
44
|
+
"Help the caller book a room. Record anything they have already mentioned - dates, " +
|
|
45
|
+
"party size, room type - then ask only for what is still missing, one question per turn.",
|
|
46
|
+
status: bookingStatus(hotel.draft),
|
|
47
|
+
};
|
|
48
|
+
}),
|
|
49
|
+
send: { type: "BOOKING_STARTED" },
|
|
50
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { countWords } from "@alexkroman1/aai/utils";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { digitsOf, speakCode, TODAY } from "../records.ts";
|
|
5
|
+
import { hotelSlot } from "../session.ts";
|
|
6
|
+
import { addTicket } from "../shared.ts";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Take a message for someone who may be a guest — their `take_guest_message`.
|
|
10
|
+
*
|
|
11
|
+
* **Whether the recipient is in-house is resolved here and NEVER returned.** The
|
|
12
|
+
* ticket records `delivered` or `undeliverable` for the desk to act on, and the
|
|
13
|
+
* result the model reads carries neither word, so a receptionist taking the
|
|
14
|
+
* message cannot leak a guest's presence however the caller asks. `agent.test.ts`
|
|
15
|
+
* asserts the result for an in-house guest and a stranger are indistinguishable.
|
|
16
|
+
*/
|
|
17
|
+
export default hotelSlot.updateTool({
|
|
18
|
+
description:
|
|
19
|
+
"Take a message for someone the caller says is staying here. Delivered only if they are in fact a " +
|
|
20
|
+
"guest - the result never tells you whether they are, and you never tell the caller: no confirming or " +
|
|
21
|
+
"denying anyone's presence, no room numbers, no connecting calls. Read name, number and message back first.",
|
|
22
|
+
inputSchema: z.object({
|
|
23
|
+
recipient: z
|
|
24
|
+
.string()
|
|
25
|
+
.min(1)
|
|
26
|
+
.describe("Full name - first AND last; ask for the last name if only a first was given"),
|
|
27
|
+
callerName: z.string().min(1),
|
|
28
|
+
callerPhone: z.string().min(1),
|
|
29
|
+
message: z.string().min(1).max(500).describe("In the caller's words"),
|
|
30
|
+
}),
|
|
31
|
+
execute({ recipient, callerName, callerPhone, message }, hotel) {
|
|
32
|
+
if (countWords(recipient) < 2) {
|
|
33
|
+
return toolFailure(
|
|
34
|
+
`"${recipient}" is only one name - a message needs the recipient's full name to reach the right ` +
|
|
35
|
+
"person. Ask the caller for the last name, then call again.",
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const wanted = recipient.trim().toLowerCase();
|
|
39
|
+
const inHouse = hotel.bookings.find(
|
|
40
|
+
(b) =>
|
|
41
|
+
b.status === "confirmed" &&
|
|
42
|
+
`${b.firstName} ${b.lastName}`.toLowerCase() === wanted &&
|
|
43
|
+
b.checkIn <= TODAY &&
|
|
44
|
+
b.checkOut > TODAY,
|
|
45
|
+
);
|
|
46
|
+
const ticket = addTicket(
|
|
47
|
+
hotel,
|
|
48
|
+
"guest_message",
|
|
49
|
+
"MSG",
|
|
50
|
+
`for ${recipient.trim()} from ${callerName}`,
|
|
51
|
+
{
|
|
52
|
+
// A matched message takes the registered guest's casing so the stored name
|
|
53
|
+
// doesn't depend on how the caller's was heard.
|
|
54
|
+
recipient: inHouse ? `${inHouse.firstName} ${inHouse.lastName}` : recipient.trim(),
|
|
55
|
+
callerName,
|
|
56
|
+
callerPhone: digitsOf(callerPhone) || callerPhone,
|
|
57
|
+
message,
|
|
58
|
+
status: inHouse ? "delivered" : "undeliverable",
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
// Deliberately NOT `...ticket.details`: the status stays on the ledger.
|
|
62
|
+
return {
|
|
63
|
+
recorded: true,
|
|
64
|
+
reference: ticket.code,
|
|
65
|
+
spokenReference: speakCode(ticket.code),
|
|
66
|
+
next:
|
|
67
|
+
"Tell the caller it's logged and give the reference. You don't know whether the recipient is staying " +
|
|
68
|
+
"here and never say either way - the general policy IS shareable: messages for in-house guests reach the " +
|
|
69
|
+
"room within about thirty minutes. Promise delivery timing only, never that the person will read or act on it.",
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TRANSFER_DESTINATIONS } from "../records.ts";
|
|
3
|
+
import { hotelSlot } from "../session.ts";
|
|
4
|
+
import { addTicket } from "../shared.ts";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Transfer the caller to a DEPARTMENT — their `transfer_call`, a stub that
|
|
8
|
+
* records the hand-off. Never a guest's room: connecting a caller to a guest is
|
|
9
|
+
* the thing `guest_privacy` forbids without exception.
|
|
10
|
+
*
|
|
11
|
+
* A transfer happens exactly once per destination. If the model re-calls this
|
|
12
|
+
* (the caller reacts and it "re-confirms"), no second record is written — their
|
|
13
|
+
* deterministic grader counted rows, and a duplicate failed the run.
|
|
14
|
+
*/
|
|
15
|
+
export default hotelSlot.updateTool({
|
|
16
|
+
description:
|
|
17
|
+
"Transfer the caller to a hotel DEPARTMENT - the restaurant, the duty manager, or housekeeping. " +
|
|
18
|
+
"NOT a guest's room. Before calling: tell the caller you're putting them on hold to connect them " +
|
|
19
|
+
"and get their okay. Pass a one-line summary so the department is briefed.",
|
|
20
|
+
inputSchema: z.object({
|
|
21
|
+
destination: z.enum(TRANSFER_DESTINATIONS),
|
|
22
|
+
summary: z.string().min(1).max(300),
|
|
23
|
+
}),
|
|
24
|
+
execute({ destination, summary }, hotel) {
|
|
25
|
+
const spoken = destination.replaceAll("_", " ");
|
|
26
|
+
if (hotel.transferredTo.includes(destination)) {
|
|
27
|
+
return {
|
|
28
|
+
transferred: true,
|
|
29
|
+
alreadyTransferred: true,
|
|
30
|
+
message: `Already transferred to the ${spoken} on this call - do NOT transfer again. Briefly reassure the caller they're being connected.`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
hotel.transferredTo.push(destination);
|
|
34
|
+
const ticket = addTicket(hotel, "transfer", "XFR", `to ${spoken}: ${summary}`, {
|
|
35
|
+
destination,
|
|
36
|
+
summary,
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
transferred: true,
|
|
40
|
+
alreadyTransferred: false,
|
|
41
|
+
reference: ticket.code,
|
|
42
|
+
message:
|
|
43
|
+
`Transferred to the ${spoken} - your part of the call is done. Give ONE short closing hand-off ` +
|
|
44
|
+
'("You\'re all set - connecting you now"), not "anything else?". Do NOT transfer again or take the ' +
|
|
45
|
+
"request down as a followup.",
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { isToolFailure, toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { validateCard } from "../card.ts";
|
|
4
|
+
import { hotelSlot } from "../session.ts";
|
|
5
|
+
import { note, requireVerified } from "../shared.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Replace the card on file — their `start_card_update`, which verified and then
|
|
9
|
+
* ran a `GetCardTask`. The same `validateCard` as `record_card`, so a misheard
|
|
10
|
+
* digit bounces with the field to re-ask, and only the last four is stored.
|
|
11
|
+
*/
|
|
12
|
+
export default hotelSlot.updateTool({
|
|
13
|
+
description:
|
|
14
|
+
"Replace the card on file for the verified caller's booking - the path when a card isn't going " +
|
|
15
|
+
"through or they want a different card charged. Take the whole card (number, expiry, security " +
|
|
16
|
+
'code, name) then call this. Keep it discreet: "isn\'t going through at the moment", never ' +
|
|
17
|
+
'"declined". Verify first.',
|
|
18
|
+
inputSchema: z.object({
|
|
19
|
+
cardNumber: z.string(),
|
|
20
|
+
expiryMonth: z.number().int(),
|
|
21
|
+
expiryYear: z.number().int(),
|
|
22
|
+
securityCode: z.string(),
|
|
23
|
+
cardholderName: z.string(),
|
|
24
|
+
}),
|
|
25
|
+
execute(args, hotel) {
|
|
26
|
+
const booking = requireVerified(hotel);
|
|
27
|
+
if (isToolFailure(booking)) return booking;
|
|
28
|
+
if (booking.status !== "confirmed") {
|
|
29
|
+
return toolFailure(
|
|
30
|
+
`booking ${booking.code} is ${booking.status} - there's no active booking to update`,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
const card = validateCard(args);
|
|
34
|
+
if (isToolFailure(card)) return card;
|
|
35
|
+
booking.cardLast4 = card.last4;
|
|
36
|
+
note(hotel, `Card on ${booking.code} replaced: ending ${card.last4}`);
|
|
37
|
+
return {
|
|
38
|
+
updated: true,
|
|
39
|
+
cardLast4: card.last4,
|
|
40
|
+
issuer: card.issuer,
|
|
41
|
+
message:
|
|
42
|
+
`Card on file updated to the one ending ${card.last4}. Confirm to the caller that the new card ` +
|
|
43
|
+
"is on the booking and everything is set for their stay; no further tool call is needed.",
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
});
|