function stringifyAgentError(_0x24a9ce){if(!_0x24a9ce)return'';if(typeof _0x24a9ce==='string')return _0x24a9ce;if(typeof _0x24a9ce['message']==='string')return _0x24a9ce['message'];try{return JSON['stringify'](_0x24a9ce);}catch{return String(_0x24a9ce);}}function truncateAgentError(_0x4594fa,_0x1f09d1=0x64){const _0x527ca7=String(_0x4594fa||'');if(_0x527ca7['length']<=_0x1f09d1)return _0x527ca7;return _0x527ca7['substring'](0x0,_0x1f09d1)+'...';}export function isAgentErrorEvent(_0x268036){return _0x268036?.['type']==='error'||_0x268036?.['type']==='turn.failed'||_0x268036?.['type']==='result'&&_0x268036?.['status']==='error';}export function getAgentErrorMessage(_0x459892){return stringifyAgentError(_0x459892?.['error']?.['message'])||stringifyAgentError(_0x459892?.['message'])||stringifyAgentError(_0x459892?.['error'])||'Agent\x20reported\x20an\x20error';}export function classifyAgentErrorAction(_0x2ee8ea,_0x226b3f='Agent\x20Error'){const _0x57a5e0=String(_0x2ee8ea||'');if(/\b(?:401|403|unauthorized|forbidden|authentication|auth method|api key|GEMINI_API_KEY|GOOGLE_GENAI_USE_VERTEXAI|GOOGLE_GENAI_USE_GCA)\b/i['test'](_0x57a5e0))return'Authentication\x20Error';if(/\b(?:429|rate limit|resource exhausted)\b/i['test'](_0x57a5e0))return'Rate\x20Limit\x20Exceeded';if(/\btimeout\b/i['test'](_0x57a5e0))return'Timeout';return _0x226b3f;}export function buildAgentErrorActivity(_0x37da12,_0x119d75={}){const _0x4ecb2c=getAgentErrorMessage(_0x37da12),_0x39b146=_0x37da12?.['type']==='turn.failed'||_0x37da12?.['type']==='result'?'Agent\x20Failed':'Agent\x20Error',_0x4b5b00=_0x119d75['idSeed']??0x0;return{'icon':'❌','action':classifyAgentErrorAction(_0x4ecb2c,_0x39b146),'detail':truncateAgentError(_0x4ecb2c,0x64),'status':'error','id':'agent-error-'+(_0x37da12?.['timestamp']||_0x4b5b00)+'-'+(_0x37da12?.['type']||'unknown'),'fullContent':_0x4ecb2c,'expandable':!![],'timestamp':_0x37da12?.['timestamp'],'rawData':{'event':_0x37da12}};}