@memoryrelay/plugin-memoryrelay-ai 0.12.2 → 0.12.3

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 (2) hide show
  1. package/index.ts +17 -3
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -790,12 +790,26 @@ class MemoryRelayClient {
790
790
  tier?: string;
791
791
  },
792
792
  ): Promise<Memory> {
793
- return this.request<Memory>("POST", "/v1/memories", {
793
+ // Extract session_id from metadata if present and move to top-level
794
+ const { session_id, ...cleanMetadata } = metadata || {};
795
+
796
+ const payload: any = {
794
797
  content,
795
- metadata,
796
798
  agent_id: this.agentId,
797
799
  ...options,
798
- });
800
+ };
801
+
802
+ // Only include metadata if there's something left after extracting session_id
803
+ if (Object.keys(cleanMetadata).length > 0) {
804
+ payload.metadata = cleanMetadata;
805
+ }
806
+
807
+ // Add session_id as top-level parameter if provided
808
+ if (session_id) {
809
+ payload.session_id = session_id;
810
+ }
811
+
812
+ return this.request<Memory>("POST", "/v1/memories", payload);
799
813
  }
800
814
 
801
815
  async search(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memoryrelay/plugin-memoryrelay-ai",
3
- "version": "0.12.2",
3
+ "version": "0.12.3",
4
4
  "description": "OpenClaw memory plugin for MemoryRelay API - sessions, decisions, patterns, projects & semantic search",
5
5
  "type": "module",
6
6
  "main": "index.ts",