pi-hermes-memory 0.6.5 → 0.6.6
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/docs/0.6/CHANGELOG.md +25 -0
- package/package.json +1 -1
- package/src/store/db.ts +43 -1
package/docs/0.6/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
# v0.6.6 Changelog
|
|
2
|
+
|
|
3
|
+
## Bug Fixes
|
|
4
|
+
|
|
5
|
+
### Fix legacy SQLite upgrade error: `no such column: category`
|
|
6
|
+
|
|
7
|
+
Some users upgrading from older versions had an existing `sessions.db` with a legacy
|
|
8
|
+
`memories` table that did not include v0.6 failure-memory columns. During schema init,
|
|
9
|
+
creating `idx_memories_category` failed and `/memory-index-sessions` crashed with:
|
|
10
|
+
|
|
11
|
+
`❌ Session indexing failed: no such column: category`
|
|
12
|
+
|
|
13
|
+
Fix:
|
|
14
|
+
|
|
15
|
+
- Added automatic legacy schema migration in `DatabaseManager`
|
|
16
|
+
- Detects missing `memories` columns and adds them idempotently:
|
|
17
|
+
- `category`
|
|
18
|
+
- `failure_reason`
|
|
19
|
+
- `tool_state`
|
|
20
|
+
- `corrected_to`
|
|
21
|
+
- Retries schema initialization after migration
|
|
22
|
+
- Added regression test: `should migrate legacy memories table without category column`
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
1
26
|
# v0.6.5 Changelog
|
|
2
27
|
|
|
3
28
|
## Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-hermes-memory",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "🧠 Persistent memory + 🔍 session search + 🛡️ secret scanning for Pi. SQLite FTS5 search across every conversation, auto-consolidation, memory aging, procedural skills. 272 tests. Ported from Hermes agent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
package/src/store/db.ts
CHANGED
|
@@ -38,11 +38,53 @@ export class DatabaseManager {
|
|
|
38
38
|
db.pragma('foreign_keys = ON');
|
|
39
39
|
|
|
40
40
|
// Create tables and triggers
|
|
41
|
-
|
|
41
|
+
try {
|
|
42
|
+
db.exec(SCHEMA_SQL);
|
|
43
|
+
} catch (err) {
|
|
44
|
+
if (!this.isLegacyMemoriesCategoryError(err)) {
|
|
45
|
+
throw err;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Legacy DB from pre-v0.6 can have memories table without the category
|
|
49
|
+
// and failure metadata columns. Add missing columns, then retry schema.
|
|
50
|
+
this.ensureMemoriesColumns(db);
|
|
51
|
+
db.exec(SCHEMA_SQL);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Extra safety: always ensure the legacy memories columns exist, even when
|
|
55
|
+
// schema execution succeeds (idempotent on upgraded DBs).
|
|
56
|
+
this.ensureMemoriesColumns(db);
|
|
42
57
|
|
|
43
58
|
return db;
|
|
44
59
|
}
|
|
45
60
|
|
|
61
|
+
private isLegacyMemoriesCategoryError(err: unknown): boolean {
|
|
62
|
+
if (!(err instanceof Error)) return false;
|
|
63
|
+
const msg = err.message.toLowerCase();
|
|
64
|
+
return msg.includes('no such column: category') || msg.includes('memories(category)');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private ensureMemoriesColumns(db: Database.Database): void {
|
|
68
|
+
const tableExists = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='memories'").get() as { name: string } | undefined;
|
|
69
|
+
if (!tableExists) return;
|
|
70
|
+
|
|
71
|
+
const columns = db.prepare('PRAGMA table_info(memories)').all() as { name: string }[];
|
|
72
|
+
const names = new Set(columns.map((c) => c.name));
|
|
73
|
+
|
|
74
|
+
if (!names.has('category')) {
|
|
75
|
+
db.exec('ALTER TABLE memories ADD COLUMN category TEXT');
|
|
76
|
+
}
|
|
77
|
+
if (!names.has('failure_reason')) {
|
|
78
|
+
db.exec('ALTER TABLE memories ADD COLUMN failure_reason TEXT');
|
|
79
|
+
}
|
|
80
|
+
if (!names.has('tool_state')) {
|
|
81
|
+
db.exec('ALTER TABLE memories ADD COLUMN tool_state TEXT');
|
|
82
|
+
}
|
|
83
|
+
if (!names.has('corrected_to')) {
|
|
84
|
+
db.exec('ALTER TABLE memories ADD COLUMN corrected_to TEXT');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
46
88
|
/**
|
|
47
89
|
* Close the database connection.
|
|
48
90
|
*/
|