@jungjaehoon/mama-core 1.4.0 → 1.4.1
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/db/migrations/001-initial-decision-graph.sql +1 -1
- package/db/migrations/002-add-error-patterns.sql +1 -1
- package/db/migrations/025-extend-kind-check.sql +59 -0
- package/dist/config-loader.d.ts +1 -1
- package/dist/config-loader.js +3 -3
- package/dist/db-adapter/base-adapter.d.ts +1 -1
- package/dist/db-manager.d.ts +2 -2
- package/dist/db-manager.js +2 -2
- package/dist/embeddings.d.ts +2 -2
- package/dist/embeddings.js +2 -2
- package/dist/memory/types.d.ts +1 -1
- package/dist/memory/types.js +10 -1
- package/package.json +1 -1
|
@@ -124,7 +124,7 @@ CREATE INDEX IF NOT EXISTS idx_sessions_last_active ON sessions(last_active_at);
|
|
|
124
124
|
-- because sqlite-vss requires extension loading first
|
|
125
125
|
--
|
|
126
126
|
-- CREATE VIRTUAL TABLE vss_memories USING vss0(
|
|
127
|
-
-- embedding(
|
|
127
|
+
-- embedding(1024) -- multilingual-e5-large embeddings
|
|
128
128
|
-- );
|
|
129
129
|
|
|
130
130
|
-- ══════════════════════════════════════════════════════════════
|
|
@@ -33,7 +33,7 @@ CREATE TABLE IF NOT EXISTS error_patterns (
|
|
|
33
33
|
first_seen INTEGER NOT NULL, -- First occurrence timestamp
|
|
34
34
|
|
|
35
35
|
-- Vector Embedding (for semantic matching)
|
|
36
|
-
embedding BLOB, --
|
|
36
|
+
embedding BLOB, -- 1024-dim embedding (multilingual-e5-large)
|
|
37
37
|
|
|
38
38
|
-- Metadata
|
|
39
39
|
created_at INTEGER DEFAULT (unixepoch() * 1000),
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
-- v0.17: Extend kind CHECK constraint to include 'task' and 'schedule'.
|
|
2
|
+
-- Only runs if the old CHECK exists (idempotent).
|
|
3
|
+
-- Uses a temp table approach since SQLite cannot ALTER CHECK constraints.
|
|
4
|
+
|
|
5
|
+
-- Drop the old column constraint by recreating the table
|
|
6
|
+
-- This is safe because we explicitly list all columns
|
|
7
|
+
|
|
8
|
+
CREATE TABLE IF NOT EXISTS decisions_v17 (
|
|
9
|
+
id TEXT PRIMARY KEY,
|
|
10
|
+
topic TEXT NOT NULL,
|
|
11
|
+
decision TEXT NOT NULL,
|
|
12
|
+
reasoning TEXT,
|
|
13
|
+
outcome TEXT,
|
|
14
|
+
failure_reason TEXT,
|
|
15
|
+
limitation TEXT,
|
|
16
|
+
user_involvement TEXT,
|
|
17
|
+
session_id TEXT,
|
|
18
|
+
supersedes TEXT,
|
|
19
|
+
superseded_by TEXT,
|
|
20
|
+
refined_from TEXT,
|
|
21
|
+
confidence REAL DEFAULT 0.5 CHECK (confidence >= 0.0 AND confidence <= 1.0),
|
|
22
|
+
created_at INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000),
|
|
23
|
+
updated_at INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000),
|
|
24
|
+
needs_validation INTEGER DEFAULT 0 CHECK (needs_validation IN (0, 1)),
|
|
25
|
+
validation_attempts INTEGER DEFAULT 0,
|
|
26
|
+
last_validated_at INTEGER,
|
|
27
|
+
usage_count INTEGER DEFAULT 0,
|
|
28
|
+
trust_context TEXT,
|
|
29
|
+
usage_success INTEGER DEFAULT 0,
|
|
30
|
+
usage_failure INTEGER DEFAULT 0,
|
|
31
|
+
time_saved INTEGER DEFAULT 0,
|
|
32
|
+
evidence TEXT,
|
|
33
|
+
alternatives TEXT,
|
|
34
|
+
risks TEXT,
|
|
35
|
+
event_date TEXT,
|
|
36
|
+
kind TEXT DEFAULT 'decision'
|
|
37
|
+
CHECK (kind IN ('decision', 'preference', 'constraint', 'lesson', 'fact', 'task', 'schedule')),
|
|
38
|
+
status TEXT DEFAULT 'active'
|
|
39
|
+
CHECK (status IN ('active', 'superseded', 'contradicted', 'stale')),
|
|
40
|
+
summary TEXT,
|
|
41
|
+
is_static INTEGER DEFAULT 0
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
INSERT OR IGNORE INTO decisions_v17 (
|
|
45
|
+
id, topic, decision, reasoning, outcome, failure_reason, limitation,
|
|
46
|
+
user_involvement, session_id, supersedes, superseded_by, refined_from,
|
|
47
|
+
confidence, created_at, updated_at, needs_validation, validation_attempts,
|
|
48
|
+
last_validated_at, usage_count, trust_context, usage_success, usage_failure,
|
|
49
|
+
time_saved, evidence, alternatives, risks, event_date, kind, status, summary, is_static
|
|
50
|
+
) SELECT
|
|
51
|
+
id, topic, decision, reasoning, outcome, failure_reason, limitation,
|
|
52
|
+
user_involvement, session_id, supersedes, superseded_by, refined_from,
|
|
53
|
+
confidence, created_at, updated_at, needs_validation, validation_attempts,
|
|
54
|
+
last_validated_at, usage_count, trust_context, usage_success, usage_failure,
|
|
55
|
+
time_saved, evidence, alternatives, risks, event_date, kind, status, summary, is_static
|
|
56
|
+
FROM decisions;
|
|
57
|
+
|
|
58
|
+
DROP TABLE decisions;
|
|
59
|
+
ALTER TABLE decisions_v17 RENAME TO decisions;
|
package/dist/config-loader.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Loads user configuration from ~/.mama/config.json with sensible defaults.
|
|
8
8
|
* Supports:
|
|
9
|
-
* - Model selection (default: multilingual-e5-
|
|
9
|
+
* - Model selection (default: multilingual-e5-large)
|
|
10
10
|
* - Embedding dimensions
|
|
11
11
|
* - Cache directory configuration
|
|
12
12
|
*
|
package/dist/config-loader.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Loads user configuration from ~/.mama/config.json with sensible defaults.
|
|
9
9
|
* Supports:
|
|
10
|
-
* - Model selection (default: multilingual-e5-
|
|
10
|
+
* - Model selection (default: multilingual-e5-large)
|
|
11
11
|
* - Embedding dimensions
|
|
12
12
|
* - Cache directory configuration
|
|
13
13
|
*
|
|
@@ -31,8 +31,8 @@ const os_1 = __importDefault(require("os"));
|
|
|
31
31
|
const debug_logger_js_1 = require("./debug-logger.js");
|
|
32
32
|
// Default configuration
|
|
33
33
|
exports.DEFAULT_CONFIG = {
|
|
34
|
-
modelName: 'Xenova/multilingual-e5-
|
|
35
|
-
embeddingDim:
|
|
34
|
+
modelName: 'Xenova/multilingual-e5-large',
|
|
35
|
+
embeddingDim: 1024,
|
|
36
36
|
quantized: true,
|
|
37
37
|
cacheDir: path_1.default.join(os_1.default.homedir(), '.cache', 'huggingface', 'transformers'),
|
|
38
38
|
};
|
|
@@ -43,7 +43,7 @@ export declare abstract class DatabaseAdapter {
|
|
|
43
43
|
abstract transaction<T>(fn: () => T): T;
|
|
44
44
|
/**
|
|
45
45
|
* Vector similarity search
|
|
46
|
-
* @param embedding - Query embedding (
|
|
46
|
+
* @param embedding - Query embedding (1024-dim)
|
|
47
47
|
* @param limit - Max results
|
|
48
48
|
* @returns Search results with distance
|
|
49
49
|
*/
|
package/dist/db-manager.d.ts
CHANGED
|
@@ -156,7 +156,7 @@ export declare function listScopesForMemory(memoryId: string): Promise<Array<{
|
|
|
156
156
|
* Stores embedding in the embeddings table for vector similarity search
|
|
157
157
|
*
|
|
158
158
|
* @param decisionRowid - SQLite rowid
|
|
159
|
-
* @param embedding -
|
|
159
|
+
* @param embedding - 1024-dim embedding vector
|
|
160
160
|
*/
|
|
161
161
|
export declare function insertEmbedding(decisionRowid: number, embedding: Float32Array | number[]): Promise<void>;
|
|
162
162
|
/**
|
|
@@ -164,7 +164,7 @@ export declare function insertEmbedding(decisionRowid: number, embedding: Float3
|
|
|
164
164
|
*
|
|
165
165
|
* Returns empty array if vector search not available (no keyword fallback)
|
|
166
166
|
*
|
|
167
|
-
* @param queryEmbedding - Query embedding (
|
|
167
|
+
* @param queryEmbedding - Query embedding (1024-dim)
|
|
168
168
|
* @param limit - Max results to return (default: 5)
|
|
169
169
|
* @param threshold - Minimum similarity threshold (default: 0.7)
|
|
170
170
|
* @returns Array of decisions with similarity scores, or empty array
|
package/dist/db-manager.js
CHANGED
|
@@ -189,7 +189,7 @@ async function listScopesForMemory(memoryId) {
|
|
|
189
189
|
* Stores embedding in the embeddings table for vector similarity search
|
|
190
190
|
*
|
|
191
191
|
* @param decisionRowid - SQLite rowid
|
|
192
|
-
* @param embedding -
|
|
192
|
+
* @param embedding - 1024-dim embedding vector
|
|
193
193
|
*/
|
|
194
194
|
async function insertEmbedding(decisionRowid, embedding) {
|
|
195
195
|
const adapter = getAdapter();
|
|
@@ -207,7 +207,7 @@ async function insertEmbedding(decisionRowid, embedding) {
|
|
|
207
207
|
*
|
|
208
208
|
* Returns empty array if vector search not available (no keyword fallback)
|
|
209
209
|
*
|
|
210
|
-
* @param queryEmbedding - Query embedding (
|
|
210
|
+
* @param queryEmbedding - Query embedding (1024-dim)
|
|
211
211
|
* @param limit - Max results to return (default: 5)
|
|
212
212
|
* @param threshold - Minimum similarity threshold (default: 0.7)
|
|
213
213
|
* @returns Array of decisions with similarity scores, or empty array
|
package/dist/embeddings.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* MAMA (Memory-Augmented MCP Architecture) - Embedding Generation
|
|
3
3
|
*
|
|
4
4
|
* Story M1.4: Configurable embedding model selection
|
|
5
|
-
* Generates embeddings using configurable model (default: multilingual-e5-
|
|
5
|
+
* Generates embeddings using configurable model (default: multilingual-e5-large)
|
|
6
6
|
* Supports: Korean-English cross-lingual similarity, enhanced metadata
|
|
7
7
|
*
|
|
8
8
|
* @module embeddings
|
|
@@ -43,7 +43,7 @@ export declare function generateEmbedding(text: string): Promise<Float32Array>;
|
|
|
43
43
|
* Inspired by A-mem: Content + Metadata for richer semantic representation
|
|
44
44
|
*
|
|
45
45
|
* @param decision - Decision object
|
|
46
|
-
* @returns
|
|
46
|
+
* @returns 1024-dim enhanced embedding
|
|
47
47
|
*/
|
|
48
48
|
export declare function generateEnhancedEmbedding(decision: DecisionForEmbedding): Promise<Float32Array>;
|
|
49
49
|
/**
|
package/dist/embeddings.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* MAMA (Memory-Augmented MCP Architecture) - Embedding Generation
|
|
4
4
|
*
|
|
5
5
|
* Story M1.4: Configurable embedding model selection
|
|
6
|
-
* Generates embeddings using configurable model (default: multilingual-e5-
|
|
6
|
+
* Generates embeddings using configurable model (default: multilingual-e5-large)
|
|
7
7
|
* Supports: Korean-English cross-lingual similarity, enhanced metadata
|
|
8
8
|
*
|
|
9
9
|
* @module embeddings
|
|
@@ -142,7 +142,7 @@ async function generateEmbedding(text) {
|
|
|
142
142
|
* Inspired by A-mem: Content + Metadata for richer semantic representation
|
|
143
143
|
*
|
|
144
144
|
* @param decision - Decision object
|
|
145
|
-
* @returns
|
|
145
|
+
* @returns 1024-dim enhanced embedding
|
|
146
146
|
*/
|
|
147
147
|
async function generateEnhancedEmbedding(decision) {
|
|
148
148
|
// Construct enriched text representation with narrative fields (Story 2.2)
|
package/dist/memory/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const MEMORY_SCOPE_KINDS: readonly ["global", "user", "channel", "project"];
|
|
2
2
|
export type MemoryScopeKind = (typeof MEMORY_SCOPE_KINDS)[number];
|
|
3
|
-
export declare const MEMORY_KINDS: readonly ["decision", "preference", "constraint", "lesson", "fact"];
|
|
3
|
+
export declare const MEMORY_KINDS: readonly ["decision", "preference", "constraint", "lesson", "fact", "task", "schedule", "compiled"];
|
|
4
4
|
export type MemoryKind = (typeof MEMORY_KINDS)[number];
|
|
5
5
|
export declare const MEMORY_STATUSES: readonly ["active", "superseded", "contradicted", "stale"];
|
|
6
6
|
export type MemoryStatus = (typeof MEMORY_STATUSES)[number];
|
package/dist/memory/types.js
CHANGED
|
@@ -5,7 +5,16 @@ exports.createEmptyRecallBundle = createEmptyRecallBundle;
|
|
|
5
5
|
exports.createEmptyMemoryAgentBootstrap = createEmptyMemoryAgentBootstrap;
|
|
6
6
|
exports.createMemoryAuditAck = createMemoryAuditAck;
|
|
7
7
|
exports.MEMORY_SCOPE_KINDS = ['global', 'user', 'channel', 'project'];
|
|
8
|
-
exports.MEMORY_KINDS = [
|
|
8
|
+
exports.MEMORY_KINDS = [
|
|
9
|
+
'decision',
|
|
10
|
+
'preference',
|
|
11
|
+
'constraint',
|
|
12
|
+
'lesson',
|
|
13
|
+
'fact',
|
|
14
|
+
'task',
|
|
15
|
+
'schedule',
|
|
16
|
+
'compiled',
|
|
17
|
+
];
|
|
9
18
|
exports.MEMORY_STATUSES = ['active', 'superseded', 'contradicted', 'stale'];
|
|
10
19
|
exports.MEMORY_TRUTH_STATUSES = [
|
|
11
20
|
'active',
|