require(`./paths-BvlJvmRS.cjs`),require(`./paths-Dbz86fcW.cjs`);const e=require(`./logger-BYbgqzvt.cjs`);require(`./model-auth-AR9ykNRi.cjs`),require(`./proxy-env-DHDz8MfA.cjs`),require(`./github-copilot-token-DoHgkI2r.cjs`),require(`./fetch-guard-DOIMyfyU.cjs`),require(`./local-roots-Djlji0UA.cjs`);const t=require(`./audio-transcription-runner-CG-Rng4e.cjs`);require(`./image-BtwCflRF.cjs`),require(`./api-key-rotation-BB75pvuT.cjs`),require(`./proxy-fetch-C6EcDOzJ.cjs`);async function n(n){let{ctx:r,cfg:i}=n,a=i.tools?.media?.audio;if(!a||a.enabled===!1)return;let o=t.i(r);if(!o||o.length===0)return;let s=o.find(e=>e&&t.p(e)&&!e.alreadyTranscribed);if(s){e.B()&&e.R(`audio-preflight: transcribing attachment ${s.index} for mention check`);try{let{transcript:a}=await t.t({ctx:r,cfg:i,attachments:o,agentDir:n.agentDir,providers:n.providers,activeModel:n.activeModel,localPathRoots:t.o({cfg:i,ctx:r})});return a?(s.alreadyTranscribed=!0,e.B()&&e.R(`audio-preflight: transcribed ${a.length} chars from attachment ${s.index}`),a):void 0}catch(t){e.B()&&e.R(`audio-preflight: transcription failed: ${String(t)}`);return}}}exports.transcribeFirstAudio=n;
