* Initialize the store. Tries SQLite first, falls back to in-memory.
()
| 41 | * Initialize the store. Tries SQLite first, falls back to in-memory. |
| 42 | */ |
| 43 | function initializeStore(): AFSStore { |
| 44 | // Check if we should use in-memory only |
| 45 | if (process.env.AGENTATION_STORE === "memory") { |
| 46 | process.stderr.write("[Store] Using in-memory store (AGENTATION_STORE=memory)\n"); |
| 47 | return createMemoryStore(); |
| 48 | } |
| 49 | |
| 50 | try { |
| 51 | // Dynamic import to avoid issues if better-sqlite3 isn't available |
| 52 | // eslint-disable-next-line @typescript-eslint/no-require-imports |
| 53 | const { createSQLiteStore } = require("./sqlite.js"); |
| 54 | const store = createSQLiteStore(); |
| 55 | process.stderr.write("[Store] Using SQLite store (~/.agentation/store.db)\n"); |
| 56 | return store; |
| 57 | } catch (err) { |
| 58 | console.warn("[Store] SQLite unavailable, falling back to in-memory:", (err as Error).message); |
| 59 | return createMemoryStore(); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // ----------------------------------------------------------------------------- |
| 64 | // In-Memory Store (fallback) |
no test coverage detected
searching dependent graphs…