memory-privacy 1.8.0 → 1.10.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.
Files changed (3) hide show
  1. package/index.ts +7 -1
  2. package/package.json +1 -1
  3. package/route.ts +9 -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memory-privacy",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "files": [
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,15 @@ export function parsePalzSessionTail(
129
131
  return {};
130
132
  }
131
133
 
132
- export function resolveDefaultWorkspaceDir(api: MemoryPrivacyPluginApi): string {
133
- return (
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
+ const effectiveAgentId = agentId || DEFAULT_AGENT_ID;
142
+ return path.join(baseDir, `workspace_${effectiveAgentId}`);
139
143
  }
140
144
 
141
145
  export function resolveRouteContext(
@@ -173,7 +177,7 @@ export function resolveRouteContext(
173
177
 
174
178
  return {
175
179
  agentId,
176
- workspaceDir: resolveDefaultWorkspaceDir(api),
180
+ workspaceDir: resolveDefaultWorkspaceDir(api, agentId),
177
181
  sessionKey,
178
182
  agentIdSource: explicitAgentId ? "context" : parsedSession?.agentId ? "session" : "default",
179
183
  workspaceSource: "default",