claude-memory-layer 2.2.2 → 2.2.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/mcp/index.js CHANGED
@@ -30870,6 +30870,26 @@ ${text}`;
30870
30870
  }
30871
30871
 
30872
30872
  // src/extensions/mcp/handlers.ts
30873
+ var autoProjectPathCache;
30874
+ function resolveAutoProjectPath() {
30875
+ const cwd = process.cwd();
30876
+ if (autoProjectPathCache?.cwd === cwd) return autoProjectPathCache.resolved;
30877
+ let resolved = null;
30878
+ try {
30879
+ if (existsSync10(path15.join(getProjectStoragePath(cwd), "events.sqlite"))) {
30880
+ resolved = cwd;
30881
+ }
30882
+ } catch {
30883
+ }
30884
+ autoProjectPathCache = { cwd, resolved };
30885
+ return resolved;
30886
+ }
30887
+ function withAutoProjectPath(args) {
30888
+ if (hasSuppliedArg(args, "projectPath")) return args;
30889
+ const autoPath = resolveAutoProjectPath();
30890
+ if (!autoPath) return args;
30891
+ return { ...args, projectPath: autoPath };
30892
+ }
30873
30893
  function resolveMemoryService(args) {
30874
30894
  const projectPath = typeof args.projectPath === "string" ? args.projectPath.trim() : "";
30875
30895
  if (projectPath.length > 0) {
@@ -30897,11 +30917,12 @@ function validateMemContextPackPerspectiveArgs(args) {
30897
30917
  requiredOperationString(args.observerActorId, "observerActorId");
30898
30918
  requiredOperationString(args.targetActorId ?? args.observedActorId, "targetActorId");
30899
30919
  }
30900
- async function handleToolCall(name, args) {
30920
+ async function handleToolCall(name, rawArgs) {
30901
30921
  try {
30902
30922
  if (name === "external-market-context") {
30903
- return await handleExternalMarketContext(args);
30923
+ return await handleExternalMarketContext(rawArgs);
30904
30924
  }
30925
+ const args = withAutoProjectPath(rawArgs);
30905
30926
  if (name === "mem-context-pack" && hasMemContextPackPerspectiveArgs(args)) {
30906
30927
  validateMemContextPackPerspectiveArgs(args);
30907
30928
  }
@@ -31496,7 +31517,9 @@ async function handlePerspectiveObservationDelete(context, args) {
31496
31517
  function requiredProjectPath(args) {
31497
31518
  const projectPath = optionalString(args.projectPath);
31498
31519
  if (!projectPath || !isAbsoluteProjectPath(projectPath)) {
31499
- throw new Error("memory operation tools require an explicit absolute projectPath");
31520
+ throw new Error(
31521
+ `memory operation tools require an explicit absolute projectPath (no memory store exists for the server working directory "${process.cwd()}")`
31522
+ );
31500
31523
  }
31501
31524
  return projectPath;
31502
31525
  }