import{u}from"./useQuery-PdiC7-sY.js";import{a as t,b as o,d as n,Z as i}from"./index-O0BQoyzo.js";const r={all:["memory"],users:["memory","users"],facts:e=>["memory","facts",e],persona:e=>["memory","persona",e],consolidate:["memory","consolidate"]};function y(){return u({queryKey:r.users,queryFn:()=>n.listMemoryUsers()})}function d(e,s={}){return u({queryKey:r.facts(e),queryFn:()=>n.listMemoryFacts(e),enabled:s.enabled!==!1&&!!e.user_key})}function m(){const e=t();return o({mutationFn:({id:s,user_key:a})=>n.deleteMemoryFactById(s,{user_key:a}),onSuccess:()=>e.invalidateQueries({queryKey:r.all})})}function f(){const e=t();return o({mutationFn:({user_key:s,body:a})=>n.deleteMemoryFacts({user_key:s},a),onSuccess:()=>e.invalidateQueries({queryKey:r.all})})}function q(e,s={}){return u({queryKey:r.persona(e),queryFn:async()=>{try{return await n.getMemoryPersona({user_key:e})}catch(a){if(a instanceof i&&a.status===404)return null;throw a}},enabled:s.enabled!==!1&&!!e})}function F(){const e=t();return o({mutationFn:({user_key:s,body:a})=>n.updateMemoryPersona({user_key:s},a),onSuccess:(s,a)=>{e.invalidateQueries({queryKey:r.persona(a.user_key)}),e.invalidateQueries({queryKey:r.users})}})}function K(){const e=t();return o({mutationFn:s=>n.deleteMemoryPersona({user_key:s}),onSuccess:(s,a)=>{e.invalidateQueries({queryKey:r.persona(a)}),e.invalidateQueries({queryKey:r.users})}})}function M(e={}){return u({queryKey:r.consolidate,queryFn:()=>n.getMemoryConsolidateStatus(),refetchInterval:3e3,refetchIntervalInBackground:!1,enabled:e.enabled!==!1})}function p(){const e=t();return o({mutationFn:()=>n.consolidateMemory(),onSuccess:()=>{e.invalidateQueries({queryKey:r.consolidate}),e.invalidateQueries({queryKey:r.all})}})}export{d as a,m as b,f as c,q as d,p as e,M as f,F as g,K as h,r as m,y as u};
//# sourceMappingURL=use-memory-DbJ4pP2Z.js.map
