import{X3 as B,Y3 as _}from"./cli-0.5.4-jp4wtw87.mjs";import{Eaa as J,Haa as Q,_aa as Z}from"./cli-0.5.4-cbq01zg3.mjs";import"./cli-0.5.4-37v5fhf1.mjs";import"./cli-0.5.4-7grzwf6q.mjs";import"./cli-0.5.4-9qmek5dq.mjs";import"./cli-0.5.4-9c6r1fjg.mjs";import"./cli-0.5.4-2dw33ms6.mjs";import"./cli-0.5.4-x1fzfxmm.mjs";import"./cli-0.5.4-e822fzaq.mjs";import"./cli-0.5.4-09dvrzcr.mjs";import"./cli-0.5.4-end8wj9r.mjs";import"./cli-0.5.4-4x206j04.mjs";import"./cli-0.5.4-yd3rd9qt.mjs";import"./cli-0.5.4-sgcaw17t.mjs";import"./cli-0.5.4-jmc3bzbn.mjs";import"./cli-0.5.4-959vxhhb.mjs";import{Zma as U}from"./cli-0.5.4-aacw1src.mjs";function V(){return D={id:`arc_${Date.now()}`,goals:[],decisions:[],milestones:[],knowledgeGraph:{entities:{},relations:[]},currentPhase:"init",startTime:Date.now(),lastUpdateTime:Date.now()},D}function G(){if(!D)return V();return D}function X(){let l=G();if(!l||Object.keys(l.knowledgeGraph.entities).length===0)return"";let C="\\nKnowledge Graph:\\n";for(let w of Object.values(l.knowledgeGraph.entities)){C+=`- [${w.type}] ${w.name}`;let b=Object.entries(w.attributes);if(b.length>0)C+=` (${b.map(([f,$])=>`${f}: ${$}`).join(", ")})`;C+="\\n"}for(let w of l.knowledgeGraph.relations){let b=l.knowledgeGraph.entities[w.sourceId]?.name,f=l.knowledgeGraph.entities[w.targetId]?.name;if(b&&f)C+=`- ${b} --(${w.type})--> ${f}\\n`}return C}function N(){let l=G();if(!l)return"No conversation arc";let C=l.goals.filter((f)=>f.status==="active"||f.status==="pending"),w=l.goals.filter((f)=>f.status==="completed"),b=`Phase: ${l.currentPhase}\\n`;if(b+=`Goals: ${w.length}/${l.goals.length} completed\\n`,C.length>0)b+=`Active: ${C[0].description.slice(0,50)}...\\n`;if(l.decisions.length>0)b+=`Decisions: ${l.decisions.length}\\n`;if(l.milestones.length>0)b+=`Latest milestone: ${l.milestones[l.milestones.length-1].description.slice(0,40)}`;return b+=X(),b}function q(){D=null}function x(){let l=G();if(!l)return null;return{phase:l.currentPhase,goalCount:l.goals.length,completedGoals:l.goals.filter((C)=>C.status==="completed").length,decisionCount:l.decisions.length,milestoneCount:l.milestones.length,durationMs:l.lastUpdateTime-l.startTime}}var D=null;var H=()=>{};var E=async(l,C)=>{let b=(l?String(l):"").trim().toLowerCase().split(/\s+/).filter(Boolean),f=b[0];if(!f||f==="status"){let $=Q(),L=x(),j=G(),S=Object.keys(j?.knowledgeGraph.entities||{}).length,T=$.knowledgeGraphEnabled!==!1?B.green("ENABLED"):B.red("DISABLED"),K=`${B.bold("Knowledge Graph Engine")}: ${T}
`;if(L)K+=`• Stats: ${L.goalCount} goals, ${L.milestoneCount} milestones, ${S} technical facts learned`;return{type:"text",value:K}}if(f==="enable"){let $=b[1],L=$==="yes"||$==="true";if(!L&&!($==="no"||$==="false"))return{type:"text",value:"Usage: /knowledge enable <yes|no>"};return J((S)=>({...S,knowledgeGraphEnabled:L})),{type:"text",value:`✨ Knowledge Graph engine ${L?B.green("enabled"):B.red("disabled")}.`}}if(f==="clear")return q(),{type:"text",value:"\uD83D\uDDD1️ Knowledge graph memory has been cleared for this session."};if(f==="list")return{type:"text",value:N()};return{type:"text",value:`Unknown subcommand: ${f}. Available: enable, clear, status, list`}};var z=U(()=>{H();Z();_()});z();export{E as call};
