"use strict";exports.id=1307,exports.ids=[1307],exports.modules={51307:(a,b,c)=>{c.d(b,{getDispatcherSummary:()=>n,getDispatcherTopic:()=>m});var d=c(73024),e=c(76760),f=c.n(e),g=c(53905),h=c(5492),i=c(36017);function j(){return f().join((0,g.homeRootEntry)().path,"dispatcher.json")}async function k(){try{return JSON.parse(await d.promises.readFile(j(),"utf8"))}catch{return{}}}async function l(a){await d.promises.mkdir(f().dirname(j()),{recursive:!0}),await d.promises.writeFile(j(),JSON.stringify(a,null,2),"utf8")}async function m(){let a=(0,g.homeRootEntry)(),b=await k();if(b.topicId&&await (0,h.eF)(a.path,b.topicId).catch(()=>null))return{rootId:g.HOME_ROOT_ID,rootPath:a.path,topicId:b.topicId};let c=await (0,i.loadSettings)(),d=c.assignments.chat,e=await (0,h.createTopic)({root:a.path,firstMessage:"Dispatcher",harness:d.harness,model:d.model,language:c.language});return await l({...b,topicId:e.meta.id}),{rootId:g.HOME_ROOT_ID,rootPath:a.path,topicId:e.meta.id}}async function n(a){let b=await k();if(b.topicId!==a||!b.summaryCoveredCount)return null;try{let a=await d.promises.readFile(f().join((0,g.homeRootEntry)().path,"dispatcher-summary.md"),"utf8");if(!a.trim())return null;return{text:a.trim(),coveredCount:b.summaryCoveredCount}}catch{return null}}}};