@aletheia-labs/store-sqlite 0.1.0

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.
@@ -0,0 +1,76 @@
1
+ /**
2
+ * SQLite-backed MemoryStore.
3
+ *
4
+ * Enforces:
5
+ * - Atoms inserted exactly once (UNIQUE memory_id).
6
+ * - Status transitions go through `transitionStatus` only — no UPDATE path
7
+ * for `content`, `scope`, `visibility`, `scores`, or `links`.
8
+ * - Allowed transitions come from `isAllowedTransition` in core.
9
+ * - Every transition is recorded in `memory_status_history`.
10
+ */
11
+ import { type IsoTimestamp, type MemoryAtom, type MemoryId, type MemoryQuery, type MemoryStatus, type MemoryStore, type StatusTransitionOptions, type StatusTransitionReason, type StatusTransitionResult, type Visibility } from '@aletheia-labs/core';
12
+ import type Database from 'better-sqlite3';
13
+ export declare class SqliteMemoryStore implements MemoryStore {
14
+ private readonly db;
15
+ private readonly insertAtom;
16
+ private readonly getAtom;
17
+ private readonly updateStatus;
18
+ private readonly insertHistory;
19
+ private readonly historyQuery;
20
+ /**
21
+ * Create a MemoryStore backed by an existing `better-sqlite3` connection.
22
+ *
23
+ * @remarks
24
+ * Direct construction is for custom composition roots. Most hosts should use
25
+ * `openSqliteStores()` so all stores share the same migrated connection.
26
+ */
27
+ constructor(db: Database.Database);
28
+ /**
29
+ * Insert an immutable memory atom and record its initial status history.
30
+ *
31
+ * @remarks
32
+ * The method zod-validates the atom before writing, then uses a transaction
33
+ * to insert both `memory_atoms` and the initial `memory_status_history` row.
34
+ * Duplicate memory IDs throw because content updates must use successor atoms.
35
+ */
36
+ insert(atom: MemoryAtom): Promise<MemoryAtom>;
37
+ /**
38
+ * Retrieve one visible atom by ID.
39
+ *
40
+ * @remarks
41
+ * Hidden and missing atoms both return `null`; this avoids leaking existence
42
+ * across visibility boundaries.
43
+ */
44
+ get(memoryId: MemoryId, permittedVisibilities: readonly Visibility[]): Promise<MemoryAtom | null>;
45
+ /**
46
+ * Query visible atoms with optional status, scope, validity, and limit filters.
47
+ *
48
+ * @remarks
49
+ * Permission filtering is the first SQL predicate. `validAt` is opt-in so
50
+ * lifecycle scanners can intentionally see expired atoms for deprecation.
51
+ */
52
+ query(filter: MemoryQuery): Promise<readonly MemoryAtom[]>;
53
+ /**
54
+ * Transition an atom through the allowed status matrix and audit the change.
55
+ *
56
+ * @remarks
57
+ * This is the only UPDATE path in the store. It changes `status` only and
58
+ * records the logical transition timestamp plus actor/rationale in
59
+ * `memory_status_history`.
60
+ */
61
+ transitionStatus(memoryId: MemoryId, nextStatus: MemoryStatus, reason: StatusTransitionReason, options?: StatusTransitionOptions): Promise<StatusTransitionResult>;
62
+ /**
63
+ * Return the audited status timeline for one atom.
64
+ *
65
+ * @remarks
66
+ * Consumers use this for Phase 2 dynamics, episodic historical snapshots, and
67
+ * operator audit views. The first row has `fromStatus: null` for insertion.
68
+ */
69
+ statusHistory(memoryId: MemoryId): Promise<readonly {
70
+ at: IsoTimestamp;
71
+ fromStatus: MemoryStatus | null;
72
+ toStatus: MemoryStatus;
73
+ reason: StatusTransitionReason;
74
+ }[]>;
75
+ }
76
+ //# sourceMappingURL=sqlite-memory-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite-memory-store.d.ts","sourceRoot":"","sources":["../src/sqlite-memory-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,UAAU,EAEf,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EAGhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAY3C,qBAAa,iBAAkB,YAAW,WAAW;IAcvC,OAAO,CAAC,QAAQ,CAAC,EAAE;IAb/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;IAChD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;IACvD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;IAClD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA+B;IAE5D;;;;;;OAMG;gBAC0B,EAAE,EAAE,QAAQ,CAAC,QAAQ;IAgClD;;;;;;;OAOG;IACG,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IA8BnD;;;;;;OAMG;IACG,GAAG,CACP,QAAQ,EAAE,QAAQ,EAClB,qBAAqB,EAAE,SAAS,UAAU,EAAE,GAC3C,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAW7B;;;;;;OAMG;IACG,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC;IAmChE;;;;;;;OAOG;IACG,gBAAgB,CACpB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,YAAY,EACxB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,sBAAsB,CAAC;IAqClC;;;;;;OAMG;IACG,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAC9C,SAAS;QACP,EAAE,EAAE,YAAY,CAAC;QACjB,UAAU,EAAE,YAAY,GAAG,IAAI,CAAC;QAChC,QAAQ,EAAE,YAAY,CAAC;QACvB,MAAM,EAAE,sBAAsB,CAAC;KAChC,EAAE,CACJ;CAaF"}
@@ -0,0 +1,189 @@
1
+ /**
2
+ * SQLite-backed MemoryStore.
3
+ *
4
+ * Enforces:
5
+ * - Atoms inserted exactly once (UNIQUE memory_id).
6
+ * - Status transitions go through `transitionStatus` only — no UPDATE path
7
+ * for `content`, `scope`, `visibility`, `scores`, or `links`.
8
+ * - Allowed transitions come from `isAllowedTransition` in core.
9
+ * - Every transition is recorded in `memory_status_history`.
10
+ */
11
+ import { IsoTimestampSchema, MemoryAtomSchema, isAllowedTransition, scopeKey, } from '@aletheia-labs/core';
12
+ import { atomToRow, permittedClause, rowToAtom } from './codec.js';
13
+ export class SqliteMemoryStore {
14
+ db;
15
+ insertAtom;
16
+ getAtom;
17
+ updateStatus;
18
+ insertHistory;
19
+ historyQuery;
20
+ /**
21
+ * Create a MemoryStore backed by an existing `better-sqlite3` connection.
22
+ *
23
+ * @remarks
24
+ * Direct construction is for custom composition roots. Most hosts should use
25
+ * `openSqliteStores()` so all stores share the same migrated connection.
26
+ */
27
+ constructor(db) {
28
+ this.db = db;
29
+ this.insertAtom = db.prepare(`
30
+ INSERT INTO memory_atoms (
31
+ memory_id, memory_type, content, source_agent_id,
32
+ source_event_ids_json, source_memory_ids_json,
33
+ scope_json, visibility_json, status, scores_json,
34
+ valid_from, valid_until, last_confirmed_at, links_json,
35
+ scope_key, visibility_key, inserted_at
36
+ ) VALUES (
37
+ @memory_id, @memory_type, @content, @source_agent_id,
38
+ @source_event_ids_json, @source_memory_ids_json,
39
+ @scope_json, @visibility_json, @status, @scores_json,
40
+ @valid_from, @valid_until, @last_confirmed_at, @links_json,
41
+ @scope_key, @visibility_key, @inserted_at
42
+ )
43
+ `);
44
+ this.getAtom = db.prepare('SELECT * FROM memory_atoms WHERE memory_id = ?');
45
+ this.updateStatus = db.prepare('UPDATE memory_atoms SET status = ? WHERE memory_id = ?');
46
+ this.insertHistory = db.prepare(`
47
+ INSERT INTO memory_status_history (
48
+ memory_id, from_status, to_status, rationale, actor, conflict_id, at
49
+ ) VALUES (?, ?, ?, ?, ?, ?, ?)
50
+ `);
51
+ this.historyQuery = db.prepare('SELECT * FROM memory_status_history WHERE memory_id = ? ORDER BY at ASC, id ASC');
52
+ }
53
+ /**
54
+ * Insert an immutable memory atom and record its initial status history.
55
+ *
56
+ * @remarks
57
+ * The method zod-validates the atom before writing, then uses a transaction
58
+ * to insert both `memory_atoms` and the initial `memory_status_history` row.
59
+ * Duplicate memory IDs throw because content updates must use successor atoms.
60
+ */
61
+ async insert(atom) {
62
+ const validated = MemoryAtomSchema.parse(atom);
63
+ const now = new Date().toISOString();
64
+ const row = atomToRow(validated, now);
65
+ const tx = this.db.transaction(() => {
66
+ try {
67
+ this.insertAtom.run(row);
68
+ }
69
+ catch (err) {
70
+ if (err instanceof Error && err.message.includes('UNIQUE')) {
71
+ throw new Error(`MemoryStore.insert: duplicate memory_id "${row.memory_id}"`);
72
+ }
73
+ throw err;
74
+ }
75
+ // Record the initial status with from_status=null.
76
+ this.insertHistory.run(row.memory_id, null, row.status, 'initial insertion', row.source_agent_id, null, now);
77
+ });
78
+ tx();
79
+ return validated;
80
+ }
81
+ /**
82
+ * Retrieve one visible atom by ID.
83
+ *
84
+ * @remarks
85
+ * Hidden and missing atoms both return `null`; this avoids leaking existence
86
+ * across visibility boundaries.
87
+ */
88
+ async get(memoryId, permittedVisibilities) {
89
+ const row = this.getAtom.get(memoryId);
90
+ if (!row)
91
+ return null;
92
+ const allowed = permittedClause(permittedVisibilities);
93
+ if (allowed.params.length === 0 || !allowed.params.includes(row.visibility_key)) {
94
+ return null;
95
+ }
96
+ return rowToAtom(row);
97
+ }
98
+ /**
99
+ * Query visible atoms with optional status, scope, validity, and limit filters.
100
+ *
101
+ * @remarks
102
+ * Permission filtering is the first SQL predicate. `validAt` is opt-in so
103
+ * lifecycle scanners can intentionally see expired atoms for deprecation.
104
+ */
105
+ async query(filter) {
106
+ const where = [];
107
+ const params = [];
108
+ // Permission first.
109
+ const allowed = permittedClause(filter.permittedVisibilities);
110
+ where.push(allowed.clause);
111
+ params.push(...allowed.params);
112
+ if (filter.statuses !== undefined && filter.statuses.length > 0) {
113
+ where.push(`status IN (${filter.statuses.map(() => '?').join(', ')})`);
114
+ params.push(...filter.statuses);
115
+ }
116
+ if (filter.scope !== undefined) {
117
+ where.push('scope_key = ?');
118
+ params.push(scopeKey(filter.scope));
119
+ }
120
+ if (filter.validAt !== undefined) {
121
+ where.push('valid_from <= ?');
122
+ params.push(filter.validAt);
123
+ where.push('(valid_until IS NULL OR valid_until >= ?)');
124
+ params.push(filter.validAt);
125
+ }
126
+ const limitClause = filter.limit !== undefined ? `LIMIT ${Math.floor(filter.limit)}` : '';
127
+ const sql = `
128
+ SELECT * FROM memory_atoms
129
+ WHERE ${where.join(' AND ')}
130
+ ORDER BY valid_from DESC, memory_id ASC
131
+ ${limitClause}
132
+ `;
133
+ const rows = this.db.prepare(sql).all(...params);
134
+ return rows.map(rowToAtom);
135
+ }
136
+ /**
137
+ * Transition an atom through the allowed status matrix and audit the change.
138
+ *
139
+ * @remarks
140
+ * This is the only UPDATE path in the store. It changes `status` only and
141
+ * records the logical transition timestamp plus actor/rationale in
142
+ * `memory_status_history`.
143
+ */
144
+ async transitionStatus(memoryId, nextStatus, reason, options) {
145
+ const row = this.getAtom.get(memoryId);
146
+ if (!row) {
147
+ return { kind: 'rejected', reason: `memory_id "${memoryId}" not found` };
148
+ }
149
+ const current = row.status;
150
+ if (current === nextStatus) {
151
+ return { kind: 'rejected', reason: `already in status "${current}"` };
152
+ }
153
+ if (!isAllowedTransition(current, nextStatus)) {
154
+ return {
155
+ kind: 'rejected',
156
+ reason: `transition not allowed: ${current} → ${nextStatus}`,
157
+ };
158
+ }
159
+ const now = options?.at !== undefined ? IsoTimestampSchema.parse(options.at) : new Date().toISOString();
160
+ const tx = this.db.transaction(() => {
161
+ this.updateStatus.run(nextStatus, memoryId);
162
+ this.insertHistory.run(memoryId, current, nextStatus, reason.rationale, reason.actor, reason.conflictId ?? null, now);
163
+ });
164
+ tx();
165
+ const updated = this.getAtom.get(memoryId);
166
+ return { kind: 'applied', atom: rowToAtom(updated) };
167
+ }
168
+ /**
169
+ * Return the audited status timeline for one atom.
170
+ *
171
+ * @remarks
172
+ * Consumers use this for Phase 2 dynamics, episodic historical snapshots, and
173
+ * operator audit views. The first row has `fromStatus: null` for insertion.
174
+ */
175
+ async statusHistory(memoryId) {
176
+ const rows = this.historyQuery.all(memoryId);
177
+ return rows.map((r) => ({
178
+ at: r.at,
179
+ fromStatus: r.from_status,
180
+ toStatus: r.to_status,
181
+ reason: {
182
+ rationale: r.rationale,
183
+ actor: r.actor,
184
+ ...(r.conflict_id !== null ? { conflictId: r.conflict_id } : {}),
185
+ },
186
+ }));
187
+ }
188
+ }
189
+ //# sourceMappingURL=sqlite-memory-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite-memory-store.js","sourceRoot":"","sources":["../src/sqlite-memory-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAGL,kBAAkB,EAElB,gBAAgB,EAShB,mBAAmB,EACnB,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAgB,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAWjF,MAAM,OAAO,iBAAiB;IAcC;IAbZ,UAAU,CAAqB;IAC/B,OAAO,CAA+B;IACtC,YAAY,CAAqB;IACjC,aAAa,CAAqB;IAClC,YAAY,CAA+B;IAE5D;;;;;;OAMG;IACH,YAA6B,EAAqB;QAArB,OAAE,GAAF,EAAE,CAAmB;QAChD,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC,OAAO,CAAC;;;;;;;;;;;;;;KAc5B,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,OAAO,CAAoB,gDAAgD,CAAC,CAAC;QAE/F,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,OAAO,CAAC,wDAAwD,CAAC,CAAC;QAEzF,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC,OAAO,CAAC;;;;KAI/B,CAAC,CAAC;QAEH,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,OAAO,CAC5B,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,MAAM,CAAC,IAAgB;QAC3B,MAAM,SAAS,GAAG,gBAAgB,CAAC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CAAC;IACN,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@aletheia-labs/store-sqlite",
3
+ "version": "0.1.0",
4
+ "description": "SQLite-backed implementations of @aletheia-labs/core storage interfaces.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "dependencies": {
22
+ "better-sqlite3": "^11.5.0",
23
+ "zod": "^3.23.8",
24
+ "@aletheia-labs/core": "0.1.0"
25
+ },
26
+ "devDependencies": {
27
+ "@types/better-sqlite3": "^7.6.12",
28
+ "@types/node": "^22.10.0",
29
+ "typescript": "^5.6.3",
30
+ "vitest": "^2.1.8"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "keywords": [
36
+ "aletheia",
37
+ "llm",
38
+ "memory",
39
+ "sqlite",
40
+ "agents"
41
+ ],
42
+ "scripts": {
43
+ "build": "tsc -p tsconfig.json",
44
+ "typecheck": "tsc -p tsconfig.json --noEmit",
45
+ "test": "vitest run",
46
+ "test:watch": "vitest"
47
+ }
48
+ }