@contextableai/openclaw-memory-rebac 0.1.3 → 0.1.4

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/dist/backend.d.ts CHANGED
@@ -117,7 +117,7 @@ export interface MemoryBackend {
117
117
  * Optional: not all backends support sub-dataset deletion.
118
118
  * Returns true if deleted, false if the backend doesn't support it.
119
119
  */
120
- deleteFragment?(uuid: string): Promise<boolean>;
120
+ deleteFragment?(uuid: string, type?: string): Promise<boolean>;
121
121
  /**
122
122
  * Discover fragment (fact/edge) UUIDs that were extracted from a stored episode.
123
123
  * Called after store() resolves the episode ID to write per-fragment SpiceDB
@@ -61,7 +61,7 @@ export declare class GraphitiBackend implements MemoryBackend {
61
61
  getStatus(): Promise<Record<string, unknown>>;
62
62
  deleteGroup(groupId: string): Promise<void>;
63
63
  listGroups(): Promise<BackendDataset[]>;
64
- deleteFragment(uuid: string): Promise<boolean>;
64
+ deleteFragment(uuid: string, type?: string): Promise<boolean>;
65
65
  getEpisodes(groupId: string, lastN: number): Promise<GraphitiEpisode[]>;
66
66
  discoverFragmentIds(episodeId: string): Promise<string[]>;
67
67
  getEntityEdge(uuid: string): Promise<FactResult>;
@@ -146,8 +146,11 @@ export class GraphitiBackend {
146
146
  // Graphiti has no list-groups API; the CLI can query SpiceDB for this
147
147
  return [];
148
148
  }
149
- async deleteFragment(uuid) {
150
- await this.restCall("DELETE", `/episode/${encodeURIComponent(uuid)}`);
149
+ async deleteFragment(uuid, type) {
150
+ const path = type === "fact"
151
+ ? `/entity-edge/${encodeURIComponent(uuid)}`
152
+ : `/episode/${encodeURIComponent(uuid)}`;
153
+ await this.restCall("DELETE", path);
151
154
  return true;
152
155
  }
153
156
  // --------------------------------------------------------------------------
package/dist/index.js CHANGED
@@ -283,6 +283,7 @@ const rebacMemoryPlugin = {
283
283
  // Parse optional type prefix — strip it to get the bare UUID
284
284
  const colonIdx = id.indexOf(":");
285
285
  let uuid;
286
+ let fragmentType;
286
287
  if (colonIdx > 0 && colonIdx < 10) {
287
288
  const prefix = id.slice(0, colonIdx);
288
289
  // "entity" type cannot be deleted this way (graph-backend specific)
@@ -292,6 +293,7 @@ const rebacMemoryPlugin = {
292
293
  details: { action: "error", id },
293
294
  };
294
295
  }
296
+ fragmentType = prefix;
295
297
  uuid = id.slice(colonIdx + 1);
296
298
  }
297
299
  else {
@@ -323,7 +325,7 @@ const rebacMemoryPlugin = {
323
325
  // Attempt backend deletion (optional — not all backends support it)
324
326
  if (backend.deleteFragment) {
325
327
  try {
326
- await backend.deleteFragment(uuid);
328
+ await backend.deleteFragment(uuid, fragmentType);
327
329
  }
328
330
  catch (err) {
329
331
  api.logger.warn(`openclaw-memory-rebac: backend deletion failed for ${uuid}: ${err}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextableai/openclaw-memory-rebac",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "OpenClaw two-layer memory plugin: SpiceDB ReBAC authorization + Graphiti knowledge graph",
5
5
  "type": "module",
6
6
  "license": "MIT",