@contextableai/openclaw-memory-rebac 0.3.1 → 0.3.2
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/cli.js +23 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -70,31 +70,42 @@ export function registerCommands(cmd, ctx) {
|
|
|
70
70
|
limit: parseInt(opts.limit),
|
|
71
71
|
})
|
|
72
72
|
: [];
|
|
73
|
-
//
|
|
74
|
-
let
|
|
75
|
-
if (
|
|
73
|
+
// Fragment-based recall via involves/view permission
|
|
74
|
+
let fragmentResults = [];
|
|
75
|
+
if (backend.getFragmentsByIds) {
|
|
76
76
|
try {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
// Determine the person to search as
|
|
78
|
+
let personSubject;
|
|
79
|
+
if (subject.type === "person") {
|
|
80
|
+
// Direct person search — look up fragments they can view
|
|
81
|
+
personSubject = subject;
|
|
82
|
+
}
|
|
83
|
+
else if (subject.type === "agent") {
|
|
84
|
+
// Agent search — resolve owner identity first
|
|
85
|
+
const ownerId = await lookupAgentOwner(spicedb, subject.id, token);
|
|
86
|
+
if (ownerId) {
|
|
87
|
+
personSubject = { type: "person", id: ownerId };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (personSubject) {
|
|
91
|
+
const viewableIds = await lookupViewableFragments(spicedb, personSubject, token);
|
|
81
92
|
if (viewableIds.length > 0) {
|
|
82
93
|
const groupResultIds = new Set(groupResults.map((r) => r.uuid));
|
|
83
94
|
const newIds = viewableIds.filter((id) => !groupResultIds.has(id));
|
|
84
95
|
if (newIds.length > 0) {
|
|
85
|
-
|
|
96
|
+
fragmentResults = await backend.getFragmentsByIds(newIds);
|
|
86
97
|
}
|
|
87
98
|
}
|
|
88
|
-
if (
|
|
89
|
-
console.log(` + ${
|
|
99
|
+
if (fragmentResults.length > 0) {
|
|
100
|
+
console.log(` + ${fragmentResults.length} result(s) via involves (${personSubject.type}:${personSubject.id})`);
|
|
90
101
|
}
|
|
91
102
|
}
|
|
92
103
|
}
|
|
93
104
|
catch {
|
|
94
|
-
//
|
|
105
|
+
// Fragment lookup failed — proceed with group results only
|
|
95
106
|
}
|
|
96
107
|
}
|
|
97
|
-
const allResults = [...groupResults, ...
|
|
108
|
+
const allResults = [...groupResults, ...fragmentResults];
|
|
98
109
|
if (allResults.length === 0) {
|
|
99
110
|
console.log("No results found.");
|
|
100
111
|
return;
|
package/package.json
CHANGED