@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,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The session's state, the slot, and what the browser is shown.
|
|
3
|
+
*
|
|
4
|
+
* The knowledge base and its retriever moved to `knowledge.ts` so that
|
|
5
|
+
* `client.tsx`, which imports this module for its view, does not take the
|
|
6
|
+
* articles with it.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
type DeepReadonly,
|
|
11
|
+
type SlotCaps,
|
|
12
|
+
type StateProjection,
|
|
13
|
+
sessionSlot,
|
|
14
|
+
} from "@alexkroman1/aai";
|
|
15
|
+
import { product } from "./knowledge.json" with { type: "json" };
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The product this desk supports.
|
|
19
|
+
*
|
|
20
|
+
* A NAMED import off `knowledge.json`, not a property of the whole object: the
|
|
21
|
+
* browser imports this module and must not take `docs` with it. `knowledge.ts`
|
|
22
|
+
* holds the articles.
|
|
23
|
+
*/
|
|
24
|
+
export const PRODUCT: string = product;
|
|
25
|
+
|
|
26
|
+
// ─── The trace ───────────────────────────────────────────────────────────────
|
|
27
|
+
// Their graph is watched by streaming node names to a notebook. A caller hears
|
|
28
|
+
// none of that, so the run records itself and the browser renders it.
|
|
29
|
+
|
|
30
|
+
export interface GradedDoc {
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
relevant: boolean;
|
|
34
|
+
reason: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface TraceStep {
|
|
38
|
+
/** The node's name, spelled as their graph spells it. */
|
|
39
|
+
node: string;
|
|
40
|
+
detail: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface AnswerTrace {
|
|
44
|
+
question: string;
|
|
45
|
+
/** The query retrieval actually ran on — rewritten, if it was. */
|
|
46
|
+
query: string;
|
|
47
|
+
rewrites: number;
|
|
48
|
+
steps: TraceStep[];
|
|
49
|
+
docs: GradedDoc[];
|
|
50
|
+
answer: string | null;
|
|
51
|
+
/** `null` until the hallucination grader has run. */
|
|
52
|
+
grounded: boolean | null;
|
|
53
|
+
/** `null` until the answer grader has run. */
|
|
54
|
+
useful: boolean | null;
|
|
55
|
+
/** True when the loop gave up and the caller should be offered a ticket. */
|
|
56
|
+
exhausted: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface Ticket {
|
|
60
|
+
reference: string;
|
|
61
|
+
question: string;
|
|
62
|
+
/** Server-side only — the projection never carries it. */
|
|
63
|
+
callback: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface SupportState {
|
|
67
|
+
/** The most recent run, which is what the sidebar renders. */
|
|
68
|
+
trace: AnswerTrace | null;
|
|
69
|
+
/** Every question this call has asked, capped. */
|
|
70
|
+
asked: string[];
|
|
71
|
+
ticket: Ticket | null;
|
|
72
|
+
ticketCounter: number;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function emptySupportState(): SupportState {
|
|
76
|
+
return { trace: null, asked: [], ticket: null, ticketCounter: 0 };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* How many of this call's questions the slot keeps.
|
|
81
|
+
*
|
|
82
|
+
* Exported because a spec reads it — the bound is declared once, here, and the
|
|
83
|
+
* test that the twenty-first question drops the first must not restate the
|
|
84
|
+
* number.
|
|
85
|
+
*/
|
|
86
|
+
export const ASKED_CAP = 20;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The growth bound, named and TYPED.
|
|
90
|
+
*
|
|
91
|
+
* `SlotCaps<SupportState>` admits only the state's array-valued keys, so a cap
|
|
92
|
+
* on `ticketCounter` or a mistyped `askedd` is a compile error at the
|
|
93
|
+
* declaration rather than a bound that silently caps nothing. `asked` rides in
|
|
94
|
+
* every `syncState` frame, which is why it is the field that needs one.
|
|
95
|
+
*/
|
|
96
|
+
const caps: SlotCaps<SupportState> = { asked: ASKED_CAP };
|
|
97
|
+
|
|
98
|
+
export const supportSlot = sessionSlot("support", emptySupportState, { caps });
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The call as a READ hands it out: deep-frozen, and typed to say so.
|
|
102
|
+
*
|
|
103
|
+
* {@link supportView} takes this rather than {@link SupportState}, which is the
|
|
104
|
+
* widening a deep-readonly slot forces and the reason it is worth doing: a
|
|
105
|
+
* mutable state still satisfies it, so a call with an `update` draft is
|
|
106
|
+
* unaffected, while a projection that WOULD have mutated stops compiling
|
|
107
|
+
* instead of throwing at its first call.
|
|
108
|
+
*/
|
|
109
|
+
export type FrozenSupportState = DeepReadonly<SupportState>;
|
|
110
|
+
|
|
111
|
+
// ─── The projection ──────────────────────────────────────────────────────────
|
|
112
|
+
|
|
113
|
+
export interface SupportView {
|
|
114
|
+
product: string;
|
|
115
|
+
trace: DeepReadonly<AnswerTrace> | null;
|
|
116
|
+
asked: readonly string[];
|
|
117
|
+
/** The reference only — the callback number stays on the server. */
|
|
118
|
+
ticket: string | null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* What the browser sees. The `ticket` field is why this is a projection rather
|
|
123
|
+
* than the state itself: a ticket carries the caller's phone number, and
|
|
124
|
+
* `syncState` is where you decide what leaves the server.
|
|
125
|
+
*/
|
|
126
|
+
export function supportView(state: FrozenSupportState): SupportView {
|
|
127
|
+
return {
|
|
128
|
+
product: PRODUCT,
|
|
129
|
+
trace: state.trace,
|
|
130
|
+
asked: state.asked,
|
|
131
|
+
ticket: state.ticket?.reference ?? null,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The projection BOTH ends use: `syncState` on the agent, `useAgentState` in
|
|
137
|
+
* the client.
|
|
138
|
+
*
|
|
139
|
+
* Annotated with `StateProjection<SupportView>` because this export IS the
|
|
140
|
+
* contract between the two — it is the only thing `agent.ts` and `client.tsx`
|
|
141
|
+
* share, and naming what a projection is (a callable carrying the slot's `key`
|
|
142
|
+
* and `create`) is what tells a reader why passing it to `useAgentState`
|
|
143
|
+
* derives the pre-first-frame value for free.
|
|
144
|
+
*/
|
|
145
|
+
export const supportProjection: StateProjection<SupportView> = supportSlot.projection(supportView);
|
|
@@ -28,9 +28,20 @@
|
|
|
28
28
|
* the only thing that tells a live model that "grab the rope" means
|
|
29
29
|
* `game_state_take` — an eval run against the framework default prompt measures
|
|
30
30
|
* an agent nobody deployed.
|
|
31
|
+
*
|
|
32
|
+
* The prompt is a RESOLVER (see `agent.ts`), so what a live run puts in front
|
|
33
|
+
* of the narrator is the file plus the board as it stands on that turn. That is
|
|
34
|
+
* what the state assertions below are really riding on: the narrator is never
|
|
35
|
+
* asked to remember an inventory, so a wrong answer is a game bug rather than a
|
|
36
|
+
* model lapse.
|
|
31
37
|
*/
|
|
32
38
|
import agentDef from "virtual:aai/agent";
|
|
33
|
-
import {
|
|
39
|
+
import {
|
|
40
|
+
type EvalTurn,
|
|
41
|
+
lastToolResultIn,
|
|
42
|
+
toolCallsInTurns,
|
|
43
|
+
toolResultIn,
|
|
44
|
+
} from "@alexkroman1/aai-runtime/eval";
|
|
34
45
|
import { describeEval } from "@alexkroman1/aai-runtime/eval/vitest";
|
|
35
46
|
import { expect } from "vitest";
|
|
36
47
|
import { z } from "zod";
|
|
@@ -135,10 +146,24 @@ describeEval(agentDef, (test) => {
|
|
|
135
146
|
test(
|
|
136
147
|
"the rank the score earned is still the player's rank a turn later",
|
|
137
148
|
async ({ session }) => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
149
|
+
// The chalice has to be IN HAND first. The prompt's scoring rule is that a
|
|
150
|
+
// treasure CARRIED BACK to the pedestal earns points, and
|
|
151
|
+
// `game_state_drop` refuses an item the player is not holding — so asked
|
|
152
|
+
// cold, "I set the chalice down" is a drop, which is what a live model
|
|
153
|
+
// reached for twice (`game_state_drop`, then no tool at all) while this
|
|
154
|
+
// case blamed the score tool.
|
|
155
|
+
const turns = await session.sayAll([
|
|
156
|
+
"I pick up the golden chalice.",
|
|
157
|
+
"I carry the chalice back to the Cave Mouth.",
|
|
158
|
+
"I set the chalice on the stone pedestal. Award me the points for returning it.",
|
|
159
|
+
]);
|
|
160
|
+
// `lastToolResultIn` rather than `answerOf`, which is `toolResultIn` and
|
|
161
|
+
// refuses a scope holding two calls. Across three turns the narrator may
|
|
162
|
+
// well award twice — settling the return on the carry and again on the
|
|
163
|
+
// request — and the SETTLED total is the one the player was told. Reading
|
|
164
|
+
// one turn instead was the workaround, and it made this case depend on
|
|
165
|
+
// which turn the narrator chose to score on.
|
|
166
|
+
const earned = lastToolResultIn(toolCallsInTurns(turns), "game_state_score", Scored);
|
|
142
167
|
// Whatever the model awarded — a live run picks its own number — the rank
|
|
143
168
|
// that came back is the one the ladder says that score earns. The tool
|
|
144
169
|
// computes it from `rankFor` because the slot's `after` hook has not run
|
|
@@ -148,12 +173,20 @@ describeEval(agentDef, (test) => {
|
|
|
148
173
|
|
|
149
174
|
// And the SECOND turn is the only place the hook's write can be seen: the
|
|
150
175
|
// field nothing assigns is read back off a later turn's state.
|
|
151
|
-
|
|
176
|
+
// "Check the game state", not "What is my score?" — the score is in the
|
|
177
|
+
// prompt now (see `statusBlock`), so a live narrator answers that one
|
|
178
|
+
// without a tool call, and this case is about the WRITE surviving the
|
|
179
|
+
// turn rather than about which question forces a read.
|
|
180
|
+
const later = answerOf(await session.say("Check the game state."), "game_state_get", Status);
|
|
152
181
|
expect(later.score).toBe(earned.score);
|
|
153
182
|
expect(later.rank).toBe(earned.rank);
|
|
154
183
|
},
|
|
155
184
|
{
|
|
156
185
|
stubReply: [
|
|
186
|
+
{ tool: "game_state_take", args: { value: "golden chalice" } },
|
|
187
|
+
"The golden chalice is cool and heavier than it looks.",
|
|
188
|
+
{ tool: "game_state_move", args: { value: "Cave Mouth" } },
|
|
189
|
+
"You retrace your steps to the cave mouth, chalice in hand.",
|
|
157
190
|
{ tool: "game_state_score", args: { value: 30 } },
|
|
158
191
|
"The chalice settles onto the pedestal with a satisfying weight.",
|
|
159
192
|
{ tool: "game_state_get" },
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/** The def a DEPLOYED agent runs: authored, plus what `tools/` declares. */
|
|
2
2
|
import agentDef from "virtual:aai/agent";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type AgentSessionContext,
|
|
5
|
+
createSeededRandom,
|
|
6
|
+
type RandomSource,
|
|
7
|
+
type SessionEventContext,
|
|
8
|
+
} from "@alexkroman1/aai";
|
|
4
9
|
import { createToolContext, parseToolInput, toolOf, toolRunner } from "@alexkroman1/aai/testing";
|
|
5
10
|
import { isToolFailure } from "@alexkroman1/aai/utils";
|
|
6
11
|
import { describe, expect, test } from "vitest";
|
|
@@ -13,6 +18,7 @@ import {
|
|
|
13
18
|
REPORTED_HISTORY,
|
|
14
19
|
rankFor,
|
|
15
20
|
SCAVENGER_FLAG,
|
|
21
|
+
statusBlock,
|
|
16
22
|
statusLine,
|
|
17
23
|
} from "./shared.ts";
|
|
18
24
|
|
|
@@ -373,3 +379,75 @@ describe("the game is per context", () => {
|
|
|
373
379
|
expect(DEFAULT_GAME_STATE.inventory).toEqual([]);
|
|
374
380
|
});
|
|
375
381
|
});
|
|
382
|
+
|
|
383
|
+
// ─── The prompt carries the board ────────────────────────────────────────────
|
|
384
|
+
//
|
|
385
|
+
// `systemPrompt` is a RESOLVER here, not a string: `system-prompt.md` supplies
|
|
386
|
+
// the world and the voice rules, and `statusBlock` appends the live board to
|
|
387
|
+
// them before every model request. What that replaced was six lines of prompt
|
|
388
|
+
// ordering the narrator to call `game_state_get` before answering any question
|
|
389
|
+
// about where the player is or what they hold — advice, enforced by nothing,
|
|
390
|
+
// and a model round trip on every turn it was obeyed on.
|
|
391
|
+
|
|
392
|
+
describe("the prompt the narrator is actually given", () => {
|
|
393
|
+
/** The def's resolver, which is what a request assembles the instructions from. */
|
|
394
|
+
const resolve = (ctx: AgentSessionContext): string => {
|
|
395
|
+
const prompt = agentDef.systemPrompt;
|
|
396
|
+
if (typeof prompt !== "function") throw new Error("systemPrompt is not a resolver");
|
|
397
|
+
return prompt(ctx);
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
test("it is a resolver, and the file's prose survives into it", () => {
|
|
401
|
+
// The build discovers `system-prompt.md` and hands it to `withSystemPrompt`,
|
|
402
|
+
// which leaves a resolver exactly as written — so the file has to reach the
|
|
403
|
+
// model through the resolver's own import, and this is what proves it does.
|
|
404
|
+
expect(typeof agentDef.systemPrompt).toBe("function");
|
|
405
|
+
expect(resolve(createToolContext())).toContain("CAVERN ADVENTURE");
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
test("a fresh session is told the opening board, before any tool has run", () => {
|
|
409
|
+
const opening = resolve(createToolContext());
|
|
410
|
+
expect(opening).toContain(`- Location: ${DEFAULT_GAME_STATE.currentRoom}`);
|
|
411
|
+
expect(opening).toContain("- Score: 0 (Beginner)");
|
|
412
|
+
expect(opening).toContain("- Turns taken: 0");
|
|
413
|
+
expect(opening).toContain("- Carrying: nothing");
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
test("every mutation is in the NEXT request's prompt, with no tool call in between", async () => {
|
|
417
|
+
const ctx = createToolContext();
|
|
418
|
+
await run("game_state_take", { value: "lantern" }, ctx);
|
|
419
|
+
await run("game_state_move", { value: "Echoing Hall" }, ctx);
|
|
420
|
+
await run("game_state_score", { value: 30 }, ctx);
|
|
421
|
+
say("go down to the hall", ctx);
|
|
422
|
+
|
|
423
|
+
const now = resolve(ctx);
|
|
424
|
+
expect(now).toContain("- Location: Echoing Hall");
|
|
425
|
+
expect(now).toContain("- Score: 30 (Amateur Adventurer)");
|
|
426
|
+
expect(now).toContain("- Turns taken: 1");
|
|
427
|
+
expect(now).toContain("- Carrying: lantern");
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
test("the block is built from the same status line the CRT and the read tool get", async () => {
|
|
431
|
+
const ctx = createToolContext();
|
|
432
|
+
await run("game_state_move", { value: "Crystal Grotto" }, ctx);
|
|
433
|
+
await run("game_state_score", { value: 60 }, ctx);
|
|
434
|
+
|
|
435
|
+
// One helper, three readers: `syncState`, `game_state_get`, and the prompt.
|
|
436
|
+
// A fourth rendering of these four numbers is a fourth thing to drift.
|
|
437
|
+
expect(resolve(ctx).endsWith(statusBlock(gameSlot.get(ctx)))).toBe(true);
|
|
438
|
+
const bar = statusLine(gameSlot.get(ctx));
|
|
439
|
+
expect(resolve(ctx)).toContain(`- Score: ${bar.score} (${bar.rank})`);
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
test("each session is told its OWN board", async () => {
|
|
443
|
+
// The resolver reads through `ctx.slots`, so it is per session for the same
|
|
444
|
+
// reason every tool is — a resolver that closed over a module-level game
|
|
445
|
+
// would put one player's inventory in another player's prompt.
|
|
446
|
+
const one = createToolContext();
|
|
447
|
+
const two = createToolContext();
|
|
448
|
+
await run("game_state_take", { value: "jade idol" }, one);
|
|
449
|
+
|
|
450
|
+
expect(resolve(one)).toContain("- Carrying: jade idol");
|
|
451
|
+
expect(resolve(two)).toContain("- Carrying: nothing");
|
|
452
|
+
});
|
|
453
|
+
});
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { agent } from "@alexkroman1/aai";
|
|
2
|
-
import { gameStatus, recordTurn } from "./shared.ts";
|
|
2
|
+
import { gameSlot, gameStatus, recordTurn, statusBlock } from "./shared.ts";
|
|
3
|
+
// The prose half of the prompt. `system-prompt.md` beside this file is
|
|
4
|
+
// discovered by the build either way — importing it is what lets the resolver
|
|
5
|
+
// below compose against it, and `withSystemPrompt` then leaves the resolver
|
|
6
|
+
// exactly as written.
|
|
7
|
+
import prompt from "./system-prompt.md?raw";
|
|
3
8
|
|
|
4
9
|
export default agent({
|
|
5
10
|
name: "Cavern Adventure",
|
|
11
|
+
// The listing line — a registry row, `aai list`, the studio's picker. Never
|
|
12
|
+
// the model: the world and the voice rules are `system-prompt.md`'s.
|
|
13
|
+
description: "Runs a spoken text adventure through an underground cave system",
|
|
6
14
|
// The world exists before the first command, so a resumed connection has
|
|
7
15
|
// something to project rather than an empty state object.
|
|
8
16
|
// A narrator wants a narrative voice; everything else stays on the
|
|
@@ -20,6 +28,27 @@ export default agent({
|
|
|
20
28
|
* one the narrator was told. `syncState` sends the game's own.
|
|
21
29
|
*/
|
|
22
30
|
syncState: gameStatus,
|
|
31
|
+
/**
|
|
32
|
+
* The world's rules, plus the board as it stands RIGHT NOW.
|
|
33
|
+
*
|
|
34
|
+
* A `systemPrompt` resolver is called once per model request, so the four
|
|
35
|
+
* facts of the status line and the player's inventory are in front of the
|
|
36
|
+
* narrator on every turn — which is what makes drift impossible rather than
|
|
37
|
+
* discouraged. The prompt used to carry a section demanding a
|
|
38
|
+
* `game_state_get` call before answering any question about the board, and
|
|
39
|
+
* "never from memory": advice that cost a round trip when it was obeyed and a
|
|
40
|
+
* desynced world when it was not. Four scalars and a list are cheaper to
|
|
41
|
+
* state than to ask for.
|
|
42
|
+
*
|
|
43
|
+
* `ctx` is an `AgentSessionContext` — the session id, the env and the slots,
|
|
44
|
+
* which is everything `gameSlot.get` needs and deliberately nothing that
|
|
45
|
+
* could speak. Synchronous by contract: the request is being assembled.
|
|
46
|
+
*
|
|
47
|
+
* `game_state_get` is NOT retired by this. It answers with the flags and the
|
|
48
|
+
* recent commands too, and it is still the tool for "check the game state".
|
|
49
|
+
* What went is the compulsory read-back.
|
|
50
|
+
*/
|
|
51
|
+
systemPrompt: (ctx) => `${prompt}\n\n${statusBlock(gameSlot.get(ctx))}`,
|
|
23
52
|
// The opening scene here must agree with DEFAULT_GAME_STATE.currentRoom
|
|
24
53
|
// (shared.ts) and the world map in system-prompt.md.
|
|
25
54
|
greeting:
|
|
@@ -337,8 +337,8 @@ function InfocomAdventure() {
|
|
|
337
337
|
latches a fatal error the state eyebrow goes back to reading like a
|
|
338
338
|
live session, so this is the only remaining signal — and the two
|
|
339
339
|
sibling chromes had already drifted on whether to print the code.
|
|
340
|
-
The frame's own square corners, the way `dispatch-
|
|
341
|
-
`retail` take it. */}
|
|
340
|
+
The frame's own square corners, the way `emergency-dispatch-agent` and
|
|
341
|
+
`retail-orders-agent` take it. */}
|
|
342
342
|
<SessionErrorBanner className="rounded-none border-x-0 border-b-0 font-mono" />
|
|
343
343
|
<Transcript />
|
|
344
344
|
<Footer />
|
|
@@ -146,6 +146,43 @@ export function statusLine(game: FrozenGameState): StatusLine {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
/**
|
|
150
|
+
* The board as the NARRATOR is given it, before every reply.
|
|
151
|
+
*
|
|
152
|
+
* `agent.ts` appends this to the system prompt through a `systemPrompt`
|
|
153
|
+
* resolver, so the four facts of the status line plus the inventory are in
|
|
154
|
+
* front of the model on every request — never remembered, never guessed, and
|
|
155
|
+
* never a turn behind.
|
|
156
|
+
*
|
|
157
|
+
* **This is what retired a whole section of `system-prompt.md`.** The prompt
|
|
158
|
+
* used to spend six lines insisting that ANY question about what the player is
|
|
159
|
+
* carrying, where they are or what they have scored be answered by calling
|
|
160
|
+
* `game_state_get` FIRST and never from memory — advice, enforced by nothing,
|
|
161
|
+
* costing a model round trip on the turns the narrator remembered and a drifting
|
|
162
|
+
* world on the turns it did not. State the model must not invent belongs in the
|
|
163
|
+
* prompt, not in a rule telling it to go and look.
|
|
164
|
+
*
|
|
165
|
+
* Prose rather than the JSON `game_state_get` answers with, because this is
|
|
166
|
+
* read as instructions rather than as a tool result — and built from
|
|
167
|
+
* {@link statusLine}, so the narrator, the CRT's top bar and the read tool
|
|
168
|
+
* cannot disagree about the four numbers. `game_state_get` stays for the rest of
|
|
169
|
+
* the board (the flags and the recent commands) and for the turn the narrator
|
|
170
|
+
* wants everything at once.
|
|
171
|
+
*/
|
|
172
|
+
export function statusBlock(game: FrozenGameState): string {
|
|
173
|
+
const { currentRoom, score, rank, moves } = statusLine(game);
|
|
174
|
+
const carrying = game.inventory.length > 0 ? game.inventory.join(", ") : "nothing";
|
|
175
|
+
return [
|
|
176
|
+
"CURRENT GAME STATE (the game's own record, refreshed before every reply —",
|
|
177
|
+
"it is ground truth and it is never out of date, so answer from it rather",
|
|
178
|
+
"than from memory, and never contradict it):",
|
|
179
|
+
`- Location: ${currentRoom}`,
|
|
180
|
+
`- Score: ${score} (${rank})`,
|
|
181
|
+
`- Turns taken: ${moves}`,
|
|
182
|
+
`- Carrying: ${carrying}`,
|
|
183
|
+
].join("\n");
|
|
184
|
+
}
|
|
185
|
+
|
|
149
186
|
/**
|
|
150
187
|
* The projection BOTH ends use: `syncState` on the agent, `useAgentState` in
|
|
151
188
|
* the client.
|
|
@@ -29,11 +29,18 @@ COMMAND INTERPRETATION:
|
|
|
29
29
|
- "what do I have" / "check my stuff" / "inventory" = inventory
|
|
30
30
|
- "where am I" / "look around" / "describe the room" = look
|
|
31
31
|
- "hit the troll" / "fight the troll" / "attack troll" = attack troll with pick
|
|
32
|
-
- "what's my score" =
|
|
32
|
+
- "what's my score" / "how am I doing" = answer from the CURRENT GAME STATE block, never game_state_score — that one AWARDS points
|
|
33
|
+
- "check the game state" / "full status" = game_state_get, which adds the game
|
|
34
|
+
flags and the last few commands to what you already have
|
|
33
35
|
- "start over" / "new game" / "restart" = restart
|
|
34
36
|
- Accept natural conversational commands and map them to game actions
|
|
37
|
+
- EARNING points is not a question and is never game_state_get. A treasure
|
|
38
|
+
carried back to the pedestal is game_state_score, which adds them; reach for
|
|
39
|
+
it whenever the player has just done something the score should move for
|
|
35
40
|
|
|
36
|
-
|
|
41
|
+
The CURRENT GAME STATE block at the end of these instructions is the game's own record, refreshed before every reply: where the player is, their score and rank, the turn count, and what they are carrying. It is never out of date. Answer from it, never say anything that contradicts it, and never spend a turn asking a tool for what it already tells you.
|
|
42
|
+
|
|
43
|
+
The tools are how you CHANGE the world: game_state_move to change rooms, game_state_take to pick up items, game_state_drop to drop items — it refuses an item the player is not carrying, and answers whether the scavenger made off with the one they dropped — game_state_score to add points, which answers with the new total and the player's rank, and game_state_flag to set game flags. Always call one when the player takes an item, moves rooms, or triggers an event. game_state_get is the one read left, and it is for the rest of the board — the game flags and the last few commands. You do not log commands or count moves — the game does that for you on every turn. When the player asks to restart, quit, or start a new game, call game_state_restart, then narrate the opening scene again.
|
|
37
44
|
|
|
38
45
|
ATMOSPHERE:
|
|
39
46
|
- Underground areas should feel dark and foreboding with the lantern lit, and terrifying in pitch blackness
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* eval driving it alone would measure an agent with no tools and the FRAMEWORK
|
|
32
32
|
* DEFAULT prompt — i.e. a desk that has never heard of a researcher, on which
|
|
33
33
|
* every claim below would pass or fail for the wrong reason. The reasoning is
|
|
34
|
-
* spelled out in `../code-interpreter/agent.eval.test.ts`.
|
|
34
|
+
* spelled out in `../code-interpreter-agent/agent.eval.test.ts`.
|
|
35
35
|
*/
|
|
36
36
|
import agentDef from "virtual:aai/agent";
|
|
37
37
|
import { countWords } from "@alexkroman1/aai/utils";
|
|
@@ -66,7 +66,7 @@ const DESK_TOOLS: readonly string[] = [
|
|
|
66
66
|
/**
|
|
67
67
|
* What `research_topic` answers with, as a schema rather than a cast.
|
|
68
68
|
*
|
|
69
|
-
* `toolResultIn` takes one for the reason `
|
|
69
|
+
* `toolResultIn` takes one for the reason `entertainment-picks-agent`'s spec records: a result
|
|
70
70
|
* that stopped carrying `findings` FAILS here naming the field, where a cast
|
|
71
71
|
* hands the assertions `undefined` and fails a line later on something
|
|
72
72
|
* unrelated.
|
|
@@ -86,11 +86,14 @@ const EmptyRecap = z.object({
|
|
|
86
86
|
|
|
87
87
|
/** What `verify_claim` answers with. */
|
|
88
88
|
// `verdict` is the parsed WORD now, so the eval can pin the enum rather than
|
|
89
|
-
// asserting a sentence is non-empty. `null` is the unaccepted case
|
|
89
|
+
// asserting a sentence is non-empty. `null` is the unaccepted case, and it
|
|
90
|
+
// arrives WITH `unusable` — the tool's own name for a checker that never
|
|
91
|
+
// returned its schema.
|
|
90
92
|
const Verdict = z.object({
|
|
91
93
|
claim: z.string(),
|
|
92
94
|
verdict: z.enum(["confirmed", "contradicted", "unclear"]).nullable(),
|
|
93
95
|
detail: z.string(),
|
|
96
|
+
unusable: z.string().optional(),
|
|
94
97
|
});
|
|
95
98
|
|
|
96
99
|
describeEval(agentDef, (test) => {
|
|
@@ -145,7 +148,7 @@ describeEval(agentDef, (test) => {
|
|
|
145
148
|
for (const finding of result.findings) expect(finding.summary.length).toBeGreaterThan(40);
|
|
146
149
|
|
|
147
150
|
// The isolation claim, and the reason this template is not
|
|
148
|
-
// `web-
|
|
151
|
+
// `web-research-agent`: the desk has NO web tools, so anything it says about
|
|
149
152
|
// the world crossed back out of a subagent. A `web_search` in this list
|
|
150
153
|
// would mean the builtins had leaked onto the parent.
|
|
151
154
|
expect(toolNames(turn.toolCalls).filter((name) => !DESK_TOOLS.includes(name))).toEqual([]);
|
|
@@ -174,9 +177,20 @@ describeEval(agentDef, (test) => {
|
|
|
174
177
|
expect(calls, describeTurn(turn)).toHaveLength(1);
|
|
175
178
|
const verdict = toolResultIn(turn.toolCalls, "verify_claim", Verdict);
|
|
176
179
|
expect(countWords(verdict.claim)).toBeGreaterThan(3);
|
|
177
|
-
// A word the desk can act on, not a sentence it must read one out of
|
|
178
|
-
|
|
179
|
-
|
|
180
|
+
// A word the desk can act on, not a sentence it must read one out of —
|
|
181
|
+
// or the honest unresolved path, which is the SAME contract seen from the
|
|
182
|
+
// other side. `factChecker` is a cheap model on `maxSteps: 2`, so a run
|
|
183
|
+
// that spends both steps searching returns no schema and the tool reports
|
|
184
|
+
// `unusable` rather than a verdict — which its own body argues is "not a
|
|
185
|
+
// failure". Demanding a verdict every time made this case a coin toss on
|
|
186
|
+
// that budget instead of a reading of whether the desk CHECKED rather
|
|
187
|
+
// than defended, which is what its name claims and what the `toHaveLength`
|
|
188
|
+
// above actually measures.
|
|
189
|
+
if (verdict.verdict === null) {
|
|
190
|
+
expect(verdict.unusable, describeTurn(turn)).toBeDefined();
|
|
191
|
+
} else {
|
|
192
|
+
expect(countWords(verdict.detail)).toBeGreaterThan(2);
|
|
193
|
+
}
|
|
180
194
|
expect(toolNames(turn.toolCalls).filter((name) => !DESK_TOOLS.includes(name))).toEqual([]);
|
|
181
195
|
},
|
|
182
196
|
{ live: true },
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
type StubDelegateCall,
|
|
6
6
|
scriptedToolContext,
|
|
7
7
|
stubDelegate,
|
|
8
|
+
toolOf,
|
|
8
9
|
toolRunner,
|
|
9
10
|
} from "@alexkroman1/aai/testing";
|
|
10
11
|
import { installStubStepFetch } from "@alexkroman1/aai/testing/vitest";
|
|
@@ -88,12 +89,12 @@ describe("the desk itself", () => {
|
|
|
88
89
|
expect(factChecker.maxSteps).toBeLessThan(MAX_RESEARCH_STEPS);
|
|
89
90
|
});
|
|
90
91
|
|
|
91
|
-
test("runs the three NARROW
|
|
92
|
+
test("runs the three NARROW subagents somewhere cheaper, and the researcher on the default", () => {
|
|
92
93
|
// The other half of the budget split, and the reason `CHEAP_MODEL` is one
|
|
93
|
-
// constant: three
|
|
94
|
+
// constant: three subagents that were each meant to be cheap, one of
|
|
94
95
|
// which quietly is not, is a bill nobody can read.
|
|
95
|
-
for (const
|
|
96
|
-
expect(
|
|
96
|
+
for (const one of [factChecker, explainer, counterpoint]) {
|
|
97
|
+
expect(one.llm, one.name).toMatchObject({ options: { model: CHEAP_MODEL } });
|
|
97
98
|
}
|
|
98
99
|
// The researcher reads whole pages and stays on the agent's own model.
|
|
99
100
|
expect(researcher.llm).toBeUndefined();
|
|
@@ -104,25 +105,25 @@ describe("the desk itself", () => {
|
|
|
104
105
|
// rather than a paragraph somebody remembered to write: the desk reads the
|
|
105
106
|
// final message and nothing else. A subagent added here without one is the
|
|
106
107
|
// regression this catches.
|
|
107
|
-
for (const
|
|
108
|
-
expect(
|
|
108
|
+
for (const one of [researcher, factChecker, explainer, counterpoint]) {
|
|
109
|
+
expect(one.expectedOutput, one.name).toBeTruthy();
|
|
109
110
|
}
|
|
110
111
|
expect(researcher.expectedOutput).toMatch(/only this/);
|
|
111
112
|
});
|
|
112
113
|
|
|
113
|
-
test("puts on the roster exactly the
|
|
114
|
+
test("puts on the roster exactly the subagents chosen by what the caller ASKED", () => {
|
|
114
115
|
// The two tools name their own subagent, so those two must NOT be on the
|
|
115
|
-
// roster: a
|
|
116
|
+
// roster: a subagent reachable both ways gives the model a second, worse
|
|
116
117
|
// route to a tool that does real work around the delegation.
|
|
117
118
|
expect(authoredAgent.subagents?.map((one) => one.name)).toEqual(["explainer", "counterpoint"]);
|
|
118
|
-
for (const
|
|
119
|
+
for (const one of authoredAgent.subagents ?? []) {
|
|
119
120
|
// The only thing the router reads. `agent()` refuses a roster without it;
|
|
120
121
|
// asserted here too because the template is what an author copies.
|
|
121
|
-
expect(
|
|
122
|
+
expect(one.description, one.name).toBeTruthy();
|
|
122
123
|
}
|
|
123
124
|
});
|
|
124
125
|
|
|
125
|
-
test("publishes the roster as one delegate tool listing both
|
|
126
|
+
test("publishes the roster as one delegate tool listing both subagents", () => {
|
|
126
127
|
const delegate = deployed.tools[DELEGATE_TOOL_NAME];
|
|
127
128
|
expect(delegate).toBeDefined();
|
|
128
129
|
expect(delegate?.description).toContain("explainer:");
|
|
@@ -622,6 +623,17 @@ describe("send_briefing", () => {
|
|
|
622
623
|
expect(posted.calls).toEqual([]);
|
|
623
624
|
});
|
|
624
625
|
|
|
626
|
+
test("declares onError, so a missing webhook is FATAL rather than something to retry", () => {
|
|
627
|
+
// Without it the runtime hands every throw to the model as this call's
|
|
628
|
+
// result, and the desk re-calls `send_briefing` against a variable that is
|
|
629
|
+
// still unset — burning the reply's step budget on a deploy fault. The
|
|
630
|
+
// handler re-throws, which is how a tool says "stop, this cannot work".
|
|
631
|
+
const sender = toolOf(deployed, "send_briefing");
|
|
632
|
+
expect(sender.onError).toBeDefined();
|
|
633
|
+
const cause = new Error(`Missing required environment variable: ${DESTINATION_ENV}`);
|
|
634
|
+
expect(() => sender.onError?.(cause, createToolContext())).toThrow(cause);
|
|
635
|
+
});
|
|
636
|
+
|
|
625
637
|
test("refuses a configured destination that is not Slack, without posting", async () => {
|
|
626
638
|
const posted = installStubStepFetch(() => ({ body: "ok" }));
|
|
627
639
|
const ctx = deskWithBoard({ [DESTINATION_ENV]: "https://example.test/collect" });
|
|
@@ -26,15 +26,18 @@ import { roster } from "./shared.ts";
|
|
|
26
26
|
* is for the case where the choice is the caller's — "what does curtailment
|
|
27
27
|
* mean" wants the explainer and "who says otherwise" wants the counterpoint,
|
|
28
28
|
* and nothing but the question tells them apart. It reaches the model as one
|
|
29
|
-
* `delegate` tool listing both, so a third
|
|
29
|
+
* `delegate` tool listing both, so a third subagent is a line here rather
|
|
30
30
|
* than a fourth file in `tools/` whose body is one `ctx.delegate` call.
|
|
31
31
|
*
|
|
32
|
-
* Compare `web-
|
|
32
|
+
* Compare `web-research-agent`, which gives the search builtins to the agent
|
|
33
33
|
* itself: that is the right shape for one lookup, and the wrong one the moment
|
|
34
34
|
* a question has four sides.
|
|
35
35
|
*/
|
|
36
36
|
export default agent({
|
|
37
37
|
name: "Briefing Desk",
|
|
38
|
+
// The listing line — a registry row, the studio's picker. "At once" is the
|
|
39
|
+
// part worth a reader's attention: it is what the subagents below buy.
|
|
40
|
+
description: "Researches a subject from several angles at once and reads back what was found",
|
|
38
41
|
greeting:
|
|
39
42
|
"Briefing desk. Tell me a subject and I'll put a few researchers on it — " +
|
|
40
43
|
"try something like, what's going on with home battery prices.",
|