MCPcopy Create free account
hub / github.com/CaviraOSS/OpenReason / load_memory

Function load_memory

src/core/utils/memory.ts:20–40  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

18let keyv: Keyv<any> | null = null
19
20export const load_memory = async (path: string) => {
21 memory_path = path
22 const uri = `sqlite://${path}`
23 keyv = new Keyv({ store: new KeyvSqlite({ uri }) })
24
25 memory_store = []
26
27 try {
28 // keyv iterator to load existing traces
29 // keys are prefixed with "trace:"
30 if ((keyv as any).iterator) {
31 for await (const [key, value] of (keyv as any).iterator()) {
32 if (typeof key === "string" && key.startsWith("trace:")) {
33 memory_store.push(value as trace)
34 }
35 }
36 }
37 } catch {
38 memory_store = []
39 }
40}
41
42export const store_trace = async (t: Omit<trace, "timestamp">) => {
43 const item: trace = {

Callers 1

initFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected