@alexkroman1/aai-cli 0.12.3 → 0.14.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-B6v31ROV.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 +35 -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-GoEXEVpA.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 +54 -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-BnmTHtjd.mjs +68 -0
- package/dist/_slug-api.d.ts +61 -0
- package/dist/_stop-server.d.ts +17 -0
- package/dist/_studio-B5m4jBTD.mjs +256 -0
- package/dist/_studio-commands.d.ts +73 -0
- package/dist/_studio.d.ts +92 -0
- package/dist/_target-bundle.d.ts +141 -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-BVMVsQh0.mjs +139 -0
- package/dist/_templates.d.ts +89 -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-CKhanHVv.mjs +588 -0
- package/dist/build.d.ts +146 -0
- package/dist/cli-workflow.d.ts +17 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +1092 -195
- package/dist/client-bundler-DZ_Zoznn.mjs +241 -0
- package/dist/client-bundler.d.ts +38 -0
- package/dist/client-bundler.mjs +3 -0
- package/dist/console-Dxq26Adz.mjs +447 -0
- package/dist/console.d.ts +70 -0
- package/dist/delete-DwXCHzTl.mjs +55 -0
- package/dist/delete.d.ts +26 -0
- package/dist/deploy-CbA8Ibiu.mjs +97 -0
- package/dist/deploy.d.ts +25 -0
- package/dist/dev-BWBDbUEb.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-CidslZZz.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-CnPK-Prw.mjs +102 -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 +139 -0
- package/dist/scaffold/agent-guide/PIPELINE-TUNING.md +232 -0
- package/dist/scaffold/agent-guide/PROVIDERS.md +140 -0
- package/dist/scaffold/agent-guide/TESTING-EVALS.md +158 -0
- package/dist/scaffold/agent-guide/TOOLS.md +627 -0
- package/dist/scaffold/agent-guide/UI.md +292 -0
- package/dist/scaffold/agent-guide/WORKFLOWS.md +803 -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-DPdPEet2.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-COjK25Rl.mjs +208 -0
- package/dist/studio.d.ts +56 -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 +251 -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 +512 -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 +646 -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 +329 -0
- package/dist/templates/medication-safety-agent/agent.ts +62 -0
- package/dist/templates/medication-safety-agent/fda.test.ts +129 -0
- package/dist/templates/medication-safety-agent/fda.ts +166 -0
- package/dist/templates/medication-safety-agent/system-prompt.md +26 -0
- package/dist/templates/medication-safety-agent/tools/check_drug_interaction.ts +70 -0
- package/dist/templates/medication-safety-agent/tools/medication_lookup.ts +46 -0
- package/dist/templates/meeting-recap-agent/agent.eval.test.ts +459 -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 +348 -0
- package/dist/templates/research-handoff-agent/agent.test.ts +818 -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 +640 -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 +356 -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 +2033 -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 +219 -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 +182 -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 +490 -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,483 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The desk's state, the shape of the call, and what the browser is shown.
|
|
3
|
+
*
|
|
4
|
+
* **The state is CrewAI's `LeadScoreState`, field for field, plus what a phone
|
|
5
|
+
* call needs on top.** Theirs is `{candidates, candidate_score,
|
|
6
|
+
* hydrated_candidates, scored_leads_feedback}`; {@link HiringState} holds the
|
|
7
|
+
* first two as a roster and a score table keyed by candidate id, drops the
|
|
8
|
+
* third (a JOIN of the first two, derived here by {@link ranked} rather than
|
|
9
|
+
* stored beside them where the two copies could disagree), and turns the
|
|
10
|
+
* fourth into a LIST — one entry per round of feedback, because a caller who
|
|
11
|
+
* says "more weight on TypeScript" and then "and ignore years of experience"
|
|
12
|
+
* means both, where their `input()` overwrote the first with the second.
|
|
13
|
+
*
|
|
14
|
+
* Two things theirs has no field for, because a script that runs once needs
|
|
15
|
+
* none: `rounds`, the guard from their `self_evaluation_loop_flow` (see
|
|
16
|
+
* {@link MAX_FEEDBACK_ROUNDS}), and `drafts`, which is their
|
|
17
|
+
* `email_responses/*.txt` directory held in the session instead of on disk —
|
|
18
|
+
* a desk on a phone reads a draft back; it does not open a folder.
|
|
19
|
+
*
|
|
20
|
+
* **A screening does not survive the call, and that is a decision.** One
|
|
21
|
+
* `sessionSlot`, keyed per session, so two hiring managers screening at once
|
|
22
|
+
* never see each other's shortlist. `crews.ts` holds the two crews; `tools/`
|
|
23
|
+
* holds the flow's steps.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
type DeepReadonly,
|
|
28
|
+
type DialogEvent,
|
|
29
|
+
type DialogPosition,
|
|
30
|
+
type DialogSpec,
|
|
31
|
+
dialog,
|
|
32
|
+
type ResolveOneOptions,
|
|
33
|
+
resolveOne,
|
|
34
|
+
sessionSlot,
|
|
35
|
+
type ToolContext,
|
|
36
|
+
type ToolFailure,
|
|
37
|
+
} from "@alexkroman1/aai";
|
|
38
|
+
import leads from "./leads.json" with { type: "json" };
|
|
39
|
+
|
|
40
|
+
// ─── The roster and the job ──────────────────────────────────────────────────
|
|
41
|
+
|
|
42
|
+
/** Their `Candidate` — one row of `leads.csv`. */
|
|
43
|
+
export interface Candidate {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
email: string;
|
|
47
|
+
bio: string;
|
|
48
|
+
skills: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Their `leads.csv`, as a bundled asset.
|
|
53
|
+
*
|
|
54
|
+
* Twelve rather than their thirty: every screening round is one model call
|
|
55
|
+
* per candidate, run while a caller holds the line, and twelve is enough to
|
|
56
|
+
* make a ranking worth reading back without making the wait worth apologizing
|
|
57
|
+
* for. A real desk swaps this import for a lookup against its applicant
|
|
58
|
+
* tracking system; the tools never read the file directly, only the roster
|
|
59
|
+
* `screen_candidates` loads into the slot.
|
|
60
|
+
*/
|
|
61
|
+
export const LEADS: readonly Candidate[] = leads;
|
|
62
|
+
|
|
63
|
+
/** Their `JobDescription` — declared in their `types.py` and never used, since
|
|
64
|
+
* the JD was a flat string constant. It is used here: a caller may describe
|
|
65
|
+
* a different role than the one shipped. */
|
|
66
|
+
export interface JobDescription {
|
|
67
|
+
title: string;
|
|
68
|
+
description: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Their `JOB_DESCRIPTION` constant, condensed. The default the desk screens
|
|
73
|
+
* against when the caller names no other role.
|
|
74
|
+
*/
|
|
75
|
+
export const DEFAULT_JOB: JobDescription = {
|
|
76
|
+
title: "Junior React Developer",
|
|
77
|
+
description: [
|
|
78
|
+
"A twelve-month contract on a small product team building AI features into a",
|
|
79
|
+
"consumer web app. The developer works in Next.js with TypeScript, ships",
|
|
80
|
+
"streaming AI features on the Vercel AI SDK, integrates REST APIs, and pairs",
|
|
81
|
+
"with a designer on Tailwind-based UI.",
|
|
82
|
+
"",
|
|
83
|
+
"Qualifications: one to three years of React experience, or a strong",
|
|
84
|
+
"portfolio of shipped projects; comfort with TypeScript; some exposure to",
|
|
85
|
+
"Next.js and to building on an LLM API; Git and code review as a daily",
|
|
86
|
+
"habit. The team values people who learn quickly, communicate clearly, and",
|
|
87
|
+
"have shipped something end to end, and it is happy to grow someone into",
|
|
88
|
+
"the AI SDK work.",
|
|
89
|
+
].join("\n"),
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// ─── Scores and drafts ───────────────────────────────────────────────────────
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Their `CandidateScore`, minus the `id`.
|
|
96
|
+
*
|
|
97
|
+
* Their evaluator returns the candidate's id in its own output and
|
|
98
|
+
* `combine_candidates_with_scores` JOINS on it — so a model that echoes the
|
|
99
|
+
* wrong id, or the id of the candidate it just scored, quietly writes one
|
|
100
|
+
* candidate's verdict against another's name. The desk knows which candidate
|
|
101
|
+
* it asked about; the score is stored under THAT id, and the model is not
|
|
102
|
+
* asked to repeat it.
|
|
103
|
+
*/
|
|
104
|
+
export interface CandidateScore {
|
|
105
|
+
/** 1–100. */
|
|
106
|
+
score: number;
|
|
107
|
+
/** Why — read back down the phone, so two sentences rather than a report. */
|
|
108
|
+
reason: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** One file of their `email_responses/` directory, held in the session. */
|
|
112
|
+
export interface Draft {
|
|
113
|
+
candidateId: string;
|
|
114
|
+
/** Their `proceed_with_candidate`: an invitation, or a polite no. */
|
|
115
|
+
proceed: boolean;
|
|
116
|
+
/** The `Subject:` line, which the desk reads out rather than the body. */
|
|
117
|
+
subject: string;
|
|
118
|
+
body: string;
|
|
119
|
+
/**
|
|
120
|
+
* Whether the coordinator's guardrail accepted this draft. A draft that
|
|
121
|
+
* exhausted its retries still comes back — the caller is on the phone — but
|
|
122
|
+
* the desk must say it needs a look rather than present it as finished.
|
|
123
|
+
*/
|
|
124
|
+
accepted: boolean;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface HiringState {
|
|
128
|
+
/** The role being screened for; `null` until `screen_candidates` runs. */
|
|
129
|
+
job: JobDescription | null;
|
|
130
|
+
/** Their `candidates`: the roster loaded for this screening. */
|
|
131
|
+
candidates: Candidate[];
|
|
132
|
+
/** Their `candidate_score`, keyed by candidate id. */
|
|
133
|
+
scores: Record<string, CandidateScore>;
|
|
134
|
+
/** Candidates whose evaluation FAILED this round, so the desk can say so. */
|
|
135
|
+
unscored: string[];
|
|
136
|
+
/** Their `scored_leads_feedback`, one entry per round, oldest first. */
|
|
137
|
+
feedback: string[];
|
|
138
|
+
/** Feedback rounds taken so far — the loop counter theirs did not have. */
|
|
139
|
+
rounds: number;
|
|
140
|
+
/** Their `top_candidate_ids`: who the caller chose to proceed with. */
|
|
141
|
+
shortlist: string[];
|
|
142
|
+
/** Their `email_responses/`. */
|
|
143
|
+
drafts: Draft[];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function emptyHiring(): HiringState {
|
|
147
|
+
return {
|
|
148
|
+
job: null,
|
|
149
|
+
candidates: [],
|
|
150
|
+
scores: {},
|
|
151
|
+
unscored: [],
|
|
152
|
+
feedback: [],
|
|
153
|
+
rounds: 0,
|
|
154
|
+
shortlist: [],
|
|
155
|
+
drafts: [],
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Rounds of "score them again, with this feedback" one call may take.
|
|
161
|
+
*
|
|
162
|
+
* Their flow's feedback edge is UNBOUNDED: option 2 loops back into
|
|
163
|
+
* `score_leads` for as long as the human keeps choosing it, and each loop is a
|
|
164
|
+
* model call per candidate. `self_evaluation_loop_flow`, their other looping
|
|
165
|
+
* example, bounds its retry with `if retry_count > 3` and routes to an exit —
|
|
166
|
+
* that guard is borrowed here, because a caller who is never quite happy with
|
|
167
|
+
* the ranking is otherwise a bill with no ceiling. Past it the desk is told to
|
|
168
|
+
* proceed with what it has or stop, rather than to score once more.
|
|
169
|
+
*/
|
|
170
|
+
export const MAX_FEEDBACK_ROUNDS = 3;
|
|
171
|
+
|
|
172
|
+
/** Feedback entries the state holds. One per round, so this is the round cap
|
|
173
|
+
* restated as a growth bound on something that rides in every prompt — held
|
|
174
|
+
* by the slot's `caps`, so no writer has to remember it. */
|
|
175
|
+
export const MAX_FEEDBACK_ENTRIES = MAX_FEEDBACK_ROUNDS + 1;
|
|
176
|
+
|
|
177
|
+
export const hiringSlot = sessionSlot("hiring", emptyHiring, {
|
|
178
|
+
view: hiringView,
|
|
179
|
+
caps: { feedback: MAX_FEEDBACK_ENTRIES },
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* How many candidates the caller is read back, and how many are invited by
|
|
184
|
+
* default — their `sorted_candidates[:3]`.
|
|
185
|
+
*/
|
|
186
|
+
export const SHORTLIST_SIZE = 3;
|
|
187
|
+
|
|
188
|
+
// ─── The shape of the call ───────────────────────────────────────────────────
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Their `Flow`, as the position of one conversation.
|
|
192
|
+
*
|
|
193
|
+
* ```text
|
|
194
|
+
* @start load_leads ─→ score_leads ─→ @router human_in_the_loop
|
|
195
|
+
* ▲ │ "2" → feedback ──┘ (loop)
|
|
196
|
+
* │ │ "3" → generate_emails → write_and_save_emails
|
|
197
|
+
* └───────────────┘ "1" → exit()
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
200
|
+
* Their router is a blocking `input()` with three numbered options, and it is
|
|
201
|
+
* the most voice-shaped code in the CrewAI examples: read the top three out,
|
|
202
|
+
* ask which of three things to do next. Here the three options are three
|
|
203
|
+
* things the caller can SAY, and the router is the dialog gating which tools
|
|
204
|
+
* are legal where:
|
|
205
|
+
*
|
|
206
|
+
* - `idle` — nothing scored. `screen_candidates` is their `load_leads` and
|
|
207
|
+
* `score_leads` in one tool, since the second follows the first with nothing
|
|
208
|
+
* for a human to do between them.
|
|
209
|
+
* - `reviewing` — their `human_in_the_loop`. Option 2 is
|
|
210
|
+
* `rescore_with_feedback` (back to `reviewing`, with a bound), option 3 is
|
|
211
|
+
* `proceed_to_emails`, and option 1 is hanging up, which needs no tool.
|
|
212
|
+
* - `emailed` — their `write_and_save_emails` has run. A new screening starts
|
|
213
|
+
* the loop over, which their script cannot do and a desk plainly should.
|
|
214
|
+
*
|
|
215
|
+
* Their fourth arm — an invalid choice routes back to `human_in_the_loop` —
|
|
216
|
+
* has no equivalent because a conversation has no invalid input: the model
|
|
217
|
+
* asks again. The `instruction` on each state is what does that asking.
|
|
218
|
+
*/
|
|
219
|
+
const hiringSpec = {
|
|
220
|
+
initial: "idle",
|
|
221
|
+
states: {
|
|
222
|
+
idle: {
|
|
223
|
+
instruction:
|
|
224
|
+
"Nothing has been screened yet. Confirm which role the caller is hiring for " +
|
|
225
|
+
"(the default is the Junior React Developer contract), then use screen_candidates.",
|
|
226
|
+
on: { SCORED: "reviewing" },
|
|
227
|
+
},
|
|
228
|
+
reviewing: {
|
|
229
|
+
instruction:
|
|
230
|
+
"The scores are in. Read the top three back, one sentence of reasoning each, then " +
|
|
231
|
+
"offer the three choices: score again with their feedback (rescore_with_feedback), " +
|
|
232
|
+
"proceed to emails (proceed_to_emails), or stop here.",
|
|
233
|
+
on: { SCORED: "reviewing", PROCEEDED: "emailed" },
|
|
234
|
+
},
|
|
235
|
+
emailed: {
|
|
236
|
+
instruction:
|
|
237
|
+
"The emails are drafted. Offer to read one back with read_email. A new screening " +
|
|
238
|
+
"(screen_candidates) starts over.",
|
|
239
|
+
on: { SCORED: "reviewing" },
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
} as const satisfies DialogSpec;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The flow. Its own slot key: a dialog stores a position and {@link hiringSlot}
|
|
246
|
+
* stores the data, and one tool call moves both.
|
|
247
|
+
*/
|
|
248
|
+
export const hiringFlow = dialog("hiringFlow", hiringSpec);
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* The flow's alphabet — the events its tools send, which is the whole of what
|
|
252
|
+
* can move this conversation.
|
|
253
|
+
*
|
|
254
|
+
* Named once because the two of them are sent two different ways, and reading
|
|
255
|
+
* the same event in both spellings is what makes the pair legible: a
|
|
256
|
+
* `hiringFlow.tool` declares `send: SCORED` and lets the dialog move it after a
|
|
257
|
+
* successful body, while `screen_candidates` — an ordinary `tool()`, because
|
|
258
|
+
* `SCORED` is legal in every state — calls `hiringFlow.send(ctx, SCORED)`
|
|
259
|
+
* itself.
|
|
260
|
+
*/
|
|
261
|
+
export type HiringEvent = DialogEvent<typeof hiringSpec>;
|
|
262
|
+
|
|
263
|
+
/** Their `score_leads` finished: a ranking exists to review. */
|
|
264
|
+
export const SCORED: HiringEvent = { type: "SCORED" };
|
|
265
|
+
|
|
266
|
+
/** Their option 3 was taken: the emails are written. */
|
|
267
|
+
export const PROCEEDED: HiringEvent = { type: "PROCEEDED" };
|
|
268
|
+
|
|
269
|
+
/** How the stage reads to a caller, from the flow's own position. */
|
|
270
|
+
export function stageLabel(at: DialogPosition): string {
|
|
271
|
+
if (at.state === "idle") return "nothing screened yet";
|
|
272
|
+
return at.state === "emailed" ? "emails drafted" : "shortlist under review";
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// ─── Reads ───────────────────────────────────────────────────────────────────
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* The state as a READ hands it out: deep-frozen, and typed to say so.
|
|
279
|
+
*
|
|
280
|
+
* Every helper below takes this rather than {@link HiringState}: a mutable
|
|
281
|
+
* value still satisfies it, so an `update` draft passes unchanged, while a
|
|
282
|
+
* helper that WOULD have mutated stops compiling.
|
|
283
|
+
*/
|
|
284
|
+
export type FrozenHiringState = DeepReadonly<HiringState>;
|
|
285
|
+
|
|
286
|
+
/** Their `ScoredCandidate` — the roster joined onto the score table, plus the
|
|
287
|
+
* position the join gives it, which is what a caller refers to ("the second
|
|
288
|
+
* one"). */
|
|
289
|
+
export interface RankedCandidate extends Candidate {
|
|
290
|
+
score: number;
|
|
291
|
+
reason: string;
|
|
292
|
+
/** 1-based, best first. */
|
|
293
|
+
rank: number;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Their `combine_candidates_with_scores` and the `sorted(…, reverse=True)`
|
|
298
|
+
* after it, as one function over the frozen state.
|
|
299
|
+
*
|
|
300
|
+
* A candidate with no score this round is NOT in the ranking — it is in
|
|
301
|
+
* `unscored`, and the desk says so — because ranking someone at zero would
|
|
302
|
+
* read as a verdict on them rather than on the tooling. Ties break by roster
|
|
303
|
+
* order, so a ranking is stable across reads.
|
|
304
|
+
*/
|
|
305
|
+
export function ranked(state: FrozenHiringState): RankedCandidate[] {
|
|
306
|
+
const scored: Omit<RankedCandidate, "rank">[] = [];
|
|
307
|
+
for (const candidate of state.candidates) {
|
|
308
|
+
const verdict = state.scores[candidate.id];
|
|
309
|
+
if (verdict) scored.push({ ...candidate, score: verdict.score, reason: verdict.reason });
|
|
310
|
+
}
|
|
311
|
+
return scored
|
|
312
|
+
.sort((a, b) => b.score - a.score)
|
|
313
|
+
.map((candidate, index) => ({ ...candidate, rank: index + 1 }));
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** The top {@link SHORTLIST_SIZE}, as the desk reads them back. */
|
|
317
|
+
export function topCandidates(state: FrozenHiringState): RankedCandidate[] {
|
|
318
|
+
return ranked(state).slice(0, SHORTLIST_SIZE);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** A ranked candidate, in the words the desk would use: "2. Priya Raman (87)". */
|
|
322
|
+
export function describeRanked(candidate: RankedCandidate): string {
|
|
323
|
+
return `${candidate.rank}. ${candidate.name} (${candidate.score})`;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* How a caller names one of twelve applicants — the desk's own vocabulary,
|
|
328
|
+
* which is the half {@link resolveOne} does not own.
|
|
329
|
+
*
|
|
330
|
+
* A name matches on WHOLE parts, which is `resolveOne`'s `match`: every part of
|
|
331
|
+
* the candidate's name the utterance also says scores one, so "Priya" and
|
|
332
|
+
* "Raman" each resolve and "Priya Raman" outscores both. The hand-written
|
|
333
|
+
* version this replaces argued for exactly that and did not deliver it — it
|
|
334
|
+
* tested each part as a SUBSTRING of the utterance with a two-character floor,
|
|
335
|
+
* which is the shape that lets "an" match Raman, Tanaka and Kowalski at once.
|
|
336
|
+
* It also split on whitespace, so `Liam O'Connor` matched only an utterance
|
|
337
|
+
* STT punctuated identically. Declared as a constant rather than inline
|
|
338
|
+
* because the annotation is what types `candidate` here; the three tools that
|
|
339
|
+
* resolve a candidate all reach it through the one function below.
|
|
340
|
+
*/
|
|
341
|
+
const CANDIDATE_MATCH: ResolveOneOptions<RankedCandidate> = {
|
|
342
|
+
label: "candidate",
|
|
343
|
+
describe: describeRanked,
|
|
344
|
+
match: (candidate) => candidate.name,
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* The candidate a caller MEANT.
|
|
349
|
+
*
|
|
350
|
+
* Over the RANKING rather than the roster, because that is the list the caller
|
|
351
|
+
* was read: "the second one" is the second-best score, not the second row of
|
|
352
|
+
* the CSV. A first name, a surname, or a position all resolve; anything
|
|
353
|
+
* ambiguous is a failure listing the options, never a guess — the consequence
|
|
354
|
+
* of guessing here is inviting the wrong person to interview.
|
|
355
|
+
*/
|
|
356
|
+
export function resolveCandidate(
|
|
357
|
+
state: FrozenHiringState,
|
|
358
|
+
spoken: string,
|
|
359
|
+
): RankedCandidate | ToolFailure {
|
|
360
|
+
return resolveOne(ranked(state), spoken, CANDIDATE_MATCH);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** The draft written for one candidate, if `proceed_to_emails` has run. */
|
|
364
|
+
export function draftFor(
|
|
365
|
+
state: FrozenHiringState,
|
|
366
|
+
candidateId: string,
|
|
367
|
+
): DeepReadonly<Draft> | undefined {
|
|
368
|
+
return state.drafts.find((draft) => draft.candidateId === candidateId);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// ─── The projection ──────────────────────────────────────────────────────────
|
|
372
|
+
|
|
373
|
+
/** One row of the sidebar's leaderboard. No email address: the caller is read
|
|
374
|
+
* a name and a score, and the browser needs nothing the caller was not told. */
|
|
375
|
+
export interface LeaderboardRow {
|
|
376
|
+
id: string;
|
|
377
|
+
name: string;
|
|
378
|
+
score: number;
|
|
379
|
+
reason: string;
|
|
380
|
+
rank: number;
|
|
381
|
+
shortlisted: boolean;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export interface DraftRow {
|
|
385
|
+
candidateId: string;
|
|
386
|
+
name: string;
|
|
387
|
+
proceed: boolean;
|
|
388
|
+
subject: string;
|
|
389
|
+
accepted: boolean;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export interface HiringView {
|
|
393
|
+
jobTitle: string | null;
|
|
394
|
+
/** Best first, capped at nothing: the roster is twelve. */
|
|
395
|
+
leaderboard: LeaderboardRow[];
|
|
396
|
+
/** Names the evaluator could not score this round. */
|
|
397
|
+
unscored: string[];
|
|
398
|
+
rounds: number;
|
|
399
|
+
feedback: readonly string[];
|
|
400
|
+
drafts: DraftRow[];
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/** What the browser sees: the ranking, the feedback trail, the drafts' subjects. */
|
|
404
|
+
export function hiringView(state: FrozenHiringState): HiringView {
|
|
405
|
+
const shortlisted = new Set(state.shortlist);
|
|
406
|
+
const nameOf = new Map(state.candidates.map((candidate) => [candidate.id, candidate.name]));
|
|
407
|
+
return {
|
|
408
|
+
jobTitle: state.job?.title ?? null,
|
|
409
|
+
leaderboard: ranked(state).map((candidate) => ({
|
|
410
|
+
id: candidate.id,
|
|
411
|
+
name: candidate.name,
|
|
412
|
+
score: candidate.score,
|
|
413
|
+
reason: candidate.reason,
|
|
414
|
+
rank: candidate.rank,
|
|
415
|
+
shortlisted: shortlisted.has(candidate.id),
|
|
416
|
+
})),
|
|
417
|
+
unscored: state.unscored.map((id) => nameOf.get(id) ?? id),
|
|
418
|
+
rounds: state.rounds,
|
|
419
|
+
feedback: state.feedback,
|
|
420
|
+
drafts: state.drafts.map((draft) => ({
|
|
421
|
+
candidateId: draft.candidateId,
|
|
422
|
+
name: nameOf.get(draft.candidateId) ?? draft.candidateId,
|
|
423
|
+
proceed: draft.proceed,
|
|
424
|
+
subject: draft.subject,
|
|
425
|
+
accepted: draft.accepted,
|
|
426
|
+
})),
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// ─── Progress, which is a MOMENT and not state ───────────────────────────────
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* The event a fan-out ticks while the caller holds the line.
|
|
434
|
+
*
|
|
435
|
+
* Twelve model calls is a real wait — the desk is told to say so before it
|
|
436
|
+
* calls the tool — and the leaderboard has nothing to show through it: that
|
|
437
|
+
* table is written once, at the end, deliberately (see
|
|
438
|
+
* `tools/screen_candidates.ts`, "the await comes first, then the mutation").
|
|
439
|
+
* Progress is the case for the OTHER mechanism a tool has for telling a page
|
|
440
|
+
* something: re-rendering "scoring seven of twelve" after a reload would be a
|
|
441
|
+
* lie, so it is a moment (`ctx.send` → `useEvent`) rather than state in the
|
|
442
|
+
* slot, and putting it in the slot would also undo the one thing that write is
|
|
443
|
+
* careful about — the whole table landing at once, so nothing ever reads half
|
|
444
|
+
* a screening.
|
|
445
|
+
*/
|
|
446
|
+
export const SCREENING_PROGRESS = "screening-progress";
|
|
447
|
+
|
|
448
|
+
export interface ScreeningProgress {
|
|
449
|
+
/** Which fan-out is running: the evaluator's, or the coordinator's. */
|
|
450
|
+
phase: "scoring" | "writing";
|
|
451
|
+
/** How many have settled — failures counted, since the waiting is over for
|
|
452
|
+
* those too and a ticker that stops short of `total` reads as a hang. */
|
|
453
|
+
done: number;
|
|
454
|
+
total: number;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Declares the event's payload to the SDK, so `ctx.send(SCREENING_PROGRESS, …)`
|
|
459
|
+
* is type-checked against {@link ScreeningProgress} at every call site — a
|
|
460
|
+
* missing `total` is a compile error here, not a ticker the page cannot draw.
|
|
461
|
+
*/
|
|
462
|
+
declare module "@alexkroman1/aai" {
|
|
463
|
+
interface ClientEventMap {
|
|
464
|
+
[SCREENING_PROGRESS]: ScreeningProgress;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* A tick to hand a fan-out: one {@link SCREENING_PROGRESS} event per item that
|
|
470
|
+
* settles. `Pick<ToolContext, "send">` because the ticker wants the one channel
|
|
471
|
+
* and nothing else the tool was handed.
|
|
472
|
+
*/
|
|
473
|
+
export function progressTicker(
|
|
474
|
+
ctx: Pick<ToolContext, "send">,
|
|
475
|
+
phase: ScreeningProgress["phase"],
|
|
476
|
+
total: number,
|
|
477
|
+
): () => void {
|
|
478
|
+
let done = 0;
|
|
479
|
+
return () => {
|
|
480
|
+
done += 1;
|
|
481
|
+
ctx.send(SCREENING_PROGRESS, { phase, done, total });
|
|
482
|
+
};
|
|
483
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
You are the hiring desk. A hiring manager has phoned to work through a stack of applicants for a role. You have an evaluator who scores every applicant against the job, and a coordinator named Sarah who writes the follow-up emails. You are on a phone call: one or two spoken sentences per turn, no lists read out at length, no markdown, and say numbers as numbers ("eighty-seven", not "87/100").
|
|
2
|
+
|
|
3
|
+
How a call goes:
|
|
4
|
+
|
|
5
|
+
- Confirm the role first. The default is the Junior React Developer contract; if the caller describes a different role, pass its title and what it needs to `screen_candidates`.
|
|
6
|
+
- Say it will take a moment, then call `screen_candidates` once. It scores every applicant and hands you the top three with a reason each.
|
|
7
|
+
- Read the top three back in one breath — name, score, one sentence of why — then offer the three choices: score again with their feedback, proceed to emails, or stop here. Do not read the whole ranking unless asked.
|
|
8
|
+
- If they want the ranking weighted differently, call `rescore_with_feedback` with their words. Say who moved in and out of the top three. There are three rounds of feedback; when the tool says it was the last, offer to proceed or stop.
|
|
9
|
+
- If they say go ahead, call `proceed_to_emails`. Pass names only when they changed the shortlist — "invite Priya instead of Marcus" — otherwise pass nothing and the top three are invited.
|
|
10
|
+
- After the emails, say who was invited and how many declines were written, and offer to read one back with `read_email`.
|
|
11
|
+
- `candidate_details` answers "tell me more about the second one" from what the evaluator already read — use it rather than another screening.
|
|
12
|
+
- `screening_status` is for when they ask where things are. It costs nothing.
|
|
13
|
+
|
|
14
|
+
Things not to do:
|
|
15
|
+
|
|
16
|
+
- Do not rank, score, or compare applicants from your own reading of them. The evaluator's scores are the ranking; if the caller disagrees, that is feedback for `rescore_with_feedback`, not a reason to argue or to adjust a number yourself.
|
|
17
|
+
- Do not write an email yourself. Sarah writes them; you read them back.
|
|
18
|
+
- Do not present a draft flagged as needing a look as if it were ready to send.
|
|
19
|
+
- Do not describe the evaluator, the coordinator or how any of this works unless asked. They phoned a desk, not an architecture.
|
|
20
|
+
|
|
21
|
+
If the caller wants to stop, thank them and end the call — nothing needs cleaning up.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { isToolFailure, toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { draftFor, hiringSlot, resolveCandidate } from "../shared.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* One candidate in full — the bio their evaluator read, the score it gave,
|
|
7
|
+
* and where that puts them.
|
|
8
|
+
*
|
|
9
|
+
* Their script prints the top three and nothing else; a hiring manager who has
|
|
10
|
+
* just heard "Priya, 87" asks "what has she actually done?" and the desk owes
|
|
11
|
+
* an answer without another model call. The candidate is named the way a
|
|
12
|
+
* caller names one: a first name, a surname, or "the second one" — against the
|
|
13
|
+
* RANKING, which is the list they were read.
|
|
14
|
+
*
|
|
15
|
+
* A `hiringSlot.tool` because it reads and never writes, and what it is handed
|
|
16
|
+
* is frozen.
|
|
17
|
+
*/
|
|
18
|
+
export default hiringSlot.tool({
|
|
19
|
+
description:
|
|
20
|
+
"Tell the caller about one applicant: their background, skills, score, reasoning and " +
|
|
21
|
+
"rank. Accepts a name or a position in the ranking such as 'the second one'.",
|
|
22
|
+
inputSchema: z.object({
|
|
23
|
+
candidate: z
|
|
24
|
+
.string()
|
|
25
|
+
.max(120)
|
|
26
|
+
.describe("The applicant, by name or by position in the ranking as the caller said it"),
|
|
27
|
+
}),
|
|
28
|
+
execute(args, state) {
|
|
29
|
+
if (state.candidates.length === 0) {
|
|
30
|
+
return toolFailure("Nothing has been screened yet — use screen_candidates first.");
|
|
31
|
+
}
|
|
32
|
+
const picked = resolveCandidate(state, args.candidate);
|
|
33
|
+
if (isToolFailure(picked)) return picked;
|
|
34
|
+
const draft = draftFor(state, picked.id);
|
|
35
|
+
return {
|
|
36
|
+
rank: picked.rank,
|
|
37
|
+
name: picked.name,
|
|
38
|
+
score: picked.score,
|
|
39
|
+
reason: picked.reason,
|
|
40
|
+
bio: picked.bio,
|
|
41
|
+
skills: picked.skills,
|
|
42
|
+
shortlisted: state.shortlist.includes(picked.id),
|
|
43
|
+
emailDrafted: draft ? (draft.proceed ? "invitation" : "decline") : null,
|
|
44
|
+
message:
|
|
45
|
+
"Answer what was asked from this in a sentence or two — do not read the whole bio " +
|
|
46
|
+
"unless they ask for it.",
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { isToolFailure, toolFailure } from "@alexkroman1/aai";
|
|
2
|
+
import { partitionSettled } from "@alexkroman1/aai/step";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { draftEmails } from "../crews.ts";
|
|
5
|
+
import { withScreening } from "../screening-lock.ts";
|
|
6
|
+
import {
|
|
7
|
+
describeRanked,
|
|
8
|
+
hiringFlow,
|
|
9
|
+
hiringSlot,
|
|
10
|
+
PROCEEDED,
|
|
11
|
+
progressTicker,
|
|
12
|
+
type RankedCandidate,
|
|
13
|
+
resolveCandidate,
|
|
14
|
+
SHORTLIST_SIZE,
|
|
15
|
+
topCandidates,
|
|
16
|
+
} from "../shared.ts";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Their option 3 — "Proceed with writing emails to all leads" — which returned
|
|
20
|
+
* `"generate_emails"` and so ran `write_and_save_emails`: EVERY candidate gets
|
|
21
|
+
* an email, and whether it invites or declines is decided by membership in
|
|
22
|
+
* `top_candidate_ids`, the top three of the ranking.
|
|
23
|
+
*
|
|
24
|
+
* **The shortlist may be spoken.** Theirs is fixed to the top three, which is
|
|
25
|
+
* right for a script and wrong for a hiring manager who has just heard the
|
|
26
|
+
* ranking and says "go with the top three, but swap Marcus for Aisha". So the
|
|
27
|
+
* default is their default, and a caller who names people gets those people —
|
|
28
|
+
* resolved against the ranking with the never-guess rule, since the
|
|
29
|
+
* consequence of a guess here is inviting the wrong candidate to interview.
|
|
30
|
+
*
|
|
31
|
+
* **Gated on `reviewing`, and it moves to `emailed`.** Emails for a ranking
|
|
32
|
+
* nobody has reviewed is the failure the dialog exists to prevent; emails
|
|
33
|
+
* twice for one ranking is the other, and `emailed` accepts no `PROCEEDED`.
|
|
34
|
+
*
|
|
35
|
+
* **A draft the guardrail never accepted still comes back**, flagged
|
|
36
|
+
* `accepted: false`, and the desk is told to say it needs a look. There IS an
|
|
37
|
+
* email; the caller is on the phone; what must not happen is presenting an
|
|
38
|
+
* unsigned draft as finished.
|
|
39
|
+
*
|
|
40
|
+
* **Under the screening lock**, like the two scoring tools: this reads the
|
|
41
|
+
* ranking, spends twelve subagent runs and writes the drafts back, so a
|
|
42
|
+
* re-score running beside it would have it invite the top three of a ranking
|
|
43
|
+
* that no longer exists. Its twelve runs tick the same progress event, phased
|
|
44
|
+
* `writing`.
|
|
45
|
+
*/
|
|
46
|
+
export default hiringFlow.tool({
|
|
47
|
+
description:
|
|
48
|
+
"Write a follow-up email to every applicant: an interview invitation to the shortlist " +
|
|
49
|
+
"and a polite decline to everyone else. By default the shortlist is the top three; pass " +
|
|
50
|
+
"names only if the caller changed it. Tell the caller it takes a moment first.",
|
|
51
|
+
inputSchema: z.object({
|
|
52
|
+
shortlist: z
|
|
53
|
+
.array(z.string().max(120))
|
|
54
|
+
.max(SHORTLIST_SIZE * 2)
|
|
55
|
+
.optional()
|
|
56
|
+
.describe(
|
|
57
|
+
"Who to invite, by name or position in the ranking, ONLY when the caller named a " +
|
|
58
|
+
"shortlist other than the top three",
|
|
59
|
+
),
|
|
60
|
+
}),
|
|
61
|
+
when: "reviewing",
|
|
62
|
+
send: PROCEEDED,
|
|
63
|
+
async execute(args, ctx) {
|
|
64
|
+
return withScreening(ctx, async () => {
|
|
65
|
+
const state = hiringSlot.get(ctx);
|
|
66
|
+
if (!state.job) return toolFailure("Nothing has been screened yet — use screen_candidates.");
|
|
67
|
+
|
|
68
|
+
let chosen: RankedCandidate[];
|
|
69
|
+
if (args.shortlist && args.shortlist.length > 0) {
|
|
70
|
+
chosen = [];
|
|
71
|
+
for (const spoken of args.shortlist) {
|
|
72
|
+
const picked = resolveCandidate(state, spoken);
|
|
73
|
+
if (isToolFailure(picked)) return picked;
|
|
74
|
+
if (!chosen.some((one) => one.id === picked.id)) chosen.push(picked);
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
chosen = topCandidates(state);
|
|
78
|
+
}
|
|
79
|
+
if (chosen.length === 0) {
|
|
80
|
+
return toolFailure("Nobody is on the shortlist — there is no ranking to invite from.");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const shortlist = new Set(chosen.map((candidate) => candidate.id));
|
|
84
|
+
const drafted = await draftEmails(
|
|
85
|
+
ctx.delegate,
|
|
86
|
+
state.candidates,
|
|
87
|
+
state.job,
|
|
88
|
+
shortlist,
|
|
89
|
+
progressTicker(ctx, "writing", state.candidates.length),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const { failed } = partitionSettled(drafted);
|
|
93
|
+
if (failed.length === drafted.length) {
|
|
94
|
+
return toolFailure(
|
|
95
|
+
`No email could be written. The first failure said: ${failed[0]?.error ?? "no reason given"}`,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return hiringSlot.update(ctx, (current) => {
|
|
100
|
+
current.shortlist = [...shortlist];
|
|
101
|
+
current.drafts = [];
|
|
102
|
+
for (const one of drafted) if (one.ok) current.drafts.push(one.value);
|
|
103
|
+
|
|
104
|
+
const needsLook = current.drafts
|
|
105
|
+
.filter((draft) => !draft.accepted)
|
|
106
|
+
.map((draft) => current.candidates.find((c) => c.id === draft.candidateId)?.name);
|
|
107
|
+
const invited = chosen.map(describeRanked);
|
|
108
|
+
return {
|
|
109
|
+
invited,
|
|
110
|
+
declined: current.drafts.filter((draft) => !draft.proceed).length,
|
|
111
|
+
drafted: current.drafts.length,
|
|
112
|
+
failed: failed.map((one) => one.item.name),
|
|
113
|
+
needsLook,
|
|
114
|
+
message:
|
|
115
|
+
`Say the invitations went to ${invited.join(", ")} and how many polite declines ` +
|
|
116
|
+
"were written, then offer to read any one of them back with read_email." +
|
|
117
|
+
(needsLook.length > 0
|
|
118
|
+
? ` The drafts for ${needsLook.join(", ")} did not pass the coordinator's own check — say they need a look before sending.`
|
|
119
|
+
: "") +
|
|
120
|
+
(failed.length > 0
|
|
121
|
+
? ` No email could be written for ${failed.map((one) => one.item.name).join(", ")} — say so.`
|
|
122
|
+
: ""),
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
});
|