import"./paths-CMcF1Wug.js";import"./config-DY0eCr1t.js";import"./paths-DaRoqzBQ.js";import"./github-copilot-token-C1hiDugd.js";import{B as e,R as t}from"./logger-B2mMW1MJ.js";import"./proxy-env-CB7CLgvT.js";import"./fetch-guard-C7Ka5NEa.js";import"./local-roots-oGgEaMIf.js";import{i as n,m as r,o as i,t as a}from"./audio-transcription-runner-bLmkGuUj.js";import"./image-BlkrohFd.js";import"./api-key-rotation-Dxv2nHqc.js";import"./proxy-fetch-DX1Ptgyn.js";async function o(o){let{ctx:s,cfg:c}=o,l=c.tools?.media?.audio;if(!l||l.enabled===!1)return;let u=n(s);if(!u||u.length===0)return;let d=u.find(e=>e&&r(e)&&!e.alreadyTranscribed);if(d){e()&&t(`audio-preflight: transcribing attachment ${d.index} for mention check`);try{let{transcript:n}=await a({ctx:s,cfg:c,attachments:u,agentDir:o.agentDir,providers:o.providers,activeModel:o.activeModel,localPathRoots:i({cfg:c,ctx:s})});return n?(d.alreadyTranscribed=!0,e()&&t(`audio-preflight: transcribed ${n.length} chars from attachment ${d.index}`),n):void 0}catch(n){e()&&t(`audio-preflight: transcription failed: ${String(n)}`);return}}}export{o as transcribeFirstAudio};
