sqlite-local-ai-memory 0.0.0-stage → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +66 -0
- package/BENCHMARKS.md +93 -0
- package/LICENSE +21 -0
- package/README.md +497 -3
- package/dist/MemoryEngine.d.ts +101 -0
- package/dist/MemoryEngine.d.ts.map +1 -0
- package/dist/MemoryEngine.js +365 -0
- package/dist/cognitive_agents.d.ts +84 -0
- package/dist/cognitive_agents.d.ts.map +1 -0
- package/dist/cognitive_agents.js +1087 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/mcp_server.d.ts +3 -0
- package/dist/mcp_server.d.ts.map +1 -0
- package/dist/mcp_server.js +258 -0
- package/dist/multi_env_mcp_test.d.ts +2 -0
- package/dist/multi_env_mcp_test.d.ts.map +1 -0
- package/dist/multi_env_mcp_test.js +139 -0
- package/dist/sqlite_store.d.ts +40 -0
- package/dist/sqlite_store.d.ts.map +1 -0
- package/dist/sqlite_store.js +409 -0
- package/dist/stress_test.d.ts +2 -0
- package/dist/stress_test.d.ts.map +1 -0
- package/dist/stress_test.js +149 -0
- package/dist/test_autodream_dual.d.ts +2 -0
- package/dist/test_autodream_dual.d.ts.map +1 -0
- package/dist/test_autodream_dual.js +38 -0
- package/dist/test_autodream_history.d.ts +2 -0
- package/dist/test_autodream_history.d.ts.map +1 -0
- package/dist/test_autodream_history.js +131 -0
- package/dist/test_multitopic_dashboard.d.ts +2 -0
- package/dist/test_multitopic_dashboard.d.ts.map +1 -0
- package/dist/test_multitopic_dashboard.js +82 -0
- package/dist/types.d.ts +134 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +16 -0
- package/package.json +71 -4
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* FILE: src/memory/test_autodream_history.ts
|
|
4
|
+
* RESPONSIBILITY: Simulates an end-of-session AutoDream consolidation cycle
|
|
5
|
+
* using realistic multi-turn conversational history (defaults to bundled fixture
|
|
6
|
+
* or user-specified file via CHAT_HISTORY_FILE environment variable).
|
|
7
|
+
* ============================================================================
|
|
8
|
+
*/
|
|
9
|
+
import fs from "fs";
|
|
10
|
+
import path from "path";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
import { MemoryEngine } from "./MemoryEngine.js";
|
|
13
|
+
async function testHistoryConsolidation() {
|
|
14
|
+
console.log("🧪 [HISTORY_TEST] Simulating AutoDream consolidation over multi-turn conversation...\n");
|
|
15
|
+
const dbPath = "./memoria_test_history.db";
|
|
16
|
+
for (const ext of ["", "-wal", "-shm"]) {
|
|
17
|
+
if (fs.existsSync(dbPath + ext)) {
|
|
18
|
+
try {
|
|
19
|
+
fs.unlinkSync(dbPath + ext);
|
|
20
|
+
}
|
|
21
|
+
catch (_) { }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// Resolve history source: custom environment variable or bundled sample fixture
|
|
25
|
+
const customPath = process.env.CHAT_HISTORY_FILE;
|
|
26
|
+
let resolvedPath = "";
|
|
27
|
+
if (customPath && fs.existsSync(customPath)) {
|
|
28
|
+
resolvedPath = customPath;
|
|
29
|
+
console.log(`📂 Using custom history source: ${resolvedPath}`);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// Look for fixtures/sample_chat_history.json relative to current directory
|
|
33
|
+
const defaultCandidates = [
|
|
34
|
+
path.resolve("./fixtures/sample_chat_history.json"),
|
|
35
|
+
path.resolve("../fixtures/sample_chat_history.json"),
|
|
36
|
+
path.join(path.dirname(fileURLToPath(import.meta.url)), "../../fixtures/sample_chat_history.json"),
|
|
37
|
+
];
|
|
38
|
+
for (const cand of defaultCandidates) {
|
|
39
|
+
if (fs.existsSync(cand)) {
|
|
40
|
+
resolvedPath = cand;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (!resolvedPath) {
|
|
45
|
+
console.error("❌ Could not locate sample_chat_history.json fixture.");
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
console.log(`📂 Using bundled fixture source: ${resolvedPath}`);
|
|
49
|
+
}
|
|
50
|
+
const raw = fs.readFileSync(resolvedPath, "utf-8");
|
|
51
|
+
let turns = [];
|
|
52
|
+
try {
|
|
53
|
+
turns = JSON.parse(raw);
|
|
54
|
+
if (!Array.isArray(turns)) {
|
|
55
|
+
throw new Error("Chat history JSON must be an array of conversation turns.");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
console.error("❌ Failed to parse chat history JSON:", err.message);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
const memory = new MemoryEngine({
|
|
63
|
+
dbPath,
|
|
64
|
+
userName: "Alice",
|
|
65
|
+
userId: "user_test",
|
|
66
|
+
semanticArbitrator: true,
|
|
67
|
+
});
|
|
68
|
+
console.log(`\n📥 Ingesting ${turns.length} conversation turns into MemoryEngine...`);
|
|
69
|
+
let ingestedCount = 0;
|
|
70
|
+
for (const [idx, turn] of turns.entries()) {
|
|
71
|
+
const userMsg = turn.u || turn.user || "";
|
|
72
|
+
const assistantMsg = turn.a || turn.assistant || "";
|
|
73
|
+
const directText = turn.text || "";
|
|
74
|
+
const combinedText = directText || (userMsg ? `User: ${userMsg}\nAssistant: ${assistantMsg}` : "");
|
|
75
|
+
if (!combinedText.trim())
|
|
76
|
+
continue;
|
|
77
|
+
// Optional noise filter: skip system telemetry banners
|
|
78
|
+
if (combinedText.includes("[NOTIFICACIÓN SISTEMA") || combinedText.includes("[SYSTEM TELEMETRY]")) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
await memory.save(combinedText, "user_test");
|
|
82
|
+
ingestedCount++;
|
|
83
|
+
}
|
|
84
|
+
console.log(`✨ Successfully processed ${ingestedCount} turns.`);
|
|
85
|
+
console.log("\n⚙️ Executing AutoDream consolidation cycle (memory.consolidate())...");
|
|
86
|
+
const startTime = Date.now();
|
|
87
|
+
const result = await memory.consolidate("user_test");
|
|
88
|
+
const elapsed = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
89
|
+
console.log("\n==================================================================");
|
|
90
|
+
console.log(`📊 EMPIRICAL AUTODREAM RESULT (Completed in ${elapsed}s):`);
|
|
91
|
+
console.log("==================================================================");
|
|
92
|
+
console.log("\n🔹 NARRATIVE SUMMARY (Executive Dashboard Overview):");
|
|
93
|
+
console.log(` ${result.narrativeSummary}`);
|
|
94
|
+
console.log("\n🔹 WORKING DASHBOARD ITEMS (Live Work in Progress):");
|
|
95
|
+
if (result.dashboard && result.dashboard.length > 0) {
|
|
96
|
+
result.dashboard.forEach((d, i) => console.log(` [${i + 1}] ${d.txt}`));
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
console.log(" (No active working items)");
|
|
100
|
+
}
|
|
101
|
+
console.log("\n🔹 TRIAGE MEMORY (Compiled Permanent 4-Block Technical Facts):");
|
|
102
|
+
if (result.triageMemory && result.triageMemory.length > 0) {
|
|
103
|
+
result.triageMemory.forEach((t, i) => console.log(` [${i + 1}] [${t.type}] ${t.fact}`));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
console.log(" (No triage facts compiled)");
|
|
107
|
+
}
|
|
108
|
+
console.log("\n🔹 OPEN CASES INCUBATOR (Tracked Unresolved Issues):");
|
|
109
|
+
if (result.openCases && result.openCases.length > 0) {
|
|
110
|
+
result.openCases.forEach((c, i) => console.log(` [${i + 1}] [ID: ${c.id}] ${c.incident}`));
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
console.log(" (No open cases)");
|
|
114
|
+
}
|
|
115
|
+
console.log("==================================================================\n");
|
|
116
|
+
memory.close();
|
|
117
|
+
// Cleanup test database
|
|
118
|
+
for (const ext of ["", "-wal", "-shm"]) {
|
|
119
|
+
if (fs.existsSync(dbPath + ext)) {
|
|
120
|
+
try {
|
|
121
|
+
fs.unlinkSync(dbPath + ext);
|
|
122
|
+
}
|
|
123
|
+
catch (_) { }
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
console.log("✅ History-based AutoDream simulation finished successfully.");
|
|
127
|
+
}
|
|
128
|
+
testHistoryConsolidation().catch((err) => {
|
|
129
|
+
console.error("❌ Fatal error during history test:", err);
|
|
130
|
+
process.exit(1);
|
|
131
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test_multitopic_dashboard.d.ts","sourceRoot":"","sources":["../src/test_multitopic_dashboard.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* FILE: src/test_multitopic_dashboard.ts
|
|
4
|
+
* RESPONSIBILITY: Verification suite for Multi-Topic Single Dashboard with
|
|
5
|
+
* deterministic cross-topic preservation.
|
|
6
|
+
* ============================================================================
|
|
7
|
+
*/
|
|
8
|
+
import fs from "fs";
|
|
9
|
+
import { MemoryEngine } from "./MemoryEngine.js";
|
|
10
|
+
async function runMultiTopicTest() {
|
|
11
|
+
console.log("🧪 [TEST] Starting Multi-Topic Single Dashboard Verification...\n");
|
|
12
|
+
const dbPath = "./memoria_test_multitopic.db";
|
|
13
|
+
for (const ext of ["", "-wal", "-shm"]) {
|
|
14
|
+
if (fs.existsSync(dbPath + ext)) {
|
|
15
|
+
try {
|
|
16
|
+
fs.unlinkSync(dbPath + ext);
|
|
17
|
+
}
|
|
18
|
+
catch (_) { }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const memory = new MemoryEngine({
|
|
22
|
+
dbPath,
|
|
23
|
+
debug: false,
|
|
24
|
+
});
|
|
25
|
+
try {
|
|
26
|
+
// 1. Ingest TotalConnect facts
|
|
27
|
+
console.log("▶ 1. Saving facts for [TOTALCONNECT]...");
|
|
28
|
+
await memory.saveFact("[TECHNICAL] Webhook timeout configured to 5000ms in TotalConnect gateway.", undefined, { source: "TOTALCONNECT" });
|
|
29
|
+
await memory.saveFact("[INCUBATOR/OPEN_CASE:TOTALCONNECT] Zone 230 PIR camera triggering false tampering alerts during night arming.", undefined, { source: "TOTALCONNECT" });
|
|
30
|
+
// 2. Consolidate TotalConnect
|
|
31
|
+
console.log("▶ 2. Consolidating AutoDream for [TOTALCONNECT]...");
|
|
32
|
+
const res1 = await memory.consolidate(undefined, "TOTALCONNECT");
|
|
33
|
+
console.log(` Consolidated status: ${res1.statusMessage}`);
|
|
34
|
+
console.log(` Dashboard items after step 1: ${res1.dashboard.length}`);
|
|
35
|
+
// 3. Ingest Sqlite-Memory facts
|
|
36
|
+
console.log("\n▶ 3. Saving facts for [SQLITE_MEMORY]...");
|
|
37
|
+
await memory.saveFact("[DEVELOPMENT] [sqlite-local-ai-memory] Implemented multi-topic dashboard schema in types.ts.", undefined, { source: "SQLITE_MEMORY" });
|
|
38
|
+
await memory.saveFact("[INCUBATOR/OPEN_CASE:SQLITE_MEMORY] Dimension mismatch between Ollama and Gemini embeddings.", undefined, { source: "SQLITE_MEMORY" });
|
|
39
|
+
// 4. Consolidate Sqlite-Memory
|
|
40
|
+
console.log("▶ 4. Consolidating AutoDream for [SQLITE_MEMORY]...");
|
|
41
|
+
const res2 = await memory.consolidate(undefined, "SQLITE_MEMORY");
|
|
42
|
+
console.log(` Consolidated status: ${res2.statusMessage}`);
|
|
43
|
+
console.log(` Dashboard items after step 2: ${res2.dashboard.length}`);
|
|
44
|
+
// 5. Inspect final dashboard
|
|
45
|
+
console.log("\n▶ 5. Reading unified dashboard from database...");
|
|
46
|
+
const dash = memory.getDashboard();
|
|
47
|
+
if (!dash) {
|
|
48
|
+
throw new Error("Dashboard not found in database!");
|
|
49
|
+
}
|
|
50
|
+
const items = JSON.parse(dash.data);
|
|
51
|
+
console.log(`\n📋 Unified Dashboard Contents (${items.length} items):`);
|
|
52
|
+
items.forEach((it, idx) => {
|
|
53
|
+
console.log(` [${idx + 1}] (Source: ${it.source || "N/A"}) ${it.txt}`);
|
|
54
|
+
});
|
|
55
|
+
const hasTC = items.some((it) => it.txt.includes("TOTALCONNECT") || (it.source && it.source.toUpperCase() === "TOTALCONNECT"));
|
|
56
|
+
const hasSQ = items.some((it) => it.txt.includes("SQLITE_MEMORY") || (it.source && it.source.toUpperCase() === "SQLITE_MEMORY"));
|
|
57
|
+
console.log("\n🔍 Verification Checks:");
|
|
58
|
+
console.log(` • TotalConnect items preserved: ${hasTC ? "✅ PASS" : "❌ FAIL"}`);
|
|
59
|
+
console.log(` • Sqlite-Memory items present: ${hasSQ ? "✅ PASS" : "❌ FAIL"}`);
|
|
60
|
+
if (hasTC && hasSQ) {
|
|
61
|
+
console.log("\n🎉 MULTI-TOPIC SINGLE DASHBOARD TEST PASSED SUCCESSFULLY!\n");
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
throw new Error("Cross-topic preservation check failed!");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
memory.close();
|
|
69
|
+
for (const ext of ["", "-wal", "-shm"]) {
|
|
70
|
+
if (fs.existsSync(dbPath + ext)) {
|
|
71
|
+
try {
|
|
72
|
+
fs.unlinkSync(dbPath + ext);
|
|
73
|
+
}
|
|
74
|
+
catch (_) { }
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
runMultiTopicTest().catch((err) => {
|
|
80
|
+
console.error("\n❌ [TEST_FAILED]", err);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
});
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* FILE: src/memory/types.ts
|
|
4
|
+
* RESPONSIBILITY: Decoupled TypeScript Interfaces and Types for MemoryEngine.
|
|
5
|
+
* ============================================================================
|
|
6
|
+
*/
|
|
7
|
+
export declare const CONFIG_USER: {
|
|
8
|
+
readonly NAME: string;
|
|
9
|
+
readonly ID: string;
|
|
10
|
+
};
|
|
11
|
+
/** Standard vector dimensionality for the hybrid retrieval engine */
|
|
12
|
+
export declare const EMBEDDING_DIM = 768;
|
|
13
|
+
export interface ExecutionOptions {
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
}
|
|
16
|
+
export interface CustomPrompts {
|
|
17
|
+
/** Override system prompt for the Gatekeeper (Noise Firewall Agent) */
|
|
18
|
+
porteroSystem?: string;
|
|
19
|
+
gatekeeperSystem?: string;
|
|
20
|
+
/** Override system prompt for the Query Expander (Bibliotecario Agent) */
|
|
21
|
+
bibliotecarioSystem?: string;
|
|
22
|
+
queryExpanderSystem?: string;
|
|
23
|
+
/** Override system prompt for the Atomic Fact Compiler (Notary Agent) */
|
|
24
|
+
notarioSystem?: string;
|
|
25
|
+
notarySystem?: string;
|
|
26
|
+
/** Override system prompt for the Semantic Arbiter (Collision Auditor Agent) */
|
|
27
|
+
arbitroSystem?: string;
|
|
28
|
+
semanticArbiterSystem?: string;
|
|
29
|
+
/** Override system prompt for the State Orchestrator (AutoDream Compiler Agent) */
|
|
30
|
+
historiadorSystem?: string;
|
|
31
|
+
stateOrchestratorSystem?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface MemoryConfig {
|
|
34
|
+
/** Path to local SQLite database file (default: './memoria.db') */
|
|
35
|
+
dbPath?: string;
|
|
36
|
+
/** Primary user display name for contextualization (default: 'User') */
|
|
37
|
+
userName?: string;
|
|
38
|
+
/** Primary user ID in database (default: 'user_default') */
|
|
39
|
+
userId?: string;
|
|
40
|
+
/** Base URL for local Ollama service (default: 'http://localhost:11434') */
|
|
41
|
+
ollamaUrl?: string;
|
|
42
|
+
/** Optional Google Gemini API Key for Cloud AI agents and embeddings */
|
|
43
|
+
geminiApiKey?: string;
|
|
44
|
+
/** Optional OpenRouter API Key for fallback LLM routing */
|
|
45
|
+
openRouterApiKey?: string;
|
|
46
|
+
/** Enable or disable real-time Semantic Arbiter anti-collision auditing (default: true) */
|
|
47
|
+
semanticArbitrator?: boolean;
|
|
48
|
+
/** Time-to-live in hours for active Dashboard working state items (default: 12) */
|
|
49
|
+
dashboardTTLHours?: number;
|
|
50
|
+
/** Optional custom system prompt overrides for fine-tuning cognitive agent behavior */
|
|
51
|
+
customPrompts?: CustomPrompts;
|
|
52
|
+
/** Enable detailed multi-stage console debugging logs (default: false, env: MEMORY_DEBUG) */
|
|
53
|
+
debug?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Deep Forensic Telemetry Switch (default: false, env: MEMORY_TELEMETRY).
|
|
56
|
+
* When enabled (true), asynchronously logs structured operational diagnostics to a JSONL file:
|
|
57
|
+
* turns in the RAM Ring Buffer, Smart Gate decisions, Query Expander latency and output,
|
|
58
|
+
* retrieved memory scores, and Gatekeeper/Notary verdicts without degrading response latency.
|
|
59
|
+
*/
|
|
60
|
+
telemetry?: boolean;
|
|
61
|
+
/** Absolute or ~/ path to the JSONL telemetry file (default: env MEMORY_TELEMETRY_PATH or ~/.local-ai-memory/telemetry.jsonl) */
|
|
62
|
+
telemetryPath?: string;
|
|
63
|
+
/** Default source tag for facts inserted during this session (e.g. 'TOTALCONNECT', 'SQLITE_MEMORY') */
|
|
64
|
+
defaultSource?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface MemoryHit {
|
|
67
|
+
id: string;
|
|
68
|
+
user_id: string;
|
|
69
|
+
data: string;
|
|
70
|
+
source: string;
|
|
71
|
+
created_at: string;
|
|
72
|
+
updated_at?: string;
|
|
73
|
+
score?: number;
|
|
74
|
+
rank?: number;
|
|
75
|
+
memory?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface AtomicFact {
|
|
78
|
+
fact: string;
|
|
79
|
+
category: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Represents a single active state item in the unified global dashboard.
|
|
83
|
+
*/
|
|
84
|
+
export interface DashboardItem {
|
|
85
|
+
/** Unique UUID identifying this working state item */
|
|
86
|
+
id: string;
|
|
87
|
+
/** Unix epoch timestamp (ms) when this item was recorded or updated */
|
|
88
|
+
ts: number;
|
|
89
|
+
/** Content text, prefixed by [PROJECT_TAG] or [INCUBATOR/OPEN_CASE:PROJECT_TAG] */
|
|
90
|
+
txt: string;
|
|
91
|
+
/** Subproject or client origin (e.g. 'TOTALCONNECT', 'SQLITE_MEMORY') for cross-topic preservation */
|
|
92
|
+
source?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface TriageItem {
|
|
95
|
+
type: "TECHNICAL" | "PERSONAL" | "MILESTONES";
|
|
96
|
+
fact: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Represents an unresolved technical incident or investigation in the Incubator.
|
|
100
|
+
*/
|
|
101
|
+
export interface OpenCaseItem {
|
|
102
|
+
/** Unique UUID identifying this open investigation case */
|
|
103
|
+
id: string;
|
|
104
|
+
/** Incident description with technical symptoms, error codes, and impacted paths */
|
|
105
|
+
incident: string;
|
|
106
|
+
/** Originating project or client source */
|
|
107
|
+
source?: string;
|
|
108
|
+
/** ISO timestamp when the case was first registered */
|
|
109
|
+
created_at?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface AutoDreamResult {
|
|
112
|
+
narrativeSummary: string;
|
|
113
|
+
dashboard: DashboardItem[];
|
|
114
|
+
triageMemory: TriageItem[];
|
|
115
|
+
openCases: OpenCaseItem[];
|
|
116
|
+
totalActive: number;
|
|
117
|
+
statusMessage: string;
|
|
118
|
+
}
|
|
119
|
+
export type AgentSchemaKey = "notary" | "orchestrator" | "arbiter" | "expander" | "none";
|
|
120
|
+
export type ModelProvider = "ollama" | "gemini" | "openrouter" | "openai";
|
|
121
|
+
export interface AgentModelConfig {
|
|
122
|
+
desc: string;
|
|
123
|
+
schemaKey?: AgentSchemaKey;
|
|
124
|
+
provider: ModelProvider;
|
|
125
|
+
model: string;
|
|
126
|
+
endpoint?: string | null;
|
|
127
|
+
options?: Array<{
|
|
128
|
+
provider: ModelProvider;
|
|
129
|
+
model: string;
|
|
130
|
+
endpoint?: string;
|
|
131
|
+
timeout?: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,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;AAEzF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE1E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,QAAQ,EAAE,aAAa,CAAC;QACxB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* FILE: src/memory/types.ts
|
|
4
|
+
* RESPONSIBILITY: Decoupled TypeScript Interfaces and Types for MemoryEngine.
|
|
5
|
+
* ============================================================================
|
|
6
|
+
*/
|
|
7
|
+
export const CONFIG_USER = {
|
|
8
|
+
get NAME() {
|
|
9
|
+
return process.env.MEMORY_USER_NAME || process.env.USER_NAME || "User";
|
|
10
|
+
},
|
|
11
|
+
get ID() {
|
|
12
|
+
return process.env.MEMORY_USER_ID || process.env.USER_ID || "user_default";
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
/** Standard vector dimensionality for the hybrid retrieval engine */
|
|
16
|
+
export const EMBEDDING_DIM = 768;
|
package/package.json
CHANGED
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sqlite-local-ai-memory",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.4.3",
|
|
4
|
+
"description": "100% In-Process Bare-Metal Hybrid Memory Engine & MCP Server for LLMs (SQLite + Int8 Vectors).",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"sqlite-local-ai-memory": "dist/mcp_server.js"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md",
|
|
20
|
+
"BENCHMARKS.md",
|
|
21
|
+
".env.example",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"start": "node ./dist/mcp_server.js",
|
|
27
|
+
"test": "node ./dist/stress_test.js",
|
|
28
|
+
"test:mcp": "node ./dist/multi_env_mcp_test.js",
|
|
29
|
+
"test:history": "node ./dist/test_autodream_history.js",
|
|
30
|
+
"prepublishOnly": "npm run build"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"mcp",
|
|
34
|
+
"mcp-server",
|
|
35
|
+
"model-context-protocol",
|
|
36
|
+
"sqlite",
|
|
37
|
+
"fts5",
|
|
38
|
+
"memory",
|
|
39
|
+
"rag",
|
|
40
|
+
"vector-search",
|
|
41
|
+
"hybrid-search",
|
|
42
|
+
"local-first",
|
|
43
|
+
"llm",
|
|
44
|
+
"claude",
|
|
45
|
+
"anthropic"
|
|
46
|
+
],
|
|
47
|
+
"author": "Jose Alberto Guerra (cheveguerra)",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/cheveguerra/sqlite-local-ai-memory.git"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/cheveguerra/sqlite-local-ai-memory#readme",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/cheveguerra/sqlite-local-ai-memory/issues"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=18.0.0"
|
|
58
|
+
},
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@google/generative-ai": "^0.21.0",
|
|
62
|
+
"@modelcontextprotocol/sdk": "^1.3.0",
|
|
63
|
+
"axios": "^1.15.1",
|
|
64
|
+
"better-sqlite3": "^11.8.0",
|
|
65
|
+
"zod": "^3.24.1"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@types/better-sqlite3": "^7.6.12",
|
|
69
|
+
"@types/node": "^20.17.0",
|
|
70
|
+
"tsx": "^4.19.0",
|
|
71
|
+
"typescript": "^5.7.3"
|
|
72
|
+
}
|
|
73
|
+
}
|