@alexkroman1/aai-cli 0.16.0 → 0.18.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/dist/{_agent-BopNO5Bq.mjs → _agent-BN21AHsJ.mjs} +4 -4
- package/dist/_api-client-Uljj0CQi.mjs +312 -0
- package/dist/_api-client.d.ts +69 -1
- package/dist/{_bundler-DCuNHjDF.mjs → _bundler-DvZDEu2p.mjs} +67 -7
- package/dist/_bundler.d.ts +15 -0
- package/dist/_cli-common.d.ts +42 -0
- package/dist/{client-bundler-DE-AGdm7.mjs → _client-plugins-kR43nZnb.mjs} +30 -132
- package/dist/_client-plugins.d.ts +16 -0
- package/dist/{_config-mq1I5Cva.mjs → _config-Dlh8PRRp.mjs} +2 -20
- package/dist/_config.d.ts +0 -8
- package/dist/{_dev-server-B4ZiXbZj.mjs → _dev-server-C_zidzWj.mjs} +17 -12
- package/dist/_dev-session-ticket.d.ts +3 -0
- package/dist/_dev-tunnel.d.ts +20 -2
- package/dist/_dotenv-file.d.ts +6 -0
- package/dist/_init.d.ts +2 -11
- package/dist/_output.d.ts +47 -20
- package/dist/_safe-write.d.ts +38 -0
- package/dist/{_server-common-CVXIeWrY.mjs → _server-common-C6j67AcZ.mjs} +37 -2
- package/dist/_server-common.d.ts +16 -0
- package/dist/{_slug-api-BnmTHtjd.mjs → _slug-api-B9cptz7Q.mjs} +3 -2
- package/dist/_start-affinity.d.ts +70 -0
- package/dist/_start-log.d.ts +39 -0
- package/dist/_start-router.d.ts +85 -0
- package/dist/_start-run.d.ts +101 -0
- package/dist/_start-worker.d.ts +61 -0
- package/dist/_start-workers-BNdOnTal.mjs +529 -0
- package/dist/_start-workers.d.ts +262 -0
- package/dist/_studio-zympBLlD.mjs +140 -0
- package/dist/_studio.d.ts +14 -0
- package/dist/_target-bundle.d.ts +4 -0
- package/dist/{_templates-BVMVsQh0.mjs → _templates-ChZuhW66.mjs} +110 -8
- package/dist/_templates.d.ts +20 -1
- package/dist/{_typecheck-gate-CcX2gLJZ.mjs → _typecheck-gate-BNF5cboL.mjs} +2 -2
- package/dist/_ui-C0RufoYZ.mjs +147 -0
- package/dist/_ui.d.ts +14 -3
- package/dist/_utils-ChU85MEg.mjs +486 -0
- package/dist/_utils.d.ts +28 -0
- package/dist/_vendor-openers.d.ts +87 -0
- package/dist/{_vitest-runner-CKI8_K1b.mjs → _vitest-runner-tzyto9IU.mjs} +7 -3
- package/dist/_vitest-runner.d.ts +8 -1
- package/dist/{build-BnXLgfk-.mjs → build-BHgd-QYb.mjs} +13 -10
- package/dist/build.d.ts +21 -0
- package/dist/cli-workflow.d.ts +7 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.mjs +243 -70
- package/dist/client-bundler-CImhqcp2.mjs +133 -0
- package/dist/client-bundler.mjs +1 -1
- package/dist/{console-Bp1kSqz_.mjs → console-DwycgRkC.mjs} +4 -5
- package/dist/delete-ZcA3J_3o.mjs +75 -0
- package/dist/delete.d.ts +10 -1
- package/dist/{deploy-eWDoiwvn.mjs → deploy-CkfkiZE3.mjs} +9 -9
- package/dist/{dev-CxZsZsOL.mjs → dev-BX9g6qcf.mjs} +81 -18
- package/dist/{eval-Dl8o91yC.mjs → eval-CUKvfxRq.mjs} +4 -4
- package/dist/{init-CidslZZz.mjs → init-B9Uw76-_.mjs} +62 -32
- package/dist/{login-oJdBWu2B.mjs → login-Ct73CqU1.mjs} +30 -6
- package/dist/login.d.ts +2 -0
- package/dist/{logs-CkmFdSbr.mjs → logs-BBsUy96d.mjs} +59 -14
- package/dist/logs.d.ts +4 -1
- package/dist/project-config.mjs +1 -1
- package/dist/scaffold/CLAUDE.md +72 -55
- package/dist/scaffold/agent-guide/AGENT-API.md +46 -33
- package/dist/scaffold/agent-guide/HOSTING.md +11 -0
- package/dist/scaffold/agent-guide/TESTING-EVALS.md +105 -36
- package/dist/scaffold/agent-guide/TOOLS.md +189 -33
- package/dist/scaffold/agent-guide/UI.md +111 -39
- package/dist/scaffold/agent-guide/WORKFLOWS.md +234 -160
- package/dist/scaffold/package.json +4 -4
- package/dist/{secret-DPdPEet2.mjs → secret-CKjHRrVX.mjs} +112 -35
- package/dist/start.d.ts +14 -14
- package/dist/start.mjs +840 -40
- package/dist/{studio-COjK25Rl.mjs → studio-U6DvBNAx.mjs} +123 -35
- package/dist/studio.d.ts +1 -0
- package/dist/templates/applicant-screening-agent/agent.eval.test.ts +23 -52
- package/dist/templates/applicant-screening-agent/agent.test.ts +821 -826
- package/dist/templates/applicant-screening-agent/agent.ts +1 -6
- package/dist/templates/applicant-screening-agent/client.tsx +1 -19
- package/dist/templates/applicant-screening-agent/shared.ts +8 -18
- package/dist/templates/applicant-screening-agent/tools/candidate_details.ts +24 -27
- package/dist/templates/applicant-screening-agent/tools/proceed_to_emails.ts +75 -82
- package/dist/templates/applicant-screening-agent/tools/read_email.ts +24 -24
- package/dist/templates/applicant-screening-agent/tools/rescore_with_feedback.ts +92 -99
- package/dist/templates/applicant-screening-agent/tools/screen_candidates.ts +72 -83
- package/dist/templates/applicant-screening-agent/tools/screening_status.ts +21 -29
- package/dist/templates/call-audit-workflow/agent.eval.test.ts +14 -19
- package/dist/templates/call-audit-workflow/agent.test.ts +275 -169
- package/dist/templates/call-audit-workflow/agent.ts +12 -30
- package/dist/templates/call-audit-workflow/client.tsx +9 -27
- package/dist/templates/call-audit-workflow/guards.test.ts +24 -71
- package/dist/templates/call-audit-workflow/workflows/audit.ts +24 -52
- package/dist/templates/call-audit-workflow/workflows/ingest.ts +32 -59
- package/dist/templates/call-audit-workflow/workflows/media.ts +4 -44
- package/dist/templates/call-audit-workflow/workflows/summarize.ts +72 -107
- package/dist/templates/code-interpreter-agent/agent.eval.test.ts +3 -2
- package/dist/templates/code-interpreter-agent/agent.test.ts +4 -17
- package/dist/templates/code-interpreter-agent/agent.ts +1 -1
- package/dist/templates/coding-agent/agent.test.ts +17 -12
- package/dist/templates/coding-agent/agent.ts +1 -1
- package/dist/templates/custom-pipeline-agent/agent.test.ts +6 -14
- package/dist/templates/custom-pipeline-agent/agent.ts +1 -1
- package/dist/templates/custom-pipeline-agent/modes.test.ts +0 -1
- package/dist/templates/custom-pipeline-agent/stages.test.ts +4 -8
- package/dist/templates/document-redline-workflow/agent.test.ts +88 -221
- package/dist/templates/document-redline-workflow/agent.ts +22 -32
- package/dist/templates/document-redline-workflow/client.tsx +46 -88
- package/dist/templates/document-redline-workflow/workflows/prompts.ts +0 -3
- package/dist/templates/document-redline-workflow/workflows/redline.ts +33 -50
- package/dist/templates/emergency-dispatch-agent/agent.eval.test.ts +22 -71
- package/dist/templates/emergency-dispatch-agent/agent.test.ts +466 -495
- package/dist/templates/emergency-dispatch-agent/agent.ts +27 -43
- package/dist/templates/emergency-dispatch-agent/client.tsx +85 -119
- package/dist/templates/emergency-dispatch-agent/shared.ts +51 -88
- package/dist/templates/emergency-dispatch-agent/tools/incident_add_note.ts +11 -17
- package/dist/templates/emergency-dispatch-agent/tools/incident_create.ts +21 -30
- package/dist/templates/emergency-dispatch-agent/tools/incident_escalate.ts +60 -63
- package/dist/templates/emergency-dispatch-agent/tools/incident_get.ts +6 -15
- package/dist/templates/emergency-dispatch-agent/tools/incident_triage.ts +40 -53
- package/dist/templates/emergency-dispatch-agent/tools/incident_update_status.ts +41 -47
- package/dist/templates/emergency-dispatch-agent/tools/ops_dashboard.ts +2 -2
- package/dist/templates/emergency-dispatch-agent/tools/ops_protocols.ts +1 -1
- package/dist/templates/emergency-dispatch-agent/tools/ops_run_scenario.ts +13 -10
- package/dist/templates/emergency-dispatch-agent/tools/resources_dispatch.ts +42 -51
- package/dist/templates/emergency-dispatch-agent/tools/resources_update_status.ts +40 -41
- package/dist/templates/entertainment-picks-agent/agent.eval.test.ts +14 -42
- package/dist/templates/entertainment-picks-agent/agent.test.ts +174 -221
- package/dist/templates/entertainment-picks-agent/agent.ts +1 -6
- package/dist/templates/entertainment-picks-agent/client.tsx +1 -12
- package/dist/templates/entertainment-picks-agent/shared.ts +12 -6
- package/dist/templates/entertainment-picks-agent/tools/recommend.ts +2 -2
- package/dist/templates/entertainment-picks-agent/tools/revisit.ts +1 -0
- package/dist/templates/executive-inbox-agent/agent.eval.test.ts +15 -22
- package/dist/templates/executive-inbox-agent/agent.test.ts +515 -527
- package/dist/templates/executive-inbox-agent/agent.ts +4 -8
- package/dist/templates/executive-inbox-agent/calendar.test.ts +23 -22
- package/dist/templates/executive-inbox-agent/client.tsx +1 -23
- package/dist/templates/executive-inbox-agent/review.ts +125 -113
- package/dist/templates/executive-inbox-agent/shared.ts +3 -0
- package/dist/templates/executive-inbox-agent/tools/ask_question.ts +6 -6
- package/dist/templates/executive-inbox-agent/tools/draft_reply.ts +16 -18
- package/dist/templates/executive-inbox-agent/tools/inbox_status.ts +1 -0
- package/dist/templates/executive-inbox-agent/tools/meeting_assistant.ts +20 -20
- package/dist/templates/executive-inbox-agent/tools/new_email.ts +17 -21
- package/dist/templates/executive-inbox-agent/tools/open_email.ts +72 -74
- package/dist/templates/executive-inbox-agent/tools/review_memory.ts +1 -0
- package/dist/templates/executive-inbox-agent/tools/send_calendar_invite.ts +19 -20
- package/dist/templates/executive-inbox-agent/tools/triage_inbox.ts +53 -50
- package/dist/templates/front-desk-agent/agent.eval.test.ts +22 -14
- package/dist/templates/front-desk-agent/agent.test.ts +139 -125
- package/dist/templates/front-desk-agent/agent.ts +4 -7
- package/dist/templates/front-desk-agent/shared.ts +88 -74
- package/dist/templates/front-door-agent/agent.eval.test.ts +61 -0
- package/dist/templates/front-door-agent/agent.test.ts +393 -0
- package/dist/templates/front-door-agent/agent.ts +35 -0
- package/dist/templates/front-door-agent/client.tsx +250 -0
- package/dist/templates/front-door-agent/routes.ts +91 -0
- package/dist/templates/front-door-agent/shared.ts +35 -0
- package/dist/templates/front-door-agent/system-prompt.md +12 -0
- package/dist/templates/front-door-agent/tools/leave_message.ts +39 -0
- package/dist/templates/front-door-agent/tools/link_phone.ts +49 -0
- package/dist/templates/front-door-agent/workflows/announce.ts +38 -0
- package/dist/templates/front-door-agent/workflows/digest.ts +53 -0
- package/dist/templates/front-door-agent/workflows/pair.ts +28 -0
- package/dist/templates/home-assistant-agent/agent.eval.test.ts +5 -9
- package/dist/templates/home-assistant-agent/agent.test.ts +513 -399
- package/dist/templates/home-assistant-agent/agent.ts +8 -5
- package/dist/templates/home-assistant-agent/client.tsx +50 -18
- package/dist/templates/home-assistant-agent/tools/cancel_reminders.ts +1 -0
- package/dist/templates/home-assistant-agent/tools/remind_me.ts +2 -1
- package/dist/templates/hotel-reception-agent/agent.eval.test.ts +27 -52
- package/dist/templates/hotel-reception-agent/agent.test.ts +980 -964
- package/dist/templates/hotel-reception-agent/agent.ts +8 -21
- package/dist/templates/hotel-reception-agent/booking.ts +2 -2
- package/dist/templates/hotel-reception-agent/client.tsx +5 -20
- package/dist/templates/hotel-reception-agent/concierge.ts +2 -0
- package/dist/templates/hotel-reception-agent/desk-seams.test.ts +285 -275
- package/dist/templates/hotel-reception-agent/desk.ts +45 -12
- package/dist/templates/hotel-reception-agent/hotel.ts +6 -6
- package/dist/templates/hotel-reception-agent/restaurant.ts +3 -4
- package/dist/templates/hotel-reception-agent/session.ts +14 -30
- package/dist/templates/hotel-reception-agent/shared.ts +33 -46
- package/dist/templates/hotel-reception-agent/tools/abandon_booking.ts +14 -15
- package/dist/templates/hotel-reception-agent/tools/add_to_waitlist.ts +1 -0
- package/dist/templates/hotel-reception-agent/tools/book_airport_car.ts +1 -0
- package/dist/templates/hotel-reception-agent/tools/cancel_restaurant_reservation.ts +2 -2
- package/dist/templates/hotel-reception-agent/tools/cancel_room_booking.ts +13 -10
- package/dist/templates/hotel-reception-agent/tools/choose_room.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/confirm_booking.ts +6 -7
- package/dist/templates/hotel-reception-agent/tools/dispatch_emergency.ts +1 -0
- package/dist/templates/hotel-reception-agent/tools/dispute_charge.ts +5 -4
- package/dist/templates/hotel-reception-agent/tools/flag_late_arrival.ts +6 -5
- package/dist/templates/hotel-reception-agent/tools/lookup_booking.ts +3 -4
- package/dist/templates/hotel-reception-agent/tools/lookup_invoice.ts +4 -4
- package/dist/templates/hotel-reception-agent/tools/modify_restaurant_reservation.ts +1 -0
- package/dist/templates/hotel-reception-agent/tools/record_card.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/record_followup.ts +1 -0
- package/dist/templates/hotel-reception-agent/tools/record_group_inquiry.ts +1 -0
- package/dist/templates/hotel-reception-agent/tools/record_guest_details.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/reinstate_booking.ts +1 -0
- package/dist/templates/hotel-reception-agent/tools/request_flight_reconfirmation.ts +1 -0
- package/dist/templates/hotel-reception-agent/tools/resend_confirmation.ts +4 -4
- package/dist/templates/hotel-reception-agent/tools/reserve_table.ts +1 -0
- package/dist/templates/hotel-reception-agent/tools/resolve_room_conflict.ts +4 -3
- package/dist/templates/hotel-reception-agent/tools/schedule_wakeup_call.ts +1 -0
- package/dist/templates/hotel-reception-agent/tools/set_do_not_disturb.ts +1 -0
- package/dist/templates/hotel-reception-agent/tools/set_extras.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/set_stay.ts +1 -1
- package/dist/templates/hotel-reception-agent/tools/start_booking_modification.ts +30 -32
- package/dist/templates/hotel-reception-agent/tools/start_room_booking.ts +22 -25
- package/dist/templates/hotel-reception-agent/tools/take_guest_message.ts +1 -0
- package/dist/templates/hotel-reception-agent/tools/update_card.ts +5 -4
- package/dist/templates/hotel-reception-agent/tools/verify_booking.ts +23 -13
- package/dist/templates/kitchen-coach-agent/agent.eval.test.ts +38 -0
- package/dist/templates/kitchen-coach-agent/agent.test.ts +204 -0
- package/dist/templates/kitchen-coach-agent/agent.ts +22 -0
- package/dist/templates/kitchen-coach-agent/client.tsx +232 -0
- package/dist/templates/kitchen-coach-agent/history.ts +37 -0
- package/dist/templates/kitchen-coach-agent/shared.ts +131 -0
- package/dist/templates/kitchen-coach-agent/system-prompt.md +17 -0
- package/dist/templates/kitchen-coach-agent/tools/get_kitchen.ts +17 -0
- package/dist/templates/kitchen-coach-agent/tools/scale_amount.ts +31 -0
- package/dist/templates/kitchen-coach-agent/tools/start_timer.ts +24 -0
- package/dist/templates/link-digest-workflow/agent.eval.test.ts +16 -40
- package/dist/templates/link-digest-workflow/agent.test.ts +84 -164
- package/dist/templates/link-digest-workflow/agent.ts +27 -42
- package/dist/templates/link-digest-workflow/api-client.ts +3 -2
- package/dist/templates/link-digest-workflow/client.tsx +5 -5
- package/dist/templates/link-digest-workflow/workflows/digest.ts +53 -95
- package/dist/templates/medication-safety-agent/agent.eval.test.ts +10 -30
- package/dist/templates/medication-safety-agent/agent.test.ts +16 -46
- package/dist/templates/medication-safety-agent/agent.ts +1 -4
- package/dist/templates/medication-safety-agent/tools/check_drug_interaction.ts +13 -10
- package/dist/templates/meeting-recap-agent/agent.eval.test.ts +238 -396
- package/dist/templates/meeting-recap-agent/agent.test.ts +414 -1073
- package/dist/templates/meeting-recap-agent/agent.ts +26 -67
- package/dist/templates/meeting-recap-agent/system-prompt.md +1 -0
- package/dist/templates/meeting-recap-agent/tools/keep_transcript.ts +10 -12
- package/dist/templates/meeting-recap-agent/tools/request_recap.ts +9 -20
- package/dist/templates/meeting-recap-agent/workflows/recap.ts +224 -547
- package/dist/templates/outbound-call-agent/agent.eval.test.ts +10 -12
- package/dist/templates/outbound-call-agent/agent.test.ts +419 -453
- package/dist/templates/outbound-call-agent/agent.ts +57 -62
- package/dist/templates/outbound-call-agent/api.ts +53 -68
- package/dist/templates/outbound-call-agent/client.tsx +105 -176
- package/dist/templates/outbound-call-agent/shared.ts +10 -39
- package/dist/templates/outbound-call-agent/system-prompt.md +3 -4
- package/dist/templates/outbound-call-agent/tools/end_call.ts +15 -12
- package/dist/templates/outbound-call-agent/tools/press_keys.ts +8 -13
- package/dist/templates/outbound-call-agent/workflows/call.ts +94 -63
- package/dist/templates/pizza-ordering-agent/agent.eval.test.ts +18 -54
- package/dist/templates/pizza-ordering-agent/agent.test.ts +205 -244
- package/dist/templates/pizza-ordering-agent/agent.ts +5 -12
- package/dist/templates/pizza-ordering-agent/client.tsx +3 -14
- package/dist/templates/pizza-ordering-agent/shared.ts +31 -36
- package/dist/templates/pizza-ordering-agent/tools/add_pizza.ts +1 -0
- package/dist/templates/pizza-ordering-agent/tools/place_order.ts +5 -2
- package/dist/templates/pizza-ordering-agent/tools/remove_pizza.ts +1 -0
- package/dist/templates/pizza-ordering-agent/tools/update_pizza.ts +2 -3
- package/dist/templates/pizza-ordering-agent/tools/view_order.ts +7 -3
- package/dist/templates/podcast-digest-workflow/agent.test.ts +53 -102
- package/dist/templates/podcast-digest-workflow/agent.ts +11 -17
- package/dist/templates/podcast-digest-workflow/client.tsx +29 -51
- package/dist/templates/podcast-digest-workflow/workflows/digest.ts +24 -26
- package/dist/templates/push-to-talk-agent/agent.eval.test.ts +13 -14
- package/dist/templates/push-to-talk-agent/agent.test.ts +30 -23
- package/dist/templates/push-to-talk-agent/agent.ts +1 -5
- package/dist/templates/push-to-talk-agent/client.tsx +1 -11
- package/dist/templates/push-to-talk-agent/shared.ts +12 -6
- package/dist/templates/push-to-talk-agent/tools/list_notes.ts +1 -0
- package/dist/templates/push-to-talk-agent/tools/save_note.ts +1 -0
- package/dist/templates/quickstart-agent/agent.eval.test.ts +0 -10
- package/dist/templates/quickstart-agent/agent.test.ts +18 -30
- package/dist/templates/quickstart-agent/agent.ts +3 -4
- package/dist/templates/research-handoff-agent/agent.eval.test.ts +161 -290
- package/dist/templates/research-handoff-agent/agent.test.ts +133 -471
- package/dist/templates/research-handoff-agent/agent.ts +26 -86
- package/dist/templates/research-handoff-agent/system-prompt.md +1 -0
- package/dist/templates/research-handoff-agent/tools/file_it_now.ts +8 -21
- package/dist/templates/research-handoff-agent/tools/request_research.ts +7 -16
- package/dist/templates/research-handoff-agent/workflows/research.ts +88 -40
- package/dist/templates/research-planner-agent/agent.eval.test.ts +15 -40
- package/dist/templates/research-planner-agent/agent.test.ts +415 -464
- package/dist/templates/research-planner-agent/agent.ts +3 -8
- package/dist/templates/research-planner-agent/client.tsx +1 -14
- package/dist/templates/research-planner-agent/procedure.ts +9 -3
- package/dist/templates/research-planner-agent/shared.ts +30 -33
- package/dist/templates/research-planner-agent/tools/plan_status.ts +7 -15
- package/dist/templates/research-planner-agent/tools/revise_plan.ts +29 -36
- package/dist/templates/research-planner-agent/tools/start_plan.ts +25 -39
- package/dist/templates/research-planner-agent/tools/work_next_step.ts +25 -42
- package/dist/templates/retail-orders-agent/agent.eval.test.ts +14 -34
- package/dist/templates/retail-orders-agent/agent.test.ts +1079 -1073
- package/dist/templates/retail-orders-agent/agent.ts +25 -78
- package/dist/templates/retail-orders-agent/client.tsx +120 -168
- package/dist/templates/retail-orders-agent/pending.test.ts +7 -14
- package/dist/templates/retail-orders-agent/registry.test.ts +93 -192
- package/dist/templates/retail-orders-agent/shared.test.ts +1 -1
- package/dist/templates/retail-orders-agent/shared.ts +10 -20
- package/dist/templates/retail-orders-agent/store.test.ts +46 -128
- package/dist/templates/retail-orders-agent/store.ts +42 -175
- package/dist/templates/retail-orders-agent/tools/cancel_change.ts +3 -6
- package/dist/templates/retail-orders-agent/tools/cancel_pending_order.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/confirm_change.ts +4 -6
- package/dist/templates/retail-orders-agent/tools/exchange_delivered_order_items.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/find_user_id_by_email.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/find_user_id_by_name_zip.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/get_item_details.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/get_order_details.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/get_product_details.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/get_user_details.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/list_all_product_types.ts +3 -8
- package/dist/templates/retail-orders-agent/tools/modify_pending_order_address.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/modify_pending_order_items.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/modify_pending_order_payment.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/modify_user_address.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/return_delivered_order_items.ts +3 -4
- package/dist/templates/retail-orders-agent/tools/transfer_to_human_agents.ts +3 -4
- package/dist/templates/roadside-assistance-agent/agent.eval.test.ts +22 -25
- package/dist/templates/roadside-assistance-agent/agent.test.ts +453 -490
- package/dist/templates/roadside-assistance-agent/agent.ts +28 -60
- package/dist/templates/roadside-assistance-agent/call.ts +16 -22
- package/dist/templates/roadside-assistance-agent/shared.ts +24 -54
- package/dist/templates/roadside-assistance-agent/tools/acknowledge_disclosure.ts +29 -37
- package/dist/templates/roadside-assistance-agent/tools/dispatch_truck.ts +44 -70
- package/dist/templates/roadside-assistance-agent/tools/job_status.ts +16 -24
- package/dist/templates/roadside-assistance-agent/tools/lookup_coverage.ts +39 -51
- package/dist/templates/roadside-assistance-agent/tools/report_location.ts +34 -33
- package/dist/templates/roadside-assistance-agent/tools/service_disclosure.ts +18 -39
- package/dist/templates/roadside-assistance-agent/yard.test.ts +22 -19
- package/dist/templates/roadside-assistance-agent/yard.ts +3 -3
- package/dist/templates/spoken-summary-workflow/agent.eval.test.ts +38 -40
- package/dist/templates/spoken-summary-workflow/agent.test.ts +129 -279
- package/dist/templates/spoken-summary-workflow/agent.ts +15 -40
- package/dist/templates/spoken-summary-workflow/client.tsx +13 -25
- package/dist/templates/spoken-summary-workflow/workflows/summarize.ts +52 -92
- package/dist/templates/tabletop-rpg-agent/agent.eval.test.ts +31 -74
- package/dist/templates/tabletop-rpg-agent/agent.test.ts +756 -774
- package/dist/templates/tabletop-rpg-agent/agent.ts +9 -46
- package/dist/templates/tabletop-rpg-agent/client.tsx +13 -21
- package/dist/templates/tabletop-rpg-agent/shared.ts +40 -99
- package/dist/templates/tabletop-rpg-agent/tools/action_roll.ts +67 -83
- package/dist/templates/tabletop-rpg-agent/tools/burn_momentum.ts +65 -88
- package/dist/templates/tabletop-rpg-agent/tools/check_state.ts +8 -27
- package/dist/templates/tabletop-rpg-agent/tools/setup_character.ts +18 -36
- package/dist/templates/tabletop-rpg-agent/tools/update_state.ts +101 -111
- package/dist/templates/technical-support-agent/agent.eval.test.ts +31 -72
- package/dist/templates/technical-support-agent/agent.test.ts +231 -260
- package/dist/templates/technical-support-agent/agent.ts +4 -10
- package/dist/templates/technical-support-agent/client.tsx +4 -18
- package/dist/templates/technical-support-agent/shared.ts +15 -25
- package/dist/templates/technical-support-agent/tools/answer_question.ts +46 -56
- package/dist/templates/technical-support-agent/tools/list_topics.ts +1 -0
- package/dist/templates/technical-support-agent/tools/log_ticket.ts +8 -5
- package/dist/templates/text-adventure-agent/agent.eval.test.ts +37 -126
- package/dist/templates/text-adventure-agent/agent.test.ts +197 -368
- package/dist/templates/text-adventure-agent/agent.ts +15 -65
- package/dist/templates/text-adventure-agent/client.tsx +38 -98
- package/dist/templates/text-adventure-agent/shared.ts +31 -143
- package/dist/templates/text-adventure-agent/tools/game_state_drop.ts +6 -12
- package/dist/templates/text-adventure-agent/tools/game_state_get.ts +4 -11
- package/dist/templates/text-adventure-agent/tools/game_state_move.ts +0 -2
- package/dist/templates/text-adventure-agent/tools/game_state_restart.ts +1 -3
- package/dist/templates/text-adventure-agent/tools/game_state_score.ts +5 -7
- package/dist/templates/topic-briefing-agent/agent.eval.test.ts +12 -50
- package/dist/templates/topic-briefing-agent/agent.test.ts +478 -476
- package/dist/templates/topic-briefing-agent/agent.ts +3 -3
- package/dist/templates/topic-briefing-agent/shared.ts +11 -16
- package/dist/templates/topic-briefing-agent/slack.ts +12 -4
- package/dist/templates/topic-briefing-agent/tools/briefing_so_far.ts +10 -17
- package/dist/templates/topic-briefing-agent/tools/research_topic.ts +21 -24
- package/dist/templates/topic-briefing-agent/tools/send_briefing.ts +13 -14
- package/dist/templates/topic-briefing-agent/tools/verify_claim.ts +16 -13
- package/dist/templates/transcription-workflow/agent.test.ts +114 -259
- package/dist/templates/transcription-workflow/agent.ts +6 -9
- package/dist/templates/transcription-workflow/client.tsx +100 -258
- package/dist/templates/transcription-workflow/recover.test.ts +6 -136
- package/dist/templates/transcription-workflow/recover.ts +14 -97
- package/dist/templates/transcription-workflow/run-panel.tsx +71 -8
- package/dist/templates/transcription-workflow/workflows/batch.ts +28 -159
- package/dist/templates/transcription-workflow/workflows/normalize.ts +50 -86
- package/dist/templates/transcription-workflow/workflows/stream.ts +2 -2
- package/dist/templates/transcription-workflow/workflows/transcribe.ts +16 -23
- package/dist/templates/travel-concierge-agent/agent.eval.test.ts +7 -25
- package/dist/templates/travel-concierge-agent/agent.test.ts +505 -517
- package/dist/templates/travel-concierge-agent/agent.ts +22 -46
- package/dist/templates/travel-concierge-agent/client.tsx +1 -22
- package/dist/templates/travel-concierge-agent/routing.ts +29 -31
- package/dist/templates/travel-concierge-agent/shared.ts +63 -152
- package/dist/templates/travel-concierge-agent/tools/book_car_rental.ts +8 -9
- package/dist/templates/travel-concierge-agent/tools/book_excursion.ts +8 -8
- package/dist/templates/travel-concierge-agent/tools/book_hotel.ts +9 -6
- package/dist/templates/travel-concierge-agent/tools/cancel_ticket.ts +10 -10
- package/dist/templates/travel-concierge-agent/tools/search_car_rentals.ts +3 -2
- package/dist/templates/travel-concierge-agent/tools/search_excursions.ts +3 -2
- package/dist/templates/travel-concierge-agent/tools/search_flights.ts +4 -3
- package/dist/templates/travel-concierge-agent/tools/search_hotels.ts +3 -2
- package/dist/templates/travel-concierge-agent/tools/update_ticket.ts +13 -8
- package/dist/templates/web-research-agent/agent.test.ts +21 -32
- package/dist/templates/web-research-agent/agent.ts +3 -4
- package/dist/templates/word-game-agent/agent.eval.test.ts +47 -67
- package/dist/templates/word-game-agent/agent.test.ts +369 -382
- package/dist/templates/word-game-agent/agent.ts +2 -5
- package/dist/templates/word-game-agent/client.tsx +1 -8
- package/dist/templates/word-game-agent/game.ts +15 -27
- package/dist/templates/word-game-agent/shared.ts +36 -20
- package/dist/templates/word-game-agent/tools/final_score.ts +14 -13
- package/dist/templates/word-game-agent/tools/relay_description.ts +90 -66
- package/dist/templates/word-game-agent/tools/repeat_word.ts +11 -10
- package/dist/templates/word-game-agent/tools/skip_word.ts +17 -21
- package/dist/templates/word-game-agent/tools/start_game.ts +26 -30
- package/dist/{test-XufelYGW.mjs → test-CW5cw5fy.mjs} +3 -4
- package/dist/typecheck.mjs +1 -1
- package/dist/worker-bundler-D8uCzpYP.mjs +335 -0
- package/dist/worker-bundler.d.ts +39 -0
- package/dist/worker-bundler.mjs +2 -155
- package/dist/{workflow-CDUlTD5B.mjs → workflow-5gOZMB2M.mjs} +66 -19
- package/package.json +4 -4
- package/dist/_output-DBP9Op_d.mjs +0 -120
- package/dist/_studio-B5m4jBTD.mjs +0 -256
- package/dist/_ui-Coe0zwmm.mjs +0 -102
- package/dist/_utils-BVLdBvdT.mjs +0 -186
- package/dist/delete-DwXCHzTl.mjs +0 -55
- package/dist/templates/document-redline-workflow/form.ts +0 -74
- package/dist/templates/emergency-dispatch-agent/events.ts +0 -48
- package/dist/templates/hotel-reception-agent/events.ts +0 -80
- package/dist/templates/meeting-recap-agent/shared.ts +0 -44
- package/dist/templates/meeting-recap-agent/tools/cancel_recap.ts +0 -25
- package/dist/templates/meeting-recap-agent/tools/recap_progress.ts +0 -24
- package/dist/templates/meeting-recap-agent/tools/recap_status.ts +0 -45
- package/dist/templates/meeting-recap-agent/workflows/tokens.ts +0 -47
- package/dist/templates/outbound-call-agent/call-params.ts +0 -109
- package/dist/templates/outbound-call-agent/live-calls.ts +0 -80
- package/dist/templates/outbound-call-agent/workflows/tokens.ts +0 -16
- package/dist/templates/research-handoff-agent/shared.ts +0 -41
- package/dist/templates/research-handoff-agent/tools/research_progress.ts +0 -23
- package/dist/templates/research-handoff-agent/tools/research_status.ts +0 -73
- package/dist/templates/research-handoff-agent/workflows/review.ts +0 -43
- package/dist/templates/roadside-assistance-agent/events.ts +0 -92
- package/dist/templates/spoken-summary-workflow/workflows/transcribe.ts +0 -137
- package/dist/templates/transcription-workflow/total-latency.tsx +0 -170
- package/dist/templates/travel-concierge-agent/call-events.ts +0 -80
|
@@ -54,13 +54,10 @@
|
|
|
54
54
|
* ## What it needs
|
|
55
55
|
*
|
|
56
56
|
* - **`ASSEMBLYAI_API_KEY` in the agent env** — `.env` under `aai dev`,
|
|
57
|
-
* `aai secret put ASSEMBLYAI_API_KEY` once deployed.
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* Postgres you bring since the platform provisions none. REQUIRED, unlike most
|
|
62
|
-
* workflow apps: an upload's record is a row, and this desk both reads an
|
|
63
|
-
* upload and writes two.
|
|
57
|
+
* `aai secret put ASSEMBLYAI_API_KEY` once deployed. It is `workflowApp()`'s
|
|
58
|
+
* default `requiredEnv`, so a deploy checks for it; one key covers
|
|
59
|
+
* transcription, the model and the voice alike. (ffmpeg cannot be declared
|
|
60
|
+
* there: a binary on `PATH` is not an environment variable.)
|
|
64
61
|
* - **ffmpeg** — every deployed guest's image installs it (and `ffprobe` with it).
|
|
65
62
|
* Under `aai dev` it is whatever is on `PATH`, or what `AAI_FFMPEG_PATH` /
|
|
66
63
|
* `AAI_FFPROBE_PATH` name. That is the one place dev/prod parity is partial, so
|
|
@@ -87,9 +84,8 @@
|
|
|
87
84
|
|
|
88
85
|
import { workflow, workflowApp } from "@alexkroman1/aai";
|
|
89
86
|
import { ASSEMBLYAI_TTS_VOICES } from "@alexkroman1/aai/tts";
|
|
90
|
-
import type { WorkflowDef } from "@alexkroman1/aai/workflow-api";
|
|
91
87
|
import { z } from "zod";
|
|
92
|
-
import { auditFlow
|
|
88
|
+
import { auditFlow } from "./workflows/audit.ts";
|
|
93
89
|
|
|
94
90
|
/**
|
|
95
91
|
* The voices the form offers: the SDK's library voices, as the tuple `z.enum`
|
|
@@ -100,15 +96,10 @@ import { auditFlow, type CallAudit } from "./workflows/audit.ts";
|
|
|
100
96
|
const VOICES = ASSEMBLYAI_TTS_VOICES;
|
|
101
97
|
|
|
102
98
|
/**
|
|
103
|
-
* The run input
|
|
104
|
-
*
|
|
105
|
-
* Named rather than inline because {@link audit} carries an explicit type, and
|
|
106
|
-
* that annotation is what lets `workflows/audit.ts` name
|
|
107
|
-
* `WorkflowInputOf<typeof audit>` for its body's parameter: the body's own
|
|
108
|
-
* signature would otherwise be part of what infers this declaration's type, and
|
|
109
|
-
* TypeScript refuses the cycle (`TS7022`).
|
|
99
|
+
* The run input. Named so the body can take `WorkflowInputOf<typeof auditInput>`
|
|
100
|
+
* — the schema's own output.
|
|
110
101
|
*/
|
|
111
|
-
const auditInput = z.object({
|
|
102
|
+
export const auditInput = z.object({
|
|
112
103
|
// A plain string, because an upload id is what the run really receives. What
|
|
113
104
|
// makes it a file picker rather than a text box is the `uploads` line below.
|
|
114
105
|
//
|
|
@@ -123,14 +114,13 @@ const auditInput = z.object({
|
|
|
123
114
|
});
|
|
124
115
|
|
|
125
116
|
/**
|
|
126
|
-
* The declaration: schema, description, and the
|
|
117
|
+
* The declaration: schema, description, and the body.
|
|
127
118
|
*
|
|
128
119
|
* Exported so `WorkflowOutputOf<typeof audit>` names the output type in one place —
|
|
129
120
|
* including from `client.tsx`, where `import type` is erased and so bundles nothing
|
|
130
|
-
* server-side
|
|
131
|
-
* for the body's parameter.
|
|
121
|
+
* server-side.
|
|
132
122
|
*/
|
|
133
|
-
export const audit
|
|
123
|
+
export const audit = workflow({
|
|
134
124
|
description: "Level a call recording, transcribe it at its pauses, and audit what was said",
|
|
135
125
|
input: auditInput,
|
|
136
126
|
// The one line that makes the form take a file: `<WorkflowFields>` renders a
|
|
@@ -142,15 +132,7 @@ export const audit: WorkflowDef<typeof auditInput, CallAudit> = workflow({
|
|
|
142
132
|
|
|
143
133
|
export default workflowApp({
|
|
144
134
|
name: "Call Audit",
|
|
145
|
-
|
|
135
|
+
listing:
|
|
146
136
|
"Turns a recorded call into a written and spoken audit — headline, risks and follow-up actions",
|
|
147
137
|
workflows: { audit },
|
|
148
|
-
// Checked at deploy time, so a missing key is a warning naming it rather than a run
|
|
149
|
-
// that fails on its third step. A workflow app declares no providers, so this is the
|
|
150
|
-
// only thing that can name the credential its steps read.
|
|
151
|
-
//
|
|
152
|
-
// ffmpeg is NOT here and cannot be: `requiredEnv` checks the agent's environment,
|
|
153
|
-
// and a binary on `PATH` is not an environment variable. The deployed guest always
|
|
154
|
-
// has one; under `aai dev` the failure names its own remedy.
|
|
155
|
-
requiredEnv: ["ASSEMBLYAI_API_KEY"],
|
|
156
138
|
});
|
|
@@ -71,14 +71,10 @@
|
|
|
71
71
|
*/
|
|
72
72
|
|
|
73
73
|
import "@alexkroman1/aai-ui/styles.css";
|
|
74
|
-
// ERASED at build time, so naming the agent's own type costs the browser bundle
|
|
75
|
-
// nothing — and it is what stops this file restating a shape `workflows/audit.ts`
|
|
76
|
-
// already declares.
|
|
77
74
|
import { formatBytes, formatDuration } from "@alexkroman1/aai/utils";
|
|
78
75
|
import {
|
|
79
76
|
AudioResult,
|
|
80
77
|
BulletList,
|
|
81
|
-
createWorkflowApi,
|
|
82
78
|
Facts,
|
|
83
79
|
Form,
|
|
84
80
|
mountPage,
|
|
@@ -91,24 +87,10 @@ import {
|
|
|
91
87
|
WorkflowProgress,
|
|
92
88
|
WorkflowRunError,
|
|
93
89
|
} from "@alexkroman1/aai-ui";
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
*
|
|
99
|
-
* A rename in `agent.ts` is a runtime 400 rather than a compile error, which is why
|
|
100
|
-
* `agent.test.ts` pins this string.
|
|
101
|
-
*/
|
|
102
|
-
const WORKFLOW = "audit";
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Hoisted out of the component deliberately.
|
|
106
|
-
*
|
|
107
|
-
* The hooks hold the client in a ref precisely so a fresh object per render cannot
|
|
108
|
-
* restart their watch, but building one in render is still a new `fetch` closure
|
|
109
|
-
* every time and reads as though it were free.
|
|
110
|
-
*/
|
|
111
|
-
const api = createWorkflowApi();
|
|
90
|
+
// ERASED at build time, so naming the agent's own type costs the browser bundle
|
|
91
|
+
// nothing — and it is what lets the hook check the NAME below against the
|
|
92
|
+
// `workflows` map `agent.ts` declares, and type the run's output off it.
|
|
93
|
+
import type agentDef from "./agent.ts";
|
|
112
94
|
|
|
113
95
|
/** One labelled number in the pipeline panel. */
|
|
114
96
|
function Stat({ label, value }: { label: string; value: string }) {
|
|
@@ -125,13 +107,13 @@ export function App() {
|
|
|
125
107
|
// `run.output` instead of `unknown`. The reload — both halves of it — is the
|
|
126
108
|
// hook's own doing; see the module doc for why the key it mints is the one
|
|
127
109
|
// this desk wants.
|
|
128
|
-
const submission = useWorkflowSubmit<typeof
|
|
110
|
+
const submission = useWorkflowSubmit<typeof agentDef>("audit");
|
|
129
111
|
const { submitForm, run, pending, upload, pauseUpload, resumeUpload, error } = submission;
|
|
130
112
|
const output = run?.status === "completed" ? run.output : undefined;
|
|
131
113
|
// `useDownloadUrl` is the SDK's: the byte route takes the agent's bearer, so the
|
|
132
114
|
// bytes have to be FETCHED and handed to the element as an object URL — and the
|
|
133
115
|
// object URL has to be revoked, which is the half a page written by hand forgets.
|
|
134
|
-
const audio = useDownloadUrl(output?.audio
|
|
116
|
+
const audio = useDownloadUrl(output?.audio);
|
|
135
117
|
|
|
136
118
|
return (
|
|
137
119
|
<main className="mx-auto flex max-w-3xl flex-col gap-6 p-8">
|
|
@@ -145,7 +127,7 @@ export function App() {
|
|
|
145
127
|
|
|
146
128
|
<Form onSubmit={(values) => submitForm(values)} error={error} className="flex flex-col gap-4">
|
|
147
129
|
{/* Every control, from the workflow's own input schema. See the module doc. */}
|
|
148
|
-
<WorkflowFields workflow=
|
|
130
|
+
<WorkflowFields<typeof agentDef> workflow="audit" />
|
|
149
131
|
<SubmitButton pending={pending} pendingLabel="Auditing…">
|
|
150
132
|
Audit the call
|
|
151
133
|
</SubmitButton>
|
|
@@ -164,7 +146,7 @@ export function App() {
|
|
|
164
146
|
{/* What the run itself says, from `stepReport()` in the workflow's steps — which
|
|
165
147
|
for this template is the ffmpeg narration: what the file was, what it
|
|
166
148
|
measured, how many pauses were found. */}
|
|
167
|
-
<WorkflowProgress runId={run?.runId}
|
|
149
|
+
<WorkflowProgress runId={run?.runId} />
|
|
168
150
|
|
|
169
151
|
{/* Announced, the same contract `<Form>` gives the submit error: this is
|
|
170
152
|
the outcome the reader waited minutes for. */}
|
|
@@ -193,7 +175,7 @@ export function App() {
|
|
|
193
175
|
/>
|
|
194
176
|
<Stat label="Run time" value={formatDuration(output.elapsedMs)} />
|
|
195
177
|
{/* Beside the run time rather than inside it: the run is mostly the
|
|
196
|
-
fan-out waiting on a provider, and this is what the
|
|
178
|
+
fan-out waiting on a provider, and this is what the LEVELLING cost.
|
|
197
179
|
It is the one number that says whether normalizing first paid for
|
|
198
180
|
itself, which is this template's whole argument. */}
|
|
199
181
|
<Stat label="ffmpeg time" value={formatDuration(output.ffmpegMs)} />
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* They are also the seam where a template is at its most tempting to hand-roll,
|
|
16
16
|
* so what each spec really pins is that the SDK's own verdict is READ rather
|
|
17
17
|
* than re-derived: `stepRequireCompleteUpload` already decided that a
|
|
18
|
-
* still-arriving upload is terminal, and `
|
|
19
|
-
*
|
|
18
|
+
* still-arriving upload is terminal, and `orFail` is what makes the engine act
|
|
19
|
+
* on it.
|
|
20
20
|
*
|
|
21
21
|
* Its own file rather than more of `agent.test.ts`, which is already the longest
|
|
22
22
|
* spec in `templates/` — the split is by subject, and `medication-safety-agent` and
|
|
@@ -27,17 +27,12 @@
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
import type { MediaInfo } from "@alexkroman1/aai/ffmpeg";
|
|
30
|
-
import type {
|
|
30
|
+
import type { UploadSlice } from "@alexkroman1/aai/step";
|
|
31
31
|
import { FatalError } from "@alexkroman1/aai/step-errors";
|
|
32
32
|
import { omitUndefined } from "@alexkroman1/aai/utils";
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
attemptSuffix,
|
|
37
|
-
segmentShortfall,
|
|
38
|
-
segmentWindow,
|
|
39
|
-
transcribeSegment,
|
|
40
|
-
} from "./workflows/audit.ts";
|
|
33
|
+
import { installStubWorld } from "@alexkroman1/aai-runtime/testing/vitest";
|
|
34
|
+
import { describe, expect, test } from "vitest";
|
|
35
|
+
import { segmentShortfall, segmentWindow, transcribeSegment } from "./workflows/audit.ts";
|
|
41
36
|
import { ingestRecording } from "./workflows/ingest.ts";
|
|
42
37
|
import {
|
|
43
38
|
BYTES_PER_SECOND,
|
|
@@ -76,9 +71,12 @@ function probed(...kinds: string[]): MediaInfo {
|
|
|
76
71
|
return { format: "mov,mp4,m4a", streams, ...omitUndefined({ audio }), raw: {} };
|
|
77
72
|
}
|
|
78
73
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
/** The store, holding `bytes` of the recording — whole unless `complete: false`. */
|
|
75
|
+
function stored(bytes: Uint8Array, options: { complete?: boolean; type?: string } = {}) {
|
|
76
|
+
return installStubWorld({
|
|
77
|
+
uploads: { files: { [UPLOAD_ID]: { bytes, name: "call.m4a", ...options } } },
|
|
78
|
+
});
|
|
79
|
+
}
|
|
82
80
|
|
|
83
81
|
describe("an upload that is still arriving", () => {
|
|
84
82
|
test("fails the run TERMINALLY rather than re-asking six times", async () => {
|
|
@@ -86,25 +84,18 @@ describe("an upload that is still arriving", () => {
|
|
|
86
84
|
// are in would level part of a call and report success. The SDK already
|
|
87
85
|
// refuses that and already carries the verdict (`retryable: false`) — but a
|
|
88
86
|
// carried verdict is only read where a caller asks, and this call site sets
|
|
89
|
-
// `maxAttempts: 6`. Without
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
installStubUploads({
|
|
93
|
-
[UPLOAD_ID]: { bytes: new Uint8Array(2048), name: "call.m4a", complete: false },
|
|
94
|
-
});
|
|
95
|
-
installStubReporter();
|
|
87
|
+
// `maxAttempts: 6`. Without `orFail` in `ingest.ts` the engine would spend
|
|
88
|
+
// all six inside a millisecond on bytes that arrive on their own schedule.
|
|
89
|
+
stored(new Uint8Array(2048), { complete: false });
|
|
96
90
|
|
|
97
91
|
await expect(ingestRecording(UPLOAD_ID)).rejects.toBeInstanceOf(FatalError);
|
|
98
92
|
});
|
|
99
93
|
|
|
100
94
|
test("keeps the SDK's own sentence, which is the one naming the remedy", async () => {
|
|
101
|
-
// `
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
[UPLOAD_ID]: { bytes: new Uint8Array(2048), name: "call.m4a", complete: false },
|
|
106
|
-
});
|
|
107
|
-
installStubReporter();
|
|
95
|
+
// `orFail` replaces no message, deliberately: what the caller has otherwise
|
|
96
|
+
// is "the step failed", where the SDK's refusal says how many bytes landed
|
|
97
|
+
// and what to do about it.
|
|
98
|
+
stored(new Uint8Array(2048), { complete: false });
|
|
108
99
|
|
|
109
100
|
await expect(ingestRecording(UPLOAD_ID)).rejects.toThrow(/still arriving/);
|
|
110
101
|
});
|
|
@@ -158,14 +149,7 @@ describe("a stored file smaller than the plan", () => {
|
|
|
158
149
|
// plan asks for one second and twelve bytes, exactly as the rounding bug
|
|
159
150
|
// produced. `stepReadUpload` clamps, so nothing throws on its own — the run
|
|
160
151
|
// used to transcribe the short slice and report success.
|
|
161
|
-
|
|
162
|
-
[UPLOAD_ID]: {
|
|
163
|
-
bytes: new Uint8Array(BYTES_PER_SECOND),
|
|
164
|
-
name: "call.pcm",
|
|
165
|
-
type: "application/octet-stream",
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
installStubReporter();
|
|
152
|
+
stored(new Uint8Array(BYTES_PER_SECOND), { type: "application/octet-stream" });
|
|
169
153
|
// No transcription stub, which is the other half of the claim: the step must
|
|
170
154
|
// fail BEFORE it spends a request on audio it knows is incomplete.
|
|
171
155
|
const overrun = { ...SEGMENT, endByte: BYTES_PER_SECOND + 12 };
|
|
@@ -193,41 +177,10 @@ describe("what the run reports about ffmpeg itself", () => {
|
|
|
193
177
|
expect(totalFfmpegMs()).toBe(0);
|
|
194
178
|
});
|
|
195
179
|
|
|
196
|
-
test("
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
//
|
|
200
|
-
// other's leaks unwatched while the test still passed.
|
|
180
|
+
test("the ingest materializes under the prefix the leak spec matches", () => {
|
|
181
|
+
// The spec proving nothing leaks matches directories by this string, so a
|
|
182
|
+
// rename in one file would leave the other's leaks unwatched while the test
|
|
183
|
+
// still passed.
|
|
201
184
|
expect(TEMP_DIR.prefix).toBe("aai-call-audit-");
|
|
202
185
|
});
|
|
203
186
|
});
|
|
204
|
-
|
|
205
|
-
describe("the progress line while a fan-out is retrying", () => {
|
|
206
|
-
/** `stepInfo()`'s answer, as the engine publishes it mid-attempt. */
|
|
207
|
-
const attempt = (n: number): StepInfo => ({
|
|
208
|
-
name: "transcribeSegment",
|
|
209
|
-
key: `transcribeSegment!${n}`,
|
|
210
|
-
attempt: n,
|
|
211
|
-
maxAttempts: 6,
|
|
212
|
-
isLastAttempt: n === 6,
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
test("says nothing on a first attempt, so an ordinary run reads as it did", () => {
|
|
216
|
-
// The eval pins the whole line — `Transcribing 0:00–1:01.` — so a suffix that
|
|
217
|
-
// appeared on attempt one would be a change to the desk's narration rather
|
|
218
|
-
// than an addition to it.
|
|
219
|
-
expect(attemptSuffix(attempt(1))).toBe("");
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
test("names the attempt and the budget once it is really retrying", () => {
|
|
223
|
-
// A thirty-segment fan-out riding out a 429 otherwise re-prints the line it
|
|
224
|
-
// already printed, which looks exactly like a run that has stalled.
|
|
225
|
-
expect(attemptSuffix(attempt(3))).toBe(" (attempt 3 of 6)");
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
test("outside a step is ORDINARY and reads as `not retrying`", () => {
|
|
229
|
-
// `stepInfo()` answers `undefined` in a body, in a tool, and in a spec driving
|
|
230
|
-
// the step directly — which is what the first attempt would have said anyway.
|
|
231
|
-
expect(attemptSuffix(undefined)).toBe("");
|
|
232
|
-
});
|
|
233
|
-
});
|
|
@@ -45,23 +45,20 @@
|
|
|
45
45
|
* ingest result, once as the plan) and buy nothing.
|
|
46
46
|
*/
|
|
47
47
|
|
|
48
|
-
// ERASED at build time, so the body can name the schema's own output type without
|
|
49
|
-
// a runtime cycle back through `agent.ts` — the same mechanism `client.tsx` uses
|
|
50
|
-
// for `WorkflowOutputOf`.
|
|
51
48
|
import type { WorkflowContext, WorkflowInputOf } from "@alexkroman1/aai";
|
|
52
49
|
import {
|
|
53
50
|
encodeWav,
|
|
54
51
|
mapConcurrent,
|
|
55
52
|
type ReadUploadOptions,
|
|
56
|
-
type StepInfo,
|
|
57
|
-
stepInfo,
|
|
58
53
|
stepReadUpload,
|
|
59
54
|
stepReport,
|
|
60
55
|
type UploadSlice,
|
|
61
56
|
} from "@alexkroman1/aai/step";
|
|
62
57
|
import { throwFatalStepError } from "@alexkroman1/aai/step-errors";
|
|
63
58
|
import { countWords, formatDuration } from "@alexkroman1/aai/utils";
|
|
64
|
-
|
|
59
|
+
// ERASED at build time: the body names the schema's own output type without a
|
|
60
|
+
// runtime cycle back through `agent.ts`.
|
|
61
|
+
import type { auditInput } from "../agent.ts";
|
|
65
62
|
import { ingestRecording } from "./ingest.ts";
|
|
66
63
|
import {
|
|
67
64
|
ANALYSIS_FORMAT,
|
|
@@ -121,7 +118,7 @@ export type CallAudit = {
|
|
|
121
118
|
/** How long the RUN took, wall clock. */
|
|
122
119
|
elapsedMs: number;
|
|
123
120
|
/**
|
|
124
|
-
* How much of that was
|
|
121
|
+
* How much of that was the two levelling passes.
|
|
125
122
|
*
|
|
126
123
|
* Rendered beside `elapsedMs` rather than folded into it, because the two
|
|
127
124
|
* answer different questions: the run is mostly the fan-out waiting on a
|
|
@@ -173,26 +170,21 @@ export type CallAudit = {
|
|
|
173
170
|
* it is validated against before a run exists.
|
|
174
171
|
*/
|
|
175
172
|
export async function auditFlow(
|
|
176
|
-
input: WorkflowInputOf<typeof
|
|
173
|
+
input: WorkflowInputOf<typeof auditInput>,
|
|
177
174
|
ctx: WorkflowContext,
|
|
178
175
|
): Promise<CallAudit> {
|
|
179
176
|
// Both at once: neither needs the other, and issued together they are one round
|
|
180
177
|
// trip instead of two before any audio moves. The ORDER is still a pure function
|
|
181
178
|
// of this expression — the two calls go out synchronously, left to right — which
|
|
182
|
-
// is what a replay reproduces.
|
|
179
|
+
// is what a replay reproduces. `ctx.now()` is journaled under its own key, so
|
|
180
|
+
// it is the moment the run really reached this line however many times the
|
|
181
|
+
// line is walked.
|
|
183
182
|
//
|
|
184
|
-
// `
|
|
185
|
-
//
|
|
186
|
-
//
|
|
187
|
-
//
|
|
188
|
-
//
|
|
189
|
-
// `maxAttempts: 6` was `ingestRecording.maxRetries = 5` — five retries AFTER
|
|
190
|
-
// the first, so six in all. More than the default 3, and not because a
|
|
191
|
-
// conversion is flaky: a corrupt file fails identically forever, and
|
|
192
|
-
// `throwFfmpegStepError` is what stops the engine retrying that. It is the two
|
|
193
|
-
// I/O halves that are worth another attempt — the step reads a whole recording
|
|
194
|
-
// out of the store and writes a whole one back, and either can lose a
|
|
195
|
-
// connection on a file this size.
|
|
183
|
+
// `maxAttempts: 6` on the ingest, and not because a conversion is flaky: a
|
|
184
|
+
// corrupt file fails identically forever, and `throwFfmpegStepError` is what
|
|
185
|
+
// stops the engine retrying that. It is the two I/O halves that are worth
|
|
186
|
+
// another attempt — the step reads a whole recording out of the store and
|
|
187
|
+
// writes a whole one back, and either can lose a connection on a file this size.
|
|
196
188
|
const [startedAt, ingested] = await Promise.all([
|
|
197
189
|
ctx.now(),
|
|
198
190
|
ctx.step("ingestRecording", () => ingestRecording(input.recording), { maxAttempts: 6 }),
|
|
@@ -210,13 +202,13 @@ export async function auditFlow(
|
|
|
210
202
|
// a recording with a silent hole in it and report success.
|
|
211
203
|
// `mapConcurrent` hands out items from a monotonic cursor, so the Nth call
|
|
212
204
|
// ISSUED is segment N whatever order they settle in — which is what makes
|
|
213
|
-
// `transcribeSegment#N` stable across a replay. `
|
|
214
|
-
//
|
|
215
|
-
//
|
|
216
|
-
//
|
|
205
|
+
// `transcribeSegment#N` stable across a replay. `maxWaits`, because a rate
|
|
206
|
+
// limit is the expected failure here: a segment that 429s is not a segment
|
|
207
|
+
// that is wrong, so a `Retry-After` is waited out rather than charged as an
|
|
208
|
+
// attempt.
|
|
217
209
|
const parts = await mapConcurrent(segments, SEGMENT_CONCURRENCY, (segment) =>
|
|
218
210
|
ctx.step("transcribeSegment", () => transcribeSegment(ingested.audio, segment), {
|
|
219
|
-
|
|
211
|
+
maxWaits: 3,
|
|
220
212
|
}),
|
|
221
213
|
);
|
|
222
214
|
|
|
@@ -236,9 +228,8 @@ export async function auditFlow(
|
|
|
236
228
|
codec: ingested.codec,
|
|
237
229
|
durationMs: ingested.durationMs,
|
|
238
230
|
elapsedMs: finishedAt - startedAt,
|
|
239
|
-
//
|
|
240
|
-
//
|
|
241
|
-
// work it did not redo.
|
|
231
|
+
// Every ffmpeg invocation the run paid for: the ingest's probe and two
|
|
232
|
+
// passes, and the mastering pass under the spoken audit.
|
|
242
233
|
ffmpegMs: ingested.ffmpegMs + spoken.ffmpegMs,
|
|
243
234
|
segments: segments.length,
|
|
244
235
|
blindCuts: segments.filter((segment) => segment.cutInSpeech).length,
|
|
@@ -280,13 +271,11 @@ export async function transcribeSegment(audioId: string, segment: Segment): Prom
|
|
|
280
271
|
//
|
|
281
272
|
// ORDER is not guaranteed here and does not need to be — the calls go out
|
|
282
273
|
// together, so their lines interleave by completion, and `segment.index` is what
|
|
283
|
-
// puts the TRANSCRIPT back in order.
|
|
284
|
-
//
|
|
285
|
-
//
|
|
286
|
-
// caller: its answer is a snapshot of the attempt in flight, so reading it again
|
|
287
|
-
// after an `await` asks a question whose answer cannot have changed.
|
|
274
|
+
// puts the TRANSCRIPT back in order. A retry's line carries "(attempt N)" from
|
|
275
|
+
// the progress stream itself, so a fan-out riding out a 429 does not read as
|
|
276
|
+
// one that has stalled.
|
|
288
277
|
const span = `${formatDuration(segment.startMs)}–${formatDuration(segment.endMs)}`;
|
|
289
|
-
await stepReport(`Transcribing ${span}
|
|
278
|
+
await stepReport(`Transcribing ${span}.`);
|
|
290
279
|
|
|
291
280
|
const audio = await stepReadUpload(audioId, segmentWindow(segment));
|
|
292
281
|
|
|
@@ -338,23 +327,6 @@ export function segmentShortfall(segment: Segment, slice: Pick<UploadSlice, "byt
|
|
|
338
327
|
return Math.max(0, segment.endByte - segment.startByte - slice.bytes.byteLength);
|
|
339
328
|
}
|
|
340
329
|
|
|
341
|
-
/**
|
|
342
|
-
* ` (attempt 2 of 6)`, or nothing at all on a first attempt.
|
|
343
|
-
*
|
|
344
|
-
* The progress log is this desk's whole UI while a run is going, and a
|
|
345
|
-
* thirty-segment fan-out that meets a rate limit re-reports each retried segment
|
|
346
|
-
* under the line it already printed — so without this a run that is patiently
|
|
347
|
-
* riding out a 429 looks exactly like a run that has stalled.
|
|
348
|
-
*
|
|
349
|
-
* `undefined` is ORDINARY rather than an error and reads as "not retrying":
|
|
350
|
-
* {@link stepInfo} answers it outside a step, which is what a spec driving this
|
|
351
|
-
* function directly has and what the first attempt would have said anyway.
|
|
352
|
-
*/
|
|
353
|
-
export function attemptSuffix(info: StepInfo | undefined): string {
|
|
354
|
-
if (info === undefined || info.attempt <= 1) return "";
|
|
355
|
-
return ` (attempt ${info.attempt} of ${info.maxAttempts})`;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
330
|
/**
|
|
359
331
|
* Join the segment transcripts into one.
|
|
360
332
|
*
|
|
@@ -56,19 +56,13 @@
|
|
|
56
56
|
* `ffmpeg-verdict.ts` because of it, and `throwFfmpegStepError` — which reaches
|
|
57
57
|
* no `node:` builtin at all — is what dissolved the boundary.
|
|
58
58
|
*
|
|
59
|
-
* `analyse` stays here for the other half of that rule: everything IT names is
|
|
60
|
-
* pure, so it may survive into the bundle.
|
|
61
59
|
*/
|
|
62
60
|
|
|
63
61
|
import { readFile, stat } from "node:fs/promises";
|
|
64
62
|
import { join } from "node:path";
|
|
65
63
|
import { describeMedia, probeMedia, runFfmpeg } from "@alexkroman1/aai/ffmpeg";
|
|
66
64
|
import { pcmDurationMs, stepReport, stepRequireCompleteUpload } from "@alexkroman1/aai/step";
|
|
67
|
-
import {
|
|
68
|
-
throwFatalStepError,
|
|
69
|
-
throwFfmpegStepError,
|
|
70
|
-
throwStepError,
|
|
71
|
-
} from "@alexkroman1/aai/step-errors";
|
|
65
|
+
import { orFail, orFatal, throwFfmpegStepError } from "@alexkroman1/aai/step-errors";
|
|
72
66
|
import { readUploadToFile, withTempDir, writeUploadFromFile } from "@alexkroman1/aai/step-files";
|
|
73
67
|
import { formatBytes, formatDuration, plural } from "@alexkroman1/aai/utils";
|
|
74
68
|
import {
|
|
@@ -86,6 +80,17 @@ import {
|
|
|
86
80
|
totalFfmpegMs,
|
|
87
81
|
} from "./media.ts";
|
|
88
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Run a `media.ts` reader, making "I cannot read this analysis" TERMINAL.
|
|
85
|
+
*
|
|
86
|
+
* A {@link MediaAnalysisError} means ffmpeg SUCCEEDED and printed something
|
|
87
|
+
* this desk does not understand — a version whose `loudnorm` renamed a key, an
|
|
88
|
+
* argv that lost `-loglevel info` — and every retry runs the same binary with
|
|
89
|
+
* the same argv. `orFatal` converts only that class; a bug in the parser stays
|
|
90
|
+
* plainly retryable.
|
|
91
|
+
*/
|
|
92
|
+
const analysed = <T>(read: () => T): T => orFatal(read, { when: MediaAnalysisError });
|
|
93
|
+
|
|
89
94
|
/**
|
|
90
95
|
* How long any one ffmpeg invocation may run before it is killed.
|
|
91
96
|
*
|
|
@@ -116,10 +121,8 @@ export type Ingested = {
|
|
|
116
121
|
/** What the recording measured before it was levelled. */
|
|
117
122
|
loudness: Loudness;
|
|
118
123
|
/**
|
|
119
|
-
* Wall clock the two `loudnorm` passes spent, in milliseconds
|
|
120
|
-
*
|
|
121
|
-
* The decoder's own cost, which is what makes the run's `elapsedMs` readable —
|
|
122
|
-
* see {@link totalFfmpegMs}.
|
|
124
|
+
* Wall clock the two `loudnorm` passes spent, in milliseconds — the decoder's
|
|
125
|
+
* own cost, which is what makes the run's `elapsedMs` readable.
|
|
123
126
|
*/
|
|
124
127
|
ffmpegMs: number;
|
|
125
128
|
/** Every pause long enough to cut in. The fan-out's cut points come from these. */
|
|
@@ -134,30 +137,20 @@ export type Ingested = {
|
|
|
134
137
|
* normalization writes a file, so journaling the id means a resumed run reads the
|
|
135
138
|
* file that already exists instead of paying to make a second one.
|
|
136
139
|
*/
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
140
|
-
//
|
|
141
|
-
// decision the step makes lives in `media.ts` as a pure
|
|
142
|
-
//
|
|
143
|
-
//
|
|
144
|
-
// lost were `"use step";` and `ingestRecording.maxRetries = 5;` — both of which
|
|
145
|
-
// the two failure tests EXECUTED, so both counted as covered while testing
|
|
146
|
-
// nothing. Removing them is what took the file under the floor: a directive
|
|
147
|
-
// propping a coverage number up is the least useful statement in the tree.
|
|
140
|
+
// The HAPPY path — three ffmpeg invocations — runs in the unit tier against a
|
|
141
|
+
// scripted child (`installStubFfmpeg`, `@alexkroman1/aai-runtime/testing/vitest`)
|
|
142
|
+
// in place of the binary: the probe answers JSON, the measure pass prints
|
|
143
|
+
// `loudnorm`'s block, and the normalize pass writes the PCM and the silence log
|
|
144
|
+
// itself. Every decision the step makes still lives in `media.ts` as a pure
|
|
145
|
+
// function; what the spec reaches HERE is the shell around them — the two
|
|
146
|
+
// `orFatal` reads, the byte count, the store, the name.
|
|
148
147
|
export async function ingestRecording(uploadId: string): Promise<Ingested> {
|
|
149
|
-
// `stepRequireCompleteUpload`, not `stepUploadInfo`: `size` is the readable
|
|
150
|
-
// an upload still arriving would be copied short and levelled as
|
|
151
|
-
//
|
|
152
|
-
//
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
// default applies and this call site's `maxAttempts: 6` re-asks the store six
|
|
156
|
-
// times inside a millisecond for bytes that arrive on their own schedule.
|
|
157
|
-
// `throwStepError` turns the carried verdict into the `FatalError` the SDK
|
|
158
|
-
// meant, with its own sentence — which names the remedy — intact.
|
|
159
|
-
const stored = await stepRequireCompleteUpload(uploadId).catch(throwStepError);
|
|
160
|
-
await stepReport(`Reading ${stored.name || uploadId} (${formatBytes(stored.size)}).`);
|
|
148
|
+
// `stepRequireCompleteUpload`, not `stepUploadInfo`: `size` is the readable
|
|
149
|
+
// PREFIX, so an upload still arriving would be copied short and levelled as
|
|
150
|
+
// the whole call. `orFail` is what makes its refusal FATAL rather than six
|
|
151
|
+
// re-asks inside a millisecond for bytes that arrive on their own schedule.
|
|
152
|
+
const stored = await orFail(stepRequireCompleteUpload)(uploadId);
|
|
153
|
+
await stepReport(`Reading ${stored.label} (${formatBytes(stored.size)}).`);
|
|
161
154
|
|
|
162
155
|
return await withTempDir(async (dir) => {
|
|
163
156
|
const source = join(dir, "source");
|
|
@@ -187,7 +180,7 @@ export async function ingestRecording(uploadId: string): Promise<Ingested> {
|
|
|
187
180
|
// off the track itself rather than off an optional chain, so `unknown` here
|
|
188
181
|
// means "ffprobe named no codec" and no longer doubles as "there was
|
|
189
182
|
// nothing to name".
|
|
190
|
-
const track =
|
|
183
|
+
const track = analysed(() => requireAudioStream(probed));
|
|
191
184
|
const codec = track.codec ?? "unknown";
|
|
192
185
|
await stepReport(
|
|
193
186
|
`Levelling ${describeMedia(probed)} to ${ANALYSIS_FORMAT.sampleRate / 1000} kHz mono.`,
|
|
@@ -198,7 +191,7 @@ export async function ingestRecording(uploadId: string): Promise<Ingested> {
|
|
|
198
191
|
const measured = await runFfmpeg(measureLoudnessArgs(source), {
|
|
199
192
|
timeoutMs: FFMPEG_TIMEOUT_MS,
|
|
200
193
|
}).catch(throwFfmpegStepError);
|
|
201
|
-
const loudness =
|
|
194
|
+
const loudness = analysed(() => parseLoudness(measured.stderr));
|
|
202
195
|
|
|
203
196
|
// Pass two: apply the measurement, find the pauses, write the audio.
|
|
204
197
|
const levelled = await runFfmpeg(normalizeArgs(source, loudness, normalized, silenceLog), {
|
|
@@ -217,13 +210,13 @@ export async function ingestRecording(uploadId: string): Promise<Ingested> {
|
|
|
217
210
|
// recording with no pause in it leaves an EMPTY log rather than no log. A
|
|
218
211
|
// missing file here is therefore a real failure and not a case to tolerate.
|
|
219
212
|
const log = await readFile(silenceLog, "utf-8");
|
|
220
|
-
const silences =
|
|
213
|
+
const silences = analysed(() => parseSilences(log, durationMs / 1000));
|
|
221
214
|
|
|
222
215
|
const written = await writeUploadFromFile(normalized, {
|
|
223
216
|
// Named after the original, so a download reads as the recording it came
|
|
224
217
|
// from. `.pcm` because that is what it is — raw samples with no header, and
|
|
225
218
|
// a `.wav` name on a headerless file is one no player will open.
|
|
226
|
-
name: `${baseName(stored.
|
|
219
|
+
name: `${baseName(stored.label)}.pcm`,
|
|
227
220
|
// Not `audio/wav`: the type is served back on the byte route, and claiming a
|
|
228
221
|
// container this file does not have would be a lie a browser acts on. Not
|
|
229
222
|
// `audio/L16` either, which looks right and is not — that type is defined as
|
|
@@ -241,7 +234,7 @@ export async function ingestRecording(uploadId: string): Promise<Ingested> {
|
|
|
241
234
|
|
|
242
235
|
return {
|
|
243
236
|
audio: written.id,
|
|
244
|
-
source: stored.
|
|
237
|
+
source: stored.label,
|
|
245
238
|
codec,
|
|
246
239
|
durationMs,
|
|
247
240
|
bytes,
|
|
@@ -252,26 +245,6 @@ export async function ingestRecording(uploadId: string): Promise<Ingested> {
|
|
|
252
245
|
}, TEMP_DIR);
|
|
253
246
|
}
|
|
254
247
|
|
|
255
|
-
/**
|
|
256
|
-
* Run a `media.ts` reader, turning "I cannot read this analysis" into a terminal
|
|
257
|
-
* failure.
|
|
258
|
-
*
|
|
259
|
-
* Fatal rather than retryable, and the distinction is real: a
|
|
260
|
-
* {@link MediaAnalysisError} means ffmpeg SUCCEEDED and printed something this
|
|
261
|
-
* desk does not understand — a version whose `loudnorm` renamed a key, an argv
|
|
262
|
-
* that lost `-loglevel info`. Every retry runs the same binary with the same argv
|
|
263
|
-
* and prints the same thing, so the retries only delay a person reading the
|
|
264
|
-
* message.
|
|
265
|
-
*/
|
|
266
|
-
export function analyse<T>(read: () => T): T {
|
|
267
|
-
try {
|
|
268
|
-
return read();
|
|
269
|
-
} catch (err: unknown) {
|
|
270
|
-
if (err instanceof MediaAnalysisError) return throwFatalStepError(err);
|
|
271
|
-
throw err;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
248
|
/** A filename without its extension, so a new one can be put on. */
|
|
276
249
|
function baseName(name: string): string {
|
|
277
250
|
const dot = name.lastIndexOf(".");
|