"use strict";exports.id=64942,exports.ids=[64942],exports.modules={742561:(a,b,c)=>{c.d(b,{startChatAgentGc:()=>k});var d=c(973024),e=c(176760),f=c(886796);function g(){return(0,e.join)((0,f.We)(),"chat-agents.json")}function h(){let a=g();if(!(0,d.existsSync)(a))return{version:1,agents:{}};try{return JSON.parse((0,d.readFileSync)(a,"utf-8"))}catch{return{version:1,agents:{}}}}function i(a){let b=g(),c=(0,e.join)(b,"..");(0,d.existsSync)(c)||(0,d.mkdirSync)(c,{recursive:!0}),(0,d.writeFileSync)(b,JSON.stringify(a,null,2)+"\n","utf-8")}let j=null;function k(){!j&&"object"==typeof(j=setInterval(()=>{try{!function(){let a=h(),b=Date.now(),c=[];for(let[d,e]of Object.entries(a.agents))"expired"!==e.state&&"deleted"!==e.state&&b-e.lastActiveAt>e.idleTtlMs&&(e.state="expired",c.push(d));c.length>0&&i(a)}(),function(){let a=h(),b=0;for(let[c,d]of Object.entries(a.agents))"deleted"===d.state&&(delete a.agents[c],b++);b>0&&i(a)}()}catch{}},3e5))&&"unref"in j&&j.unref()}}};