@memtensor/memos-local-openclaw-plugin 1.0.4-beta.19 → 1.0.4-beta.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memtensor/memos-local-openclaw-plugin",
3
- "version": "1.0.4-beta.19",
3
+ "version": "1.0.4-beta.20",
4
4
  "description": "MemOS Local memory plugin for OpenClaw — full-write, hybrid-recall, progressive retrieval",
5
5
  "type": "module",
6
6
  "main": "index.ts",
package/src/hub/server.ts CHANGED
@@ -950,7 +950,18 @@ export class HubServer {
950
950
  const deleted = this.opts.store.deleteHubMemoryById(memoryId);
951
951
  if (!deleted) return this.json(res, 404, { error: "not_found" });
952
952
  if (memInfo) {
953
- this.opts.store.insertHubNotification({ id: randomUUID(), userId: memInfo.sourceUserId, type: "resource_removed", resource: "memory", title: memInfo.summary || memInfo.id });
953
+ const payload = JSON.stringify({
954
+ memoryId,
955
+ sourceChunkId: memInfo.sourceChunkId,
956
+ });
957
+ this.opts.store.insertHubNotification({
958
+ id: randomUUID(),
959
+ userId: memInfo.sourceUserId,
960
+ type: "resource_removed",
961
+ resource: "memory",
962
+ title: memInfo.summary || memInfo.id,
963
+ message: payload,
964
+ });
954
965
  }
955
966
  return this.json(res, 200, { ok: true });
956
967
  }
@@ -7419,6 +7419,9 @@ function connectNotifSSE(){
7419
7419
  _notifUnread=d.unreadCount||0;
7420
7420
  renderNotifBadge();
7421
7421
  if(_notifUnread>prev&&_notifPanelOpen) loadNotifications();
7422
+ if(_notifUnread>prev&&_activeView==='memories'&&memorySearchScope!=='hub'){
7423
+ syncTeamShareRemovedFromNotifications().then(function(){ loadMemories(currentPage,true); });
7424
+ }
7422
7425
  }
7423
7426
  if(d.type==='cleared'){
7424
7427
  _notifUnread=0;_notifCache=[];
@@ -7764,11 +7767,31 @@ function getFilterParams(){
7764
7767
  return p;
7765
7768
  }
7766
7769
 
7770
+ /** Hub admin removed a shared memory — badge-only: clear team_shared_chunks (never touches chunks/embeddings/hub_memories recall data). */
7771
+ async function syncTeamShareRemovedFromNotifications(){
7772
+ try{
7773
+ var r=await fetch('/api/sharing/notifications');
7774
+ var d=await r.json();
7775
+ var list=d.notifications||[];
7776
+ for(var i=0;i<list.length;i++){
7777
+ var n=list[i];
7778
+ if(n.type!=='resource_removed'||n.resource!=='memory'||!n.message) continue;
7779
+ try{
7780
+ var meta=JSON.parse(n.message);
7781
+ if(meta.sourceChunkId){
7782
+ await fetch('/api/sharing/sync-hub-removal',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({sourceChunkId:meta.sourceChunkId})});
7783
+ }
7784
+ }catch(e){}
7785
+ }
7786
+ }catch(e){}
7787
+ }
7788
+
7767
7789
  async function loadMemories(page,silent){
7768
7790
  if(page) currentPage=page;
7769
7791
  const list=document.getElementById('memoryList');
7770
7792
  if(!silent) list.innerHTML='<div class="spinner"></div>';
7771
7793
  try{
7794
+ if(!silent) await syncTeamShareRemovedFromNotifications();
7772
7795
  const p=getFilterParams();
7773
7796
  p.set('limit',PAGE_SIZE);
7774
7797
  p.set('page',currentPage);
@@ -309,6 +309,7 @@ export class ViewerServer {
309
309
  else if (p === "/api/sharing/notifications" && req.method === "GET") this.serveSharingNotifications(res, url);
310
310
  else if (p === "/api/sharing/notifications/read" && req.method === "POST") this.handleSharingNotificationsRead(req, res);
311
311
  else if (p === "/api/sharing/notifications/clear" && req.method === "POST") this.handleSharingNotificationsClear(req, res);
312
+ else if (p === "/api/sharing/sync-hub-removal" && req.method === "POST") this.handleSyncHubRemoval(req, res);
312
313
  else if (p === "/api/notifications/stream" && req.method === "GET") this.handleNotifSSE(req, res);
313
314
  else if (p === "/api/admin/shared-tasks" && req.method === "GET") this.serveAdminSharedTasks(res);
314
315
  else if (p.match(/^\/api\/admin\/shared-tasks\/[^/]+\/detail$/) && req.method === "GET") this.serveHubTaskDetail(res, p);
@@ -2481,6 +2482,21 @@ export class ViewerServer {
2481
2482
  });
2482
2483
  }
2483
2484
 
2485
+ /** Badge-only: clear Client team-share UI metadata when Hub admin removes that memory. Does NOT touch chunks, embeddings, or hub_memories (recall paths). */
2486
+ private handleSyncHubRemoval(req: http.IncomingMessage, res: http.ServerResponse): void {
2487
+ this.readBody(req, (body) => {
2488
+ try {
2489
+ const parsed = JSON.parse(body || "{}");
2490
+ const sourceChunkId = String(parsed.sourceChunkId || "");
2491
+ if (!sourceChunkId) return this.jsonResponse(res, { ok: false, error: "missing_source_chunk_id" }, 400);
2492
+ this.store.deleteTeamSharedChunk(sourceChunkId);
2493
+ this.jsonResponse(res, { ok: true, sourceChunkId });
2494
+ } catch (e) {
2495
+ this.jsonResponse(res, { ok: false, error: String(e) }, 500);
2496
+ }
2497
+ });
2498
+ }
2499
+
2484
2500
  private handleNotifSSE(req: http.IncomingMessage, res: http.ServerResponse): void {
2485
2501
  res.writeHead(200, {
2486
2502
  "Content-Type": "text/event-stream",