@alexkroman1/aai-cli 16.0.1 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/{_build-target-55dJisQ-.mjs → _build-target-C08aM-Es.mjs} +511 -41
- package/dist/_build-target.d.ts +109 -2
- package/dist/_deno-target.d.ts +15 -14
- package/dist/_dev-env.d.ts +19 -13
- package/dist/{_dev-server-BzWB6-4y.mjs → _dev-server-CLU9xjH5.mjs} +27 -19
- package/dist/_dev-server.d.ts +4 -3
- package/dist/_dev-vite-config.d.ts +1 -1
- package/dist/_init.d.ts +39 -0
- package/dist/_modal-target.d.ts +11 -6
- package/dist/_preflight-CnW9QiE7.mjs +116 -0
- package/dist/_preflight.d.ts +110 -5
- package/dist/{_server-common-De0haHr9.mjs → _server-common-DAcv1nC5.mjs} +46 -2
- package/dist/_server-common.d.ts +39 -0
- package/dist/_target-bundle.d.ts +112 -0
- package/dist/_target-entry.d.ts +81 -0
- package/dist/{_templates-CuP74F8D.mjs → _templates-IMeKMVIj.mjs} +1 -1
- package/dist/{_vitest-runner-AVR9VtXh.mjs → _vitest-runner-CZNGj0ZC.mjs} +22 -17
- package/dist/_vitest-runner.d.ts +36 -24
- package/dist/{_workflow-determinism-CvpqMpdh.mjs → _workflow-determinism-CLxFQ5ox.mjs} +1 -1
- package/dist/_workflow-determinism.d.ts +1 -1
- package/dist/{build-ButI2IKc.mjs → build-DrQTSc2R.mjs} +187 -289
- package/dist/build.d.ts +88 -2
- package/dist/cli.mjs +20 -16
- package/dist/{deploy-CGqPU5U-.mjs → deploy-B68-x7xM.mjs} +14 -6
- package/dist/deploy.d.ts +9 -0
- package/dist/{dev-kodAY23K.mjs → dev-ChsrNHpK.mjs} +1 -1
- package/dist/dev.d.ts +1 -1
- package/dist/{eval-DvoSz7SZ.mjs → eval-DB07kTxO.mjs} +2 -2
- package/dist/init-W-4k-lCF.mjs +559 -0
- package/dist/init.d.ts +43 -3
- package/dist/scaffold/CLAUDE.md +87 -100
- package/dist/scaffold/package.json +6 -6
- package/dist/scaffold/vite.config.ts +29 -1
- package/dist/start.mjs +1 -1
- package/dist/{studio-CtRBVVFR.mjs → studio-DEAJGBXa.mjs} +20 -10
- package/dist/templates/{hiring-desk → applicant-screening-agent}/agent.eval.test.ts +20 -6
- package/dist/templates/{hiring-desk → applicant-screening-agent}/agent.ts +28 -0
- package/dist/templates/{hiring-desk → applicant-screening-agent}/crews.ts +1 -1
- package/dist/templates/{hiring-desk → applicant-screening-agent}/shared.ts +11 -11
- package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/screening_status.ts +1 -1
- package/dist/templates/{call-audit → call-audit-workflow}/agent.ts +4 -2
- package/dist/templates/{call-audit → call-audit-workflow}/client.tsx +3 -3
- package/dist/templates/{call-audit → call-audit-workflow}/guards.test.ts +2 -2
- package/dist/templates/{call-audit → call-audit-workflow}/workflows/summarize.ts +1 -1
- package/dist/templates/{code-interpreter → code-interpreter-agent}/agent.eval.test.ts +3 -2
- package/dist/templates/{code-interpreter → code-interpreter-agent}/agent.test.ts +1 -1
- package/dist/templates/{code-interpreter → code-interpreter-agent}/agent.ts +1 -0
- package/dist/templates/coding-agent/agent.eval.test.ts +136 -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/{pipeline-simple → custom-pipeline-agent}/agent.test.ts +2 -2
- package/dist/templates/{pipeline-simple → custom-pipeline-agent}/agent.ts +2 -1
- package/dist/templates/{pipeline-simple → custom-pipeline-agent}/modes.test.ts +1 -1
- package/dist/templates/{redline → document-redline-workflow}/agent.ts +4 -2
- package/dist/templates/{redline → document-redline-workflow}/client.tsx +1 -1
- package/dist/templates/{redline → document-redline-workflow}/workflows/redline.ts +1 -1
- package/dist/templates/{dispatch-center → emergency-dispatch-agent}/agent.test.ts +104 -1
- package/dist/templates/{dispatch-center → emergency-dispatch-agent}/agent.ts +15 -0
- package/dist/templates/{dispatch-center → emergency-dispatch-agent}/events.ts +1 -1
- package/dist/templates/emergency-dispatch-agent/guardrails.ts +105 -0
- package/dist/templates/{dispatch-center → emergency-dispatch-agent}/system-prompt.md +1 -0
- package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_create.ts +1 -1
- package/dist/templates/{night-owl → entertainment-picks-agent}/agent.eval.test.ts +8 -1
- package/dist/templates/{night-owl → entertainment-picks-agent}/agent.test.ts +1 -1
- package/dist/templates/{night-owl → entertainment-picks-agent}/agent.ts +1 -0
- package/dist/templates/{night-owl → entertainment-picks-agent}/client.tsx +1 -1
- package/dist/templates/{night-owl → entertainment-picks-agent}/system-prompt.md +6 -0
- package/dist/templates/{night-owl → entertainment-picks-agent}/tools/revisit.ts +7 -0
- package/dist/templates/{executive-assistant → executive-inbox-agent}/agent.eval.test.ts +84 -23
- package/dist/templates/{executive-assistant → executive-inbox-agent}/agent.ts +1 -0
- package/dist/templates/{executive-assistant → executive-inbox-agent}/meeting.ts +2 -2
- package/dist/templates/{executive-assistant → executive-inbox-agent}/prompts.ts +3 -1
- package/dist/templates/{executive-assistant → executive-inbox-agent}/shared.ts +2 -2
- package/dist/templates/{executive-assistant → executive-inbox-agent}/system-prompt.md +3 -3
- package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/meeting_assistant.ts +3 -3
- package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/open_email.ts +8 -16
- package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/send_calendar_invite.ts +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/agent.eval.test.ts +85 -21
- package/dist/templates/{hotel-desk → hotel-reception-agent}/agent.test.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/agent.ts +6 -3
- package/dist/templates/{hotel-desk → hotel-reception-agent}/client.tsx +14 -2
- package/dist/templates/{hotel-desk → hotel-reception-agent}/concierge.ts +3 -2
- package/dist/templates/{hotel-desk → hotel-reception-agent}/desk-seams.test.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/disputes.ts +9 -11
- package/dist/templates/{hotel-desk → hotel-reception-agent}/events.ts +2 -1
- package/dist/templates/hotel-reception-agent/session.ts +56 -0
- package/dist/templates/{hotel-desk → hotel-reception-agent}/shared.ts +21 -22
- package/dist/templates/{hotel-desk → hotel-reception-agent}/system-prompt.md +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/abandon_booking.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/add_to_waitlist.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/book_airport_car.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/cancel_restaurant_reservation.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/cancel_room_booking.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/check_restaurant_availability.ts +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/check_room_availability.ts +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/choose_room.ts +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/confirm_booking.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/dispatch_emergency.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/dispute_charge.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/flag_late_arrival.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_booking.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_guest_history.ts +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_invoice.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_restaurant_reservation.ts +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/modify_restaurant_reservation.ts +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/record_card.ts +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/record_followup.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/record_group_inquiry.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/record_guest_details.ts +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/reinstate_booking.ts +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/request_flight_reconfirmation.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/resend_confirmation.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/reserve_table.ts +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/resolve_room_conflict.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/schedule_wakeup_call.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/set_do_not_disturb.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/set_extras.ts +1 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/set_stay.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/start_booking_modification.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/start_room_booking.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/take_guest_message.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/transfer_call.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/update_card.ts +2 -1
- package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/verify_booking.ts +2 -1
- package/dist/templates/{link-digest → link-digest-workflow}/agent.eval.test.ts +16 -1
- package/dist/templates/{link-digest → link-digest-workflow}/agent.test.ts +2 -2
- package/dist/templates/{link-digest → link-digest-workflow}/agent.ts +8 -3
- package/dist/templates/{link-digest → link-digest-workflow}/client.tsx +2 -2
- package/dist/templates/{link-digest → link-digest-workflow}/workflows/digest.ts +1 -1
- package/dist/templates/{health-assistant → medication-safety-agent}/agent.test.ts +55 -1
- package/dist/templates/medication-safety-agent/agent.ts +62 -0
- package/dist/templates/{recap-workflow → meeting-recap-agent}/agent.test.ts +4 -4
- package/dist/templates/{recap-workflow → meeting-recap-agent}/agent.ts +5 -1
- package/dist/templates/{recap-workflow → meeting-recap-agent}/workflows/recap.ts +3 -3
- package/dist/templates/{pizza-ordering → pizza-ordering-agent}/agent.ts +3 -0
- package/dist/templates/{podcast-digest → podcast-digest-workflow}/agent.eval.test.ts +1 -1
- package/dist/templates/{podcast-digest → podcast-digest-workflow}/agent.test.ts +1 -1
- package/dist/templates/{podcast-digest → podcast-digest-workflow}/agent.ts +6 -2
- package/dist/templates/{podcast-digest → podcast-digest-workflow}/client.tsx +3 -3
- package/dist/templates/{podcast-digest → podcast-digest-workflow}/workflows/digest.ts +1 -1
- package/dist/templates/{simple → quickstart-agent}/agent.eval.test.ts +39 -3
- package/dist/templates/{simple → quickstart-agent}/agent.test.ts +25 -3
- package/dist/templates/quickstart-agent/agent.ts +24 -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-workflow → research-handoff-agent}/agent.test.ts +1 -1
- package/dist/templates/{research-workflow → research-handoff-agent}/agent.ts +5 -1
- package/dist/templates/{research-workflow → research-handoff-agent}/workflows/filing.ts +1 -1
- package/dist/templates/{research-workflow → research-handoff-agent}/workflows/research.ts +1 -1
- package/dist/templates/{research-workflow → research-handoff-agent}/workflows/review.ts +1 -1
- package/dist/templates/{plan-and-execute → research-planner-agent}/agent.eval.test.ts +24 -2
- package/dist/templates/{plan-and-execute → research-planner-agent}/agent.ts +3 -0
- package/dist/templates/{plan-and-execute → research-planner-agent}/shared.ts +1 -1
- package/dist/templates/{plan-and-execute → research-planner-agent}/system-prompt.md +1 -1
- package/dist/templates/{retail → retail-orders-agent}/agent.ts +32 -3
- package/dist/templates/retail-orders-agent/keyterms.ts +154 -0
- package/dist/templates/{retail → retail-orders-agent}/pending.ts +2 -2
- package/dist/templates/{retail → retail-orders-agent}/resolve.ts +18 -3
- package/dist/templates/{retail → retail-orders-agent}/shared.ts +1 -1
- package/dist/templates/{retail → retail-orders-agent}/store.ts +3 -3
- package/dist/templates/{roadside-assist → roadside-assistance-agent}/agent.eval.test.ts +37 -5
- package/dist/templates/{roadside-assist → roadside-assistance-agent}/agent.test.ts +38 -6
- package/dist/templates/{roadside-assist → roadside-assistance-agent}/agent.ts +5 -1
- package/dist/templates/{roadside-assist → roadside-assistance-agent}/call.ts +1 -1
- package/dist/templates/{roadside-assist → roadside-assistance-agent}/shared.ts +15 -3
- package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/acknowledge_disclosure.ts +14 -0
- package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/dispatch_truck.ts +1 -1
- package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/lookup_coverage.ts +11 -0
- package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/service_disclosure.ts +17 -11
- package/dist/templates/{roadside-assist → roadside-assistance-agent}/yard.test.ts +4 -0
- package/dist/templates/{spoken-summary → spoken-summary-workflow}/agent.test.ts +1 -1
- package/dist/templates/{spoken-summary → spoken-summary-workflow}/agent.ts +5 -1
- package/dist/templates/{spoken-summary → spoken-summary-workflow}/client.tsx +1 -1
- package/dist/templates/{spoken-summary → spoken-summary-workflow}/workflows/summarize.ts +1 -1
- package/dist/templates/{solo-rpg → tabletop-rpg-agent}/agent.eval.test.ts +6 -0
- package/dist/templates/{solo-rpg → tabletop-rpg-agent}/agent.test.ts +125 -1
- package/dist/templates/tabletop-rpg-agent/agent.ts +58 -0
- package/dist/templates/{solo-rpg → tabletop-rpg-agent}/shared.ts +84 -3
- package/dist/templates/{solo-rpg → tabletop-rpg-agent}/system-prompt.md +1 -1
- package/dist/templates/tabletop-rpg-agent/tools/check_state.ts +37 -0
- package/dist/templates/{support-line → technical-support-agent}/agent.test.ts +3 -3
- package/dist/templates/{support-line → technical-support-agent}/agent.ts +5 -1
- package/dist/templates/technical-support-agent/knowledge.ts +165 -0
- package/dist/templates/{support-line → technical-support-agent}/nodes.ts +3 -2
- package/dist/templates/{support-line → technical-support-agent}/procedure.ts +4 -3
- package/dist/templates/technical-support-agent/shared.ts +145 -0
- package/dist/templates/{support-line → technical-support-agent}/tools/list_topics.ts +2 -1
- package/dist/templates/{infocom-adventure → text-adventure-agent}/agent.eval.test.ts +39 -6
- package/dist/templates/{infocom-adventure → text-adventure-agent}/agent.test.ts +79 -1
- package/dist/templates/{infocom-adventure → text-adventure-agent}/agent.ts +30 -1
- package/dist/templates/{infocom-adventure → text-adventure-agent}/client.tsx +2 -2
- package/dist/templates/{infocom-adventure → text-adventure-agent}/shared.ts +37 -0
- package/dist/templates/{infocom-adventure → text-adventure-agent}/system-prompt.md +9 -2
- package/dist/templates/{briefing-desk → topic-briefing-agent}/agent.eval.test.ts +21 -7
- package/dist/templates/{briefing-desk → topic-briefing-agent}/agent.test.ts +23 -11
- package/dist/templates/{briefing-desk → topic-briefing-agent}/agent.ts +5 -2
- package/dist/templates/{briefing-desk → topic-briefing-agent}/shared.ts +11 -11
- package/dist/templates/{briefing-desk → topic-briefing-agent}/slack.ts +1 -1
- package/dist/templates/{briefing-desk → topic-briefing-agent}/system-prompt.md +13 -8
- package/dist/templates/{briefing-desk → topic-briefing-agent}/tools/send_briefing.ts +43 -5
- package/dist/templates/transcription-workflow/agent.test.ts +1 -1
- package/dist/templates/transcription-workflow/agent.ts +4 -1
- package/dist/templates/transcription-workflow/client.tsx +1 -1
- package/dist/templates/transcription-workflow/workflows/batch.ts +2 -2
- package/dist/templates/transcription-workflow/workflows/transcribe.ts +1 -1
- package/dist/templates/{travel-concierge → travel-concierge-agent}/agent.ts +4 -0
- package/dist/templates/{travel-concierge → travel-concierge-agent}/shared.ts +1 -1
- package/dist/templates/{web-researcher → web-research-agent}/agent.eval.test.ts +32 -6
- package/dist/templates/{web-researcher → web-research-agent}/agent.test.ts +17 -1
- package/dist/templates/{web-researcher → web-research-agent}/agent.ts +31 -1
- package/dist/templates/{web-researcher → web-research-agent}/system-prompt.md +8 -2
- package/dist/templates/{word-wrangler → word-game-agent}/agent.eval.test.ts +79 -18
- package/dist/templates/{word-wrangler → word-game-agent}/agent.ts +20 -0
- package/dist/templates/{word-wrangler → word-game-agent}/game.ts +1 -1
- package/dist/templates/{word-wrangler → word-game-agent}/shared.ts +1 -1
- package/dist/test-CjKPQ9_B.mjs +102 -0
- package/dist/test.d.ts +37 -12
- package/package.json +5 -5
- package/dist/_init-BzQbV8Zh.mjs +0 -199
- package/dist/_preflight-CcAR577V.mjs +0 -46
- package/dist/init-D363Ls5u.mjs +0 -183
- package/dist/templates/health-assistant/agent.ts +0 -15
- package/dist/templates/simple/agent.ts +0 -8
- package/dist/templates/solo-rpg/agent.ts +0 -29
- package/dist/templates/solo-rpg/tools/check_state.ts +0 -28
- package/dist/templates/support-line/shared.ts +0 -281
- package/dist/test-Cllnx81G.mjs +0 -83
- /package/dist/templates/{hiring-desk → applicant-screening-agent}/agent.test.ts +0 -0
- /package/dist/templates/{hiring-desk → applicant-screening-agent}/client.tsx +0 -0
- /package/dist/templates/{hiring-desk → applicant-screening-agent}/leads.json +0 -0
- /package/dist/templates/{hiring-desk → applicant-screening-agent}/screening-lock.test.ts +0 -0
- /package/dist/templates/{hiring-desk → applicant-screening-agent}/screening-lock.ts +0 -0
- /package/dist/templates/{hiring-desk → applicant-screening-agent}/system-prompt.md +0 -0
- /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/candidate_details.ts +0 -0
- /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/proceed_to_emails.ts +0 -0
- /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/read_email.ts +0 -0
- /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/rescore_with_feedback.ts +0 -0
- /package/dist/templates/{hiring-desk → applicant-screening-agent}/tools/screen_candidates.ts +0 -0
- /package/dist/templates/{call-audit → call-audit-workflow}/agent.eval.test.ts +0 -0
- /package/dist/templates/{call-audit → call-audit-workflow}/agent.test.ts +0 -0
- /package/dist/templates/{call-audit → call-audit-workflow}/workflows/audit.ts +0 -0
- /package/dist/templates/{call-audit → call-audit-workflow}/workflows/ingest.ts +0 -0
- /package/dist/templates/{call-audit → call-audit-workflow}/workflows/media.ts +0 -0
- /package/dist/templates/{call-audit → call-audit-workflow}/workflows/sync-api.ts +0 -0
- /package/dist/templates/{code-interpreter → code-interpreter-agent}/system-prompt.md +0 -0
- /package/dist/templates/{pipeline-simple → custom-pipeline-agent}/agent.eval.test.ts +0 -0
- /package/dist/templates/{pipeline-simple → custom-pipeline-agent}/stages.test.ts +0 -0
- /package/dist/templates/{redline → document-redline-workflow}/agent.eval.test.ts +0 -0
- /package/dist/templates/{redline → document-redline-workflow}/agent.test.ts +0 -0
- /package/dist/templates/{redline → document-redline-workflow}/form.ts +0 -0
- /package/dist/templates/{redline → document-redline-workflow}/workflows/prompts.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/agent.eval.test.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/client.tsx +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/shared.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_add_note.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_escalate.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_get.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_triage.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/incident_update_status.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/ops_dashboard.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/ops_protocols.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/ops_run_scenario.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/resources_dispatch.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/resources_get_available.ts +0 -0
- /package/dist/templates/{dispatch-center → emergency-dispatch-agent}/tools/resources_update_status.ts +0 -0
- /package/dist/templates/{night-owl → entertainment-picks-agent}/shared.ts +0 -0
- /package/dist/templates/{night-owl → entertainment-picks-agent}/tools/recommend.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/agent.test.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/calendar.test.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/client.tsx +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/inbox.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/nodes.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/review.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/accept.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/ask_question.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/draft_reply.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/edit.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/ignore.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/inbox_status.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/new_email.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/respond.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/review_memory.ts +0 -0
- /package/dist/templates/{executive-assistant → executive-inbox-agent}/tools/triage_inbox.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/booking.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/card.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/catalogs.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/desk.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/hotel.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/policies.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/records.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/restaurant.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/seed.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/book_business_center.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/book_spa_appointment.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/book_tour.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/lookup_policy.ts +0 -0
- /package/dist/templates/{hotel-desk → hotel-reception-agent}/tools/order_flowers.ts +0 -0
- /package/dist/templates/{link-digest → link-digest-workflow}/api-client.ts +0 -0
- /package/dist/templates/{health-assistant → medication-safety-agent}/agent.eval.test.ts +0 -0
- /package/dist/templates/{health-assistant → medication-safety-agent}/fda.test.ts +0 -0
- /package/dist/templates/{health-assistant → medication-safety-agent}/fda.ts +0 -0
- /package/dist/templates/{health-assistant → medication-safety-agent}/system-prompt.md +0 -0
- /package/dist/templates/{health-assistant → medication-safety-agent}/tools/check_drug_interaction.ts +0 -0
- /package/dist/templates/{health-assistant → medication-safety-agent}/tools/medication_lookup.ts +0 -0
- /package/dist/templates/{recap-workflow → meeting-recap-agent}/agent.eval.test.ts +0 -0
- /package/dist/templates/{recap-workflow → meeting-recap-agent}/shared.ts +0 -0
- /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/cancel_recap.ts +0 -0
- /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/keep_transcript.ts +0 -0
- /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/recap_progress.ts +0 -0
- /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/recap_status.ts +0 -0
- /package/dist/templates/{recap-workflow → meeting-recap-agent}/tools/request_recap.ts +0 -0
- /package/dist/templates/{recap-workflow → meeting-recap-agent}/workflows/tokens.ts +0 -0
- /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/agent.eval.test.ts +0 -0
- /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/agent.test.ts +0 -0
- /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/client.tsx +0 -0
- /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/shared.ts +0 -0
- /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/system-prompt.md +0 -0
- /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/add_pizza.ts +0 -0
- /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/place_order.ts +0 -0
- /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/remove_pizza.ts +0 -0
- /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/set_customer_name.ts +0 -0
- /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/update_pizza.ts +0 -0
- /package/dist/templates/{pizza-ordering → pizza-ordering-agent}/tools/view_order.ts +0 -0
- /package/dist/templates/{podcast-digest → podcast-digest-workflow}/workflows/feeds.ts +0 -0
- /package/dist/templates/{podcast-digest → podcast-digest-workflow}/workflows/slack.ts +0 -0
- /package/dist/templates/{research-workflow → research-handoff-agent}/agent.eval.test.ts +0 -0
- /package/dist/templates/{research-workflow → research-handoff-agent}/shared.ts +0 -0
- /package/dist/templates/{research-workflow → research-handoff-agent}/tools/file_it_now.ts +0 -0
- /package/dist/templates/{research-workflow → research-handoff-agent}/tools/request_research.ts +0 -0
- /package/dist/templates/{research-workflow → research-handoff-agent}/tools/research_progress.ts +0 -0
- /package/dist/templates/{research-workflow → research-handoff-agent}/tools/research_status.ts +0 -0
- /package/dist/templates/{research-workflow → research-handoff-agent}/workflows/notes.ts +0 -0
- /package/dist/templates/{research-workflow → research-handoff-agent}/workflows/prompts.ts +0 -0
- /package/dist/templates/{plan-and-execute → research-planner-agent}/agent.test.ts +0 -0
- /package/dist/templates/{plan-and-execute → research-planner-agent}/client.tsx +0 -0
- /package/dist/templates/{plan-and-execute → research-planner-agent}/procedure.ts +0 -0
- /package/dist/templates/{plan-and-execute → research-planner-agent}/prompts.ts +0 -0
- /package/dist/templates/{plan-and-execute → research-planner-agent}/tools/plan_status.ts +0 -0
- /package/dist/templates/{plan-and-execute → research-planner-agent}/tools/revise_plan.ts +0 -0
- /package/dist/templates/{plan-and-execute → research-planner-agent}/tools/start_plan.ts +0 -0
- /package/dist/templates/{plan-and-execute → research-planner-agent}/tools/work_next_step.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/address.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/agent.eval.test.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/agent.test.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/authenticate.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/cancel.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/client.tsx +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/payment.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/pending.test.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/refund.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/registry.test.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/resolve.test.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/returns.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/seed.json +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/seed.test.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/shared.test.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/store.test.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/swap.test.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/swap.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/system-prompt.md +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/cancel_change.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/cancel_pending_order.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/confirm_change.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/exchange_delivered_order_items.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/find_user_id_by_email.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/find_user_id_by_name_zip.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/get_item_details.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/get_order_details.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/get_product_details.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/get_user_details.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/list_all_product_types.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/modify_pending_order_address.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/modify_pending_order_items.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/modify_pending_order_payment.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/modify_user_address.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/return_delivered_order_items.ts +0 -0
- /package/dist/templates/{retail → retail-orders-agent}/tools/transfer_to_human_agents.ts +0 -0
- /package/dist/templates/{roadside-assist → roadside-assistance-agent}/events.ts +0 -0
- /package/dist/templates/{roadside-assist → roadside-assistance-agent}/system-prompt.md +0 -0
- /package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/job_status.ts +0 -0
- /package/dist/templates/{roadside-assist → roadside-assistance-agent}/tools/report_location.ts +0 -0
- /package/dist/templates/{roadside-assist → roadside-assistance-agent}/yard.ts +0 -0
- /package/dist/templates/{spoken-summary → spoken-summary-workflow}/agent.eval.test.ts +0 -0
- /package/dist/templates/{spoken-summary → spoken-summary-workflow}/workflows/transcribe.ts +0 -0
- /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/client.tsx +0 -0
- /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/action_roll.ts +0 -0
- /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/burn_momentum.ts +0 -0
- /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/oracle.ts +0 -0
- /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/setup_character.ts +0 -0
- /package/dist/templates/{solo-rpg → tabletop-rpg-agent}/tools/update_state.ts +0 -0
- /package/dist/templates/{support-line → technical-support-agent}/agent.eval.test.ts +0 -0
- /package/dist/templates/{support-line → technical-support-agent}/client.tsx +0 -0
- /package/dist/templates/{support-line → technical-support-agent}/knowledge.json +0 -0
- /package/dist/templates/{support-line → technical-support-agent}/prompts.ts +0 -0
- /package/dist/templates/{support-line → technical-support-agent}/system-prompt.md +0 -0
- /package/dist/templates/{support-line → technical-support-agent}/tools/answer_question.ts +0 -0
- /package/dist/templates/{support-line → technical-support-agent}/tools/log_ticket.ts +0 -0
- /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_drop.ts +0 -0
- /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_flag.ts +0 -0
- /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_get.ts +0 -0
- /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_move.ts +0 -0
- /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_restart.ts +0 -0
- /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_score.ts +0 -0
- /package/dist/templates/{infocom-adventure → text-adventure-agent}/tools/game_state_take.ts +0 -0
- /package/dist/templates/{briefing-desk → topic-briefing-agent}/tools/briefing_so_far.ts +0 -0
- /package/dist/templates/{briefing-desk → topic-briefing-agent}/tools/research_topic.ts +0 -0
- /package/dist/templates/{briefing-desk → topic-briefing-agent}/tools/verify_claim.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/agent.eval.test.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/agent.test.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/call-events.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/client.tsx +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/routing.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/system-prompt.md +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/book_car_rental.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/book_excursion.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/book_hotel.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/cancel_action.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/cancel_ticket.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/complete_or_escalate.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/confirm_action.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/lookup_booking.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/search_car_rentals.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/search_excursions.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/search_flights.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/search_hotels.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/to_car_rental_assistant.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/to_excursion_assistant.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/to_flight_assistant.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/to_hotel_assistant.ts +0 -0
- /package/dist/templates/{travel-concierge → travel-concierge-agent}/tools/update_ticket.ts +0 -0
- /package/dist/templates/{word-wrangler → word-game-agent}/agent.test.ts +0 -0
- /package/dist/templates/{word-wrangler → word-game-agent}/client.tsx +0 -0
- /package/dist/templates/{word-wrangler → word-game-agent}/guess.ts +0 -0
- /package/dist/templates/{word-wrangler → word-game-agent}/player.ts +0 -0
- /package/dist/templates/{word-wrangler → word-game-agent}/system-prompt.md +0 -0
- /package/dist/templates/{word-wrangler → word-game-agent}/tools/final_score.ts +0 -0
- /package/dist/templates/{word-wrangler → word-game-agent}/tools/relay_description.ts +0 -0
- /package/dist/templates/{word-wrangler → word-game-agent}/tools/repeat_word.ts +0 -0
- /package/dist/templates/{word-wrangler → word-game-agent}/tools/skip_word.ts +0 -0
- /package/dist/templates/{word-wrangler → word-game-agent}/tools/start_game.ts +0 -0
- /package/dist/templates/{word-wrangler → word-game-agent}/words.ts +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type AgentGuardrail, agent } from "@alexkroman1/aai";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The check itself, named and typed rather than written inline.
|
|
5
|
+
*
|
|
6
|
+
* A guardrail is the one declaration in an `agent()` that can stop the agent
|
|
7
|
+
* saying something, so it is worth reading on its own — and `AgentGuardrail`
|
|
8
|
+
* is what types the pair it is handed (the text, and the session's context).
|
|
9
|
+
*/
|
|
10
|
+
const refuseDoses: AgentGuardrail = (text) =>
|
|
11
|
+
/\b\d+(?:\.\d+)?\s?(?:mg|mcg|ml|g|iu|units?)\b/i.test(text)
|
|
12
|
+
? "I can't give dosing information — the amount to take depends on things I don't know about you. Please check the label or ask your pharmacist, and I'm happy to help with side effects or interactions."
|
|
13
|
+
: true;
|
|
14
|
+
|
|
15
|
+
export default agent({
|
|
16
|
+
name: "Dr. Sage",
|
|
17
|
+
// Read by whoever is looking at a LIST of agents — a registry page, the
|
|
18
|
+
// studio's picker — and never by the model. The model's brief is
|
|
19
|
+
// `system-prompt.md`.
|
|
20
|
+
description: "Answers medication questions from openFDA labels, and never gives dosing advice",
|
|
21
|
+
greeting:
|
|
22
|
+
"Hey, I'm Dr. Sage. Try asking me something like, what are the side effects of ibuprofen, can I take aspirin and warfarin together, or calculate my BMI. Just remember, I'm not a real doctor, so always check with your healthcare provider.",
|
|
23
|
+
// Three builtins, and `fetch_json` is the one worth explaining: `fda.ts`
|
|
24
|
+
// already reaches openFDA's LABEL endpoint in tool code, and a label is the
|
|
25
|
+
// manufacturer's text. What the two tools cannot answer is what people
|
|
26
|
+
// actually REPORT, which lives in a different dataset (`/drug/event.json`)
|
|
27
|
+
// and is a counting query rather than a lookup — so it is the model's to
|
|
28
|
+
// compose, not a fixed tool's. `system-prompt.md` holds the endpoint and the
|
|
29
|
+
// caveat that a report count is not an incidence rate.
|
|
30
|
+
builtinTools: ["web_search", "run_code", "fetch_json"],
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The one rule in this agent's brief that must not depend on the model
|
|
34
|
+
* following it.
|
|
35
|
+
*
|
|
36
|
+
* `system-prompt.md` already says not to give a dose. A prompt is a request,
|
|
37
|
+
* and this agent reads out drug labels — every one of which contains dosing
|
|
38
|
+
* text the model is one summarization away from repeating. An output
|
|
39
|
+
* guardrail is the only place the sentence can be stopped, because it is the
|
|
40
|
+
* only thing that runs between the model finishing and the synthesizer
|
|
41
|
+
* starting (see `AgentGuardrails` — in S2S mode there is no such point, and
|
|
42
|
+
* declaring one there is refused rather than ignored).
|
|
43
|
+
*
|
|
44
|
+
* Two properties are worth copying into your own:
|
|
45
|
+
*
|
|
46
|
+
* - **The verdict is what the caller HEARS**, not a complaint sent back to
|
|
47
|
+
* the model. There is no rewrite: a second full turn is time a caller
|
|
48
|
+
* spends in silence, so the honest options are the fallback sentence or
|
|
49
|
+
* nothing.
|
|
50
|
+
* - **It costs the streaming.** A reply that must be judged whole cannot be
|
|
51
|
+
* spoken as it arrives, so this agent's answers begin when the model
|
|
52
|
+
* finishes rather than as it types. That is the price of a block that is
|
|
53
|
+
* real, and it is why the field is opt-in.
|
|
54
|
+
*
|
|
55
|
+
* The pattern deliberately does not try to be a dose PARSER. It matches a
|
|
56
|
+
* number next to a dose unit, which over-blocks (a label quote that mentions
|
|
57
|
+
* "200 mg tablets" is refused too) — and over-blocking is the safe direction
|
|
58
|
+
* for this agent: the caller is told to ask a pharmacist, which is the answer
|
|
59
|
+
* the brief wanted anyway.
|
|
60
|
+
*/
|
|
61
|
+
outputGuardrails: [refuseDoses],
|
|
62
|
+
});
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
* RECORDED and its `waitFor` answers out of `hooks`, so no wait it serves ever
|
|
38
38
|
* suspended. A wait now hands the body a promise that never settles, so a
|
|
39
39
|
* suspension cannot reach a `catch` at all and there is no branch left to test:
|
|
40
|
-
* `aai-runtime`'s `workflow
|
|
41
|
-
* `workflow
|
|
40
|
+
* `aai-runtime`'s `workflow/replay/suspend.ts` carries the mechanism and
|
|
41
|
+
* `workflow/replay.test.ts` the engine-level proof, for every template at once.
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
/** The def a DEPLOYED agent runs: authored, plus what `tools/` declares. */
|
|
@@ -441,7 +441,7 @@ describe("cancel_recap", () => {
|
|
|
441
441
|
* through the SDK — and `step-fetch.ts` falls back to `globalThis.fetch` only
|
|
442
442
|
* when nothing is published. A global stub therefore passed while exercising a
|
|
443
443
|
* path production never takes; every sibling template already stubs the slot,
|
|
444
|
-
* and `link-digest/agent.test.ts` states the rule this one used to break.
|
|
444
|
+
* and `link-digest-workflow/agent.test.ts` states the rule this one used to break.
|
|
445
445
|
*
|
|
446
446
|
* `installStubStepFetch` unpublishes on `onTestFinished`, so there is no restore
|
|
447
447
|
* registry here and a stub cannot reach the next file.
|
|
@@ -1140,7 +1140,7 @@ describe("the run is DURABLE", () => {
|
|
|
1140
1140
|
*
|
|
1141
1141
|
* Every step's HTTP goes through the slot, the model call included, so a
|
|
1142
1142
|
* gateway stub installed over `globalThis.fetch` beside a provider stub would
|
|
1143
|
-
* be bypassed — `link-digest/agent.test.ts` carries the same note.
|
|
1143
|
+
* be bypassed — `link-digest-workflow/agent.test.ts` carries the same note.
|
|
1144
1144
|
* `stubGatewayRoute` is the composition for it.
|
|
1145
1145
|
*
|
|
1146
1146
|
* `transcript` is a list of successive `GET` answers, so a spec says how many
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* ported to a phone call.
|
|
5
5
|
*
|
|
6
6
|
* The desk transcribes a recording and writes it up. That takes minutes, and
|
|
7
|
-
* the caller is on the line for seconds, so the shape is `research-
|
|
7
|
+
* the caller is on the line for seconds, so the shape is `research-handoff-agent`'s: a
|
|
8
8
|
* tool starts a run and answers the turn, the run outlives the call, and the
|
|
9
9
|
* finished run takes an unprompted turn to read the result back.
|
|
10
10
|
*
|
|
@@ -79,6 +79,10 @@ import { recap } from "./shared.ts";
|
|
|
79
79
|
|
|
80
80
|
export default agent({
|
|
81
81
|
name: "Recap Desk",
|
|
82
|
+
// The desk's job, for a registry page or the studio's picker. Not the same
|
|
83
|
+
// sentence as `recap`'s own `description` in `shared.ts`: that one describes a
|
|
84
|
+
// RUN and is read by whoever is choosing a workflow to start.
|
|
85
|
+
description: "Transcribes meeting recordings and reads the write-up back when it lands",
|
|
82
86
|
greeting: "Recap desk. Want me to write up a recording?",
|
|
83
87
|
systemPrompt: [
|
|
84
88
|
"You take recordings over the phone, hand them to a transcription run, and read back recaps.",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* The durable half of the recap desk — and the file the Temporal patterns were
|
|
4
4
|
* ported into.
|
|
5
5
|
*
|
|
6
|
-
* Read `research-
|
|
6
|
+
* Read `research-handoff-agent/workflows/research.ts` first for the two rules every
|
|
7
7
|
* directive body obeys (replayed from the top, so no live handles and no
|
|
8
8
|
* undurable decisions; step arguments and results cross a queue, so pass an id
|
|
9
9
|
* and not a payload). Both hold here unchanged. What THIS template adds is the
|
|
@@ -234,7 +234,7 @@ const REQUEST_TIMEOUT_MS = 30_000;
|
|
|
234
234
|
* Transcript characters handed to the model.
|
|
235
235
|
*
|
|
236
236
|
* The pass-an-id-not-a-payload rule meeting the case where the payload IS the
|
|
237
|
-
* work — the same bound `link-digest` puts on article text, for the same
|
|
237
|
+
* work — the same bound `link-digest-workflow` puts on article text, for the same
|
|
238
238
|
* reason: it has to cross the queue, so it is capped rather than trusted.
|
|
239
239
|
*/
|
|
240
240
|
const MAX_TRANSCRIPT_CHARS = 24_000;
|
|
@@ -753,7 +753,7 @@ export async function discardTranscript(id: string): Promise<void> {
|
|
|
753
753
|
/**
|
|
754
754
|
* Reduce a transcript to something worth saying out loud.
|
|
755
755
|
*
|
|
756
|
-
* Separate from the polling on purpose, and for the same reason `link-digest`
|
|
756
|
+
* Separate from the polling on purpose, and for the same reason `link-digest-workflow`
|
|
757
757
|
* splits its fetch from its summary: a rate-limited model call replays the whole
|
|
758
758
|
* transcription — twenty minutes of provider time, already paid for — out of the
|
|
759
759
|
* journal instead of submitting the recording again.
|
|
@@ -9,6 +9,9 @@ import systemPrompt from "./system-prompt.md?raw";
|
|
|
9
9
|
|
|
10
10
|
export default agent({
|
|
11
11
|
name: "Pizza Palace",
|
|
12
|
+
// What the shop DOES, for a reader of a list of agents — not for the model,
|
|
13
|
+
// which gets `system-prompt.md` and the generated menu below.
|
|
14
|
+
description: "Takes pizza orders over the phone, from first topping to checkout",
|
|
12
15
|
// `orderSlot.state` IS the `() => ({ [slot.key]: slot.create() })` factory,
|
|
13
16
|
// so the session's cart exists before the first tool call — which is what a
|
|
14
17
|
// resumed connection needs to have something to project.
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
//
|
|
28
28
|
// So a LIVE run of this file makes no provider call and costs nothing. That is
|
|
29
29
|
// the honest report rather than a gap being papered over: what a live run would
|
|
30
|
-
// add here is a real transcript, and `spoken-summary` and `call-audit` both
|
|
30
|
+
// add here is a real transcript, and `spoken-summary-workflow` and `call-audit-workflow` both
|
|
31
31
|
// measure that against a real recording already.
|
|
32
32
|
//
|
|
33
33
|
// WHAT NO EVAL HERE COVERS: durability — which for THIS template is most of
|
|
@@ -1089,7 +1089,7 @@ describe("the run is DURABLE", () => {
|
|
|
1089
1089
|
* Every step's HTTP goes through the slot, the model call included, so a
|
|
1090
1090
|
* gateway stub over `globalThis.fetch` beside these routes would be bypassed.
|
|
1091
1091
|
* `stubGatewayRoute` is the composition for it — the same note
|
|
1092
|
-
* `link-digest/agent.test.ts` carries.
|
|
1092
|
+
* `link-digest-workflow/agent.test.ts` carries.
|
|
1093
1093
|
*
|
|
1094
1094
|
* `polls` is how many `GET /v2/transcript/:id` answers say "not yet" before
|
|
1095
1095
|
* the job is reported done, which is how a case decides whether the run has
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* voice pipeline. `client.tsx` starts a run over the workflow HTTP API and
|
|
8
8
|
* watches it, and `workflows/digest.ts` does the work.
|
|
9
9
|
*
|
|
10
|
-
* ## What makes this a different KIND of workflow app from `link-digest`
|
|
10
|
+
* ## What makes this a different KIND of workflow app from `link-digest-workflow`
|
|
11
11
|
*
|
|
12
|
-
* `link-digest` is the smallest one: one URL in, one digest out, run over. This
|
|
12
|
+
* `link-digest-workflow` is the smallest one: one URL in, one digest out, run over. This
|
|
13
13
|
* is the same front door around a run that **sleeps for days and wakes up
|
|
14
14
|
* again**. Three consequences worth reading before copying it:
|
|
15
15
|
*
|
|
@@ -131,6 +131,10 @@ export const dailyDigest: WorkflowDef<typeof digestInput, DailyDigestOutput> = w
|
|
|
131
131
|
|
|
132
132
|
export default workflowApp({
|
|
133
133
|
name: "Podcast Digest",
|
|
134
|
+
// The app's own line, for a reader of a list. `dailyDigest` above carries its
|
|
135
|
+
// own description for a different reader — the workflow listing a form is
|
|
136
|
+
// rendered from — and says the schedule, which is a fact about a run.
|
|
137
|
+
description: "Posts a recurring digest of new podcast episodes to Slack",
|
|
134
138
|
// The whole product. A workflow app is an agent whose work happens here.
|
|
135
139
|
workflows: { dailyDigest },
|
|
136
140
|
// Checked at deploy time. A workflow app declares no providers, so this is
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
* here with no edit to this file, and the defaults are stated once, in the
|
|
58
58
|
* schema, rather than here AND in the schema AND in the workflow body.
|
|
59
59
|
*
|
|
60
|
-
* `link-digest` is the page that writes its one control by hand, deliberately,
|
|
61
|
-
* so a reader can see what this layer stands on. `redline` is the MIXED case —
|
|
60
|
+
* `link-digest-workflow` is the page that writes its one control by hand, deliberately,
|
|
61
|
+
* so a reader can see what this layer stands on. `document-redline-workflow` is the MIXED case —
|
|
62
62
|
* declared scalars beside one hand-written array field.
|
|
63
63
|
*
|
|
64
|
-
* ## What a SCHEDULED run adds to `link-digest`'s page
|
|
64
|
+
* ## What a SCHEDULED run adds to `link-digest-workflow`'s page
|
|
65
65
|
*
|
|
66
66
|
* Two controls that only make sense when a run spends most of its life asleep,
|
|
67
67
|
* and both are the point of copying this file rather than that one:
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
*
|
|
39
39
|
* ## Batch polling, which is this file's one genuinely new mechanism
|
|
40
40
|
*
|
|
41
|
-
* `spoken-summary` and `transcription-workflow` each wait for ONE transcript,
|
|
41
|
+
* `spoken-summary-workflow` and `transcription-workflow` each wait for ONE transcript,
|
|
42
42
|
* so their poll loop is `for (…) { if (done) return; await ctx.sleep(…) }`. Here N
|
|
43
43
|
* episodes are in flight at once and they finish out of order, so the loop has
|
|
44
44
|
* to carry a shrinking pending set and let the finished ones drop out — see
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The def a DEPLOYED agent runs: authored, plus what `tools/` and
|
|
3
|
+
* `system-prompt.md` declare.
|
|
4
|
+
*
|
|
5
|
+
* `./agent.ts` would be the wrong import even for a template this small.
|
|
6
|
+
* Discovery happens where the bundle is assembled, so the authored export has
|
|
7
|
+
* NO tools and the framework-default prompt — an eval driving it measures a
|
|
8
|
+
* different agent than the one that deploys, and the tool-choice claim below
|
|
9
|
+
* would pass or fail for the wrong reason.
|
|
10
|
+
*/
|
|
11
|
+
import agentDef from "virtual:aai/agent";
|
|
1
12
|
// An EVAL: does the agent actually behave? Run it with `aai eval`.
|
|
2
13
|
//
|
|
3
14
|
// A test asserts about the config (see agent.test.ts — it never calls a model).
|
|
@@ -17,10 +28,9 @@
|
|
|
17
28
|
// What no eval here can see: anything below the audio boundary — where the
|
|
18
29
|
// agent decides you stopped talking, how it handles being interrupted, whether
|
|
19
30
|
// two sentences merged into one turn. Those need real paced audio.
|
|
20
|
-
import { errorsIn } from "@alexkroman1/aai-runtime/eval";
|
|
31
|
+
import { errorsIn, toolNames } from "@alexkroman1/aai-runtime/eval";
|
|
21
32
|
import { describeEval } from "@alexkroman1/aai-runtime/eval/vitest";
|
|
22
33
|
import { expect } from "vitest";
|
|
23
|
-
import agentDef from "./agent.ts";
|
|
24
34
|
|
|
25
35
|
describeEval(agentDef, (test) => {
|
|
26
36
|
test(
|
|
@@ -33,12 +43,38 @@ describeEval(agentDef, (test) => {
|
|
|
33
43
|
|
|
34
44
|
expect(turn.completed).toBe(true);
|
|
35
45
|
expect(turn.text).toMatch(/paris/i);
|
|
36
|
-
//
|
|
46
|
+
// The agent's one tool looks up WEATHER, so reaching for it here would
|
|
47
|
+
// be a real finding — not "this agent has no tools", which is what this
|
|
48
|
+
// line used to say and stopped being true the day it got one.
|
|
37
49
|
expect(turn.toolCalls).toEqual([]);
|
|
38
50
|
},
|
|
39
51
|
{ stubReply: "Paris is the capital of France." },
|
|
40
52
|
);
|
|
41
53
|
|
|
54
|
+
test(
|
|
55
|
+
"reaches for the tool that is only a FILE",
|
|
56
|
+
async ({ session }) => {
|
|
57
|
+
const turn = await session.say("What's the weather in Denver?");
|
|
58
|
+
|
|
59
|
+
// The claim the quickstart makes about this project: `get_weather` is a
|
|
60
|
+
// file in `tools/` that nothing imports and nothing registers, and this
|
|
61
|
+
// is the case that would notice if the directory went missing — a
|
|
62
|
+
// scripted run still boots the agent and still executes the tool a
|
|
63
|
+
// script names, so it checks the wiring even with no key set.
|
|
64
|
+
expect(toolNames(turn.toolCalls)).toEqual(["get_weather"]);
|
|
65
|
+
expect(turn.text).toMatch(/denver/i);
|
|
66
|
+
},
|
|
67
|
+
// The tool really runs, and really calls wttr.in. Nothing here asserts on
|
|
68
|
+
// what it answered: a service that is down returns the `{ error }` the
|
|
69
|
+
// tool is written to hand back, and the claim is about the CHOICE.
|
|
70
|
+
{
|
|
71
|
+
stubReply: [
|
|
72
|
+
{ tool: "get_weather", args: { city: "Denver" } },
|
|
73
|
+
"It's 54 degrees and clear in Denver.",
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
|
|
42
78
|
test(
|
|
43
79
|
"keeps the thread across two turns",
|
|
44
80
|
async ({ session }) => {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** The def a DEPLOYED agent runs: authored, plus `tools/` and `system-prompt.md`. */
|
|
2
|
+
import deployedDef from "virtual:aai/agent";
|
|
1
3
|
import { agent, assemblyAIPipeline, DEFAULT_SYSTEM_PROMPT } from "@alexkroman1/aai";
|
|
2
4
|
import { expectDeployable } from "@alexkroman1/aai/testing";
|
|
3
5
|
import { describe, expect, test } from "vitest";
|
|
@@ -17,7 +19,7 @@ import agentDef from "./agent.ts";
|
|
|
17
19
|
* mode needs is filled) are `expectDeployable`'s, which fails naming the one
|
|
18
20
|
* that went.
|
|
19
21
|
*/
|
|
20
|
-
describe("
|
|
22
|
+
describe("quickstart-agent template", () => {
|
|
21
23
|
test("is deployable: validates, is nameable, and every stage its mode needs is filled", () => {
|
|
22
24
|
// The template's point: with no provider fields declared, the default
|
|
23
25
|
// all-AssemblyAI cascaded pipeline is injected at parse time (see
|
|
@@ -54,13 +56,33 @@ describe("simple template", () => {
|
|
|
54
56
|
}
|
|
55
57
|
});
|
|
56
58
|
|
|
59
|
+
test("the two DISCOVERED halves are really discovered", () => {
|
|
60
|
+
// The template's central claim, and until it shipped these files there was
|
|
61
|
+
// nothing here to make it. `virtual:aai/agent` is the lowering a DEPLOYED
|
|
62
|
+
// agent gets — the authored def plus what `tools/` and `system-prompt.md`
|
|
63
|
+
// declare — so this asserts the thing the quickstart tells a reader to
|
|
64
|
+
// trust: the tool is registered by being a file, and the prompt is applied
|
|
65
|
+
// by sitting beside `agent.ts`.
|
|
66
|
+
//
|
|
67
|
+
// `deployedDef` rather than `agentDef` above: the raw export has no tools
|
|
68
|
+
// and the framework-default prompt, which is exactly what makes an
|
|
69
|
+
// assertion against it unable to see either half go missing.
|
|
70
|
+
expect(Object.keys(deployedDef.tools ?? {})).toEqual(["get_weather"]);
|
|
71
|
+
// Not "some prompt" but NOT the framework's — `system-prompt.md` is the
|
|
72
|
+
// one file an author edits first, and a prompt silently ignored produces
|
|
73
|
+
// an agent that behaves plausibly and wrongly rather than one that
|
|
74
|
+
// visibly cannot do something.
|
|
75
|
+
expect(deployedDef.systemPrompt).not.toBe(DEFAULT_SYSTEM_PROMPT);
|
|
76
|
+
expect(deployedDef.systemPrompt).toContain("get_weather");
|
|
77
|
+
});
|
|
78
|
+
|
|
57
79
|
test("write no prompt and you already have one: the SDK's voice core", () => {
|
|
58
80
|
// The other half of "declares nothing and still runs", and the one an
|
|
59
81
|
// author meets first. Built here rather than read off `agentDef`, so
|
|
60
82
|
// writing your own prompt — or dropping a `system-prompt.md` beside
|
|
61
83
|
// `agent.ts`, which the BUILD folds in — does not redden a claim about
|
|
62
84
|
// the SDK's default.
|
|
63
|
-
expect(expectDeployable(agent({ name: "
|
|
85
|
+
expect(expectDeployable(agent({ name: "Quickstart Assistant" })).systemPrompt).toBe(
|
|
64
86
|
DEFAULT_SYSTEM_PROMPT,
|
|
65
87
|
);
|
|
66
88
|
// And what a prompt of your own resolves to is your text ALONE. That is
|
|
@@ -68,7 +90,7 @@ describe("simple template", () => {
|
|
|
68
90
|
// session and appends yours under a header saying yours wins where they
|
|
69
91
|
// conflict. So write only your own rules — `DEFAULT_SYSTEM_PROMPT` is
|
|
70
92
|
// exported to be READ (print it, diff it across releases), not pasted in.
|
|
71
|
-
const own = agent({ name: "
|
|
93
|
+
const own = agent({ name: "Quickstart Assistant", systemPrompt: "Only discuss the weather." });
|
|
72
94
|
expect(expectDeployable(own).systemPrompt).toBe("Only discuss the weather.");
|
|
73
95
|
});
|
|
74
96
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { agent } from "@alexkroman1/aai";
|
|
2
|
+
|
|
3
|
+
// The whole agent. Three files make it up and none of them imports another:
|
|
4
|
+
// this one, `system-prompt.md` beside it, and `tools/get_weather.ts` — each
|
|
5
|
+
// found by WHERE IT SITS. That is the idea the rest of the framework is built
|
|
6
|
+
// on, so it is worth seeing here before anywhere else.
|
|
7
|
+
//
|
|
8
|
+
// No providers declared: the agent runs the default all-AssemblyAI cascaded
|
|
9
|
+
// pipeline, billed to ASSEMBLYAI_API_KEY. Declare any of stt/llm/tts to swap a
|
|
10
|
+
// single stage.
|
|
11
|
+
export default agent({
|
|
12
|
+
name: "Quickstart Assistant",
|
|
13
|
+
// One line for whoever is reading a LIST of agents — `aai list`, a registry
|
|
14
|
+
// page, the studio's picker. Never the model: what the model is told is
|
|
15
|
+
// `system-prompt.md`, beside this file.
|
|
16
|
+
description: "Looks up the current weather for any city",
|
|
17
|
+
// The first thing a caller hears. Without one the agent waits for them to
|
|
18
|
+
// speak, which on a phone call reads as a dead line.
|
|
19
|
+
greeting: "Hi — I can look up the weather anywhere. Which city?",
|
|
20
|
+
// Any name from `ASSEMBLYAI_TTS_VOICES`. It is sugar for a `tts` descriptor,
|
|
21
|
+
// so declaring `tts: assemblyAITts({ voice })` yourself is the same thing
|
|
22
|
+
// spelled out — and either one replaces only the speaking stage.
|
|
23
|
+
voice: "jane",
|
|
24
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
You are a friendly assistant on a voice call. Keep replies to one or two
|
|
2
|
+
sentences — a caller is listening, not reading.
|
|
3
|
+
|
|
4
|
+
Use the get_weather tool whenever someone asks what it is like somewhere, and
|
|
5
|
+
answer from what it returns rather than from memory. Round temperatures to
|
|
6
|
+
whole degrees and say the city back, so a mishearing is obvious.
|
|
7
|
+
|
|
8
|
+
If a lookup fails, say so plainly and offer to try another city.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { tool } from "@alexkroman1/aai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The two fields this tool reads out of wttr.in's JSON.
|
|
6
|
+
*
|
|
7
|
+
* Narrowed by hand rather than typed as the whole response: a tool's result is
|
|
8
|
+
* recorded in the conversation and sent to the model, so returning everything
|
|
9
|
+
* a third-party API happens to include spends context on fields nobody reads.
|
|
10
|
+
*/
|
|
11
|
+
type Wttr = {
|
|
12
|
+
current_condition?: [{ temp_F?: string; weatherDesc?: [{ value?: string }] }];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// This file IS the tool. It sits in `tools/`, so the model calls it
|
|
16
|
+
// `get_weather` — the filename and nothing else names it, and neither
|
|
17
|
+
// `agent.ts` nor any list mentions it. Adding an ability is adding a file
|
|
18
|
+
// here.
|
|
19
|
+
export default tool({
|
|
20
|
+
description: "Get the current weather for a city.",
|
|
21
|
+
inputSchema: z.object({ city: z.string().describe("City name, e.g. Denver") }),
|
|
22
|
+
// What the caller HEARS while this runs. A third-party lookup on a live call
|
|
23
|
+
// is the case the field exists for: without it the agent goes silent for as
|
|
24
|
+
// long as wttr.in takes, which sounds like a dropped call rather than like
|
|
25
|
+
// someone checking.
|
|
26
|
+
//
|
|
27
|
+
// Several entries at one moment are VARIANTS — one is drawn per call, so an
|
|
28
|
+
// agent asked about three cities does not say the same sentence three times.
|
|
29
|
+
// Different `afterMs` values are STAGES: the second line below is the one a
|
|
30
|
+
// caller hears only when the first was not enough.
|
|
31
|
+
//
|
|
32
|
+
// None of this is recorded. A hold line is heard, never written into the
|
|
33
|
+
// conversation, and never counts as the agent having spoken — so a caller
|
|
34
|
+
// who talks over one is not interrupting the reply being fetched behind it.
|
|
35
|
+
messages: {
|
|
36
|
+
start: ["Let me check that.", "One moment, checking the forecast."],
|
|
37
|
+
delayed: [{ afterMs: 4000, content: "Still waiting on the weather service." }],
|
|
38
|
+
// `role: "system"` hands the model a hint instead of a sentence: the
|
|
39
|
+
// failure is worth apologizing for in the agent's own voice, and only the
|
|
40
|
+
// model knows what the caller asked.
|
|
41
|
+
failed: [
|
|
42
|
+
{ role: "system", content: "The weather lookup failed. Apologize and offer to retry." },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
execute: async ({ city }, ctx) => {
|
|
46
|
+
// `ctx.signal` is the tool call's own deadline. Passing it means a slow
|
|
47
|
+
// service ends the FETCH rather than being waited out and then discarded,
|
|
48
|
+
// which on a live call is the difference between a short apology and a
|
|
49
|
+
// silence the caller hangs up on.
|
|
50
|
+
const res = await fetch(`https://wttr.in/${encodeURIComponent(city)}?format=j1`, {
|
|
51
|
+
signal: ctx.signal,
|
|
52
|
+
});
|
|
53
|
+
// Returned, not thrown: a tool failure the model can read is one it can
|
|
54
|
+
// apologize for out loud, which on a call beats silence.
|
|
55
|
+
if (!res.ok) return { error: `The weather service answered ${res.status}.` };
|
|
56
|
+
const now = ((await res.json()) as Wttr).current_condition?.[0];
|
|
57
|
+
return { city, tempF: now?.temp_F, conditions: now?.weatherDesc?.[0]?.value };
|
|
58
|
+
},
|
|
59
|
+
});
|
|
@@ -800,7 +800,7 @@ describe("filing the findings", () => {
|
|
|
800
800
|
* sequential: one angle, and a researcher that stops on its first turn, so the
|
|
801
801
|
* `mapConcurrent` fan-out has a single item and nothing races. A case that wants
|
|
802
802
|
* two angles at once wants a router keyed on the system prompt instead — the
|
|
803
|
-
* shape `link-digest` uses — because the order two concurrent step bodies reach
|
|
803
|
+
* shape `link-digest-workflow` uses — because the order two concurrent step bodies reach
|
|
804
804
|
* the gateway in is the scheduler's business.
|
|
805
805
|
*
|
|
806
806
|
* Five calls make a whole run: the brief, the angles, the researcher's first
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This is the HANDOFF shape: a caller is on the line, so a tool starts a run and
|
|
7
7
|
* answers the turn. When the workflow IS the product — a form rather than a
|
|
8
8
|
* call — the agent is declared with `workflowApp()` instead and has no session
|
|
9
|
-
* at all; `link-digest` is that one, at its smallest.
|
|
9
|
+
* at all; `link-digest-workflow` is that one, at its smallest.
|
|
10
10
|
*
|
|
11
11
|
* The whole point is the thing a voice agent cannot otherwise do: **answer the
|
|
12
12
|
* caller now, finish the work later.** Research takes minutes; the caller is on
|
|
@@ -98,6 +98,10 @@ import { research } from "./shared.ts";
|
|
|
98
98
|
|
|
99
99
|
export default agent({
|
|
100
100
|
name: "Research Desk",
|
|
101
|
+
// For a reader of a LIST of agents, never for the model. It names the
|
|
102
|
+
// HANDOFF, because that is what a caller actually gets from this line: an
|
|
103
|
+
// answer later, not an answer now.
|
|
104
|
+
description: "Takes research requests over the phone and reports back when the run lands",
|
|
101
105
|
greeting: "Research desk. What would you like me to look into?",
|
|
102
106
|
systemPrompt: [
|
|
103
107
|
"You take research requests over the phone and read back results.",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* a 4xx is a `FatalError`, because a revoked webhook answers identically on
|
|
18
18
|
* every retry, and a 5xx is a `RetryableError` carrying Slack's own
|
|
19
19
|
* `Retry-After`. None of that is written here, and the module doc of
|
|
20
|
-
* `podcast-digest/workflows/slack.ts` argues why at length. What is left is the
|
|
20
|
+
* `podcast-digest-workflow/workflows/slack.ts` argues why at length. What is left is the
|
|
21
21
|
* part that is about RESEARCH: what a filed report says.
|
|
22
22
|
*
|
|
23
23
|
* ## The channel is OPTIONAL, and that is deliberate
|
|
@@ -381,7 +381,7 @@ export async function investigate(brief: Brief, angle: string): Promise<Note> {
|
|
|
381
381
|
task: angle,
|
|
382
382
|
// The researcher has not heard the call and cannot see its siblings, so the
|
|
383
383
|
// brief rides in `context` — the same rule `angleBrief` states in
|
|
384
|
-
// `briefing-
|
|
384
|
+
// `topic-briefing-agent`, and the reason a subagent's task must be complete.
|
|
385
385
|
context: briefText(brief),
|
|
386
386
|
});
|
|
387
387
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* `researchFlow` opens the wait with {@link REVIEW_SLEEP_ID} and `file_it_now`
|
|
7
7
|
* ends it by naming the same id, so the two are a pair in the way
|
|
8
|
-
* `recap-
|
|
8
|
+
* `meeting-recap-agent/workflows/tokens.ts` describes: a string written twice is a
|
|
9
9
|
* string that drifts once, and the symptom is `wakeUp` answering `0` — which is
|
|
10
10
|
* ALSO what "the run had already moved past its wait" looks like. One module
|
|
11
11
|
* both sides import is what makes those two answers mean different things.
|
|
@@ -69,6 +69,9 @@ const planState = (session: EvalSession) => lastStateIn(session.events(), Projec
|
|
|
69
69
|
* dialog envelope — it reads the position itself. */
|
|
70
70
|
const IdleStatus = z.object({ stage: z.string(), reads: z.string(), next: z.string() });
|
|
71
71
|
|
|
72
|
+
/** How many steps the plan has actually recorded as worked, so far this session. */
|
|
73
|
+
const workedSteps = (session: EvalSession): number => planState(session)?.done.length ?? 0;
|
|
74
|
+
|
|
72
75
|
describeEval(agentDef, (test) => {
|
|
73
76
|
test(
|
|
74
77
|
"the stage the desk reports is the flow's, not a guess at the plan",
|
|
@@ -133,6 +136,14 @@ describeEval(agentDef, (test) => {
|
|
|
133
136
|
await session.say(
|
|
134
137
|
"I want to work out whether it is cheaper to take the train or fly from London to Edinburgh next month.",
|
|
135
138
|
);
|
|
139
|
+
// One more utterance when the desk asked something instead of planning.
|
|
140
|
+
// Its brief allows a single clarifying question, so spending it is legal
|
|
141
|
+
// and the caller answering is what a real call does — without this the
|
|
142
|
+
// case failed on "called no tools" for a desk that was following its own
|
|
143
|
+
// instructions.
|
|
144
|
+
if (session.toolCalls().every((call) => call.name !== "start_plan")) {
|
|
145
|
+
await session.say("Just those two options, next month, cheapest total. Go ahead and plan.");
|
|
146
|
+
}
|
|
136
147
|
const started = session.toolCalls().find((call) => call.name === "start_plan");
|
|
137
148
|
// The whole SESSION's calls, not one turn's: the plan may be started on
|
|
138
149
|
// either utterance, and "expected undefined to be defined" says nothing
|
|
@@ -145,13 +156,24 @@ describeEval(agentDef, (test) => {
|
|
|
145
156
|
expect(planned?.objective, `start_plan answered: ${started?.result}`).toBeTruthy();
|
|
146
157
|
expect(planned?.plan.length ?? 0).toBeGreaterThan(0);
|
|
147
158
|
|
|
148
|
-
|
|
159
|
+
let worked = await session.say("Yes — work the first step now and tell me what it found.");
|
|
160
|
+
// ONE more turn when nothing landed, keyed on the OUTCOME rather than on
|
|
161
|
+
// the tool's message. A step whose `executeStep` throws is put back at the
|
|
162
|
+
// head of the plan by the tool itself, "where a retry will find it" — so a
|
|
163
|
+
// transient delegate failure is a designed-for outcome with a designed-for
|
|
164
|
+
// recovery, and on a real call the caller asking again IS the retry. Read
|
|
165
|
+
// off `done` because the two ways to get here need the same nudge: the
|
|
166
|
+
// step threw, or the desk never called it. Without this a gateway hiccup
|
|
167
|
+
// failed the case on "expected 0 to be greater than 0", naming neither.
|
|
168
|
+
if (workedSteps(session) === 0) worked = await session.say("Give that step another try.");
|
|
149
169
|
const calls = toolNames(worked.toolCalls).filter((name) => name === "work_next_step").length;
|
|
150
170
|
expect(calls, describeTurn(worked)).toBeGreaterThan(0);
|
|
151
171
|
|
|
152
172
|
const after = planState(session);
|
|
153
173
|
const done = after?.done ?? [];
|
|
154
|
-
|
|
174
|
+
// Named, because "expected 0 to be greater than 0" says nothing about WHY
|
|
175
|
+
// nothing landed — a step that threw answers here with its own sentence.
|
|
176
|
+
expect(done.length, describeToolCalls(session.toolCalls())).toBeGreaterThan(0);
|
|
155
177
|
// ONE STEP PER CALL: `work_next_step` is one execute-then-replan turn, not
|
|
156
178
|
// a loop. More steps recorded than calls made would mean the tool had run
|
|
157
179
|
// the plan to completion, leaving the caller on a silent line with no gap
|
|
@@ -15,6 +15,9 @@ import { planProjection } from "./shared.ts";
|
|
|
15
15
|
*/
|
|
16
16
|
export default agent({
|
|
17
17
|
name: "Planning Desk",
|
|
18
|
+
// For a reader of a list of agents. It says the LOOP rather than "research",
|
|
19
|
+
// because a caller who wants an answer in one turn is on the wrong line.
|
|
20
|
+
description: "Turns an objective into a plan and works it one step at a time with the caller",
|
|
18
21
|
// The plan exists before the first tool call, so a resumed connection has
|
|
19
22
|
// something to project.
|
|
20
23
|
// The plan, its progress and its revision trail, pushed after every tool call.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* `sessionSlot` keyed per session, so two callers planning at once never see
|
|
11
11
|
* each other's steps and an abandoned plan vanishes with the session.
|
|
12
12
|
* Cross-session persistence would mean `ctx.db` and a caller identity, which is
|
|
13
|
-
* a different template (`
|
|
13
|
+
* a different template (`tabletop-rpg-agent` has the save-slot version).
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import {
|
|
@@ -2,7 +2,7 @@ You are the planning desk. Someone calls with something they want to get done, a
|
|
|
2
2
|
|
|
3
3
|
How a call goes:
|
|
4
4
|
|
|
5
|
-
- Find out what they actually want first. One clarifying question is
|
|
5
|
+
- Find out what they actually want first, but only when you actually need to: if what they opened with is already clear enough to plan, call `start_plan` on it straight away. One clarifying question is the most you ever need — you are planning, not interviewing, and a question you did not have to ask costs the caller a whole turn before anything starts.
|
|
6
6
|
- Call `start_plan` with the objective, then read the steps back in one breath: "I'd do three things — check X, compare Y, then book Z. Want me to start?"
|
|
7
7
|
- Call `work_next_step` once per step, never in a loop. It does the step, searches the web where it needs to, and updates the plan from what it found.
|
|
8
8
|
- After each step, say what it found in a sentence and ask whether to carry on. That pause is the point: it is where the caller gets to change their mind.
|
|
@@ -4,10 +4,39 @@ import { callFlow, gateFor, record, retailSlot } from "./store.ts";
|
|
|
4
4
|
|
|
5
5
|
export default agent({
|
|
6
6
|
name: "Retail Support",
|
|
7
|
+
description: "Looks up orders, returns and store credit for an authenticated retail caller",
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* A per-session ceiling on what the model may spend.
|
|
11
|
+
*
|
|
12
|
+
* This is the template where a budget earns its place: authentication, an
|
|
13
|
+
* order lookup and a staged change are three tool chains deep, the store's
|
|
14
|
+
* projection is large, and a caller who keeps re-asking can run a session for
|
|
15
|
+
* as long as they like. `maxSteps` bounds a REPLY and says nothing about a
|
|
16
|
+
* call — one step that sends a 100k-token context and one that sends a
|
|
17
|
+
* greeting are the same step.
|
|
18
|
+
*
|
|
19
|
+
* Tokens rather than money: a price is per-model and per-contract, and the
|
|
20
|
+
* SDK carries no table of them (see `UsageLimits`). The number here is a
|
|
21
|
+
* generous ceiling for a support call, not a target — pick yours from what
|
|
22
|
+
* `usage.updated` reports on a real conversation.
|
|
23
|
+
*
|
|
24
|
+
* Reaching it ends the session. An agent that wants a softer landing watches
|
|
25
|
+
* `usage.updated` through `agent({ events })` and says something first.
|
|
26
|
+
*
|
|
27
|
+
* **It was 200_000, and a real call reached 252,825 and ended mid-support.**
|
|
28
|
+
* This is the template with the deepest tool chains and the largest
|
|
29
|
+
* projection, so the old number was a ceiling a legitimate call could touch
|
|
30
|
+
* — and reaching it is not a soft landing, it ends the session. Raised with
|
|
31
|
+
* headroom rather than tuned: read `usage.updated` on a few real
|
|
32
|
+
* conversations and pick from that.
|
|
33
|
+
*
|
|
34
|
+
* The overshoot past whatever number is here is expected and bounded by the
|
|
35
|
+
* requests in flight: the cap is checked BEFORE each request, never
|
|
36
|
+
* mid-stream, because a limit enforced mid-sentence reads to the caller as a
|
|
37
|
+
* dropped call.
|
|
38
|
+
*/
|
|
39
|
+
usageLimits: { totalTokens: 2_000_000 },
|
|
11
40
|
|
|
12
41
|
// The store lives in one `sessionSlot` (`store.ts`), a pristine copy per
|
|
13
42
|
// session — callers must not see each other's cancellations. Nothing declares
|