Spaces:
Configuration error
Configuration error
fix: compat shim for legacy observe callers - map sessionId/cwd to folderPath/agentId
Browse filesFiles changed (2)
293 unmodified lines294295296297298297298299300301302303304305306307308309310311312313314315316317318319320321293 unmodified lines folder_path = args.get("folderPath") agent_id = args.get("agentId") text = args.get("text") or args.get("content") or "" if not folder_path or not agent_id or not text: return jsonify({"error": "folderPath, agentId, and text are required"}), 400
# Compat shim: old plugin scripts send sessionId/project/cwd instead of # folderPath/agentId. Map them across so legacy callers keep working. if not folder_path: # Use cwd first, then project, then a sensible default folder_path = ( args.get("cwd") or args.get("project") or os.getenv("AGENTMEMORY_CWD") or "/unknown" ) if not agent_id: agent_id = ( args.get("sessionId") or functions.get_agent_id() or os.getenv("AGENT_ID") or "agent" )
if not text: return jsonify({"error": "text (or content) is required"}), 400
timestamp = args.get("timestamp") or _datetime_now_iso() payload = { "folderPath": folder_path,60 unmodified lines6162636465666768697071727374757677787980818260 unmodified lines agent_id = body.get("agentId") text = body.get("text") or body.get("content") or ""
# Compat shim: old clients send sessionId/project/cwd — map to folder model. if not folder_path: folder_path = ( body.get("cwd") or body.get("project") or os.getenv("AGENTMEMORY_CWD") or "/unknown" ) if not agent_id: agent_id = ( body.get("sessionId") or functions.get_agent_id() or os.getenv("AGENT_ID") or "agent" )
if folder_path and agent_id: # New folder-based model — delegate to folder_observe payload = {src/routes/mcp.py+22-2
src/routes/observations.py+16