fix: resolve smoke test failures

- Fixed memory backend API: getAll() now includes all memory types (lesson, gotcha, pattern, preference, discovery, context, ephemeral)
- Fixed memory test assertions: use MEMORY_TYPES.LESSON instead of undefined FACT, await retrieve() calls
- Added getAll() method to JSONBackend for grouped memory access
- Fixed InMemoryBackend to support all memory types in getAll()
- Fixed smoke test to properly await async methods and check correct properties
This commit is contained in:
admin
2026-05-06 09:55:48 +00:00
Unverified
parent dcd01da1b1
commit 416dedb94b
5 changed files with 277 additions and 18 deletions

View File

@@ -157,7 +157,7 @@ export class JSONBackend {
return scored.slice(0, limit).map(s => s.entry);
}
async delete(id) {
async delete(id) {
this._entries.delete(id);
this._markDirty();
}
@@ -170,11 +170,26 @@ export class JSONBackend {
}
async flush() {
if (this._saveTimer) {
clearTimeout(this._saveTimer);
this._saveTimer = null;
clearTimeout(this._saveTimer);
await this._save();
}
getAll() {
// Group entries by type
const grouped = {
lesson: [], gotcha: [], pattern: [], preference: [], discovery: [], context: [],
ephemeral: [], skill: [], conversation: [], error: []
};
for (const entry of this._entries.values()) {
if (grouped[entry.type]) {
grouped[entry.type].push(entry);
}
}
if (!this._dirty) return;
return grouped;
}
async flush() {
clearTimeout(this._saveTimer);
await this._save();
}