openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.38 kB
JavaScript
import{o as resolveGlobalSingleton}from"./global-singleton-DolL9xGt.mjs";import{t as createPluginRuntimeStore}from"./runtime-store-B8_CWTsk.mjs";
//!extensions/memory-core/src/memory/lifecycle.ts
const lifecycleStore=createPluginRuntimeStore({key:`memory-core:manager-lifecycle`,errorMessage:`Memory manager lifecycle is not initialized`});const liveIndexing=resolveGlobalSingleton(Symbol.for(`openclaw.memoryCore.liveIndexing`),()=>/* @__PURE__ */ new Set,e=>{e.clear()},`close-and-restart`);function markMemoryIndexingLive(e){liveIndexing.add(e)}function retainMemoryIndexingAgents(e){const t=new Set(e);for(const e of liveIndexing)if(!t.has(e))liveIndexing.delete(e);return[...liveIndexing]}var MemoryManagerReloadError=class extends Error{constructor(){super(`Memory provider is reloading; retry after the plugin operation completes.`)}};function getMemoryManagerLifecycle(){let e=lifecycleStore.tryGetRuntime();if(!e){e={};lifecycleStore.setRuntime(e)}return e}function prepareMemoryManagerReload(e,t=getMemoryManagerLifecycle()){const n={retireRuntime:e.retireRuntime,adapters:new Set(e.retiringEmbeddingProviders)};t.reload=n;return{drain:t.prepare?.(n)??(async()=>({errors:[]})),resume(){t.reload=void 0}}}export{retainMemoryIndexingAgents as a,prepareMemoryManagerReload as i,getMemoryManagerLifecycle as n,markMemoryIndexingLive as r,MemoryManagerReloadError as t};