memory-privacy 1.8.0 → 1.9.0
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/index.ts +7 -1
- package/package.json +1 -1
- package/route.ts +12 -5
package/index.ts
CHANGED
|
@@ -125,7 +125,7 @@ export default {
|
|
|
125
125
|
const log = getLogger(api);
|
|
126
126
|
const defaultWorkspaceDir = resolveDefaultWorkspaceDir(api);
|
|
127
127
|
|
|
128
|
-
log.info(`[memory-privacy] defaultWorkspaceDir: ${defaultWorkspaceDir}`);
|
|
128
|
+
log.info(`[memory-privacy] defaultWorkspaceDir: ${defaultWorkspaceDir} (agent-specific workspaces enabled)`);
|
|
129
129
|
|
|
130
130
|
api.on(
|
|
131
131
|
"before_tool_call",
|
|
@@ -150,6 +150,9 @@ export default {
|
|
|
150
150
|
if (route.agentIdSource === "default" && route.workspaceSource === "default") {
|
|
151
151
|
log.warn("[memory-privacy] Falling back to default agent workspace for write routing.");
|
|
152
152
|
}
|
|
153
|
+
log.info(
|
|
154
|
+
`[memory-privacy] write: agentId=${route.agentId} workspace=${route.workspaceDir} file=${filePath}`,
|
|
155
|
+
);
|
|
153
156
|
|
|
154
157
|
const normalizedFilePath = normalizePathForMatch(filePath);
|
|
155
158
|
if (endsWithPathSuffix(filePath, "memory.md")) {
|
|
@@ -331,6 +334,9 @@ export default {
|
|
|
331
334
|
|
|
332
335
|
api.on("agent_end", (event: AgentEndEvent, ctx: RouteContextLike) => {
|
|
333
336
|
const { route, identity } = resolveRequestState(api, ctx);
|
|
337
|
+
log.info(
|
|
338
|
+
`[memory-privacy] agent_end: agentId=${route.agentId} workspaceDir=${route.workspaceDir} agentIdSource=${route.agentIdSource} workspaceSource=${route.workspaceSource}`,
|
|
339
|
+
);
|
|
334
340
|
const messages = event.messages ?? [];
|
|
335
341
|
|
|
336
342
|
const lastUserMsg = [...messages].reverse().find((message) => message.role === "user");
|
package/package.json
CHANGED
package/route.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
|
|
1
3
|
const DEFAULT_AGENT_ID = "main";
|
|
2
4
|
|
|
3
5
|
export interface MemoryPrivacyPluginApi {
|
|
@@ -129,13 +131,18 @@ export function parsePalzSessionTail(
|
|
|
129
131
|
return {};
|
|
130
132
|
}
|
|
131
133
|
|
|
132
|
-
export function resolveDefaultWorkspaceDir(api: MemoryPrivacyPluginApi): string {
|
|
133
|
-
|
|
134
|
+
export function resolveDefaultWorkspaceDir(api: MemoryPrivacyPluginApi, agentId?: string): string {
|
|
135
|
+
const baseDir =
|
|
134
136
|
api.runtime?.config?.agents?.defaults?.workspace ??
|
|
135
137
|
api.config?.agents?.defaults?.workspace ??
|
|
136
138
|
process.env.OPENCLAW_WORKSPACE ??
|
|
137
|
-
process.cwd()
|
|
138
|
-
|
|
139
|
+
process.cwd();
|
|
140
|
+
|
|
141
|
+
if (agentId && agentId !== DEFAULT_AGENT_ID) {
|
|
142
|
+
return path.join(baseDir, "agents", agentId);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return baseDir;
|
|
139
146
|
}
|
|
140
147
|
|
|
141
148
|
export function resolveRouteContext(
|
|
@@ -173,7 +180,7 @@ export function resolveRouteContext(
|
|
|
173
180
|
|
|
174
181
|
return {
|
|
175
182
|
agentId,
|
|
176
|
-
workspaceDir: resolveDefaultWorkspaceDir(api),
|
|
183
|
+
workspaceDir: resolveDefaultWorkspaceDir(api, agentId),
|
|
177
184
|
sessionKey,
|
|
178
185
|
agentIdSource: explicitAgentId ? "context" : parsedSession?.agentId ? "session" : "default",
|
|
179
186
|
workspaceSource: "default",
|