openclaw-memory-alibaba-local 1.0.8 → 1.0.10

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.
Files changed (2) hide show
  1. package/index.ts +22 -21
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -1343,7 +1343,7 @@ async function captureUserMemoryFromInboundTexts(
1343
1343
  if (action.action === "delete") {
1344
1344
  const hit = existingCandidates.find((c) => c.entry.id === action.memoryId);
1345
1345
  if (hit) {
1346
- await deleteSimilarLogicalMemory(db, agentId, sessionKey, hit);
1346
+ await deleteSimilarLogicalMemory(db, agentId, hit.entry.sessionId, hit);
1347
1347
  }
1348
1348
  continue;
1349
1349
  }
@@ -1351,7 +1351,7 @@ async function captureUserMemoryFromInboundTexts(
1351
1351
  if (action.action === "update") {
1352
1352
  const hit = existingCandidates.find((c) => c.entry.id === action.memoryId);
1353
1353
  if (hit) {
1354
- await deleteSimilarLogicalMemory(db, agentId, sessionKey, hit);
1354
+ await deleteSimilarLogicalMemory(db, agentId, hit.entry.sessionId, hit);
1355
1355
  }
1356
1356
  const { vectors } = await backend.encodeForStorage(action.text);
1357
1357
  const rows = buildChunkRows(
@@ -1447,7 +1447,7 @@ async function captureUserMemoryFromInboundTexts(
1447
1447
  if (action.action === "delete") {
1448
1448
  const hit = existingCandidates.find((c) => c.entry.id === action.memoryId);
1449
1449
  if (hit) {
1450
- await deleteSimilarLogicalMemory(db, agentId, sessionKey, hit);
1450
+ await deleteSimilarLogicalMemory(db, agentId, hit.entry.sessionId, hit);
1451
1451
  }
1452
1452
  continue;
1453
1453
  }
@@ -1455,7 +1455,7 @@ async function captureUserMemoryFromInboundTexts(
1455
1455
  if (action.action === "update") {
1456
1456
  const hit = existingCandidates.find((c) => c.entry.id === action.memoryId);
1457
1457
  if (hit) {
1458
- await deleteSimilarLogicalMemory(db, agentId, sessionKey, hit);
1458
+ await deleteSimilarLogicalMemory(db, agentId, hit.entry.sessionId, hit);
1459
1459
  }
1460
1460
  const { vectors } = await backend.encodeForStorage(action.text);
1461
1461
  const rows = buildChunkRows(
@@ -1597,13 +1597,11 @@ function buildChunkRows(
1597
1597
  async function deleteSimilarLogicalMemory(
1598
1598
  db: MemoryDB,
1599
1599
  agentId: string,
1600
- sessionId: string | null | undefined,
1600
+ _sessionId: string | null | undefined,
1601
1601
  hit: MemorySearchResult,
1602
1602
  ): Promise<void> {
1603
- const n = await db.deleteByAgentSessionCategoryText(agentId, sessionId, hit.entry.category, hit.entry.text);
1604
- if (n === 0) {
1605
- await db.delete(agentId, hit.entry.id);
1606
- }
1603
+ console.log(`[openclaw-memory-alibaba-local] deleteSimilarLogicalMemory id=${hit.entry.id} agentId=${agentId} text=${hit.entry.text.slice(0, 60)}`);
1604
+ await db.delete(agentId, hit.entry.id);
1607
1605
  }
1608
1606
 
1609
1607
  async function storeOneCaptureItem(
@@ -2177,19 +2175,22 @@ const memoryPlugin = {
2177
2175
  const isUserTrigger = trigger === "user";
2178
2176
 
2179
2177
  // Skip memory extraction for system/bootstrap sessions (/new, /reset).
2180
- // Check the last user message for known bootstrap patterns.
2178
+ // Check ANY user message for known bootstrap patterns (not just last).
2181
2179
  if (isUserTrigger) {
2182
- const lastUserMsg = [...event.messages].reverse().find(
2183
- (m: any) => m && typeof m === "object" && (m as Record<string, unknown>).role === "user",
2184
- ) as Record<string, unknown> | undefined;
2185
- const lastUserText = typeof lastUserMsg?.content === "string" ? lastUserMsg.content.toLowerCase() : "";
2186
- if (
2187
- lastUserText.includes("a new session was started") ||
2188
- lastUserText.includes("session startup sequence") ||
2189
- lastUserText.includes("/new or /reset") ||
2190
- lastUserText.startsWith("system:") ||
2191
- lastUserText.startsWith("run your session")
2192
- ) {
2180
+ const isBootstrapSession = event.messages.some((m: any) => {
2181
+ if (!m || typeof m !== "object" || (m as Record<string, unknown>).role !== "user") return false;
2182
+ const text = typeof (m as Record<string, unknown>).content === "string"
2183
+ ? ((m as Record<string, unknown>).content as string).toLowerCase()
2184
+ : "";
2185
+ return (
2186
+ text.includes("a new session was started") ||
2187
+ text.includes("session startup sequence") ||
2188
+ text.includes("/new or /reset") ||
2189
+ text.startsWith("system:") ||
2190
+ text.startsWith("run your session")
2191
+ );
2192
+ });
2193
+ if (isBootstrapSession) {
2193
2194
  console.log("[openclaw-memory-alibaba-local] agent_end skip capture (system/bootstrap session)");
2194
2195
  return;
2195
2196
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-memory-alibaba-local",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "OpenClaw memory plugin: local LanceDB + DashScope-compatible embeddings",
5
5
  "type": "module",
6
6
  "engines": {