openclaw-memory-alibaba-local 1.0.12 → 1.0.13
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.ts +13 -1
- package/index.ts +10 -0
- package/package.json +1 -1
package/db.ts
CHANGED
|
@@ -1306,9 +1306,21 @@ export class MemoryDB {
|
|
|
1306
1306
|
throw new Error(`Invalid memory ID format: ${id}`);
|
|
1307
1307
|
}
|
|
1308
1308
|
await this.ensureInitialized();
|
|
1309
|
+
await this.refreshToLatest();
|
|
1309
1310
|
const pred = `id = '${sqlEscapeLiteral(id)}' AND agentId = '${sqlEscapeLiteral(agentId)}'`;
|
|
1311
|
+
// Verify row exists before delete
|
|
1312
|
+
const before = await this.table!.countRows(pred);
|
|
1310
1313
|
await this.table!.delete(pred);
|
|
1311
|
-
|
|
1314
|
+
await this.refreshToLatest();
|
|
1315
|
+
const after = await this.table!.countRows(pred);
|
|
1316
|
+
if (before > 0 && after === 0) {
|
|
1317
|
+
console.log(`[openclaw-memory-alibaba-local] db.delete OK id=${id} (${before} row(s) removed)`);
|
|
1318
|
+
} else if (before === 0) {
|
|
1319
|
+
console.warn(`[openclaw-memory-alibaba-local] db.delete MISS id=${id} (row not found before delete)`);
|
|
1320
|
+
} else {
|
|
1321
|
+
console.warn(`[openclaw-memory-alibaba-local] db.delete FAIL id=${id} (before=${before} after=${after})`);
|
|
1322
|
+
}
|
|
1323
|
+
return before > 0 && after === 0;
|
|
1312
1324
|
}
|
|
1313
1325
|
|
|
1314
1326
|
async close(): Promise<void> {
|
package/index.ts
CHANGED
|
@@ -2209,6 +2209,16 @@ const memoryPlugin = {
|
|
|
2209
2209
|
});
|
|
2210
2210
|
if (isBootstrapSession) {
|
|
2211
2211
|
console.log("[openclaw-memory-alibaba-local] agent_end skip capture (system/bootstrap session)");
|
|
2212
|
+
// Advance cursor past bootstrap messages so the next agent_end won't re-process them.
|
|
2213
|
+
try {
|
|
2214
|
+
const storageSessionKey = resolveStorageSessionKey(ctx);
|
|
2215
|
+
if (storageSessionKey) {
|
|
2216
|
+
const agentId = resolveAgentIdForMemory(ctx);
|
|
2217
|
+
await runAgentEndCapture(cfg, db, backend, agentId, storageSessionKey, null, event.messages, resolvedDbPath, /* cursorOnly */ true);
|
|
2218
|
+
}
|
|
2219
|
+
} catch (e) {
|
|
2220
|
+
console.warn("[openclaw-memory-alibaba-local] agent_end bootstrap cursor advance failed:", String(e));
|
|
2221
|
+
}
|
|
2212
2222
|
return;
|
|
2213
2223
|
}
|
|
2214
2224
|
}
|