function stringifyAgentError(_0xf682b7){if(!_0xf682b7)return'';if(typeof _0xf682b7==='string')return _0xf682b7;if(typeof _0xf682b7['message']==='string')return _0xf682b7['message'];try{return JSON['stringify'](_0xf682b7);}catch{return String(_0xf682b7);}}function truncateAgentError(_0x458be2,_0x296363=0x64){const _0x2e8dd7=String(_0x458be2||'');if(_0x2e8dd7['length']<=_0x296363)return _0x2e8dd7;return _0x2e8dd7['substring'](0x0,_0x296363)+'...';}export function isAgentErrorEvent(_0x548112){return _0x548112?.['type']==='error'||_0x548112?.['type']==='turn.failed'||_0x548112?.['type']==='result'&&_0x548112?.['status']==='error';}export function getAgentErrorMessage(_0x52b7ba){return stringifyAgentError(_0x52b7ba?.['error']?.['message'])||stringifyAgentError(_0x52b7ba?.['message'])||stringifyAgentError(_0x52b7ba?.['error'])||'Agent\x20reported\x20an\x20error';}export function classifyAgentErrorAction(_0x174232,_0xc9628b='Agent\x20Error'){const _0x475d4f=String(_0x174232||'');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'](_0x475d4f))return'Authentication\x20Error';if(/\b(?:429|rate limit|resource exhausted)\b/i['test'](_0x475d4f))return'Rate\x20Limit\x20Exceeded';if(/\btimeout\b/i['test'](_0x475d4f))return'Timeout';return _0xc9628b;}export function buildAgentErrorActivity(_0x5979f1,_0x44b36c={}){const _0x2d661e=getAgentErrorMessage(_0x5979f1),_0x178865=_0x5979f1?.['type']==='turn.failed'||_0x5979f1?.['type']==='result'?'Agent\x20Failed':'Agent\x20Error',_0x401355=_0x44b36c['idSeed']??0x0;return{'icon':'❌','action':classifyAgentErrorAction(_0x2d661e,_0x178865),'detail':truncateAgentError(_0x2d661e,0x64),'status':'error','id':'agent-error-'+(_0x5979f1?.['timestamp']||_0x401355)+'-'+(_0x5979f1?.['type']||'unknown'),'fullContent':_0x2d661e,'expandable':!![],'timestamp':_0x5979f1?.['timestamp'],'rawData':{'event':_0x5979f1}};}